BayesicFitting

Model Fitting and Evidence Calculation

View project on GitHub



class EclipsingStarModel( NonLinearModel )[source]

Model for the light curve of an eclipsing double star, as a function of time, t.

par symbol name description limits comment
p0 e eccentricity of the elliptic orbit 0<e<1 0 is circular
p1 P period of the velocity variation P>0
p2 T phase phase until t = 0 0<T<2π
p3 i inclination of orbit (close to 90) 0<i<π
p4 ω longitude from north to periastron 0<ω<2π
p5 r1 radius1 radius of star 1 0<r1<1
p6 r2 radius2 radius of star 2 0<r2<1
p7 f1 lumen1 luminosity of star 1
p8 f2 lumen2 luminosity of star 2
p9 fs spot spot illumination fs >= 0 0 is no spot
p10 m1 mass1 relative mass of star 1 0 < m1 < 1 m2 = 1 - m1

The amplitude (semimajor axis) is set to 1.0. Both stellar radii are given as a fraction of the amplitude. The mass of star 2 is ( 1 - m1 ). The mass ratio is used in calculating the tidal distortion.

When the sum of the radii, p5 + p6, is larger than the periastron distance, 1 - p0, the stars clash.

When the model is constructed as circular, the parameter p0 becomes 0 by definition and p4 looses its meaning. They are removed from the model.

This class uses StellarOrbitModel to find the true orbit

The parameters are initialized at
     [0.0, 1.0, 0.0, pi/2, 0.0, 0.1, 0.1, 1.0, 1.0, 0.0, 0.5]. It is a non-linear model.

For the mathematics of this model and further explanation see ../EclipsingStars.md

(Partial) derivatives were obtained with the help of
https://www.derivative-calculator.net Muchas Gracias

Attributes

  • storbit : StellarOrbitModel
         to calculate the true stellar orbit
  • circular : bool
         whether the orbit is circular (eccentricity == phase == longitude == 0)
  • spot : bool
         apply spot illumination and tidal distortion
  • tides : bool
         apply tidal distortion
  • occultation : bool
         True: eclipses stricty enforced
  • fixpar : lambda function
         to provide parameters for StellarOrbitModel

Examples

esm = EclipsingStarModel( spot=True, tides=True )
print( esm.npars )
10

EclipsingStarModel( circular=False, spot=False, tides=False, occultation=True, copy=None, **kwargs ) [source]

Radial velocity model.

Number of parameters depends on the settings of ( False or True ) of
  circular spot tides ( 9 or 6 ) + ( 0 or 1 ) + ( 0 or 1 )

Parameters

  • circular : bool
         stellar orbit is circular: eccentricity = 0 ==> lonod = 0
  • spot : bool or number
         apply spot illumination; more pronounced when spot > 1
  • tides : bool
         apply tidal distortion
  • occultation : bool (True)
         eclipses are stricty enforced
  • copy : EclipsingStarModel
         model to copy

copy( ) [source]
Copy method.

distanceConstraint( logL, problem, allpars, lowLhood ) [source]
Constrain the sizes of the stars for use in NestedSampling to avoid collapse. and the inclination to ensure eclipses

Parameters

  • logL : float
         log Likelihood obtained with allpars
  • problem : Problem
         to solve
  • allpars : array
         all parameters involved in the problem
  • lowLhood : float
         present value of the likelihood constraint

logCombiPrior( allpars ) [source]
Get extra prior for this combination of parameters.

Parameters

  • allpars : array
         all parameters involved in the problem

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

Parameters

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

lightCurve( xy, z, params, debug=0 ) [source]
Return the visible area of two eclipsing stars, multiplied by their luminocities.

Parameters

  • xy : array
         distance between the stars in the sky plane
  • z : array
         distance of star 2 to the sky plane
  • params : array
         of the model
  • debug : int
         debug partial derivativesin stages

visibleFraction( xy, z, r1, r2 ) [source]
Calculate the fraction of visibility for both stars.

If z is positive, star 2 is in front of star 1
If z is negative, star 2 is behind star 1

Parameters

  • xy : array
         distance between overlapping circles
  • z : array
         distance of star 2 to the sky plane
  • r1 : float or array
         radius of star 1
  • r2 : float or array
         radius of star 2

VFderivative( xy, z, r1, r2 ) [source]
Calculate the derivatives for the visible fraction to xy and z

Parameters

  • xy : array
         distance between overlapping circles
  • z : array
         distance of star 2 to the sky plane
  • r1 : float or array
         radius of star 1
  • r2 : float or array
         radius of star 2

Returns
( dV1dx, dV2dx, dV1dz, dV2dz )
     derivatives of the visibility to xy and z

VFpartial( xy, z, r1, r2 ) [source]
Calculate the partial derivatives for the visible fraction to r1 and r2.

Parameters

  • xy : array
         distance between overlapping circles
  • z : array
         distance of star 2 to the sky plane
  • r1 : float or array
         radius of star 1
  • r2 : float or array
         radius of star 2

Returns
( dV1dr1, dV2dr1, dV1dr2, dV2dr2 )
     partials of the visibility to r1 and r2

overlap( xy, r1, r2 ) [source]
Calculate the overlap area between two partially overlapping circles

