Skip to content

Commit

Permalink
GH #900: Compute display lag
Browse files Browse the repository at this point in the history
Previously the BehaviorOphysLimsApi did not compute
monitor delay, but added a default value of 0.351.
This updates the default to 0.215, which is the
average of monitor delay for a large number of recent
datasets.

Additionally use the OphysTimeAligner methods to
compute the display lag, which is used in the
OphysTimeSync job to produce corrected timestamps
in the LIMS pipeline.
  • Loading branch information
kschelonka committed Feb 28, 2020
1 parent 24c0ca2 commit 17bf241
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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()
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
MAX_MONITOR_DELAY = 0.07 # seconds

VERSION_1_KEYS = {
Expand Down

0 comments on commit 17bf241

Please sign in to comment.