Skip to content

Commit

Permalink
Handle non-CRDS reference data and only update metadata when relevant…
Browse files Browse the repository at this point in the history
… keywords already exist.
  • Loading branch information
schlafly committed Aug 16, 2024
1 parent d9d978a commit 32896b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions romanisim/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,8 @@ def gather_reference_data(image_mod, usecrds=False):
for reftype, reffn in reffiles.items():
if reftype in ['inverselinearity', 'ipc', 'flat']:
continue
if reftype not in refsneeded:
continue
image_mod.meta.ref_file[reftype] = os.path.basename(reffn)

Check warning on line 617 in romanisim/image.py

View check run for this annotation

Codecov / codecov/patch

romanisim/image.py#L612-L617

Added lines #L612 - L617 were not covered by tests
if flatneeded:
try:
Expand Down
11 changes: 6 additions & 5 deletions romanisim/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,11 @@ def add_more_metadata(metadata):
metadata['exposure']['duration'] = openshuttertime
metadata['guidestar']['gw_window_xsize'] = 16
metadata['guidestar']['gw_window_ysize'] = 16
metadata['guidestar']['gw_window_xstop'] = (
metadata['guidestar']['gw_window_xstart'])
metadata['guidestar']['gw_window_ystop'] = (
metadata['guidestar']['gw_window_ystart'])
if 'gw_window_xstart' in metadata['guidestar']:
metadata['guidestar']['gw_window_xstop'] = (
metadata['guidestar']['gw_window_xstart'])
metadata['guidestar']['gw_window_ystop'] = (
metadata['guidestar']['gw_window_ystart'])
# integration_start? integration_end? nints = 1? ...

if 'target' not in metadata.keys():
Expand Down Expand Up @@ -255,7 +256,7 @@ def add_more_metadata(metadata):
if 'ephemeris' in metadata:
metadata['ephemeris']['ephemeris_reference_frame'] = (
metadata['ephemeris']['ephemeris_reference_frame'][:10])
if 'guidestar' in metadata:
if 'guidestar' in metadata and 'gs_epoch' in metadata['guidestar']:
metadata['guidestar']['gs_epoch'] = (
metadata['guidestar']['gs_epoch'][:10])

Expand Down

0 comments on commit 32896b0

Please sign in to comment.