Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.
nilearn.glm.first_level.compute_regressor¶
- nilearn.glm.first_level.compute_regressor(exp_condition, hrf_model, frame_times, con_id='cond', oversampling=50, fir_delays=None, min_onset=-24)[source]¶
Convolve regressors with HRF model.
- Parameters:
- exp_conditionarray-like of shape (3, n_events)
yields description of events for this condition as a (onsets, durations, amplitudes) triplet
- hrf_model
str
, function,list
of functions, or None This parameter defines the HRF model to be used. It can be a string if you are passing the name of a model implemented in Nilearn. Valid names are:
"spm + derivative"
: SPM model plus its time derivative. This gives 2 regressors. Seespm_hrf
, andspm_time_derivative
."spm + derivative + dispersion"
: Same as above plus dispersion derivative. This gives 3 regressors. Seespm_hrf
,spm_time_derivative
, andspm_dispersion_derivative
."glover"
: This corresponds to the Glover HRF. Seeglover_hrf
."glover + derivative"
: The Glover HRF + time derivative. This gives 2 regressors. Seeglover_hrf
, andglover_time_derivative
."glover"+ derivative + dispersion"
: Same as above plus dispersion derivative. This gives 3 regressors. Seeglover_hrf
,glover_time_derivative
, andglover_dispersion_derivative
."fir"
: Finite impulse response basis. This is a set of delayed dirac models.
It can also be a custom model. In this case, a function should be provided for each regressor. Each function should behave as the other models implemented within Nilearn. That is, it should take both
t_r
andoversampling
as inputs and return a sample numpy array of appropriate shape.Note
It is expected that
"spm"
standard and"glover"
models would not yield large differences in most cases.Note
In case of
"glover"
and"spm"
models, the derived regressors are orthogonalized with respect to the main one.- frame_timesarray of shape (n_scans)
the desired sampling times
- con_id
str
, default=’cond’ Identifier of the condition
- oversampling
int
, default=50 Oversampling factor to perform the convolution.
- fir_delays[int] 1D-array-like or None, default=None
Delays (in scans) used in case of a finite impulse response model.
- min_onset
float
, default=-24 Minimal onset relative to frame_times[0] (in seconds) events that start before frame_times[0] + min_onset are not considered.
- Returns:
- computed_regressorsarray of shape(n_scans, n_reg)
Computed regressors sampled at frame times.
- reg_names
list
of strings Corresponding regressor names.
Examples using nilearn.glm.first_level.compute_regressor
¶
Example of MRI response functions