Example #1
0
    cmd = "%s/nomagic in=%s out=%s repval=%d %s" % (kapdir, thresh, magic, 0, "> /dev/null")
    os.system(cmd)
    ### recreate mask of clump i - mask0
    cmd = "%s/thresh in=%s out=%s thrlo=%d thrhi=%d newlo=%d newhi=%d %s" % (
        kapdir,
        magic,
        mask,
        0,
        0,
        0,
        1,
        "> /dev/null",
    )
    os.system(cmd)

    ndf2fits.ndf2fits(mask)

    Fig1.show_contour(maskFITS, levels=(0.5, 1000), linewidth=3, colors=("black"))
    Fig2.show_contour(maskFITS, levels=(0.5, 1000), linewidth=3, colors=("black"))
    Fig3.show_contour(maskFITS, levels=(0.5, 1000), linewidth=3, colors=("black"))

    cmd = "rm %s %s %s" % (thresh, mask, magic)
    os.system(cmd)

# PLOT FW contours
# OPEN up the region specific clump list
data = pyfits.open(clumpcatb)
DATA = data[1].data

for j in DATA:
    I = int(j[0])
Example #2
0
File: ARMM.py Project: DJRumble/PHD
def Z(CD): #OB star checking
    Fig = aplpy.FITSFigure(CD)
    Fig.show_colorscale(vmax=8.5E22,vmin=2.5E21, stretch='linear',cmap='afmhot_r')
    Fig.add_colorbar()
    Fig.colorbar.set_axis_label_text('Column Density (H$_{2}$ cm$^{-2}$)') 

    #Plot YSOs
    #YSO.c2dGBS_v2(Fig)

#PLOT FW contours
#OPEN up the region specific clump list

    clumpcat = '/data/damian/run31/FW/cat/OrionA_20150227_clump_cat.fit'
    clumps = '/data/damian/run31/FW/clumps/OrionA_20150227_clumps.sdf'

    data = pyfits.open(clumpcat)
    DATA = data[1].data

    for j in DATA:
        I = int(j[0])
        print str(I)+'/'+str(len(DATA))
    ### SETUP temp. file names
        thresh = '/data/damian/run31/mask/thresh'+str(I)+'.sdf'
        mask = '/data/damian/run31/mask/mask_'+str(I)+'.sdf'
        maskFITS = '/data/damian/run31/mask/mask_'+str(I)+'.fits'
        magic = '/data/damian/run31/mask/magic'+str(I)+'.sdf'

    ### isolate clump i ###
        cmd = '%s/thresh in=%s out=%s thrlo=%d thrhi=%d newlo=%s newhi=%s %s'%(kapdir,clumps,thresh,I,I,'bad','bad','> /dev/null')
        os.system(cmd)
    ### process 2 - remove 0value data
        cmd = '%s/nomagic in=%s out=%s repval=%d %s'%(kapdir,thresh,magic,0,'> /dev/null')
        os.system(cmd)
    ### recreate mask of clump i - mask0
        cmd = '%s/thresh in=%s out=%s thrlo=%d thrhi=%d newlo=%d newhi=%d %s'%(kapdir,magic,mask,0,0,0,1,'> /dev/null')
        os.system(cmd)
        
        ndf2fits.ndf2fits(mask)

        Fig.show_contour(maskFITS, levels=(0.5,1000), linewidth=3, colors=('black'))

        cmd = 'rm %s %s %s'%(thresh,mask,magic)
        os.system(cmd)

    #Deffine OB star data
    data1 = np.loadtxt('/data/damian/run27/OBstars_list.txt')
    RA_OB = data1[:,0]	
    DEC_OB = data1[:,1]

    data2 = np.loadtxt('/data/damian/run27/OBstars.txt',dtype='string')
    RA_OBx = map(float, data2[:,2])	
    DEC_OBx = map(float, data2[:,3])

    data1 = np.loadtxt('/data/damian/data/OBstars/obcatalog_deg.txt')
    RA_OB_R = data1[:,0]	
    DEC_OB_R = data1[:,1]


    Fig.show_markers(RA_OB,DEC_OB, edgecolor='k', facecolor='none', marker='*',s=100, alpha=1)
    Fig.show_markers(RA_OBx,DEC_OBx, edgecolor='k', facecolor='cyan', marker='*',s=100, alpha=1)
    Fig.show_markers(RA_OB_R,DEC_OB_R, edgecolor='r', facecolor='none', marker='*',s=100, alpha=1)
    
    Fig.tick_labels.set_xformat('hh:mm:ss')

    return
