当前位置: 首页>>代码示例>>Python>>正文


Python Progress.report方法代码示例

本文整理汇总了Python中mantid.api.Progress.report方法的典型用法代码示例。如果您正苦于以下问题:Python Progress.report方法的具体用法?Python Progress.report怎么用?Python Progress.report使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mantid.api.Progress的用法示例。


在下文中一共展示了Progress.report方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: PyExec

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
    def PyExec(self):
        # Read the state
        state_property_manager = self.getProperty("SANSState").value
        state = create_deserialized_sans_state_from_property_manager(state_property_manager)

        # Run the appropriate SANSLoader and get the workspaces and the workspace monitors
        # Note that cache optimization is only applied to the calibration workspace since it is not available as a
        # return property and it is also something which is most likely not to change between different reductions.
        use_cached = self.getProperty("UseCached").value
        publish_to_ads = self.getProperty("PublishToCache").value

        data = state.data
        progress = self._get_progress_for_file_loading(data)

        # Get the correct SANSLoader from the SANSLoaderFactory
        load_factory = SANSLoadDataFactory()
        loader = load_factory.create_loader(state)

        workspaces, workspace_monitors = loader.execute(data_info=data, use_cached=use_cached,
                                                        publish_to_ads=publish_to_ads, progress=progress,
                                                        parent_alg=self)
        progress.report("Loaded the data.")

        progress_move = Progress(self, start=0.8, end=1.0, nreports=2)
        progress_move.report("Starting to move the workspaces.")
        self._perform_initial_move(workspaces, state)
        progress_move.report("Finished moving the workspaces.")

        # Set output workspaces
        for workspace_type, workspace in workspaces.items():
            self.set_output_for_workspaces(workspace_type, workspace)

        # Set the output monitor workspaces
        for workspace_type, workspace in workspace_monitors.items():
            self.set_output_for_monitor_workspaces(workspace_type, workspace)
开发者ID:mantidproject,项目名称:mantid,代码行数:37,代码来源:SANSLoad.py

示例2: PyExec

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
 def PyExec(self):
     error = self.getProperty("Error").value
     if error:
         raise RuntimeError('Error in algorithm')
     progress = Progress(self, 0.0, 1.0, 2)
     progress.report('Half way')
     progress.report()
开发者ID:DanNixon,项目名称:mantid,代码行数:9,代码来源:test_algorithm_observer.py

示例3: _sample

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
    def _sample(self):
        sample_prog = Progress(self, start=0.01, end=0.03, nreports=2)
        sample_prog.report('Setting Sample Material for Sample')
        SetSampleMaterial(self._sample_ws_name , ChemicalFormula=self._sample_chemical_formula,
                          SampleNumberDensity=self._sample_number_density)
        sample = mtd[self._sample_ws_name].sample()
        sam_material = sample.getMaterial()
        # total scattering x-section
        self._sig_s = np.zeros(self._number_can)
        self._sig_s[0] = sam_material.totalScatterXSection()
        # absorption x-section
        self._sig_a = np.zeros(self._number_can)
        self._sig_a[0] = sam_material.absorbXSection()
        # density
        self._density = np.zeros(self._number_can)
        self._density[0] = self._sample_number_density

        if self._use_can:
            sample_prog.report('Setting Sample Material for Container')
            SetSampleMaterial(InputWorkspace=self._can_ws_name, ChemicalFormula=self._can_chemical_formula,
                              SampleNumberDensity=self._can_number_density)
            can_sample = mtd[self._can_ws_name].sample()
            can_material = can_sample.getMaterial()
            self._sig_s[1] = can_material.totalScatterXSection()
            self._sig_a[1] = can_material.absorbXSection()
            self._density[1] = self._can_number_density
开发者ID:mducle,项目名称:mantid,代码行数:28,代码来源:CylinderPaalmanPingsCorrection2.py

