Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support asimov data in the HiFa spec #1911

Open
1 task done
kratsg opened this issue Jul 2, 2022 · 2 comments
Open
1 task done

Support asimov data in the HiFa spec #1911

kratsg opened this issue Jul 2, 2022 · 2 comments
Assignees
Labels
feat/enhancement New feature or request

Comments

@kratsg
Copy link
Contributor

kratsg commented Jul 2, 2022

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
@kratsg kratsg added feat/enhancement New feature or request needs-triage Needs a maintainer to categorize and assign labels Jul 2, 2022
@alexander-held
Copy link
Member

See also #566 which includes an example. I have seen the <Data> tag being kept in these cases as well, without any path information provided.

When considering the addition of automatic Asimov dataset generation, there needs to be a method for picking the Asimov values of free-floating parameters (assuming that "pre-fit Asimov" would be used, and I think that generally makes sense here since data might not only be missing from some channels, but also from all of them so there is no way to perform a partial fit to actual data first).

kratsg added a commit that referenced this issue Aug 10, 2022
* Raise RuntimeError for cases where channel is missing data in the XML configuration
(associated with Asimov).
   - c.f. Issue #1911
* Add tests and test XML files.
@matthewfeickert matthewfeickert removed the needs-triage Needs a maintainer to categorize and assign label Aug 10, 2022
@kratsg kratsg added wontfix This will not be worked on and removed wontfix This will not be worked on labels Aug 10, 2022
@kratsg
Copy link
Contributor Author

kratsg commented Aug 10, 2022

For now, current solution is to raise a RuntimeError.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants