Esempio n. 1
0
    def setup_class(self):
        # From t_ldn in t_erfa_c.c
        ldbody = np.array(
            [(0.00028574, 3e-10, ([-7.81014427, -5.60956681, -1.98079819],
                                  [0.0030723249, -0.00406995477, -0.00181335842])),
             (0.00095435, 3e-9, ([0.738098796, 4.63658692, 1.9693136],
                                 [-0.00755816922, 0.00126913722, 0.000727999001])),
             (1.0, 6e-6, ([-0.000712174377, -0.00230478303, -0.00105865966],
                          [6.29235213e-6, -3.30888387e-7, -2.96486623e-7]))],
            dtype=erfa_ufunc.dt_eraLDBODY)
        ldbody_unit = u.StructuredUnit('Msun,radian,(AU,AU/day)', ldbody.dtype)
        self.ldbody = ldbody << ldbody_unit
        self.ob = [-0.974170437, -0.2115201, -0.0917583114] << u.AU
        self.sc = np.array([-0.763276255, -0.608633767, -0.216735543])

        # From t_atciq in t_erfa_c.c
        astrom, eo = erfa_ufunc.apci13(2456165.5, 0.401182685)
        self.astrom_unit = u.StructuredUnit(
            'yr,AU,1,AU,1,1,1,rad,rad,rad,rad,1,1,1,rad,rad,rad',
            astrom.dtype)
        self.astrom = astrom << self.astrom_unit
        self.rc = 2.71 * u.rad
        self.dc = 0.174 * u.rad
        self.pr = 1e-5 * u.rad/u.year
        self.pd = 5e-6 * u.rad/u.year
        self.px = 0.1 * u.arcsec
        self.rv = 55.0 * u.km/u.s
Esempio n. 2
0
 def test_s2pv(self):
     theta, phi, r, td, pd, rd = erfa_ufunc.pv2s(self.pv)
     # On purpose change some of the units away from expected by s2pv.
     pv = erfa_ufunc.s2pv(theta.to(u.deg), phi, r.to(u.m),
                          td.to(u.deg/u.day), pd, rd.to(u.m/u.s))
     assert pv.unit == u.StructuredUnit('m, m/s', names=('p', 'v'))
     assert_quantity_allclose(pv['p'], self.pv['p'], atol=1*u.m, rtol=0)
     assert_quantity_allclose(pv['v'], self.pv['v'], atol=1*u.mm/u.s, rtol=0)
Esempio n. 3
0
 def test_pvtob(self):
     pv = erfa_ufunc.pvtob([90, 0]*u.deg, 0.*u.deg, 100*u.km,
                           0*u.deg, 0*u.deg, 0*u.deg, 90*u.deg)
     assert pv.unit == u.StructuredUnit('m, m/s', names=('p', 'v'))
     assert pv.unit['v'] == u.m / u.s
     assert_quantity_allclose(pv['p'], [[-6478, 0, 0], [0, 6478, 0]]*u.km,
                              atol=2*u.km)
     assert_quantity_allclose(pv['v'], [[0, -0.5, 0], [-0.5, 0, 0]]*u.km/u.s,
                              atol=0.1*u.km/u.s)
Esempio n. 4
0
 def test_sxpv(self):
     # Not a realistic example!!
     sxpv = erfa_ufunc.sxpv(10., self.pv)
     assert sxpv.unit == self.pv.unit
     assert_array_equal(sxpv['p'], self.pv['p']*10)
     assert_array_equal(sxpv['v'], self.pv['v']*10)
     sxpv2 = erfa_ufunc.sxpv(30.*u.s, self.pv)
     assert sxpv2.unit == u.StructuredUnit('AU s,AU s/d', names=('p', 'v'))
     assert_array_equal(sxpv2['p'], self.pv['p']*30*u.s)
     assert_array_equal(sxpv2['v'], self.pv['v']*30*u.s)
Esempio n. 5
0
 def test_s2xpv(self):
     # Not a realistic example!!
     s2xpv = erfa_ufunc.s2xpv(10., 1*u.s, self.pv)
     assert s2xpv.unit == u.StructuredUnit('AU,AU s/d', names=('p', 'v'))
     assert_array_equal(s2xpv['p'], self.pv['p']*10)
     assert_array_equal(s2xpv['v'], self.pv['v']*u.s)