BracketModel = class BracketModel(Model.Brackets) |
|
BracketModel(model, copy=None, fixed=None, **kwargs)
BracketModel provides brackets to a chain of Models.
Its results are exactly the same as the results of the contained model.
When the contained model is a compound model (a chain of models), the
BracketModel make a single unit out of it. It acts as a pair of brackets
in another chain of models. Since compound models can be joined by operations
other than addition ( there is also subtract, multiply and divide ) brackets
are needed to distinguish m1 * ( m2 + m3 ) from m1 * m2 + m3.
BracketModel is automatically invoked when the Model appended to another model,
is actually a chain of models.
Model.Brackets is an internal class inside Model.
Attributes
----------
model : Model
to be put inside of brackets
deep : int
container depth (only for nice printing).
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
--------
Explicit use of BrackeModel
>>> m1 = GaussModel( )
>>> m1 += PolynomialModel( 0 ) # Gauss on a constant background
>>> m2 = BracketModel( m1 )
>>> m3 = SineModel( )
>>> m3 *= m2 # sine * ( gauss + const )
>>> print( m3 )
Implicit use of BrackeModel, automatically invoked when m2 is a chain
>>> m1 = GaussModel( )
>>> m1 += PolynomialModel( 0 ) # m1 is a chain of models
>>> m3 = SineModel( )
>>> m3 *= m1 # sine * ( gauss + const )
>>> print( m3 ) # exactly the same
Warning
-------
BracketModel is about rather advanced model building.
Notes
-----
1. You have to complete the BracketModel, including parameter reduction,
BEFORE you put it into a model chain.
2. If you change a BracketModel which is part of a model chain, unexpected result
might happen. |
|
- Method resolution order:
- BracketModel
- Model.Brackets
- Model
- FixedModel
- BaseModel
- builtins.object
Constructor:
- BracketModel( model, copy=None, fixed=None, **kwargs )
- BracketModel
When constructing a BracketModel existing attributes are lost, except
parameters that were 'fixed' in the constituent Models. They stay fixed.
Parameters
----------
model : Model
to be put in the container.
copy : BracketModel
model to be copied
fixed : dict
if fixed is not None raise AttributeError
Use fixed on the constituent models.
Raises
------
AttributeErrr : When fixed is not None
Methods defined here:
- copy()
- Copy a Bracket Model.
Methods inherited from Model.Brackets:
Methods inherited from Model:
Overloaded operators and aliases
Other methods
- addModel( model )
- appendModel( model, operation )
- assignDF1( partial, i, dpi )
- assignDF2( partial, i, dpi )
- chainLength()
- correctParameters( params )
- derivative( xdata, param, useNum=False )
- divideModel( model )
- domain2Unit( dvalue, kpar=None )
- getIntegralUnit()
- getLinearIndex()
- getNumberOfParameters()
- getParameterName( k )
- getParameterUnit( k )
- getPrior( k )
- hasLimits( fitindex=None )
- isDynamic()
- isMixed()
- isNullModel()
- isolateModel( k )
- multiplyModel( model )
- numDerivative( xdata, param )
- numPartial( xdata, param )
- operate( res, pars, next )
- partial( xdata, param, useNum=False )
- partialDomain2Unit( dvalue )
- pipeModel( model )
- 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)
- result( xdata, param=None )
- selectPipe( ndim, ninter, ndout )
- setPrior( k, prior=None, **kwargs )
- shortName()
- strictNumericDerivative( xdata, param )
- strictNumericPartial( xdata, params, parlist=None )
- subtractModel( model )
- testPartial( xdata, params, silent=True )
- unit2Domain( uvalue, kpar=None )
Methods inherited from FixedModel:
Methods inherited from BaseModel:
|
|