예제 #1
0
    ties = []
    kwargs = {}
    num_spectra = mtd[input_ws].getNumberHistograms()
    for i in range(0, num_spectra):
        multi += comp
        kwargs['WorkspaceIndex_' + str(i)] = i

        if i > 0:
            kwargs['InputWorkspace_' + str(i)] = input_ws

            # tie beta for every spectrum
            for stretched_index in stretched_indices:
                ties.append('f{0}.f{1}.Stretching=f0.f{1}.Stretching'.format(i, stretched_index))

    ties = ','.join(ties)
    multi += 'ties=(' + ties + ')'

    return multi, kwargs


def _find_indices_of_stretched_exponentials(composite):
    indices = []

    for index in range(0, len(composite)):
        if composite.getFunction(index).name() == "StretchExp":
            indices.append(index)
    return indices


AlgorithmFactory.subscribe(IqtFitMultiple)
예제 #2
0
            'fit_type': self._fit_type,
            'intensities_constrained': self._intensities_constrained,
            'beta_constrained': False
        }

        copy_log_alg = self.createChildAlgorithm("CopyLogs")
        copy_log_alg.setProperty("InputWorkspace", self._input_ws)
        copy_log_alg.setProperty("OutputWorkspace", self._fit_group_name)
        copy_log_alg.execute()
        copy_log_alg.setProperty("InputWorkspace", self._input_ws)
        copy_log_alg.setProperty("OutputWorkspace", self._result_ws.getName())
        copy_log_alg.execute()

        log_names = [item for item in sample_logs]
        log_values = [sample_logs[item] for item in sample_logs]

        add_sample_log_multi = self.createChildAlgorithm(
            "AddSampleLogMultiple")
        add_sample_log_multi.setProperty("Workspace",
                                         self._result_ws.getName())
        add_sample_log_multi.setProperty("LogNames", log_names)
        add_sample_log_multi.setProperty("LogValues", log_values)
        add_sample_log_multi.execute()
        add_sample_log_multi.setProperty("Workspace", self._fit_group_name)
        add_sample_log_multi.setProperty("LogNames", log_names)
        add_sample_log_multi.setProperty("LogValues", log_values)
        add_sample_log_multi.execute()


AlgorithmFactory.subscribe(IqtFitSequential)
예제 #3
0
        """
        Copy the sample logs from the input workspace and add them to the output workspaces
        """

        sample_logs = {'start_x': self._start_x, 'end_x': self._end_x, 'fit_type': self._fit_type,
                       'intensities_constrained': self._intensities_constrained, 'beta_constrained': False}

        copy_log_alg = self.createChildAlgorithm("CopyLogs", enableLogging=False)
        copy_log_alg.setProperty("InputWorkspace", self._input_ws)
        copy_log_alg.setProperty("OutputWorkspace", self._fit_group_name)
        copy_log_alg.execute()
        copy_log_alg.setProperty("InputWorkspace", self._input_ws)
        copy_log_alg.setProperty("OutputWorkspace", self._result_ws.name())
        copy_log_alg.execute()

        log_names = [item for item in sample_logs]
        log_values = [sample_logs[item] for item in sample_logs]

        add_sample_log_multi = self.createChildAlgorithm("AddSampleLogMultiple", enableLogging=False)
        add_sample_log_multi.setProperty("Workspace", self._result_ws.name())
        add_sample_log_multi.setProperty("LogNames", log_names)
        add_sample_log_multi.setProperty("LogValues", log_values)
        add_sample_log_multi.execute()
        add_sample_log_multi.setProperty("Workspace", self._fit_group_name)
        add_sample_log_multi.setProperty("LogNames", log_names)
        add_sample_log_multi.setProperty("LogValues", log_values)
        add_sample_log_multi.execute()


AlgorithmFactory.subscribe(IqtFitSequential)
예제 #4
0
        self.declareProperty(name="TimeMax", defaultValue=0.2, validator=FloatMandatoryValidator(),
                             doc="Multiplicative scale factor")
        self.declareProperty(name='Plot', defaultValue='None', validator=StringListValidator(['None', 'Intensity', 'Tau', 'Beta', 'All']),
                             doc='Switch Plot Off/On')

    def PyExec(self):
        from IndirectDataAnalysis import furyfitMult

        workdir = config['defaultsave.directory']
        inType = self.getProperty('InputType').value
        prefix = self.getProperty('Instrument').value
        ana = self.getProperty('Analyser').value
        RunNumb = self.getProperty('RunNumber').value
        xMax = self.getProperty('TimeMax').value
        filename = prefix + str(RunNumb) + '_' + ana
        plotOp = self.getProperty('Plot').value
        inWS = filename + '_iqt'
        if inType == 'File':
            spath = os.path.join(workdir, inWS + '.nxs')  # path name for sample nxs file
            logger.notice('Input from File : ' + spath)
            LoadNexusProcessed(Filename=spath, OutputWorkspace=inWS)
        else:
            logger.notice('Input from Workspace : ' + inWS)
        CropWorkspace(InputWorkspace=inWS, OutputWorkspace=inWS, XMin=0.0, XMax=xMax)
        function = 'name=LinearBackground,A0=0.02,A1=0,ties=(A1=0);'
        function +=     'name=UserFunction,Formula=Intensity*exp(-(x/Tau)^Beta),Intensity=0.98,Tau=0.02,Beta=0.8'

        furyfitMult(inWS, function, 'SSSS', 0.0, 0.2, False, plotOp, True)

AlgorithmFactory.subscribe(FuryFitMultiple)
예제 #5
0
    def PyExec(self):
        from IndirectDataAnalysis import furyfitMult

        workdir = config['defaultsave.directory']
        inType = self.getProperty('InputType').value
        prefix = self.getProperty('Instrument').value
        ana = self.getProperty('Analyser').value
        RunNumb = self.getProperty('RunNumber').value
        xMax = self.getProperty('TimeMax').value
        filename = prefix + str(RunNumb) + '_' + ana
        plotOp = self.getProperty('Plot').value
        inWS = filename + '_iqt'
        if inType == 'File':
            spath = os.path.join(workdir, inWS +
                                 '.nxs')  # path name for sample nxs file
            logger.notice('Input from File : ' + spath)
            LoadNexusProcessed(Filename=spath, OutputWorkspace=inWS)
        else:
            logger.notice('Input from Workspace : ' + inWS)
        CropWorkspace(InputWorkspace=inWS,
                      OutputWorkspace=inWS,
                      XMin=0.0,
                      XMax=xMax)
        function = 'name=LinearBackground,A0=0.02,A1=0,ties=(A1=0);'
        function += 'name=UserFunction,Formula=Intensity*exp(-(x/Tau)^Beta),Intensity=0.98,Tau=0.02,Beta=0.8'

        furyfitMult(inWS, function, 'SSSS', 0.0, 0.2, False, plotOp, True)


AlgorithmFactory.subscribe(FuryFitMultiple)