  Analysis of emission lines in gaseous nebulae yields direct measures of
physical conditions and chemical abundances and is the cornerstone of nebular
astrophysics. Although the physical problem is conceptually simple, its
practical complexity can be overwhelming since the amount of data to be
analyzed steadily increases; furthermore, results depend crucially on the input
atomic data, whose determination also improves each year. To address these
challenges we created PyNeb, an innovative code for analyzing emission lines.
PyNeb computes physical conditions and ionic and elemental abundances, and
produces both theoretical and observational diagnostic plots. It is designed to
be portable, modular, and largely customizable in aspects such as the atomic
data used, the format of the observational data to be analyzed, and the
graphical output. It gives full access to the intermediate quantities of the
calculation, making it possible to write scripts tailored to the specific type
of analysis one wants to carry out. In the case of collisionally excited lines,
PyNeb works by solving the equilibrium equations for an n-level atom; in the
case of recombination lines, it works by interpolation in emissivity tables.
The code offers a choice of extinction laws and ionization correction factors,
which can be complemented by user-provided recipes. It is entirely written in
the python programming language and uses standard python libraries. It is fully
vectorized, making it apt for analyzing huge amounts of data. The code is
stable and has been benchmarked against IRAF/NEBULAR. It is public, fully
documented, and has already been satisfactorily used in a number of published
papers.
