Skip to content

Instantly share code, notes, and snippets.

@joezuntz
joezuntz / parallel_loadz.ipynb
Created June 27, 2022 10:53
Parallel loadz using concurrent.futures
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joezuntz
joezuntz / cosmosis_interactive.ipynb
Last active June 23, 2022 17:00
interactive cosmosis notebook
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.
@joezuntz
joezuntz / h5py-example.ipynb
Created July 12, 2021 16:27
H5PY Basic Example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import sqlite3
import numpy as np
import astropy.table
# open DB file
con = sqlite3.connect('baseline_nexp2_v1.7_10yrs.db')
# count rows so we can make numpy arrays
n = list(con.execute("select count(*) from SummaryAllProps"))[0][0]
ra = np.zeros(n)
@joezuntz
joezuntz / compare.ipynb
Created March 24, 2021 18:14
compare cosmosis and pycamb phi-phi
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import fitsio
import healpy
import os
import numpy as np
import pylab
nside = 512
npix = healpy.nside2npix(nside)
# download DESI
@joezuntz
joezuntz / example.ipynb
Last active March 9, 2020 16:22
Example of pymultinest with derived params
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joezuntz
joezuntz / namaster.ipynb
Last active January 16, 2020 18:32
namaster attempt
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joezuntz
joezuntz / run_in_subprocess.py
Last active October 14, 2023 13:36
Python decorator to let you run a function that may kill/hang in a subprocess, isolating it.
import multiprocessing as mp
import os
import functools
from queue import Empty
class TimeoutError(Exception):
pass
def optionally_run_in_subprocess(f):
"""A decorator adding a kwarg to a function that makes it run in a subprocess.