<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>sygma &mdash; SYGMA DOC v1.0 documentation</title>
    
    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     'v1.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <link rel="top" title="SYGMA DOC v1.0 documentation" href="../index.html" />
    <link rel="up" title="Module code" href="index.html" /> 
  </head>
  <body role="document">
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">SYGMA DOC v1.0 documentation</a> &raquo;</li>
          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Module code</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <h1>Source code for sygma</h1><div class="highlight"><pre>
<span></span><span class="sd">&#39;&#39;&#39;</span>

<span class="sd">GCE SYGMA (Stellar Yields for Galaxy Modelling Applications) module</span>

<span class="sd">Functionality</span>
<span class="sd">=============</span>

<span class="sd">This tool allows the modeling of simple stellar populations.  Creating a SYGMA </span>
<span class="sd">instance runs the simulation while extensive analysis can be done with the plot_*</span>
<span class="sd">functions found in the chem_evol_plot module.  See the DOC directory for a detailed</span>
<span class="sd">documentation.</span>


<span class="sd">Made by</span>
<span class="sd">=======</span>

<span class="sd">v0.1 NOV2013: C. Fryer, C. Ritter</span>

<span class="sd">v0.2 JAN2014: C. Ritter</span>

<span class="sd">v0.3 APR2014: C. Ritter, J. F. Navarro, F. Herwig, C. Fryer, E. Starkenburg, </span>
<span class="sd">              M. Pignatari, S. Jones, K. Venn1, P. A. Denissenkov &amp; the </span>
<span class="sd">              NuGrid collaboration</span>

<span class="sd">v0.4 FEB2015: C. Ritter, B. Cote</span>
<span class="sd">v0.5 MAY2016: C. Ritter; Note: See from now the official releases via github.</span>

<span class="sd">Usage</span>
<span class="sd">=====</span>

<span class="sd">Simple run example:</span>

<span class="sd">&gt;&gt;&gt; import sygma as s</span>

<span class="sd">Get help with</span>

<span class="sd">&gt;&gt;&gt; help s</span>

<span class="sd">Now start a calculation by providing the initial metal fraction</span>
<span class="sd">iniZ, the final evolution time tend, and the total mass of the SSP:</span>

<span class="sd">&gt;&gt;&gt; s1=s.sygma(iniZ=0.0001, tend=5e9, mgal=1e5)</span>

<span class="sd">For more information regarding the input parameter see below or</span>
<span class="sd">try</span>

<span class="sd">&gt;&gt;&gt; s.sygma?</span>

<span class="sd">For plotting utilize the plotting functions (plot_*) as described further</span>
<span class="sd">below, for example:</span>

<span class="sd">&gt;&gt;&gt; s1.plot_totmasses()</span>

<span class="sd">You can write out the information about the composition of the total</span>
<span class="sd">ejecta of a SSP via</span>

<span class="sd">&gt;&gt;&gt; s.write_evol_table(elements=[&#39;H&#39;,&#39;C&#39;,&#39;O&#39;])</span>

<span class="sd">Yield tables are available in the NUPYCEE subdirectory </span>
<span class="sd">yield/textunderscore tables. Add your yield tables to</span>
<span class="sd">this directory and SYGMA will be able to read the table</span>
<span class="sd">if you have specified the $table$ variable. Only</span>
<span class="sd">for tables with Z=0 is the variable $pop3/textunderscore table$ used.</span>
<span class="sd">Both tables need yields specified in the SYGMA (and OMEGA)</span>
<span class="sd">yield input format. See the default table for the structure.</span>
<span class="sd">It is important to provide an initial abundance</span>
<span class="sd">file which must match the number of species provided in the yield tables.</span>
<span class="sd">Provide the file in the iniAbu directory inside the directory yield/extunderscore tables.</span>
<span class="sd">The input variable with which the table file can be specified is $iniabu/textunderscore table$.</span>
<span class="sd">For the necessary structure see again the default choice of that variable.</span>

<span class="sd">For example with artificial yields of only H-1, you can try</span>

<span class="sd">&gt;&gt;&gt; s2 = s.sygma(iniZ=0.0001,dt=1e8,tend=1.5e10, mgal=1e11,table=&#39;yield_tables/isotope_yield_table_h1.txt&#39;,</span>
<span class="sd">    sn1a_table=&#39;yield_tables/sn1a_h1.txt&#39;,iniabu_table=&#39;yield_tables/iniab1.0E-04GN93_alpha_h1.ppn.txt&#39;)</span>

<span class="sd">&#39;&#39;&#39;</span>

<span class="c1"># Standard package</span>
<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="kn">as</span> <span class="nn">plt</span>

<span class="c1"># Import the class inherited by SYGMA</span>
<span class="kn">from</span> <span class="nn">chem_evol</span> <span class="kn">import</span> <span class="o">*</span>


<div class="viewcode-block" id="sygma"><a class="viewcode-back" href="../sygma.html#sygma.sygma">[docs]</a><span class="k">class</span> <span class="nc">sygma</span><span class="p">(</span> <span class="n">chem_evol</span> <span class="p">):</span>

    <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">    Input parameters (SYGMA)</span>
<span class="sd">    ================</span>

<span class="sd">    sfr : string</span>
<span class="sd">	Description of the star formation, usually an instantaneous burst.</span>
<span class="sd">        </span>
<span class="sd">	Choices : </span>

<span class="sd">		&#39;input&#39; - read and use the sfr_input file to set the percentage</span>
<span class="sd">                            of gas that is converted into stars at each timestep.</span>

<span class="sd">                &#39;schmidt&#39; - use an adapted Schmidt law (see Timmes95)</span>

<span class="sd">        Default value : &#39;input&#39;</span>
<span class="sd">    </span>
<span class="sd">    ================</span>
<span class="sd">    &#39;&#39;&#39;</span>
    <span class="c1"># Combine docstrings from chem_evol with sygma docstring</span>
    <span class="n">__doc__</span> <span class="o">=</span> <span class="n">__doc__</span><span class="o">+</span><span class="n">chem_evol</span><span class="o">.</span><span class="n">__doc__</span>

    <span class="c1">##############################################</span>
    <span class="c1">#                Constructor                 #</span>
    <span class="c1">##############################################</span>
    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sfr</span><span class="o">=</span><span class="s1">&#39;input&#39;</span><span class="p">,</span> \
                 <span class="n">imf_type</span><span class="o">=</span><span class="s1">&#39;kroupa&#39;</span><span class="p">,</span> <span class="n">alphaimf</span><span class="o">=</span><span class="mf">2.35</span><span class="p">,</span> <span class="n">imf_bdys</span><span class="o">=</span><span class="p">[</span><span class="mf">0.1</span><span class="p">,</span><span class="mi">100</span><span class="p">],</span> \
                 <span class="n">sn1a_rate</span><span class="o">=</span><span class="s1">&#39;power_law&#39;</span><span class="p">,</span> <span class="n">iniZ</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">dt</span><span class="o">=</span><span class="mf">1e6</span><span class="p">,</span> <span class="n">special_timesteps</span><span class="o">=</span><span class="mi">30</span><span class="p">,</span> \
                 <span class="n">nsmerger_bdys</span><span class="o">=</span><span class="p">[</span><span class="mi">8</span><span class="p">,</span> <span class="mi">100</span><span class="p">],</span> <span class="n">tend</span><span class="o">=</span><span class="mf">13e9</span><span class="p">,</span> <span class="n">mgal</span><span class="o">=</span><span class="mf">1e4</span><span class="p">,</span> <span class="n">transitionmass</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span> <span class="n">iolevel</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> \
                 <span class="n">ini_alpha</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="s1">&#39;yield_tables/isotope_yield_table_MESA_only_fryer12_delay.txt&#39;</span><span class="p">,</span> \
                 <span class="n">hardsetZ</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">sn1a_on</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">sn1a_table</span><span class="o">=</span><span class="s1">&#39;yield_tables/sn1a_t86.txt&#39;</span><span class="p">,</span><span class="n">sn1a_energy</span><span class="o">=</span><span class="mf">1e51</span><span class="p">,</span>\
		 <span class="n">ns_merger_on</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">bhns_merger_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">f_binary</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">f_merger</span><span class="o">=</span><span class="mf">0.0008</span><span class="p">,</span> \
                 <span class="n">t_merger_max</span><span class="o">=</span><span class="mf">1.0e10</span><span class="p">,</span> <span class="n">m_ej_nsm</span> <span class="o">=</span> <span class="mf">2.5e-02</span><span class="p">,</span> <span class="n">nsm_dtd_power</span><span class="o">=</span><span class="p">[],</span>\
                 <span class="n">m_ej_bhnsm</span><span class="o">=</span><span class="mf">2.5e-02</span><span class="p">,</span> \
                 <span class="n">bhnsmerger_table</span> <span class="o">=</span> <span class="s1">&#39;yield_tables/r_process_rosswog_2014.txt&#39;</span><span class="p">,</span> \
                 <span class="n">nsmerger_table</span> <span class="o">=</span> <span class="s1">&#39;yield_tables/r_process_rosswog_2014.txt&#39;</span><span class="p">,</span> <span class="n">iniabu_table</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span> \
                 <span class="n">extra_source_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">nb_nsm_per_m</span><span class="o">=-</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">t_nsm_coal</span><span class="o">=-</span><span class="mf">1.0</span><span class="p">,</span> \
                 <span class="n">extra_source_table</span><span class="o">=</span><span class="s1">&#39;yield_tables/extra_source.txt&#39;</span><span class="p">,</span> \
		 <span class="n">f_extra_source</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> \
                 <span class="n">pop3_table</span><span class="o">=</span><span class="s1">&#39;yield_tables/popIII_heger10.txt&#39;</span><span class="p">,</span> \
                 <span class="n">imf_bdys_pop3</span><span class="o">=</span><span class="p">[</span><span class="mf">0.1</span><span class="p">,</span><span class="mi">100</span><span class="p">],</span> <span class="n">imf_yields_range_pop3</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mi">30</span><span class="p">],</span> \
                 <span class="n">starbursts</span><span class="o">=</span><span class="p">[],</span> <span class="n">beta_pow</span><span class="o">=-</span><span class="mf">1.0</span><span class="p">,</span><span class="n">gauss_dtd</span><span class="o">=</span><span class="p">[</span><span class="mf">1e9</span><span class="p">,</span><span class="mf">6.6e8</span><span class="p">],</span><span class="n">exp_dtd</span><span class="o">=</span><span class="mf">2e9</span><span class="p">,</span>\
                 <span class="n">nb_1a_per_m</span><span class="o">=</span><span class="mf">1.0e-3</span><span class="p">,</span><span class="n">direct_norm_1a</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">Z_trans</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> \
                 <span class="n">f_arfo</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">imf_yields_range</span><span class="o">=</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">30</span><span class="p">],</span><span class="n">exclude_masses</span><span class="o">=</span><span class="p">[],</span> \
                 <span class="n">netyields_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">wiersmamod</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">yield_interp</span><span class="o">=</span><span class="s1">&#39;lin&#39;</span><span class="p">,</span> \
                 <span class="n">stellar_param_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">t_dtd_poly_split</span><span class="o">=-</span><span class="mf">1.0</span><span class="p">,</span> \
		 <span class="n">stellar_param_table</span><span class="o">=</span><span class="s1">&#39;yield_tables/isotope_yield_table_MESA_only_param.txt&#39;</span><span class="p">,</span>
		 <span class="n">tau_ferrini</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">dt_in</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([]),</span>\
                 <span class="n">nsmerger_dtd_array</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([]),</span> <span class="n">bhnsmerger_dtd_array</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([]),</span>\
                 <span class="n">ytables_in</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([]),</span> <span class="n">zm_lifetime_grid_nugrid_in</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([]),</span>\
                 <span class="n">isotopes_in</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([]),</span> <span class="n">ytables_pop3_in</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([]),</span>\
                 <span class="n">zm_lifetime_grid_pop3_in</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([]),</span> <span class="n">ytables_1a_in</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([]),</span> \
                 <span class="n">mass_sampled</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([]),</span> <span class="n">scale_cor</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([]),</span>\
                 <span class="n">poly_fit_dtd_5th</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([]),</span> <span class="n">poly_fit_range</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([]),</span>\
		 <span class="n">ytables_nsmerger_in</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([])):</span>

        <span class="c1"># Call the init function of the class inherited by SYGMA</span>
        <span class="n">chem_evol</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">imf_type</span><span class="o">=</span><span class="n">imf_type</span><span class="p">,</span> <span class="n">alphaimf</span><span class="o">=</span><span class="n">alphaimf</span><span class="p">,</span> \
                 <span class="n">imf_bdys</span><span class="o">=</span><span class="n">imf_bdys</span><span class="p">,</span> <span class="n">sn1a_rate</span><span class="o">=</span><span class="n">sn1a_rate</span><span class="p">,</span> <span class="n">iniZ</span><span class="o">=</span><span class="n">iniZ</span><span class="p">,</span> <span class="n">dt</span><span class="o">=</span><span class="n">dt</span><span class="p">,</span> \
                 <span class="n">special_timesteps</span><span class="o">=</span><span class="n">special_timesteps</span><span class="p">,</span> <span class="n">tend</span><span class="o">=</span><span class="n">tend</span><span class="p">,</span> <span class="n">mgal</span><span class="o">=</span><span class="n">mgal</span><span class="p">,</span> \
                 <span class="n">nsmerger_bdys</span><span class="o">=</span><span class="n">nsmerger_bdys</span><span class="p">,</span> <span class="n">transitionmass</span><span class="o">=</span><span class="n">transitionmass</span><span class="p">,</span> <span class="n">iolevel</span><span class="o">=</span><span class="n">iolevel</span><span class="p">,</span> \
                 <span class="n">ini_alpha</span><span class="o">=</span><span class="n">ini_alpha</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">hardsetZ</span><span class="o">=</span><span class="n">hardsetZ</span><span class="p">,</span> \
                 <span class="n">sn1a_on</span><span class="o">=</span><span class="n">sn1a_on</span><span class="p">,</span> <span class="n">sn1a_table</span><span class="o">=</span><span class="n">sn1a_table</span><span class="p">,</span><span class="n">sn1a_energy</span><span class="o">=</span><span class="n">sn1a_energy</span><span class="p">,</span>\
		 <span class="n">ns_merger_on</span><span class="o">=</span><span class="n">ns_merger_on</span><span class="p">,</span> <span class="n">nsmerger_table</span><span class="o">=</span><span class="n">nsmerger_table</span><span class="p">,</span> \
		 <span class="n">f_binary</span><span class="o">=</span><span class="n">f_binary</span><span class="p">,</span> <span class="n">f_merger</span><span class="o">=</span><span class="n">f_merger</span><span class="p">,</span> \
                 <span class="n">bhns_merger_on</span><span class="o">=</span><span class="n">bhns_merger_on</span><span class="p">,</span>
                 <span class="n">m_ej_bhnsm</span><span class="o">=</span><span class="n">m_ej_bhnsm</span><span class="p">,</span> <span class="n">bhnsmerger_table</span><span class="o">=</span><span class="n">bhnsmerger_table</span><span class="p">,</span> \
                 <span class="n">nsm_dtd_power</span><span class="o">=</span><span class="n">nsm_dtd_power</span><span class="p">,</span> \
                 <span class="n">t_merger_max</span><span class="o">=</span><span class="n">t_merger_max</span><span class="p">,</span> <span class="n">m_ej_nsm</span> <span class="o">=</span> <span class="n">m_ej_nsm</span><span class="p">,</span> \
                 <span class="n">iniabu_table</span><span class="o">=</span><span class="n">iniabu_table</span><span class="p">,</span> <span class="n">extra_source_on</span><span class="o">=</span><span class="n">extra_source_on</span><span class="p">,</span> \
                 <span class="n">extra_source_table</span><span class="o">=</span><span class="n">extra_source_table</span><span class="p">,</span><span class="n">f_extra_source</span><span class="o">=</span><span class="n">f_extra_source</span><span class="p">,</span> \
		 <span class="n">pop3_table</span><span class="o">=</span><span class="n">pop3_table</span><span class="p">,</span> \
                 <span class="n">nb_nsm_per_m</span><span class="o">=</span><span class="n">nb_nsm_per_m</span><span class="p">,</span> <span class="n">t_nsm_coal</span><span class="o">=</span><span class="n">t_nsm_coal</span><span class="p">,</span> \
                 <span class="n">imf_bdys_pop3</span><span class="o">=</span><span class="n">imf_bdys_pop3</span><span class="p">,</span> \
                 <span class="n">imf_yields_range_pop3</span><span class="o">=</span><span class="n">imf_yields_range_pop3</span><span class="p">,</span> \
                 <span class="n">starbursts</span><span class="o">=</span><span class="n">starbursts</span><span class="p">,</span> <span class="n">beta_pow</span><span class="o">=</span><span class="n">beta_pow</span><span class="p">,</span> \
                 <span class="n">gauss_dtd</span><span class="o">=</span><span class="n">gauss_dtd</span><span class="p">,</span><span class="n">exp_dtd</span><span class="o">=</span><span class="n">exp_dtd</span><span class="p">,</span>\
                 <span class="n">nb_1a_per_m</span><span class="o">=</span><span class="n">nb_1a_per_m</span><span class="p">,</span><span class="n">direct_norm_1a</span><span class="o">=</span><span class="n">direct_norm_1a</span><span class="p">,</span> \
                 <span class="n">Z_trans</span><span class="o">=</span><span class="n">Z_trans</span><span class="p">,</span> <span class="n">f_arfo</span><span class="o">=</span><span class="n">f_arfo</span><span class="p">,</span> <span class="n">t_dtd_poly_split</span><span class="o">=</span><span class="n">t_dtd_poly_split</span><span class="p">,</span> \
                 <span class="n">imf_yields_range</span><span class="o">=</span><span class="n">imf_yields_range</span><span class="p">,</span><span class="n">exclude_masses</span><span class="o">=</span><span class="n">exclude_masses</span><span class="p">,</span>\
                 <span class="n">netyields_on</span><span class="o">=</span><span class="n">netyields_on</span><span class="p">,</span><span class="n">wiersmamod</span><span class="o">=</span><span class="n">wiersmamod</span><span class="p">,</span>\
                 <span class="n">yield_interp</span><span class="o">=</span><span class="n">yield_interp</span><span class="p">,</span> <span class="n">tau_ferrini</span><span class="o">=</span><span class="n">tau_ferrini</span><span class="p">,</span>\
                 <span class="n">ytables_in</span><span class="o">=</span><span class="n">ytables_in</span><span class="p">,</span> <span class="n">nsmerger_dtd_array</span><span class="o">=</span><span class="n">nsmerger_dtd_array</span><span class="p">,</span> \
                 <span class="n">bhnsmerger_dtd_array</span><span class="o">=</span><span class="n">bhnsmerger_dtd_array</span><span class="p">,</span> \
                 <span class="n">zm_lifetime_grid_nugrid_in</span><span class="o">=</span><span class="n">zm_lifetime_grid_nugrid_in</span><span class="p">,</span>\
                 <span class="n">isotopes_in</span><span class="o">=</span><span class="n">isotopes_in</span><span class="p">,</span><span class="n">ytables_pop3_in</span><span class="o">=</span><span class="n">ytables_pop3_in</span><span class="p">,</span>\
                 <span class="n">zm_lifetime_grid_pop3_in</span><span class="o">=</span><span class="n">zm_lifetime_grid_pop3_in</span><span class="p">,</span>\
		 <span class="n">ytables_1a_in</span><span class="o">=</span><span class="n">ytables_1a_in</span><span class="p">,</span> <span class="n">ytables_nsmerger_in</span><span class="o">=</span><span class="n">ytables_nsmerger_in</span><span class="p">,</span> \
		 <span class="n">dt_in</span><span class="o">=</span><span class="n">dt_in</span><span class="p">,</span><span class="n">stellar_param_on</span><span class="o">=</span><span class="n">stellar_param_on</span><span class="p">,</span>\
                 <span class="n">stellar_param_table</span><span class="o">=</span><span class="n">stellar_param_table</span><span class="p">,</span>\
                 <span class="n">poly_fit_dtd_5th</span><span class="o">=</span><span class="n">poly_fit_dtd_5th</span><span class="p">,</span>\
                 <span class="n">poly_fit_range</span><span class="o">=</span><span class="n">poly_fit_range</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">need_to_quit</span><span class="p">:</span>
            <span class="k">return</span>

        <span class="c1"># Announce the beginning of the simulation </span>
        <span class="k">print</span> <span class="s1">&#39;SYGMA run in progress..&#39;</span>
        <span class="n">start_time</span> <span class="o">=</span> <span class="n">t_module</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
	<span class="bp">self</span><span class="o">.</span><span class="n">start_time</span> <span class="o">=</span> <span class="n">start_time</span>

        <span class="c1"># Attribute the input parameter to the current object</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">sfr</span> <span class="o">=</span> <span class="n">sfr</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">mass_sampled</span> <span class="o">=</span> <span class="n">mass_sampled</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">scale_cor</span> <span class="o">=</span> <span class="n">scale_cor</span>

        <span class="c1"># Get the SFR of every timestep</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">sfrin_i</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__sfr</span><span class="p">()</span>

        <span class="c1"># Run the simulation</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__run_simulation</span><span class="p">()</span>

        <span class="c1"># Do the final update of the history class</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_update_history_final</span><span class="p">()</span>

        <span class="c1"># Announce the end of the simulation</span>
        <span class="k">print</span> <span class="s1">&#39;   SYGMA run completed -&#39;</span><span class="p">,</span><span class="bp">self</span><span class="o">.</span><span class="n">_gettime</span><span class="p">()</span>


    <span class="c1">##############################################</span>
    <span class="c1">#                Run Simulation              #</span>
    <span class="c1">##############################################</span>
    <span class="k">def</span> <span class="nf">__run_simulation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">        This function calculates the evolution of the ejecta released by simple</span>
<span class="sd">        stellar populations as a function of time.</span>
<span class="sd">         </span>
<span class="sd">        &#39;&#39;&#39;</span>

        <span class="c1"># For every timestep i considered in the simulation ...</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">nb_timesteps</span><span class="o">+</span><span class="mi">1</span><span class="p">):</span>

            <span class="c1"># Get the current fraction of gas that turns into stars</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">sfrin</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sfrin_i</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>

            <span class="c1"># Run the timestep i</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_evol_stars</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">mass_sampled</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">scale_cor</span><span class="p">)</span>

            <span class="c1"># Get the new metallicity of the gas</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">zmetal</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_getmetallicity</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>

            <span class="c1"># Update the history class</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_update_history</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>


    <span class="c1">##############################################</span>
    <span class="c1">#                    SFR                     #</span>
    <span class="c1">##############################################</span>
    <span class="k">def</span> <span class="nf">__sfr</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">        This function calculates the percentage of gas mass which transforms into</span>
<span class="sd">        stars at every timestep, and then returns the result in an array.</span>

<span class="sd">        &#39;&#39;&#39;</span>

        <span class="c1"># Declaration of the array containing the mass fraction converted</span>
        <span class="c1"># into stars at every timestep i.</span>
        <span class="n">sfr_i</span> <span class="o">=</span> <span class="p">[]</span>

        <span class="c1"># Output information</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">iolevel</span> <span class="o">&gt;=</span> <span class="mi">3</span><span class="p">:</span>
            <span class="k">print</span> <span class="s1">&#39;Entering sfr routine&#39;</span>

        <span class="c1"># For every timestep i considered in the simulation ...</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">nb_timesteps</span><span class="o">+</span><span class="mi">1</span><span class="p">):</span>

            <span class="c1"># If an array is used to generate starbursts ...</span>
            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">starbursts</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">starbursts</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="n">i</span><span class="p">:</span>

                    <span class="c1"># Use the input value</span>
                    <span class="n">sfr_i</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">starbursts</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">sfr</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sfr_i</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>

            <span class="c1"># If an input file is read for the SFR ...</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">sfr</span> <span class="o">==</span> <span class="s1">&#39;input&#39;</span><span class="p">:</span>

                <span class="c1"># Open the input file, read all lines, and close the file</span>
                <span class="n">f1</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">global_path</span><span class="o">+</span><span class="s1">&#39;sfr_input&#39;</span><span class="p">)</span>
                <span class="n">lines</span> <span class="o">=</span> <span class="n">f1</span><span class="o">.</span><span class="n">readlines</span><span class="p">()</span>
                <span class="n">f1</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

                <span class="c1"># The number of lines needs to be at least equal to the</span>
                <span class="c1"># number of timesteps</span>
                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">nb_timesteps</span> <span class="o">&gt;</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">lines</span><span class="p">)):</span>
                    <span class="k">print</span> <span class="s1">&#39;Error - SFR input file does not&#39;</span> \
                          <span class="s1">&#39;provide enough timesteps&#39;</span>
                    <span class="k">return</span>

                <span class="c1"># Copy the SFR (mass fraction) of every timestep</span>
                <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">lines</span><span class="p">)):</span>
                    <span class="k">if</span> <span class="n">k</span> <span class="o">==</span> <span class="p">(</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">):</span>
                        <span class="n">sfr_i</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">lines</span><span class="p">[</span><span class="n">k</span><span class="p">]))</span>
                        <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">sfr</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sfr_i</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>
                        <span class="k">break</span>

            <span class="c1"># If the Schmidt law is used (see Timmes98) ... </span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">sfr</span> <span class="o">==</span> <span class="s1">&#39;schmidt&#39;</span><span class="p">:</span>

                <span class="c1"># Calculate the mass of available gas</span>
                <span class="n">mgas</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">(</span><span class="n">ymgal</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>

                <span class="c1"># Calculate the SFR according to the current gas fraction</span>
                <span class="n">B</span> <span class="o">=</span> <span class="mf">2.8</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">mgal</span> <span class="o">*</span> <span class="p">(</span><span class="n">mgas</span> <span class="o">/</span> <span class="bp">self</span><span class="o">.</span><span class="n">mgal</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span>    <span class="c1"># [Mo/Gyr]</span>
                <span class="n">sfr_i</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">B</span><span class="o">/</span><span class="n">mgas</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="n">timesteps</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">/</span> <span class="mf">1.e9</span><span class="p">)</span> <span class="c1"># mass fraction</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">sfr</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sfr_i</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>

        <span class="c1"># Return the SFR (mass fraction) of every timestep</span>
        <span class="k">return</span> <span class="n">sfr_i</span>

<span class="c1">###############################################################################################</span>
<span class="c1">######################## Here start the analysis methods ######################################</span>
<span class="c1">###############################################################################################</span>


<div class="viewcode-block" id="sygma.write_stellar_param_table"><a class="viewcode-back" href="../sygma.html#sygma.sygma.write_stellar_param_table">[docs]</a>    <span class="k">def</span> <span class="nf">write_stellar_param_table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">table_name</span><span class="o">=</span><span class="s1">&#39;gce_stellar_param_table.txt&#39;</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="s2">&quot;evol_tables&quot;</span><span class="p">,</span><span class="n">interact</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>

	<span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Writes out evolution of stellar parameter such as luminosity and kinetic energy. </span>
<span class="sd">	Stellar parameter quantities are available via &lt;sygma instance&gt;.stellar_param_attrs.</span>


<span class="sd">	Table structure:</span>

<span class="sd">	&amp;Age &amp;Quantity1 &amp;Quantity2 ...</span>

<span class="sd">	&amp;0.000E+00 &amp;0.000E+00 &amp;0.000E+00</span>

<span class="sd">	&amp;0.000E+00 &amp;0.000E+00 &amp;0.000E+00</span>


<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">        table_name : string,optional</span>
<span class="sd">          Name of table. If you use a notebook version, setting a name</span>
<span class="sd">          is not necessary.</span>

<span class="sd">	path : string</span>
<span class="sd">		directory where to save table.	</span>

<span class="sd">        interact: bool</span>
<span class="sd">                If true, saves file in current directory (notebook dir) and creates HTML link useful in ipython notebook environment</span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>

