Skip to content

Instantly share code, notes, and snippets.

Avatar

Joosep Pata jpata

View GitHub Profile
View mlpf_evaluate.py
import tensorflow as tf
import numpy as np
#download model_full from https://jpata.web.cern.ch/jpata/2101.08578/v2/model_full.tar.gz
#untar the archive
#note that the custom loss is not included!
model = tf.keras.models.load_model("model_full")
model.summary()
#(batch size, elements in event, features)
@jpata
jpata / 32066.patch
Created Nov 23, 2020
32066 remove friend class
View 32066.patch
diff --git a/CondFormats/EcalObjects/interface/EcalMustacheSCParameters.h b/CondFormats/EcalObjects/interface/EcalMustacheSCParameters.h
index f5d44be83fc..65ab6127780 100644
--- a/CondFormats/EcalObjects/interface/EcalMustacheSCParameters.h
+++ b/CondFormats/EcalObjects/interface/EcalMustacheSCParameters.h
@@ -6,14 +6,8 @@
#include "CondFormats/Serialization/interface/Serializable.h"
-namespace reco {
- class MustacheSCParametersHelper;
@jpata
jpata / test_root.py
Created May 11, 2020
ROOT histogram bins
View test_root.py
import ROOT
from test_uproot import vals
if __name__ == "__main__":
h = ROOT.TH1D("h", "h", 10, 0, 1)
for v in vals:
h.Fill(v)
print("h1")
@jpata
jpata / mylib.cc
Created May 23, 2019
numba CFFI class method C wrapper
View mylib.cc
//compile with g++ -fPIC mylib.cc -shared -o mylib.dylib
class MyClass {
public:
MyClass(const char* filename) {
//do something with filename
}
double func(int a) {
//an expensive C++ function
@jpata
jpata / example_job.jdl
Last active Sep 4, 2019
Example Tier2 batch job
View example_job.jdl
Universe = vanilla
Executable = example_job.sh
Arguments = 10
#The logs directory must exist
Log = logs/example_job.$(Cluster).log
Output = logs/example_job.out.$(Cluster).$(Process)
Error = logs/example_job.err.$(Cluster).$(Process)
@jpata
jpata / simple_loop.cc
Created Aug 24, 2018
Simple event loop on NanoAOD
View simple_loop.cc
//Compile with:
//c++ `root-config --cflags --libs --evelibs` -Wno-unsequenced -O3 code/simple_loop.cc -o simple_loop
#include <iostream>
#include <map>
#include <string>
#include <TFile.h>
#include <TROOT.h>
#include <TH1D.h>
View files
[SingleElectron]
/store/user/jpata/tth/Mar29_rereco_v1/SingleElectron/Mar29_rereco_v1/170329_155828/0000/tree_1.root = 0
/store/user/jpata/tth/Mar29_rereco_v1/SingleElectron/Mar29_rereco_v1/170329_155828/0000/tree_10.root = 14136
/store/user/jpata/tth/Mar29_rereco_v1/SingleElectron/Mar29_rereco_v1/170329_155828/0000/tree_100.root = 27350
/store/user/jpata/tth/Mar29_rereco_v1/SingleElectron/Mar29_rereco_v1/170329_155828/0000/tree_101.root = 25062
/store/user/jpata/tth/Mar29_rereco_v1/SingleElectron/Mar29_rereco_v1/170329_155828/0000/tree_102.root = 22851
/store/user/jpata/tth/Mar29_rereco_v1/SingleElectron/Mar29_rereco_v1/170329_155828/0000/tree_103.root = 30098
/store/user/jpata/tth/Mar29_rereco_v1/SingleElectron/Mar29_rereco_v1/170329_155828/0000/tree_104.root = 25321
/store/user/jpata/tth/Mar29_rereco_v1/SingleElectron/Mar29_rereco_v1/170329_155828/0000/tree_105.root = 13815
/store/user/jpata/tth/Mar29_rereco_v1/SingleElectron/Mar29_rereco_v1/170329_155828/0000/tree_106.root = 14586
@jpata
jpata / diff-setup.py
Created Sep 20, 2016
root_numpy setup.py patch
View diff-setup.py
diff --git a/setup.py b/setup.py
index 6569037..48d1603 100755
--- a/setup.py
+++ b/setup.py
@@ -80,8 +80,9 @@ librootnumpy = Extension(
extra_compile_args=root_cflags + [
'-Wno-unused-function',
'-Wno-write-strings',
+ '-mmacosx-version-min=10.7'
],
View rootcxx.jl
using Cxx
const ROOT_PATH = "/Users/joosep/Documents/root-build/"
addHeaderDir(joinpath(ROOT_PATH, "include"), kind=C_System)
for lib in ["Core", "RIO", "Hist"]
Libdl.dlopen("$ROOT_PATH/lib$lib.so", Libdl.RTLD_GLOBAL)
end
cxx"""#include <TFile.h> """
cxx"""#include <TH1D.h> """
View test_profile.py
import cProfile, time
def func():
s = 0
for i in range(100000):
s += i
p = cProfile.Profile(time.clock)
p.runcall(func)
p.print_stats()