MODULE TITLE

Scientific Programming in Python

 

CREDIT VALUE

15

MODULE CODE

PHY1031

MODULE CONVENER

Dr J. Hatchell

 

 

DURATION

TERM

1

2

3

Number Students Taking Module (anticipated)

120

WEEKS

T1:01-12

T2:01-11

 

DESCRIPTION – summary of the module content (100 words)

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.

MODULE 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. write 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:

  1. apply logic to the solution of problems;
  2. keep proper records of work;
  3. apply the Python programming language to simple physical problems including calculations, modelling and data analysis;
  4. produce publication-quality plots;
  5. present a portfolio of work;

Personal and Key Transferable / Employment Skills and Knowledge:

  1. deal with the practicalities of writing a computer program;
  2. think and plan in a logical manner;
  3. apply a structured approach to problem solving.

SYLLABUS PLAN – summary of the structure and academic content of the module

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. Advanced Python
    1. File handling with contexts. Filename and process handling with 'sys' and 'os'.
    2. Classes and objects.
    3. Creating a Python program and /or module in an IDE. if __name_ == "__main__" and command-line arguments.
  6. Projects
    1. Programming project based on the stage 1 Physics programme content.

 

LEARNING AND TEACHING

 

LEARNING ACTIVITIES AND TEACHING METHODS (given in hours of study time)

Scheduled Learning & Teaching activities  

62 hours

Guided independent study  

88 hours

Placement/study abroad

0 hours

 

DETAILS OF LEARNING ACTIVITIES AND TEACHING METHODS

 Category 

 Hours of study time 

 Description 

Scheduled Learning & Teaching activities

18 hours

18×1-hour lectures

Scheduled Learning & Teaching activities

44 hours

22×2-hour supervised computer labs

Guided independent study

32 hours

8×4-hour Python homework assignments

Guided independent study

12 hours

1×12-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 the assessment e.g. duration/length

ILOs assessed

Feedback method

19×Python classwork assignments (formative)

8 hours

1-16

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 the assessment e.g. duration/length

 ILOs assessed 

Feedback method

8×homework assignments

80%

4 hours per assignment

1-16

Written and verbal

Programming project

20%

6 hours (homework) 6 hours (in class)

1-16

Written and verbal

 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

Programming project and homework assignments

Programming project (16 hours) 100% wt

1-16

August/September assessment period

RE-ASSESSMENT NOTES  

 

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.

Core text:

  • Not applicable

Supplementary texts:

ELE:

CREDIT VALUE

15

ECTS VALUE

7.5

PRE-REQUISITE MODULES

none

CO-REQUISITE MODULES

Vector Mechanics (PHY1021), Introduction to Astrophysics (PHY1022), Waves and Optics (PHY1023), Properties of Matter (PHY1024) and Mathematics Skills (PHY1025)

NQF LEVEL (FHEQ)

4

AVAILABLE AS DISTANCE LEARNING

NO

ORIGIN DATE

29-Mar-22

LAST REVISION DATE

18-Jun-22

KEY WORDS SEARCH

Physics; Python; Program; Structures; Function; Codes; Project; Data; Computing; Arrays; Designing.

Module Descriptor Template Revised October 2011