Peak Detection
Automatic peak finding for spectroscopy data, built on Peaks.jl.
Types
OpticalSpectroscopy.PeakInfo — Type
PeakInfoInformation about a detected peak.
Fields
position::Float64— Peak center in x-unitsintensity::Float64— Peak heightprominence::Float64— How much the peak stands out from surrounding baselinewidth::Float64— Full width at half prominence (FWHP) in x-unitsbounds::Tuple{Float64,Float64}— Left and right edges at half prominenceindex::Int— Index in the original data array
Finding Peaks
OpticalSpectroscopy.find_peaks — Function
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 rangemin_width::Real=0— Minimum peak width in x-unitsmax_width::Real=Inf— Maximum peak width in x-unitsmin_height::Real=-Inf— Minimum peak height (absolute)window::Int=1— Comparison window for local maxima detectionmode::Symbol=:maxima—:maximafor peaks,:minimafor valleys (e.g. 2nd derivative)baseline::Union{Symbol,Nothing}=nothing— Apply baseline correction before peak detectionbaseline_kw::NamedTuple=NamedTuple()— Keyword arguments for baseline correction
OpticalSpectroscopy.peak_bounds — Function
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.
Display
OpticalSpectroscopy.peak_table — Function
peak_table(peaks::Vector{PeakInfo}) -> StringFormat detected peaks as an aligned text table for terminal display.