'Spectrum': Spectral Analysis in Python


Spectrum is a Python library that includes tools to estimate Power Spectral Densities. Although the use of power spectrum of a signal is fundamental in electrical engineering (e.g. radio communications, radar), it has a wide range of applications from cosmology (e.g., detection of gravitational waves in 2016), to music (pattern detection) or biology (mass spectroscopy).

Methods available are based on Fourier transform, parametric methods or eigenvalues analysis. Although standard methods such as periodogram are available, less common methods (e.g. multitapering) are also implemented:

  • The Fourier methods are based upon correlogram, periodogram and Welch estimates. Standard tapering windows (Hann, Hamming, Blackman) and more exotic ones are available (DPSS, Taylor, ...)(Harris 1978; Welch 1967; Marple 1987).
  • The parametric methods are based on Yule-Walker, BURG, MA and ARMA, covariance and modified covariance methods (Marple 1987; Percival and Walden 1993).
  • Non-parametric methods based on eigen analysis (e.g., MUSIC) and minimum variance analysis are also implemented (Marple 1987).
  • Multitapering method is also available (Percival and Walden 1993)
  • Classical tools useful to spectral analysis and more generally signal processing such as window tapering (Harris 1978) or transfer function are also available within the library.

The following image shows the different methods of spectral estimation that are available in Spectrum.



Spectrum relies on Matplotlib (Hunter 2007) for the plotting. We also use Numpy (Stéfan van der Walt and Varoquaux 2011) for fast array manipulation and Scipy (Jones et al. 2001–2001--) for linear algebra.


Harris, F. J. 1978. “On the Use of Windows for Harmonic Analysis with the Discrete Fouriertransform.” Proceedings of the IEEE 66 (1). IEEE: 51–83. doi:10.1109/PROC.1978.10837.

Hunter, John D. 2007. “Matplotlib: A 2d Graphics Environment.” Computing in Science & Engineering 9: 90–95. doi:DOI:10.1109/MCSE.2007.55.

Jones, Eric, Travis Oliphant, Pearu Peterson, and others. 2001–2001--. “SciPy: Open Source Scientific Tools for Python.” http://www.scipy.org/.

Marple, S. L. 1987. Digital Spectral Analysis with Applications. Australia, Sydney: Prentice Hall.

Percival, Donald B, and Andrew T Walden. 1993. Spectral Analysis for Physical Applications: Multitaper and Conventional Univariate Techniques. cambridge university press.

Stéfan van der Walt, S. Chris Colbert, and Gaël Varoquaux. 2011. “"The Numpy Array: A Structure for Efficient Numerical Computation.” Computing in Science & Engineering 13: 22–30. doi:DOI:10.1109/MCSE.2011.37.

Welch, P. 1967. “The Use of Fast Fourier Transform for the Estimation of Power Spectra: A Method Based on Time Averaging over Short, Modified Periodograms.” IEEE Transactions on Audio and Electroacoustics 15 (2): 70–73.