romanimpreprocess.L1_to_L2.gen_cal_image
Main tools to drive exposure level processing.
Functions
- wcs_from_config
Extracts a WCS from the configuration file.
- initializationstep
Creates and initializes L2 data.
- saturation_check
Flags saturated pixels in a 3D cube.
- subtract_dark_current
Subtracts dark current in a 3D cube.
- repackage_wcs
Packages a WCS so that it can be handed to romanisim.
- calibrateimage
L1->L2 driver.
Attributes
Functions
|
Gets a WCS object from the configuration. |
|
Initialization step. |
|
Flags saturated pixels (in both 3D and 2D arrays). |
|
Subtracts dark current from a linearized image. |
|
Packages a WCS to feed to romanisim. |
|
Main routine to run the specified calibrations from a config file. |
Module Contents
- wcs_from_config(config)[source]
Gets a WCS object from the configuration.
Currently supports FITS headers imported from a simulation.
- Parameters:
config (dict) – Configuration dictionary (usually imported from YAML).
- Returns:
The WCS as a FITS header.
- Return type:
astropy.io.fits.header.Header
- initializationstep(config, caldir, mylog, exclude_first=False)[source]
Initialization step.
- Parameters:
config (dict) – Configuration dictionary (usually imported from YAML).
caldir (dict) – Locations of calibration files.
mylog (romanimpreprocess.utils.processlog.ProcessLog) – Processing log.
exclude_first (bool) – if True, mark first resultant as DO_NOT_USE
- Returns:
ramp_model (RampModel) – ramp data model including data, groupdq, pixeldq, metadata
meta (dict) – Other metadata (right now: frame_time and read_pattern)
- saturation_check(ramp_model, caldir, mylog, backup=1, skip_firstn=1)[source]
Flags saturated pixels (in both 3D and 2D arrays).
Performs a saturation check on the data cube (data) using the calibration files in caldir. Information is appended to mylog. The flags rdq and pdq are updated in place.
This function serves as a wrapper for
flag_saturation(imported fromromancal).- Parameters:
ramp_model (roman_datamodels.datamodels.RampModel) – data model including resultant cube
caldir (dict) – Locations of calibration files.
mylog (romanimpreprocess.utils.processlog.ProcessLog) – Processing log.
backup (int) – Number of resultants to “back up” when flagging saturation.
skip_firstn (int) – Do not check the first n resultants in ramp_model.data for saturation.
- Return type:
None
- subtract_dark_current(data, rdq, pdq, caldir, meta, mylog)[source]
Subtracts dark current from a linearized image.
The data, rdq, and pdq fields are updated in place.
- Parameters:
data (np.array) – 3D data cube (in DN_lin, shape ngroup,4096,4096)
rdq (np.array) – 3D ramp data quality (uint32, shape ngroup,4096,4096)
pdq (np.array) – 2D pixel data quality (uint32, shape 4096,4096)
caldir (dict) – Locations of calibration files.
meta (dict) – Metadata dictionary (from L1 ASDF tree).
mylog (romanimpreprocess.utils.processlog.ProcessLog) – Processing log.
- Returns:
The 2D image of subtracted dark current in DN/s.
- Return type:
np.array
- repackage_wcs(thewcs)[source]
Packages a WCS to feed to romanisim.
Right now supports FITS-standard headers from a simulation. Since this for compatibility in ramp-fitting routines, can use this and overwrite the WCS in the L2 ASDF tree with a full-accuracy gwcs at a later stage.
- Parameters:
thewcs (astropy.io.fits.Header or galsim.CelestialWCS) – Input WCS.
- Returns:
Packaged WCS, 2 layers deep for compatibility with romanisim.
- Return type:
class