Open
Description
Hi there,
I'm collaborating on an EEG project in Croatia, and am having difficulties porting the ridge extraction from Matlab to python using pymodalib.
I'm running OSX 15.7.1, currently using Python 3.7.3 and have installed Matlab Runtime Engine 9.6. I don't have a separate Matlab license.
I am getting a MatlabLibraryException when I try to implement wavelet transform or ridge extraction using matlab (implementation="python" works fine for wavelet transform), but as ridge_extraction requires Matlab, I can't get past the error. The DYLD_LIBRARY_PATH seems to be correct, have added it to both .bash_profile and as an environment variable in the script.
Here is my script:
import pymodalib
import pandas as pd
import csv
import numpy as np
from scipy.io import loadmat
import h5py
import os
import sys
from matplotlib import pyplot as plt
os.environ["DYLD_LIBRARY_PATH"] = "/Applications/MATLAB/MATLAB_Runtime/v96/runtime/maci64:/Applications/MATLAB/MATLAB_Runtime/v96/sys/os/maci64:/Applications/MATLAB/MATLAB_Runtime/v96/bin/maci64:/Applications/MATLAB/MATLAB_Runtime/v96/extern/bin/maci64"
patient="x"
samplerate = 500.0
fmax_arg = 1.2
fmin_arg = 0.8
file = "path/to/file"
with h5py.File(file, 'r') as f:
dset = f[patient]
data = f.get(patient)
signal = np.array(data)
times = pymodalib.generate_times(signal, samplerate)
wt, freq,wtdict = pymodalib.wavelet_transform(signal, samplerate, resolution=wt_resolution,cut_edges=False,fmax=fmax_arg,fmin=fmin_arg,wavelet=wavelet,return_opt=True,implementation='matlab')
iamp,iphi,ifreq = pymodalib.ridge_extraction(tfr=wt,frequencies=freq,fs=float(samplerate),method='direct',wopt=wtdict,implementation='matlab')
Traceback is as follows:
Traceback (most recent call last):
File "moda.py", line 189, in <module>
wt, freq,wtdict = pymodalib.wavelet_transform(signal, samplerate, resolution=wt_resolution,cut_edges=False,fmax=fmax_arg,fmin=fmin_arg,wavelet=wavelet,return_opt=True,implementation='matlab')
File "/Users/macintosh/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pymodalib/algorithms/wavelet.py", line 191, in wavelet_transform
**kwargs,
File "/Users/macintosh/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pymodalib/utils/decorators.py", line 72, in wrapper
f"The MATLAB-packaged library '{module}' is not installed. Please install "
pymodalib.utils.matlab_runtime.MatlabLibraryException: The MATLAB-packaged library 'WT' is not installed. Please install PyMODA, which supplies the MATLAB-packaged libraries, or check if there is a pure-Python implementation by passing 'implementation="python"' to the function.
Many thanks for your help in advance.
Metadata
Metadata
Assignees
Labels
No labels