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
Functions
|
Helper function for parsing noise directives. |
|
Noise generator. |
|
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 buildconfig['NOISE']['TEMP']: temporary noise file locationconfig['NOISE']['SEED']: random number seed for the read noise imagesconfig['NOISE']['OUT']: output of noise cube
Layer commands start with a capital letter, then have lower case or numerical indications:
R= include read noiseP...= placeholder for Poisson noiseS\d*= subtract sky using median filter of given orderC...= 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.