示例4: _wave_range

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
    def _wave_range(self):

        if self._emode != 'Elastic':
            self._fixed = math.sqrt(81.787 / self._efixed)

        if self._emode == 'Efixed':
            self._waves.append(self._fixed)
            logger.information('Efixed mode, setting lambda_fixed to {0}'.format(self._fixed))
        else:
            wave_range = '__wave_range'
            ExtractSingleSpectrum(InputWorkspace=self._sample_ws_name, OutputWorkspace=wave_range, WorkspaceIndex=0)

            Xin = mtd[wave_range].readX(0)
            wave_min = mtd[wave_range].readX(0)[0]
            wave_max = mtd[wave_range].readX(0)[len(Xin) - 1]
            number_waves = self._number_wavelengths
            wave_bin = (wave_max - wave_min) / (number_waves-1)

            self._waves = list()
            wave_prog = Progress(self, start=0.07, end = 0.10, nreports=number_waves)
            for idx in range(0, number_waves):
                wave_prog.report('Appending wave data: %i' % idx)
                self._waves.append(wave_min + idx * wave_bin)
            DeleteWorkspace(wave_range, EnableLogging = False)

            if self._emode == 'Elastic':
                self._elastic = self._waves[int(len(self._waves) / 2)]
                logger.information('Elastic lambda : %f' % self._elastic)

            logger.information('Lambda : %i values from %f to %f' % (len(self._waves), self._waves[0], self._waves[-1]))
开发者ID:samueljackson92,项目名称:mantid,代码行数:32,代码来源:CylinderPaalmanPingsCorrection2.py

示例5: _setup

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
    def _setup(self):
        setup_prog = Progress(self, start=0.00, end=0.01, nreports=2)
        setup_prog.report('Obtaining input properties')
        self._sample_ws_name = self.getPropertyValue('SampleWorkspace')
        self._sample_density_type = self.getPropertyValue('SampleDensityType')
        self._sample_density = self.getProperty('SampleDensity').value
        self._sample_inner_radius = self.getProperty('SampleInnerRadius').value
        self._sample_outer_radius = self.getProperty('SampleOuterRadius').value
        self._number_can = 1

        self._can_ws_name = self.getPropertyValue('CanWorkspace')
        self._use_can = self._can_ws_name != ''
        self._can_density_type = self.getPropertyValue('CanDensityType')
        self._can_density = self.getProperty('CanDensity').value
        self._can_outer_radius = self.getProperty('CanOuterRadius').value
        if self._use_can:
            self._number_can = 2

        self._step_size = self.getProperty('StepSize').value
        self._radii = np.zeros(self._number_can +1)
        self._radii[0] = self._sample_inner_radius
        self._radii[1] = self._sample_outer_radius
        if (self._radii[1] - self._radii[0]) < 1e-4:
            raise ValueError('Sample outer radius not > inner radius')
        else:
            logger.information('Sample : inner radius = %f ; outer radius = %f' % (self._radii[0], self._radii[1]))
            self._ms = int((self._radii[1] - self._radii[0] + 0.0001)/self._step_size)
            if self._ms < 20:
                raise ValueError('Number of steps ( %i ) should be >= 20' % self._ms)
            else:
                if self._ms < 1:
                    self._ms = 1
                logger.information('Sample : ms = %i ' % self._ms)
        if self._use_can:
            self._radii[2] = self._can_outer_radius
            if (self._radii[2] - self._radii[1]) < 1e-4:
                raise ValueError('Can outer radius not > sample outer radius')
            else:
                logger.information('Can : inner radius = %f ; outer radius = %f' % (self._radii[1], self._radii[2]))
        setup_prog.report('Obtaining beam values')
        beam_width = self.getProperty('BeamWidth').value
        beam_height = self.getProperty('BeamHeight').value
        self._beam = [beam_height,
                      0.5 * beam_width,
                      -0.5 * beam_width,
                      (beam_width / 2),
                      -(beam_width / 2),
                      0.0,
                      beam_height,
                      0.0,
                      beam_height]

        self._interpolate = self.getProperty('Interpolate').value
        self._number_wavelengths = self.getProperty('NumberWavelengths').value

        self._emode = self.getPropertyValue('Emode')
        self._efixed = self.getProperty('Efixed').value

        self._output_ws_name = self.getPropertyValue('OutputWorkspace')
开发者ID:rosswhitfield,项目名称:mantid,代码行数:61,代码来源:CylinderPaalmanPingsCorrection2.py

