コード例 #1
0
ファイル: calc-mean-ne.py プロジェクト: hgsteggles/Torch
def calc_ne(mass, size):
	nh = nhs[args.iden]
	logQ = logQ_interp(mass)
	stro = koo.calcStromgrenRadius(logQ, nh)
	radius = 0.5 * size * PC2CM
	ne = nh * (stro / radius)**(1.5)

	return ne
コード例 #2
0
ファイル: calc-stag-time.py プロジェクト: hgsteggles/Torch
def calcStagnationTime(logQ, nh):
	ci = koo.soundSpeed(8000.0, 0.5)
	co = koo.soundSpeed(10.0, 1.0)
	cico = ci / co

	RS = koo.calcStromgrenRadius(logQ, nh)
	ts = RS / ci

	return (4.0 / 7.0) * ((3.0 / 4.0)**0.5) * (((4.0 / 3.0)**(7.0 / 6.0)) * (cico**(7.0 / 3.0)) - 1.0) * ts
コード例 #3
0
ファイル: select-ben.py プロジェクト: hgsteggles/Torch
casa_ang_size = np.zeros(nstars, dtype=float)
tot_flux = np.zeros(nstars, dtype=float)
casa_tot_flux = np.zeros(nstars, dtype=float)
casa_peak_flux = np.zeros(nstars, dtype=float)
g_long = star_data[:,15]
g_lat = star_data[:,16]

for i in range(1, nstars + 1):
	t = age[i - 1] * 1000.0 * YR2S
	m = mcur[i - 1]
	nh = nhs[args.iden]
	logQ = float(logQ_interp(m))
	#dsun = d_sun[i - 1] * 1000.0 * PC2CM
	dsun = 5.0 * 1000.0 * PC2CM

	stro = koo.calcStromgrenRadius(logQ, nh)
	raga = koo.calcSpitzerRadius(logQ, nh, t)
	stag = koo.calcStagnationRadius(logQ, nh)
	#radius = np.minimum(raga, stag)
	radius = raga

	angsize_rad = (2.0 * radius / dsun)
	angsize_as = angsize_rad * 60.0 * 60.0 * 180.0 / math.pi
	ne = nh * (stro / radius)**(1.5)
	T = 8000.0
	f = 5.0e9
	tau = calcTau(T, f, ne, logQ)
	B = calcPlanck2(T, f) * 1.0e26
	S = B * (1.0 - math.exp(-tau))
	F = S * (0.5 * angsize_rad)**2 * 1000
コード例 #4
0
ファイル: param-table.py プロジェクト: hgsteggles/Torch
	r = "{:4.2f}".format(rstar[j])
	l = "{:4.2f}".format(logL[j])
	q = "{:4.2f}".format(logQ[j])
	ed = "{:4.2e}".format(0.5 * mdot[j] * vinf[j] * vinf[j]) # erg.s-1
	md = "{:8.2e}".format(mdot[j] / 6.341958397e25) # [Msun.yr-1]
	v = "{:8.2e}".format(vinf[j] / 100000.0) # [km.s-1]

	print m + " & " + t + " & " + r + " & " + l + " & " + q + " & " + ed + " & " + md \
			  + " & " + v + " \\\\"

for i in range(len(den)):
	for j in range(len(mass)):
		index = 9*i + j
		m = "{:3d}".format(int(mass[j]))
		d = "{:8.2e}".format(den[i])
		ysc = "{:4.3f}".format(koo.calcStromgrenRadius(logQ[j], den[i]) / cloud_dist)
		nx = str(nxs[index])
		ny = str(nys[index])
		nxny = "{($" + nx + "$,$" + ny + "$)}"
		sizex = "{:3.2f}".format(sizexs[index] / 3.09e18)
		r_inj = 10.0 * sizexs[index] / nxs[index]
		lcrit = "{:4.3e}".format(critL2(r_inj, vinf[j]))
		tstart = "{:4.3f}".format(koo.calcStartTime(mdot[j], vinf[j], mh*den[i], 8000.0, 0.5, r_inj) * S2YR / 1000.0)
		tcoolval = coolTime(mp1_data.central_pressures[index], mp1_data.central_densities[index]) * S2YR / 1000.0
		tcool = "{:4.3e}".format(tcoolval)
		texitval = exitTime(r_inj, vinf[j]) * S2YR / 1000.0
		texit = "{:4.3f}".format(texitval)
		R_inj = "{:4.3f}".format(r_inj * CM2PC)
		ri = "{:8d}".format((int)(-tcoolval / texitval))

		print m + " & " + d + " & " + nx + " & " + ny + " & " + sizex + " & " + ysc + " & " + R_inj + " & " + tstart + " & " + tcool + " \\\\"
