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

Add numpy 2 compatibility #229

Merged
merged 5 commits into from
Jun 29, 2024
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
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ jobs:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python: [3.8, 3.9, "3.10"]
include:
# test big sur on 3.9.0
- python: 3.9
platform: macos-11.0
python: ["3.9", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ keywords = [
'image processing',
'skeletons'
]
requires-python = '>=3.8'
requires-python = '>=3.9'
dependencies = [
'imageio>=2.10.1',
'magicgui>=0.7.3',
'matplotlib>=3.4',
'networkx>=2.7',
'numba>=0.53',
'numpy>=1.21',
'numpy>=1.25',
'pandas>=2.0.2',
'openpyxl>=2.6',
'scikit-image>=0.17.1',
Expand Down
4 changes: 2 additions & 2 deletions src/skan/_testdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@


_zeros1 = np.zeros_like(skeleton1)
skeleton2 = np.column_stack((skeleton1, _zeros1))
skeleton2 = np.row_stack((skeleton2, skeleton2[:, ::-1]))
skeleton2 = np.concatenate((skeleton1, _zeros1), axis=1)
skeleton2 = np.concatenate((skeleton2, skeleton2[:, ::-1]), axis=0)

skeleton3d = np.array([[[1, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
Expand Down
2 changes: 1 addition & 1 deletion src/skan/csr.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ def summarize(
"to silence this warning, use `separator='-'` to maintain "
"current behavior and use `separator='_'` to switch to the "
"new default behavior.",
np.VisibleDeprecationWarning,
np.exceptions.VisibleDeprecationWarning,
stacklevel=2, # make sure warning points to calling line
)
separator = '-'
Expand Down
4 changes: 2 additions & 2 deletions src/skan/nputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ def _raveled_offsets_and_distances(
... )
>>> off # doctest: +SKIP
array([-5, -1, 1, 5, -6, -4, 4, 6, 10, 9, 11])
>>> d[0]
>>> float(d[0]) # avoid np.float64 repr
1.0
>>> d[-1] # distance from (1, 1) to (3, 2)
>>> float(d[-1]) # distance from (1, 1) to (3, 2)
2.236...
"""
ndim = len(image_shape)
Expand Down
2 changes: 1 addition & 1 deletion src/skan/test/test_csr.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def test_skeleton_integer_dtype(dtype):


def test_default_summarize_separator():
with pytest.warns(np.VisibleDeprecationWarning,
with pytest.warns(np.exceptions.VisibleDeprecationWarning,
match='separator in column name'):
stats = csr.summarize(csr.Skeleton(skeletonlabel))
assert 'skeleton-id' in stats
Expand Down
Loading