dS = float(Dnoise[k][l]) dT = float(Dtemperr[k][l]) if S == 0: mass[k][l] = 0 masserr[k][l] = 0 if S != 0: mass[k][l] = massF(S,T,kappa,d,temp_mi) masserr[k][l] = mass_errF(S,T,dS,dT,temp_mi,temperr_mi) Imasserr.flush() Imass.flush() ###### #MASS# ###### #convert back to sdf ndf2fits.fits2ndf(massFITS) ndf2fits.fits2ndf(masserrFITS) mass = 'SMM/'+region+'/Mass'+str(I)+'.sdf' masserr ='SMM/'+region+'/masserr'+str(I)+'.sdf' #Extract TOTAL clump mass as number cmd = '%s/stats ndf=%s %s'%(kapdir,mass,'> /dev/null') os.system(cmd) cmd = '%s/parget parname=%s applic=%s'%(kapdir,'total','stats') status, output = commands.getstatusoutput(cmd) mi = float(output) del output #calculate frac error on the mass and find its mean value, on which the mean mass error is based. fracmass = 'SMM/'+region+'/temp/fracmass_clump'+str(I)+'.sdf' cmd = '%s/div in1=%s in2=%s out=%s'%(kapdir,masserr,mass,fracmass)
########### Bulk Code ############# #Method A = RUMBLE #Method B = CHEN inA_fits = 'PerseusWest_20150317-autotemperatureWCSALN_SMT.fits' errA_fits = 'PerseusWest_20150317-autotemp_errorWCSALN_SMT.fits' inB_fits = 'tempMap_Her+850_clean.fits' errB_fits = 'TempMapErr_Her+850_clean.fits' Beta_fits = 'betaMap_Her+850_clean.fits' errBeta_fits = 'betaMapErr_Her+850_clean.fits' inA = ndf2fits.fits2ndf(inA_fits) inB = ndf2fits.fits2ndf(inB_fits) errA = ndf2fits.fits2ndf(errA_fits) errB = ndf2fits.fits2ndf(errB_fits) k = 0 TA = [] TB = [] EA = [] EB = [] Beta = [] eBeta = [] count_lo = 0 count_hi = 0
for i in range(0, row): for j in range(0, column): T = float(temp_data[i][j]) S = float(s850_data[i][j]) Mass_data[i][j] = massF(S,T,kappa,d) Mass15_data[i][j] = massF(S,20,kappa,d) #if Mass[i][j] > 0: #print Mass[i][j] #output new values back to FITS file and save image_mass.flush() image_mass.close() image_mass15.flush() image_mass15.close() ndf2fits.fits2ndf(massFITS) ndf2fits.fits2ndf(mass15FITS) #CALCULATE Column density #Convert map of mass (in solar masses) into column density (in H2 cm-2) and Extinction (mag) M_x = 1.989E33 #g N = 1 au = 14959787100000 #cm m_h = 1.67262178E-24 #g mu = 2.8 #333 #ratio of H2 to He (Kauffmann et al. 2008) #pixel area A = ((((a*d)*au)**2.0)*N) #in cm^2 f = M_x/(mu*m_h*A) #column density per cm^2 mass = 'CDmaps/mass/'+region+'_mass.sdf'
# 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" sub = "%s/sub in1=%s in2=%s out=%s" % (kapdir, tempFF, temp, submap) os.system(sub) """ ################################ #### calculate columndensity ### #see run26 ################################ #deffine constants kappa = 0.012 #cm^2 g^-1 d = 500 #pc