Skip to content

Commit

Permalink
Merge pull request #34 from macaodha/feat/migrate-to-numpy-2
Browse files Browse the repository at this point in the history
Feat/migrate to numpy 2
  • Loading branch information
mbsantiago authored Nov 10, 2024
2 parents cb08835 + 1ac3808 commit 39c3918
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion batdetect2/utils/detector_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
import torch
import torch.nn.functional as F

try:
from numpy.exceptions import AxisError
except ImportError:
from numpy import AxisError

import batdetect2.detector.compute_features as feats
import batdetect2.detector.post_process as pp
import batdetect2.utils.audio_utils as au
Expand Down Expand Up @@ -242,7 +247,7 @@ def format_single_result(
)
class_name = class_names[np.argmax(class_overall)]
annotations = get_annotations_from_preds(predictions, class_names)
except (np.AxisError, ValueError):
except (AxisError, ValueError):
# No detections
class_overall = np.zeros(len(class_names))
class_name = "None"
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies = [
"click>=8.1.7",
"librosa>=0.10.1",
"matplotlib>=3.7.1",
"numpy>=1.23.5,<2",
"numpy>=1.23.5",
"pandas>=1.5.3",
"scikit-learn>=1.2.2",
"scipy>=1.10.1",
Expand Down Expand Up @@ -65,7 +65,7 @@ docstring-code-format = true
docstring-code-line-length = 79

[tool.ruff.lint]
select = ["E4", "E7", "E9", "F", "B", "Q", "I"]
select = ["E4", "E7", "E9", "F", "B", "Q", "I", "NPY201"]

[tool.ruff.lint.pydocstyle]
convention = "numpy"
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 39c3918

Please sign in to comment.