roiextract.optimize.ctf_optimize#
- roiextract.optimize.ctf_optimize(leadfield, template, mask, lambda_, mode='similarity', criteria='rat', threshold=None, initial='auto', tol=0.001, reg=0.001, quantify=False, ch_names=None, name='')#
Derive a spatial filter that optimizes properties of the CTF for the extracted ROI time series
- Parameters:
leadfield (array_like) – Lead field matrix for dipoles with fixed orientation with shape (channels, voxels).
template (array_like) – Template CTF pattern for voxels with shape (voxels,). Only values within the ROI are used.
mask (array_like) – Voxel mask of the region of interest with shape (voxels,). Contains ones and zeros for voxels within and outside ROI, respectively.
lambda (float) – If 0, only ratio is optimized. If 1, only dot product. Values in between allow tweaking the balance between optimization for dot product or ratio.
mode (str) – Optimize a combination of ratio and similarity (mode=”similarity”) or ratio and homogeneity (mode=”homogeneity”).
reg (float) – Regularization parameter to ensure that it is possible to calculate the inverse matrices.
quantify (bool) – Whether to calculate CTF properties for the optimized spatial filter.
- Returns:
sf (SpatialFilter) – Spatial filter produced by the optimization.
props (dict, only returned if quantify=True) – Dictionary that contains the estimates of CTF-based properties (ratio, similarity and/or homogeneity).
- Raises:
ValueError – If provided lambda_ value is out of [0, 1] range.