Skip to content

Instantly share code, notes, and snippets.

import BaseHTTPServer
def run_while_true(server_class=BaseHTTPServer.HTTPServer,
handler_class=BaseHTTPServer.BaseHTTPRequestHandler):
"""
This assumes that keep_running() is a function of no arguments which
is tested initially and after each request. If its return value
is true, the server continues.
"""
@astrofrog
astrofrog / warnings.log
Created February 17, 2014 17:09
Astropy documentation warnings in nitpicky mode
This file has been truncated, but you can view the full file.
/Users/tom/Dropbox/Code/development/Astropy/astropy/docs/api/astropy.config.configuration.ConfigurationItem.rst:7: WARNING: py:class reference target not found: object
/Users/tom/Dropbox/Code/development/Astropy/astropy/docs/api/astropy.config.configuration.ConfigurationItem.rst:37: WARNING: py:obj reference target not found: configspec
/Users/tom/Dropbox/Code/development/Astropy/astropy/docs/api/astropy.config.configuration.ConfigurationItem.rst:37: WARNING: py:obj reference target not found: configobj
/Users/tom/Dropbox/Code/development/Astropy/astropy/docs/api/astropy.config.configuration.ConfigurationItem.rst:54: WARNING: py:obj reference target not found: module
[u"ConfigurationItem(name, defaultvalue=u'', description=None, cfgtype=None, module=None)", u':module: astropy.config.configuration', u'', u'Bases: :class:`object`', u'', u'', u'', u'A setting and associated value stored in the astropy configuration', u'files.', u'', u'These objects are typically defined at the top of astropy subpackages', u'or a
@astrofrog
astrofrog / find_order.py
Created February 18, 2014 14:53
Find order to switch octree from xyz to zyx and vice-versa
def find_order(refined):
"""
Find the index array to use to sort the ``refined`` and ``density`` arrays.
"""
order = np.zeros(refined.shape)
if not refined[0]:
return [0]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/Users/tom/Dropbox/Code/development/Astropy/astropy/docs/api/astropy.coordinates.angles.Longitude.rst:58: WARNING: [astropyautosummary] public object wrap_angle does not have a docstring
/Users/tom/Dropbox/Code/development/Astropy/astropy/docs/api/astropy.coordinates.builtin_systems.AltAz.rst:87: WARNING: [astropyautosummary] public object alt does not have a docstring
/Users/tom/Dropbox/Code/development/Astropy/astropy/docs/api/astropy.coordinates.builtin_systems.AltAz.rst:87: WARNING: [astropyautosummary] public object az does not have a docstring
/Users/tom/Dropbox/Code/development/Astropy/astropy/docs/api/astropy.coordinates.builtin_systems.AltAz.rst:87: WARNING: [astropyautosummary] public object equinox does not have a docstring
/Users/tom/Dropbox/Code/development/Astropy/astropy/docs/api/astropy.coordinates.builtin_systems.AltAz.rst:87: WARNING: [astropyautosummary] public object obstime does not have a docstring
/Users/tom/Dropbox/Code/development/Astropy/astropy/docs/api/astropy.coordinates.builtin_s
import pyavm
from matplotlib import pyplot as plt
from wcsaxes import WCS
from PIL import Image
avm = pyavm.AVM.from_image('gcenter.jpg')
wcs = avm.to_wcs(target_image='gcenter.jpg')
fig = plt.figure()
Last login: Sun Mar 16 09:49:43 on ttys055
$ git clone git://github.com/embray/astropy.git
Cloning into 'astropy'...
remote: Counting objects: 55003, done.
remote: Compressing objects: 100% (14226/14226), done.
remote: Total 55003 (delta 40287), reused 55003 (delta 40287)
Receiving objects: 100% (55003/55003), 26.29 MiB | 1.31 MiB/s, done.
Resolving deltas: 100% (40287/40287), done.
Checking connectivity... done
$ cd astropy/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@astrofrog
astrofrog / sun_zoom_plot.py
Created March 19, 2014 22:07
Made with WCSAxes
import numpy as np
from astropy.wcs import WCS
from astropy.io import fits
from astropy import units as u
import matplotlib.pyplot as plt
from wcsaxes import WCSAxes
from sunpy.cm import get_cmap
## Definition of solar transforms (needed for now) ##