Ejemplo n.º 1
0
        wdage = (10.**wdage).reshape((len(x[:, 0]), 1)) / 1e9

        # solve for the Einstein radius
        n = 2. * np.pi / x[:, 0]
        # Sudarsky 2005 Eq. 9 to convert between center of transit
        # and pericenter passage (tau)
        edif = 1.-e[:, 0]**2.
        fcen = np.pi/2. - omega[:, 0] * np.pi/180.
        tau = (x[:, 1] + np.sqrt(edif)*x[:, 0] / (2.*np.pi) *
               (e[:, 0]*np.sin(fcen)/(1.+e[:, 0]*np.cos(fcen)) -
                2./np.sqrt(edif) * np.arctan(np.sqrt(edif)*np.tan(fcen/2.) /
                                            (1.+e[:, 0]))))

        # define the mean anomaly
        M = (n * (x[:, 1] - tau)) % (2. * np.pi)
        E = kepler_problem(M, e[:, 0])

        # solve for f
        tanf2 = np.sqrt((1.+e[:, 0])/(1.-e[:, 0])) * np.tan(E/2.)
        f = (np.arctan(tanf2)*2.) % (2. * np.pi)

        r = a[:, 0] * (1. - e[:, 0]**2.) / (1. + e[:, 0] * np.cos(f))
        # positive z means body 2 is in front (transit)
        Z = (r * np.sin(omega[:, 0]*np.pi/180. + f) *
             np.sin(inc[:, 0]*np.pi/180.))
        # 1.6984903e-5 gives 2*Einstein radius^2/R1^2
        Rein = np.sqrt(1.6984903e-5 * x[:, 6] * np.abs(Z) * R1[:, 0] / 2.)

        # add the Einstein radius
        Rein = Rein.reshape((len(x[:, 0]), 1))
        x = np.concatenate((x, Rein), axis=1)
Ejemplo n.º 2
0
# radius ratio with a range of WD masses
rrats = R2s / R1
# mean motion
n = 2. * np.pi / period

# Sudarsky 2005 Eq. 9 to convert between center of transit
# and pericenter passage (tau)
edif = 1.-e**2.
fcen = np.pi/2. - omega
tau = (ttran + np.sqrt(edif)*period / (2.*np.pi) *
       (e*np.sin(fcen) / (1.+e*np.cos(fcen)) - 2./np.sqrt(edif) *
        np.arctan(np.sqrt(edif)*np.tan(fcen/2.)/(1.+e))))

# define the mean anomaly
M = (n * (ttran - tau)) % (2. * np.pi)
E = kepler_problem(M, e)

# solve for f
tanf2 = np.sqrt((1.+e)/(1.-e)) * np.tan(E/2.)
fanom = (np.arctan(tanf2)*2.) % (2. * np.pi)
r = a * (1. - e**2.) / (1. + e * np.cos(fanom))

# positive z means body 2 is in front (transit)
Z = r * np.sin(omega + fanom) * np.sin(inc)
# get the lens depth given this separation at transit
# 1.6984903e-5 gives 2*Einstein radius^2 = 8GMZ/(c^2 R^2) with M, Z, R all
# scaled to solar values
lensdeps = 1.6984903e-5 * M2s * np.abs(Z) / R1 - rrats**2.
# decompose into the two parts
lensonly = 1.6984903e-5 * M2s * np.abs(Z) / R1
tranonly = -rrats**2.