Skip to content

Instantly share code, notes, and snippets.

View keflavich's full-sized avatar

Adam Ginsburg keflavich

View GitHub Profile
setup: function() {
// code to run on startup
flotoptions.yaxis.max = prompt("Enter a maximum graph height percentage, such as '50'");$.plot($("#graph"),$W.data,flotoptions);
},
draw: function() {
// code to run every frame
}
@keflavich
keflavich / smooth.js
Last active January 4, 2016 11:59 — forked from jywarren/smooth.js
Time-averaging code: average over whole spectrum, don't bother with a selection process
setup: function() {
// code to run on startup
smooth_complete = function(row) {
var orig_img = $('#image')[0]
$('body').append("<canvas id='tmp_canvas'></canvas>")
var img = new Image()
img.src = orig_img.src
var canvas = $('#tmp_canvas')[0]
canvas.width = img.width
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
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
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 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']
"""
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
@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
@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]