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 | |
import scipy as sp | |
import scipy.stats | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
size = 1e4 | |
aa = 10**np.random.normal(-2.0, size=int(size)) | |
aa = np.clip(aa, 1e-5, 1.0) | |
bb = 10**np.random.uniform(-4, 0, size=aa.size) |
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
def voronoi_mesh(path, snap_num, ndim=2, int_type=np.int32, double_type=np.float32): | |
"""Load an Arepo voronoi mesh from the 2D `voronoi_mesh_###` files. | |
""" | |
# fname = _snap_file_from_path(fname, "voronoi_mesh_{:03d}", snap_num=snap_num) | |
fname = os.path.join(path, "voronoi_mesh_{:03d}".format(snap_num)) | |
mesh = dict() | |
with open(fname, 'rb') as data: | |
# Read header |
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 | |
import matpotlib.pyplot as plt | |
import corner # From: https://github.com/dfm/corner.py | |
SKIP = 100 # Only plot 1/SKIP data points | |
fname = "./lzk-gw-data_cornish-becsy.npz" | |
data = np.load(fname) |
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 | |
import scipy as sp | |
import scipy.stats | |
import matplotlib.pyplot as plt | |
def sf_rad(mm, aa, bb): | |
rs = aa + bb * (np.log10(mm) - 10.0) | |
return np.power(10.0, rs) |
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 | |
import scipy as sp | |
import scipy.stats | |
import matplotlib.pyplot as plt | |
NUM = 100 | |
xx = np.random.uniform(-1.0, 1.0, NUM) | |
plt.hist(xx) |
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 | |
import scipy as sp | |
import scipy.stats | |
import matplotlib.pyplot as plt | |
fig, ax = plt.subplots(figsize=[8, 5]) | |
ax.set_xscale('log') | |
# Construct a log-normal distribution | |
dist = sp.stats.lognorm(1) |
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
EVOLVE_ACCRETION_FLAG = True | |
def main(): | |
mbhb, sets = run_init() | |
# ... do some check and logging and whatever ... | |
if EVOLVE_ACCRETION_FLAG: |
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
# Initialize Auto-Reloading Magic | |
%reload_ext autoreload | |
%autoreload 2 | |
import os | |
import sys | |
from importlib import reload | |
import astropy as ap | |
import numpy as np |
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 sys | |
import os | |
import numpy as np | |
import scipy as sp | |
import scipy.stats | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
# Silence annoying numpy errors |
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
#!/bin/bash | |
# Detect which `ls` flavor is in use | |
if ls --color > /dev/null 2>&1; then # GNU `ls` | |
colorflag="--color" | |
else # OS X `ls` | |
colorflag="-G" | |
fi | |
# List all files colorized in long format |
NewerOlder