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


Python AzimuthalIntegrator.refine2_wavelength方法代码示例

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


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

示例1: CalibrationModel

# 需要导入模块: from pyFAI.azimuthalIntegrator import AzimuthalIntegrator [as 别名]
# 或者: from pyFAI.azimuthalIntegrator.AzimuthalIntegrator import refine2_wavelength [as 别名]

#.........这里部分代码省略.........
        self.start_values = start_values
        self.polarization_factor = start_values['polarization_factor']

    def calibrate(self):
        self.spectrum_geometry = GeometryRefinement(self.create_point_array(self.points, self.points_index),
                                                    dist=self.start_values['dist'],
                                                    wavelength=self.start_values['wavelength'],
                                                    pixel1=self.start_values['pixel_width'],
                                                    pixel2=self.start_values['pixel_height'],
                                                    calibrant=self.calibrant)
        self.orig_pixel1 = self.start_values['pixel_width']
        self.orig_pixel2 = self.start_values['pixel_height']

        self.refine()
        self.create_cake_geometry()
        self.is_calibrated = True

        self.calibration_name = 'current'
        self.set_supersampling()
        # reset the integrator (not the geometric parameters)
        self.spectrum_geometry.reset()

    def refine(self):
        self.reset_supersampling()
        self.spectrum_geometry.data = self.create_point_array(self.points, self.points_index)

        fix = ['wavelength']
        if self.fit_wavelength:
            fix = []
        if not self.fit_distance:
            fix.append('dist')
        if self.fit_wavelength:
            self.spectrum_geometry.refine2()
        self.spectrum_geometry.refine2_wavelength(fix=fix)

        self.create_cake_geometry()
        self.set_supersampling()
        # reset the integrator (not the geometric parameters)
        self.spectrum_geometry.reset()

    def integrate_1d(self, num_points=None, mask=None, polarization_factor=None, filename=None,
                     unit='2th_deg', method='csr'):
        if np.sum(mask) == self.img_model.img_data.shape[0] * self.img_model.img_data.shape[1]:
            # do not perform integration if the image is completely masked...
            return self.tth, self.int

        if self.spectrum_geometry._polarization is not None:
            if self.img_model.img_data.shape != self.spectrum_geometry._polarization.shape:
                # resetting the integrator if the polarization correction matrix has not the correct shape
                self.spectrum_geometry.reset()

        if polarization_factor is None:
            polarization_factor = self.polarization_factor

        if num_points is None:
            num_points = self.calculate_number_of_spectrum_points(2)
        self.num_points = num_points

        t1 = time.time()

        if unit is 'd_A':
            try:
                self.tth, self.int = self.spectrum_geometry.integrate1d(self.img_model.img_data, num_points,
                                                                        method=method,
                                                                        unit='2th_deg',
                                                                        mask=mask,
开发者ID:knilav,项目名称:Dioptas,代码行数:70,代码来源:CalibrationModel.py

示例2: CalibrationData

# 需要导入模块: from pyFAI.azimuthalIntegrator import AzimuthalIntegrator [as 别名]
# 或者: from pyFAI.azimuthalIntegrator.AzimuthalIntegrator import refine2_wavelength [as 别名]

#.........这里部分代码省略.........
        self.start_values = start_values
        self.polarization_factor = start_values['polarization_factor']

    def calibrate(self):
        self.spectrum_geometry = GeometryRefinement(self.create_point_array(self.points, self.points_index),
                                                    dist=self.start_values['dist'],
                                                    wavelength=self.start_values['wavelength'],
                                                    pixel1=self.start_values['pixel_width'],
                                                    pixel2=self.start_values['pixel_height'],
                                                    calibrant=self.calibrant)
        self.orig_pixel1 = self.start_values['pixel_width']
        self.orig_pixel2 = self.start_values['pixel_height']

        self.refine()
        self.create_cake_geometry()
        self.is_calibrated = True

        self.calibration_name = 'current'
        self.set_supersampling()
        # reset the integrator (not the geometric parameters)
        self.spectrum_geometry.reset()

    def refine(self):
        self.reset_supersampling()
        self.spectrum_geometry.data = self.create_point_array(self.points, self.points_index)

        fix = ['wavelength']
        if self.fit_wavelength:
            fix = []
        if not self.fit_distance:
            fix.append('dist')
        if self.fit_wavelength:
            self.spectrum_geometry.refine2()
        self.spectrum_geometry.refine2_wavelength(fix=fix)

        self.create_cake_geometry()
        self.set_supersampling()
        # reset the integrator (not the geometric parameters)
        self.spectrum_geometry.reset()

    def integrate_1d(self, num_points=None, mask=None, polarization_factor=None, filename=None,
                     unit='2th_deg', method='csr'):
        if np.sum(mask) == self.img_data.img_data.shape[0] * self.img_data.img_data.shape[1]:
            # do not perform integration if the image is completely masked...
            return self.tth, self.int

        if self.spectrum_geometry._polarization is not None:
            if self.img_data.img_data.shape != self.spectrum_geometry._polarization.shape:
                # resetting the integrator if the polarization correction matrix has not the correct shape
                self.spectrum_geometry.reset()

        if polarization_factor is None:
            polarization_factor = self.polarization_factor

        if num_points is None:
            num_points = self.calculate_number_of_spectrum_points(2)
        self.num_points = num_points

        t1 = time.time()

        if unit is 'd_A':
            try:
                self.tth, self.int = self.spectrum_geometry.integrate1d(self.img_data.img_data, num_points,
                                                                        method=method,
                                                                        unit='2th_deg',
                                                                        mask=mask,
开发者ID:ggarba,项目名称:Dioptas,代码行数:70,代码来源:CalibrationData.py


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