Python. und statistische Methoden der Datenanalyse

Ähnliche Dokumente
Einführung in Python Teil II Bibliotheken für wissenschaftliches Rechnen

Python Einführung. Monica Selva Soto. 24 März Mathematisches Institut

Computerphysik II. Python Einführung. S. Gerlach. WiSe S. Gerlach Computerphysik II

Computerphysik II. Python Einführung. S. Gerlach. WiSe S. Gerlach Computerphysik II

Python - Open-Source-Werkzeuge für Wissenschaftler und Ingenieure

2D - Plotten / Visualisierung

Introduction to Python. Introduction. First Steps in Python. pseudo random numbers. May 2016

Einführung in Python/Matplotlib

Teil XI. Wissenschaftliches Rechnen in Python

Bildverarbeitung mit Python

Einführung in Python Teil I Grundlagen

Python für Wissenschaftler

Introduction to Python. Introduction. First Steps in Python. pseudo random numbers. May 2018

Teil XII. Wissenschaftliches Rechnen in Python

Teil XII. Wissenschaftliches Rechnen in Python

Minimaleinführung in Python 3

Teil XII. Wissenschaftliches Rechnen in Python. T. Neckel Einführung in die wissenschaftliche Programmierung IN8008 Wintersemester 2017/

A2.1 Python. Algorithmen und Datenstrukturen. Algorithmen und Datenstrukturen. A2.1 Python. A2.2 Kurzer Sprachüberblick. A2.3 Selectionsort in Python

Algorithmen und Datenstrukturen

Beispiellösung zu Aufgabe 10.3c)

Gültigkeitsbereich. T. Neckel Einführung in die wissenschaftliche Programmierung IN8008 Wintersemester 2016/

Einführung in das Natural Language Toolkit

Kurze Einführung in (I)Python und Matplotlib richard rascher-friesenhausen

Einführung in die Computerlinguistik

Funktionen. Theorie. Inhaltsverzeichnis. Programmieren mit Python Modul 4. 1 Modulübersicht 3

Algorithmik kontinuierlicher Systeme. Einführung in Python

image.png Die Dokumentation von Python, welche ich so sehr empfehle, findet ihr hier:

Algorithmik und Programmieren

mit Dämpfung : mit :sin(α)=tan(α)=x/l m g x=0bzw : l oder x r m v l bzw : v= g l

Die freie Programmiersprache Python mit Beispielen für ihren praktischen Einsatz. Python User Group Köln

Crashkurs Python und Sage U23 Krypto-Mission

Computergrafik 2: Übung 1. Eclipse, PyDev, NumPy, Matplotlib

1 Berechnung von Summen (ca = 10 Punkte)

Python Zahlen, Strings Logik Kontrollstrukturen. Scriptsprachen. Python Basics. Sascha Winter

Python zur Lösung von AvA Übung 1 VON MORITZ FEY

das ROOT-Framework Datenanaufnahme, Speicherung, Visualisierung & Analyse

Quick-Start Informatik Programmieren in Python Teil 2

Informatik für Mathematiker und Physiker Woche 6. David Sommer

Multimedia Programmierung mit Python

Bildverarbeitung mit Python

pandas ist ein Modul, das Datencontainer anbietet, ähnlich den DataFrames in R Die wich gsten Datencontainer sind: pandas.

Rechnernutzung in der Physik Computeralgebra/Mathematica

PYTHON. 04 Funktionen II, Module

Ursprünge. Die Syntax von Java. Das Wichtigste in Kürze. Konsequenzen. Weiteres Vorgehen. Rund um Java

Grundlagen der Programmierung

Toolbox Workshop. PeP et al. e.v. Nützliche Programme für Physikstudenten. Igor Babuschkin Kevin Dungs Christian Gerhorst.

Eine sehr kurze Einführung in Python und SimpleITK Teil 1 richard rascher-friesenhausen

1 12. Vorlesung: Singulärwertzerlegung,

1 Motivation. Informatik I: Einführung in die Programmierung. 2 Installation. Motivation

ffl RENAME Λ Doppelklick auf Reihe1 Λ title Λ neuen Namen eingeben, z.b. Zins1 Λ r Reihe2 Zins2 ffl DELETE Λ Einfachklick aufzins1 Λ delete Λ d zins2

Programmieren in Python

Profiling in Python. Seminar: Effiziente Programmierung. Jan Pohlmann. November Jan Pohlmann Profiling in Python November / 32

Einführung in. Pierre Bayerl

Programmierkurs Python I

Python Workshop i. Python Workshop

Bioinformatik für Biochemiker

