In [1]:
%pylab inline
In [2]:
from Chempy.parameter import ModelParameters
from Chempy.yields import SN2_feedback, AGB_feedback, SN1a_feedback, Hypernova_feedback
In [3]:
from Chempy.infall import PRIMORDIAL_INFALL, INFALL
In [4]:
# This loads the default parameters, you can check and change them in paramter.py
a = ModelParameters()
In [5]:
# Implemented SN Ia yield tables
a.yield_table_name_1a_list
Out[5]:
In [6]:
# AGB yields implemented
a.yield_table_name_agb_list
Out[6]:
In [7]:
# CC-SN yields implemented
a.yield_table_name_sn2_list
Out[7]:
In [8]:
# Hypernova yields (is mixed with Nomoto2013 CC-SN yields for stars more massive than 25Msun)
a.yield_table_name_hn_list
Out[8]:
In [9]:
# Here we show the available mass and metallicity range for each yield set
# First for CC-SNe
print('Available CC-SN yield parameter range')
for item in a.yield_table_name_sn2_list:
basic_sn2 = SN2_feedback()
getattr(basic_sn2, item)()
print('----------------------------------')
print('yield table name: ',item)
print('provided masses: ', basic_sn2.masses)
print('provided metallicities',basic_sn2.metallicities)
Hyper Nova (HN) is only provided for Nomoto 2013 CC-SN yields and it is mixed 50/50 with it for stars with mass >= 25 Msun
In [10]:
# Then for Hypernovae
print('Available HN yield parameter range')
for item in a.yield_table_name_hn_list:
basic_hn = Hypernova_feedback()
getattr(basic_hn, item)()
print('----------------------------------')
print('yield table name: ',item)
print('provided masses: ', basic_hn.masses)
print('provided metallicities',basic_hn.metallicities)
In [11]:
# Here for AGB stars
print('Available AGB yield parameter range')
for item in a.yield_table_name_agb_list:
basic_agb = AGB_feedback()
getattr(basic_agb, item)()
print('----------------------------------')
print('yield table name: ',item)
print('provided masses: ', basic_agb.masses)
print('provided metallicities',basic_agb.metallicities)
In [12]:
# And for SN Ia
print('Available SN Ia yield parameter range')
for item in a.yield_table_name_1a_list:
basic_1a = SN1a_feedback()
getattr(basic_1a, item)()
print('----------------------------------')
print('yield table name: ',item)
print('provided masses: ', basic_1a.masses)
print('provided metallicities',basic_1a.metallicities)
In [13]:
from Chempy.data_to_test import elements_plot
from Chempy.solar_abundance import solar_abundances
In [14]:
# To get the element list we initialise the solar abundance class
basic_solar = solar_abundances()
# we load the default yield set:
basic_sn2 = SN2_feedback()
getattr(basic_sn2, "Nomoto2013")()
basic_1a = SN1a_feedback()
getattr(basic_1a, "Seitenzahl")()
basic_agb = AGB_feedback()
getattr(basic_agb, "Karakas_net_yield")()
#Now we plot the elements available for the default yield set and which elements are available for specific surveys and come from which nucleosynthetic channel
elements_plot('default', basic_agb.elements,basic_sn2.elements,basic_1a.elements,['C','N','O'], basic_solar.table,40)
Out[14]:
In [15]:
# Then we load the alternative yield set:
basic_sn2 = SN2_feedback()
getattr(basic_sn2, "chieffi04")()
basic_1a = SN1a_feedback()
getattr(basic_1a, "Thielemann")()
basic_agb = AGB_feedback()
getattr(basic_agb, "Ventura")()
#And again plot the elements available
elements_plot('alternative', basic_agb.elements,basic_sn2.elements,basic_1a.elements,['C','N','O'], basic_solar.table,40)
Out[15]:
In [16]:
# We need solar abundances for normalisation of the feedback
basic_solar.Asplund09()
# Then we plot the [Mg/Fe] of Nomoto+ 2013 for all masses and metallicities
from Chempy.data_to_test import yield_plot
basic_sn2 = SN2_feedback()
getattr(basic_sn2, "Nomoto2013")()
yield_plot('Nomoto+2013', basic_sn2, basic_solar, 'Mg')
In [17]:
# And we plot the same for Chieffi+ 2004 CC-yields
basic_sn2 = SN2_feedback()
getattr(basic_sn2, "chieffi04")()
yield_plot('Chieffi+04', basic_sn2, basic_solar, 'Mg')
In [18]:
# Now we plot a comparison for different elements between Nomoto+ 2013 and Chieffi+ 2004 CC-yields:
# You can look into the output/ folder and see the comparison for all those elements
from Chempy.data_to_test import yield_comparison_plot
basic_sn2 = SN2_feedback()
getattr(basic_sn2, "Nomoto2013")()
basic_sn2_chieffi = SN2_feedback()
getattr(basic_sn2_chieffi, "chieffi04")()
for element in ['C', 'N', 'O', 'Mg', 'Ca', 'Na', 'Al', 'Mn','Ti']:
yield_comparison_plot('Nomoto13', 'Chieffi04', basic_sn2, basic_sn2_chieffi, basic_solar, element)
In [27]:
# We can also plot a comparison between Karakas+ 2010 and Ventura+ 2013 AGB-yields
# Here we plot the fractional N yield
from Chempy.data_to_test import fractional_yield_comparison_plot
basic_agb = AGB_feedback()
getattr(basic_agb, "Karakas_net_yield")()
basic_agb_ventura = AGB_feedback()
getattr(basic_agb_ventura, "Ventura")()
fractional_yield_comparison_plot('Karakas10', 'Ventura13', basic_agb, basic_agb_ventura, basic_solar, 'N')
#The next line produces an error in the 0.2 version. Needs checking
#fractional_yield_comparison_plot('Karakas10', 'Ventura13', basic_agb, basic_agb_ventura, basic_solar, 'C')
In [28]:
# Different entries of the yield table are queried
print('Mass, Remnant mass fraction, Unprocessed mass in winds fraction, destroyed Hydrogen of total mass')
for i in range(len(basic_agb.masses)):
print(basic_agb.table[0.02]['Mass'][i],basic_agb.table[0.02]['mass_in_remnants'][i],basic_agb.table[0.02]['unprocessed_mass_in_winds'][i],basic_agb.table[0.02]['H'][i])
In [29]:
# Here we compare the yields for different iron-peak elements for Seitenzahl+ 2013 and Thielemann+ 2003 SNIa tables
basic_1a = SN1a_feedback()
getattr(basic_1a, 'Seitenzahl')()
basic_1a_alternative = SN1a_feedback()
getattr(basic_1a_alternative, 'Thielemann')()
print('Mass fraction of SN1a ejecta: Cr, Mn, Fe and Ni')
print('Seitenzahl2013')
print(basic_1a.table[0.02]['Cr'],basic_1a.table[0.02]['Mn'],basic_1a.table[0.02]['Fe'],basic_1a.table[0.02]['Ni'])
print('Thielemann2003')
print(basic_1a_alternative.table[0.02]['Cr'],basic_1a_alternative.table[0.02]['Mn'],basic_1a_alternative.table[0.02]['Fe'],basic_1a_alternative.table[0.02]['Ni'])