示例6: PyExec

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
    def PyExec(self):

        setup_prog = Progress(self, start=0.05, end=0.95, nreports=3)

        self._tmp_fit_name = "__fit_ws"
        self._crop_ws(self._sample_ws, self._tmp_fit_name, self._e_min, self._e_max)

        convert_to_hist_alg = self.createChildAlgorithm("ConvertToHistogram", enableLogging=False)
        convert_to_hist_alg.setProperty("InputWorkspace", self._tmp_fit_name)
        convert_to_hist_alg.setProperty("OutputWorkspace", self._tmp_fit_name)
        convert_to_hist_alg.execute()
        mtd.addOrReplace(self._tmp_fit_name, convert_to_hist_alg.getProperty("OutputWorkspace").value)

        self._convert_to_elasticQ(self._tmp_fit_name)

        num_hist = self._sample_ws.getNumberHistograms()
        if self._hist_max is None:
            self._hist_max = num_hist - 1

        setup_prog.report('Fitting 1 peak')
        self._fit(1)
        setup_prog.report('Fitting 2 peaks')
        self._fit(2)
        self._delete_ws(self._tmp_fit_name)
		
        chi_group = self._output_name + '_ChiSq'
        chi_ws1 = self._output_name + '_1L_ChiSq'
        chi_ws2 = self._output_name + '_2L_ChiSq'
        self._clone_ws(chi_ws1, chi_group)
        self._append(chi_group, chi_ws2, chi_group)
        ws = mtd[chi_group]
        ax = TextAxis.create(2)
        for i, x in enumerate(['1 peak', '2 peaks']):
            ax.setLabel(i, x)
        ws.replaceAxis(1, ax)
        self._delete_ws(chi_ws1)
        self._delete_ws(chi_ws2)

        res_group = self._output_name + '_Result'
        res_ws1 = self._output_name + '_1L_Result'
        res_ws2 = self._output_name + '_2L_Result'
        self._extract(res_ws1, res_group, 1)
        self._extract(res_ws2, '__spectrum', 1)
        self._append(res_group, '__spectrum', res_group)
        self._extract(res_ws2, '__spectrum', 3)
        self._append(res_group, '__spectrum', res_group)
        ws = mtd[res_group]
        ax = TextAxis.create(3)
        for i, x in enumerate(['fwhm.1', 'fwhm.2.1', 'fwhm.2.2']):
            ax.setLabel(i, x)
        ws.replaceAxis(1, ax)
        self._delete_ws(res_ws1)
        self._delete_ws(res_ws2)
        self._delete_ws(self._output_name + '_1L_Parameters')
        self._delete_ws(self._output_name + '_2L_Parameters')
开发者ID:mantidproject,项目名称:scriptrepository,代码行数:57,代码来源:IndirectTwoPeakFit.py

示例7: PyExec

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
    def PyExec(self):
        """ Main execution body
        """

        self.vanaws = self.getProperty("VanadiumWorkspace").value       # returns workspace instance
        outws_name = self.getPropertyValue("OutputWorkspace")           # returns workspace name (string)
        eppws = self.getProperty("EPPTable").value
        nhist = self.vanaws.getNumberHistograms()
        prog_reporter = Progress(self, start=0.0, end=1.0, nreports=nhist+1)

        # calculate array of Debye-Waller factors
        dwf = self.calculate_dwf()

        # for each detector: fit gaussian to get peak_centre and fwhm
        # sum data in the range [peak_centre - 3*fwhm, peak_centre + 3*fwhm]
        dataX = self.vanaws.readX(0)
        coefY = np.zeros(nhist)
        coefE = np.zeros(nhist)
        instrument = self.vanaws.getInstrument()
        detID_offset = self.get_detID_offset()
        peak_centre = eppws.column('PeakCentre')
        sigma = eppws.column('Sigma')

        for idx in range(nhist):
            prog_reporter.report("Setting %dth spectrum" % idx)
            dataY = self.vanaws.readY(idx)
            det = instrument.getDetector(idx + detID_offset)
            if np.max(dataY) == 0 or det.isMasked():
                coefY[idx] = 0.
                coefE[idx] = 0.
            else:
                dataE = self.vanaws.readE(idx)
                fwhm = sigma[idx]*2.*np.sqrt(2.*np.log(2.))
                idxmin = (np.fabs(dataX-peak_centre[idx]+3.*fwhm)).argmin()
                idxmax = (np.fabs(dataX-peak_centre[idx]-3.*fwhm)).argmin()
                coefY[idx] = dwf[idx]*sum(dataY[idxmin:idxmax+1])
                coefE[idx] = dwf[idx]*sum(dataE[idxmin:idxmax+1])

        # create X array, X data are the same for all detectors, so
        coefX = np.zeros(nhist)
        coefX.fill(dataX[0])

        create = self.createChildAlgorithm("CreateWorkspace")
        create.setPropertyValue('OutputWorkspace', outws_name)
        create.setProperty('ParentWorkspace', self.vanaws)
        create.setProperty('DataX', coefX)
        create.setProperty('DataY', coefY)
        create.setProperty('DataE', coefE)
        create.setProperty('NSpec', nhist)
        create.setProperty('UnitX', 'TOF')
        create.execute()
        outws = create.getProperty('OutputWorkspace').value

        self.setProperty("OutputWorkspace", outws)