<span class="sd">        &gt;&gt;&gt; s.write_evol_table(table_name=&#39;testoutput.txt&#39;)</span>


<span class="sd">	&#39;&#39;&#39;</span>

        <span class="n">time_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span>

	<span class="c1">#get available quantities</span>

        <span class="n">parameter</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">stellar_param_attrs</span>
        <span class="n">parameter_values</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">stellar_param</span>

        <span class="n">metal_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">metallicity</span>
        <span class="c1">#header</span>
        <span class="n">out</span><span class="o">=</span><span class="s1">&#39;&amp;Age [yr]  &#39;</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">parameter</span><span class="p">)):</span>
            <span class="n">out</span><span class="o">+=</span> <span class="p">(</span><span class="s1">&#39;&amp;&#39;</span><span class="o">+</span><span class="n">parameter</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">+</span><span class="p">((</span><span class="mi">20</span><span class="o">-</span><span class="nb">len</span><span class="p">(</span><span class="n">parameter</span><span class="p">[</span><span class="n">i</span><span class="p">]))</span><span class="o">*</span><span class="s1">&#39; &#39;</span><span class="p">))</span>
	<span class="n">out</span> <span class="o">=</span> <span class="n">out</span> <span class="o">+</span> <span class="s1">&#39;</span><span class="se">\n</span><span class="s1">&#39;</span>
	<span class="n">out</span><span class="o">+=</span><span class="p">(</span><span class="s1">&#39;&amp;&#39;</span><span class="o">+</span><span class="s1">&#39;{:.3E}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">time_evol</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
	<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">parameter_values</span><span class="p">)):</span>
		<span class="n">out</span><span class="o">+=</span> <span class="p">(</span> <span class="s1">&#39; &amp;&#39;</span><span class="o">+</span> <span class="s1">&#39;{:.3E}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="mf">0.</span><span class="p">))</span>
	<span class="n">out</span> <span class="o">=</span> <span class="n">out</span> <span class="o">+</span> <span class="s1">&#39;</span><span class="se">\n</span><span class="s1">&#39;</span>	
        <span class="c1">#data</span>
        <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">parameter_values</span><span class="p">[</span><span class="mi">0</span><span class="p">])):</span>
            <span class="n">out</span><span class="o">+=</span><span class="p">(</span><span class="s1">&#39;&amp;&#39;</span><span class="o">+</span><span class="s1">&#39;{:.3E}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">time_evol</span><span class="p">[</span><span class="n">t</span><span class="o">+</span><span class="mi">1</span><span class="p">]))</span>
            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">parameter_values</span><span class="p">)):</span>
                <span class="n">out</span><span class="o">+=</span> <span class="p">(</span> <span class="s1">&#39; &amp;&#39;</span><span class="o">+</span> <span class="s1">&#39;{:.3E}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">parameter_values</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">t</span><span class="p">]))</span>
            <span class="n">out</span><span class="o">+=</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">&#39;</span>

        <span class="k">if</span> <span class="n">interact</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
                <span class="kn">import</span> <span class="nn">random</span>
                <span class="n">randnum</span><span class="o">=</span><span class="n">random</span><span class="o">.</span><span class="n">randrange</span><span class="p">(</span><span class="mi">10000</span><span class="p">,</span><span class="mi">99999</span><span class="p">)</span>
                <span class="n">name</span><span class="o">=</span><span class="n">table_name</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">randnum</span><span class="p">)</span><span class="o">+</span><span class="s1">&#39;.txt&#39;</span>
                <span class="c1">#f1=open(global_path+&#39;evol_tables/&#39;+name,&#39;w&#39;)</span>
                <span class="n">f1</span><span class="o">=</span><span class="nb">open</span><span class="p">(</span><span class="n">name</span><span class="p">,</span><span class="s1">&#39;w&#39;</span><span class="p">)</span>
                <span class="n">f1</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
                <span class="n">f1</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
                <span class="k">print</span> <span class="s1">&#39;Created table &#39;</span><span class="o">+</span><span class="n">name</span><span class="o">+</span><span class="s1">&#39;.&#39;</span>
                <span class="k">print</span> <span class="s1">&#39;Download the table using the following link:&#39;</span>
                <span class="c1">#from IPython.display import HTML</span>
                <span class="c1">#from IPython import display</span>
                <span class="kn">from</span> <span class="nn">IPython.core.display</span> <span class="kn">import</span> <span class="n">HTML</span>
                <span class="kn">import</span> <span class="nn">IPython.display</span> <span class="kn">as</span> <span class="nn">display</span>
                <span class="c1">#print help(HTML)</span>
                <span class="c1">#return HTML(&quot;&quot;&quot;&lt;a href=&quot;evol_tables/download.php?file=&quot;&quot;&quot;+name+&quot;&quot;&quot;&quot;&gt;Download&lt;/a&gt;&quot;&quot;&quot;)</span>
                <span class="c1">#test=</span>
                <span class="c1">#return display.FileLink(&#39;../../nugrid/SYGMA/SYGMA_online/SYGMA_dev/evol_table/&#39;+name)</span>
                <span class="c1">#if interact==False:</span>
                <span class="c1">#return HTML(&quot;&quot;&quot;&lt;a href=&quot;&quot;&quot;+global_path+&quot;&quot;&quot;/evol_tables/&quot;&quot;&quot;+name+&quot;&quot;&quot;&gt;Download&lt;/a&gt;&quot;&quot;&quot;)</span>
                <span class="k">return</span> <span class="n">HTML</span><span class="p">(</span><span class="s2">&quot;&quot;&quot;&lt;a href=&quot;&quot;&quot;</span><span class="o">+</span><span class="n">name</span><span class="o">+</span><span class="s2">&quot;&quot;&quot;&gt;Download&lt;/a&gt;&quot;&quot;&quot;</span><span class="p">)</span>
                <span class="c1">#else:</span>
                <span class="c1">#        return name</span>
        <span class="k">else</span><span class="p">:</span>
                <span class="k">print</span> <span class="s1">&#39;file &#39;</span><span class="o">+</span><span class="n">table_name</span><span class="o">+</span><span class="s1">&#39; saved in subdirectory evol_tables.&#39;</span>
                <span class="n">f1</span><span class="o">=</span><span class="nb">open</span><span class="p">(</span><span class="n">path</span><span class="o">+</span><span class="s1">&#39;/&#39;</span><span class="o">+</span><span class="n">table_name</span><span class="p">,</span><span class="s1">&#39;w&#39;</span><span class="p">)</span>
                <span class="n">f1</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
                <span class="n">f1</span><span class="o">.</span><span class="n">close</span><span class="p">()</span></div>



<div class="viewcode-block" id="sygma.plot_stellar_param"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_stellar_param">[docs]</a>    <span class="k">def</span> <span class="nf">plot_stellar_param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span><span class="n">quantity</span><span class="o">=</span><span class="s1">&#39;Ekindot_wind&#39;</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;o&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;r&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;-&#39;</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	</span>
<span class="sd">	Plots the evolution of stellar parameter as provided as input in stellar parameter table (stellar_param_table variable).</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">	quantity: string</span>
<span class="sd"> </span>
<span class="sd">		Name of stellar parameter of interest. Check for available parameter via &lt;sygma instance&gt;.stellar_param_attrs</span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>

<span class="sd">        &gt;&gt;&gt; s.plot_stellar_param(quantity=&#39;Ekin_wind&#39;)</span>


<span class="sd">	&#39;&#39;&#39;</span>

	<span class="c1">#in case stellar parameter are not used.</span>
	<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">stellar_param_on</span><span class="o">==</span><span class="bp">False</span><span class="p">:</span>
		<span class="k">print</span> <span class="s1">&#39;Set stellar_param_on to true to use this function.&#39;</span>
		<span class="k">return</span>
	
	<span class="k">if</span> <span class="ow">not</span> <span class="n">quantity</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">stellar_param_attrs</span><span class="p">:</span>
		<span class="k">print</span> <span class="s1">&#39;Quantity &#39;</span><span class="p">,</span><span class="n">quantity</span><span class="p">,</span><span class="s1">&#39; not provided in yield table&#39;</span>
		<span class="k">return</span>
	<span class="n">idx</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">stellar_param_attrs</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">quantity</span><span class="p">)</span>
	<span class="n">quantity_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">stellar_param</span><span class="p">[</span><span class="n">idx</span><span class="p">]</span>
	<span class="n">age</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>

	<span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">)</span>

        <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">age</span><span class="p">,</span><span class="n">quantity_evol</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
 
        <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;log-scaled &#39;</span><span class="o">+</span><span class="n">quantity</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;log-scaled age [yr]&#39;</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">yscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span></div>

<div class="viewcode-block" id="sygma.plot_metallicity"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_metallicity">[docs]</a>    <span class="k">def</span> <span class="nf">plot_metallicity</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">source</span><span class="o">=</span><span class="s1">&#39;all&#39;</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;o&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;r&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;-&#39;</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">        Plots the metal fraction defined as the sum of all isotopes except</span>
<span class="sd">        H1, H2, H3, He3, He4, Li6, Li7.</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">        source : string</span>
<span class="sd">             Specifies if yields come from</span>

<span class="sd">	     all sources (&#39;all&#39;), including</span>
<span class="sd">	     AGB+SN1a, massive stars. Or from</span>

<span class="sd">	     distinctive sources:</span>

<span class="sd">	     only agb stars (&#39;agb&#39;), </span>
<span class="sd">	</span>
<span class="sd">	     only SN1a (&#39;SN1a&#39;)</span>

<span class="sd">	     only massive stars (&#39;massive&#39;)</span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>

<span class="sd">        &gt;&gt;&gt; s.plot_metallicity(source=&#39;all&#39;)</span>



<span class="sd">        &#39;&#39;&#39;</span>
	<span class="n">iso_non_metal</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;H-1&#39;</span><span class="p">,</span><span class="s1">&#39;H-2&#39;</span><span class="p">,</span><span class="s1">&#39;H-3&#39;</span><span class="p">,</span><span class="s1">&#39;He-3&#39;</span><span class="p">,</span><span class="s1">&#39;He-4&#39;</span><span class="p">,</span><span class="s1">&#39;Li-6&#39;</span><span class="p">,</span><span class="s1">&#39;Li-7&#39;</span><span class="p">]</span>
	<span class="n">idx_iso_non_metal</span><span class="o">=</span><span class="p">[]</span>
	<span class="k">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">iso_non_metal</span><span class="p">)):</span>
		<span class="k">if</span> <span class="n">iso_non_metal</span><span class="p">[</span><span class="n">h</span><span class="p">]</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="p">:</span>
			<span class="n">idx_iso_non_metal</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">iso_non_metal</span><span class="p">[</span><span class="n">h</span><span class="p">]))</span>


        <span class="n">x</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span>

	<span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
	       <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield</span>
	<span class="k">elif</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
	      <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_agb</span>
	<span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
	      <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_1a</span>
	<span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;massive&#39;</span><span class="p">:</span>
	     <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_massive</span>
	
        <span class="n">Z_evol</span><span class="o">=</span><span class="p">[]</span>
	<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">)):</span>
		<span class="n">isotopes</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span>
		<span class="n">nonmetals</span><span class="o">=</span><span class="mi">0</span>
		<span class="k">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">idx_iso_non_metal</span><span class="p">)):</span>
			<span class="n">nonmetals</span><span class="o">=</span><span class="n">nonmetals</span> <span class="o">+</span> <span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">idx_iso_non_metal</span><span class="p">[</span><span class="n">h</span><span class="p">]]</span>
		<span class="n">Z_step</span><span class="o">=</span><span class="p">(</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="o">-</span> <span class="n">nonmetals</span><span class="p">)</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
		<span class="n">Z_evol</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Z_step</span><span class="p">)</span>

	<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">Z_evol</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">)</span>

	<span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;age [yr]&#39;</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;metal fraction Z&#39;</span><span class="p">)</span></div>
        <span class="c1">#self.__fig_standard(ax=ax,fontsize=fontsize,labelsize=labelsize,rspace=rspace, bspace=bspace,legend_fontsize=legend_fontsize)</span>



<div class="viewcode-block" id="sygma.plot_table_param"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_table_param">[docs]</a>    <span class="k">def</span> <span class="nf">plot_table_param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span><span class="n">ax</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">xaxis</span><span class="o">=</span><span class="s1">&#39;mini&#39;</span><span class="p">,</span><span class="n">quantity</span><span class="o">=</span><span class="s1">&#39;Lifetime&#39;</span><span class="p">,</span><span class="n">iniZ</span><span class="o">=</span><span class="mf">0.02</span><span class="p">,</span><span class="n">masses</span><span class="o">=</span><span class="p">[],</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;o&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;r&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;-&#39;</span><span class="p">,</span><span class="n">table</span><span class="o">=</span><span class="s1">&#39;yield_tables/isotope_yield_table.txt&#39;</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Plots the yield table quantities such as lifetimes versus initial mass as given in yield input tables.</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">        xaxis : string</span>
<span class="sd">             if &#39;mini&#39;: use initial mass</span>
<span class="sd">	     if &#39;time&#39;: use lifetime</span>
<span class="sd">        iniZ  : float </span>
<span class="sd">	      Metallicity of interest</span>
<span class="sd">	masses: list</span>
<span class="sd">	      List of initial masses to be plotted</span>

<span class="sd">	table: string</span>
<span class="sd">	      Yield table	</span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>

<span class="sd">        &gt;&gt;&gt; s.plot_table_param(quantity=&#39;Lifetiem&#39;)</span>



<span class="sd">	&#39;&#39;&#39;</span>

        <span class="kn">import</span> <span class="nn">read_yields</span> <span class="kn">as</span> <span class="nn">ry</span>
        <span class="kn">import</span> <span class="nn">re</span>
        <span class="n">y_table</span><span class="o">=</span><span class="n">ry</span><span class="o">.</span><span class="n">read_nugrid_yields</span><span class="p">(</span><span class="n">global_path</span><span class="o">+</span><span class="n">table</span><span class="p">)</span>

	<span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">)</span>

        <span class="c1"># find all available masses</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">masses</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
                <span class="n">allheader</span><span class="o">=</span><span class="n">y_table</span><span class="o">.</span><span class="n">table_mz</span>
                <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">allheader</span><span class="p">)):</span>
                        <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="n">iniZ</span><span class="p">)</span> <span class="ow">in</span> <span class="n">allheader</span><span class="p">[</span><span class="n">k</span><span class="p">]:</span>
                                <span class="n">mfound</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">allheader</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;,&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;=&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">])</span>
                                <span class="n">masses</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mfound</span><span class="p">)</span>
                <span class="c1">#print &#39;Found masses: &#39;,masses</span>

	<span class="k">if</span> <span class="n">xaxis</span><span class="o">==</span><span class="s1">&#39;mini&#39;</span><span class="p">:</span>
		<span class="n">x</span><span class="o">=</span><span class="n">masses</span>
	<span class="k">elif</span> <span class="n">xaxis</span><span class="o">==</span><span class="s1">&#39;time&#39;</span><span class="p">:</span>
		<span class="n">x</span><span class="o">=</span><span class="p">[]</span>
		<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">masses</span><span class="p">)):</span>
			<span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">y_table</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">Z</span><span class="o">=</span><span class="n">iniZ</span><span class="p">,</span> <span class="n">M</span><span class="o">=</span><span class="n">masses</span><span class="p">[</span><span class="n">k</span><span class="p">],</span> <span class="n">quantity</span><span class="o">=</span><span class="s1">&#39;Lifetime&#39;</span><span class="p">))</span>	

        <span class="n">param</span><span class="o">=</span><span class="p">[]</span>
        <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">masses</span><span class="p">)):</span>
                <span class="n">param</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">y_table</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">Z</span><span class="o">=</span><span class="n">iniZ</span><span class="p">,</span> <span class="n">M</span><span class="o">=</span><span class="n">masses</span><span class="p">[</span><span class="n">k</span><span class="p">],</span> <span class="n">quantity</span><span class="o">=</span><span class="n">quantity</span><span class="p">))</span>

	<span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">ax</span><span class="p">)</span><span class="o">==</span><span class="nb">str</span><span class="p">:</span>
		<span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">param</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="n">quantity</span><span class="p">)</span>
	<span class="k">if</span> <span class="n">xaxis</span><span class="o">==</span><span class="s1">&#39;mini&#39;</span><span class="p">:</span>
        	<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;initial mass [M$_{\odot}$]&#39;</span><span class="p">)</span>
	<span class="k">elif</span> <span class="n">xaxis</span><span class="o">==</span><span class="s1">&#39;time&#39;</span><span class="p">:</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;lifetime [yr]&#39;</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">yscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span></div>


<div class="viewcode-block" id="sygma.plot_table_remnant"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_table_remnant">[docs]</a>    <span class="k">def</span> <span class="nf">plot_table_remnant</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span><span class="n">xaxis</span><span class="o">=</span><span class="s1">&#39;mini&#39;</span><span class="p">,</span><span class="n">iniZ</span><span class="o">=</span><span class="mf">0.02</span><span class="p">,</span><span class="n">masses</span><span class="o">=</span><span class="p">[],</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;o&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;r&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;-&#39;</span><span class="p">,</span><span class="n">table</span><span class="o">=</span><span class="s1">&#39;yield_tables/isotope_yield_table.txt&#39;</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>

<span class="sd">	Plots the remnant masses versus initial mass given in yield tables.</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">        xaxis : string</span>
<span class="sd">             if &#39;mini&#39;: use initial mass; if of the form [specie1/specie2] use spec. notation of </span>
<span class="sd">        yaxis : string</span>

<span class="sd">	iniZ : float</span>
<span class="sd">	     Metallicity to choose.</span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>

<span class="sd">        &gt;&gt;&gt; s.plot_table_remnant(iniZ=0.02)</span>


<span class="sd">	&#39;&#39;&#39;</span>
        <span class="kn">import</span> <span class="nn">read_yields</span> <span class="kn">as</span> <span class="nn">ry</span>
        <span class="kn">import</span> <span class="nn">re</span>
        <span class="n">y_table</span><span class="o">=</span><span class="n">ry</span><span class="o">.</span><span class="n">read_nugrid_yields</span><span class="p">(</span><span class="n">global_path</span><span class="o">+</span><span class="n">table</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">)</span>
        <span class="c1"># find all available masses</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">masses</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
                <span class="n">allheader</span><span class="o">=</span><span class="n">y_table</span><span class="o">.</span><span class="n">table_mz</span>
                <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">allheader</span><span class="p">)):</span>
                        <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="n">iniZ</span><span class="p">)</span> <span class="ow">in</span> <span class="n">allheader</span><span class="p">[</span><span class="n">k</span><span class="p">]:</span>
                                <span class="n">mfound</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">allheader</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;,&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;=&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">])</span>
                                <span class="n">masses</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mfound</span><span class="p">)</span>
                <span class="c1">#print &#39;Found masses: &#39;,masses</span>
	
	<span class="n">mfinals</span><span class="o">=</span><span class="p">[]</span>
	<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">masses</span><span class="p">)):</span>	
		<span class="n">mfinals</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">y_table</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">Z</span><span class="o">=</span><span class="n">iniZ</span><span class="p">,</span> <span class="n">M</span><span class="o">=</span><span class="n">masses</span><span class="p">[</span><span class="n">k</span><span class="p">],</span> <span class="n">quantity</span><span class="o">=</span><span class="s1">&#39;Mfinal&#39;</span><span class="p">))</span>

	<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">masses</span><span class="p">,</span><span class="n">mfinals</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;remnant mass [M$_{\odot}$]&#39;</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;initial mass [M$_{\odot}$]&#39;</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">minorticks_on</span><span class="p">()</span></div>

<div class="viewcode-block" id="sygma.plot_yield_mtot"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_yield_mtot">[docs]</a>    <span class="k">def</span> <span class="nf">plot_yield_mtot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span><span class="n">plot_imf_mass_ranges</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>

	<span class="sd">&#39;&#39;&#39;</span>

<span class="sd">	Plots total mass ejected by stars (!). To distinguish between the total mass of yields from the table and fitted total mass</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">	plot_imf_mass_ranges : boolean</span>
<span class="sd">		If true plots the initial mass ranges for which yields are consider.	</span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>

<span class="sd">        &gt;&gt;&gt; s.plot_yield_mtot()</span>

<span class="sd">	</span>
<span class="sd">	&#39;&#39;&#39;</span>

	<span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
	<span class="n">yall</span><span class="o">=</span><span class="p">[]</span>
	<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">yields</span><span class="p">)):</span>
	    <span class="n">yall</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">sum</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">yields</span><span class="p">[</span><span class="n">k</span><span class="p">]))</span>
	<span class="n">mall</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">m_stars</span>
	<span class="n">x</span><span class="o">=</span><span class="p">[]</span>
	<span class="n">ms</span><span class="o">=</span><span class="p">[]</span>
	<span class="k">for</span> <span class="n">m</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">imf_bdys</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="bp">self</span><span class="o">.</span><span class="n">imf_bdys</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span><span class="mi">1</span><span class="p">):</span>
	    <span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">func_total_ejecta</span><span class="p">(</span><span class="n">m</span><span class="p">))</span>
	    <span class="n">ms</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">m</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">ms</span><span class="p">,</span><span class="n">x</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="s1">&#39;:&#39;</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;fit&#39;</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">mall</span><span class="p">,</span><span class="n">yall</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;x&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;k&#39;</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;input yield grid&#39;</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;initial mass [M$_{\odot}$]&#39;</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;total yields [M$_{\odot}$]&#39;</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>

	<span class="k">if</span> <span class="n">plot_imf_mass_ranges</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
		<span class="n">ranges</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">imf_mass_ranges</span>
		<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">ranges</span><span class="p">)):</span>
		    <span class="n">plt</span><span class="o">.</span><span class="n">vlines</span><span class="p">(</span><span class="n">ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span><span class="mi">0</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="s1">&#39;--&#39;</span><span class="p">)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">vlines</span><span class="p">(</span><span class="n">ranges</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span><span class="mi">0</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="s1">&#39;--&#39;</span><span class="p">)</span>

        <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span></div>


<div class="viewcode-block" id="sygma.plot_table_yield_mass"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_table_yield_mass">[docs]</a>    <span class="k">def</span> <span class="nf">plot_table_yield_mass</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span><span class="n">xaxis</span><span class="o">=</span><span class="s1">&#39;mini&#39;</span><span class="p">,</span><span class="n">yaxis</span><span class="o">=</span><span class="s1">&#39;C-12&#39;</span><span class="p">,</span><span class="n">iniZ</span><span class="o">=</span><span class="mf">0.0001</span><span class="p">,</span><span class="n">netyields</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">masses</span><span class="o">=</span><span class="p">[],</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;o&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;r&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;-&#39;</span><span class="p">,</span><span class="n">table</span><span class="o">=</span><span class="s1">&#39;yield_tables/isotope_yield_table.txt&#39;</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>

	<span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Plots yields for isotopes given in yield tables.</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">	xaxis : string</span>
<span class="sd">		if &#39;mini&#39; use initial mass on x axis</span>
<span class="sd">	</span>
<span class="sd">	yaxis : string</span>
<span class="sd">		isotope to plot.</span>
<span class="sd">	</span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>

<span class="sd">        &gt;&gt;&gt; s.plot_iso_ratio(yaxis=&#39;C-12&#39;)</span>

<span class="sd">	&#39;&#39;&#39;</span>

        <span class="c1"># find all available masses</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">masses</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
                <span class="n">allheader</span><span class="o">=</span><span class="n">y_table</span><span class="o">.</span><span class="n">table_mz</span>
                <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">allheader</span><span class="p">)):</span>
                        <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="n">iniZ</span><span class="p">)</span> <span class="ow">in</span> <span class="n">allheader</span><span class="p">[</span><span class="n">k</span><span class="p">]:</span>
                                <span class="n">mfound</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">allheader</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;,&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;=&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">])</span>
                                <span class="n">masses</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mfound</span><span class="p">)</span>
                <span class="c1">#print &#39;Found masses: &#39;,masses</span>
	<span class="k">if</span> <span class="bp">True</span><span class="p">:</span>
                <span class="n">x</span><span class="o">=</span><span class="p">[]</span>
                <span class="n">y</span><span class="o">=</span><span class="p">[]</span>
                <span class="k">for</span> <span class="n">mini</span> <span class="ow">in</span> <span class="n">masses</span><span class="p">:</span>
                                <span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mini</span><span class="p">)</span>
                                <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;initial mass [M$_{\odot}$]&#39;</span><span class="p">)</span>
                                <span class="n">headerx</span><span class="o">=</span><span class="s1">&#39;Mini/Msun&#39;</span>

                                <span class="k">if</span> <span class="n">netyields</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
                                        <span class="n">y_ini</span><span class="o">=</span><span class="n">ini_isos_frac</span><span class="p">[</span><span class="n">ini_isos</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">yaxis</span><span class="p">)]</span>
                                        <span class="n">miniadd</span><span class="o">=</span><span class="p">(</span><span class="n">y_ini</span><span class="o">*</span><span class="p">(</span><span class="n">mini</span><span class="o">-</span><span class="n">mfinal</span><span class="p">))</span>
                                        <span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">yaxis</span><span class="p">)</span> <span class="o">+</span> <span class="n">miniadd</span><span class="p">)</span>
                                <span class="k">else</span><span class="p">:</span>
                                        <span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">yaxis</span><span class="p">))</span>
                                <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;yield [M$_{\odot}$]&#39;</span><span class="p">)</span>
                                <span class="n">headery</span><span class="o">=</span><span class="s1">&#39;Yield [Msun]&#39;</span>

                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
                        <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;Z=&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">Z</span><span class="p">),</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">)</span>
                <span class="k">else</span><span class="p">:</span>
                        <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">)</span>


        <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>
        <span class="c1">#return x,y</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__save_data</span><span class="p">(</span><span class="n">header</span><span class="o">=</span><span class="p">[</span><span class="n">headerx</span><span class="p">,</span><span class="n">headery</span><span class="p">],</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">])</span></div>


<div class="viewcode-block" id="sygma.plot_net_yields"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_net_yields">[docs]</a>    <span class="k">def</span> <span class="nf">plot_net_yields</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">91</span><span class="p">,</span><span class="n">species</span><span class="o">=</span><span class="s1">&#39;[C-12/Fe-56]&#39;</span><span class="p">,</span><span class="n">netyields_iniabu</span><span class="o">=</span><span class="s1">&#39;yield_tables/iniabu/iniab_solar_Wiersma.ppn&#39;</span><span class="p">):</span>

	<span class="sd">&#39;&#39;&#39;</span>
<span class="sd">		Plots net yields as calculated in the code when using netyields_on=True.</span>

<span class="sd">		To be used only with net yield input.</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">	species : string</span>
<span class="sd">		Isotope ratio in spectroscopic notation.</span>


<span class="sd">        Examples</span>
<span class="sd">        ----------</span>

