diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ce9518bd..e9a5ee0bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ ### Bug fixes * Fixed the default naming of multiple electrical series in the `SpikeGLXConverterPipe`. [PR #957](https://github.com/catalystneuro/neuroconv/pull/957) * Write new properties to the electrode table use the global identifier channel_name, group [PR #984](https://github.com/catalystneuro/neuroconv/pull/984) +* Fixed a check in `_configure_backend` on neurodata_object ndx_events.Events to work only when ndx-events==0.2.0 is used. [PR #998](https://github.com/catalystneuro/neuroconv/pull/998) ### Improvements * The `OpenEphysBinaryRecordingInterface` now uses `lxml` for extracting the session start time from the settings.xml file and does not depend on `pyopenephys` anymore. [PR #971](https://github.com/catalystneuro/neuroconv/pull/971) diff --git a/src/neuroconv/tools/nwb_helpers/_configure_backend.py b/src/neuroconv/tools/nwb_helpers/_configure_backend.py index a67308d43..3ae0a7db9 100644 --- a/src/neuroconv/tools/nwb_helpers/_configure_backend.py +++ b/src/neuroconv/tools/nwb_helpers/_configure_backend.py @@ -4,11 +4,12 @@ from typing import Union from hdmf.common import Data +from packaging import version from pynwb import NWBFile, TimeSeries from ._configuration_models._hdf5_backend import HDF5BackendConfiguration from ._configuration_models._zarr_backend import ZarrBackendConfiguration -from ..importing import is_package_installed +from ..importing import get_package_version, is_package_installed def configure_backend( @@ -53,13 +54,14 @@ def configure_backend( dataset_name=dataset_name, data_io_class=data_io_class, data_io_kwargs=data_io_kwargs ) # Special ndx-events v0.2.0 types - elif is_ndx_events_installed and isinstance(neurodata_object, ndx_events.Events): - neurodata_object.set_data_io( - dataset_name=dataset_name, data_io_class=data_io_class, data_io_kwargs=data_io_kwargs - ) - # But temporarily skipping LabeledEvents - elif is_ndx_events_installed and isinstance(neurodata_object, ndx_events.LabeledEvents): - continue + elif is_ndx_events_installed and (get_package_version("ndx-events") == version.parse("0.2.0")): + # Temporarily skipping LabeledEvents + if isinstance(neurodata_object, ndx_events.LabeledEvents): + continue + elif isinstance(neurodata_object, ndx_events.Events): + neurodata_object.set_data_io( + dataset_name=dataset_name, data_io_class=data_io_class, data_io_kwargs=data_io_kwargs + ) # Skip the setting of a DataIO when target dataset is a link (assume it will be found in parent) elif isinstance(neurodata_object, TimeSeries) and is_dataset_linked: continue