Runs the test suite of the installed version
Parameters: | deprecation – enable/disables deprecation warning in the tests |
---|
Bases: pyFAI.geometry.Geometry
This class is an azimuthal integrator based on P. Boesecke’s geometry and histogram algorithm by Manolo S. del Rio and V.A Sole
All geometry calculation are done in the Geometry class
main methods are:
>>> tth, I = ai.integrate1d(data, npt, unit="2th_deg")
>>> q, I, sigma = ai.integrate1d(data, npt, unit="q_nm^-1", error_model="poisson")
>>> regrouped = ai.integrate2d(data, npt_rad, npt_azim, unit="q_nm^-1")[0]
Generate an array of position in different dimentions (R, Q, 2Theta)
Parameters: |
|
---|---|
Returns: | R, Q or 2Theta array depending on unit |
Return type: | ndarray |
Combines various masks into another one.
Parameters: |
|
---|---|
Returns: | the new mask |
Return type: | ndarray of bool |
This method combine two masks (dynamic mask from data & dummy and mask) to generate a new one with the ‘or’ binary operation. One can adjust the level, with the dummy and the delta_dummy parameter, when you consider the data values needs to be masked out.
This method can work in two different mode:
- “normal”: False for valid pixels, True for bad pixels
- “numpy”: True for valid pixels, false for others
This method tries to accomodate various types of masks (like valid=0 & masked=-1, ...) and guesses if an input mask needs to be inverted.
Correct for Dark-current effects. If dark is not defined, correct for a dark set by “set_darkfiles”
Parameters: |
|
---|---|
Returns: | 2tuple: corrected_data, dark_actually used (or None) |
Correct for flat field. If flat is not defined, correct for a flat set by “set_flatfiles”
Parameters: |
|
---|---|
Returns: | 2tuple: corrected_data, flat_actually used (or None) |
Calculate the azimuthal integrated Saxs curve in q(nm^-1) by default
Multi algorithm implementation (tries to be bullet proof), suitable for SAXS, WAXS, ... and much more
Parameters: |
|
---|---|
Returns: | q/2th/r bins center positions and regrouped intensity (and error array if variance or variance model provided), uneless all==True. |
Return type: | 2 or 3-tuple of ndarrays |
Calculate the azimuthal regrouped 2d image in q(nm^-1)/chi(deg) by default
Multi algorithm implementation (tries to be bullet proof)
Parameters: |
|
---|---|
Returns: | azimuthaly regrouped intensity, q/2theta/r pos. and chi pos. |
Return type: | 3-tuple of ndarrays (2d, 1d, 1d) |
Parameters: |
|
---|---|
Returns: | the header |
Return type: | str |
Reset azimuthal integrator in addition to other arrays.
Parameters: |
|
---|
This method save the result of a 1D integration.
Parameters: |
|
---|
This method save the result of a 2D integration.
decorator that deprecates the use of a function
Separate bragg signal from powder/amorphous signal using azimuthal integration, median filering and projected back before subtraction.
Parameters: |
|
---|---|
Returns: | bragg, amorphous |
Parameters: |
|
---|
Set the dark current from one or mutliple files, avaraged according to the method provided
Parameters: |
|
---|
Set the flat field from one or mutliple files, averaged according to the method provided
Prepare a look-up-table
Parameters: |
|
---|
This method is called when a look-up table needs to be set-up. The shape parameter, correspond to the shape of the original datatset. It is possible to customize the number of point of the output histogram with the npt parameter which can be either an integer for an 1D integration or a 2-tuple of integer in case of a 2D integration. The LUT will have a different shape: (npt, lut_max_size), the later parameter being calculated during the instanciation of the splitBBoxLUT class.
It is possible to prepare the LUT with a predefine mask. This operation can speedup the computation of the later integrations. Instead of applying the patch on the dataset, it is taken into account during the histogram computation. If provided the mask_checksum prevent the re-calculation of the mask. When the mask changes, its checksum is used to reset (or not) the LUT (which is a very time consuming operation !)
It is also possible to restrain the range of the 1D or 2D pattern with the pos1_range and pos2_range.
The unit parameter is just propagated to the LUT integrator for further checkings: The aim is to prevent an integration to be performed in 2th-space when the LUT was setup in q space.
Prepare a look-up-table
Parameters: |
|
---|
This method is called when a look-up table needs to be set-up. The shape parameter, correspond to the shape of the original datatset. It is possible to customize the number of point of the output histogram with the npt parameter which can be either an integer for an 1D integration or a 2-tuple of integer in case of a 2D integration. The LUT will have a different shape: (npt, lut_max_size), the later parameter being calculated during the instanciation of the splitBBoxLUT class.
It is possible to prepare the LUT with a predefine mask. This operation can speedup the computation of the later integrations. Instead of applying the patch on the dataset, it is taken into account during the histogram computation. If provided the mask_checksum prevent the re-calculation of the mask. When the mask changes, its checksum is used to reset (or not) the LUT (which is a very time consuming operation !)
It is also possible to restrain the range of the 1D or 2D pattern with the pos1_range and pos2_range.
The unit parameter is just propagated to the LUT integrator for further checkings: The aim is to prevent an integration to be performed in 2th-space when the LUT was setup in q space.
decorator that deprecates the use of a function
decorator that deprecates the use of a function
decorator that deprecates the use of a function
decorator that deprecates the use of a function
decorator that deprecates the use of a function
decorator that deprecates the use of a function
decorator that deprecates the use of a function
decorator that deprecates the use of a function
decorator that deprecates the use of a function
decorator that deprecates the use of a function
decorator that deprecates the use of a function
decorator that deprecates the use of a function
decorator that deprecates the use of a function
decorator that deprecates the use of a function
Bases: object
This class is an azimuthal integrator based on P. Boesecke’s geometry and histogram algorithm by Manolo S. del Rio and V.A Sole
Detector is assumed to be corrected from “raster orientation” effect. It is not addressed here but rather in the Detector object or at read time. Considering there is no tilt:
Axis 1 is along first dimension of detector (when not tilted), this is the slow dimension of the image array in C or Y x1={1,0,0}
Axis 2 is along second dimension of detector (when not tilted), this is the fast dimension of the image in C or X x2={0,1,0}
Axis 3 is along the incident X-Ray beam x3={0,0,1}
We define the 3 rotation around axis 1, 2 and 3:
rotM1 = RotationMatrix[rot1,x1] = {{1,0,0},{0,cos[rot1],-sin[rot1]},{0,sin[rot1],cos[rot1]}} rotM2 = RotationMatrix[rot2,x2] = {{cos[rot2],0,sin[rot2]},{0,1,0},{-sin[rot2],0,cos[rot2]}} rotM3 = RotationMatrix[rot3,x3] = {{cos[rot3],-sin[rot3],0},{sin[rot3],cos[rot3],0},{0,0,1}}
Rotations of the detector are applied first Rot around axis 1, then axis 2 and finally around axis 3:
R = rotM3.rotM2.rotM1
In Python notation:
R.x1 = [cos(rot2)*cos(rot3),cos(rot2)*sin(rot3),-sin(rot2)]
R.x2 = [cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3),cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3), cos(rot2)*sin(rot1)]
R.x3 = [cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3),-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3), cos(rot1)*cos(rot2)]
Coordinates of the Point of Normal Incidence:
PONI = R.{0,0,L}
L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)),L*cos(rot1)*cos(rot2)]
Any pixel on detector plan at coordinate (d1, d2) in meters. Detector is at z=L
P={d1,d2,L}
R.P = [t1, t2, t3] t1 = R.P.x1 = d1*cos(rot2)*cos(rot3) + d2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) + L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3)) t2 = R.P.x2 = d1*cos(rot2)*sin(rot3) + d2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3)) + L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) t3 = R.P.x3 = d2*cos(rot2)*sin(rot1) - d1*sin(rot2) + L*cos(rot1)*cos(rot2)
Distance sample (origin) to detector point (d1,d2)
pow(Abs(d1*cos(rot2)*cos(rot3) + d2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) + L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3))),2) + pow(Abs(d1*cos(rot2)*sin(rot3) + L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) + d2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3))),2))
cos(2theta) is defined as (R.P component along x3) over the distance from origin to data point |R.P|
tth = ArcCos [-(R.P).x3/|R.P|]
pow(Abs(d1*cos(rot2)*cos(rot3) + d2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) +
d2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3))),2)))
tth = ArcTan2 [sqrt(t1**2 + t2**2) , t3 ]
Getting 2theta from it’s tangeant seems both more precise (around beam stop very far from sample) and faster by about 25% Currently there is a swich in the method to follow one path or the other.
chi = ArcTan[((R.P).x1) / ((R.P).x2)]
- chi = ArcTan2(d1*cos(rot2)*cos(rot3) + d2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) +
L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3)),
- d1*cos(rot2)*sin(rot3) + L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) +
- d2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3)))
Allows you to calculate the position of a set of points in space in the sample re
Parameters: |
|
---|
Defines the absorption correction for a phosphor screen or a scintillator from t0, the normal transmission of the screen.
See reference on: J. Appl. Cryst. (2002). 35, 356–359 G. Wu et al. CCD phosphor
Parameters: |
|
---|---|
Returns: | actual |
Computes a 2D image from a 1D integrated profile
Parameters: |
|
---|---|
Returns: | 2D image reconstructed |
Calculate the chi (azimuthal angle) for the centre of a pixel at coordinate d1,d2 which in the lab ref has coordinate:
X1 = p1*cos(rot2)*cos(rot3) + p2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) - L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3)) X2 = p1*cos(rot2)*sin(rot3) - L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) + p2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3)) X3 = -(L*cos(rot1)*cos(rot2)) + p2*cos(rot2)*sin(rot1) - p1*sin(rot2) hence tan(Chi) = X2 / X1
Parameters: |
|
---|---|
Returns: | chi, the azimuthal angle in rad |
Generate an array of the given shape with chi(i,j) (azimuthal angle) for all elements.
Parameters: | shape (ndarray.shape) – the shape of the chi array |
---|---|
Returns: | the chi array |
Return type: | ndarray |
Calculate the chi (azimuthal angle) for the corner of a pixel at coordinate d1,d2 which in the lab ref has coordinate:
X1 = p1*cos(rot2)*cos(rot3) + p2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) - L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3)) X2 = p1*cos(rot2)*sin(rot3) - L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) + p2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3)) X3 = -(L*cos(rot1)*cos(rot2)) + p2*cos(rot2)*sin(rot1) - p1*sin(rot2) hence tan(Chi) = X2 / X1
Parameters: |
|
---|---|
Returns: | chi, the azimuthal angle in rad |
chi array in cache
Generate a 3D array of the given shape with (i,j) (radial angle 2th, azimuthal angle chi ) for all elements.
Parameters: | shape (2-tuple of integer) – expected shape |
---|---|
Returns: | 3d array with shape=(*shape,4,2) the two elements are (radial angle 2th, azimuthal angle chi) |
Generate a 3D array of the given shape with (i,j) (azimuthal angle) for all elements.
Parameters: | shape (2-tuple of integer) – expected shape |
---|---|
Returns: | 3d array with shape=(*shape,4,2) the two elements are (scattering vector q, azimuthal angle chi) |
Generate a 3D array of the given shape with (i,j) (azimuthal angle) for all elements.
Parameters: | shape (2-tuple of integer) – expected shape |
---|---|
Returns: | 3d array with shape=(*shape,4,2) the two elements are (radial distance, azimuthal angle chi) |
Generate a 3D array of the given shape with (i,j) (azimuthal angle) for all elements.
Parameters: | shape (2-tuple of integer) – expected shape |
---|---|
Returns: | 3d array with shape=(*shape,4,2) the two elements are (reciprocal spacing squared, azimuthal angle chi) |
Calculate the incidence angle (alpha) for current pixels (P). The poni being the point of normal incidence, it’s incidence angle is ${alpha} = 0$ hence $cos({alpha}) = 1$
Parameters: |
|
---|---|
Returns: | cosine of the incidence angle |
Generate a 3D array of the given shape with (i,j) with the max distance between the center and any corner in 2 theta
Parameters: | shape – The shape of the detector array: 2-tuple of integer |
---|---|
Returns: | 2D-array containing the max delta angle between a pixel center and any corner in 2theta-angle (rad) |
Generate a 3D array of the given shape with (i,j) with the max distance between the center and any corner in chi-angle (rad)
Parameters: | shape – The shape of the detector array: 2-tuple of integer |
---|---|
Returns: | 2D-array containing the max delta angle between a pixel center and any corner in chi-angle (rad) |
Generate a 2D array of the given shape with (i,j) with the max distance between the center and any corner in q_vector unit (nm^-1)
Parameters: | shape – The shape of the detector array: 2-tuple of integer |
---|---|
Returns: | array 2D containing the max delta Q between a pixel center and any corner in q_vector unit (nm^-1) |
Generate a 2D array of the given shape with (i,j) with the max distance between the center and any corner in radius unit (mm)
Parameters: | shape – The shape of the detector array: 2-tuple of integer |
---|---|
Returns: | array 2D containing the max delta Q between a pixel center and any corner in q_vector unit (nm^-1) |
Generate a 2D array of the given shape with (i,j) with the max distance between the center and any corner in unit: reciprocal spacing squarred (1/nm^2)
Parameters: | shape – The shape of the detector array: 2-tuple of integer |
---|---|
Returns: | array 2D containing the max delta (d*)^2 between a pixel center and any corner in reciprocal spacing squarred (1/nm^2) |
Calculate the solid angle of the current pixels (P) versus the PONI (C)
Omega(P) A cos(a) SC^2 3 SC^3
cos(a) = SC/SP
Parameters: |
|
---|---|
Returns: | solid angle correction array |
solid angle array in cache
Export geometry setup with the geometry of Fit2D
Returns: | dict with parameters compatible with fit2D geometry |
---|
Export geometry setup with the geometry of PyFAI
Returns: | dict with the parameter-set of the PyFAI geometry |
---|
get the SPD like parameter set: For geometry description see Peter Boesecke J.Appl.Cryst.(2007).40, s423–s427
Basically the main difference with pyFAI is the order of the axis which are flipped
Returns: | dictionnary with those parameters: SampleDistance: distance from sample to detector at the PONI (orthogonal projection) Center_1, pixel position of the PONI along fastest axis Center_2: pixel position of the PONI along slowest axis Rot_1: rotation around the fastest axis (x) Rot_2: rotation around the slowest axis (y) Rot_3: rotation around the axis ORTHOGONAL to the detector plan PSize_1: pixel size in meter along the fastest dimention PSize_2: pixel size in meter along the slowst dimention splineFile: name of the file containing the spline BSize_1: pixel binning factor along the fastest dimention BSize_2: pixel binning factor along the slowst dimention WaveLength: wavelength used in meter |
---|
Load the refined parameters from a file.
Parameters: | filename (string) – name of the file to load |
---|
Calculate the polarization correction accoding to the polarization factor:
The axis_offset parameter allows correction for the misalignement of the polarization plane (or ellipse main axis) and the the detector’s X axis.
Parameters: |
|
---|---|
Returns: | 2D array with polarization correction array (intensity/polarisation) |
Generate an array of the given shape with q(i,j) for all elements.
Calculate the q_vector for any pixel corner (in nm^-1)
Calculates the q value for the center of a given pixel (or set of pixels) in nm-1
q = 4pi/lambda sin( 2theta / 2 )
Parameters: |
|
---|---|
Returns: | q in in nm^(-1) |
Return type: | float or array of floats. |
Q array in cache
Generate an array of the given shape with r(i,j) for all elements; r in m.
Parameters: | shape – expected shape |
---|---|
Returns: | 2d array of the given shape with radius in m from beam center on detector. |
Calculate the radius array for any pixel corner (in m)
Calculates the radius value for the center of a given pixel (or set of pixels) in m
r = direct_distance * tan( 2theta )
Parameters: |
|
---|---|
Returns: | r in in m |
Return type: | float or array of floats. |
Generate an array of the given shape with (d*(i,j))^2 for all elements, d* in inverse nm
Load the refined parameters from a file.
Parameters: | filename (string) – name of the file to load |
---|
reset most arrays that are cached: used when a parameter changes.
Save the geometry parameters.
Parameters: | filename (string) – name of the file where to save the parameters |
---|
Set the position of the discontinuity of the chi axis between -pi and +pi. This is the default behavour
Set the position of the discontinuity of the chi axis between 0 and 2pi. By default it is between pi and -pi
Set the Fit2D-like parameter set: For geometry description see HPR 1996 (14) pp-240
Warning: Fit2D flips automatically images depending on their file-format. By reverse engineering we noticed this behavour for Tiff and Mar345 images (at least). To obtaine correct result you will have to flip images using numpy.flipud.
Parameters: |
|
---|
set the oversampling factor
set the geometry from a pyFAI-like dict
Set the SPD like parameter set: For geometry description see Peter Boesecke J.Appl.Cryst.(2007).40, s423–s427
Basically the main difference with pyFAI is the order of the axis which are flipped
Parameters: | SampleDistance – distance from sample to detector at the PONI (orthogonal projection) |
---|
:param Center_1, pixel position of the PONI along fastest axis :param Center_2: pixel position of the PONI along slowest axis :param Rot_1: rotation around the fastest axis (x) :param Rot_2: rotation around the slowest axis (y) :param Rot_3: rotation around the axis ORTHOGONAL to the detector plan :param PSize_1: pixel size in meter along the fastest dimention :param PSize_2: pixel size in meter along the slowst dimention :param splineFile: name of the file containing the spline :param BSize_1: pixel binning factor along the fastest dimention :param BSize_2: pixel binning factor along the slowst dimention :param WaveLength: wavelength used
A static method combining the constructor and the loader from a file
Parameters: | filename (string) – name of the file to load |
---|---|
Returns: | instance of Gerometry of AzimuthalIntegrator set-up with the parameter from the file. |
Generate an array for the solid angle correction given the shape of the detector.
solid_angle = cos(incidence)^3
Parameters: |
|
---|
SA = pix1*pix2/dist^2 * cos(incidence)^3
Calculates the 2theta value for the center of a given pixel (or set of pixels)
Parameters: |
|
---|---|
Returns: | 2theta in radians |
Return type: | floar or array of floats. |
Calculates the 2theta value for the corner of a given pixel (or set of pixels)
Parameters: |
|
---|---|
Returns: | 2theta in radians |
Return type: | floar or array of floats. |
2theta array in cache
Generate an array of the given shape with two-theta(i,j) for all elements.
Save the geometry parameters.
Parameters: | filename (string) – name of the file where to save the parameters |
---|
Module containing the description of all detectors with a factory to instantiate them
Bases: pyFAI.detectors.Detector
ADSC Quantum 210r detector, 2x2 chips
Informations from http://www.adsc-xray.com/products/ccd-detectors/q210r-ccd-detector/
Question: how are the gaps handled ?
Bases: pyFAI.detectors.Detector
ADSC Quantum 270r detector, 2x2 chips
Informations from http://www.adsc-xray.com/products/ccd-detectors/q270-ccd-detector/
Question: how are the gaps handled ?
Bases: pyFAI.detectors.Detector
ADSC Quantum 315r detector, 3x3 chips
Informations from http://www.adsc-xray.com/products/ccd-detectors/q315r-ccd-detector/
Question: how are the gaps handled ?
Bases: pyFAI.detectors.Detector
ADSC Quantum 4r detector, 2x2 chips
Informations from http://proteincrystallography.org/detectors/adsc.php
Question: how are the gaps handled ?
Bases: pyFAI.detectors.Detector
Cylindrical detector made of a bent imaging-plate. Developped at the Danish university of Aarhus r = 1.2m or 0.3m
The image has to be laid-out horizontally
Nota: the detector is bending towards the sample, hence reducing the sample-detector distance. This is why z<0 (or p3<0)
TODO: update cython code for 3d detectors use expand2d instead of outer product with ones
Calculate the position of each pixel center in cartesian coordinate and in meter of a couple of coordinates. The half pixel offset is taken into account here !!! Adapted to Nexus detector definition
Parameters: |
|
---|---|
Returns: | position in meter of the center of each pixels. |
Return type: | ndarray |
d1 and d2 must have the same shape, returned array will have the same shape.
Calculate the position of the corner of the pixels
This should be overwritten by class representing non-contiguous detector (Xpad, ...)
Returns: | 4D array containing: pixel index (slow dimension) pixel index (fast dimension) corner index (A, B, C or D), triangles or hexagons can be handled the same way vertex position (z,y,x) |
---|
Bases: pyFAI.detectors.Detector
Basler camera are simple CCD camara over GigaE
Bases: object
Generic class representing a 2D detector
Calculate the position of each pixel center in cartesian coordinate and in meter of a couple of coordinates. The half pixel offset is taken into account here !!! Adapted to Nexus detector definition
Parameters: |
|
---|---|
Returns: | position in meter of the center of each pixels. |
Return type: | 3xndarray, the later being None if IS_FLAT |
d1 and d2 must have the same shape, returned array will have the same shape.
pos_z is None for flat detectors
Detectors with gaps should overwrite this method with something actually calculating the mask!
A kind of factory...
Parameters: |
|
---|---|
Returns: | an instance of the right detector, set-up if possible |
Return type: | pyFAI.detectors.Detector |
Helper method to serialize the description of a detector using the Fit2d units
Returns: | representation of the detector easy to serialize |
---|---|
Return type: | dict |
Helper method to serialize the description of a detector using the pyFAI way with everything in S.I units.
Returns: | representation of the detector easy to serialize |
---|---|
Return type: | dict |
Get a meaningful name for detector
Calculate the position of the corner of the pixels
This should be overwritten by class representing non-contiguous detector (Xpad, ...)
Precision float32 is ok: precision of 1µm for a detector size of 1m
Returns: | 4D array containing: pixel index (slow dimension) pixel index (fast dimension) corner index (A, B, C or D), triangles or hexagons can be handled the same way vertex position (z,y,x) |
---|
Guess the binning/mode depending on the image shape :param data: 2-tuple with the shape of the image or the image with a .shape attribute.
Get a meaningful name for detector
Saves the detector description into a NeXus file, adapted from: http://download.nexusformat.org/sphinx/classes/base_classes/NXdetector.html Main differences:
- differentiate pixel center from pixel corner offsets
- store all offsets are ndarray according to slow/fast dimension (not x, y)
Parameters: | filename – name of the file on the disc |
---|
Twin method of getFit2D: setup a detector instance according to a description
Parameters: | kwarg – dictionary containing pixel1, pixel2 and splineFile |
---|
Twin method of getPyFAI: setup a detector instance according to a description
Parameters: | kwarg – dictionary containing detector, pixel1, pixel2 and splineFile |
---|
Set the “binning” of the detector,
Parameters: | bin_size ((int, int)) – binning as integer or tuple of integers. |
---|
Sets the configuration of the detector. This implies: - Orientation: integers - Binning - ROI
The configuration is either a python dictionary or a JSON string or a file containing this JSON configuration
keys in that dictionary are : “orientation”: integers from 0 to 7 “binning”: integer or 2-tuple of integers. If only one integer is provided, “offset”: coordinate (in pixels) of the start of the detector
set the pixel-wise displacement along X (dim2):
set the pixel-wise displacement along Y (dim1):
Bases: type
Metaclass used to register all detector classes inheriting from Detector
Bases: pyFAI.detectors.Detector
Dexela CMOS family detector
Bases: pyFAI.detectors.Detector
Eiger detector: generic description containing mask algorithm
Calculate the position of each pixel center in cartesian coordinate and in meter of a couple of coordinates. The half pixel offset is taken into account here !!!
Parameters: |
|
---|---|
Returns: | position in meter of the center of each pixels. |
Return type: | ndarray |
d1 and d2 must have the same shape, returned array will have the same shape.
Returns a generic mask for Pilatus detectors...
Bases: pyFAI.detectors.Eiger
Eiger 16M detector
Bases: pyFAI.detectors.Eiger
Eiger 1M detector
Bases: pyFAI.detectors.Eiger
Eiger 4M detector
Bases: pyFAI.detectors.Eiger
Eiger 9M detector
Bases: pyFAI.detectors.Detector
FReLoN detector: The spline is mandatory to correct for geometric distortion of the taper
TODO: create automatically a mask that removes pixels out of the “valid reagion”
Returns a generic mask for Frelon detectors... All pixels which (center) turns to be out of the valid region are by default discarded
Bases: pyFAI.detectors.Detector
Fairchild Condor 486:90 detector
Bases: pyFAI.detectors.Detector
ADSC HF-130K 1 module
Informations from http://www.adsc-xray.com/products/pixel-array-detectors/hf-130k/
Bases: pyFAI.detectors.Detector
ADSC HF-1M 2x4 modules
Informations from http://www.adsc-xray.com/products/pixel-array-detectors/hf-1m/
Nota: gaps between modules is not known/described
Bases: pyFAI.detectors.Detector
ADSC HF-262k 2 module
Informations from http://www.adsc-xray.com/products/pixel-array-detectors/hf-262k/
Nota: gaps between modules is not known/described
Bases: pyFAI.detectors.Detector
ADSC HF-1M 3x6 modules
Informations from http://www.adsc-xray.com/products/pixel-array-detectors/hf-2.4m/
Nota: gaps between modules is not known/described
Bases: pyFAI.detectors.Detector
ADSC HF-4M 4x8 modules
Informations from http://www.adsc-xray.com/products/pixel-array-detectors/hf-4m/
Bases: pyFAI.detectors.Detector
ADSC HF-130K 1 module
Informations from http://www.adsc-xray.com/products/pixel-array-detectors/hf-9-4m/
Bases: pyFAI.detectors.Detector
ImXPad detector: ImXPad s10 detector with 1x1modules
Calculate the position of each pixel center in cartesian coordinate and in meter of a couple of coordinates. The half pixel offset is taken into account here !!!
Parameters: |
|
---|---|
Returns: | position in meter of the center of each pixels. |
Return type: | ndarray |
d1 and d2 must have the same shape, returned array will have the same shape.
Calculate the mask
Calculate the position of the pixel edges
Calculate the position of the corner of the pixels
This should be overwritten by class representing non-contiguous detector (Xpad, ...)
Precision float32 is ok: precision of 1µm for a detector size of 1m
Returns: | 4D array containing: pixel index (slow dimension) pixel index (fast dimension) corner index (A, B, C or D), triangles or hexagons can be handled the same way vertex position (z,y,x) |
---|
Bases: pyFAI.detectors.ImXPadS10
ImXPad detector: ImXPad s140 detector with 2x7modules
Bases: pyFAI.detectors.ImXPadS10
ImXPad detector: ImXPad s70 detector with 1x7modules
Bases: pyFAI.detectors.Detector
Mar345 Imaging plate detector
In this detector, pixels are always square The valid image size are 2300, 2000, 1600, 1200, 3450, 3000, 2400, 1800
Guess the binning/mode depending on the image shape :param data: 2-tuple with the shape of the image or the image with a .shape attribute.
Bases: pyFAI.detectors.Detector
Class representing a 2D detector loaded from a NeXus file
Helper method to serialize the description of a detector using the Fit2d units
Returns: | representation of the detector easy to serialize |
---|---|
Return type: | dict |
Helper method to serialize the description of a detector using the pyFAI way with everything in S.I units.
Returns: | representation of the detector easy to serialize |
---|---|
Return type: | dict |
Loads the detector description from a NeXus file, adapted from: http://download.nexusformat.org/sphinx/classes/base_classes/NXdetector.html
Parameters: | filename – name of the file on the disk |
---|
Instantiate the detector description from a NeXus file, adapted from: http://download.nexusformat.org/sphinx/classes/base_classes/NXdetector.html
Parameters: | filename – name of the file on the disk |
---|---|
Returns: | Detector instance |
Bases: pyFAI.detectors.Detector
Perkin detector
Bases: pyFAI.detectors.Detector
Pilatus detector: generic description containing mask algorithm
Sub-classed by Pilatus1M, Pilatus2M and Pilatus6M
Calculate the position of each pixel center in cartesian coordinate and in meter of a couple of coordinates. The half pixel offset is taken into account here !!!
Parameters: |
|
---|---|
Returns: | position in meter of the center of each pixels. |
Return type: | ndarray |
d1 and d2 must have the same shape, returned array will have the same shape.
Returns a generic mask for Pilatus detectors...
In this case splinefile is a couple filenames
Bases: pyFAI.detectors.Pilatus
Pilatus 100k detector
Bases: pyFAI.detectors.Pilatus
Pilatus 1M detector
Bases: pyFAI.detectors.Pilatus
Pilatus 200k detector
Bases: pyFAI.detectors.Pilatus
Pilatus 2M detector
Bases: pyFAI.detectors.Pilatus
Pilatus 300k detector
Bases: pyFAI.detectors.Pilatus
Pilatus 300k-wide detector
Bases: pyFAI.detectors.Pilatus
Pilatus 6M detector
Bases: pyFAI.detectors.Detector
Guess the binning/mode depending on the image shape :param data: 2-tuple with the shape of the image or the image with a .shape attribute.
Set the “binning” of the detector,
Parameters: | bin_size (int or (int, int)) – set the binning of the detector |
---|
Bases: pyFAI.detectors.Rayonix
Rayonix 133 2D CCD detector detector also known as mar133
Personnal communication from M. Blum
What should be the default binning factor for those cameras ?
Circular detector
Circular mask
Bases: pyFAI.detectors.Rayonix
Rayonix lx170 2d CCD Detector (2x1 CCDs).
Nota: this is the same for lx170hs
Bases: pyFAI.detectors.Rayonix
Rayonix lx255 2d Detector (3x1 CCDs)
Nota: this detector is also called lx255hs
Bases: pyFAI.detectors.Rayonix
Rayonix mx170 2d CCD Detector (2x2 CCDs).
Nota: this is the same for mx170hs
Bases: pyFAI.detectors.Rayonix
Rayonix mx225 2D CCD detector detector
Nota: this is the same definition for mx225he Personnal communication from M. Blum
Bases: pyFAI.detectors.Rayonix
Rayonix mx225hs 2D CCD detector detector
Pixel size from a personnal communication from M. Blum
Bases: pyFAI.detectors.Rayonix
Rayonix mx300 2D detector (4x4 CCDs)
Pixel size from a personnal communication from M. Blum
Bases: pyFAI.detectors.Rayonix
Rayonix mx300hs 2D detector (4x4 CCDs)
Pixel size from a personnal communication from M. Blum
Bases: pyFAI.detectors.Rayonix
Rayonix mx325 and mx325he 2D detector (4x4 CCD chips)
Pixel size from a personnal communication from M. Blum
Bases: pyFAI.detectors.Rayonix
Rayonix mx340hs 2D detector (4x4 CCDs)
Pixel size from a personnal communication from M. Blum
Bases: pyFAI.detectors.Rayonix
Rayonix mx425hs 2D CCD camera (5x5 CCD chip)
Pixel size from a personnal communication from M. Blum
Bases: pyFAI.detectors.Rayonix
Rayonix sx165 2d Detector also known as MAR165.
Circular detector
Circular mask
Bases: pyFAI.detectors.Rayonix
Rayonix sx200 2d CCD Detector.
Pixel size are personnal communication from M. Blum.
Bases: pyFAI.detectors.Rayonix
Rayonix sx30hs 2D CCD camera (1 CCD chip)
Pixel size from a personnal communication from M. Blum
Bases: pyFAI.detectors.Rayonix
Rayonix sx85hs 2D CCD camera (1 CCD chip)
Pixel size from a personnal communication from M. Blum
Bases: pyFAI.detectors.Detector
Titan CCD detector from Agilent. Mask not handled
Bases: pyFAI.detectors.ImXPadS10
Xpad detector: generic description for ImXPad detector with 8x7modules
Calculate the position of each pixel center in cartesian coordinate and in meter of a couple of coordinates. The half pixel offset is taken into account here !!! Adapted to Nexus detector definition
Parameters: |
|
---|
@parm use_cython: set to False to test Numpy implementation :return: position in meter of the center of each pixels. :rtype: ndarray
d1 and d2 must have the same shape, returned array will have the same shape.
Returns a generic mask for Xpad detectors... discards the first line and raw form all modules: those are 2.5x bigger and often mis - behaving
Calculate the position of the pixel edges, specific to the S540, d5 detector
Calculate the position of the corner of the pixels
Returns: | 4D array containing: pixel index (slow dimension) pixel index (fast dimension) corner index (A, B, C or D), triangles or hexagons can be handled the same way vertex position (z,y,x) |
---|
This is piece of software aims at manipulating spline files describing for geometric corrections of the 2D detectors using cubic-spline.
Mainly used at ESRF with FReLoN CCD camera.
Bases: object
This class is a python representation of the spline file
Those file represent cubic splines for 2D detector distortions and makes heavy use of fitpack (dierckx in netlib) — A Python-C wrapper to FITPACK (by P. Dierckx). FITPACK is a collection of FORTRAN programs for curve and surface fitting with splines and tensor product splines. See _http://www.cs.kuleuven.ac.be/cwis/research/nalag/research/topics/fitpack.html or _http://www.netlib.org/dierckx/index.html
Calculates the spline coefficients from the displacements matrix using fitpack.
Parameters: |
|
---|
Performs the binning of a spline (same camera with different binning)
Parameters: | binning – binning factor as integer or 2-tuple of integers |
---|---|
Type: | int or (int, int) |
Compares the current spline distortion with a reference
Parameters: |
|
---|---|
Returns: | True or False depending if the splines are the same or not |
Return type: | bool |
Flip the spline :return: new spline object
Flip the spline left-right and up-down :return: new spline object
Flip the spline up-down :return: new spline object
Return the size of the pixel from as a 2-tuple of floats expressed in meters.
Returns: | the size of the pixel from a 2D detector |
---|---|
Return type: | 2-tuple of floats expressed in meter. |
read an ascii spline file from file
Parameters: | filename (str) – file containing the cubic spline distortion file |
---|
Sets the size of the pixel from a 2-tuple of floats expressed in meters.
Param: | pixel size in meter |
---|
Calculates the displacement matrix using fitpack bisplev(x, y, tck, dx = 0, dy = 0)
Parameters: | timing (bool) – profile the calculation or not |
---|---|
Returns: | Nothing ! |
Return type: | float or ndarray |
Evaluate a bivariate B-spline and its derivatives. Return a rank-2 array of spline function values (or spline derivative values) at points given by the cross-product of the rank-1 arrays x and y. In special cases, return an array or just a float if either x or y or both are floats.
Calculates the displacement matrix using fitpack for the X direction on the given grid.
Parameters: |
|
---|---|
Returns: | displacement matrix for the X direction |
Return type: | ndarray |
calculates the displacement matrix using fitpack for the Y direction
Parameters: |
|
---|---|
Returns: | displacement matrix for the Y direction |
Return type: | ndarray |
The tilt method apply a virtual tilt on the detector, the point of tilt is given by the center
Parameters: |
|
---|---|
Returns: | tilted Spline instance |
Return type: | Spline |
save the cubic spline in an ascii file usable with Fit2D or SPD
Parameters: | filename (str) – name of the file containing the cubic spline distortion file |
---|
save the distortion matrices into a couple of files called basename-x.edf and basename-y.edf
Parameters: | basename (str) – base of the name used to save the data |
---|
Defines a spline file with no ( zero ) displacement.
Parameters: |
|
---|
Defines a spline file with no ( zero ) displacement with the same shape as the other one given.
Parameters: | other (Spline instance) – another Spline instance |
---|
Some tests ....
Bases: object
Simple class that contains the structure of an OpenCL device
Complete device description
Returns: | string |
---|
Bases: object
Simple class that wraps the structure ocl_tools_extended.h
This is a static class. ocl should be the only instance and shared among all python modules.
Choose a device and initiate a context.
Devicetypes can be GPU,gpu,CPU,cpu,DEF,ACC,ALL. Suggested are GPU,CPU. For each setting to work there must be such an OpenCL device and properly installed. E.g.: If Nvidia driver is installed, GPU will succeed but CPU will fail. The AMD SDK kit is required for CPU via OpenCL. :param devicetype: string in [“cpu”,”gpu”, “all”, “acc”] :param useFp64: boolean specifying if double precision will be used :param platformid: integer :param devid: integer :return: OpenCL context on the selected device
Retrieves the Device from the context
Parameters: | ctx – OpenCL context |
---|---|
Returns: | instance of Device |
Return a platform according
Parameters: | key (int or str) – identifier for a platform, either an Id (int) or it’s name |
---|
Select a device based on few parameters (at the end, keep the one with most memory)
Parameters: |
|
---|
Bases: object
Simple class that contains the structure of an OpenCL platform
Add new device to the platform
Parameters: | device – Device instance |
---|
Return a device according to key
Parameters: | key (int or str) – identifier for a device, either it’s id (int) or it’s name |
---|
Parameters: | buffers – the buffers info use to create the pyopencl.Buffer |
---|---|
Returns: | a dict containing the instanciated pyopencl.Buffer |
Return type: | dict(str, pyopencl.Buffer) |
This method instanciate the pyopencl.Buffer from the buffers description.
Parameters: | cl_buffer (dict(str, pyopencl.Buffer)) – the buffer you want to release |
---|
This method release the memory of the buffers store in the dict
This module contains the Worker class:
A tool able to perform azimuthal integration with: additional saving capabilities like - save as 2/3D structure in a HDF5 File - read from HDF5 files
Aims at being integrated into a plugin like LImA or as model for the GUI
The configuration of this class is mainly done via a dictionary transmitted as a JSON string: Here are the valid keys:
“dist”, “poni1”, “poni2”, “rot1” “rot3” “rot2” “pixel1” “pixel2”
“splineFile” “wavelength”
“poni” #path of the file
“chi_discontinuity_at_0” “do_mask” “do_dark” “do_azimuthal_range” “do_flat” “do_2D” “azimuth_range_min” “azimuth_range_max”
“polarization_factor” “nbpt_rad” “do_solid_angle” “do_radial_range” “do_poisson” “delta_dummy” “nbpt_azim” “flat_field” “radial_range_min” “dark_current” “do_polarization” “mask_file” “detector” “unit” “radial_range_max” “val_dummy” “do_dummy” “method”
}
Bases: object
Simple worker doing dark, flat, solid angle and polarization correction
Process the data and apply a normalization factor :param data: input data :param normalization: normalization factor :return processed data
Bases: object
Simple worker doing dark, flat, solid angle and polarization correction
Process the data and apply a normalization factor :param data: input data :param normalization: normalization factor :return processed data
Bases: object
return configuration as a dictionary
return configuration as a JSON string
Process a frame #TODO: dark, flat, sa are missing
Param: | data: numpy array containing the input image |
---|
This is just to force the integrator to initialize with a given input image shape
Parameters: |
|
---|
this is just to force the integrator to initialize
enforce the extension of the processed data file written
Set the relative or absolute path for processed data
Process a dummy image to ensure everything is initialized
Parameters: | sync – wait for processing to be finished |
---|
Module for “high-performance” writing in either 1D with Ascii , or 2D with FabIO or even nD with n varying from 2 to 4 using HDF5
Stand-alone module which tries to offer interface to HDF5 via H5Py and capabilities to write EDF or other formats using fabio.
Can be imported without h5py but then limited to fabio & ascii formats.
TODO: * add monitor to HDF5
Bases: pyFAI.io.Writer
Ascii file writer (.xy or .dat)
Creates the directory that will host the output file(s)
Bases: pyFAI.io.Writer
Image file writer based on FabIO
TODO !!!
Creates the directory that will host the output file(s)
Bases: pyFAI.io.Writer
Class allowing to write HDF5 Files.
Update some data like axis units and so on.
Parameters: |
|
---|
Initializes the HDF5 file for writing :param fai_cfg: the configuration of the worker as a dictionary
Minimalistic method to limit the overhead. :param data: array with intensities or tuple (2th,I) or (I,2th,chi)
Bases: object
Writer class to handle Nexus/HDF5 data Manages: entry
- pyFAI-subentry
- detector
#TODO: make it thread-safe !!!
close the filename and update all entries
perform a deep copy: create a “name” entry in self containing a copy of the object
Parameters: |
|
---|
Tries to find a detector within a NeXus file, takes the first compatible detector
Parameters: | all – return all detectors found as a list |
---|
return all sub-groups of the given type within a group
Parameters: |
|
---|
return all dataset of the the NeXus class NXdata
Parameters: |
|
---|
retrieves all entry sorted the latest first.
Returns: | list of HDF5 groups |
---|
Retrieves an entry from its name
Parameters: | name – name of the entry to retrieve |
---|---|
Returns: | HDF5 group of NXclass == NXentry |
create a new sub-group with type class_type :param grp: parent group :param name: name of the sub-group :param class_type: NeXus class name :return: subgroup created
Create a new entry/pyFAI/Detector
Parameters: |
|
---|
Create a new entry
Parameters: |
|
---|
@force_time: enforce the start_time (as string!) :return: the corresponding HDF5 group
Create an instrument in an entry or create both the entry and the instrument if
Bases: object
Abstract class for writers.
To be implemented
Creates the directory that will host the output file(s) :param fai_cfg: configuration for worker :param lima_cfg: configuration for acquisition
Sets the JSON configuration
To be implemented
Parameters: | text – string representing the time is iso format |
---|
Parameters: | forceTime (float) – enforce a given time (current by default) |
---|---|
Returns: | the current time as an ISO8601 string |
Return type: | string |
Check if a file is actually a HDF5 file
Parameters: | filename – this file has better to exist |
---|
Bases: object
A massif is defined as an area around a peak, it is used to find neighbouring peaks
defines a map of the massif around x and returns the mask
All in one function that finds a maximum from the given seed (x) then calculates the region extension and extract position of the neighboring peaks. :param x: seed for the calculation, input coordinates :param nmax: maximum number of peak per region :param annotate: call back method taking number of points + coordinate as input. :param massif_contour: callback to show the contour of a massif with the given index. :param stdout: this is the file where output is written by default. :return: list of peaks
:return binned data
Returns: | a blurred image |
---|
Returns: | an image composed of int with a different value for each massif |
---|
Returns: | a spacial median filtered image |
---|
Parameters: | x – coordinates of the peak |
---|
:returns the coordinates of the nearest peak
Return the list of peaks within an area
Parameters: |
|
---|---|
Returns: | list of peaks [y,x], [y,x], ...] |
Defines the minimum distance between two massifs
Bases: object
Performs a blob detection: http://en.wikipedia.org/wiki/Blob_detection using a Difference of Gaussian + Pyramid of Gaussians
Perform and plot the two main directions of the peaks, considering their previously calculated scale ,by calculating the Hessian at different sizes as the combination of gaussians and their first and second derivatives
Return the nearest peak from a position
Parameters: |
|
---|
Return the list of peaks within an area
Parameters: |
|
---|---|
Returns: | list of peaks [y,x], [y,x], ...] |
Perform the keypoint extraction for max_octave cycles or until all octaves have been processed. :param max_octave: number of octave to process
Refine the keypoint location based on a 3 point derivative, and delete uncoherent keypoints
Parameters: |
|
---|
:return arrays of corrected coordinates of keypoints, values and locations of keypoints
Savitzky Golay algorithm to check if a point is really the maximum :param kpx: x_pos of keypoint :param kpy: y_pos of keypoint :param kps: s_pos of keypoint :return array of corrected keypoints
Shows a window with the repartition of keypoint in function of scale/intensity
Parameters: | dogs – 3d array with (sigma,y,x) containing difference of gaussians |
---|
@parm mask: mask out keypoint next to the mask (or inside the mask) :param n_5: look for a larger neighborhood
Bases: object
This class applies a distortion correction on an image.
New version compatible both with CSR and LUT...
initialize all arrays
Considering the “half-CCD” spline from ID11 which describes a (1025,2048) detector, the physical location of pixels should go from: [-17.48634 : 1027.0543, -22.768829 : 2028.3689] We chose to discard pixels falling outside the [0:1025,0:2048] range with a lose of intensity
Correct an image based on the look-up table calculated ...
Parameters: |
|
---|---|
Returns: | corrected 2D image |
#TODO: #225
reset the distortion correction and re-calculate the look-up table
Parameters: |
|
---|
Take an image which has been corrected and transform it into it’s raw (with loss of information)
Parameters: | image – 2D-array with the image |
---|---|
Returns: | uncorrected 2D image and a mask (pixels in raw image |
Bases: object
xxxxxAxxxxxxxI’xxxxxxxx xxxxxxxxxIxxxxxx | x
Bxxxxxxxxxxxx | | x x | | x x | | x
x | | x x | | x x | | x x | | x x | | x
x | | x x | | x x | | x x O| P A’ x
x | x x | x x | x
x | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxD CxxxxxxxxxxxxxxxxxKxxxxx
Bases: dict
Simple class half way between a dict and a class, behaving as an enum
Utilities, mainly for image treatment
Bases: set
Like a set, made for FixedParameters in geometry refinement
Add a value to a set if value, else discard it :param key: element to added or discared from set :type value: boolean. If None do nothing ! :return: None
Averages a serie of dark (or flat) images. Centers the result on the mean or the median ... but averages all frames within cutoff*std
Parameters: |
|
---|---|
Returns: | 2D image averaged |
Takes a list of filenames and create an average frame discarding all saturated pixels.
Parameters: |
|
---|---|
Returns: | filename with the data or the data ndarray in case format=None |
Parameters: |
|
---|---|
Returns: | binned input ndarray |
Tries to guess the bounding box around a valid massif
Parameters: | img – 2D array like |
---|---|
Returns: | 4-typle (d0_min, d1_min, d0_max, d1_max) |
Calculate the checksum by default (or returns its buffer location if unsafe)
Calculate the center of mass of of the array. Like scipy.ndimage.measurements.center_of_mass :param img: 2-D array :return: 2-tuple of float with the center of mass
Parameters: | filenames – filenames containing the kernels |
---|
this method concatenates all the kernel from the list
convert a function name in CamelCase into camel_case
Convert degrees to radian in the range -pi->pi
Parameters: | dd – angle in degrees |
---|
Nota: depending on the platform it could be 0<2pi A branch is cheaper than a trigo operation
2D difference of gaussian typically 1 to 10 parameters
2-dimensional Difference of Gaussian filter implemented with FFTw
Parameters: |
|
---|
Expand array a with its reflection on boundaries
Parameters: |
|
---|
:param mode:”constant”, “nearest”, “reflect” or mirror :param cval: filling value used for constant, 0.0 by default
Nota: sigma is the half-width of the kernel. For gaussian convolution it is adviced that it is 4*sigma_of_gaussian
This expands a vector to a 2d-array.
The resul is the same as if vertical:
numpy.outer(numpy.ones(size2), vect)
This is a ninja optimization: replace *1 with a memcopy, saves 50% of time at the ms level.
Parameters: |
|
---|
Takes an argv and expand it (under Windows, cmd does not convert *.tif into a list of files. Keeps only valid files (thanks to glob)
Parameters: | args – list of files or wilcards |
---|---|
Returns: | list of actual args |
Convert anything to a float ... or None if not applicable
Return a Gaussian window of length M with standard-deviation std.
This differs from the scipy.signal.gaussian implementation as: - The default for sym=False (needed for gaussian filtering without shift) - This implementation is normalized
Parameters: |
|
---|
The FWHM is 2*numpy.sqrt(2 * numpy.pi)*std
2-dimensional Gaussian filter implemented with FFTw
Parameters: |
|
---|
get the full path of a calibration directory
Returns: | the full path of the calibrant file |
---|
get the full path of a openCL file
Returns: | the full path of the openCL source file |
---|
get the full path of a user-interface file
Returns: | the full path of the ui |
---|
Convert anything to an int ... or None if not applicable
Tells if a point is far from a group of points, distance greater than d2 (distance squared)
Parameters: |
|
---|---|
Returns: | True If the point is far from all others. |
Bases: object
meant to be used for lazy evaluation of an object attribute. property should represent non-mutable data, as it replaces itself.
Same as scipy.ndimage.measurements.maximum_position: Find the position of the maximum of the values of the array.
Parameters: | img – 2-D image |
---|---|
Returns: | 2-tuple of int with the position of the maximum |
Measure the actual offset between 2 images :param img1: ndarray, first image :param img2: ndarray, second image, same shape as img1 :param withLog: shall we return logs as well ? boolean :return: tuple of floats with the offsets
Read float from the keyboard ....
Parameters: |
|
---|
Parameters: | filename – read an OpenCL file and apply a preprocessor |
---|---|
Returns: | preprocessed source code |
Relabel limits the number of region in the label array. They are ranked relatively to their max(I0)-max(blur(I0)
Parameters: |
|
---|
:return array like label
Parameters: |
|
---|---|
Returns: | another dataset |
This function returns the integer >=N for which size the Fourier analysis is faster (fron the FFT point of view) Credit: Alessandro Mirone, ESRF, 2012
Parameters: | N – interger on which one would like to do a Fourier transform |
---|---|
Returns: | integer with a better choice |
Shift an array like scipy.ndimage.interpolation.shift(input_img, shift_val, mode=”wrap”, order=0) but faster :param input_img: 2d numpy array :param shift_val: 2-tuple of integers :return: shifted image
Do shift using FFTs Shift an array like scipy.ndimage.interpolation.shift(input, shift, mode=”wrap”, order=”infinity”) but faster :param input_img: 2d numpy array :param shift_val: 2-tuple of float :return: shifted image
Convert anything to a string ... but None -> “”
Parameters: |
|
---|---|
Returns: | unBinned input ndarray |
gui_utils
Module to handle matplotlib and the Qt backend
Bases: object
Dummy class for dummy things
Try to set the figure fullscreen
Update a matplotlib figure with a Qt4 backend
Parameters: | fig – pylab figure |
---|