<span class="sd">        &gt;&gt;&gt; s.plot_net_yields(species=&#39;[C-12/Fe-56]&#39;)</span>


<span class="sd">	&#39;&#39;&#39;</span>

	<span class="n">iniabu</span><span class="o">=</span><span class="n">ry</span><span class="o">.</span><span class="n">iniabu</span><span class="p">(</span><span class="n">global_path</span><span class="o">+</span><span class="s1">&#39;/&#39;</span><span class="o">+</span><span class="n">netyields_iniabu</span><span class="p">)</span>
	<span class="n">isonames</span><span class="o">=</span><span class="n">iniabu</span><span class="o">.</span><span class="n">names</span>
        <span class="n">specie1</span><span class="o">=</span><span class="n">species</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">:]</span>
        <span class="n">specie2</span><span class="o">=</span><span class="n">species</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">][:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
	<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">isonames</span><span class="p">)):</span>
		<span class="n">elem</span><span class="o">=</span><span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;(\d+)&#39;</span><span class="p">,</span><span class="n">isonames</span><span class="p">[</span><span class="n">k</span><span class="p">])[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="o">.</span><span class="n">capitalize</span><span class="p">()</span>
		<span class="n">A</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;(\d+)&#39;</span><span class="p">,</span><span class="n">isonames</span><span class="p">[</span><span class="n">k</span><span class="p">])[</span><span class="mi">1</span><span class="p">])</span>
		<span class="k">if</span> <span class="n">specie1</span> <span class="o">==</span> <span class="n">elem</span><span class="o">+</span><span class="s1">&#39;-&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">A</span><span class="p">):</span>
			<span class="n">x1sol</span><span class="o">=</span><span class="n">iniabu</span><span class="o">.</span><span class="n">iso_abundance</span><span class="p">(</span><span class="n">elem</span><span class="o">+</span><span class="s1">&#39;-&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">A</span><span class="p">))</span>
		<span class="k">if</span> <span class="n">specie2</span> <span class="o">==</span> <span class="n">elem</span><span class="o">+</span><span class="s1">&#39;-&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">A</span><span class="p">):</span>
			<span class="n">x2sol</span><span class="o">=</span><span class="n">iniabu</span><span class="o">.</span><span class="n">iso_abundance</span><span class="p">(</span><span class="n">elem</span><span class="o">+</span><span class="s1">&#39;-&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">A</span><span class="p">))</span>

	<span class="n">specie1</span><span class="o">=</span><span class="n">species</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">:]</span>
	<span class="n">specie2</span><span class="o">=</span><span class="n">species</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">][:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
	<span class="n">idx1</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">specie1</span><span class="p">)</span>
	<span class="n">idx2</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">specie2</span><span class="p">)</span>
	<span class="n">y</span><span class="o">=</span><span class="p">[]</span>
	<span class="n">x</span><span class="o">=</span><span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">netyields</span><span class="p">))</span>
	<span class="n">x</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span>
	<span class="n">x</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">netyields_masses</span>
	<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">netyields</span><span class="p">)):</span>
	    <span class="n">x1</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">netyields</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">idx1</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">netyields</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
	    <span class="n">x2</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">netyields</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">idx2</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">netyields</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
	    <span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span><span class="n">x1</span><span class="o">/</span><span class="n">x2</span> <span class="o">/</span> <span class="p">(</span><span class="n">x1sol</span><span class="o">/</span><span class="n">x2sol</span><span class="p">)))</span>
	<span class="k">print</span> <span class="s1">&#39;create figure&#39;</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;o&#39;</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="n">species</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;initial mass [M$_{\odot}$]&#39;</span><span class="p">)</span></div>
	<span class="c1">#plt.xscale(&#39;log&#39;)</span>

<div class="viewcode-block" id="sygma.plot_table_yield"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_table_yield">[docs]</a>    <span class="k">def</span> <span class="nf">plot_table_yield</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span><span class="n">xaxis</span><span class="o">=</span><span class="s1">&#39;mini&#39;</span><span class="p">,</span><span class="n">yaxis</span><span class="o">=</span><span class="s1">&#39;C-12&#39;</span><span class="p">,</span><span class="n">iniZ</span><span class="o">=</span><span class="mf">0.0001</span><span class="p">,</span><span class="n">netyields</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">masses</span><span class="o">=</span><span class="p">[],</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;o&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;r&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;-&#39;</span><span class="p">,</span><span class="n">table</span><span class="o">=</span><span class="s1">&#39;yield_tables/isotope_yield_table.txt&#39;</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">solar_ab</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">netyields_iniabu</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>

<span class="sd">	Plots the yields of the yield input grid versus initial mass or</span>
<span class="sd">	Z or [Fe/H]. Yield can be plotted in solar masses or in spectroscopic notation.</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">	xaxis : string</span>
<span class="sd">	     if &#39;mini&#39;: use initial mass; if of the form [specie1/specie2] use spec. notation</span>
<span class="sd">	yaxis : string</span>
<span class="sd">	     specifies isotopes or elements with &#39;C-12&#39; or &#39;C&#39;: plot yield of isotope;</span>
<span class="sd">	     if chosen spectros: use form [specie3/specie4]</span>
<span class="sd">	iniZ : float</span>
<span class="sd">	     specifies the metallicity to be plotted</span>
<span class="sd">	masses : list</span>
<span class="sd">	     if empty plot all available masses for metallicity iniZ; else choose only masses in list masses</span>
<span class="sd">	netyields : bool</span>
<span class="sd">	     if true assume net yields in table and add corresponding initial contribution to get total yields</span>
<span class="sd">	table : string</span>
<span class="sd">	     table to plot data from; default sygma input table</span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>

<span class="sd">        &gt;&gt;&gt; s.plot_iso_ratio(yaxis=&#39;C-12&#39;)</span>

<span class="sd">        </span>
<span class="sd">	&#39;&#39;&#39;</span>
	<span class="kn">import</span> <span class="nn">read_yields</span> <span class="kn">as</span> <span class="nn">ry</span>
	<span class="kn">import</span> <span class="nn">re</span>
	<span class="n">y_table</span><span class="o">=</span><span class="n">ry</span><span class="o">.</span><span class="n">read_nugrid_yields</span><span class="p">(</span><span class="n">global_path</span><span class="o">+</span><span class="n">table</span><span class="p">)</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="n">fsize</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">fsize</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
	<span class="n">spec</span><span class="o">=</span><span class="bp">False</span>
	<span class="k">if</span> <span class="s1">&#39;[&#39;</span> <span class="ow">in</span> <span class="n">yaxis</span><span class="p">:</span>
		<span class="n">spec</span><span class="o">=</span><span class="bp">True</span>
	
	<span class="c1"># for spectroscopic notation need initial abundance of elements or isotopes</span>
	<span class="k">if</span> <span class="bp">True</span><span class="p">:</span> <span class="c1">#spec==True or &#39;[&#39; in xaxis:</span>
                <span class="n">ini_list</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;iniab1.0E-02GN93.ppn&#39;</span> <span class="p">,</span><span class="s1">&#39;iniab1.0E-03GN93_alpha.ppn&#39;</span><span class="p">,</span><span class="s1">&#39;iniab1.0E-04GN93_alpha.ppn&#39;</span><span class="p">,</span><span class="s1">&#39;iniab2.0E-02GN93.ppn&#39;</span> <span class="p">,</span><span class="s1">&#39;iniab6.0E-03GN93_alpha.ppn&#39;</span><span class="p">,</span><span class="s1">&#39;iniab1.0E-05GN93_alpha_scaled.ppn&#39;</span><span class="p">,</span><span class="s1">&#39;iniab1.0E-06GN93_alpha_scaled.ppn&#39;</span><span class="p">]</span>
                <span class="n">iniZs</span><span class="o">=</span><span class="p">[</span><span class="mf">0.01</span><span class="p">,</span><span class="mf">0.001</span><span class="p">,</span><span class="mf">0.0001</span><span class="p">,</span><span class="mf">0.02</span><span class="p">,</span><span class="mf">0.006</span><span class="p">,</span><span class="mf">0.00001</span><span class="p">,</span><span class="mf">0.000001</span><span class="p">]</span>
                <span class="n">ymgal</span><span class="o">=</span><span class="p">[]</span>
		<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">netyields_iniabu</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
                	<span class="k">for</span> <span class="n">metal</span> <span class="ow">in</span> <span class="n">iniZs</span><span class="p">:</span>
                    		<span class="k">if</span> <span class="n">metal</span> <span class="o">==</span> <span class="nb">float</span><span class="p">(</span><span class="n">iniZ</span><span class="p">):</span>
                            		<span class="n">iniabu</span><span class="o">=</span><span class="n">ry</span><span class="o">.</span><span class="n">iniabu</span><span class="p">(</span><span class="n">global_path</span><span class="o">+</span><span class="s1">&#39;yield_tables/iniabu/&#39;</span><span class="o">+</span><span class="n">ini_list</span><span class="p">[</span><span class="n">iniZs</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">iniZ</span><span class="p">)])</span>
		<span class="k">else</span><span class="p">:</span>
			<span class="n">iniabu</span><span class="o">=</span><span class="n">ry</span><span class="o">.</span><span class="n">iniabu</span><span class="p">(</span><span class="n">global_path</span><span class="o">+</span><span class="s1">&#39;/&#39;</span><span class="o">+</span><span class="n">netyields_iniabu</span><span class="p">)</span>
		<span class="n">isonames</span><span class="o">=</span><span class="n">iniabu</span><span class="o">.</span><span class="n">names</span>
		<span class="c1">#get initial elements </span>
		<span class="c1">#if not &#39;-&#39; in yaxis:</span>
		<span class="k">if</span> <span class="bp">True</span><span class="p">:</span>
			<span class="n">ini_elems</span><span class="o">=</span><span class="p">[]</span>
			<span class="n">ini_elems_frac</span><span class="o">=</span><span class="p">[]</span>
			<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">isonames</span><span class="p">)):</span>
				<span class="n">elem</span><span class="o">=</span><span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;(\d+)&#39;</span><span class="p">,</span><span class="n">isonames</span><span class="p">[</span><span class="n">k</span><span class="p">])[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="o">.</span><span class="n">capitalize</span><span class="p">()</span>
				<span class="n">A</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;(\d+)&#39;</span><span class="p">,</span><span class="n">isonames</span><span class="p">[</span><span class="n">k</span><span class="p">])[</span><span class="mi">1</span><span class="p">])</span>
				<span class="k">if</span> <span class="n">elem</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">ini_elems</span><span class="p">:</span>
					<span class="n">ini_elems</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">elem</span><span class="p">)</span>
					<span class="n">ini_elems_frac</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">iniabu</span><span class="o">.</span><span class="n">iso_abundance</span><span class="p">(</span><span class="n">elem</span><span class="o">+</span><span class="s1">&#39;-&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">A</span><span class="p">)))</span>
				<span class="k">else</span><span class="p">:</span>
					<span class="n">ini_elems_frac</span><span class="p">[</span><span class="n">ini_elems</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">elem</span><span class="p">)]</span><span class="o">+=</span><span class="n">iniabu</span><span class="o">.</span><span class="n">iso_abundance</span><span class="p">(</span><span class="n">elem</span><span class="o">+</span><span class="s1">&#39;-&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">A</span><span class="p">))</span>
			<span class="c1">#ini_species=ini_elems</span>
			<span class="c1">#ini_species_frac=ini_elems_frac</span>
		<span class="c1">#get isotopes</span>
		<span class="k">if</span> <span class="bp">True</span><span class="p">:</span>	
			<span class="n">ini_isos</span><span class="o">=</span><span class="p">[]</span>
			<span class="n">ini_isos_frac</span><span class="o">=</span><span class="p">[]</span>
                        <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">isonames</span><span class="p">)):</span>
                                <span class="n">elem</span><span class="o">=</span><span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;(\d+)&#39;</span><span class="p">,</span><span class="n">isonames</span><span class="p">[</span><span class="n">k</span><span class="p">])[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="o">.</span><span class="n">capitalize</span><span class="p">()</span>
                                <span class="n">A</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;(\d+)&#39;</span><span class="p">,</span><span class="n">isonames</span><span class="p">[</span><span class="n">k</span><span class="p">])[</span><span class="mi">1</span><span class="p">])</span>
				<span class="n">newname</span><span class="o">=</span><span class="n">elem</span><span class="o">+</span><span class="s1">&#39;-&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">A</span><span class="p">)</span>
				<span class="n">ini_isos</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">newname</span><span class="p">)</span>
				<span class="n">ini_isos_frac</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">iniabu</span><span class="o">.</span><span class="n">iso_abundance</span><span class="p">(</span><span class="n">elem</span><span class="o">+</span><span class="s1">&#39;-&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">A</span><span class="p">)))</span>
                        <span class="c1">#ini_species=ini_isos</span>
                        <span class="c1">#ini_species_frac=ini_isos_frac</span>

	<span class="c1">####Get solar Z either from </span>
	<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">solar_ab</span><span class="p">)</span> <span class="o">==</span><span class="mi">0</span><span class="p">:</span>
		<span class="n">iniabu</span><span class="o">=</span><span class="n">ry</span><span class="o">.</span><span class="n">iniabu</span><span class="p">(</span><span class="n">global_path</span><span class="o">+</span><span class="s1">&#39;yield_tables/iniabu/iniab2.0E-02GN93.ppn&#39;</span><span class="p">)</span>
	<span class="k">else</span><span class="p">:</span>
		<span class="n">iniabu</span><span class="o">=</span><span class="n">ry</span><span class="o">.</span><span class="n">iniabu</span><span class="p">(</span><span class="n">global_path</span><span class="o">+</span><span class="n">solar_ab</span><span class="p">)</span>
	<span class="c1">#ini_elems=[]</span>
	<span class="n">ini_elems_frac_sol</span><span class="o">=</span><span class="p">[]</span>
	<span class="n">ini_elems</span><span class="o">=</span><span class="p">[]</span>
	<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">isonames</span><span class="p">)):</span>
			<span class="n">elem</span><span class="o">=</span><span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;(\d+)&#39;</span><span class="p">,</span><span class="n">isonames</span><span class="p">[</span><span class="n">k</span><span class="p">])[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="o">.</span><span class="n">capitalize</span><span class="p">()</span>
			<span class="n">A</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;(\d+)&#39;</span><span class="p">,</span><span class="n">isonames</span><span class="p">[</span><span class="n">k</span><span class="p">])[</span><span class="mi">1</span><span class="p">])</span>
			<span class="k">if</span> <span class="n">elem</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">ini_elems</span><span class="p">:</span>
				<span class="n">ini_elems</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">elem</span><span class="p">)</span>
				<span class="n">ini_elems_frac_sol</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">iniabu</span><span class="o">.</span><span class="n">iso_abundance</span><span class="p">(</span><span class="n">elem</span><span class="o">+</span><span class="s1">&#39;-&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">A</span><span class="p">)))</span>
			<span class="k">else</span><span class="p">:</span>
				<span class="n">ini_elems_frac_sol</span><span class="p">[</span><span class="n">ini_elems</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">elem</span><span class="p">)]</span><span class="o">+=</span><span class="n">iniabu</span><span class="o">.</span><span class="n">iso_abundance</span><span class="p">(</span><span class="n">elem</span><span class="o">+</span><span class="s1">&#39;-&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">A</span><span class="p">))</span>

	<span class="n">ini_isos_frac_sol</span><span class="o">=</span><span class="p">[]</span>
        <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">isonames</span><span class="p">)):</span>
                                <span class="n">elem</span><span class="o">=</span><span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;(\d+)&#39;</span><span class="p">,</span><span class="n">isonames</span><span class="p">[</span><span class="n">k</span><span class="p">])[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="o">.</span><span class="n">capitalize</span><span class="p">()</span>
                                <span class="n">A</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;(\d+)&#39;</span><span class="p">,</span><span class="n">isonames</span><span class="p">[</span><span class="n">k</span><span class="p">])[</span><span class="mi">1</span><span class="p">])</span>
				<span class="n">newname</span><span class="o">=</span><span class="n">elem</span><span class="o">+</span><span class="s1">&#39;-&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">A</span><span class="p">)</span>
				<span class="c1">#ini_isos.append(newname)</span>
				<span class="n">ini_isos_frac_sol</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">iniabu</span><span class="o">.</span><span class="n">iso_abundance</span><span class="p">(</span><span class="n">elem</span><span class="o">+</span><span class="s1">&#39;-&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">A</span><span class="p">)))</span>
                        <span class="c1">#ini_species=ini_isos</span>
                        <span class="c1">#ini_species_frac=ini_isos_frac</span>



	<span class="c1">#print &#39;test&#39;</span>
	<span class="c1">#prepare yield table data</span>

	<span class="c1">#find all available masses</span>
	<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">masses</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
		<span class="n">allheader</span><span class="o">=</span><span class="n">y_table</span><span class="o">.</span><span class="n">table_mz</span>
		<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">allheader</span><span class="p">)):</span>
			<span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="n">iniZ</span><span class="p">)</span> <span class="ow">in</span> <span class="n">allheader</span><span class="p">[</span><span class="n">k</span><span class="p">]:</span>
				<span class="n">mfound</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">allheader</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;,&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;=&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">])</span>	
				<span class="n">masses</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mfound</span><span class="p">)</span>
		<span class="k">print</span> <span class="s1">&#39;Found masses: &#39;</span><span class="p">,</span><span class="n">masses</span>
	<span class="n">idx1</span><span class="o">=-</span><span class="mi">1</span>
	<span class="n">Z</span><span class="o">=</span><span class="n">iniZ</span>
	<span class="n">y_delay</span><span class="o">=</span><span class="n">y_table</span>
	<span class="k">if</span> <span class="bp">True</span><span class="p">:</span>
		<span class="n">x</span><span class="o">=</span><span class="p">[]</span>
		<span class="n">y</span><span class="o">=</span><span class="p">[]</span>
		<span class="k">for</span> <span class="n">mini</span> <span class="ow">in</span> <span class="n">masses</span><span class="p">:</span>
			
			<span class="n">idx1</span><span class="o">+=</span><span class="mi">1</span>
			<span class="n">totmass</span><span class="o">=</span><span class="nb">sum</span><span class="p">(</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">quantity</span><span class="o">=</span><span class="s1">&#39;Yields&#39;</span><span class="p">))</span>
			<span class="n">mfinal</span> <span class="o">=</span> <span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span> <span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span> <span class="n">quantity</span><span class="o">=</span><span class="s1">&#39;Mfinal&#39;</span><span class="p">)</span>

			<span class="k">if</span> <span class="s1">&#39;[&#39;</span> <span class="ow">in</span> <span class="n">xaxis</span><span class="p">:</span>
				<span class="n">x1</span><span class="o">=</span><span class="n">xaxis</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">:]</span>
				<span class="n">x2</span><span class="o">=</span><span class="n">xaxis</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">][:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
				<span class="c1">#print &#39;for xaxis&#39;,x1,x2</span>
				<span class="k">if</span> <span class="s1">&#39;-&#39;</span> <span class="ow">in</span> <span class="n">xaxis</span><span class="p">:</span>
					<span class="n">ini_species</span><span class="o">=</span><span class="n">ini_isos</span>
					<span class="n">ini_species_frac</span><span class="o">=</span><span class="n">ini_isos_frac</span>
	                                <span class="n">yx2</span><span class="o">=</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">x2</span><span class="p">)</span>
        	                        <span class="n">yx1</span><span class="o">=</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">x1</span><span class="p">)</span>
					<span class="n">ini_species_frac_sol</span><span class="o">=</span><span class="n">ini_iso_frac_sol</span>

				<span class="k">else</span><span class="p">:</span>
					<span class="n">ini_species</span><span class="o">=</span><span class="n">ini_elems</span>
					<span class="n">ini_species_frac</span><span class="o">=</span><span class="n">ini_elems_frac</span>
					<span class="n">ini_species_frac_sol</span><span class="o">=</span><span class="n">ini_elem_frac_sol</span>
					<span class="n">isoavail</span><span class="o">=</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">quantity</span><span class="o">=</span><span class="s1">&#39;Isotopes&#39;</span><span class="p">)</span>
					<span class="n">yx2</span><span class="o">=</span><span class="mi">0</span>
					<span class="n">yx1</span><span class="o">=</span><span class="mi">0</span>
					<span class="c1">#sum up isotopes to get elements</span>
					<span class="c1">#print isoavail</span>
					<span class="c1">#print mini,Z</span>
					<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">isoavail</span><span class="p">)):</span>
						<span class="k">if</span> <span class="n">x1</span> <span class="o">==</span> <span class="n">isoavail</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]:</span>
							<span class="n">yx1</span><span class="o">+=</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">isoavail</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
                                                <span class="k">if</span> <span class="n">x2</span> <span class="o">==</span> <span class="n">isoavail</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]:</span>
                                                        <span class="n">yx2</span><span class="o">+=</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">isoavail</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
					
				<span class="n">x1_ini</span><span class="o">=</span><span class="n">ini_species_frac</span><span class="p">[</span><span class="n">ini_species</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">x1</span><span class="p">)]</span>
				<span class="n">x2_ini</span><span class="o">=</span><span class="n">ini_species_frac</span><span class="p">[</span><span class="n">ini_species</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">x2</span><span class="p">)]</span>
				<span class="n">x1_ini_sol</span><span class="o">=</span><span class="n">ini_species_frac_sol</span><span class="p">[</span><span class="n">ini_species</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">x1</span><span class="p">)]</span>
				<span class="n">x2_ini_sol</span><span class="o">=</span><span class="n">ini_species_frac_sol</span><span class="p">[</span><span class="n">ini_species</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">x2</span><span class="p">)]</span>

				<span class="k">if</span> <span class="n">netyields</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
					<span class="n">miniadd</span><span class="o">=</span><span class="p">(</span><span class="n">x1_ini</span><span class="o">*</span><span class="p">(</span><span class="n">mini</span><span class="o">-</span><span class="n">mfinal</span><span class="p">))</span>
					<span class="n">yx1_frac</span><span class="o">=</span><span class="p">(</span> <span class="n">yx1</span><span class="o">+</span><span class="n">miniadd</span>  <span class="p">)</span><span class="o">/</span><span class="n">totmass</span>
					<span class="n">miniadd</span><span class="o">=</span><span class="p">(</span><span class="n">x2_ini</span><span class="o">*</span><span class="p">(</span><span class="n">m</span><span class="o">-</span><span class="n">mfinal</span><span class="p">))</span>
					<span class="n">yx2_frac</span><span class="o">=</span><span class="p">(</span> <span class="n">yx2</span><span class="o">+</span><span class="n">miniadd</span>  <span class="p">)</span><span class="o">/</span><span class="n">totmass</span>
				<span class="k">else</span><span class="p">:</span>
					<span class="n">yx2_frac</span><span class="o">=</span><span class="n">yx2</span><span class="o">/</span><span class="n">totmass</span>
					<span class="n">yx1_frac</span><span class="o">=</span><span class="n">yx1</span><span class="o">/</span><span class="n">totmass</span>
				<span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="n">np</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span> <span class="n">yx1_frac</span><span class="o">/</span><span class="n">yx2_frac</span> <span class="o">*</span> <span class="n">x2_ini_sol</span><span class="o">/</span><span class="n">x1_ini_sol</span><span class="p">)</span> <span class="p">)</span>
				<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="n">xaxis</span><span class="p">)</span>
				<span class="n">headerx</span><span class="o">=</span><span class="n">xaxis</span>
			<span class="k">elif</span> <span class="s1">&#39;mini&#39;</span> <span class="o">==</span> <span class="n">xaxis</span><span class="p">:</span>
				<span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mini</span><span class="p">)</span>
				<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;initial mass [M$_{\odot}$]&#39;</span><span class="p">)</span>
				<span class="n">headerx</span><span class="o">=</span><span class="s1">&#39;Mini/Msun&#39;</span>
			<span class="k">else</span><span class="p">:</span>
				<span class="k">return</span> <span class="s1">&#39;wrong input&#39;</span>	
			<span class="c1">#	x.append(y_delay.get(M=mini,Z=Z,specie=xaxis))</span>

			<span class="k">if</span> <span class="s1">&#39;[&#39;</span> <span class="ow">in</span> <span class="n">yaxis</span><span class="p">:</span>
                                <span class="n">y1</span><span class="o">=</span><span class="n">yaxis</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">:]</span>
                                <span class="n">y2</span><span class="o">=</span><span class="n">yaxis</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">][:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
                                <span class="k">if</span> <span class="s1">&#39;-&#39;</span> <span class="ow">in</span> <span class="n">yaxis</span><span class="p">:</span>
                                        <span class="n">ini_species</span><span class="o">=</span><span class="n">ini_isos</span>
					<span class="n">ini_species_frac</span><span class="o">=</span><span class="n">ini_isos_frac</span>
					<span class="n">ini_species_frac_sol</span><span class="o">=</span><span class="n">ini_isos_frac_sol</span>
                                        <span class="n">yy2</span><span class="o">=</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">y2</span><span class="p">)</span>
                                        <span class="n">yy1</span><span class="o">=</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">y1</span><span class="p">)</span>
                                <span class="k">else</span><span class="p">:</span>
                                        <span class="n">ini_species</span><span class="o">=</span><span class="n">ini_elems</span>
					<span class="n">ini_species_frac</span><span class="o">=</span><span class="n">ini_elems_frac</span>
					<span class="n">ini_species_frac_sol</span><span class="o">=</span><span class="n">ini_elems_frac_sol</span>
                                        <span class="n">isoavail</span><span class="o">=</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">quantity</span><span class="o">=</span><span class="s1">&#39;Isotopes&#39;</span><span class="p">)</span>
                                        <span class="n">yy2</span><span class="o">=</span><span class="mi">0</span>
                                        <span class="n">yy1</span><span class="o">=</span><span class="mi">0</span>
                                        <span class="c1">#sum up isotopes to get elements</span>
                                        <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">isoavail</span><span class="p">)):</span>
                                                <span class="k">if</span> <span class="n">y1</span> <span class="o">==</span> <span class="n">isoavail</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]:</span>
                                                        <span class="n">yy1</span><span class="o">+=</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">isoavail</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
                                                <span class="k">if</span> <span class="n">y2</span> <span class="o">==</span> <span class="n">isoavail</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]:</span>
                                                        <span class="n">yy2</span><span class="o">+=</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">isoavail</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>

				<span class="n">y1_ini</span><span class="o">=</span><span class="n">ini_species_frac</span><span class="p">[</span><span class="n">ini_species</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">y1</span><span class="p">)]</span>
				<span class="n">y2_ini</span><span class="o">=</span><span class="n">ini_species_frac</span><span class="p">[</span><span class="n">ini_species</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">y2</span><span class="p">)]</span>
				<span class="n">y1_ini_sol</span><span class="o">=</span><span class="n">ini_species_frac_sol</span><span class="p">[</span><span class="n">ini_species</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">y1</span><span class="p">)]</span>
				<span class="n">y2_ini_sol</span><span class="o">=</span><span class="n">ini_species_frac_sol</span><span class="p">[</span><span class="n">ini_species</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">y2</span><span class="p">)]</span>
				<span class="n">yy1_1</span><span class="o">=</span><span class="n">yy1</span>
				<span class="n">yy2_1</span><span class="o">=</span><span class="n">yy2</span>
                                <span class="k">if</span> <span class="n">netyields</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
                                        <span class="n">miniadd</span><span class="o">=</span><span class="p">(</span><span class="n">y1_ini</span><span class="o">*</span><span class="p">(</span><span class="n">mini</span><span class="o">-</span><span class="n">mfinal</span><span class="p">))</span>
					<span class="n">yy1_1</span><span class="o">=</span><span class="p">(</span> <span class="n">yy1</span><span class="o">+</span><span class="n">miniadd</span>  <span class="p">)</span>
                                        <span class="n">miniadd</span><span class="o">=</span><span class="p">(</span><span class="n">y2_ini</span><span class="o">*</span><span class="p">(</span><span class="n">mini</span><span class="o">-</span><span class="n">mfinal</span><span class="p">))</span>
					<span class="n">yy2_1</span><span class="o">=</span><span class="p">(</span> <span class="n">yy2</span><span class="o">+</span><span class="n">miniadd</span>  <span class="p">)</span>
                                <span class="k">if</span> <span class="n">yy1_1</span><span class="o">==</span><span class="mi">0</span> <span class="ow">or</span> <span class="n">yy2_1</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
                                        <span class="k">print</span> <span class="s1">&#39;Zeros for &#39;</span><span class="p">,</span><span class="n">mini</span><span class="p">,</span><span class="s1">&#39; skip mass &#39;</span><span class="p">,</span><span class="n">yy1</span><span class="p">,</span><span class="n">yy2</span>
                                        <span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
                                        <span class="k">continue</span>
				<span class="n">yy1_frac</span><span class="o">=</span><span class="n">yy1_1</span><span class="o">/</span><span class="n">totmass</span>
				<span class="n">yy2_frac</span><span class="o">=</span><span class="n">yy2_1</span><span class="o">/</span><span class="n">totmass</span>
				<span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="n">np</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span> <span class="n">yy1_frac</span><span class="o">/</span><span class="n">yy2_frac</span> <span class="o">*</span> <span class="n">y2_ini_sol</span><span class="o">/</span><span class="n">y1_ini_sol</span><span class="p">)</span> <span class="p">)</span>
				<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="n">yaxis</span><span class="p">)</span>
				<span class="n">headery</span><span class="o">=</span><span class="n">yaxis</span>
			<span class="c1">#for yields</span>
			<span class="k">else</span><span class="p">:</span>
				<span class="k">if</span> <span class="n">netyields</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
					<span class="n">y_ini</span><span class="o">=</span><span class="n">ini_isos_frac</span><span class="p">[</span><span class="n">ini_isos</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">yaxis</span><span class="p">)]</span>
					<span class="n">miniadd</span><span class="o">=</span><span class="p">(</span><span class="n">y_ini</span><span class="o">*</span><span class="p">(</span><span class="n">mini</span><span class="o">-</span><span class="n">mfinal</span><span class="p">))</span>
					<span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">yaxis</span><span class="p">)</span> <span class="o">+</span> <span class="n">miniadd</span><span class="p">)</span>
				<span class="k">else</span><span class="p">:</span>
					<span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">y_delay</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">M</span><span class="o">=</span><span class="n">mini</span><span class="p">,</span><span class="n">Z</span><span class="o">=</span><span class="n">Z</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">yaxis</span><span class="p">))</span>
				<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;yield [M$_{\odot}$]&#39;</span><span class="p">)</span>
				<span class="n">headery</span><span class="o">=</span><span class="s1">&#39;Yields/Msun&#39;</span>
			<span class="c1">#if idx==4:</span>
			<span class="c1">#	ax1.plot([],[],marker=marker[idx1],color=&#39;k&#39;,linestyle=&#39;None&#39;,label=&#39;M=&#39;+str(mini))</span>
			<span class="c1">#ax.plot(x[-1],y[-1],marker=marker[idx1],color=color[idx],linestyle=linestyle[idx])</span>
		<span class="c1">#print x</span>
		<span class="c1">#print y</span>
		<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
			<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;Z=&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">Z</span><span class="p">),</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">)</span>
		<span class="k">else</span><span class="p">:</span>
			<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">)</span>

	<span class="k">if</span> <span class="s1">&#39;[&#39;</span> <span class="ow">in</span> <span class="n">xaxis</span> <span class="ow">and</span> <span class="s1">&#39;[&#39;</span> <span class="ow">in</span> <span class="n">yaxis</span><span class="p">:</span>
		<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">)):</span>
			<span class="n">plt</span><span class="o">.</span><span class="n">annotate</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">masses</span><span class="p">[</span><span class="n">k</span><span class="p">]),</span> <span class="n">xy</span> <span class="o">=</span> <span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="n">k</span><span class="p">],</span> <span class="n">y</span><span class="p">[</span><span class="n">k</span><span class="p">]),</span><span class="n">xytext</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">textcoords</span> <span class="o">=</span> <span class="s1">&#39;offset points&#39;</span><span class="p">)</span>

	<span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
	<span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>
        <span class="c1">#return x,y</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__save_data</span><span class="p">(</span><span class="n">header</span><span class="o">=</span><span class="p">[</span><span class="n">headerx</span><span class="p">,</span><span class="n">headery</span><span class="p">],</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">])</span></div>


<div class="viewcode-block" id="sygma.plot_mass_ratio"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_mass_ratio">[docs]</a>    <span class="k">def</span> <span class="nf">plot_mass_ratio</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span><span class="n">species_ratio</span><span class="o">=</span><span class="s1">&#39;C/N&#39;</span><span class="p">,</span><span class="n">source</span><span class="o">=</span><span class="s1">&#39;all&#39;</span><span class="p">,</span><span class="n">norm</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span><span class="n">multiplot</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">return_x_y</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">logy</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Mass ratio of two species indicated by species_ratio over time.</span>
<span class="sd">	Choice can either be elemental ratio or isotopic ratios.</span>
<span class="sd">	Masses of species are in solar masses.</span>
<span class="sd">	Note: Similar to plot_mass but with ratios of masses. </span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>


<span class="sd">	specie : string</span>
<span class="sd">	     ratio of element or isotope, e.g. &#39;C/O&#39;, &#39;C-12/O-12&#39; 	</span>
<span class="sd">	source : string</span>
<span class="sd">             Specifies if yields come from</span>
<span class="sd">	     all sources (&#39;all&#39;), including</span>
<span class="sd">	     AGB+SN1a, massive stars. Or from</span>
<span class="sd">	     distinctive sources:</span>
<span class="sd">	     only agb stars (&#39;agb&#39;), only</span>
<span class="sd">	     SN1a (&#39;SN1a&#39;), or only massive stars</span>
<span class="sd">             (&#39;massive&#39;)</span>
<span class="sd">        norm : boolean</span>
<span class="sd">             If True, normalize to current total ISM mass</span>
<span class="sd">	label : string</span>
<span class="sd">	     figure label</span>
<span class="sd">	marker : string</span>
<span class="sd">	     figure marker</span>
<span class="sd">	shape : string</span>
<span class="sd">	     line style	</span>
<span class="sd">	color : string</span>
<span class="sd">	     color of line</span>
<span class="sd">        fig : string,float</span>
<span class="sd">	     to name the plot figure       </span>
<span class="sd">	logy : bool</span>
<span class="sd">             if yes, choose yaxis in log scale 	      </span>
<span class="sd"> </span>
<span class="sd">        Examples</span>
<span class="sd">	----------</span>

<span class="sd">	&gt;&gt;&gt; s.plot_mass_ratio(&#39;C-12&#39;)</span>

<span class="sd">        &#39;&#39;&#39;</span>
	<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">&lt;</span><span class="mi">1</span><span class="p">:</span>
		<span class="k">if</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="n">species_ratio</span><span class="o">+</span><span class="s1">&#39;, AGB&#39;</span>
		<span class="k">if</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;massive&#39;</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="n">species_ratio</span><span class="o">+</span><span class="s1">&#39;, Massive&#39;</span>
		<span class="k">if</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="n">species_ratio</span><span class="o">+</span><span class="s1">&#39;, SNIa&#39;</span>

        <span class="c1">#Reserved for plotting</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">return_x_y</span><span class="p">:</span>
            <span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__msc</span><span class="p">(</span><span class="n">source</span><span class="p">,</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="p">)</span>



 
	<span class="n">specie1</span><span class="o">=</span><span class="n">species_ratio</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
	<span class="n">specie2</span><span class="o">=</span><span class="n">species_ratio</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>

        <span class="n">x</span><span class="p">,</span><span class="n">y1</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">plot_mass</span><span class="p">(</span><span class="n">fig</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">specie1</span><span class="p">,</span><span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span><span class="n">norm</span><span class="o">=</span><span class="n">norm</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span><span class="n">multiplot</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">return_x_y</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">)</span>

        <span class="n">x</span><span class="p">,</span><span class="n">y2</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">plot_mass</span><span class="p">(</span><span class="n">fig</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">specie2</span><span class="p">,</span><span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span><span class="n">norm</span><span class="o">=</span><span class="n">norm</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span><span class="n">multiplot</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">return_x_y</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">)</span>
 
        
	<span class="n">y</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">y1</span><span class="p">)</span><span class="o">/</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">y2</span><span class="p">)</span>
         <span class="c1">#Reserved for plotting</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">return_x_y</span><span class="p">:</span>
           <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="n">fsize</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">fsize</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
           <span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
           <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;age [yr]&#39;</span><span class="p">)</span>
           <span class="k">if</span> <span class="n">norm</span> <span class="o">==</span> <span class="bp">False</span><span class="p">:</span>
               <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;yield ratio&#39;</span><span class="p">)</span>
	       <span class="k">if</span> <span class="n">logy</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
                   <span class="n">plt</span><span class="o">.</span><span class="n">yscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
           <span class="k">else</span><span class="p">:</span>
               <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;(IMF-weighted) fraction of ejecta&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">y</span><span class="o">=</span><span class="n">y</span>
        <span class="c1">#If x and y need to be returned ...</span>
        <span class="k">if</span> <span class="n">return_x_y</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span>

        <span class="k">else</span><span class="p">:</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>
            <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>
	    <span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">dt</span><span class="p">,</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">tend</span><span class="p">)</span>	</div>
	    <span class="c1">#self.__save_data(header=[&#39;Age[yr]&#39;,specie],data=[x,y])</span>

       


<div class="viewcode-block" id="sygma.plot_mass"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_mass">[docs]</a>    <span class="k">def</span> <span class="nf">plot_mass</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="s1">&#39;C&#39;</span><span class="p">,</span><span class="n">source</span><span class="o">=</span><span class="s1">&#39;all&#39;</span><span class="p">,</span><span class="n">norm</span><span class="o">=</span><span class="s1">&#39;no&#39;</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span><span class="n">multiplot</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">return_x_y</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">linewidth</span><span class="o">=</span><span class="mi">2</span><span class="p">):</span>
    
        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	mass evolution (in Msun) of an element or isotope vs time.</span>
<span class="sd">	Note: Used in WENDI.</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>


<span class="sd">	specie : string</span>
<span class="sd">             1) isotope or element name, in the form &#39;C&#39; or &#39;C-12&#39;</span>
<span class="sd">	     2) ratio of element or isotope, e.g. &#39;C/O&#39;, &#39;C-12/O-12&#39; 	</span>
<span class="sd">	source : string</span>
<span class="sd">             Specifies if yields come from</span>
<span class="sd">	     all sources (&#39;all&#39;), including</span>
<span class="sd">	     AGB+SN1a, massive stars. Or from</span>
<span class="sd">	     distinctive sources:</span>
<span class="sd">	     only agb stars (&#39;agb&#39;), only</span>
<span class="sd">	     SN1a (&#39;SN1a&#39;), or only massive stars</span>
<span class="sd">             (&#39;massive&#39;)</span>
<span class="sd">        norm : string</span>
<span class="sd">	    if &#39;no&#39;, no normalization</span>
<span class="sd">            If &#39;current&#39;, normalize to current total amount of specie</span>

<span class="sd">	label : string</span>
<span class="sd">	     figure label</span>
<span class="sd">	marker : string</span>
<span class="sd">	     figure marker</span>
<span class="sd">	shape : string</span>
<span class="sd">	     line style	</span>
<span class="sd">	color : string</span>
<span class="sd">	     color of line</span>
<span class="sd">        fig : string,float</span>
<span class="sd">	     to name the plot figure       </span>
<span class="sd"> 	       </span>
<span class="sd">        Examples</span>
<span class="sd">	----------</span>

<span class="sd">	&gt;&gt;&gt; s.plot_mass(specie=&#39;C&#39;)</span>

<span class="sd">        &#39;&#39;&#39;</span>
	<span class="n">yaxis</span><span class="o">=</span><span class="n">specie</span>
	<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">&lt;</span><span class="mi">1</span><span class="p">:</span>
		<span class="n">label</span><span class="o">=</span><span class="n">yaxis</span>
		<span class="k">if</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="n">yaxis</span><span class="o">+</span><span class="s1">&#39;, AGB&#39;</span>
		<span class="k">if</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;massive&#39;</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="n">yaxis</span><span class="o">+</span><span class="s1">&#39;, Massive&#39;</span>
		<span class="k">if</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="n">yaxis</span><span class="o">+</span><span class="s1">&#39;, SNIa&#39;</span>

        <span class="c1">#Reserved for plotting</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">return_x_y</span><span class="p">:</span>
            <span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__msc</span><span class="p">(</span><span class="n">source</span><span class="p">,</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="p">)</span>

        <span class="n">x</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">x</span><span class="o">=</span><span class="n">x</span>
        <span class="n">y</span><span class="o">=</span><span class="p">[]</span>
        <span class="n">yields_evol_all</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield</span>
        <span class="k">if</span> <span class="n">yaxis</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_agb</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_1a</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;massive&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_massive</span>
            <span class="n">idx</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">yaxis</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">yaxis</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_agb</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_1a</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;massive&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_massive</span>
            <span class="n">idx</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">yaxis</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">print</span> <span class="s1">&#39;Isotope or element not available&#39;</span>
            <span class="k">return</span> <span class="mi">0</span>

        <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">)):</span>
            <span class="k">if</span> <span class="n">norm</span> <span class="o">==</span> <span class="s1">&#39;no&#39;</span><span class="p">:</span>
                <span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">idx</span><span class="p">])</span>
            <span class="k">elif</span> <span class="n">norm</span> <span class="o">==</span> <span class="s1">&#39;current&#39;</span><span class="p">:</span>
                <span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">idx</span><span class="p">]</span><span class="o">/</span><span class="n">yields_evol_all</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">idx</span><span class="p">])</span>
	    <span class="k">else</span><span class="p">:</span>
		<span class="k">print</span> <span class="s1">&#39;wrong specification of norm parameter&#39;</span>

        <span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
        <span class="n">y</span><span class="o">=</span><span class="n">y</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
        <span class="k">if</span> <span class="n">multiplot</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
                <span class="k">return</span> <span class="n">x</span><span class="p">,</span><span class="n">y</span>  

        <span class="c1">#Reserved for plotting</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">return_x_y</span><span class="p">:</span>
           <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="n">fsize</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">fsize</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
           <span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
           <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;log-scaled age [yr]&#39;</span><span class="p">)</span>
           <span class="k">if</span> <span class="n">norm</span> <span class="o">==</span> <span class="s1">&#39;no&#39;</span><span class="p">:</span>
               <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;log-scaled integrated ejecta [M$_{\odot}$]&#39;</span><span class="p">)</span>
               <span class="n">plt</span><span class="o">.</span><span class="n">yscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
           <span class="k">else</span><span class="p">:</span>
               <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;log-scaled integrated fraction of ejecta&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">y</span><span class="o">=</span><span class="n">y</span>

        <span class="c1">#If x and y need to be returned ...</span>
        <span class="k">if</span> <span class="n">return_x_y</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span>

        <span class="k">else</span><span class="p">:</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">,</span><span class="n">linewidth</span><span class="o">=</span><span class="n">linewidth</span><span class="p">)</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>
            <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>
	    <span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">dt</span><span class="p">,</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">tend</span><span class="p">)</span>	
	    <span class="c1">#return x,y</span>
	    <span class="bp">self</span><span class="o">.</span><span class="n">__save_data</span><span class="p">(</span><span class="n">header</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;Age[yr]&#39;</span><span class="p">,</span><span class="n">specie</span><span class="p">],</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">])</span></div>

    <span class="k">def</span> <span class="nf">__plot_mass_multi</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;C&#39;</span><span class="p">],</span><span class="n">ylims</span><span class="o">=</span><span class="p">[],</span><span class="n">source</span><span class="o">=</span><span class="s1">&#39;all&#39;</span><span class="p">,</span><span class="n">norm</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="p">[],</span><span class="n">shape</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;-&#39;</span><span class="p">],</span><span class="n">marker</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;o&#39;</span><span class="p">],</span><span class="n">color</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;r&#39;</span><span class="p">],</span><span class="n">markevery</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>

    	<span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Use the function plot_mass multiple times</span>
<span class="sd">	Mass evolution (in Msun) of an element or isotope vs time.</span>
<span class="sd">	</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>


<span class="sd">	yaxis : array</span>
<span class="sd">             isotopes or element names, in the form &#39;C&#39; or &#39;C-12&#39;</span>
<span class="sd">	source : string</span>
<span class="sd">             Specifies if yields come from</span>
<span class="sd">	     all sources (&#39;all&#39;), including</span>
<span class="sd">	     AGB+SN1a, massive stars. Or from</span>
<span class="sd">	     distinctive sources:</span>
<span class="sd">	     only agb stars (&#39;agb&#39;), only</span>
<span class="sd">	     SN1a (&#39;SN1a&#39;), or only massive stars</span>
<span class="sd">             (&#39;massive&#39;)</span>
<span class="sd">        norm : boolean</span>
<span class="sd">             If True, normalize to current total ISM mass</span>
<span class="sd">	label : string</span>
<span class="sd">	     figure label</span>
<span class="sd">	marker : string</span>
<span class="sd">	     figure marker</span>
<span class="sd">	shape : string</span>
<span class="sd">	     line style	</span>
<span class="sd">	color : string</span>
<span class="sd">	     color of line</span>
<span class="sd">        fig : string,float</span>
<span class="sd">	     to name the plot figure       </span>
<span class="sd"> 	       </span>
<span class="sd">        Examples</span>
<span class="sd">	----------</span>

<span class="sd">	&#39;&#39;&#39;</span>
	<span class="c1">#fig=plt.figure(fig)</span>
	<span class="c1">#nplots=1#len(specie)</span>
	<span class="c1">#f, ax_plots = plt.subplots(nplots, sharex=True, sharey=False)</span>
	<span class="n">limits</span><span class="o">=</span><span class="p">[]</span>
	<span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
	<span class="n">props</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">boxstyle</span><span class="o">=</span><span class="s1">&#39;square&#39;</span><span class="p">,</span> <span class="n">facecolor</span><span class="o">=</span><span class="s1">&#39;w&#39;</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
	<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">specie</span><span class="p">)):</span>
		<span class="c1">#if len(ylims)&gt;0:</span>
			<span class="c1">#ylims1=ylims[k]</span>
			<span class="c1">#ax_plots[k].set_ylim(ylims[k][0],ylims[k][1])</span>
		<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
			<span class="n">label1</span><span class="o">=</span><span class="n">specie</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>
		<span class="k">else</span><span class="p">:</span>
			<span class="n">label1</span><span class="o">=</span><span class="n">label</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>
		<span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">plot_mass</span><span class="p">(</span><span class="n">fig</span><span class="o">=</span><span class="n">fig</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="n">specie</span><span class="p">[</span><span class="n">k</span><span class="p">],</span><span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span><span class="n">norm</span><span class="o">=</span><span class="n">norm</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label1</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="n">shape</span><span class="p">[</span><span class="n">k</span><span class="p">],</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">[</span><span class="n">k</span><span class="p">],</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">[</span><span class="n">k</span><span class="p">],</span><span class="n">markevery</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span><span class="n">multiplot</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
		<span class="c1">#x=np.log10(np.array(x))</span>
		<span class="n">y</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">y</span><span class="p">))</span>
		<span class="c1">#ax_plots[k]</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label1</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">[</span><span class="n">k</span><span class="p">],</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">[</span><span class="n">k</span><span class="p">],</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">[</span><span class="n">k</span><span class="p">],</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
		<span class="c1">#ax_plots[k].set_ylim(min(y),max(y))</span>
		<span class="n">limits</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="nb">min</span><span class="p">(</span><span class="n">y</span><span class="p">),</span><span class="nb">max</span><span class="p">(</span><span class="n">y</span><span class="p">)])</span>
		<span class="c1">#ax_plots[k].set_xlim(min(x),max(x))</span>
		<span class="c1">#ax_plots[k].</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
		<span class="c1">#ax_plots[k].set_yscale(&#39;log&#39;)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;log-scaled age [yr]&#39;</span><span class="p">)</span>
		<span class="c1">#ax_plots[k].locator_params(axis = &#39;y&#39;, nbins = 2)</span>
		<span class="c1">#if norm == False:</span>
		    <span class="c1">#ax_plots[k].set_ylabel(&#39;yield [Msun]&#39;)</span>
		    <span class="c1">#ax_plots[k].set_yscale(&#39;log&#39;)</span>
		<span class="c1">#else:</span>
		<span class="c1">#    ax_plots[k].set_ylabel(&#39;(IMF-weighted) fraction of ejecta&#39;)</span>
		<span class="c1">#plt.legend()</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">,</span><span class="n">lwtickboth</span><span class="o">=</span><span class="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span><span class="n">lwtickmajor</span><span class="o">=</span><span class="p">[</span><span class="mi">5</span><span class="p">,</span><span class="mi">1</span><span class="p">])</span>
		<span class="c1">#ax_plots[k].</span>
		<span class="c1">#plt.legend().set_visible(False)</span>
		<span class="c1">#x.legend(loc=&#39;center right&#39;, bbox_to_anchor=(1, 0.5),markerscale=0.8,fontsize=fontsize).set_visible(False)</span>
		<span class="c1">#ax_plots[k]</span>
		<span class="c1">#.text(0.90, 0.80, label1, transform=ax_plots[k].transAxes, fontsize=18,verticalalignment=&#39;top&#39;, bbox=props)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">dt</span><span class="p">,</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">tend</span><span class="p">)</span>
	<span class="k">if</span> <span class="n">norm</span> <span class="o">==</span> <span class="bp">False</span><span class="p">:</span>
		<span class="n">fig</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span>
		<span class="n">fig</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="mf">0.002</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="s1">&#39;Log (Yield [M$_{\odot}$])&#39;</span><span class="p">,</span> <span class="n">ha</span><span class="o">=</span><span class="s1">&#39;center&#39;</span><span class="p">,</span> <span class="n">va</span><span class="o">=</span><span class="s1">&#39;center&#39;</span><span class="p">,</span> <span class="n">rotation</span><span class="o">=</span><span class="s1">&#39;vertical&#39;</span><span class="p">)</span>
	<span class="k">else</span><span class="p">:</span>
		<span class="n">fig</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span>
		<span class="n">fig</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="mf">0.01</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="s1">&#39;(IMF-weighted) fraction of ejecta&#39;</span><span class="p">,</span> <span class="n">ha</span><span class="o">=</span><span class="s1">&#39;center&#39;</span><span class="p">,</span> <span class="n">va</span><span class="o">=</span><span class="s1">&#39;center&#39;</span><span class="p">,</span> <span class="n">rotation</span><span class="o">=</span><span class="s1">&#39;vertical&#39;</span><span class="p">)</span>

	<span class="c1">#set lim here</span>
	<span class="c1">#print limits</span>
	<span class="c1">#for k in range(len(ax_plots)):</span>
	<span class="c1">#	ax_plots[k].set_ylim(limits[k][0],limits[k][1])</span>

	<span class="c1">#f.subplots_adjust(hspace=0.35)#0)</span>
	<span class="c1">#plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False)</span>
	<span class="k">return</span> 


<div class="viewcode-block" id="sygma.plot_massfrac"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_massfrac">[docs]</a>    <span class="k">def</span> <span class="nf">plot_massfrac</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span><span class="n">xaxis</span><span class="o">=</span><span class="s1">&#39;age&#39;</span><span class="p">,</span><span class="n">yaxis</span><span class="o">=</span><span class="s1">&#39;O-16&#39;</span><span class="p">,</span><span class="n">source</span><span class="o">=</span><span class="s1">&#39;all&#39;</span><span class="p">,</span><span class="n">norm</span><span class="o">=</span><span class="s1">&#39;no&#39;</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Plots mass fraction of isotope or element</span>
<span class="sd">	vs either time or other isotope or element.</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>
<span class="sd">	xaxis : string </span>
<span class="sd">            either &#39;age&#39; for time</span>
<span class="sd">	    or isotope name, in the form e.g. &#39;C-12&#39;</span>
<span class="sd">	yaxis : string</span>
<span class="sd">            isotope name, in the same form as for xaxis</span>

<span class="sd">	source : string</span>
<span class="sd">            Specifies if yields come from</span>
<span class="sd">	    all sources (&#39;all&#39;), including</span>
<span class="sd">	    AGB+SN1a, massive stars. Or from</span>
<span class="sd">	    distinctive sources:</span>
<span class="sd">	    only agb stars (&#39;agb&#39;), only</span>
<span class="sd">	    SN1a (&#39;SN1a&#39;), or only massive stars</span>
<span class="sd">            (&#39;massive&#39;)</span>

<span class="sd">        norm : string</span>
<span class="sd">            if &#39;no&#39;, no normalization of mass fraction</span>
<span class="sd">            if &#39;ini&#39;, normalization ot initial abundance</span>
<span class="sd">        label : string</span>
<span class="sd">             figure label</span>
<span class="sd">        marker : string</span>
<span class="sd">             figure marker</span>
<span class="sd">        shape : string</span>
<span class="sd">             line style </span>
<span class="sd">        color : string</span>
<span class="sd">             color of line</span>
<span class="sd">        fig : string,float</span>
<span class="sd">             to name the plot figure       </span>

<span class="sd">        </span>
<span class="sd">        Examples</span>
<span class="sd">        ----------</span>

<span class="sd">	&gt;&gt;&gt; s.plot_massfrac(&#39;age&#39;,&#39;C-12&#39;)</span>

<span class="sd">        &#39;&#39;&#39;</span>

        <span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="kn">as</span> <span class="nn">plt</span>

        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">&lt;</span><span class="mi">1</span><span class="p">:</span>
                <span class="n">label</span><span class="o">=</span><span class="n">yaxis</span>

	<span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__msc</span><span class="p">(</span><span class="n">source</span><span class="p">,</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="p">)</span>



        <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="n">fsize</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">fsize</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>

 
        <span class="c1">#Input X-axis</span>
        <span class="k">if</span> <span class="s1">&#39;-&#39;</span> <span class="ow">in</span> <span class="n">xaxis</span><span class="p">:</span>
        <span class="c1">#to test the different contributions</span>
	    <span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
	       <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield</span>
	    <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
	      <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_agb</span>
	    <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
	      <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_1a</span>
	    <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;massive&#39;</span><span class="p">:</span>
	     <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_massive</span>
	     <span class="n">iso_idx</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">xaxis</span><span class="p">)</span>
            <span class="n">x</span><span class="o">=</span><span class="p">[]</span>
	    <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">)):</span>
	       <span class="k">if</span> <span class="n">norm</span><span class="o">==</span><span class="s1">&#39;no&#39;</span><span class="p">:</span>
	           <span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">]))</span>
	       <span class="k">if</span> <span class="n">norm</span><span class="o">==</span><span class="s1">&#39;ini&#39;</span><span class="p">:</span>
	           <span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span><span class="o">/</span><span class="n">yields_evol</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">])</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;X(&#39;</span><span class="o">+</span><span class="n">xaxis</span><span class="o">+</span><span class="s1">&#39;)&#39;</span><span class="p">)</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="s1">&#39;age&#39;</span> <span class="o">==</span> <span class="n">xaxis</span><span class="p">:</span>
            <span class="n">x</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span><span class="c1">#[1:]</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;age [yr]&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="s1">&#39;Z&#39;</span> <span class="o">==</span> <span class="n">xaxis</span><span class="p">:</span>
            <span class="n">x</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">metallicity</span><span class="c1">#[1:]</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;ISM metallicity&#39;</span><span class="p">)</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">xaxis</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_agb</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_1a</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;massive&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_massive</span>
            <span class="n">iso_idx</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">xaxis</span><span class="p">)</span>
            <span class="n">x</span><span class="o">=</span><span class="p">[]</span>
            <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">)):</span>
                <span class="k">if</span> <span class="n">norm</span><span class="o">==</span><span class="s1">&#39;no&#39;</span><span class="p">:</span>
                    <span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">]))</span>
                <span class="k">if</span> <span class="n">norm</span><span class="o">==</span><span class="s1">&#39;ini&#39;</span><span class="p">:</span>
                    <span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span><span class="o">/</span><span class="n">yields_evol</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">])</span>
                    <span class="k">print</span> <span class="n">yields_evol</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">]</span>

            <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;X(&#39;</span><span class="o">+</span><span class="n">xaxis</span><span class="o">+</span><span class="s1">&#39;)&#39;</span><span class="p">)</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>


        <span class="c1">#Input Y-axis</span>
        <span class="k">if</span> <span class="s1">&#39;-&#39;</span> <span class="ow">in</span> <span class="n">yaxis</span><span class="p">:</span>
            <span class="c1">#to test the different contributions</span>
            <span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_agb</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_1a</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;massive&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_massive</span>
            <span class="n">iso_idx</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">yaxis</span><span class="p">)</span>
            <span class="n">y</span><span class="o">=</span><span class="p">[]</span>
            <span class="c1">#change of xaxis array &#39;age &#39;due to continue statement below</span>
            <span class="k">if</span> <span class="n">xaxis</span><span class="o">==</span><span class="s1">&#39;age&#39;</span><span class="p">:</span>
                <span class="n">x_age</span><span class="o">=</span><span class="n">x</span>
                <span class="n">x</span><span class="o">=</span><span class="p">[]</span>
            <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">)):</span>
                <span class="k">if</span> <span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="o">==</span><span class="mi">0</span><span class="p">:</span>
                    <span class="k">continue</span>
                <span class="k">if</span> <span class="n">norm</span><span class="o">==</span><span class="s1">&#39;no&#39;</span><span class="p">:</span>
                    <span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">]))</span>
                <span class="k">if</span> <span class="n">norm</span><span class="o">==</span><span class="s1">&#39;ini&#39;</span><span class="p">:</span>
                    <span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span><span class="o">/</span><span class="n">yields_evol</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">])</span>

                <span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">x_age</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;X(&#39;</span><span class="o">+</span><span class="n">yaxis</span><span class="o">+</span><span class="s1">&#39;)&#39;</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">y</span><span class="o">=</span><span class="n">y</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">yscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="s1">&#39;Z&#39;</span> <span class="o">==</span> <span class="n">yaxis</span><span class="p">:</span>
            <span class="n">y</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">metallicity</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;ISM metallicity&#39;</span><span class="p">)</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">yscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">yaxis</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_agb</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_1a</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;massive&#39;</span><span class="p">:</span>
                <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_massive</span>
            <span class="n">iso_idx</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">yaxis</span><span class="p">)</span>
            <span class="n">y</span><span class="o">=</span><span class="p">[]</span>
            <span class="c1">#change of xaxis array &#39;age &#39;due to continue statement below</span>
            <span class="k">if</span> <span class="n">xaxis</span><span class="o">==</span><span class="s1">&#39;age&#39;</span><span class="p">:</span>
                <span class="n">x_age</span><span class="o">=</span><span class="n">x</span>
                <span class="n">x</span><span class="o">=</span><span class="p">[]</span>
            <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">)):</span>
                <span class="k">if</span> <span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="o">==</span><span class="mi">0</span><span class="p">:</span>
                    <span class="k">continue</span>
                <span class="k">if</span> <span class="n">norm</span><span class="o">==</span><span class="s1">&#39;no&#39;</span><span class="p">:</span>
                    <span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">]))</span>
                <span class="k">if</span> <span class="n">norm</span><span class="o">==</span><span class="s1">&#39;ini&#39;</span><span class="p">:</span>
                    <span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span><span class="o">/</span><span class="n">yields_evol</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">])</span>

                <span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">x_age</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
            <span class="c1">#plt.yscale(&#39;log&#39;)</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;X(&#39;</span><span class="o">+</span><span class="n">yaxis</span><span class="o">+</span><span class="s1">&#39;)&#39;</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">y</span><span class="o">=</span><span class="n">y</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">yscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
        <span class="c1">#To prevent 0 +log scale</span>
        <span class="k">if</span> <span class="s1">&#39;age&#39;</span> <span class="o">==</span> <span class="n">xaxis</span><span class="p">:</span>
                <span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
                <span class="n">y</span><span class="o">=</span><span class="n">y</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">dt</span><span class="p">,</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">tend</span><span class="p">)</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>
        <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>
	<span class="bp">self</span><span class="o">.</span><span class="n">__save_data</span><span class="p">(</span><span class="n">header</span><span class="o">=</span><span class="p">[</span><span class="n">xaxis</span><span class="p">,</span><span class="n">yaxis</span><span class="p">],</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">])</span></div>

<div class="viewcode-block" id="sygma.plot_spectro"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_spectro">[docs]</a>    <span class="k">def</span> <span class="nf">plot_spectro</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span><span class="n">xaxis</span><span class="o">=</span><span class="s1">&#39;age&#39;</span><span class="p">,</span><span class="n">yaxis</span><span class="o">=</span><span class="s1">&#39;[Fe/H]&#39;</span><span class="p">,</span><span class="n">source</span><span class="o">=</span><span class="s1">&#39;all&#39;</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;-&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;o&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;k&#39;</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span><span class="n">show_data</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">show_sculptor</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">show_legend</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span><span class="n">return_x_y</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">sub_plot</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">linewidth</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span><span class="n">sub</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">solar_ab</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">        Plots elements in spectroscopic notation.</span>
<span class="sd">	Note: Used in WENDI.</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">	xaxis : string</span>
<span class="sd">            Spectroscopic notation of elements e.g. [Fe/H]</span>
<span class="sd">	    if &#39;age&#39;: time evolution in years</span>
<span class="sd">	yaxis : string</span>
<span class="sd">                Elements in spectroscopic notation, e.g. [C/Fe]</span>
<span class="sd">	source : string</span>
<span class="sd">                If yields come from</span>
<span class="sd">		all sources use &#39;all&#39; (include</span>
<span class="sd">		AGB+SN1a, massive stars.)</span>

<span class="sd">		If yields come from distinctive source:</span>
<span class="sd">		only agb stars use &#39;agb&#39;, only</span>
<span class="sd">		SN1a (&#39;SN1a&#39;), or only massive stars</span>
<span class="sd">		(&#39;massive&#39;)</span>

<span class="sd">        label : string</span>
<span class="sd">             figure label</span>
<span class="sd">        marker : string</span>
<span class="sd">             figure marker</span>
<span class="sd">        shape : string</span>
<span class="sd">             line style </span>
<span class="sd">        color : string</span>
<span class="sd">             color of line</span>
<span class="sd">        fig : string,float</span>
<span class="sd">             to name the plot figure       </span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>
<span class="sd">	&gt;&gt;&gt; plt.plot_spectro(&#39;[Fe/H]&#39;,&#39;[C/Fe]&#39;)</span>

<span class="sd">        &#39;&#39;&#39;</span>

        <span class="c1">#Error message if there is the &quot;subplot&quot; has not been provided</span>
        <span class="k">if</span> <span class="n">sub_plot</span> <span class="ow">and</span> <span class="n">sub</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="k">print</span> <span class="s1">&#39;!! Error - You need to use the </span><span class="se">\&#39;</span><span class="s1">sub</span><span class="se">\&#39;</span><span class="s1"> parameter and provide the frame for the plot !!&#39;</span>
            <span class="k">return</span>

        <span class="c1">#Operations associated with plot visual aspects</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">return_x_y</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">sub_plot</span><span class="p">:</span>

            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">&lt;</span><span class="mi">1</span><span class="p">:</span>
                    <span class="n">label</span><span class="o">=</span><span class="n">yaxis</span>

            <span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__msc</span><span class="p">(</span><span class="n">source</span><span class="p">,</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="p">)</span>

        <span class="c1">#Set the figure output</span>
        <span class="k">if</span> <span class="n">sub_plot</span><span class="p">:</span>
            <span class="n">plt_ps</span> <span class="o">=</span> <span class="n">sub</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">plt_ps</span> <span class="o">=</span> <span class="n">plt</span>


        <span class="c1">#Access solar abundance</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">solar_ab</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">iniabu</span><span class="o">=</span><span class="n">ry</span><span class="o">.</span><span class="n">iniabu</span><span class="p">(</span><span class="n">global_path</span><span class="o">+</span><span class="n">solar_ab</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">iniabu</span><span class="o">=</span><span class="n">ry</span><span class="o">.</span><span class="n">iniabu</span><span class="p">(</span><span class="n">global_path</span><span class="o">+</span><span class="s1">&#39;yield_tables/iniabu/iniab2.0E-02GN93.ppn&#39;</span><span class="p">)</span>

        <span class="n">x_ini_iso</span><span class="o">=</span><span class="n">iniabu</span><span class="o">.</span><span class="n">iso_abundance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="p">)</span>
        <span class="n">elements</span><span class="p">,</span><span class="n">x_ini</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_iso_abu_to_elem</span><span class="p">(</span><span class="n">x_ini_iso</span><span class="p">)</span>
        <span class="c1">#to test the different contributions</span>
        <span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
            <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield</span>
        <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
            <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_agb</span>
        <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
            <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_1a</span>
        <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;massive&#39;</span><span class="p">:</span>
            <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_massive</span>

        <span class="c1">#Operations associated with plot visual aspects</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">return_x_y</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">sub_plot</span><span class="p">:</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="n">fsize</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">fsize</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>



        <span class="c1">######################################</span>


        <span class="k">if</span> <span class="s1">&#39;age&#39;</span> <span class="o">==</span> <span class="n">xaxis</span><span class="p">:</span>
            <span class="n">x</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span>

            <span class="c1">#Operations associated with plot visual aspects</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="n">return_x_y</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">sub_plot</span><span class="p">:</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;log-scaled age [yr]&#39;</span><span class="p">)</span>

            <span class="bp">self</span><span class="o">.</span><span class="n">x</span><span class="o">=</span><span class="n">x</span>
        <span class="k">else</span><span class="p">:</span>


            <span class="n">xaxis_elem1</span><span class="o">=</span><span class="n">xaxis</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">:]</span>
            <span class="n">xaxis_elem2</span><span class="o">=</span><span class="n">xaxis</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">][:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>

            <span class="c1">#print xaxis_elem1, xaxis_elem2</span>

            <span class="c1">#X-axis ini values</span>
            <span class="n">x_elem1_ini</span><span class="o">=</span><span class="n">x_ini</span><span class="p">[</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">xaxis_elem1</span><span class="p">)]</span>
            <span class="n">x_elem2_ini</span><span class="o">=</span><span class="n">x_ini</span><span class="p">[</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">xaxis_elem2</span><span class="p">)]</span>

            <span class="c1">#X-axis gce values</span>
            <span class="n">elem_idx1</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">xaxis_elem1</span><span class="p">)</span>
            <span class="n">elem_idx2</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">xaxis_elem2</span><span class="p">)</span>

            <span class="n">x</span><span class="o">=</span><span class="p">[]</span>
            <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">)):</span>
                <span class="k">if</span> <span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="o">==</span><span class="mi">0</span><span class="p">:</span>
                    <span class="k">continue</span>
                <span class="c1">#in case no contribution during timestep</span>
                <span class="n">x1</span><span class="o">=</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">elem_idx1</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
                <span class="n">x2</span><span class="o">=</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">elem_idx2</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
                <span class="n">spec</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span><span class="n">x1</span><span class="o">/</span><span class="n">x2</span><span class="p">)</span> <span class="o">-</span> <span class="n">np</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span><span class="n">x_elem1_ini</span><span class="o">/</span><span class="n">x_elem2_ini</span><span class="p">)</span>
                <span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">spec</span><span class="p">)</span>
            <span class="c1">#Operations associated with plot visual aspects</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="n">return_x_y</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">sub_plot</span><span class="p">:</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="n">xaxis</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">x</span><span class="o">=</span><span class="n">x</span>



        <span class="n">yaxis_elem1</span><span class="o">=</span><span class="n">yaxis</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">:]</span>
        <span class="n">yaxis_elem2</span><span class="o">=</span><span class="n">yaxis</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">][:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>

        <span class="c1">#y=axis ini values</span>
        <span class="n">x_elem1_ini</span><span class="o">=</span><span class="n">x_ini</span><span class="p">[</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">yaxis_elem1</span><span class="p">)]</span>
        <span class="n">x_elem2_ini</span><span class="o">=</span><span class="n">x_ini</span><span class="p">[</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">yaxis_elem2</span><span class="p">)]</span>

        <span class="c1">#Y-axis gce values</span>
        <span class="n">elem_idx1</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">yaxis_elem1</span><span class="p">)</span>
        <span class="n">elem_idx2</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">yaxis_elem2</span><span class="p">)</span>

        <span class="n">y</span><span class="o">=</span><span class="p">[]</span>
        <span class="k">if</span> <span class="n">xaxis</span><span class="o">==</span><span class="s1">&#39;age&#39;</span><span class="p">:</span>
            <span class="n">x_age</span><span class="o">=</span><span class="n">x</span>
            <span class="n">x</span><span class="o">=</span><span class="p">[]</span>
        <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">)):</span>
            <span class="k">if</span> <span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="o">==</span><span class="mi">0</span><span class="p">:</span>
                <span class="k">continue</span>
            <span class="c1">#in case no contribution during timestep</span>
            <span class="n">x1</span><span class="o">=</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">elem_idx1</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
            <span class="n">x2</span><span class="o">=</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">elem_idx2</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
            <span class="n">spec</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span><span class="n">x1</span><span class="o">/</span><span class="n">x2</span><span class="p">)</span> <span class="o">-</span> <span class="n">np</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span><span class="n">x_elem1_ini</span><span class="o">/</span><span class="n">x_elem2_ini</span><span class="p">)</span>
            <span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">spec</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">xaxis</span><span class="o">==</span><span class="s1">&#39;age&#39;</span><span class="p">:</span>
                <span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">x_age</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">y</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
            <span class="k">print</span> <span class="s1">&#39;Y values all zero&#39;</span>
        <span class="c1">#Operations associated with plot visual aspects</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">return_x_y</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">sub_plot</span><span class="p">:</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="n">yaxis</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">y</span><span class="o">=</span><span class="n">y</span>
	<span class="c1">#To prevent 0 +log scale</span>
	<span class="k">if</span> <span class="s1">&#39;age&#39;</span> <span class="o">==</span> <span class="n">xaxis</span><span class="p">:</span>
		<span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
		<span class="n">y</span><span class="o">=</span><span class="n">y</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
                <span class="c1">#Operations associated with plot visual aspects</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="n">return_x_y</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">sub_plot</span><span class="p">:</span>
                    <span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">dt</span><span class="p">,</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">tend</span><span class="p">)</span>

        <span class="c1">#Remove values when SFR is zero, that is when no element is locked into stars</span>
        <span class="n">i_rem</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span>
        <span class="c1">#while self.history.sfr_abs[i_rem] == 0.0:</span>
        <span class="c1">#    del y[-1]</span>
        <span class="c1">#    del x[-1]</span>
        <span class="c1">#    i_rem -= 1</span>

        <span class="c1">#If this function is supposed to return the x, y arrays only ...</span>
        <span class="k">if</span> <span class="n">return_x_y</span><span class="p">:</span>

            <span class="k">return</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span>

        <span class="c1">#If this is a sub-figure managed by an external module</span>
        <span class="k">elif</span> <span class="n">sub_plot</span><span class="p">:</span>

            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">galaxy</span> <span class="o">==</span> <span class="s1">&#39;none&#39;</span><span class="p">:</span>
                <span class="k">if</span> <span class="n">show_legend</span><span class="p">:</span>
                    <span class="n">sub</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">sub</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">if</span> <span class="n">show_legend</span><span class="p">:</span>
                    <span class="n">sub</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">,</span><span class="n">linewidth</span><span class="o">=</span><span class="n">linewidth</span><span class="p">)</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">sub</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">,</span><span class="n">linewidth</span><span class="o">=</span><span class="n">linewidth</span><span class="p">)</span> 

        <span class="c1">#If this function is supposed to plot ...</span>
        <span class="k">else</span><span class="p">:</span>

            <span class="c1">#Plot a thicker line for specific galaxies, since they must be visible with all the obs. data</span>
            <span class="k">if</span> <span class="bp">True</span><span class="p">:</span>
                <span class="k">if</span> <span class="n">show_legend</span><span class="p">:</span>
                    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">if</span> <span class="n">show_legend</span><span class="p">:</span>
                    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">,</span><span class="n">linewidth</span><span class="o">=</span><span class="n">linewidth</span><span class="p">)</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">,</span><span class="n">linewidth</span><span class="o">=</span><span class="n">linewidth</span><span class="p">)</span>

            <span class="c1">#plt.plot([1.93,2.123123,3.23421321321],[4.123123132,5.214124142,6.11111],linestyle=&#39;--&#39;)</span>
            <span class="c1">#plt.plot([1.93,2.123123,3.23421321321],[4.123123132,5.214124142,6.11111],linestyle=&#39;--&#39;)</span>
	    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
	            <span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>
            <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>
	    <span class="bp">self</span><span class="o">.</span><span class="n">__save_data</span><span class="p">(</span><span class="n">header</span><span class="o">=</span><span class="p">[</span><span class="n">xaxis</span><span class="p">,</span><span class="n">yaxis</span><span class="p">],</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">])</span></div>


    <span class="k">def</span> <span class="nf">__plot_abu_distr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span><span class="n">t</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span><span class="n">x_axis</span><span class="o">=</span><span class="s1">&#39;A&#39;</span><span class="p">,</span><span class="n">solar_norm</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span><span class="n">marker1</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span><span class="n">linest</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span><span class="n">y_range</span><span class="o">=</span><span class="p">[],</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;CHEM  module&#39;</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	EXPERIMENTAL: DO NOT USE</span>
<span class="sd">	Plots abundance distribution of stable isotopes</span>
<span class="sd">	of certain time t (X/X_sol vs A).:</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">	t : float</span>
<span class="sd">            default end of the simulation tend</span>
<span class="sd">	x_axis :  string</span>
<span class="sd">            only &#39;A&#39; setting, mass number, possible</span>
<span class="sd">        solar_norm : boolean</span>
<span class="sd">            if true, normalize to solar value</span>
<span class="sd">        linest : string</span>
<span class="sd">            linestyle</span>
<span class="sd">        makre1 : string</span>
<span class="sd">            for marker</span>
<span class="sd">        y_range : list</span>
<span class="sd">            contains min and max</span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>
<span class="sd">	&gt;&gt;&gt; s.plot_abu_distr()</span>

<span class="sd">        &#39;&#39;&#39;</span>


        <span class="n">color</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;r&#39;</span><span class="p">,</span><span class="s1">&#39;k&#39;</span><span class="p">,</span><span class="s1">&#39;b&#39;</span><span class="p">,</span><span class="s1">&#39;g&#39;</span><span class="p">]</span>
        <span class="n">marker_type</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;o&#39;</span><span class="p">,</span><span class="s1">&#39;+&#39;</span><span class="p">,</span><span class="s1">&#39;s&#39;</span><span class="p">,</span><span class="s1">&#39;D&#39;</span><span class="p">]</span>
        <span class="n">line_style</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;--&#39;</span><span class="p">,</span><span class="s1">&#39;-&#39;</span><span class="p">,</span><span class="s1">&#39;-.&#39;</span><span class="p">,</span><span class="s1">&#39;:&#39;</span><span class="p">]</span>


        <span class="n">x</span><span class="o">=</span><span class="p">[]</span>
        <span class="n">y</span><span class="o">=</span><span class="p">[]</span>
        <span class="n">fig</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span><span class="mi">8</span><span class="p">))</span>
        <span class="n">ax</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">y_range</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">ylim</span><span class="p">(</span><span class="n">y_range</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">y_range</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
        <span class="n">elem_array</span><span class="o">=</span><span class="p">[]</span>
        <span class="n">y_array</span><span class="o">=</span><span class="p">[]</span>
        <span class="n">iso_name</span><span class="o">=</span><span class="s1">&#39;H-1&#39;</span>
        <span class="n">ele</span><span class="o">=</span><span class="s1">&#39;H&#39;</span>
        <span class="n">i</span><span class="o">=</span><span class="mi">0</span>
        <span class="n">colormap</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">cm</span><span class="o">.</span><span class="n">prism</span><span class="c1">#flag #gist_ncar</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span><span class="o">.</span><span class="n">set_color_cycle</span><span class="p">([</span><span class="n">colormap</span><span class="p">(</span><span class="n">j</span><span class="p">)</span> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mf">0.9</span><span class="p">,</span> <span class="mi">100</span><span class="p">)])</span>


        <span class="k">if</span> <span class="n">t</span><span class="o">==-</span><span class="mi">1</span><span class="p">:</span>
            <span class="n">t</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">tend</span>
        <span class="n">idx</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">t</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">dt</span><span class="p">)</span> <span class="o">-</span><span class="mi">1</span>
        <span class="n">isotopes1</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span>
        <span class="n">yields_iso1</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield</span><span class="p">[</span><span class="n">idx</span><span class="p">]</span>
        <span class="n">isotopes</span><span class="o">=</span><span class="p">[]</span>
        <span class="n">yields_iso</span><span class="o">=</span><span class="p">[]</span>

        <span class="c1">#Check for stable isotopes</span>
        <span class="kn">from</span> <span class="nn">nugrid_set</span> <span class="kn">import</span> <span class="n">is_stable</span>
        <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">isotopes1</span><span class="p">)):</span>
            <span class="k">if</span> <span class="n">is_stable</span><span class="p">(</span><span class="n">isotopes1</span><span class="p">[</span><span class="n">k</span><span class="p">]):</span>
                <span class="n">isotopes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">isotopes1</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
                <span class="n">yields_iso</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">yields_iso1</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>


        <span class="n">iniabu</span><span class="o">=</span><span class="n">ry</span><span class="o">.</span><span class="n">iniabu</span><span class="p">(</span><span class="s1">&#39;yield_tables/iniabu/iniab2.0E-02GN93.ppn&#39;</span><span class="p">)</span>
        <span class="n">x_ini_iso</span><span class="o">=</span><span class="n">iniabu</span><span class="o">.</span><span class="n">iso_abundance</span><span class="p">(</span><span class="n">isotopes</span><span class="p">)</span>
        <span class="c1">#elements,x_ini=self.iso_abu_to_elem(self.isotopes,x_ini_iso)</span>

        <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">isotopes</span><span class="p">)):</span>
            <span class="n">elem_name</span><span class="o">=</span><span class="n">isotopes</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
            <span class="k">if</span> <span class="n">x_axis</span><span class="o">==</span><span class="s1">&#39;A&#39;</span><span class="p">:</span>
                <span class="c1"># Xi / Xsun</span>
                <span class="n">yields_norm</span><span class="o">=</span><span class="p">(</span><span class="n">yields_iso</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_iso</span><span class="p">))</span><span class="o">/</span><span class="n">x_ini_iso</span><span class="p">[</span><span class="n">isotopes</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">isotopes</span><span class="p">[</span><span class="n">k</span><span class="p">])]</span>

                <span class="c1">#in the case of isotope of same element as before</span>
                <span class="k">if</span> <span class="n">elem_name</span><span class="o">==</span><span class="n">ele</span><span class="p">:</span>
                    <span class="n">elem_array</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">isotopes</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span> <span class="p">)</span>
                    <span class="n">y_array</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">yields_norm</span> <span class="p">)</span>
                    <span class="k">print</span> <span class="s1">&#39;new iso&#39;</span><span class="p">,</span><span class="n">isotopes</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>
                    <span class="c1">#i+=1</span>
                    <span class="k">if</span> <span class="ow">not</span> <span class="n">k</span><span class="o">==</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">isotopes</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">):</span>
                        <span class="k">continue</span>
                <span class="k">print</span> <span class="n">k</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">elem_array</span><span class="p">,</span><span class="n">y_array</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker_type</span><span class="p">[</span><span class="n">marker1</span><span class="p">],</span><span class="n">markersize</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">line_style</span><span class="p">[</span><span class="n">linest</span><span class="p">])</span>
                <span class="k">print</span> <span class="n">elem_array</span>
                <span class="k">print</span> <span class="n">y_array</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
                <span class="n">i</span><span class="o">+=</span><span class="mi">1</span>
                <span class="k">if</span> <span class="p">(</span><span class="n">i</span><span class="o">%</span><span class="mi">2</span><span class="p">)</span> <span class="o">==</span><span class="mi">0</span><span class="p">:</span>
                    <span class="n">high</span><span class="o">=</span><span class="mi">6</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">high</span><span class="o">=</span><span class="mi">4</span>
                <span class="k">print</span> <span class="s1">&#39;i&#39;</span><span class="p">,</span><span class="n">i</span>
                <span class="k">print</span> <span class="s1">&#39;high&#39;</span><span class="p">,</span><span class="n">high</span>
                <span class="n">y_pos</span><span class="o">=</span><span class="p">(</span><span class="nb">max</span><span class="p">(</span><span class="n">y_array</span><span class="p">))</span>
                <span class="n">x_pos</span><span class="o">=</span>  <span class="n">elem_array</span><span class="p">[</span><span class="n">y_array</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="nb">max</span><span class="p">(</span><span class="n">y_array</span><span class="p">))]</span>
                <span class="n">ax</span><span class="o">.</span><span class="n">annotate</span><span class="p">(</span><span class="n">iso_name</span><span class="p">,</span> <span class="n">xy</span><span class="o">=</span><span class="p">(</span><span class="n">x_pos</span><span class="p">,</span> <span class="n">y_pos</span><span class="p">),</span> <span class="n">xytext</span><span class="o">=</span><span class="p">(</span><span class="n">elem_array</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">high</span><span class="p">))</span>

                <span class="n">ele</span><span class="o">=</span><span class="n">elem_name</span>
                <span class="n">iso_name</span><span class="o">=</span><span class="n">isotopes</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>
                <span class="n">y_array</span><span class="o">=</span><span class="p">[]</span>
                <span class="n">y_array</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">yields_norm</span><span class="p">)</span>
                <span class="n">elem_array</span><span class="o">=</span><span class="p">[]</span>
                <span class="n">elem_array</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">isotopes</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span> <span class="p">)</span>
                <span class="c1">#x.append(line_1[1])</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span><span class="mi">72</span><span class="p">],[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">],</span><span class="n">linestyle</span><span class="o">=</span><span class="s1">&#39;--&#39;</span><span class="p">)</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span><span class="mi">72</span><span class="p">],[</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">],</span><span class="n">linestyle</span><span class="o">=</span><span class="s1">&#39;--&#39;</span><span class="p">)</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span><span class="mi">72</span><span class="p">],[</span><span class="mf">0.5</span><span class="p">,</span><span class="mf">0.5</span><span class="p">],</span><span class="n">linestyle</span><span class="o">=</span><span class="s1">&#39;--&#39;</span><span class="p">)</span>





            <span class="c1">#if x_axis==&#39;Z&#39;:</span>
            <span class="c1">#       x.append(line_1[0])</span>

        <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s2">&quot;mass number A&quot;</span><span class="p">)</span>
            <span class="c1">#plt.plot(x,y,marker=marker_type[0],markersize=10,linestyle=&#39;None&#39;,label=self.label)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">set_yscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">y_range</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">ylim</span><span class="p">(</span><span class="n">y_range</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">y_range</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">72</span><span class="p">)</span>
        <span class="n">simArtist</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">Line2D</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">),(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="n">mfc</span><span class="o">=</span><span class="s1">&#39;none&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker_type</span><span class="p">[</span><span class="n">marker1</span><span class="p">],</span> <span class="n">linestyle</span><span class="o">=</span><span class="s1">&#39;w&#39;</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">([</span><span class="n">simArtist</span><span class="p">],[</span><span class="n">label</span><span class="p">])</span>
        <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>


<div class="viewcode-block" id="sygma.plot_totmasses"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_totmasses">[docs]</a>    <span class="k">def</span> <span class="nf">plot_totmasses</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span><span class="n">mass</span><span class="o">=</span><span class="s1">&#39;gas&#39;</span><span class="p">,</span><span class="n">source</span><span class="o">=</span><span class="s1">&#39;all&#39;</span><span class="p">,</span><span class="n">norm</span><span class="o">=</span><span class="s1">&#39;no&#39;</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span><span class="n">log</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Plots either gas or star mass as fraction of total mass</span>
<span class="sd">	vs time.</span>
<span class="sd">    	Note: Used in WENDI.</span>
<span class="sd">    </span>
<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">        mass : string</span>
<span class="sd">            either &#39;gas&#39; for ISM gas mass</span>
<span class="sd">            or &#39;stars&#39; for gas locked away in stars (total gas - ISM gas)</span>

<span class="sd">        norm : string</span>
<span class="sd">            normalization, either &#39;no&#39; for no normalization (total gas mass in solar masses),</span>

<span class="sd">	    for normalization to the initial gas mass (mgal) with &#39;ini&#39;,</span>

<span class="sd">	    for normalization to the current total gas mass &#39;current&#39;.</span>
<span class="sd">	    The latter case makes sense when comparing different</span>
<span class="sd">	    sources (see below)</span>

<span class="sd">        source : string</span>
<span class="sd">            specifies if yields come from</span>
<span class="sd">	    all sources (&#39;all&#39;), including</span>
<span class="sd">	    AGB+SN1a, massive stars. Or from</span>
<span class="sd">	    distinctive sources:</span>
<span class="sd">	    only agb stars (&#39;agb&#39;), only</span>
<span class="sd">	    SN1a (&#39;sn1a&#39;), or only massive stars</span>
<span class="sd">	    (&#39;massive&#39;)</span>
<span class="sd">	log : boolean</span>
<span class="sd">            if true plot logarithmic y axis</span>
<span class="sd">        label : string</span>
<span class="sd">             figure label</span>
<span class="sd">        marker : string</span>
<span class="sd">             figure marker</span>
<span class="sd">        shape : string</span>
<span class="sd">             line style </span>
<span class="sd">        color : string</span>
<span class="sd">             color of line</span>
<span class="sd">        fig : string,float</span>
<span class="sd">             to name the plot figure       </span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>
<span class="sd">        &gt;&gt;&gt; s.plot_totmasses()</span>


<span class="sd">        &#39;&#39;&#39;</span>

        <span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="kn">as</span> <span class="nn">plt</span>

        <span class="c1">#if len(label)&lt;1:</span>
        <span class="c1">#        label=mass+&#39;, &#39;+source</span>


        <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="n">fsize</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">fsize</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>

        <span class="c1">#Assume isotope input</span>

	<span class="n">xaxis</span><span class="o">=</span><span class="s1">&#39;age&#39;</span>
	<span class="k">if</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;all&#39;</span><span class="p">:</span>
		<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="s1">&#39;All&#39;</span>
	<span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;agb&#39;</span><span class="p">:</span>
		<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="s1">&#39;AGB&#39;</span>
	<span class="k">if</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;massive&#39;</span><span class="p">:</span>
		<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="s1">&#39;Massive&#39;</span>
	<span class="k">if</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
		<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="s1">&#39;SNIa&#39;</span>
	
	<span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__msc</span><span class="p">(</span><span class="n">source</span><span class="p">,</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="p">)</span>

	<span class="k">if</span> <span class="s1">&#39;age&#39;</span> <span class="o">==</span> <span class="n">xaxis</span><span class="p">:</span>
	    <span class="n">x_all</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span><span class="c1">#[1:]</span>
	    <span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
	    <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;log-scaled age [yr]&#39;</span><span class="p">)</span>
	    <span class="c1">#self.x=x</span>

	<span class="n">gas_mass</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">gas_mass</span>

	<span class="c1">#to test the different contributions</span>
	<span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
            <span class="n">gas_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">gas_mass</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
	        <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_agb</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
	        <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_1a</span>
            <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;massive&#39;</span><span class="p">:</span>
	        <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_massive</span>
            <span class="n">gas_evol</span><span class="o">=</span><span class="p">[]</span>
            <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">)):</span>
	        <span class="n">gas_evol</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">]))</span>

	<span class="n">ism_gasm</span><span class="o">=</span><span class="p">[]</span>
	<span class="n">star_m</span><span class="o">=</span><span class="p">[]</span>
	<span class="n">x</span><span class="o">=</span><span class="p">[]</span>
        <span class="c1">#To prevent 0 +log scale</span>
        <span class="k">if</span> <span class="s1">&#39;age&#39;</span> <span class="o">==</span> <span class="n">xaxis</span><span class="p">:</span>
                <span class="n">x_all</span><span class="o">=</span><span class="n">x_all</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
                <span class="n">gas_evol</span><span class="o">=</span><span class="n">gas_evol</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
		<span class="n">gas_mass</span><span class="o">=</span><span class="n">gas_mass</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
	<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">gas_evol</span><span class="p">)):</span>
	    <span class="k">if</span> <span class="p">(</span><span class="n">gas_evol</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">==</span><span class="mi">0</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="n">gas_mass</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">==</span><span class="mi">0</span><span class="p">):</span>
		<span class="k">continue</span>
            <span class="k">if</span> <span class="n">norm</span><span class="o">==</span><span class="s1">&#39;ini&#39;</span><span class="p">:</span>
	        <span class="n">ism_gasm</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">gas_evol</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">mgal</span><span class="p">)</span>
	        <span class="n">star_m</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">mgal</span><span class="o">-</span><span class="n">gas_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">mgal</span><span class="p">)</span>
		<span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">x_all</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
            <span class="k">if</span> <span class="n">norm</span> <span class="o">==</span> <span class="s1">&#39;current&#39;</span><span class="p">:</span>
	        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">gas_mass</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">==</span><span class="mf">0.</span><span class="p">:</span>
	              <span class="n">ism_gasm</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">gas_evol</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">/</span><span class="n">gas_mass</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
	              <span class="n">star_m</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">mgal</span><span class="o">-</span><span class="n">gas_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span><span class="o">/</span><span class="n">gas_mass</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
		      <span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">x_all</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
	    <span class="c1">#else:</span>
	     <span class="c1">#   ism_gasm.append(0.)</span>
	      <span class="c1">#  star_m.append(0.)</span>
            <span class="k">elif</span> <span class="n">norm</span> <span class="o">==</span> <span class="s1">&#39;no&#39;</span><span class="p">:</span>
	        <span class="n">ism_gasm</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">gas_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
	        <span class="n">star_m</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">mgal</span><span class="o">-</span><span class="n">gas_evol</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
		<span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">x_all</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
        <span class="k">if</span> <span class="n">mass</span> <span class="o">==</span> <span class="s1">&#39;gas&#39;</span><span class="p">:</span>
	    <span class="n">y</span><span class="o">=</span><span class="n">ism_gasm</span>
        <span class="k">if</span> <span class="n">mass</span> <span class="o">==</span> <span class="s1">&#39;stars&#39;</span><span class="p">:</span>
	    <span class="n">y</span><span class="o">=</span><span class="n">star_m</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">)</span>	
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>
        <span class="k">if</span> <span class="n">norm</span><span class="o">==</span><span class="s1">&#39;current&#39;</span><span class="p">:</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">ylim</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">norm</span><span class="o">==</span><span class="s1">&#39;no&#39;</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">mass</span><span class="o">==</span><span class="s1">&#39;gas&#39;</span><span class="p">:</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;mass fraction&#39;</span><span class="p">)</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">title</span><span class="p">(</span><span class="s1">&#39;Gas mass as a fraction of total gas mass&#39;</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;mass fraction&#39;</span><span class="p">)</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">title</span><span class="p">(</span><span class="s1">&#39;Star mass as a fraction of total star mass&#39;</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">mass</span><span class="o">==</span><span class="s1">&#39;gas&#39;</span><span class="p">:</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;log-scaled integrated ejected mass [M$_{\odot}$]&#39;</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;log-scaled integrated mass locked in stars [M$_{\odot}$]&#39;</span><span class="p">)</span>

            <span class="k">if</span> <span class="n">mass</span><span class="o">==</span><span class="s1">&#39;gas&#39;</span><span class="p">:</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;log-scaled integrated ejected mass [M$_{\odot}$]&#39;</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;log-scaled integrated mass locked in stars [M$_{\odot}$]&#39;</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">log</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">yscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
	    <span class="k">if</span> <span class="ow">not</span> <span class="n">norm</span><span class="o">==</span><span class="s1">&#39;no&#39;</span><span class="p">:</span>
            	<span class="n">plt</span><span class="o">.</span><span class="n">ylim</span><span class="p">(</span><span class="mf">1e-4</span><span class="p">,</span><span class="mf">1.2</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">dt</span><span class="p">,</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">tend</span><span class="p">)</span>
	<span class="bp">self</span><span class="o">.</span><span class="n">__save_data</span><span class="p">(</span><span class="n">header</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;age&#39;</span><span class="p">,</span><span class="s1">&#39;mass&#39;</span><span class="p">],</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">])</span></div>

<div class="viewcode-block" id="sygma.plot_sn_distr"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_sn_distr">[docs]</a>    <span class="k">def</span> <span class="nf">plot_sn_distr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span><span class="n">rate</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span><span class="n">rate_only</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">xaxis</span><span class="o">=</span><span class="s1">&#39;time&#39;</span><span class="p">,</span><span class="n">fraction</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">label1</span><span class="o">=</span><span class="s1">&#39;SNIa&#39;</span><span class="p">,</span><span class="n">label2</span><span class="o">=</span><span class="s1">&#39;SN2&#39;</span><span class="p">,</span><span class="n">shape1</span><span class="o">=</span><span class="s1">&#39;:&#39;</span><span class="p">,</span><span class="n">shape2</span><span class="o">=</span><span class="s1">&#39;--&#39;</span><span class="p">,</span><span class="n">marker1</span><span class="o">=</span><span class="s1">&#39;o&#39;</span><span class="p">,</span><span class="n">marker2</span><span class="o">=</span><span class="s1">&#39;s&#39;</span><span class="p">,</span><span class="n">color1</span><span class="o">=</span><span class="s1">&#39;k&#39;</span><span class="p">,</span><span class="n">color2</span><span class="o">=</span><span class="s1">&#39;b&#39;</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Plots the SN1a distribution:</span>

<span class="sd">	The evolution of the number of SN1a and SN2</span>


<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>
<span class="sd">	rate : boolean</span>
<span class="sd">            if true, calculate rate [1/century] </span>
<span class="sd">            else calculate numbers</span>
<span class="sd">	fraction ; boolean</span>
<span class="sd">	    if true, ignorate rate and calculate number fraction of SNIa per WD</span>
<span class="sd">        rate_only : string</span>
<span class="sd">	    if empty string, plot both rates (default)</span>

<span class="sd">            if &#39;sn1a&#39;, plot only SN1a rate</span>

<span class="sd">            if &#39;sn2&#39;, plot only SN2 rate</span>
<span class="sd">	xaxis: string</span>
<span class="sd">	    if &#39;time&#39; : time evolution</span>
<span class="sd">	    if &#39;redshift&#39;: experimental! use with caution; redshift evolution</span>
<span class="sd">        label : string</span>
<span class="sd">             figure label</span>
<span class="sd">        marker : string</span>
<span class="sd">             figure marker</span>
<span class="sd">        shape : string</span>
<span class="sd">             line style </span>
<span class="sd">        color : string</span>
<span class="sd">             color of line</span>
<span class="sd">        fig : string,float</span>
<span class="sd">             to name the plot figure       </span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>
<span class="sd">        &gt;&gt;&gt; s.plot_sn_distr()</span>
<span class="sd">        &#39;&#39;&#39;</span>
	<span class="c1">#For Wiersma09</span>
	<span class="n">Hubble_0</span><span class="o">=</span><span class="mf">73.</span>
	<span class="n">Omega_lambda</span><span class="o">=</span><span class="mf">0.762</span>
	<span class="n">Omega_m</span><span class="o">=</span><span class="mf">0.238</span>

        <span class="n">figure</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="n">fsize</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">fsize</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
        <span class="n">age</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span>
        <span class="n">sn1anumbers</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">sn1a_numbers</span><span class="c1">#[:-1]</span>
        <span class="n">sn2numbers</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">sn2_numbers</span>
	<span class="k">if</span> <span class="n">xaxis</span><span class="o">==</span><span class="s1">&#39;redshift&#39;</span><span class="p">:</span>
		<span class="k">print</span> <span class="s1">&#39;this features is not tested yet.&#39;</span>
		<span class="k">return</span> <span class="mi">0</span>
		<span class="n">age</span><span class="p">,</span><span class="n">idx</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__time_to_z</span><span class="p">(</span><span class="n">age</span><span class="p">,</span><span class="n">Hubble_0</span><span class="p">,</span><span class="n">Omega_lambda</span><span class="p">,</span><span class="n">Omega_m</span><span class="p">)</span>
		<span class="n">age</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">+</span><span class="n">age</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;redshift z&#39;</span><span class="p">)</span>
		<span class="n">timesteps</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">timesteps</span><span class="p">[</span><span class="n">idx</span><span class="o">-</span><span class="mi">1</span><span class="p">:]</span>
		<span class="n">sn2numbers</span><span class="o">=</span><span class="n">sn2numbers</span><span class="p">[</span><span class="n">idx</span><span class="p">:]</span>
		<span class="n">sn1anumbers</span><span class="o">=</span><span class="n">sn1anumbers</span><span class="p">[</span><span class="n">idx</span><span class="p">:]</span>
	<span class="k">else</span><span class="p">:</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;age [yr]&#39;</span><span class="p">)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">rate</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">fraction</span><span class="p">:</span>
	    <span class="k">if</span> <span class="n">xaxis</span><span class="o">==</span><span class="s1">&#39;redshift&#39;</span><span class="p">:</span>
			<span class="n">sn1a_rate</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">sn1anumbers</span><span class="p">)</span><span class="o">/</span> <span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">timesteps</span><span class="p">)</span><span class="o">/</span><span class="mf">100.</span><span class="p">)</span>
			<span class="n">sn2_rate</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">sn2numbers</span><span class="p">)</span><span class="o">/</span> <span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">timesteps</span><span class="p">)</span><span class="o">/</span><span class="mf">100.</span><span class="p">)</span>	
	    <span class="k">else</span><span class="p">:</span>
            		<span class="n">sn1a_rate</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">sn1anumbers</span><span class="p">[</span><span class="mi">1</span><span class="p">:])</span><span class="o">/</span> <span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">timesteps</span><span class="p">)</span><span class="o">/</span><span class="mf">100.</span><span class="p">)</span>
            		<span class="n">sn2_rate</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">sn2numbers</span><span class="p">[</span><span class="mi">1</span><span class="p">:])</span><span class="o">/</span> <span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">timesteps</span><span class="p">)</span><span class="o">/</span><span class="mf">100.</span><span class="p">)</span>
	    <span class="n">sn1a_rate1</span><span class="o">=</span><span class="p">[]</span>
	    <span class="n">sn2_rate1</span><span class="o">=</span><span class="p">[]</span>
	    <span class="n">age</span><span class="o">=</span><span class="n">age</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
	    <span class="n">age_sn1a</span><span class="o">=</span><span class="p">[]</span> <span class="c1">#age[1:]</span>
	    <span class="n">age_sn2</span><span class="o">=</span><span class="p">[]</span>
	    <span class="c1">#correct sn1a rate</span>
	    <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">sn1a_rate</span><span class="p">)):</span>
		<span class="k">if</span> <span class="n">sn1a_rate</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
			<span class="n">sn1a_rate1</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sn1a_rate</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
			<span class="n">age_sn1a</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">age</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
			
	    <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">sn2_rate</span><span class="p">)):</span>
		<span class="k">if</span> <span class="n">sn2_rate</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
			<span class="n">sn2_rate1</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sn2_rate</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
			<span class="n">age_sn2</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">age</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
	

            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">rate_only</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
		    <span class="n">x</span><span class="o">=</span><span class="p">[</span><span class="n">age_sn2</span><span class="p">,</span><span class="n">age_sn1a</span><span class="p">]</span>
		    <span class="n">y</span><span class="o">=</span><span class="p">[</span><span class="n">sn1a_rate1</span><span class="p">,</span><span class="n">sn2_rate1</span><span class="p">]</span>
		    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">age_sn1a</span><span class="p">,</span><span class="n">sn1a_rate1</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape1</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color1</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label1</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker1</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
		    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">age_sn2</span><span class="p">,</span><span class="n">sn2_rate1</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape2</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color2</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label2</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker2</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
            	    <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;SN rate [century$^{-1}$]&#39;</span><span class="p">)</span>
	    <span class="k">if</span> <span class="n">rate_only</span><span class="o">==</span><span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
		    <span class="n">x</span><span class="o">=</span><span class="n">age_sn1a</span>
		    <span class="n">y</span><span class="o">=</span> <span class="n">sn1a_rate1</span>
		    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">age_sn1a</span><span class="p">,</span><span class="n">sn1a_rate1</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape1</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color1</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label1</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker1</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
		    <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;SNIa rate [century$^{-1}$]&#39;</span><span class="p">)</span>
	    <span class="k">if</span> <span class="n">rate_only</span><span class="o">==</span><span class="s1">&#39;sn2&#39;</span><span class="p">:</span>
		    <span class="n">x</span><span class="o">=</span><span class="n">age_sn2</span>
		    <span class="n">y</span><span class="o">=</span><span class="n">sn2_rate</span>
                    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">age_sn2</span><span class="p">,</span><span class="n">sn2_rate1</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape2</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color2</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label2</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker2</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
		    <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;SN2 rate [century$^{-1}$]&#39;</span><span class="p">)</span>


        <span class="k">else</span><span class="p">:</span>
            <span class="c1">#if xaxis==&#39;redshift&#39;:</span>
		
                        <span class="c1">#sn1_numbers=np.array(sn1anumbers)/ (np.array(timesteps)/100.)</span>
                        <span class="c1">#sn2_numbers=np.array(sn2numbers)/ (np.array(timesteps)/100.)</span>
            <span class="c1">#True: #else:</span>
                        <span class="c1">#sn1a_rate=np.array(sn1anumbers[1:])/ (np.array(self.history.timesteps)/100.)</span>
                        <span class="c1">#sn2_rate=np.array(sn2numbers[1:])/ (np.array(self.history.timesteps)/100.)</span>

	    <span class="n">sn1a_numbers</span><span class="o">=</span><span class="n">sn1anumbers</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
	    <span class="n">sn2_numbers</span><span class="o">=</span><span class="n">sn2numbers</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>	
            <span class="n">sn1a_numbers1</span><span class="o">=</span><span class="p">[]</span>
	    <span class="n">sn2_numbers1</span><span class="o">=</span><span class="p">[]</span>
            <span class="n">age_sn1a</span><span class="o">=</span><span class="p">[]</span>
	    <span class="n">age_sn2</span><span class="o">=</span><span class="p">[]</span>
            <span class="n">age</span><span class="o">=</span><span class="n">age</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
            <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">sn1a_numbers</span><span class="p">)):</span>
                <span class="k">if</span> <span class="n">sn1a_numbers</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
                        <span class="n">sn1a_numbers1</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sn1a_numbers</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
                        <span class="n">age_sn1a</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">age</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
	    <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">sn2_numbers</span><span class="p">)):</span>
                <span class="k">if</span> <span class="n">sn2_numbers</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
                        <span class="n">sn2_numbers1</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sn2_numbers</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
                        <span class="n">age_sn2</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">age</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>

	    <span class="k">if</span> <span class="n">fraction</span><span class="p">:</span>
		<span class="n">age</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span>
		<span class="n">ratio</span><span class="o">=</span><span class="p">[]</span>
		<span class="n">age1</span><span class="o">=</span><span class="p">[]</span>
		<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wd_sn1a_range1</span><span class="p">)):</span>
		    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">wd_sn1a_range1</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
			<span class="n">ratio</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">sn1a_numbers</span><span class="p">[</span><span class="mi">1</span><span class="p">:][</span><span class="n">k</span><span class="p">]</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">wd_sn1a_range1</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
			<span class="n">age1</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">age</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">age1</span><span class="p">,</span><span class="n">ratio</span><span class="p">)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">yscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;number of SNIa going off per WD born&#39;</span><span class="p">)</span>
		<span class="n">label</span><span class="o">=</span><span class="s1">&#39;SNIafractionperWD&#39;</span><span class="p">;</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;sn1a &#39;</span><span class="o">+</span><span class="n">label</span>
		<span class="n">x</span><span class="o">=</span><span class="n">age1</span>
		<span class="n">y</span><span class="o">=</span><span class="n">ratio</span>
		<span class="bp">self</span><span class="o">.</span><span class="n">__save_data</span><span class="p">(</span><span class="n">header</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;age&#39;</span><span class="p">,</span><span class="n">label</span><span class="p">],</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">])</span>		
		<span class="k">return</span> 
	    <span class="k">else</span><span class="p">:</span>
		    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">rate_only</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
			    <span class="n">x</span><span class="o">=</span><span class="p">[</span><span class="n">age_sn1a</span><span class="p">,</span><span class="n">age_sn2</span><span class="p">]</span>
			    <span class="n">y</span><span class="o">=</span><span class="p">[</span><span class="n">sn1a_numbers</span><span class="p">,</span><span class="n">sn2_numbers</span><span class="p">]</span>
			    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">age_sn1a</span><span class="p">,</span><span class="n">sn1a_numbers1</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape1</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color1</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label1</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker1</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
			    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">age_sn2</span><span class="p">,</span><span class="n">sn2_numbers1</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape2</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color2</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label2</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker2</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
			    <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;SN numbers&#39;</span><span class="p">)</span>
		    <span class="k">if</span> <span class="n">rate_only</span><span class="o">==</span><span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
			    <span class="n">x</span><span class="o">=</span> <span class="n">age1</span>
			    <span class="n">y</span><span class="o">=</span> <span class="n">sn1anumbers1</span>
			    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">age_sn1a</span><span class="p">,</span><span class="n">sn1a_numbers1</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape1</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color1</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label1</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker1</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markever</span><span class="p">)</span>
			    <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;SN numbers&#39;</span><span class="p">)</span>
		    <span class="k">if</span> <span class="n">rate_only</span><span class="o">==</span><span class="s1">&#39;sn2&#39;</span><span class="p">:</span>
			    <span class="n">x</span><span class="o">=</span> <span class="n">age</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
			    <span class="n">y</span><span class="o">=</span> <span class="n">sn2numbers</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
			    <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">age_sn2</span><span class="p">,</span><span class="n">sn2_numbers1</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape2</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color2</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label2</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker2</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
			    <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;SN numbers&#39;</span><span class="p">)</span>

	<span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">yscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
	<span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>
	<span class="k">if</span> <span class="n">rate</span><span class="p">:</span>
		<span class="n">label</span><span class="o">=</span><span class="s1">&#39;rate&#39;</span>
	<span class="k">else</span><span class="p">:</span>
		<span class="n">label</span><span class="o">=</span><span class="s1">&#39;number&#39;</span>	
	<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">rate_only</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
		<span class="k">if</span> <span class="n">rate</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="s1">&#39;rate&#39;</span>
		<span class="k">else</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="s1">&#39;number&#39;</span>
		<span class="bp">self</span><span class="o">.</span><span class="n">__save_data</span><span class="p">(</span><span class="n">header</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;age&#39;</span><span class="p">,</span><span class="s1">&#39;SNIa &#39;</span><span class="o">+</span><span class="n">label</span><span class="p">,</span><span class="s1">&#39;age&#39;</span><span class="p">,</span><span class="s1">&#39;CCSN &#39;</span><span class="o">+</span><span class="n">label</span><span class="p">],</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">x</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span><span class="n">y</span><span class="p">[</span><span class="mi">1</span><span class="p">]])</span>
	<span class="k">else</span><span class="p">:</span>
		<span class="k">if</span> <span class="n">rate_only</span><span class="o">==</span><span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="s1">&#39;sn1a &#39;</span><span class="o">+</span><span class="n">label</span>
		<span class="k">else</span><span class="p">:</span>
			<span class="n">label</span><span class="o">=</span><span class="s1">&#39;ccsn &#39;</span><span class="o">+</span><span class="n">label</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">__save_data</span><span class="p">(</span><span class="n">header</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;age&#39;</span><span class="p">,</span><span class="n">label</span><span class="p">],</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">])</span></div>
			

    <span class="c1">##############################################</span>
    <span class="c1">#          Plot Star Formation Rate          #</span>
    <span class="c1">##############################################</span>
<div class="viewcode-block" id="sygma.plot_star_formation_rate"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_star_formation_rate">[docs]</a>    <span class="k">def</span> <span class="nf">plot_star_formation_rate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">6</span><span class="p">,</span><span class="n">fraction</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span><span class="n">source</span><span class="o">=</span><span class="s1">&#39;all&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">abs_unit</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>
	<span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Plots the star formation rate over time.</span>
<span class="sd">	Shows fraction of ISM mass which transforms into stars.</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">	fraction : boolean</span>
<span class="sd">		if true: fraction of ISM which transforms into stars;</span>
<span class="sd">		else: mass of ISM which goes into stars</span>

<span class="sd">	source : string</span>
<span class="sd">		either &#39;all&#39; for total star formation rate; &#39;agb&#39; for AGB and &#39;massive&#39; for massive stars</span>

<span class="sd">	marker : string</span>
<span class="sd">		marker type</span>
<span class="sd">	shape : string</span>
<span class="sd">		line shape type</span>
<span class="sd">	fig: figure id</span>
<span class="sd">	</span>
<span class="sd">        Examples</span>
<span class="sd">        ----------</span>
<span class="sd">        &gt;&gt;&gt; s.star_formation_rate()</span>
<span class="sd">	</span>
<span class="sd">	&#39;&#39;&#39;</span>

	<span class="k">if</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">marker</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">shape</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">color</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
		<span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__msc</span><span class="p">(</span><span class="n">source</span><span class="p">,</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="p">)</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="n">fsize</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">fsize</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
	<span class="c1">#maybe a histogram for display the SFR?</span>
	<span class="k">if</span> <span class="bp">False</span><span class="p">:</span>
		<span class="n">age</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span>
		<span class="c1">#age=[0.1]+self.history.age[1:-1]</span>
		<span class="n">sfr</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">sfr</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;age [yr]&#39;</span><span class="p">)</span>
		<span class="c1">#plt.xscale(&#39;log&#39;)</span>
		<span class="n">mean_age</span><span class="o">=</span><span class="p">[]</span>
		<span class="n">color</span><span class="o">=</span><span class="s1">&#39;r&#39;</span>
		<span class="n">label</span><span class="o">=</span><span class="s1">&#39;aa&#39;</span>
		<span class="n">age_bdy</span><span class="o">=</span><span class="p">[]</span>
		<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">age</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">):</span>
			<span class="n">mean_age</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="c1">#age[k+1]-age[k])</span>
		<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">age</span><span class="p">)):</span>
			<span class="n">age_bdy</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">age</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>	
		<span class="k">print</span> <span class="s1">&#39;age&#39;</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">mean_age</span><span class="p">)</span>
		<span class="k">print</span> <span class="s1">&#39;weights&#39;</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">sfr</span><span class="p">)</span>
		<span class="k">print</span> <span class="s1">&#39;bdy&#39;</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">age_bdy</span><span class="p">)</span>
		<span class="k">print</span> <span class="n">sfr</span><span class="p">[:</span><span class="mi">5</span><span class="p">]</span>
	        <span class="n">p1</span> <span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">hist</span><span class="p">(</span><span class="n">mean_age</span><span class="p">,</span> <span class="n">bins</span><span class="o">=</span><span class="n">age_bdy</span><span class="p">,</span><span class="n">weights</span><span class="o">=</span><span class="n">sfr</span><span class="p">,</span><span class="n">facecolor</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">)</span>

        <span class="c1">#Plot the mass fraction of gas available converted into stars</span>
	<span class="k">if</span> <span class="n">fraction</span><span class="p">:</span>
		<span class="n">sfr</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">sfr</span>
                <span class="k">if</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;all&#39;</span><span class="p">:</span>
                        <span class="n">label</span><span class="o">=</span><span class="s1">&#39;all&#39;</span>
                <span class="k">elif</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
			<span class="n">sfr</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">sfr</span><span class="p">)</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">m_locked_agb</span><span class="p">)</span><span class="o">/</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">m_locked</span><span class="p">)</span>
                        <span class="n">label</span><span class="o">=</span><span class="s1">&#39;AGB&#39;</span>
                <span class="k">elif</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;massive&#39;</span><span class="p">:</span>
                        <span class="n">masslocked</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">m_locked_massive</span>
			<span class="n">sfr</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">sfr</span><span class="p">)</span><span class="o">*</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">m_locked_massive</span><span class="p">)</span><span class="o">/</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">m_locked</span><span class="p">)</span>
                        <span class="n">label</span><span class="o">=</span><span class="s1">&#39;Massive&#39;</span>
		<span class="n">age</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
		<span class="k">print</span> <span class="nb">len</span><span class="p">(</span><span class="n">age</span><span class="p">),</span><span class="nb">len</span><span class="p">(</span><span class="n">sfr</span><span class="p">)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;age [yr]&#39;</span><span class="p">)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">age</span><span class="p">,</span><span class="n">sfr</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;fraction of current gas mass into stars&#39;</span><span class="p">)</span>	
        	<span class="bp">self</span><span class="o">.</span><span class="n">__save_data</span><span class="p">(</span><span class="n">header</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;age&#39;</span><span class="p">,</span><span class="s1">&#39;SFR&#39;</span><span class="p">],</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">age</span><span class="p">,</span><span class="n">sfr</span><span class="p">])</span>

        <span class="c1">#Plot the mass converted into stars</span>
	<span class="k">else</span><span class="p">:</span>
		<span class="k">if</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;all&#39;</span><span class="p">:</span>
			<span class="n">masslocked</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">m_locked</span>
			<span class="n">label</span><span class="o">=</span><span class="s1">&#39;all&#39;</span>
		<span class="k">elif</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
			<span class="n">masslocked</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">m_locked_agb</span>
			<span class="n">label</span><span class="o">=</span><span class="s1">&#39;AGB&#39;</span>
		<span class="k">elif</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;massive&#39;</span><span class="p">:</span>
			<span class="n">masslocked</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">m_locked_massive</span>
			<span class="n">label</span><span class="o">=</span><span class="s1">&#39;Massive&#39;</span>
		<span class="n">age</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">age</span><span class="p">,</span><span class="n">masslocked</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;age [yr]&#39;</span><span class="p">)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;ISM mass transformed into stars&#39;</span><span class="p">)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">);</span><span class="n">plt</span><span class="o">.</span><span class="n">yscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>

        <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span></div>

	<span class="c1">#print &#39;Total mass transformed in stars, total mass transformed in AGBs, total mass transformed in massive stars:&#39;</span>
	<span class="c1">#print sum(self.history.m_locked),sum(self.history.m_locked_agb),sum(self.history.m_locked_massive)</span>

