Skip to content

Instantly share code, notes, and snippets.

View keflavich's full-sized avatar

Adam Ginsburg keflavich

View GitHub Profile
@keflavich
keflavich / packinglist
Created October 8, 2012 05:05 — forked from alissapajer/packinglist
Rainier packing list!
backpack
pack cover
hiking poles
sleeping bag
sleeping pad
tent
water bottles
camelback
water purification system
@keflavich
keflavich / log_regression.py
Created November 4, 2012 20:10 — forked from marcelcaraciolo/log_regression.py
Logistic prediction
def sigmoid(X):
'''Compute the sigmoid function '''
#d = zeros(shape=(X.shape))
den = 1.0 + e ** (-1.0 * X)
d = 1.0 / den
return d
@keflavich
keflavich / import.rb
Last active December 10, 2015 07:48 — forked from dnagir/import.rb
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
require 'uri'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
@keflavich
keflavich / image.fits
Last active December 14, 2015 05:28 — forked from cdeil/ds9_screenshot.png
SIMPLE = T / file does conform to FITS standard BITPIX = 32 / number of bits per data pixel NAXIS = 2 / number of data axes NAXIS1 = 341 / length of data axis 1 NAXIS2 = 291 / length of data axis 2 EXTEND = T / FITS dataset may contain extensions COMMENT FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H EXTNAME = 'On ' HDUNAME = 'On ' CTYPE1 = 'GLON-CAR' / Type of co-ordinate on axis 1 CTYPE2 = 'GLAT-CAR' / Type of co-ordinate on axis 2 RADESYS = ' ' / Reference frame for RA/DEC valu
"""
Match two sets of on-sky coordinates to each other.
I.e., find nearest neighbor of one that's in the other.
Similar in purpose to IDL's spherematch, but totally different implementation.
Requires numpy and scipy.
"""
from __future__ import division
import numpy as np
import pymc as pm
import numpy as np
# FIXME: Need to store duplicates too, when jumps are rejected. That means some mechanism
# for making sure the history is full-rank needs to be employed.
class HistoryCovarianceStepper(pm.StepMethod):
_state = ['n_points','history','tally','verbose']
import numpy as np
import fftw3
import pyfftw
import multiprocessing
import matplotlib
import matplotlib.pyplot as pl
import time
def fft_comparison_tests(size=2048, dtype=np.complex128, byte_align=False):
import functools
class class_or_instance(object):
def __init__(self, fn):
self.fn = fn
def __get__(self, obj, cls):
if obj is not None:
return lambda *args, **kwds: self.fn(obj, *args, **kwds)
else:
return lambda *args, **kwds: self.fn(cls, *args, **kwds)
import functools
class class_or_instance(object):
def __init__(self, fn):
self.fn = fn
def __get__(self, obj, cls):
if obj is not None:
return lambda *args, **kwds: self.fn(obj, *args, **kwds)
else:
return lambda *args, **kwds: self.fn(cls, *args, **kwds)
import numpy as np
from astropy.io import fits
header1 = """
SIMPLE = T / conforms to FITS standard
BITPIX = -64 / array data type
NAXIS = 2 / number of array dimensions
NAXIS1 = 128
NAXIS2 = 128
CRVAL1 = 0.0 / Value at ref. pixel on axis 1