Computational Astrophysics in Python (WP1.1)

Table of Contents

Questions/Comments about the Python lab should go to Kerstin Paech (email is kerstin.paech and then @physik.lmu.de).

1 About this lab

This is the webpage for the Computational Astrophysics Lab in Python (WP1.1 Numerical practical course with exercises). The lab is part of the Astro Practicle Course of the Master of Science in Astrophysics and is open to Master of Science in Physics students as well. It is held each semester. Organizational details about the lab will be discussed in the introductory.

If you have questions about the Numerics Lab, please contact Kerstin Paech. For general questions about the Practicle Course, please contact Stella Seitz.

The aim of the Lab Course is gaining proficiency in the application and usage of numerical methods. You will develop computer programs and the practise the critical evaluation of numerical results.

This lab is also offered in the FORTRAN programming language, see the FORTRAN numerics lab website for details.

For general information about how this lab course is organized go to the course main page. There you will find information how everything works, including evaluation criteria. These criteria are not self-serving and you should very much see them as a guideline on what important skills as a scientist are. You will need these and other skills to successfully complete your master thesis eventually.

The Python numerics lab exercises are mostly provided as jupyter ipython notebook (exceptions are mentioned in the lab descriptions you can find below). Check out the respective sections for each lab.

How to use ipython notebooks will be discussed in the Tutorial. If you'd like to install python and jupyter on your personal computer, a convenient choice is described on the jupyter website here.

The following labs are offered in Python:

2 Voluntary Introduction to Linux and programming/plotting in Python

Before the semester starts, we offer a voluntary introductory Linux and Python Tutorial. We will be covering the basics of these both topics so you have a good starting point in navigating USM computers and working on the acutal "experiments" during the lab.

You do not to be an expert in Linux and Python, but should be able to perform basic tasks. To self-evaluate yourself, you can have a look at these basic Linux and Python exercises. If you can solve these, then your experience level suffices to participate in the lab.

The Tutorial will take place on two days and on each of these days both Linux and Python topics will be covered. For each of these sections we ask you to prepare by reading the material or watching the videos provided (see the table below for details).

Between day 1 and 2 of the Intro you should to work on some basic problems. The solutions will be discussed on day 2.

After the 2nd week of Tutorials we encourage you to work on the

If you would like to participate and sign up with the course you'll get some emails asking you to provide some information and with instructions on how to set up your computer environment in order to be able to participate. You can only participate if you answer those emails.

Questions about the Python Lab, including the Intro, should go to Kerstin Paech (email is kerstin.paech and then @physik.lmu.de

What you need to do material you need needs to be done by
prepare/provide feedback emails by instructors specified in emails
starting up a VNC connection VNC instructions sent by Arno specified in emails
starting up a Jupyter Notebook instructions specified in emails
open the tutorial Notebook Tutorial Jupyter Notebook specified in emails

3 Matrix inversion

In this lab, basic methods for solving linear equations are implemented and applied.

Please prepare for this lab by reading the lab manual. The exercises are to be found in the ipython notebook. Note that the atomic data for advanced task 2 are to be found in the appendix in the manual.

4 Integration methods

You'll numerically calculate integrals and apply those methods to calculate the radius a pure ionized hydrogen Strömgren sphere.

Please use this manual (the password is the same as for the general astro physics lab webpages), there is no Jupyter notebook.

5 Ordinary differential equations

This lab provides an introduction to some numerical methods to evaluate differential equations, and coupled differential equation.

Please prepare for the lab by working through the first three chapters of FORTRAN lab manual and answering the inline questions.

You find additional instructions in the following ipython notebooks: notebook1 and notebook1a for the first afternoon; notebook2 and a stand alone script for the second afternoon.

6 N-body simulations

Please prepare for the lab by working through the manual. You find additional instructions in the following notebooks: notebook1 for the first afternoon; more details will be added later.

7 Random numbers and Monte Carlo simulations

In this lab you will learn how to create simple pseudo random numbers and use random numbers to calculate an integral as well as simulate pure radiative transfer in stellar atmospheres.

Please prepare for the lab by working through chapter 1 of FORTRAN lab manual. You can find the actual lab exercises in the ipython notebooks for the following three tasks:

  • Notebook 1 In a first step you'll program a simple random number generator
  • Notebook 2 The first application an integral is calculated using Monte Carlo Integration
  • Notebook 3 The second application is the simulation of pure radiative transfer in stellar atmospheres and you'll simulate why the sun is darker at it's edges than at the center.

8 Monte Carlo Markov Chains and Lensing Profile of Galaxy Clusters

  • You'll learn how to use Monte Carlo Markov Chains (MCMC) to estimate the parameters of a model, including confidence regions (i.e. uncertainties).
  • As an application you'll estimate the mass of a galaxy cluster with weak lensing

Please use the manual to prepare for the lab. Further instructions can be found in this ipython notebook.

You will use the data in halo5.tab (download) - make sure you either save it to the current working directory of your notebook or specify the right path inside your notebook when opening the file.

Author: The Astrophysics Python Lab Instructors

Created: 2024-03-14 Thu 12:17

Validate