diff --git a/allensdk/internal/api/behavior_ophys_api.py b/allensdk/internal/api/behavior_ophys_api.py index 53bbd5fbd..268073bc9 100644 --- a/allensdk/internal/api/behavior_ophys_api.py +++ b/allensdk/internal/api/behavior_ophys_api.py @@ -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 @@ -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): diff --git a/allensdk/internal/brain_observatory/time_sync.py b/allensdk/internal/brain_observatory/time_sync.py index d7aa449b6..3133fb3e8 100644 --- a/allensdk/internal/brain_observatory/time_sync.py +++ b/allensdk/internal/brain_observatory/time_sync.py @@ -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 = {