romanimpreprocess.L1_to_L2.denoise_construct

Tools for building de-noising realizations from a science image.

This module was written by M. Gabe. A few wrapper functions added by C. Hirata.

Attributes

weights

Functions

raw_weights(N_beta, a_beta)

Generates the matrix L to transform raw frames into MA frames.

centmoms(N_beta, a_beta)

Calculates the central moments of our raw frames.

compress_moms(mom2, mom3, mom4lin, mom4quad, L)

Linearly compresses raw moments into MA moments using the raw weights L.

get_nus(N_beta, a_beta)

Finds nu_pl to 4th order

compress_nu(nu, W)

Compresses a nu_pl tensor of rank 2–4 using MA weights, W.

get_tilde_nus(N_beta, a_beta, W)

Calculates the tilde{nu}_pl's used in computing the

get_tilde_nus_from_list(grps, wt)

Similar, but with input of a grp list instead. Requires groups to be consecutive lists

Module Contents

raw_weights(N_beta, a_beta)[source]

Generates the matrix L to transform raw frames into MA frames.

Used in this code to calculate the “compressed” moments of the MA frames using the moments of the raw frames.

Inputs: N_beta – a 1D numpy vector describing how many frames we will sum over to make an MA frame a_beta – a 1D numpy vector detailing which frame index we start our sums

Output: (L) raw weights of size (M,N)

centmoms(N_beta, a_beta)[source]

Calculates the central moments of our raw frames.

This function does not include Ibar

For example, 2nd central moment = np.min(a,b) Ibar

but in this code, 2nd central moment = np.min(a,b)

as our nu_pl’s are independent of the value of Ibar

Inputs: N_beta – a 1D numpy vector describing how many frames we will sum over to make an MA frame a_beta – a 1D numpy vector detailing which frame index we start our sums

Outputs: (centmom2) 2nd central moment / Ibar (centmom3) 3rd central moment / Ibar (centmom4lin) 4th central moment term linear in Ibar / Ibar (centmom4quad) 4th central moment quadratic in Ibar / Ibar^2

compress_moms(mom2, mom3, mom4lin, mom4quad, L)[source]

Linearly compresses raw moments into MA moments using the raw weights L.

Used in this script to find the central moments of our MA frames using the central moments of our raw frames and their raw weights, L.

In this code, we treat the nu_pl’s as equal to the compressed moments of our MA frames, as they differ by a factor of Ibar or Ibar^2, which cancel out when being compressed.

Inputs: (centmom2) 2nd central moment / Ibar (centmom3) 3rd central moment / Ibar (centmom4lin) 4th central moment term linear in Ibar / Ibar (centmom4quad) 4th central moment quadratic in Ibar / Ibar^2

Outputs: mom2x = compressed centmom2 mom3x = compressed centmom3 mom4linx = compressed centmom4lin mom4quadx = compressed centmom4quad

get_nus(N_beta, a_beta)[source]

Finds nu_pl to 4th order

Inputs: N_beta – a 1D numpy vector describing how many frames we will sum over to make an MA frame a_beta – a 1D numpy vector detailing which frame index we start our sums

compress_nu(nu, W)[source]

Compresses a nu_pl tensor of rank 2–4 using MA weights, W.

Inputs: nu_pl (hypercubic array of dimension p with side length N) (W) MA weights (size N)

Outputs scalars based on the dimension of nu_pl: W^a W^b [nu_2l]_a,b W^a W^b W^c [nu_3l]_a,b,c W^a W^b W^c W^d [nu_4l]_a,b,c,d

get_tilde_nus(N_beta, a_beta, W)[source]

Calculates the tilde{nu}_pl’s used in computing the 2nd, 3rd, and 4th moments of our xi distribution.

Inputs: N_beta – a 1D numpy vector describing how many frames we will sum over to make an MA frame a_beta – a 1D numpy vector detailing which frame index we start our sums

get_tilde_nus_from_list(grps, wt)[source]

Similar, but with input of a grp list instead. Requires groups to be consecutive lists (drops between groups OK, drops within group not OK).

weights[source]