You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if it was possible to include an option to detect peaks in periodic data?
E.g. if I'm having a simple cos(x) curve over an x range of 0 to 2π, then it would be nice if findmaxima() would detect x=0 (or x=2π) as a maxima.
As a workaround I assume one can just shift the data and search for maxima in there?!
( MWE:findmaxima([cos(ϕ) for ϕ in 0:2π]) gives no peaks. )
Cheers 😀
The text was updated successfully, but these errors were encountered:
Hi, thanks for your interest! Peaks may or may not already be able to do what you're looking for, but I'm not entirely sure from your question.
If you're wanting to symbolically detect peaks from functions, that is not something that is within the scope of this package, and that can be accomplished using other Julia packages that are intended for that problem (see e.g. Roots.jl or IntervalRootFinding.jl).
For the specific example you gave (findmaxima([cos(ϕ) for ϕ in 0:2π])), strictly speaking there are no peaks (maxima) in [cos(ϕ) for ϕ in 0:2π]. If you want to consider the bounds of the array as potential peaks, then you would need to add a strict=false keyword arg to your findmaxima call (e.g. findmaxima([cos(ϕ) for ϕ in 0:2π]; strict=false) which would return 2 peaks, one each at the first and last indices). The documentation has more information on the strict keyword. (Check out the dev docs for newly re-written documentation with expanded explanations of concepts.)
Hi,
I was wondering if it was possible to include an option to detect peaks in periodic data?
E.g. if I'm having a simple
cos(x)
curve over anx
range of 0 to 2π, then it would be nice iffindmaxima()
would detectx=0
(orx=2π
) as a maxima.As a workaround I assume one can just shift the data and search for maxima in there?!
( MWE:
findmaxima([cos(ϕ) for ϕ in 0:2π])
gives no peaks. )Cheers 😀
The text was updated successfully, but these errors were encountered: