Skip to content

Instantly share code, notes, and snippets.

Prasanth phn

Block or report user

Report or block phn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@phn
phn / angles.py
Created Jul 28, 2011
Python classes and functions for working with angles.
View angles.py
# Code moved to http://github.com/phn/angles.
@phn
phn / jdcal.py
Created Aug 30, 2011
Julian date calculator for proleptic Gregorian and Julian calendars.
View jdcal.py
# Code moved to http://github.com/phn/jdcal.
@phn
phn / lineid_utils.py
Created Apr 7, 2012
lineid_plot_utils
View lineid_utils.py
import matplotlib as mpl
import lineid_plot
def color_text_boxes(ax, labels, colors, color_arrow=True):
assert len(labels) == len(colors), \
"Equal no. of colors and lables must be given"
boxes = ax.findobj(mpl.text.Annotation)
box_lables = lineid_plot.unique_labels(labels)
for box in boxes:
@phn
phn / c6d_s6d.py
Created Apr 22, 2012
6D Cartesian and Spherical coordinates.
View c6d_s6d.py
"""Conversion between 6D Cartesian and spherical coordinates.
Cartesian6D represents the coordinates (x, y, z, xdot, ydot, zdot).
Spherical6D represents the coordinates (r, alpha, delta, rdot,
alphadot, deltadot). Alpha is the longitudinal angle and delta is the
latitudinal angle. The latter goes from 90 degrees at the +ve z-axis to
-90 at the -ve z-axis.
The Cartesian coordinates can have any units. The radial spherical
coordinate has the some unit as the input Cartesian
@phn
phn / year_to_jd.py
Created May 4, 2012
Julian dates, decimal years, Gregorian calendar dates, and Julian epochs.
View year_to_jd.py
import jdcal
from jdcal import ipart, fpart, is_leap, gcal2jd, jd2gcal
CJ = 36525.0
def days_in_year(year, c="g"):
"""Number of days in a calendar year (Gregorian/Julian)."""
if c.lower() == "g":
return 366 if is_leap(year) else 365
@phn
phn / part1.rst
Created Jul 5, 2012
Astropython.org PyFits tutorial
View part1.rst

PyFITS: FITS files in Python

In this article, we provide examples of using the python module PyFITS for working with FITS data. We first go through a brief

You can’t perform that action at this time.