hist package#

class hist.BaseHist(*in_args: AxisProtocol | Tuple[int, float, float] | Storage | str, storage: Storage | str | None = None, metadata: Any | None = None, data: ndarray[Any, dtype[Any]] | None = None, label: str | None = None, name: str | None = None)#

Bases: Histogram

property T: Self#
density() ndarray[Any, dtype[Any]]#

Density NumPy array.

fill(*args: Any, weight: Any | None = None, sample: Any | None = None, threads: int | None = None, **kwargs: Any) Self#

Insert data into the histogram using names and indices, return a Hist object.

fill_flattened(*args: Any, weight: Any | None = None, sample: Any | None = None, threads: int | None = None, **kwargs: Any) Self#
classmethod from_columns(data: Mapping[str, Any], axes: Sequence[str | AxisProtocol], *, weight: str | None = None, storage: Storage = Double()) Self#
integrate(name: int | str, i_or_list: InnerIndexing | list[str | int] | None = None, j: InnerIndexing | None = None) Self | float | bh.accumulators.Accumulator#
plot(*args: Any, overlay: str | None = None, **kwargs: Any) Hist1DArtists | Hist2DArtists#

Plot method for BaseHist object.

plot1d(*, ax: matplotlib.axes.Axes | None = None, overlay: str | int | None = None, **kwargs: Any) Hist1DArtists#

Plot1d method for BaseHist object.

plot2d(*, ax: matplotlib.axes.Axes | None = None, **kwargs: Any) Hist2DArtists#

Plot2d method for BaseHist object.

plot2d_full(*, ax_dict: dict[str, matplotlib.axes.Axes] | None = None, **kwargs: Any) tuple[Hist2DArtists, Hist1DArtists, Hist1DArtists]#

Plot2d_full method for BaseHist object.

Pass a dict of axes to ax_dict, otherwise, the current figure will be used.

plot_pie(*, ax: matplotlib.axes.Axes | None = None, **kwargs: Any) Any#
plot_pull(func: Callable[[np.typing.NDArray[Any]], np.typing.NDArray[Any]] | str, *, ax_dict: dict[str, matplotlib.axes.Axes] | None = None, **kwargs: Any) tuple[FitResultArtists, RatiolikeArtists]#

plot_pull method for BaseHist object.

Return a tuple of artists following a structure of (main_ax_artists, subplot_ax_artists)

plot_ratio(other: hist.BaseHist | Callable[[np.typing.NDArray[Any]], np.typing.NDArray[Any]] | str, *, ax_dict: dict[str, matplotlib.axes.Axes] | None = None, **kwargs: Any) tuple[MainAxisArtists, RatiolikeArtists]#

plot_ratio method for BaseHist object.

Return a tuple of artists following a structure of (main_ax_artists, subplot_ax_artists)

profile(axis: int | str) Self#

Returns a profile (Mean/WeightedMean) histogram from a normal histogram with N-1 axes. The axis given is profiled over and removed from the final histogram.

project(*args: int | str) Self | float | Any#

Projection of axis idx.

show(**kwargs: Any) Any#

Pretty print histograms to the console.

sort(axis: int | str, key: Callable[[int], SupportsLessThan] | Callable[[str], SupportsLessThan] | None = None, reverse: bool = False) Self#

Sort a categorical axis.

stack(axis: int | str) Stack#

Returns a stack from a normal histogram axes.

sum(flow: bool = False) float | Any#

Compute the sum over the histogram bins (optionally including the flow bins).

class hist.Hist(*in_args: AxisProtocol | Tuple[int, float, float] | Storage | str, storage: Storage | str | None = None, metadata: Any | None = None, data: ndarray[Any, dtype[Any]] | None = None, label: str | None = None, name: str | None = None)#

Bases: BaseHist

class hist.NamedHist(*args: Any, **kwargs: Any)#

Bases: BaseHist

fill(weight: Any | None = None, sample: Any | None = None, threads: int | None = None, **kwargs: Any) Self#

Insert data into the histogram using names and return a NamedHist object. NamedHist could only be filled by names.

fill_flattened(obj: Any | None = None, *, weight: Any | None = None, sample: Any | None = None, threads: int | None = None, **kwargs: Any) Self#
project(*args: int | str) Self | float | Any#

Projection of axis idx.

class hist.Stack(*args: BaseHist)#

Bases: object

property axes: NamedAxesTuple#
classmethod from_dict(d: Mapping[str, BaseHist]) Self#

Create a Stack from a dictionary of histograms. The keys of the dictionary are used as names.

classmethod from_iter(iterable: Iterable[BaseHist]) Self#

Create a Stack from an iterable of histograms.

plot(*, ax: mpl.axes.Axes | None = None, **kwargs: Any) Any#

Plot method for Stack object.

project(*args: int | str) Self#

Project the Stack onto a new axes.

show(**kwargs: object) Any#

Pretty print the stacked histograms to the console.

class hist.loc(value: str | float, offset: int = 0)#

Bases: Locator

value#
class hist.rebin(factor: int | None = None, *, groups: Sequence[int] | None = None)#

Bases: object

factor#
group_mapping(axis: PlottableAxis) Sequence[int]#
groups#
hist.sum(iterable, /, start=0)#

Return the sum of a ‘start’ value (default: 0) plus an iterable of numbers

When the iterable is empty, return the start value. This function is intended specifically for use with numeric values and may reject non-numeric types.

Subpackages#

Submodules#