def __init__(self, data, dist=1, poni1=None, poni2=None,
                 rot1=0, rot2=0, rot3=0,
                 pixel1=None, pixel2=None, splineFile=None, detector=None,
                 wavelength=None, dSpacing=None):
        """
        @param data: ndarray float64 shape = n, 3
            col0: pos in dim0 (in pixels)
            col1: pos in dim1 (in pixels)
            col2: ring index in dSpacing file
        @param dist: guessed sample-detector distance (optional, in m)
        @param poni1: guessed PONI coordinate along the Y axis (optional, in m)
        @param poni2: guessed PONI coordinate along the X axis (optional, in m)
        @param rot1: guessed tilt of the detector around the Y axis (optional, in rad)
        @param rot2: guessed tilt of the detector around the X axis (optional, in rad)
        @param rot3: guessed tilt of the detector around the incoming beam axis (optional, in rad)
        @param pixel1: Pixel size along the vertical direction of the detector (in m), almost mandatory
        @param pixel2: Pixel size along the horizontal direction of the detector (in m), almost mandatory
        @param splineFile: file describing the detector as 2 cubic splines. Replaces pixel1 & pixel2
        @param detector: name of the detector or Detector instance. Replaces splineFile, pixel1 & pixel2
        @param wavelength: wavelength in m (1.54e-10)
        @param dSpacing: filename or list or array or vector containing the d-spacing (in Angstrom)

        """
        self.data = numpy.array(data, dtype="float64")
        assert self.data.ndim == 2
        assert self.data.shape[1] == 3
        assert self.data.shape[0]>0

        if (pixel1 is None) and (pixel2 is None) and (splineFile is None) and (detector is None):
            raise RuntimeError("Setting up the geometry refinement without knowing the detector makes little sense")
        AzimuthalIntegrator.__init__(self, dist, 0, 0,
                                     rot1, rot2, rot3,
                                     pixel1, pixel2, splineFile, detector, wavelength=wavelength)

        if (poni1 is None) or (poni2 is None):
            self.guess_poni()
        else:
            self.poni1 = float(poni1)
            self.poni2 = float(poni2)
        self._dist_min = 0
        self._dist_max = 10
        self._poni1_min = -10000 * self.pixel1
        self._poni1_max = 15000 * self.pixel1
        self._poni2_min = -10000 * self.pixel2
        self._poni2_max = 15000 * self.pixel2
        self._rot1_min = -pi
        self._rot1_max = pi
        self._rot2_min = -pi
        self._rot2_max = pi
        self._rot3_min = -pi
        self._rot3_max = pi
        self._wavelength_min = 1e-15
        self._wavelength_max = 100.e-10
        if dSpacing is not None:
            if type(dSpacing) in types.StringTypes:
                self.dSpacing = numpy.loadtxt(dSpacing)
            else:
                self.dSpacing = numpy.array(dSpacing, dtype=numpy.float64)
        else:
            self.dSpacing = numpy.array([])
