BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



class CauchyPrior( Prior )Source

Cauchy prior distribution.

Pr( x ) = s / ( π * ( s2 + ( x - c )2 )

By default: c = center = 0 and s = scale = 1.

It can also have a limited domain. By default the domain is [-Inf,+Inf]. In computational practice it is limited to [-1e16, 1e16]

  domain2unit:
     u = arctan( ( d - c ) / s ) / π + 0.5
  unit2domain:
     d = tan( ( u - 0.5 ) * π ) * s + c

Examples

pr = CauchyPrior()                         # center=0, scale=1
pr = CauchyPrior( center=1.0, scale=0.5 )
pr = CauchyPrior( limits=[0,None] )        # lowlimit=0, highlimit=inf
pr = CauchyPrior( center=1, circular=3 )   # circular between 0.5 and 2.5

Attributes

  • center : float
         center of the Cauchy prior
  • scale : float
         scale of the Cauchy prior

Attributes from Prior

lowLimit, highLimit, deltaP, _lowDomain, _highDomain

CauchyPrior( center=0.0, scale=1, limits=None, circular=False, prior=None )

Constructor.

Parameters

  • center : float
         of the prior
  • scale : float
         of the prior
  • limits : None or [float,float]
         None no limits are set
         2 floats lowlimit and highlimit
  • circular : bool or float
         bool : y|n circular with period from limits[0] to limits[1]
         float : period of circularity
  • prior : CauchyPrior
         prior to copy (with new scale if applicable)

copy( )

domain2Unit( dval )
Return a value in [0,1] given a value within the valid domain of a parameter for a Cauchy distribution.

u = arctan( ( d - c ) / s ) / π + 0.5

Parameters

  • dval : float
         value within the domain of a parameter

unit2Domain( uval )
Return a value within the valid domain of the parameter given a value between [0,1] for a Cauchy distribution.

d = tan( ( u - 0.5 ) * π ) * s + c

Parameters

  • uval : float
         value within [0,1]

result( x )
Return a the result of the distribution function at x.

Parameters

  • x : float
         value within the domain of a parameter

partialLog( x )
Return partial derivative of log( Prior ) wrt parameter.

Parameters

  • x : float
         the value

isBound( )

Return true if the integral over the prior is bound.

shortName( )

Return a string representation of the prior.

Methods inherited from Prior