Reprs in Jupyter

Reprs in Jupyter#

Hist has custom reprs when displaying in a Jupyter.

[1]:
import numpy as np

from hist import Hist
[2]:
Hist.new.Reg(50, 1, 2).Double().fill(np.random.normal(1.5, 0.3, 10_000))
[2]:
1 2 Axis 0
Regular(50, 1, 2, label='Axis 0')

Double() Σ=9039.0 (10000.0 with flow)
[3]:
Hist.new.Reg(50, 0, 2 * 3, circular=True).Double().fill(
    np.random.normal(1.5, 0.7, 10_000)
)
[3]:
Regular(50, 0, 6, circular=True, label='Axis 0')

Double() Σ=10000.0
[4]:
Hist.new.Reg(50, 0, 2).Reg(50, 10, 20).Double().fill(
    np.random.normal(1, 0.5, 10_000), np.random.normal(15, 3, 10_000)
)
[4]:
0 2 10 20 Axis 0 Axis 1
Regular(50, 0, 2, label='Axis 0')
Regular(50, 10, 20, label='Axis 1')

Double() Σ=8666.0 (10000.0 with flow)
[5]:
Hist.new.Reg(50, 0, 2).Reg(50, 10, 20).Reg(2, 3, 4).Double()
[5]:
Hist(
  Regular(50, 0, 2, label='Axis 0'),
  Regular(50, 10, 20, label='Axis 1'),
  Regular(2, 3, 4, label='Axis 2'),
  storage=Double())