Skip to content

Commit

Permalink
Compatibility with numpy 2.0 (#109)
Browse files Browse the repository at this point in the history
* replaced np.alltrue with np.all

* added ruff rule for checking numpy2.0 deprecations
  • Loading branch information
niksirbi authored Sep 4, 2024
1 parent 3a13a6c commit ea1f17e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def check_wall(pre_state, new_state, wall, wall_closenes=1e-5, tolerance=1e-9):
larger_than_zero = intersection >= 0

# If condition is true, then the points cross the wall
cross_wall = np.alltrue(np.logical_and(smaller_than_one, larger_than_zero))
cross_wall = np.all(np.logical_and(smaller_than_one, larger_than_zero))
if cross_wall:
new_state = (intersection[-1] - wall_closenes) * (new_state - pre_state) + pre_state

Expand Down
2 changes: 1 addition & 1 deletion neuralplayground/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def check_crossing_wall(
larger_than_zero = intersection >= 0

# If condition is true, then the points cross the wall
cross_wall = np.alltrue(np.logical_and(smaller_than_one, larger_than_zero))
cross_wall = np.all(np.logical_and(smaller_than_one, larger_than_zero))
if cross_wall:
new_state = (intersection[-1] - wall_closenes) * (new_state - pre_state) + pre_state

Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ ignore = [
[tool.ruff]
line-length = 127
exclude = ["__init__.py","build",".eggs"]
select = ["I", "E", "F"]
fix = true

[tool.ruff.lint]
select = ["I", "E", "F", "NPY201"]

[tool.cibuildwheel]
build = "cp38-* cp39-* cp310-* cp311-*"

Expand Down

0 comments on commit ea1f17e

Please sign in to comment.