derb12 / pybaselines

A Python library of algorithms for the baseline correction of experimental data.
https://pybaselines.readthedocs.io
BSD 3-Clause "New" or "Revised" License
115 stars 17 forks source link

FEAT: Greatly reduce time for Whittaker methods and make them more robust #8

Closed derb12 closed 3 years ago

derb12 commented 3 years ago

Description

Switched to using banded solvers for all Whittaker methods, which reduced the computation time by ~60-85% compared to version 0.4.0 due to no longer having to create and modify large sparse matrices and using the faster solve(h)_banded functions.

Added pentapy as an optional dependency. When pentapy is installed and the diff_order is 2 (pentadiagonal system), will use pentapy's solver, which is ~30-70% faster than SciPy's solve(h)_banded (~30-45% faster for tested datasets with 1000 points, ~45-70% faster for tested datasets with 10000 points), resulting in a total time reduction of 80-95% compared to v0.4.0.

Made the weight calculations for some Whittaker functions more robust by preventing nan values from being created.

Type of Pull Request

Pull Request Checklist