Skip to content

Request for support of writing hist-derived profiles #908

Closed
@raymondEhlers

Description

@raymondEhlers

I'd like to request writing support for profile hists that are coming from hist/boost-histogram. The use case I ran into was merging some root files containing a variety of histograms. My procedure was roughly:

  1. Read file
  2. Retrieve hists, and convert using to_hist to take advantage of the __add__ functionality already implemented
  3. Add the hists
  4. Write the merged hists to file

The issue is in step 4. This works fine for standard histograms, and from the docs I understand that it should work for TProfile objects that aren't converted to hist (eg. just read by uproot, and still contained in a Model), but it doesn't work after I've done the conversion. Looking into the exception that's raised

https://github.com/scikit-hep/uproot5/blame/a9f4374607b7434ef89ebec82c784d34bfc31413/src/uproot/writing/identify.py#L248-L255

the NotImplementedError obviously suggests that profiles intentionally aren't supported at the moment, but the ValueError suggests that perhaps they were intended to be? In any case, adding support for writing profiles would be much appreciated, and would make merging hists a bit easier (this would be helpful because hadd isn't always available). Thanks!

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions