Interrupted workflow


In [1]:
import numpy as np
import physt

%matplotlib inline

In [2]:
histogram = physt.h1(None, "fixed_width", bin_width=0.1, adaptive=True)
histogram


Out[2]:
Histogram1D(bins=(0,), total=0, dtype=int64)

In [3]:
# Big chunk of data
data1 = np.random.normal(0, 1, 10000000)
histogram.fill_n(data1)
histogram


Out[3]:
Histogram1D(bins=(106,), total=10000000, dtype=int64)

In [4]:
histogram.plot()


Out[4]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f5527d8e9b0>

Store the histogram:


In [5]:
histogram.to_json(path="./histogram.json");
del histogram

Turn off the machine, go for lunch, return home later...

Read the histogram:


In [6]:
histogram = physt.io.load_json(path="./histogram.json")
histogram


Out[6]:
Histogram1D(bins=(106,), total=10000000, dtype=int64)

In [7]:
histogram.plot()


Out[7]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f5527b47748>

The same one ;-)

Continue filling:


In [8]:
# Another big chunk of data
data1 = np.random.normal(3, 2, 10000000)
histogram.fill_n(data1)
histogram


Out[8]:
Histogram1D(bins=(212,), total=20000000, dtype=int64)

In [9]:
histogram.plot()


Out[9]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f552799d320>