APR_lib

APR(dset: ndarray, usf: int, ref: int, pxsize: float = 1, apodize: bool = True, filter_sigma: float = 1, mode: str = 'interp')[source]

It performs adaptive pixel reassignment on a single-plane ISM dataset using the phase correlation method.

Parameters:
  • dset (np.ndarray) – ISM dataset (Nx x Ny x Nch).

  • usf (int) – Upsampling factor (subpixel precision).

  • ref (int) – Index of the SPAD element to be used as a reference.

  • pxsize (float, optional) – Pixel size. The default is 1.

  • apodize (bool, optional) – If True, the dataset is apodized to calculate the shift-vectors. The default is True.

  • filter_sigma (float) – If bigger than zero, the dataset is denoised with a gaussian filter. The default is 1.

  • mode (str, optional) – Registration method. It can be a fourier shift (‘fourier’’) or a linear interpolation (‘interp’). The default is ‘interp’.

Returns:

  • shift_vec (np.ndarray) – Shift-vectors (Nch x 2). The second dimension is the x/y axis.

  • result_ism_pc (np.ndarray) – Reassigned ISM dataset (Nx x Ny x Nch).

Reassignment(shift_vec: ndarray, dset: ndarray, mode: str = 'interp')[source]

It reassignes a single-plane ISM dataset using the provided shift-vectors.

Parameters:
  • shift_vec (np.ndarray) – Shift-vectors array (Nch x 2).

  • dset (np.ndarray) – ISM dataset (Nx x Ny x Nch).

  • mode (str, optional) – Registration method. It can be a fourier shift (‘fourier’’) or an interpolation (‘interp’). The default is ‘interp’.

Returns:

result_ism_pc – Reassigned ISM dataset (Nx x Ny x Nch).

Return type:

np.ndarray

ShiftVectors(dset: ndarray, usf: int, ref: int, apodize: bool = True, filter_sigma: float = 0)[source]

It calculates the shift-vectors from a single-plane ISM dataset using the phase correlation method.

Parameters:
  • dset (np.ndarray) – ISM dataset (Nx x Ny x Nch).

  • usf (int) – Upsampling factor (subpixel precision).

  • ref (int) – Index of the SPAD element to be used as a reference.

  • apodize (bool) – If True, the dataset is apodized with a Hann windows The default is True.

  • filter_sigma (float) – If bigger than zero, the dataset is denoised with a gaussian filter. The default is 0.

Returns:

  • shift_vec (np.ndarray) – Shift-vectors (Nch x 2). The second dimension is the xy-axes.

  • error (np.ndarray) – Estimation error of the shift-vectors.

hann2d(shape: tuple)[source]

It generates a 2D Hann window for a 2D array.

Parameters:

shape (tuple) – Shape of the window. It has to be the same shape of the image to be windowed.

Returns:

W – 2D Hann window function.

Return type:

np.ndarray