Skip to content

Systematic increase in latency between OdorSite event and Harp odor-onset trigger for first trial of each session #475

@tiffanyona

Description

@tiffanyona

When comparing the offset between the software triggered odor at the start of an OdorSite with the Hardware timestamp provided from Harpolfactometer, I am observing a systematic increase for the first site in a session.

Image

I have obtained the missmatch by iterating this snippet over 500 sessions that run between 11/19/2025 to 1/22/2026 for 12 mice and 9 rigs.

from aind_behavior_vr_foraging.data_contract import dataset as vr_foraging_dataset
from pathlib import Path

session_path = Path(r'Z:/stage/vr-foraging/data/806527/806527_2026-01-22T184208Z') # One exampple
dataset = vr_foraging_dataset(session_path)

dataset['Behavior']['SoftwareEvents']['ActiveSite'].load()
sites_travelled = dataset['Behavior']['SoftwareEvents']['ActiveSite'].data
reward_sites_travelled = sites_travelled[sites_travelled["data"].apply(lambda x: x["label"] == "RewardSite")]

dataset['Behavior']['HarpOlfactometer'].load()
odor_triggers = dataset['Behavior']['HarpOlfactometer'].data

odor_triggers[55].load()
triggers = odor_triggers[55].data['EndValve0']
odor_onset = triggers[triggers]
odor_offset = triggers[~triggers]

missmatch = odor_onset.index - reward_sites_travelled.timestamp
missmatch = missmatch.reset_index().drop('index', axis=1)
missmatch.index.name = 'total_sites'
missmatch.columns = ['mismatch']

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions