Skip to content
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

Update stable branch of 0.22.0 #542

Merged
merged 39 commits into from
Dec 19, 2024
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6818e21
start changelog for 0.22.0
nden Mar 10, 2024
e67779d
fix examples (#492)
nden Mar 13, 2024
53025a9
[SCSB-145] require Python 3.10 (#493)
zacharyburnett Apr 12, 2024
4a1e104
adjust test tolerance for mac scipy 1.14.0 (#505)
braingram Jul 22, 2024
735c306
replace usages of ``copy_arrays`` with ``memmap`` (#503)
zacharyburnett Jul 30, 2024
e634b1f
Fix an issue with units in wcs_from_points (#507)
nden Aug 21, 2024
8cc50d9
Simplify converting units to strings (#508)
eerovaher Sep 4, 2024
9549ab5
Update development version installation instructions (#509)
eerovaher Sep 16, 2024
506745b
Improve compatibility with numpy 2.0 (#510)
mcara Sep 16, 2024
c1c5335
MNT: Create dependabot.yml for workflow auto updates (#514)
pllim Oct 14, 2024
c61cfc3
MNT: Use hash for Action workflow versions and update if needed (#513)
pllim Oct 14, 2024
b0b029f
Bump the actions group across 1 directory with 2 updates (#516)
dependabot[bot] Oct 14, 2024
9006b03
Fix units in WCS API world_axis_object_components (#512)
Cadair Oct 17, 2024
57478e0
vendorize and fix contexts workflow (#518)
braingram Oct 21, 2024
c46e932
Synchronize gwcs region with changes in jwst/romancal (#517)
WilliamJamieson Oct 21, 2024
ccbb066
Add support for compound bounding boxes and ignored bounding box entr…
WilliamJamieson Oct 24, 2024
8a74fa6
Add ability to manually trigger CI (#520)
WilliamJamieson Oct 28, 2024
8a9086c
Move examples from conftest to an examples module (#521)
WilliamJamieson Nov 1, 2024
60b4552
Bump actions/checkout from 4.2.1 to 4.2.2 in /.github/workflows in th…
dependabot[bot] Nov 1, 2024
7f92615
Force gwcs to always return a F ordered bounding box (#522)
WilliamJamieson Nov 8, 2024
0eab5aa
Pin JWST version before suspect change
WilliamJamieson Nov 14, 2024
cd496d3
Revert just the PR that may have caused the issue
WilliamJamieson Nov 14, 2024
037fb76
Possible fix?
WilliamJamieson Nov 14, 2024
235890a
Testing Fix for JWST downstream (#529)
WilliamJamieson Nov 15, 2024
9cd8552
Create downstream test workflow
WilliamJamieson Nov 14, 2024
7d874c3
Create downstream test workflow (#528)
WilliamJamieson Nov 15, 2024
5f66522
add `romanisim` to downstream testing (#530)
WilliamJamieson Nov 20, 2024
bd9ba38
hotfix for download workflow
zacharyburnett Nov 20, 2024
09d4110
Update tox envs (#533)
WilliamJamieson Dec 2, 2024
86dc56c
Bump OpenAstronomy/github-actions-workflows from 1.13.0 to 1.14.0 in …
dependabot[bot] Dec 2, 2024
9f23a66
Ignore the bounding box ordering warning when reading files (#526)
WilliamJamieson Dec 2, 2024
c01c6d0
Add integer rounding to match APE 14 (#525)
WilliamJamieson Dec 2, 2024
8b4d8d7
Set the bounding_box within the forward_transform property (#532)
WilliamJamieson Dec 5, 2024
863b6e4
Respect the bounding_box in inverse transforms (#498)
nden Dec 13, 2024
68fcfa8
Fix inside/outside calc for inverse with bbox (#536)
mcara Dec 18, 2024
ca12fbc
Allow for small rounding errors in bbox for inverse (#537)
mcara Dec 18, 2024
333c143
Revert "Allow for small rounding errors in bbox for inverse" (#538)
nden Dec 18, 2024
f10ceb7
Update changes for release
WilliamJamieson Dec 19, 2024
fcbcf5a
Update changes for release (#541)
WilliamJamieson Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix units in WCS API world_axis_object_components (#512)
Co-authored-by: Nadia Dencheva <[email protected]>
Cadair and nden authored Oct 17, 2024
commit 9006b03a333adb15d301c048fae8dc5911f40702
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@

- Fix an issue with units in ``wcs_from_points``. [#507]

- Fix incorrect units being returned in the low level WCS API. [#512]

0.21.0 (2024-03-10)
-------------------

6 changes: 3 additions & 3 deletions gwcs/coordinate_frames.py
Original file line number Diff line number Diff line change
@@ -355,8 +355,8 @@ def _world_axis_object_classes(self):

@property
def _world_axis_object_components(self):
return [('celestial', 0, 'spherical.lon'),
('celestial', 1, 'spherical.lat')]
return [('celestial', 0, lambda sc: sc.spherical.lon.to_value(self.unit[0])),
('celestial', 1, lambda sc: sc.spherical.lat.to_value(self.unit[1]))]

def coordinates(self, *args):
"""
@@ -457,7 +457,7 @@ def _world_axis_object_classes(self):

@property
def _world_axis_object_components(self):
return [('spectral', 0, 'value')]
return [('spectral', 0, lambda sc: sc.to_value(self.unit[0]))]

def coordinates(self, *args):
# using SpectralCoord
3 changes: 2 additions & 1 deletion gwcs/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -125,7 +125,8 @@ def gwcs_3d_identity_units():
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"))
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])
36 changes: 29 additions & 7 deletions gwcs/tests/test_api.py
Original file line number Diff line number Diff line change
@@ -165,8 +165,10 @@ def test_array_index_to_world_values(gwcs_2d_spatial_shift, x, y):

def test_world_axis_object_components_2d(gwcs_2d_spatial_shift):
waoc = gwcs_2d_spatial_shift.world_axis_object_components
assert waoc == [('celestial', 0, 'spherical.lon'),
('celestial', 1, 'spherical.lat')]
assert waoc[0][:2] == ('celestial', 0)
assert callable(waoc[0][2])
assert waoc[1][:2] == ('celestial', 1)
assert callable(waoc[1][2])


def test_world_axis_object_components_2d_generic(gwcs_2d_quantity_shift):
@@ -177,15 +179,19 @@ def test_world_axis_object_components_2d_generic(gwcs_2d_quantity_shift):

def test_world_axis_object_components_1d(gwcs_1d_freq):
waoc = gwcs_1d_freq.world_axis_object_components
assert waoc == [('spectral', 0, 'value')]
assert [c[:2] for c in waoc] == [('spectral', 0)]
assert callable(waoc[0][2])


def test_world_axis_object_components_4d(gwcs_4d_identity_units):
waoc = gwcs_4d_identity_units.world_axis_object_components
assert waoc[0:3] == [('celestial', 0, 'spherical.lon'),
('celestial', 1, 'spherical.lat'),
('spectral', 0, 'value')]
assert waoc[3][0:2] == ('temporal', 0)
first_two = [c[:2] for c in waoc]
last_one = [c[2] for c in waoc]
assert first_two == [('celestial', 0),
('celestial', 1),
('spectral', 0),
('temporal', 0)]
assert all([callable(l) for l in last_one])


def test_world_axis_object_classes_2d(gwcs_2d_spatial_shift):
@@ -521,3 +527,19 @@ def test_coordinate_frame_api():

pixel2 = wcs.invert(world)
assert u.allclose(pixel2, 0*u.pix)


def test_world_axis_object_components_units(gwcs_3d_identity_units):
from astropy.wcs.wcsapi.high_level_api import high_level_objects_to_values

wcs = gwcs_3d_identity_units
world = wcs.pixel_to_world(1, 1, 1)

values = high_level_objects_to_values(*world, low_level_wcs=wcs)

expected_values = [world[0].spherical.lon.to_value(wcs.output_frame.unit[0]),
world[0].spherical.lon.to_value(wcs.output_frame.unit[1]),
world[1].to_value(wcs.output_frame.unit[2])]

assert not any([isinstance(o, u.Quantity) for o in values])
np.testing.assert_allclose(values, expected_values)
68 changes: 48 additions & 20 deletions gwcs/tests/test_api_slicing.py
Original file line number Diff line number Diff line change
@@ -44,9 +44,13 @@ def test_ellipsis(gwcs_3d_galactic_spectral):

assert_equal(wcs.axis_correlation_matrix, [[True, False, True], [False, True, False], [True, False, True]])

assert wcs.world_axis_object_components == [('celestial', 1, 'spherical.lat'),
('spectral', 0, 'value'),
('celestial', 0, 'spherical.lon')]
first_two = [c[:2] for c in wcs.world_axis_object_components]
last_one = [c[2] for c in wcs.world_axis_object_components]
assert first_two == [('celestial', 1),
('spectral', 0),
('celestial', 0)]

assert all([callable(l) for l in last_one])

assert wcs.world_axis_object_classes['celestial'][0] is SkyCoord
assert wcs.world_axis_object_classes['celestial'][1] == ()
@@ -106,8 +110,12 @@ def test_spectral_slice(gwcs_3d_galactic_spectral):

assert_equal(wcs.axis_correlation_matrix, [[True, True], [True, True]])

assert wcs.world_axis_object_components == [('celestial', 1, 'spherical.lat'),
('celestial', 0, 'spherical.lon')]
first_two = [c[:2] for c in wcs.world_axis_object_components]
last_one = [c[2] for c in wcs.world_axis_object_components]
assert first_two == [('celestial', 1),
('celestial', 0)]

assert all([callable(l) for l in last_one])

assert wcs.world_axis_object_classes['celestial'][0] is SkyCoord
assert wcs.world_axis_object_classes['celestial'][1] == ()
@@ -166,9 +174,13 @@ def test_spectral_range(gwcs_3d_galactic_spectral):

assert_equal(wcs.axis_correlation_matrix, [[True, False, True], [False, True, False], [True, False, True]])

assert wcs.world_axis_object_components == [('celestial', 1, 'spherical.lat'),
('spectral', 0, 'value'),
('celestial', 0, 'spherical.lon')]
first_two = [c[:2] for c in wcs.world_axis_object_components]
last_one = [c[2] for c in wcs.world_axis_object_components]
assert first_two == [('celestial', 1),
('spectral', 0),
('celestial', 0)]

assert all([callable(l) for l in last_one])

assert wcs.world_axis_object_classes['celestial'][0] is SkyCoord
assert wcs.world_axis_object_classes['celestial'][1] == ()
@@ -230,9 +242,13 @@ def test_celestial_slice(gwcs_3d_galactic_spectral):

assert_equal(wcs.axis_correlation_matrix, [[False, True], [True, False], [False, True]])

assert wcs.world_axis_object_components == [('celestial', 1, 'spherical.lat'),
('spectral', 0, 'value'),
('celestial', 0, 'spherical.lon')]
first_two = [c[:2] for c in wcs.world_axis_object_components]
last_one = [c[2] for c in wcs.world_axis_object_components]
assert first_two == [('celestial', 1),
('spectral', 0),
('celestial', 0)]

assert all([callable(l) for l in last_one])

assert wcs.world_axis_object_classes['celestial'][0] is SkyCoord
assert wcs.world_axis_object_classes['celestial'][1] == ()
@@ -295,9 +311,13 @@ def test_celestial_range(gwcs_3d_galactic_spectral):

assert_equal(wcs.axis_correlation_matrix, [[True, False, True], [False, True, False], [True, False, True]])

assert wcs.world_axis_object_components == [('celestial', 1, 'spherical.lat'),
('spectral', 0, 'value'),
('celestial', 0, 'spherical.lon')]
first_two = [c[:2] for c in wcs.world_axis_object_components]
last_one = [c[2] for c in wcs.world_axis_object_components]
assert first_two == [('celestial', 1),
('spectral', 0),
('celestial', 0)]

assert all([callable(l) for l in last_one])

assert wcs.world_axis_object_classes['celestial'][0] is SkyCoord
assert wcs.world_axis_object_classes['celestial'][1] == ()
@@ -363,9 +383,13 @@ def test_no_array_shape(gwcs_3d_galactic_spectral):

assert_equal(wcs.axis_correlation_matrix, [[True, False, True], [False, True, False], [True, False, True]])

assert wcs.world_axis_object_components == [('celestial', 1, 'spherical.lat'),
('spectral', 0, 'value'),
('celestial', 0, 'spherical.lon')]
first_two = [c[:2] for c in wcs.world_axis_object_components]
last_one = [c[2] for c in wcs.world_axis_object_components]
assert first_two == [('celestial', 1),
('spectral', 0),
('celestial', 0)]

assert all([callable(l) for l in last_one])

assert wcs.world_axis_object_classes['celestial'][0] is SkyCoord
assert wcs.world_axis_object_classes['celestial'][1] == ()
@@ -431,9 +455,13 @@ def test_ellipsis_none_types(gwcs_3d_galactic_spectral):
assert_equal(wcs.axis_correlation_matrix, [[True, False, True],
[False, True, False], [True, False, True]])

assert wcs.world_axis_object_components == [('celestial', 1, 'spherical.lat'),
('spectral', 0, 'value'),
('celestial', 0, 'spherical.lon')]
first_two = [c[:2] for c in wcs.world_axis_object_components]
last_one = [c[2] for c in wcs.world_axis_object_components]
assert first_two == [('celestial', 1),
('spectral', 0),
('celestial', 0)]

assert all([callable(l) for l in last_one])

assert wcs.world_axis_object_classes['celestial'][0] is SkyCoord
assert wcs.world_axis_object_classes['celestial'][1] == ()