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 compatibility with Numpy 1.26 and 2.0 #341

Merged
merged 1 commit into from
Jun 18, 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
5 changes: 4 additions & 1 deletion py_neuromodulation/nm_bursts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import numpy as np
from numpy.lib._function_base_impl import _quantile as np_quantile # type:ignore
if np.__version__ >= "2.0.0":
from numpy.lib._function_base_impl import _quantile as np_quantile # type:ignore
else:
from numpy.lib.function_base import _quantile as np_quantile # type:ignore
from collections.abc import Sequence
from itertools import product

Expand Down
8 changes: 6 additions & 2 deletions py_neuromodulation/nm_sharpwaves.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import numpy as np
from collections.abc import Sequence
from collections import defaultdict
from itertools import product

from py_neuromodulation.nm_types import NMBaseModel
from pydantic import model_validator
from typing import TYPE_CHECKING, Any, Callable
from numpy._core._methods import _mean as np_mean

import numpy as np
if np.__version__ >= "2.0.0":
from numpy._core._methods import _mean as np_mean # type: ignore
else:
from numpy.core._methods import _mean as np_mean

from py_neuromodulation.nm_features import NMFeature
from py_neuromodulation.nm_types import BoolSelector, FrequencyRange
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ dependencies = [
"mne-connectivity",
"mrmr_selection",
"nolds",
"numpy>=2.0.0",
"pandas>=2.2.2",
"numpy >= 1.21.2",
"pandas >= 2.0.0",
"scikit-image",
"scikit-learn >= 0.24.2",
"scikit-optimize",
Expand Down