-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add helper functions to aid in migration of AsdfInFits from ASDF #114
Add helper functions to aid in migration of AsdfInFits from ASDF #114
Conversation
Codecov ReportBase: 49.96% // Head: 50.31% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #114 +/- ##
==========================================
+ Coverage 49.96% 50.31% +0.34%
==========================================
Files 121 123 +2
Lines 7669 7765 +96
==========================================
+ Hits 3832 3907 +75
- Misses 3837 3858 +21
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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 should have an actual docs page. Indeed, fits_support
in general should have a detailed documentation page anyways, so that we can link to it from the ASDF documentation.
a74d113
to
57b1837
Compare
JWST regression tests passed: |
Are the docs for this package published anywhere? Adding documentation to fits_support seems outside the scope of this PR. What is your opinion on adding the migration documentation to ASDF as it has more thorough documentation and these functions are being added to aid in migration for ASDF users? |
It should @zacharyburnett or @nden should know where it is (or we should create a RTD). There is a
It seems entirely within the scope of this PR to me (in hindsight the documentation really should have been part of #110). Since ASDF-in-Fits support of some fashion is being moved specifically to this package meaning it needs to be documented. This PR is intended to add things to help support the transition of ASDF-in-Fits from
No. the documentation of something, |
A follow-on PR sounds great.
I will work on a module level docstring for asdf_in_fits that describes the migration. Will this be sufficient for the changes you are requesting or did you have more in mind? |
Sure, though it ought to make it into the docs for |
The asdf_in_fits module is already included in the stdatamodels docs through the addition in |
I forgot about that. I think that will work, so long as we can create a sphinx link to it. |
I added a module docstring to asdf_in_fits. @WilliamJamieson input/edits/suggestions for this are appreciated. I'm also seeing the built docs on readthedocs with this PR. Thanks @zacharyburnett |
7a18206
to
60dc148
Compare
@WilliamJamieson Are there additional changes you are requesting? |
@zacharyburnett did this miss the 1.0 release? If not, it would be helpful to have this in that release. @WilliamJamieson pinging you again for clarification on what changes you are requesting. |
60dc148
to
e65e697
Compare
I rebased this and moved the changes to 1.1.0 |
c9d9eb3
to
b622e56
Compare
The jwst ci job failures that appeared in this PR after updating it: |
It looks like this is just a truth value issue:
@braingram I think this is good to merge, and then we can figure out the sticky parts between repos after we release |
Thanks for taking a look. I think the run you linked was run against master. The one against this PR has extra errors:
Are those also because of the version issues? |
Oh good catch, that's my bad!
I'm not sure what these are, were class names changed? |
No class names were changed in this PR. I think the crds caching isn't configured correctly anymore. The key is I pushed a commit re-adding the Any objection if I delete some of the |
Same errors occur on a test PR with only changes to the readme. I think that's pretty conclusive that the changes in this PR are not the cause of the jwst test failures. @zacharyburnett I don't appear to have sufficient permissions to merge this PR without the CI jobs passing. If you're able to do so please feel free. I tried fixing the crds cache key, and removing the crds cache with no improvement. I will open an issue to track the incorrect cache key. |
This PR adds an asdf_in_fits submodule with 2 functions:
These are intended as near replacements for:
The signatures of the replacement functions were determined by surveying AsdfInFits usage outside of stdatamodels/jwst. These uses include:
asdf.fits_embed.AsdfInFits.open(filename)
ff = asdf.fits_embed.AsdfInFits(hdulist, tree); ff.write_to(filename, …)
with asdf.open(filename) as af
with asdf.open(filename) as af
ff = asdf.fits_embed.AsdfInFits(hdulist, tree); ff.write_to(filename, …)
with AsdfInFits.open as af
ff = asdf.fits_embed.AsdfInFits(hdulist, tree); ff.write_to(filename, …)
To summarize, the above uses include opening as a with context or as a function call and writing by creating an
AsdfInFits
object then callingwrite_to
.For reads using a with statement, calls like the following:
can be replaced with
The same function can be used outside of a with statement to allow replacing:
with
Finally writes like the following:
can be replaced with
This and several related forms (including passing in an empty or partially full hdu) is included as tests.
The rendering of the documentation appears odd as the numpy style docstrings don't appear to correctly render locally (there is no space between parameter names and types).
Checklist
CHANGES.rst
(either inBug Fixes
orChanges to API
)