ncrf.TRFDesign

class ncrf.TRFDesign(basis, tstart, tstep, tstop, basis_std, stim_is_single, stim_dims, stim_names, basis_stride=None, stim_baseline=None, stim_scaling=None, scale=None)

Stimulus and basis metadata defining the coefficient space.

Use from_stim() to derive a design from predictor NDVars.

Parameters:
  • basis (list[numpy._typing._array_like.NDArray[numpy.float64]]) – Gaussian basis matrices, one per predictor variable. basis[i] is shape (n_lags, n_atoms): each column is a Gaussian bump centered on a distinct lag.

  • tstart – TRF timing; tstart/tstop hold one value per predictor.

  • tstep – TRF timing; tstart/tstop hold one value per predictor.

  • tstop – TRF timing; tstart/tstop hold one value per predictor.

  • basis_std (float) – Standard deviation of the Gaussian basis functions in seconds.

  • stim_is_single (bool) – Whether the original stimulus input was a single predictor per segment; controls whether reconstruction returns a bare NDVar or a list.

  • stim_dims (list[eelbrain._data_obj.Categorial | eelbrain._data_obj.Scalar | eelbrain._data_obj.Space | None]) – Feature dimension for each predictor (None for scalar predictors).

  • stim_names (list[str]) – Name of each predictor variable.

  • basis_stride (int | None) – Spacing between neighboring basis atoms in samples, as passed to from_stim(). None when the design was constructed directly with a custom basis, since no single stride describes it then.

  • stim_baseline – Centering and scaling of the covariates, one value per expanded covariate channel, or None when that step is not applied.

  • stim_scaling – Centering and scaling of the covariates, one value per expanded covariate channel, or None when that step is not applied.

  • scale (Literal['l1', 'l2', 'spectral'] | None) – Which scaling produced stim_scaling ('l1', 'l2' or 'spectral'), or None when the covariates were left unscaled.

Methods

assert_compatible(other)

Check that other describes the same coefficient space as this design.

assert_same_normalization(other)

Check that other records the same centering and scaling as this design.

expand(values)

Expand one value per covariate channel to one value per covariate column.

from_stim(stim, tstep, tstart, tstop[, ...])

Derive the design from the predictors of one segment.

per_predictor(values)

Split one value per covariate channel into one item per predictor.

Attributes

basis_column_sums

Sum of each covariate column's basis function, one value per column.

basis_stride

basis_widths

Number of basis functions of each expanded covariate channel.

filter_length

TRF length in samples, one value per predictor.

n_coefficients

Total number of Gabor coefficients, i.e. the number of columns of theta.

scale

start_samples

tstart in samples, one value per predictor.

stim_baseline

stim_lens

Number of expanded covariate channels contributed by each predictor.

stim_scaling

stop_samples

tstop in samples, one value per predictor.

basis

tstart

tstep

tstop

basis_std

stim_is_single

stim_dims

stim_names