Skip to content

Commit 3710e41

Browse files
authored
Support error as 16 bit float if roman_datamodels wants that (#300)
* support error as 16 bit float if roman_datamodels wants that * also do var_poisson as float16. * Do not include optional fields. * Add some more Gaia docs.
1 parent f966091 commit 3710e41

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

docs/romanisim/catalog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,4 @@ The simulator allows for passage of a user-specified COSMOS file (one which must
6464
The simulator can also generate place Gaia stars at the appropriate locations using the ``make_gaia_stars`` method, in place of the random stars in ``make_stars``. Note that these stars have fluxes exactly equal to the Gaia G band fluxes in all bands; i.e., no attempt is made to predict accurate colors of stars.
6565

6666
.. automodapi:: romanisim.catalog
67+
.. automodapi:: romanisim.gaia

romanisim/image.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,10 +1068,24 @@ def make_asdf(slope, slopevar_rn, slopevar_poisson, metadata=None,
10681068
out['dq'] = np.zeros(slope.shape, dtype='u4')
10691069
if dq is not None:
10701070
out['dq'][:, :] = dq
1071-
out['var_poisson'] = slopevar_poisson
1072-
out['var_rnoise'] = slopevar_rn
1073-
out['var_flat'] = slopevar_rn * 0
1074-
out['err'] = np.sqrt(out['var_poisson'] + out['var_rnoise'] + out['var_flat'])
1071+
1072+
def assign_with_default_types(fielddict, out):
1073+
# assign fields with existing types, only if they're already
1074+
# present.
1075+
for field in fielddict:
1076+
if out.get(field, None) is None:
1077+
continue
1078+
dtype = out[field].dtype
1079+
out[field] = fielddict[field].astype(dtype)
1080+
1081+
fielddict = dict(
1082+
var_poisson=slopevar_poisson,
1083+
var_rnoise=slopevar_rn,
1084+
var_flat=slopevar_rn * 0,
1085+
err=np.sqrt(slopevar_poisson + slopevar_rn),
1086+
)
1087+
assign_with_default_types(fielddict, out)
1088+
10751089
out['amp33'] = np.zeros((n_groups, 4096, 128), dtype=out.amp33.dtype)
10761090
for side in ('left', 'right', 'top', 'bottom'):
10771091
if side in ('left', 'right'):

0 commit comments

Comments
 (0)