Specreduce Documentation

The specreduce package aims to provide a data reduction toolkit for optical and infrared spectroscopy, on which applications such as pipeline processes for specific instruments can be built. The scope of its functionality is limited to basic spectroscopic reduction, currently encompassing the following three tasks:

  1. Determining the trace of a spectrum dispersed in a 2D image, either by setting a flat trace, providing a custom trace array, or fitting a spline, polynomial, or other model to the positions of the dispersed spectrum.

  2. Generating a background based on a region on one or both sides of this trace, and making available the background image, 1D spectrum of the background, and the background-subtracted image.

  3. Performing either a Horne (a.k.a. “optimal”) or boxcar extraction on either the original or background-subtracted 2D spectrum, using the trace generated by the first task to generate a 1D spectrum.

Further details about these capabilities are detailed in the sections linked below. Beyond these tasks, basic image processing steps (such as bias subtraction) are covered by ccdproc and other packages, data analysis by specutils, and visualization by matplotlib. A few examples will be provided that feature specreduce in conjunction with these complementary packages.


Specreduce is currently an incomplete work-in-progress and is liable to change. Please feel free to contribute code and suggestions through github.

Spectral Extraction



Development Docs