In order to do this module, you’ll need some core software tools. As the module proceeds we’ll also install several more Python packages, but you don’t need to install those right now. The core tools you will need are:
Python version 3.6 or later.
Git (the revision control system we’re going to use).
A Python-aware text editor. Visual Studio Code is recommended, and all the instructions in this course will assume that this is what you are using.
The Faculty of Natural Sciences at Imperial has centralised instructions for installing all of these tools, and we’ll follow those.
Your implementation will be written in Python based on a code skeleton provided. This means that you’ll need a certain familiarity with the Python language. But don’t panic! Python is a very easy language to work with. This module will use Python 3.
If you haven’t done any Python before, then go through the official Python tutorial. If you have done a little Python but perhaps are not so familiar with the object-oriented features such as classes, then you might like to refer to the online book Object-oriented Programming in Python for Mathematicians. We will be using classes extensively in this course.
The Matlab-like array features of Python are provided by Numpy for which there is a helpful tutorial. There is also a handy guide for Matlab users. In that context, the code provided in this course will always use Numpy arrays, and never Numpy matrices.
If you don’t already have Python 3.6 or later installed on your computer, follow the FoNS Python instructions. We will exclusively use virtual environments so it doesn’t matter at all whether you use Python from Anaconda or from another source. Mac users should note, though that the built-in Python will not do, so you should use either Homebrew or Anaconda.
The example code in the exercises uses f-strings which were introduced in Python 3.6, so the code will not work in earlier versions of Python.
Revision control is a mechanism for recording and managing different versions of changing software. This enables changes to be tracked and helps in the process of debugging code, and in managing conflicts when more than one person is working on the same project. Revision control can be combined with online hosting to provide secure backups and to enable you to work on code from different locations.
In this module, you’ll use revision control to access the skeleton files, and to update those files if and when they change. You’ll also use the same revision control system to record the edits you make over time and to submit your work for feedback and, eventually, marking.
If you are a more confident computer user, you could go ahead and set up git to work with ssh, the secure shell. This will save a lot of password typing but it’s not essential so if you are not so confident with computers, you can skip this bit. GitHub provide instructions for using ssh with git.
Visual Studio Code¶
Visual Studio Code is a Python-aware Integrated Development Environment (IDE). This means that it incorporates editing files with other programming features such as Debugging and testing, Git support, and built-in terminal. Visual Studio Code also provides an incredibly useful remote collaborative coding feature called Live Share. This will be very useful for getting remote help from an instructor.
Install Visual Studio Code using the FoNS Visual Studio Code installation instructions.
Follow the FoNS Visual Studio Live Share instructions instructions to learn how to set up a Live Share. Pair up with someone else taking the module to ensure that you can share your Visual Studio Code session with them, and they with you. If you need to find someone else taking the module to do this exercise with, you can use this Piazza post <https://piazza.com/class/kiujdiwgpk5su?cid=1>.
The command line¶
A lot of the routine activity involved in this module revolves around executing commands on the command line. For example you use the command line to work with the revision control system.
If you’re not familiar with the Linux command line, then follow at least the first two sections of the Software Carpentry Unix Shell lesson. That guide focusses on the Bash shell, but zsh and the Windows Powershell use very similar commands.