Monte Carlo method for calculating oxygen abundances and their uncertainties from strong-line flux measurements

F. B. Bianco, M. Modjaz, S. M. Oh, D. Fierroz, Y. Q. Liu, L. Kewley, O. Graur

    Research output: Contribution to journalArticlepeer-review


    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 and Dopita (2002) with updates from Kewley and 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 (referred to as indicators) 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 provide the option of outputting the full Monte Carlo distributions, and their Kernel Density estimates. 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. We show that our metallicity estimates are consistent with previous methods but yield smaller statistical uncertainties. It should be noted that systematic uncertainties are not taken into account. We also 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

    Original languageEnglish (US)
    Pages (from-to)54-66
    Number of pages13
    JournalAstronomy and Computing
    StatePublished - Jul 1 2016


    • Abundances-ISM
    • Galaxy
    • General
    • HII regions-supernovae

    ASJC Scopus subject areas

    • Astronomy and Astrophysics
    • Computer Science Applications
    • Space and Planetary Science


    Dive into the research topics of 'Monte Carlo method for calculating oxygen abundances and their uncertainties from strong-line flux measurements'. Together they form a unique fingerprint.

    Cite this