They say procrastination is a bad thing. I found that I always come up with some good ideas while I procrastinate from work. The fact that these ideas are rarely ever related to my work is a different matter entirely, and I might write something on that topic some other time because right now I wish to tell you about how one of those procrastination sessions resulted in something good not just for me, but for others at RSES too.

During this particular procrastination session a couple of months back I was trying to find courses in Python I could attend. If you don’t already know, Python is one of multitude of available programming languages. It is freely available to everyone under open source license. There are heaps of free courses online the purpose of which is to teach someone the basics (and then some) of Python. I always failed to complete any of these – not because they are in any way bad or difficult – on the contrary! – but because I have to organize my life in such a way that I spend some time every day paying attention to them. Something would usually happen and then as soon as I wouldn’t have time to stick to it for 2-3 days in a row – it was done, I wouldn’t go back to it. Why Python? Because it’s powerful, intuitive, easy to use, and because it would enable me to do all my data loading, processing, plotting… what have you… in one go. So far I have used several different pieces of software to do my research. I run the important bit of my code in Fortran, then use shell scripts to process Fortran’s output into something meaningful that I can then plot with GMT. This is tedious, and prone to mistakes. I can do all of this in one Python script. Also did I mention that big companies such as Google, NASA and Walt Disney Animations also use Python?

HelloW-3
Python wishing you hello! (source: http://pytalent.zandstrasystems.com/meet_py1.html)

As I was looking for courses I realised it would require me to go from Canberra into Sydney (the closest) and cash out around $500 for a one day course. I was looking for something short – couple of intense days of learning so I could get back to my work as soon as possible. One or two day courses were anything between $500 and $750. And so I thought to myself – someone should organise a course at ANU. I started looking and inquiring around ANU, but there was no such thing as a quick Python course. There is a whole semester of Python at Department of Computer Science – but that is semester two. And it’s a whole semester – time one Phd student cannot afford. The only other possible solution I had in front of me was – I will try to organise it. Before I did anything I talked to a couple of guys at RSES geophysics group who I know are using Python on daily basis. I asked them whether they would be willing to teach Python if someone were to organise a course. Since all of them preach how everyone should use it, and how people should finally use more modern methods in their research they readily accepted and decided to put their action where their words are. And so Rhys Hawkins, Christian Sippl and Erdinc Saygin became my first volunteers and principal teachers in a hypothetical Python course. This was a good choice – they are all three wonderful guys, incredibly patient. I know this, because they all work with me and see me every day and they are still my friends.

This was then followed by my email to kea student list (unofficial students list at RSES) with a short description of Python and a simple question – would you like to learn it? I expected around 5 answers in total, most of them coming from geophysics group. I received more than 20 emails within first half an hour. These were emails from students all over RSES – not just geophysics group – all of them interested in learning Python. I was overwhelmed by this response, as it became clear that somehow I managed to pinpoint a need within our department.

After such a response my teachers and I decided we really have to ask these people about their programming background and/or skills. Have you ever programmed before? If so, what did you use? What do you expect from the course? How are you processing your data now and how do you wish to improve it etc etc. It turned out that around 40 interested people spanned the entire spectrum – from those who never wrote one line of code in their lives, to those who use Python every day and just wish to learn something new – and everything and everyone in between.

This was now getting difficult. How do you create a course that can cater to the needs of such a large and varied group? Around a month and a couple of meeting and brainstorms later the four of us had a general plan of the course, booked classroom, requirements for the course (participants had to bring their own laptops) and we have agreed on the distribution to be used. We figured everyone should have the same – so we all get same errors and have one universal way of doing and demonstrating things. Julian Byrne joined at this stage and also offered his help and valuable insights on the material we presented.

The course was scheduled for a whole week after Easter weekend, every day from 9am to 5pm. Because the student group interested was so large, I decided to help my principal teachers and teach on the first day. It was my duty to show everyone the very basics of Python but also to introduce new programmers to the act of programming. I knew just enough Python to do this (and I have been programming since the age of 12), and later I would join the rest of the students as a student too.

20150408_154136
Everyone hard at work.

Out of 33 people officially registered for the course, around half that number appeared on the first day. This was to be expected – a lot of people pulled out because they are finishing their theses, or have other duties they cannot cancel. It was my first time to teach anything. I did my best to keep students not overly bored or confused while going through the “what” and the “how” of Python, promising them the “why” at the end of the day. I probably failed a few times, but tried to compensate by asking questions and making people think. This is how my first programming teacher taught me, and I think she did a good job. After going through the most important and common variable types in Python, I showed students how and why to use the if-statements, for and while loops. This is a lot of information for everyone – especially those who never programmed in their life. At the very end of the day I made my students re-type line by line a script that I prepared for them (with Rhys’s help where fancy new Python syntax was concerned). This script was short and simple, performed a simple task but contained everything they have seen throughout the day. Line by line we went through it all together, me gesticulating a lot and heavily using the whiteboard, and them concentrating, intensely. By exactly 5pm they understood it, and ran their first script.

Hmm… what could have gone wrong there?

A proof that they did understand how it all works came in the following days, when they knew exactly where and why they would use a for loop and they were familiar with variable types, indices and string formatting. All of this while learning new things every hour! And they asked very good questions. Also after a question about how and why Python is better than Excel spreadsheets and plotting in Excel, the OTHER STUDENTS answered this. Personally I was very proud of group of students who were just introduced to programming and yet instantly saw the advantage of using Python scripts in their research. You are all a great, bright bunch of students 🙂

Teaching style obviously changed from day to day as all of us (teachers) are different and because we had a difficult task of going through a lot but not to overkill it. I was a student as well the following days and I learned a lot, not to say that I was completely blown away by some features of Python and an incredible advantage of those features over Fortran and other pieces of software I have been using.

Everyone in the end did a good job – my volunteer teachers and the students. It was difficult to present the material properly at a reasonable pace, and it was difficult to stay focused and interested every day form 9am to 5pm. But in the end we all did it. My biggest reward comes in the form of feedback I am now reading as it is coming into my inbox. Definitely my favorite type of feedback was a dataset plot created in Python and saying “I just need to add a legend now” (thank you Laure, that made my day) and another little email that said “I am using Python now” (thank you Mari, I am glad you find it useful).

 

pyprint
pythoning on a daily basis 😉 (source: http://www.thehelloworldprogram.com/python/writing-first-python-program/)

 

Thank you Rhys, Christian and Erdinc – thank you so much for agreeing to take your time and do this. Thank you Julian for you support and insights. Thank you Daniela Rubatto and Ian Jackson for allowing me to this and for your support.

And more than anything – thank you students, for your interest and commitment. This wouldn’t at all be possible without you.

In the end we all learned something new and we are winning big time.

20150410_165526
The survivors on Friday afternoon with some funky basemap plots in the background.