In this article, we provide examples of using the python module PyFITS for working with FITS data. We first go through a brief
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code moved to http://github.com/phn/jdcal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code moved to http://github.com/phn/angles. |