Skip to content

Instantly share code, notes, and snippets.

View kratsg's full-sized avatar

Giordon Stark kratsg

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import requests
import subprocess
import itkdb
fpath = "~/VBFSUSY_13_Higgsino_150.root"
eos_path = "/eos/atlas/test/itkpd/d/e/8/debug_ewans_file"
data = requests.post(f'https://itkpd2eos.unicornuniversity.net/generate-token?path={eos_path}&permissions=rw')
eos_token = data.json()['token']
import itkdb
#image = itkdb.data / "1x1.jpg"
import pathlib
image = pathlib.Path("/Users/kratsg/VBFSUSY_13_Higgsino_150.root")
import logging
import textwrap
logger = logging.getLogger('httplogger')
{
"channels": [
{
"name": "electron_channel",
"samples": [
{ "name": "main", "data": [ 50, 100 ],
"modifiers": [
{ "name": "mu", "type": "normfactor", "data": null },
{ "name": "uncorrelated_el", "type": "normsys", "data": { "hi": 1.1, "lo": 0.9 } },
{ "name": "correlated", "type": "normsys", "data": { "hi": 1.1, "lo": 0.7 } }
import numpy as np
import onnx
import onnxruntime
import uproot
import h5py
import json
model="./SimpleAnalysisCodes/data/ThreeBjets_NN_2020_model.onnx"
session = onnxruntime.InferenceSession(model, None)
import numpy as np
import onnx
import onnxruntime
from onnx import numpy_helper
import uproot
model="./model.onnx"
session = onnxruntime.InferenceSession(model, None)
input_name = session.get_inputs()[0].name
version: "3.8"
services:
traefik:
restart: always
image: "traefik:v2.6"
container_name: "traefik"
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kratsg
kratsg / example.py
Created April 2, 2020 18:52
python-jsonschema recursive RefResolver class
>>> import jsonschema
>>> resolver = jsonschema.RefResolver(base_uri='https://scikit-hep.org/pyhf/schemas/1.0.0/', referrer='workspace.json')
>>> rec_resolver = RecursiveRefResolver(base_uri='https://scikit-hep.org/pyhf/schemas/1.0.0/', referrer='workspace.json')
>>> resolver.resolve('https://scikit-hep.org/pyhf/schemas/1.0.0/workspace.json')
('https://scikit-hep.org/pyhf/schemas/1.0.0/workspace.json',
{'$schema': 'http://json-schema.org/draft-06/schema#',
'$id': 'https://scikit-hep.org/pyhf/schemas/1.0.0/workspace.json',
'$ref': 'defs.json#/definitions/workspace'})
>>> rec_resolver.resolve('https://scikit-hep.org/pyhf/schemas/1.0.0/workspace.json')
{'$schema': 'http://json-schema.org/draft-06/schema#',
Summary
------------------
channels 2
samples 1
parameters 42
modifiers 42
channels nbins
---------- -----
electron 12