Skip to content

Commit

Permalink
fix numpy 2.0 failures and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nden committed Sep 10, 2023
1 parent 317b631 commit ada8046
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Bug Fixes
- Synchronize ``array_shape`` and ``pixel_shape`` attributes of WCS
objects. [#439]

- Fix failures and warnings woth numpy 2.0. [#472]

other
^^^^^

Expand Down
2 changes: 1 addition & 1 deletion gwcs/converters/tests/test_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _assert_mapper_equal(a, b):

if isinstance(a.mapper, dict):
assert(a.mapper.__class__ == b.mapper.__class__) # nosec
assert(all(np.in1d(list(a.mapper), list(b.mapper)))) # nosec
assert(np.isin(list(a.mapper), list(b.mapper)).all()) # nosec
for k in a.mapper:
assert (a.mapper[k].__class__ == b.mapper[k].__class__) # nosec
assert(all(a.mapper[k].parameters == b.mapper[k].parameters)) # nosec
Expand Down
2 changes: 1 addition & 1 deletion gwcs/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class LabelMapperArray(_LabelMapper):
fittable = False

def __init__(self, mapper, inputs_mapping=None, name=None, **kwargs):
if mapper.dtype.type is not np.unicode_:
if mapper.dtype.type is not np.str_:
mapper = np.asanyarray(mapper, dtype=int)
_no_label = 0
else:
Expand Down
4 changes: 2 additions & 2 deletions gwcs/tests/test_wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ def test_init_no_transform():
assert gw.pipeline[1].frame == "icrs"
with pytest.warns(DeprecationWarning, match="Indexing a WCS.pipeline step is deprecated."):
assert gw.pipeline[1][0] == "icrs"
assert np.in1d(gw.available_frames, ['detector', 'icrs']).all()
assert np.isin(gw.available_frames, ['detector', 'icrs']).all()
gw = wcs.WCS(output_frame=icrs, input_frame=detector)
assert gw._pipeline[0].frame == "detector"
with pytest.warns(DeprecationWarning, match="Indexing a WCS.pipeline step is deprecated."):
assert gw._pipeline[0][0] == "detector"
assert gw._pipeline[1].frame == "icrs"
with pytest.warns(DeprecationWarning, match="Indexing a WCS.pipeline step is deprecated."):
assert gw._pipeline[1][0] == "icrs"
assert np.in1d(gw.available_frames, ['detector', 'icrs']).all()
assert np.isin(gw.available_frames, ['detector', 'icrs']).all()
with pytest.raises(NotImplementedError):
gw(1, 2)

Expand Down
13 changes: 11 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
git+https://github.com/asdf-format/asdf
git+https://github.com/asdf-format/asdf-standard

# Use weekly astropy dev build
--extra-index-url https://pypi.anaconda.org/astropy/simple astropy --pre

git+https://github.com/astropy/astropy


git+https://github.com/astropy/asdf-astropy
git+https://github.com/asdf-format/asdf-transform-schemas
git+https://github.com/asdf-format/asdf-coordinates-schemas
git+https://github.com/asdf-format/asdf-wcs-schemas
git+https://github.com/astropy/astropy
git+https://github.com/astropy/asdf-astropy

# Use Bi-weekly numpy/scipy dev builds
--extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
numpy>=0.0.dev0
scipy>=0.0.dev0

0 comments on commit ada8046

Please sign in to comment.