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.expression_to_contrast_vector¶
- nilearn.glm.expression_to_contrast_vector(expression, design_columns)[source]¶
Convert a string describing a contrast to a contrast vector.
- Parameters:
- Returns:
- contrast_vectornumpy.ndarray
1D array with one entry per design column.
Examples
>>> from nilearn.glm.contrasts import expression_to_contrast_vector >>> expression_to_contrast_vector("task", ["task", "rest"]) array([1., 0.]) >>> expression_to_contrast_vector("task - rest", ["task", "rest"]) array([ 1., -1.])