Kontrollstrukturen. T. Neckel Einführung in die wissenschaftliche Programmierung IN8008 Wintersemester 2016/

Modulare Programmierung

PPS "Bits on Air" 1. Teil, Matlab-Tutorial Vorbereitungsaufgaben (Lösungsvorschläge)

1 def Anweisung. 2 Argumentübergabe. 3 Lokale Variablen. 4 Default Argumente. 5 Aufruf mit Schlüsselwort. 6 Variable Argumente. Funktionen in Python

Funktionen in Python

Programming 101. Carl Herrmann IPMB & DKFZ

Programmieren in Python

WS2018/ Oktober 2018

Computergestützte Datenauswertung

Klassen und Objekte. Klassen und Objekte

WS2017/ Oktober 2017

Teil IV. Funktionen und Module

Ausnahmen-Behandlung

SFZPy Sj. 17/18. Python Jupyter / Spyder. SFZ 16/17 W.Seyboldt

Java Tools JDK. IDEs. Downloads. Eclipse. IntelliJ. NetBeans. Java SE 8 Java SE 8 Documentation

1 Autorennen ( = 11 Punkte)

Informatik I. 27. Wissenschaftliches Rechnen mit numpy, scipy und matplotlib Albert-Ludwigs-Universität Freiburg.

Algorithmik und Programmieren Brückenkurs Informatik Benedikt Hupfauf

lektion5 November 15, 2018

AuD-Tafelübung T-B5b

Thomas Sillmann. Swift im Detail HANSER

das ROOT-Framework Datenanaufnahme, Speicherung, Visualisierung & Analyse

Grundlagen MATLAB. Vorlesung Batteriemodellierung mit MATLAB

D-MATH Numerische Methoden FS 2019 Dr. Vasile Gradinaru Marco Petrella. Serie 1

Einführung in numerische Simulation mit Python

Programmierung in Python

2.2 Spezifikation abstrakter Datentypen. 2.3 Implementierung und Anwendung von ADT. 2.4 Datenabstraktion und Objektorientierung

(I)Python in Labor & Lehre

Einführung in MATLAB + MATLAB Simulink. Dipl.-Inf. Markus Appel

Softwareprojektpraktikum Maschinelle Übersetzung Kurze Einführung in Python

Inhaltsverzeichnis. Ulrich Stein. Einstieg in das Programmieren mit MATLAB ISBN: Weitere Informationen oder Bestellungen unter

Motivation Von Funktoren, Komposition, Applikation Zu Monoiden Die Monade Zusammenfassung. Monaden für alle. Franz Pletz

Programmierkurs Python I

Prof. Dr. Stefan Funken, Dipl.-Ing. Christoph Erath 15. Mai WiMa-Praktikum (Matlab 2/9) Einführung in LATEXund Matlab

Nochmal Typen und Objekte

import matplotlib.pyplot as plt from numpy import sin, exp, linspace, arange, pi macht das Gleiche wie

Brückenkurs Informatik Algorithmik und Programmieren. Justus Piater

Inhaltsverzeichnis. Ulrich Stein. Programmieren mit MATLAB. Programmiersprache, Grafische Benutzeroberflächen, Anwendungen

Haskell for Hackers... or why functional programming matters

EINFÜHRUNG IN DIE WISSENSCHAFTLICHE DATENANALYSE

Informatik I. Informatik I Motivation Installation Das Modul numpy Funktionswerte zeich nen) 27.1 Motivation.

Transkript:

Python und statistische Methoden der Datenanalyse

Python-Grundlagen moderne Hochsprache unterstützt Skripting (Prozeduren u. Funktionen) objektorientiet (Klassen) Funktionale Programmierung (z.b. List-Comprehension) Batteries included ipython (komfortable Interpreter) NumPy/SciPy (Vektor/Matrixoperationen, Sammlung wissenschaftlicher Routinen) MatPlotLib (2D Datenvisualisierung)

Dokumentation Python Homepage Python Tutorial Python Einführung (deutsch) NumPy/SciPy homepage SciPy Cookbook MatPlotLib Homepage Übungsmaterial

Computerpool Physik python, ipython, numpy, scipy and matplotlib ist berteits installiert start mit ipython (beim ersten Start werden Konfigurationsdateien angelegt) In [1]: print "Hallo Welt" Hallo Welt In [2]: Exit verlassen mit Exit oder CTRL-D

Ein erstes Beispiel Fibonacci Folge In [1]: a, b = 0, 1 In [2]: while b < 10:...: print b,...: a, b = b, a+b...: 1 1 2 3 5 8 Blöcke durch Einrückung Mehrfachzuweisung möglich

