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

Fix numpy 2.0 failures and warnings #472

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading