Skip to content

Instantly share code, notes, and snippets.

Jet Tagging Tutorial

Setup Weaver and weaver-benchmark

# prerequisite: install the dependent packages
# https://github.com/hqucms/weaver#set-up-your-environmen

git clone https://github.com/hqucms/weaver.git
cd weaver
import numpy as np
import scipy.stats
import uproot
import awkward as ak
import yaml
import json
import os
import argparse
@hqucms
hqucms / convert_top.py
Created December 21, 2018 17:06
Convert top tagging dataset
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
import logging
logging.basicConfig(level=logging.DEBUG, format='[%(asctime)s] %(levelname)s: %(message)s')
import pandas as pd
@hqucms
hqucms / pdf2png.py
Last active July 11, 2017 19:35 — forked from newville/pdf2png.py
pdf2png
#!/usr/bin/env python
"""Convert PDF to PNG with convert program
"""
import sys
import subprocess
import getopt
# add -trim to avoid extra borders
convert = "convert -trim -antialias -alpha on -channel rgba -fuzz 5%"
density = 300
#!/bin/zsh
set -e
# Usage:
# rsync_parallel [--parallel=N] [rsync args...]
#
# Options:
# --parallel=N Use N parallel processes for transfer. Defaults to 10.
#
# Notes:
@hqucms
hqucms / xgboost2tmva.py
Last active March 21, 2024 17:25
Convert xgboost model to TMVA xml format. Not fully tested...
import re
import xml.etree.cElementTree as ET
regex_float_pattern = r'[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?'
def build_tree(xgtree, base_xml_element, var_indices):
parent_element_dict = {'0':base_xml_element}
pos_dict = {'0':'s'}
for line in xgtree.split('\n'):
if not line: continue
if ':leaf=' in line:
@hqucms
hqucms / tmux_local_install.sh
Last active May 23, 2019 04:31 — forked from sharjeelsayed/tmux_local_install.sh
bash script for installing tmux without root access.Updated to include latest Tmux version and some other minor changes
#!/bin/bash
# Source: https://gist.github.com/ryin/3106801
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.9a