From 337ce2ae9979b8ec3dada0b7994afb105afb5919 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Mon, 10 Jun 2024 09:34:40 -0600 Subject: [PATCH] Propagate integrity checks verbose for intan (#887) Co-authored-by: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> --- CHANGELOG.md | 6 +++-- .../ecephys/intan/intandatainterface.py | 22 +++++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d3d8edb8..c9bc9cac6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,8 +27,10 @@ * Added a function to generate ogen timestamps and data from onset times and parameters to `tools.optogenetics`. [PR #832](https://github.com/catalystneuro/neuroconv/pull/832) * Added `configure_and_write_nwbfile` and optimized imports in `tools.nwb_helpers` module. [PR #848](https://github.com/catalystneuro/neuroconv/pull/848) * `configure_backend` may now apply a `BackendConfiguration` to equivalent in-memory `pynwb.NWBFile` objects that have different address in RAM. [PR #848](https://github.com/catalystneuro/neuroconv/pull/848) -* Add support for doubled ragged arrays in `add_units_table`. [PR #879](https://github.com/catalystneuro/neuroconv/pull/879) -* Add support for doubled ragged arrays in `add_electrodes`. [PR #881](https://github.com/catalystneuro/neuroconv/pull/881) +* Add support for doubled ragged arrays in `add_units_table` [PR #879](https://github.com/catalystneuro/neuroconv/pull/879) +* Add support for doubled ragged arrays in `add_electrodes` [PR #881](https://github.com/catalystneuro/neuroconv/pull/881) +* Propagate `ignore_integrity_checks` from neo to IntanRecordingInterface [PR #887](https://github.com/catalystneuro/neuroconv/pull/887) + ### Bug fixes * Remove JSON Schema `definitions` from the `properties` field. [PR #818](https://github.com/catalystneuro/neuroconv/pull/818) diff --git a/src/neuroconv/datainterfaces/ecephys/intan/intandatainterface.py b/src/neuroconv/datainterfaces/ecephys/intan/intandatainterface.py index 2403213bd..64330c0e8 100644 --- a/src/neuroconv/datainterfaces/ecephys/intan/intandatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/intan/intandatainterface.py @@ -45,7 +45,7 @@ class IntanRecordingInterface(BaseRecordingExtractorInterface): display_name = "Intan Recording" associated_suffixes = (".rhd", ".rhs") info = "Interface for Intan recording data." - stream_id = "0" # This is the only stream_id of Intan that might have neural data + stream_id = "0" # This are the amplifier channels, corresponding to the stream_name 'RHD2000 amplifier channel' @classmethod def get_source_schema(cls) -> dict: @@ -59,6 +59,7 @@ def __init__( stream_id: Optional[str] = None, verbose: bool = True, es_key: str = "ElectricalSeries", + ignore_integrity_checks: bool = False, ): """ Load and prepare raw data and corresponding metadata from the Intan format (.rhd or .rhs files). @@ -72,8 +73,25 @@ def __init__( verbose : bool, default: True Verbose es_key : str, default: "ElectricalSeries" + ignore_integrity_checks, bool, default: False. + If True, data that violates integrity assumptions will be loaded. At the moment the only integrity + check performed is that timestamps are continuous. If False, an error will be raised if the check fails. """ + neo_version = get_package_version(name="neo") + spikeinterface_version = get_package_version(name="spikeinterface") + + init_kwargs = dict(file_path=file_path, stream_id=self.stream_id, verbose=verbose, es_key=es_key) + if neo_version >= Version("0.13.1") and spikeinterface_version >= Version("0.100.6"): + init_kwargs["ignore_integrity_checks"] = ignore_integrity_checks + else: + if ignore_integrity_checks: + warnings.warn( + "The 'ignore_integrity_checks' parameter is not supported for neo versions < 0.13.1. " + "or spikeinterface versions < 0.100.6.", + UserWarning, + ) + if stream_id is not None: warnings.warn( "Use of the 'stream_id' parameter is deprecated and it will be removed after September 2024.", @@ -81,7 +99,7 @@ def __init__( ) self.stream_id = stream_id - super().__init__(file_path=file_path, stream_id=self.stream_id, verbose=verbose, es_key=es_key) + super().__init__(**init_kwargs) electrodes_metadata = extract_electrode_metadata(recording_extractor=self.recording_extractor) group_names = electrodes_metadata["group_names"]