Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CALIB and wcsinfo to ami schema #357

Merged
merged 7 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/357.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add CALIB and PA keywords to amioi schema
34 changes: 34 additions & 0 deletions src/stdatamodels/jwst/datamodels/schemas/ami.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/fits-schema/fits-schema"
id: "http://stsci.edu/schemas/jwst_datamodel/ami.schema"
allOf:
- $ref: wcsinfo.schema
- type: object
properties:
meta:
type: object
properties:
ami:
type: object
properties:
calibrator_object_id:
title: "Calibration object identifier"
type: string
fits_keyword: CALIB
blend_table: True
roll_ref:
title: "[deg] V3 roll angle at the ref point (N over E)"
type: number
fits_keyword: ROLL_REF
blend_table: True
v3yangle:
title: "[deg] Angle from V3 axis to Ideal y axis"
type: number
fits_keyword: V3I_YANG
blend_table: True
vparity:
title: Relative sense of rotation between Ideal xy and V2V3
type: integer
fits_keyword: VPARITY
blend_table: True
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ id: "http://stsci.edu/schemas/jwst_datamodel/amioi.schema"
title: AMI OIFITS analysis data model
allOf:
- $ref: oifits.schema
- $ref: ami.schema
6 changes: 6 additions & 0 deletions src/stdatamodels/jwst/datamodels/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,12 @@ def test_amioi_model_oifits_extra_columns(tmp_path, oifits_ami_model, table_name
oifits_ami_model.save(fn)


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


def test_dq_def_roundtrip(tmp_path):
"""
Open a MaskModel with a defined DQ array and dq_def that modifies the
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]