solid_waffle.ftsolve
Fourier-domain flat correlation prediction code for solid-waffle.
Attributes
Functions
|
Transforms kernel so that it looks as expected to the eye. |
|
Transforms kernel from human-readable to numpy-readable. |
|
Transforms decentered a_i,j -> decentered a_-i,-j. |
|
Zero-pads array out to size NxN (if arr is smaller than this). |
|
Constructs a pairwise correlation kernel from a 2x2 covariance matrix. |
|
Fits a quantum yield model to a Phi-kernel. |
Test function for p2kernel. |
|
|
Predicts the unequal-time correlation function C_{abcd}(Delta i, Delta j). |
|
Evaluates the derivative of a non-linearity polynomial. |
|
Predicts a sequence of similar unequal-time correlation functions. |
|
Predicts the unequal-time correlation function C_{abcd}(Delta i, Delta j) for visible light. |
|
Predicts a sequence of similar unequal-time correlation functions, for visible light. |
Module Contents
- center(arr)[source]
Transforms kernel so that it looks as expected to the eye.
- Parameters:
arr (np.array) – 2D array kernel, square with odd side length.
- Returns:
Returns version of kernel with (0,0) in center, y=-1 down, x=-1 left, etc. Centered arrays should NOT be used for calculations! For display only.
- Return type:
np.array
See also
decenterInverse function.
- decenter(arr)[source]
Transforms kernel from human-readable to numpy-readable.
Only decentered arrays should be used for calculations.
- Parameters:
arr (np.array) – 2D array kernel, square with odd side length, human-readable.
- Returns:
Decentered array.
- Return type:
np.array
See also
centerInverse function.
- flip(arr)[source]
Transforms decentered a_i,j -> decentered a_-i,-j.
The function is its own inverse.
- Parameters:
arr (np.array) – 2D array kernel, square with odd side length, human-readable.
- Returns:
Flipped array.
- Return type:
np.array
- pad_to_N(arr, N)[source]
Zero-pads array out to size NxN (if arr is smaller than this).
- Parameters:
arr (np.array) – 2D input array, odd size, square, assumed to be centered.
N (int) – Size to pad arr to. Must be odd. Does nothing if arr is already this big.
- Returns:
The padded array.
- Return type:
np.array
- p2kernel(cov, np2, N_integ=256)[source]
Constructs a pairwise correlation kernel from a 2x2 covariance matrix.
- Parameters:
cov (list or np.array of float) – Length 3; [Cxx, Cxy, Cyy].
np2 (int) – Kernel radius to generate.
N_integ (int, optional) – Number of integration steps.
- Returns:
p2_output – The p2 kernel, of shape (2*`np2`+1, 2*`np2`+1) so that
p2_output[np2+j, np2+i]is the probability that if one charge generated in a flat field lands in (0,0), the other lands in (i,j).- Return type:
np.array of float
- op2_to_pars(op2, cmin=0.01)[source]
Fits a quantum yield model to a Phi-kernel.
- Parameters:
op2 (np.array) – The Phi-kernel, omega/(1+omega)*p2 (where omega is the 2-charge probability and p2 is the pairwise charge diffusion probability kernel). This is the combination that can be extracted from a correlation function.
cmin (float, optional) – Minimum semi-minor axis of the covariance. (Prevents regularity problems.)
- Returns:
Entries are [omega, cxx, cxy, cyy, change in last step, number of iterations].
- Return type:
list
- solve_corr(bfek, N, I_, g, betas, sigma_a, tslices, avals, avals_nl=[0, 0, 0], outsize=2)[source]
Predicts the unequal-time correlation function C_{abcd}(Delta i, Delta j).
- Parameters:
bfek (np.array) – Compound kernel [K^2 a+KK*] (assumed to be centered).
N (int) – Size to use for boudary conditions (must be odd, larger is more accurate).
I (float) – Current (elementary charges per pixel per frame).
g (float) – Gain in e/DN.
betas (np.array of float) – Array of classical non-linearity coefficients [beta_2…beta_n].
sigma_a (float) – Sum of the BFE kernel, in e^-1.
tslices (list of int) – List of time slices [ta, tb, tc, td].
avals (list or tuple of float) – The alpha values for the linear IPC kernel [aV, aH, aD]. Dimensionless.
avals_nl (list or tuple of float, optional) – The alpha values for NL-IPC kernel [aV_nl, aH_nl, aD_nl]. Units 1/e..
outsize (int, optional) – The “radius” of output (so the BFE kernel has size (2*outsize+1, 2*outsize+1).
- Returns:
An array of size (N, N) describing C_{abcd}(Delta i, Delta j) in “decentered” mode.
- Return type:
np.array
- eval_cnl(betas, I_, t)[source]
Evaluates the derivative of a non-linearity polynomial.
- Parameters:
betas (np.array) – The coefficients, in order starting from 2nd order (beta_2), then 3rd order (beta_3), etc.
I (float) – The current in electrons per pixel per frame.
t (float) – The time in frames since reset.
- Returns:
The derivative g*dS/dQ (where g is the gain in e/DN; S is the signal in DN; and Q is the charge in e).
- Return type:
float
- solve_corr_many(bfek, N, I_, g, betas, sigma_a, tslices, avals, avals_nl=[0, 0, 0], outsize=2)[source]
Predicts a sequence of similar unequal-time correlation functions.
- Parameters:
bfek (np.array) – Compound kernel [K^2 a+KK*] (assumed to be centered).
N (int) – Size to use for boudary conditions (must be odd, larger is more accurate).
I (float) – Current (elementary charges per pixel per frame).
g (float) – Gain in e/DN.
betas (np.array of float) – Array of classical non-linearity coefficients [beta_2…beta_n].
sigma_a (float) – Sum of the BFE kernel, in e^-1.
tslices (list of int) – List of time slices [ta, tb, tc, td, tn]. Should have tn>=1.
avals (list or tuple of float) – The alpha values for the linear IPC kernel [aV, aH, aD]. Dimensionless.
avals_nl (list or tuple of float, optional) – The alpha values for NL-IPC kernel [aV_nl, aH_nl, aD_nl]. Units 1/e..
outsize (int, optional) – The “radius” of output (so the BFE kernel has size (2*outsize+1, 2*outsize+1).
- Returns:
The mean correlation function, sum_{k=0}^{tn-1} C_{ta+k,tb+k,tc+k,td+k} / tn, as a shape (N, N) array, decentered.
- Return type:
np.array
See also
solve_correquivalent version with tn=1.
- solve_corr_vis(bfek, N, I_, g, betas, sigma_a, tslices, avals, avals_nl=[0, 0, 0], outsize=2, omega=0, p2=0)[source]
Predicts the unequal-time correlation function C_{abcd}(Delta i, Delta j) for visible light.
- Parameters:
bfek (np.array) – Compound kernel [K^2 a+KK*] (assumed to be centered).
N (int) – Size to use for boudary conditions (must be odd, larger is more accurate).
I (float) – Current (elementary charges per pixel per frame).
g (float) – Gain in e/DN.
betas (np.array of float) – Array of classical non-linearity coefficients [beta_2…beta_n].
sigma_a (float) – Sum of the BFE kernel, in e^-1.
tslices (list of int) – List of time slices [ta, tb, tc, td].
avals (list or tuple of float) – The alpha values for the linear IPC kernel [aV, aH, aD]. Dimensionless.
avals_nl (list or tuple of float, optional) – The alpha values for NL-IPC kernel [aV_nl, aH_nl, aD_nl]. Units 1/e..
outsize (int, optional) – The “radius” of output (so the BFE kernel has size (2*outsize+1, 2*outsize+1).
omega (float, optional) – The probability of getting 2 charges.
p2 (np.array, optional) – The pairwise separation probability for 2 charges generated at the same point in a flat field.
- Returns:
An array of size (N, N) describing C_{abcd}(Delta i, Delta j) in “decentered” mode.
- Return type:
np.array
See also
solve_corrSimilar but for IR flats.
- solve_corr_vis_many(bfek, N, I_, g, betas, sigma_a, tslices, avals, avals_nl=[0, 0, 0], outsize=2, omega=0, p2=0)[source]
Predicts a sequence of similar unequal-time correlation functions, for visible light.
- Parameters:
bfek (np.array) – Compound kernel [K^2 a+KK*] (assumed to be centered).
N (int) – Size to use for boudary conditions (must be odd, larger is more accurate).
I (float) – Current (elementary charges per pixel per frame).
g (float) – Gain in e/DN.
betas (np.array of float) – Array of classical non-linearity coefficients [beta_2…beta_n].
sigma_a (float) – Sum of the BFE kernel, in e^-1.
tslices (list of int) – List of time slices [ta, tb, tc, td, tn]. Should have tn>=1.
avals (list or tuple of float) – The alpha values for the linear IPC kernel [aV, aH, aD]. Dimensionless.
avals_nl (list or tuple of float, optional) – The alpha values for NL-IPC kernel [aV_nl, aH_nl, aD_nl]. Units 1/e..
outsize (int, optional) – The “radius” of output (so the BFE kernel has size (2*outsize+1, 2*outsize+1).
omega (float, optional) – The probability of getting 2 charges.
p2 (np.array, optional) – The pairwise separation probability for 2 charges generated at the same point in a flat field.
- Returns:
The mean correlation function, sum_{k=0}^{tn-1} C_{ta+k,tb+k,tc+k,td+k} / tn, as a shape (N, N) array, decentered.
- Return type:
np.array
See also
solve_corr_visequivalent version with tn=1.