Пример #1
0
def test_frames(tmpdir):
    frames = [
        cf.CelestialFrame(reference_frame=coord.ICRS()),
        cf.CelestialFrame(reference_frame=coord.FK5(
            equinox=time.Time('2010-01-01'))),
        cf.CelestialFrame(reference_frame=coord.FK4(
            equinox=time.Time('2010-01-01'), obstime=time.Time('2015-01-01'))),
        cf.CelestialFrame(reference_frame=coord.FK4NoETerms(
            equinox=time.Time('2010-01-01'), obstime=time.Time('2015-01-01'))),
        cf.CelestialFrame(reference_frame=coord.Galactic()),
        cf.CelestialFrame(
            reference_frame=coord.Galactocentric(galcen_distance=5.0 * u.m,
                                                 galcen_ra=45 * u.deg,
                                                 galcen_dec=1 * u.rad,
                                                 z_sun=3 * u.pc,
                                                 roll=3 * u.deg)),
        cf.CelestialFrame(
            reference_frame=coord.GCRS(obstime=time.Time('2010-01-01'),
                                       obsgeoloc=[1, 3, 2000] * u.pc,
                                       obsgeovel=[2, 1, 8] * (u.m / u.s))),
        cf.CelestialFrame(reference_frame=coord.CIRS(
            obstime=time.Time('2010-01-01'))),
        cf.CelestialFrame(reference_frame=coord.ITRS(
            obstime=time.Time('2022-01-03'))),
        cf.CelestialFrame(reference_frame=coord.PrecessedGeocentric(
            obstime=time.Time('2010-01-01'),
            obsgeoloc=[1, 3, 2000] * u.pc,
            obsgeovel=[2, 1, 8] * (u.m / u.s)))
    ]

    tree = {'frames': frames}

    helpers.assert_roundtrip_tree(tree, tmpdir)
Пример #2
0
def create_test_frames():
    """Creates an array of frames to be used for testing."""

    # Suppress warnings from astropy that are caused by having 'dubious' dates
    # that are too far in the future. It's not a concern for the purposes of
    # unit tests. See issue #5809 on the astropy GitHub for discussion.
    from astropy._erfa import ErfaWarning
    warnings.simplefilter("ignore", ErfaWarning)

    frames = [
        cf.CelestialFrame(reference_frame=coord.ICRS()),
        cf.CelestialFrame(reference_frame=coord.FK5(
            equinox=time.Time('2010-01-01'))),
        cf.CelestialFrame(reference_frame=coord.FK4(
            equinox=time.Time('2010-01-01'), obstime=time.Time('2015-01-01'))),
        cf.CelestialFrame(reference_frame=coord.FK4NoETerms(
            equinox=time.Time('2010-01-01'), obstime=time.Time('2015-01-01'))),
        cf.CelestialFrame(reference_frame=coord.Galactic()),
        cf.CelestialFrame(reference_frame=coord.Galactocentric(
            # A default galcen_coord is used since none is provided here
            galcen_distance=5.0 * u.m,
            z_sun=3 * u.pc,
            roll=3 * u.deg)),
        cf.CelestialFrame(
            reference_frame=coord.GCRS(obstime=time.Time('2010-01-01'),
                                       obsgeoloc=[1, 3, 2000] * u.pc,
                                       obsgeovel=[2, 1, 8] * (u.m / u.s))),
        cf.CelestialFrame(reference_frame=coord.CIRS(
            obstime=time.Time('2010-01-01'))),
        cf.CelestialFrame(reference_frame=coord.ITRS(
            obstime=time.Time('2022-01-03'))),
        cf.CelestialFrame(reference_frame=coord.PrecessedGeocentric(
            obstime=time.Time('2010-01-01'),
            obsgeoloc=[1, 3, 2000] * u.pc,
            obsgeovel=[2, 1, 8] * (u.m / u.s))),
        cf.StokesFrame(),
        cf.TemporalFrame(time.Time("2011-01-01"))
    ]

    return frames