-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fits wcs #246
Fits wcs #246
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #246 +/- ##
==========================================
- Coverage 99.45% 99.40% -0.06%
==========================================
Files 57 62 +5
Lines 2037 2200 +163
==========================================
+ Hits 2026 2187 +161
- Misses 11 13 +2 ☔ View full report in Codecov by Sentry. |
@@ -6,15 +6,15 @@ description: |- | |||
model classes, which are handled by an implementation of the ASDF | |||
transform extension. | |||
asdf_standard_requirement: | |||
gte: 1.6.0 |
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.
Note to reviewers this manifest requires ASDF standard 1.6.0 which has not yet become the stable release. Since this PR adds new features that are compatible with the current stable ASDF standard 1.5.0 I chose to change this manifest (astropy-1.2.0
) to instead support the stable version (using all the pre 1.6.0 schemas) and adding the new WCS schemas.
I also added astropy-1.3.0
which support 1.6.0 and also adds the new WCS schemas for that standard version.
So to summarize. Before this PR:
astropy-1.2.0
supported ASDF standard 1.6.0 (the unused development version)
After this PR:
astropy-1.2.0
supports ASDF standard 1.5.0 and adds the WCS schemasastropy-1.3.0
supports ASDF standard 1.6.0 and adds the WCS schemas
@Cadair I can't request you as a reviewer. Would you give this a review? |
@ViciousEagle03 I put together this PR based on the work you did serializing |
This is great! Thanks for cleaning up the code and finding a workaround for the bug. We can finally merge the rest of the PRs dependent on the serialization of |
- type: integer | ||
- type: object |
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.
Would it be simpler if we always stored a slice object with stop = start + 1?
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.
Possibly. Although I think this should retain the format of the _slices_array
. Which can contain all of these values.
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.
That's fair, let's leave it as is.
return wcs | ||
|
||
|
||
def create_tabular_wcs(): |
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 is a distortion table, but do we have a test for a -TAB
wcs?
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.
Any suggestions for an example to try?
If I use the one here:
https://github.com/astropy/astropy/blob/0f80be718107ef797a58ba42025e70b21c454c61/astropy/wcs/tests/conftest.py#L11
it doesn't roundtrip through pickle (or to_fits
)
import pickle
from astropy.wcs import WCS
from astropy.wcs.tests.helper import SimModelTAB
st = SimModelTAB(nx=150, ny=200)
hdulist = st.hdulist
wcs = WCS(hdulist[0].header, hdulist)
pickle.loads(pickle.dumps(wcs))
KeyError: "Extension ('WCS-TABLE', 1) not found."
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.
The file in the astropy package data get_pkg_data_filename("data/tab-time-last-axis.fits", package="astropy.wcs.tests")
also fails to round-trip through pickle (or to_fits
).
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.
Oh astropy/astropy#9998 astropy can't produce a -TAB
wcs so we can't support it here.
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.
Well I guess we should write a test which errors then 😆
tl;dr -- Isn't the whole point of ASDF is to be able to use GWCS so you can ditch FITS WCS? |
The point of ASDF is to be able to save things, this work is part of a GSOC project for saving |
5f34952 adds some tests using the astropy.wcs.tests.data. I wasn't able to find a definitive list of "wcses that should work" and some of the test data is designed to trigger errors. I tried to get most of the files that were not designed to trigger errors. This did reveal one bug in this PR where setting "pixel_shape" on deserialization resulted in an error for https://github.com/astropy/astropy/blob/7896e82c0b06ea4b3870711e7124569f812df39f/astropy/wcs/tests/data/spectra/orion-velo-1.hdr since the "pixel_shape" is inconsistent with "naxis". I fixed this by removing the "pixel_shape" setting (and looking back I don't see this set anywhere in WCS_unpickle which was the model for this PR). |
for more information, see https://pre-commit.ci
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.
LGTM, as much as FITS WCS looks good to me ;-)
This PR builds off of #235
and works around an astropy issue where SIP coefficients lose precision: astropy/astropy#17334