Orbit Code

exception bagle.orbits.EccAnomalyError(message)
bagle.orbits.a_to_P(mass, a)

Goes from semimajor axis in AU to period in years

Parameters:
mass: float or array-like

Primary object mass in Msun.

a: float or array-like

Semimajor axis in AU.

Returns:
period: float or array-like

Orbital period in years.

bagle.orbits.add_mult_positions(companions, ss_pos, logAge, add_velocities=False)

Adds x and y positions of multiple companions by transforming keplerian parameters to xyz in AU using code origially from gcworks and random initial times. Then adding them to the random posiiton of the primary object.

Parameters:
ss_pos: astropy table

Star system table with positions added with add_positions()

companion: astropy table

Companion table without positions

logAge: float or int

Log of age of cluster with age in years

Returns:
companion_temp: astropy table

Companion table with positions added

bagle.orbits.add_positions(ss)

Adds x and y positions randomly in a box of length and width 40000 AU for each system.

Parameters:
ss: astropy table

Star system table without positions

Returns:
ss_temp: astropy table

Star system table with positions added

bagle.orbits.distance_to_center_of_mass(ss_pos, companions_pos)

Adds extra column to star system and companions table with x and y distance to the center of mass in AU. Assumes hierarchical triples (two closest stars orbit their center of mass and triple orbits them) and no quads+.

Parameters:
ss_pos: astropy table

Star system table with positions added with add_positions()

companion_pos: astropy table

Companion table with positions added with add_mult_positions()

bagle.orbits.plot_companion_orbit(ss, companions_pos, logAge, t0=None, system=None)

Plots the orbit of one system assuming the primary object is at (0,0). By default random companion and initial time.

Parameters:
ss: astropy table

Star system table (does not matter if it has positions or not)

companion_pos: astropy table

Companion table with positions added with add_mult_positions()

logAge: float or int

Log of age of cluster with age in years

t0: float or int, optional

Initial time of creation of the system in years. Default random.

system: int, optional

Index of desired companion in companion_pos table. Default random.

bagle.orbits.plot_projected_cluster(ss_pos, companions_pos)

Plots projected cluster with lines between companions and primary stars

Parameters:
ss_pos: astropy table

Star system table with positions added with add_positions()

companion_pos: astropy table

Companion table with positions added with add_mult_positions()