How to define contrasts between different conditions across runs?

Summary of what happened:

Hello Neurostars community,
I have a question about defining a contrast between conditions from different runs in a first-level fMRI analysis using Nilearn’s FirstLevelModel.compute_contrast.

Experiment Setup:

I repeat several different runs in my experiment, but for simplicity, I will focus on two runs:

  1. Run 1 has six conditions:
    a_cond1, a_cond2, a_cond3, a_cond4, a_cond5, a_cond6.
  2. Run 2 has six different conditions:
    b_cond1, b_cond2, b_cond3, b_cond4, b_cond5, b_control.

For the first-level analysis, I want to compute a contrast comparing the average activation of all conditions in Run 1 (a_cond1 to a_cond6) to the control condition in Run 2 (b_control).

Current Approach:

When using compute_contrast from Nilearn, the input is a list, where each item corresponds to the contrast for the relevant run. I’ve currently specified the contrast as follows:

contrast = [
    '1*a_cond1 + 1*a_cond2 + 1*a_cond3 + 1*a_cond4 + 1*a_cond5 + 1*a_cond6', 
    '0*b_cond1 + 0*b_cond2 + 0*b_cond3 + 0*b_cond4 + 0*b_cond5 - 6*b_control'
]

Is my approach correct, and if not, how should I handle it?
However, my understanding is that the sum of weights in a contrast should equal 0 . In this case, since I am contrasting conditions across different runs, this requirement is not met.

Version:

Nilearn version: ‘0.11.0’

Environment (Docker, Singularity / Apptainer, custom installation):

Python version: 3.13.1

Screenshots / relevant information:

An instance of a design matrix:

Thanks in advance,
Meitar