neuromaps.nulls.moran
- neuromaps.nulls.moran(data, atlas='fsaverage', density='10k', parcellation=None, n_perm=1000, seed=None, distmat=None, tempdir=None, n_proc=1, **kwargs)[source]
Generate null maps for data using method from [SN9].
Method uses a spatial decomposition of a distance-based weight matrix to estimate eigenvectors that are used to generate surrogate maps by imposing a similar spatial structure on randomized data. For a MATLAB implementation refer to [SN10] and [SN11]
- Parameters:
data (array_like or path_like or niimg_like or giimg_like or tuple) – Input data from which to generate null maps. When a parcellation is provided, the data must be parcellated and array-like. Otherwise, the data can either be a volumetric image (niimg_like, e.g. nib.Nifti1Image) or a surface-based image (giimg_like, e.g. nib.GiftiImage). Alternatively, it can be a path-like object (str or os.PathLike) pointing to an image file.
atlas ({'fsLR', 'fsaverage', 'civet', 'mni152'}, optional) – Name of atlas on which data are defined. Default: ‘fsaverage’
density (str, optional) – Density of atlas on which data are defined. Must be compatible with specified atlas. Default: ‘10k’
parcellation (tuple-of-str or os.PathLike, optional) – Filepaths to parcellation images ([left, right] hemisphere) mapping data to atlas specified by atlas and density. Should only be supplied if data represents a parcellated null map. Default: None
n_perm (int, optional) – Number of null maps or permutations to generate. Default: 1000
seed ({int, np.random.RandomState instance, None}, optional) – Seed for random number generation. Default: None
n_proc (int, optional) – Number of processors to use for parallelizing computations. If negative will use max available processors plus 1 minus the specified number. Default: 1 (no parallelization)
distmat (tuple-of-str or os.PathLike, optional) – Filepaths to pre-computed (left, right) surface distance matrices. Providing this will cause atlas, density, and parcellation to be ignored. Default: None
tempdir (os.PathLike, optional) – Directory specifying where the temporary distance matrix computed when generating volumetric nulls without parcellations should be stored. If None, a default directory is used. Default: None
kwargs (key-value pairs) – Other keyword arguments passed directly to the underlying null method generator
- Returns:
nulls – Generated null distribution, where each column represents a unique null map
- Return type:
np.ndarray
References
[SN9]Wagner, H. H., & Dray, S. (2015). Generating spatially constrained null models for irregularly spaced data using M oran spectral randomization methods. Methods in Ecology and Evolution, 6(10), 1169-1178.
[SN10]de Wael, R. V., Benkarim, O., Paquola, C., Lariviere, S., Royer, J., Tavakol, S., … & Bernhardt, B. C. (2020). BrainSpace: a toolbox for the analysis of macroscale gradients in neuroimaging and connectomics datasets. Communications Biology, 3(1), 1-10.