Exemplo n.º 1
0
def rrmodel_direct_s_simple(t, k, t0, p, a, i, e, w, ldp, istar, ze, zm, ng,
                            splimit, lcids, pbids, epids, nsamples, exptimes,
                            parallel):
    """Simple RoadRunner transit model for a homogeneous time series without supersampling and relatively small number of points.

    This version avoids the overheads from threading and supersampling. The fastest option if the number of datapoints
    is smaller than some thousands.
    """
    k = atleast_1d(k)

    y0, vx, vy, ax, ay, jx, jy, sx, sy = vajs_from_paiew(p, a, i, e, w)
    z = z_taylor_v(t, t0, p, y0, vx, vy, ax, ay, jx, jy, sx, sy)

    # RoadRunner model branch
    # -----------------------
    if k[0] > splimit:
        gs, dg, weights = calculate_weights_2d(k[0], ze, ng)
        ldw = dot(weights, ldp[0, 0, :])
        iplanet = im_p_v2(z / (1. + k[0]), dg, ldw)

    # Small-planet approximation branch
    # ---------------------------------
    else:
        iplanet = interpolate_limb_darkening_v(z, zm, ldp[0, 0, :])

    aplanet = circle_circle_intersection_area_v(1.0, k[0], z)
    flux = (istar[0, 0] - iplanet * aplanet) / istar[0, 0]
    return flux
Exemplo n.º 2
0
def _eval_rrm_interpolated_v_parallel(t, k, t0, p, a, i, e, w, ldp, istar,
                                      weights, dk, k0, dg, lcids, pbids, epids,
                                      nsamples, exptimes, npb):
    npv = k.shape[0]
    npt = t.size
    ng = weights.shape[1]

    flux = zeros((npv, npt))
    for ipv in prange(npv):
        y0, vx, vy, ax, ay, jx, jy, sx, sy = vajs_from_paiew(
            p[ipv], a[ipv], i[ipv], e[ipv], w[ipv])
        half_window_width = 0.025 + 0.5 * t14(k[ipv, 0], y0, vx, vy, ax, ay,
                                              jx, jy, sx, sy)

        ldw = zeros((npb, ng))

        nk = (k[ipv, 0] - k0) / dk
        ik = int(floor(nk))
        ak = nk - ik

        for ipb in range(npb):
            ldw[ipb] = (1.0 - ak) * dot(weights[ik], ldp[ipv, ipb]) + ak * dot(
                weights[ik + 1], ldp[ipv, ipb])

        for j in range(npt):
            ilc = lcids[j]
            iep = epids[ilc]

            epoch = floor((t[j] - t0[ipv, iep] + 0.5 * p[ipv]) / p[ipv])
            tc = t[j] - (t0[ipv, iep] + epoch * p[ipv])
            if abs(tc) > half_window_width:
                flux[ipv, j] = 1.0
            else:
                ipb = pbids[ilc]

                if k.shape[1] == 1:
                    _k = k[ipv, 0]
                else:
                    _k = k[ipv, ipb]

                if isnan(_k) or isnan(a[ipv]):
                    flux[ipv, j] = inf
                else:
                    for isample in range(1, nsamples[ilc] + 1):
                        time_offset = exptimes[ilc] * (
                            (isample - 0.5) / nsamples[ilc] - 0.5)
                        z = z_taylor_st(tc + time_offset, y0, vx, vy, ax, ay,
                                        jx, jy, sx, sy)
                        if z > 1.0 + _k:
                            flux[ipv, j] += 1.
                        else:
                            iplanet = lerp(z / (1. + _k), dg, ldw[ipb])
                            aplanet = circle_circle_intersection_area(
                                1.0, _k, z)
                            flux[ipv,
                                 j] += (istar[ipv, ipb] -
                                        iplanet * aplanet) / istar[ipv, ipb]
                    flux[ipv, j] /= nsamples[ilc]
    return flux
