Python for Physicists

This course is an introduction to programming in Python for people with little or no previous programming experience . It is aimed primarily at physical scientists, using the analysis of UV-Vis data as a motivating example. Although it references the Jupyter Notebook, it can be taught using a regular Python3 interpreter as well.

Questionnaire

Please complete this questionnaire at the start of the course.

Prerequisites

  1. Learners should install Python before the class starts. Please see the setup instructions for details.

  2. Learners should download the data before class. Please see the setup instructions for details.

Schedule

Setup Download files required for the lesson
00:00 1. Running Python How can I run Python programs?
00:40 2. Variables and Assignment How can I store data in programs?
01:10 3. Data Types and Type Conversion What kinds of data do programs store?
How can I convert one type to another?
01:50 4. Built-in Functions, Help and Errors How can I use built-in functions?
How can I find out what they do?
What kind of errors can occur in programs?
02:20 5. Lists How can I store multiple values?
03:05 6. For Loops How can I make a program do many things?
03:35 7. Conditionals How can programs do different things for different data?
04:15 8. Writing Functions How can I create my own functions?
05:30 9. Variable Scope How do function calls actually work?
How can I determine where errors occurred?
05:55 10. Libraries How can I use software that other people have written?
How can I find out what that software does?
06:35 11. Storing data in Numpy arrays What is a Numpy array and when is it useful?
How can I import and clean data in Python?
07:20 12. Retrieving data from Numpy arrays How can I select data from a NumPy array?
08:00 13. Visualizing data with Matplotlib How can I plot my data?
How can I save my plot for publishing?
08:50 14. Analysing data using Numpy How can I analyse data using Numpy?
How can I fit a polynomial function to data?
How can I apply mathematical operations to my data?
10:15 15. Code Quality How can I make my programs more readable?
How can programs check their own operation?
How can I document my code?
How can I make my code more reproducibility?
10:55 16. Running your Code as a Python Script How can I export my Jupyter notebook as a Python script?
How do I run a Python script?
How can I pass an argument to my script?
11:35 17. Wrap-Up What else is out there and where do I find it?
11:55 Finish