class ConstantModel( Model ) | Source |
---|
ConstantModel is a Model which does not have any parameters.
f( x:p ) = f( x )
As such it is irrelevant whether it is linear or not. It has 0 params and returns a 0 for its partials.
ConstantModel, by default, returns a constant ( = 0 ) for its result. It can however return any fixed form that a Model can provide.
This might all seem quite irrelevant for fitting. And indeed no parameters can be fitted to these models, no standard deviations can be calculated, but it is possible to calculate the evidence for these models and compare them with more complicated models to decide whether there is any evidence for some structure at all.
It can also be used when some constant is needed in a compound model, or a family of similar shapes.
Attributes
- fixedModel : Model
a model which is calculated. (default: 0, everywhere) - table : array_like
array of tabulated results
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
Examples
To make a model that decays to 1.0
model = ConstantModel( values=1.0 )
model.addModel( ExpModel( ) )
## To make a model that returns a fixed cosine of frequency 5
model = ConstantModel( fixedModel=SineModel(), values=[1.0,0.0,5.0] )
ConstantModel( ndim=1, copy=None, fixedModel=None, values=None, table=None ) |
---|
The ConstantModel implementation.
Number of parameters = 0.
Parameters
- ndim : int
number of dimensions for the model. (default: 1) - copy : ConstantModel
model to be copied. (default: None) - fixedModel : Model
a fixed model to be returned. (default: 0 everywhere) - values : array_like
parameters to be used in the fixedModel. (default: None) - table : array_like
array of tabulated results
Notes
A table provided to the constructor has only values at the xdata. At other vales than xdata, the model does not work.
copy( ) |
---|
baseResult( xdata, params ) |
---|
Parameters
- xdata : array_like
values at which to calculate the result - params : array_like
values for the parameters. (irrelevant)
basePartial( xdata, params, parlist=None ) |
---|
Parameters
- xdata : array_like
values at which to calculate the result - params : array_like
values for the parameters. (irrelevant) - parlist : None
only to complete the necessary argument list
baseDerivative( xdata, params ) |
---|
Parameters
- xdata : array_like
values at which to calculate the result - params : array_like
values for the parameters. (irrelevant)
baseName( ) |
---|
Methods inherited from Model |
---|
- chainLength( )
- isNullModel( )
- isolateModel( k )
- addModel( model )
- subtractModel( model )
- multiplyModel( model )
- divideModel( model )
- pipeModel( model )
- appendModel( model, operation )
- correctParameters( params )
- result( xdata, param=None )
- operate( res, pars, next )
- derivative( xdata, param, useNum=False )
- partial( xdata, param, useNum=False )
- selectPipe( ndim, ninter, ndout )
- pipe_0( dGd, dHdG )
- pipe_1( dGd, dHdG )
- pipe_2( dGd, dHdG )
- pipe_3( dGd, dHdG )
- pipe_4( dGdx, dHdG )
- pipe_5( dGdx, dHdG )
- pipe_6( dGdx, dHdG )
- pipe_7( dGdx, dHdG )
- pipe_8( dGdx, dHdG )
- pipe_9( dGdx, dHdG )
- shortName( )
- getNumberOfParameters( )
- numDerivative( xdata, param )
- numPartial( xdata, param )
- isDynamic( )
- hasPriors( isBound=True )
- getPrior( kpar )
- setPrior( kpar, prior=None, **kwargs )
- getParameterName( kpar )
- getParameterUnit( kpar )
- getIntegralUnit( )
- setLimits( lowLimits=None, highLimits=None )
- getLimits( )
- hasLimits( fitindex=None )
- unit2Domain( uvalue, kpar=None )
- domain2Unit( dvalue, kpar=None )
- partialDomain2Unit( dvalue )
- nextPrior( )
- isMixed( )
- getLinearIndex( )
- testPartial( xdata, params, silent=True )
- strictNumericPartial( xdata, params, parlist=None )
- assignDF1( partial, i, dpi )
- assignDF2( partial, i, dpi )
- strictNumericDerivative( xdata, param )
Methods inherited from FixedModel |
---|
Methods inherited from BaseModel |
---|