# Path: dart_board/utils.py
# def A_to_P(M1, M2, a):
#     """
#     Calculate the orbital period from the stellar masses and orbital separation.
# 
#     Args:
#         M1, M2 : floats, masses of the two stars (Msun)
#         a : float, orbital separation (Rsun)
# 
#     Returns:
#         P : float, orbital period (days)
#     """
# 
#     mu = c.G * (M1 + M2) * c.Msun_to_g
#     n = np.sqrt(mu/(a**3 * c.Rsun_to_cm**3))
#     P = 2.0*np.pi / n
# 
#     return P / c.day_to_sec
# 
# def P_to_A(M1, M2, P):
#     """
#     Calculate the orbital separation from the stellar masses and orbital period.
# 
#     Args:
#         M1, M2 : floats, masses of the two stars (Msun)
#         P : float, orbital period (days)
# 
#     Returns:
#         a : float, orbital separation (Rsun)
#     """
# 
#     mu = c.G * (M1 + M2) * c.Msun_to_g
#     n = 2.0*np.pi / P / c.day_to_sec
#     a = np.power(mu/(n*n), 1.0/3.0) / c.Rsun_to_cm
# 
#     return a


import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.patches as mpatches
from .utils import A_to_P, P_to_A

    P_orb_out = np.array([])
    ecc_out = np.array([])

    k1_out = np.array([], dtype='i8')
    k2_out = np.array([], dtype='i8')

    L1_out = np.array([])
    L2_out = np.array([])

    for time in times:

        output = evolve(M1_in, M2_in, P_orb_in, ecc,
                        v1_kick[0], v1_kick[1], v1_kick[2], v1_kick[3],
                        v2_kick[0], v2_kick[1], v2_kick[2], v2_kick[3],
                        time, metallicity, verbose_output,
                        **model_kwargs)

        R1_out = np.append(R1_out, output['R1'])
        R2_out = np.append(R2_out, output['R2'])

        M1_out = np.append(M1_out, output['M1'])
        M2_out = np.append(M2_out, output['M2'])

        Teff1_out = np.append(Teff1_out, output['Teff1'])
        Teff2_out = np.append(Teff2_out, output['Teff2'])

        Mdot1_out = np.append(Mdot1_out, output['mdot1'])
        Mdot2_out = np.append(Mdot2_out, output['mdot2'])


# Path: dart_board/utils.py
# def A_to_P(M1, M2, a):
#     """
#     Calculate the orbital period from the stellar masses and orbital separation.
# 
#     Args:
#         M1, M2 : floats, masses of the two stars (Msun)
#         a : float, orbital separation (Rsun)
# 
#     Returns:
#         P : float, orbital period (days)
#     """
# 
#     mu = c.G * (M1 + M2) * c.Msun_to_g
#     n = np.sqrt(mu/(a**3 * c.Rsun_to_cm**3))
#     P = 2.0*np.pi / n
# 
#     return P / c.day_to_sec
# 
# def P_to_A(M1, M2, P):
#     """
#     Calculate the orbital separation from the stellar masses and orbital period.
# 
#     Args:
#         M1, M2 : floats, masses of the two stars (Msun)
#         P : float, orbital period (days)
# 
#     Returns:
#         a : float, orbital separation (Rsun)
#     """
# 
#     mu = c.G * (M1 + M2) * c.Msun_to_g
#     n = 2.0*np.pi / P / c.day_to_sec
#     a = np.power(mu/(n*n), 1.0/3.0) / c.Rsun_to_cm
# 
#     return a


# Path: dart_board/plot_system_evolution.py
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.patches as mpatches
from .utils import A_to_P, P_to_A


    P_orb_out = np.array([])
    ecc_out = np.array([])

    k1_out = np.array([], dtype='i8')
    k2_out = np.array([], dtype='i8')

    L1_out = np.array([])
    L2_out = np.array([])

    for time in times:

        output = evolve(M1_in, M2_in, P_orb_in, ecc,
                        v1_kick[0], v1_kick[1], v1_kick[2], v1_kick[3],
                        v2_kick[0], v2_kick[1], v2_kick[2], v2_kick[3],
                        time, metallicity, verbose_output,
                        **model_kwargs)

        R1_out = np.append(R1_out, output['R1'])
        R2_out = np.append(R2_out, output['R2'])

        M1_out = np.append(M1_out, output['M1'])
        M2_out = np.append(M2_out, output['M2'])

        Teff1_out = np.append(Teff1_out, output['Teff1'])
        Teff2_out = np.append(Teff2_out, output['Teff2'])

        Mdot1_out = np.append(Mdot1_out, output['mdot1'])
        Mdot2_out = np.append(Mdot2_out, output['mdot2'])


        P_orb_tmp = A_to_P(output['M1'], output['M2'], output['a'])