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.mean_scaling¶
- nilearn.glm.first_level.mean_scaling(Y, axis=0)[source]¶
Scaling of the data to have percent of baseline change along the specified axis.
- Parameters:
- Yarray of shape (n_time_points, n_voxels)
The input data.
- axis
int, default=0 Axis along which the scaling mean should be calculated.
- Returns:
- Yarray of shape (n_time_points, n_voxels),
The data after mean-scaling, de-meaning and multiplication by 100.
- meanarray of shape (n_voxels,)
The data mean.
Examples
>>> import numpy as np >>> from nilearn.glm.first_level import mean_scaling >>> Y = np.array([[1.0, 2.0, 3.0], [2.0, 4.0, 6.0]]) >>> Y_scaled, mean = mean_scaling(Y) >>> Y_scaled.shape (2, 3) >>> mean array([1.5, 3. , 4.5]) >>> bool(np.allclose(Y_scaled.mean(axis=0), 0)) True