8000 JP-1739: Remove references to stdatamodels.ndmodel by eslavich · Pull Request #6179 · spacetelescope/jwst · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

JP-1739: Remove references to stdatamodels.ndmodel #6179

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

Merged
merged 4 commits into from
Jul 6, 2021

Conversation

eslavich
Copy link
Contributor
@eslavich eslavich commented Jul 1, 2021

Addresses #5380 / JP-1739

Description

This PR removes references to the stdatamodels.ndmodel module which is being removed over in stdatamodels. I've also updated code that uses NDData interface methods.

Checklist

  • Tests

  • Documentation

  • Change log

  • Milestone

  • Label(s)

@eslavich
Copy link
Contributor Author
eslavich commented Jul 1, 2021

Regression test run with this branch and the stdatamodels branch that removes the module: https://plwishmaster.stsci.edu:8081/job/RT/job/eslavich-dev/90

@codecov
Copy link
codecov bot commented Jul 1, 2021

Codecov Report

Merging #6179 (ca70c53) into master (9f4eda3) will decrease coverage by 0.36%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6179      +/-   ##
==========================================
- Coverage   77.02%   76.65%   -0.37%     
==========================================
  Files         402      402              
  Lines       34366    34694     +328     
==========================================
+ Hits        26469    26596     +127     
- Misses       7897     8098     +201     
Flag Coverage Δ *Carryforward flag
nightly 77.02% <100.00%> (-0.01%) ⬇️ Carriedforward from c65ae0a
unit 55.12% <100.00%> (-0.09%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
jwst/datamodels/__init__.py 100.00% <ø> (ø)
jwst/extract_1d/apply_apcorr.py 95.75% <100.00%> (ø)
jwst/extract_1d/extract.py 65.57% <100.00%> (ø)
jwst/photom/photom.py 82.91% <100.00%> (-6.06%) ⬇️
jwst/wfss_contam/wfss_contam_step.py 34.48% <0.00%> (-12.58%) ⬇️
jwst/wfss_contam/wfss_contam.py 13.33% <0.00%> (-8.10%) ⬇️
jwst/wfss_contam/observations.py 8.20% <0.00%> (-0.69%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9f4eda3...ca70c53. Read the comment docs.

@eslavich eslavich added this to the Build 7.9 milestone Jul 2, 2021
@eslavich eslavich requested a review from jdavies-st July 2, 2021 15:02
Copy link
Collaborator
@jdavies-st jdavies-st left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a small question below.

🚀

Comment on lines +118 to +122
if (
model.meta.hasattr('wcsinfo')
and model.meta.wcsinfo.hasattr('spectral_order')
and model.meta.wcsinfo.spectral_order is not None
):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For any datamodel passed to photom, it will have a wcsinfo attribute, and if it does (because it includes wcsinfo.schema) then spectral_order will definitely be an attribute (with a value or None).

So this check might more simply be:

if model.meta.wcsinfo.spectral_order is not None:
    do stuff

@stscieisenhamer any reason you used model.meta.get('wcsinfo.spectral_order') instead of the above?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I.e. if the input datamodel doesn't include the wcsinfo.schema, then the original code will fail with AttributeError as well. And if self.order has a default of None, why assign it and then have a check in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that first, but tests fail due to wcsinfo being None. I didn't look into why that might be.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All datamodels should have a wcsinfo block, i.e. include that schema, or else they should not even make it to the photometric calibration step in stage 2 pipeline. So do we have unit tests that are testing for something that will never occur in the wild?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it looks like this is to handle MultiSlitModel where the wcsinfo block is in

for slit in model.slits:
    self.spectral_order = slit.meta.wcsinfo.spectral_order

So this seems like a not great way to initialize the DataSet class, because the question becomes how is order determined (if not on __init__) for MultiSlitModel? Not the same as for the others.

Anyway, not worth debugging now.

@jdavies-st jdavies-st changed the title Remove references to stdatamodels.ndmodel JP-1739: Remove references to stdatamodels.ndmodel Jul 2, 2021
@jdavies-st jdavies-st merged commit 1bac2bd into spacetelescope:master Jul 6, 2021
@jdavies-st jdavies-st deleted the AL-408-remote-nddata-ii branch July 6, 2021 16:20
loicalbert pushed a commit to talensgj/jwst that referenced 8000 this pull request Nov 5, 2021
* Remove references to stdatamodels.ndmodel

* Fix hasattr check

* Fix style issue

* Add changelog entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0