API
Modules
Types and constants
Functions and macros
LegendEventAnalysis.apply_event_mapLegendEventAnalysis.build_cross_system_eventsLegendEventAnalysis.build_global_event_mapLegendEventAnalysis.build_global_eventsLegendEventAnalysis.calibrate_allLegendEventAnalysis.calibrate_aux_detector_dataLegendEventAnalysis.calibrate_ged_detector_dataLegendEventAnalysis.calibrate_pmt_detector_dataLegendEventAnalysis.calibrate_spm_detector_dataLegendEventAnalysis.flag_coincidencesLegendEventAnalysis.flatten_over_detectors
Documentation
LegendEventAnalysis.apply_event_map — Method
apply_event_map(data::StructVector, evtmap::StructVector)Apply the event map evtmap to the data data.
data will typically be the result of flatten_over_detectors and evtmap the result of build_global_event_map.
LegendEventAnalysis.build_cross_system_events — Method
function build_cross_system_events(
data::NamedTuple,
ts_window::Number = 25u"μs"
)Build cross-system events.
data must be a NamedTuple with properties that represent the names of experiment (sub)-systems and values that are the result of build_global_events for each system.
Note: Currently requires the tstart columns of all systems to be identical.
LegendEventAnalysis.build_global_event_map — Method
build_global_event_map(local_events::StructArray; ts_window::Number = 25u"μs")Build a map of global events based on local_events.
data must contain columns detector, detevtno and timestamp. It will typically be the result of flatten_over_detectors.
Returns a StructArray that contains the columns tstart, detector, detevtno and timestamp, sorted by tstart globally and along timestamp in each row.
The tstart column contains the start time of each event, the detector, detevtno and timestamp columns are vectors of vectors that contain the detector-id, per-detector event numbers and per-detector timestamps that have been associated with each respective events.
Per-detector events are associated with the same global event if their timestamps fall within a time windows of length ts_window.
LegendEventAnalysis.build_global_events — Function
function build_global_events(
data::AbstractDict{<:DetectorIdLike},
detectors::AbstractVector{<:DetectorIdLike} = collect(keys(data));
ts_window::Number = 25u"μs"
)Build global events from a dictionary of per-detector events
Per-detector events are associated with the same global event if their timestamps fall within a time windows of length ts_window.
data must a dictionary of in-memory or on-disk table-like objects, keyed by detector-IDs. It may, e.g. be a Dict with values that are StructArrays.StructVector, TypedTables.Table or similar, but may also be a LegendHDF5IO.LHDataStore. Note that on-disk data will be read into memory as a whole.
LegendEventAnalysis.calibrate_all — Function
calibrate_all(data::LegendData, sel::ValiditySelection, datastore::AbstractDict)Calibrate all detectors in the given datastore, using the metadata processing configuration for data and sel.
LegendEventAnalysis.calibrate_aux_detector_data — Method
calibrate_aux_detector_data(data::LegendData, sel::ValiditySelection, detector::DetectorId, detector_data::AbstractVector)Apply the calibration specified by data and sel for aux detector referred to by the detector ID to the single-detector detector_data for that detector.
Also calculates the configured cut/flag values.
LegendEventAnalysis.calibrate_ged_detector_data — Method
calibrate_ged_detector_data(data::LegendData, sel::AnyValiditySelection, detector::DetectorId, detector_data::AbstractVector;
psd_cal_pars_type::Symbol=:ppars, psd_cal_pars_cat::Symbol=:aoe, psd_cut_pars_type::Symbol=:ppars, psd_cut_pars_cat::Symbol=:aoe,
keep_detdata::Bool=false)Apply the calibration specified by data and sel for the given HPGe detector to the single-detector detector_data for that detector.
Also calculates the configured cut/flag values.
LegendEventAnalysis.calibrate_pmt_detector_data — Method
calibrate_pmt_detector_data(data::LegendData, sel::ValiditySelection, detector::DetectorId, detector_data::AbstractVector)Apply the calibration specified by data and sel for the given PMT detector to the single-detector detector_data for that detector.
Also calculates the configured cut/flag values.
LegendEventAnalysis.calibrate_spm_detector_data — Method
calibrate_spm_detector_data(data::LegendData, sel::ValiditySelection, detector::DetectorId, detector_data::AbstractVector)Apply the calibration specified by data and sel for the given SiPM detector to the single-detector detector_data for that detector.
Also calculates the configured cut/flag values.
LegendEventAnalysis.flag_coincidences — Method
flag_coincidences(
timestamps::AbstractVector{<:RealQuantity}, ref_timestamps::AbstractVector{<:RealQuantity};
ts_window::Number = 125u"μs"
)Flag coincidences in timestamps with respect to ref_timestamps.
Return a boolean vector of the same length as timestamps that is true where a timestamp is within ts_window of an element of ref_timestamps and false otherwise.
LegendEventAnalysis.flatten_over_detectors — Function
function flatten_over_detectors(
data::AbstractDict{<:DetectorIdLike},
detectors::AbstractVector{<:DetectorIdLike} = collect(keys(data))
)Flatten per-detector data data to a single StructArrays.StructVector by concatenating its table-like values and adding the columns detector and detevtno.
data must a dictionary of in-memory or on-disk table-like objects, keyed by detector-IDs. It may, e.g. be a Dict with values that are StructArrays.StructVector, TypedTables.Table or similar, but may also be a LegendHDF5IO.LHDataStore. Note that on-disk data will be read into memory as a whole.
Returns a NamedTuple{(:result, :per_detector)}: result is the flattened data and per_detector is a detector-indexed dictionary of views into result.