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 tmin value in the events dataset (default -0.1).

  • tmax (float | str) – End of the epoch, or an expression that evaluates to a trial-specific tmax value in the events dataset (default 0.6).

  • samplingrate (float) – Target samplingrate. Needs to divide data samplingrate evenly (e.g. 200 for 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 every decim’th sample).

  • baseline (tuple) – The baseline of the epoch (default (None, 0); if tmin > 0: no baseline; if tmax < 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_shift applied after loading selected events. For secondary epochs the trigger_shift is applied additively with the trigger_shift of 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_shift parameter is specified, the parameters post_baseline_trigger_shift_min and post_baseline_trigger_shift_max are also needed, specifying the smallest and largest possible shift. These are used to crop the resulting epochs appropriately, to the region from new_tmin = epoch['tmin'] - post_baseline_trigger_shift_min to new_tmax = epoch['tmax'] - post_baseline_trigger_shift_max.

  • n_cases (int) – Expected number of epochs. If n_cases is defined, a RuntimeError will 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

Pipeline.epochs

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)")