cedalion.models.glm.basis_functions

Temporal basis functions for the GLM.

Classes

AFNIGamma(p, q, T)

AFNI gamma basis function, optionally convolved with a square-wave.

DiracDelta()

Convoluted with the stim duration this basis function yields a square wave.

Gamma(tau, sigma, T)

Modified gamma function, optionally convolved with a square-wave.

GammaDeriv(tau, sigma, T)

Modified gamma func.

GaussianKernels(t_pre, t_post, t_delta, t_std)

A consecutive sequence of gaussian functions.

GaussianKernelsWithTails(t_pre, t_post, ...)

A consecutive sequence of gaussian functions.

TemporalBasisFunction(convolve_over_duration)

class cedalion.models.glm.basis_functions.TemporalBasisFunction(convolve_over_duration: bool)[source]

Bases: ABC

class cedalion.models.glm.basis_functions.GaussianKernelsWithTails(
t_pre: cdt.QTime,
t_post: cdt.QTime,
t_delta: cdt.QTime,
t_std: cdt.QTime,
)[source]

Bases: TemporalBasisFunction

A consecutive sequence of gaussian functions.

The basis functions have the form:

\[f(t) = \exp( -(t-\mu)^2/t_{std}^2)\]

The user specifies a time interval around the stimuls onset via the parameters t_pre and t_post. Over this time interval a series of gaussian basis functions is distributed:

  • between the gaussian centers there is time gap of t_delta

  • the width of the each gaussian is specified by t_std

  • the gaussians are centered in the time interval with a margin of 3 x t_std left and right.

The number of gaussians is derived automatically from these constraints.

Parameters:
  • t_pre (Quantity, [time]) – time before trial onset

  • t_post (Quantity, [time]) – time after trial onset

  • t_delta (Quantity, [time]) – the temporal spacing between consecutive gaussians

  • t_std (Quantity, [time]) – time width of the gaussians

class cedalion.models.glm.basis_functions.GaussianKernels(
t_pre: cdt.QTime,
t_post: cdt.QTime,
t_delta: cdt.QTime,
t_std: cdt.QTime,
)[source]

Bases: TemporalBasisFunction

A consecutive sequence of gaussian functions.

The basis functions have the form:

\[f(t) = \exp( -(t-\mu)^2/t_{std}^2)\]

The user specifies a time interval around the stimuls onset via the parameters t_pre and t_post. Over this time interval a series of gaussian basis functions is distributed:

  • between the gaussian centers there is time gap of t_delta

  • the width of the each gaussian is specified by t_std

  • the first gaussian is centered at trial onset - t_pre.

  • the model function extends strictly from -t_pre to t_post with a hard cutoff.

The number of gaussians is derived automatically from these constraints.

Parameters:
  • t_pre (Quantity, [time]) – time before trial onset

  • t_post (Quantity, [time]) – time after trial onset

  • t_delta (Quantity, [time]) – the temporal spacing between consecutive gaussians

  • t_std (Quantity, [time]) – time width of the gaussians

class cedalion.models.glm.basis_functions.Gamma(
tau: cdt.QTime | dict[str, cdt.QTime],
sigma: cdt.QTime | dict[str, cdt.QTime],
T: cdt.QTime | dict[str, cdt.QTime],
)[source]

Bases: TemporalBasisFunction

Modified gamma function, optionally convolved with a square-wave.

The basis function has the form:

\[f(t) \sim \frac{t-\tau}{\sigma} \exp \left(-\left(\frac{t - \tau}{\sigma}\right)^2\right)\]
Parameters:
  • tau – Specifies a delay of the response with respect ot stimulus onset time.

  • sigma – Specifies the width of the hemodynamic reponse.

  • T – If > 0, the response is additionally convoluted by a square wave of this width.

class cedalion.models.glm.basis_functions.GammaDeriv(
tau: cdt.QTime | dict[str, cdt.QTime],
sigma: cdt.QTime | dict[str, cdt.QTime],
T: cdt.QTime | dict[str, cdt.QTime],
)[source]

Bases: TemporalBasisFunction

Modified gamma func. and its derivative, optionally convolved with a square-wave.

Parameters:
  • tau – onset time

  • sigma – width of the HRF

  • T – convolution width

class cedalion.models.glm.basis_functions.AFNIGamma(
p: float | dict[str, float],
q: cdt.QTime | dict[str, cdt.QTime],
T: cdt.QTime | dict[str, cdt.QTime],
)[source]

Bases: TemporalBasisFunction

AFNI gamma basis function, optionally convolved with a square-wave.

Parameters:
  • p – shape parameter

  • q – scale parameter

  • T – convolution width

class cedalion.models.glm.basis_functions.DiracDelta[source]

Bases: TemporalBasisFunction

Convoluted with the stim duration this basis function yields a square wave.