开发者ID:liyulun,项目名称:mantid,代码行数:56,代码来源:ComputeCalibrationCoefVan.py

示例8: _get_angles

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
 def _get_angles(self):
     num_hist = mtd[self._sample_ws_name].getNumberHistograms()
     angle_prog = Progress(self, start=0.03, end=0.07, nreports=num_hist)
     source_pos = mtd[self._sample_ws_name].getInstrument().getSource().getPos()
     sample_pos = mtd[self._sample_ws_name].getInstrument().getSample().getPos()
     beam_pos = sample_pos - source_pos
     self._angles = list()
     for index in range(0, num_hist):
         angle_prog.report('Obtaining data for detector angle %i' % index)
         detector = mtd[self._sample_ws_name].getDetector(index)
         two_theta = detector.getTwoTheta(sample_pos, beam_pos) * 180.0 / math.pi
         self._angles.append(two_theta)
     logger.information('Detector angles : %i from %f to %f ' % (len(self._angles), self._angles[0], self._angles[-1]))
开发者ID:rosswhitfield,项目名称:mantid,代码行数:15,代码来源:CylinderPaalmanPingsCorrection2.py

示例9: PyExec

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
    def PyExec(self):
        use_zero_error_free = self.getProperty("UseZeroErrorFree").value
        file_formats = self._get_file_formats()
        file_name = self.getProperty("Filename").value
        workspace = self.getProperty("InputWorkspace").value

        if use_zero_error_free:
            workspace = get_zero_error_free_workspace(workspace)
        progress = Progress(self, start=0.0, end=1.0, nreports=len(file_formats) + 1)
        for file_format in file_formats:
            progress_message = "Saving to {0}.".format(SaveType.to_string(file_format.file_format))
            progress.report(progress_message)
            save_to_file(workspace, file_format, file_name)
        progress.report("Finished saving workspace to files.")
开发者ID:samueljackson92,项目名称:mantid,代码行数:16,代码来源:SANSSave.py

示例10: PyExec

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
    def PyExec(self):
        """Executes the data reduction workflow."""
        progress = Progress(self, 0.0, 1.0, 4)
        subalgLogging = False
        if self.getProperty(common.PROP_SUBALG_LOGGING).value == common.SUBALG_LOGGING_ON:
            subalgLogging = True
        wsNamePrefix = self.getProperty(common.PROP_OUTPUT_WS).valueAsStr
        cleanupMode = self.getProperty(common.PROP_CLEANUP_MODE).value
        wsNames = common.NameSource(wsNamePrefix, cleanupMode)
        wsCleanup = common.IntermediateWSCleanup(cleanupMode, subalgLogging)

        progress.report('Loading inputs')
        mainWS = self._inputWS(wsCleanup)

        progress.report('Applying self shielding corrections')
        mainWS, applied = self._applyCorrections(mainWS, wsNames, wsCleanup, subalgLogging)

        progress.report('Subtracting EC')
        mainWS, subtracted = self._subtractEC(mainWS, wsNames, wsCleanup, subalgLogging)

        if not applied and not subtracted:
            mainWS = self._cloneOnly(mainWS, wsNames, wsCleanup, subalgLogging)

        self._finalize(mainWS, wsCleanup)
        progress.report('Done')
开发者ID:stuartcampbell,项目名称:mantid,代码行数:27,代码来源:DirectILLApplySelfShielding.py

