def ColumnD(S,T,kappa,a,d): """Takes inputs of; Flux (S in Jk), Temperature (T in Kelvin), oppacity (kappa in g cm-2), Number of pixels in distance (d in pcs)""" #constants au = 149597871000 #m M_x = 1.989E30 #kg m_h2 = 3.34745E-24 #g mu = 2.333333 #ratio of H2 to He (5:1) N = 1 #each pixel has an area in SI units and each apature contains N pixels A = ((((a*d)*au)**2.0)*N)*10000 #in cm M = mass.djr(S,T,kappa,d) m = M*M_x*1000.0 #A = 1 density in g per pixel n = m/(mu*m_h2*A) #column density per cm^2 N = m/A #density in g per cm^2 #print 'mass per pixel in solar masses:', M #print 'column density of apature in per cm^2:', n #print 'density of apature in g per cm^2:', N return N
dMi_450 = mass_err(c450i,temp_mi,0.3) dMi_850 = mass_err(c850i,temp_mi,0.02) #Extract clump mass as number cmd = '%s/stats ndf=%s %s'%(kapdir,mass450,'> /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,mass850,'> /dev/null') os.system(cmd) cmd = '%s/parget parname=%s applic=%s'%(kapdir,'total','stats') status, output = commands.getstatusoutput(cmd) m850i = output print '850 mass by mean = ',mass.djr(float(c850i),float(temp_mi),kappa_4,d) print '850 mass by pixel = ',m850i #Run Stats and extract NUMBER of pixels cmd = '%s/stats ndf=%s %s'%(kapdir,magic,'> /dev/null') os.system(cmd) cmd = '%s/parget parname=%s applic=%s'%(kapdir,'numgood','stats') status, output = commands.getstatusoutput(cmd) Ni = output #Calculate effetive radii and append to file Ni = float(Ni) xxyy = a*d*(au/psc) A = Ni*(xxyy**2.0) ri = (A**0.5)/pi