Learning outcomes

The students are introduced to programming. The programming language chosen is Python. In the end, the students will be able to understand and to create themself a Python program to read various data coming from either experimental measurements (IR, cyclovoltametry, NMR, ...) or theoretical calculations (QM, MM, ...), to treat them and to print them out in a nice way (tabular, graphic, ...).

Goals

To be able to write a python script in order to read a file, treat its data and output some values in a table, a graphic, ...

Content

 

The various concepts behind programming and more particularly behind programming in Python will be developed:

 

1  Introduction

 

2  Introduction to Python language

2.1 Python interpreter

2.2 Python from a script

 

3  Numerical types and operators in Python

3.1 Numbers

3.2 Boolean

3.3 Comparison

 

4  Variables in Python

4.1 Define a variable

 

5  Reading and writing Data in Python

5.1 Reading data and conversion

5.2 Print out data

 

6  Strings in Python

6.1 String formatting

6.2 Operations on string

6.3 Comparison

6.4 Indexing and slicing string

 

7  Conditional Branching in Python

 

8  Loops in Python

 

9  Lists in Python

9.1 Operations on list

9.2 Comparison

9.3 Indexing and slicing list

 

10  Tuples in Python

10.1 Operations on tuple

10.2 Comparison

10.3 Indexing and slicing tuple

 

11  Function and methods with iterable

 

12  Lists are mutable

 

13  Dictionary in Python

13.1 Comparison

13.2 Dictionary indexing

13.3 Dictionary methods

 

14  Summary of Data Containers in Python

 

15  More on loops in Python

 

16  Read from and write to files in Python

16.1 Info on the files

16.2 Opening and closing files

16.3 Parsing files

 

17  Defining functions in Python

17.1 General aspects

17.2 Default argument values and keywords arguments

17.3 Copy of data when passing arguments

17.4 Lambda function

 

18  Modules in Python

 

19  Errors and Exceptions in Python

 

20  Module NumPy

20.1 Creation of array class

20.2 Attributes of an array

20.3 Indexing and slicing

20.4 Copy and Views

20.5 Arithmetic operations

20.6 Universal functions

20.7 Methods and functions

 

21  Module Scipy

 

22  Module Re for regular expressions

 

23  Defining a class in Python

23.1 General aspects

 

24  Other interesting modules

 

25  Miscellaneous

Table of contents

 

1  Introduction 

2  Introduction to Python language

3  Numerical types and operators in Python

4  Variables in Python

5  Reading and writing Data in Python

6  Strings in Python

7  Conditional Branching in Python

8  Loops in Python

9  Lists in Python

10  Tuples in Python

11  Function and methods with iterable

12  Lists are mutable

13  Dictionary in Python

14  Summary of Data Containers in Python

15  More on loops in Python

16  Read from and write to files in Python

17  Defining functions in Python

18  Modules in Python

19  Errors and Exceptions in Python

20  Module NumPy

21  Module Scipy

22  Module Re for regular expressions

23  Defining a class in Python

24  Other interesting modules

25  Miscellaneous

Exercices

A list of exercices will be given to the student along the evolution of the lecture. The solutions will also be given.

Assessment method

The evaluation consists in a work: write a program in relation with their master work.

This program should read some data, treat them and output them in a nice way (tabular, graphic, ...)

The various aspects of the program that are required will be explained at the end of the lecture.

Sources, references and any support material

During the lecture, some references will be made to the official Python documentation:

http://docs.python.org/3/

Language of instruction

Français
Training Study programme Block Credits Mandatory
Master in Chemistry Standard 0 4
Master in Chemistry Standard 0 4
Standard 0 4
Master in Chemistry Standard 1 4
Master in Chemistry Standard 1 4
Standard 1 4