<div class="viewcode-block" id="sygma.plot_mass_range_contributions"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_mass_range_contributions">[docs]</a>    <span class="k">def</span> <span class="nf">plot_mass_range_contributions</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">7</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="s1">&#39;C&#39;</span><span class="p">,</span><span class="n">prodfac</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">rebin</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span><span class="n">time</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;-&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;o&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;r&#39;</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span><span class="n">extralabel</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">log</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>


        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Plots yield contribution (Msun) of a certain mass range</span>
<span class="sd">	versus initial mass. Each stellar ejecta in one mass range </span>
<span class="sd">	is represented by the same yields, yields from certain stellar simulation.</span>
<span class="sd">	Be aware that a larger mass range means also a larger amount</span>
<span class="sd">	of yield for that range.</span>
<span class="sd">	Note: Used in WENDI.</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>
<span class="sd">        specie : string</span>
<span class="sd">            Element or isotope name in the form &#39;C&#39; or &#39;C-12&#39;</span>
<span class="sd">	prodfac : boolean</span>
<span class="sd">	    if true, calculate stellar production factor for each mass range.</span>
<span class="sd">	    It is the final stellar yield divided by the initial (IMF-weighted)</span>
<span class="sd">	    total mass (ISM+stars) in that region.</span>
<span class="sd">	rebin : change the bin size to uniform mass intervals of size &#39;rebin&#39;</span>
<span class="sd">	        default 0, bin size is defined by ranges of (stellar) yield inputs	</span>
<span class="sd">	log : boolean</span>
<span class="sd">	    if true, use log yaxis</span>
<span class="sd">        label : string</span>
<span class="sd">             figure label</span>
<span class="sd">        marker : string</span>
<span class="sd">             figure marker</span>
<span class="sd">        shape : string</span>
<span class="sd">             line style </span>
<span class="sd">        color : string</span>
<span class="sd">             color of line</span>
<span class="sd">        fig : string,float</span>
<span class="sd">             to name the plot figure       </span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>
<span class="sd">        &gt;&gt;&gt; s.plot_mass_range_contribution(element=&#39;C&#39;)</span>

<span class="sd">        &#39;&#39;&#39;</span>

	<span class="n">figure</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="n">fsize</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">fsize</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>


	<span class="c1">#e.g. for testing: ratio</span>
	<span class="c1">#ratio, e.g. C/Fe</span>
	<span class="k">if</span> <span class="s1">&#39;/&#39;</span> <span class="ow">in</span> <span class="n">specie</span><span class="p">:</span>
		<span class="n">specie1</span><span class="o">=</span><span class="n">specie</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
		<span class="n">mean_val</span><span class="p">,</span><span class="n">bin_bdys</span><span class="p">,</span><span class="n">y1</span><span class="p">,</span><span class="n">color</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__plot_mass_range_contributions_single</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span><span class="n">specie1</span><span class="p">,</span><span class="n">prodfac</span><span class="p">,</span><span class="n">rebin</span><span class="p">,</span><span class="n">time</span><span class="p">,</span><span class="n">label</span><span class="p">,</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="p">,</span><span class="n">extralabel</span><span class="p">,</span><span class="n">log</span><span class="p">,</span><span class="n">fsize</span><span class="p">,</span><span class="n">fontsize</span><span class="p">,</span><span class="n">rspace</span><span class="p">,</span><span class="n">bspace</span><span class="p">,</span><span class="n">labelsize</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="p">)</span>
		<span class="n">specie2</span><span class="o">=</span><span class="n">specie</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>
		<span class="n">mean_val</span><span class="p">,</span><span class="n">bin_bdys</span><span class="p">,</span><span class="n">y2</span><span class="p">,</span><span class="n">color</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__plot_mass_range_contributions_single</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span><span class="n">specie2</span><span class="p">,</span><span class="n">prodfac</span><span class="p">,</span><span class="n">rebin</span><span class="p">,</span><span class="n">time</span><span class="p">,</span><span class="n">label</span><span class="p">,</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="p">,</span><span class="n">extralabel</span><span class="p">,</span><span class="n">log</span><span class="p">,</span><span class="n">fsize</span><span class="p">,</span><span class="n">fontsize</span><span class="p">,</span><span class="n">rspace</span><span class="p">,</span><span class="n">bspace</span><span class="p">,</span><span class="n">labelsize</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="p">)</span>

		<span class="n">y</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">y1</span><span class="p">)</span><span class="o">/</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">y2</span><span class="p">)</span>
		<span class="n">label</span><span class="o">=</span><span class="n">specie</span>
	<span class="c1">#to get the total mass</span>
	<span class="k">if</span> <span class="s1">&#39;all&#39;</span> <span class="ow">in</span> <span class="n">specie</span><span class="p">:</span>
		<span class="n">eles</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span>
		<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">eles</span><span class="p">)):</span>
			<span class="n">specie</span><span class="o">=</span><span class="n">eles</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>
			<span class="n">ytmp</span><span class="o">=</span><span class="mi">0</span>
			<span class="n">mean_val</span><span class="p">,</span><span class="n">bin_bdys</span><span class="p">,</span><span class="n">ytmp</span><span class="p">,</span><span class="n">color</span><span class="p">,</span><span class="n">labeltmp</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__plot_mass_range_contributions_single</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span><span class="n">specie</span><span class="p">,</span><span class="n">prodfac</span><span class="p">,</span><span class="n">rebin</span><span class="p">,</span><span class="n">time</span><span class="p">,</span><span class="n">label</span><span class="p">,</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="p">,</span><span class="n">extralabel</span><span class="p">,</span><span class="n">log</span><span class="p">,</span><span class="n">fsize</span><span class="p">,</span><span class="n">fontsize</span><span class="p">,</span><span class="n">rspace</span><span class="p">,</span><span class="n">bspace</span><span class="p">,</span><span class="n">labelsize</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="p">)</span>
			<span class="k">if</span> <span class="n">k</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
				<span class="n">y</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">ytmp</span><span class="p">)</span>
			<span class="k">else</span><span class="p">:</span>
				<span class="n">y</span><span class="o">=</span> <span class="n">y</span><span class="o">+</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">ytmp</span><span class="p">)</span>
	<span class="c1">#default, mass, C, C-12</span>
	<span class="k">else</span><span class="p">:</span>
		<span class="n">mean_val</span><span class="p">,</span><span class="n">bin_bdys</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">color</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__plot_mass_range_contributions_single</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span><span class="n">specie</span><span class="p">,</span><span class="n">prodfac</span><span class="p">,</span><span class="n">rebin</span><span class="p">,</span><span class="n">time</span><span class="p">,</span><span class="n">label</span><span class="p">,</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="p">,</span><span class="n">extralabel</span><span class="p">,</span><span class="n">log</span><span class="p">,</span><span class="n">fsize</span><span class="p">,</span><span class="n">fontsize</span><span class="p">,</span><span class="n">rspace</span><span class="p">,</span><span class="n">bspace</span><span class="p">,</span><span class="n">labelsize</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="p">)</span>



	<span class="k">if</span> <span class="n">prodfac</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
        	<span class="n">p1</span> <span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">hist</span><span class="p">(</span><span class="n">mean_val</span><span class="p">,</span> <span class="n">bins</span><span class="o">=</span><span class="n">bin_bdys</span><span class="p">,</span><span class="n">weights</span><span class="o">=</span><span class="n">y</span><span class="p">,</span><span class="n">facecolor</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">)</span>
	<span class="k">else</span><span class="p">:</span>
		<span class="n">p1</span> <span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">hist</span><span class="p">(</span><span class="n">mean_val</span><span class="p">,</span> <span class="n">bins</span><span class="o">=</span><span class="n">bin_bdys</span><span class="p">,</span><span class="n">weights</span><span class="o">=</span><span class="n">y</span><span class="p">,</span><span class="n">facecolor</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span><span class="n">bottom</span><span class="o">=</span><span class="mf">0.001</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">)</span>
        <span class="c1">#&#39;&#39;&#39;</span>
	<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
		<span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>
        <span class="c1">#ax1 = figure.add_subplot(111)</span>
        <span class="c1">#ax1.set_xscale(&#39;log&#39;)</span>
        <span class="c1">#ax2 = ax1.twiny()</span>
    <span class="c1">#       ax2.set_xticklabels(tick_function(new_tick_locations))</span>
        <span class="c1">#plt.plot(masses,yields,marker=marker,linestyle=shape,color=color,markevery=markevery,markersize=6,label=label)</span>
        <span class="c1">#ax1.errorbar(masses,yields,marker=marker,linestyle=shape,color=color,markevery=markevery,markersize=6,label=label,xerr=0.05)</span>
	<span class="n">ax1</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="c1">#self.__fig_standard(ax=ax1,fontsize=18,labelsize=18)</span>
	<span class="c1">#if log==True:		</span>
        <span class="c1">#	ax1.set_xlabel(&#39;log-scaled initial mass [Msun]&#39;)</span>
	<span class="c1">#else:</span>
	<span class="n">ax1</span><span class="o">.</span><span class="n">set_xlabel</span><span class="p">(</span><span class="s1">&#39;initial mass [M$_{\odot}$]&#39;</span><span class="p">)</span>
	<span class="k">if</span> <span class="n">prodfac</span><span class="o">==</span><span class="bp">False</span><span class="p">:</span>
		<span class="n">ax1</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s1">&#39;IMF-weighted yield [M$_{\odot}$]&#39;</span><span class="p">)</span>
	<span class="k">else</span><span class="p">:</span>
	        <span class="n">ax1</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s1">&#39;production factor&#39;</span><span class="p">)</span>
	<span class="k">if</span> <span class="n">log</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
       		<span class="n">ax1</span><span class="o">.</span><span class="n">set_yscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
        <span class="c1">#ax1.set_yscale(&#39;log&#39;)</span>
        <span class="c1">#ax1.legend(numpoints = 1)</span>
	<span class="c1">#fontsize=18</span>
	<span class="c1">#labelsize=18</span>
	<span class="n">lwtickboth</span><span class="o">=</span><span class="p">[</span><span class="mi">6</span><span class="p">,</span><span class="mi">2</span><span class="p">]</span>
	<span class="n">lwtickmajor</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mi">3</span><span class="p">]</span>
	<span class="n">plt</span><span class="o">.</span><span class="n">xlim</span><span class="p">(</span><span class="nb">min</span><span class="p">(</span><span class="n">bin_bdys</span><span class="p">),</span><span class="nb">max</span><span class="p">(</span><span class="n">bin_bdys</span><span class="p">))</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span><span class="n">prop</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;size&#39;</span><span class="p">:</span><span class="n">legend_fontsize</span><span class="p">})</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">rcParams</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="s1">&#39;font.size&#39;</span><span class="p">:</span> <span class="n">fontsize</span><span class="p">})</span>
        <span class="n">ax1</span><span class="o">.</span><span class="n">yaxis</span><span class="o">.</span><span class="n">label</span><span class="o">.</span><span class="n">set_size</span><span class="p">(</span><span class="n">labelsize</span><span class="p">)</span>
        <span class="n">ax1</span><span class="o">.</span><span class="n">xaxis</span><span class="o">.</span><span class="n">label</span><span class="o">.</span><span class="n">set_size</span><span class="p">(</span><span class="n">labelsize</span><span class="p">)</span>
        <span class="c1">#ax.xaxis.set_tick_params(width=2)</span>
        <span class="c1">#ax.yaxis.set_tick_params(width=2)              </span>
        <span class="n">ax1</span><span class="o">.</span><span class="n">tick_params</span><span class="p">(</span><span class="n">length</span><span class="o">=</span><span class="n">lwtickboth</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">width</span><span class="o">=</span><span class="n">lwtickboth</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span><span class="n">which</span><span class="o">=</span><span class="s1">&#39;both&#39;</span><span class="p">)</span>
        <span class="n">ax1</span><span class="o">.</span><span class="n">tick_params</span><span class="p">(</span><span class="n">length</span><span class="o">=</span><span class="n">lwtickmajor</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">width</span><span class="o">=</span><span class="n">lwtickmajor</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span><span class="n">which</span><span class="o">=</span><span class="s1">&#39;major&#39;</span><span class="p">)</span>
        <span class="c1">#Add that line below at some point</span>
        <span class="c1">#ax.xaxis.set_tick_params(width=2)</span>
        <span class="c1">#ax.yaxis.set_tick_params(width=2)</span>
        <span class="n">ax1</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s1">&#39;center left&#39;</span><span class="p">,</span> <span class="n">bbox_to_anchor</span><span class="o">=</span><span class="p">(</span><span class="mf">1.01</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">),</span><span class="n">markerscale</span><span class="o">=</span><span class="mf">0.8</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>
	<span class="bp">self</span><span class="o">.</span><span class="n">__save_data</span><span class="p">(</span><span class="n">header</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;Mean mass&#39;</span><span class="p">,</span><span class="s1">&#39;mass bdys (bins)&#39;</span><span class="p">,</span><span class="s1">&#39;Yield&#39;</span><span class="p">],</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">mean_val</span><span class="p">,</span><span class="n">bin_bdys</span><span class="p">,</span><span class="n">y</span><span class="p">])</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">subplots_adjust</span><span class="p">(</span><span class="n">right</span><span class="o">=</span><span class="n">rspace</span><span class="p">)</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">subplots_adjust</span><span class="p">(</span><span class="n">bottom</span><span class="o">=</span><span class="n">bspace</span><span class="p">)</span>

	<span class="c1">#print [mean_val,bin_bdys,y]</span>
	<span class="k">return</span></div>


    <span class="k">def</span> <span class="nf">__plot_mass_range_contributions_single</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">7</span><span class="p">,</span><span class="n">specie</span><span class="o">=</span><span class="s1">&#39;C&#39;</span><span class="p">,</span><span class="n">prodfac</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">rebin</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span><span class="n">time</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;-&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;o&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;r&#39;</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span><span class="n">extralabel</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">log</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Internal plotting function for function plot_mass_range_contributions</span>
<span class="sd">        &#39;&#39;&#39;</span>
    

        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
            <span class="n">label</span><span class="o">=</span><span class="n">specie</span>


        <span class="n">contribution</span><span class="o">=</span><span class="p">[]</span>
        <span class="c1">#find starburst corresponding to time</span>
        <span class="k">if</span> <span class="n">time</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
                <span class="n">age1</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span>
                <span class="k">if</span> <span class="n">time</span> <span class="ow">in</span> <span class="n">age1</span><span class="p">:</span>
                        <span class="n">age_idx</span><span class="o">=</span><span class="n">age1</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">time</span><span class="p">)</span>
                <span class="k">else</span><span class="p">:</span>
                        <span class="n">age_idx</span><span class="o">=</span><span class="nb">min</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">age1</span><span class="p">)),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="nb">abs</span><span class="p">(</span><span class="n">age1</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">-</span><span class="n">time</span><span class="p">))</span>
                        <span class="k">print</span> <span class="s1">&#39;Age not found, choose closest age&#39;</span><span class="p">,</span><span class="n">age1</span><span class="p">[</span><span class="n">age_idx</span><span class="p">]</span>
                <span class="n">mass_ranges</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">imf_mass_ranges</span><span class="p">[</span><span class="n">age_idx</span><span class="p">]</span>
                <span class="n">contribution</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">imf_mass_ranges_contribution</span><span class="p">[</span><span class="n">age_idx</span><span class="p">]</span>
                <span class="n">mtots</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">imf_mass_ranges_mtot</span><span class="p">[</span><span class="n">age_idx</span><span class="p">]</span>
        <span class="c1">#take sum of all star bursts</span>
        <span class="k">else</span><span class="p">:</span>

                <span class="n">firstTime</span><span class="o">=</span><span class="bp">True</span>
                <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">imf_mass_ranges</span><span class="p">)):</span>
                        <span class="n">mass_ranges1</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">imf_mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>
                        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">mass_ranges1</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span> <span class="ow">and</span> <span class="n">firstTime</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
                                <span class="n">mass_ranges</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">imf_mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>
                                <span class="n">contribution</span><span class="o">=</span><span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">imf_mass_ranges_contribution</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
                                <span class="n">mtots</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">imf_mass_ranges_mtot</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>
                                <span class="n">firstTime</span><span class="o">=</span><span class="bp">False</span>
                        <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">mass_ranges1</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span> <span class="ow">and</span> <span class="p">(</span><span class="ow">not</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">imf_mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="n">mass_ranges</span><span class="p">)):</span>
                                <span class="k">print</span> <span class="s1">&#39;Error: Different mass range intervalls used: cannot combine them&#39;</span>
                                <span class="k">print</span> <span class="s1">&#39;Choose a specific staburst via time&#39;</span>
                                <span class="k">return</span> <span class="mi">0</span>
                        <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">mass_ranges1</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
                                <span class="n">mtots</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">mtots</span><span class="p">)</span><span class="o">+</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">imf_mass_ranges_mtot</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
                                <span class="c1">#carries all isotopes, hence an array: self.history.imf_mass_ranges_contribution[k][h]</span>
                                <span class="k">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">imf_mass_ranges_contribution</span><span class="p">[</span><span class="n">k</span><span class="p">])):</span>
                                        <span class="n">contribution</span><span class="p">[</span><span class="n">h</span><span class="p">]</span><span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">contribution</span><span class="p">[</span><span class="n">h</span><span class="p">])</span><span class="o">+</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">imf_mass_ranges_contribution</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">h</span><span class="p">])</span>


        <span class="n">isotopes</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span>
        <span class="n">iso_idx_array</span><span class="o">=</span><span class="p">[]</span>
	<span class="n">x_iso_ism_ini</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">mgal</span>
        <span class="c1">#get the element specific indices</span>
        <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">isotopes</span><span class="p">)):</span>
	    <span class="k">if</span> <span class="ow">not</span> <span class="s1">&#39;-&#39;</span> <span class="ow">in</span> <span class="n">specie</span><span class="p">:</span>
	    	<span class="n">specie</span><span class="o">=</span><span class="n">specie</span><span class="o">+</span><span class="s1">&#39;-&#39;</span>
            <span class="k">if</span> <span class="n">specie</span> <span class="ow">in</span> <span class="n">isotopes</span><span class="p">[</span><span class="n">k</span><span class="p">]:</span>
                <span class="n">iso_idx_array</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">isotopes</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">isotopes</span><span class="p">[</span><span class="n">k</span><span class="p">]))</span>
        <span class="c1">#get the sum of yields for each isotope and mass range</span>
        <span class="n">y</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">*</span><span class="nb">len</span><span class="p">(</span><span class="n">contribution</span><span class="p">)</span>
        <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">contribution</span><span class="p">)):</span>
	    <span class="n">yields</span><span class="o">=</span><span class="mi">0</span> <span class="c1">#[0]*len(contribution[k])</span>
	    <span class="n">x_ini</span><span class="o">=</span><span class="mi">0</span>
            <span class="k">for</span> <span class="n">iso_idx</span> <span class="ow">in</span> <span class="n">iso_idx_array</span><span class="p">:</span>
                <span class="n">yields</span><span class="o">+=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">contribution</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">iso_idx</span><span class="p">])</span>
		<span class="n">x_ini</span><span class="o">+=</span><span class="n">x_iso_ism_ini</span><span class="p">[</span><span class="n">iso_idx</span><span class="p">]</span>
	    <span class="k">if</span> <span class="n">prodfac</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
		<span class="k">if</span> <span class="n">x_ini</span> <span class="o">==</span><span class="mi">0</span><span class="p">:</span>
			<span class="k">print</span> <span class="s1">&#39;Initial abundance not available!&#39;</span>
			<span class="k">print</span> <span class="s1">&#39;Cannot plot production factor.&#39;</span>
			<span class="k">return</span> <span class="mi">0</span>
		<span class="n">y</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">yields</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="n">mtots</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">*</span><span class="n">x_ini</span><span class="p">)</span>
	    <span class="k">else</span><span class="p">:</span>
	 	<span class="n">y</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">=</span><span class="n">yields</span>
		
	<span class="c1">#print mass_ranges</span>
	<span class="c1">#print &#39;contribution&#39;</span>
	<span class="c1">#print y</span>

        <span class="c1">#masses1=[]</span>
        <span class="c1">#for m in range(len(mass_ranges)):</span>
        <span class="c1">#    masses1.append( (mass_ranges[m][0]+mass_ranges[m][1])/2.)</span>
        <span class="c1">#masses_idx= sorted(range(len(masses1)),key=lambda x:masses1[x])</span>

        <span class="c1">#print &#39;len same: &#39;,len(mass_ranges),len(masses)</span>
        <span class="c1">#for idx in masses_idx:</span>
        <span class="c1">#    masses.append(masses1[idx])</span>
        <span class="c1">#    yields.append(yields1[idx])</span>
        <span class="c1">#&#39;&#39;&#39;</span>
        <span class="c1">#for histo</span>
        <span class="n">bin_bdys</span><span class="o">=</span><span class="p">[]</span>
	<span class="n">mean_val</span><span class="o">=</span><span class="p">[]</span>
        <span class="c1">#bin_bdys.append(1)</span>
        <span class="n">bin_values</span><span class="o">=</span><span class="p">[]</span>
	<span class="c1">#rebin the plot using the bin size rebin</span>
	<span class="c1">#print mass_ranges</span>
	<span class="k">if</span> <span class="n">rebin</span> <span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
		<span class="c1">#print mass_ranges</span>
		<span class="c1">#print y</span>
		<span class="c1">#nprint &#39;-------------------&#39;</span>
		<span class="c1">#_imf(self,mmin,mmax,inte,mass=0,iolevel=0)</span>
		<span class="n">mass</span><span class="o">=</span><span class="n">mass_ranges</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>	
		<span class="n">mmax</span><span class="o">=</span><span class="n">mass_ranges</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
		<span class="n">bin_bdys1</span><span class="o">=</span><span class="p">[]</span>
		<span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
			<span class="n">bin_min</span><span class="o">=</span><span class="nb">round</span><span class="p">(</span><span class="n">mass</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>
			<span class="n">mass</span><span class="o">+=</span><span class="n">rebin</span>
			<span class="n">bin_max</span><span class="o">=</span><span class="nb">round</span><span class="p">(</span><span class="n">mass</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>
			<span class="k">if</span> <span class="p">(</span><span class="n">mmax</span><span class="o">==</span><span class="mi">0</span><span class="p">):</span>
				<span class="k">break</span>
			<span class="k">if</span> <span class="n">bin_max</span><span class="o">&gt;</span><span class="n">mmax</span><span class="p">:</span>
				<span class="n">bin_max</span><span class="o">=</span><span class="n">mmax</span>
				<span class="n">mass</span><span class="o">=</span><span class="n">mmax</span>
				<span class="n">mmax</span><span class="o">=</span><span class="mi">0</span>
			<span class="n">bin_bdys1</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">bin_min</span><span class="p">,</span><span class="n">bin_max</span><span class="p">])</span>
			<span class="n">bin_values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
			<span class="c1">#print &#39;Bin :&#39;,bin_bdys1[-1]</span>
			<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">mass_ranges</span><span class="p">)):</span>
				<span class="k">if</span> <span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span><span class="o">&lt;=</span><span class="n">bin_min</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span><span class="o">&gt;=</span><span class="n">bin_max</span><span class="p">):</span>
					<span class="k">continue</span>
				<span class="c1">#print &#39;interval &#39;,mass_ranges[k]</span>
				<span class="c1">#if mass range inside bin</span>
				<span class="k">elif</span> <span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span><span class="o">&gt;=</span><span class="n">bin_min</span><span class="p">)</span> <span class="ow">and</span> <span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span><span class="o">&lt;=</span><span class="n">bin_max</span><span class="p">):</span>
					<span class="n">bin_values</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">+=</span><span class="n">y</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>
					<span class="c1">#print &#39;bin includes mass range&#39;,y[k]</span>
					<span class="k">continue</span>
				<span class="c1">#if mass range includes bin:</span>
				<span class="k">elif</span> <span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span><span class="o">&lt;=</span><span class="n">bin_min</span><span class="p">)</span> <span class="ow">and</span> <span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span><span class="o">&gt;=</span><span class="n">bin_max</span><span class="p">):</span>
                                        <span class="c1">#normalization to bin mass</span>
                                        <span class="n">h</span><span class="o">=</span><span class="n">y</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">_imf</span><span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span><span class="n">inte</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
                                        <span class="n">y1</span><span class="o">=</span><span class="n">h</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_imf</span><span class="p">(</span><span class="n">bin_min</span><span class="p">,</span><span class="n">bin_max</span><span class="p">,</span><span class="n">inte</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
                                        <span class="n">bin_values</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">+=</span><span class="n">y1</span>
                                        <span class="c1">#print &#39;mass range inlcudes bin &#39;,bin_min,bin_max,y1</span>
					
				<span class="c1">#if upper part of bin is not in mass range</span>
				<span class="k">elif</span> <span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span><span class="o">&lt;</span><span class="n">bin_max</span><span class="p">):</span>
					<span class="c1">#normalization to bin mass</span>
					<span class="n">h</span><span class="o">=</span><span class="n">y</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">_imf</span><span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span><span class="n">inte</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
					<span class="n">y1</span><span class="o">=</span><span class="n">h</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_imf</span><span class="p">(</span><span class="n">bin_min</span><span class="p">,</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span><span class="n">inte</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
					<span class="n">bin_values</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">+=</span><span class="n">y1</span>
					<span class="c1">#print &#39;add upper half from &#39;,bin_min,mass_ranges[k][1],y1</span>
                                <span class="c1">#if lower part of bin is not in mass range</span>
                                <span class="k">elif</span> <span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span><span class="o">&gt;</span><span class="n">bin_min</span><span class="p">:</span>					
					<span class="c1">#normalization to bin mass</span>
					<span class="n">h</span><span class="o">=</span><span class="n">y</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">_imf</span><span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">1</span><span class="p">],</span><span class="n">inte</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
					<span class="n">y1</span><span class="o">=</span><span class="n">h</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_imf</span><span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span><span class="n">bin_max</span><span class="p">,</span><span class="n">inte</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
					<span class="c1">#print &#39;add lower half from &#39;,mass_ranges[k][0],bin_max,y1</span>
					<span class="n">bin_values</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">+=</span><span class="n">y1</span>
			<span class="c1">#if bin_values[-1]==0:</span>
			<span class="c1">#	print &#39;Note that no values are found in bin range:&#39;,bin_min,&#39;-&#39;,bin_max</span>
				<span class="c1">#return 0</span>
			<span class="k">if</span> <span class="n">mmax</span><span class="o">==</span><span class="n">bin_max</span><span class="p">:</span>
				<span class="k">break</span>
	<span class="c1">#	print bin_bdys1</span>