https://scipython.com/books/book2/chapter-8-scipy/problems/overlapping-circles/

Parameters

  • xy : array
         distance between overlapping circles
  • r1 : float or array
         radius of circle 1
  • r2 : float or array
         radius of circle 2

spotIllumination( xy, z, params ) [source]
Illumination of the stars on each other. Depending on distance between stars and aspect angle

The algoritm is taken from DOI: 10.5817/OEJV2025-0258

Parameters

  • xy : array
         distance between the stars in the sky plane
  • z : array
         distance of star 2 to the sky plane
  • params : array
         parameters of the model

tidalDistortion( xy, z, params ) [source]
Calculate the tidal distortion of the stars in a binary system as elongated, prolate spheroids (cigars).

See equation. (1.468) from https://farside.ph.utexas.edu/teaching/355/Surveyhtml/node69.html
  (for as long as it lasts)

Parameters

  • xy : array
         distance between the stars in the sky plane
  • z : array
         distance of star 2 to the sky plane
  • params : array
         parameters of the model

Returns
( a1, b1, a2, b2 )
     apparent stretch and squeeze of both stars

basePartial( xdata, params, parlist=None ) [source]
Returns the partials at the input value.

Parameters

  • xdata : array
         values at which to calculate the result
  • params : array
         values for the parameters.
  • parlist : array
         list of indices active parameters (or None for all)

baseDerivative( xdata, params ) [source]
Returns the derivative of f to t (dfdt) at the input values.

Parameters

  • xdata : array
         times at which to calculate the result
  • params : array
         values for the parameters.

OVpartial( xy, r1, r2 ) [source]
calculate the partials of overlap to r1 and r2.

Parameters

  • xy : array
         projected distance between stars
  • r1 : array
         radius of star 1
  • r2 : array
         radius of star 2

SIpartial( xy, z, params, surface=(1,1) ) [source]
Returns partials of the SpotIllumination. Specificly of the modified f1 and f2 to params[-5:] (radius1, radius2, lumen1, lumen2, spot)

If no spot illumination is requested, the dF*dfs are returned as zero.

Parameters

  • xy : array
         distance between the stars in the sky plane
  • z : array
         distance of star 2 to the sky plane
  • params : array
         values for the parameters.
  • surface : tuple of arrays
         normalized surface areas of the stars

Returns
( dF1dr1, dF1dr2, dF1df1, dF1df2, dF1dfs,
   dF2dr1, dF2dr2, dF2df1, dF2df2, dF2dfs )

LCpartial( xy, z, params ) [source]
Return partial derivatives of LightCurve to each of the parameters

Parameters

  • xy : array
         distance between the stars in the sky plane
  • z : array
         distance of star 2 to the sky plane
  • params : array
         parameters of the model

TDpartial( xy, z, params, TDresult=None ) [source]
Calculate partials of the tidal distortion to the distortion parameter

Parameters

  • xy : array
         distance between the stars in the sky plane
  • z : array
         distance of star 2 to the sky plane
  • params : array
         parameters of the model
  • TDresult : None or tuple
         result of a call to tidalDistortion

Returns

  • ( da1dm, db1dm, da2dm, db2dm, da1dr, db1dr, da2dr, db2dr ) : 8 arrays
         Partials of the normalized projected axes to the parameters

OVderivative( xy, r1, r2 ) [source]
calculate the derivative of overlap to xy

Parameters

  • xy : array
         projected distance between stars
  • r1 : array
         radius of star 1
  • r2 : array
         radius of star 2

LCderivative( xy, z, params ) [source]
Return derivative of LightCurve to xy and z, as

Parameters

  • xy : array
         distance between the stars in the sky plane
  • z : array
         distance of star 2 to the sky plane
  • params : array
         parameters of the model

SIderivative( xy, z, params, surface=(1,1) ) [source]
Returns derivatives of the SpotIllimunation. Specificly of the modified f1 and f2 to xy and z

Parameters

  • xy : float
         distance between the stars in the sky plane
  • z : float
         distance of star 2 to the sky plane
  • params : array_like
         values for the parameters.
  • surface : tuple of 2 array
         normalized surface areas of the stars

Returns
( dF1dx, dF2dx, dF1dz, dF2dz )

TDderivative( xy, z, params, TDresult=None ) [source]
Calculate the derivative of the tidal distortion to xy and z

Parameters

  • xy : array
         distance between the stars in the sky plane
  • z : array
         distance of star 2 to the sky plane
  • params : array
         parameters of the model
  • TDresult : tuple
         result of call tp tidalDostortion

Returns
( da1dx, db1dx, da2dx, db2dx, da1dz, db1dz, da2dz, db2dz )
     derivatives of apparent major and minor axes to xy and z

baseName( ) [source]
Returns a string representation of the model.

reportParameters( param, stdevs=None, toMags=False ) [source]
Print parameters and stdevs (if present)

Parameters

  • param : array
         to be converted and printed
  • stdevs : array
         to be converted and printed
  • toMags : bool or float (False)
         true convert luminosities to magnitudes
         float true and use number as scaling factor
Methods inherited from NonLinearModel
Methods inherited from Model
Methods inherited from FixedModel
Methods inherited from BaseModel