Пример #1
0
def test_regression_5085():
    """
    PR #5085 was put in place to fix the following issue.

    Issue: https://github.com/astropy/astropy/issues/5069
    At root was the transformation of Ecliptic coordinates with
    non-scalar times.
    """
    # Note: for regression test, we need to be sure that we use UTC for the
    # epoch, even though more properly that should be TT; but the "expected"
    # values were calculated using that.
    j2000 = Time('J2000', scale='utc')
    times = Time(["2015-08-28 03:30", "2015-09-05 10:30", "2015-09-15 18:35"])
    latitudes = Latitude([3.9807075, -5.00733806, 1.69539491]*u.deg)
    longitudes = Longitude([311.79678613, 72.86626741, 199.58698226]*u.deg)
    distances = u.Quantity([0.00243266, 0.0025424, 0.00271296]*u.au)
    coo = GeocentricMeanEcliptic(lat=latitudes,
                                 lon=longitudes,
                                 distance=distances, obstime=times, equinox=times)
    # expected result
    ras = Longitude([310.50095400, 314.67109920, 319.56507428]*u.deg)
    decs = Latitude([-18.25190443, -17.1556676, -15.71616522]*u.deg)
    distances = u.Quantity([1.78309901, 1.710874, 1.61326649]*u.au)
    expected_result = GCRS(ra=ras, dec=decs,
                           distance=distances, obstime=j2000).cartesian.xyz
    actual_result = coo.transform_to(GCRS(obstime=j2000)).cartesian.xyz
    assert_quantity_allclose(expected_result, actual_result)
Пример #2
0
def test_regression_5085():
    """
    PR #5085 was put in place to fix the following issue.

    Issue: https://github.com/astropy/astropy/issues/5069
    At root was the transformation of Ecliptic coordinates with
    non-scalar times.
    """
    # Note: for regression test, we need to be sure that we use UTC for the
    # epoch, even though more properly that should be TT; but the "expected"
    # values were calculated using that.
    j2000 = Time('J2000', scale='utc')
    times = Time(["2015-08-28 03:30", "2015-09-05 10:30", "2015-09-15 18:35"])
    latitudes = Latitude([3.9807075, -5.00733806, 1.69539491]*u.deg)
    longitudes = Longitude([311.79678613, 72.86626741, 199.58698226]*u.deg)
    distances = u.Quantity([0.00243266, 0.0025424, 0.00271296]*u.au)
    coo = GeocentricMeanEcliptic(lat=latitudes,
                                 lon=longitudes,
                                 distance=distances, obstime=times, equinox=times)
    # expected result
    ras = Longitude([310.50095400, 314.67109920, 319.56507428]*u.deg)
    decs = Latitude([-18.25190443, -17.1556676, -15.71616522]*u.deg)
    distances = u.Quantity([1.78309901, 1.710874, 1.61326649]*u.au)
    expected_result = GCRS(ra=ras, dec=decs,
                           distance=distances, obstime=j2000).cartesian.xyz
    actual_result = coo.transform_to(GCRS(obstime=j2000)).cartesian.xyz
    assert_quantity_allclose(expected_result, actual_result)
Пример #3
0
def apparent_longitude(t='now'):
    """
    Returns the Sun's apparent longitude, referred to the true equinox of date.  Corrections for
    nutation and aberration (for Earth motion) are included.

    Parameters
    ----------
    t : {parse_time_types}
        A time (usually the start time) specified as a parse_time-compatible
        time string, number, or a datetime object.

    Notes
    -----
    The nutation model is IAU 2000A nutation with adjustments to match IAU 2006 precession.
    """
    time = parse_time(t)
    sun = SkyCoord(0*u.deg, 0*u.deg, 0*u.AU, frame='hcrs', obstime=time)
    coord = sun.transform_to(GeocentricMeanEcliptic(equinox=time))

    # Astropy's GeocentricMeanEcliptic already includes aberration, so only add nutation
    jd1, jd2 = get_jd12(time, 'tt')
    nut_lon, _ = erfa.nut06a(jd1, jd2)*u.radian
    lon = coord.lon + nut_lon

    return Longitude(lon)
Пример #4
0
def apparent_latitude(t='now'):
    """
    Returns the Sun's apparent latitude, referred to the true equinox of date.  Corrections for
    nutation and aberration (for Earth motion) are included.

    Parameters
    ----------
    t : {parse_time_types}
        Time to use in a parse-time-compatible format
    """
    time = parse_time(t)
    sun = SkyCoord(0 * u.deg, 0 * u.deg, 0 * u.AU, frame='hcrs', obstime=time)
    coord = sun.transform_to(GeocentricMeanEcliptic(equinox=time))

    # Astropy's GeocentricMeanEcliptic does not include nutation, but the contribution is negligible
    lat = coord.lat

    return Latitude(lat)
Пример #5
0
def true_latitude(t='now'):
    """
    Returns the Sun's true geometric latitude, referred to the mean equinox of date.  No
    corrections for nutation or aberration are included.

    Parameters
    ----------
    t : {parse_time_types}
        Time to use in a parse-time-compatible format
    """
    time = parse_time(t)
    sun = SkyCoord(0 * u.deg, 0 * u.deg, 0 * u.AU, frame='hcrs', obstime=time)
    coord = sun.transform_to(GeocentricMeanEcliptic(equinox=time))

    # Astropy's GeocentricMeanEcliptic includes aberration from Earth motion, but the contribution
    # is negligible
    lat = coord.lat

    return Latitude(lat)