Exemplo n.º 1
0
    def test_astropy(self):
        utcd = now()
        obstime = time.Time(utcd, scale="utc")

        jd = JulianDay(utcd)

        self.assertAlmostEqual(obstime.jd, jd, 4)
Exemplo n.º 2
0
    def test_astropy(self):
        utcd = now()
        obstime = time.Time(utcd, scale='utc')

        jd = JulianDay(utcd)
        
        self.assertAlmostEqual(obstime.jd, jd, 4)
Exemplo n.º 3
0
    def test_solar_elevation(self):
        t = utc.now()
        s = sun.Sun()
        ra, decl = s.radec(t)

        el, az = Dunedin.equatorial_to_horizontal(t, ra, decl)
        el1, az1 = s.to_horizontal(Dunedin, t)
        self.assertAlmostEqual(el.to_degrees(), el1.to_degrees(), 5)
        self.assertAlmostEqual(az.to_degrees(), az1.to_degrees(), 5)
Exemplo n.º 4
0
    def test_solar_elevation(self):
        t = utc.now()
        s = sun.Sun()
        ra, decl = s.radec(t)

        el, az = Dunedin.equatorial_to_horizontal(t, ra, decl)
        el1, az1 = s.to_horizontal(Dunedin, t)
        self.assertAlmostEqual(el.to_degrees(), el1.to_degrees(), 5)
        self.assertAlmostEqual(az.to_degrees(), az1.to_degrees(), 5)
Exemplo n.º 5
0
 def test_uvw_90(self):
     a0 = Antenna(location.Dunedin, [0.0, 0.0, 0.0])
     a1 = Antenna(location.Dunedin, [0.0, 1.0, 0.0])
     el = angle.from_dms(0.0)
     az = angle.from_dms(0.0)
     utc_time = utc.now()
     ra, dec = location.Dunedin.horizontal_to_equatorial(utc_time, el, az)
     u, v, w = get_UVW(a0, a1, utc_time, ra, dec)
     self.assertAlmostEqual(u, 0.0)
     self.assertAlmostEqual(v, 0.0)
     self.assertAlmostEqual(w, -1.0)
Exemplo n.º 6
0
 def test_uvw(self):
     a0 = Antenna(location.Dunedin, [0.0, 0.0, 0.0])
     a1 = Antenna(location.Dunedin, [0.0, 1.0, 0.0])
     el = angle.from_dms(90.0)
     for az_deg in range(0, 360, 10):
         az = angle.from_dms(az_deg)
         utc_time = utc.now()
         ra, dec = location.Dunedin.horizontal_to_equatorial(
             utc_time, el, az)
         u, v, w = get_UVW(a0, a1, utc_time, ra, dec)
         self.assertAlmostEqual(u, 0.0)
         self.assertAlmostEqual(v, -1.0)
         self.assertAlmostEqual(w, 0.0)
Exemplo n.º 7
0
    def test_eci_to_ecef(self):
        utc_date = utc.now()
        n_tests = 50
        x_arr = np.random.rand(n_tests) * 12345e3
        y_arr = np.random.rand(n_tests) * 23456e3
        z_arr = np.random.rand(n_tests) * 12345e3

        for x_in, y_in, z_in in zip(x_arr, y_arr, z_arr):
            ecef = location.eci_to_ecef(utc_date, x_in, y_in, z_in)

            x, y, z = location.ecef_to_eci(utc_date, ecef[0], ecef[1], ecef[2])
            self.assertAlmostEqual(x_in, x)
            self.assertAlmostEqual(y_in, y)
            self.assertAlmostEqual(z_in, z)
Exemplo n.º 8
0
    def test_eci_to_ecef(self):
        utc_date = utc.now()
        n_tests = 50
        x_arr = np.random.rand(n_tests)*12345e3
        y_arr = np.random.rand(n_tests)*23456e3
        z_arr = np.random.rand(n_tests)*12345e3

        for x_in, y_in, z_in in zip(x_arr, y_arr, z_arr):
            ecef = location.eci_to_ecef(utc_date, x_in, y_in, z_in)

            x,y,z = location.ecef_to_eci(utc_date, ecef[0], ecef[1], ecef[2])
            self.assertAlmostEqual(x_in, x)
            self.assertAlmostEqual(y_in, y)
            self.assertAlmostEqual(z_in, z)
