diff --git a/romanisim/image.py b/romanisim/image.py index d492117f..49aca5d3 100644 --- a/romanisim/image.py +++ b/romanisim/image.py @@ -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) if flatneeded: try: diff --git a/romanisim/util.py b/romanisim/util.py index ef69c5d7..d98d7ab1 100644 --- a/romanisim/util.py +++ b/romanisim/util.py @@ -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(): @@ -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])