Modern Scientific Computing with Python

Course at IEEE Nuclear Science Symposium and Medical Imaging Conference

2014-11-13

Matt McCormick matt.mccormick@kitware.com

Python is an increasingly popular scientific computing programming language, offering an easy-to-learn, versatile interface that glues together work from many other languages well. Furthermore, it is supported by a vibrant open source community.

While the Python standard library is often touted for being “batteries-included”, the scientific Python environment is even richer, with many powerful tools and packages to enhance the scientific computing workflow.

In this one-hour course, we will introduce and refresh participants to modern Pythonic practices from the perspective of a researcher with a C or C++ background.

This contents computational environment, code, and data to run this course and available on the distributed USB flash drives and on GitHub. See the README file in the root directory for directions on how to run the notebooks.

Please copy the contents of the USB flash drive and return the drive :-).

Overview

Reproducible Research

J.R. Johansson: A sound scientific result should be reproducible, and a sound scientific study should be replicable.

To achieve these goals, we need to:

  • Keep and take note of exactly which source code and version that was used to produce data and figures in published papers.
  • Record information of which version of external software that was used. Keep access to the environment that was used.
  • Make sure that old codes and notes are backed up and kept for future reference.
  • Be ready to give additional information about the methods used, and perhaps also the simulation codes, to an interested reader who requests it (even years after the paper was published!).
  • Ideally codes should be published online, to make it easier for other scientists interested in the codes to access it.

Outline

1) Creating a reproducible computational environment with Docker.

2) Interactive analysis and literate programming with the IPython notebook.

3) A brief survey of the fundamental scientific Python packages: numpy, matplotlib, scipy, sympy, pandas, nose.

4) Writing efficient, compiled C/Python hybrid code with Cython.

5) Wrapping C and C++ libraries in python with XDress.

Learn more!

Basic References

IPython Notebooks

Advanced References