# modalities.fmri.fmristat.hrf

## Module: `modalities.fmri.fmristat.hrf`

Computation of the canonical HRF used in fMRIstat, both the 2-term spectral approximation and the Taylor series approximation, to a shifted version of the canonical Glover HRF.

### References

Liao, C.H., Worsley, K.J., Poline, J-B., Aston, J.A.D., Duncan, G.H.,

  Evans, A.C. (2002). ‘Estimating the delay of the response in fMRI data.’ NeuroImage, 16:593-606.

## Functions

nipy.modalities.fmri.fmristat.hrf.spectral_decomposition(hrf2decompose, time=None, delta=None, ncomp=2)

  PCA decomposition of symbolic HRF shifted over time

  Perform a PCA expansion of a symbolic HRF, time shifted over the values in delta, returning the first ncomp components.

  This smooths out the HRF as compared to using a Taylor series approximation.

  Parameters:
    hrf2decompose sympy expression

      An expression that can be lambdified as a function of ‘t’. This is the HRF to be expanded in PCA

    time None or np.ndarray, optional

      None gives default value of np.linspace(-15,50,3251) chosen to match fMRIstat implementation. This corresponds to a time interval of 0.02. Presumed to be equally spaced.

    delta None or np.ndarray, optional

      None results in default value of np.arange(-4.5, 4.6, 0.1) chosen to match fMRIstat implementation.

    ncomp int, optional

      Number of principal components to retain.

  Returns:
    hrf[sympy expressions]

      A sequence length ncomp of symbolic HRFs that are the principal components.

    approx

      TODO

nipy.modalities.fmri.fmristat.hrf.taylor_approx(hrf2decompose, time=None, delta=None)

  A Taylor series approximation of an HRF shifted by times delta

  Returns original HRF and gradient of HRF

  Parameters:
    hrf2decompose sympy expression

      An expression that can be lambdified as a function of ‘t’. This is the HRF to be expanded in PCA

    time None or np.ndarray, optional

      None gives default value of np.linspace(-15,50,3251) chosen to match fMRIstat implementation. This corresponds to a time interval of 0.02. Presumed to be equally spaced.

    delta None or np.ndarray, optional

      None results in default value of np.arange(-4.5, 4.6, 0.1) chosen to match fMRIstat implementation.

  Returns:
    hrf[sympy expressions]

      Sequence length 2 comprising (hrf2decompose, `dhrf`) where `dhrf` is the first derivative of hrf2decompose.

    approx

      TODO

  References

  Liao, C.H., Worsley, K.J., Poline, J-B., Aston, J.A.D., Duncan, G.H., Evans, A.C. (2002). ‘Estimating the delay of the response in fMRI data.’ NeuroImage, 16:593-606.