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

Compute display lag in BehaviorOphysLimsApi #1400

Merged
merged 1 commit into from
Mar 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 5 additions & 2 deletions allensdk/internal/api/behavior_ophys_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from allensdk.internal.api.ophys_lims_api import OphysLimsApi
from allensdk.brain_observatory.behavior.sync import (
get_sync_data, get_stimulus_rebase_function, frame_time_offset)
from allensdk.internal.brain_observatory.time_sync import OphysTimeAligner
from allensdk.brain_observatory.behavior.stimulus_processing import get_stimulus_presentations, get_stimulus_templates, get_stimulus_metadata
from allensdk.brain_observatory.behavior.metadata_processing import get_task_parameters
from allensdk.brain_observatory.behavior.running_processing import get_running_df
Expand Down Expand Up @@ -38,8 +39,10 @@ def get_sync_data(self):

@memoize
def get_stimulus_timestamps(self):
monitor_delay = .0351
return self.get_sync_data()['stimulus_times_no_delay'] + monitor_delay
sync_path = self.get_sync_file()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

timestamps, _, _ = (OphysTimeAligner(sync_file=sync_path)
.corrected_stim_timestamps)
return timestamps

@memoize
def get_ophys_timestamps(self):
Expand Down
2 changes: 1 addition & 1 deletion allensdk/internal/brain_observatory/time_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
REG_PHOTODIODE_MAX = 2.1 # seconds
PHOTODIODE_ANOMALY_THRESHOLD = 0.5 # seconds
LONG_STIM_THRESHOLD = 0.2 # seconds
ASSUMED_DELAY = 0.0351 # seconds
ASSUMED_DELAY = 0.0215 # seconds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm cautiously confident that this value is better than 0.0351 based on some analysis Wayne and I did. However, there should be a mechanism in place to re-evaluate this every so often as we collect more data to make sure this is still a reasonable value.

MAX_MONITOR_DELAY = 0.07 # seconds

VERSION_1_KEYS = {
Expand Down