Skip to content

Instantly share code, notes, and snippets.

@adrn
adrn / data.csv
Last active August 29, 2015 13:57
Data for hack day exercise.
# x y sigma_y
0.1029224715 6.1523941226 0.1816047467
0.1719426056 6.1203735252 0.2797154059
0.2261364446 6.0386732469 0.1232469666
0.2322520636 6.0468432274 0.4025523066
0.2904180608 6.2151388619 0.0880203776
0.3252579649 5.7345903217 0.6583423380
0.4424625103 6.2595326795 0.3846405824
0.4883605700 6.4047751371 0.1488420104
0.6101911742 6.4503687020 0.0235317241
@adrn
adrn / custom.css
Created September 15, 2014 16:44
More obvious edit mode
/* make the selected cell more obvious */
div.cell.selected {
background: #ECF0F1;
}
/* make a cell in edit mode *really* obvious */
div.cell.selected.edit_mode > div.input > div.input_prompt {
color: #ECF0F1;
background: rgb(83, 144, 107);
}
@adrn
adrn / custom.js
Created September 18, 2014 20:27
Custom cell macros in IPython Notebook
$([IPython.events]).on('app_initialized.NotebookApp', function(){
// Try to read JSON file specifying cell macros
$.getJSON("/static/custom/macros.json", function(data) {
var pickTemplateLabel = $("<span></span>")
.attr("class", "navbar-text")
.text("Cell Macro:");
var pickTemplate = $("<select></select>").attr("id", "pick_template");
@adrn
adrn / authors.txt
Created June 16, 2015 00:00
A list of Astropy contributors, sorted by first commit
# Here is a list of all Astropy contributors (as of 2015-06-15) sorted by
# date of first commit. This was generated with the git-authors script from:
# https://github.com/jgehrcke/git-authors
0001 (2011-07-25): Erik Tollerud (erik.tollerud@gmail.com)
0002 (2011-07-26): Thomas Robitaille (thomas.robitaille@gmail.com)
0003 (2011-08-10): Prasanth Nair (prasanthhn@gmail.com)
0004 (2011-08-17): Erik Bray (embray@stsci.edu)
0005 (2011-10-13): Michael Droettboom (mdboom@gmail.com)
0006 (2011-10-14): Tom Aldcroft (taldcroft@gmail.com)
0007 (2011-10-14): Matt Davis (jiffyclub.programatic@gmail.com)
@adrn
adrn / gist:3106258
Created July 13, 2012 17:50
Python pipeline function sketch
import os
import cPickle as pickle
def some_function(another_function, overwrite=False, *args, **kwargs):
if overwrite:
os.remove("somefilename.pickle")
if not os.path.exists("somefilename.pickle"):
# analysis / make object
object = another_function(*args, **kwargs)
@adrn
adrn / columbia_astropy.md
Created October 10, 2012 20:41
What do people at Columbia want in AstroPy?
  • read_ascii()
    • Probably already included in astropy.ascii
  • ascii_template()
    • Probably already included in astropy.ascii
  • ntostr() (from Erin Sheldon's sdsstools)
    • It looks like this is just pure Python...
  • helcorr.pro
    • This will be included in the coordinates subpackage (astropy.coordinates)
  • glactc.pro
  • This will be included in the coordinates subpackage (astropy.coordinates)
@adrn
adrn / README.md
Last active November 2, 2015 17:16
List all git repositories in a given path, identify which ones have commits waiting to be pushed.

git-report

List all subfolders that are git repositories within a specified path. Displays a check mark next to repositories that are up to date with origin/master. Displays a red x next to repositories with commits waiting to be pushed. Right now just compares local master branch to origin/master.

Install

I put this in ~/bin/, then add this line to my bash profile:

import matplotlib as mpl
import matplotlib.pyplot as pl
with mpl.rc_context(rc={'font.family': 'Sans Serif'}):
fig,ax = pl.subplots(1,1,figsize=(6,4))
ax.set_title(mpl.__version__)
ax.set_xscale('log')
ax.set_yscale('log')
ax.set_xlabel("test $10^5$")
from astropy.table import Table
from astropy.io import ascii
IDs = [1, 3, 6, 9, 100]
names = ["cat", "bat", "rat", "mat", "gnat"]
scores = [83, 51, 77, 81, 92]
t = Table([IDs, names, scores], names=["ID", "name", "score"])
ascii.write(t, delimiter=",")
"""
Make a figure to visualize using MCMC (in particular, the Python package
emcee) to infer 4 parameters from a parametrized model of the Milky Way's
dark matter halo by using tracer stars from the Sagittarius Stream.
If you're unfamiliar with the jargon here (walkers, Sgr, etc.), check out:
- Law & Majewski 2010
http://iopscience.iop.org/0004-637X/714/1/229/pdf/apj_714_1_229.pdf
- emcee
http://dan.iel.fm/emcee/