Skip to content

Commit

Permalink
Add CALIB and wcsinfo to ami schema (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram authored Dec 4, 2024
1 parent 155eb9c commit cf3f85f
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 0 deletions.
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
1 change: 1 addition & 0 deletions src/stdatamodels/jwst/datamodels/schemas/amioi.schema.yaml
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]

0 comments on commit cf3f85f

Please sign in to comment.