Exemplo n.º 1
0
 def test_precision_and_wrap(self):
     """Check that the precision in the output fits within allowed space and values to round to 60s"""
     target_name = "test"
     coordinate = coordinates.SkyCoord("11:59:59.9999999999 -10:00:59.9999999999",
                                       unit=(units.hour, units.degree),
                                       obstime=Time("2000-01-01 10:00:00", scale='utc'))
     et = ephem_target.EphemTarget(target_name)
     et.append(coordinate)
     line = et.doc.getElementsByTagName("CSV")[0].firstChild.wholeText.split('\n')[-2]
     values = line.split('|')
     self.assertEqual(len(values), 4)
     self.assertEqual(values[1], "12:00:00.00")
     self.assertEqual(values[2], "-10:01:00.0")
Exemplo n.º 2
0
    def test_file_write(self):
        """Check that we are writing the file."""

        et = ephem_target.EphemTarget("")
        coordinate = coordinates.ICRSCoordinates(
            "01:27:30.26 +13:40:30.60",
            unit=(units.hour, units.degree),
            obstime=Time("2014-12-28 09:59:59", scale='utc'))
        et.append(coordinate)
        coordinate = coordinates.ICRSCoordinates(
            "01:27:29.39 +13:40:20.90",
            unit=(units.hour, units.degree),
            obstime=Time("2014-12-29 09:59:59", scale='utc'))
        et.append(coordinate)
        f_handle = cStringIO.StringIO()
        et.writer(f_handle)
        f_handle.seek(0)
        f_handle.close()
Exemplo n.º 3
0
    def test_file_write(self):
        """Check that we are writing the file."""

        et = ephem_target.EphemTarget("Test")
        coordinate = coordinates.SkyCoord("01:27:30.26 +13:40:30.60",
                                          unit=(units.hour, units.degree),
                                          obstime=Time("2014-12-28 09:59:59", scale='utc'))
        et.append(coordinate)
        # coordinate = coordinates.SkyCoord("01:27:29.39 +13:40:20.90",
        #                                   unit=(units.hour, units.degree),
        #                                   obstime=Time("2014-12-29 09:59:59", scale='utc'))
        # et.append(coordinate)
        print et.coordinates
        f_handle = cStringIO.StringIO()
        et.writer(f_handle)
        f_handle.seek(0)
        self.assertEqual(f_handle.read(), example_file)
        f_handle.close()
Exemplo n.º 4
0
 def test_create(self):
     """Make sure we can build an object with just a name."""
     target_name = "test"
     et = ephem_target.EphemTarget(target_name)
     self.assertIn(target_name, et.name)