Skip to content

Commit

Permalink
Merge pull request #2346 from glue-viz/numpy-1.24
Browse files Browse the repository at this point in the history
API update to numpy 1.24
  • Loading branch information
dhomeier authored Dec 21, 2022
2 parents 583699b + 86b869b commit 2293019
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions glue/core/data_factories/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def panda_process(indf):
"""
result = Data()
for name, column in indf.iteritems():
for name, column in indf.items():

if (column.dtype == np.object) | (column.dtype == np.bool):
if (column.dtype == object) | (column.dtype == bool):

# try to salvage numerical data
try:
Expand Down
2 changes: 1 addition & 1 deletion glue/core/data_factories/tests/test_data_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_dtype_int():
data = b'# a, b\n1, 1 \n2, 2 \n3, 3'
with make_file(data, '.csv') as fname:
d = df.load_data(fname)
assert d['a'].dtype == np.int
assert d['a'].dtype == int


def test_dtype_float():
Expand Down
4 changes: 2 additions & 2 deletions glue/plugins/dendro_viewer/dendro_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _substructures(parent, idx):
while todo:
result.append(todo.pop())
todo.extend(children[result[-1]])
return np.array(result, dtype=np.int)
return np.array(result, dtype=int)


def _dendro_children(parent):
Expand All @@ -66,7 +66,7 @@ def _dendro_children(parent):
def _iter_sorted(children, parent, key):
# must yield both children before parent
yielded = set()
trunks = np.array([i for i, p in enumerate(parent) if p < 0], dtype=np.int)
trunks = np.array([i for i, p in enumerate(parent) if p < 0], dtype=int)
for idx in np.argsort(key[trunks]):
idx = trunks[idx]
for item in _postfix_iter(idx, children, parent, yielded, key):
Expand Down
4 changes: 2 additions & 2 deletions glue/plugins/dendro_viewer/qt/data_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ def apply_roi(self, roi, override_mode=None):
if self.state.select_substruct:
parent = self.state.reference_data[self.state.parent_att]
select = _substructures(parent, select)
select = np.asarray(select, dtype=np.int)
select = np.asarray(select, dtype=int)
else:
select = np.array([], dtype=np.int)
select = np.array([], dtype=int)

subset_state = CategorySubsetState(self.state.reference_data.pixel_component_ids[0], select)

Expand Down
11 changes: 4 additions & 7 deletions glue/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,22 @@ def make_skipper(module, label=None, version=None):
if version:
assert Version(version_installed) >= Version(version)
installed = True
except (ImportError, AssertionError):
except (ImportError, AssertionError, AttributeError):
installed = False
return installed, pytest.mark.skipif(str(not installed), reason='Requires %s' % label)


ASTROPY_INSTALLED, requires_astropy = make_skipper('astropy',
label='Astropy')
ASTROPY_INSTALLED, requires_astropy = make_skipper('astropy', label='Astropy')

MATPLOTLIB_GE_22, requires_matplotlib_ge_22 = make_skipper('matplotlib', version='2.2')

ASTRODENDRO_INSTALLED, requires_astrodendro = make_skipper('astrodendro')

SCIPY_INSTALLED, requires_scipy = make_skipper('scipy',
label='SciPy')
SCIPY_INSTALLED, requires_scipy = make_skipper('scipy', label='SciPy')

PIL_INSTALLED, requires_pil = make_skipper('PIL', label='PIL')

SKIMAGE_INSTALLED, requires_skimage = make_skipper('skimage',
label='scikit-image')
SKIMAGE_INSTALLED, requires_skimage = make_skipper('skimage', label='scikit-image')

XLRD_INSTALLED, requires_xlrd = make_skipper('xlrd')

Expand Down
2 changes: 1 addition & 1 deletion glue/utils/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_coerce_numeric():
assert coerce_numeric(x) is x

x = np.array([0, 1, 1, 0], dtype=bool)
np.testing.assert_array_equal(coerce_numeric(x), np.array([0, 1, 1, 0], dtype=np.int))
np.testing.assert_array_equal(coerce_numeric(x), np.array([0, 1, 1, 0], dtype=int))


@pytest.mark.parametrize(('shape', 'views'),
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ install_requires =
matplotlib>=3.2
scipy>=1.1
pandas>=1.2
echo>=0.5
echo>=0.6
astropy>=4.0
setuptools>=30.3.0
qtpy>=1.9
Expand Down

0 comments on commit 2293019

Please sign in to comment.