Exemplo n.º 9
0
    def test_horizontal_to_eci_and_back(self):
        
        n_tests = 50
        theta_arr = np.random.rand(n_tests)*np.pi/2
        phi_arr = np.random.rand(n_tests)*np.pi*2
        r = 1.3e7
        utc_date = utc.now()

        for theta, phi in zip(theta_arr, phi_arr):
            xi, yi, zi = Dunedin.horizontal_to_eci(r, angle.from_rad(theta), angle.from_rad(phi), utc_date)
            r2, theta2, phi2 = Dunedin.eci_to_horizontal(xi, yi, zi, utc_date)

            self.assertAlmostEqual(theta2.to_rad(), theta)
            self.assertAlmostEqual(phi2.to_rad(), phi)
            self.assertAlmostEqual(r2, r)
Exemplo n.º 10
0
    def test_horizontal_to_eci_and_back(self):

        n_tests = 50
        theta_arr = np.random.rand(n_tests) * np.pi / 2
        phi_arr = np.random.rand(n_tests) * np.pi * 2
        r = 1.3e7
        utc_date = utc.now()

        for theta, phi in zip(theta_arr, phi_arr):
            xi, yi, zi = Dunedin.horizontal_to_eci(r, angle.from_rad(theta),
                                                   angle.from_rad(phi),
                                                   utc_date)
            r2, theta2, phi2 = Dunedin.eci_to_horizontal(xi, yi, zi, utc_date)

            self.assertAlmostEqual(theta2.to_rad(), theta)
            self.assertAlmostEqual(phi2.to_rad(), phi)
            self.assertAlmostEqual(r2, r)
Exemplo n.º 11
0
    def test_horizontal_to_ecef_vs_astropy(self):
        loc = Dunedin

        n_tests = 50
        el_arr = np.random.rand(n_tests)*np.pi/2
        az_arr = np.random.rand(n_tests)*np.pi*2
        r_arr = np.random.rand(n_tests)*1e8

        utc_date = utc.now()

        for r, el, az in zip(r_arr, el_arr, az_arr):
            x,y,z = self.astropy_horizontal_to_ECEF(r, el, az, loc, utc_date)
            xi, yi, zi = Dunedin.horizontal_to_ecef(r, angle.from_dms(el), angle.from_dms(az))

            self.assertAlmostEqual(x/xi, 1.0, 3)
            self.assertAlmostEqual(y/yi, 1.0, 3)
            self.assertAlmostEqual(z/zi, 1.0, 3)
Exemplo n.º 12
0
    def test_horizontal_to_ecef_vs_astropy(self):
        loc = Dunedin

        n_tests = 50
        el_arr = np.random.rand(n_tests) * np.pi / 2
        az_arr = np.random.rand(n_tests) * np.pi * 2
        r_arr = np.random.rand(n_tests) * 1e8

        utc_date = utc.now()

        for r, el, az in zip(r_arr, el_arr, az_arr):
            x, y, z = self.astropy_horizontal_to_ECEF(r, el, az, loc, utc_date)
            xi, yi, zi = Dunedin.horizontal_to_ecef(r, angle.from_dms(el),
                                                    angle.from_dms(az))

            self.assertAlmostEqual(x / xi, 1.0, 3)
            self.assertAlmostEqual(y / yi, 1.0, 3)
            self.assertAlmostEqual(z / zi, 1.0, 3)
Exemplo n.º 13
0
 def test_now_horizontal(self):
     t = utc.now()
     s = Sun()
     el, az = s.to_horizontal(location.Dunedin, t)
     print("El %f    Az %f" % (el.to_degrees(), az.to_degrees()))
Exemplo n.º 14
0
 def test_now_horizontal(self):
   t = utc.now()
   s = Sun()
   el, az = s.to_horizontal(location.Dunedin, t)
   print "El %f  Az %f" % (el.to_degrees(), az.to_degrees())