eelbrain.pipeline.PrimaryEpoch
- class eelbrain.pipeline.PrimaryEpoch(task=None, sel=None, tmin=-0.1, tmax=0.6, samplingrate=None, decim=None, baseline=None, trigger_shift=0.0, post_baseline_trigger_shift=None, post_baseline_trigger_shift_min=None, post_baseline_trigger_shift_max=None, n_cases=None)
Epoch based on selecting events from a raw file
- Parameters:
task (str) – Task from which to load data. Can be omitted if the experiment has only a single task.
sel (str) – Expression which evaluates in the events Dataset to the index of the events included in this Epoch specification.
tmin (float | str) – Start of the epoch, or an expression that evaluates to a trial-specific
tminvalue in the events dataset (default -0.1).tmax (float | str) – End of the epoch, or an expression that evaluates to a trial-specific
tmaxvalue in the events dataset (default 0.6).samplingrate (float) – Target samplingrate. Needs to divide data samplingrate evenly (e.g.
200for data sampled at 1000 Hz; by default, use the raw data samplingrate).decim (int) – Alternative to
samplingrate. Decimate the data by this factor (i.e., only keep everydecim’th sample).baseline (tuple) – The baseline of the epoch (default
(None, 0); iftmin > 0: no baseline; iftmax < 0: the whole interval).trigger_shift (float | str) – Shift event triggers before extracting the data [in seconds]. Can be a float to shift all triggers by the same value, or a str indicating an event variable that specifies the trigger shift for each trigger separately. The
trigger_shiftapplied after loading selected events. For secondary epochs thetrigger_shiftis applied additively with thetrigger_shiftof their base epoch.post_baseline_trigger_shift (str) – Shift the trigger (i.e., where epoch time = 0) after baseline correction. The value of this entry is an expression that is evaluated in the selected-events Dataset and needs to yield the actual amount of time shift (in seconds) for each epoch. If the
post_baseline_trigger_shiftparameter is specified, the parameterspost_baseline_trigger_shift_minandpost_baseline_trigger_shift_maxare also needed, specifying the smallest and largest possible shift. These are used to crop the resulting epochs appropriately, to the region fromnew_tmin = epoch['tmin'] - post_baseline_trigger_shift_mintonew_tmax = epoch['tmax'] - post_baseline_trigger_shift_max.n_cases (int) – Expected number of epochs. If n_cases is defined, a
RuntimeErrorwill be raised whenever the actual number of matching events is different.post_baseline_trigger_shift_min (float)
post_baseline_trigger_shift_max (float)
See also
Examples
Selecting events based on a categorial label:
PrimaryEpoch('task', "variable == 'label'")
Based on multiple categorial labels:
PrimaryEpoch('task', "variable.isin(['label1', 'label2'])")
Based on multiple categorial variables:
PrimaryEpoch('task', "(variable == 'label') & (other_variable == 'other_label)")