Closed rob-tay closed 5 years ago
Thanks, @rob-tay!
@reikdas, does this work with your developments in file-writing? (You added a superclass TH
for multi-dimensional histograms—is anything in this PR redundant with that or needs to be changed to work with that? Or is it consistent and just adds to what you've done?)
I added a comment about a possible redundant check. Apart from that looks great! :)
Maybe the explicit TH2
check is redundant after the TH
check, and if so, it should probably be removed.
Does this require a particular combination of uproot and uproot-methods versions to function properly? That is, will any combinations that are allowed by the version constraints in setup.py cause mysterious exceptions, rather than just NotImplementedError
if you're using a version that doesn't have the TH2
handling yet?
Do we need to synchronize new version constraints between uproot and uproot-methods to get this feature? (Hopefully not!)
Does this require a particular combination of uproot and uproot-methods versions to function properly? That is, will any combinations that are allowed by the version constraints in setup.py cause mysterious exceptions, rather than just
NotImplementedError
if you're using a version that doesn't have theTH2
handling yet?
Hmm, yeah this will require uproot 3.5.1 which adds the uproot.write.objects.TH.TH
class. If using a previous version then I think this will result in a ModuleNotFoundError
when importlib is used to import the TH
class
Okay, then for safety, I'll coordinate the inclusion of this PR with the next semi-major release (uproot 3.6).
I'm also revamping the lazy-array implementation—replacing uproot's custom LazyArray
class with one constructed from awkward's ChunkedArray
of VirtualArrays
. The lazy-array making methods will have slightly altered parameter lists, which suggests a new semi-major release. All of this will have to go in before an uproot HATS next week.
Adds ability to write 2D histograms created using np.histogram2d.
Changes:
from_numpy()
method added toclasses.TH2
convert.towriteable()
for directly writing to file