- Advanced NumPy
Files: tar.gz | zip | PDF
- Signals and Systems in Python
- High Performance and Parallel Computing in Python
- GPUs and Python: PyCuda, PyOpenCL
Files: tar.gz | PDF
- Introduction to Traits
Files: tar.gz | zip
Unless otherwise stated the tutorials will use packages that are available in EPD or PythonXY. Tutorial attendees should have the latest versions of these distributions installed on their laptops in order to follow along.
Prabhu Ramachandran, Kadambari Devarajan, Christopher Burns
This tutorial will introduce attendees to a typical interactive workflow using the scipy-stack. The tutorial is hands-on, with attendees working through exercises typically found in scientific computing. Sessions are interative and each session is followed by a series of exercises. While working through specific tasks we will introduce plotting with Matplotlib, the IPython environment, Numpy arrays, selected Scipy packages, along with an overview of Python language basics.
This tutorial assumes the audience has some previous experience with scientific computing, maybe some experience with a language like Matlab or IDL. We do not assume any previous experience in Python and will introduce language basics as needed. Upon completion of this tutorial, attendees will have a good overview of scientific computing in Python and be comfortable enough with the environment to explore further on their own.
- Overview of the IPython workflow, basic Matplotlib plotting, Python lists and strings.
- Dealing with data files and simple statistics, matrices in Numpy and least squares fitting.
- Solving linear equations, root finding, ODEs and FFTs.
- Review Python basics: data types, IO, control flow and functions.
- More on functions, modules and objects. Introduction to testing and debugging strategies.
- 3D plotting with Mayavi.
Required Software: As this is an interactive tutorial, you are expected to have the required software installed on your laptop so you can follow along. Please run this checklist to verify you have all the dependencies required for the tutorial. You should have the following installed:
Python distributions such as EPD or pythonxy contain the above dependencies and more! Attendees no familiar with installing python packages should consider using one of these all-in-one distributions.
The goal of the tutorial is to bridge from beginning use of matplotlib to more intermediate use, covering in more depth the various plotting methods and, especially, the various capabilities they have for being tweaked to produce just the right plot you're looking for. In some cases, not every detail can be covered, but the hope is that you come away with an awareness that a capability exists, so that you know how to look it up later. The tutorial will be conducted as a live coding session so the audience can follow along on their own computers if they wish. Each section will also include an exercise (~15 minutes) to reinforce material. Some of the specific covered topics:
- Basic Plotting
- Adding and labeling a set of plots
- Adding labels and controlling their properties
- More text and equations (mathtext)
- Adding a legend
- Annotating a plot
- Controlling ticks and gridlines (locators and formatters)
- 2D Plotting and Colormapping
- Displaying (non-uniform) gridded data (pcolor)
- Displaying images (imshow)
- Controlling colormapping (norms and colormaps)
- The aspect ratio
- Adding a colorbar
- Scatter: the plotting swiss army knife
- Adding artists by hand
- Vector fields (quiver and barbs)
- Working with dates
- Other plot types
- Brief demos (as time allows):
- Dropped spines
Stéfan van der Walt
This tutorial will cover advanced NumPy topics, including:
- Broadcasting in high dimensions
- Delays caused by memory and how to avoid it (cache effects, churn, for-loops)
- Indexing tricks
- The array interface: using NumPy to peek at foreign memory
- Generalised ufuncs
- Making use of the lessons learnt by NumPy developers (I): libnpymath
- Making use of the lessons learnt by NumPy developers (II): numpy.distutils and numscons
- New additions to NumPy 2.0: datetime, dot-method, Py3k-compatibility
The new features section is suitable to any audience, whereas the broadcasting section is more complex. A minimum requirement is to be comfortable with Python and familiar with the basics of NumPy (constructing and manipulating arrays, basic indexing). Anyone who has followed a fairly basic tutorial such as: http://mentat.za.net/numpy/intro/intro.html should be fine.
Students will learn the basics of signal processing with examples in Python. Sampling and filtering of data will be covered in the time and frequency domain. Students will learn signal analysis and system simulation techniques.
- Introduction to Signals and Systems (40 minutes)
- Continuous versus discrete signals
- Continuous versus discrete systems
- Continuous linear systems
- Transfer function
- Impulse response
- State-space equations
- Poles and zeros
- Digital Signal Analysis (1 hour)
- Sampling, aliasing
- Time-Domain Analysis
- Average, Peak-to-peak, RMS
- FIR filters and convolution
- IIR filters and recursion
- Frequency Analysis
- Proper use of FFT and IFFT
- Scaling frequencies and magnitudes
- Wrap-around mistake
- Power Spectral Density, Parseval's Theorem
- Frequency-Domain Filters
- System Analysis (20 minutes)
- Simulating systems
- Introduction to System Identification
- Frequency analysis, Cross Spectral Density
This tutorial will give an overview of parallel computing and then focus on specific libraries and tools available to parallelize Python code. Topic to be covered include:
- An overview of parallel computing
- Ahmdal's law
- Understanding performance bottlenecks
- Threading and the GIL
This tutorial will teach you how to make compute-intensive tasks much faster by using GPUs through OpenCL. To get the most out of this tutorial, you ideally:
- • Know how to use numpy at the level of the intro tutorial.
- • Have a basic working knowledge of C. (Sample questions: What's a pointer? How do I write a C loop that increments each entry of 256-long array by five?) Roughly, the material here through Section 7.
Based on this knowledge, I will show you how to:
- • get code and data onto the OpenCL compute device.
- • show you how to write a kernel for a simple computation in OpenCL's C dialect.
- • generate C code with templating.
- • use PyOpenCL's array abstractions.
- • benchmark and automatically tune the GPU implementation of an algorithm.
- • understand different machine architectures for which you might be optimizing your code.
It would be helpful if the attendees had PyOpenCL installed, which in turn requires NumPy. PyOpenCL requires an OpenCL implementation. Macs with Snow Leopard or newer come with one built in. Linux and Windows users may use the one supplied by their GPU manufacturer, if applicable.
Supported Nvidia GPUs:
- http://www.nvidia.com/object/cuda_gpus.html Nvidia users need to have 195.xx (or newer) drivers installed to haveOpenCL support.
Supported AMD GPUs:
- http://developer.amd.com/gpu/ATIStreamSDK/Pages/default.aspx#two Nvidia users need to have 195.xx (or newer) drivers installed to haveOpenCL support.
If no usable GPU is present, the CPU implementation by AMD will work. Requires x86/x86_64 CPU with SSE3. Installation support is available from the PyOpenCL mailing list: http://lists.tiker.net/listinfo/pyopencl. As a fallback, remote access to an OpenCL-capable cluster will be provided.
In addition, please have Jinja2 installed.
The Traits project allows you to simply add validation, initialization, delegation, notification and a graphical user interface to Python object attributes. In this tutorial we will explore the Traits toolset and learn how to dramatically reduce the amount of boilerplate code you write, do rapid GUI application development, and understand the ideas which underly other parts of the Enthought Tool Suite (such as MayaVi and Chaco plotting toolkits).
- Introduction to ETS and Traits
- Basic Traits + Trait types + Property Traits + Trait Validation
- Traits UI + Basic Traits UI + Tour of the Trait editors + Advanced Trait editors
- Notification in Traits + Static notification + Dynamic notification
- Advanced Traits UI + Customizing Views, Groups and Items + Traits UI Handlers + Buttons, Menus and Toolbars + Drag and Drop
At the end of this tutorial attendees will learn how to visualize numpy arrays using Mayavi's mlab interface. They will also learn enough about mayavi to be able to create their own simple datasets and visualize them. If this tutorial follows one on traits, then attendees will learn how easy it is to embed 3D visualization in their own application UIs (provided they are written in wxPython or PyQt).
In this tutorial, we first provide a rapid overview of Mayavi_ and its features. We then move on to using Mayavi via IPython_ and mlab. This is done in a hands-on fashion and introduces the audience to visualizing numpy arrays and the basic mayavi visualization pipeline. We then introduce the audience to the basic objects and data sources used in Mayavi. We end with an example of creating custom dialogs using Traits_ and embedding 3D visualization in these dialogs with Mayavi.