From 30b03f93027fcdeedec686c7f036228ec56d2049 Mon Sep 17 00:00:00 2001 From: zm711 <92116279+zm711@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:39:38 -0500 Subject: [PATCH 1/7] test python 3.13 --- .github/workflows/io-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/io-test.yml b/.github/workflows/io-test.yml index e5e0cd3a5..6c17ec8a4 100644 --- a/.github/workflows/io-test.yml +++ b/.github/workflows/io-test.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: true matrix: - python-version: ['3.9', '3.12'] + python-version: ['3.9', '3.12', '3.13'] defaults: # by default run in bash mode (required for conda usage) run: From cf153641d051a9c380217f4f68c0072d826ce021 Mon Sep 17 00:00:00 2001 From: zm711 <92116279+zm711@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:20:44 -0500 Subject: [PATCH 2/7] remove numpy limit --- environment_testing.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/environment_testing.yml b/environment_testing.yml index 64488e835..8ff8bd984 100644 --- a/environment_testing.yml +++ b/environment_testing.yml @@ -4,6 +4,3 @@ 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 From 5f2573f938339c65d5054e51cf7f783ff0cbcd76 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 15 Jan 2025 16:27:58 +0100 Subject: [PATCH 3/7] Fix for bloackrock with numpy2 --- neo/rawio/blackrockrawio.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/neo/rawio/blackrockrawio.py b/neo/rawio/blackrockrawio.py index f2df3fb0d..bfc24603a 100644 --- a/neo/rawio/blackrockrawio.py +++ b/neo/rawio/blackrockrawio.py @@ -1357,7 +1357,7 @@ def __match_nsx_and_nev_segment_ids(self, nsx_nb): # Show warning if spikes do not fit any segment (+- 1 sampling 'tick') # Spike should belong to segment before - mask_outside = (ev_ids == i) & (data["timestamp"] < int(seg["timestamp"]) - nsx_offset - nsx_period) + mask_outside = (ev_ids == i) & (data["timestamp"] < int(seg["timestamp"]) - int(nsx_offset) - int(nsx_period)) if len(data[mask_outside]) > 0: warnings.warn(f"Spikes outside any segment. Detected on segment #{i}") @@ -1987,6 +1987,7 @@ def __get_nsx_param_variant_a(self, nsx_nb): else: units = "uV" + nsx_parameters = { "nb_data_points": int( (self.__get_file_size(filename) - bytes_in_headers) @@ -1995,8 +1996,8 @@ def __get_nsx_param_variant_a(self, nsx_nb): ), "labels": labels, "units": np.array([units] * self.__nsx_basic_header[nsx_nb]["channel_count"]), - "min_analog_val": -1 * np.array(dig_factor), - "max_analog_val": np.array(dig_factor), + "min_analog_val": -1 * np.array(dig_factor, dtype="float"), + "max_analog_val": np.array(dig_factor, dtype="float"), "min_digital_val": np.array([-1000] * self.__nsx_basic_header[nsx_nb]["channel_count"]), "max_digital_val": np.array([1000] * self.__nsx_basic_header[nsx_nb]["channel_count"]), "timestamp_resolution": 30000, From a6c0182057fb7d44de52091b82e51fded940fc5c Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Fri, 17 Jan 2025 15:15:29 +0100 Subject: [PATCH 4/7] Fix klustakwik io --- neo/io/klustakwikio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/io/klustakwikio.py b/neo/io/klustakwikio.py index 7a5b7c478..c3f761c22 100644 --- a/neo/io/klustakwikio.py +++ b/neo/io/klustakwikio.py @@ -197,7 +197,7 @@ def _load_spike_times(self, fetfilename): names.append("spike_time") # Load into recarray - data = np.recfromtxt(fetfilename, names=names, skip_header=1, delimiter=" ") + data = np.genfromtxt(fetfilename, names=names, skip_header=1, delimiter=" ") # get features features = np.array([data[f"fet{n}"] for n in range(nbFeatures)]) From 8b05510c27b6f337787d21a67128a30680f2b91c Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Fri, 17 Jan 2025 15:34:21 +0100 Subject: [PATCH 5/7] Fix ascii and axograph ios --- neo/test/iotest/test_asciisignalio.py | 18 +++++++++--------- neo/test/iotest/test_axographio.py | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/neo/test/iotest/test_asciisignalio.py b/neo/test/iotest/test_asciisignalio.py index bead9269e..de8f14593 100644 --- a/neo/test/iotest/test_asciisignalio.py +++ b/neo/test/iotest/test_asciisignalio.py @@ -166,10 +166,10 @@ def test_skiprows(self): self.assertEqual(signal.units, pq.V) assert_array_equal(signal.times, [0.0, 1.0, 2.0, 3.0] * pq.s) assert_array_equal(signal.times.magnitude, [0.0, 1.0, 2.0, 3.0]) - assert_array_equal(signal[0].magnitude, -64.8) - assert_array_equal(signal[1].magnitude, -64.6) - assert_array_equal(signal[2].magnitude, -64.3) - assert_array_equal(signal[3].magnitude, -66) + assert_array_almost_equal(signal[0].magnitude, -64.8, decimal=5) + assert_array_almost_equal(signal[1].magnitude, -64.6, decimal=5) + assert_array_almost_equal(signal[2].magnitude, -64.3, decimal=5) + assert_array_almost_equal(signal[3].magnitude, -66, decimal=5) assert_array_almost_equal(np.asarray(signal).flatten(), np.array([-64.8, -64.6, -64.3, -66]), decimal=5) os.remove(filename) @@ -195,11 +195,11 @@ def test_usecols(self): self.assertEqual(signal.units, pq.V) assert_array_equal(signal.times, [0.0, 1.0, 2.0, 3.0, 4.0] * pq.s) assert_array_equal(signal.times.magnitude, [0.0, 1.0, 2.0, 3.0, 4.0]) - assert_array_equal(signal[0].magnitude, 0.5) - assert_array_equal(signal[1].magnitude, 0.6) - assert_array_equal(signal[2].magnitude, 0.7) - assert_array_equal(signal[3].magnitude, 0.8) - assert_array_equal(signal[4].magnitude, 1.4) + assert_array_almost_equal(signal[0].magnitude, 0.5, decimal=5) + assert_array_almost_equal(signal[1].magnitude, 0.6, decimal=5) + assert_array_almost_equal(signal[2].magnitude, 0.7, decimal=5) + assert_array_almost_equal(signal[3].magnitude, 0.8, decimal=5) + assert_array_almost_equal(signal[4].magnitude, 1.4, decimal=5) assert_array_almost_equal(np.asarray(signal).flatten(), np.array([0.5, 0.6, 0.7, 0.8, 1.4]), decimal=5) os.remove(filename) diff --git a/neo/test/iotest/test_axographio.py b/neo/test/iotest/test_axographio.py index 03c6a7087..fb1793c13 100644 --- a/neo/test/iotest/test_axographio.py +++ b/neo/test/iotest/test_axographio.py @@ -9,7 +9,7 @@ from neo.test.iotest.common_io_test import BaseTestIO import numpy as np -from numpy.testing import assert_equal +from numpy.testing import assert_equal, assert_almost_equal import quantities as pq from neo.test.rawiotest.test_axographrawio import TestAxographRawIO @@ -35,9 +35,9 @@ def test_version_1(self): target = np.array([[-5.5078130], [-3.1171880], [+1.6640626], [+1.6640626], [+4.0546880]], dtype=np.float32) assert_equal(arr, target) - assert_equal(sig.t_start, 0.0005000000237487257 * pq.s) + assert_almost_equal(sig.t_start, 0.0005000000237487257 * pq.s, decimal=9) - assert_equal(sig.sampling_period, 0.0005000010132789612 * pq.s) + assert_almost_equal(sig.sampling_period, 0.0005000010132789612 * pq.s, decimal=9) def test_version_2(self): """Test reading a version 2 AxoGraph file""" @@ -87,9 +87,9 @@ def test_version_2(self): target = np.array([[0.3125], [9.6875], [9.6875], [9.6875], [9.3750]], dtype=np.float32) assert_equal(arr, target) - assert_equal(sig.t_start, 0.00009999999747378752 * pq.s) + assert_almost_equal(sig.t_start, 0.00009999999747378752 * pq.s, decimal=9) - assert_equal(sig.sampling_period, 0.00009999999747378750 * pq.s) + assert_almost_equal(sig.sampling_period, 0.00009999999747378750 * pq.s, decimal=9) def test_version_5(self): """Test reading a version 5 AxoGraph file""" @@ -169,7 +169,7 @@ def test_file_written_by_axographio_package_without_linearsequence(self): assert_equal(sig.t_start, 0 * pq.s) - assert_equal(sig.sampling_period, 0.009999999999999787 * pq.s) + assert_almost_equal(sig.sampling_period, 0.009999999999999787 * pq.s, decimal=9) def test_file_with_corrupt_comment(self): """Test reading a file with a corrupt comment""" From dcb9440d92a3f4a791ff95ff346436acb9dc92e7 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Fri, 17 Jan 2025 16:09:59 +0100 Subject: [PATCH 6/7] Remove Python 3.12 from io-tests --- .github/workflows/io-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/io-test.yml b/.github/workflows/io-test.yml index 8f3d7e1d4..77ece4428 100644 --- a/.github/workflows/io-test.yml +++ b/.github/workflows/io-test.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: true matrix: - python-version: ['3.9', '3.12', '3.13'] + python-version: ['3.9', '3.13'] defaults: # by default run in bash mode (required for conda usage) run: From afc8da932c904e75babe4b652efbd169a1410611 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Fri, 17 Jan 2025 16:15:33 +0100 Subject: [PATCH 7/7] Force docs to numpy>=2.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 79cc1a849..21f798eb5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,7 +81,7 @@ docs = [ "nixio", "pynwb", "igor2", - "numpy<2.0" # https://github.com/NeuralEnsemble/python-neo/pull/1612 + "numpy>=2.0" ] dev = [