Skip to content

Instantly share code, notes, and snippets.

@dfm
dfm / README.md
Created November 30, 2012 21:18
Sometimes I do evil things...
@dfm
dfm / astrofrog.py
Created December 1, 2012 02:16
Stochastic gradient descent example
import numpy as np
N = 5000
I_true = np.random.randn(N)
D = I_true[:, None] - I_true[None, :]
I0 = np.zeros_like(I_true)
eta = 1.0 / N # Learning rate.
tol = 1.25e-11 # Error tolerance.
@dfm
dfm / gist:4260874
Created December 11, 2012 18:30
Patch for Alberto's JS
diff --git a/old.html b/index.html
index e17fcfc..1f320f3 100644
--- a/old.html
+++ b/index.html
@@ -9,10 +9,12 @@
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet">
<link href="http://twitter.github.com/bootstrap/assets/css/docs.css" rel="stylesheet">
<link href="http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.css" rel="stylesheet">
+ <link href="ADSASS_applet/jquery-ui-1.9.2.custom.min.css" rel="stylesheet">
@dfm
dfm / gh.py
Created December 14, 2012 02:15
Get me some github repos...
import requests
@dfm
dfm / koi.py
Created December 14, 2012 20:28
Scrape the Kepler KOI page to get the parameters of the published KOIs. This might already exist but here it is anyways...
from __future__ import print_function
import requests
from bs4 import BeautifulSoup
def get_table(fn=u"koi.txt"):
url = u"http://archive.stsci.edu/kepler/planet_candidates.html"
r = requests.get(url)
if r.status_code != requests.codes.ok:
@dfm
dfm / dotastro.ipynb
Created December 16, 2012 21:30
IPython notebook from #dotastro_nyc
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dfm
dfm / koi.py
Last active December 14, 2015 05:08
import bart
# Initialize a planet.
planet = bart.Planet(r=0.01, a=21.3, t0=3.85)
planet.parameters += [bart.parameters.Parameter(r"$r$", "r"),
bart.parameters.LogParameter(r"$a$", "a")]
# Initialize the star.
ldp = bart.kepler.fiducial_ldp(teff=6438, logg=4.28, feh=0.0)
star = bart.Star(mass=planet.get_mstar(12.4138), ldp=ldp)
@dfm
dfm / README.md
Last active December 15, 2015 17:08
Figures for my talk on MCMC for data analysis
@dfm
dfm / autokep.pro
Created April 9, 2013 12:33
de-trending in TAP
pro autokep_event,event
Widget_Control, event.id, Get_UValue=info
Call_Method, info.method, info.object, event
end
@dfm
dfm / README.md
Last active December 17, 2015 16:29
emcee progress

Here's what happens if you want to display the progress of the default emcee example from the main documentation page.