7.1. Introduction to Python for Physicists#
In this repository, you can find the source code of the material developed for an introduction to Python for physicists that runs as a “minicourse” of 1.5 ECTS as part of the “First Year Physics Lab Course” of the Applied Physics program at TU Delft.
The course consists of 6 core Jupyter notebooks, and additional materials, designed for self-study. The notebooks are self-contained, and include an explanation of the concepts, example code to illustrate the concepts, and exercises (with answers at the end) for testing your knowledge. There are an additional two notebooks with extra material: Notebook 7 for the curious student wanting to learn about building GUI’s, and notebook 8 with a few extra practice exercises for students wanting more practice material. Below an overview of what is in each notebook.
Notebook |
Description |
Type |
---|---|---|
Notebook 1 |
Python Basics |
Core material |
Notebook 2 |
Functions |
Core material |
Notebook 3 |
Program flow |
Core material |
Notebook 4 |
Scientific computing |
Core material |
Notebook 5 |
Data analysis |
Core material |
Notebook 6 |
Uncertainties |
Core material |
Notebook 7 |
GUI’s |
Addtional |
Notebook 8 |
Practice material |
Practice |
Example exam |
Example exam |
old exam |
The notebooks are designed for people with no programming background at all, and are used in the course during 8 afternoons (32 hours). By the end of the course, you should be familiar with:
Basic concepts in Python: What is Python and how does it work
Functions in Python: How to write them and how to use them
Program flow control: How to control the flow of execution of your code
Scientific computing in Python: Introduction to the numpy library
Data in Python: How to load, plot and fit data
Measurement uncertainty and error propagation: Quantify measurement uncertainties and calculate how these propagate to your final answer.
Each notebook of the first 5 Notebooks start with a pre-post test. If you have some knowledge of programming, you can make the test and see whether you already know the content. If you can make the test without any problems, skip the module. If you are not familiar with programming (in Python), go through the module, do the exercises and finish with the test to see whether you mastered the content. Each notebook includes a list of detailed learning objectives so you know what you should be learning. In addition, there is a “notebook for more advanced programmers”, exploring additional programming concepts in python.
7.1.1. How to use them#
If you want to use the notebooks for learning Python, you can download this zip file:
The zipfile also includes instructions on how to install Python and start up the notebook server.
7.1.2. Feedback#
Did you find a typo? Is there something that is not clear to you? Is there a mistake in the notebooks? We gladly welcome feedback! To give feedback, the easiest for us is for you to submit an “issue” in our repository issue tracker:
In the message, please include:
The notebook number
Copy-and-paste the text from the notebook
Optional: Describe your suggestion (with a typo not needed even)
7.1.3. Developers#
The first five notebooks were developed by Gary Steele g.a.steele@tudelft.nl with input and feedback from Jeroen Kalkman J.Kalkman@tudelft.nl and Freek Pols c.f.j.pols@tudelft.nl. These notebooks were then developed further by Freek. All other notebooks were developed by Freek Pols
Copyright Delft University of Technology and contributors 2019.
7.1.4. Contents#
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
7.1.5. Source code#
Copyright (c) 2019, Delft University of Technology and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of TU Delft nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
Warning
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DELFT UNIVERSITY OF TECHNOLOGY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.