Esempio n. 1
0
 def test_tete_quick(self):
     # Following copied from intermediate_rotation_transforms.gcrs_to_tete
     rbpn = erfa.pnm06a(*get_jd12(self.obstime, 'tt'))
     loc_gcrs_frame = get_location_gcrs(
         self.loc, self.obstime, tete_to_itrs_mat(self.obstime, rbpn=rbpn),
         rbpn)
     self.check_obsgeo(loc_gcrs_frame.obsgeoloc, loc_gcrs_frame.obsgeovel)
Esempio n. 2
0
def get_cip(jd1, jd2):
    """
    Find the X, Y coordinates of the CIP and the CIO locator, s.

    Parameters
    ----------
    jd1 : float or `np.ndarray`
        First part of two part Julian date (TDB)
    jd2 : float or `np.ndarray`
        Second part of two part Julian date (TDB)

    Returns
    --------
    x : float or `np.ndarray`
        x coordinate of the CIP
    y : float or `np.ndarray`
        y coordinate of the CIP
    s : float or `np.ndarray`
        CIO locator, s
    """
    # classical NPB matrix, IAU 2006/2000A
    rpnb = erfa.pnm06a(jd1, jd2)
    # CIP X, Y coordinates from array
    x, y = erfa.bpn2xy(rpnb)
    # CIO locator, s
    s = erfa.s06(jd1, jd2, x, y)
    return x, y, s
def tete_to_gcrs(tete_coo, gcrs_frame):
    # Compute the pn matrix, and then multiply by its transpose.
    rbpn = erfa.pnm06a(*get_jd12(tete_coo.obstime, 'tt'))
    newrepr = tete_coo.cartesian.transform(matrix_transpose(rbpn))
    # We now have a GCRS vector for the input location and obstime.
    # Turn it into a GCRS frame instance.
    loc_gcrs = get_location_gcrs(tete_coo, rbpn)
    gcrs = loc_gcrs.realize_frame(newrepr)
    # Finally, do any needed offsets (no-op if same obstime and location)
    return gcrs.transform_to(gcrs_frame)
Esempio n. 4
0
def _apparent_position_in_true_coordinates(skycoord):
    """
    Convert Skycoord in GCRS frame into one in which RA and Dec
    are defined w.r.t to the true equinox and poles of the Earth
    """
    jd1, jd2 = get_jd12(skycoord.obstime, 'tt')
    # Classical NPB matrix, IAU 2006/2000A
    # (same as in builtin_frames.utils.get_cip).
    rbpn = erfa.pnm06a(jd1, jd2)
    return SkyCoord(skycoord.frame.realize_frame(
        skycoord.cartesian.transform(rbpn)))
Esempio n. 5
0
def _true_ecliptic_rotation_matrix(equinox):
    # This code calls pnm06a from ERFA, which retrieves the precession
    # matrix (including frame bias) according to the IAU 2006 model, and
    # including the nutation. This family of systems is less popular
    # (see https://github.com/astropy/astropy/pull/6508).
    jd1, jd2 = get_jd12(equinox, 'tt')
    rnpb = erfa.pnm06a(jd1, jd2)
    _, nut_obl = erfa.nut06a(jd1, jd2) * u.radian
    obl = erfa.obl06(
        jd1, jd2
    ) * u.radian + nut_obl  # calculate the true obliquity of the ecliptic
    return matrix_product(rotation_matrix(obl, 'x'), rnpb)
def gcrs_to_tete(gcrs_coo, tete_frame):
    # Classical NPB matrix, IAU 2006/2000A
    # (same as in builtin_frames.utils.get_cip).
    rbpn = erfa.pnm06a(*get_jd12(tete_frame.obstime, 'tt'))
    # Get GCRS coordinates for the target observer location and time.
    loc_gcrs = get_location_gcrs(tete_frame, rbpn)
    gcrs_coo2 = gcrs_coo.transform_to(loc_gcrs)
    # Now we are relative to the correct observer, do the transform to TETE.
    # These rotations are defined at the geocenter, but can be applied to
    # topocentric positions as well, assuming rigid Earth. See p57 of
    # https://www.usno.navy.mil/USNO/astronomical-applications/publications/Circular_179.pdf
    crepr = gcrs_coo2.cartesian.transform(rbpn)
    return tete_frame.realize_frame(crepr)
Esempio n. 7
0
def tete_to_gcrs(tete_coo, gcrs_frame):
    # compute the pn matrix, and then multiply by its transpose

    jd1, jd2 = get_jd12(tete_coo.obstime, 'tt')
    # Classical NPB matrix, IAU 2006/2000A
    # (same as in builtin_frames.utils.get_cip).
    rbpn = erfa.pnm06a(jd1, jd2)
    newrepr = tete_coo.cartesian.transform(matrix_transpose(rbpn))

    gcrs = GCRS(newrepr,
                obstime=tete_coo.obstime,
                obsgeoloc=tete_coo.obsgeoloc,
                obsgeovel=tete_coo.obsgeovel)

    # now do any needed offsets (no-op if same obstime and 0 pos/vel)
    return gcrs.transform_to(gcrs_frame)
Esempio n. 8
0
def gcrs_to_tete(gcrs_coo, tete_frame):
    # first apply GCRS self transform to correct time and observatory position/velocity
    gcrs_coo2 = gcrs_coo.transform_to(
        GCRS(obstime=tete_frame.obstime,
             obsgeoloc=tete_frame.obsgeoloc,
             obsgeovel=tete_frame.obsgeovel))

    jd1, jd2 = get_jd12(tete_frame.obstime, 'tt')
    # Classical NPB matrix, IAU 2006/2000A
    # (same as in builtin_frames.utils.get_cip).
    rbpn = erfa.pnm06a(jd1, jd2)

    # These rotations are defined at the geocenter, but can be applied to
    # topocentric positions as well, assuming rigid Earth. See p57 of
    # https://www.usno.navy.mil/USNO/astronomical-applications/publications/Circular_179.pdf
    crepr = gcrs_coo2.cartesian.transform(rbpn)
    return tete_frame.realize_frame(crepr)