Python Basics In [1]: from math import * # define 'sin' etc. In [2]: def f(x,y): # function definition...: if x<0 :...: x = -x...: Funktionen h = sin(x)*sin(y)...: return h...: In [3]: f(1.,1.) Out[3]: 0.708073418274 Lambda functions (one line functions) In [12]: g = lambda x,y : sin(x)*sin(y) In [13]: g(1.,1.) Out[13]: 0.708073418274

Listen und for-schleifen Listen durch [ und ] for-schleifen laufen über Listen In [1]: liste = ['apple','grapefruit', 'banana'] In [2]: for item in liste:...: print item,...: apple grapefruit banana Integer-Listen durch range(start,stop,spep) In [3]: range(10,20) Out[3]: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]

List Comprehension for-schleife über Integer mit range(...) In [4]: i2 = [] # create empty list In [5]: for i in range(10):...: i2.append(i*i)...: In [6]: print i2 [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] kompakter durch List Comprehension In [7]: [i*i for i in range(10)] Out[7]: [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

Laden von Modulen / Hilfe Laden von Modulen In [8]: import pylab # names in module scope In [9]: pylab.plot([1,2,3]) In [10]: from pylab import * # names in global scope In [11]: plot([3,2,1]) Hilfe In [12]: help(plot) # python standard help system In [13]: plot? # enhanced help system In [14]: plot?? # print source code if available In [15]: %magic # ipythons 'magic' functions

Py4Science NumPy, SciPy, PyLab from scipy import * from numpy import * from pylab import * x = arange(0,10,0.01) for k in arange(0.5,5.5): y = special.jv(k,x) plot(x,y) f = lambda x: -special.jv(k,x) x_max = optimize.fminbound(f,0,6) plot([x_max], [special.jv(k,x_max)],'ro') title('different Bessel functions and their local maxima') show()

NumPy Matrix- und Array-Operationen (array, zeros, ones, arange, linspace, random.*) In [1]: from numpy import * # create arrays In [2]: a = array([1.,3.,7.]) # - from python list In [3]: b = arange(3.)+1 # - from range In [4]: r = random.uniform(size=3) # - from random numbers In [5]: print a, b, r [ 1. 3. 7.] [1. 2. 3.] [ 0.81470576 0.21422178 0.79054738] In [6]: a*b Out[6]: array([ 1., 6., 21.]) In [7]: a**2 Out[7]: array([ 1., 9., 49.]) In [22]: floor(3.*r+1) Out[22]: array([ 3., 1., 3.]) # vector product # square # truncate to integer

SciPy I - Statistik Modul In [1]: from scipy import * In [2]: f = stats.poisson(3.0) # define poisson object In [4]: f.pmf(arange(10)) # probability mass function Out[4]: array([ 0.04978707, 0.14936121,... ]) In [14]: r = random.normal(size=10000) # inherited from numpy In [15]: stats.mean(r) Out[15]: 0.0119397312522 # statistic function/test # for help call 'stats?' In [16]: stats.median(r) Out[16]: 0.019663695948 In [18]: stats.kurtosis(r) Out[18]: 0.00738373607439

MatPlotLib - Graphik Easy 2D Graphik Modul Similar to MatLab syntax hist - Histogramm In [1]: from pylab import * In [2]: from scipy import * In [3]: hist(random.uniform(size=10000))

MatPlotLib - Graphik Easy 2D Graphik Modul Similar to MatLab syntax hist - Histogramm In [1]: from pylab import * In [2]: from scipy import * In [3]: hist(random.uniform(size=10000))

MatPlotLib - Graphik box, plot,... title, xlable, ylable In [4]: figure() In [5]: x = arange(10) # create new figure # define x-values In [6]: y = stats.poisson.pmf(x,3.0) # calc y-vaules In [7]: bar(x,y) # make bar plot In [8]: plot(x,stats.norm.pdf(x,3.0,3.0),color='red') # draw Gauss function In [9]: title('demonstration of MatPlotLib') # set title

MatPlotLib - Graphik box, plot,... title, xlable, ylable In [4]: figure() In [5]: x = arange(10) # create new figure # define x-values In [6]: y = stats.poisson.pmf(x,3.0) # calc y-vaules In [7]: bar(x,y) # make bar plot In [8]: plot(x,stats.norm.pdf(x,3.0,3.0),color='red') # draw Gauss function In [9]: title('demonstration of MatPlotLib') # set title

Additional Moduls Viele, viele... http://pypi.python.org PyROOT - einfach zu verwendener ROOT-Wrapper PyMinuit - Interface zum C++ Minuit PyTables - IO im HDF5-Dateiformat...