In [85]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from astropy import units as u
from onezone.constants import CONST as const
In [86]:
def SNII_luminosity(x, dt):
return 1.0E51 * x / dt
In [94]:
def cumulative_to_rate(x):
rate = np.zeros(np.shape(x))
rate[0] = 0.0
rate[1:] = x[1:] - x[0:-1]
return rate
In [95]:
#
# Load the summary output file
#
data = np.genfromtxt('summary_output.txt', names=True)
# all information
print data.dtype.names
In [96]:
nsnII = data['N_SNIa']
print nsnII
print cumulative_to_rate(nsnII)
In [97]:
print "Final time = %.5f Myr"%(data['t'][-1])
print "M_gas = %5.5E"%(data['M_gas'][-1])
print "M_star = %5.5E"%(data['M_star'][-1])
print "N_star = %8i"%(data['N_star'][-1])
print 'N_SNII %4i'%(data['N_SNII'][-1])
print 'N_SNIa %4i'%(data['N_SNIa'][-1])
In [98]:
#
# Lets plot cumulative SF
#
plt.plot(data['t'], data['M_star'], lw = 3, color ='black')
plt.xlabel('time (Myr)')
plt.ylabel('Total Mass of Stars (Msun)')
# constant SFR... not surprising
Out[98]:
In [99]:
nsnII = data['N_SNIa']
dNsnII_dt = cumulative_to_rate(nsnII)
L_SNII = SNII_luminosity(dNsnII_dt, 0.5 * 1.0E6 * const.yr_to_s)
In [100]:
#
# Lets plot the luminosities
#
plt.plot(data['t'], data['L_Q0'], label = 'L_H', lw = 3, color = 'red')
plt.plot(data['t'], data['L_Q1'], label = 'L_He', lw = 3, color = 'red', ls = ':')
plt.plot(data['t'], data['L_FUV'], label = 'L_FUV', lw = 3, color = 'red', ls = '-.')
plt.plot(data['t'], data['L_wind'], label = 'L_wind', lw = 3, color = 'black', ls = '-')
plt.plot(data['t'], L_SNII, label='L_SNII'
plt.xlabel('Time (Myr)')
plt.ylabel('Luminosity (erg/s)')
plt.semilogy()
plt.legend(loc='best')
Out[100]:
In [62]:
(1.0 * u.AU).to(u.pc)
Out[62]:
In [ ]:
In [ ]: