In [ ]:
#%matplotlib nbagg
import matplotlib.pyplot as plt
import sys
import sygma as s
import numpy as np
print (s.global_path)
import matplotlib
%matplotlib inline
fign=0
In [ ]:
s1=s.sygma(iniZ=0.02,
#table='yield_tables/isotope_yield_table_MESA_only_fryer12_delay.txt',
stellar_param_table='yield_tables/stellar_feedback_nugrid_MESAonly.txt',
mgal=1.0,special_timesteps=200,dt=1e6,exclude_masses=[],stellar_param_on=True,
table='yield_tables/agb_and_massive_stars_nugrid_MESAonly_fryer12delay.txt',
sn1a_energy=1e51,nb_1a_per_m = 3.0e-3)
In [ ]:
fign = fign + 1
f, axarr = plt.subplots(2, 2,num=fign)
markevery=50
props = dict(boxstyle='square', facecolor='w', alpha=1)
for specie in ['Total','Ele','Ele_all','Iso_all']:
if specie=='Total':
plt.sca(axarr[0, 0])
if specie=='Ele':
plt.sca(axarr[0, 1])
elif specie=='Ele_all':
plt.sca(axarr[1, 0])
elif specie=='Iso_all':
plt.sca(axarr[1, 1])
ax=plt.gca()
if specie == 'Total':
markevery=8
s1.plot_totmasses(fig=fign,source='all',label='Total',markevery=markevery,color='k',marker='*')
s1.plot_totmasses(fig=fign,source='agb',markevery=markevery,color='r',marker='^')
s1.plot_totmasses(fig=fign,source='massive',markevery=markevery,color='r',marker='D')
s1.plot_totmasses(fig=fign,source='sn1a',markevery=markevery+5,color='b',marker='o')
leg=plt.legend(loc=4,fontsize=12)
leg.get_frame().set_edgecolor('k')
leg.get_frame().set_alpha(1.)
ax.get_xaxis().set_ticklabels([])
ax.set_xlabel('')
ax.set_yticks([1e-4,1e-2,1e0])
ax.set_ylim(1e-4,1e0)
ax.set_ylabel('')
elif specie == 'Ele':
markevery=50
#why was that commented???
s1.plot_mass(fig=fign,specie='C',source='all',label='C, Total',markevery=markevery,color='r',marker='^')
s1.plot_mass(fig=fign,specie='C',source='agb',label='C, AGB',markevery=markevery,color='g',marker='^',shape=':')
s1.plot_mass(fig=fign,specie='O',source='all',label='O, Total',markevery=markevery,color='b',marker='D')
s1.plot_mass(fig=fign,specie='O',source='massive',label='O, Massive',markevery=markevery,color='k',marker='D',shape=':')
s1.plot_mass(fig=fign,specie='Fe',source='all',label='Fe, Total',markevery=markevery+5,color='m',marker='o')
s1.plot_mass(fig=fign,specie='Fe',source='sn1a',markevery=markevery+5,label='Fe, SNIa',color='y',marker='o',shape=':')
leg=plt.legend(loc=4,fontsize=12)
leg.get_frame().set_edgecolor('k')
leg.get_frame().set_alpha(1.)
plt.ylim(1e-4,1e-2)
ax.get_xaxis().set_ticklabels([])
ax.set_xlabel('')
ax.set_ylabel('')
elif specie == 'Ele_all':
#s1.plot_mass(fig=fign,specie='C',source='all',markevery=markevery,color='r',marker='^')
#s1.plot_mass(fig=fign,specie='O',source='all',markevery=markevery,color='r',marker='D')
#s1.plot_mass(fig=fign,specie='Si',source='all',markevery=markevery+5,color='b',marker='o')
#s1.plot_mass(fig=fign,specie='Fe',source='all',markevery=markevery+5,color='g',marker='*')
s1.plot_mass(fig=fign,specie='C-12',source='all',markevery=markevery,color='r',marker='<',shape='-')
s1.plot_mass(fig=fign,specie='O-16',source='all',markevery=markevery,color='r',marker='s',shape='--')
s1.plot_mass(fig=fign,specie='Si-28',source='all',markevery=markevery+5,color='b',marker='x',shape='-.')
s1.plot_mass(fig=fign,specie='Fe-56',source='all',markevery=markevery+5,color='g',marker='^',shape=':')
leg=plt.legend(loc=4,fontsize=12)
leg.get_frame().set_edgecolor('k')
leg.get_frame().set_alpha(1.)
ax.set_yticks([1e-10,1e-8,1e-6,1e-4,1e-2])
plt.ylim(1e-5,1e-2)
ax.set_ylabel('')
ax.set_xlabel('SSP age [yr]', fontsize=15)
else:
s1.plot_mass(fig=fign,specie='Sr',source='all',markevery=markevery+5,color='m',marker='x')
s1.plot_mass(fig=fign,specie='Ba',source='all',markevery=markevery+5,color='grey',marker='<')
s1.plot_mass(fig=fign,specie='Pb',source='all',markevery=markevery+5,color='y',marker='*')
s1.plot_mass(fig=fign,specie='Sr-88',source='all',markevery=markevery+5,color='m',marker='D',shape='--')
s1.plot_mass(fig=fign,specie='Ba-138',source='all',markevery=markevery+5,color='grey',marker='o',shape='--')
s1.plot_mass(fig=fign,specie='Pb-208',source='all',markevery=markevery+5,color='y',marker='^',shape='--')
leg=plt.legend(loc=4,fontsize=12)
leg.get_frame().set_edgecolor('k')
leg.get_frame().set_alpha(1.)
ax.set_ylabel('')
ax.set_yticks([1e-10,1e-8,1e-6,1e-4,1e-2])
ax.set_xlabel('SSP age [yr]', fontsize=15)
plt.ylim(1e-10,1e-7)
plt.xlim(5e6,1e10)
#general settings
fig=plt.gcf()
fig.set_size_inches(20,10)
plt.subplots_adjust(hspace=0.1, bottom=0.225,wspace=0.15)
plt.subplots_adjust(hspace=0.1, bottom=0.225,wspace=0.15,left=0.1,right=0.9)
plt.subplots_adjust(hspace=0.1, bottom=0.125,wspace=0.2,left=0.1,right=0.9)
fig=plt.gcf()
fig.set_size_inches(14,10,forward=True)
fig.set_size_inches(12,10,forward=True)
fig.text(0.04, 0.65, r'Accumulated ejecta [M$_{\odot}$]', ha='center',rotation='vertical',fontsize=15)
matplotlib.rcParams.update({'font.size': 14})
In [ ]:
fign = fign + 1
fig=plt.figure(fign)
ax=plt.gca()
other='Mdot_wind' #s1.stellar_param_attrs
k=0
s1.plot_stellar_param(fig=fign,quantity=other,
label='10$^4$M$_{\odot}$ population',
marker='o',shape='-',color='b',markevery=10)
plt.xlabel('SSP age [yr]', fontsize=20)
plt.ylabel('Mass-loss rate [M$_{\odot}$ yr$^{-1}$]', fontsize=20)
plt.legend(loc=1,fontsize=14)
plt.xlim(1e7,1e10)
plt.ylim(1e-13,1e-8)
plt.legend().set_visible(False)
#style
fig.set_size_inches(8,5.6,forward=True)
ax.tick_params(length=6,width=2,which='both')
ax.tick_params(length=10,width=3,which='major')
plt.tight_layout(h_pad=1.,pad=1.)
matplotlib.rcParams.update({'font.size': 20})
In [ ]:
fign= fign + 1
fig=plt.figure(fign)
ax=plt.gca()
s1.plot_stellar_param(fig=fign,quantity='Ekindot_wind',
label='Wind',marker='o',shape='-',color='b',markevery=10)
s1.plot_stellar_param(fig=fign,quantity='CCSN energy',label='CCSN',
marker='x',shape='--',color='m',markevery=10)
s1.plot_stellar_param(fig=fign,quantity='SNIa energy',label='SNIa',
marker='^',shape=':',color='r',markevery=10)
plt.xlabel('SSP Age [yr]', fontsize=21)
#plt.ylabel('L$_{mech}$ [erg/s]')
plt.ylabel('Kinetic energy [erg s$^{-1}$]', fontsize=21)
plt.xlim(1e7,1e10)
plt.ylim(1e28,1e35)
ax.set_yticks([1e28,1e30,1e32,1e34])
leg=plt.legend(loc=1,fontsize=18)
leg.get_frame().set_edgecolor('k')
leg.get_frame().set_alpha(1.)
#style
fig.set_size_inches(8,5.6,forward=True)
ax.tick_params(length=6,width=2,which='both')
ax.tick_params(length=10,width=3,which='major')
plt.tight_layout(h_pad=1.,pad=0.3)
matplotlib.rcParams.update({'font.size': 21})
plt.xscale('log')
In [ ]:
fign = fign + 1
fig=plt.figure(fign)
ax=plt.gca()
s1.plot_stellar_param(fig=fign,quantity='L_tot',label='L$_{tot}$',
marker='o',shape='-',color='b',markevery=10)
s1.plot_stellar_param(fig=fign,quantity='[11.18, 13.6]',label='Lyman-Werner band', #label='11.18 - 13.6eV',
marker='s',shape='--',color='r',markevery=10)
s1.plot_stellar_param(fig=fign,quantity='[13.6, 24.6]',label='H-ionizing band', #label='13.6 - 24.6eV',
marker='^',shape='-.',color='g',markevery=10)
plt.xscale('log');plt.yscale('log')
leg=plt.legend(fontsize=17,loc=3, frameon=True)
plt.xlabel('SSP age [yr]', fontsize=21)
leg.get_frame().set_edgecolor('k')
leg.get_frame().set_alpha(1.)
#plt.ylabel('Luminosity [erg/s]')
plt.ylabel('Luminosity [erg s$^{-1}$]', fontsize=21)
plt.xlim(1e7,1e10)
plt.ylim(1e26,1e37)
ax.set_yticks([1e26,1e28,1e30,1e32,1e34,1e36])
#style
fig.set_size_inches(8,5.6,forward=True)
ax.tick_params(length=6,width=2,which='both')
ax.tick_params(length=10,width=3,which='major')
plt.tight_layout(h_pad=1.,pad=1.)
matplotlib.rcParams.update({'font.size': 21})
In [ ]: