'Spectrum': Spectral Analysis in Python

Thomas Cokelaer, Juergen Hasch

► To cite this version:

Thomas Cokelaer, Juergen Hasch. 'Spectrum': Spectral Analysis in Python. Journal of Open Source Software, 2017, 2 (18), pp.348. 10.21105/joss.00348. pasteur-03111917

HAL Id: pasteur-03111917

https://pasteur.hal.science/pasteur-03111917

Submitted on 15 Jan 2021

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
'Spectrum': Spectral Analysis in Python

Thomas Cokelaer¹ and Juergen Hasch²

1 Institut Pasteur - Bioinformatics and Biostatistics Hub - C3BI, USR 3756 IP CNRS - Paris, France

2 Robert Bosch GmbH: Renningen, Baden-Württemberg, Germany

DOI: 10.21105/joss.00348

Software

* Review ⚗

* Repository ⚗

* Archive ⚗

Licence

Authors of JOSS papers retain
copyright and release the work un-
der a Creative Commons Attri-
bution 4.0 International License
(CC-BY).

Summary

**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.

References

Harris, F. J. 1978. "On the Use of Windows for Harmonic Analysis with the Discrete Fourier transform." *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: Prent-
<figure><img src="image_2.png" /><figcaption>Figure 1: https://doi.org/10.6084/m9 figshare.5270866.v1</figcaption></figure>

tice 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.