API reference

lyman.frontend: Front-end interface

Forward facing lyman tools with information about ecosystem.

Interface functions

frontend.info([experiment, model, lyman_dir])

Load information from various files to control analyses.

frontend.subjects([subject_arg, sessions, …])

Find a list of subjects in a variety of ways.

frontend.execute(wf, args, info)

Main interface for (probably) executing a nipype workflow.

Information classes

frontend.LymanInfo

Combination of all information classes.

frontend.ProjectInfo

General information common to a project.

frontend.ExperimentInfo

More specific experiment-level information.

frontend.ModelInfo

Model-specific level of information about a specific model.

lyman.glm: General linear modeling

HRF models

glm.HRFModel

Abstract base class for HRF models used in design construction.

glm.GammaHRF([res, duration, pos_shape, …])

Double gamma variate model of cannonical HRF.

glm.GammaBasis([time_derivative, …])

Basis set for HRF based on Gamma variate model.

glm.FIRBasis(n[, offset, suffix])

Finite Impulse Response basis model.

glm.IdentityHRF

Model that does not alter input during transform; useful for testing.

Design construction

glm.build_design_matrix([conditions, …])

Use design information to build a matrix for a BOLD time series GLM.

glm.condition_to_regressors(name, condition, …)

Generate design matrix columns from information about event occurrence.

glm.contrast_matrix(contrast, design_matrix)

Return a contrast matrix that is valid for a given design matrix.

Model estimation

glm.prewhiten_image_data(ts_img, mask_img, X)

Estimate autocorrelation and transform data and design for OLS.

glm.estimate_residual_autocorrelation(Y, X)

Fit OLS model and estimate residual autocorrelation with regularization.

glm.iterative_ols_fit(Y, X)

Fit a linear model using ordinary least squares in each voxel.

glm.iterative_contrast_estimation(B, SS, …)

Compute contrast parameter and variance estimates in each voxel.

glm.contrast_fixed_effects(G, V)

Compute higher-order fixed effects parameters.

Temporal filtering

glm.highpass_filter_matrix(n_tp, cutoff[, tr])

Return an array to implement a gaussian running line filter.

glm.highpass_filter(data, cutoff[, tr, copy])

Highpass filter data with gaussian running line filter.

lyman.signals: Signal processing

Time series transformation and diagnostics

signals.percent_change(data[, axis])

Convert data to percent signal change over specified axis.

signals.detrend(data[, axis, replace_mean])

Linearly detrend on an axis, optionally replacing the original mean.

signals.pca_transform(data[, keep, whiten])

Transform data matrix using PCA.

signals.identify_noisy_voxels(ts_img, mask_img)

Create a mask of voxels that are unusually noisy given neighbors.

signals.cv(data[, axis, detrend, mask, …])

Compute the temporal coefficient of variation.

Spatial filtering

signals.smooth_volume(data_img, fwhm[, …])

Filter volume data with an isotropic gaussian kernel.

signals.smooth_segmentation(data_img, …[, …])

Filter each compartment of a segmentation with an isotropic gaussian.

signals.smooth_surface(data_img, vert_img, …)

Smooth cortical voxels with Gaussian weighted surface distances.

signals.smoothing_matrix(measure, vertids, fwhm)

Define a matrix to smooth voxels using surface geometry.

signals.voxel_sigmas(fwhm, img)

Convert isotropic fwhm in mm to an array of voxelwise sigmas.

lyman.surface: Surface mesh operations

Geodesic distance measurement

surface.SurfaceMeasure(verts, faces)

Object for computing distance along a surface mesh.

Data representation conversion

surface.vol_to_surf(data_img, subject, hemi)

Sample data from a volume image onto a surface mesh.

lyman.utils: Utilities

Custom Nipype interfaces

utils.LymanInterface(**inputs)

Enhanced Interface object that custom interface should inherit from.

utils.SaveInfo(**inputs)

Data representation conversion

utils.image_to_matrix(img, mask_img[, use])

Extract image data from voxels using segmentation mask.

utils.matrix_to_image(data, mask_img[, …])

Convert a vector or matrix of data into a nibabel image.

utils.check_mask(mask, data)

Check the dtype and shape of a mask array.

lyman.visualization: Data visualization

Classes for image representation

visualizations.Mosaic(anat[, stat, mask, …])

visualizations.CarpetPlot(data, seg[, …])

Model visualization

visualizations.plot_design_matrix(X[, title])

Show the design matrix as a transposed heatmap.

visualizations.plot_nuisance_variables(X[, …])

Show the timeseries of each nuisance variable, by source.