Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/lib/init/initlib.php on line 245

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/vendor_bundled/vendor/h5p/h5p-core/h5p.classes.php on line 2590

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/vendor_bundled/vendor/h5p/h5p-core/h5p-development.class.php on line 70

Deprecated: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in /home/astrobe2/public_html/wiki/tiki-setup_base.php on line 223

Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/astrobe2/public_html/wiki/tiki-setup_base.php on line 38

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/lib/core/Tiki/MemoryLimit.php on line 45

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/lib/tikilib.php on line 416

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/lib/tikilib.php on line 1925

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/lib/tikilib.php on line 5147

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/lib/tikilib.php on line 5147

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/lib/tikilib.php on line 6448

Warning: session_name(): Cannot change session name when headers already sent in /home/astrobe2/public_html/wiki/tiki-setup_base.php on line 188

Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /home/astrobe2/public_html/wiki/tiki-setup_base.php on line 233

Warning: session_set_cookie_params(): Cannot change session cookie parameters when headers already sent in /home/astrobe2/public_html/wiki/tiki-setup_base.php on line 237

Warning: Cannot modify header information - headers already sent by (output started at /home/astrobe2/public_html/wiki/lib/init/initlib.php:245) in /home/astrobe2/public_html/wiki/tiki-setup_base.php on line 270

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/lib/modules/modlib.php on line 554

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/tiki-sefurl.php on line 193

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/lib/userslib.php on line 369

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/lib/userslib.php on line 371

Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/astrobe2/public_html/wiki/lib/userslib.php on line 8313

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/lib/core/Perms/Accessor.php on line 118

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/astrobe2/public_html/wiki/lib/core/Perms/Accessor.php on line 118
AstroBetter | Python Tutorial For Astronomers Who Use IDL
Loading...
 

 

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