Skip to content

Instantly share code, notes, and snippets.

View davidwhogg's full-sized avatar

David W. Hogg davidwhogg

View GitHub Profile
@davidwhogg
davidwhogg / Joaquin_W_Hogg.ipynb
Last active June 25, 2022 18:43
Testing components of Joaquin
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.
@davidwhogg
davidwhogg / XP-APOGEE.ipynb
Last active June 23, 2022 00:23
A notebook for the Gaia Hike
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davidwhogg
davidwhogg / ImagePhaseSandbox.ipynb
Created October 26, 2019 16:44 — forked from adrn/ImagePhaseSandbox.ipynb
ImagePhaseSandbox.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davidwhogg
davidwhogg / Simple-Linear-Nonlinear-Inference.ipynb
Created October 5, 2019 14:00 — forked from adrn/Simple-Linear-Nonlinear-Inference.ipynb
hq/notebooks/Simple-Linear-Nonlinear-Inference.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davidwhogg
davidwhogg / Galah-demo.ipynb
Created July 18, 2018 07:32 — forked from adrn/Galah-demo.ipynb
Galah-for-Hogg.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davidwhogg
davidwhogg / Get_all_the_TGAS_data_by_curl.sh
Created September 14, 2016 10:56
Get all the TGAS data by curl
#!/bin/bash
curl -O http://cdn.gea.esac.esa.int/Gaia/tgas_source/fits/TgasSource_000-000-000.fits
curl -O http://cdn.gea.esac.esa.int/Gaia/tgas_source/fits/TgasSource_000-000-001.fits
curl -O http://cdn.gea.esac.esa.int/Gaia/tgas_source/fits/TgasSource_000-000-002.fits
curl -O http://cdn.gea.esac.esa.int/Gaia/tgas_source/fits/TgasSource_000-000-003.fits
curl -O http://cdn.gea.esac.esa.int/Gaia/tgas_source/fits/TgasSource_000-000-004.fits
curl -O http://cdn.gea.esac.esa.int/Gaia/tgas_source/fits/TgasSource_000-000-005.fits
curl -O http://cdn.gea.esac.esa.int/Gaia/tgas_source/fits/TgasSource_000-000-006.fits
curl -O http://cdn.gea.esac.esa.int/Gaia/tgas_source/fits/TgasSource_000-000-007.fits
curl -O http://cdn.gea.esac.esa.int/Gaia/tgas_source/fits/TgasSource_000-000-008.fits
import numpy as np
from scipy.interpolate import interp1d
def weighted_median(xs, ws=None):
if ws is None:
ws = np.ones_like(xs)
totalw = np.sum(ws)
sindx = np.argsort(xs) # expensive
cs = np.cumsum(ws[sindx]) / totalw
symcumsum = 0.5 * (cs + np.append(0., cs[0:-1]))
import numpy as np
def hoggsumexp(qns, dqn_dams, diag=False):
"""
# purpose:
- Computes L = log(sum(exp(qns, axis=-1))).
- Also computes its M-dimensional gradient components dL / da_m.
# input
- qns: ndarray of shape [n1, n2, n3, ..., nD, N]
@davidwhogg
davidwhogg / gist:4719653
Created February 6, 2013 02:13
:nyantocat:
<img width="20" height="20" align="absmiddle" src="http://octodex.github.com/images/nyantocat.gif" class="emoji" alt=":nyantocat:">