cfelpyutils.geometry_utils module¶
Geometry utilities.
This module contains the implementation of several functions used to manipulate geometry information.
-
class
cfelpyutils.geometry_utils.
PixelMaps
(x, y, r)¶ Bases:
tuple
Pixel maps storing data geometry.
A namedtuple that stores the pixel maps describing the geometry of a dataset. The first two fields, named “x” and “y” respectively, store the pixel maps for the x coordinate and the y coordinate. The third field, named “r”, is instead a pixel map storing the distance of each pixel in the data array from the center of the reference system.
-
r
¶ Alias for field number 2
-
x
¶ Alias for field number 0
-
y
¶ Alias for field number 1
-
-
cfelpyutils.geometry_utils.
compute_min_array_size
(pixel_maps)¶ Compute the minimum array size storing data with applied geometry.
Return the minimum size of an array that can store data on which the geometry information described by the pixel maps has been applied.
The returned array shape is big enough to display all the input pixel values in the reference system of the physical detector. The array is also supposed to be centered at the center of the reference system of the detector (i.e: the beam interaction point).
Parameters: [PixelMaps] (pixel_maps) – a PixelMaps tuple. Returns: a numpy-style shape tuple storing the minimum array size. Return type: Tuple[int, int]
-
cfelpyutils.geometry_utils.
compute_pix_maps
(geometry)¶ Compute pixel maps from a CrystFEL geometry object.
Take as input a CrystFEL-style geometry object (A dictionary returned by the function load_crystfel_geometry function in the crystfel_utils module) and return a PixelMap tuple . The origin the reference system used by the pixel maps is set at the beam interaction point.
Parameters: geometry (dict) – A CrystFEL geometry object (A dictionary returned by the cfelpyutils.crystfel_utils.load_crystfel_geometry
function).Returns: A PixelMaps tuple storing the pixel maps (ndarrays of type float). Return type: PixelMaps
-
cfelpyutils.geometry_utils.
compute_visualization_pix_maps
(geometry)¶ Compute pixel maps for visualization of the data.
The pixel maps can be used for to display the data in a Pyqtgraph ImageView widget.
Parameters: geometry (dict) – A CrystFEL geometry object (A dictionary returned by the cfelpyutils.crystfel_utils.load_crystfel_geometry
function).Returns: - A PixelMaps tuple containing the adjusted pixel
- maps. The first two fields, named “x” and “y” respectively, store the pixel maps for the x coordinate and the y coordinates (as ndarrays of type int). The third field (“r”) is just set to None.
Return type: PixelMaps