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

pyhf xml2json|pyhf cls / pyhf cls wspace.json #204

Closed
lukasheinrich opened this issue Aug 24, 2018 · 0 comments
Closed

pyhf xml2json|pyhf cls / pyhf cls wspace.json #204

lukasheinrich opened this issue Aug 24, 2018 · 0 comments
Labels
feat/enhancement New feature or request

Comments

@lukasheinrich
Copy link
Contributor

lukasheinrich commented Aug 24, 2018

Description

subject to #203

but this would be nice

import pyhf.utils
import json
d = json.load(open('./test.json'))
from pyhf import Model
p = Model({'channels':d['channels']}, poiname='SigXsecOverSM')
result = pyhf.utils.runOnePoint(1.0, d['data']['channel1'] + p.config.auxdata, p)
json.dumps({'CLs_obs': result[-2].tolist()[0], 'CLs_exp': result[-1].ravel().tolist()})

returns

'{"CLs_obs": 0.5250899403989365, "CLs_exp": [0.005398954300520573, 0.02413688765551562, 0.0955643537176678, 0.30007471275202563, 0.6452061679174199]}'

once workspaces are on hepdata we could do

curl http://hepdata.net/ins12345/workspace.json | pyhf cls

and to reinterpret for RECAST

curl http://hepdata.net/ins12345/workspace.json | pyhf cls --patch newsignal.json
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