-
Notifications
You must be signed in to change notification settings - Fork 171
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
Fix distortion reffile schema and unit test #5553
Fix distortion reffile schema and unit test #5553
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5553 +/- ##
==========================================
+ Coverage 71.32% 71.39% +0.06%
==========================================
Files 410 410
Lines 36467 36468 +1
Branches 5720 5753 +33
==========================================
+ Hits 26010 26035 +25
+ Misses 8800 8771 -29
- Partials 1657 1662 +5
Continue to review full report at Codecov.
|
ef9299d
to
3e349a0
Compare
3e349a0
to
a3c8100
Compare
This branch passes the regression tests: https://plwishmaster.stsci.edu:8081/job/RT/job/jdavies-dev/217/ And I also made sure that all the distortion reffiles currently in CRDS central store cache can be loaded: In [1]: from jwst import datamodels
In [2]: from glob import glob
In [3]: files = glob("/grp/crds/jwst/references/jwst/jwst*distortion*.asdf")
In [4]: files.sort()
In [6]: for file in files:
...: print("---------")
...: with datamodels.DistortionModel(file) as model:
...: print(file)
...: model.validate()
...:
---------
/grp/crds/jwst/references/jwst/jwst_fgs_distortion_0001.asdf
/Users/jdavies/dev/jwst/jwst/datamodels/reference.py:45: ValidationWarning: Model.meta is missing values for ['description', 'reftype', 'author', 'pedigree', 'useafter', 'instrument.name']
warnings.warn(message, ValidationWarning)
/Users/jdavies/dev/jwst/jwst/datamodels/wcs_ref_models.py:61: ValidationWarning: Traceback (most recent call last):
File "/Users/jdavies/dev/jwst/jwst/datamodels/wcs_ref_models.py", line 56, in validate
assert self.meta.instrument.name in ["NIRCAM", "NIRSPEC", "MIRI", "TFI", "FGS", "NIRISS"]
AssertionError
warnings.warn(traceback.format_exc(), ValidationWarning)
/Users/jdavies/dev/jwst/jwst/datamodels/wcs_ref_models.py:83: ValidationWarning: Traceback (most recent call last):
File "/Users/jdavies/dev/jwst/jwst/datamodels/wcs_ref_models.py", line 73, in validate
assert isinstance(self.meta.input_units, (str, u.NamedUnit))
AssertionError
warnings.warn(traceback.format_exc(), ValidationWarning)
---------
/grp/crds/jwst/references/jwst/jwst_fgs_distortion_0002.asdf
---------
/grp/crds/jwst/references/jwst/jwst_fgs_distortion_0003.asdf
---------
/grp/crds/jwst/references/jwst/jwst_fgs_distortion_0004.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0001.asdf
/Users/jdavies/dev/jwst/jwst/datamodels/wcs_ref_models.py:61: ValidationWarning: Traceback (most recent call last):
File "/Users/jdavies/dev/jwst/jwst/datamodels/wcs_ref_models.py", line 55, in validate
assert isinstance(self.model, Model)
AssertionError
warnings.warn(traceback.format_exc(), ValidationWarning)
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0002.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0003.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0004.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0005.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0006.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0007.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0008.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0009.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0010.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0011.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0012.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0013.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0014.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0015.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0016.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0017.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0018.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0019.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0020.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0021.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0022.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0023.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0024.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0025.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0026.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0027.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0028.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0029.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0030.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0031.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0032.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0033.asdf
---------
/grp/crds/jwst/references/jwst/jwst_miri_distortion_0034.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0001.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0002.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0003.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0004.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0005.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0006.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0007.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0008.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0009.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0010.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0011.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0012.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0013.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0014.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0015.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0016.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0017.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0018.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0019.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0020.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0021.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0022.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0023.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0024.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0025.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0026.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0027.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0028.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0029.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0030.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0033.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0034.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0035.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0036.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0037.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0038.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0039.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0040.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0041.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0042.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0043.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0044.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0045.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0046.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0047.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0048.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0049.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0050.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0051.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0052.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0053.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0054.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0055.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0056.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0057.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0058.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0059.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0060.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0061.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0062.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0063.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0064.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0065.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0066.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0085.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0086.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0087.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0088.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0089.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0090.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0091.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0092.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0093.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0094.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0095.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0096.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0097.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0098.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0099.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0100.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0101.asdf
---------
/grp/crds/jwst/references/jwst/jwst_nircam_distortion_0102.asdf
---------
/grp/crds/jwst/references/jwst/jwst_niriss_distortion_0001.asdf
---------
/grp/crds/jwst/references/jwst/jwst_niriss_distortion_0002.asdf
---------
/grp/crds/jwst/references/jwst/jwst_niriss_distortion_0003.asdf
---------
/grp/crds/jwst/references/jwst/jwst_niriss_distortion_0006.asdf
---------
/grp/crds/jwst/references/jwst/jwst_niriss_distortion_0008.asdf
---------
/grp/crds/jwst/references/jwst/jwst_niriss_distortion_0010.asdf |
The only odd thing here in the Generally these |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. I like the idea of changing stdatamodels to throw a consistent validation error class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Not sure exactly why CHANNEL is needed in the ref files, because the DETECTOR specification already includes it indirectly for NIRCam (i.e. any DETECTOR with a trailing 1-4 is CHANNEL=SHORT, and any DETECTOR that ends with "LONG" is obviously CHANNEL=LONG), but since the keyword is in the ref files we should have it in the datamodel schema too.
Is this ready to be merged? If so, we can get it into a regtest run and potentially include it in the next B7.7 release candidate (0.18.1). |
In debugging #5543 yesterday, warnings in the
assign_wcs
tests indicated that there was an inconsistency between the distortion model schema and what thevalidate()
method for that model was requiring.validate()
was requiring thatmeta.instrument.channel
be populated, but thechannel
node was not actually in the schema. And this issue was being masked by thevalidate()
code short-circuiting the real validation error message. So we were seeing the below:Once the masking of the real exception or warnings was fixed, it turns out the schema was not correct:
Looking at existing reffiles for NIRCam and NIRISS, they actually have different metadata formats, and it's not clear there's consistency. Not sure I understand what is happening there.
But this PR at least makes the test and the schema in sync, and it also reports what the actual validation error/warning is now.