def _mask_t0_crop(self, run_number, name):
     """
     Load a run into a workspace with:
      1. Masked detectors
      2. Delayed emission time from  moderator removed
      3. Conversion of units to momentum
      4. Remove events outside the valid momentum range
     :param run_number: BASIS run number
     :param name: name for the output workspace
     :return: workspace object
     """
     ws = self._load_single_run(run_number, name)
     MaskDetectors(ws, MaskedWorkspace=self._t_mask)
     ws = ModeratorTzeroLinear(InputWorkspace=ws.name(),
                               Gradient=self._tzero['gradient'],
                               Intercept=self._tzero['intercept'],
                               OutputWorkspace=ws.name())
     # Correct old DAS shift of fast neutrons. See GitHub issue 23855
     if self._das_version == VDAS.v1900_2018:
         ws = self.add_previous_pulse(ws)
     ws = ConvertUnits(ws, Target='Momentum', OutputWorkspace=ws.name())
     ws = CropWorkspace(ws,
                        OutputWorkspace=ws.name(),
                        XMin=self._momentum_range[0],
                        XMax=self._momentum_range[1])
     return ws
 def _mask_t0_crop(self, run_number, name):
     """
     Load a run into a workspace with:
      1. Masked detectors
      2. Delayed emission time from  moderator removed
      3. Conversion of units to momentum
      4. Remove events outside the valid momentum range
     :param run_number: BASIS run number
     :param name: name for the output workspace
     :return: workspace object
     """
     ws = self._load_single_run(run_number, name)
     MaskDetectors(ws, MaskedWorkspace=self._t_mask)
     ws = ModeratorTzeroLinear(InputWorkspace=ws.name(),
                               Gradient=self._tzero['gradient'],
                               Intercept=self._tzero['intercept'],
                               OutputWorkspace=ws.name())
     # Correct old DAS shift of fast neutrons. See GitHub issue 23855
     if self._das_version == VDAS.v1900_2018:
         ws = self.add_previous_pulse(ws)
     ws = ConvertUnits(ws, Target='Momentum', OutputWorkspace=ws.name())
     ws = CropWorkspace(ws,
                        OutputWorkspace=ws.name(),
                        XMin=self._momentum_range[0],
                        XMax=self._momentum_range[1])
     return ws
 def _save_t0(self, run_number, name='_t_ws'):
     """
     Create temporary events file with delayed emission time from
     moderator removed
     :param run: run number
     :param name: name for the output workspace
     :return: file name of event file with events treated with algorithm
     ModeratorTzeroLinear.
     """
     ws = self._load_single_run(run_number, name)
     ws = ModeratorTzeroLinear(InputWorkspace=ws.name(),
                               Gradient=self._tzero['gradient'],
                               Intercept=self._tzero['intercept'],
                               OutputWorkspace=ws.name())
     # Correct old DAS shift of fast neutrons. See GitHub issue 23855
     if self._das_version == VDAS.v1900_2018:
         ws = self.add_previous_pulse(ws)
     file_name = self._spawn_tempnexus()
     SaveNexus(ws, file_name)
     return file_name
 def _save_t0(self, run_number, name='_t_ws'):
     """
     Create temporary events file with delayed emission time from
     moderator removed
     :param run: run number
     :param name: name for the output workspace
     :return: file name of event file with events treated with algorithm
     ModeratorTzeroLinear.
     """
     ws = self._load_single_run(run_number, name)
     ws = ModeratorTzeroLinear(InputWorkspace=ws.name(),
                               Gradient=self._tzero['gradient'],
                               Intercept=self._tzero['intercept'],
                               OutputWorkspace=ws.name())
     # Correct old DAS shift of fast neutrons. See GitHub issue 23855
     if self._das_version == VDAS.v1900_2018:
         ws = self.add_previous_pulse(ws)
     file_name = self._spawn_tempnexus()
     SaveNexus(ws, file_name)
     return file_name