コード例 #5
0
ファイル: size-calc.py プロジェクト: hgsteggles/Torch
def printPaperTable(r, t, b, isWind, isMVD):
	T = 8000.0
	mu = 0.5

	diststr = "D_\\mathrm{s}" if isWind else "D_\\mathrm{i}"
	numstr = "4" if isWind else "4"

	for row in range(9):
		mass = massList[row]
		mdot = mdotList[row]
		vinf = vinfList[row]
		logQ = logQList[row]
		nhs_hii = mvd_iden if isMVD else  mvt_iden
		times = mvd_times if isMVD else mvt_times
		nhs_init = mvd_nhs if isMVD else mvt_nhs
		inj = mvd_inj if isMVD else mvt_inj

		tableline = "\multirow{" + numstr + "}{*}{\\num{" + str(mass) + "}} & {$" + diststr + "(0)$}"
		for col in range(5):
			tableline = tableline + " & "
			tableline = tableline + str(t[col][row])
		print tableline + " \\\\"

		tableline =  "& {$" + diststr + "(\\frac{\\pi}{2})$}"
		for col in range(5):
			tableline = tableline + " & "
			tableline = tableline + str(r[col][row])
		print tableline + " \\\\"

		tableline = "& {$" + diststr + "(\\pi)$}"
		for col in range(5):
			tableline = tableline + " & "
			tableline = tableline + str(b[col][row])
		print tableline + " \\\\"

		if isWind:
			tableline = "& {$R_\\mathrm{P}$}"
			for col in range(5):
				tableline = tableline + " & "
				R = koo.calcFinalRadiusRB(mdot, vinf, mh*nhs_hii[col][row], T, mu) * CM2PC
				tableline = tableline + str(R)
			print tableline + " \\\\"
		else:
			tableline = "& {$R_\\mathrm{raga-1}$}"
			for col in range(5):
				tableline = tableline + " & "
				R = koo.calcStromgrenRadius(logQ, nhs_init[col])
				#R = max(R, inj[col][row] / CM2PC)
				R = koo.calcSpitzerRadius2(R, times[col]*YR2S)*CM2PC
				R = koo.calcExactIF(300.0, T, 1.0, mu, nhs_init[col], 10.0**logQ,
									times[col] * YR2S, is_spitzer=True) * CM2PC
				tableline = tableline + str(R)
			print tableline + " \\\\"

			#tableline = "& {$R_\\mathrm{stag}$}"
			#for col in range(5):
			#	tableline = tableline + " & "
			#	R = koo.calcStromgrenRadius(logQ, nhs_init[col])
			#	#R = max(R, inj[col][row] / CM2PC)
			#	R = koo.calcStagnationRadius2(R) * CM2PC
			#	tableline = tableline + str(R)
			#print tableline + " \\\\"

		if row != 8:
			print "& & & & & & \\\\"
コード例 #6
0
ファイル: size-calc.py プロジェクト: hgsteggles/Torch
#mvd_iden.append([610.0,   480.0,  650.0,  900.0, 1300.0, 1800.0, 2200.0, 2400.0,  2700.0])
#mvd_iden.append([800.0,   900.0, 1000.0, 1400.0, 2100.0, 2500.0, 3000.0, 5000.0,  5000.0])
#mvd_iden.append([2000.0, 2200.0, 2200.0, 2400.0, 3000.0, 4500.0, 5500.0, 7000.0, 12000.0])

#mvt_iden = []
#mvt_iden.append([520.0, 620.0, 1000.0, 1700.0, 2600.0, 4500.0, 6500.0, 9000.0, 12000.0])
#mvt_iden.append([620.0, 520.0,  750.0, 1000.0, 1600.0, 2400.0, 2500.0, 5000.0,  8000.0])
#mvt_iden.append([580.0, 520.0,  600.0,  800.0, 1400.0, 1800.0, 1900.0, 2500.0,  3000.0])
#mvt_iden.append([520.0, 550.0,  550.0,  700.0, 1100.0, 1300.0, 1500.0, 1700.0,  1800.0])
#mvt_iden.append([520.0, 540.0,  520.0,  620.0,  850.0, 1200.0, 1300.0, 1400.0,  1500.0])

mvd_iden = []
for i in range(5):
	arr = []
	for j in range(9):
		R_strom = koo.calcStromgrenRadius(logQList[j], mvd_nhs[i]) * CM2PC
		#R_strom = max(R_strom, mvd_inj[i][j])
		arr.append(mvd_nhs[i] * math.pow(R_strom / mvd_IF_r[i][j], 1.5))
	mvd_iden.append(arr)

mvt_iden = []
for i in range(5):
	arr = []
	for j in range(9):
		R_strom = koo.calcStromgrenRadius(logQList[j], mvt_nhs[i]) * CM2PC
		#R_strom = max(R_strom, mvt_inj[i][j])
		arr.append(mvt_nhs[i] * math.pow(R_strom / mvt_IF_r[i][j], 1.5))
	mvt_iden.append(arr)


if print_sizes: