Skip to content

Instantly share code, notes, and snippets.

View eteq's full-sized avatar

Erik Tollerud eteq

View GitHub Profile
@eteq
eteq / issue2pr.py
Created February 6, 2012 08:23
Python function/script to convert github issues to pull requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Requires python >=2.6
"""
Tool to convert github issues to pull requests by attaching code. Uses the
github v3 API. Defaults assumed for the `astropy <http://www.astropy.org>`_
project.
"""
from __future__ import print_function
@eteq
eteq / pyspherematch.py
Last active January 29, 2020 04:42
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.
"""
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
@eteq
eteq / xkeckhelio.py
Created February 21, 2013 00:02
Heliocentric correction code for Keck observatory, based on an idl procedure from XIDL
#This is a mostly literal port of x_keckhelio.pro from XIDL (http://www.ucolick.org/~xavier/IDL/)
from __future__ import division
from math import pi
from numpy import cos, sin
import numpy as np
def x_keckhelio(ra, dec, epoch=2000.0, jd=None, tai=None,
longitude=None, latitude=None, altitude=None, obs='keck'):
"""
@eteq
eteq / apj_short_prop.bst
Created March 1, 2013 20:12
A modified version of the apj latex/bibtex bst file for funding/observing proposals where there is very little space.
%%This is often best used in a latex file in two-column mode. To do that, do:
%%
%%\usepackage{multicol} % before \begin{document}
%% ... document ...
%%\begin{multicols}{2}
%%\bibliography{filename}{}
%%\bibliographystyle{apj_short_prop}
%%\end{multicols}
@eteq
eteq / rc3.py
Created February 5, 2014 19:04
RC3 (Third Reference Catalog of Bright Galaxies, de Vacouleurs+ 91) loader
# coding: utf-8
from __future__ import print_function, division
"""
A python function to grab the RC3 catalog from vizier and parse it.
Requires `astropy <http://www.astropy.org>`_ version >= 0.3
This does not include the actual rc3 data file. The python `load_rc3` function
will get the data file automatically from
@eteq
eteq / Yoda-OO-Session2.ipynb
Last active August 29, 2015 13:57
Object-Oriented Programming intro for Astronomers (For Yale Overarching Discussion of Astro/YODA)
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.
Freezing version number to astropy/version.py
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-2.7
creating build/lib.macosx-10.9-x86_64-2.7/astropy
copying astropy/__init__.py -> build/lib.macosx-10.9-x86_64-2.7/astropy
copying astropy/conftest.py -> build/lib.macosx-10.9-x86_64-2.7/astropy
copying astropy/logger.py -> build/lib.macosx-10.9-x86_64-2.7/astropy
copying astropy/setup_helpers.py -> build/lib.macosx-10.9-x86_64-2.7/astropy
@eteq
eteq / gh_issuereport.py
Created July 5, 2014 17:00
A script to query github and find out how many PRs and issues a project has
from __future__ import print_function
"""
This script will use PyPI to identify a release of a package, and then search
through github to get a count of all of the issues and PRs closed/merged since
that release.
Usage:
python gh_issuereport.py astropy/astropy astropy/0.3
@eteq
eteq / mockimg.py
Created September 23, 2014 22:45
Mock astronomy image generation code
from __future__ import division, print_function
import abc
import numpy as np
from matplotlib import pyplot as plt
from astropy import units as u
from astropy.modeling import Fittable2DModel, Parameter, fitting
from astropy.modeling import format_input as _format_input