Is there any handy module to detect emission lines in a spectrum like one we get from the Sloan Digital Sky Survey (SDSS)?

You can see there are many emission lines like Ha,OI in the spectrum below. In fact the spectrum is a two column data set, wavelength and flux. It is a combination of lots of scatter points. The typical interval between two points nearyby is 1.5 angstroms. I need to find all the Gaussian bumps and their line center.

So,first I need to find the the bumps and then I need to fit them to get their centers.

enter image description here

  • 1
    $\begingroup$ I could probably give you a detailed answer if you tell me what you want to do with the spectrum. Rigorous spectrum analysis is not usually a trivial affair. $\endgroup$
    – Moriarty
    Commented Oct 22, 2013 at 3:21
  • $\begingroup$ I have updated my post.Maybe it is easy to understand now. $\endgroup$ Commented Oct 22, 2013 at 8:29

3 Answers 3


The programs I am aware of that you could use do require some programming expertise to operate. I would recommend looking at either IRAF (or PyRAF, which uses Python to interface with IRAF), or SPECTRE. Unfortunately, I'm not aware of a "black box" solution where you can just press a button and go.

SPECTRE is written in FORTRAN77 and is quite easy to use once you get the hang of it, though it has a somewhat limited feature set and the documentation is brief. It will help you to manually fit Gaussians to spectral lines, giving their central wavelengths and equivalent widths. A caveat for SPECTRE is that it requires the plotting package SuperMongo, which is not free software. If you are affiliated with a university, most Physics and Astronomy departments should have a license.

IRAF is a quite fully-featured, free, cross-platform application purposefully built for astronomical image analysis. It can help you measure the spectral lines, and can analyse the spectrum to determine the object's radial velocity.

  • $\begingroup$ how about writing our own python code to do it?All we have to do is analyse lots of wavlength-flux data sets from lots of spectra. $\endgroup$ Commented Oct 22, 2013 at 10:09
  • $\begingroup$ Go for it. Often it's easiest to write your own code, especially if you have large data sets to crunch through. $\endgroup$
    – Moriarty
    Commented Oct 22, 2013 at 11:03
  • $\begingroup$ First find a local maximum and then fit it with a Gaussian profile. This method is too easy to believe. Anything I miss? $\endgroup$ Commented Oct 22, 2013 at 12:12
  • 1
    $\begingroup$ Yep, that's just about it. If you want to find local maxima computationally, applying some median smoothing (depending on noise levels) and then using its derivatives can work well. This piece of code does just that (I don't think it would work well for what you want as-is, though it will serve as a working example of what you might want to do). adsabs.harvard.edu/abs/2007A%26A...469..783S $\endgroup$
    – Moriarty
    Commented Oct 22, 2013 at 21:55

Yes, there is are two python modules called astropy, and astropysics that both claim to have spectral analysis tools. As a reference, here is a link for resources for astronomers for the python programming language.


There are plenty of software and tools available to do what you want:

  • IRAF, by NOAO;
  • MIDAS which is basically very similar to IRAF but developed by ESO;
  • in Python, either astropy or pyRAF (to use IRAF with a Python interface).

I would go with some Python tools (Python is more versatile than IRAF or MIDAS that are much more "single-purpose" oriented), to benefit from the other features offered by Python.

But to plot and process your spectrum is just the first part of the work, what you would probably want to do in the end is to use spectral synthesis, to analyze your spectrum. Spectral synthesis will allow you:

  • to identify efficiently the chemical composition of the celestrial object you study;
  • to determine some properties of the celestial object you study.

Among the existing tools for spectral synthesis (for stellar spectra for example), there are:

  • $\begingroup$ Thanks. I just want to know the positions of line center. $\endgroup$ Commented Oct 22, 2013 at 14:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .