From f03b15b792e977cbcaf4aa25dc17d46952e9408d Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Mon, 9 Dec 2024 14:41:27 -0800 Subject: [PATCH 1/2] added temporal alignment for video --- .../zempolich_2024_nwbconverter.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/schneider_lab_to_nwb/zempolich_2024/zempolich_2024_nwbconverter.py b/src/schneider_lab_to_nwb/zempolich_2024/zempolich_2024_nwbconverter.py index cc67c8f..7d0a0ea 100644 --- a/src/schneider_lab_to_nwb/zempolich_2024/zempolich_2024_nwbconverter.py +++ b/src/schneider_lab_to_nwb/zempolich_2024/zempolich_2024_nwbconverter.py @@ -1,4 +1,6 @@ """Primary NWBConverter class for this dataset.""" +from pathlib import Path +from pymatreader import read_mat from neuroconv import NWBConverter from neuroconv.datainterfaces import ( PhySortingInterface, @@ -25,3 +27,17 @@ class Zempolich2024NWBConverter(NWBConverter): Optogenetic=Zempolich2024OptogeneticInterface, ISOI=Zempolich2024IntrinsicSignalOpticalImagingInterface, ) + + def temporally_align_data_interfaces(self): + """Align timestamps between data interfaces. + + It is called by run_conversion() after the data interfaces have been initialized but before the data is added + to the NWB file. + In its current implementation, this method aligns timestamps between the behavior and video data interfaces. + """ + behavior_interface = self.data_interface_objects["Behavior"] + behavior_file_path = Path(behavior_interface.source_data["file_path"]) + file = read_mat(behavior_file_path) + cam1_timestamps, cam2_timestamps = file["continuous"]["cam"]["time"] + self.data_interface_objects["VideoCamera1"].set_aligned_timestamps([cam1_timestamps]) + self.data_interface_objects["VideoCamera2"].set_aligned_timestamps([cam2_timestamps]) From df27d2f895c3ab1360b202e67b856e1e89b66f89 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Tue, 10 Dec 2024 09:58:55 -0800 Subject: [PATCH 2/2] added pymatreader to dependencies --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 98641fc..29c1e1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,8 @@ dependencies = [ "neuroconv", "nwbinspector", "ndx-events==0.2.0", - "spikeinterface>=101.1" + "spikeinterface>=101.1", + "pymatreader" ] [project.urls]