Home | Trees | Indices | Help |
---|
|
Fit and evaluate binary (Keplerian) orbits.
Be careful with the inclination angle: if you only want an image projected onto the sky, it is not case-sensitive. Only for the radial velocities this becomes important (the primary and secondary can be mixed).
Example usage: compute the absolute orbits of the two components of mu Cassiopeia, and compute the relative orbit of the second component.
See ps file on http://www.chara.gsu.edu/~gudehus/binary.html and Drummond et al., 1995 (the latter's orbital parameters are used).
Neccesary imports:
>>> from ivs.units.constants import *
Orbital elements, Euler angles and masses of the system
>>> P = 21.753*365 # period in days >>> e = 0.561 # ecc >>> omega,Omega,i = 332.7, 47.3, 106.8 # degrees >>> T0 = 1975.738*365 # year in days >>> plx = 133.2 # mas >>> M1,M2 = 0.719,0.168 # Msun >>> times = np.linspace(T0,T0+0.95*P,100)
Derive semi-major axis of absolute orbits (semi-major axis of relative orbit is a+a2)
>>> fA = M2**3/ (M1+M2)**2 * Msol >>> a1 = ((P*24*3600)**2 * GG * fA / (4*np.pi**2))**(1/3.) >>> a1 = a1/au >>> a2 = a1*M1/M2
Convert the angles to radians
>>> omega,Omega,i = omega/180*np.pi,Omega/180*np.pi,i/180*np.pi
Compute the orbits of the primary and secondary in the plane of the sky
>>> x1,y1,z1 = orbit_on_sky(times,(P,e,a1,T0,omega,Omega,i),component='prim',distance=(1000./133.,'pc')) >>> x2,y2,z2 = orbit_on_sky(times,(P,e,a2,T0,omega,Omega,i),component='sec',distance=(1000./133.,'pc'))
Plot it:
>>> import pylab as pl >>> colors = times/365. >>> p = pl.title('mu Cassiopeia') >>> p = pl.scatter(x1,y1,c=colors,edgecolors='none',cmap=pl.cm.spectral,label='_nolegend_') >>> p = pl.scatter(x2,y2,c=colors,edgecolors='none',cmap=pl.cm.spectral,label='_nolegend_') >>> p = pl.scatter(x2-x1,y2-y1,c=colors,edgecolors='none',cmap=pl.cm.spectral,label='_nolegend_') >>> p = pl.plot(x1,y1,'b-',label='Primary') >>> p = pl.plot(x2,y2,'g-',label='Secondary') >>> p = pl.plot(x2-x1,y2-y1,'r-',label='Secondary relative') >>> p = pl.colorbar() >>> p = pl.legend(loc='lower right') >>> p = pl.grid() >>> p = pl.xlabel(r'Angular size (arcsec) --> N') >>> p = pl.ylabel(r'Angular size (arcsec) --> E')
]include figure]]ivs_binary_keplerorbit_muCas.png]
Example usage 2: compute the absolute orbits of the two components of Capella, and compute the relative orbit of the primary component.
See Hummel et al. 1994 (?).
Neccesary imports:
>>> from ivs.units.constants import *
Orbital elements, Euler angles and masses of the system
>>> P = 104.022 # period in days >>> e = 0.000 #ecc >>> i = 137.18 # degree >>> T0 = 2447528.45 # year >>> omega = 0 # degrees >>> Omega = 40.8 # degrees >>> plx = 76.20 # mas >>> M1 = 2.69 #Msun >>> M2 = 2.56 #Msun >>> RV0 = 0. >>> times = np.linspace(T0,T0+0.95*P,100)
Derive semi-major axis of absolute orbits (semi-major axis of relative orbit is a+a2)
>>> fA = M2**3/ (M1+M2)**2 * Msol >>> a1 = ((P*24*3600)**2 * GG * fA / (4*np.pi**2))**(1/3.) >>> a1 = a1/au >>> a2 = a1*M1/M2
Convert the angles to radians
>>> omega,Omega,i = omega/180*np.pi,Omega/180*np.pi,i/180*np.pi
Compute the orbits of the primary and secondary in the plane of the sky
>>> x1,y1,z1 = orbit_on_sky(times,(P,e,a1,T0,omega,Omega,i),component='prim',distance=(1000./plx,'pc')) >>> x2,y2,z2 = orbit_on_sky(times,(P,e,a2,T0,omega,Omega,i),component='sec',distance=(1000./plx,'pc'))
Plot it:
>>> import pylab as pl >>> colors = times/365. >>> p = pl.figure() >>> p = pl.title('Capella') >>> p = pl.scatter(x1,y1,c=colors,edgecolors='none',cmap=pl.cm.spectral,label='_nolegend_') >>> p = pl.scatter(x2,y2,c=colors,edgecolors='none',cmap=pl.cm.spectral,label='_nolegend_') >>> p = pl.scatter(x1-x2,y1-y2,c=colors,edgecolors='none',cmap=pl.cm.spectral,label='_nolegend_') >>> p = pl.plot(x1,y1,'b-',label='Primary') >>> p = pl.plot(x2,y2,'g-',label='Secondary') >>> p = pl.plot(x1-x2,y1-y2,'r-',label='Secondary relative') >>> p = pl.colorbar() >>> p = pl.legend(loc='lower right') >>> p = pl.grid() >>> p = pl.xlabel(r'Angular size DEC (arcsec) --> N') >>> p = pl.ylabel(r'Angular size RA (arcsec) --> E')
]include figure]]ivs_binary_keplerorbit_capella.png]
|
|||
Radial velocities | |||
---|---|---|---|
ndarray |
|
||
2xarray |
|
||
2xarray |
|
||
|
|||
|
|||
float,float |
|
||
float,float |
|
||
float,float |
|
||
float |
|
||
float |
|
||
Kepler's laws | |||
|
|
|||
logger = logging.getLogger('IVS.KEPLER')
|
|
Evaluate Radial velocities due to kepler orbit. These parameters define the Keplerian orbit if you give times points
(
These parameters define the Keplerian orbit if you give angles
(
The periastron passage T0 can be derived via x0 by calculating T0 = x0/(2pi*Freq) + times[0] See e.g. p 41,42 of Hilditch, 'An Introduction To Close Binary Stars'
|
Construct an orbit in the orbital plane. Give times in days Parameters contains:
Return r (m) and theta (radians)
|
Calculate the velocity in the orbital plane.
|
Project an orbit onto the plane of the sky. Parameters contains the Euler angles:
Returns x,y (orbit in plane of the sky) and z See Hilditch p41 for a sketch of the coordinates. The difference with this is that all angles are inverted. In this approach, North is in the positive X direction, East is in the negative Y direction. |
Construct an orbit projected on the sky. Parameters contains:
You can give an extra parameter 'distance' as a tuple (value,'unit'). This will be used to convert the distances to angular scale (arcsec). Else, this function returns the distances in AU. See Hilditch p41 for a sketch of the coordinates. The difference with this is that all angles are inverted. In this approach, North is in the positive X direction, East is in the negative Y direction. |
Calculation of true and eccentric anomaly in Kepler orbits. M is the phase of the star, e is the eccentricity See p.39 of Hilditch, 'An Introduction To Close Binary Stars'
|
Compute orbital phase from true anomaly T
|
Compute phase of superior conjunction and periastron passage. Example usage: >>> omega = np.pi/4.0 >>> e = 0.3 >>> print calculate_critical_phases(omega,e) (-0.125, -0.057644612788576133, -0.42054512757020118, -0.19235538721142384, 0.17054512757020118)
|
Calculate the eclipse separation between primary and secondary in a light curve. Minimum separation at omega=pi Maximum spearation at omega=0
|
Caculate the argument of periastron from the eclipse separation and eccentricity. separation in phase units.
|
Kepler's third law. Give two quantities, derived the third. M = total mass system (solar units) a = semi-major axis (au) P = period (d) >>> print third_law(M=1.,a=1.) 365.256891359 >>> print third_law(a=1.,P=365.25) 1.00003773538 >>> print third_law(M=1.,P=365.25) 0.999987421856 |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Mar 30 10:45:19 2018 | http://epydoc.sourceforge.net |