- class colliderscope.Histogram
Constant memory histogram data structure.
Changed in version 0.2.0: Migrated from
datamodule. Renamed_alignparameter toalign.Changed in version 0.2.7: Added
missedproperty for number of out-of-bounds updates.- Parameters:¶
- num_bins : int
Number of bins to store multiplicities within.
- window : tuple[float, float]
Range of x-axis to use for binning.
- align : {"left", "center"}
Alignment of x-axis. Valid options are “left” or “center”. If
"left",windowwill be relative tox=0. If"center",windowwill be centered relative tox=expected. Default is"left".- expected : float, optional
Expected value for distribution’s measure of location.
- align¶
Alignment of x-axis. Valid options are “left” or “center”. If
"left",windowwill be relative tox=0. If"center",windowwill be centered relative tox=expected. Default is"left".- Type:¶
{“left”, “center”}
Public members¶
-
align : 'left' | 'center' =
'left'
- __eq__(other: Self) bool
Determines if two
Histograminstances contain the samebin_edges,counts, and normalisation forpdf.
- __add__(other: Histogram) Histogram
Merges two
Histograminstances, by adding theircountsand_totalnormalisation variables. Must have the same bins.
-
to_json(fname: str | Path | IOBase, encoding: str =
'utf-8') None Serialise and store
Histogramobject as a JSON file.
- classmethod from_json(fname: str | Path | IOBase, ...) Histogram
Instantiate a histogram from JSON file, encoded using the
Histogram.to_json()method.
- property pdf : tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]
Bin centers and count density. May be used for bar chart plots.
- density() ndarray[Any, dtype[float64]]
Probability density of the histogram, normalised by the total count of the histogram.
- midpoints() ndarray[Any, dtype[float64]]
Midpoints of the bins along the x and y axes, respectively.
- serialize() SerializedHistogram
Converts
Histograminto serialized representation.
- classmethod from_interface(hist: HistogramLike, ...) Self
Instantiates
Histogramfrom a genericHistogramLikeinterface.
- classmethod from_serialized(hist_dict: SerializedHistogram) Self
Instantiates
Histogramfrom serialized data.
- Histogram(num_bins: int, window: tuple[float, float], ...)
Initialize self. See help(type(self)) for accurate signature.
- __repr__()
Return repr(self).
Last update:
Jun 27, 2025