Python Resources

Here are some resources you might find useful. As with most programming, google is your friend.

Python Distributions:

Python and its associated 3rd party modules are all either free or open source. But it's a pain to compile/install everything from scratch. These distributions make life much easier. The following distributions can all live on your laptop/desktop without conflicting with each other. You run startup commands to activate whichever one you want to work with. For the bootcamp, we will be using Anaconda.

  • Anaconda. Works on just about all modern operating systems (Windows, OSX, Linux). Nice GUI interface (Navigator) and package installer. Includes MKL (Math Kernel Library) routines for numpy.
  • Enthought Canopy. Like Anaconda, very nice GUI interface and packages manager. Unlike Anaconda, it works very well in a distributed computing (e.g., HPC cluster) environment. License is more limiting than Anaconda.
  • Carnegie Python Distribution. Nowhere near as polished as the previous two, but is distributed with the in-house data reduction pipelines for many Carnegie instruments (MIKE, MaGE, etc).

Useful Modules:

  • Pandas: This package extends numpy with many convenience functions/methods for munging and visualizing data.
  • SciPy:  The de facto numerical methods package. If you need to numerically solve an equation, integrate a function, fit a model to data, or need special functions, this is where you should look first.
  • sciki-image:  A module for dealing with image processing and analysis. 
  • matplotlib:  there are many plotting packages for python, but matplotlib has emerged as the most popular and actively maintained.
  • Astropy:  loads of packages for dealing with astronomical data (FITS files, spectra, world coordinates, cosmological calculators, ...)
  • APLpy: A package for plotting 2D image data from FITS files. Uses matplotlib as the engine, but allows you to easily add sky coordinate grids, plot contours, label catalogs of objects, etc.
  • emcee:  A package for doing "Kick Ass MCMC". 
  • Kapteyn: Another bundle of astronomy-related packages, mostly dealing with World Coordinate Systems and map projections.
  • Pyephem: Useful for finding out where celestial objects are in the sky based on time/location.
  • Pyraf: If you have to use IRAF, why not do so from the comfort of your python interpreter?
  • The Python Package Index (aka the Python Cheese Shop) is a site that indexes the majority of 3rd party python modules. Search here first before you write up your own methods.

Tutorials and Code Samples:

Other Resources: