def PyExec(self): """Execute the data collection workflow.""" progress = Progress(self, 0.0, 1.0, 9) self._report = utils.Report() self._subalgLogging = self.getProperty( common.PROP_SUBALG_LOGGING).value == common.SUBALG_LOGGING_ON namePrefix = self.getProperty(common.PROP_OUTPUT_WS).valueAsStr cleanupMode = self.getProperty(common.PROP_CLEANUP_MODE).value self._cleanup = utils.Cleanup(cleanupMode, self._subalgLogging) self._names = utils.NameSource(namePrefix, cleanupMode) # The variables 'mainWS' and 'monWS shall hold the current main # data throughout the algorithm. # Get input workspace. progress.report('Loading inputs') mainWS = self._inputWS() # Extract monitors to a separate workspace. progress.report('Extracting monitors') mainWS, monWS = self._separateMons(mainWS) # Save the main workspace for later use, if needed. rawWS = None if not self.getProperty(common.PROP_OUTPUT_RAW_WS).isDefault: rawWS = mainWS self._cleanup.protect(rawWS) # Normalisation to monitor/time, if requested. progress.report('Normalising to monitor/time') monWS = self._flatBkgMon(monWS) monEPPWS = self._createEPPWSMon(monWS) mainWS = self._normalize(mainWS, monWS, monEPPWS) # Time-independent background. progress.report('Calculating backgrounds') mainWS = self._flatBkgDet(mainWS) # Calibrate incident energy, if requested. progress.report('Calibrating incident energy') mainWS, monWS = self._calibrateEi(mainWS, monWS, monEPPWS) self._cleanup.cleanup(monWS, monEPPWS) # Add the Ei as Efixed instrument parameter _addEfixedInstrumentParameter(mainWS) progress.report('Correcting TOF') mainWS = self._correctTOFAxis(mainWS) self._outputRaw(mainWS, rawWS) # Find elastic peak positions. progress.report('Calculating EPPs') self._outputDetEPPWS(mainWS) self._finalize(mainWS) progress.report('Done')
def PyExec(self): """Executes the data reduction workflow.""" progress = Progress(self, 0.0, 1.0, 9) self._report = utils.Report() self._subalgLogging = self.getProperty( common.PROP_SUBALG_LOGGING).value == common.SUBALG_LOGGING_ON wsNamePrefix = self.getProperty(common.PROP_OUTPUT_WS).valueAsStr cleanupMode = self.getProperty(common.PROP_CLEANUP_MODE).value self._names = utils.NameSource(wsNamePrefix, cleanupMode) self._cleanup = utils.Cleanup(cleanupMode, self._subalgLogging) # The variables 'mainWS' and 'monWS shall hold the current main # data throughout the algorithm. # Get input workspace. progress.report('Loading inputs') mainWS = self._inputWS() progress.report('Applying diagnostics') mainWS = self._applyDiagnostics(mainWS) # Vanadium normalization. progress.report('Normalising to vanadium') mainWS = self._normalizeToVana(mainWS) # Convert units from TOF to energy. progress.report('Converting to energy') mainWS = self._convertTOFToDeltaE(mainWS) # KiKf conversion. mainWS = self._correctByKiKf(mainWS) # Rebinning. progress.report('Rebinning in energy') mainWS = self._rebinInW(mainWS) # Divide the energy transfer workspace by bin widths. mainWS = self._convertToDistribution(mainWS) # Detector efficiency correction. progress.report('Correcting detector efficiency') mainWS = self._correctByDetectorEfficiency(mainWS) progress.report('Grouping detectors') mainWS = self._groupDetectors(mainWS) self._outputWSConvertedToTheta(mainWS) progress.report('Converting to q') mainWS = self._sOfQW(mainWS) mainWS = self._transpose(mainWS) self._finalize(mainWS) progress.report('Done')
def PyExec(self): """Executes the data reduction workflow.""" progress = Progress(self, 0.0, 1.0, 7) self._report = utils.Report() self._subalgLogging = self.getProperty( common.PROP_SUBALG_LOGGING).value == common.SUBALG_LOGGING_ON wsNamePrefix = self.getProperty(common.PROP_OUTPUT_WS).valueAsStr cleanupMode = self.getProperty(common.PROP_CLEANUP_MODE).value self._names = utils.NameSource(wsNamePrefix, cleanupMode) self._cleanup = utils.Cleanup(cleanupMode, self._subalgLogging) progress.report('Loading inputs') mainWS = self._inputWS() maskWSName = self._names.withSuffix('combined_mask') maskWS = _createMaskWS(mainWS, maskWSName, self._subalgLogging) self._cleanup.cleanupLater(maskWS) reportWS = None if not self.getProperty( common.PROP_OUTPUT_DIAGNOSTICS_REPORT_WS).isDefault: reportWSName = self.getProperty( common.PROP_OUTPUT_DIAGNOSTICS_REPORT_WS).valueAsStr reportWS = _createDiagnosticsReportTable( reportWSName, mainWS.getNumberHistograms(), self._subalgLogging) progress.report('Loading default mask') defaultMaskWS = self._defaultMask(mainWS) defaultMaskedSpectra = set() if defaultMaskWS is not None: defaultMaskedSpectra = _reportDefaultMask(reportWS, defaultMaskWS) maskWS = Plus(LHSWorkspace=maskWS, RHSWorkspace=defaultMaskWS, EnableLogging=self._subalgLogging) self._cleanup.cleanup(defaultMaskWS) progress.report('User-defined mask') userMaskWS = self._userMask(mainWS) maskWS = Plus(LHSWorkspace=maskWS, RHSWorkspace=userMaskWS, EnableLogging=self._subalgLogging) self._cleanup.cleanup(userMaskWS) beamStopMaskedSpectra = set() if self._beamStopDiagnosticsEnabled(mainWS): progress.report('Diagnosing beam stop') beamStopMaskWS = self._beamStopDiagnostics(mainWS, maskWS) beamStopMaskedSpectra = _reportBeamStopMask( reportWS, beamStopMaskWS) maskWS = Plus(LHSWorkspace=maskWS, RHSWorkspace=beamStopMaskWS, EnableLogging=self._subalgLogging) self._cleanup.cleanup(beamStopMaskWS) bkgMaskedSpectra = set() if self._bkgDiagnosticsEnabled(mainWS): progress.report('Diagnosing backgrounds') bkgMaskWS, bkgWS = self._bkgDiagnostics(mainWS) bkgMaskedSpectra = _reportBkgDiagnostics(reportWS, bkgWS, bkgMaskWS) maskWS = Plus(LHSWorkspace=maskWS, RHSWorkspace=bkgMaskWS, EnableLogging=self._subalgLogging) self._cleanup.cleanup(bkgMaskWS) self._cleanup.cleanup(bkgWS) peakMaskedSpectra = set() if self._peakDiagnosticsEnabled(mainWS): progress.report('Diagnosing peaks') peakMaskWS, peakIntensityWS = self._peakDiagnostics(mainWS) peakMaskedSpectra = _reportPeakDiagnostics(reportWS, peakIntensityWS, peakMaskWS) maskWS = Plus(LHSWorkspace=maskWS, RHSWorkspace=peakMaskWS, EnableLogging=self._subalgLogging) self._cleanup.cleanup(peakMaskWS) self._cleanup.cleanup(peakIntensityWS) self._outputReports(reportWS, defaultMaskedSpectra, beamStopMaskedSpectra, peakMaskedSpectra, bkgMaskedSpectra) self._finalize(maskWS) progress.report('Done')