-
Notifications
You must be signed in to change notification settings - Fork 48
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 units in WCS API world_axis_object_components #512
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #512 +/- ##
==========================================
- Coverage 87.28% 87.25% -0.03%
==========================================
Files 22 21 -1
Lines 3821 3813 -8
==========================================
- Hits 3335 3327 -8
Misses 486 486 ☔ View full report in Codecov by Sentry. |
@Cadair I am trying to understand this. Can you verify that the example in the issue works now? When I run it I don't see a change with this PR. Running |
hey @nden, here's an example: Setupfrom astropy.modeling import models
from gwcs import WCS
import gwcs.coordinate_frames as cf
import astropy.units as u
import astropy.coordinates as coord
from astropy.wcs.wcsapi.wrappers import SlicedLowLevelWCS
from astropy.wcs.wcsapi.high_level_api import high_level_objects_to_values
import numpy as np
identity = (models.Multiply(1 * u.arcsec / u.pixel) &
models.Multiply(1 * u.arcsec / u.pixel) &
models.Multiply(1 * u.nm / u.pixel))
sky_frame = cf.CelestialFrame(axes_order=(0, 1), name='icrs',
reference_frame=coord.ICRS(),
axes_names=("longitude", "latitude"),
unit=(u.arcsec, u.arcsec))
wave_frame = cf.SpectralFrame(axes_order=(2, ), unit=u.nm, axes_names=("wavelength",))
frame = cf.CompositeFrame([sky_frame, wave_frame])
detector_frame = cf.CoordinateFrame(name="detector", naxes=3,
axes_order=(0, 1, 2),
axes_type=("pixel", "pixel", "pixel"),
axes_names=("x", "y", "z"), unit=(u.pix, u.pix, u.pix))
wcs = WCS(forward_transform=identity, output_frame=frame, input_frame=detector_frame) values = high_level_objects_to_values(*wcs.pixel_to_world(1, 2, 3), low_level_wcs=wcs) before:
after:
The issue being that before we had Quantity instances and they were not in frame units, now we have numbers in frame units. |
@nden are we going to be able to get this out in a release before the final release of astropy 7? |
I can get a release out but I was assumign after astropy 7.0. Or do you need this before? |
Well without this patch and with astropy 7 some things will break for me, so would be nice to get this out first? |
fixes #495
We were returning Quantity objects for CelestialFrame when we shouldn't have been, but we also need to make sure we cast the values to the units of the frame.