This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
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.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see https://gist.github.com/jpivarski/001867b9da51a47b93913a0b9809db3a | |
import concurrent.futures | |
import time | |
import glob | |
import tarfile | |
import json | |
import ast | |
import re | |
import gzip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see https://gist.github.com/jpivarski/001867b9da51a47b93913a0b9809db3a | |
import concurrent.futures | |
import time | |
import glob | |
import tarfile | |
import json | |
import ast | |
import re | |
import gzip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), |
NewerOlder