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
Exemplo n.º 2
0
    def _apply_corrections(self, w, target='sample'):
        """
        Apply a series of corrections and normalizations to the input
        workspace

        Parameters
        ----------
        w: Mantid.EventsWorkspace
            Input workspace
        target: str
            Specify the entity the workspace refers to. Valid options are
            'sample', 'background', and 'vanadium'

        Returns
        -------
        Mantid.EventsWorkspace
        """
        MaskDetectors(w, MaskedWorkspace=self._t_mask)
        _t_corr = ModeratorTzeroLinear(w)  # delayed emission from moderator
        _t_corr = self.add_previous_pulse(_t_corr)
        _t_corr = ConvertUnits(_t_corr, Target='Wavelength', Emode='Elastic')
        l_s, l_e = self._wavelength_band[0], self._wavelength_band[1]
        _t_corr = CropWorkspace(_t_corr, XMin=l_s, XMax=l_e)
        _t_corr = Rebin(_t_corr,
                        Params=[l_s, self._wavelength_dl, l_e],
                        PreserveEvents=False)
        if self.getProperty('MonitorNormalization').value is True:
            _t_corr = self._monitor_normalization(_t_corr, target)
        return _t_corr
 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
Exemplo n.º 6
0
 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 = LoadEventNexus(Filename=self._makeRunFile(run_number),
                         NXentryName='entry-diff',
                         OutputWorkspace=name)
     ws = ModeratorTzeroLinear(InputWorkspace=ws.name(),
                               OutputWorkspace=ws.name())
     file_name = self._spawn_tempnexus()
     SaveNexus(ws, file_name)
     return file_name
Exemplo n.º 7
0
    def _apply_corrections(self, w, target='sample'):
        """
        Apply a series of corrections and normalizations to the input
        workspace

        Parameters
        ----------
        w: Mantid.EventsWorkspace
            Input workspace
        target: str
            Specify the entity the workspace refers to. Valid options are
            'sample', 'background', and 'vanadium'

        Returns
        -------
        Mantid.EventsWorkspace
        """
        MaskDetectors(w, MaskedWorkspace=self._t_mask)
        local_name = tws('corr')
        _t_corr = ModeratorTzeroLinear(w,
                                       Gradient=self._tzero['gradient'],
                                       Intercept=self._tzero['intercept'],
                                       OutputWorkspace=local_name)
        # Correct old DAS shift of fast neutrons. See GitHub issue 23855
        if self._das_version == VDAS.v1900_2018:
            _t_corr = self.add_previous_pulse(_t_corr)

        _t_corr = ConvertUnits(_t_corr,
                               Target='Wavelength',
                               Emode='Elastic',
                               OutputWorkspace=local_name)
        l_s, l_e = self._wavelength_band[0], self._wavelength_band[1]
        _t_corr = CropWorkspace(_t_corr,
                                XMin=l_s,
                                XMax=l_e,
                                OutputWorkspace=local_name)
        _t_corr = Rebin(_t_corr,
                        Params=[l_s, self._wavelength_dl, l_e],
                        PreserveEvents=False,
                        OutputWorkspace=local_name)

        if self.getProperty('DoFluxNormalization').value is True:
            _t_corr = self._flux_normalization(_t_corr, target)
        RenameWorkspace(_t_corr, OutputWorkspace=w.name())
        return _t_corr
Exemplo n.º 8
0
 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 = LoadEventNexus(Filename=self._makeRunFile(run_number),
                         NXentryName='entry-diff',
                         SingleBankPixelsOnly=False,
                         OutputWorkspace=name)
     MaskDetectors(ws, MaskedWorkspace=self._t_mask)
     ws = ModeratorTzeroLinear(InputWorkspace=ws.name(),
                               OutputWorkspace=ws.name())
     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