cajal / pipeline

Schemata and libraries for neuroscientific data
GNU Lesser General Public License v3.0
20 stars 44 forks source link

Missing feature of Clocktool: Sample response/behavior traces at arbitrary behavior/stimulus times #427

Open ZhuokunDing opened 3 years ago

ZhuokunDing commented 3 years ago

Clocktool at the moment does a great job of interpolating one time series stored in the database to another time series stored in the database. However, sometimes time points of interest may not be readily stored, for example, 1). neural responses at 50 msec after every frame flip, 2). neural response sampled at 30 Hz during a movie presentation. In those cases, it would be really convenient to expose a function, let the user define the time points of interest and sample the response/behavior traces at those given time points.

I tried to implement the function with the existing tools in the clocktool.py and posted it as a draft PR: https://github.com/cajal/pipeline/pull/426

ZhuokunDing commented 3 years ago

Notes after the discussion with Paul and Cameron:

  1. Compatibility of sync.SyncModel should be added to convert_clock. One will be able to sample the target traces at every stimulus flip time.
  2. There will be one more option in convert_clock that samples the target traces at arbitrary time points defined by a starting time point, a duration, and a sampling frequency. The sampling frequency will be checked to ensure we are unlikely to sample only one time point in a huge NaN gap.
  3. For scans with uneven screen flips, e.g. stimulus.Frame, the recommended way to use clocktool would be to first upsample the responses in stimulus time using the opinion mentioned in 2). Then, apply low-pass filtering of the user's choice. The low pass filtering won't be covered by the clocktool.