From 3f2f3c3a5e2269c194bbbdb89356acff95999f86 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 19 Aug 2025 12:43:00 +0200 Subject: [PATCH 01/13] pytest.ini: Ignore marshmallow warnings Created #575 to fix them. --- pytest.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pytest.ini b/pytest.ini index 626d70ba..4fa723ff 100644 --- a/pytest.ini +++ b/pytest.ini @@ -7,3 +7,5 @@ markers = filterwarnings = ignore:add_child is deprecated. Set the parent attribute instead.:DeprecationWarning + ignore::marshmallow.warnings.RemovedInMarshmallow4Warning + ignore::marshmallow.warnings.ChangedInMarshmallow4Warning From eaa1509767339aa305d166df2ec69cd479a5c035 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 19 Aug 2025 13:30:24 +0200 Subject: [PATCH 02/13] ipfx/bin/make_stimulus_ontology.py: Avoid unknown escape sequence This fixes the warning: /home/thomas/devel/ipfx/ipfx/bin/make_stimulus_ontology.py:26: DeprecationWarning: invalid escape sequence \d m = re.search("(.*)\d{6}$", scode) --- ipfx/bin/make_stimulus_ontology.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipfx/bin/make_stimulus_ontology.py b/ipfx/bin/make_stimulus_ontology.py index 8f3c734b..6ba43ebf 100755 --- a/ipfx/bin/make_stimulus_ontology.py +++ b/ipfx/bin/make_stimulus_ontology.py @@ -23,7 +23,7 @@ def make_stimulus_ontology(stims): scode = stim['stimulus_code'] # code tags - m = re.search("(.*)\d{6}$", scode) + m = re.search(r"(.*)\d{6}$", scode) if m: code_name, = m.groups() tags.add((CODE, code_name, scode)) From a55716f72f6254f20b486f5e41ae7b352f22e384 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 19 Aug 2025 13:48:17 +0200 Subject: [PATCH 03/13] tests/test_ephys_extractor.py: Ignore divide by zero warnings The whole purpose of the tests is to trigger that case. --- tests/test_ephys_extractor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_ephys_extractor.py b/tests/test_ephys_extractor.py index 080f3529..2c15c76d 100644 --- a/tests/test_ephys_extractor.py +++ b/tests/test_ephys_extractor.py @@ -43,7 +43,7 @@ def test_extractors_no_values(): SpikeFeatureExtractor() SpikeTrainFeatureExtractor(start=0, end=0) - +@pytest.mark.filterwarnings("ignore:.*encountered in divide:RuntimeWarning") def test_extractor_wrong_inputs(spike_test_pair): data = spike_test_pair @@ -103,6 +103,7 @@ def test_extractor_on_zero_voltage(): ext.process(t, v, i) +@pytest.mark.filterwarnings("ignore:.*encountered in divide:RuntimeWarning") def test_extractor_on_variable_time_step(spike_test_var_dt): data = spike_test_var_dt From f9f4836993b93e2bd6a8f9ccdab5ae28b2c61af2 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 19 Aug 2025 14:33:46 +0200 Subject: [PATCH 04/13] tests: Add missing timezone for NWB datetime entries This avoids warnings. The additional dependency is already required by pynwb. --- requirements.txt | 1 + tests/attach_metadata/test_cli.py | 4 +++- tests/attach_metadata/test_nwb2_sink.py | 3 ++- tests/dataset/test_ephys_nwb_data.py | 5 +++-- tests/test_append_nwb.py | 6 ++++-- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index a6e90e15..73620e56 100755 --- a/requirements.txt +++ b/requirements.txt @@ -11,6 +11,7 @@ pillow pyabf pynwb==3.1.2 pyYAML +python-dateutil ruamel.yaml<0.18.0 scipy simplejson diff --git a/tests/attach_metadata/test_cli.py b/tests/attach_metadata/test_cli.py index 2c025def..bd1acaba 100644 --- a/tests/attach_metadata/test_cli.py +++ b/tests/attach_metadata/test_cli.py @@ -14,6 +14,8 @@ import pytest from ipfx.utilities import inject_sweep_table +from dateutil.tz import tzlocal + class CliRunner: def __init__( @@ -54,7 +56,7 @@ def simple_nwb(base_path): nwbfile = pynwb.NWBFile( session_description="test session", identifier='test session', - session_start_time=datetime.now() + session_start_time=datetime.now(tzlocal()) ) inject_sweep_table(nwbfile) diff --git a/tests/attach_metadata/test_nwb2_sink.py b/tests/attach_metadata/test_nwb2_sink.py index 1df7a1e6..49d65c91 100644 --- a/tests/attach_metadata/test_nwb2_sink.py +++ b/tests/attach_metadata/test_nwb2_sink.py @@ -15,6 +15,7 @@ import pynwb import h5py +from dateutil.tz import tzlocal from ipfx.attach_metadata.sink import nwb2_sink from ipfx.utilities import inject_sweep_table @@ -24,7 +25,7 @@ def nwbfile(): _nwbfile = pynwb.NWBFile( session_description="test session", identifier='test session', - session_start_time=datetime.now() + session_start_time=datetime.now(tzlocal()) ) dev = pynwb.device.Device(name="my_device") _nwbfile.add_device(dev) diff --git a/tests/dataset/test_ephys_nwb_data.py b/tests/dataset/test_ephys_nwb_data.py index 0b0d046d..6bafc54c 100644 --- a/tests/dataset/test_ephys_nwb_data.py +++ b/tests/dataset/test_ephys_nwb_data.py @@ -7,6 +7,7 @@ from pynwb.icephys import CurrentClampStimulusSeries, CurrentClampSeries import numpy as np from ipfx.utilities import inject_sweep_table +from dateutil.tz import tzlocal from dictdiffer import diff @@ -28,8 +29,8 @@ def nwbfile_to_test(): nwbfile = pynwb.NWBFile( session_description="test nwb data", identifier='test session', - session_start_time=datetime.datetime.now(), - file_create_date=datetime.datetime.now() + session_start_time=datetime.datetime.now(tzlocal()), + file_create_date=datetime.datetime.now(tzlocal()) ) device = nwbfile.create_device(name='electrode_0') diff --git a/tests/test_append_nwb.py b/tests/test_append_nwb.py index 73ae5ba6..ba1f8283 100644 --- a/tests/test_append_nwb.py +++ b/tests/test_append_nwb.py @@ -3,6 +3,8 @@ import pynwb import numpy as np +from dateutil.tz import tzlocal + from ipfx.nwb_append import append_spike_times @@ -11,8 +13,8 @@ def make_skeleton_nwb2_file(nwb2_file_name): nwbfile = pynwb.NWBFile( session_description='test icephys', identifier='session_uuid', - session_start_time=datetime.datetime.now(), - file_create_date=datetime.datetime.now() + session_start_time=datetime.datetime.now(tzlocal()), + file_create_date=datetime.datetime.now(tzlocal()) ) device = nwbfile.create_device(name='electrode_0') From 5fe2c4fe0871cec9fbf81d0b9f277cd143993b64 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 19 Aug 2025 14:51:58 +0200 Subject: [PATCH 05/13] test_XXX_nwb_data.py/test_nwb2_sink.py: Ignore DtypeConversionwarning This ignores the following and similiar warnings: tests/dataset/test_mies_nwb_data.py: 2 warnings /home/thomas/.venvs/ipfx-3.9/lib/python3.9/site-packages/hdmf/build/objectmapper.py:267: DtypeConversionWarning: Spec 'CurrentClampSeries/sweep_number': Value with data type int64 is being converted to data type uint64 (min specification: uint32). warnings.warn(full_warning_msg, DtypeConversionWarning) tests/attach_metadata/test_nwb2_sink.py: 10 warnings tests/dataset/test_ephys_nwb_data.py: 6 warnings tests/dataset/test_hbg_nwb_data.py: 3 warnings tests/dataset/test_mies_nwb_data.py: 2 warnings /home/thomas/.venvs/ipfx-3.9/lib/python3.9/site-packages/hdmf/build/objectmapper.py:267: DtypeConversionWarning: Spec 'SweepTable/sweep_number': Value with data type int64 is being converted to data type uint64 (min specification: uint32). warnings.warn(full_warning_msg, DtypeConversionWarning) tests/dataset/test_ephys_nwb_data.py: 6 warnings tests/dataset/test_hbg_nwb_data.py: 3 warnings tests/dataset/test_mies_nwb_data.py: 2 warnings /home/thomas/.venvs/ipfx-3.9/lib/python3.9/site-packages/hdmf/build/objectmapper.py:267: DtypeConversionWarning: Spec 'CurrentClampStimulusSeries/sweep_number': Value with data type int64 is being converted to data type uint64 (min specification: uint32). warnings.warn(full_warning_msg, DtypeConversionWarning) Both int64 and uint64 are big enough for our number of sweeps. In addition this test is using existing files so even fixing/upgrading IPNWB would not solve the issue. --- tests/attach_metadata/test_nwb2_sink.py | 3 +++ tests/dataset/test_ephys_nwb_data.py | 6 ++++++ tests/dataset/test_hbg_nwb_data.py | 4 ++++ tests/dataset/test_mies_nwb_data.py | 2 ++ 4 files changed, 15 insertions(+) diff --git a/tests/attach_metadata/test_nwb2_sink.py b/tests/attach_metadata/test_nwb2_sink.py index 49d65c91..3732553c 100644 --- a/tests/attach_metadata/test_nwb2_sink.py +++ b/tests/attach_metadata/test_nwb2_sink.py @@ -79,6 +79,7 @@ def test_get_subject(nwbfile, set_none): assert nwbfile.subject.subject_id == "foo" +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_serialize(tmpdir_factory, nwbfile): out_path = os.path.join( str(tmpdir_factory.mktemp("test_serialize")), @@ -102,6 +103,7 @@ def test_serialize(tmpdir_factory, nwbfile): assert obt.identifier == "test session" +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_roundtrip(tmpdir_factory, nwbfile): tmpdir = str(tmpdir_factory.mktemp("test_serialize")) first_path = os.path.join(tmpdir, "first.nwb") @@ -136,6 +138,7 @@ def test_roundtrip(tmpdir_factory, nwbfile): "Mus musculus" ], ]) +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_register( tmpdir_factory, nwbfile, name, value, sweep_id, getter, expected ): diff --git a/tests/dataset/test_ephys_nwb_data.py b/tests/dataset/test_ephys_nwb_data.py index 6bafc54c..195f6b4f 100644 --- a/tests/dataset/test_ephys_nwb_data.py +++ b/tests/dataset/test_ephys_nwb_data.py @@ -103,14 +103,17 @@ def nwb_data(tmp_nwb_path): return EphysNWBData(nwb_file=tmp_nwb_path, ontology=ontology) +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_get_stimulus_unit(nwb_data): assert nwb_data.get_stimulus_unit(sweep_number=4) == "Amps" +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_get_stimulus_code(nwb_data): assert nwb_data.get_stimulus_code(sweep_number=4) == "STIMULUS_CODE" +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_get_sweep_data(nwb_data): expected = { @@ -125,6 +128,7 @@ def test_get_sweep_data(nwb_data): assert list(diff(expected, obtained, tolerance=0.001)) == [] +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_get_sweep_attrs(nwb_data): expected = { @@ -141,12 +145,14 @@ def test_get_sweep_attrs(nwb_data): print(expected) assert expected == obtained +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_get_clamp_mode(nwb_data): attrs = nwb_data.get_sweep_attrs(4); assert attrs['clamp_mode'] == "CurrentClamp" +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_get_full_recording_date(nwb_data): assert nwb_data.get_full_recording_date() == nwb_data.nwb.session_start_time diff --git a/tests/dataset/test_hbg_nwb_data.py b/tests/dataset/test_hbg_nwb_data.py index 97473629..0eaff806 100644 --- a/tests/dataset/test_hbg_nwb_data.py +++ b/tests/dataset/test_hbg_nwb_data.py @@ -27,10 +27,12 @@ def hbg_nwb_data(tmp_nwb_path): return HBGNWBData(nwb_file=tmp_nwb_path, ontology=ontology) +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_create_hbg(hbg_nwb_data): assert isinstance(hbg_nwb_data,HBGNWBData) +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_get_sweep_metadata(hbg_nwb_data): expected = { @@ -48,6 +50,8 @@ def test_get_sweep_metadata(hbg_nwb_data): obtained = hbg_nwb_data.get_sweep_metadata(sweep_number=4) assert expected == obtained + +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_get_stimulus_code_ext(hbg_nwb_data): expected = 'STIMULUS_CODE' diff --git a/tests/dataset/test_mies_nwb_data.py b/tests/dataset/test_mies_nwb_data.py index c76fc949..c46151a0 100644 --- a/tests/dataset/test_mies_nwb_data.py +++ b/tests/dataset/test_mies_nwb_data.py @@ -42,10 +42,12 @@ def get_value(self, key, sweep_num, default): ontology=ontology) +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_create_mies(mies_nwb_data): assert isinstance(mies_nwb_data, MIESNWBData) +@pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") def test_get_sweep_metadata(mies_nwb_data): expected = { From d05077a35d9788dcc95cef09fbcaaf6f1ed9c5c1 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 19 Aug 2025 15:00:56 +0200 Subject: [PATCH 06/13] ipfx: Avoid using deprecated pynwb interfaces This fixes the following warnings: /home/thomas/.venvs/ipfx-3.9/lib/python3.9/site-packages/pynwb/base.py:87: DeprecationWarning: get_data_interface is deprecated and will be removed in PyNWB 4.0. Use get instead. warn('get_data_interface is deprecated and will be removed in PyNWB 4.0. Use get instead.', DeprecationWarning) tests/test_mies_nwb_pipeline_output.py: 127 warnings /home/thomas/.venvs/ipfx-3.9/lib/python3.9/site-packages/pynwb/base.py:82: DeprecationWarning: add_data_interface is deprecated and will be removed in PyNWB 4.0. Use add instead. warn('add_data_interface is deprecated and will be removed in PyNWB 4.0. Use add instead.', DeprecationWarning) --- ipfx/dataset/ephys_nwb_data.py | 2 +- ipfx/nwb_append.py | 2 +- tests/test_append_nwb.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ipfx/dataset/ephys_nwb_data.py b/ipfx/dataset/ephys_nwb_data.py index aa373f58..388ccc9b 100644 --- a/ipfx/dataset/ephys_nwb_data.py +++ b/ipfx/dataset/ephys_nwb_data.py @@ -308,7 +308,7 @@ def get_clamp_mode(self,sweep_number): def get_spike_times(self, sweep_number): spikes = self.nwb.get_processing_module('spikes') - sweep_spikes = spikes.get_data_interface(f"Sweep_{sweep_number}") + sweep_spikes = spikes.get(f"Sweep_{sweep_number}") return sweep_spikes.timestamps @staticmethod diff --git a/ipfx/nwb_append.py b/ipfx/nwb_append.py index 32a52af9..f8bada40 100644 --- a/ipfx/nwb_append.py +++ b/ipfx/nwb_append.py @@ -59,7 +59,7 @@ def append_spike_times(input_nwb_path: PathLike, unit='seconds', data=wrapped_spike_times, name=f"Sweep_{sweep_num}") - spike_module.add_data_interface(ts) + spike_module.add(ts) nwbfile.add_processing_module(spike_module) diff --git a/tests/test_append_nwb.py b/tests/test_append_nwb.py index ba1f8283..3a889db4 100644 --- a/tests/test_append_nwb.py +++ b/tests/test_append_nwb.py @@ -51,5 +51,5 @@ def test_embed_spike_times_into_nwb(tmpdir_factory): spikes = nwbfile.get_processing_module('spikes') for sweep_num, spike_times in sweep_spike_times.items(): - sweep_spikes = spikes.get_data_interface(f"Sweep_{sweep_num}").timestamps + sweep_spikes = spikes.get(f"Sweep_{sweep_num}").timestamps assert np.allclose(sweep_spikes, spike_times) From 6c313a9596c9e187a954f9cdccc5736032e2f672 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 19 Aug 2025 15:29:30 +0200 Subject: [PATCH 07/13] test_serialize: Silence pynwb warning pynwb 3.1.2 does currently always output a warning about a missing .nwb ending in path even if path was not passed at all and is None. This will be fixed in [1], ignore the warning until we require that version. We also drop the path argument to NWBHDF5IO as that is not needed. [1]: https://github.com/NeurodataWithoutBorders/pynwb/pull/2130 --- tests/attach_metadata/test_nwb2_sink.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/attach_metadata/test_nwb2_sink.py b/tests/attach_metadata/test_nwb2_sink.py index 3732553c..592ef200 100644 --- a/tests/attach_metadata/test_nwb2_sink.py +++ b/tests/attach_metadata/test_nwb2_sink.py @@ -80,6 +80,7 @@ def test_get_subject(nwbfile, set_none): @pytest.mark.filterwarnings("ignore:.*Value with data type int64 is being converted to data type uint64.*") +@pytest.mark.filterwarnings("ignore:.*It is recommended that NWB files using the HDF5 backend use the '.nwb' extension.") def test_serialize(tmpdir_factory, nwbfile): out_path = os.path.join( str(tmpdir_factory.mktemp("test_serialize")), @@ -90,7 +91,6 @@ def test_serialize(tmpdir_factory, nwbfile): sink._data = io.BytesIO() sink._h5_file = h5py.File(sink._data, "w") sink._nwb_io = pynwb.NWBHDF5IO( - path=sink._h5_file.filename, mode="w", file=sink._h5_file ) From 45c30501c5728c9d61d7143f6787b96d0897312e Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Wed, 27 Aug 2025 14:21:37 +0200 Subject: [PATCH 08/13] tests/test_mies_nwb_pipeline_output.py: Silence warning about icephys_filtering This test uses existing files so even fixing/upgrading IPNWB would not solve the issue. --- tests/test_mies_nwb_pipeline_output.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_mies_nwb_pipeline_output.py b/tests/test_mies_nwb_pipeline_output.py index d2122ceb..952736f3 100755 --- a/tests/test_mies_nwb_pipeline_output.py +++ b/tests/test_mies_nwb_pipeline_output.py @@ -43,6 +43,7 @@ def rebase(new_base: str, path: str, mkdir: bool = False) -> str: @pytest.mark.slow @pytest.mark.parametrize('input_json,output_json', test_specimens_params) +@pytest.mark.filterwarnings("ignore:.*Use of icephys_filtering is deprecated and will be removed in PyNWB 4.0. Use the IntracellularElectrode.filtering field instead") def test_mies_nwb_pipeline_output(input_json, output_json, tmpdir_factory): """ Runs pipeline, saves to a json file and compares to the existing pipeline output. From 59468f52c3675148e1ee04049659ce4ae352b128 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Wed, 27 Aug 2025 14:49:36 +0200 Subject: [PATCH 09/13] tests/attach_metadata/test_cli.py: Silence warning about icephys_filtering This test uses existing files so even fixing/upgrading IPNWB would not solve the issue. --- tests/attach_metadata/test_cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/attach_metadata/test_cli.py b/tests/attach_metadata/test_cli.py index bd1acaba..e1116abd 100644 --- a/tests/attach_metadata/test_cli.py +++ b/tests/attach_metadata/test_cli.py @@ -151,6 +151,7 @@ def test_cli_nwb2(cli_runner): [1, 2, 3] ) +@pytest.mark.filterwarnings("ignore:.*Use of icephys_filtering is deprecated and will be removed in PyNWB 4.0. Use the IntracellularElectrode.filtering field instead") def test_cli_mies(cli_runner): in_nwb_path = os.path.join(cli_runner.tmpdir, "input.nwb") out_nwb_path = os.path.join(cli_runner.tmpdir, "meta.nwb") From 5b63dd2289ff73c97a1fde83d7e01d3634d8cf55 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Wed, 27 Aug 2025 14:25:14 +0200 Subject: [PATCH 10/13] pytest.ini: Ignore scipy.misc warning for now This is tracked in [1]. [1]: https://github.com/AllenInstitute/ipfx/issues/576 --- pytest.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/pytest.ini b/pytest.ini index 4fa723ff..9729234f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -9,3 +9,4 @@ filterwarnings = ignore:add_child is deprecated. Set the parent attribute instead.:DeprecationWarning ignore::marshmallow.warnings.RemovedInMarshmallow4Warning ignore::marshmallow.warnings.ChangedInMarshmallow4Warning + ignore:scipy.misc is deprecated and will be removed in 2.0.0 From b0b1dbaace3983d23e65d787ffc1e7cefa7e98a9 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Wed, 27 Aug 2025 15:16:48 +0200 Subject: [PATCH 11/13] pytest.ini: Ignore pandas warning about ChainedAssignmentError This is tracked in [1]. [1]: https://github.com/AllenInstitute/ipfx/issues/577 --- pytest.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/pytest.ini b/pytest.ini index 9729234f..341f7f7d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -10,3 +10,4 @@ filterwarnings = ignore::marshmallow.warnings.RemovedInMarshmallow4Warning ignore::marshmallow.warnings.ChangedInMarshmallow4Warning ignore:scipy.misc is deprecated and will be removed in 2.0.0 + ignore:.*behaviour will change in pandas 3.0!.*:FutureWarning From 05c14d1656df1723183420bf9cf9fa1756f83c47 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Wed, 27 Aug 2025 14:24:31 +0200 Subject: [PATCH 12/13] pytest.ini: Treat warnings as errors --- pytest.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/pytest.ini b/pytest.ini index 341f7f7d..a68d124f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -6,6 +6,7 @@ markers = requires_inhouse_data: require inhouse data filterwarnings = + error ignore:add_child is deprecated. Set the parent attribute instead.:DeprecationWarning ignore::marshmallow.warnings.RemovedInMarshmallow4Warning ignore::marshmallow.warnings.ChangedInMarshmallow4Warning From a16a55a556ad676dfc54d2ca6682ee14582045cd Mon Sep 17 00:00:00 2001 From: Nathan Gouwens Date: Tue, 9 Sep 2025 15:39:50 -0700 Subject: [PATCH 13/13] Fix underlying cause of divide-by-zero warning in test --- ipfx/time_series_utils.py | 9 ++++++--- tests/test_ephys_extractor.py | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) mode change 100644 => 100755 ipfx/time_series_utils.py mode change 100644 => 100755 tests/test_ephys_extractor.py diff --git a/ipfx/time_series_utils.py b/ipfx/time_series_utils.py old mode 100644 new mode 100755 index 6c3ae8be..bb290ae1 --- a/ipfx/time_series_utils.py +++ b/ipfx/time_series_utils.py @@ -50,11 +50,14 @@ def calculate_dvdt(v, t, filter=None): dv = np.diff(v) dt = np.diff(t) - dvdt = 1e-3 * dv / dt # in V/s = mV/ms - # some data sources, such as neuron, occasionally report + # some data sources, such as neuron, occasionally report # duplicate timestamps, so we require that dt is not 0 - return dvdt[np.fabs(dt) > sys.float_info.epsilon] + mask = np.fabs(dt) > sys.float_info.epsilon + + dvdt = 1e-3 * dv[mask] / dt[mask] # in V/s = mV/ms + + return dvdt def has_fixed_dt(t): diff --git a/tests/test_ephys_extractor.py b/tests/test_ephys_extractor.py old mode 100644 new mode 100755 index 2c15c76d..97ef5f39 --- a/tests/test_ephys_extractor.py +++ b/tests/test_ephys_extractor.py @@ -103,7 +103,6 @@ def test_extractor_on_zero_voltage(): ext.process(t, v, i) -@pytest.mark.filterwarnings("ignore:.*encountered in divide:RuntimeWarning") def test_extractor_on_variable_time_step(spike_test_var_dt): data = spike_test_var_dt