BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



class PadeModel( NonLinearModel )Source

General Pade model of arbitrary degrees in numerator and denominator.

  f( x:p ) = ∑ pn * xn / ( ∑ pnum+1+k * xk )

where the sum in the numerator is over n running from 0 to num ( inclusive ) and the sum in the denominator is over k running from 0 to den ( inclusive )

At least one parameter needs to be fixed, otherwise the model is degenerate in its parameters. By default the first parameter of the denominator (pnum+1) is fixed to 1.0.

All parameters are initialized at 0. It is a non-linear model.

Beware of the poles where the denominator equals zero.

Author: Do Kester

Examples

pade = PadeModel( 3, 1 )                # 3rd degree polynomial
print pade.getNumberOfParameters( )     # 5
5

Attributes

  • num : int
         order of the polynomial in the numerator
  • den : int
         order of the polynomial in the denominator

Attributes from Model

     npchain, parameters, stdevs, xUnit, yUnit

Attributes from FixedModel

     npmax, fixed, parlist, mlist

Attributes from BaseModel

     npbase, ndim, priors, posIndex, nonZero, tiny, deltaP, parNames

Alternate

PadeModel( 2, 3 ) is equivalent to

  • PolynomialModel( 2 ) / PolynomialModel( 3, fixed={0 : 1.0} )

PadeModel( num, den, copy=None, fixed=None, **kwargs )

Pade of a certain degree in numerator and denominator.

The number of parameters is ( num + den + 1 )

Parameters

  • num : int
         the degree of the polynomial in the numerator.
  • den : int
         the degree of the polynomial in the denominator.
  • copy : PadeModel
         model to be copied
  • fixed : dictionary of {int:float|Model}
         int index of parameter to fix permanently.
         float|Model values for the fixed parameters.
                     Default {num+1 : 1.0}
         Attribute fixed can only be set in the constructor.
         See: FixedModel

copy( )

Copy method.

baseResult( xdata, params )
Returns the result of the model function.

Parameters

  • xdata : array_like
         values at which to calculate the partials
  • params : array_like
         parameters for the model.

basePartial( xdata, params, parlist=None )
Returns the partials at the xdata values.

Parameters

  • xdata : array_like
         values at which to calculate the partials
  • params : array_like
         parameters for the model.
  • parlist : array_like
         list of indices active parameters (or None for all)

baseDerivative( xdata, params )
Returns the partials at the xdata values.

Parameters

  • xdata : array_like
         values at which to calculate the partials
  • params : array_like
         parameters for the model.

baseName( )
Returns a string representation of the model.

baseParameterUnit( k )
Return the unit of the indicated parameter. Parameters
  • k : int
         parameter number.
Methods inherited from NonLinearModel
Methods inherited from Model
Methods inherited from FixedModel
Methods inherited from BaseModel