def PyExec(self): import EnggUtils # Get the run workspace ws = self.getProperty('InputWorkspace').value # Get spectra indices either from bank or direct list of indices, checking for errors bank = self.getProperty('Bank').value spectra = self.getProperty(self.INDICES_PROP_NAME).value indices = EnggUtils.getWsIndicesFromInProperties(ws, bank, spectra) # Leave the data for the bank we are interested in only ws = EnggUtils.cropData(self, ws, indices) # Apply calibration detPos = self.getProperty("DetectorPositions").value if detPos: self._applyCalibration(ws, detPos) # Leave data for the same bank in the vanadium workspace too vanWS = self.getProperty("VanadiumWorkspace").value # if it is raw data (not precalculated curve), needs to be cropped if EnggUtils.vanadiumWorkspaceIsPrecalculated(ws): vanWS = EnggUtils.cropData(self, vanWS, indices) # These corrections rely on ToF<->Dspacing conversions, so they're done after the calibration step vanFittingWS = EnggUtils.applyVanadiumCorrection(self, ws, vanWS, self.getProperty('VanadiumIntegWorkspace').value) # Convert to dSpacing ws = EnggUtils.convertToDSpacing(self, ws) # Sum the values ws = EnggUtils.sumSpectra(self, ws) # Convert back to time of flight ws = EnggUtils.convertToToF(self, ws) # OpenGenie displays distributions instead of pure counts (this is done implicitly when # converting units), so I guess that's what users will expect self._convertToDistr(ws) self.setProperty("OutputWorkspace", ws) # optinally, generate the workspace with per-bank vanadium fitting curves outVanWSName = self.getPropertyValue('OutVanadiumCurveFits') if outVanWSName: mtd[outVanWSName] = vanFittingWS