Skip to main content

Study information

Scientific Programming in Python - 2023 entry

MODULE TITLEScientific Programming in Python CREDIT VALUE15
MODULE CODEPHY1031 MODULE CONVENERDr Jennifer Hatchell (Coordinator)
DURATION: TERM 1 2 3
DURATION: WEEKS 11 11 0
Number of Students Taking Module (anticipated) 120
DESCRIPTION - summary of the module content
A knowledge of a computing language and how to write programs to solve physics related problems is a valuable transferable skill.  This module teaches the Python programming language, but the principles involved are applicable to almost every procedural programming language.  Python is an interpreted, high-level, general-purpose programming language that is widely used in commercial and academic environments and for scientific research including high level data analysis work.
 
The module is taught through a series of lectures and practical sessions based on Jupyter notebooks.  The student will learn the building blocks of the language, and a logical approach to coding, and use these to create their own programs with Physics applications.
 
AIMS - intentions of the module

Students learn to write clearly structured and documented programs in Python (Jupyter notebooks), and are able to find and use Python module functionality.

INTENDED LEARNING OUTCOMES (ILOs) (see assessment section below for how ILOs will be assessed)

On successful completion of this module you should be able to:

Module Specific Skills and Knowledge:

1. Explain and use standard features of the Python programming language including statements, assignments, objects, loops, conditionals and functions

2. Write and modify simple programs in Python

3. Find errors and debug code

4. Write structured code based on short routines with a clear purpose and interfaces that are simple and unambiguous

5. Self-explanatory, self-documenting code using markdown, docstrings and comments

6. Select and apply existing tools for scientific programming from modules including Numpy, Scipy, Matplotlib and Astropy, based on the documentation

Discipline Specific Skills and Knowledge:

7. Apply logic to the solution of problems

8. Keep proper records of work

9. Apply the Python programming language to simple physical problems including calculations, modelling and data analysis

10. Produce publication-quality plots

11. Present a portfolio of work

Personal and Key Transferable / Employment Skills and Knowledge:

12. Deal with the practicalities of writing a computer program

13. Think and plan in a logical manner

14. Apply a structured approach to problem solving

 

SYLLABUS PLAN - summary of the structure and academic content of the module
 
I Introduction to Python:
 
1. Running interactive Python; loading modules and packages; using Python as a graphical calculator; simple calculations, maths, simple functions and plotting
2. Using Jupyter notebooks with Numpy and Matplotlib
 
II Core Python programming:
 
1. Objects, variables and assignments.    Dynamic 'Duck' typing.   Numerical
datatypes
2. More datatypes: strings, lists, tuples, and dictionaries
3. Control flow I: Conditionals, comparisons and Boolean logic 
4. Control flow II: Loops
5. Functions: keyword and positional arguments, default arguments, *args and **kwargs, docstrings, variable scope
6. Program structure and documentation, error handling, testing and debugging
 
III  Python for labs:
 
1. Numpy arrays and datatypes
2. Using Numpy for reading and writing data; simple statistics; plotting data with errorbars
3. Fitting a straight line with a least-squares fit 
4. Nonlinear least-squares fitting with Scipy
5. Publication-quality plots with Matplotlib:  multiple axes, control of plot elements
 
IV  Python packages and modules:
 
1. How to find out what's available and use the documentation
2. Further examples from Matplotlib e.g. histograms, 2D plots
3. Further examples from Numpy e.g. random numbers, matrices
4. Introduction and examples from Scipy e.g. root finding and numerical integration
5. Introduction and examples from Astropy e.g. reading and displaying FITS images
6. Introduction and examples from pandas, e.g. reading and manipulating tabular data
 
V Advanced Python:
 
1. Handling files and filenames with contexts and ‘os’
2. Classes and objects 
3. Creating a Python program and /or module in an IDE.   if __name_ == "__main__" and command-line arguments
 
VI Projects:
 
1. Programming project based on the Stage 1 Physics course content
 

 

LEARNING AND TEACHING
LEARNING ACTIVITIES AND TEACHING METHODS (given in hours of study time)
Scheduled Learning & Teaching Activities 62 Guided Independent Study 88 Placement / Study Abroad 0
DETAILS OF LEARNING ACTIVITIES AND TEACHING METHODS
Category Hours of study time Description
Scheduled learning and teaching 18 hours 18x1 hour lectures
Scheduled learning and teaching 44 hours 22x2-hour supervised computer labs
Guided independent study 32 hours 8x4-hour Python homework
Guided independent study 12 hours 1x12-hour Python project
Guided independent study 44 hours Reading to support own learning requirements


 

ASSESSMENT
FORMATIVE ASSESSMENT - for feedback and development purposes; does not count towards module grade
Form of Assessment Size of Assessment (e.g. duration/length) ILOs Assessed Feedback Method
19x Python classwork 8 hours 1-14 Written and verbal

 

SUMMATIVE ASSESSMENT (% of credit)
Coursework 100 Written Exams 0 Practical Exams 0
DETAILS OF SUMMATIVE ASSESSMENT
Form of Assessment % of Credit Size of Assessment (e.g. duration/length) ILOs Assessed Feedback Method
8x Homework assignments 80% 4 hours per assignment 1-14 Written and oral
Programming project 20%
6 hours (homework), 6 hours (in class)
 
1-14 Written 

 

DETAILS OF RE-ASSESSMENT (where required by referral or deferral)
Original Form of Assessment Form of Re-assessment ILOs Re-assessed Time Scale for Re-assessment
Homework assignments and programme project Programming project (32 hours) (100%)  1-14 August reassessment period

 

RE-ASSESSMENT NOTES

Re-assessment is not available except when required by referral or deferral.

RESOURCES
INDICATIVE LEARNING RESOURCES - The following list is offered as an indication of the type & level of
information that you are expected to consult. Further guidance will be provided by the Module Convener

Web-based and electronic resources:

ELE: https://vle.exeter.ac.uk/course/view.php?id=14084

Other Resources: None

 

Reading list for this module:

Type Author Title Edition Publisher Year ISBN
Set Hill, C. Learning Scientific Programming with Python Cambridge 2020 978-1-108-74591-8
CREDIT VALUE 15 ECTS VALUE 7.5
PRE-REQUISITE MODULES None
CO-REQUISITE MODULES None
NQF LEVEL (FHEQ) 4 AVAILABLE AS DISTANCE LEARNING No
ORIGIN DATE Thursday 28th April 2022 LAST REVISION DATE Friday 2nd June 2023
KEY WORDS SEARCH Physics, Python, Program, Structures, Function, Codes, Project, Data, Computing, Arrays, Designing

Please note that all modules are subject to change, please get in touch if you have any questions about this module.