analyzer.modules.common.histogram_builder

Attributes

Classes

HistogramBuilder

Abstract base class for pure result modules.

SimpleHistogram

Abstract base class for all analyzer modules.

Functions

makeHistogram(product_name, columns, axes, data[, ...])

Create a histogram from column data and register it in the pipeline.

Module Contents

analyzer.modules.common.histogram_builder.logger[source]
class analyzer.modules.common.histogram_builder.HistogramBuilder[source]

Bases: analyzer.core.analysis_modules.PureResultModule

Abstract base class for pure result modules. Subclasses must implement the outputs and run methods.

product_name: str[source]
columns: list[analyzer.core.columns.Column][source]
axes: list[analyzer.modules.common.axis.Axis][source]
storage: str = 'weight'[source]
mask_col: analyzer.core.columns.Column | None = None[source]
__attrs_post_init__()[source]
static transformToFill(fill_data, per_event_value, mask=None)[source]

Perform transformations to bring fill data to correct shape

static maybeFlatten(data)[source]
static fillHistogram(histogram, cat_values, fill_data, weight=None, variation='central', mask=None)[source]
static create(backend, categories, axes, storage)[source]
run(column_sets, params)[source]
inputs(metadata)[source]
outputs(metadata)[source]
analyzer.modules.common.histogram_builder.makeHistogram(product_name: str, columns, axes: analyzer.modules.common.axis.Axis | list[analyzer.modules.common.axis.Axis], data, description=None, mask=None)[source]

Create a histogram from column data and register it in the pipeline.

This helper function wraps input data into temporary columns, associates them with axes definitions, and builds a histogram that can be added to the module outputs.

Parameters

product_namestr

Name of the histogram/product to create.

columnslist[Column]

Collection of event data columns where temporary columns will be stored.

axesAxis or list of Axis

Axis (or axes) definition(s) for the histogram. Must match the dimensionality of data.

dataarray-like or list of array-like

Data array(s) to histogram. Can be a single array or a list/tuple for multiple dimensions.

descriptionstr, optional

Optional description for the histogram.

maskarray-like, optional

Boolean array indicating which entries should be included in the histogram.

Returns

ModuleAddition

Object encapsulating the histogram builder, ready to be added to an analyzer module’s outputs.

Notes

  • Temporary columns are created for each data array to integrate with the pipeline.

  • If mask is provided, it is stored in a separate column and used by the histogram builder.

class analyzer.modules.common.histogram_builder.SimpleHistogram[source]

Bases: analyzer.core.analysis_modules.AnalyzerModule

Abstract base class for all analyzer modules. Subclasses must implement the inputs and run methods.

hist_name: str[source]
input_cols: list[analyzer.core.columns.Column][source]
axes: list[analyzer.modules.common.axis.RegularAxis][source]
replace_none: float | None = None[source]
mask_cols: list[analyzer.core.columns.Column] | None = None[source]
__attrs_post_init__()[source]
lint()[source]
outputs(metadata)[source]
inputs(metadata)[source]
run(columns, params)[source]