1 Mar 01:32
Re: NumPy in Teaching
Joe Harrington <jh <at> physics.ucf.edu>
2007-03-01 00:32:41 GMT
2007-03-01 00:32:41 GMT
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(Continue reading)
and that numpy would allow much
higher level tasks to be attempted at an early stage and would get them
used to using an array-processing mindset. I think that, since some of
the students had prior C experience, they were able to help each other a
bit more in the C labs. We found that we were busier answering questions
in the Python labs as a result.
We had them create arrays in C, populating them with sinc functions to
get them to deal with division by zero etc. and repeat the exercise in
Python with numpy. We had them do some file i/o in both languages - I
used scipy.io read_array and write_array to read data printf'ed by their
C code. We did some fft-based filtering with Python and used pylab to
view the results. We used Enthought Python with "ipython -pylab" shells
and Idle as the editor. One lesson learned is that I tried to be a bit
too ambitious with Python - they struggled with trying to figure out how
to use functions. The labs were written as a mixture of "modify this
example" code and "find the function which does this" - they found the
latter too hard because the number of functions in numpy/scipy is a bit
overwhelming and not easily navigable for the uninitiated.
We'll be re-running this course in a few weeks and perhaps introducing a
physics modelling/numerical methods subject (perhaps language-neutral)
later in the year. It may also be a prerequisite for some of the 3rd
year astronomical data processing labs currently being written.
Gary R.
Steven H. Rogers wrote:
> I'm doing an informal survey on the use of Array Programming Languages
> for teaching. If you're using NumPy in this manner I'd like to hear
> from you. What subject was/is taught, academic level, results, lessons
> learned, etc.
>
> Regards,
> Steve
RSS Feed