Skip to content

Commit

Permalink
Merge branch 'plexon-overflow-2-fix' of https://github.com/zm711/pyth…
Browse files Browse the repository at this point in the history
…on-neo into plexon-overflow-2-fix
  • Loading branch information
zm711 committed Dec 13, 2024
2 parents 1148431 + 6cd1782 commit fb2d9a6
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 14 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/core-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,43 @@ jobs:
fail-fast: true
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python-version: ['3.9', '3.10', '3.11', '3.12']
numpy-version: ['1.22.4', '1.23.5', '1.24.1', '1.25.1', '1.26.4']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
numpy-version: ['1.22.4', '1.23.5', '1.24.4', '1.25.1', '1.26.4', '2.0.2','2.1']
# numpy 1.22: 3.10, 1.23: 3.11, 1.24: 3.11, 1.25: 3.11, 1.26: 3.12
exclude:
- python-version: '3.9'
numpy-version: '2.1'
- python-version: '3.11'
numpy-version: '1.22.4'
- python-version: '3.12'
numpy-version: '1.22.4'
- python-version: '3.12'
numpy-version: '1.23.5'
- python-version: '3.12'
numpy-version: '1.24.1'
numpy-version: '1.24.4'
- python-version: '3.12'
numpy-version: '1.25.1'
- python-version: '3.13'
numpy-version: '1.22.4'
- python-version: '3.13'
numpy-version: '1.23.5'
- python-version: '3.13'
numpy-version: '1.24.4'
- python-version: '3.13'
numpy-version: '1.25.1'
- python-version: '3.13'
numpy-version: '1.26.4'
- python-version: '3.13'
numpy-version: '2.0.2'

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install numpy ${{ matrix.numpy-version }}
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/io-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ['3.9', '3.11.9']
python-version: ['3.9', '3.12']
defaults:
# by default run in bash mode (required for conda usage)
run:
shell: bash -l {0}
steps:

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get current year-month
id: date
Expand All @@ -38,7 +38,7 @@ jobs:
run: |
echo "dataset_hash=$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
# Loading cache of ephys_testing_dataset
id: cache-datasets
with:
Expand Down
3 changes: 3 additions & 0 deletions environment_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ channels:
dependencies:
- datalad
- pip
# temporary have this here for IO testing while we decide how to deal with
# external packages not 2.0 ready
- numpy=1.26.4
2 changes: 1 addition & 1 deletion neo/core/spiketrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ def _merge_array_annotations(self, others, sorting=None):

omitted_keys_other = [
key
for key in np.unique([key for other in others for key in other.array_annotations])
for key in set([key for other in others for key in other.array_annotations])
if key not in self.array_annotations
]

Expand Down
10 changes: 9 additions & 1 deletion neo/test/coretest/test_spiketrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ def test__create_from_quantity_array(self):

def test__create_from_quantity_array_with_dtype(self):
times = np.arange(10, dtype="f4") * pq.ms
# this step is required for NumPy 2.0 which now casts to float64 in the case either value/array
# is float64 even if not necessary
# https://numpy.org/devdocs/numpy_2_0_migration_guide.html
times = times.astype(dtype="f4")
t_start = 0.0 * pq.s
t_stop = 12.0 * pq.ms
train1 = SpikeTrain(times, t_start=t_start, t_stop=t_stop)
Expand Down Expand Up @@ -343,6 +347,10 @@ def test__create_from_quantity_array_no_start_stop_units(self):

def test__create_from_quantity_array_no_start_stop_units_with_dtype(self):
times = np.arange(10, dtype="f4") * pq.ms
# this step is required for NumPy 2.0 which now casts to float64 in the case either value/array
# is float64 even if not necessary
# https://numpy.org/devdocs/numpy_2_0_migration_guide.html
times = times.astype(dtype="f4")
t_start = 0.0
t_stop = 12.0
train1 = SpikeTrain(times, t_start=t_start, t_stop=t_stop)
Expand Down Expand Up @@ -1143,7 +1151,7 @@ def test_merge_multiple(self):
expected *= time_unit
sorting = np.argsort(expected)
expected = expected[sorting]
np.testing.assert_array_equal(result.times, expected)
np.testing.assert_array_equal(result.times.magnitude, expected.magnitude)

# Make sure array annotations are merged correctly
self.assertTrue("label" not in result.array_annotations)
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.14.0.dev0"
authors = [{name = "Neo authors and contributors"}]
description = "Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats"
readme = "README.rst"
requires-python = ">=3.9,<3.13" # 3.13 will require NumPy > 2.0 (Windows issue in CI)
requires-python = ">=3.9"
license = {text = "BSD 3-Clause License"}
classifiers = [
"Development Status :: 4 - Beta",
Expand All @@ -23,7 +23,7 @@ classifiers = [

dependencies = [
"packaging",
"numpy>=1.22.4,<2.0.0",
"numpy>=1.22.4",
"quantities>=0.16.1"
]

Expand All @@ -45,7 +45,7 @@ iocache = [
]

test = [
"dhn_med_py<2.0", # ci failing with 2.0 test future version when stable
# "dhn_med_py<2.0", # ci failing with 2.0 test future version when stable
"pytest",
"pytest-cov",
# datalad # this dependency is covered by conda (environment_testing.yml)
Expand Down Expand Up @@ -105,7 +105,7 @@ plexon2 = ["zugbruecke>=0.2; sys_platform!='win32'", "wenv; sys_platform!='win32
all = [
"coverage",
"coveralls",
"dhn_med_py<2.0", # ci failing with 2.0 test future version when stable
# "dhn_med_py<2.0", # ci failing with 2.0 test future version when stable
"h5py",
"igor2",
"ipython",
Expand Down

0 comments on commit fb2d9a6

Please sign in to comment.