Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporal Alignment #19

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Primary NWBConverter class for this dataset."""
from pathlib import Path
from pymatreader import read_mat
pauladkisson marked this conversation as resolved.
Show resolved Hide resolved
from neuroconv import NWBConverter
from neuroconv.datainterfaces import (
PhySortingInterface,
Expand All @@ -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])
Loading