Prelab Setup

This page provides instructions to install the software necessary to complete prelab assignments, including: Miniconda, Spyder, Jupyter Notebook, and Python packages.

Miniconda installation

Miniconda is a cross-platform distribution of the Python programming language and common libraries; it is a lightweight version of the Anaconda distribution. Miniconda allows you to install Python on your own computer and use Jupyter Notebooks to work on the prelabs.

To install Miniconda, follow these steps:

  1. Download the latest Miniconda installer by visiting the miniconda installation webpage and clicking on the link corresponding to your preferred operating system (Windows, Mac or Linux).
  2. Open the downloaded installer file and follow the default installation procedure for your operating system, which often starts by simply double-clicking on the installer file.
  3. Launch a terminal or command window, e.g., by double-clicking on the Anaconda Prompt (miniconda3) application.
  4. Bring Miniconda up to date by typing the following command into the terminal or command window:
conda update -n base -c defaults conda

The miniconda prompt with update command on a Windows computer You may see the following line appear in the terminal or command window:

Proceed ([y]/n)?

Type “y” and press enter to confirm and continue with the update.

Spyder - Python Integrated Development Environment (IDE)

Spyder provides a code editor with syntax highlighting and debugging capabilities for Python. It will be helpful to write the Python scripts required by the prelabs and labs.

In the same terminal or command window, enter the command line below to install Spyder

conda install -c anaconda spyder

And again enter “y” and hit enter to confirm installation.

The Spyder application can be found just like any other application in your application finder. The IDE looks like the image below.

Spyder IDE with the code given by the first prelab

Matplotlib and NumPy Libraries

There are many Python libraries, or modules, written by other people that will be useful for additional functionality. For our purposes in particular, we will add the NumPy library for working with arrays and matrices, and the Matplotlib library for creating plots of data and signals. These two libraries provide Matlab-like functionality to Python programming.

To install these modules, issue the following commands in the terminal window

conda install matplotlib
conda install numpy

Jupyter Notebook installation

Jupyter Notebook is another Python library that allows us to create and interact with documents that contain text, mathematics, Python code, and computational results and plots.

The instructional staff will provide you with prelabs and labs that are formatted as Jupyter Notebooks, and you will writeup your solutions and lab reports in the same format as well.

Type the following line to install jupyter notebook.

conda install -c conda-forge notebook

Prelab assignment instructions

After the installation is complete, run the jupyter notebook application by typing

jupyter notebook

This should open a wepage in your default web browser showing directories. Click on the directories leading to the folder containing the prelab, then open it (the prelabs are files with the .ipynb extension).

Your will see that your task is to write a python code in one of the cells. We suggest using Spyder to first write and test your code then copying over to the cell in the prelab.

Good luck!