示例11: _rebin_result

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
    def _rebin_result(self):                    #apply rebinning
        rebin_prog = Progress(self, start=0.0, end=0.8, nreports=3)
        rebin_prog.report('Rebin result ')

        logger.information('Rebin option : ' + self._rebin_option)
        qrange = ''
        if mtd.doesExist(self._sofq):                  #check if S(Q) WS exists
		    logger.information('Sofq data from Workspace : %s' % self._sofq)
        else:                                    #read from nxs file
            sofq_path = FileFinder.getFullPath(self._sofq + '.nxs')
            LoadNexusProcessed(Filename=sofq_path,
                               OutputWorkspace=self._sofq,
                               EnableLogging=False)
            logger.information('Sq data from File : %s' % sofq_path)
        rebin_logs = [('rebin_option', self._rebin_option)]
        if self._rebin_option != 'None':          #rebin to be applied
            rebin_logs.append(('rebin_qrange', self._rebin_qrange))
            logger.information('Rebin qrange : %s' % self._rebin_qrange)
            if self._rebin_qrange == 'New':          #new Q range
                mtd[self._final_q].setDistribution(True)
                xs = mtd[self._final_q].readX(0)
                new_dq = float(self._rebin_qinc)       #increment in Q
                xmax = (int(xs[len(xs) -1 ] / new_dq) + 1) * new_dq    #find number of points & Q max
                qrange = '0.0, %f, %f' % (new_dq, xmax)   #create Q range
                self._rebin(self._final_q, self._final_q, qrange)
                x = mtd[self._final_q].readX(0)
                xshift = 0.5 * (x[0] - x[1])
                self._scale_x(self._final_q, self._final_q, xshift)
                logger.information('Output S(Q) rebinned for range : %s' % qrange)
            if self._rebin_qrange == 'Snap':         #use input Q range
                gR = mtd[self._sofq].getRun()      #input S(Q) WS
                stype = gR.getLogData('input_type').value
                logger.information('Rebin option : %s' % self._rebin_option)
                if stype != 'Q':             #check input was in Q
                    raise ValueError('Input type must be Q for Snap option')
                if self._rebin_option == 'Interpolate':
                    self._rebin_ws(self._final_q, self._sofq, self._final_q)
                    logger.information('Output S(Q) interpolated to input S(Q) : %s' % self._sofq)
                if self._rebin_option == 'Spline':
                    self._spline_interp(self._sofq, self._final_q, self._final_q, '', 2)
                    logger.information('Output S(Q) spline interpolated to input S(Q) :%s ' % self._sofq)
                    rebin_logs.append(('rebin_Q_file', self._sofq))
        log_names = [item[0] for item in rebin_logs]
        log_values = [item[1] for item in rebin_logs]
#        self._add_sample_log_mult(self._final_q, log_names, log_values)
        logger.information('Corrected WS created : %s' % self._final_q)
开发者ID:mantidproject,项目名称:scriptrepository,代码行数:48,代码来源:DeconD4Result.py

示例12: PyExec

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
    def PyExec(self):
        self._setup()

        self._calculate_parameters()

        if not self._dry_run:
            self._transform()

            self._add_logs()

        else:
            skip_prog = Progress(self, start=0.3, end=1.0, nreports=2)
            skip_prog.report('skipping transform')
            skip_prog.report('skipping add logs')
            logger.information('Dry run, will not run TransformToIqt')

        self.setProperty('ParameterWorkspace', self._parameter_table)
        self.setProperty('OutputWorkspace', self._output_workspace)
开发者ID:dezed,项目名称:mantid,代码行数:20,代码来源:TransformToIqt.py

