This page describes the optical version of the code. To see the ultraviolet version (HII-CHI-mistry-UV) click here.


HII-CHI-mistry is a python program that calculates for gaseous nebulae ionized by massive stars the oxygen abundance in terms of 12+log(O/H), the nitrogen-to-oxygen ratio as log(N/O) and the ionisation parameter as log U from a set of emission-line optical intensities, consistently with the direct method. The methodology and the results are described in Pérez-Montero (2014, MNRAS, 441, 2663).


Each compressed tar.gz file contains the python file of the code, the libraries of the models and a file with instructions

- Version 3.0 (2017/09).
The errors of the input intensity lines are now considered in the calculation of the errors of the derived abundances and log U. To do so an iterative Monte-Carlo simulation is performed in the script. In addition, in the interpolated grid of models, this grid is only used once a first estimation of the results is obtained to reduce the time of calculation.

- Version 2.2 (2017/02)
    (In order to avoid some divergences in the calculation of O/H, it enhances in the interpolated mode the parameter defined to fix the number of  constrained models once calculated N/O).

-ersion 2.0 (2016/01)
        (This version uses the library numpy, so asciidata is not anymore required. the results are now stored in an independent ascii file. Finally this version lets the user to choose a model grid of better resolution in O/H and N/O to smooth results around the knots of the model grid. In addition, the program  uses all the models for the weighted means of the results, not just a subset of them as in previous versions.)

- Version 1.2 (2015/08)
    (It fixes a bug for observational sets with [OIII[ 4363 but without [NII] 6584 for N/O and it expands the metallicity range from 12+log(O/H) = 6.9).

- Version 1.0 (2014/04)


HII-CHI-mistry has been written in python. It requires the library numpy (versions previous to v2.0 use the library asciidata). It also needs the files of the relative emission line intensities predicted by the models, assuming a different set of input conditions, including:


In version 2.0 and later the distribution also has the files with the linear interpolations of the grid in O/H and N/O. These files have the same name with and additional "int" at the end.


These files represent the whole set of models, limiting the values of log U at each Z (left picture), and limiting also the values of N/O, respectively (right picture).
All were calculated with Cloudy v.13 and a POPSTAR SED at an age of 1Myr with an IMF of Chabrier.

To run the program, just type (for v3.0, in other versions use the name of thecorresponding  python script ):

> python HCm_v3.0.py

For version 2.0 and later the program will ask about what sets of models must be used (0: non-interpolated, 1:interpolated) and then will ask you about your input file


It must be written in text format with five columns containing in each row the following information about a gaseous nebula or a postion of it:

[OII] 3727/Hbeta
[OIII] 4363/Hbeta
[OIII] 5007/Hbeta
[NII] 6584/Hbeta
[SII] 6717+6731/Hbeta

all of them reddening corrected. If no information exists about a certain line it must typed as zero.
In version 3.0 the file must have ten columns, including the associated errors. If no error is considered these columns must be typed as zero.


If the input file is correctly introduced, the program will calculate the wanted quantities and their corresponding errors.
The information will be displayed in the screen for each object, along with the ratio of completeness of the task. It will be also added an index saying
what grid was used, where

1: the complete grid is used (only if [OIII] 4363 > 0)
2: the log U limited grid is used (when [OIII] 4363 = 0)
3: the log U and N/O limited grid is used
(if, besides, [NII]/[OII] and [NII]/[SII] cannot be obtained).

In addition in version 2.0 and later it will create a file called output.dat with the columnas of the input emission lines and seven new columns will be added to the input file  with the
following information:

grid index
error of 12+log(O/H)
log(N/O) (-10 if grid 3 is used)
error of log(N/O)
log U
error of log(U) (take with care if grid 2 or 3 are used)

Enrique Pérez-Montero. IAA-CSIC
Last update: 201
7, September

This program has been made thanks to the financial support from the Spanish AYA project Estallidos