pyimcom.routine
Numba version of pyimcom_croutines.c.
Slightly slower than C, used when furry-parakeet is not installed.
Functions
- iD5512C_getw
Interpolation code written by Python.
- iD5512C
2D, 10x10 kernel interpolation for high accuracy.
- iD5512C_sym
iD5512C for symmetrical output.
- gridD5512C
iD5512C for rectangular grid.
- lakernel1
PyIMCOM linear algebra kernel (eigendecomposition).
- lsolve_sps
Routine to solve Ax=b.
- build_reduced_T_wrap
Makes coaddition matrix T from a reduced space.
Functions
|
Interpolation code written by Python. |
|
2D, 10x10 kernel interpolation for high accuracy |
|
2D, 10x10 kernel interpolation for high accuracy |
|
2D, 10x10 kernel interpolation for high accuracy |
|
PyIMCOM linear algebra kernel (eigendecomposition). |
|
Routine to solve Ax=b. |
|
Intermediate quantities to build coaddition matrix T from a reduced space. |
Module Contents
- iD5512C_getw(w: numpy.array, fh: float) None[source]
Interpolation code written by Python.
- Parameters:
w (np.array) – Array, shape (10,); 1D interpolation weights will be written here.
fh (float) – ‘xfh’ and ‘yfh’ with 1/2 subtracted.
- Return type:
None
- iD5512C(infunc: numpy.array, xpos: numpy.array, ypos: numpy.array, fhatout: numpy.array) None[source]
2D, 10x10 kernel interpolation for high accuracy
Can interpolate multiple functions at a time from the same grid so we don’t have to keep recomputing weights.
- Parameters:
infunc (np.array) – Input function on some grid. Shape (nlayer, ngy, ngx).
xpos (np.array) – Input x values. Shape (nout,).
ypos (np.array) – Input y values. Shape (nout,).
fhatout (np.array) – Location to put the output values. Shape : (nlayer, nout).
- Return type:
None
- iD5512C_sym(infunc: numpy.array, xpos: numpy.array, ypos: numpy.array, fhatout: numpy.array) None[source]
2D, 10x10 kernel interpolation for high accuracy
Can interpolate multiple functions at a time from the same grid so we don’t have to keep recomputing weights.
This version assumes the output is symmetrical as a sqrt nout x sqrt nout matrix
- Parameters:
infunc (np.array) – Input function on some grid. Shape (nlayer, ngy, ngx).
xpos (np.array) – Input x values. Shape (nout,).
ypos (np.array) – Input y values. Shape (nout,).
fhatout (np.array) – Location to put the output values. Shape (nlayer, nout).
- Return type:
None
- gridD5512C(infunc: numpy.array, xpos: numpy.array, ypos: numpy.array, fhatout: numpy.array) None[source]
2D, 10x10 kernel interpolation for high accuracy
this version works with output points on a rectangular grid so that the same weights in x and y can be used for many output points
- Parameters:
infunc (np.array) – Input function on some grid. Shape (ngy, ngx).
xpos (np.array) – Input x values. Shape (npi, nxo).
ypos (np.array) – Input y values. Shape (npi, nyo).
fhatout (np.array) – Location to put the output values. Shape (npi, nyo*nxo).
- Return type:
None
Notes
There are npi*nyo*nxo interpolations to be done in total, but for each input pixel npi, there is an nyo x nxo grid of output points. If you want a 3D array (npi, nyo, nxo), you can reshape fhatout after it is filled.
- lakernel1(lam: numpy.array, Q: numpy.array, mPhalf: numpy.array, C: float, targetleak: float, kCmin: float, kCmax: float, nbis: int, kappa: numpy.array, Sigma: numpy.array, UC: numpy.array, T: numpy.array, smax: float) None[source]
PyIMCOM linear algebra kernel (eigendecomposition).
Performs all the steps with the for loops (i.e., except the matrix diagonalization). In the parameter descriptions, “n” refers to the number of input pixels and “m” to the number of output pixels.
- Parameters:
lam (np.array) – System matrix eigenvalues. Shape (n,).
Q (np.array) – System matrix eigenvectors. Shape (n, n). (No longer used in this version of the algorithm.)
mPhalf (np.array) – -P/2 = premultiplied target overlap matrix. Shape (m, n).
C (float) – Target normalization.
targetleak (float) – Allowable leakage of target PSF.
kCmin (float, float) – Range of kappa/C to test.
kCmax (float, float) – Range of kappa/C to test.
nbis (int) – Number of bisections.
kappa (np.array) – Lagrange multiplier per output pixel. Shape (m,). Writes to this array.
Sigma (np.array) – Output noise amplification. Shape (m,). Writes to this array.
UC (np.array) – Fractional squared error in PSF. Shape (m,). Writes to this array.
T (np.array) – Coaddition matrix, needs to be multiplied by Q^T after the return. Shape (m,n). Writes to this array.
smax (float) – Maximum allowed noise amplification Sigma.
- Return type:
None
- lsolve_sps(N: int, A: numpy.array, x: numpy.array, b: numpy.array) None[source]
Routine to solve Ax=b.
Only the lower triangle of A is ever used (the rest need not even be allocated). The matrix A is destroyed.
- build_reduced_T_wrap(Nflat: numpy.array, Dflat: numpy.array, Eflat: numpy.array, kappa: numpy.array, ucmin: float, smax: float, out_kappa: numpy.array, out_Sigma: numpy.array, out_UC: numpy.array, out_w: numpy.array) None[source]
Intermediate quantities to build coaddition matrix T from a reduced space.
In the parameter descriptions, “m” refers to the number of output pixels and “nv” to the number of kappa nodes.
- Parameters:
Nflat (np.array) – Input noise array. Shape (m*nv*nv,). Flattened version of (m,nv,nv).
Dflat (np.array) – Input 1st order signal D/C. Shape (m*nv,). Flattened version of (m,nv).
Eflat (np.array) – Input 2nd order signal E/C. Shape (m*nv*nv,). Flattened version of (m,nv,nv).
kappa (np.array) – List of eigenvalues, must be sorted ascending. Shape (nv,).
ucmin (float) – Min U/C.
smax (float) – Max Sigma (noise).
out_kappa (np.array) – Output “kappa” parameter. Shape (m,).
out_Sigma (np.array) – Output “Sigma”. Shape (m,).
out_UC (np.array) – Output “U/C”. Shape (m,).
out_w (np.array) – Output weights for each eigenvalue and each output pixel. Shape (m*nv,). Flattened version of (m,nv).
- Return type:
None