Time-frequency analysis through Stockwell transform
Project description
Stockwell
Python package for time-frequency analysis through Stockwell transform.
Based on original code from NIMH MEG Core Facility.
Installation
Using Anaconda
If you use Anaconda, the latest release of Stockwell is available via conda-forge.
To install, simply run:
conda install -c conda-forge stockwell
Using pip and PyPI
The latest release of Stockwell is available on the Python Package Index.
You can install it easily through pip
:
pip install stockwell
Installation from source
If no precompiled package is available for you architecture on PyPI, or if you want to work on the source code, you will need to compile this package from source.
To obtain the source code, download the latest release from the releases page, or clone the GitHub project.
C compiler
Part of Stockwell is written in C, so you will need a C compiler.
On Linux (Debian or Ubuntu), install the build-essential
package:
sudo apt install build-essential
On macOS, install the XCode Command Line Tools:
xcode-select --install
On Windows, install the Microsoft C++ Build Tools.
FFTW
To compile Stockwell, you will need to have FFTW installed.
On Linux and macOS, you can download and compile FFTW from source using
the script get_fftw3.sh
provided in the scripts
directory:
./scripts/get_fftw3.sh
Alternatively, you can install FFTW using your package manager:
-
If you use Anaconda (Linux, macOS, Windows):
conda install fftw
-
If you use Homebrew (macOS)
brew install fftw
-
If you use
apt
(Debian or Ubuntu)sudo apt install libfftw3-dev
Install the Python package from source
Finally, install this Python package using pip:
pip install .
Or, alternatively, in "editable" mode:
pip install -e .
Usage
Example usage:
import numpy as np
from scipy.signal import chirp
import matplotlib.pyplot as plt
from stockwell import st
t = np.linspace(0, 10, 5001)
w = chirp(t, f0=12.5, f1=2.5, t1=10, method='linear')
fmin = 0 # Hz
fmax = 25 # Hz
df = 1./(t[-1]-t[0]) # sampling step in frequency domain (Hz)
fmin_samples = int(fmin/df)
fmax_samples = int(fmax/df)
stock = st.st(w, fmin_samples, fmax_samples)
extent = (t[0], t[-1], fmin, fmax)
fig, ax = plt.subplots(2, 1, sharex=True)
ax[0].plot(t, w)
ax[0].set(ylabel='amplitude')
ax[1].imshow(np.abs(stock), origin='lower', extent=extent)
ax[1].axis('tight')
ax[1].set(xlabel='time (s)', ylabel='frequency (Hz)')
plt.show()
You should get the following output:
You can also compute the inverse Stockwell transform, ex:
inv_stock = st.ist(stock, fmin_samples, fmax_samples)
fig, ax = plt.subplots(2, 1, sharex=True)
ax[0].plot(t, w, label='original signal')
ax[0].plot(t, inv_stock, label='inverse Stockwell')
ax[0].set(ylabel='amplitude')
ax[0].legend(loc='upper right')
ax[1].plot(t, w - inv_stock)
ax[1].set_xlim(0, 10)
ax[1].set(xlabel='time (s)', ylabel='amplitude difference')
plt.show()
References
Stockwell, R.G., Mansinha, L. & Lowe, R.P., 1996. Localization of the complex spectrum: the S transform, IEEE Trans. Signal Process., 44(4), 998–1001, doi:10.1109/78.492555
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 Distributions
Hashes for stockwell-1.1.2-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 440bf75a3ed14b9b696bed1608ca962612ce8ed1f322e8bc68a85dde179b70fb |
|
MD5 | 5e0ffb78fde9799f0d118f58eb446abd |
|
BLAKE2b-256 | d256a4fd07bfced85b0bd865f024b7d92e85d31ad28ac8df04ee1be8528d13cc |
Hashes for stockwell-1.1.2-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2457b429b365995acf2d3b847275b943a735b83417412036784e29e897d0855b |
|
MD5 | 1ed4c0a1e5b3971520f0d59fb9125ab8 |
|
BLAKE2b-256 | 49c6aa31cdb9262e9c8604253265b60747d78833c42b8dc732d8c25be5f16c0f |
Hashes for stockwell-1.1.2-cp312-cp312-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eaac06f61e53640321af13c0876ec01bce01e7c632941e83e3dd57837c2b5b5b |
|
MD5 | 77dfa3dcdf518e3a0f07b0528c4e8b6c |
|
BLAKE2b-256 | 6aa7da467e2d4e67f90b59a36c472f0eb7c0cb63cb0707fd56fde7c8ff1f11e2 |
Hashes for stockwell-1.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d2a96b8e76805d454de15d96c9faf836d6e09ae329e68d7009168254f32a5c2 |
|
MD5 | d9b779b447ada77ca3de0fc57d4e31ef |
|
BLAKE2b-256 | 3d7c822035a7fa9c72c7185071ab0d1ac588ea71f837a3c5d8663232edca6cb1 |
Hashes for stockwell-1.1.2-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a13dc745bce889f891fbfe098fd3835a202e9cd2d8d7bd7de7fda7754cb9e733 |
|
MD5 | 6629914a05ab89d85ed5c4b900389bf7 |
|
BLAKE2b-256 | cb48915b68841afcf9fa46cf6413969a48ffa17a8f69034868b04017ab7a128d |
Hashes for stockwell-1.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9dd5ac23982ff4f351290a67d5dd02486eb8dcaf5ee7c1582df5ceaf61aac31d |
|
MD5 | ffc36817b4da4bc8b0e3f8d08cd25662 |
|
BLAKE2b-256 | bce7a4be4d34c734a5033c75c25feacf9c1b92421d8e44c91bc86d752904c79c |
Hashes for stockwell-1.1.2-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad51463b081ee555422219ce4e545b3d4f2b10d9ec5dfec3506860c8698472f4 |
|
MD5 | b99adb3af4bfdc879a1117f754c443b4 |
|
BLAKE2b-256 | e52c420f061d60f770c277ffecdecd187c3aa7b641f960c3a04327f8e3bdf4f9 |
Hashes for stockwell-1.1.2-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c95f323f552cd32872769510c967e15f98619c9c983e8eb40afce0c172ceb82c |
|
MD5 | 6bed8bf25f2177c095749d7a4b58f5ae |
|
BLAKE2b-256 | c8c913e2a8662d2d3b06d7556155f5d9325fd77fe7046a64f21b741af296c2ff |
Hashes for stockwell-1.1.2-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ab28cb044d250e7951ca8792bca8a4b1885eeee068cc0319de5af5d93925aad |
|
MD5 | 12b68f48f65cecbddaf0b4bdbea0985f |
|
BLAKE2b-256 | 03009937c695c177dc774f86caa51a604a73aacefa0f579f0fe03c6963e57cd8 |
Hashes for stockwell-1.1.2-cp311-cp311-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e936940cfa47dd66dfdf4cc39f4d17728f22e9c91d432d806324e7b1b44f445 |
|
MD5 | e6e5eb2d7b3a3cd0d39470601cac3375 |
|
BLAKE2b-256 | 6978be3b3709282c6a43c88757db48fd3385b8ed85db6245e56eb658eab99f52 |
Hashes for stockwell-1.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7de265f96371d6cd4df580106c4cb0293c3099aefe119baa5a8f232377cae249 |
|
MD5 | 4341529f7de870983c474dadda9a96c9 |
|
BLAKE2b-256 | a89a7775843aacb8dee97abde2b5d24b1670e615474d5c525d82196199236326 |
Hashes for stockwell-1.1.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c414467f71cb2bf77bfc46629ac069ef264d7f520abbb164e6244dacd5d9ef5d |
|
MD5 | fa9b2d87b53873d45c23c6636f693e94 |
|
BLAKE2b-256 | 83a6494fd6369b53152a2dcc87edb498119d0c645c9e005ded35464f282a34c6 |
Hashes for stockwell-1.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c98be732cf993f65ff699faea865da1334ae953b7433c640a2023f6531f82ef7 |
|
MD5 | 331d57cf91f634e70ab64c6db09c8d69 |
|
BLAKE2b-256 | 7f0f071d52ceda180b705444550c731f889cbd84ee03ea659ecc97d87aed9c42 |
Hashes for stockwell-1.1.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5bff0eb0ab250f4a337f8ed133650fe8c8f887a76d8b54409f459533c3e1f05 |
|
MD5 | 6a7f5d7b28ee4d2e536cbaf4a6be8d0c |
|
BLAKE2b-256 | c93da0f95b26903beee21b3f23ec1fcb1a5b08f1a6b75c24c6a6f3b7c227bf2b |
Hashes for stockwell-1.1.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69881c85f8cc27ad8c928d1f42064b1834b345d5d0b8d0f1cc49495d85b7fcc7 |
|
MD5 | 0b64d1bc90919298c737589906e5aac7 |
|
BLAKE2b-256 | d1e4b076820a14d5558cf34e53868583c7cb943729e92c7e194f3009f728525c |
Hashes for stockwell-1.1.2-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 326c50df0d4e0d47817eaa0555bf14fb08283fcd0b773add7bd554df8bef57e0 |
|
MD5 | 3828251a18d2455860cd4a48984a243d |
|
BLAKE2b-256 | 12c6f1c2e452d2f8112be8c932030c31d43f80190de70a4430f3112208f4c2b8 |
Hashes for stockwell-1.1.2-cp310-cp310-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a3ba0734934d3aadb104684d9a47486335738ca2d29cec0ec8537bd4d28c449 |
|
MD5 | 0745f228697233bf639149c2f787ec7c |
|
BLAKE2b-256 | f58440d59fef7cda91dda98fd0ae1732b49cb571c73fbdb19fe2de3ba952df67 |
Hashes for stockwell-1.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f311e9bcb9e059bce86ee226b1a75202ffac3f2c89367f96134d1772f6470bff |
|
MD5 | 8d3662141e730cad47b1444767c79db4 |
|
BLAKE2b-256 | d5f194036f5ccdc3329a4c7599993bc2dc2eca6cff61f9afe49dc28c89f3194b |
Hashes for stockwell-1.1.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fd8d3f2b0093a3c4bfcfd1b57f8cfdd88be8dd1551bc2f8e8bf3c232b82033c |
|
MD5 | f39c5b61aa23c781c04e3d8898c422d8 |
|
BLAKE2b-256 | bac956581e39d75d589ce1e7833c962db2c355e61dede0ec0f67ece788310431 |
Hashes for stockwell-1.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6b1afb316d4b64167c71e3633232f22eab5ee09ea1ac5f3f19039a56b015436 |
|
MD5 | 71b26849ef4264d75f7743fdb5df8813 |
|
BLAKE2b-256 | 8a2f6299d6cc8aeca0d9f45a9f55fed7c1c11a4508890e7dc3466d1927e79977 |
Hashes for stockwell-1.1.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b5e10f26e232835c6b8e0e3bf2bde239e5415b5106ac410df0b613144cffc5c |
|
MD5 | adb250a61145b51e5730466054e283f9 |
|
BLAKE2b-256 | a38fb94f9c9b746b450dae91954d2ba922245a05296ab617b8826e09c2dada61 |
Hashes for stockwell-1.1.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e576955d288f0aeaa1e59b127bb0be073ae2d9fc7c390d1fb672568915719945 |
|
MD5 | 8978354ba3ab720b66366a5bcc92b8a9 |
|
BLAKE2b-256 | b337653b3cc5c26a1701170dd1268b006dbf4514ceebe4c7aeaa8d80a562f7f8 |
Hashes for stockwell-1.1.2-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b07aa9128f3964c961fdb8ddda511fec7e56b5638977df014529815783aa09e |
|
MD5 | 8030850129f8fc06c6c17d5305b3e7de |
|
BLAKE2b-256 | 89d8ee379f2678a3bb9a43ebd9eae927b7874bd03de53d084c949ecc13afd3dc |
Hashes for stockwell-1.1.2-cp39-cp39-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cba554b0def61a15d335eeb629619b74afd60566126a0cd6501074c3c859ed19 |
|
MD5 | a400636f993f8e4c825f8794bc446113 |
|
BLAKE2b-256 | c15b1f43d0b632c830cb17507f32e06da1d07abd484e07ac32564872f7828f98 |
Hashes for stockwell-1.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1578aa62c225d0a9297142fc2dce893a1a305044359163f6dbb0a07f25b2855b |
|
MD5 | 353385ec2365838d5ad795523f7df572 |
|
BLAKE2b-256 | f60afe08ed0539b40a686d54a7b0dc98ce62c880725e5d43cea2a9e4849f99bc |
Hashes for stockwell-1.1.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e98961b00ec29df7ac17ec1aef9e4306ba1782589823f74859f99b18b090251 |
|
MD5 | f46e4c56a91bed9cf8b2f050ea3554ef |
|
BLAKE2b-256 | 46c3e00a4b4caaf1f2f9fef00a36fbed86f5cb485cd85eb140161c1c0a694226 |
Hashes for stockwell-1.1.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 224d51fa7eecbb0a942bd81934d8bf92286418c81a4a9d4490e82c08b6016ac6 |
|
MD5 | ed7b8485e3cb1a947d77a0f6699f5891 |
|
BLAKE2b-256 | b5e8da846307dc806ca7e5c17a4654bfa6bb77fcdde8e672a4734a496947c310 |
Hashes for stockwell-1.1.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f5a82769780ecec4eae40d9cf7f630e8616b12378097fca7fd285df54dd80a6 |
|
MD5 | 05c3b2b270e117b8cdb1143777a99943 |
|
BLAKE2b-256 | 4dda755dd1c9ff07287f1bb7aa0ef044f2d133287e9a84d3037f49a4b48cc7f8 |
Hashes for stockwell-1.1.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bdaec37fea906c6c995dd89166ee3e36b2932e9dc964e949a90788ba32a3ea3 |
|
MD5 | 609eda3157ec0c013914c8364f7f73ef |
|
BLAKE2b-256 | e5b03e3ad5daa23e4b066e5db731930b3bd890a57f7691f1c05fa24a93fc71f0 |
Hashes for stockwell-1.1.2-cp38-cp38-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbcf513b7a654d124c99811f7bc9f2f815765e4a05a932500d4b8ec530eec0e7 |
|
MD5 | ebe9e36d355b2d057a51bad9ff4a45d5 |
|
BLAKE2b-256 | ff2d3449f8baa4930be57b3226a24f5084bb17074758a81ece2f60506606234b |
Hashes for stockwell-1.1.2-cp38-cp38-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f26b2246ec17acdf5b38e6912c08e2cae6a03f069a2c98b7819e40ad8337d3d8 |
|
MD5 | 23a37a4521df295a827dbdcf3186bf70 |
|
BLAKE2b-256 | f0ca2aed05ec86c43aab37c626fca7312afbc9a356eed5b566fcb17e40babac3 |
Hashes for stockwell-1.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e63e8c50189b1ecc3da2fe920ef88f8ee3b67d057544161ff83bf566b109dd0b |
|
MD5 | c5fd3d7ea1e80e5cfb65af09ba7e3f47 |
|
BLAKE2b-256 | bff3323e7382cfdec76941b5794fe6b06f7f86d6d15f2a5d94734e3e1dd9652b |
Hashes for stockwell-1.1.2-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 825e10e4d62b17278425ebfe6a80c2dca29095c00b245c219810018440f4bd4d |
|
MD5 | 19d1ea5c7062b462ad8b26154554d7f0 |
|
BLAKE2b-256 | 03b6ca49c34e20c7b31e6dd8a4c3b9528dd25488f3b5accfef493ce5af646099 |
Hashes for stockwell-1.1.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3abd888c9a8b7692b05e9422137c30470f111547476275cd4000e197e0eb851e |
|
MD5 | 81f9f075c1386c7a2179e99f40622512 |
|
BLAKE2b-256 | 16cfddda092bf07b03d9f66360b81cf96bccb916eee62eeaa73933de33eb78c0 |
Hashes for stockwell-1.1.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a18db8a24f8ab4e31905d4807f37473a0a33d8c5001cf670c1ba3b9e54428f13 |
|
MD5 | 63494e9cbb929927351bfbf9bb3f8286 |
|
BLAKE2b-256 | ec851ee8c665b6e8b2dcafd2394400d9df70708f8ee011557ec1b743de2ea553 |