From 542886af36670f7b06505fc7bb4e5afb67dc1b16 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Wed, 3 Apr 2024 10:06:50 +0200 Subject: [PATCH 1/3] Open Ephys: Use discovered recording ids tp load sync timestamps --- .../extractors/neoextractors/openephys.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/spikeinterface/extractors/neoextractors/openephys.py b/src/spikeinterface/extractors/neoextractors/openephys.py index 65df593c77..419bb81451 100644 --- a/src/spikeinterface/extractors/neoextractors/openephys.py +++ b/src/spikeinterface/extractors/neoextractors/openephys.py @@ -180,6 +180,9 @@ def __init__( exp_id = exp_ids[0] else: exp_id = exp_ids[block_index] + rec_ids = sorted( + list(self.neo_reader.folder_structure[record_node]["experiments"][exp_id]["recordings"].keys()) + ) # do not load probe for NIDQ stream or if load_sync_channel is True if "NI-DAQmx" not in stream_name and not load_sync_channel: @@ -229,10 +232,8 @@ def __init__( # load synchronized timestamps and set_times to recording recording_folder = Path(folder_path) / record_node stream_folders = [] - for segment_index in range(self.get_num_segments()): - stream_folder = ( - recording_folder / f"experiment{exp_id}" / f"recording{segment_index+1}" / "continuous" / oe_stream - ) + for segment_index, rec_id in enumerate(rec_ids): + stream_folder = recording_folder / f"experiment{exp_id}" / f"recording{rec_id}" / "continuous" / oe_stream stream_folders.append(stream_folder) if load_sync_timestamps: if (stream_folder / "sample_numbers.npy").is_file(): @@ -245,7 +246,7 @@ def __init__( sync_times = None try: self.set_times(times=sync_times, segment_index=segment_index, with_warning=False) - except AssertionError: + except: warnings.warn(f"Could not load synchronized timestamps for {stream_name}") self._stream_folders = stream_folders From 3cddb50206d48b02d5b0bf2983437b88cdfdd753 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Sat, 6 Apr 2024 11:06:19 +0200 Subject: [PATCH 2/3] prepare release 0.100.5 --- doc/releases/0.100.5.rst | 12 ++++++++++++ doc/whatisnew.rst | 6 ++++++ pyproject.toml | 6 +++--- src/spikeinterface/extractors/nwbextractors.py | 3 ++- src/spikeinterface/widgets/spikes_on_traces.py | 3 +-- 5 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 doc/releases/0.100.5.rst diff --git a/doc/releases/0.100.5.rst b/doc/releases/0.100.5.rst new file mode 100644 index 0000000000..1f480e942b --- /dev/null +++ b/doc/releases/0.100.5.rst @@ -0,0 +1,12 @@ +.. _release0.100.5: + +SpikeInterface 0.100.5 release notes +------------------------------------ + +6th April 2024 + +Minor release with bug fixes + +* Open Ephys: Use discovered recording ids to load sync timestamps (#2655) +* Fix channel gains in NwbRecordingExtractor with backend (#2661) +* Fix depth location in spikes on traces map (#2676) diff --git a/doc/whatisnew.rst b/doc/whatisnew.rst index 3c9f2b44c7..015d033385 100644 --- a/doc/whatisnew.rst +++ b/doc/whatisnew.rst @@ -8,6 +8,7 @@ Release notes .. toctree:: :maxdepth: 1 + releases/0.100.5.rst releases/0.100.4.rst releases/0.100.3.rst releases/0.100.2.rst @@ -38,6 +39,11 @@ Release notes releases/0.9.1.rst +Version 0.100.5 +=============== + +* Minor release with bug fixes + Version 0.100.4 =============== diff --git a/pyproject.toml b/pyproject.toml index 1c9bc56ac7..e17780890f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "spikeinterface" -version = "0.100.4" +version = "0.100.5" authors = [ { name="Alessio Buccino", email="alessiop.buccino@gmail.com" }, { name="Samuel Garcia", email="sam.garcia.die@gmail.com" }, @@ -59,7 +59,7 @@ changelog = "https://spikeinterface.readthedocs.io/en/latest/whatisnew.html" extractors = [ "MEArec>=1.8", - "pynwb>=2.3.0", + "pynwb>=2.6.0", "hdmf-zarr>=0.5.0", "pyedflib>=0.1.30", "sonpy;python_version<'3.10'", @@ -80,7 +80,7 @@ streaming_extractors = [ "fsspec", "aiohttp", "requests", - "pynwb>=2.3.0", + "pynwb>=2.6.0", "hdmf-zarr>=0.5.0", "remfile", "s3fs" diff --git a/src/spikeinterface/extractors/nwbextractors.py b/src/spikeinterface/extractors/nwbextractors.py index 09b462d5ae..39fdceceb0 100644 --- a/src/spikeinterface/extractors/nwbextractors.py +++ b/src/spikeinterface/extractors/nwbextractors.py @@ -842,7 +842,8 @@ def _fetch_main_properties_backend(self): data_attributes = self.electrical_series["data"].attrs electrical_series_conversion = data_attributes["conversion"] gains = electrical_series_conversion * 1e6 - if "channel_conversion" in data_attributes: + channel_conversion = self.electrical_series.get("channel_conversion", None) + if channel_conversion: gains *= self.electrical_series["channel_conversion"][:] # Channel offsets diff --git a/src/spikeinterface/widgets/spikes_on_traces.py b/src/spikeinterface/widgets/spikes_on_traces.py index 42fbd623cd..cc20c212cc 100644 --- a/src/spikeinterface/widgets/spikes_on_traces.py +++ b/src/spikeinterface/widgets/spikes_on_traces.py @@ -183,8 +183,7 @@ def plot_matplotlib(self, data_plot, **backend_kwargs): spike_times_to_plot = sorting.get_unit_spike_train( unit, segment_index=segment_index, return_times=True )[spike_start:spike_end] - unit_y_loc = min_y + max_y - dp.unit_locations[unit][1] - # markers = np.ones_like(spike_frames_to_plot) * (min_y + max_y - dp.unit_locations[unit][1]) + unit_y_loc = dp.unit_locations[unit][1] width = 2 * 1e-3 ellipse_kwargs = dict(width=width, height=10, fc="none", ec=dp.unit_colors[unit], lw=2) patches = [Ellipse((s, unit_y_loc), **ellipse_kwargs) for s in spike_times_to_plot] From bb88a49ffaef568c77635fb2ec13dbfdf1c30a3c Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Sat, 6 Apr 2024 11:19:44 +0200 Subject: [PATCH 3/3] Add CI on bug fixes --- .github/workflows/core-test.yml | 1 + .github/workflows/full-test.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/core-test.yml b/.github/workflows/core-test.yml index 1609b8619c..fc4dcda5e7 100644 --- a/.github/workflows/core-test.yml +++ b/.github/workflows/core-test.yml @@ -5,6 +5,7 @@ on: types: [synchronize, opened, reopened] branches: - main + - 0.100-bug-fixes concurrency: # Cancel previous workflows on the same pull request group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/full-test.yml b/.github/workflows/full-test.yml index b432fbd4d5..da2d8ed212 100644 --- a/.github/workflows/full-test.yml +++ b/.github/workflows/full-test.yml @@ -5,6 +5,7 @@ on: types: [synchronize, opened, reopened] branches: - main + - 0.100-bug-fixes concurrency: # Cancel previous workflows on the same pull request group: ${{ github.workflow }}-${{ github.ref }}