raphaelvallat / yasa

YASA (Yet Another Spindle Algorithm): a Python package to analyze polysomnographic sleep recordings.
https://raphaelvallat.com/yasa/
BSD 3-Clause "New" or "Revised" License
428 stars 115 forks source link

[ENH] Speed up `_index_to_events` #51

Closed snwnde closed 2 years ago

snwnde commented 2 years ago

Issue

This PR addresses https://github.com/raphaelvallat/yasa/issues/50.

Benchmark

See https://github.com/raphaelvallat/yasa/issues/50#issuecomment-1000740304.

Code style

flake8 reports problems in spectral.py and staging.py but I didn't touch them.

Pytest

All tests passed with some DeprecationWarning in the test codes.

Remark

I also kept the doc string Original code imported from the Visbrain package as I would expect them to accept the same enhancement, c.f. https://github.com/EtienneCmb/visbrain/issues/104.