Loading...
 
(Cached)

 

Python Workshop run by IDL users

Below are notes on how to run a DIY python workshop.  These notes are based on a 3 day workshop at Yale in June 2012.  We were 10 people, all IDL programmers with no python experience.   Our workshop consisted of one full day, plus 3 half days.   A minimum amount of time to  accomplish most astro goals is 1 full plus 2 half days.

Success of the workshop depends on having a highly motivated group of participants.   It also requires someone to assume a leadership role, to facilitate organization, but is not required to be a python expert.  We met in a classroom far from the Astronomy Department to avoid distraction.   The classroom had a laptop projector and blackboards which we used heavily.

 

Day 0 - To complete before the workshop begins:     

  1. Write simple program to say 'hello world' following steps in Exercise #1.
  2. Install the superpack installation from Enthought.   We've talked to many people and this seems to be the best way to get started.    Mac users want 64-bit.   This install includes many packages including numpy and scipy.
  3. Extra credit:   To easily install other python packages in pip.  To install pip download and unzip file. Open terminal, navigate to your unzipped folder.  Type, "sudo python setup.py install" and login if necessary.    Some packages to look into and (maybe) install with pip: cosmolopy, readline, asciitable, emcee.

 

Day 1:

Make a list of goals you what to get out of the week.  Is there a program you want to learn how to run?  A specific plot you want to make in python?

Day 1 Morning 1:  

Watch Google Video Day 1.1.   Do first Google basic exercise (string1.py).

Day 1 Morning 2:

Watch Google Day 1.2.   Do second Google basic (list1.py).

Day 1 Afternoon 1:

Watch  Google Day 1.3.   Note minute ~9:30 when Google search is explained in two lines of code.   Do third Google basic (wordcount.py).   This exercise takes significantly longer than previous practice problems.   We needed 45min to complete/discuss this exercise.

Day 1 Afternoon 2:

Watched half of Google Day 2.1, but stop at minute 25 as it starts to get too deep into database stuff.

Day 1 Afternoon 3:

The google videos use the python command line directly (e.g. > python).   For research coding, you want to use iPython which is installed as part of Enthought (e.g. > ipython).    Watch a video explaining why this is a better environment to use. 

 

Day 2-4

We then worked throug the lectures and practice problems at:

http://python4astronomers.github.com/index.html  

This will walk you through the numpy and scipy packages, including how to read fits tables/images, fitting data and plotting data.   We worked through these pages individually, but anytime someone encounted a problem these were solved as a group.   The bouncing ball animation is super cool.

Other websites that we found useful:

Josh Bloom's python bootcamp

iPython tip sheet

Python Style Guide

At the end of Day 2 and 4, we invited a python expert in for an hour and asked questions.   This was useful, particularly in understanding how best to write longer codes.  

Good luck and happy coding!


Page last modified on Friday 20 of July, 2012 16:44:08 EDT