Example #3
0
    p = PARGET(YSO,'fpixscale','ndftrace')
    smooth = sig/p[0]
    
    cmd = '%s/gausmooth in=%s fwhm=%f out=%s'%(kapdir,YSO,smooth,YSOsurface)
    os.system(cmd)
    cmd = '%s/gausmooth in=%s fwhm=%f out=%s'%(kapdir,proto,smooth,protosurface)
    os.system(cmd)
    cmd = '%s/gausmooth in=%s fwhm=%f out=%s'%(kapdir,PMS,smooth,PMSsurface)
    os.system(cmd)

    #scale up units 
    scale850 = 18909
    cmult = '%s/cmult in=%s scalar=%s out=%s'%(kapdir,YSOsurface,scale850,YSOsurfaceunits)
    os.system(cmult)
    cmult = '%s/cmult in=%s scalar=%s out=%s'%(kapdir,protosurface,scale850,protosurfaceunits)
    os.system(cmult)
    cmult = '%s/cmult in=%s scalar=%s out=%s'%(kapdir,PMSsurface,scale850,PMSsurfaceunits)
    os.system(cmult)

    #convert to fits file
    ndf2fits.ndf2fits(PMSsurfaceunits)
    ndf2fits.ndf2fits(protosurfaceunits)
    ndf2fits.ndf2fits(YSOsurfaceunits)
    #print surfaceunits
    
    #clean up
    cmd1 = 'rm  YSO/temp/*'
    os.system(cmd1)

    break
Example #4
0
    elif '450' in myfile:
        print "=============="
        print '450 micron map'
        print myfile
        p450 = PARGET(myfile,'fpixscale','ndftrace')
    #p850 = PARGET(input_dir+'/'+file850+'.sdf','fpixscale','ndftrace')
        print "Pixel sizes are "+str(p450[0])
        p450 = p450[0]
        cunits = (p450**2.)/1000

    old_units = '.sdf'
    nu_units = 'Jypix.sdf'
    col_units = 'Jypix_col.sdf'

    prefix = string.split(myfile,old_units)[0]
    print 'Converting %s to %s...'%(old_units,nu_units)

    nu_file = prefix+nu_units
    nu_2dfile = prefix+col_units

    cmd = '%s/cmult in=%s scalar=%f out=%s QUIET'%(kapdir,myfile,cunits,nu_file)
    os.system(cmd)

    cmd = '%s/setunits ndf=%s units=%s'%(kapdir,nu_file,'Jy/pix')
    os.system(cmd)

    cmd = '%s/collapse in=%s out=%s axis=%s'%(kapdir,nu_file,nu_2dfile,3)
    os.system(cmd)
    
    ndf2fits.ndf2fits(nu_2dfile)
Example #5
0
        ##############################
        #### CALCULATE PROPERTIES ####
        ##############################
        #use NOMAGIC to remove the blanks
        nm850 = 'SMM/'+region+'/temp/s850_NMclump'+str(I)+'.sdf'
        nmtemp = 'SMM/'+region+'/temp/temp_NMclump'+str(I)+'.sdf'
        nmtemp_err = 'SMM/'+region+'/temp/temp_NMclump_err'+str(I)+'.sdf'
        nnoise = 'SMM/'+region+'/temp/s850noiseNM'+str(I)+'.sdf'
        nomagic(c850,nm850)
        nomagic(cnoise,nnoise)
        nomagic(THtemp,nmtemp)
        nomagic(THtemp_err,nmtemp_err)

        #from individual clump maps
        ndf2fits.ndf2fits(nm850)
        ndf2fits.ndf2fits(nnoise)
        ndf2fits.ndf2fits(nmtemp)
        ndf2fits.ndf2fits(nmtemp_err)      
        #deffine FITS files
        #existing files#
        nm850FITS = 'SMM/'+region+'/temp/s850_NMclump'+str(I)+'.fits'
        cnoise = 'SMM/'+region+'/temp/s850noiseNM'+str(I)+'.fits'
        nmtempFITS = 'SMM/'+region+'/temp/temp_NMclump'+str(I)+'.fits'
        nmtempFITS_err = 'SMM/'+region+'/temp/temp_NMclump_err'+str(I)+'.fits'
        #new files#
        massFITS = 'SMM/'+region+'/Mass'+str(I)+'.fits'
        masserrFITS = 'SMM/'+region+'/masserr'+str(I)+'.fits'

        #copy existing clump file to act as a base on to which calculations will be writen.
        copy(cnoise,massFITS)
Example #6
0
import ndf2fits
import numpy as np 

data = np.loadtxt('maps.txt',dtype='string')

for i in data:
    ndf2fits.ndf2fits(i)
Example #7
0
for i in maps:
    #Make directory
    if not os.path.exists('CDmaps/CDpart'):
        os.makedirs('CDmaps/CDpart')

    #split INPUT file
    s850,temp,dtemp,alpha,proto,YSO,clumps,clumpcat = string.split(i,',')
    prefix1 = string.split(s850,'.sdf')[0]
    prefix2 = string.split(temp,'.sdf')[0]
    file = string.split(prefix1,'/')[0]
    #deffine region name
    name = string.split(clumps,'/')[2]
    region = string.split(name,'_2')[0]

    #Convert maps to fits
    ndf2fits.ndf2fits(s850)
    ndf2fits.ndf2fits(temp)
    s850FITS = prefix1+'.fits'
    tempFITS = prefix2+'.fits'
    massFITS = 'CDmaps/mass/'+region+'_mass.fits'
    mass15FITS = 'CDmaps/mass/'+region+'_mass15K.fits'

    #print massFITS
    print temp

    cmd = 'cp %s %s'%(s850FITS,massFITS)
    os.system(cmd)
    cmd = 'cp %s %s'%(s850FITS,mass15FITS)
    os.system(cmd)

    #Open files
