Peak Detection

Automatic peak finding for spectroscopy data, built on Peaks.jl.

Types

OpticalSpectroscopy.PeakInfoType
PeakInfo

Information about a detected peak.

Fields

  • position::Float64 — Peak center in x-units
  • intensity::Float64 — Peak height
  • prominence::Float64 — How much the peak stands out from surrounding baseline
  • width::Float64 — Full width at half prominence (FWHP) in x-units
  • bounds::Tuple{Float64,Float64} — Left and right edges at half prominence
  • index::Int — Index in the original data array
source

Finding Peaks

OpticalSpectroscopy.find_peaksFunction
find_peaks(y; kwargs...) -> Vector{PeakInfo}
find_peaks(x, y; kwargs...) -> Vector{PeakInfo}
find_peaks(spec; kwargs...) -> Vector{PeakInfo}

Find peaks in spectroscopic data.

The spec form accepts any 1D AbstractSpectroscopyData (uses xdata/ydata).

Keyword Arguments

  • min_prominence::Real=0.05 — Minimum prominence as fraction of data range
  • min_width::Real=0 — Minimum peak width in x-units
  • max_width::Real=Inf — Maximum peak width in x-units
  • min_height::Real=-Inf — Minimum peak height (absolute)
  • window::Int=1 — Comparison window for local maxima detection
  • mode::Symbol=:maxima:maxima for peaks, :minima for valleys (e.g. 2nd derivative)
  • baseline::Union{Symbol,Nothing}=nothing — Apply baseline correction before peak detection
  • baseline_kw::NamedTuple=NamedTuple() — Keyword arguments for baseline correction
source
OpticalSpectroscopy.peak_boundsFunction
peak_bounds(y, idx) -> (left, right)

Find the extent of a peak located at index idx by walking outward to the nearest local minimum on each side. Returns the bounding indices (left, right) with left <= idx <= right. Used to delimit a peak around a known position (e.g. a user-selected point) rather than detecting peaks.

source

Display