コード例 #1
0
def transfer(fs, ts, khat, xyz, L=5e9):
    khat = tt.reshape(khat, (1, 3))

    fstar = 2.99792e8 / (2 * pi * L)

    tfs_re = tt.zeros((3, 3, ts.shape[0]))
    tfs_im = tt.zeros((3, 3, ts.shape[0]))
    for i in range(3):
        for j in range(i + 1, 3):
            if not (j == i):
                rij = xyz[j, :, :] - xyz[i, :, :]
                r2 = tt.reshape(pmm.sum(rij * rij, axis=1), (-1, 1))
                rij = rij / pmm.sqrt(r2)

                rk = pmm.sum(rij * khat, axis=1)
                w = fs / (2 * fstar) * (1 - rk)
                wp = fs / (2 * fstar) * (1 + rk
                                         )  # Reverse direction, get a plus
                sc = pmm.sin(w) / w
                scp = pmm.sin(wp) / wp

                tfs_re = tt.set_subtensor(tfs_re[i, j, :], sc * pmm.cos(w))
                tfs_im = tt.set_subtensor(tfs_im[i, j, :], sc * pmm.sin(w))

                tfs_re = tt.set_subtensor(tfs_re[j, i, :], scp * pmm.cos(wp))
                tfs_im = tt.set_subtensor(tfs_im[j, i, :], scp * pmm.sin(wp))

    return tfs_re, tfs_im
コード例 #2
0
def constellation(ts, e=0.00985, R=1, kappa=0, lam=0):
    L = 5e9 * 2 * sqrt(3) * e * R  # m ; R in AU

    alpha = 2 * pi * ts / (3600.0 * 24.0 * 365.25 * R**(3.0 / 2.0)) + kappa
    alpha = tt.reshape(alpha, (1, alpha.shape[0]))

    betas = tt.as_tensor_variable(
        [kappa, kappa + 2 * pi / 3, kappa + 4 * pi / 3])
    betas = tt.reshape(betas, (betas.shape[0], 1))

    xs = R * pmm.cos(alpha) + 0.5 * e * R * (pmm.cos(2 * alpha - betas) -
                                             3 * pmm.cos(betas))
    ys = R * pmm.sin(alpha) + 0.5 * e * R * (pmm.sin(2 * alpha - betas) -
                                             3 * pmm.sin(betas))
    zs = -sqrt(3) * e * R * pmm.cos(alpha - betas)

    return tt.stack((xs, ys, zs), axis=2)
コード例 #3
0
def y_slow(ts, f0, fdot, fddot, phi0, nhat, cos_iota, psi, fhet=None):
    if fhet is None:
        fhet = f0

    df = f0 - fhet

    uvk_ = uvk(nhat)
    khat = uvk_[2, :]

    xyz = constellation(ts)

    dp, dc = dp_dc(xyz, uvk_)

    cp = pmm.cos(2.0 * psi)
    sp = pmm.sin(2.0 * psi)

    ys_re = tt.zeros((3, 3, ts.shape[0]))
    ys_im = tt.zeros((3, 3, ts.shape[0]))

    for i in range(3):
        kdotx = 499.0048 * tt.tensordot(
            xyz[i, :, :], khat, axes=1)  # 499.0048 = 1 AU / c in seconds
        xi = ts - kdotx
        fs = f0 + fdot * xi

        tfs_re, tfs_im = transfer(fs, ts, khat, xyz)
        Ap, Ac = Ap_Ac(fs, cos_iota)

        phi = pi * fddot * xi * xi * xi / 3.0 + pi * fdot * xi * xi + phi0 - 2 * pi * f0 * kdotx + 2 * pi * df * ts
        osc_re = pmm.cos(phi)
        osc_im = pmm.sin(phi)

        for j in range(3):
            if not i == j:
                Fp_re = dp[i, j] * Ap * cp - dc[i, j] * Ap * sp
                Fp_im = -dp[i, j] * Ac * sp - dc[i, j] * Ac * cp

                A_re = (Fp_re * tfs_re[i, j, :] - Fp_im * tfs_im[i, j, :]) / 4
                A_im = (Fp_im * tfs_re[i, j, :] + Fp_re * tfs_im[i, j, :]) / 4

                ys_re = tt.set_subtensor(ys_re[i, j, :],
                                         A_re * osc_re - A_im * osc_im)
                ys_im = tt.set_subtensor(ys_im[i, j, :],
                                         A_im * osc_re + A_re * osc_im)

    return (ys_re, ys_im)
コード例 #4
0
def uvk(nhat):
    phi = tt.arctan2(nhat[1], nhat[0])
    cos_theta = nhat[2]
    sin_theta = pmm.sqrt(1 - cos_theta * cos_theta)

    cphi = pmm.cos(phi)
    sphi = pmm.sin(phi)

    u = tt.as_tensor_variable([cos_theta * cphi, cos_theta * sphi, -sin_theta])
    v = tt.as_tensor_variable([sphi, -cphi, 0.0])
    k = tt.as_tensor_variable(
        [-sin_theta * cphi, -sin_theta * sphi, -cos_theta])

    return tt.stack((u, v, k), dim=0)
