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

Lacourse 2018 very slow #13

Open
bdyetton opened this issue Feb 28, 2019 · 3 comments
Open

Lacourse 2018 very slow #13

bdyetton opened this issue Feb 28, 2019 · 3 comments

Comments

@bdyetton
Copy link

bdyetton commented Feb 28, 2019

Hi Wonambi Team,
First, thank you for this amazing package!
I'm using it to apply the Lacourse 2018 detector. This detector is very slow. It's 'moving_power_ratio' that seems to be slow. I'm wondering if there are some code optimizations possible. For example, unless im mistaken, line 1347 and line 1353 do the same thing, twice:

sf, psd = periodogram(windat, s_freq, 'hann', nfft=nfft,
                                       detrend='constant')

That should give a factor of 2 speed up at least. There are also a lot of regular python functions which could be numpy functions to also speed things up (sum vs np.sum).
I don't know if you guys have time, but if so, it would help speed up the 2000 records id like to detect spindles for ;)

@gpiantoni
Copy link
Member

Hi Jordan @jnobyrne

can you look into this?

@jnobyrne
Copy link
Contributor

Hi Benjamin @ bdyetton,

Thanks for your feedback! You're quite right, that extra periodogram was redundant. And the use of python's built-in sum function likely slowed things down too. I'll put the changes in the next release.

Please note that I am in fact in the process of reviewing the Lacourse algorithm. At present, it is not exactly faithful to Karine Lacourse's original Matlab implementation. We are currently in contact attempting to iron out these discrepancies. Watch this space for an update in the next few weeks!

Best,
Jordan

@bdyetton
Copy link
Author

Great :)
Excellent, let me know how it goes, and if you need someone to test it :)

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

No branches or pull requests

3 participants