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_channel_dataLegendEventAnalysis.calibrate_ged_channel_dataLegendEventAnalysis.calibrate_pmt_channel_dataLegendEventAnalysis.calibrate_spm_channel_dataLegendEventAnalysis.flag_coincidencesLegendEventAnalysis.flatten_over_channels
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_channels 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 channel, chevtno and timestamp. It will typically be the result of flatten_over_channels.
Returns a StructArray that contains the columns start, channels, localevents and timestamps, sorted by start globally and along timestamps in each row.
The start column contains the start time of each event, the channels, chevts and timestamps columns are vectors of vectors that contain the channel-id, per-channel event numbers and per-channel timestamps that have been associated with each respective events.
Per-channel events are accociated 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{<:ChannelIdLike},
channels::AbstractVector{<:ChannelIdLike} = collect(keys(data));
ts_window::Number = 25u"μs"
)Build global events from a dictionary of per-channel events
Per-channel events are accociated 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 channel-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 channels in the given datastore, using the metadata processing configuration for data and sel.
LegendEventAnalysis.calibrate_aux_channel_data — Method
calibrate_aux_channel_data(data::LegendData, sel::ValiditySelection, detector::DetectorId, channel_data::AbstractVector)Apply the calibration specified by data and sel for aux channel referred to by the detector ID to the single-channel channel_data for that detector.
Also calculates the configured cut/flag values.
LegendEventAnalysis.calibrate_ged_channel_data — Method
calibrate_ged_channel_data(data::LegendData, sel::AnyValiditySelection, detector::DetectorId, channel_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_chdata::Bool=false)Apply the calibration specified by data and sel for the given HPGe detector to the single-channel channel_data for that detector.
Also calculates the configured cut/flag values.
LegendEventAnalysis.calibrate_pmt_channel_data — Method
calibrate_pmt_channel_data(data::LegendData, sel::ValiditySelection, detector::DetectorId, channel_data::AbstractVector)Apply the calibration specified by data and sel for the given PMT detector to the single-channel channel_data for that detector.
Also calculates the configured cut/flag values.
LegendEventAnalysis.calibrate_spm_channel_data — Method
calibrate_spm_channel_data(data::LegendData, sel::ValiditySelection, detector::DetectorId, channel_data::AbstractVector)Apply the calibration specified by data and sel for the given SiPM detector to the single-channel channel_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_channels — Function
function flatten_over_channels(
data::AbstractDict{<:ChannelIdLike},
channels::AbstractVector{<:ChannelIdLike} = collect(keys(data))
)Flatten per-channel data data to a single StructArrays.StructVector by concatenating its table-like values and adding the columns a channel and chevtno.
data must a dictionary of in-memory or on-disk table-like objects, keyed by channel-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_channel)}: result is the flattened data and per_channel is a channel-indexed dictionary of views into result.