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

map JWST to OIFITS keywords prior to validate #234

Merged
merged 2 commits into from
Nov 7, 2023
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
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Bug Fixes
---------

-
- Fixed ``ValidationError`` during ``AmiOIModel.update`` [#234]

Changes to API
--------------
Expand All @@ -14,7 +14,7 @@ Changes to API
Other
-----

- Add mrsptcorr ref_file to core.schema [#228]
- Add mrsptcorr ref_file to core.schema [#228]

1.8.3 (2023-10-02)
==================
Expand Down
13 changes: 10 additions & 3 deletions src/stdatamodels/jwst/datamodels/amioi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ def get_primary_array_name(self):
# for the example file OI_T3 is the largest array
return 't3'

def on_save(self, path=None):
super().on_save(path)

def _map_oifits_keywords(self):
# OIFITS requires specific keyword names for some data that already
# exist in JWST files under different keywords. For existing
# (and defined) metadata, copy the data to the OIFITS compatible
Expand Down Expand Up @@ -73,3 +71,12 @@ def on_save(self, path=None):
self.meta.oifits.derived.array.y = 0.0
if self.meta.oifits.derived.array.z is None:
self.meta.oifits.derived.array.z = 0.0

def on_save(self, path=None):
super().on_save(path)
self._map_oifits_keywords()

def validate(self):
# map the JWST to OIFITS keywords prior to validate
self._map_oifits_keywords()
super().validate()
8 changes: 8 additions & 0 deletions src/stdatamodels/jwst/datamodels/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,14 @@ def oifits_ami_model():
return m


def test_amioi_model_oifits_validate(oifits_ami_model):
oifits_ami_model.validate()


def test_amioi_model_oifits_update(oifits_ami_model):
oifits_ami_model.update({})


def test_amioi_model_oifits_compliance(tmp_path, oifits_ami_model):
"""
This test cannot fully test oifits compliance but the schema for the model
Expand Down