Logo HCm


Back to main page


HII-CHI-mistry is a python program that calculates, for gaseous nebulae ionized by massive stars or active galactic nuclei, 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


HII-CHI-mistry has been written in python v. 2.7, but from version 4.1 it is also compatible with python 3. 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:


OH vs U relation       OH vs NO

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.17 and a POPSTAR SED at an age of 1Myr with an IMF of Chabrier.

For calculations for the NLR in AGNs it is also included those files from models calculated using a double composite power-law with parameter alpha(UV) = -1.0 and alpha(OX) = -0.8. Additional versions of the code are calculated using an alpha(ox) = -1.2.
Notice that in the case of AGN no constrained version for log U is supplied.

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

> python HCm_v5.0.py

Once the input file has been specified in the prompt or by direct question, the code will ask about what SED of models is going to be used: (1) Young POPSTAR massive cluster, (2) BPASS cluster models atmospheres with binaries, (3) double composite power-law AGN with alpha = -0.8 or (4) alpha = -1.2. Then, the program will ask about the use of a interpolated high-resolution grid : (0) non-interpolated or (1) interpolated. This will enhance the resolution of the grid in O/H, N/O, and log U in a factor 10, but it will decrease the speed of calculation.


It must be written in text format with a first row with the labels for the different columns, corresponding to the identification of each row and those containing the emission line fluxes and their errors relative to Hbeta. the following labels can be read by the code:

["ID" ! for the identification name of the row
"OII_3727" and "eOII_3727" for [OII] 3727/Hbeta with its error
"NeIII_3868" and "eNeIII_3868" for [NeIII] 3868/Hbeta with its error
"OIII_4363" and "eOIII_4363" for [OIII] 4363/Hbeta with its error
"OIII_4959" and "eOIII_4959" for [OIII] 4959/Hbeta with its error
"OIII_5007" and "eOIII_5007" for [OIII] 5007/Hbeta with its error. It is possible to give only one of the two strong [OIII] nebular lines.
"NII_6584" and "eNII_6584" for [NII] 6584/Hbeta with its error
"SII_6725" and "eSII_6725" for [SII] 6717+6731/Hbeta with its error
all of them reddening corrected. If no information exists about a certain line it must typed as zero.


If the input file is correctly introduced, the program will ask for the chosen SED and the use of interpolations and it 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, it will create a file called using the name of the input file + "_hcm-output.dat" with the information about the used models, the identification of each row, the columns 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: 2020, November

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