pyimcom.meta.ginterp
Deconvolution-shear-reconvolution-resampling tools.
Functions
- InterpMatrix
Constructs an interpolation matrix.
- MultiInterp
Performs the interpolation.
- test
A test function for InterpMatrix.
Functions
|
Constructs a reconvolution + interpolation matrix. |
|
Interpolates from an input array to a regularly spaced output array, including some additional smoothing.. |
Module Contents
- InterpMatrix(Rsearch, samp, x_out, y_out, Cov, epsilon=1e-07, stest=1, verbose=False)[source]
Constructs a reconvolution + interpolation matrix.
- Parameters:
Rsearch (float) – Search radius (from corners), in gridded pixels.
samp (float) – Sampling rate of input image (samples per FWHM).
x_out (np.array of float) – Fractional pixel positions in x (0 to 1, inclusive), shape (Npts,).
y_out (np.array of float) – Fractional pixel positions in y (0 to 1, inclusive), shape (Npts,).
Cov (np.array of float) – Covariance matrix of extra smoothing. length 3, array-like [Cxx, Cxy, Cyy].
epsilon (float, optional) – Regularization parameter to prevent singular correlations.
stest (int, optional) – Computes diagnostics for every stest-th point instead of every point (default is every point). Saves time.
verbose (bool, optional) – Print timing information?
- Returns:
posx (np.array of int) – x positions of input pixels, shape (NN,)
posy (np.array of int) – y positions of input pixels, shape (NN,)
T (np.array of float) – Interpolation/smoothing matrix, shape (Npts, NN).
U (np.array of float) – Fractional squared leakage, shape (Npts,).
Sigma (np.array of float) – Noise amplification = sum_i T_{ai}^2, shape (Npts,).
Notes
This function actually has the same algorithm as IMCOM embedded in it. But the “system matrix” A is the same in all cases so it is much faster than IMCOM.
- MultiInterp(in_array, in_mask, out_size, out_origin, out_transform, Rsearch, samp, Cov, epsilon=1e-07, stest=1, blocksize=393216)[source]
Interpolates from an input array to a regularly spaced output array, including some additional smoothing..
- Parameters:
in_array (np.array of float) – Array to interpolate from (may be 3D, with multiple layers).
in_mask (np.array of bool) – Boolean mask for input array (True = masked; False = good).
out_size ((int, int)) – Output array size, format: (ny,nx).
out_origin (np.array) – Length 2 vector of origin for mapping input–>output coordinates.
out_transform (np.array) – Shape (2,2) matrix of Jacobian for mapping input–>output coordinates.
Rsearch (float) – Search radius (from corners) in pixels in in_array.
samp (float) – Sampling rate of input image (samples per FWHM).
Cov (np.array) – Covariance matrix of extra smoothing. length 3, flattened array-like [Cxx, Cxy, Cyy].
epsilon (float, optional) – Regularization parameter to prevent singular correlations.
stest (int, optional) – Computes diagnostics for every stest-th point instead of every point (default is every point). Saves time.
blocksize (int, optional) – Number of points to compute at once (larger is slightly faster but uses more memory).
- Returns:
out_array (np.array of float) – 2D or 3D. Same number of layers as in_array.
out_mask (np.array of bool) – Boolean mask for output array (True = masked; False = good).
Umax (float) – Maximum leakage from the interpolation step.
Smax (float) – Maximum noise metric from the interpolation step.
Notes
The mapping between input and output coordinates is, using out_origin and out_transform,
x_in = out_transform[0][0]*x_out + out_transform[0][1]*y_out + out_origin[0] y_in = out_transform[1][0]*x_out + out_transform[1][1]*y_out + out_origin[1]
Both are 0-offset, C/Python style.