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

Conversation

kschelonka
Copy link
Contributor

@kschelonka kschelonka commented Feb 28, 2020

Response to #900

I updated the default value for monitor delay from .0351 to .0215, per the output of the ophys time sync jobs.

I also used the OphysTimeAligner class to compute the monitor delay, which is used by the ophys time sync job. This will throw a warning if the monitor delay falls outside of our "expected" parameters, but will still use the default value.

Looking for some feedback. Should we throw an error instead of a warning? What about the ophys time sync job? Edit: we should investigate this, but can be done outside of this story.

I did some investigation and found that the stimulus timestamps were not being treated in a rig specific way (I was thinking of the ophys timestamps). So the 2p2 rigs either have a longer monitor delay for whatever reason than our other rigs, or there is some other issue causing the delay to be computed incorrectly.

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.
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB.

@kschelonka kschelonka changed the base branch from master to rc/1.6.0 February 28, 2020 23:19
@codecov-io
Copy link

codecov-io commented Feb 28, 2020

Codecov Report

Merging #1400 into rc/1.6.0 will increase coverage by 0.12%.
The diff coverage is 40%.

Impacted file tree graph

@@             Coverage Diff              @@
##           rc/1.6.0    #1400      +/-   ##
============================================
+ Coverage     34.59%   34.71%   +0.12%     
============================================
  Files           342      342              
  Lines         33248    33250       +2     
============================================
+ Hits          11501    11542      +41     
+ Misses        21747    21708      -39
Impacted Files Coverage Δ
allensdk/internal/brain_observatory/time_sync.py 24.84% <100%> (+24.84%) ⬆️
allensdk/internal/api/behavior_ophys_api.py 28.93% <25%> (+0.21%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24c0ca2...17bf241. Read the comment docs.

@@ -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.

@@ -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!

@wbwakeman wbwakeman added the braintv relates to Insitute BrainTV program label Mar 2, 2020
@kschelonka kschelonka marked this pull request as ready for review March 2, 2020 21:39
@kschelonka kschelonka requested review from njmei and sgratiy as code owners March 2, 2020 21:39
@kschelonka kschelonka merged commit 6abf105 into rc/1.6.0 Mar 2, 2020
@kschelonka kschelonka deleted the GH-900/compute-display-lag branch March 2, 2020 21:45
@kschelonka kschelonka changed the title WIP: Compute display lag in BehaviorOphysLimsApi Compute display lag in BehaviorOphysLimsApi Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
braintv relates to Insitute BrainTV program
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants