Skip to content

Instantly share code, notes, and snippets.

@dfm
dfm / live-intro-to-jax.ipynb
Last active Mar 29, 2022
Live coded notebooks for the GPRV workshop. Check out https://github.com/dfm/gprv for more self contained versions.
View live-intro-to-jax.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dfm
dfm / numpyro_ncx2.py
Last active Jul 13, 2021
Noncentral chi squared distribution
View numpyro_ncx2.py
import tensorflow_probability.substrates.jax as tfp
import jax.numpy as jnp
import jax.scipy as jsp
from jax import lax
import jax.random as random
from numpyro.distributions import constraints
from numpyro.distributions.distribution import Distribution
from numpyro.distributions.util import is_prng_key, promote_shapes, validate_sample
def _random_chi2(key, df, shape=(), dtype=jnp.float_):
@dfm
dfm / environment.yml
Last active Jul 2, 2021
My default environment
View environment.yml
channels:
- conda-forge
dependencies:
- python =3.9
- numpy
- mkl-service
- scipy
- matplotlib
- jupyter
- jupyterlab
@dfm
dfm / rtds_mirror.py
Last active May 30, 2021
A script to download a mirror copy of all of the generated docs for a ReadTheDocs project. httrack must be installed for this to work and you'll need to provide an API token for RTDs.
View rtds_mirror.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import time
import json
import argparse
import requests
import tempfile
View emcee_pz_dist.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View deterministic_op.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View mp-bug.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View eleanor_profile.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gaia_lbol.py
from astropy.io import ascii
import astropy.units as u
from astropy.coordinates import SkyCoord
from astroquery.gaia import Gaia
def find_one(ra, dec, mag):
coord = SkyCoord(ra=ra, dec=dec, unit=(u.deg, u.deg))
radius = 5 * u.arcsec
j = Gaia.cone_search_async(coord, radius)
View rot-term-demo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.