nispace.nulls.apply_spins

nispace.nulls.apply_spins(data_1d, spins_lh, spins_rh, idc_lh, idc_rh, n_perm=None)[source]

Apply precomputed spin indices to a 1D data array.

Parameters:
  • data_1d (array-like) – 1D array of parcel values, length n_parcels.

  • spins_lh (ndarray of int) – Spin indices as returned by generate_spins()/generate_baum_spins, shape (n_lh_parcels, n_perm) / (n_rh_parcels, n_perm). -1 entries (Baum-method parcels absorbed by the medial wall after rotation) are handled by setting those output positions to NaN.

  • spins_rh (ndarray of int) – Spin indices as returned by generate_spins()/generate_baum_spins, shape (n_lh_parcels, n_perm) / (n_rh_parcels, n_perm). -1 entries (Baum-method parcels absorbed by the medial wall after rotation) are handled by setting those output positions to NaN.

  • idc_lh (array-like of int) – Positions in data_1d corresponding to each hemisphere’s parcels, in the same order spins_lh/spins_rh index into.

  • idc_rh (array-like of int) – Positions in data_1d corresponding to each hemisphere’s parcels, in the same order spins_lh/spins_rh index into.

  • n_perm (int, optional) – Number of permutations to apply; defaults to spins_lh.shape[1] (use all).

Returns:

null_data – Shape (n_perm, n_parcels). Positions not covered by idc_lh/idc_rh (e.g. subcortex) remain NaN.

Return type:

ndarray

Notes

Intended to be called through generate_null_maps(), which calls this once per data row as part of its spin-test code path — not meant to be called directly in most cases.