class Kernel2dModel( NonLinearModel ) | Source |
---|
Two dimensional Kernel Model.
The Kernel2dModel is defined as
f( x:p ) = p0 * K( r )
where K( r ) is a selectable kernel function and r is the distance to the center.
r = sqrt( u2 + v2 ).
There are 3 options for u and v
- CIRCULAR has 4 parameters
Circular shape with only one width.
u = ( x - p1 ) / p3
v = ( x - p2 ) / p3 - ELLIPTIC has 5 parameters
Elliptic shape aligned along the axes; 2 widths.
u = ( x - p1 ) / p3
v = ( x - p2 ) / p4 - ROTATED has 6 parameters
Rotated elliptical shape with 2 width and a rotational angle.
u = ( ( x - p1 )*cos( p5 ) - ( y - p2 )*sin( p5) ) / p3
v = ( ( x - p1 )*sin( p5 ) + ( y - p2 )*cos( p5) ) / p4
The "center" parameters ( 1&2 ) and the "angle" parameter ( 5 ) are initilized as 0. The rotational angle is measured counterclockwise from the x-axis. The "width" parameters ( 3&4 ) are initialized as 1.0, except for the ROTATED case; then they need to be different ( 2.0 and 0.5 resp. ). Otherwise the model parameter "angle" is degenerate. The "amplitude" parameter is set to 1.0.
Several kernel functions, K( x ) are defined in the directory fit/kernels.
Beware: These models are unaware of anything outside their range.
Author: Do Kester
Example
model = Kernel2dModel( ) # default: circular Gauss
model.setKernelShape( Lorentz(), 'Elliptic' ) # elliptic Lorentz model.
model = Kernel2dModel( shape=3 ) # rotated Gauss
- Category : mathematics/Fitting
Kernel2dModel( kernel=Gauss(), shape=1, copy=None, **kwargs ) |
---|
Kernel Model.
Default model: Gauss with Circular shape.
Parameters
- kernel : Kernel
the kernel to be used - shape : 1 | 2 | 3 | 'circular' | 'elliptic' | 'rotated'
int : resp.: circular elliptic, rotated
str : case insensitive; only the first letter matters.
shape defaults to 'circular' when misunderstood - copy : Kernel2dModel
to be copied - fixed : None or dictionary of {int:float|Model}
int index of parameter to fix permanently.
float|Model values for the fixed parameters.
Attribute fixed can only be set in the constructor.
See: FixedModel
copy( ) |
---|
parseShape( shape ) |
---|
setKernelShape( kernel, shape ) |
---|
baseName( ) |
---|
Returns a string representation of the model.
baseResult( xdata, params ) |
---|
Parameters
- xdata : array_like
value at which to calculate the result - params : array_like
values for the parameters
baseDerivative( xdata, params ) |
---|
Parameters
- xdata : array_like
value at which to calculate the result - params : array_like
values for the parameters
basePartial( xdata, params, parlist=None ) |
---|
Parameters
- xdata : array_like
value at which to calculate the partials - params : array_like
parameters to the model (ignored in LinearModels) - parlist : array_like
list of indices of active parameters
baseParameterUnit( k ) |
---|
- k : int
the kth parameter.
isBound( ) |
---|
Methods inherited from NonLinearModel |
---|
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 )
- 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( )
- 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 |
---|