The STELLAB module (which is a contraction for Stellar Abundances) enables to plot observational data for comparison with galactic chemical evolution (GCE) predictions. The abundance ratios are presented in the following spectroscopic notation :
The following sections describe how to use the code.
In [1]:
# Import the needed packages
import matplotlib
import matplotlib.pyplot as plt
In [2]:
# Import the observational data module
import stellab
In [3]:
import sys
# Trigger interactive or non-interactive depending on command line argument
__RUNIPY__ = sys.argv[0]
if __RUNIPY__:
%matplotlib inline
else:
%pylab nbagg
In order to plot observed stellar abundances, you just need to enter the wanted ratios with the xaxis and yaxis parameters. Stellab has been coded in a way that any abundance ratio can be plotted (see Appendix A below), as long as the considered data sets contain the elements. In this example, we consider the Milky Way.
In [4]:
# Create an instance of Stellab
s = stellab.stellab()
In [5]:
# Plot observational data (you can try all the ratios you want)
s.plot_spectro(xaxis='[Fe/H]', yaxis='[Eu/Fe]')
plt.xlim(-4.5,0.75)
plt.ylim(-1.6,1.6)
Out[5]:
By default, the solar normalization $\log(n_A/n_B)_\odot$ is taken from the reference paper that provide the data set. But every data point can be re-normalized to any other solar values (see Appendix B), using the norm parameter. This is highly recommended, since the original data points may not have the same solar normalization.
In [6]:
# First, you can see the list of the available solar abundances
s.list_solar_norm()
Here is an example of how the observational data can be re-normalized.
In [7]:
# Plot using the default solar normalization of each data set
s.plot_spectro(xaxis='[Fe/H]', yaxis='[Ca/Fe]')
plt.xlim(-4.5,0.75)
plt.ylim(-1.4,1.6)
Out[7]:
In [8]:
# Plot using the same solar normalization for all data sets
s.plot_spectro(xaxis='[Fe/H]', yaxis='[Ca/Fe]',norm='Asplund_et_al_2009')
plt.xlim(-4.5,0.75)
plt.ylim(-1.4,1.6)
Out[8]:
You can select a subset of the observational data implemented in Stellab.
In [9]:
# First, you can see the list of the available reference papers
s.list_ref_papers()
In [10]:
# Create a list of reference papers
obs = ['stellab_data/milky_way_data/Jacobson_et_al_2015_stellab',\
'stellab_data/milky_way_data/Venn_et_al_2004_stellab',\
'stellab_data/milky_way_data/Yong_et_al_2013_stellab',\
'stellab_data/milky_way_data/Bensby_et_al_2014_stellab']
# Plot data using your selection of data points
s.plot_spectro(xaxis='[Fe/H]', yaxis='[Ca/Fe]', norm='Asplund_et_al_2009', obs=obs)
plt.xlim(-4.5,0.7)
plt.ylim(-1.4,1.6)
Out[10]:
The Milky Way (milky_way) is the default galaxy. But you can select another galaxy among Sculptor, Fornax, and Carina (use lower case letters).
In [11]:
# Plot data using a specific galaxy
s.plot_spectro(xaxis='[Fe/H]', yaxis='[Si/Fe]',norm='Asplund_et_al_2009', galaxy='fornax')
plt.xlim(-4.5,0.75)
plt.ylim(-1.4,1.4)
Out[11]:
It is possible to plot error bars with the show_err parameter, and print the mean errors with the show_mean_err parameter.
In [12]:
# Plot error bars for a specific galaxy
s.plot_spectro(xaxis='[Fe/H]',yaxis='[Ti/Fe]',\
norm='Asplund_et_al_2009', galaxy='sculptor', show_err=True, show_mean_err=True)
plt.xlim(-4.5,0.75)
plt.ylim(-1.4,1.4)
Out[12]:
Let's consider that a data set provides stellar abundances in the form of [X/Y], where Y is the reference element (often H or Fe) and X represents any element. It is possible to change the reference element by using simple substractions and additions.
Let's say we want [Ca/Mg] from [Ca/Fe] and [Mg/Fe].
Let's say we want [Mg/H] from [Fe/H] and [Mg/Fe].
In [13]:
# Everything should be on a horizontal line
s.plot_spectro(xaxis='[Mg/H]', yaxis='[Ti/Ti]')
plt.xlim(-1,1)
plt.ylim(-1,1)
Out[13]:
In [14]:
# Everything should be on a vertical line
s.plot_spectro(xaxis='[Mg/Mg]', yaxis='[Ti/Mg]')
plt.xlim(-1,1)
plt.ylim(-1,1)
Out[14]:
In [15]:
# Everything should be at zero
s.plot_spectro(xaxis='[Mg/Mg]', yaxis='[Ti/Ti]')
plt.xlim(-1,1)
plt.ylim(-1,1)
Out[15]:
Changing the solar normalization is a very straightforward operation.
In these two last equations, paper refers to the reference paper that provides the data set, and re-norm refers to the new solar abundances you want for your re-normalization.