This is also [meant to be] a rather short assignment, in recognition of your need to get to work on your Project proposal, to be presented next week. (More on that later.) So please don't make this take longer than it needs to. :-)
Your Mission is as follows (this message will not self-destruct, sorry!):
Then get right to work on your Project Proposal Presentation!
OK, that sounds simple, but you are going to need some guidance, even if you have already done some Python programming, because saying, "I know some Python, this should be easy!" is like saying, "Oh, you're from Toronto, do you know my friend George there?" Python is huge, diverse, mysterious and powerful; no one really "knows Python" -- but you can get used to a small subset of its idiosyncracies in certain contexts. After that, how far you take it is up to you. You should know, however, that it it probably the most popular language for writing system software, and that armies of Python programmers have devoted enormous efforts to building emulators in Python for complex and esoteric programming environments like MatLab.
There are usually several differences between established programming environments and their emulators:
To save you some time and effort, I have done a bit of hunting myself, looking for well-written documentation that seems at an appropriate and useful level for most PHYS 210 students; here are the results:
Python: | Object-Oriented Programming (PDF)
Verbose Tutorial for Beginners Alphabetical Glossary of Terms |
NumPy:
(You won't need NumPy for this Assignment.) |
Tentative
NumPy Tutorial
NumPy for MatLab Users [Mathesaurus] NumPy for MatLab Users [SciPy.org] NumPy Functions by Category |
matplotlib: |
matplotlib.pyplot API
errorbar method in pyplot [scienceoss] errorbar method in pyplot [official] |
PyX: | PyX Examples
Titus' PyX Tutorial for Gnuplot Users |
I expect that, by browsing these links, thinking about what you read, "borrowing" examples, trying them out and modifying them*, you will be able to get a nice plot like the one below, except using either pyplot or PyX instead of µView.
* Remember the 11th Commandment: "Thou shalt not change more than one independent parameter at a time before testing to see the effect." Even though Python (unlike PHP on a public Website) does provide lots (and lots!) of diagnostic messages, it helps to know which ones come from which changes! Be prepared to make many, many trials.
As usual, when your script(s) work perfectly and you have nice plot files to show,
put them all in your /home2/phys210/$USER/a05/
directory.
If you have any comments or suggestions (in a README.txt file)
those are welcome too, but not required.
./dbpylab.py
" in its directory.
The resultant plot is interactive, as in MatLab.
The script dbpyplot.py generates the desired figure pretty well
using the pyplot method of the matplotlib module in Python.
To run it, make it executable and then enter "./dbpyplot.py
" in its directory.
The resultant plot is interactive, as in MatLab.
Note that there is virtually no difference between dbpyplot.py and dbpylab.py!
The script dbpyx.py generates the desired figure pretty well
using the graph method of the pyx module in Python.
To run it, make it executable, copy db.dat into the same directory
and then enter "./dbpyx.py db.dat
" to create the plot files
data-pyx.eps and data-pyx.pdf there.
(This one is not interactive like MatLab.)