def spm_time_derivative(tr, oversampling=50, time_length=32., onset=0.):
    """Implementation of the SPM time derivative hrf (dhrf) model

    Parameters
    ----------
    tr: float
        scan repeat time, in seconds

    oversampling: int, optional
        temporal oversampling factor, optional

    time_length: float, optional
        hrf kernel length, in seconds

    onset: float, optional
        onset of the response in seconds

    Returns
    -------
    dhrf: array of shape(length / tr, dtype=float)
          dhrf sampling on the provided grid
    """
    do = .1
    dhrf = 1. / do * (spm_hrf(tr, oversampling, time_length, onset) -
                      spm_hrf(tr, oversampling, time_length, onset + do))
    return dhrf
Implementation of the SPM time derivative hrf (dhrf) model

    Parameters
    ----------
    tr: float
        scan repeat time, in seconds

    oversampling: int, optional
        temporal oversampling factor, optional

    time_length: float, optional
        hrf kernel length, in seconds

    onset: float, optional
        onset of the response in seconds

    Returns
    -------
    dhrf: array of shape(length / tr, dtype=float)
          dhrf sampling on the provided grid