Table Of Contents

Previous topic

mvpa.misc.fsl.melodic

Next topic

mvpa.misc.io

This Page

Quick search

mvpa.misc.fx

Misc. functions (in the mathematical sense)

The comprehensive API documentation for this module, including all technical details, is available in the Epydoc-generated API reference for mvpa.misc.fx (for developers).

Functions

mvpa.misc.fx.doubleGammaHRF(t, A1=5.4000000000000004, W1=5.2000000000000002, K1=1.0, A2=10.800000000000001, W2=7.3499999999999996, K2=0.34999999999999998)

Hemodynamic response function model.

The version is using two gamma functions (also see singleGammaHRF()).

Parameters:
  • t (float) – Time.
  • A (float) – Time to peak.
  • W (float) – Full-width at half-maximum.
  • K (float) – Scaling factor.

Parameters A, W and K exists individually for each of both gamma functions.

See also

Full API documentation of doubleGammaHRF() in module mvpa.misc.fx.

mvpa.misc.fx.leastSqFit(fx, params, y, x=None, **kwargs)

Simple convenience wrapper around SciPy’s optimize.leastsq.

The advantage of using this wrapper instead of optimize.leastsq directly is, that it automatically constructs an appropriate error function and easily deals with 2d data arrays, i.e. each column with multiple values for the same function argument (x-value).

Parameters:
  • fx (functor) – Function to be fitted to the data. It has to take a vector with function arguments (x-values) as the first argument, followed by an arbitrary number of (to be fitted) parameters.
  • params (sequence) – Sequence of start values for all to be fitted parameters. During fitting all parameters in this sequences are passed to the function in the order in which they appear in this sequence.
  • y (1d or 2d array) – The data the function is fitted to. In the case of a 2d array, each column in the array is considered to be multiple observations or measurements of function values for the same x-value.
  • x (Corresponding function arguments (x-values) for each datapoint, i.e.) – element in y or columns in y’, in the case of `y being a 2d array. If x is not provided it will be generated by N.arange(m), where m is either the length of y or the number of columns in y, if y is a 2d array.
  • **kwargs – All additonal keyword arguments are passed to fx.
Return type:

tuple

Returns:

i.e. 2-tuple with list of final (fitted) parameters of fx and an integer value indicating success or failure of the fitting procedure (see leastsq docs for more information).

See also

Full API documentation of leastSqFit() in module mvpa.misc.fx.

mvpa.misc.fx.singleGammaHRF(t, A=5.4000000000000004, W=5.2000000000000002, K=1.0)

Hemodynamic response function model.

The version consists of a single gamma function (also see doubleGammaHRF()).

Parameters:
  • t (float) – Time.
  • A (float) – Time to peak.
  • W (float) – Full-width at half-maximum.
  • K (float) – Scaling factor.

See also

Full API documentation of singleGammaHRF() in module mvpa.misc.fx.