Fast easy-to-use multitaper spectrogram and spectrum calculation with Python
Project description
pymultitaper
pymultitaper is a fast and easy-to-use small package for multitaper spectrogram/spectrum calculation, as well as oridnary (single-taper) spectrogram calculation.
Installation
Install via pip:
pip install pymultitaper
GPU computation is supported in a pre-release version. To install the GPU-enabled version, use:
pip install --pre pymultitaper
GPU support requires CuPy. For installation instructions, see the CuPy documentation.
Note: Cupy is an optional dependency. If you do not have CuPy installed, pymultitaper will still work using the CPU backend.
Usage
>>> from pymultitaper import multitaper_spectrogram, plot_spectrogram
>>> from scipy.io import wavfile
>>> fs, data = wavfile.read('test.wav')
>>> freqs,times,psd = multitaper_spectrogram(
... data, fs,time_step=0.001,window_length=0.005,NW=4
... )
>>> fig,ax = plot_spectrogram(times,freqs,psd,cmap="viridis")
GPU Support
GPU usage is automatic: if you pass a CuPy array into the spectrogram functions, pymultitaper will use the GPU backend. NumPy arrays still use the CPU backend.
>>> import cupy as cp
>>> from pymultitaper import multitaper_spectrogram
>>> from scipy.io import wavfile
>>> fs, data = wavfile.read("test.wav")
>>> data_gpu = cp.asarray(data)
>>> freqs, times, psd = multitaper_spectrogram(
... data_gpu, fs, time_step=0.001, window_length=0.005, NW=4
... )
>>> psd.shape
(len(freqs), len(times))
The returned arrays stay on the GPU until you explicitly move them back to NumPy, for example with cp.asnumpy(...), before plotting.
Documentation
Refer to pymultitaper documentation for more details.
Examples
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pymultitaper-2.0.0rc1.tar.gz.
File metadata
- Download URL: pymultitaper-2.0.0rc1.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c5bd52da55b15569333f6e5fa19748c91afda7cb977f8ae5e1814ccd407e5af
|
|
| MD5 |
36d95e5171df6fe29d23ae5ce6b6d8ae
|
|
| BLAKE2b-256 |
e63d770fd5f6935a94f23344359682e7773287bd93049a2ab37f9d08ab62dec8
|
File details
Details for the file pymultitaper-2.0.0rc1-py3-none-any.whl.
File metadata
- Download URL: pymultitaper-2.0.0rc1-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff7b9ec4de22fb7c849edbe1a17506d611b8293d942bb5f0a6ae997b99ebd1a1
|
|
| MD5 |
bb5d73350ae2802086a7699525ca1e7d
|
|
| BLAKE2b-256 |
e42f50992589787ac8eea46429669677212c8e99a2e1357f053103161163c785
|