Skip to content

Improve computational performance for the Whittaker algorithm #16

@InnocenteSimone

Description

@InnocenteSimone

Hi,

I found out that the current implementation for the Whittaker algorithm is quite heavy and it takes time to compute for a good amount of spectra.
For example for 374 spectra, the current implementation took around 74 seconds to complete the preprocessing.

I found an alternative implementation https://github.com/mhvwerts/whittaker-eilers-smoother/blob/master/whittaker_smooth.py under the CeCILL-B license thus you need to cite the author.

The code will be something like this:

def _whittaker(intensity_data, spectral_axis, lam, d):
    m = len(intensity_data)
    E = sparse.eye(m, format='csc')
    D = _speyediff(m, d, format='csc')
    coefmat = E + lam * D.conj().T.dot(D)
    z = splu(coefmat).solve(intensity_data)
    return z, spectral_axis

This solution run 374 preprocessing in 0.47 seconds.

Hope it can helps, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions