Skip to content

Commit 7ffbb4b

Browse files
committed
update docstrings for model classes
1 parent 55b9fc4 commit 7ffbb4b

7 files changed

Lines changed: 97 additions & 2 deletions

File tree

romanisim/models/bandpass.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def getBandpasses(
306306
There is currently no estimate for the thermal background for these
307307
bands and they are set to zero arbitrarily.
308308
[default: False]
309-
sca: Return the bandpasses dictionary for the particular SCA if given.
309+
sca: Return the bandpasses dictionary for the particular SCA if given.
310310
[default: None]
311311
bandnames: Iterable of bandpass names to get. If None, it gets all the imaging
312312
bands if ``include_all_bands`` is False, or all bands if
@@ -445,6 +445,9 @@ def read_gsfc_effarea(sca=None, filename=None, galsim_filter_name=False):
445445
the name of the detector. A number between 1-18.
446446
filename : str
447447
filename to read in
448+
galsim_filter_name: bool
449+
Whether to return the Table using galsim.roman filter naming
450+
conventions.
448451
449452
Returns
450453
-------
@@ -488,6 +491,9 @@ def compute_abflux(sca, effarea=None, galsim_filter_name=True):
488491
the name of the detector. A number between 1-18.
489492
effarea : astropy.Table.table
490493
Table from GSFC with effective areas for each filter.
494+
galsim_filter_name: bool
495+
Whether to return the Table using galsim.roman filter naming
496+
conventions.
491497
492498
Returns
493499
-------
@@ -539,6 +545,9 @@ def compute_count_rate(flux, bandpass, sca, filename=None, effarea=None, wavedis
539545
Table from GSFC with effective areas for each filter.
540546
wavedist : numpy.ndarray
541547
Array of wavelengths along which spectral flux densities are defined in microns
548+
galsim_filter_name: bool
549+
whether the effective areas references from Goddard are in galsim.roman filter
550+
naming conventions.
542551
543552
Returns
544553
-------

romanisim/models/dark_current.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@ def _get_crds_model(self, getdq=False, metadata=None, image_mod=None, reffiles=N
122122
metadata : dict or None, optional
123123
Metadata overrides applied to the fake model's `meta` before CRDS
124124
reference selection.
125+
image_mod : roman_datamodels.datamodels.ImageModel or None, optional
126+
Existing image model whose metadata may be used to determine the
127+
appropriate reference files. If provided, these values are used
128+
preferentially when available.
129+
reffiles : dict or None, optional
130+
Optional mapping of reference file types to file paths. If
131+
provided, these values are used preferentially (with lower
132+
priority than image_mod) when available.
125133
126134
Side Effects
127135
------------

romanisim/models/gain.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ def _get_crds_model(self, metadata=None, image_mod=None, reffiles=None):
5858
metadata : dict, optional
5959
Metadata overrides to apply before CRDS lookup. If provided, values
6060
are merged into the model metadata tree.
61+
image_mod : roman_datamodels.datamodels.ImageModel or None, optional
62+
Existing image model whose metadata may be used to determine the
63+
appropriate reference files. If provided, these values are used
64+
preferentially when available.
65+
reffiles : dict or None, optional
66+
Optional mapping of reference file types to file paths. If
67+
provided, these values are used preferentially (with lower
68+
priority than image_mod) when available.
6169
6270
Notes
6371
-----

romanisim/models/ipc.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ def _get_crds_model(self, metadata=None, image_mod=None, reffiles=None):
7474
----------
7575
metadata : dict or None, optional
7676
Metadata overrides applied to the data model before CRDS lookup.
77+
image_mod : roman_datamodels.datamodels.ImageModel or None, optional
78+
Existing image model whose metadata may be used to determine the
79+
appropriate reference files. If provided, these values are used
80+
preferentially when available.
81+
reffiles : dict or None, optional
82+
Optional mapping of reference file types to file paths. If
83+
provided, these values are used preferentially (with lower
84+
priority than image_mod) when available.
7785
7886
Notes
7987
-----

romanisim/models/nonlinearity.py

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,31 @@ class Nonlinearity(object):
145145
If True, query CRDS and load per-pixel polynomial coefficients from the
146146
``inverselinearity`` reference and a gain map from the ``gain`` reference.
147147
If False, use the module defaults.
148+
reftype : str, optional
149+
CRDS reference type to use for the polynomial coefficients. Typical
150+
values include ``"inverselinearity"`` when applying nonlinearity and
151+
``"linearity"`` when removing it.
148152
getdq : bool, optional
149153
If True and ``usecrds=True``, also read the DQ array from the CRDS
150154
inverselinearity file and store it as ``self.dq`` (cropped by ``nborder``).
155+
integralnonlinearity : object or None, optional
156+
Optional integral nonlinearity reference model. If provided, the class
157+
constructs channel-based lookup corrections that are added after the
158+
polynomial correction.
151159
metadata : dict or None, optional
152160
Metadata overrides to apply before CRDS lookup. If provided, values
153161
are merged into the model metadata tree.
154-
162+
saturation : float or None, optional
163+
Optional upper clipping threshold applied before evaluating the
164+
nonlinearity correction.
165+
coeffs : numpy.ndarray or None, optional
166+
Explicit polynomial coefficients to use instead of loading them from
167+
CRDS or using module defaults. Coefficients should be ordered from
168+
lowest to highest polynomial degree.
169+
gain : float or numpy.ndarray or None, optional
170+
Explicit gain value or gain map to use when ``electrons=True`` in
171+
:meth:`apply`.
172+
155173
Attributes
156174
----------
157175
coeffs : numpy.ndarray
@@ -225,6 +243,34 @@ def __init__(
225243
)
226244

227245
def _get_crds_model(self, getdq=False, metadata=None, image_mod=None, reffiles=None):
246+
"""Load nonlinearity and gain reference data from CRDS.
247+
This method resolves the required reference files, loads the gain map
248+
and nonlinearity coefficients, crops them by ``nborder``, and repairs
249+
invalid coefficient values when needed. If integral nonlinearity is
250+
enabled, the corresponding reference file is also resolved.
251+
252+
Parameters
253+
----------
254+
getdq : bool, optional
255+
If True, also read the DQ array from the nonlinearity reference
256+
file and propagate repair flags.
257+
metadata : dict or None, optional
258+
Metadata overrides used when selecting CRDS reference files.
259+
image_mod : roman_datamodels.datamodels.ImageModel or None, optional
260+
Existing image model whose metadata may be used to determine the
261+
appropriate reference files. If provided, these values are used
262+
preferentially when available.
263+
reffiles : dict or None, optional
264+
Optional mapping of reference file types to file paths. If
265+
provided, these values are used preferentially (with lower
266+
priority than image_mod) when available.
267+
268+
Returns
269+
-------
270+
None
271+
This method updates object attributes in place.
272+
"""
273+
228274
# Inverse linearity reference files are used to apply the
229275
# effect of classical non-linearity when constructing
230276
# L1 files, and linearity reference files are used to

romanisim/models/read_noise.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ def _get_crds_model(self, metadata=None, image_mod=None, reffiles=None):
8181
metadata : dict, optional
8282
Metadata overrides to apply before CRDS lookup. If provided, values
8383
are merged into the model metadata tree.
84+
image_mod : roman_datamodels.datamodels.ImageModel or None, optional
85+
Existing image model whose metadata may be used to determine the
86+
appropriate reference files. If provided, these values are used
87+
preferentially when available.
88+
reffiles : dict or None, optional
89+
Optional mapping of reference file types to file paths. If
90+
provided, these values are used preferentially (with lower
91+
priority than image_mod) when available.
8492
8593
"""
8694

romanisim/models/saturation.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ def _get_crds_model(self, getdq=False, metadata=None, image_mod=None, reffiles=N
7979
metadata : dict, optional
8080
Metadata overrides to apply before CRDS lookup. If provided, values
8181
are merged into the model metadata tree.
82+
image_mod : roman_datamodels.datamodels.ImageModel or None, optional
83+
Existing image model whose metadata may be used to determine the
84+
appropriate reference files. If provided, these values are used
85+
preferentially when available.
86+
reffiles : dict or None, optional
87+
Optional mapping of reference file types to file paths. If
88+
provided, these values are used preferentially (with lower
89+
priority than image_mod) when available.
8290
"""
8391

8492
ref_file = get_ref_files(image_mod, metadata, reffiles, reftypes=["saturation"])

0 commit comments

Comments
 (0)