<span class="c1">#		print bin_values</span>
		<span class="n">mass_ranges</span><span class="o">=</span><span class="n">bin_bdys1</span>
		<span class="n">y</span><span class="o">=</span><span class="n">bin_values</span>


	<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">mass_ranges</span><span class="p">)):</span>
                <span class="c1">#yields1.append(yields[k]) #</span>
		<span class="k">if</span> <span class="n">k</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
                	<span class="n">bin_bdys</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
                <span class="n">bin_bdys</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
		<span class="n">mean_val</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="p">(</span><span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="n">mass_ranges</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span><span class="o">/</span><span class="mf">2.</span><span class="p">)</span>
	<span class="c1">#print &#39;test&#39;		</span>
	<span class="c1">#print yields</span>
	<span class="c1">#print bin_bdys</span>
	<span class="c1">#print mean_val</span>

	<span class="k">return</span> <span class="n">mean_val</span><span class="p">,</span><span class="n">bin_bdys</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">color</span><span class="p">,</span><span class="n">label</span>


<div class="viewcode-block" id="sygma.plot_iso_ratio"><a class="viewcode-back" href="../sygma.html#sygma.sygma.plot_iso_ratio">[docs]</a>    <span class="k">def</span> <span class="nf">plot_iso_ratio</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">fig</span><span class="o">=</span><span class="mi">18</span><span class="p">,</span><span class="n">source</span><span class="o">=</span><span class="s1">&#39;all&#39;</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">shape</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span>\
        <span class="n">color</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="n">fsize</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mf">4.5</span><span class="p">],</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span>\
        <span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">15</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">return_x_y</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
        <span class="n">xaxis</span><span class="o">=</span><span class="s1">&#39;age&#39;</span><span class="p">,</span><span class="n">yaxis</span><span class="o">=</span><span class="s1">&#39;C-12/C-13&#39;</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="mi">500</span><span class="p">,</span>\
        <span class="n">solar_ab</span><span class="o">=</span><span class="s1">&#39;yield_tables/iniabu/iniab2.0E-02GN93.ppn&#39;</span><span class="p">,</span>\
        <span class="n">solar_iso</span><span class="o">=</span><span class="s1">&#39;solar_normalization/Asplund_et_al_2009_iso.txt&#39;</span><span class="p">):</span>

	<span class="sd">&#39;&#39;&#39;</span>

