Skip to content

Commit

Permalink
Clean up astropy.io.fits references
Browse files Browse the repository at this point in the history
  • Loading branch information
taldcroft committed Feb 6, 2015
1 parent 8879447 commit 7f95f90
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
12 changes: 7 additions & 5 deletions source/astropy/fits.rst
@@ -1,9 +1,11 @@
.. include:: ../references.rst

.. _handling-fits-files:

Handling FITS files
===================

.. note:: If you are already familiar with PyFITS, `astropy.io.fits` is in
.. note:: If you are already familiar with PyFITS, `astropy.io.fits`_ is in
fact the same code as the latest version of PyFITS, and you can
adapt old scripts that use PyFITS to use Astropy by simply doing::

Expand All @@ -17,7 +19,7 @@ Documentation
-------------

For more information about the features presented below, you can read the
`astropy.io.fits <http://docs.astropy.org/en/v0.2/io/fits/index.html>`_ docs.
`astropy.io.fits`_ docs.



Expand Down Expand Up @@ -215,14 +217,14 @@ Accessing Tabular Data

In Astropy 0.2, FITS tables cannot be read/written directly from the ``Table``
class. To create a ``Table`` object from a FITS table, you can use
``astropy.io.fits``::
`astropy.io.fits`_::

>>> from astropy.io import fits
>>> from astropy.table import Table
>>> data = fits.getdata('catalog.fits', 1)
>>> t = Table(data)
and to write out, you can use ``astropy.io.fits``, converting the table to a
and to write out, you can use `astropy.io.fits`_, converting the table to a
Numpy array::

>>> fits.writeto('new_catalog.fits', np.array(t))
Expand Down Expand Up @@ -285,7 +287,7 @@ Practical Exercises
Using Matplotlib, make an all-sky plot of the LAT Background Model in the
Plate Carée projection showing the LAT Point Source Catalog overlaid with
markers, and with the correct coordinates on the axes. You should do this
using only ``astropy.io.fits``, Numpy, and Matplotlib (no WCS or
using only `astropy.io.fits`_, Numpy, and Matplotlib (no WCS or
coordinate conversion library). Hint: the -CAR projection is such that the
x pixel position is proportional to longitude, and the y pixel position to
latitude. Bonus points for a pretty colormap.
Expand Down
10 changes: 6 additions & 4 deletions source/files/binaryfiles.rst
@@ -1,3 +1,5 @@
.. include:: ../references.rst

:tocdepth: 2

Binary formats useful for astronomers
Expand All @@ -6,12 +8,12 @@ Binary formats useful for astronomers
astropy.io.fits - Reading and writing fits files
================================================

`astropy.io.fits <http://docs.astropy.org/en/v0.2.1/io/fits/index.html>`_ is a Python module developed at STScI to read and write all types of fits files. The full html manual is available `here <http://docs.astropy.org/en/v0.2.1/io/fits/index.html>`_.
`astropy.io.fits`_ is a Python module developed at STScI to read and write all types of fits files.

.. admonition:: External resource!

The astropy.io.fits tutorial itself is good for our purpose and since this
is the internet I will not reinvent the wheel. Read the manual `here <http://docs.astropy.org/en/v0.2.1/io/fits/index.html>`_
The `astropy.io.fits`_ tutorial itself is good for our purpose and since this
is the internet I will not reinvent the wheel. Read the manual
then come back to this page for an exercise.

.. admonition:: Exercise
Expand Down Expand Up @@ -47,7 +49,7 @@ Here is a possible solution::
plt.colorbar()

You might recognize this piece of code. It was used before in
the :doc:`../core/numpy_scipy` part of the tutorial, but now you should understand the ``astropy.io.fits`` commands in more detail.
the :doc:`../core/numpy_scipy` part of the tutorial, but now you should understand the `astropy.io.fits`_ commands in more detail.

.. raw:: html

Expand Down
3 changes: 2 additions & 1 deletion source/fitting/low-level.rst
@@ -1,3 +1,4 @@
.. include:: ../references.rst

The low-level Sherpa API
------------------------
Expand Down Expand Up @@ -32,7 +33,7 @@ Import a few Sherpa classes needed to characterize a fit::
from sherpa.optmethods import LevMar
from sherpa.fit import Fit

Import the Python FITS reader ``astropy.io.fits`` and open the spectrum as a table::
Import the Python FITS reader `astropy.io.fits`_ and open the spectrum as a table::

from astropy.io import fits
dat = fits.open('3c273.fits')[1].data
Expand Down
2 changes: 2 additions & 0 deletions source/fitting/spectrum.rst
@@ -1,3 +1,5 @@
.. include:: ../references.rst


1-D data with errors
--------------------
Expand Down
2 changes: 1 addition & 1 deletion source/intro/quick-tour.rst
Expand Up @@ -147,7 +147,7 @@ This example demonstrates how to create a synthetic image of a cluster,
including convolution with a Gaussian filter and the addition of noise.
::

import astropy.io.fits as fits
from astropy.io import fits
from scipy.ndimage import gaussian_filter

# Create empty image
Expand Down
2 changes: 1 addition & 1 deletion source/references.rst
Expand Up @@ -4,7 +4,6 @@
.. _`IPython`: http://ipython.org
.. _CIAO: http://cxc.harvard.edu/ciao/
.. _SAS: http://xmm.vilspa.esa.es/sas/
.. _astropy_doc: http://astropy.readthedocs.org/en/stable
.. _APLpy: http://aplpy.github.com
.. _SAMPy: http://pypi.python.org/pypi/sampy
.. _COATPy: https://github.com/python4vo/coatpy
Expand All @@ -14,5 +13,6 @@
.. _TOPCAT: http://www.star.bris.ac.uk/~mbt/topcat
.. _Directory: http://nvo.stsci.edu/vor10/index.aspx
.. _astropy: http://astropy.org
.. _astropy_doc: http://astropy.readthedocs.org/en/stable
.. _`astropy.io.ascii`: http://astropy.readthedocs.org/en/stable/io/ascii/
.. _`astropy.io.fits`: http://astropy.readthedocs.org/en/stable/io/fits/

0 comments on commit 7f95f90

Please sign in to comment.