Skip to content

Commit

Permalink
Merge pull request spacetelescope#1517 from BradleySappington/header_fix
Browse files Browse the repository at this point in the history
Header fix
  • Loading branch information
BradleySappington authored Mar 15, 2024
2 parents 8d7b83c + 2a2f567 commit 33c0619
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions jwql/website/apps/jwql/data_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,36 +466,38 @@ def get_additional_exposure_info(root_file_infos, image_info):
header = fits.getheader(file_path)
header_sci = fits.getheader(file_path, 1)

basic_info['category'] = header['CATEGORY']
basic_info['visit_status'] = header['VISITSTA']
additional_info['NGROUPS'] = header['NGROUPS']
additional_info['NINTS'] = header['NINTS']
additional_info['EXPTIME'] = header['EFFEXPTM']
additional_info['TITLE'] = header['TITLE']
additional_info['PI_NAME'] = header['PI_NAME']
additional_info['TARGNAME'] = header['TARGPROP']
# Dont assume headers exist, some are omitted in parallel observations
basic_info['category'] = header.get('CATEGORY', 'N/A')
basic_info['visit_status'] = header.get('VISITSTA', 'N/A')
additional_info['NGROUPS'] = header.get('NGROUPS', 'N/A')
additional_info['NINTS'] = header.get('NINTS', 'N/A')
additional_info['EXPTIME'] = header.get('EFFEXPTM', 'N/A')
additional_info['TITLE'] = header.get('TITLE', 'N/A')
additional_info['PI_NAME'] = header.get('PI_NAME', 'N/A')
additional_info['TARGNAME'] = header.get('TARGPROP', 'N/A')
additional_info['BRADTEST'] = header.get('BRADTEST', 'N/A')

# For the exposure level (i.e. multiple files) present the target
# RA and Dec. For the image level, give RA_REF, DEC_REF, since those
# are specific to the detector. Similarly, for the exposure level, show
# PA_V3, which applies to all detectors. At the image level, show
# ROLL_REF, which is detector-specific.
if isinstance(root_file_infos, QuerySet):
additional_info['TARG_RA'] = header['TARG_RA']
additional_info['TARG_DEC'] = header['TARG_DEC']
additional_info['PA_V3'] = header_sci['PA_V3']
additional_info['TARG_RA'] = header.get('TARG_RA', 'N/A')
additional_info['TARG_DEC'] = header.get('TARG_DEC', 'N/A')
additional_info['PA_V3'] = header_sci.get('PA_V3', 'N/A')
elif isinstance(root_file_infos, RootFileInfo):
additional_info['RA_REF'] = header_sci['RA_REF']
additional_info['DEC_REF'] = header_sci['DEC_REF']
additional_info['ROLL_REF'] = header_sci['ROLL_REF']
additional_info['RA_REF'] = header_sci.get('RA_REF', 'N/A')
additional_info['DEC_REF'] = header_sci.get('DEC_REF', 'N/A')
additional_info['ROLL_REF'] = header_sci.get('ROLL_REF', 'N/A')

additional_info['CAL_VER'] = 'N/A'
additional_info['CRDS context'] = 'N/A'

# Pipeline version and CRDS context info are not in uncal files
if suffix != 'uncal':
additional_info['CAL_VER'] = header['CAL_VER']
additional_info['CRDS context'] = header['CRDS_CTX']
additional_info['CAL_VER'] = header.get('CAL_VER', 'N/A')
additional_info['CRDS context'] = header.get('CRDS_CTX', 'N/A')

return basic_info, additional_info

Expand Down

0 comments on commit 33c0619

Please sign in to comment.