BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



class PseudoVoigtModel( NonLinearModel )Source

Approximation of VoigtModel as the sum of a GaussModel and a LorentzModel

     F(x:p) = p3 * L(x:p) + ( 1 - p3 ) * G(x:p)

where L() and G() are the LorentzModel and the GaussModel, resp. and p3 is the fractional contribution of them. 0 < p3 < 1.

The models takes 4 parameters: amplitude, center frequency, half-width and the balance between the models

These are initialised to [1, 0, 1, 0.5]. Parameter 2 (width) is always kept positive ( >=0 ).

Examples

voigt = PseudoVoigtModel( )
voigt.setParameters( [5, 4, 1, 0.7] )
print( voigt( numpy.arange(  41 , dtype=float ) / 5 ) )      # from [0,8]

Attributes

  • gauss : GaussModel
         to construct the gauss parts
  • lorentz : LorentzModel
         to construct the lorentz parts

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

PseudoVoigtModel( copy=None, **kwargs )

PseudoVoigt model.
Number of parameters is 4.

Parameters

  • copy : PseudoVoigtModel
         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( )

Copy method.

baseResult( xdata, params )
Returns the result of the model function.

Note

  1. The "balance" parameter (item 3) should be kept between [0..1]
  2. The "width" parameter (item 2) the width in the parameter array ( items 2 & 3 ) are kept strictly positive. I.e. they are changed when upon xdata 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 )
Returns the partials at the xdata value.

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 )
Return the derivative df/dx at each xdata (=x).

Parameters

  • xdata : array_like
         values at which to calculate the derivative
  • params : array_like
         values for the parameters.

baseName( )
Returns a string representation of the model.

baseParameterUnit( k )
Return the name of a parameter.

Parameters

  • k : int
         parameter number.
Methods inherited from NonLinearModel
Methods inherited from Model
Methods inherited from FixedModel
Methods inherited from BaseModel