Exemple #2
0
    def __init__(self, data, dist=1, poni1=None, poni2=None,
                 rot1=0, rot2=0, rot3=0,
                 pixel1=None, pixel2=None, splineFile=None, detector=None,
                 wavelength=None, dSpacing=None):
        """
        @param data: ndarray float64 shape = n, 3
            col0: pos in dim0 (in pixels)
            col1: pos in dim1 (in pixels)
            col2: associated tth value (in rad)

        @param detector: name of the detector or Detector instance.
        """
        self.data = numpy.array(data, dtype="float64")
        AzimuthalIntegrator.__init__(self, dist, 0, 0,
                                     rot1, rot2, rot3,
                                     pixel1, pixel2, splineFile, detector, wavelength=wavelength)

        if (poni1 is None) or (poni2 is None):
            self.guess_poni()
        else:
            self.poni1 = float(poni1)
            self.poni2 = float(poni2)
        self._dist_min = 0
        self._dist_max = 10
        self._poni1_min = -10000 * self.pixel1
        self._poni1_max = 15000 * self.pixel1
        self._poni2_min = -10000 * self.pixel2
        self._poni2_max = 15000 * self.pixel2
        self._rot1_min = -pi
        self._rot1_max = pi
        self._rot2_min = -pi
        self._rot2_max = pi
        self._rot3_min = -pi
        self._rot3_max = pi
        self._wavelength_min = 1e-15
        self._wavelength_max = 100.e-10
        if dSpacing is not None:
            if type(dSpacing) in types.StringTypes:
                self.dSpacing = numpy.loadtxt(dSpacing)
            else:
                self.dSpacing = numpy.array(dSpacing, dtype=numpy.float64)
        else:
            self.dSpacing = numpy.array([])
    def __init__(self,
                 data,
                 dist=1,
                 poni1=None,
                 poni2=None,
                 rot1=0,
                 rot2=0,
                 rot3=0,
                 pixel1=None,
                 pixel2=None,
                 splineFile=None,
                 detector=None,
                 wavelength=None,
                 dSpacing=None):
        """
        @param data: ndarray float64 shape = n, 3
            col0: pos in dim0 (in pixels)
            col1: pos in dim1 (in pixels)
            col2: ring index in dSpacing file
        @param dist: guessed sample-detector distance (optional, in m)
        @param poni1: guessed PONI coordinate along the Y axis (optional, in m)
        @param poni2: guessed PONI coordinate along the X axis (optional, in m)
        @param rot1: guessed tilt of the detector around the Y axis (optional, in rad)
        @param rot2: guessed tilt of the detector around the X axis (optional, in rad)
        @param rot3: guessed tilt of the detector around the incoming beam axis (optional, in rad)
        @param pixel1: Pixel size along the vertical direction of the detector (in m), almost mandatory
        @param pixel2: Pixel size along the horizontal direction of the detector (in m), almost mandatory
        @param splineFile: file describing the detector as 2 cubic splines. Replaces pixel1 & pixel2
        @param detector: name of the detector or Detector instance. Replaces splineFile, pixel1 & pixel2
        @param wavelength: wavelength in m (1.54e-10)
        @param dSpacing: filename or list or array or vector containing the d-spacing (in Angstrom)

        """
        self.data = numpy.array(data, dtype="float64")
        assert self.data.ndim == 2
        assert self.data.shape[1] == 3
        assert self.data.shape[0] > 0

        if (pixel1 is None) and (pixel2 is None) and (splineFile is None) and (
                detector is None):
            raise RuntimeError(
                "Setting up the geometry refinement without knowing the detector makes little sense"
            )
        AzimuthalIntegrator.__init__(self,
                                     dist,
                                     0,
                                     0,
                                     rot1,
                                     rot2,
                                     rot3,
                                     pixel1,
                                     pixel2,
                                     splineFile,
                                     detector,
                                     wavelength=wavelength)

        if (poni1 is None) or (poni2 is None):
            self.guess_poni()
        else:
            self.poni1 = float(poni1)
            self.poni2 = float(poni2)
        self._dist_min = 0
        self._dist_max = 10
        self._poni1_min = -10000 * self.pixel1
        self._poni1_max = 15000 * self.pixel1
        self._poni2_min = -10000 * self.pixel2
        self._poni2_max = 15000 * self.pixel2
        self._rot1_min = -pi
        self._rot1_max = pi
        self._rot2_min = -pi
        self._rot2_max = pi
        self._rot3_min = -pi
        self._rot3_max = pi
        self._wavelength_min = 1e-15
        self._wavelength_max = 100.e-10
        if dSpacing is not None:
            if type(dSpacing) in types.StringTypes:
                self.dSpacing = numpy.loadtxt(dSpacing)
            else:
                self.dSpacing = numpy.array(dSpacing, dtype=numpy.float64)
        else:
            self.dSpacing = numpy.array([])