Python for Astronomers Advance Course Materials
Class I - 7 Nov. 2013
Slides/Presentations
Python Introduction
Python Basic Sintaxe
Template
Python Script Template
Exercises
Exercises
Possible resolutions
Exercises Solutions Alternatives
Class II - 21 Nov. 2013
Slides/Presentations
Objects in Python
Numpy
Exercises
Exercises
Possible resolutions
Star class
Planet class
Planetary System class
Numpy Solutions
100 Numpy Exercises
Class III - 5 Dec. 2013
Slides/Presentations
Matplotlib
Scipy
Exercises
Exercises
Matplotlib Simple Exercises
IDL Sav File to Read
Wav File to Read
Possible resolutions
Matplotlib Exercises (from pdf file) solution
Scipy Exercises solution
Class IV - 17 Dec. 2013
Pyraf Example
In order to run this
simple script you need pyraf module in your python system.
Pyfits Example
In order to run this you need pyraf module in your python system.
Pyfits Example 1 : this example shows how to read a 2 extension fits file and create a new fits file with only 1 extension ready for splot or ARES.
Test Data Example 1
Pyfits Example 2 : this example shows how to take a simple 1D fits spectra and add a new extension to a new fits file.
Test Data Example 2
Pyfits Example 3 : this example shows a solution to create a new fits table file.
Test Data Example 3
Cython for wrapping C - Some simple Examples
Note that you should have cythin installed in your system. To create the module for python for each example, just unpack the tar files for each example, inside each folder run: python setup.py build_ext --inplace
Cython Example 1 : Simple call of a cos function from "math.h".
Cython Example 2 : Simple call a test.c code implemented in the folder.
Cython Example 3 : Simple example to interface with numpy arrays.
Cython Example 4 : Calling functions defined in TMCalc code downloadable in the ARES Webpage.
Cython Example 5 : Wrapping a c code that uses an external library. In this case the Gnu Scientific Library is used as an example.
References
Python 2.7. Quick Reference
Python Scientific Lecture Notes - http://scipy-lectures.github.com
Python Oficial WebPage
Python Online Documentation
PyFits
PyRAF by Ureka
Author
S. G. Sousa (sousasag(-at-)astro.up.pt) | Last modification: December 2013
Supported by FCT in the form of the grant: SFRH/BPD/47611/2008