AllenInstitute / visual_behavior_analysis

Python package for analyzing behavioral data for Brain Observatory: Visual Behavior
Other
21 stars 6 forks source link

esp.rewards_each_flash and esp.licks_each_flash are incorrect #818

Closed alexpiet closed 2 years ago

alexpiet commented 2 years ago

These functions assume that the interval between stimulus presentations is exactly 750ms. Due to slight variations in stimulus timing, licks and rewards can be double assigned to multiple stimuli, or assigned to none.

These functions are called by reformat.add_rewards_each_flash and reformat.add_licks_each_flash

behavior_session_id = 1050970990 reward near time = 585 has this problem

alexpiet commented 2 years ago

This seems to happen when a change is immediately followed by an omission bsid = 1050968476 near 1880

alexpiet commented 2 years ago

It looks like the problem is that the duration between stimulus times for omissions is normally .733 seconds rather than .75

alexpiet commented 2 years ago

session.stimulus_presentations.groupby('omitted')['diff'].mean() False: .751387 True: .734119