Tuesday, December 15, 2009

Scientific Python tools use rising in education

It's pretty clear to me that Python is rapidly growing in acceptance as a computational platform at universities everywhere. I recently heard from Josh Bloom at UC Berkeley astronomy that his proposal for a short 'boot camp' course at the beginning of the Fall semester was approved. This is excellent news, last year I taught something similar for neuroscience students and postdocs, and I'm glad to see the campus adopting python further as a key component of the computational training the science students receive.

John Hunter and I just completed a few days ago teaching another such workshop at the Claremont Colleges, supported by an NSF grant that John Milton, (J. Hunter's PhD advisor) has for exposing undergraduates to a number of research-related experiences. This grant supports summer research internships where two undergrads visit together a research lab away from their home campus to work independently on a project, as well as our teaching of scientific python tools (we were also there in 2008 and hopefully will continue next year).

I have to say that I really enjoy teaching this type of workshop, especially now that the core tools are fairly mature, installation isn't the problem it used to be, and we have a chance of presenting interesting examples to the students from the very beginning. By now we've taught a number of these at various labs and universities, and I think we've found a good workflow.  John is a phenomenal lecturer, with a real knack for illustrating interesting concepts on the fly, in a very natural manner that is honestly similar to how exploratory work is actually done in real research, where you run a bit of code, plot some results, print a few things, code some more, etc. In the picture above, he was working through some of the matplotlib image tutorial, which gave us an opportunity to find and fix a small bug in how the luminance histogram was being computed (the current form is correct). Every one of these students probably has a digital camera these days (if nothing else, in a cell phone), so an example like this is a great way to connect something they are used to with mathematical and programming concepts.

Here, John gave a great illustration of random numbers and simple statistics. He built up interactively a simulation of random walks, working up from a single (one-dimensional) walker to a group of them, comparing the simulation results with the analytical predictions for various quantities (like mean and variance), and also explaining to the students how these squiggly lines could be considered a model of price fluctuations over time. In this manner, he connected the somewhat abstract statistical concepts to something the students could relate to, namely the risk of an investment making a profit or a loss after a certain period.

We also talked about FFTs, dynamical systems, error analysis, data formats, and a few other things. It was very encouraging to have most of the students return on the second day, considering how this was a completely optional activity for them, covering an entire weekend (with morning lectures both days) right before they had to start diving into their finals. But they were a smart and enthusiastic bunch, and I hope that the workshop gave them some useful starting points they can then develop on their own as they get involved in research projects.

These are just two examples of how we are now seeing Python's acceptance in university computing growing. We have a lot of work still ahead of us, but it's really encouraging to see how far we've come from the days when building scipy was a black art, IPython was little more than a different prompt for the python shell and matplotlib could only do basic line plots in a GTK window. We now have tools that provide a complete computational environment for teaching and research, and things are only getting better...


hfv said...

This are great news indeed! Just a few weeks ago the school I work for in Guatemala decided that next January they'll start walking the pythonic path, leaving Java behind. All the engineering instructors are required to take a python workshop (getting some of them to use python-based tools might be the hardest challenge). So, thank you for all your great work!

Fernando Perez said...

That's great to hear! I'll actually be spending all of February teaching a whole-month course on Python for computational physics at the Universidad de Antioquia in Medellin, Colombia (where I obtained my undergraduate degree). I'll try to post some updates on that here as well.

Unknown said...

We are trying to do a similar thing at the University of Wisconsin-Madison in January. If you or John or Josh would like to take part in any way, let us know :-) We would be happy to have you.

Fernando Perez said...

Can you contact me by email so we can talk about this? Fernando.Perez@Berkeley.edu


Unknown said...


Reciba un cordial saludo Prof. Fernando Perez,

Mi nombre es William Oquendo. Soy miembro del grupo de investigacion Simulacion de Sistemas Fisicos de la Universidad Nacional de Colombia ( www .ssf.unal.edu.co ). Nuestro trabajo consiste en estudiar sistemas complejos, que van desde medios granulares hasta la magnetohidrodinamica de sol pasando por trafico vehicular, microfluidica, fracturamiento, etc. Normalmente disenhamos e implementamos nuestros programas en C++, y realizamos el analisis posteriormente. En cuanto a visualizacion usamos herramientas como povray, gnuplot y xmgrace, es decir cosas muy sencillas.

Estamos muy interesados en aprender nuevas herramientas que nos permitan indagar mejor en las soluciones que obtenemos, atacar problemas mas complejos y ser mas productivos. Por eso el interes nuestro en lenguajes y herramientas como Python, Mayavi2, VTK, etc.

Hemos observado que usted vendra a Colombia en el 2010, a la UDEA, a dictar un seminario sobre Python en computacion cientifica. Me gustaria saber si usted estara en Bogota algun tiempo y si seria posible invitarlo a dictarnos alguna conferencia, curso o similar. Seria un honor para nosotros compartir con un experto como usted. Como no conozco realmente su disponibilidad y requerimientos, le solicito respetuosamente que me indique las posibilidades que tenemos, el tiempo, posibles costos, recursos computacioneles, etc. Podria coordinar este evento en la Universidad Nacional o en la Universidad de los Andes, dado que estamos vinculados a un centro de excelencia en investigacion que agrupa a ambas universidades.

Agradezco mucho su amable atencion y le deseo una feliz Navidad y un prospero anho nuevo 2010.


William Oquendo
Simulation Of Physical Systems Group

Unknown said...

Wow, new useful tools in education are always welcome, especially if they particularly help with speed and getting things done neatly.