frites.utils.split_group#

frites.utils.split_group(x, names=None, axis='roi', new_axis='subjects', average=False)[source]#

Split data group.

This function can be used to reorganize a list of matrices. For example, if you have a list storing the data of n_subjects :

\[data = [(roi_{1}, times), (roi_{2}, times), (roi_{3}, times)]\]

the data can be reorganized to become a list of brain regions with

\[reshaped = [(suj_{1}, times), (suj_{2}, times), (suj_{3}, times)]\]
Parameters
xpython:list

List of xarray.DataArray, potentially multidimensional

namespython:list | python:None

List of names associated to each element of the list. Should have the same length as x.

axispython:str | ‘roi’

Axis name along which data should be splitted. By default, the function performs a spatial split over the ‘roi’ dimension

new_axispython:str | ‘subjects’

New name replacing axis. By default, the function is going to concatenate over a new axis called ‘subjects’

averagebool | python:False

If repeated coordinates are present for each element of the list (e.g. repeated brain region names for a single subject), allow to take the average over repeated coordinates.

Returns
reshapedpython:list

List of reshaped xarray.DataArray

u_namespython:list

List of unique names describing each element of the reshaped data