[Numpy-discussion] NumPy in Teaching

Joe Harrington jh at physics.ucf.edu
Wed Feb 28 19:32:41 EST 2007


Hi Steve,

I have taught Astronomical Data Analysis twice at Cornell using IDL,
and I will be teaching it next Fall at UCF using NumPy.  Though I've
been active here in the recent past, I'm actually not a regular NumPy
user myself yet (I used Numeric experimentally for about 6 months in
1997), so I'm a bit nervous.  There isn't the kind of documentation
and how-to support for Numpy that there is for IDL, though our web
site is a start in that direction.  One thought I've had in making the
transition easier is to put up a syntax and function concordance,
similar to that available for MATLAB.  I thought this existed.  Maybe
Perry can point me to it.  Just adding a column to the MATLAB one
would be fine.

My syllabi (there are undergrad and grad versions) are at:

Cornell courses (undergrad only):
http://physics.ucf.edu/~jh/ast/ast234-2003/
http://physics.ucf.edu/~jh/ast/ast234-2004/

UCF course (4xxx is undergrad, 5xxx is grad, numbers not yet assigned):
http://physics.ucf.edu/~jh/ast/dacourse/

The goal of the course is for students to go out and do research with
faculty as soon as they're done, and be useful enough to be included
on papers.  Rather than the usual (and failing) "just do what I do"
model, in which physics students learn to program badly and in
FORTRAN77 from their professors, I teach programming from a CS point
of view, focusing on good top-down design and bottom-up construction
(indentation, documentation, sensible naming, testing, etc.).  I teach
error analysis by first teaching probability.  Then we go into the
physics of detectors and finally do an end-to-end analysis of some
simple spacecraft data sets (photometry and spectroscopy), the
programming of which make up most of their assignments.  There is a
project at the end, in which many in the class seem to get an epiphany
for how all this stuff fits together.  They write up the result in the
format of an Astrophysical Journal article, and while I don't teach
writing as a topic, I do demand that it is done well (and to my shock
it usually is!).

The first two times I taught it, it was way too much material (good
students spent 15+ hours on the class weekly), so I'm ripping out
about half the programming assignments for the undergrads, and giving
simpler project datasets.

My main lesson learned is that the old adage of "They know less than
you think they know but they can do more than you think they can do"
falls completely on its face here.  Many of them actually do know how
to program, and that ability, rather than their academic level, is
really the best predictor of course success.  A computer-savvy
freshman will just kill a computerphobic grad student, because the
rest of the class just isn't that hard.  What I wasn't prepared for
the first time I taught it is just how hard it is to teach debugging.
These kids will stare a simple twiddle-characters bug in the face for
hours and not see it.  It's been twenty-five years since I was at that
stage and it's hard to remember what it was like.  To teach debugging,
I'm emphasizing "fingers as the creators of error" (since you KNOW
your brain didn't do it!), and that they should test each small bit of
code before incorporating it in their function.  I'm also showing them
how to use a debugger, giving them a list of common bug types and how
to find them, and only having them do every other step in the
photometry pipeline.  I'll give them the other half of the steps and
that will teach them how to design to an API.

The other lesson is that it is a hell of a lot of work to grade
programming assignments from even four students, if you care about
grading for good practice and not just whether it runs.  I probably
spent 20 hours a week on the class the second year I taught it.  Since
I'll have 10 students next semester, I plan on doing something here
with peer evaluation.  Wish me luck...

I'm posting here because I'm interested in your results and any advice
you or your respondents have to share.  I hope other respondents will
post here rather than sending private email.  If we get enough people,
let's start a page on the wiki (a mailing list!  a conference!  a
movement!  ok, well, let's start with a wiki page).

--jh--
Prof. Joseph Harrington
Department of Physics
University of Central Florida



More information about the NumPy-Discussion mailing list