Our tools#
We are going to start working in the Jupyter Notebook. This is an interface that allows us to interact with the Python programming language.
There are many ways of installing Python and the Jupyter Notebook. The best way of installing Python depends on many things. For this iteration of the class, we installed Python using the Anaconda distribution. We discuss this more below.
Python#
Python is a very popular programming language that is growing quickly.
It is free and open-source.
Among its advantages are:
Python code is famously easy to read and write;
As a result, it is a popular language for teaching, in schools and universities. Just for example, the Raspberry Pi computer is so-named because many of its teaching materials are in Python.
It has a very wide range of libraries, including many libraries for tasks in science, such as data analysis, statistics and visualization. For example, there are libraries for designing and running Psychology experiments.
It is widely used in teaching, science and industry.
Because it has a large open-source community, it is easy to find other people working on the same thing as you, in Python. The community has a strong background in good practices for code, such as testing, and writing code that is clear and simple.
For a comparison of Matlab and Python, see this blog post.
The Jupyter Notebook#
We will soon here more about the Jupyter Notebook. It is a particularly easy interface to run Python code, and display the results.
The Notebook has two parts. The first is the web application, that you interact with. This is the web client. The web client then sends commands to another process on your computer, called the kernel. The kernel runs Python. The client sends Python commands to the kernel, and the kernel runs the commands, generates the results, and sends any output back to the client for display. Outputs include the display of values, and plots from plotting commands.
The Notebook is just one way to run Python commands; there are many others, and we will cover some of these later in the course. The notebook is a particularly good way of running code for beginners, because it gets you started very quickly, in a familiar interface (the web browser). As you gain experience, you will find that you will outgrow the Notebook, because it is not a good interface for writing more than a small amount of code. When you get there, you be much more efficient using a good code editor, such as Atom.
Installing Python#
As we said above, there are many ways to install Python.
Which way you choose will depend on factors such as:
How much you are using Python;
What operating system you are running (macOS, Windows, Linux);
What method your colleagues are using.
The method that many people use for courses such as this, is to use Anaconda to install Python and various important Python libraries.
Anaconda is an application that can install Python and various libraries with a few clicks. It is built and maintained by a company, also called Anaconda, but they give away the distribution for free, for various reasons.
Anaconda is a good option for Windows, because Windows is a relatively complicated platform for building code, such as Python and its libraries. As a result, some of the other methods of installing Python libraries do not work as well on Windows as they do for other platforms. Because Anaconda works on Windows and Mac and Linux, it is easier to deal with installation problems for a class; everyone is likely to have similar problems, and you (the student) will be using the same installation as us (the instructors).