eelbrain.pipeline.PrimaryEpoch
- class eelbrain.pipeline.PrimaryEpoch(session, sel=None, **kwargs)
Epoch based on selecting events from a raw file
- Parameters:
session (str) – Session (raw file) from which to load data.
sel (str) – Expression which evaluates in the events Dataset to the index of the events included in this Epoch specification.
tmin (float) – Start of the epoch (default -0.1).
tmax (float) – End of the epoch (default 0.6).
samplingrate (scalar) – Target samplingrate. Needs to divide data samplingrate evenly (e.g.
200for data sampled at 1000 Hz; default200).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).n_cases (int) – Expected number of epochs. If n_cases is defined, a RuntimeError error will be raised whenever the actual number of matching events is different.
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 has to be the name of an event variable providing for each epoch the actual amount of time shift (in seconds). 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.vars (dict) – Add new variables only for this epoch. Each entry specifies a variable with the following schema:
{name: definition}.definitioncan be either a string that is evaluated in the events-Dataset`, or a(source_name, {value: code})-tuple.source_namecan also be an interaction, in which case cells are joined with spaces ("f1_cell f2_cell").
See also
Examples
Selecting events based on a categorial label:
PrimaryEpoch('session', "variable == 'label'")
Based on multiple categorial labels:
PrimaryEpoch('session', "variable.isin(['label1', 'label2'])")
Based on multiple categorial variables:
PrimaryEpoch('session', "(variable == 'label') & (other_variable == 'other_label)")