Example #8
0
        ##############################
        #### CALCULATE PROPERTIES ####
        ##############################
        #use NOMAGIC to remove the blanks
        nm850 = 'SMM/'+region+'/temp/s850_NMclump'+str(I)+'.sdf'
        nmtemp = 'SMM/'+region+'/temp/temp_NMclump'+str(I)+'.sdf'
        nmtemp_err = 'SMM/'+region+'/temp/temp_NMclump_err'+str(I)+'.sdf'
        nnoise = 'SMM/'+region+'/temp/s850noiseNM'+str(I)+'.sdf'
        nomagic(c850,nm850)
        nomagic(cnoise,nnoise)
        nomagic(THtemp,nmtemp)
        nomagic(THtemp_err,nmtemp_err)

        #from individual clump maps
        nm850FITS =ndf2fits.ndf2fits(nm850)
        cnoise = ndf2fits.ndf2fits(nnoise)
        nmtempFITS =ndf2fits.ndf2fits(nmtemp)
        nmtempFITS_err = ndf2fits.ndf2fits(nmtemp_err)      
        #deffine FITS files
        #existing files#
        #nm850FITS = 'SMM/'+region+'/temp/s850_NMclump'+str(I)+'.fits'
        #cnoise = 'SMM/'+region+'/temp/s850noiseNM'+str(I)+'.fits'
        #nmtempFITS = 'SMM/'+region+'/temp/temp_NMclump'+str(I)+'.fits'
        #nmtempFITS_err = 'SMM/'+region+'/temp/temp_NMclump_err'+str(I)+'.fits'
        #new files#
        massFITS = 'SMM/'+region+'/temp/Mass'+str(I)+'.fits'
        masserrFITS = 'SMM/'+region+'/temp/masserr'+str(I)+'.fits'

        #copy existing clump file to act as a base on to which calculations will be writ
        copy(cnoise,massFITS)
Example #9
0
# all free-free
mask1 = "%s/mult in1=%s in2=%s out=%s" % (kapdir, sub450, mask, mask450FF)
mask2 = "%s/mult in1=%s in2=%s out=%s" % (kapdir, sub850, mask, mask850FF)
os.system(mask1)
os.system(mask2)

############################
# make ratio and temp maps
# original
div1 = "%s/div in1=%s in2=%s out=%s" % (kapdir, mask450, mask850, ratio)
os.system(div1)
# freefree
div2 = "%s/div in1=%s in2=%s out=%s" % (kapdir, mask450FF, mask850FF, ratioFF)
os.system(div2)

ndf2fits.ndf2fits(ratio)
ndf2fits.ndf2fits(ratioFF)

temperature(ratio, ratio_fits, ratio_fits, 1.8, "FALSE")
temperature(ratioFF, ratioFF_fits, ratioFF_fits, 1.8, "FALSE")

mv1 = "mv %s %s" % (ratio_fits, temp_fits)
mv2 = "mv %s %s" % (ratioFF_fits, tempFF_fits)
os.system(mv1)
os.system(mv2)

ndf2fits.fits2ndf(temp_fits)
ndf2fits.fits2ndf(tempFF_fits)

# compare temp maps
submap = "maps/s21/submap.sdf"
Example #10
0
#all free-free
mask1 = '%s/mult in1=%s in2=%s out=%s'%(kapdir,sub450,mask,mask450FF)
mask2 = '%s/mult in1=%s in2=%s out=%s'%(kapdir,sub850,mask,mask850FF)
os.system(mask1)
os.system(mask2)

############################
#make ratio and temp maps 
#original
div1 = '%s/div in1=%s in2=%s out=%s'%(kapdir,mask450,mask850,ratio)
os.system(div1)
#freefree
div2 = '%s/div in1=%s in2=%s out=%s'%(kapdir,mask450FF,mask850FF,ratioFF)
os.system(div2)

ndf2fits.ndf2fits(ratio)
ndf2fits.ndf2fits(ratioFF)

temperature(ratio,ratio_fits,ratio_fits,1.8,'FALSE')
temperature(ratioFF,ratioFF_fits,ratioFF_fits,1.8,'FALSE')

mv1 = 'mv %s %s'%(ratio_fits,temp_fits)
mv2 = 'mv %s %s'%(ratioFF_fits,tempFF_fits)
os.system(mv1)
os.system(mv2)

ndf2fits.fits2ndf(temp_fits)
ndf2fits.fits2ndf(tempFF_fits)

#compare temp maps
submap = 'maps/s21/submap.sdf'