tedana.model.fit

Fit models.

Functions

computefeats2(data, mmix, mask[, normalize]) Converts data to component space using mmix
fitmodels_direct(catd, mmix, mask, t2s, …) Fit TE-dependence and -independence models to components.
get_coeffs(data, X[, mask, add_const]) Performs least-squares fit of X against data
computefeats2(data, mmix, mask, normalize=True)[source]

Converts data to component space using mmix

Parameters:
  • data ((S x T) array_like) – Input data
  • mmix ((T [x C]) array_like) – Mixing matrix for converting input data to component space, where C is components and T is the same as in data
  • mask ((S,) array_like) – Boolean mask array
  • normalize (bool, optional) – Whether to z-score output. Default: True
Returns:

data_Z – Data in component space

Return type:

(S x C) numpy.ndarray

fitmodels_direct(catd, mmix, mask, t2s, t2s_full, tes, combmode, ref_img, reindex=False, mmixN=None, full_sel=True, label=None, out_dir='.', verbose=False)[source]

Fit TE-dependence and -independence models to components.

Parameters:
  • catd ((S x E x T) array_like) – Input data, where S is samples, E is echos, and T is time
  • mmix ((T x C) array_like) – Mixing matrix for converting input data to component space, where C is components and T is the same as in catd
  • mask ((S [x E]) array_like) – Boolean mask array
  • t2s ((S [x T]) array_like) – Limited T2* map or timeseries.
  • t2s_full ((S [x T]) array_like) – Full T2* map or timeseries. For voxels with good signal in only one echo, which are zeros in the limited T2* map, this map uses the T2* estimate using the first two echoes.
  • tes (list) – List of echo times associated with catd, in milliseconds
  • combmode ({'t2s', 'paid'} str) – How optimal combination of echos should be made, where ‘t2s’ indicates using the method of Posse 1999 and ‘paid’ indicates using the method of Poser 2006
  • ref_img (str or img_like) – Reference image to dictate how outputs are saved to disk
  • reindex (bool, optional) – Default: False
  • mmixN (array_like, optional) – Default: None
  • full_sel (bool, optional) – Whether to perform selection of components based on Rho/Kappa scores. Default: True
Returns:

  • seldict (dict)
  • comptable ((C x X) pandas.DataFrame) – Component metric table. One row for each component, with a column for each metric. The index is the component number.
  • betas (numpy.ndarray)
  • mmix_new (numpy.ndarray)

get_coeffs(data, X, mask=None, add_const=False)[source]

Performs least-squares fit of X against data

Parameters:
  • data ((S [x E] x T) array_like) – Array where S is samples, E is echoes, and T is time
  • X ((T [x C]) array_like) – Array where T is time and C is predictor variables
  • mask ((S [x E]) array_like) – Boolean mask array
  • add_const (bool, optional) – Add intercept column to X before fitting. Default: False
Returns:

betas – Array of S sample betas for C predictors

Return type:

(S [x E] x C) numpy.ndarray