Esempio n. 1
0
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
Esempio n. 2
0
 def testknownValues(self):
     for input, output in self.knownValues:
         result = coordinates.hmstora(*input)
         self.assertAlmostEqual(result, output)