Analysis of emission and absorption spectra of chemical substances