| class SplinesDynamicModel( Modifiable,Dynamic,BasicSplinesModel ) | [source] |
|---|
BasicSplinesModel that is modifiable (knot locations) and dynamic (in number of knots)
Examples
# make dynamic splinesmodel, initially with 4 equidistant knots from 0 to 10
knots = numpy.linspace( 0, 10, 4, dtype=float )
csm = SplinesDynamicModel( knots=knots, modifiable=False )
print csm.getNumberOfParameters( )
6
# or similarly, also modifiable
csm = SplinesDynamicModel( nrknots=4, min=0, max=10 )
print csm.getNumberOfParameters( )
6
# or periodic and not dynamic
x = numpy.arange( npt, dtype=float )
knots = numpy.linspace( 0, 10, 4, dtype=float )
csm = SplinesDynamicModel( knots=knots, border=1, dynamic=False )
print csm.getNumberOfParameters( )
5
Attributes
- minKnots : int
minimum number of knots - maxKnots : int or None
maximum number of knots - minDistance : float
minimum distance between knots - border : int (0)
0,1,2 as in BasicSplinesModel
3 periodic (as 1) with flexible period - flexPeriod : bool
flexible period when the model is periodic
Attributes from Modifiable
modifiable
Attributes from Dynamic
dynamic, ncomp, deltaNpar, minComp, maxComp, growPrior
Attributes from BasicSplinesModel
border, period
Attributes from SplinesModel
knots, order
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
Limitations
Dont construct the knots so closely spaced, that there are no datapoints in between.
| SplinesDynamicModel( modifiable=True, dynamic=True, growPrior=None, minKnots=2, maxKnots=None, minDistance=0.01, border=0, copy=None, **kwargs ) | [source] |
|---|
Splines on a given set of knots and a given order.
The number of parameters is ( length( knots ) + order - 1 )
Parameters
- modifiable : bool (True)
if True allow changement of the knot locations - dynamic : bool (True)
if True allow growth and shrinkage of number of knots - minKnots : int (2)
minimum number of knots - maxKnots : None or int
maximum number of Knots - minDistance : float ( 0.01 * mean knot separation )
minimum distance between knots, provided as fraction of average knot distance. - border : int (0)
0,1,2 as in BasicSplinesModel
3 periodic (as 1) with flexible period - growPrior : None or Prior
governing the birth and death.
ExponentialPrior (scale=2) if maxDegree is None else UniformPrior - copy : PolynomialDynamicModel
model to copy
Parameters for SplinesModel
knots, order, nrknots, min, max, xrange
Raises
ValueError if not minKnots <= nrknots <= maxKnots
| copy( modifiable=None, dynamic=None ) | [source] |
|---|
Parameters
- modifiable : bool
is a modifiable model - dynamic : bool
is a dynamic model
| baseName( ) | [source] |
|---|
Returns a string representation of the model.
| changeNComp( dn ) | [source] |
|---|
| grow( offset=0, rng=None, force=False, **kwargs ) | [source] |
|---|
Parameters
- offset : int
index where the params of the Dynamic model start - rng : random number generator (obligatory)
to generate a new parameter. - force : bool
dont check maxKnots (only for varyAlt())
Return
- bool : succes
| shrink( offset=0, rng=None, **kwargs ) | [source] |
|---|
Parameters
- offset : int
index where the params of the Dynamic model start - rng : random number generator
to generate a new parameter (obligatory)
Return
- bool : succes
| vary( rng=None, location=None ) | [source] |
|---|
Parameters
- rng : RNG
random number generator - location : int
index of the item to be modified; otherwise random - kwargs : keyword arguments
for specific implementations
| varyAlt( offset=0, rng=None, **kwargs ) | [source] |
|---|
Parameters
- offset : int
index where the params of the Modifiable model start - rng : RNG
random number generator - kwargs : keyword arguments
for specific implementations
| Methods inherited from Modifiable, |
|---|
| Methods inherited from Dynamic, |
|---|
- isDynamic( )
- setGrowPrior( growPrior=None, min=1, max=None, name="Comp" )
- setDynamicAttribute( name, value )
- alterParameterNames( dnp )
- alterParameterSize( dnp, offset, location=None, value=0 )
- alterParameters( param, location, dnp, offset, value=None )
- alterFitindex( findex, location, dnp, offset )
- shuffle( param, offset, np, rng )
| Methods inherited from BasicSplinesModel |
|---|
- makeBaseBasis( )
- makeDist( knotix )
- makePeriodicBasis( )
- normalizeBasis( basis )
- findParameters( knotix, dist, kpar=0 )
- baseResult( xdata, params )
- basePartial( xdata, params, parlist=None )
- makeKnotIndices( xdata )
- basicBlob( xdata, basis, x2k, poly )
- baseDerivative( xdata, params )
- baseParameterUnit( k )
| Methods inherited from SplinesModel |
|---|
| Methods inherited from LinearModel |
|---|
| 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 )
- 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 |
|---|