pyimcom.diagnostics.noise_diagnostics

Report section for noise diagnostics.

Classes

NoiseReport

Noise report section.

Notes

This incorporates functionality that was previously in noisespecs.py.

It also includes the updated functionality from the Laliotis et al. analysis (August 2024).

This version is trying to implement some things to reduce imcom-related correlations, including:

  1. only FFTing the interior postage stamp region (throwing out padded regions)

  2. convolving noise images with a window function before FFTing

We have changed the clipping to use the full unique region [bdpad:L+bdpad,bdpad:L+bdpad] in each image.

Attributes

RomanFilters

AreaArray

Classes

PspecResults

NoiseReport

The noise section of the report.

Module Contents

RomanFilters = ['W146', 'F184', 'H158', 'J129', 'Y106', 'Z087', 'R062', 'PRSM', 'DARK', 'GRSM', 'K213'][source]
AreaArray = [22085, 4840, 7340, 7111, 7006, 6635, 9011, 0, 0, 0, 4654][source]
class PspecResults[source]

Bases: tuple

ps_image[source]
ps_image_err[source]
npix[source]
k[source]
ps_2d[source]
noiselayer[source]
class NoiseReport(rpt)[source]

Bases: pyimcom.diagnostics.report.ReportSection

The noise section of the report.

Inherits from pyimcom.diagnostics.report.ReportSection. Overrides build.

nblock

Number of blocks in the (sub)mosaic used.

Type:

int

psfiles

List of power spectrum file names.

Type:

list of str

outslab

Indices of the layers used for the power spectrum computation.

Type:

list of int

orignames

Names of the layers used for the power spectrum computation.

Type:

list of str

L

Side length of the unique region in a block, in output pixels.

Type:

int

noiselayers

A dictionary with values that are integers corresponding to the input layer corresponding to the type of noise indicated in the key. (Keys should be strings.)

Type:

dict

NLK

The keys of noiselayers, sorted in the same order as EXTRAINPUT in the configuration.

Type:

list of str

build(nblockmax=100, m_ab=23.9, bin_flag=1, alpha=0.9, tarfiles=True)[source]

Builds the noise section of the report.

Parameters:
  • nblockmax (int, optional) – Maximum size of mosaic to build.

  • m_ab (float, optional) – Scaling magnitude (not currently used).

  • bin_flag (int, optional) – Whether to bin? (1 = bin 8x8, 0 = do not bin)

  • alpha (float, optional) – Tukey window width for noise power spectrum.

  • tarfiles (bool, optional) – Generate a tarball of the data files?

Return type:

None

build_noisespec(m_ab, bin_flag, alpha)[source]

Computes the noise power spectrum.

Parameters:
  • m_ab (float) – Reference star brightness (not used)

  • bin_flag (int, optional) – Whether to bin? (1 = bin 8x8, 0 = do not bin) Note that binning is disabled if the input image is too small.

  • alpha (float, optional) – Tukey window width for noise power spectrum.

Returns:

Status string (‘Completed’).

Return type:

str

static measure_power_spectrum(noiseframe, L, norm=1.0, bin=True, win=True, alpha=0.9)[source]

Measure the 2D power spectrum of image.

Parameters:
  • noiseframe (np.array) – The 2D input image to measure the power spectrum of. In this case, a noise frame from the simulations

  • L (int) – The length of the FFT (must be a multiple of 8).

  • norm (float, optional) – The normalization to use (power spectrum is |FFT|^2/norm).

  • bin (bool, optional) – Whether to bin the 2D spectrum. Default=True, bins spectrum into L/8 x L/8 image. Potential extra rows are cut off.

  • win (bool, optional) – Whether to convolve the noise frame with a Tukey window function.

  • alpha (float, optional) – Tukey window parameter.

Returns:

The 2D power spectrum of the image.

Return type:

np.array

static _get_wavenumbers(window_length, num_radial_bins)[source]

Calculate wavenumbers for the input image.

Parameters:
  • window_length (int) – The length of one axis of the image.

  • num_radial_bins (int) – Number of radial bins the image should be averaged into.

Returns:

kmean – 1D array of the wavenumbers for the image

Return type:

np.array

static azimuthal_average(image, num_radial_bins)[source]

Compute radial profile of image.

Parameters:
  • image (np.array) – Input image, 2D.

  • num_radial_bins (int) – Number of radial bins in profile.

Returns:

  • r (np.array) – Value of radius at each point

  • radial_mean (np.array) – Mean intensity within each annulus. Main result

  • radial_err (np.array) – Standard error on the mean: sigma / sqrt(N).

static get_powerspectra(noiseframe, L, norm, num_radial_bins, use_slice=-1, bin_flag=1, win=True, alpha=0.9)[source]

Calculate the azimuthally-averaged 1D power spectrum of the image.

Parameters:
  • noiseframe (np.array) – The 2D input image to be averaged over.

  • L (int) – Length of FFT (must be a multiple of 8).

  • norm (float) – Normalization of |FFT|^2->power spectrum.

  • num_radial_bins (int) – Number of bins, should match bin number in get_wavenumbers

  • use_slice (int, optional) – Noise slice number used.

  • bin_flag (int, optional) – Binning? (1=yes, 0=no).

  • win (bool, optional) – Whether to convolve the noise frame with a Tukey window function.

  • alpha (float, optional) – Tukey window parameter.

Returns:

results – Power spectrum results.

Return type:

collection.namedtuple

average_spectra(bin_flag)[source]

Averages together all the power spectra in one band.

Parameters:

bin_flag – Whether to bin? (1 = bin 8x8, 0 = do not bin)

Return type:

None

gen_overview_fig()[source]

Makes a simple overview figure.

Returns:

File name of the figure written.

Return type:

str