-
Notifications
You must be signed in to change notification settings - Fork 174
JP-1679: Skip serializing None in datamodels #5371
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
JP-1679: Skip serializing None in datamodels #5371
Conversation
683617f
to
afc109b
Compare
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.
One extremely minor optional comment. LGTM!
@@ -348,12 +347,6 @@ def _assign_group_ids(self): | |||
''.join(params[3:6]), params[6]])) | |||
model.meta.group_id = group_id | |||
except TypeError: | |||
params_dict = dict(zip(unique_exposure_parameters, params)) |
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.
What was the issue here? Not that I'd miss this code, just curious.
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.
Yeah, this is a very unnecessary warning that applies to all data that isn't NIRCam. So you are cursed to get this warning if you're not using NIRCam data. Not a good warning.
Codecov Report
@@ Coverage Diff @@
## master #5371 +/- ##
==========================================
- Coverage 52.87% 52.85% -0.03%
==========================================
Files 409 409
Lines 37093 37116 +23
Branches 5759 5765 +6
==========================================
+ Hits 19613 19617 +4
- Misses 16231 16248 +17
- Partials 1249 1251 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Sorry, I updated the change log this morning for my own changes in another PR, so now you've got conflicts. |
f3a71b4
to
29f142e
Compare
No problem Howard. I've added a simple unit test to this PR as well, to show this works, though clearly this is being tested elsewhere implicitly as well. |
This PR cannot be merged until astropy 4.0.2 is released which contains this PR: Without the above change, 168 of our regression tests fail. The transforms used in the WCS cannot be serialized properly. |
So, after discussion with @eslavich and @nden today, it looks like this PR is fine as is and can be merged. We will only see failures if |
It looks like the small changes in resampling I was seeing in some spectroscopic regression tests were not due floating point accuracy issues, but to the change in |
From
asdf 2.8
onwards,None
will not be stripped from the ASDF tree before serialization. Butjwst.datamodels
currently depends on this behavior for a variety of reasons.Lots of pipeline steps populate things in
meta
withNone
. If we don't stripNone
, it causes a validation error for many of the items in our schemas, becauseNone
is not an allowed type. The schema is expecting a string or number, notNone
.So the solution is to strip any
None
values before save, and avoid populating attributes withNone
internally.Other clean up:
ModelContainer
for instruments that were not NIRCam. A useless warning that I put in several years ago to detect malformed NIRCam simulated data. No longer needed.HT: @eslavich for way forward and the first commit. 🚀
Resolves #5314 / JP-1679