romanimpreprocess.L1_to_L2.gen_noise_image

Routines to generate noise realizations.

Functions

_get_subscript

Helper function for parsing noise directives.

make_noise_cube

Makes a noise cube; a bunch of 2D images (realization, y, x).

generate_all_noise

Driver to generate noise realizations.

Attributes

config

Functions

_get_subscript(arr, ch)

Helper function for parsing noise directives.

make_noise_cube(config, rng)

Noise generator.

generate_all_noise(config)

Driver for noise generation.

Module Contents

_get_subscript(arr, ch)[source]

Helper function for parsing noise directives.

Takes a character ch in the array, and return the string that goes out to but does not include the next capital letter. e.g.:

_get_subscript('RS2Pg4', 'S') --> '2'
_get_subscript('RS2Pg4', 'P') --> 'g4'
Parameters:
  • arr (str) – A string containing many directives separated by capital letters.

  • ch (str) – Character that we want to subscript.

Returns:

The subscript of ch.

Return type:

str

make_noise_cube(config, rng)[source]

Noise generator.

Makes alternative files with extra read noise, and then differences them to return a “noise only” slope image. The list of noise realizations to generate is controlled by config["NOISE"]["LAYER"].

Parameters:
  • config (dict) – Configuration dictionary (likely unpacked from a YAML file).

  • rng (galsim.BaseDeviate) – Random number generator.

Returns:

The noise realizations, shape = (N_noise,nside_active,nside_active).

Return type:

np.array

generate_all_noise(config)[source]

Driver for noise generation.

Parameters:

config (dict) – The configuration (usually unpacked from a YAML file).

Return type:

None

Notes

This requires an additional ‘NOISE’ object in the configuration dictionary. It should have the entries:

  • config['NOISE']['LAYER'] : list of noise realizations to build

  • config['NOISE']['TEMP'] : temporary noise file location

  • config['NOISE']['SEED'] : random number seed for the read noise images

  • config['NOISE']['OUT'] : output of noise cube

Layer commands start with a capital letter, then have lower case or numerical indications:

  • R = include read noise

  • P... = placeholder for Poisson noise

  • S\d* = subtract sky using median filter of given order

  • C... = reserved for comment (no capital letters in …)

The configuration has to have been run, since it looks for the L2 file written by gen_cal_image.calibrateimage.

config[source]