align_media_per_trial#

ethograph.align_media_per_trial(trial_table, stream_rates=None, output_path=None, session_description='NWB file for media alignment (ethograph generated).', media_root=None, pose_fps=None)[source]#

Create an alignment.nwb from a trial table.

This is the primary user-facing function for creating alignment files.

Parameters:

trial_table (pd.DataFrame) – DataFrame with trial column and {stream}_{device} filename columns. start_time / stop_time are optional – omit for aligned-to-trial data.

stream_rates

Sampling rate per stream. Must include every stream that has columns in the table. Example: {"video": 30.0, "audio": 48000.0, "pose": 30.0}

output_path

Where to write the .nwb file.

Return type:

Path to the created NWB file.

Examples

>>> import pandas as pd, ethograph as eto
>>> table = pd.DataFrame({
...     "trial": [1, 2, 3],
...     "video_cam-1": ["t1.mp4", "t2.mp4", "t3.mp4"],
...     "pose_cam-1": ["t1.h5", "t2.h5", "t3.h5"],
... })
>>> eto.create_alignment(table, {"video": 30.0, "pose": 30.0}, "out/.ethograph/alignment.nwb")