inpystem.restore.interpolation module

This module implement the interpolate function which is an interface between 2D as 3D data and the interpolation function of scipy.

inpystem.restore.interpolation.interpolate(Y, mask=None, method='nearest', PCA_transform=True, PCA_th='auto', verbose=True)

Implements data interpolation.

Three interpolation methods are implemented: nearest neighbor, linear interpolation and cubic interpolation.

Note that cubic interpolation is performed band-by-band in the case of 3D data while other methods perform in 3D directly.

Parameters
  • Y ((m, n) or (m, n, l) numpy array) – Input data

  • mask (optional, None, (m, n) numpy array) – Sampling mask. True for sampled pixel. Default is None for full sampling.

  • method (optional, 'nearest', 'linear' or 'cubic') – Interpolation method. Default is ‘nearest’.

  • PCA_transform (optional, bool) – Enables the PCA transformation if True, otherwise, no PCA transformation is processed. Default is True.

  • PCA_th (optional, int, str) – The desired data dimension after dimension reduction. Possible values are ‘auto’ for automatic choice, ‘max’ for maximum value and an int value for user value. Default is ‘auto’.

  • verbose (optional, bool) – Indicates if information text is desired. Default is True.

Returns

  • (m, n) or (m, n, l) numpy array – Interpolated data.

  • float – Execution time (s).