Skip to content

Instantly share code, notes, and snippets.

View astrofrog's full-sized avatar

Thomas Robitaille astrofrog

View GitHub Profile
import os
import netrc
from github import Github
from batchpr import Updater
DESCRIPTION = """
This is an automated update of the astropy-helpers submodule to {0}. This
@astrofrog
astrofrog / When will Stuart be Vertical?.ipynb
Created July 6, 2017 09:45
When will Stuart (@RTWbike) be vertical relative to the ecliptic?
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import matplotlib.pyplot as plt
image = np.arange(100).reshape((10, 10))
subplot = 0
fig = plt.figure(figsize=(16, 8))
for extent in [None, [-5, 5, -5, 5]]:
# Import latest recommended constants
from astropy import constants as const
# Import constants for a specific Astropy version
from astropy.constants import ASTROPYCONST20 as const
# Import constants from a specific set
from astropy.constants import CODATA2010 as const
# In all cases, constants can then be used as e.g.
\datatype=fitshdr
| cntr| ctype1| ctype2|naxis1|naxis2| crval1| crval2| crpix1| crpix2| cdelt1| cdelt2| crota2| scale| ra1| dec1| ra2| dec2| ra3| dec3| ra4| dec4| URL| file|
| int| char| char| int| int| double| double| double| double| double| double| double| double| double| double| double| double| double| double| double| double| char| char|
2392679 RA---SIN DEC--SIN 512 1024 10.411536 41.114164 256.50 512.50 -0.00027778 0.00027778 0.01415 0.90373 10.5057657 40.9719206 10.3173994 40.9718856 10.3168972 41.2563303 10.5060814 41.2563655 http://irsa.ipac.caltech.edu/ibe/data/t
#!/bin/bash -x
set -e
source activate asv
cd astropy-benchmarks
git clean -fxd
git checkout master
git pull origin master
taskset -c 0 asv run NEW
from astropy.wcs.utils import skycoord_to_pixel
def linear_offset_celestial_coords(wcs, center):
"""
Returns a locally linear offset coordinate system.
Given a 2-d celestial WCS object and a central coordinate, return a WCS
that describes an 'offset' coordinate system, assuming that the
coordinates are locally linear (that is, the grid lines of this offset
coordinate system are always aligned with the pixel coordinates, and
#!/usr/bin/env python
import sys
from qtpy.QtCore import QUrl, QTimer
from qtpy.QtWebEngineWidgets import QWebEngineView
from qtpy.QtWidgets import QApplication, QMainWindow
HTML = """
<html>
<head>
# TODO: deal properly with zoom
import threading
import matplotlib.pyplot as plt
import cartopy.io.img_tiles as cimgt
from PIL import Image
from PyQt5 import QtGui, QtWidgets
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
class MplCanvas(FigureCanvas):
def __init__(self, fig):
FigureCanvas.__init__(self, fig)
self.renderer = None