# modalities.fmri.realfuncs

## Module: `modalities.fmri.realfuncs`

Helper functions for constructing design regressors

## Functions

nipy.modalities.fmri.realfuncs.dct_ii_basis(volume_times, order=None, normcols=False)

  DCT II basis up to order order

  See: https://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-II

  By default, basis not normalized to length 1, and therefore, basis is not orthogonal. Normalize basis with normcols keyword argument.

  Parameters:
    volume_times array-like

      Times of acquisition of each volume. Must be regular and continuous otherwise we raise an error.

    order None or int, optional

      Order of DCT-II basis. If None, return full basis set.

    normcols bool, optional

      If True, normalize columns to length 1, so return orthogonal dct_basis.

  Returns:
    dct_basis array

      Shape `(len(volume_times), order)` array with DCT-II basis up to order order.

  Raises:
    ValueError

      If difference between successive volume_times values is not constant over the 1D array.

nipy.modalities.fmri.realfuncs.dct_ii_cut_basis(volume_times, cut_period)

  DCT-II regressors with periods >= cut_period

  See: http://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-II

  Parameters:
    volume_times array-like

      Times of acquisition of each volume. Must be regular and continuous otherwise we raise an error.

    cut_period: float

      Cut period (wavelength) of the low-pass filter (in time units).

  Returns:
    cdrift: array shape (n_scans, n_drifts)

      DCT-II drifts plus a constant regressor in the final column. Constant regressor always present, regardless of cut_period.