Skip to content

Commit

Permalink
Merge pull request #2640 from alejoe91/prepare-0.100.3
Browse files Browse the repository at this point in the history
Prepare minor release 0.100.3
  • Loading branch information
samuelgarcia authored Mar 28, 2024
2 parents 9041249 + f44a34f commit 22808ca
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 21 deletions.
12 changes: 12 additions & 0 deletions doc/releases/0.100.3.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. _release0.100.3:

SpikeInterface 0.100.3 release notes
------------------------------------

28th March 2024

Minor release with bug fixes for Zarr compressor and NWB in container

* Remove lazy typing in nwb (#2635)
* Add extra_requirements for nwb extractors (#2637)
* Fix compressor propagation to Zarr save function (#2639)
7 changes: 7 additions & 0 deletions doc/whatisnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Release notes
.. toctree::
:maxdepth: 1

releases/0.100.3.rst
releases/0.100.2.rst
releases/0.100.1.rst
releases/0.100.0.rst
Expand Down Expand Up @@ -36,6 +37,12 @@ Release notes
releases/0.9.1.rst


Version 0.100.3
==============

* Minor release with bug fixes for Zarr compressor and NWB in container


Version 0.100.2
==============

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "spikeinterface"
version = "0.100.2"
version = "0.100.3"
authors = [
{ name="Alessio Buccino", email="[email protected]" },
{ name="Samuel Garcia", email="[email protected]" },
Expand Down
4 changes: 2 additions & 2 deletions src/spikeinterface/core/zarrextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def add_recording_to_zarr_group(recording: BaseRecording, zarr_group: zarr.hiera
dataset_paths = [f"traces_seg{i}" for i in range(recording.get_num_segments())]

zarr_kwargs["dtype"] = kwargs.get("dtype", None) or recording.get_dtype()
if "compressor" not in zarr_group:
if "compressor" not in zarr_kwargs:
zarr_kwargs["compressor"] = get_default_zarr_compressor()

add_traces_to_zarr(
Expand All @@ -392,7 +392,7 @@ def add_recording_to_zarr_group(recording: BaseRecording, zarr_group: zarr.hiera
**job_kwargs,
)

# # save probe
# save probe
if recording.get_property("contact_vector") is not None:
probegroup = recording.get_probegroup()
zarr_group.attrs["probe"] = check_json(probegroup.to_dict(array_as_list=True))
Expand Down
27 changes: 9 additions & 18 deletions src/spikeinterface/extractors/nwbextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@
from spikeinterface.core.core_tools import define_function_from_class


def import_lazily():
"Makes annotations / typing available lazily"
global NWBFile, ElectricalSeries, Units, NWBHDF5IO
from pynwb import NWBFile
from pynwb.ecephys import ElectricalSeries
from pynwb.misc import Units
from pynwb import NWBHDF5IO


def read_file_from_backend(
*,
file_path: str | Path | None,
Expand Down Expand Up @@ -111,7 +102,7 @@ def read_nwbfile(
cache: bool = False,
stream_cache_path: str | Path | None = None,
storage_options: dict | None = None,
) -> NWBFile:
) -> "NWBFile":
"""
Read an NWB file and return the NWBFile object.
Expand Down Expand Up @@ -176,8 +167,8 @@ def read_nwbfile(


def _retrieve_electrical_series_pynwb(
nwbfile: NWBFile, electrical_series_path: Optional[str] = None
) -> ElectricalSeries:
nwbfile: "NWBFile", electrical_series_path: Optional[str] = None
) -> "ElectricalSeries":
"""
Get an ElectricalSeries object from an NWBFile.
Expand Down Expand Up @@ -230,7 +221,7 @@ def _retrieve_electrical_series_pynwb(
return electrical_series


def _retrieve_unit_table_pynwb(nwbfile: NWBFile, unit_table_path: Optional[str] = None) -> Units:
def _retrieve_unit_table_pynwb(nwbfile: "NWBFile", unit_table_path: Optional[str] = None) -> "Units":
"""
Get an Units object from an NWBFile.
Units tables can be either the main unit table (nwbfile.units) or in the processing module.
Expand Down Expand Up @@ -568,8 +559,10 @@ def __init__(
# fetch and add main recording properties
if use_pynwb:
gains, offsets, locations, groups = self._fetch_main_properties_pynwb()
self.extra_requirements.append("pynwb")
else:
gains, offsets, locations, groups = self._fetch_main_properties_backend()
self.extra_requirements.append("h5py")
self.set_channel_gains(gains)
self.set_channel_offsets(offsets)
if locations is not None:
Expand Down Expand Up @@ -781,8 +774,6 @@ def _fetch_other_properties(self, electrodes_table, electrodes_indices, columns)
#########
# Extract and re-name properties from nwbfile TODO: Should be a function
########
from pynwb.ecephys import ElectrodeGroup

properties = dict()
properties_to_skip = [
"id",
Expand All @@ -798,9 +789,7 @@ def _fetch_other_properties(self, electrodes_table, electrodes_indices, columns)

for column in columns:
first_value = electrodes_table[column][0]
if isinstance(first_value, ElectrodeGroup):
continue
elif column in properties_to_skip:
if column in properties_to_skip:
continue
else:
column_name = rename_properties.get(column, column)
Expand Down Expand Up @@ -1024,8 +1013,10 @@ def __init__(
if load_unit_properties:
if use_pynwb:
columns = [c.name for c in self.units_table.columns]
self.extra_requirements.append("pynwb")
else:
columns = list(self.units_table.keys())
self.extra_requirements.append("h5py")
properties = self._fetch_properties(columns)
for property_name, property_values in properties.items():
values = [x.decode("utf-8") if isinstance(x, bytes) else x for x in property_values]
Expand Down

0 comments on commit 22808ca

Please sign in to comment.