Here are some resources you might find useful. As with most programming, Google is your friend.
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 introductory sessions, 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.
- Carnegie Python Distribution. Nowhere near as polished as anaconda, but is distributed with the in-house data reduction pipelines for many Carnegie instruments (MIKE, MaGE, etc).
- 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".
- Pyephem: Useful for finding out where celestial objects are in the sky based on time/location. There is also astroplan, which some prefer.
- 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:
- FlyingCircus (introductory python session) tutorials are available at GitHub.
- Transitioning from Notebooks to scripts: a guide.
- Top tips/tricks as compiled from the Python in Astronomy facebook group.
- Google's colaboratory. It's jupyter notebooks in the cloud, but they also have a large collection of "code snippets" that you can add in easily.
- Basic python tutorial for the beginner.
- A reference for formatting strings
- A good general introduction to python from the point of view of the astronomer: practical python for astronomers.
- AstroPy has some tutorials that are rather specific, but could be great if they cover what you need.
- Here are some tutorials for getting started with pandas.
- Matplotlib has a gallery of plots. It can help to see what's possible and emulate the code.
- The Scientific Python Cheat Sheet.
- The Python Users in Astronomy Facebook group.
- The O'Reilly series of books on python are quite good