This course uses Python 2.7 as opposed to the “new” Python 3.4.3. I am not familiar with all of the differences but I’ve noticed a few bugs when plotting error bars. So I ask you to stick with the well-supported old version. If you want to install it on your laptop, you need to make sure you have these packages: matplotlib, numpy, math. For the astronomy lab you will need pyraf and pyfits packages as well. If you have about 10GB of space on your laptop, I can arrange for you to download the Virtual Machine onto your laptop. The person who set up the VMs (and would do the installing) works here part time, so let me know ahead of time if interested.
Some Programming Advice
- Typically one learns to program on an as needed basis. You learn a few key techniques and everything else you look up as the need arises.
- Start with a pre-existing program. Hack at it and change little bits here and there and see how it alters the output. Use the examples from my cheat sheet.
- Browse the boards at stack overflow.com. In fact, if you just type the terms such as ‘array’ ‘python’ and ‘loop’ into google, it will more than likely bring you to a stack overflow page.
- Make comments on all your code! It will save you time trying to decipher your program.
- Get your code to run - don’t be a perfectionist: There are many ways to write one program for a particular task. Someone who has experience can write elegant code in a few lines. Others will take 3 times the amount of lines to do the same task. Doesn’t matter at this point - just get it to work!
- Debugging code and getting it to run is part of the process. Expect to do this MULTIPLE times for each program.
Tutorials and Cheat Sheets
Python Downloads