Skip to content

Condition contrasts

contrasts module-attribute

Python
contrasts: Sequence[tuple[str, str] | ArbitraryContrast] = []

The conditions to contrast via a subtraction of ERPs / ERFs. The list elements can either be tuples or dictionaries (or a mix of both). Each element in the list corresponds to a single contrast.

A tuple specifies a one-vs-one contrast, where the second condition is subtracted from the first.

If a dictionary, must contain the following keys:

  • name: a custom name of the contrast
  • conditions: the conditions to contrast
  • weights: the weights associated with each condition.

Pass an empty list to avoid calculation of any contrasts.

For the contrasts to be computed, the appropriate conditions must have been epoched, and therefore the conditions should either match or be subsets of conditions above.

Example

Contrast the "left" and the "right" conditions by calculating left - right at every time point of the evoked responses:

Python
contrasts = [('left', 'right')]  # Note we pass a tuple inside the list!

Contrast the "left" and the "right" conditions within the "auditory" and the "visual" modality, and "auditory" vs "visual" regardless of side:

Python
contrasts = [('auditory/left', 'auditory/right'),
             ('visual/left', 'visual/right'),
             ('auditory', 'visual')]

Contrast the "left" and the "right" regardless of side, and compute an arbitrary contrast with a gradient of weights:

Python
contrasts = [
    ('auditory/left', 'auditory/right'),
    {
        'name': 'gradedContrast',
        'conditions': [
            'auditory/left',
            'auditory/right',
            'visual/left',
            'visual/right'
        ],
        'weights': [-1.5, -.5, .5, 1.5]
    }
]

Pipeline steps using this setting

The following steps are directly affected by changes to contrasts:

  • sensor/_01_make_evoked
  • sensor/_02_decoding_full_epochs
  • sensor/_03_decoding_time_by_time
  • sensor/_05_decoding_csp
  • sensor/_06_make_cov
  • sensor/_99_group_average
  • source/_05_make_inverse
  • source/_99_group_average