I don't know how many times I have talked with colleagues about research and found out that their data processing steps involve some form of copying and pasting between various applications, Microsoft Excel and plotting software being common examples. Often times, with a minimal set of programming skills, a problem could be completed faster, more accurately, and produce a better set of automated figures. When I was introduced to python as an undergraduate studying meteorology, it opened my eyes to the world of automation and numerical modeling that was previously inaccessible. The python language is the ideal first programming language, and for many scientists may be the only one they need for the bulk of their work. The language is very readable and does not require a compilation step as it is interpreted. While that convenience comes at the cost of speed, there are many ways to improve the languages' performance when necessary.
What has been missing is the appropriate introduction for students. Most students will not write software professionally, but could benefit from a basic set of computing skills to help them wrangle data. For many technical jobs, basic programming skills are becoming the norm, not a unique skill. Learning how to effectively use a computer is a bit like trying to devour an elephant. There is so much to learn and so many interdependencies between the bodies of knowledge you are trying to internalize, it is impossible to know where to start. It is a daunting task and one that often ends in frustration on the student's part. A comprehensive guide to a good set of computing skills would be a very thick volume that is intimidating and too much for a beginner. It is important to quickly get past “Hello, World!” and onto more useful constructions. Texts written for computer scientists are often too technical for the non-specialist and focus heavily on software architecture, an important topic, but not one for the novice scientific programmer.
Kinder and Nelson are targeting the beginning scientific programmer with their book A Student's Guide to Python for Physical Modeling. The introduction to the book captures what I found so much joy in when I discovered problem solving through programming: “You can add in the effects of friction and air resistance that your physics professor is always telling you to ignore, you can make your own predator-prey simulations…” This guide is meant to get the complete novice programmer to a basic understanding of python syntax and be able to solve basic problems including file input/output, array manipulation, functional programming, numerical integration, and plotting of results.
At a brief 160 pages, it is quite possible for a motivated student to complete it in just a few sittings. The authors do emphasize what anyone learning to program already knows—you must type the examples and run them to learn anything. For this reason, they do not show the output of the scripts in the book and only show a few examples of plots. While this does force students to follow along, it also might create some worry for the students that they could be doing it incorrectly. The lack of figures also makes it more difficult to quickly recognize figures when flipping through and looking for the appropriate section. The typesetting of the book, including the code blocks, equations, and text, is beautiful; a refreshing change when compared to many books with less attention to detail.
This book is a fine introduction, but should be quickly followed by a book slightly more focused on programming structures and practice to help students quickly get through the “spaghetti code” stage. One such book is Effective Computation in Physics by Scopatz and Huff. While weighing in at just over 500 pages, it provides a broader view of computing skills that will quickly become important after learning how to program, such as version control, object oriented programming, testing, documentation, and regular expressions.
I really appreciated that the authors use python 3 throughout the book, as many scientific programmers have been stuck in python 2.7, which is being phased out. Few scientific programming books have yet been updated for python 3. I had hoped to see Jupyter notebooks utilized in this book; they run in the browser and make it easy to mix code, documentation, equations, and media. These notebooks are the ideal classroom tool, but were unfortunately not mentioned. All of the exercises could be easily adopted to use notebooks by the instructor. I would also recommend the instructor have the students correct the errors listed in the errata in class, as they are not likely to remember to check an erratum page and some of the errors could result in confusion and frustration.
I think this book is suitable for a quick introduction to programming for scientists, but should be followed by an introduction to more tools and techniques, especially the PEP8 document that sets out the best practices for coding style in python, including variable naming conventions and code layout/commenting.
John R. Leeman is a Ph.D. Candidate at The Pennsylvania State University. His research involves the frictional dynamics of earthquakes and slow earthquakes.