Skip to content

Commit

Permalink
Use pyhf contrib's download to get pallet
Browse files Browse the repository at this point in the history
Allows for getting everything cleanly from central location of HEPData
repo for published analysis
  • Loading branch information
matthewfeickert committed Oct 26, 2020
1 parent 7f4d64c commit ca05bb1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions demo_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
NUM_RUNS = 70
import requests
from funcx.sdk.client import FuncXClient
from pyhf.contrib.utils import download

pyhf_endpoint = 'a727e996-7836-4bec-9fa2-44ebf7ca5302'

Expand Down Expand Up @@ -40,13 +41,16 @@ def infer_hypotest(w, metadata, doc):

infer_func = fxc.register_function(infer_hypotest)

data = requests.get('https://gist.githubusercontent.com/lukasheinrich/75b80a2f8bc49e365bfb96e767c8a726/raw/a0946bc7590c76fec2b70de2f6f46208c0545c8d/BkgOnly.json').json()
# locally get pyhf pallet for analysis
download("https://doi.org/10.17182/hepdata.90607.v3/r3", "1Lbb-pallet")
with open("1Lbb-pallet/BkgOnly.json") as bkgonly_json:
bkgonly_workspace = json.load(bkgonly_json)

prepare_task = fxc.run(data, endpoint_id=pyhf_endpoint, function_id=prepare_func)
prepare_task = fxc.run(bkgonly_workspace, endpoint_id=pyhf_endpoint, function_id=prepare_func)

# While this cooks, let's read in the patch set
patches = None
with open('patchset.json') as f:
with open('1Lbb-pallet/patchset.json') as f:
patches = json.load(f)
patch = patches['patches'][0]
name = patch['metadata']['name']
Expand Down

0 comments on commit ca05bb1

Please sign in to comment.