Examples of python scripts ************************** This section describe how to use the generated tables to display informations about the Chemistriy properties. To run these examples, we assume that you have moved to the directory ``shared`` of ``PyChem``. Info """" Print the content of a ``chemistry.h5`` file (using h5py):: pychem_print chemistry.h5 pychem_print chemistry.h5 -f Header Dump the content of a ``chemistry.h5`` file (using pychem):: pychem_read chemistry.h5 Get IMF properties:: pychem_IMF_properties --mstar 1e4 chemistry.h5 Print the number of stars in a mass range:: pychem_get_Nstars --mstar 1e4 --mmin 0.6 --mmax 1. chemistry.h5 Compute the number of stars in a given mass range (and compare with the total) as well as the mass of a given element ejected by those stars:: pychem_get_subIMF_props --mstar 1000 --mmin 13 --mmax 300 --elt Fe chemistry.h5 Plot IMF """""""" :: pychem_plot_IMF --log xy --legend chemistry.h5 Sample IMF """""""""" Sample and IMF with a Monte Carlo method and get info :: pychem_sample_IMF --mstar 1e4 chemistry.h5 pychem_sample_IMF_and_properties --mstar 1e4 chemistry.h5 Use the optimal sampling and compare:: pychem_sample_IMF_optimal chemistry.h5 Get the maximal value of a star from the total IMF mass, for the optimal sampling:: pychem_optimal_sampling_Mmax chemistry.h5 Star lifetime """"""""""""" Get info on stars lifetimes:: pychem_lifetime chemistry.h5 Plot the stars lifetime as a function of mass and metallicity:: pychem_plot_lifetime --legend --log xy --xmin 0.05 --xmax 100 --ymin 1e-1 --ymax 1e10 chemistry.h5 Helium core """"""""""" Plot helium core vs star mass:: pychem_plot_HeliumCore PyChemTables/tables/HeliumCore.dat PyChemTables/tables/AGBs/OriginalData/karakas-HeliumCore-0.0200.txt Plot yields """"""""""" Plot the Mass fraction of ejected elements due to the explotion of one SNII of mass m:: pychem_plot_SNII_yields --log xy --legend --xmin 0.05 --xmax 100 --ymin 1e-4 --ymax 1 chemistry.h5 pychem_plot_DYIN_yields --log xy --legend --xmin 0.05 --xmax 100 --ymin 1e-4 --ymax 1 chemistry.h5 pychem_plot_SNII_yields --log xy --legend --xmin 0.05 --xmax 100 --ymin 1e-4 --ymax 1 --elts=Ej,Ejnp,Fe,Mg,O,Metals chemistry.h5 Plots ejectats in stellar mass:: pychem_plot_SNII_yields --legend --xmin 8 --xmax 60 --ymin 1e-4 --ymax 1 --elts Fe,Mg chemistry.h5 --absolute_mass Plot resulting abundance for a mass of pristine reservoir MH touche py a SNII of a given mass:: pychem_plot_SNII_InducedAbRatio --legend --xmin 8 --xmax 60 --ymin -5 --ymax 0 chemistry.h5 --MH 1e4 --elts Fe,Mg,O,Metals total (single) ejection:: pychem_plot_TOTAL_yields --log xy --legend --xmin 0.05 --xmax 100 --ymin 1e-4 --ymax 1 --NSNII=1 --NSNIa=0 --NDYIN=1 chemistry.h5 pychem_plot_TOTAL_yields --log xy --legend --xmin 0.05 --xmax 100 --ymin 1e-4 --ymax 1 --NSNII=1 --NSNIa=0 --NDYIN=0 chemistry.h5 pychem_plot_TOTAL_yields --log xy --legend --xmin 0.05 --xmax 100 --ymin 1e-4 --ymax 1 --NSNII=0 --NSNIa=1 --NDYIN=0 chemistry.h5 pychem_plot_TOTAL_yields --log xy --legend --xmin 0.05 --xmax 100 --ymin 1e-4 --ymax 1 --NSNII=1 --NSNIa=1 --NDYIN=1 chemistry.h5 metallicity dependent yields:: pychem_plot_DYIN_yields_withZ --Z 0.0001 --log xy --xmin 0.05 --xmax 100 --ymin 1e-10 --ymax 1 chemistry.h5 pychem_plot_TOTAL_yields_withZ --Z 1e-4 --log xy --legend --xmin 0.05 --xmax 100 --ymin 1e-10 --ymax 1 --NSNII=1 --NSNIa=0 --NDYIN=1 chemistry.h5 pychem_plot_yieldsAbundances_withZ --Z 1e-4 --legend --xmin -10 --xmax 80 --elts Mg,S,Zn chemistry.h5 total (integrated) ejection:: pychem_plot_TOTAL_integrated_yields --log xy --xmin 0.05 --xmax 100 chemistry.h5 pychem_plot_TOTAL_integrated_yields_withZ --Z 1e-4 --log xy --xmin 0.05 --xmax 100 --ymin 1e-25 --ymax 1e-11 chemistry.h5 Plot the integrated yields (!! the zero depends on the zero of the function...):: pychem_plot_SNII_integrated_yields --log xy --legend --xmin 0.05 --xmax 100 --ymin 1e-4 --ymax 1 chemistry.h5 For dying stars:: pychem_plot_DYIN_integrated_yields --log xy --xmin 0.05 --xmax 100 --ymin 1e-10 --ymax 1 chemistry.h5 pychem_plot_DYIN_integrated_yields_withZ --Z 0.0001 --log xy --xmin 0.05 --xmax 100 --ymin 1e-10 --ymax 1 chemistry.h5 Estimation of the energy lost by stars:: pychem_mass_ejection chemistry.h5 Ejection of metals """""""""""""""""" Compute the enrichment of a reservoir of gas of mass Mg [Msol] due to a SSP of mass M0 [Msol] evolving between t1 and t2 (in Myrs):: pychem_get_IMF_info_and_ejectats chemistry.h5 --t1 0 --t2 14000 --M0=1.43e6 --Mg=5e7 Chemical evolution """""""""""""""""" Number of dying stars as a function of time:: pychem_SSP_discret_evolution3 -Z 0.02 chemistry.h5 --mstar 1e4 --timeunit Myr --xmin 1 --xmax 14000 --dt 0.1 -o NSNII,NSNIa,NDYIN pychem_SSP_discret_evolution3 -Z 0.02 chemistry.h5 --mstar 1e4 --timeunit Myr --xmin 1 --xmax 14000 --dt 0.1 -o CumNSNII,CumNSNIa,CumNDYIN Evolution of Barium, as a function of Z:: pychem_plot_TOTAL_yields_withZ --Z 1e-4 --log xy --xmin 1 --xmax 50 --ymin 1e-12 --ymax 1 --NSNII=1 --NSNIa=0 --NDYIN=1 --elts Ba,Fe --legend chemistry.h5 pychem_plot_TOTAL_yields_withZ --Z 1e-3 --log xy --xmin 1 --xmax 50 --ymin 1e-12 --ymax 1 --NSNII=1 --NSNIa=0 --NDYIN=1 --elts Ba,Fe --legend chemistry.h5 pychem_plot_TOTAL_yields_withZ --Z 1e-2 --log xy --xmin 1 --xmax 50 --ymin 1e-12 --ymax 1 --NSNII=1 --NSNIa=0 --NDYIN=1 --elts Ba,Fe --legend chemistry.h5 Evolution of Barium, as a function of time:: pychem_SSP_discret_evolution3 --mstar 1e4 --Z 1e-4 --tmin 1 --tmax 14000 --ymin -5 --ymax 15 --log x --timeunit Myr --y Ba -o Y --plot_continuous_only chemistry.h5 pychem_SSP_discret_evolution3 --mstar 1e4 --Z 1e-3 --tmin 1 --tmax 14000 --ymin -5 --ymax 15 --log x --timeunit Myr --y Ba -o Y --plot_continuous_only chemistry.h5 pychem_SSP_discret_evolution3 --mstar 1e4 --Z 1e-2 --tmin 1 --tmax 14000 --ymin -5 --ymax 15 --log x --timeunit Myr --y Ba -o Y --plot_continuous_only chemistry.h5 [Ba/Fe], vs [Fe/H]:: pychem_SSP_discret_evolution3 -Z 1e-4 --mstar 1e4 --Z 1e-4 --tmin 1 --tmax 14000 --y Ba --timeunit Myr -o D --plot_continuous_only chemistry.h5 pychem_SSP_discret_evolution3 -Z 1e-4 --mstar 1e4 --Z 1e-3 --tmin 1 --tmax 14000 --y Ba --timeunit Myr -o D --plot_continuous_only chemistry.h5 pychem_SSP_discret_evolution3 -Z 1e-4 --mstar 1e4 --Z 1e-2 --tmin 1 --tmax 14000 --y Ba --timeunit Myr -o D --plot_continuous_only chemistry.h5 Chemical evolution with optimal sampling """""""""""""""""""""""""""""""""""""""" check SNII:: pychem_SSP_discret_evolution3 --optimal_sampling -Z 0.02 --mstar 1e3 --timeunit Myr --xmin 1 --xmax 50 --dt 0.1 -o CumNSNII chemistry.h5 check SNII,DYIN,SNIa:: pychem_SSP_discret_evolution3 --optimal_sampling -Z 0.0 --mstar 1e6 --timeunit Myr --xmin 1 --xmax 14000 --dt 0.1 -o CumNSNII,CumNDYIN,CumNSNIa chemistry.h5 pychem_SSP_discret_evolution3 -Z 0.0 --mstar 1e6 --timeunit Myr --xmin 1 --xmax 14000 --dt 0.1 -o CumNSNII,CumNDYIN,CumNSNIa chemistry.h5 chemical evolution closed box """"""""""""""""""""""""""""" :: pychem_chemivol --Z=1e-10 --tmax 14000 --dt 1.0 --mstar 1e3 --mgas 2e6 -o cbox.dmp --seed 0 chemistry.h5 pychem_chemivol --Z=1e-10 --tmax 14000 --dt 1.0 --mstar 1e4 --mgas 2e6 -o cbox.dmp --seed 0 chemistry.h5 pychem_plot_chemivol cbox.dmp display results:: pNvsX --param params --select stars1 --x Fe --nx 40 --xmin=-4 --xmax=0.5 --ymin=0 --ymax=0.15 snap.dat pMgFevsFe --select=stars1 --xmin=-4 --xmax=0.5 --ymin=-1 --ymax=1.5 --map snap.dat pBaFevsFe --select=stars1 --xmin=-4 --xmax=0.5 --ymin=-1 --ymax=1.5 --map snap.dat pplot --select=stars1 --xmin=-4 --xmax=0.5 --ymin=-1 --ymax=1.5 --map --x Zn/H --y S/Zn snap.dat Chemical evolution (old scripts not fully tested yet) """"""""""""""""""""""""""""""""""""""""""""""""""""" chemical enrichment due to a SSP:: pychem_SSP_evolution chemistry.h5 --xmin 0 --xmax 30 --y Mg --timeunit Myr -o Y,ESN pychem_SSP_evolution chemistry.h5 --xmin 0.001 --xmax 13 --y Mg --timeunit Gyr -o Y,ESN pychem_SSP_evolution chemistry.h5 --xmin 0.001 --xmax 20 --y Mg --timeunit Gyr -o Y,ESN --log x pychem_SSP_evolution chemistry.h5 --xmin 1 --xmax 20000 --y Mg --timeunit Myr -o Y,ESN --log x pychem_SSP_evolution chemistry.h5 --xmin 1 --xmax 20000 --y Mg --timeunit Myr -o D evolution of the stellar mass:: pychem_SSP_evolution chemistry.h5 --xmin 1 --xmax 20000 --y Mg --timeunit Myr -o MSTAR --log x --ymin 0 --ymax 1e-5 --NumberOfTables 2 --DefaultTable 0 pychem_SSP_evolution chemistry.h5 --xmin 1 --xmax 20000 --y Mg --timeunit Myr -o MSTAR --log x --ymin 0 --ymax 1e-5 --NumberOfTables 2 --DefaultTable 1 using different tables:: pychem_SSP_evolution chemistry.h5 --xmin 1 --xmax 20000 --y Mg --timeunit Myr -o Y,ESN --log x --NumberOfTables 2 pychem_SSP_evolution chemistry.h5 --xmin 1 --xmax 20000 --y Mg --timeunit Myr -o Y,ESN --log x --NumberOfTables 2 --DefaultTable 1 using the SN_MC trick:: pychem_SSP_evolution chemistry.h5 --mstar 1e7 --xmin 0 --xmax 50 --y Mg --timeunit Myr -o NSNII,CumNSNII --mstar 3e4 --dt .1 --discsn pychem_SSP_evolution chemistry.h5 --mstar 1e7 --xmin 0 --xmax 3000 --y Mg --timeunit Myr -o NSNIa,CumNSNIa --mstar 3e4 --dt .1 --discsn pychem_SSP_discret_evolution2 chemistry.h5 --mstar 1e7 --xmin 0 --discsn --x Fe --y Mg --timeunit Myr --dt .01 --xmax 3000 -o CumNSNII,CumNSNIa,CumNDYIN,CumEjMass,StellarMass,Y,Yg,D check SN monte carlo:: pychem_SSP_discret_evolution2 chemistry.h5 --mstar 105 --xmin 0 --discsn --x Fe --y Mg --timeunit Myr --dt .01 --xmax 3000 -o CumNSNII,CumNSNIa,CumNDYIN,CumEjMass