Monte Carlo Method for Calculating Oxygen Abundances and Their
  Uncertainties from Strong-Line Flux Measurements
  We present the open-source Python code pyMCZ that determines oxygen abundance
and its distribution from strong emission lines in the standard metallicity
calibrators, based on the original IDL code of Kewley & Dopita (2002) with
updates from Kewley & Ellison (2008), and expanded to include more recently
developed calibrators. The standard strong-line diagnostics have been used to
estimate the oxygen abundance in the interstellar medium through various
emission line ratios in many areas of astrophysics, including galaxy evolution
and supernova host galaxy studies. We introduce a Python implementation of
these methods that, through Monte Carlo sampling, better characterizes the
statistical oxygen abundance confidence region including the effect due to the
propagation of observational uncertainties. These uncertainties are likely to
dominate the error budget in the case of distant galaxies, hosts of cosmic
explosions. Given line flux measurements and their uncertainties, our code
produces synthetic distributions for the oxygen abundance in up to 15
metallicity calibrators simultaneously, as well as for E(B-V), and estimates
their median values and their 68% confidence regions. We test our code on
emission line measurements from a sample of nearby supernova host galaxies (z <
0.15) and compare our metallicity results with those from previous methods. Our
metallicity estimates are consistent with previous methods but yield smaller
statistical uncertainties. Systematic uncertainties are not taken into account.
We offer visualization tools to assess the spread of the oxygen abundance in
the different calibrators, as well as the shape of the estimated oxygen
abundance distribution in each calibrator, and develop robust metrics for
determining the appropriate Monte Carlo sample size. The code is open access
and open source and can be found at https://github.com/nyusngroup/pyMCZ
(Abridged)
