Skip to content

Instantly share code, notes, and snippets.

View jpivarski's full-sized avatar

Jim Pivarski jpivarski

  • Princeton, IRIS-HEP, PyHEP, Scikit-HEP
View GitHub Profile
@jpivarski
jpivarski / orbitty.py
Last active May 3, 2024 21:04
Package to demonstrate testing
import numpy as np
class System:
G = 3
min_distance = 0.1
@classmethod
def random(cls, num_particles, num_dimensions, mass_mean, mass_width, x_width, p_width):
m = np.random.gamma(mass_mean / mass_width, mass_width, num_particles)
x = np.random.normal(0, x_width, (num_particles, num_dimensions))
@jpivarski
jpivarski / python-skills-survey-list.ipynb
Created April 23, 2024 02:00
python-skills-survey-list
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jpivarski
jpivarski / extra-stuff-2.ipynb
Last active April 3, 2024 02:17
Plan for SciPy Teen Track
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jpivarski
jpivarski / computer-breaking-probability.ipynb
Last active November 16, 2023 17:28
Computer breaking probability
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jpivarski
jpivarski / static-analysis.py
Last active November 15, 2023 21:37
Analysis of repos that use Numba
# see https://gist.github.com/jpivarski/001867b9da51a47b93913a0b9809db3a
import concurrent.futures
import time
import glob
import tarfile
import json
import ast
import re
import gzip
@jpivarski
jpivarski / static-analysis.py
Last active November 11, 2023 11:02
Static analysis of GitHub repos
# see https://gist.github.com/jpivarski/001867b9da51a47b93913a0b9809db3a
import concurrent.futures
import time
import glob
import tarfile
import json
import ast
import re
import gzip
@jpivarski
jpivarski / assign-all-argtypes.py
Created May 26, 2021 21:34
Assigning ctypes argument types to all Awkward Array kernels from the YAML specification
import yaml
import awkward as ak
arg2key = {
"List[bool]": "np.bool_",
"Const[List[bool]]": "np.bool_",
"List[int8_t]": "np.int8",
"Const[List[int8_t]]": "np.int8",
"List[uint8_t]": "np.uint8",
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jpivarski
jpivarski / life-numba.py
Last active February 6, 2023 19:43
For https://youtu.be/lhqP50YVT-I (Game of Life in Python and Numba)
import time
import numpy as np
import numba as nb
# This could also be done without a class, using @nb.jit directly.
# It just seems natural to use a class. (That *might* slow it down a little; haven't tested it.)
spec = [
("width", nb.int32),
("height", nb.int32),