Skip to content

Instantly share code, notes, and snippets.

View aminnj's full-sized avatar

Nick Amin aminnj

  • Austin, TX
View GitHub Profile
@aminnj
aminnj / networkx_plotly.ipynb
Created March 24, 2022 00:53
networkx + plotly
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aminnj
aminnj / matplotlibkeynote.py
Created January 23, 2022 05:46
Matplotlib style to mimic keynote chart style
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
def keynote_style(ax=None):
if ax is None:
ax = plt.gca()
ax.grid(which="major", axis="y")
ax.set_axisbelow(True)
for k in ["left", "right", "top"]:
@aminnj
aminnj / clipboardcolors.py
Created January 23, 2022 03:07
Get color palette of image on the clipboard
# requires
# numpy, PIL (and IPython, if you keep in the HTML repr stuff)
import itertools
import numpy as np
def _image_from_clipboard(algo="png"):
if algo == "jpeg":
from PIL import ImageGrab
im = ImageGrab.grabclipboard().convert("RGB")
@aminnj
aminnj / anscombe.ipynb
Last active January 15, 2022 01:12
Anscombe's quartet
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aminnj
aminnj / hist3drepr.ipynb
Created October 5, 2021 07:33
hist3d repr FHist
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aminnj
aminnj / rootbenchmarks.md
Last active September 15, 2021 20:21
Comparing unroot/root/uproot

Tree information

Open data DoubleMuon dataset: ~62M events, 150M muons, ~2GB with zlib

Converted to uncompressed, LZ4, LZMA versions with

hadd -O -f0 uncompressed_Run2012BC_DoubleMuParked_Muons.root Run2012BC_DoubleMuParked_Muons.root
@aminnj
aminnj / animals.txt
Created September 8, 2021 00:14
emojis instead of animals for MacroTools.jl
©
®
@aminnj
aminnj / ganttunroot.ipynb
Created September 4, 2021 02:35
gantt for threading in unroot
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aminnj
aminnj / fhistcollection.md
Created September 2, 2021 02:13
make a collection of FHist objects

This macro will pass through definitions of FHist histograms and make a dictionary encapsulating them.

macro histcollection(ex)
    hists = Symbol[]
    for line in ex.args
        !hasproperty(line, :head) && continue
        line.head !== :(=) && continue
        varname, varbody = line.args[1:2]
        varbody.args[1]  (:Hist1D, :Hist2D) && continue
 push!(hists, varname)
@aminnj
aminnj / rgbpoly.ipynb
Created August 20, 2021 03:33
matplotlib color scale to rgb polynomial
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.