Spectral Typing Tool - sptool

What is "sptool"?

In order to accurately determine the spectral type of an unknown star, it is necessary to be able to visually compare features of the unknown type to spectral standards. However, no tool that I found allows the spectral classifier to easily compare the unknown type to a set of standards So I have written a tool to use a normalized grid of standards that allows you to visually compare the unknown type to any standard you have and to 'flip through' the standards by simply pressing a key.

Sptool software was developed in support of NSF award AST-1008908.

sptool screenshot 0

sptool screenshot 1

sptool screenshot 2

sptool screenshot 3

If you use sptool for your research, please acknowledge this website and cite the paper Pecaut, Mamajek, & Bubar (2012, The Astrophysical Journal, 746, 154).


This is written in poorly coded python and it requires

if you can import scipy, numpy, pylab and pyfits you should be fine:

          $> python
          Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) 
          [GCC 4.3.3] on linux2
          Type "help", "copyright", "credits" or "license" for more information.
          >>> import numpy
          >>> import scipy
          >>> import matplotlib
          >>> import pyfits

Download and Configuration

The actual program can be downloaded here: sptool.py

Be sure to put it someplace executable if you are on unix and also make it executable:

          $ chmod 755 sptool.py

You will need to edit the file (sptool.py) and put the path to your grid of standards. The standards MUST be named like this:


These files should be your spectral standards obtained with the same instrument as your program spectra. If you have gaps in your standards, I would recommend using spectra from the following projects:

Please note that some "standard stars" have changed classifications over the years and in general it is best to scrutinize the classification history of each standard star before you adopt it as a standard in your own classifications. See Stellar Spectral Classification by Gray & Corbally - Appendix A contains a modern grid of spectral standards. Also useful is Eric Mamajek's Notes on Spectral Standards.

The luminosity classes it recognizes are

'IA', 'IAB', 'III', 'III-IV', 'IV', 'IV-V', 'V'

Note that this means you cannot use odd luminosity classes like 'Ve' or 'V/IV' or whatever without first modifying the code. If you don't like these luminosity classes please feel free to edit the code - it is under a BSD-style license.

To Use

          sptool.py --sptype F1 file_to_classify.fits

or alternatively:

          sptool.py -sF1 file_to_classify.fits

the sptype flag and the file_to_classify.fits are required

To move around the grid of standards, the keys are:

Page UpPage Downmove in spectral type space
+-move in luminosity class space
updownshift the object spectrum up or down
<>shifts the spectrum left or right
()separate/converge the spectral standards
qquits without saving
wsaves the spectral type to the output file and quits

Bugs and Comments

There is a matplotlib bug where it won't let you zoom/pan after you have pressed a number key. This is a matplotlib bug and it may affect your ability to remap the keys to use the number pad. In general, I am not happy with the choice of keys to perform the tasks but I had to avoid certain keys because they are already being used by matplotlib (for example, 'g' toggles the grid). There are probably more bugs so if you find any or make any improvements or changes let me know and I'll fix it.

Other Tools

There are other tools that may be helpful in determining spectral types. Some of the more obvious ones are:

They all have different features and uses than sptool so if sptool isn't doing what you want, you may want to try these tools.