Skip to content

Instantly share code, notes, and snippets.

@dfm
dfm / settings.json
Created February 17, 2023 13:44
Settings for using tectonic with LaTeX Workshop in VSCode
{
"latex-workshop.latex.external.build": {
"command": "tectonic",
"args": ["--print", "--synctex", "%DOC%.tex"]
}
}
% Expand NASA ADS journal macros
% ref: https://ui.adsabs.harvard.edu/help/actions/journal-macros
@string{aas="American Astronomical Society Meeting Abstracts"}
@string{aj="Astronomical Journal"}
@string{actaa="Acta Astronomica"}
@string{araa="Annual Review of Astron and Astrophysis"}
@string{apj="Astrophysical Journal"}
@string{apjl="Astrophysical Journal, Letters"}
@string{apjs="Astrophysical Journal, Supplement"}
@string{ao="Applied Optics"}
@dfm
dfm / intro-to-jax-part3.ipynb
Created June 28, 2022 22:38
intro-to-jax-part3.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dfm
dfm / intro-to-jax-part2.ipynb
Created June 28, 2022 22:38
intro-to-jax-part2.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dfm
dfm / live-intro-to-jax.ipynb
Last active March 29, 2022 05:15
Live coded notebooks for the GPRV workshop. Check out https://github.com/dfm/gprv for more self contained versions.
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 July 13, 2021 16:11
Noncentral chi squared distribution
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 July 2, 2021 21:51
My default environment
channels:
- conda-forge
dependencies:
- python =3.9
- numpy
- mkl-service
- scipy
- matplotlib
- jupyter
- jupyterlab
@dfm
dfm / rtds_mirror.py
Last active May 30, 2021 18:28
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.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import time
import json
import argparse
import requests
import tempfile
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.