HistogramAggregator#

class ctapipe.monitoring.aggregator.HistogramAggregator(*args: t.Any, **kwargs: t.Any)[source]#

Bases: BaseAggregator

Compute aggregated histograms from a chunk of event-wise data using Hist.

Works with any N-dimensional event-wise data by aggregating along axis=0 (event dimension).

Attributes Summary

axis_definition

Dictionary that contains class_name and the corresponding kwargs to construct a hist.axis.<class_name>(**kwargs) instance.

axis_names

List of axis names for the histogram.

Methods Summary

hist_from_container(hist_container)

Construct a hist.Hist from a ChunkHistogramContainer.

hist_from_tablerow(row)

Build a hist.Hist from an Astropy table row produced by the HistogramAggregator.

Attributes Documentation

axis_definition#

Dictionary that contains class_name and the corresponding kwargs to construct a hist.axis.<class_name>(**kwargs) instance. E.g. {'class_name': 'Regular', 'bins': 40, 'start': 20.0, 'stop': 80.0, 'name': 'value'}.

axis_names#

List of axis names for the histogram. E.g. [‘channel’, ‘pixel’]. If None, default names will be used.

Methods Documentation

static hist_from_container(hist_container: ChunkHistogramContainer)[source]#

Construct a hist.Hist from a ChunkHistogramContainer.

Parameters:
hist_containerChunkHistogramContainer

Stored histogram container.

static hist_from_tablerow(row: Row)[source]#

Build a hist.Hist from an Astropy table row produced by the HistogramAggregator.

This is a thin wrapper that constructs a ChunkHistogramContainer from the provided row (reading n_events, histogram and row.meta) and delegates the actual reconstruction to hist_from_container().

Parameters:
rowastropy.table.Row

Table row created by HistogramAggregator.__call__. Expected to contain a histogram ndarray with shape (n_bins, *data_dims), number of valid events in n_events, and metadata in row.meta describing the original axis.

Returns:
hist.Hist

Reconstructed histogram object with axes and counts populated.