Skip to content

data_structures

static_interpolation.data_structures

Classes:

Name Description
ImageLayout

Defines multi-panel image layout.

AGIPD_1MLayout

ImageLayout for the AGIPD_1M detector.

JUNGFRAU_4MLayout

ImageLayout for the JUNGFRAU_4M detector.

SamplingGrid

Defines sampling point collections.

ImageLayout [source] dataclass

Defines multi-panel image layout. ,implements data standardization routines.

Attributes:

Name Type Description
n_panels int)

Number of panels

num_x int

Number of data pixels in x-direction

num_y int)

Number of data pixels in y-direction

num_x_logical int)

Number of logical pixels in x-direction

num_y_logical int)

Number of logical pixels in y-direction

Methods:

Name Description
from_shape

ImageLayout constructor using a shape tuple.

normalize

Normalizes input data shape to (n_images,n_panels,num_x,num_y)

ravel

Ravel the image dimensions n_panel,num_x,num_y.

convert_logical_to_data_ids

Converts a set of logical indices into actual data indices.

data_shape property

tuple[int,int,int]: Data shape as tuple (n_panels,num_x,num_y)

logical_shape property

tuple[int,int,int]: Data shape as tuple (n_panels,num_x,num_y)

from_shape(data_shape, logical_shape=None) [source] classmethod

ImageLayout constructor using a shape tuple.

Parameters:

Name Type Description Default
data_shape tuple[int, ...]

Shape tuple of length 2 or 3. Tuples of length 2 are interpreted as single panel shape, only specifying num_x and num_y.

required

Returns: ImageLayout: instance

normalize(data) [source]

Normalizes input data shape to (n_images,n_panels,num_x,num_y) setting n_images and/or n_panels to 1 if necessary. Forces output data array to be c_contiguous. Possible intput shapes are: 1. (num_x,num_y) -> (1,1,num_x,num_y) 2. self.n_panels=1 and (n_images,num_x,num_y) -> (n_image,1,num_x,num_y) 3. self.n_panels!=1 and (n_panels,num_x,num_y -> (1,n_panels,num_x,num_y) 4. (n_image,n_panels,num_x,num_y) -> (n_image,n_panels,num_x,num_y)

Parameters:

Name Type Description Default
data NDArray

Input data set.

required

Returns: NDArray: reshaped version of data (No copy if input was C contiguous )

ravel(data) [source]

Ravel the image dimensions n_panel,num_x,num_y. (n_images,n_panels,num_x,num_y) -> (n_images,N) with N = n_panelsnum_xnum_y Args: data (NDArray): Input data set Returns: NDArray: Reshaped data set

convert_logical_to_data_ids(logical_ids) [source]

Converts a set of logical indices into actual data indices. This Routine simply does the identity map. Subclasses are supposed to overide this method.

Parameters:

Name Type Description Default
logical_ids NDArray

Array of indices with values in 0 to n_panelsnum_x_logicalnum_y_logical

required

Returns: NDArray: Corresponding Data indices

AGIPD_1MLayout [source] dataclass

Bases: ImageLayout

ImageLayout for the AGIPD_1M detector.

Attributes:

Name Type Description
n_panels int)

Number of panels = 16

num_x int

Number of data pixels in x-direction = 512

num_y int)

Number of data pixels in y-direction = 128

num_x_logical int)

Number of logical pixels in x-direction = 526

num_y_logical int)

Number of logical pixels in y-direction = 128

Methods:

Name Description
convert_logical_to_data_ids

Converts a set of logical AGIPD indices into actual data indices taking the double width pixel at

convert_logical_to_data_ids(logical_ids) [source]

Converts a set of logical AGIPD indices into actual data indices taking the double width pixel at asic boundaries into account, see https://doi.org/10.1107/S1600577518016077.

Parameters:

Name Type Description Default
logical_ids NDArray

Array of indices with values in 0 to 1077248

required

Returns: NDArray: Corresponding Data indices

JUNGFRAU_4MLayout [source] dataclass

Bases: ImageLayout

ImageLayout for the JUNGFRAU_4M detector.

Attributes:

Name Type Description
n_panels int)

Number of panels = 16

num_x int

Number of data pixels in x-direction = 512

num_y int)

Number of data pixels in y-direction = 1024

num_x_logical int)

Number of logical pixels in x-direction = 514

num_y_logical int)

Number of logical pixels in y-direction = 1030

Methods:

Name Description
convert_logical_to_data_ids

Converts a set of logical JUNGFRAU indices into actual data indices taking the double width/height and quadruple pixels at inner asic boundaries into account, see https://doi.org/10.1107/S1600577526000342.

convert_logical_to_data_ids(logical_ids) [source]

Converts a set of logical JUNGFRAU indices into actual data indices taking the double width/height and quadruple pixels at inner asic boundaries into account, see https://doi.org/10.1107/S1600577526000342.

X: –256–+1 | +1–256–
Y: –256–+1 | +1–256–+1 | +1–256–+1 | +1–256–

Parameters:

Name Type Description Default
logical_ids NDArray

Array of indices with values in 0 to 1077248

required

Returns: NDArray: Corresponding Data indices

SamplingGrid [source] dataclass

Defines sampling point collections. Attributes: points (NDArray): Has standard shape (n_panels,…,2). n_panels (int): Number of panels.

Methods:

Name Description
__post_init__

Forces self.points to be C-contiguous and checks points shape.

from_shared_points

SamplingGrid constructor for panel-independent points of shape (…, 2).

from_uniform_polar

Constructor of SamplingGrid for a uniform polar grid.

ravel

Returns self.points in the standard shape (n_panels,N,2)

Attributes:

Name Type Description
out_shape tuple[int, ...]

Returns the expected interpolation output shape.

out_shape property

Returns the expected interpolation output shape. Follows the premis that panels are not allowed to overlap. So the output shape is self.points.shape[1:-1].

Returns:

Name Type Description
tuple (int, ...)

Shape of interpolation output

__post_init__() [source]

Forces self.points to be C-contiguous and checks points shape.

from_shared_points(points, n_panels) [source] classmethod

SamplingGrid constructor for panel-independent points of shape (…, 2).

from_uniform_polar(n_panels, shape, max_radius, endpoint=False) [source] classmethod

Constructor of SamplingGrid for a uniform polar grid.

Parameters:

Name Type Description Default
n_panels int

number of panels

required
shape tuple(int, int)

shape of the uniform polar grid (number_of_radial_points,number_of_angular_points)

required
max_radius float

Maximal radial distance

required
endpoint bool

Whether max_radius or max_radius*(number_of_radial_points-1)/number_of_radial_points is the last radial point.

False

ravel() [source]

Returns self.points in the standard shape (n_panels,N,2) Returns: NDArray: reshaped version of self.points