Skip to content

Peaks and spectral fitting

findpeaks and maskpeaks wrap Peaks.jl for time series and spectra; they handle multivariate input and return peaks with heights, prominences, and widths.

MAPPLE (Adaptive Peaks and Power-Law Exponents) is a parametric spectral model combining multiple piecewise power-law components with Gaussian peaks. Fitting is in two stages: an initial peak-finding + linear-regression pass (fit(MAPPLE, S)), then a refinement with Optim (fit!(m, S)), provided by OptimExt (loaded with using Optim).

julia
using TimeseriesTools, Optim
m  = fit(MAPPLE, S)        # rough fit on a power spectrum
fit!(m, S)                 # refine
ŝ  = predict(m, freqs(S))

Reference

Missing docstring.

Missing docstring for findpeaks. Check Documenter's build log for details.

Missing docstring.

Missing docstring for maskpeaks. Check Documenter's build log for details.

TimeseriesTools.MAPPLE Type
julia
MAPPLE(params::ComponentArray)

An MAPPLE (Adaptive Peaks and Power-Law Exponents) model for fitting power spectra. params consists of:

  • log_A: Base log-10 amplitude of the spectrum.

  • components: An array of components, each with:

    • log_f_stop: Log-10 frequency where the component transitions to the next.

    • β: Power-law exponent for the component.

  • peaks: An array of Gaussian peaks, each with:

    • log_f: Log-10 center frequency of the peak.

    • log_σ: Width of the peak in log-frequency space.

    • log_A: Log-10 amplitude of the peak.

  • transition_width: Width of the transition between components in log-frequency space.

source

Missing docstring.

Missing docstring for mapple. Check Documenter's build log for details.

Missing docstring.

Missing docstring for fit_mapple. Check Documenter's build log for details.

StatsAPI.fit! Method
julia
fit!(m::MAPPLE, logspectrum; kwargs...)

Refine the parameters of a MAPPLE model m to fit the provided spectrum.

source