def PyExec(self): self._loadCharacterizations() charac = "" if mtd.doesExist("characterizations"): charac = "characterizations" # arguments for both AlignAndFocusPowder and AlignAndFocusPowderFromFiles self._alignArgs['OutputWorkspace'] = self.getPropertyValue("OutputWorkspace") self._alignArgs['RemovePromptPulseWidth'] = self.getProperty("RemovePromptPulseWidth").value self._alignArgs['CompressTolerance'] = COMPRESS_TOL_TOF self._alignArgs['PreserveEvents'] = True self._alignArgs['CalFileName'] = self.getProperty("CalibrationFile").value self._alignArgs['Params']=self.getProperty("Binning").value self._alignArgs['ResampleX']=self.getProperty("ResampleX").value self._alignArgs['Dspacing']=True self._alignArgs['CropWavelengthMin'] = self.getProperty('CropWavelengthMin').value self._alignArgs['CropWavelengthMax'] = self.getProperty('CropWavelengthMax').value self._alignArgs['ReductionProperties'] = '__snspowderreduction' wksp = self.getProperty("InputWorkspace").value if wksp is None: # run from file with caching wksp = AlignAndFocusPowderFromFiles(Filename=self.getProperty("Filename").value, CacheDir=self.getProperty("CacheDir").value, MaxChunkSize=self.getProperty("MaxChunkSize").value, FilterBadPulses=self.getProperty("FilterBadPulses").value, Characterizations=charac, FrequencyLogNames=self.getProperty("FrequencyLogNames").value, WaveLengthLogNames=self.getProperty("WaveLengthLogNames").value, **(self._alignArgs)) else: # process the input workspace self.log().information("Using input workspace. Ignoring properties 'Filename', " + "'OutputWorkspace', 'MaxChunkSize', and 'FilterBadPulses'") # get the correct row of the table PDDetermineCharacterizations(InputWorkspace=wksp, Characterizations=charac, ReductionProperties="__snspowderreduction", FrequencyLogNames=self.getProperty("FrequencyLogNames").value, WaveLengthLogNames=self.getProperty("WaveLengthLogNames").value) wksp = AlignAndFocusPowder(InputWorkspace=wksp, **(self._alignArgs)) wksp = NormaliseByCurrent(InputWorkspace=wksp, OutputWorkspace=wksp) wksp.getRun()['gsas_monitor'] = 1 if self._iparmFile is not None: wksp.getRun()['iparm_file'] = self._iparmFile wksp = SetUncertainties(InputWorkspace=wksp, OutputWorkspace=wksp, SetError="sqrtOrOne") SaveGSS(InputWorkspace=wksp, Filename=self.getProperty("PDFgetNFile").value, SplitFiles=False, Append=False, MultiplyByBinWidth=False, Bank=mantid.pmds["__snspowderreduction"]["bank"].value, Format="SLOG", ExtendedHeader=True) self.setProperty("OutputWorkspace", wksp)
def _alignAndFocus(self, filename, wkspname, detCalFilename, withUnfocussed, progStart, progDelta): # create the unfocussed name if withUnfocussed: unfocussed = wkspname.replace('_red', '') unfocussed = unfocussed + '_d' else: unfocussed = '' # process the data if detCalFilename: progEnd = progStart + .45 * progDelta # have to load and override the instrument here Load(Filename=filename, OutputWorkspace=wkspname, startProgress=progStart, endProgress=progEnd) progStart = progEnd progEnd += .45 * progDelta LoadIsawDetCal(InputWorkspace=wkspname, Filename=detCalFilename) AlignAndFocusPowder( InputWorkspace=wkspname, OutputWorkspace=wkspname, UnfocussedWorkspace=unfocussed, # can be empty string startProgress=progStart, endProgress=progEnd, **self.alignAndFocusArgs) progStart = progEnd else: progEnd = progStart + .9 * progDelta # pass all of the work to the child algorithm AlignAndFocusPowderFromFiles( Filename=filename, OutputWorkspace=wkspname, MaxChunkSize=self.chunkSize, UnfocussedWorkspace=unfocussed, # can be empty string startProgress=progStart, endProgress=progEnd, **self.alignAndFocusArgs) progStart = progEnd progEnd = progStart + .1 * progDelta NormaliseByCurrent(InputWorkspace=wkspname, OutputWorkspace=wkspname, startProgress=progStart, endProgress=progEnd) return wkspname, unfocussed
def load(ws_name, input_files, geometry=None, chemical_formula=None, mass_density=None, **align_and_focus_args): AlignAndFocusPowderFromFiles(OutputWorkspace=ws_name, Filename=input_files, Absorption=None, **align_and_focus_args) NormaliseByCurrent(InputWorkspace=ws_name, OutputWorkspace=ws_name, RecalculatePCharge=True) if geometry and chemical_formula and mass_density: set_sample(ws_name, geometry, chemical_formula, mass_density) ConvertUnits(InputWorkspace=ws_name, OutputWorkspace=ws_name, Target="MomentumTransfer", EMode="Elastic") return ws_name