# stockwelltransform

committed bec1d3b

# Files changed (3)

` Code from Dr. Stockwell's web site for the stockwell transform`
` `
` http://www.cora.nwra.com/~stockwel/index.php?module=fatcat&fatcat[user]=viewCategory&fatcat_id=2&module_title=pagemaster`
`+`
`+----`
`+from pylab import *`
`+`
`+The way the basic module works is, for a signal x`
`+y = stockwell.smt.st(x)`
`+will return it's complex valued transform`
`+the amplitude "spectra" can be obtained with`
`+`
`+ay = abs(y)`
`+`
`+The rows in the interval [0,n/2) label the number of cycles during the entire period of x (ie, it uses the length L of x as the longest time)`
`+`
`+So, to covert this back to hz`
`+Let`
`+Fs=<sampling interval in Hz>`
`+`
`+Let`
`+Tn = float(L * Fs) # total time, say in seconds, of x`
`+`
`+# row ii -> ii/L`
`+# Then the freq of row ii is`
`+freq[ii] = ii/Tn`

# examples/eeg2.py

` `
` import _edflib`
` import stockwell.smt as smt`
`-eegfile="/mnt/hgfs/clee/Documents/swaineeg/NKT/EEG2100/CA75510M_1-1+_1-2+.edf"`
`+# eegfile="/mnt/hgfs/clee/Documents/swaineeg/NKT/EEG2100/CA75510M_1-1+_1-2+.edf"`
`+eegfile='/home/clee/Dropbox/data/swainAFIB_CA46803E_1-1+.edf'`
` open(eegfile)`
` e=_edflib.Edfreader(eegfile)`
` `

# examples/eeg3.py

`+from __future__ import division`
`+from numpy import *`
`+from matplotlib.pyplot import *`
`+`
`+import _edflib`
`+import stockwell.smt as smt`
`+# eegfile="/mnt/hgfs/clee/Documents/swaineeg/NKT/EEG2100/CA75510M_1-1+_1-2+.edf"`
`+eegfile='/home/clee/Dropbox/data/swainAFIB_CA46803E_1-1+.edf'`
`+open(eegfile)`
`+e=_edflib.Edfreader(eegfile)`
`+`
`+def showst(swtransform, newfigure=True):`
`+    if newfigure:`
`+        figure()`
`+    imshow(swtransform, origin='lower', aspect='auto')`
`+    #axis('auto')`
`+    `
`+`
`+# read a short number of samples`
`+`
`+`
`+import scipy.signal as signal`
`+#?signal.chirp`
`+t=linspace(0,10,num=1000)`
`+chrp = signal.chirp(t)`
`+`
`+pstchrp = abs(smt.st(chrp))`
`+showst(pstchrp)`
`+`
`+`
`+`
`+eeg2000= zeros(2000.0)`
`+e.readsignal(0,0,2000,eeg2000)`
`+e.close()`
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.