def _calibData(self, sam_ws, mon_ws): sapi.MaskDetectors(Workspace=sam_ws, DetectorList=self._dMask) sapi.ModeratorTzeroLinear(InputWorkspace=sam_ws, OutputWorkspace=sam_ws) sapi.LoadParameterFile(Workspace=sam_ws, Filename=pjoin(DEFAULT_CONFIG_DIR, self._reflection["parameter_file"])) sapi.ConvertUnits(InputWorkspace=sam_ws, OutputWorkspace=sam_ws, Target='Wavelength', EMode='Indirect') if self._MonNorm: sapi.ModeratorTzeroLinear(InputWorkspace=mon_ws, OutputWorkspace=mon_ws) sapi.Rebin(InputWorkspace=mon_ws, OutputWorkspace=mon_ws, Params='10') sapi.ConvertUnits(InputWorkspace=mon_ws, OutputWorkspace=mon_ws, Target='Wavelength') sapi.OneMinusExponentialCor(InputWorkspace=mon_ws, OutputWorkspace=mon_ws, C='0.20749999999999999', C1='0.001276') sapi.Scale(InputWorkspace=mon_ws, OutputWorkspace=mon_ws, Factor='1e-06') sapi.RebinToWorkspace(WorkspaceToRebin=sam_ws, WorkspaceToMatch=mon_ws, OutputWorkspace=sam_ws) sapi.Divide(LHSWorkspace=sam_ws, RHSWorkspace=mon_ws, OutputWorkspace=sam_ws)
def _calibData(self, sam_ws, mon_ws): api.MaskDetectors(Workspace=sam_ws, DetectorList=self._dMask) #MaskedWorkspace='BASIS_MASK') api.ModeratorTzeroLinear(InputWorkspace=sam_ws,\ OutputWorkspace=sam_ws) api.LoadParameterFile(Workspace=sam_ws, Filename=config.getInstrumentDirectory() + 'BASIS_silicon_111_Parameters.xml') api.ConvertUnits(InputWorkspace=sam_ws, OutputWorkspace=sam_ws, Target='Wavelength', EMode='Indirect') if not self._noMonNorm: api.ModeratorTzeroLinear(InputWorkspace=mon_ws,\ OutputWorkspace=mon_ws) api.Rebin(InputWorkspace=mon_ws, OutputWorkspace=mon_ws, Params='10') api.ConvertUnits(InputWorkspace=mon_ws, OutputWorkspace=mon_ws, Target='Wavelength') api.OneMinusExponentialCor(InputWorkspace=mon_ws, OutputWorkspace=mon_ws, C='0.20749999999999999', C1='0.001276') api.Scale(InputWorkspace=mon_ws, OutputWorkspace=mon_ws, Factor='9.9999999999999995e-07') api.RebinToWorkspace(WorkspaceToRebin=sam_ws, WorkspaceToMatch=mon_ws, OutputWorkspace=sam_ws) api.Divide(LHSWorkspace=sam_ws, RHSWorkspace=mon_ws, OutputWorkspace=sam_ws)
def _generate_flux_spectrum(self, run_set, sam_ws): r""" Retrieve the aggregate flux and create an spectrum of intensities versus wavelength such that intensities will be similar for any of the possible flux normalization types. Parameters ---------- sam_ws: str Name of aggregated sample workspace Returns ------- str Name of aggregated flux workspace (output workspace) """ flux_binning = [1.5, 0.0005, 7.5] # wavelength binning suffix = re.sub('[^0-9a-zA-Z]+', '_', self._flux_normalization_type) flux_ws = tws(self._make_run_name(run_set[0]) + '_' + suffix) if self._MonNorm: self._sum_monitors(run_set, flux_ws) rpf = self._elucidate_reflection_parameter_file(sam_ws) sapi.LoadParameterFile(Workspace=flux_ws, Filename=rpf) sapi.ModeratorTzeroLinear(InputWorkspace=flux_ws, OutputWorkspace=flux_ws) sapi.Rebin(InputWorkspace=flux_ws, OutputWorkspace=flux_ws, Params='10', # 10 microseconds TOF bin width PreserveEvents=False) sapi.ConvertUnits(InputWorkspace=flux_ws, OutputWorkspace=flux_ws, Target='Wavelength') sapi.OneMinusExponentialCor(InputWorkspace=flux_ws, OutputWorkspace=flux_ws, C='0.20749999999999999', C1='0.001276') sapi.Scale(InputWorkspace=flux_ws, OutputWorkspace=flux_ws, Factor='1e-06') sapi.Rebin(InputWorkspace=flux_ws, OutputWorkspace=flux_ws, Params=flux_binning) else: ws = mtd[sam_ws].getRun() if self._flux_normalization_type == 'Proton Charge': aggregate_flux = ws.getProtonCharge() elif self._flux_normalization_type == 'Duration': aggregate_flux = ws.getProperty('duration').value # These factors ensure intensities typical of flux workspaces # derived from monitor data f = {'Proton Charge': 0.00874, 'Duration': 0.003333} x = np.arange(flux_binning[0], flux_binning[2], flux_binning[1]) y = f[self._flux_normalization_type] * \ aggregate_flux * np.ones(len(x) - 1) _flux_ws = sapi.CreateWorkspace(OutputWorkspace=flux_ws, DataX=x, DataY=y, UnitX='Wavelength') _flux_ws.setYUnit(mtd[sam_ws].YUnit()) return flux_ws