コード例 #1
0
ファイル: analysisHelpers.py プロジェクト: gemmaguest/mantid
def correct_for_gamma_background(ws_name,first_spectrum,last_spectrum, sample_properties, g_log):
    g_log.debug( "Evaluating the Gamma Background Correction.")
    gamma_background_correction=sapi.CloneWorkspace(ws_name)
    for spec in range(first_spectrum,last_spectrum+1):
        ws_index=gamma_background_correction.getIndexFromSpectrumNumber(spec)
        tmp_bkg, tmp_cor = sapi.VesuvioCalculateGammaBackground(
            InputWorkspace=ws_name,ComptonFunction=sample_properties, WorkspaceIndexList=ws_index)
        for bin in range(gamma_background_correction.blocksize()):
            gamma_background_correction.dataY(ws_index)[bin]=tmp_bkg.dataY(0)[bin]
            gamma_background_correction.dataE(ws_index)[bin]=0.
    sapi.RenameWorkspace(InputWorkspace= "gamma_background_correction", OutputWorkspace = str(ws_name)+"_gamma_background")
    safe_delete_ws("tmp_cor")
    safe_delete_ws("tmp_bkg")
    return
コード例 #2
0
    def _gamma_correction(self):
        correction_background_ws = str(
            self._correction_wsg) + "_GammaBackground"

        fit_opts = parse_fit_options(
            mass_values=self._masses,
            profile_strs=self.getProperty("MassProfiles").value,
            constraints_str=self.getProperty("IntensityConstraints").value)
        params_dict = TableWorkspaceDictionaryFacade(
            self.getProperty("FitParameters").value)
        func_str = fit_opts.create_function_str(params_dict)

        ms.VesuvioCalculateGammaBackground(
            InputWorkspace=self._output_ws,
            ComptonFunction=func_str,
            BackgroundWorkspace=correction_background_ws,
            CorrectedWorkspace='__corrected_dummy')
        ms.DeleteWorkspace('__corrected_dummy')

        return correction_background_ws