ncrf.RegressionData

class ncrf.RegressionData(meg, covariates, norm_factor, basis, tstart, tstep, tstop, stim_is_single, stim_dims, stim_names, baseline, scaling, stim_normalization, basis_std, sensor_dim, is_whitened=False)

Prepared dataset for NCRF fitting.

Use from_data() to construct a dataset from raw MEG and stimulus NDVar objects.

Parameters:
  • meg (list[numpy.ndarray[tuple[Any, ...], numpy.dtype[numpy.float64]]]) – MEG signal arrays, one per segment, each shaped (n_sensors, n_times).

  • covariates (list[numpy.ndarray[tuple[Any, ...], numpy.dtype[numpy.float64]]]) – Basis-projected covariate matrices, one per segment, each shaped (n_times, n_basis_cols).

  • norm_factor (float) – sqrt(n_times) of the first segment; used by timeslice() to rescale sub-segments consistently.

  • basis (list[numpy.ndarray[tuple[Any, ...], numpy.dtype[numpy.float64]]]) – Gaussian basis matrices, one per predictor variable, each shaped (filter_length, n_basis).

  • tstart (list[float]) – TRF start time in seconds, one value per predictor.

  • tstep (float) – Sample spacing in seconds, shared by all segments.

  • tstop (list[float]) – TRF stop time in seconds, one value per predictor.

  • stim_is_single (bool) – True when the original stimulus input contained a single predictor per segment rather than a list; controls whether NCRF.h 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.

  • baseline (Sequence[eelbrain._data_obj.NDVar | float] | None) – Per-predictor centering values subtracted before covariate construction, or None if no centering was applied.

  • scaling (Sequence[eelbrain._data_obj.NDVar | float] | None) – Per-predictor scale factors applied after centering, or None if no scaling was applied.

  • stim_normalization (list[list[float]]) – Spectral norms of each predictor block before post-normalization, one inner list per segment.

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

  • sensor_dim (eelbrain._data_obj.Sensor) – Sensor dimension shared by all MEG segments.

  • is_whitened (bool) – Whether meg has already been transformed by a whitening filter.

Methods

from_data(meg, stim, tstart, tstop[, ...])

Construct a dataset from MEG and stimulus NDVars.

timeslice(idx)

Return a new dataset restricted to selected time indices.

whiten(whitening_filter)

Return a new dataset with MEG whitened.