Skip to content

fiorellalan/stockwell

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stockwell

Time-frequency analysis through Stockwell transform.

Installation

Make sure that you have FFTW installed. For example:

# macOS
brew install fftw

# debian or ubuntu
sudo apt-get install libfftw3-dev

Then install this python package using pip:

pip install .

Or, alternatively, in "editable" mode:

pip install -e .

Usage

From the command line:

stockwell file.sac

It will produce file.sac.pdf with the time-frequency representation of the signal.

Example usage from python:

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
fmax = 250
stock = st.st(w, fmin, fmax)
dt = t[1] - t[0]
fmin = fmin/(len(w)*dt)
fmax = fmax/(len(w)*dt)
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: stockwell.png

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

S transform on Wikipedia.

About

stockwell transform for python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 55.7%
  • Python 44.1%
  • Shell 0.2%