Astropy Tutorials: Learn how to do common astro tasks with astropy and Python

by Guest on July 7, 2014

This is a guest post by Adrian Price-Whelan (@adrianprw), an NSF graduate fellow at Columbia University. Adrian works on tidal streams and Galactic dynamics, is an open source enthusiast, Python developer, and plays bass for death ray architect. He is also an instructor in the SciCoder workshops and Python workshops at AAS meetings.

Astropy is a community-developed Python package intended to provide much of the core functionality and common tools needed for astronomy and astrophysics research (c.f., IRAF, idlastro). In order to provide demonstrations of the package and subpackage features and how they interact, we are announcing Astropy tutorials. These tutorials are aimed to be accessible by folks with little-to-no python experience and we hope they will be useful exercises for those just getting started with programming, Python, and/or the Astropy package. (The tutorials complement the Astropy documentation, which provides more detailed and complete information about the contents of the package along with short examples of code usage.)

The Astropy tutorials work through software tasks common in astronomical data manipulation and analysis. For example, the “Read and plot catalog information from a text file” tutorial demonstrates using astropy.io.ascii for reading and writing ASCII data, astropy.coordinates and astropy.units for converting RA (as a sexagesimal angle) to decimal degrees, and then uses matplotlib for making a color-magnitude diagram an all-sky projection of the source positions.

http://i.imgur.com/08uBjAu.png

Several of the tutorials also demonstrate how to use matplotlib to make 2D images with different color maps, stretches, and colorbars.

http://i.imgur.com/744tSiD.png

http://i.imgur.com/7gP8NwN.png

http://i.imgur.com/cpKGJ1h.png

So far, we’ve made five tutorials:

We welcome feedback and improvements to these tutorials via the Astropy Tutorials repo on Github. If you find a typo or would like to clarify some text, please either create an issue or make the change yourself and then submit a pull request directly to the repository. Questions and/or comments about the tutorials are welcome on the astropy-dev mailing list.

If you are interested in contributing an IPython notebook as a tutorial, please check the README or contact the developer list. Also, if you have an idea for a tutorial or a tutorial request, please post to the developer list or leave a comment below. If you would like to contribute to this effort, but need some inspiration, check out the open issues. This is a collaborative effort and we are looking for contributions and ideas from users like you!

If you use Astropy directly—or as a dependency to another package—for your work, please remember to include the following acknowledgment at the end of papers:

This research made use of Astropy, a community-developed core Python package for Astronomy (Astropy Collaboration, 2013).

where “(Astropy Collaboration, 2013)” is the Astropy paper.

{ 4 comments… read them below or add one }

1 Annie JC July 7, 2014 at 11:10 am

Sometimes the astronomy gets lost in the code… e.g., the RAs should increase to the left in the first and third figures. We are inside the Universe, not outside!

Reply

2 Ginny McSwain July 7, 2014 at 12:13 pm

The link to the first tutorial is broken; it points to the 5th tutorial instead.

Reply

3 Kelle July 7, 2014 at 12:30 pm

fixed.

4 Austen July 8, 2014 at 10:40 am

Is there any easy way in astropy to plot the location of an object of interest over top of a survey footprint? Even better, would be to over-plot this object on an actual image from an overlapping survey.

Reply

Leave a Comment

Previous post:

Next post: