API
Types
Functions
RadiationSpectra._interpolate_linear
RadiationSpectra.calibrate_spectrum
RadiationSpectra.get_example_spectrum
RadiationSpectra.opt_fit
RadiationSpectra.opt_fit
RadiationSpectra.peakfinder
Documentation
RadiationSpectra._interpolate_linear
— Method_interpolate_linear(point1::Tuple{Real, Real}, point2::Tuple{Real, Real}; threshold::Real = 0.5)
Interpolate a point between two points point1
and point2
using a linear interpolation.
RadiationSpectra.calibrate_spectrum
— Methodcalibrate_spectrum(h_uncal::Histogram, photon_lines::Array{Real, 1}; <keyword arguments>)
Returns the calibrated histogram, the deconvoluted spectrum, the found (uncalibrated) peak positions and the final threshold
value.
Keywords
σ::Real = 2.0
: The expected sigma of a peak in the spectrum. In units of bins.threshold::Real = 10.0
: Threshold for being identified as a peak in the deconvoluted spectrum. A single bin is identified as a peak when its weight exceeds thethreshold
and the previous bin was not identified as an peak.min_n_peaks::Int = 0
: If the number of found peaks is smaller thanmin_n_peaks
the functions lowers the parameterthreshold
until enough peaks are found.max_n_peaks::Int = 50
: Use only the first (strongest)max_n_peaks
peaks for peak identification.α::Real = 0.005
: = 0.5%. Acceptance level in the comparison of the peak position ratios in the peak indentification step. When the difference between the ratio of two found peak positions and the ratio of two photon lines (photon_lines
) is smaller thanα
, the found peaks are identified as the two photon lines.rtol::Real = 5e-3
: = 5e-3. Acceptance level for tolerance of the absolute difference between true and found line position.
Calibrate the spectrum h_uncal
. This is done by:
- finding peaks through devoncolution
- identifying them through comparison of the ratios of their positions with the ratios of the known
lines
- fitting all identified peaks (with a gaussian plus first order polynomial) to get their position more precisely
- performe a linear fit (offset forced to 0) of these positions vs the true positions (
lines
) to get the calibration constant
RadiationSpectra.get_example_spectrum
— Methodget_example_spectrum()::Histogram
Returns an uncalibrated radiation spectrum for testing and demonstrating purpose.
RadiationSpectra.opt_fit
— Function# opt_fit(DT::Type{<:UvSpectrumDensity}, h::Histogram{<:Any, 1},
p0::AbstractVector, lower_bounds::AbstractVector, upper_bounds::AbstractVector)
Maximum Likelihood Estimation Fit of model density d
on the histogram h
.
RadiationSpectra.opt_fit
— Function# opt_fit(DT::Type{<:UvSpectrumDensity}, h::Histogram{<:Any, 1},
p0::NamedTuple, lower_bounds::NamedTuple, upper_bounds::NamedTuple)
Maximum Likelihood Estimation Fit of model density d
on the histogram h
.
RadiationSpectra.peakfinder
— Methodpeakfinder(h::Histogram; <keyword arguments>)::Tuple{Histogram, Array{Float64, 1}}
Returns a deconvoluted spectrum and an array of peak positions.
Keywords
σ::Real=2.0
: The expected sigma of a peak in the spectrum. In units of bins.threshold::Real=10.0
: Threshold for being identified as a peak in the deconvoluted spectrum. A single bin is identified as a peak when its weight exceeds thethreshold
and the previous bin was not identified as an peak.backgroundRemove::Bool=true
deconIterations::Int=3
markov::Bool=true
averWindow::Int=3
Source
This function is basically a copy of TSpectrum::SearchHighRes
from ROOT.
- M.A. Mariscotti: A method for identification of peaks in the presence of background and its application to spectrum analysis. NIM 50 (1967), 309-320.
- M. Morhac;, J. Kliman, V. Matouoek, M. Veselsky, I. Turzo.:Identification of peaks in multidimensional coincidence gamma-ray spectra. NIM, A443 (2000) 108-125.
- Z.K. Silagadze, A new algorithm for automatic photopeak searches. NIM A 376 (1996), 451.