예제 #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)
예제 #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)
예제 #3
0
파일: tools.py 프로젝트: AntoniaR/scripts
def extract_sky(vlss_sources,restfrq,frq):
    srcs_vlss=[]
    for a in vlss_sources:
        nums=a.split(', ')
        dec=nums[3]
        dec=dec.replace('.',':', 2)
        position= nums[2] + ' ' + dec
        f=nums[9].split('[')
        A1 = float(f[1].split(']')[0])
        A2 = 0
        if len(nums)>10 and ']' in nums[10]: A2 = float(nums[10].split(']')[0])
        if A2 == 0:
            new=float(nums[4])*(np.power(restfrq,A1))/(np.power(float(frq),A1))
        else:
            new=float(nums[4])*((np.power(restfrq,A1))+(np.power((restfrq*restfrq),A2)))/((np.power(float(frq),A1))+(np.power((float(frq)*float(frq)),A2)))
        ra_tmp = nums[2].split(':')
        dec_tmp = dec.split(':')
        # Fix for rounding errors in the gsm.py skymodel which give the number of seconds as 60.
        if int(float(dec_tmp[2])) == 60:
            dec_tmp[2]=59.999
        if int(float(ra_tmp[2])) == 60:
            ra_tmp[2]=59.999
        position = [coords.hmstora(int(float(ra_tmp[0])),int(float(ra_tmp[1])),int(float(ra_tmp[2]))), coords.dmstodec(int(float(dec_tmp[0])),int(float(dec_tmp[1])),int(float(dec_tmp[2])))]
        srcs_vlss.append([position,new])
    return srcs_vlss
예제 #4
0
 def testknownValues(self):
     for input, output in self.knownValues:
         result = coordinates.dmstodec(*input)
         self.assertAlmostEqual(result, output)