Computational Astrophysics

Course Schedule and Work Load

This course consists of two parts that will be taught in 2016 during four weeks in January (part 1) and four weeks in June (part 2).  You need to attend and take part in both parts to obtain credit (6 EC) for this course. This is an intensive course. Expect to spend 20 hours per week. Of these there are 8 contact hours and 12 hours of independent/group work and preparation.

In January the contact hours will take place on Monday 9am-1am and Wednesday 3-7pm.


In this course you will develop various computational skills that will prepare you to start to develop your own research projects.  Python will be used during this course as a language of choice, but many of the techniques and skills are generally applicable.

  • Become familiar and a thorough understanding of the basic widely computational techniques. Develop a general understanding of more advanced techniques.
  • Develop skills such as coding habits, efficient debugging and code optimization, version control that will enhance your productivity the reliability and reusability of your programs
  • Develop a general understanding of the fields of astrophysics where computational techniques are used in current active research.

In general topics you can expect are

  • Python freshup
  • basic but efficient data visualisation
  • rounding errors, convergence
  • timing and optimization
  • debugging
  • version control
  • modules: numpy, scipy, matplotlib
  • interpolation
  • root finding
  • numerical integration
  • solving of ODEs
  • Monte Carlo techniques

You are expected to be fluent in the basics of python at the start of this course.  Please refresh your skills with one of your old lecture notes or the many introductions online, for example

Week 1: Jan 4-10, 2016

Assignments for independent study week 1

(I) Python freshupHave python installed and review all basic elements listed below.  You should be familiar with nearly all of them already, so you should be able to proceed quickly.  Scan through the links below and make note of all concepts that are new to you or that you might have forgotten about.  I suggest you make notes in a digital notebook and make a personal list of ‘tips and tricks’ of things that seem useful to you.  (I use Evernote for this) .

  1. Have a working version of python with scipy packages installed and working properly (numpy, matplotlib, scipy). and refresh your basic python skills
  2. Know how to run ipython notebooks. Understand the difference between calling scripts from the command line and running a notebook.
  3. Scan through this overview and make notes check if all of this is familiar to you
  4. Review Strings, lists, arrays and dictionaries
  5. Review File input and output
  6. Review Basic plotting with matplotlib
  7. Review Conditionals and loops
  8. Review functions, methods and attributes

(II) Version control with git and github.  You are familiar with the concept of version control. For example the back ups you hopefully make, or the undo button in your text editor, or maybe even emailing back and forth a document you work on with a collaborator.  When working on large coding projects (or scientific papers) you want to do version control in a systematic way.  One of the widely used

Reading and exercises for this part come from the “software carpentry” website, which aims to educate scientists in programming skills.

  1. Work through the lessons

The learning curve to start using git can be a little steep for novice users.  Use of version control will not be enforced in this course, but it is highly encouraged, especially during the second part of this course where you will be working on larger projects. If you start to use it now for smaller project it will be a routine for you when you work on larger projects.


Week 2: Jan 11-13, 2016

Week 3: Jan 18-24, 2016

Week 4: Jan 25-31, 2016