def test_gcrs_itrs():
 (ra, dec, _) = randomly_sample_sphere(200)
 gcrs = GCRS(ra=ra, dec=dec, obstime=u'J2000')
 gcrs6 = GCRS(ra=ra, dec=dec, obstime=u'J2006')
 gcrs2 = gcrs.transform_to(ITRS).transform_to(gcrs)
 gcrs6_2 = gcrs6.transform_to(ITRS).transform_to(gcrs)
 assert_allclose(gcrs.ra, gcrs2.ra)
 assert_allclose(gcrs.dec, gcrs2.dec)
 assert (not allclose(gcrs.ra, gcrs6_2.ra))
 assert (not allclose(gcrs.dec, gcrs6_2.dec))
 gcrsc = gcrs.realize_frame(gcrs.data)
 gcrsc.representation = CartesianRepresentation
 gcrsc2 = gcrsc.transform_to(ITRS).transform_to(gcrsc)
 assert_allclose(gcrsc.spherical.lon.deg, gcrsc2.ra.deg)
 assert_allclose(gcrsc.spherical.lat, gcrsc2.dec)

def test_gcrs_itrs ( ) : ( ra , dec , _ ) = randomly_sample_sphere ( 200 ) gcrs = GCRS ( ra = ra , dec = dec , obstime = u'J2000' ) gcrs6 = GCRS ( ra = ra , dec = dec , obstime = u'J2006' ) gcrs2 = gcrs . transform_to ( ITRS ) . transform_to ( gcrs ) gcrs6_2 = gcrs6 . transform_to ( ITRS ) . transform_to ( gcrs ) assert_allclose ( gcrs . ra , gcrs2 . ra ) assert_allclose ( gcrs . dec , gcrs2 . dec ) assert ( not allclose ( gcrs . ra , gcrs6_2 . ra ) ) assert ( not allclose ( gcrs . dec , gcrs6_2 . dec ) ) gcrsc = gcrs . realize_frame ( gcrs . data ) gcrsc . representation = CartesianRepresentation gcrsc2 = gcrsc . transform_to ( ITRS ) . transform_to ( gcrsc ) assert_allclose ( gcrsc . spherical . lon . deg , gcrsc2 . ra . deg ) assert_allclose ( gcrsc . spherical . lat , gcrsc2 . dec )
check basic gcrs<->itrs transforms for round-tripping .