BaseModel

 
BaseModel = class BaseModel(builtins.object)
    BaseModel(nparams=0, ndim=1, copy=None, posIndex=[], nonZero=[], **kwargs)
 
BaseModel implements the common parts of simple Models.
 
A simple model is a function in x with parameters p : f(x:p).
The variable x is an array of points in a space of one or more
dimensions; p can have any length, including 0 i.e. the model
has no parameters.
 
The result of the function for certain x and p is given by
model.result( x, p )
 
The partial derivatives of f to p (df/dp) is given by
model.partial( x, p )
Some fitters make use of the partials
 
The derivative of f to x (df/dx) is given by
model.derivative( x, p )
 
BaseModel checks parameters for positivity and nonzero-ness, if such
is indicated in the model itself.
 
BaseModel also implements the numerical calculation of the (partial)
derivatives to be used when they are not given in the model definition
itself.
 
Attributes
----------
npbase : int
    number of params in the base model
ndim : int
    number of dimensions (parallel streams) of input. (default : 1)
priors : list of Prior
    pertaining to each of the parameters of the model.
    If the list is shorter than the number of parameters, the last one is repeated.
posIndex : list of int
    list of indices indication positive-definite parameters.
nonZero : list of int
    list of parameters that need a warning when they are equal to zero.
    Warnings will only be issued once. Values are replaced by self.tiny
tiny : float
    very small value, replacing zero valued when found on NonZero.
    (default : 1e-20)
deltaP : array_like
    (list of) width(s) for numerical partial calculation. (default : 0.00001)
parNames : list of str
    list of parameter names. (default : "parameter_k")
 
Author :         Do Kester
 
  Constructor:
BaseModel( nparams=0, ndim=1, copy=None, posIndex=[], nonZero=[], **kwargs )
BaseModel Constructor.
<br>
Parameters
----------
nparams : int
    Number of parameters in the model (default: 0)
ndim : int
    Number of dimensions of the input (default: 1)
copy : BaseModel
    to be copied
posIndex : list of int
    indices of parameters that need to be > 0
nonZero : list of int
    indices of parameters that cannot be zero.
    they are replaced by self.tiny
kwargs
    for internal use.
Methods defined here:
baseParameterName( k )
Return the name of the indicated parameter.
 
Parameters
---------
k : int
    parameter number.
baseParameterUnit( k )
Return the name of the indicated parameter.
 
Parameters
---------
k : int
    parameter number.
basePrior( k )
Return the prior of the indicated parameter.
 
Parameters
----------
k : int
    parameter number.
checkParameter( param )
Return parameters corrected for positivity and Non-zero.
 
Parameters
----------
param : array_like
    values for the parameters.
checkPositive( param )
Check parameters for positivity. Silently correct.
 
Parameters
----------
params : array_like
    values for the parameters
checkZeroParameter( param )
Check parameters for Non-zero. Correct after one warning.
 
Parameters
----------
params : array_like
    values for the parameters
derivative( xdata, param )
Returns the derivative of the model to xdata.
 
It is a numeric derivative as the analytic derivative is not present
in the model.
 
Parameters
----------
xdata : array_like
    values at which to calculate the derivative
param : array_like
    values for the parameters. (default: model.parameters)
getParameterName( k )
Return the name of the indicated parameter.
 
Parameters
---------
k : int
    parameter number.
getParameterUnit( k )
Return the unit of the indicated parameter.
 
Parameters
---------
k : int
    parameter number.
getPrior( k )
Return the prior of the indicated parameter.
 
Parameters
---------
k : int
    parameter number.
hasLimits( fitindex=None )
Return True if the model has limits set.
hasPriors( isBound=True )
Return True when the model has priors for all its parameters.
 
Parameters
----------
isBound : bool
    Also check if the prior is bound.
isDynamic()
Whether the model implements Dynamic
isModifiable()
Whether the model implements Modifiable
partial( xdata, param, parlist=None )
Returns the partial derivatives calculated at the inputs.
 
Parameters
----------
xdata : array_like
    values at which to calculate the result
param : array_like
    values for the parameters.
parlist : None or array_like
    indices of active parameters
result( xdata, param )
Returns the result calculated at the xdatas.
 
Parameters
----------
xdata : array_like
    values at which to calculate the result
param : array_like
    values for the parameters.
setPrior( k, prior=None, **kwargs )
set the prior and/or limits for the indicated parameter.
 
The prior (by default UniformPrior) is appended when k is equal to np, the
length of the existing list of priors. It replaces the prior when k < np
and it generates an error when k > np
 
Parameters
---------
k : int
    parameter number.
prior : Prior
    prior for the parameter
kwargs : dict
    attributes to be passed to the prior
shortName()
Return a short version the string representation: upto first non-letter.