Ejemplo n.º 1
0
def PlanetPropertiestoLinearModelAmplitudes(T0, P, mass, e, varpi, T10, P1,
                                            mass1, e1, varpi1):
    """
    """

    j = get_nearest_firstorder(P / P1)
    j_2 = 1.0 / j / j
    Delta = (j - 1) * P1 / P / j - 1
    Delta_2 = 1.0 / Delta / Delta

    ex = e * np.cos(varpi)
    ey = e * np.sin(varpi)
    ex1 = e1 * np.cos(varpi1)
    ey1 = e1 * np.sin(varpi1)

    alpha = (P / P1)**(2. / 3.)
    alpha_2 = 1.0 / alpha / alpha
    fCoeffIn, fCoeffOut = get_fCoeffs(j, alpha)
    denom = (fCoeffIn * fCoeffIn + fCoeffOut * fCoeffOut)**(0.5)
    Zx = fCoeffIn * ex + fCoeffOut * ex1
    Zy = fCoeffIn * ey + fCoeffOut * ey1
    Zx /= denom
    Zy /= denom

    S = mass1 * Zx
    C = mass1 * Zy
    S1 = mass * Zx
    C1 = mass * Zy
    return np.array([T0, P, mass1, S, C]), np.array([T10, P1, mass, S1, C1])
Ejemplo n.º 2
0
def ttv_basis_function_matrix_outer(P,
                                    P1,
                                    T0,
                                    T10,
                                    Ntrans,
                                    IncludeLinearBasis=True):
    """
    Compute the transit time basis function matrix, 'M', for a planet subject to an interior perturber.

    Args:
        P (real): Inner planet period.
        P1 (real): Inner planet period.
        T (real): Outer planet initial time of transit
        T1 (real): Outer planet initial time of transit
        Ntrans (int):  number of transits 
        IncludeLinearBasis (bool): Whether basis functions representing a linear transit emphemris is included. Default is True.
           
    Returns:
        Array: the resulting basis function matrix is returned an (Ntrans, 5) array or an (Ntrans, 3) array if IncludeLinearBasis=False.

    """
    j = get_nearest_firstorder(P / P1)
    assert j > 0, "Bad period ratio!!! P,P1 = %.3f \t %.3f" % (P, P1)
    superP = get_superperiod(P, P1)
    superPhase = 2 * np.pi * (j * (-T10 / P1) - (j - 1) * (-T0 / P))
    Times = T10 + np.arange(Ntrans) * P1

    # Normalize super-sin/cos so that basis fn amplitude is mu * (Zx/Zy)
    #
    j_2 = 1.0 / j / j
    Delta = (j - 1) * P1 / P / j - 1
    Delta_2 = 1.0 / Delta / Delta
    alpha = (P / P1)**(2. / 3.)
    alpha_2 = 1.0 / alpha / alpha
    fCoeffIn, fCoeffOut = get_fCoeffs(j, alpha)
    denom = (fCoeffIn * fCoeffIn + fCoeffOut * fCoeffOut)**(0.5)
    S1 = 1.5 * (j) * j_2 * Delta_2 * denom * P1 / (np.pi)
    C1 = -1.5 * (j) * j_2 * Delta_2 * denom * P1 / (np.pi)

    dt0 = dt0_OuterPlanet(P, P1, T0, T10, Ntrans)
    superSin = S1 * np.sin(2 * np.pi * Times / superP + superPhase)
    superCos = C1 * np.cos(2 * np.pi * Times / superP + superPhase)

    if IncludeLinearBasis:
        basis_function_matrix = np.vstack(
            (np.ones(Ntrans), np.arange(Ntrans), dt0, superSin, superCos)).T
    else:
        basis_function_matrix = np.vstack((dt0, superSin, superCos)).T
    return basis_function_matrix