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 / part1.rst
Created Jul 5, 2012 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

phn /
Created Jul 28, 2011
Python classes and functions for working with angles.
# Code moved to
phn /
Created May 4, 2012
Julian dates, decimal years, Gregorian calendar dates, and Julian epochs.
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 /
Created Apr 22, 2012
6D Cartesian and Spherical coordinates.
"""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 /
Created Apr 7, 2012
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 /
Created Aug 30, 2011
Julian date calculator for proleptic Gregorian and Julian calendars.
# Code moved to
You can’t perform that action at this time.