diff --git a/doc/releases/0.100.3.rst b/doc/releases/0.100.3.rst new file mode 100644 index 0000000000..f43d0a8034 --- /dev/null +++ b/doc/releases/0.100.3.rst @@ -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) diff --git a/doc/whatisnew.rst b/doc/whatisnew.rst index 48606467fb..3063db51f5 100644 --- a/doc/whatisnew.rst +++ b/doc/whatisnew.rst @@ -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 @@ -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 ============== diff --git a/pyproject.toml b/pyproject.toml index d36c3b9e3c..2a2a072fc8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "spikeinterface" -version = "0.100.2" +version = "0.100.3" authors = [ { name="Alessio Buccino", email="alessiop.buccino@gmail.com" }, { name="Samuel Garcia", email="sam.garcia.die@gmail.com" }, diff --git a/src/spikeinterface/core/zarrextractors.py b/src/spikeinterface/core/zarrextractors.py index 106f8ccc1e..a8a23b5863 100644 --- a/src/spikeinterface/core/zarrextractors.py +++ b/src/spikeinterface/core/zarrextractors.py @@ -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( @@ -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)) diff --git a/src/spikeinterface/extractors/nwbextractors.py b/src/spikeinterface/extractors/nwbextractors.py index 287522a870..09b462d5ae 100644 --- a/src/spikeinterface/extractors/nwbextractors.py +++ b/src/spikeinterface/extractors/nwbextractors.py @@ -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, @@ -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. @@ -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. @@ -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. @@ -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: @@ -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", @@ -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) @@ -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]