From c4b846d7392fbc6a3412ff3559c6355ed5eeb1ad Mon Sep 17 00:00:00 2001 From: GuiMacielPereira Date: Wed, 28 Aug 2024 14:35:47 +0100 Subject: [PATCH] Update gamma correction to use updated algorithm Mantid's algorithm for gamma correction was recently updated to correct a bug where output workspaces would not preserve the order of the spectra. Now that this is fixed, we can avoid using a for loop for the gamma correction algorithm. --- src/mvesuvio/analysis_reduction.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/mvesuvio/analysis_reduction.py b/src/mvesuvio/analysis_reduction.py index 3dcf50fe..ea5fd6b0 100644 --- a/src/mvesuvio/analysis_reduction.py +++ b/src/mvesuvio/analysis_reduction.py @@ -995,24 +995,9 @@ def create_gamma_workspaces(self): profiles = self.calcGammaCorrectionProfiles(self._mean_widths, self._mean_intensity_ratios) # Approach below not currently suitable for current versions of Mantid, but will be in the future - # background, corrected = VesuvioCalculateGammaBackground(InputWorkspace=inputWS, ComptonFunction=profiles) - # DeleteWorkspace(corrected) - # RenameWorkspace(InputWorkspace= background, OutputWorkspace = inputWS+"_Gamma_Background") - - ws = CloneWorkspace(InputWorkspace=inputWS, OutputWorkspace="tmpGC") - for spec in range(ws.getNumberHistograms()): - background, corrected = VesuvioCalculateGammaBackground( - InputWorkspace=inputWS, ComptonFunction=profiles, WorkspaceIndexList=spec - ) - ws.dataY(spec)[:], ws.dataE(spec)[:] = ( - background.dataY(0)[:], - background.dataE(0)[:], - ) - DeleteWorkspace(background) + background, corrected = VesuvioCalculateGammaBackground(InputWorkspace=inputWS, ComptonFunction=profiles) DeleteWorkspace(corrected) - RenameWorkspace( - InputWorkspace="tmpGC", OutputWorkspace=inputWS + "_Gamma_Background" - ) + RenameWorkspace(InputWorkspace= background, OutputWorkspace = inputWS + "_Gamma_Background") Scale( InputWorkspace=inputWS + "_Gamma_Background",