Skip to content

Instantly share code, notes, and snippets.

View sparticlesteve's full-sized avatar

Steve Farrell sparticlesteve

View GitHub Profile
# Command line options parser
parser = ArgumentParser(description='TFile adding script')
add_arg = parser.add_argument
subparsers = parser.add_subparsers(dest='fileType', help='Specify files to sum, e.g. "ana", "fr", "mm"')
# ana files
ana_parser = subparsers.add_parser('ana', help='sum AnaHists files')
add_ana_arg = ana_parser.add_argument
add_ana_arg('-r', '--regions', nargs='*', default=[])
@sparticlesteve
sparticlesteve / gist:227d2e7197a0af7477f3
Created May 1, 2014 00:59
Happy birthday, Serhan!
import datetime
from coolpeople import serhan
today = datetime.date.today()
if today == datetime.date(2014, 4, 30):
print 'HAPPY BIRTHDAY!'
serhan.age += 1
serhan.ponder_inevitable_demise()
@sparticlesteve
sparticlesteve / xAODPythonMacro.py
Last active October 26, 2021 02:35
PyROOT macro for the PyROOT-xAOD hands-on session of the LBL ATLAS Software Tutorial with xAOD
#!/usr/bin/env python
# Set up ROOT and RootCore
import ROOT
ROOT.gROOT.Macro('$ROOTCOREDIR/scripts/load_packages.C')
# Initialize the xAOD infrastructure
ROOT.xAOD.Init()
# Set up the input files (PDSF)
@sparticlesteve
sparticlesteve / sys_equality_error.py
Created May 4, 2015 18:39
Demonstrate error from operator== usage for SystematicVariation
#!/usr/bin/env python
from ROOT import gROOT
gROOT.SetBatch()
from ROOT import gSystem
gSystem.Load('libPATInterfaces.so')
from ROOT import CP
from ROOT.CP import SystematicVariation
# Get the equality operator
@sparticlesteve
sparticlesteve / snippet.cpp
Created January 14, 2016 22:26
OR tool init in SUSYTools for RootCore
// /////////////////////////////////////////////////////////////////////////////////////////
// Initialise Overlap Removal Tool
if (m_orTool.empty()) {
std::string suffix = "";
if (m_doTauOR) suffix += "Tau";
if (m_doPhotonOR) suffix += "Gamma";
std::string bJetLabel = "";
if (m_doBjetOR) {
suffix += "Bjet";
bJetLabel = "bjet_loose";
from __future__ import print_function
import h5py
input_file = '/project/projectdirs/atlas/sfarrell/atlas_dl/hdf5/prod002_2016_11_10/GG_RPV10_1400_850.h5'
with h5py.File(input_file, 'r') as hf:
keys = hf.keys()
print('Loading %d events' % len(keys))
print('Contents of the first event:')
event = hf.get(keys[0])
print(event.keys())
@sparticlesteve
sparticlesteve / build_pytorch.sh
Created August 14, 2018 20:37
Instructions to build pytorch with CRAY MPICH
# Make a conda env
conda create -y --prefix $INSTALL_DIR python=3.6
conda activate $INSTALL_DIR
conda install -y numpy pyyaml mkl mkl-include setuptools cmake cffi typing
conda install -y -c mingfeima mkldnn
# Configure the build using Cray compiler wrappers cc, CC
export CMAKE_PREFIX_PATH="$(dirname $(which conda))/../"
export CXX=CC
export CC=cc
@sparticlesteve
sparticlesteve / build_horovod.sh
Created August 14, 2018 20:40
Instructions used to try and build horovod with Cray MPICH
conda activate $INSTALL_DIR
# Set compile flags
export CRAYPE_LINK_TYPE=dynamic
export CC=CC
export CXX=CC
export CFLAGS="-g"
export CXXFLAGS="-g"
export HOROVOD_MPICXX_SHOW="$PWD/showMPI.sh"
export HOROVOD_WITHOUT_TENSORFLOW=1
@sparticlesteve
sparticlesteve / pytorch_build.log
Last active August 14, 2018 21:53
output of build_pytorch.sh
Solving environment: ...working... done
## Package Plan ##
environment location: /global/cscratch1/sd/sfarrell/conda/pytorch-horovod/v0.4.0
added / updated specs:
- python=3.6
@sparticlesteve
sparticlesteve / horovod_build.log
Created August 14, 2018 21:52
output of build_horovod.sh
+ cd /global/cscratch1/sd/sfarrell/pytorch-build/pytorch-horovod/v0.4.0
+ git clone -b v0.13.11 [email protected]:uber/horovod.git
Cloning into 'horovod'...
Note: checking out '641a1dea212d81d15e28b07e1e4484b46150a53f'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may