Skip to content

Instantly share code, notes, and snippets.

View jonathansick's full-sized avatar

Jonathan Sick jonathansick

View GitHub Profile
@PBarmby
PBarmby / gal_radii_pb.py
Created March 4, 2014 21:16
Computes deprojected galactocentric distances
from astropy.coordinates import ICRS, Galactic, Distance, Angle
from astropy import units as u
import math as mt
import numpy as np
from astropy.table import Table, Column
# inspired by
#http://idl-moustakas.googlecode.com/svn-history/r560/trunk/impro/hiiregions/im_hiiregion_deproject.pro
def correct_rgc(coord, glx_ctr=ICRS('00h42m44.33s +41d16m07.5s'), glx_PA=Angle('37d42m54s'), glx_incl=Angle('77.5d'), glx_dist=Distance(783,unit=u.kpc)):
'''computes deprojected galactocentric distance for an object at coord,
@jonathansick
jonathansick / pypi_checklist.md
Last active August 29, 2015 14:02
A checklist for uploading to PyPI, because I always forget.

First time:

python setup.py register

Uploading a new version:

python setup.py check
@PBarmby
PBarmby / make_latex_unc_tab.py
Created January 5, 2015 00:28
Deals with making a LaTeX table with uncertainties and correct number of significant figures
from astropy.table import Table, Column, join, vstack
from uncertainties import ufloat
import astropy.units as u
def uncert_str(tab_row, col_name, value_fmt):
''' format tab_row[col_name] single table row in LaTeX $num \pm unc$ format
input: tab_row: single row from an astropy table
col_name: name of column to be extracted and formatted
value_fmt: format for string output
output:
import cPickle as pickle
import numpy as np
from bson.binary import Binary
from pymongo.son_manipulator import SONManipulator
class NumpySONManipulator(SONManipulator):
def transform_incoming(self, value, collection):
if isinstance(value, (list,tuple,set)):
return [self.transform_incoming(item,collection) for item in value]
if isinstance(value,dict):
@jhoblitt
jhoblitt / graph.sh
Created November 12, 2015 16:48
Build a graph of the EUPS product dependencies
git clone https://github.com/lsst-sqre/build-graph.git
cd build-graph/
wget https://raw.githubusercontent.com/lsst/versiondb/master/manifests/b1780.txt
virtualenv deps
. deps/bin/activate
pip install -r requirements.txt
./deps.py b1780.txt
@tylermenezes
tylermenezes / drafttypekit.userscript.js
Created December 9, 2013 22:35
Adds a personal Typekit kit to Draft
// ==UserScript==
// @name Draft Typekitizer
// @namespace http://tyler.menez.es/
// @version 1
// @description Adds Typekit to Draft
// @match http*://*.draftin.com/*
// @copyright 2013 Tyler Menezes
// ==/UserScript==
(function() {
@jmatt
jmatt / change-resource-record-sets.json
Created October 12, 2015 20:03
Bash command to add CNAME
{
"Comment": "A new CNAME for jsick's Read the Docs documentation.",
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "docs.lsst.codes.",
"Type": "CNAME",
"SetIdentifier" : "Read the Docs",
"Weight": 10,

EUPS distrib binary "tarball" products

The EUPS distrib facility (eups distrib ...) has support for packaging and publishing binary builds in a package format called "tarballs". Unlike the "eupspkg" (source) package format that was the sole DM published product format, "tarballs" are inherently tied to the microarchitecture and ABI of a platform. As there are currently multiple supported "stack" build platforms, a means of coordinating multiple independent binary builds from identical sources is needed both to ensure consistency of product versions across platforms and

@fccoelho
fccoelho / cgibbs.pyx
Created December 28, 2010 09:37
Comparison of MCMC implementations in Python and Cython. This is discussed here: http://pyinsci.blogspot.com/2010/12/efficcient-mcmc-in-python.html
'''
Pure cython version
compile with:
$ cython cgibbs.pyx
$ gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing -I/usr/include/python2.6 -o cgibbs.so cgibbs.c
then import from python shell and call main()
'''
import random,math, time
@matthewmccullough
matthewmccullough / gist:47267
Created January 15, 2009 05:15 — forked from halbtuerke/gist:31934
Show Git dirty status in your Unix bash prompt (symbols not compatible with CygWin)
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"