コード例 #5
0
def XYZ_freq(yf_re, yf_im, Tobs, heterodyne_bin, N, L=5e9):
    fstar = 2.99792e8 / (2.0 * pi * L)

    nf = N
    df = 1.0 / Tobs
    dfs = linspace(0, df * nf / 2, int(round(nf / 2)) + 1)
    dfs = concatenate((dfs, -dfs[-2:0:-1]))
    fs = heterodyne_bin * df + dfs

    c1 = pmm.cos(-fs / fstar)
    s1 = pmm.sin(-fs / fstar)

    c2 = pmm.cos(-2 * fs / fstar)
    s2 = pmm.sin(-2 * fs / fstar)

    c3 = pmm.cos(-3 * fs / fstar)
    s3 = pmm.sin(-3 * fs / fstar)

    X_re = yf_re[0,1,:]*c3 - yf_im[0,1,:]*s3 \
           - (yf_re[0,2,:]*c3 - yf_im[0,2,:]*s3) \
           + yf_re[1,0,:]*c2 - yf_im[1,0,:]*s2 \
           - (yf_re[2,0,:]*c2 - yf_im[2,0,:]*s2) \
           + yf_re[0,2,:]*c1 - yf_im[0,2,:]*s1 \
           - (yf_re[0,1,:]*c1 - yf_im[0,1,:]*s1) \
           + yf_re[2,0,:] - yf_re[1,0,:]

    X_im = yf_im[0,1,:]*c3 + yf_re[0,1,:]*s3 \
           - (yf_im[0,2,:]*c3 + yf_re[0,2,:]*s3) \
           + yf_im[1,0,:]*c2 + yf_re[1,0,:]*s2 \
           - (yf_im[2,0,:]*c2 + yf_re[2,0,:]*s2) \
           + yf_im[0,2,:]*c1 + yf_re[0,2,:]*s1 \
           - (yf_im[0,1,:]*c1 + yf_re[0,1,:]*s1) \
           + yf_im[2,0,:] - yf_im[1,0,:]

    Y_re = yf_re[1,2,:]*c3 - yf_im[1,2,:]*s3 \
           - (yf_re[1,0,:]*c3 - yf_im[1,0,:]*s3) \
           + yf_re[2,1,:]*c2 - yf_im[2,1,:]*s2 \
           - (yf_re[0,1,:]*c2 - yf_im[0,1,:]*s2) \
           + yf_re[1,0,:]*c1 - yf_im[1,0,:]*s1 \
           - (yf_re[1,2,:]*c1 - yf_im[1,2,:]*s1) \
           + yf_re[0,1,:] - yf_re[2,1,:]

    Y_im = yf_im[1,2,:]*c3 + yf_re[1,2,:]*s3 \
           - (yf_im[1,0,:]*c3 + yf_re[1,0,:]*s3) \
           + yf_im[2,1,:]*c2 + yf_re[2,1,:]*s2 \
           - (yf_im[0,1,:]*c2 + yf_re[0,1,:]*s2) \
           + yf_im[1,0,:]*c1 + yf_re[1,0,:]*s1 \
           - (yf_im[1,2,:]*c1 + yf_re[1,2,:]*s1) \
           + yf_im[0,1,:] - yf_im[2,1,:]

    Z_re = yf_re[2,0,:]*c3 - yf_im[2,0,:]*s3 \
           - (yf_re[2,1,:]*c3 - yf_im[2,1,:]*s3) \
           + yf_re[0,2,:]*c2 - yf_im[0,2,:]*s2 \
           - (yf_re[1,2,:]*c2 - yf_im[1,2,:]*s2) \
           + yf_re[2,1,:]*c1 - yf_im[2,1,:]*s1 \
           - (yf_re[2,0,:]*c1 - yf_im[2,0,:]*s1) \
           + yf_re[1,2,:] - yf_re[0,2,:]

    Z_im = yf_im[1,2,:]*c3 + yf_re[1,2,:]*s3 \
           - (yf_im[1,0,:]*c3 + yf_re[1,0,:]*s3) \
           + yf_im[2,1,:]*c2 + yf_re[2,1,:]*s2 \
           - (yf_im[0,1,:]*c2 + yf_re[0,1,:]*s2) \
           + yf_im[1,0,:]*c1 + yf_re[1,0,:]*s1 \
           - (yf_im[1,2,:]*c1 + yf_re[1,2,:]*s1) \
           + yf_im[0,1,:] - yf_im[2,1,:]

    return ((X_re, X_im), (Y_re, Y_im), (Z_re, Z_im))
コード例 #6
0
def distance_f():
    return D.d('v_mean') * cos(D.d('theta')) * \
           (D.d('v_mean') * sin(D.d('theta')) + sqrt((D.d('v_mean') * sin(D.d('theta'))) ** 2 +\
                                                     2 * g * D.d('height')) / g)