brainspace.null_models.spin.spin_permutations

brainspace.null_models.spin.spin_permutations(spheres, data, unique=False, n_rep=100, random_state=None, surface_algorithm='FreeSurfer')[source]

Generate null data using spin permutations.

Parameters:
  • spheres (dict[str, ndarray or BSPolyData], BSPolyData or ndarray) – Dictionary of points in a sphere, for left (‘lh’ key) and right (‘rh’ key) hemispheres. The right hemisphere is optional. If provided, rotations are derived from the rotations computed for points_lh by reflecting the rotation matrix across the Y-Z plane.
  • data (dict[str, ndarray] or ndarray) – Dictionary of data to randomize. Array of variables arranged in columns for each hemisphere.
  • unique (bool, optional) – Whether to enforce a one-to-one correspondence between original points and rotated ones. If true, the Hungarian algorithm is used. Default is False.
  • n_rep (int, optional) – Number of random rotations. Default is 100.
  • surface_algorithm ({'FreeSurfer', 'CIVET'}) – For ‘CIVET’, no flip is required to generate the spins for the right hemisphere. Only used when points_rh is not None. Default is ‘FreeSurfer’.
  • random_state (int or None, optional) – Random state. Default is None.
Returns:

  • rand_lh (ndarray, shape = (n_rep, n_lh, n_feat)) – Permutations of data in left hemisphere.
  • rand_rh (ndarray, shape = (n_rep, n_rh, n_feat)) – Permutations of data in right hemisphere. Only if right data and sphere are provided.

See also

SpinPermutations

References

  • Alexander-Bloch A, Shou H, Liu S, Satterthwaite TD, Glahn DC, Shinohara RT, Vandekar SN and Raznahan A (2018). On testing for spatial correspondence between maps of human brain structure and function. NeuroImage, 178:540-51.
  • Blaser R and Fryzlewicz P (2016). Random Rotation Ensembles. Journal of Machine Learning Research, 17(4): 1–26.
  • https://netneurotools.readthedocs.io