Daniel Winklehner, Remi Lehe

The Python interpreter

Daniel Winklehner, Remi Lehe

US Particle Accelerator School (USPAS) Summer Session

Self-Consistent Simulations of Beam and Plasma Systems

S. M. Lund, J.-L. Vay, D. Bruhwiler, R. Lehe & D. Winklehner

Old Dominion U., Hampton, VA, 15-26 January, 2018

Python interpreter: Outline

1

Overview of the Python language

2

Python, numpy and matplotlib

3

Reusing code: functions, modules, classes

4

Faster computation: Forthon

Overview

Scientific Python

Reusing code

Forthon

Overview of the Python programming language

Interpreted language (i.e. not compiled)

¡ú Interactive, but not optimal for computational speed

Readable and non-verbose

No need to declare variables

Indentation is enforced

Free and open-source

+ Large community of open-souce packages

Well adapted for scientific and data analysis applications

Many excellent packages, esp. numerical computation (numpy),

scientific applications (scipy), plotting (matplotlib), data

analysis (pandas, scikit-learn)

3

Overview

Scientific Python

Reusing code

Forthon

Interfaces to the Python language

Scripting

Interactive shell

Code written in a file, with a

text editor (gedit, vi, emacs)

Obtained by typing python or

(better) ipython

Execution via command line

(python + filename)

Commands are typed in and

executed one by one

Convenient for long-term code

Convenient for exploratory work,

debugging, rapid feedback, etc...

4

Overview

Scientific Python

Reusing code

Forthon

Interfaces to the Python language

IPython (a.k.a Jupyter) notebook

Notebook interface, similar to

Mathematica.

Intermediate between scripting

and interactive shell, through

reusable cells

Obtained by typing jupyter

notebook, opens in your web

browser

Convenient for exploratory work,

scientific analysis and reports

5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download