Course information
This postgraduate course is designed to give a general introduction to the Python programming language and its wider ecosystem, with a focus on the elements most important for data analysis and scientific research.
The course is aimed at students on the MSc Machine Learning in Science (MLiS) programme at the University of Nottingham (for which it is PHYS4038) as well as first-year PhD students at the University of Nottingham and a number of other institutions, via the Midland Physics Alliance Graduate School (MPAGS AS1). Students taking this module are expected to have a limited level of prior programming experience, but not necessarily in python.
Joining the course
MSc students should enrol via the University of Nottingham module enrolment form, after discussing their options with their tutor. You can self enrol on the module Moodle page
PhD students should enrol for the module via the MPAGS module sign-up page. If you are enrolling late, please also email the convenor.
Getting Setup
If you are taking this course in person at Nottingham the workshops will use computers already containing the necessary software. However, if doing the sessions remotely or setting up your own computer for work outside the sessions you will need to install the following:
Install:
You will need to create a github account. If attending in person we will do this in the first session. Registration with github classroom can then be done by clicking on an email link to the first weeks files. This will be sent out in the week commencing 2nd October. If you do not receive this link please contact me.
On vscode you should install a few extensions.
- python (required)
- Jupyter Notebooks (required)
- github classroom (required)
- liveshare (if you are taking the course remotely. Watch the video and work out how to create a link to share your session)
Lecturer contact
The course is taught by Dr Mike Smith. Outside of synchronous teaching sessions you can contact him via email.
Timetable
The main course runs for the whole of the Autumn term.
- There will be a 2 hour session every week (Tuesday 1-3pm, George Green Library A13).
- In Week 6 there will be a 1 hour in-class test in place of the usual session (Taught Masters only).
- Vivas in week 9 (Taught Masters only)
- The projects will be released in week 3 and must be submitted by Friday 8th December (5pm).
- Vivas for those on taught Masters courses will be arranged in this final week.
Topics
An outline of the topics is given below. This may be slightly altered and expanded as the course progresses.
- Session 1: Introduction, setup, using Conda and importing packages
- Session 2: Overview of Python core language
- Session 3: Numerical Python and Plotting (Numpy and Matplotlib)
- Session 4: Scipy, other libraries and figuring things out
- Session 5: Manipulating Data - Pandas
- Session 6: In-class test (Taught MSci students only)
- Session 7: Object Oriented Programming
- Session 8: Git and Github
- Session 9: Testing, Debugging, Refactoring
- Session 10: Session for project help
Assessment
The assessment varies depending on whether you are taking this module as a taught masters student or via MPAGS (Research Masters / PhD students)
Taught Masters students
Assessment for this module comes in 3 parts:
- An in-class test in week 6. This will be controlled conditions but, you will be allowed access to the previous session notes and documentation for any external modules you are required to use. The test will last 1 hour. If you have a support plan which allows extra time please contact me in advance of the test. (35%)
- A brief viva with staff concerning your project in week 9 of the course (Week commencing Nov 27th). (20%)
- Submission of a Project (see details below) as a Jupyter Notebook by (45%)
MPAGS
To qualify for MPAGS credits, you will need to demonstrate sustained engagement with the course. This includes submitting an acceptable effort at the exercises in the taught sessions and producing a Python program. Your program may address any scientific purpose you like, e.g. data analysis, simulation, modelling, experiment control, visualisation, etc. Ideally the program will do something that is relevant for your research projects. MPAGS students are not required to take the in-class test.
Project Code Guidelines
A project template is provided as an assignment, which you can synchronise in the same way you do with the exercises each week.
We ask that where possible projects are submitted as a Jupyter Notebook (*.ipynb). The Jupyter Notebook should not only provide code but be structured with Markdown cells which explain:
- The aim of the project and the problem it is solving
- An overview in words of how the code works
- A discussion of design decisions taken in structuring the code.
- How you would develop / improve the code if given more time
We do recognise that there are certain projects using, for example GUI frameworks where a set of code files is better. In this case you will need to submit a pdf report covering the above points.
In addition to the Jupyter Notebook / code, you should also submit:
- a Conda environment file which enables your notebook to be run. Please ensure you test this on a Windows machine.
- any output that cannot easily be embedded in the notebook (e.g an example data file or some visualisation, pdfs)
- Additional code / modules (which will not be assessed) can also be included as python files in the same repository and then imported. Please make sure you use relative imports in your code.
Your program should (as a rough guide)…
- do something meaningful: analyse real data or perform a simulation
- define at least two user functions (but typically more)
- make use of appropriate specialist modules
- comprise >~ 50 lines of actual code (excluding comments, imports and other ‘boilerplate’)
- contain no more than 1000 lines in total (if you have written more, please isolate an individual element)
Viva
MSc students must also have a short viva (5 mins) with members of staff which will be held during week 9 of the course (Week commencing Nov 27th) of term. The only preparation necessary for this viva is to ensure you are familiar with the project you have submitted. This will take the form of a code review. You’ll be asked questions about your code, design decisions and alternative approaches you might have taken.