nigsp package

nigsp.workflow - Primary workflows

nigsp(fname, scname[, atlasname, outname, ...])

Main workflow for nigsp, following the methods described in [Ra554358f60f2-1].

nigsp.operations.graph - Operations on graphs

zerocross(eigenvec)

Compute the amount of zero-crossing of an eigenvector matrix (for each eigenvector).

nodestrength(mtx[, mean])

Compute the node strength of a graph.

nigsp.operations.laplacian - Operations on/for Laplacians

compute_laplacian(mtx[, negval, selfloops])

Compute Laplacian (L) matrix from a square matrix.

normalisation(lapl, degree[, norm, fix_zeros])

Normalise a Laplacian (L) matrix using either symmetric or random walk normalisation.

symmetric_normalised_laplacian(mtx[, d, ...])

Compute symmetric normalised Laplacian (SNL) matrix.

decomposition(mtx)

Run a eigenvector decomposition on input.

recomposition(eigenval, eigenvec)

Recompose a matrix from its eigenvalues and eigenvectors.

nigsp.operations.metrics - Metrics computation

sdi(ts_split[, mean, keys])

Compute the Structural Decoupling Index (SDI).

gsdi(ts_split[, mean, keys])

Compute the generalised SDI.

functional_connectivity(timeseries[, mean])

Compute Functional Connectivity of timeseries.

nigsp.operations.nifti - Operations on nifti-like data

vol_to_mat(data)

Reshape <3D in 1D or 4D into 2D.

mat_to_vol(data[, shape, asdata])

Reshape nD data (normally 2D) using either shape or data shape).

apply_mask(data, mask)

Reduce shape and size of data based on mask.

unmask(data, mask[, shape, asdata])

Unmask 1D or 2D into an nD based on shape or asdata.

apply_atlas(data, atlas[, mask])

Extract average timeseries from an atlas.

unfold_atlas(data, atlas[, mask])

Return a lower dimensional matrix into a 3- or 4- D matrix based on an atlas.

nigsp.operations.surrogates - Surrogate computations and testing

random_sign(eigenvec[, n_surr, seed, stack])

Create surrogates by randomly switching signs of eigenvectors.

sc_informed(timeseries, eigenvec[, n_surr, ...])

Create surrogates informed by the real structural connectivity.

sc_uninformed(timeseries, lapl_mtx[, ...])

Create surrogates ignorant of the real structural connectivity.

test_significance(surr[, data, method, p, ...])

Test the significance of the empirical data against surrogates.

nigsp.operations.timeseries - Operations on/involving timeseries

normalise_ts(timeseries[, globally])

Normalise given timeseries (i.e. mean=0, std=1).

spc_ts(timeseries[, globally])

Express timeseries in signal percentage change.

demean_ts(timeseries[, globally])

Demean timeseries.

rescale_ts(timeseries[, vmin, vmax, globally])

Rescale given timeseries between given max and min value.

resize_ts(timeseries[, resize, globally])

Rescale timeseries with some methods.

graph_fourier_transform(timeseries, eigenvec)

Project a graph decomposition onto the timeseries.

median_cutoff_frequency_idx(energy)

Find the frequency that splits the energy of a timeseries in two roughly equal parts.

graph_filter(timeseries, eigenvec, freq_idx)

Filter a graph decomposition into two parts based on freq_idx.

nigsp.io - I/O functions: checks

check_ext(all_ext, fname[, scan, remove])

Check which extension a file has, and possibly remove it.

check_nifti_dim(fname, data[, dim])

Check number of dimensions in nifti file.

check_mtx_dim(fname, data[, shape])

Check dimensions of a matrix.

nigsp.io - I/O functions: load

load_nifti_get_mask(fname[, is_mask, ndim])

Load a nifti file and returns its data, its image, and a 3d mask.

load_txt(fname[, shape])

Read files in textual format.

load_mat(fname[, shape])

Read files in matlab format.

load_xls(fname[, shape])

Read files in xls format.

nigsp.io - I/O functions: export

export_nifti(data, img, fname)

Export a nifti file.

export_txt(data, fname[, ext])

Export data into a text-like or mat file.

export_mtx(data, fname[, ext])

Export data into a text-like or mat file.

nigsp.io - I/O functions: supported extensions

EXT_1D

Built-in mutable sequence.

EXT_MAT

Built-in mutable sequence.

EXT_NIFTI

Built-in mutable sequence.

EXT_XLS

Built-in mutable sequence.

nigsp.viz - Visualisations

plot_connectivity(mtx[, filename, closeplot])

Create a connectivity matrix plot.

plot_greyplot(timeseries[, filename, title, ...])

Create a greyplot (a.k.a.

plot_nodes(ns, atlas[, filename, thr, closeplot])

Create a marker plot in the MNI space.

plot_edges(mtx, atlas[, filename, thr, ...])

Create a connectivity plot in the MNI space.

nigsp.utils - Utility functions

pairwise(iterable)

Recreate itertools.pairwise behaviour for python < 3.10 compatibility.

change_var_type(var, dtype[, varname, stop, ...])

Make sure var is of type dtype.

prepare_ndim_iteration(data, idx)

Reshape data to have idx+1 dimensions.

nigsp.objects - Data objects

The main object of nigsp.

It holds all data information - graph, timeseries, decompositions, …

Contains duplications of operations, allowing a more object oriented approach to interact with nigsp.

Attributes

LGR

Logger

SCGraph(mtx, timeseries[, atlas, filename, ...])

Main module object, containing all data representing the graph.

nigsp.blocks - Workflow blocks

nifti_to_timeseries(fname, atlasname)

Read a nifti file and returns a normalised timeseries from an atlas.

export_metric(scgraph, outext, outprefix)

Export the metrics computed within the library.

plot_metric(scgraph, outprefix[, atlas, thr])

If possible, plot metrics as markerplot.