Beispiel #1
0
 def testSanity(self):
     for h in range(0, 24):
         for m in range(0, 60):
             for s in range(0, 60):
                 ra = coordinates.dmstodec(h, m, s)
                 ch, cm, cs = coordinates.dectodms(ra)
                 self.assertEqual(h, ch)
                 self.assertEqual(m, cm)
                 self.assertAlmostEqual(s, cs)
Beispiel #2
0
 def testSanity(self):
     for d in range(-89, 90):
         for m in range(0, 60):
             for s in range(0, 60):
                 dec = coordinates.dmstodec(d, m, s)
                 cd, cm, cs = coordinates.dectodms(dec)
                 self.assertEqual(d, cd)
                 self.assertEqual(m, cm)
                 self.assertAlmostEqual(s, cs)
     dec = coordinates.dmstodec(90, 0, 0)
     cd, cm, cs = coordinates.dectodms(dec)
     self.assertEqual(90, cd)
     self.assertEqual(0, cm)
     self.assertAlmostEqual(0, cs)
     dec = coordinates.dmstodec(0, -30, 0)
     cd, cm, cs = coordinates.dectodms(dec)
     self.assertEqual(0, cd)
     self.assertEqual(-30, cm)
     self.assertAlmostEqual(0, cs)
Beispiel #3
0
def format_angle(value, format_type):
    if format_type == "time":
        h, m, s = ratohms(value)
        result = "%d:%d:%.1f" % (h, m, s)
    if format_type == "dms":
        d, m, s = dectodms(value)
        if d > 0:
            sign = '+'
        else:
            sign = '-'
        result = "%s%d:%d:%.1f" % (sign, d, m, s)
    return mark_safe(result)
Beispiel #4
0
def format_angle(value, format_type):
    if format_type == "time":
        h, m, s = ratohms(value)
        result = "%d:%d:%.1f" % (h, m, s)
    if format_type == "dms":
        d, m, s = dectodms(value)
        if d > 0:
            sign = '+'
        else:
            sign = '-'
        result = "%s%d:%d:%.1f" % (sign, d, m, s)
    return mark_safe(result)
Beispiel #5
0
 def testknownValues(self):
     for input, output in self.knownValues:
         result = coordinates.dectodms(input)
         self.assertEqual(result, output)