regularizepsf.util#

Utility functions for regularizepsf.

Classes#

IndexedCube

A stack of arrays with assigned coordinates as keys.

Functions#

calculate_covering(→ numpy.ndarray)

Determine the grid of overlapping neighborhood patches.

Module Contents#

regularizepsf.util.calculate_covering(image_shape: tuple[int, int], size: int) numpy.ndarray#

Determine the grid of overlapping neighborhood patches.

Parameters:
  • image_shape (tuple of 2 ints) – shape of the image we plan to correct

  • size (int) – size of the square patches we want to create

Returns:

an array of shape Nx2 where return[:, 0] are the x coordinate and return[:, 1] are the y coordinates

Return type:

np.ndarray

class regularizepsf.util.IndexedCube(coordinates: list[tuple[int, int]], values: numpy.ndarray)#

A stack of arrays with assigned coordinates as keys.

Initialize an IndexedCube.

Parameters:
  • coordinates (list[tuple[int, int]]) – list of image coordinates for upper left corner of the cube patches represented.

  • values (np.ndarray) – an array of image cube patches, should be size (len(coordinates), x, y) where x and y are the dimensions of the patches

_coordinates#
_values#
_index#
property sample_shape: tuple[int, int]#

Shape of individual sample.

__getitem__(coordinate: tuple[int, int]) numpy.ndarray#

Get the sample associated with that coordinate.

Parameters:

coordinate (tuple[int, int]) – reference coordinate for requested array

Returns:

sample at that coordinate

Return type:

np.ndarray

__setitem__(coordinate: tuple[int, int], value: numpy.ndarray) None#

Set the array associated with that coordinate.

Parameters:
  • coordinate (tuple[int, int]) – reference coordinate for sample

  • value (np.ndarray) – value at the sample

Returns:

sample array

Return type:

np.ndarray

property coordinates: list[tuple[int, int]]#

Retrieve coordinates the transfer kernel is defined on.

Returns:

coordinates the transfer kernel is defined on.

Return type:

list[tuple[int, int]]

property values: numpy.ndarray#

Retrieve values of the cube.

__len__() int#

Return number of sample cube is indexed on.

Returns:

number of sample cube is indexed on.

Return type:

int

__eq__(other: IndexedCube) bool#

Test equality between two IndexedCubes.