Scientific Python course
Lecture notes from the course taught at the University of Bordeaux in the academic year 2018 for PhD students. Each student needs to come with a notebook computer running either Linux, OSX or Windows.
Adapted from https://xkcd.com/353/
The scientific Python ecosystem is made of several modules that constitute together the scientific stack. There are hundreds of Python scientific packages and most of them are built on top of numpy, scipy, matplotib, pandas, cython and/or sympy. We won't cover everything in this short course, but you should get enough information to decide if your research can benefit from Python. And I bet it will likely do.
This course is based on the following teaching material:
- Software Carpentry (CC BY 4.0)
- Matplotlib tutorial (CC BY 4.0)
- Scipy Lecture Notes (CC BY 4.0)
- From Python to Numpy (CC BY-NC-SA 4.0)
1. Beginner course (day 1 & 2)
1.1 - Introduction (day 1)
This gentle introduction to Python explains how to install Python and introduces some very simple concepts related to numerical expressions and other data types.
1.2 - Programming with Python (day 1)
This lecture does not attempt to be comprehensive and cover every single feature, or even every commonly used feature. Instead, it introduces many of Python's most noteworthy features, and will give you a good idea of the language’s flavor and style.
1.3 - Computation I (day 2)
The primary goal of this lesson is to introduce the numpy (numerical python) module which is de facto the standard module for numerical computing with Python. It is essential for you to become familiar with this module since it will be used everywhere in the next lessons.
1.4 - Visualization (day 2)
This tutorial gives an overview of Matplotlib, the core tool for 2D & 2.5D plotting that produces publication quality figures as well as interactive environments across platforms.
2. Advanced course (day 3 & 4)
2.1 - Scientific computation II (day 3)
This lesson introduces the scipy package that contains various toolboxes dedicated to common issues in scientific computing. Its different submodules correspond to different applications, such as interpolation, integration, optimization, image processing, statistics, special functions, etc.
2.2 - Version control (day 3)
This lesson introduces version control using git. Version control is the lab notebook of the digital world: it's what professionals use to keep track of what they’ve done and to collaborate with other people. And it isn't just for software: books, papers, small data sets, and anything that changes over time or needs to be shared can and should be stored in a version control system.
2.3 - C/Python integration (day 4)
This chapter covers the many different routes for making your native code (primarily C/C++) available from Python, a process commonly referred to wrapping. The goal of this chapter is to give you a flavour of what technologies exist and what their respective merits and shortcomings are, so that you can select the appropriate one for your specific needs.
2.4 - Vectorization (day 4)
NumPy is all about vectorization. If you are familiar with Python, this is the main difficulty you'll face because you'll need to change your way of thinking and your new friends (among others) are named "vectors", "arrays", "views" or "ufuncs".