<span class="sd">	Plots ratios of isotopes.</span>


<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>

<span class="sd">	yaxis: string</span>
<span class="sd">		Ratio of isotopes, e.g. C-12/C-13</span>


<span class="sd">        Examples</span>
<span class="sd">        ----------</span>

<span class="sd">	&gt;&gt;&gt; s.plot_iso_ratio(yaxis=&#39;C-12/C-13&#39;) 	</span>

<span class="sd">	&#39;&#39;&#39;</span>


        <span class="c1"># Declaration of the array to plot</span>
        <span class="n">x</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="n">y</span> <span class="o">=</span> <span class="p">[]</span>

        <span class="c1"># Access solar abundance</span>
        <span class="n">iniabu</span><span class="o">=</span><span class="n">ry</span><span class="o">.</span><span class="n">iniabu</span><span class="p">(</span><span class="n">global_path</span><span class="o">+</span><span class="n">solar_ab</span><span class="p">)</span>
        <span class="n">x_ini_iso</span><span class="o">=</span><span class="n">iniabu</span><span class="o">.</span><span class="n">iso_abundance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="p">)</span>
        <span class="n">elements</span><span class="p">,</span><span class="n">x_ini</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_iso_abu_to_elem</span><span class="p">(</span><span class="n">x_ini_iso</span><span class="p">)</span>

        <span class="c1"># Get the wanted source</span>
        <span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;all&#39;</span><span class="p">:</span>
            <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield</span>
            <span class="n">yields_evol_el</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield</span>
        <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
            <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_agb</span>
            <span class="n">yields_evol_el</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_agb</span>
        <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
            <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_1a</span>
            <span class="n">yields_evol_el</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_1a</span>
        <span class="k">elif</span> <span class="n">source</span> <span class="o">==</span> <span class="s1">&#39;massive&#39;</span><span class="p">:</span>
            <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield_massive</span>
            <span class="n">yields_evol_el</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield_massive</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">print</span> <span class="s1">&#39;!! Source not valid !!&#39;</span>
            <span class="k">return</span>

        <span class="c1"># Verify the X-axis</span>
        <span class="n">xaxis_ratio</span> <span class="o">=</span> <span class="bp">False</span>
        <span class="k">if</span> <span class="n">xaxis</span> <span class="o">==</span> <span class="s1">&#39;age&#39;</span><span class="p">:</span>
            <span class="n">x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span>
        <span class="k">elif</span> <span class="n">xaxis</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;[&#39;</span> <span class="ow">and</span> <span class="n">xaxis</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;]&#39;</span><span class="p">:</span>
            <span class="n">xaxis_elem1</span> <span class="o">=</span><span class="n">xaxis</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">:]</span>
            <span class="n">xaxis_elem2</span> <span class="o">=</span><span class="n">xaxis</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">][:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="n">xaxis_elem1</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span> <span class="ow">and</span> \
               <span class="ow">not</span> <span class="n">xaxis_elem2</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span><span class="p">:</span>
                 <span class="k">print</span> <span class="s1">&#39;!! Elements in xaxis are not valid !!&#39;</span>
                 <span class="k">return</span>

            <span class="c1">#X-axis ini values</span>
            <span class="n">x_elem1_ini</span><span class="o">=</span><span class="n">x_ini</span><span class="p">[</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">xaxis_elem1</span><span class="p">)]</span>
            <span class="n">x_elem2_ini</span><span class="o">=</span><span class="n">x_ini</span><span class="p">[</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">xaxis_elem2</span><span class="p">)]</span>

            <span class="c1">#X-axis gce values</span>
            <span class="n">elem_idx1</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">xaxis_elem1</span><span class="p">)</span>
            <span class="n">elem_idx2</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">xaxis_elem2</span><span class="p">)</span>

            <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">yields_evol_el</span><span class="p">)):</span>
                <span class="k">if</span> <span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol_el</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                    <span class="k">continue</span>
                <span class="c1">#in case no contribution during timestep</span>
                <span class="n">x1</span><span class="o">=</span><span class="n">yields_evol_el</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">elem_idx1</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol_el</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
                <span class="n">x2</span><span class="o">=</span><span class="n">yields_evol_el</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">elem_idx2</span><span class="p">]</span><span class="o">/</span><span class="nb">sum</span><span class="p">(</span><span class="n">yields_evol_el</span><span class="p">[</span><span class="n">k</span><span class="p">])</span>
                <span class="n">spec</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span><span class="n">x1</span><span class="o">/</span><span class="n">x2</span><span class="p">)</span> <span class="o">-</span> <span class="n">np</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span><span class="n">x_elem1_ini</span><span class="o">/</span><span class="n">x_elem2_ini</span><span class="p">)</span>
                <span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">spec</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">xaxis_ratio</span> <span class="o">=</span> <span class="bp">True</span>
            <span class="n">x_1</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
            <span class="n">x_2</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
            <span class="n">is_x_1</span> <span class="o">=</span> <span class="bp">True</span>
            <span class="k">for</span> <span class="n">ix</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">xaxis</span><span class="p">)):</span>
                <span class="k">if</span> <span class="n">xaxis</span><span class="p">[</span><span class="n">ix</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;/&#39;</span> <span class="ow">and</span> <span class="n">is_x_1</span><span class="p">:</span>
                    <span class="n">is_x_1</span> <span class="o">=</span> <span class="bp">False</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">if</span> <span class="n">is_x_1</span><span class="p">:</span>
                        <span class="n">x_1</span> <span class="o">+=</span> <span class="n">xaxis</span><span class="p">[</span><span class="n">ix</span><span class="p">]</span>
                    <span class="k">else</span><span class="p">:</span>
                        <span class="n">x_2</span> <span class="o">+=</span> <span class="n">xaxis</span><span class="p">[</span><span class="n">ix</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">x_2</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                <span class="k">print</span> <span class="s1">&#39;!! xaxis not valid.  Need to be </span><span class="se">\&#39;</span><span class="s1">age</span><span class="se">\&#39;</span><span class="s1"> or a ratio !!&#39;</span>
                <span class="k">return</span>

        <span class="c1"># Verify the Y-axis</span>
        <span class="n">y_1</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
        <span class="n">y_2</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
        <span class="n">is_y_1</span> <span class="o">=</span> <span class="bp">True</span>
        <span class="k">for</span> <span class="n">iy</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">yaxis</span><span class="p">)):</span>
            <span class="k">if</span> <span class="n">yaxis</span><span class="p">[</span><span class="n">iy</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;/&#39;</span> <span class="ow">and</span> <span class="n">is_y_1</span><span class="p">:</span>
                <span class="n">is_y_1</span> <span class="o">=</span> <span class="bp">False</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">if</span> <span class="n">is_y_1</span><span class="p">:</span>
                    <span class="n">y_1</span> <span class="o">+=</span> <span class="n">yaxis</span><span class="p">[</span><span class="n">iy</span><span class="p">]</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">y_2</span> <span class="o">+=</span> <span class="n">yaxis</span><span class="p">[</span><span class="n">iy</span><span class="p">]</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">y_2</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">print</span> <span class="s1">&#39;!! yaxis not valid.  Need to be a ratio !!&#39;</span>
            <span class="k">return</span>

        <span class="c1"># Get the isotopes for X-axis</span>
        <span class="k">if</span> <span class="n">xaxis_ratio</span><span class="p">:</span>
          <span class="k">if</span> <span class="n">x_1</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span> <span class="ow">and</span> <span class="n">x_2</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="p">:</span>
            <span class="n">idx_1</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">x_1</span><span class="p">)</span>
            <span class="n">idx_2</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">x_2</span><span class="p">)</span>
            <span class="n">x1_elem</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">x_1</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
            <span class="n">x2_elem</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">x_2</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
            <span class="n">x1_at_nb</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_1</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">])</span>
            <span class="n">x2_at_nb</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_2</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">])</span>
          <span class="k">else</span><span class="p">:</span>
            <span class="k">print</span> <span class="s1">&#39;!! Isotopes in xaxis are not valid !!&#39;</span>
            <span class="k">return</span>

        <span class="c1"># Get the isotopes for Y-axis</span>
        <span class="k">if</span> <span class="n">y_1</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span> <span class="ow">and</span> <span class="n">y_2</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="p">:</span>
            <span class="n">idy_1</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">y_1</span><span class="p">)</span>
            <span class="n">idy_2</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">y_2</span><span class="p">)</span>
            <span class="n">y1_elem</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">y_1</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
            <span class="n">y2_elem</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">y_2</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
            <span class="n">y1_at_nb</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_1</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">])</span>
            <span class="n">y2_at_nb</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_2</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)[</span><span class="mi">1</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">print</span> <span class="s1">&#39;!! Isotopes in yaxis are not valid !!&#39;</span>
            <span class="k">return</span>

        <span class="c1"># Set the default label .. if not defined</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span><span class="o">&lt;</span><span class="mi">1</span><span class="p">:</span>
            <span class="n">label</span><span class="o">=</span><span class="n">yaxis</span>
            <span class="k">if</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
                <span class="n">label</span><span class="o">=</span><span class="n">yaxis</span><span class="o">+</span><span class="s1">&#39;, AGB&#39;</span>
            <span class="k">elif</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;massive&#39;</span><span class="p">:</span>
                <span class="n">label</span><span class="o">=</span><span class="n">yaxis</span><span class="o">+</span><span class="s1">&#39;, Massive&#39;</span>
            <span class="k">elif</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
                <span class="n">label</span><span class="o">=</span><span class="n">yaxis</span><span class="o">+</span><span class="s1">&#39;, SNIa&#39;</span>

        <span class="c1"># Get the solar values</span>
        <span class="k">if</span> <span class="n">xaxis_ratio</span><span class="p">:</span>
            <span class="n">x1_sol</span><span class="p">,</span> <span class="n">x2_sol</span><span class="p">,</span> <span class="n">y1_sol</span><span class="p">,</span> <span class="n">y2_sol</span> <span class="o">=</span> \
              <span class="bp">self</span><span class="o">.</span><span class="n">__read_solar_iso</span><span class="p">(</span><span class="n">solar_iso</span><span class="p">,</span> <span class="n">x_1</span><span class="p">,</span> <span class="n">x_2</span><span class="p">,</span> <span class="n">y_1</span><span class="p">,</span> <span class="n">y_2</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">x1_sol</span><span class="p">,</span> <span class="n">x2_sol</span><span class="p">,</span> <span class="n">y1_sol</span><span class="p">,</span> <span class="n">y2_sol</span> <span class="o">=</span> \
                <span class="bp">self</span><span class="o">.</span><span class="n">__read_solar_iso</span><span class="p">(</span><span class="n">solar_iso</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="n">y_1</span><span class="p">,</span> <span class="n">y_2</span><span class="p">)</span>

        <span class="c1"># Calculate the isotope ratios (mass ratio)</span>
        <span class="c1">#for k in range(0,len(yields_evol)):</span>
        <span class="c1">#    if xaxis_ratio:</span>
        <span class="c1">#        x.append( yields_evol[k][idx_1] / yields_evol[k][idx_2] )</span>
        <span class="c1">#    y.append( yields_evol[k][idy_1] / yields_evol[k][idy_2] )</span>

        <span class="c1"># Calculate the isotope ratios (delta notation)</span>
        <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">yields_evol</span><span class="p">)):</span>
            <span class="k">if</span> <span class="n">xaxis_ratio</span><span class="p">:</span>
                <span class="n">ratio_sample</span> <span class="o">=</span> <span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">idx_1</span><span class="p">]</span><span class="o">/</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">idx_2</span><span class="p">])</span><span class="o">*</span>\
                               <span class="p">(</span><span class="n">x2_at_nb</span> <span class="o">/</span> <span class="n">x1_at_nb</span><span class="p">)</span>
                <span class="n">ratio_std</span> <span class="o">=</span> <span class="n">x1_sol</span> <span class="o">/</span> <span class="n">x2_sol</span>
                <span class="n">x</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="p">((</span><span class="n">ratio_sample</span><span class="o">/</span><span class="n">ratio_std</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> <span class="o">*</span> <span class="mi">1000</span><span class="p">)</span>
            <span class="n">ratio_sample</span> <span class="o">=</span> <span class="p">(</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">idy_1</span><span class="p">]</span><span class="o">/</span><span class="n">yields_evol</span><span class="p">[</span><span class="n">k</span><span class="p">][</span><span class="n">idy_2</span><span class="p">])</span><span class="o">*</span>\
                           <span class="p">(</span><span class="n">y2_at_nb</span> <span class="o">/</span> <span class="n">y1_at_nb</span><span class="p">)</span>
            <span class="n">ratio_std</span> <span class="o">=</span> <span class="n">y1_sol</span> <span class="o">/</span> <span class="n">y2_sol</span>
            <span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="p">((</span><span class="n">ratio_sample</span><span class="o">/</span><span class="n">ratio_std</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> <span class="o">*</span> <span class="mi">1000</span><span class="p">)</span>
    
        <span class="c1">#Reserved for plotting</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">return_x_y</span><span class="p">:</span>
            <span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__msc</span><span class="p">(</span><span class="n">source</span><span class="p">,</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="p">)</span>

        <span class="c1">#x=x[1:]</span>
        <span class="c1">#y=y[1:]</span>


        <span class="c1">#Reserved for plotting</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">return_x_y</span><span class="p">:</span>
           <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">fig</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="n">fsize</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">fsize</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
           <span class="k">if</span> <span class="n">xaxis</span> <span class="o">==</span> <span class="s1">&#39;age&#39;</span><span class="p">:</span>
               <span class="n">plt</span><span class="o">.</span><span class="n">xscale</span><span class="p">(</span><span class="s1">&#39;log&#39;</span><span class="p">)</span>
           <span class="c1">#plt.yscale(&#39;log&#39;)</span>
           <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s2">&quot;$\delta$($^{&quot;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">y1_at_nb</span><span class="p">))</span><span class="o">+</span><span class="s2">&quot;}$&quot;</span><span class="o">+</span><span class="n">y1_elem</span><span class="o">+</span><span class="s2">&quot;/$^{&quot;</span><span class="o">+</span>\
                           <span class="nb">str</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">y2_at_nb</span><span class="p">))</span><span class="o">+</span><span class="s2">&quot;}$&quot;</span><span class="o">+</span><span class="n">y2_elem</span><span class="o">+</span><span class="s2">&quot;)&quot;</span><span class="p">)</span>
           <span class="k">if</span> <span class="n">xaxis</span> <span class="o">==</span> <span class="s1">&#39;age&#39;</span><span class="p">:</span>
               <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;age [yr]&#39;</span><span class="p">)</span>
           <span class="k">elif</span> <span class="n">xaxis_ratio</span><span class="p">:</span>
               <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s2">&quot;$\delta$($^{&quot;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">x1_at_nb</span><span class="p">))</span><span class="o">+</span><span class="s2">&quot;}$&quot;</span><span class="o">+</span><span class="n">x1_elem</span><span class="o">+</span><span class="s2">&quot;/$^{&quot;</span><span class="o">+</span>\
                           <span class="nb">str</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">x2_at_nb</span><span class="p">))</span><span class="o">+</span><span class="s2">&quot;}$&quot;</span><span class="o">+</span><span class="n">x2_elem</span><span class="o">+</span><span class="s2">&quot;)&quot;</span><span class="p">)</span>
           <span class="k">else</span><span class="p">:</span>
               <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="n">xaxis</span><span class="p">)</span>

        <span class="c1">#If x and y need to be returned ...</span>
        <span class="k">if</span> <span class="n">return_x_y</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span>

        <span class="k">else</span><span class="p">:</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="n">label</span><span class="p">,</span><span class="n">linestyle</span><span class="o">=</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="n">marker</span><span class="p">,</span>\
                     <span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span><span class="n">markevery</span><span class="o">=</span><span class="n">markevery</span><span class="p">)</span>
            <span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>
            <span class="n">ax</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">__fig_standard</span><span class="p">(</span><span class="n">ax</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">fontsize</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="n">labelsize</span><span class="p">,</span>\
                  <span class="n">rspace</span><span class="o">=</span><span class="n">rspace</span><span class="p">,</span> <span class="n">bspace</span><span class="o">=</span><span class="n">bspace</span><span class="p">,</span><span class="n">legend_fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>
	    <span class="c1">#plt.xlim(self.history.dt,self.history.tend)	</span>
	    <span class="bp">self</span><span class="o">.</span><span class="n">__save_data</span><span class="p">(</span><span class="n">header</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;Iso mass ratio&#39;</span><span class="p">,</span><span class="n">yaxis</span><span class="p">],</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">])</span></div>



    <span class="c1">##############################################</span>
    <span class="c1">#               Read Solar Iso               #</span>
    <span class="c1">##############################################</span>
    <span class="k">def</span> <span class="nf">__read_solar_iso</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">file_path</span><span class="p">,</span> <span class="n">xx1</span><span class="p">,</span> <span class="n">xx2</span><span class="p">,</span> <span class="n">yy1</span><span class="p">,</span> <span class="n">yy2</span><span class="p">):</span>

        <span class="c1"># Initialisation of the variable to be returned</span>
        <span class="n">x1_rsi</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
        <span class="n">x2_rsi</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
        <span class="n">y1_rsi</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
        <span class="n">y2_rsi</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>

        <span class="c1"># Open the data file</span>
        <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">global_path</span><span class="o">+</span><span class="n">file_path</span><span class="p">,</span> <span class="s1">&#39;r&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">data_file</span><span class="p">:</span>

            <span class="c1"># For every line (for each isotope) ...</span>
            <span class="k">for</span> <span class="n">line_1_str</span> <span class="ow">in</span> <span class="n">data_file</span><span class="p">:</span>

                <span class="c1"># Split the line</span>
                <span class="n">split</span> <span class="o">=</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">line_1_str</span><span class="o">.</span><span class="n">split</span><span class="p">()]</span>

                <span class="c1"># Copy the number fraction of the isotopes (if found)</span>
                <span class="k">if</span> <span class="n">split</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">xx1</span><span class="p">:</span>
                    <span class="n">x1_rsi</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">split</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
                <span class="k">if</span> <span class="n">split</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">xx2</span><span class="p">:</span>
                    <span class="n">x2_rsi</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">split</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
                <span class="k">if</span> <span class="n">split</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">yy1</span><span class="p">:</span>
                    <span class="n">y1_rsi</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">split</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
                <span class="k">if</span> <span class="n">split</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">yy2</span><span class="p">:</span>
                    <span class="n">y2_rsi</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">split</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>

        <span class="c1"># Close the file</span>
        <span class="n">data_file</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

        <span class="c1"># Return the number fractions</span>
        <span class="k">return</span> <span class="n">x1_rsi</span><span class="p">,</span> <span class="n">x2_rsi</span><span class="p">,</span> <span class="n">y1_rsi</span><span class="p">,</span> <span class="n">y2_rsi</span>

    <span class="k">def</span> <span class="nf">__msc</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">source</span><span class="p">,</span><span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span><span class="p">):</span>

	<span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Function checks if either of shape,color,marker</span>
<span class="sd">	is set. If not then assign in each case</span>
<span class="sd">	a unique property related to the source (&#39;agb&#39;,&#39;massive&#39;..)</span>
<span class="sd">	to the variable and returns all three</span>
<span class="sd">	&#39;&#39;&#39;</span>

	<span class="k">if</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;all&#39;</span><span class="p">:</span>
		<span class="n">shape1</span><span class="o">=</span><span class="s1">&#39;-&#39;</span>
		<span class="n">marker1</span><span class="o">=</span><span class="s1">&#39;o&#39;</span>
		<span class="n">color1</span><span class="o">=</span><span class="s1">&#39;k&#39;</span>
	<span class="k">elif</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;agb&#39;</span><span class="p">:</span>
		<span class="n">shape1</span><span class="o">=</span><span class="s1">&#39;--&#39;</span>
		<span class="n">marker1</span><span class="o">=</span><span class="s1">&#39;s&#39;</span>
		<span class="n">color1</span><span class="o">=</span><span class="s1">&#39;r&#39;</span>
	<span class="k">elif</span> <span class="n">source</span><span class="o">==</span><span class="s1">&#39;massive&#39;</span><span class="p">:</span>
		<span class="n">shape1</span><span class="o">=</span><span class="s1">&#39;-.&#39;</span>
		<span class="n">marker1</span><span class="o">=</span><span class="s1">&#39;D&#39;</span>
		<span class="n">color1</span><span class="o">=</span><span class="s1">&#39;b&#39;</span>
	<span class="k">elif</span> <span class="n">source</span> <span class="o">==</span><span class="s1">&#39;sn1a&#39;</span><span class="p">:</span>
		<span class="n">shape1</span><span class="o">=</span><span class="s1">&#39;:&#39;</span>
		<span class="n">marker1</span><span class="o">=</span><span class="s1">&#39;x&#39;</span>
		<span class="n">color1</span><span class="o">=</span><span class="s1">&#39;g&#39;</span>
	
	<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">shape</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
		<span class="n">shape</span><span class="o">=</span><span class="n">shape1</span>
	<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">marker</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
		<span class="n">marker</span><span class="o">=</span><span class="n">marker1</span>
	<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">color</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
		<span class="n">color</span><span class="o">=</span><span class="n">color1</span>

	<span class="k">return</span> <span class="n">shape</span><span class="p">,</span><span class="n">marker</span><span class="p">,</span><span class="n">color</span>


    <span class="c1">##############################################</span>
    <span class="c1">#                Fig Standard                #</span>
    <span class="c1">##############################################</span>
    <span class="k">def</span> <span class="nf">__fig_standard</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">ax</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span><span class="n">labelsize</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span><span class="n">lwtickboth</span><span class="o">=</span><span class="p">[</span><span class="mi">6</span><span class="p">,</span><span class="mi">2</span><span class="p">],</span><span class="n">lwtickmajor</span><span class="o">=</span><span class="p">[</span><span class="mi">10</span><span class="p">,</span><span class="mi">3</span><span class="p">],</span><span class="n">markersize</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span><span class="n">rspace</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span><span class="n">bspace</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span> <span class="n">legend_fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Internal function in order to get standardized figure font sizes.</span>
<span class="sd">	It is used in the plotting functions.</span>
<span class="sd">        &#39;&#39;&#39;</span>

        <span class="n">plt</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span><span class="n">prop</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;size&#39;</span><span class="p">:</span><span class="n">legend_fontsize</span><span class="p">})</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">rcParams</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="s1">&#39;font.size&#39;</span><span class="p">:</span> <span class="n">fontsize</span><span class="p">})</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">yaxis</span><span class="o">.</span><span class="n">label</span><span class="o">.</span><span class="n">set_size</span><span class="p">(</span><span class="n">labelsize</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">xaxis</span><span class="o">.</span><span class="n">label</span><span class="o">.</span><span class="n">set_size</span><span class="p">(</span><span class="n">labelsize</span><span class="p">)</span>
	<span class="c1">#ax.xaxis.set_tick_params(width=2)</span>
	<span class="c1">#ax.yaxis.set_tick_params(width=2)		</span>
	<span class="n">ax</span><span class="o">.</span><span class="n">tick_params</span><span class="p">(</span><span class="n">length</span><span class="o">=</span><span class="n">lwtickboth</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">width</span><span class="o">=</span><span class="n">lwtickboth</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span><span class="n">which</span><span class="o">=</span><span class="s1">&#39;both&#39;</span><span class="p">)</span>
	<span class="n">ax</span><span class="o">.</span><span class="n">tick_params</span><span class="p">(</span><span class="n">length</span><span class="o">=</span><span class="n">lwtickmajor</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">width</span><span class="o">=</span><span class="n">lwtickmajor</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span><span class="n">which</span><span class="o">=</span><span class="s1">&#39;major&#39;</span><span class="p">)</span>
	<span class="c1">#Add that line below at some point</span>
	<span class="c1">#ax.xaxis.set_tick_params(width=2)</span>
	<span class="c1">#ax.yaxis.set_tick_params(width=2)</span>
	<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">ax</span><span class="o">.</span><span class="n">lines</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
		<span class="k">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">ax</span><span class="o">.</span><span class="n">lines</span><span class="p">)):</span>
			<span class="n">ax</span><span class="o">.</span><span class="n">lines</span><span class="p">[</span><span class="n">h</span><span class="p">]</span><span class="o">.</span><span class="n">set_markersize</span><span class="p">(</span><span class="n">markersize</span><span class="p">)</span>
	<span class="n">ax</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s1">&#39;center left&#39;</span><span class="p">,</span> <span class="n">bbox_to_anchor</span><span class="o">=</span><span class="p">(</span><span class="mf">1.01</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">),</span><span class="n">markerscale</span><span class="o">=</span><span class="mf">0.8</span><span class="p">,</span><span class="n">fontsize</span><span class="o">=</span><span class="n">legend_fontsize</span><span class="p">)</span>

        <span class="n">plt</span><span class="o">.</span><span class="n">subplots_adjust</span><span class="p">(</span><span class="n">right</span><span class="o">=</span><span class="n">rspace</span><span class="p">)</span>
        <span class="n">plt</span><span class="o">.</span><span class="n">subplots_adjust</span><span class="p">(</span><span class="n">bottom</span><span class="o">=</span><span class="n">bspace</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">__save_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">header</span><span class="o">=</span><span class="p">[],</span><span class="n">data</span><span class="o">=</span><span class="p">[],</span><span class="n">filename</span><span class="o">=</span><span class="s1">&#39;plot_data.txt&#39;</span><span class="p">):</span>
	<span class="sd">&#39;&#39;&#39;</span>
<span class="sd">		Writes data into a text file. data entries</span>
<span class="sd">		can have different lengths</span>
<span class="sd">	&#39;&#39;&#39;</span>
	<span class="n">out</span><span class="o">=</span><span class="s1">&#39; &#39;</span>
        <span class="c1">#header</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">header</span><span class="p">)):</span>
            <span class="n">out</span><span class="o">+=</span> <span class="p">(</span><span class="s1">&#39;&amp;&#39;</span><span class="o">+</span><span class="n">header</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">+</span><span class="p">((</span><span class="mi">10</span><span class="o">-</span><span class="nb">len</span><span class="p">(</span><span class="n">header</span><span class="p">[</span><span class="n">i</span><span class="p">]))</span><span class="o">*</span><span class="s1">&#39; &#39;</span><span class="p">))</span>
        <span class="c1">#data</span>
	<span class="n">out</span><span class="o">+=</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">&#39;</span>
	<span class="n">max_data</span><span class="o">=</span><span class="p">[]</span>
        <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">)):</span>
		<span class="n">max_data</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">t</span><span class="p">]))</span>
        <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">max</span><span class="p">(</span><span class="n">max_data</span><span class="p">)):</span>
            <span class="c1">#out+=(&#39;&amp;&#39;+&#39;{:.3E}&#39;.format(data[t]))</span>
            <span class="c1">#out+=(&#39; &amp;&#39;+&#39;{:.3E}&#39;.format(frac_yields[t]))</span>
            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">)):</span>
		<span class="k">if</span> <span class="n">t</span><span class="o">&gt;</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">i</span><span class="p">])</span><span class="o">-</span><span class="mi">1</span><span class="p">):</span>
			<span class="n">out</span><span class="o">+=</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="o">*</span><span class="nb">len</span><span class="p">(</span> <span class="s1">&#39; &amp;&#39;</span><span class="o">+</span> <span class="s1">&#39;{:.3E}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="mi">0</span><span class="p">)))</span>
		<span class="k">else</span><span class="p">:</span>
                	<span class="n">out</span><span class="o">+=</span> <span class="p">(</span> <span class="s1">&#39; &amp;&#39;</span><span class="o">+</span> <span class="s1">&#39;{:.3E}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">t</span><span class="p">]))</span>
            <span class="c1">#out+=( &#39; &amp;&#39;+ &#39;{:.3E}&#39;.format(mtot_gas[t]))</span>
            <span class="n">out</span><span class="o">+=</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">&#39;</span>
	<span class="c1">#import os.path</span>
	<span class="c1">#if os.path.isfile(filename) </span>
	<span class="c1">#overwrite existing file for now</span>
	<span class="n">f1</span><span class="o">=</span><span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span><span class="s1">&#39;w&#39;</span><span class="p">)</span>
	<span class="n">f1</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
	<span class="n">f1</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>


<div class="viewcode-block" id="sygma.write_evol_table"><a class="viewcode-back" href="../sygma.html#sygma.sygma.write_evol_table">[docs]</a>    <span class="k">def</span> <span class="nf">write_evol_table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">elements</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;H&#39;</span><span class="p">],</span><span class="n">isotopes</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;H-1&#39;</span><span class="p">],</span><span class="n">table_name</span><span class="o">=</span><span class="s1">&#39;gce_table.txt&#39;</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">,</span><span class="n">interact</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>

        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Writes out evolution of the SSP accummulated ejecta in fraction of total mass of the SSP in the following format</span>
<span class="sd">	(each timestep in a line):</span>

<span class="sd">	&amp;Age       &amp;H-1       &amp;H-2  ....</span>

<span class="sd">	&amp;0.000E+00 &amp;1.000E+00 &amp;7.600E+08 &amp; ...</span>

<span class="sd">	&amp;1.000E+07 &amp;1.000E+00 &amp;7.600E+08 &amp; ...</span>

<span class="sd">	....</span>
<span class="sd">	</span>
<span class="sd">	This method has a notebook and normal version. If you are</span>
<span class="sd">	using a python notebook the function will</span>
<span class="sd">	open a link to a page containing the table.</span>
<span class="sd">	</span>

<span class="sd">        Parameters</span>
<span class="sd">        ----------</span>
<span class="sd">        table_name : string,optional</span>
<span class="sd">          Name of table. If you use a notebook version, setting a name</span>
<span class="sd">	  is not necessary.</span>
<span class="sd">	elements : array</span>
<span class="sd">		Containing the elements with the name scheme &#39;H&#39;,&#39;C&#39;</span>
<span class="sd">	isotopes : array</span>
<span class="sd">		If elements list empty, ignore elements input and use isotopes input; Containing the isotopes with the name scheme &#39;H-1&#39;, &#39;C-12&#39;</span>
<span class="sd">	interact: bool</span>
<span class="sd">		If true, saves file in current directory (notebook dir) and creates HTML link useful in ipython notebook environment</span>

<span class="sd">        Examples</span>
<span class="sd">        ----------</span>

<span class="sd">        &gt;&gt;&gt; s.write_evol_table(elements=[&#39;H&#39;,&#39;C&#39;,&#39;O&#39;],table_name=&#39;testoutput.txt&#39;)</span>

<span class="sd">        &#39;&#39;&#39;</span>
        <span class="k">if</span> <span class="n">path</span> <span class="o">==</span> <span class="s2">&quot;&quot;</span><span class="p">:</span>
            <span class="n">path</span> <span class="o">=</span> <span class="n">global_path</span><span class="o">+</span><span class="s1">&#39;evol_tables/&#39;</span>

        <span class="n">yields_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield</span>
        <span class="n">metal_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">metallicity</span>
        <span class="n">time_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">age</span>
	<span class="n">idx</span><span class="o">=</span><span class="p">[]</span>
	<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">elements</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
		<span class="n">elements_tot</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">elements</span>
		<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">elements_tot</span><span class="p">)):</span>
			<span class="k">if</span> <span class="n">elements_tot</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="ow">in</span> <span class="n">elements</span><span class="p">:</span>
				<span class="n">idx</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">elements_tot</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">elements_tot</span><span class="p">[</span><span class="n">k</span><span class="p">]))</span>
		<span class="n">yields_specie</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_elem_yield</span>
		<span class="n">specie</span><span class="o">=</span><span class="n">elements</span>
	<span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">isotopes</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
                <span class="n">iso_tot</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">isotopes</span>
                <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">iso_tot</span><span class="p">)):</span>
                        <span class="k">if</span> <span class="n">iso_tot</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="ow">in</span> <span class="n">isotopes</span><span class="p">:</span>
                                <span class="n">idx</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">iso_tot</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">iso_tot</span><span class="p">[</span><span class="n">k</span><span class="p">]))</span>
		<span class="n">yields_specie</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">ism_iso_yield</span>	
		<span class="n">specie</span><span class="o">=</span><span class="n">isotopes</span>
		
	<span class="k">else</span><span class="p">:</span>
		<span class="k">print</span> <span class="s1">&#39;Specify either isotopes or elements&#39;</span>
		<span class="k">return</span>
	<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
		<span class="k">print</span> <span class="s1">&#39;Please choose the right isotope names&#39;</span>
		<span class="k">return</span> <span class="mi">0</span>


	<span class="n">frac_yields</span><span class="o">=</span><span class="p">[]</span>
	<span class="k">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">yields_specie</span><span class="p">)):</span>
		<span class="n">frac_yields</span><span class="o">.</span><span class="n">append</span><span class="p">([])</span>
		<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">idx</span><span class="p">)):</span>
			<span class="n">frac_yields</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">yields_specie</span><span class="p">[</span><span class="n">h</span><span class="p">][</span><span class="n">idx</span><span class="p">[</span><span class="n">k</span><span class="p">]])</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">mgal</span><span class="p">)</span>
	
	<span class="n">mtot_gas</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">gas_mass</span>


        <span class="n">metal_evol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">history</span><span class="o">.</span><span class="n">metallicity</span>
	<span class="c1">#header</span>
        <span class="n">out</span><span class="o">=</span><span class="s1">&#39;&amp;Age [yr]  &#39;</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">specie</span><span class="p">)):</span>
            <span class="n">out</span><span class="o">+=</span> <span class="p">(</span><span class="s1">&#39;&amp;&#39;</span><span class="o">+</span><span class="n">specie</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">+</span><span class="p">((</span><span class="mi">10</span><span class="o">-</span><span class="nb">len</span><span class="p">(</span><span class="n">specie</span><span class="p">[</span><span class="n">i</span><span class="p">]))</span><span class="o">*</span><span class="s1">&#39; &#39;</span><span class="p">))</span>
        <span class="n">out</span><span class="o">+=</span><span class="s1">&#39;M_tot </span><span class="se">\n</span><span class="s1">&#39;</span>
	<span class="c1">#data</span>
        <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">frac_yields</span><span class="p">)):</span>
            <span class="n">out</span><span class="o">+=</span><span class="p">(</span><span class="s1">&#39;&amp;&#39;</span><span class="o">+</span><span class="s1">&#39;{:.3E}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">time_evol</span><span class="p">[</span><span class="n">t</span><span class="p">]))</span>
            <span class="c1">#out+=(&#39; &amp;&#39;+&#39;{:.3E}&#39;.format(frac_yields[t]))</span>
            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">specie</span><span class="p">)):</span>
                <span class="n">out</span><span class="o">+=</span> <span class="p">(</span> <span class="s1">&#39; &amp;&#39;</span><span class="o">+</span> <span class="s1">&#39;{:.3E}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">frac_yields</span><span class="p">[</span><span class="n">t</span><span class="p">][</span><span class="n">i</span><span class="p">]))</span>
	    <span class="n">out</span><span class="o">+=</span><span class="p">(</span> <span class="s1">&#39; &amp;&#39;</span><span class="o">+</span> <span class="s1">&#39;{:.3E}&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">mtot_gas</span><span class="p">[</span><span class="n">t</span><span class="p">]))</span>
            <span class="n">out</span><span class="o">+=</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">&#39;</span>
	
	<span class="k">if</span> <span class="n">interact</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
		<span class="kn">import</span> <span class="nn">random</span>
		<span class="n">randnum</span><span class="o">=</span><span class="n">random</span><span class="o">.</span><span class="n">randrange</span><span class="p">(</span><span class="mi">10000</span><span class="p">,</span><span class="mi">99999</span><span class="p">)</span>
		<span class="n">name</span><span class="o">=</span><span class="n">table_name</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">randnum</span><span class="p">)</span><span class="o">+</span><span class="s1">&#39;.txt&#39;</span>
		<span class="c1">#f1=open(global_path+&#39;evol_tables/&#39;+name,&#39;w&#39;)</span>
		<span class="n">f1</span><span class="o">=</span><span class="nb">open</span><span class="p">(</span><span class="n">name</span><span class="p">,</span><span class="s1">&#39;w&#39;</span><span class="p">)</span>
		<span class="n">f1</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
		<span class="n">f1</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
		<span class="k">print</span> <span class="s1">&#39;Created table &#39;</span><span class="o">+</span><span class="n">name</span><span class="o">+</span><span class="s1">&#39;.&#39;</span>
		<span class="k">print</span> <span class="s1">&#39;Download the table using the following link:&#39;</span>
		<span class="c1">#from IPython.display import HTML</span>
		<span class="c1">#from IPython import display</span>
		<span class="kn">from</span> <span class="nn">IPython.core.display</span> <span class="kn">import</span> <span class="n">HTML</span>
		<span class="kn">import</span> <span class="nn">IPython.display</span> <span class="kn">as</span> <span class="nn">display</span>
		<span class="c1">#print help(HTML)</span>
		<span class="c1">#return HTML(&quot;&quot;&quot;&lt;a href=&quot;evol_tables/download.php?file=&quot;&quot;&quot;+name+&quot;&quot;&quot;&quot;&gt;Download&lt;/a&gt;&quot;&quot;&quot;)</span>
		<span class="c1">#test=</span>
		<span class="c1">#return display.FileLink(&#39;../../nugrid/SYGMA/SYGMA_online/SYGMA_dev/evol_table/&#39;+name)</span>
                <span class="c1">#if interact==False:</span>
                <span class="c1">#return HTML(&quot;&quot;&quot;&lt;a href=&quot;&quot;&quot;+global_path+&quot;&quot;&quot;/evol_tables/&quot;&quot;&quot;+name+&quot;&quot;&quot;&gt;Download&lt;/a&gt;&quot;&quot;&quot;)</span>
		<span class="k">return</span> <span class="n">HTML</span><span class="p">(</span><span class="s2">&quot;&quot;&quot;&lt;a href=&quot;&quot;&quot;</span><span class="o">+</span><span class="n">name</span><span class="o">+</span><span class="s2">&quot;&quot;&quot;&gt;Download&lt;/a&gt;&quot;&quot;&quot;</span><span class="p">)</span>
                <span class="c1">#else:</span>
                <span class="c1">#        return name</span>
	<span class="k">else</span><span class="p">:</span>
		<span class="k">print</span> <span class="s1">&#39;file &#39;</span><span class="o">+</span><span class="n">table_name</span><span class="o">+</span><span class="s1">&#39; saved in subdirectory evol_tables.&#39;</span>
		<span class="n">f1</span><span class="o">=</span><span class="nb">open</span><span class="p">(</span><span class="n">path</span><span class="o">+</span><span class="n">table_name</span><span class="p">,</span><span class="s1">&#39;w&#39;</span><span class="p">)</span>
        	<span class="n">f1</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
        	<span class="n">f1</span><span class="o">.</span><span class="n">close</span><span class="p">()</span></div>


    <span class="k">def</span> <span class="nf">__time_to_z</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">time</span><span class="p">,</span><span class="n">Hubble_0</span><span class="p">,</span><span class="n">Omega_lambda</span><span class="p">,</span><span class="n">Omega_m</span><span class="p">):</span>
	<span class="sd">&#39;&#39;&#39;</span>
<span class="sd">	Time to redshift conversion</span>

<span class="sd">	&#39;&#39;&#39;</span>
	<span class="kn">import</span> <span class="nn">time_to_redshift</span> <span class="kn">as</span> <span class="nn">tz</span>
	<span class="c1">#transform into Gyr</span>
	<span class="n">time_new</span><span class="o">=</span><span class="p">[]</span>
	<span class="n">firstidx</span><span class="o">=</span><span class="bp">True</span>
	<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">time</span><span class="p">)):</span>
		<span class="k">if</span> <span class="n">time</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">&gt;=</span><span class="mf">8e8</span><span class="p">:</span>
			<span class="n">time_new</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">time</span><span class="p">[</span><span class="n">k</span><span class="p">]</span><span class="o">/</span><span class="mf">1e9</span><span class="p">)</span>
			<span class="k">if</span> <span class="n">firstidx</span><span class="p">:</span>
				<span class="n">index</span><span class="o">=</span><span class="n">k</span>
				<span class="n">firstidx</span><span class="o">=</span><span class="bp">False</span>	
	<span class="k">return</span> <span class="n">tz</span><span class="o">.</span><span class="n">t_to_z</span><span class="p">(</span><span class="n">time_new</span><span class="p">,</span><span class="n">Hubble_0</span><span class="p">,</span><span class="n">Omega_lambda</span><span class="p">,</span><span class="n">Omega_m</span><span class="p">),</span><span class="n">index</span></div>


</pre></div>

          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">SYGMA DOC v1.0 documentation</a> &raquo;</li>
          <li class="nav-item nav-item-1"><a href="index.html" >Module code</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &copy; Copyright 2014, Christian Ritter.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.5.
    </div>
  </body>
</html>