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

Reuse Lombscargle.PeriodogramPlan for different signal but the same time vector #20

Open
felixcremer opened this issue Jun 2, 2020 · 2 comments

Comments

@felixcremer
Copy link
Contributor

I am currently implementing a time series surrogate algorithm based on the lombscargle periodogram JuliaDynamics/TimeseriesSurrogates.jl#67.
There I need to compute the lombscargle periodogram for shuffled versions of the same signal with the same times vector a few thousand times.
I benchmarked my implementation and most of the time is spent in the computation of the lombscargle periodogram.

Is there a way to reuse the Lombscargle PeriodogramPlan for this so that I could update the signal of the PeriodogramPlan?

I have seen the bootstrap methods in this package, but I don't understand, why this shuffles the times vector, but from that I would assume, that something similar for the signal might be feasible.

@giordano
Copy link
Member

giordano commented Jun 2, 2020

I have seen the bootstrap methods in this package, but I don't understand, why this shuffles the times vector, but from that I would assume, that something similar for the signal might be feasible.

Quoting from the documentation:

the LombScargle.PeriodogramPlan bears the time vector, but the quantities that are pre-computed in planning stage do not actually depend on it. This is particularly useful if you want to calculate the false-alarm probability via bootstrapping with LombScargle.bootstrap function: the vector time is randomly shuffled, but pre-computed quantities will remain the same, saving both time and memory in each iteration.

For bootstrap, shuffling the times or the signal is just the same. The quantities that are pre-computed depends on the signal, so it's just much more efficient to keep it fixed and shuffle the times.

I'm not sure there would be any advantage in a plan that has the same time vector but different signals, you can't cache almost anything

@giordano
Copy link
Member

giordano commented Jun 2, 2020

I'm not sure there would be any advantage in a plan that has the same time vector but different signals, you can't cache almost anything

Looking at src/planning.jl, maybe the FFTW plan could be reused in the case of the FastGLSPlan* plans, but in the other cases I don't see any possible improvement.

I introduced the plans especially because they make bootstrapping much more efficient and reliable, as you're sure that you didn't miss any option. If the signal is different you need to perform a whole new periodogram anyway.

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

2 participants