Skip to content

Commit

Permalink
add test to check ami and wcsinfo match
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Dec 2, 2024
1 parent 3b0027f commit 60d663f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/stdatamodels/jwst/datamodels/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def test_amioi_model_oifits_extra_columns(tmp_path, oifits_ami_model, table_name


def test_amioi_model_extra_meta(tmp_path, oifits_ami_model):
oifits_ami_model.meta.calibrator_object_id = "foo"
oifits_ami_model.meta.ami.calibrator_object_id = "foo"
fn = tmp_path / "test.fits"
oifits_ami_model.save(fn)

Expand Down
18 changes: 18 additions & 0 deletions src/stdatamodels/jwst/datamodels/tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,21 @@ def test_data_array(tmp_path):
assert x == set(
[('FOO', 2), ('FOO', 1), ('ASDF', None), ('DQ', 2),
(None, None)])


def test_ami_wcsinfo():
"""
The ami and wcsinfo schemas contain duplicate information
since ami products don't otherwise contain a SCI extension.
This test checks that the schema entries for the duplicated
information stays in sync.
"""
wcsinfo_schema = mschema.load_schema("http://stsci.edu/schemas/jwst_datamodel/wcsinfo.schema")
ami_schema = mschema.load_schema("http://stsci.edu/schemas/jwst_datamodel/ami.schema")
ami_def = ami_schema["allOf"][1]["properties"]["meta"]["properties"]["ami"]["properties"]
wcsinfo_def = wcsinfo_schema["properties"]["meta"]["properties"]["wcsinfo"]["properties"]
for keyword in ("roll_ref", "v3yangle", "vparity"):
ami = ami_def[keyword]
wcsinfo = wcsinfo_def[keyword]
for key in set(ami.keys()) | set(wcsinfo.keys()) - {"fits_hdu"}:
assert ami[key] == wcsinfo[key]

0 comments on commit 60d663f

Please sign in to comment.