Exemplo n.º 3
0
def _eval_rrm_direct_v_parallel(t, k, t0, p, a, i, e, w, ldp, istar, ze, ng,
                                lcids, pbids, epids, nsamples, exptimes, npb):
    npv = k.shape[0]
    npt = t.size

    flux = zeros((npv, npt))
    for ipv in prange(npv):
        y0, vx, vy, ax, ay, jx, jy, sx, sy = vajs_from_paiew(
            p[ipv], a[ipv], i[ipv], e[ipv], w[ipv])
        half_window_width = fmax(0.125, (2 + k[ipv, 0]) / vx)

        gs, dg, weights = calculate_weights_2d(k[ipv, 0], ze, ng)

        ldw = zeros((npb, ng))
        for ipb in range(npb):
            ldw[ipb] = dot(weights, ldp[ipv, ipb])

        for j in range(npt):
            ilc = lcids[j]
            iep = epids[ilc]
            epoch = floor((t[j] - t0[ipv, iep] + 0.5 * p[ipv]) / p[ipv])
            tc = t[j] - (t0[ipv, iep] + epoch * p[ipv])

            if abs(tc) > half_window_width:
                flux[ipv, j] = 1.0
            else:
                ipb = pbids[ilc]

                if k.shape[1] == 1:
                    _k = k[ipv, 0]
                else:
                    _k = k[ipv, ipb]

                if isnan(_k) or isnan(a[ipv]):
                    flux[ipv, j] = inf
                else:
                    for isample in range(1, nsamples[ilc] + 1):
                        time_offset = exptimes[ilc] * (
                            (isample - 0.5) / nsamples[ilc] - 0.5)
                        z = z_taylor_st(tc + time_offset, y0, vx, vy, ax, ay,
                                        jx, jy, sx, sy)
                        if z > 1.0 + _k:
                            flux[ipv, j] += 1.
                        else:
                            iplanet = lerp(z / (1. + _k), dg, ldw[ipb])
                            aplanet = circle_circle_intersection_area(
                                1.0, _k, z)
                            flux[ipv,
                                 j] += (istar[ipv, ipb] -
                                        iplanet * aplanet) / istar[ipv, ipb]
                    flux[ipv, j] /= nsamples[ilc]
    return flux
Exemplo n.º 4
0
def _eval_rrm_parallel(t, k, t0, p, a, i, e, w, istar, zm, dg, ldp, ldw,
                       splimit, lcids, pbids, epids, nsamples, exptimes):
    npt = t.size
    flux = zeros(npt)

    if epids.max() != t0.size - 1:
        raise ValueError(
            "The number of transit centers must equal to the number of individual epoch IDs."
        )

    y0, vx, vy, ax, ay, jx, jy, sx, sy = vajs_from_paiew(p, a, i, e, w)
    half_window_width = 0.025 + 0.5 * t14(k[0], y0, vx, vy, ax, ay, jx, jy, sx,
                                          sy)

    for j in prange(npt):
        ilc = lcids[j]
        iep = epids[ilc]
        epoch = floor((t[j] - t0[iep] + 0.5 * p) / p)
        tc = t[j] - (t0[iep] + epoch * p)

        if abs(tc) > half_window_width:
            flux[j] = 1.0
        else:
            ilc = lcids[j]
            ipb = pbids[ilc]
            _k = k[0] if k.size == 1 else k[ipb]

            for isample in range(1, nsamples[ilc] + 1):
                time_offset = exptimes[ilc] * (
                    (isample - 0.5) / nsamples[ilc] - 0.5)
                z = z_taylor_st(tc + time_offset, y0, vx, vy, ax, ay, jx, jy,
                                sx, sy)
                if z > 1.0 + _k:
                    flux[j] += 1.
                else:
                    if _k > splimit:
                        iplanet = lerp(z / (1. + _k), dg, ldw[ipb])
                    else:
                        iplanet = interpolate_limb_darkening_s(
                            z, zm, ldp[0, ipb])
                    aplanet = circle_circle_intersection_area(1.0, _k, z)
                    flux[j] += (istar[0, ipb] - iplanet * aplanet) / istar[0,
                                                                           ipb]
            flux[j] /= nsamples[ilc]
    return flux