Skip to content

Instantly share code, notes, and snippets.

View jpivarski's full-sized avatar

Jim Pivarski jpivarski

  • University of Chicago
View GitHub Profile
@jpivarski
jpivarski / matplotlib-awkward.ipynb
Created July 29, 2020 16:36
Matplotlib should fail for unflattened arrays (as it does here)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Requires scikit-hep/uproot4#35.

>>> import uproot4
>>> tbranchelement1 = uproot4.open("Event.root : T/fH")
>>> tbranchelement1
<TBranchElement 'fH' at 0x7f5ef03c92d0>
>>> tbranchelement1.interpretation
AsObjects(Model_TH1F)
>>> tbranchelement1.array(library="np", entry_stop=5)
@jpivarski
jpivarski / growablebuffer.py
Last active April 1, 2020 16:40
GrowableBuffer in Numba
import sys
import operator
import numpy
# Note: these are pre-0.49 locations; things move around in Numba 0.49.
import numba
import numba.typing.arraydecl
# First, let's define the class in Python.
@jpivarski
jpivarski / hist.py
Last active April 22, 2019 07:46
Functional histogram slice proposal
import numbers
import math
import numpy
class Binning:
"Abstract superclass of all binning types. Only Regular is implemented."
def __init__(self, *args, **kwargs):
raise NotImplementedError
@jpivarski
jpivarski / xsimd.ipynb
Last active August 13, 2018 14:58
AVX-512 cumsum implementation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jpivarski
jpivarski / ReadOneBranch.java
Last active November 4, 2016 17:50
Performance test comparison of C++ ROOT and Java ROOT
import hep.io.root.core.RootInput;
import hep.io.root.*;
import hep.io.root.interfaces.*;
public class ReadOneBranch {
final static long itemsPerPrint = 100000L;
static long lastTime = 0L;
static long items = 0;
private static void printout() {