Skip to content

Support asimov data in the HiFa spec #1911

@kratsg

Description

@kratsg

Summary

As it turns out, the HistFactory XML spec allows for <Channel /> with no <Data />. In those cases, it seems that Asimov data is used instead.

We don't currently do this in pyhf. Actually, we haven't run into a spec from a user yet where <Data/> was missing so we never caught the uncovered case that I found in readxml.py as part of #1909 while I'm adding typehints there. Specifically:

pyhf/src/pyhf/readxml.py

Lines 229 to 233 in acde7f4

data = channel.findall('Data')
if data:
parsed_data = process_data(data[0], rootdir, inputfile, histopath)
else:
parsed_data = None
- parsed_data = None can happen which means that when we write out the observations, we will have 'data': None which is not allowed by the HiFa JSON spec right now (but it technically should be).

In the situation when there's no data for a channel, we should probably generate asimov data for it, but this feels very "magical" to me, but maybe functionality users will want, even if it appears that most frameworks (exporting to XML+ROOT) are not using this right now.

Additional Information

Code of Conduct

  • I agree to follow the Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions