Gwybodaeth Modiwlau

Module Identifier
Module Title
Scientific Python
Academic Year
Semester 1 (Taught over 2 semesters)
Mutually Exclusive
MA25220, MT25220 and MX35220
Other Staff

Course Delivery

Delivery Type Delivery length / details
Lecture 20 x 1 Hour Lectures
Practical 11 x 1 Hour Practicals
Practical 10 x 1 Hour Practicals


Assessment Type Assessment length / details Proportion
Semester Exam 3 Hours   Exam at end of Semester 2  Online coding and data analysis exam in Llandinam B23 if possible  70%
Semester Assessment 2 x In-class test in Semester 1 (Proportion 2 x 15%)  Online coding test, in class time.  30%
Supplementary Exam 3 Hours   Exam at end of Semester 2  Online coding and data analysis exam in Llandinam B23 if possible.  100%

Learning Outcomes

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

Plan and execute a computational scientific experiment.

Demonstrate an ability to write small programs in Python

Demonstrate an understanding of the potential biases and sources of error in science.

Analyse a data set (process data, apply appropriate tests, calculate summary statistics, plot results).


Semester 1
Week 1: Introduction, types, variables, if-statements, for- and while- loops. The interpreter, and the evaluation of simple expressions. Editing, saving and loading code.

Week 2: The data structures: Lists and dictionaries.

Week 3: numpy arrays.

Week 4: Functions. Function definition, function calling

Week 5: Organising Python code. Generating documentation (e.g. pydoc), catching and handling exceptions, organising code into modules, executing main (and __main__)

Week 6: Objects and classes. Defining classes, instantiating an object. Inheritance.

Week 7: Working with objects

Week 8: File handling. CSV format.

Week 9: Plotting. Manipulate data and plot results.

Week 10: Review and revision classes

Semester 2
Week 1: The Scientific Method. Structure of a scientific investigation. Hypotheses. Occam's razor. Controls. Correlation vs causation. Falsification. Examples such as intention to treat.

Week 2: Randomness. Random number generators. Random distributions. Latin squares. Controlled and double blind trials.

Week 3: Summary statistics: measures of central tendency and dispersion. Use of scipy.

Week 4: Hypothesis tests. t-tests. Confidence. p-values. Correction of multiple tests. Correlation.

Week 5: Application to real data.

Week 6: Sampling. Bootstrap. Monte Carlo. Biases.

Weeks 7-9: Hot topics in science.

Week 10: Review and Revision classes.

Brief description

This module introduces students to the Python programming language and more broadly, the Scientific Python Stack. The module will then cover the basic structure of a scientific experiment, hypotheses and testing with illustrated examples of good and bad practice. We’ll discuss the difficulty in achieving randomness, sources of bias during sampling and introduce appropriate statistical testing processes for various types of study.

Module Skills

Skills Type Skills details
Application of Number Inherent in subject.
Communication Documenting code.
Improving own Learning and Performance From feedback (automatic feedback from computer and in-practical feedback from demonstrators).
Information Technology Inherent in subject.
Personal Development and Career planning No, though the skills in this module are highly in demand from employers.
Problem solving Problems will need to be overcome in order to develop solutions that behave and appear as intended.
Research skills Using a Computer. Searching the language and library documentation.
Subject Specific Skills Programming skills, debugging skills, statistics skills, data analysis skills.
Team work No.


This module is at CQFW Level 5