Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fm.fit taking forever #21

Open
iyangand opened this issue Jan 10, 2021 · 4 comments
Open

fm.fit taking forever #21

iyangand opened this issue Jan 10, 2021 · 4 comments

Comments

@iyangand
Copy link

in the matlab wrapper fooof.m, I can get through the first few lines just fine, but then when the line "fm.fit(freqs, power_spectrum, f_range)" is executed, it's taking forever.

I think this is not a matlab/python problem since the first few lines run just fine (e.g. py.numpy.array, pylist, etc.).

I'm using python 3.7 w/ cpython on matlab 2020a.

@TomDonoghue
Copy link
Member

We would need some more information to be able to troubleshoot this. Does model fitting finish at all, or is it hanging? How long is "forever"? What is the data you are trying to fit and what settings are you using?

@iyangand
Copy link
Author

Thank you for quick response!

I am simply running the cell in 'fooof_example_one_spectrum.m', using the provided data in 'ch_dat_one.mat'

The model never finishes even when I let it run for >10 minutes.

I tried changing the default settings as follows, and still have the same issue.
settings.peak_width_limits=[2 5];
settings.max_n_peaks=2;
settings.min_peak_height=0.1;
settings.peak_threshold=2;
settings.aperiodic_mode='fixed';
settings.verbose=true;

@EricKolibacz
Copy link

EricKolibacz commented May 18, 2021

Same here. But I get one additional output warning:

FOOOF WARNING: Lower-bound peak width limit is < or ~= the frequency resolution: 0.98 <= 0.50
	Lower bounds below frequency-resolution have no effect (effective lower bound is the frequency resolution).
	Too low a limit may lead to overfitting noise as small bandwidth peaks.
	We recommend a lower bound of approximately 2x the frequency resolution.

Some details of my Machine:

  • Ubuntu20.4
  • Matlab2019b
  • Steps of installation:
    • created venv in python
    • installed fooof via pip install fooof in this venv
    • linked the python version in matlab with pyversion("~/venvs/fooof/bin/python3")
>> pyenv

ans = 

  PythonEnvironment with properties:

          Version: "3.8"
       Executable: "/home/eric/venvs/fooof/bin/python3"
          Library: "libpython3.8.so.1.0"
             Home: "/home/eric/venvs/fooof"
           Status: Loaded
    ExecutionMode: InProcess
        ProcessID: "8933"
      ProcessName: "MATLAB"

The installed packages are

(fooof) eric@XXX:~$ pip list
Package       Version
------------- -------
fooof         1.0.0  
numpy         1.20.2 
pip           20.0.2 
pkg-resources 0.0.0  
scipy         1.6.3  
setuptools    44.0.0

@EricKolibacz
Copy link

EricKolibacz commented May 18, 2021

I was able to solve it with the answer on StackOverflow. As the answer suggests "this issue sometimes can arise when Python attempts to use the MathWorks version of libcrypto". Just run:

py.sys.setdlopenflags(int32(10))
py.importlib.import_module('ssl')

and you should be good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants