예제 #1
0
def coord(refmap,params):
    #takes input reference map (.sdf) and parameter file as produced by FellWalker) (.fit)
    data = pyfits.getdata(params)

    array = []

    i = 0
    for i in range(len(data)):

        ra = RaDecDegs.timeRa(data[i][1],'TRUE')
        dec = RaDecDegs.timeDec(data[i][2],'TRUE')
    
        coords = "%10.7f %s"%(ra, dec)
        cmd = stardir+"kappa/wcstran %s posin=\"\'%s\'\" framein=SKY frameout=PIXEL > /dev/null"%(refmap,coords)
        os.system(cmd)
        posout = (os.popen(stardir+"kappa/parget posout wcstran").readlines())
    #print posout[0]
        (pixx,pixy,junk) = re.split("\s+",posout[0],2)
    #print pixx, pixy

        #print 'Ra '+str(ra)+' and Dec '+ str(dec) +' are coordinates '+ str(pixx)+' and ' + str(pixy)
        
        array.append([pixx,pixy])
        i = i + 1
    return array
예제 #2
0
        Ji = jeans.sadavoy(temp_mi,d,Ni)
        err_Ji = Ji * (0.05) #frac. error in temp. 
        if float(Ji) == 0:
            equ = 0
        else:
            equ = float(m850i) / float(Ji)

    #Error in mass ratio:
        frac = ((dMi_850/float(m850i))**2.)+((err_Ji/float(Ji))**2.)
        err_R = equ * ((frac)**0.5)

    #Convert Ra/Dec from degrees to Time format.
        Ra = float(data[i-1][1])
        Dec = float(data[i-1][2])

        Ra_T = RaDecDegs.timeRa(Ra,'FALSE')
        Dec_T = RaDecDegs.timeDec(Dec,'FALSE')

    #Write to files
    #open files for appending
        SMM = open("SMM.txt","a")
        SMM_LTX = open("SMM_LTX.txt","a")

    #RAW data file
        SMM.write(str(i)+'\t')
        SMM.write(str(round(float(data[i-1][1]),2))+'\t')
        SMM.write(str(round(float(data[i-1][2]),4))+'\t')
        SMM.write(str(c450i)+'\t')
        SMM.write(str(c850i)+'\t')
        SMM.write(str(m450i)+'\t')
        SMM.write(str(m850i)+'\t')
예제 #3
0
        # Extract core mass as number
        cmd = "%s/stats ndf=%s %s" % (kapdir, m450, "> /dev/null")
        os.system(cmd)
        cmd = "%s/parget parname=%s applic=%s" % (kapdir, "total", "stats")
        status, output = commands.getstatusoutput(cmd)
        m450i = output
        cmd = "%s/stats ndf=%s %s" % (kapdir, m850, "> /dev/null")
        os.system(cmd)
        cmd = "%s/parget parname=%s applic=%s" % (kapdir, "total", "stats")
        status, output = commands.getstatusoutput(cmd)
        m850i = output
        print "mass of clump 850 =", m850i

        # Convert Ra/Dec from degrees to Time format.
        Ra = float(data[i - 1][1])
        Dec = float(data[i - 1][2])

        Ra_T = RaDecDegs.timeRa(Ra, "FALSE")
        Dec_T = RaDecDegs.timeDec(Dec, "FALSE")

        # Write to files #LaTex data file
        core_LTX.write(str(i) + "\t&\t")
        # core_LTX.write(Ra_T+'\t&\t')
        # core_LTX.write(Dec_T+'\t&\t')
        core_LTX.write(str(round(float(c450i), 1)) + "\t&\t")
        core_LTX.write(str(round(float(c850i), 2)) + "\t&\t")
        # core_LTX.write(str(round(float(m450i),1))+'('+str(round(float(dMi_450),1))+')\t&\t')
        core_LTX.write(str(round(float(m850i), 2)) + "(" + str(round(float(dMi_850), 2)) + ")\t&\t")
        core_LTX.write(str(round(float(temp_mi), 1)) + "(" + str(round(float(0.05 * temp_mi), 1)) + ") \n")