nabu.estimation.distortion module

nabu.estimation.distortion.estimate_flat_distortion(flat, image, tile_size=100, interpolation_kind='linear', padding_mode='edge', correction_spike_threshold=None, logger=None)[source]

Estimate the wavefront distortion on a flat image, from another image.

Parameters:
  • flat (np.array) – The flat-field image to be corrected

  • image (np.ndarray) – The image to correlate the flat against.

  • tile_size (int) – The wavefront corrections are calculated by correlating the image to the flat, region by region. The regions are tiles of size tile_size

  • interpolation_kind ("linear" or "cubic") – The interpolation method used for interpolation

  • padding_mode (string) – Padding mode. Must be valid for np.pad when wavefront correction is applied, the corrections are first found for the tiles, which gives the shift at the center of each tiled. Then, to interpolate the corrections, at the positions f every pixel, on must add also the border of the extremal tiles. This is done by padding with a width of 1, and using the mode given ‘padding_mode’.

  • correction_spike_threshold (float, optional) – By default it is None and no spike correction is performed on the shifts grid which is found by correlation. If set to a float, a spike removal will be applied using such threshold

Returns:

coordinates – An array having dimensions (flat.shape[0], flat.shape[1], 2) where each coordinates[i,j] contains the coordinates of the position in the image “flat” which correlates to the pixel (i,j) in the image “im2”.

Return type:

np.ndarray