Tutorial sessions
We will hold tutorials during the first two days of the conference. These tutorials will be focused on teaching scientific computing tools using Python.
There will be two parallel tutorial tracks: the first starts from scratch and is suitable to newcomers to the language. It is considered a continuous, two day mini-course that gradually builds knowledge from the basic language to the key tools for everyday numerical computing in Python. The advanced track consists of a set of eight 2-hour long tutorials focused on specific topics over two days. These are each presented by a different speaker, and typically assume a reasonable knowledge of Python and some of the basic tools like NumPy and SciPy.
The tutorials are being held in the following rooms.
- Introductory Tutorial: Moore Laboratory, Room 070 (Has whiteboards with markers)
- Advanced Tutorial: Beckman Institute Auditorium (Has blackboards with chalk)
Note: All tutorial attendees should arrive at the Beckman Institute Auditorium at 7:45am Tuesday for breakfast and registration. Intro track attendees may then walk over to the nearby Moore Lab.
Food will be served to tutorial attendees as follows:
- Breakfast starts at 7:45 am
- Snack break at 10:00 am
- Lunch break at 12:00 pm
- Afternoon break at 3:00 pm
Introductory tutorial track
Note
For Perry's tutorial, you will need to use PyFits as well as these example data files.
The demo scripts used by Perry can also be obtained here and here (2nd).
The introductory tutorial will be taught by Perry Greenfield and Michael Droetboom from the Space Science Telescope Institute, and Fernando Perez from UC Berkeley.
This is a hands-on, interactive session. Please make sure you have a laptop computer with you so you can participate!
While we will assume little to no prior python experience, in the interest of being able to cover more interesting topics within our limited time, very basic ideas will be reviewed rather rapidly. For that reason, we very strongly encourage you to at least thoroughly work through the official introductory Python tutorial, as well as the basic NumPy tutorial. In addition to these two basic documents, which you should not only read but experiment with yourself on your computer, reading the following resources will allow you to learn a fair bit more during the two days of hands-on work:
- A general description on getting started with Python for scientific computing.
- A detailed tutorial on data analysis using Python by Perry Greenfield and Robert Jedrzejewski. While its examples focus on astronomical image analysis, most of it is of general utility.
- The matplotlib documentation.
More documentation resources are available. Below is a rough outline of what the introductory tutorial will cover in the two days:
Day 1
Basics of Python, suitable for an audience with no prior python experience.
Topics for the first day:
- Installation checks, so everyone has the tools.
- A brief general presentation on the uses of Python for scientific work.
- Workflow, guided by a simple examples and students typing along. We will show the basics of everyday workflow as we cover the core concepts.
- Quick review of control flow: if, for, range, while, break, continue.
- Defining functions. Arguments and docstrings.
- Reusing your code: scripts and modules.
- Exceptions.
- Debugging your programs:
- Testing your code: reproducible research from the start.
- Introduction to NumPy arrays.
- Working with data
Day 2
A continuation of the material of day 1, with in-depth coverage of 2-d plotting using the Matplotlib library.
Advanced tutorial track
The advanced tutorial track assumes attendees have significant Python experience, have brought a laptop computer with them, and have installed the listed software and tools prior to the start of the tutorial.
Also, if attendees are not already familiar with the materials mentioned for the Introductory track, please review them prior to the tutorials.
Day 1
8:15 am: Astronomical data analysis
Presented by Perry Greenfield.
The tutorial will cover the use of PyFITS, the package for reading and writing FITS files (including tables) and PyRAF, the package that allows one to script and interact with IRAF tasks, and emulate the IRAF CL scripting language.
Prerequisites: Please install PyFITS and PyRAF prior to the start of the tutorial.
10:15 am: Bulding extensions with Numscons
Presented by David Cournapeau.
numscons is a new, experimental build system aimed at replacing numpy.distutils and distutils to build numpy and scipy. It can also be used to build your own extensions. Numscons is a set of extensions around scons, and as such, benefits from scons features such as top-notch automatic dependancy handling, good documentation, extensibility. It can also build ctypes extensions, and other goodies not available in numpy.distutils.
The tutorial will briefly cover the rationales for numscons and its main design choices. It will then cover in details how numscons can be used by users for easy customization of the build, by developers for complex C/Fortran extension, and by core numpy/scipy developers.
Prerequisites: no knowledge of distutils or scons is expected. Scons will be introduced during the tutorial; a basic knowledge of cross-platform issues in building software is advised, but not required. To use numscons on your machine, you need both numpy and numscons installed; installing numpy from the trunk is ideal, but 1.1.1 should work. numscons is available on pypi: easy_install numscons.
1:15 pm: Writing optimized extensions with Cython
Presented by Robert Bradshaw
In many ways Python is an ideal language for scientific programing, but being interpreted it often lacks the speed of C or Fortran needed for doing low-level data manipulation. Cython is a Python to C compiler that allows one to write C-speed code in a Python environment, as well as wrap existing C and C++ libraries. In this tutorial you will learn how to write and compile Cython code, use Cython as a bridge between Python and external libraries, and common pitfalls to avoid. We will also look at the recent feature by Dag Seljebotn that allow one easily and efficiently access NumPy arrays and other buffer objects.
Prerequisites: This is an interactive session. Attendees should come with the latest copy of Cython installed. A very easy environment to get and use Cython in is Sage, though this is not required.
3:15 pm: Beyond pure python: Sage
Presented by William Stein
This tutorial will introduce the free open source Python-based mathematical software system Sage. It will teach you how to install Sage, draw 2d and 3d graphics, run a web-based Sage notebook server, and create interactive web-based graphical interfaces for working with data. It will also explain how to use other systems such as Maxima, Mathematica, Maple, Matlab, and Magma from the Sage environment, and how to create and link to compiled code (via Cython) for use in Sage. The examples illustrating each of the above themes will involve many of the unique algorithmic capabilities of Sage, such as arbitrary precision and interval arithmetic, fast exact linear algebra, polynomial arithmetic, and computation of automorphism groups of networks.
Prerequisites: This is an interactive session. You should have Sage-3.1 installed (or 3.0.6 if 3.1 is not available on your platform) prior to the start of the session.
Materials: Some of the material here is useful: http://wiki.wstein.org/2008/480a
Day 2
8:15 am: Advanced NumPy
Presented by Stefan van der Walt.
- Subclassing ndarrays.
- Create your own dtype for reading nasty binary blobs.
- Using structured arrays ("record arrays").
- Crazy views for performing windowed operations ("np.lib.stride_tricks").
- Code optimization techniques. Why x[[1,2,3,1]] += [4,5,6,7] doesn't work, how to avoid copies in memory, etc.
- NumPy gems: well hidden, useful functions.
Prerequisites: This is an interactive session. Requires the latest version of NumPy (1.1.0 or later) pre-installed.
10:15 am: Scientific GUI applications with the Enthought Toolset
Presented by Eric Jones.
This tutorial will review the contents and capabilities of the open-source Enthought Tool Suite (ETS) projects, paying particular attention to Traits as it is at the root of the dependency tree. Exercises will help attendees learn about Trait features such as types, validation, event notification, and GUI interface generation.
Prerequisites: This is an interactive session. Attendees should have the most recent ETS release (at least 3.0.0b2), IPython, NumPy, and SciPy installed. For help installing ETS please see the Enthought Wiki. Windows and OS X users might find it easiest to get these by installing the EPD for Python 2.5 4.0.300 Beta which should be released the weekend before the conference.
1:15 pm: Interactive plots using Chaco
Presented by Peter Wang.
This tutorial will start with basic plotting in Chaco and cover some of the various plot types and options. We will discuss some basics of layout and event handling within Chaco, and show how to use these to compose more
complex, interactive visualizations. The tutorial ultimately leads up to an example of writing custom interactions, and demonstrating integration with IPython and with Traits UI.
Prerequisites: Users should be comfortable with basic Python concepts like classes, lists, and dicts. Although the tutorial will be paced so that attendees can play around with examples and ask questions, it is not strictly designed as an interactive session. Attendees are encouraged to have Chaco 3.0 installed (either via PyPI or Enthought Python Distribution).
3:15 pm: 3-d visualization using TVTK and Mayavi
Presented by Prabhu Ramachandran (prabhu at aero dot iitb dot ac dot in) and Gaël Varoquaux (gael dot varoquaux at normalesup dot org).
Description: Mayavi is a powerful 3D visualization library and application, relying on the TVTK wrapper to the VTK visualization toolkit.
In this tutorial we will first expose the user to mayavi's mlab interface and use mlab to motivate and expose the rest of the more complex Mayavi library and application. We do this so the user can start using mayavi immediately and then gradually understand the architecture of mayavi. We believe this would make the tutorial much more meaningful for the user.
Prerequisites: This is an interactive session. Please have the following installed:
If you are under Windows, Mac OS X or RHEL3, all these requirements are packaged under the Enthought Python Distribution. As the software is well-tested on this distribution, using it is an easy way to make sure that everything works well. Under Ubuntu or Debian, Mayavi2 and its dependencies are packaged (make sure to enable backports to get the latest version).
Please make sure that you have everything installed and working before the tutorial. We will be around starting from the day before the tutorial to answer any questions and help you install the software if the need arises. If you have questions on the installation before the conference starts you can email the Enthought developers list with your questions.
Structure of tutorial:
Rapid overview of tools and what they mean for the user (5 min)
Installation (5 min)
- Mlab introduction (30 min)
Exposure to major mlab functionality
Gradual introduction to the vizualization pipeline
- Introduction to more advanced mlab/mayavi features
- Datasets in TVTK/Mayavi (the mlab way)
- Filtering of data with an example
Demo of the mayavi2 application with mlab
Simple exercise for the users to solve (10 min)
Introduction to VTK and TVTK (10 min)
Creating TVTK datasets with numpy arrays (20 min)
Embedding Mayavi (mlab) into a traits UI app (15 min)
- Using mayavi as a library (15 min)
- Motivation
- Mayavi architecture
- Writing mayavi scripts
- Additional features: (10 min)
- Offscreen rendering
- Making simple animations
- Envisage plugins
- Customization of UI, contributing modules etc.