SPECTRUM : Spectral Analysis in Python
- contributions:
Please join https://github.com/cokelaer/spectrum
- contributors:
- issues:
Please use https://github.com/cokelaer/spectrum/issues
- documentation:
- Citation:
Cokelaer et al, (2017), ‘Spectrum’: Spectral Analysis in Python, Journal of Open Source Software, 2(18), 348, doi:10.21105/joss.00348
Overview
Spectrum contains tools to estimate Power Spectral Densities using methods based on Fourier transform, parametric methods or eigenvalues analysis:
Fourier-based methods: correlogram, periodogram and Welch estimates. Standard tapering windows (Hann, Hamming, Blackman) and more exotic ones are available (DPSS, Taylor, …).
Parametric methods: Yule-Walker, BURG, MA and ARMA, covariance and modified covariance methods.
Non-parametric (eigenanalysis) methods: MUSIC and minimum variance analysis.
Multitapering (MTM).
The targeted audience is diverse. 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), to music (pattern detection) or biology (mass spectroscopy).
Quick Start
The example below creates a cosine signal buried in white noise and estimates its power spectral density using a simple periodogram:
from spectrum import Periodogram, data_cosine
# generate a 1024-sample cosine at 200 Hz (amplitude 0.1) buried in white noise
data = data_cosine(N=1024, A=0.1, sampling=1024, freq=200)
# create the periodogram object and plot
p = Periodogram(data, sampling=1024)
p.plot(marker='o')
All PSD classes share the same interface: instantiate the object, run the estimation (or let it run lazily on first access), then call p.plot(). The functional API is also available for all methods when a quick result is needed without a full object.
See the documentation for a complete tutorial, API reference and gallery of examples.
Installation
spectrum is available on PyPI:
pip install spectrum
and on conda-forge:
conda install -c conda-forge spectrum
To install conda itself, see https://docs.conda.io/en/latest/miniconda.html.
Contributions
Please see GitHub for any issues, bugs, comments or contributions.
Changelog (summary)
release |
description |
|---|---|
0.10.0 |
|
0.9.0 |
|
0.8.1 |
|
Some notebooks (external contributions)
Metadata
Release files for spectrum 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| spectrum-0.10.0.tar.gz | 233.4 kB | Without provenance | Details |
Release files / spectrum-0.10.0.tar.gz
| Download URL | spectrum-0.10.0.tar.gz |
|---|---|
| Size | 233.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8203c2a06004bef60d4dc9c92d4f5c252ccf41b1cfe372ef2e61f01fbfb91c0a
|
|
BLAKE2b-256 checksum How to use checksums |
023c95180c5969c8ac658e0e66bc6b4de682764e3a8aa1cb499e1a576ce5ebac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.14
|
Security for spectrum 0.10.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.