class BracketModel( Brackets ) | Source |
---|
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
- You have to complete the BracketModel, including parameter reduction,
BEFORE you put it into a model chain. - If you change a BracketModel which is part of a model chain, unexpected result
might happen.
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
copy( ) |
---|
Methods inherited from Brackets |
---|
- baseResult( xdata, param )
- basePartial( xdata, param, parlist=None )
- baseDerivative( xdata, param )
- setPrior( kpar, prior=None, **kwargs )
- getPrior( kpar )
- nextPrior( )
- basePrior( k )
- hasPriors( isBound=True )
- baseParameterName( k )
- baseParameterUnit( k )
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( )
- getParameterName( kpar )
- getParameterUnit( kpar )
- getIntegralUnit( )
- setLimits( lowLimits=None, highLimits=None )
- getLimits( )
- hasLimits( fitindex=None )
- unit2Domain( uvalue, kpar=None )
- domain2Unit( dvalue, kpar=None )
- partialDomain2Unit( dvalue )
- 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 |
---|