Skip to content

Commit

Permalink
Rename spikeinterface api to add_nwb (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin authored Aug 20, 2024
1 parent 5a74e09 commit 60ca62f
Show file tree
Hide file tree
Showing 6 changed files with 592 additions and 175 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Deprecations
* Deprecated `WaveformExtractor` usage. [PR #821](https://github.com/catalystneuro/neuroconv/pull/821)
* Changed the spikeinterface.tool functions (e.g. `add_recording`, `add_sorting`) to have `_to_nwbfile` as suffix [PR #1015](https://github.com/catalystneuro/neuroconv/pull/1015)
* Deprecated use of `compression` and `compression_options` in `VideoInterface` [PR #1005](https://github.com/catalystneuro/neuroconv/pull/1005)
* `get_schema_from_method_signature` has been deprecated; please use `get_json_schema_from_method_signature` instead. [PR #1016](https://github.com/catalystneuro/neuroconv/pull/1016)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def add_to_nwbfile(
Dictionary of keyword arguments to be passed directly to tqdm.
See https://github.com/tqdm/tqdm#parameters for options.
"""
from ...tools.spikeinterface import add_recording
from ...tools.spikeinterface import add_recording_to_nwbfile

if stub_test or self.subset_channels is not None:
recording = self.subset_recording(stub_test=stub_test)
Expand All @@ -359,7 +359,7 @@ def add_to_nwbfile(
if metadata is None:
metadata = self.get_metadata()

add_recording(
add_recording_to_nwbfile(
recording=recording,
nwbfile=nwbfile,
metadata=metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,17 @@ def add_channel_metadata_to_nwb(self, nwbfile: NWBFile, metadata: Optional[DeepD
This function adds metadata to the `nwbfile` in-place, meaning the `nwbfile` object is modified directly.
"""
from ...tools.spikeinterface import (
add_devices,
add_electrode_groups,
add_electrodes,
add_devices_to_nwbfile,
add_electrode_groups_to_nwbfile,
add_electrodes_to_nwbfile,
)

if hasattr(self, "generate_recording_with_channel_metadata"):
recording = self.generate_recording_with_channel_metadata()

add_devices(nwbfile=nwbfile, metadata=metadata)
add_electrode_groups(recording=recording, nwbfile=nwbfile, metadata=metadata)
add_electrodes(recording=recording, nwbfile=nwbfile, metadata=metadata)
add_devices_to_nwbfile(nwbfile=nwbfile, metadata=metadata)
add_electrode_groups_to_nwbfile(recording=recording, nwbfile=nwbfile, metadata=metadata)
add_electrodes_to_nwbfile(recording=recording, nwbfile=nwbfile, metadata=metadata)

def add_to_nwbfile(
self,
Expand Down Expand Up @@ -309,7 +309,7 @@ def add_to_nwbfile(
The name of the units table. If write_as=='units', then units_name must also be 'units'.
units_description : str, default: 'Autogenerated by neuroconv.'
"""
from ...tools.spikeinterface import add_sorting
from ...tools.spikeinterface import add_sorting_to_nwbfile

metadata_copy = deepcopy(metadata)
if write_ecephys_metadata:
Expand All @@ -335,7 +335,7 @@ def add_to_nwbfile(
value=value,
)

add_sorting(
add_sorting_to_nwbfile(
sorting_extractor,
nwbfile=nwbfile,
property_descriptions=property_descriptions,
Expand Down
14 changes: 12 additions & 2 deletions src/neuroconv/tools/spikeinterface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,21 @@
add_sorting,
add_units_table,
add_sorting_analyzer,
check_if_recording_traces_fit_into_memory,
get_nwb_metadata,
write_recording,
write_sorting,
write_sorting_analyzer,
add_waveforms,
write_waveforms,
add_devices_to_nwbfile,
add_electrical_series_to_nwbfile,
add_electrode_groups_to_nwbfile,
add_electrodes_to_nwbfile,
add_recording_to_nwbfile,
add_sorting_to_nwbfile,
add_units_table_to_nwbfile,
add_sorting_analyzer_to_nwbfile,
write_recording_to_nwbfile,
write_sorting_to_nwbfile,
write_sorting_analyzer_to_nwbfile,
check_if_recording_traces_fit_into_memory,
)
Loading

0 comments on commit 60ca62f

Please sign in to comment.