Skip to content

Commit

Permalink
Invoke fixup from hinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrondel committed Nov 14, 2024
1 parent 1fd9c6f commit 76b305e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion python/lsst/consdb/hinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,25 +345,33 @@ def process_resource(resource: ResourcePath, instrument_dict: dict, update: bool
info = dict()
content = yaml.safe_load(resource.read())

fixup_columns: list[str] = []

for header in content["PRIMARY"]:
info[header["keyword"]] = header["value"]
instrument_obj = instrument_dict[info["CONTRLLR"]]
info["camera"] = instrument_obj.camera
info["translator"] = instrument_obj.translator
for column, column_def in KW_MAPPING.items():
exposure_rec[column] = process_column(column_def, info)
if exposure_rec[column] is None:
fixup_columns.append(column)
for column, column_def in instrument_obj.instrument_mapping.items():
exposure_rec[column] = process_column(column_def, info)
if exposure_rec[column] is None:
fixup_columns.append(column)

obs_info_obj = ObservationInfo(info, translator_class=instrument_obj.translator)
obs_info = dict()
for keyword in OI_MAPPING.values():
obs_info[keyword] = getattr(obs_info_obj, keyword)
for field, keyword in OI_MAPPING.items():
exposure_rec[field] = process_column(keyword, obs_info)
if exposure_rec[field] is None:
fixup_columns.append(column)

# Add missing data as best we can
exposure_rec.update(Fixer(exposure_rec).updates)
exposure_rec.update(Fixer(info, obs_info, fixup_columns).updates)

stmt = insert(instrument_obj.exposure_table).values(exposure_rec)
if update:
Expand Down

0 comments on commit 76b305e

Please sign in to comment.