PyEMILI (Tu, Fang et al. 2025) is a Python-based tool primarily designed to assist with the automated identification of spectral lines, especially for emission-line objects such as planetary nebulae (PNe), H II regions, and Herbig–Haro (HH) objects, etc. Compared to manual line identifications in the literature, PyEMILI achieves approximately 90% agreement. The current version of PyEMILI offers the following features:
- Automated Emission Line Identification: Identify emission lines in various astronomical objects.
- Automated Absorption Line Identification: Identify absorption lines in stellar spectra.
- Automatic 1D Spectrum Processing:
- Continuum Fitting: Automatically fit the continuum of the 1D spectrum.
- Line Detection: Find lines in the spectrum. An interactive interface is available for manually reviewing, adding, or revising spectral lines.
- Recombination Lines Fitting: Fit the electron temperature, electron density, and ionic abundance using a set of recombination lines.
Note
PyEMILI uses the Atomic Line List v3.00b4 developed by Peter A. M. Van Hoof, covering wavelengths from 1000–20000 Å. Molecular transitions are not included in the current version.
To run PyEMILI, you will need:
- Python3 compiler
- Python Packages: numpy, scipy, matplotlib, astropy, pandas, and numba
Ensure that the versions of numba and numpy are compatible to avoid potential errors, such as ImportError: Numba needs NumPy 1.** or less. It is recommended to use the latest versions of these packages.
You can install PyEMILI by downloading the source code:
In the root directory which contains the setup.py file, run:
pip install .Directly install using pip:
pip install pyemiliDetailed usage instructions and examples can be found in the Manual, including descriptions of output files and additional parameter configurations. Examples in test directory include results for three samples, IC 418 (PN), Hf 2-2 (PN), and J0608 ([WC11] star).
In general, you need a text file containing at least the wavelengths and fluxes of the unidentified lines. If you need to use the automatic line searching function in PyEMILI, and generate a line list to be identified, refer to Line_finding.
from pyemili.Lines import Line_list
import numpy as np
# Load the line list
hf22 = np.loadtxt('Hf2-2_linelist.txt',skiprows=1)
hf22_output = Line_list(wavelength=hf22[:,0], # array of wavelengths
wavelength_error=10, # set a uniform wavelength uncertainty of 10 km/s
flux=hf22[:,1]) # array of fluxes
# run the line identification process, set the output filename as 'Hf2-2',
# and use the preset nebular elemental abundance
hf22_output.identify('Hf2-2',abun_type='nebula')After running pyemili.Lines.Line_list.identify(), two files ending with '.dat' and '.out' will be generated in the directory. The '.out' file contains complete candidate IDs of each input observed line, and '.dat' file contains primarily the A ranking candidate IDs for each line. More information can be found here.
If you encounter any issues with PyEMILI, e.g., installation problems, usage problems, or questions on line identification accuracy, please feel free to reach out to us.
Contact:
- Email: [email protected]
Alternatively, please open an issue on the GitHub repository, where we’ll be happy to assist.