psychopy#
Psychopy behavioral event data source.
Explicit assumptions: - Psychopy CSV contains at least one display_*.started column with 2+ numeric rows. - A single keypress RT column exists (key_resp*.rt) and is used to align time zero. - If a dataqueue timeline exists, it must include nidaq payload==1 pulses.
psychopy files have an expStart column that indicates start of the experiment in absolute clock datetime. Psychopy files have a Custom_Trigger routine; a spacebar press then triggers a sync pulse to the DAQ system. Thus, the true start is the expStart + the key_resp_2.rt (the key_resp_2.rt is column in the psychopy file, with 1 value, but that value may not be on the first row)
true end can be calculated using the expStart + the elapsed value from the last row of the column that precedes Subject ID and
The dataqueue file collects nidaq TTL pulses. The first pulse (payload=1) has a clock time and relative time (queue_elapsed). We can use this to align the psychopy timeline to the dataqueue timeline. The experimental window, for sample_experiment3, is between the first nidaq and last nidaq.
The psychopy experiment likely runs longer than the nidaq pulse window, so we can trim the psychopy timeline to be within the nidaq pulse window.
- Additional details:
The loader derives its primary timeline from event start columns (e.g. display_*.started).
All time-like columns are aligned by subtracting the keypress RT so time zero is the trigger.
For task-gratings, rows are taken from trial metadata and extended to include the final stopped event.
When dataqueue is available, the timeline is trimmed to the nidaq window but remains zero-based.
- class mesofield.datakit.sources.behavior.psychopy.Psychopy[source]#
Bases:
IntervalSeriesSourceLoad Psychopy trial windows as an interval table.
- requires: ClassVar[Tuple[str, ...]] = ('dataqueue',)#
Tag names of upstream sources whose loaded streams should be made available via
LoadContext.dependencies. Soft contract: a missing or failed dependency yieldsNoneindependencies[tag]; sources are responsible for either degrading gracefully or raising.