Workshop 1: Beginners Python
10-10:50 Tue 12 August LB203
Introduction
Today we are going to introduce you to:
- python coding
- jupyter notebooks
Just a word of warning, deploying these in a classroom rather than locally on my computer is new to me. I'm learning as we go, and we may have a few hiccups along the way!
Workshop
- use Chrome or Safari, do NOT use Firefox, its not loading the notebooks correctly
- you will be using your student account, but if you have any problems, I or one of the demonstrators will need to log you in via a teaching account
- feel free to use ChatGPT to help with coding, you can ask it to explain a section of code, we do this all the time!
- you will need this logfile ehimcl_opt_XX.log to work on, so download it or find it in the file explorer and copy it replacing XX with your initials, for example mine would be ehimcl_opt_TH.log
- follow the instructions here to get jupyter notebook up and running, these are actually written for the 207 lab but the process is the same. Don't use their *.ipynb file though, use the ones below:
- then work your way through the following notebooks, remember to copy the file and replace XX with your initials, work on your file!!
- basics of a notebook basics_notebook_XX.ipynb
- define variables variables_notebook_XX.ipynb
- make an array arrays_notebook_XX.ipynb
- get data from a file getdata_notebook_XX.ipynb
- plot data in a graph plotdata_notebook_XX.ipynb
- your turn! extract and plot the forces forces_notebook_XX.ipynb
- keep the last notebook open! This will need to be checked off (marked!) by an academic, they will also ask you some questions to gauge your understanding
- the workshop is out of 5, a rough outline of the mark shedule
- 1 turns up reads the ipynb workbooks runs code cells
- 2.5 creates some original code, is engaged, produces a graph with help
- 5 does all notebooks, actively engaged, produces a nice graph without much help
- on your own laptop?
Make sure to download and install anaconda or miniconda3 with anaconda-Navigator BEFORE the lab. This can take over 30min! Instructions here
I use miniconda as the full anaconda can be quite big. When using miniconda3 you need to install the navigator manually:
- conda activate base
- conda install --name base anaconda-navigator
- conda list --name base anaconda-navigator
- launch anaconda navigator like normal
- conda activate base
- conda install jupyter notebook numpy matplotlib scipy
- download the files, place them in a directory
- cd into the directory change the XX in the names
- execute jupyter: jupyter notebook --browser=safari
Alternatively by-pass navigator entirely and go straight to jupyter notebooks.