dask-histogram
dask-histogram copied to clipboard
Unserializable histogram generated if computed without fill call
Originally posted here: https://github.com/scikit-hep/hist/issues/586
And I found that this issue can be replicated entirely upstream using just dask-histogram
import pickle
import boost_histogram
import dask
import dask_histogram.boost
import numpy
h = dask_histogram.boost.Histogram(boost_histogram.axis.Regular(10, 0, 1))
# h.fill( # Toggle to include a fill call
# dask.array.from_array(numpy.zeros(shape=(10))),
# weight=dask.array.from_array(numpy.zeros(shape=(10))),
# )
o = dask.compute(h)
pickle.dump(o, open("hist_dask_test.pkl", "wb"))
Without a fill call, the resulting histogram will have dangling a self._dask
field that breaks serialization.