Giter Club home page Giter Club logo

dmd's Introduction

Dynamic Mode Decomposition (DMD) and Multi-Resolution DMD (mrDMD)

Decoding hand movements from ECoG recordings

Installation

git clone https://github.com/BruntonUWBio/ecog-hand
sudo apt-get install python3-pip
sudo pip3 install numpy matplotlib cvxpy pytest sklearn

Usage

In your project, load the required modules:

%matplotlib inline
from mrDMD import mrDMD
from DMD import DMD
from helper_functions import *

Start with a signal composed of a sum of sinusoids in 1-dimension

dt = 1/200
N = 1000
t = np.linspace(0, 5, N)
amp = 1
freq_max = 40
freqs = np.arange(freq_max)
freqs = freqs[::4]
print('Freqs: ')
print(freqs)

X = buildX(freqs, t)
plt.figure()
plt.plot(t, X[0,:])
plt.show()
Freqs: 
[ 0  4  8 12 16 20 24 28 32 36]

png

Comparisons to FFT when frequency well below Nyquist

freq, P = fftPlot(X, dt, freq_max)

png

stack_factor = 2*len(freqs)
kwargs = {'dt':dt, 
    'scale_modes':True}
dmd = DMD(**kwargs)
dmd.fit(X)
f, P = dmd.spectrum(sort='frequencies')

idx = in_range(f, (1,freq_max))
plt.figure()
plt.stem([f[i] for i in idx], [P[i] for i in idx])
plt.title('DMD spectrum shortened')
plt.xlabel('Frequency')
plt.show()
plt.close()

png

Testing

Pytest is used for testing run the following at the command line

pytest

References

For DMD algorithm details see:

  • "Dynamic Mode Decomposition". J. Nathan Kutz, Steven L. Brunton, Bingni W. Brunton, and Joshua L. Proctor 2016.

For multiresolution DMD algorithm details see:

  • "Multiresolution Dynamic Mode Decomposition". J. Nathan Kutz, Xing Fu, Steven L. Brunton 2016.

dmd's People

Contributors

kdmarrett avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.