class VoigtModel( NonLinearModel ) | Source |
---|
Voigt's Gauss Lorentz convoluted model for line profiles.
The Voigt function is a convolution of a Gauss and a Lorentz function. Physicaly it is the result of thermal and pressure broadening of a spectral line.
The models takes 4 parameters: amplitude, center frequency, half-width of the Gaussian, and half-width of the Lorentzian. These are initialised to [1, 0, 1, 1]. Parameters 2 & 3 ( widths ) is always kept positive ( >=0 ).
The implementation uses the Faddeeva function from scipy.special.wofz.
Examples
voigt = VoigtModel( )
voigt.setParameters( [5, 4, 1, 2] )
print( voigt( numpy.arange( 41 , dtype=float ) / 5 ) ) # from [0,8]
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
VoigtModel( copy=None, **kwargs ) |
---|
Voigt model.
Number of parameters is 4.
Parameters
- copy : VoigtModel
to be copied
copy( ) |
---|
baseResult( xdata, params ) |
---|
Note: both width in the parameter array ( items 2 & 3 ) are kept strictly positive. I.e. they are changed when upon input they are negative.
Parameters
- xdata : array_like
values at which to calculate the result - params : array_like
values for the parameters.
basePartial( xdata, params, parlist=None ) |
---|
z = ( x - p1 + 1j * p3 ) / ( p2 * sqrt2 )
z0 = 1j * p3 / ( p2 * sqrt2 )
vgt = p0 * R( wofzz ) / R( wofz0 )
dvdp = dvdz * dzdp
dvdz = p0 * ( R(dwdz) * R(wofz0) - R(dwd0) * R(wofzz) ) / R(wofz0)2
dvdp = p0 * ( R(dwdz * dzdp) * R(wofz0) - R(dwd0 * d0dp) * R(wofzz) ) / R(wofz0)2
dwdz = 2j / sqrt(pi) - 2 * z * wofzz
dwd0 = 2j / sqrt(pi) - 2 * z0 * wofz0
## p0 and p1 have no influence in wofz0
dzdp0 = 0
dzdp1 = -1 / ( p2 * sqrt2 )
d0dp2 = - ( 1j * p3 / ( p22 * sqrt2 ) = -z0 / p2
dzdp2 = - ( ( x - p1 + 1j * p3 ) / ( p22 * sqrt2 ) = -z / p2
dzdp3 = d0dp3 = 1j / ( p2 * sqrt2 )
dvdp0 = R(wofzz) / R(wofz0)
## The other partial follow from calculating dvdp for the parameters 1..3
Parameters
- xdata : array_like
values at which to calculate the partials - params : array_like
values for the parameters. - parlist : array_like
list of indices active parameters (or None for all)
baseDerivative( xdata, params ) |
---|
z = ( x - p1 + 1j * p3 ) / ( p2 * sqrt2 )
z0 = 1j * p3 / ( p2 * sqrt2 )
vgt = p0 / wofz0 * re( wofzz )
dvdx = dvdz * dzdx
dvdz = p0 / wofz0 * dwdz
dwdz = 2j / sqrt(pi) - 2 * z * wofzz
dzdx = 1 / ( p2 * sqrt2 )
Parameters
- xdata : array_like
values at which to calculate the result - params : array_like
values for the parameters.
baseName( ) |
---|
baseParameterUnit( k ) |
---|
Parameters
- k : int
parameter number.
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 |
---|