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


Python AzimuthalIntegrator.chi方法代码示例

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


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

示例1: CalibrationModel

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

#.........这里部分代码省略.........
                                    poni1=pyFAI_parameter['poni1'],
                                    poni2=pyFAI_parameter['poni2'],
                                    rot1=pyFAI_parameter['rot1'],
                                    rot2=pyFAI_parameter['rot2'],
                                    rot3=pyFAI_parameter['rot3'],
                                    pixel1=pyFAI_parameter['pixel1'],
                                    pixel2=pyFAI_parameter['pixel2'])

        self.cake_geometry.wavelength = pyFAI_parameter['wavelength']

    def setup_peak_search_algorithm(self, algorithm, mask=None):
        """
        Initializes the peak search algorithm on the current image
        :param algorithm:
            peak search algorithm used. Possible algorithms are 'Massif' and 'Blob'
        :param mask:
            if a mask is used during the process this is provided here as a 2d array for the image.
        """

        if algorithm == 'Massif':
            self.peak_search_algorithm = Massif(self.img_model.get_raw_img_data())
        elif algorithm == 'Blob':
            if mask is not None:
                self.peak_search_algorithm = BlobDetection(self.img_model.get_raw_img_data() * mask)
            else:
                self.peak_search_algorithm = BlobDetection(self.img_model.get_raw_img_data())
            self.peak_search_algorithm.process()
        else:
            return

    def search_peaks_on_ring(self, ring_index, delta_tth=0.1, min_mean_factor=1,
                             upper_limit=55000, mask=None):
        """
        This function is searching for peaks on an expected ring. It needs an initial calibration
        before. Then it will search for the ring within some delta_tth and other parameters to get
        peaks from the calibrant.

        :param ring_index: the index of the ring for the search
        :param delta_tth: search space around the expected position in two theta
        :param min_mean_factor: a factor determining the minimum peak intensity to be picked up. it is based
                                on the mean value of the search area defined by delta_tth. Pick a large value
                                for larger minimum value and lower for lower minimum value. Therefore, a smaller
                                number is more prone to picking up noise. typical values like between 1 and 3.
        :param upper_limit: maximum intensity for the peaks to be picked
        :param mask: in case the image has to be masked from certain areas, it need to be given here. Default is None.
                     The mask should be given as an 2d array with the same dimensions as the image, where 1 denotes a
                     masked pixel and all others should be 0.
        """
        self.reset_supersampling()
        if not self.is_calibrated:
            return

        # transform delta from degree into radians
        delta_tth = delta_tth / 180.0 * np.pi

        # get appropriate two theta value for the ring number
        tth_calibrant_list = self.calibrant.get_2th()
        tth_calibrant = np.float(tth_calibrant_list[ring_index])

        # get the calculated two theta values for the whole image
        if self.spectrum_geometry._ttha is None:
            tth_array = self.spectrum_geometry.twoThetaArray(self.img_model._img_data.shape)
        else:
            tth_array = self.spectrum_geometry._ttha

        # create mask based on two_theta position
开发者ID:knilav,项目名称:Dioptas,代码行数:70,代码来源:CalibrationModel.py

示例2: CalibrationData

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

#.........这里部分代码省略.........

    def set_fit2d(self, fit2d_parameter):
        print fit2d_parameter
        self.spectrum_geometry.setFit2D(directDist=fit2d_parameter['directDist'],
                                        centerX=fit2d_parameter['centerX'],
                                        centerY=fit2d_parameter['centerY'],
                                        tilt=fit2d_parameter['tilt'],
                                        tiltPlanRotation=fit2d_parameter['tiltPlanRotation'],
                                        pixelX=fit2d_parameter['pixelX'],
                                        pixelY=fit2d_parameter['pixelY'])
        self.spectrum_geometry.wavelength = fit2d_parameter['wavelength']
        self.create_cake_geometry()
        self.polarization_factor = fit2d_parameter['polarization_factor']
        self.orig_pixel1 = fit2d_parameter['pixelX'] * 1e-6
        self.orig_pixel2 = fit2d_parameter['pixelY'] * 1e-6
        self.is_calibrated = True
        self.set_supersampling()

    def set_pyFAI(self, pyFAI_parameter):
        self.spectrum_geometry.setPyFAI(dist=pyFAI_parameter['dist'],
                                        poni1=pyFAI_parameter['poni1'],
                                        poni2=pyFAI_parameter['poni2'],
                                        rot1=pyFAI_parameter['rot1'],
                                        rot2=pyFAI_parameter['rot2'],
                                        rot3=pyFAI_parameter['rot3'],
                                        pixel1=pyFAI_parameter['pixel1'],
                                        pixel2=pyFAI_parameter['pixel2'])
        self.spectrum_geometry.wavelength = pyFAI_parameter['wavelength']
        self.create_cake_geometry()
        self.polarization_factor = pyFAI_parameter['polarization_factor']
        self.orig_pixel1 = pyFAI_parameter['pixel1']
        self.orig_pixel2 = pyFAI_parameter['pixel2']
        self.is_calibrated = True
        self.set_supersampling()

    def set_supersampling(self, factor=None):
        if factor is None:
            factor = self.supersampling_factor
        self.spectrum_geometry.pixel1 = self.orig_pixel1 / float(factor)
        self.spectrum_geometry.pixel2 = self.orig_pixel2 / float(factor)

        if factor != self.supersampling_factor:
            self.spectrum_geometry.reset()
            self.supersampling_factor = factor

    def reset_supersampling(self):
        self.spectrum_geometry.pixel1 = self.orig_pixel1
        self.spectrum_geometry.pixel2 = self.orig_pixel2

    def get_two_theta_img(self, x, y):
        """
        Gives the two_theta value for the x,y coordinates on the image
        :return:
            two theta in radians
        """
        x = np.array([x]) * self.supersampling_factor
        y = np.array([y]) * self.supersampling_factor

        return self.spectrum_geometry.tth(x, y)[0]

    def get_azi_img(self, x, y):
        """
        Gives chi for position on image.
        :param x:
            x-coordinate in pixel
        :param y:
            y-coordinate in pixel
        :return:
            azimuth in radians
        """
        x *= self.supersampling_factor
        y *= self.supersampling_factor
        return self.spectrum_geometry.chi(x, y)[0]

    def get_two_theta_cake(self, y):
        """
        Gives the two_theta value for the x coordinate in the cake
        :param x:
            y-coordinate on image
        :return:
            two theta in degree
        """
        return self.cake_tth[np.round(y[0])]

    def get_azi_cake(self, x):
        """
        Gives the azimuth value for a cake.
        :param x:
            x-coordinate in pixel
        :return:
            azimuth in degree
        """
        return self.cake_azi[np.round(x[0])]

    def get_two_theta_array(self):
        return self.spectrum_geometry._ttha[::self.supersampling_factor, ::self.supersampling_factor]

    @property
    def wavelength(self):
        return self.spectrum_geometry.wavelength
开发者ID:ggarba,项目名称:Dioptas,代码行数:104,代码来源:CalibrationData.py


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