DSP helpers and tools for biomedical signal processing
Install BME-DSP library
pip install git+https://github.com/jd2504/bmedsp/
Downloading files using parrakit. Use grab_mat() method for MATLAB files and grab_wav() method for .wav files. Files loaded using scipy.io into numpy.
from bmedsp import parrakit as pk
x = pk.grab_mat('spike.mat')
Output:
https://parralab.org/teaching/biomed-dsp/spike.mat
dict_keys(['__header__', '__version__', '__globals__', 'x'])
b'MATLAB 5.0 MAT-file, Platform: LNX86, Created on: Sat Sep 28 19:09:03 2002'
Grab and inspect data
x = x['x']
print(x.shape)
ma_filt()- simple moving averagegaborfir()- Gabor FIR linear filterlpc()- Levinson recursion based linear prediction filter coefficients estimation
E.g. LPC estimation on white noise
N = 50000
seed(42)
noise = randn(N)
ar_coeffs = np.array([1.0, 1/2, 1/3, 1/4])
x = signal.lfilter([1], ar_coeffs, noise)
x = x[-4096:].flatten()
a, g = lpc(x, 3)