示例13: _subtract_corr

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
    def _subtract_corr(self):    #subtract corrections from input to give _data_used & _result
        calc_prog = Progress(self, start=0.0, end=0.8, nreports=3)
        calc_prog.report('Subtract corrections ')

        logger.information('Subtracting corrections')
        self._data_used = self._data + '_used'
        if self._smooth:                                #select which hist to use
            index = 1
        else:
            index= 0
        self._extract(self._data, self._data_used, index)

        self._extract(self._corr, '__wcr', 0)
        wsc1 = 'S-1C'    #1 term subtracted
        self._plus(self._data_used, '__wcr', wsc1)
        wsc2 = 'S-2C'    #2 terms subtracted
        self._extract(self._corr, '__wcr', 1)
        self._plus(wsc1, '__wcr', wsc2)
        wsc3 = 'S-3C'    #3 terms subtracted
        self._extract(self._corr, '__wcr', 2)
        self._plus(wsc2, '__wcr', wsc3)
        wsc4 = 'S-4C'    #4 terms subtracted
        self._extract(self._corr, '__wcr', 3)
        self._plus(wsc3, '__wcr', wsc4)

        self._result = self._data + '_result'             #results WS
        self._clone_ws(wsc1, self._result)
        self._append(self._result, wsc2, self._result)
        self._append(self._result, wsc3, self._result)
        self._append(self._result, wsc4, self._result)

        ax = TextAxis.create(4)
        for i, x in enumerate(['S-1C', 'S-2C', 'S-3C', 'S-4C']):
            ax.setLabel(i, x)
        mtd[self._result].replaceAxis(1, ax)

        subtract_logs = [('smooth', self._smooth)]
        log_names = [item[0] for item in subtract_logs]
        log_values = [item[1] for item in subtract_logs]
        self._add_sample_log_mult(self._result, log_names, log_values)
        workspaces = ['__wcr', wsc1, wsc2, wsc3, wsc4]
        for ws in workspaces:
            self._delete_ws(ws)
        logger.information('Results in WS %s' % self._result)
开发者ID:mantidproject,项目名称:scriptrepository,代码行数:46,代码来源:DeconApplyCorrections.py

示例14: _corr_terms

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
    def _corr_terms(self):   #calculates the correction terms = coef*deriv as _corr
        calc_prog = Progress(self, start=0.0, end=0.8, nreports=3)
        calc_prog.report('Correction terms ')

        logger.information('Calculating Correction terms')
        self._corr = self._data + '_corr'              #corrections WS
        self._extract(self._deriv, '__temp', 0)
        self._spline_interp('__temp', self._coeff, self._coeff, '', 2)
        self._multiply(self._coeff, self._deriv, self._corr)

        ax = TextAxis.create(4)
        for i, x in enumerate(['Corr.1', 'Corr.2', 'Corr.3', 'Corr.4']):
            ax.setLabel(i, x)
        mtd[self._corr].replaceAxis(1, ax)

        self._copy_log(self._mome, self._corr, 'MergeKeepExisting')
        self._delete_ws('__temp')
        logger.information('Correction terms WS created : %s' % self._corr)
        calc_prog.report('Correction terms completed')
开发者ID:mantidproject,项目名称:scriptrepository,代码行数:21,代码来源:DeconApplyCorrections.py

示例15: _sample

# 需要导入模块: from mantid.api import Progress [as 别名]
# 或者: from mantid.api.Progress import report [as 别名]
    def _sample(self):
        sample_prog = Progress(self, start=0.01, end=0.03, nreports=2)
        sample_prog.report('Setting Sample Material for Sample')

        sample_ws, self._sample_density = self._set_material(self._sample_ws_name,
                                                             self._set_sample_method,
                                                             self._sample_chemical_formula,
                                                             self._sample_coherent_cross_section,
                                                             self._sample_incoherent_cross_section,
                                                             self._sample_attenuation_cross_section,
                                                             self._sample_density_type,
                                                             self._sample_density,
                                                             self._sample_number_density_unit)

        sample_material = sample_ws.sample().getMaterial()
        # total scattering x-section
        self._sig_s = np.zeros(self._number_can)
        self._sig_s[0] = sample_material.totalScatterXSection()
        # absorption x-section
        self._sig_a = np.zeros(self._number_can)
        self._sig_a[0] = sample_material.absorbXSection()
        # density
        self._density = np.zeros(self._number_can)
        self._density[0] = self._sample_density

        if self._use_can:
            sample_prog.report('Setting Sample Material for Container')

            can_ws, self._can_density = self._set_material(self._can_ws_name,
                                                           self._set_can_method,
                                                           self._can_chemical_formula,
                                                           self._can_coherent_cross_section,
                                                           self._can_incoherent_cross_section,
                                                           self._can_attenuation_cross_section,
                                                           self._can_density_type,
                                                           self._can_density,
                                                           self._can_number_density_unit)

            can_material = can_ws.sample().getMaterial()
            self._sig_s[1] = can_material.totalScatterXSection()
            self._sig_a[1] = can_material.absorbXSection()
            self._density[1] = self._can_density
开发者ID:mantidproject,项目名称:mantid,代码行数:44,代码来源:CylinderPaalmanPingsCorrection2.py


注:本文中的mantid.api.Progress.report方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。