SlideShare une entreprise Scribd logo
1  sur  76
Télécharger pour lire hors ligne
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 1 Python > 29.11.2014 
Big Python 
Andreas Schreiber <Andreas.Schreiber@dlr.de> 
Python Unconference Hamburg, 29.11.2014
DLR.de • Folie 2 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Vorstellung 
Wissenschaftler, 
Abteilungsleiter 
Co-Gründer, 
Geschäftsführer 
Communities
DLR.de • Folie 3 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Bild: Mariluna, CC BY-SA 3.0
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 4 Python > 29.11.2014 
Big Python 
Themen 
Big Number of Devices 
• Internet of Things 
• Smartphones 
Big Computers 
• High Performance Computing 
Big Applications 
• „Killer“-Applikationen in Wissenschaft 
und Technologie
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 5 Python > 29.11.2014 
Big Number of Devices 
• Internet of Things 
• Smartphones
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 6 Python > 29.11.2014 
Internet der Dinge 
Internet of Things 
Milliarden an Geräten, Sensoren und Chips 
• Verbundene physikalische Objekte (oder deren virtuelle 
Repräsentation) 
• Verbunden über das Internet 
• Eindeutig identifiziert 
• Sie interagieren miteinander
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 7 Python > 29.11.2014 
Geräte im Internet der Dinge 
Die „Dinge“ sind 
• Embedded Systeme 
• Sensoren 
• Aktuatoren 
In unseren Lebenswelten 
• Smart Home 
• Connected Car 
• Wearables 
• …
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 8 Python > 29.11.2014 
Wie groß ist „Big“? 
Wachstum 
Die Anzahl der mit Internet verbundenen Geräte steigt täglich 
50.000.000.000 „Dinge“ bis 2020
DLR.de • Folie 9 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Kommunikation 
Internet 
der Dinge 
Kommunikations-infrastruktur
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 10 Python > 29.11.2014 
Ein Kommunikationsprotokoll 
MQTT 
MQ Telemetry Transport 
• Machine-to-machine (M2M) connectivity protocol 
• Publish/Subscribe-Messaging 
• Rechnet mit unzuverlässigen Netzwerken mit geringer Bandbreite 
und hoher Latenzzeit 
• Rechnet mit Clients mit geringer Rechenleistung 
• Erlaubt hohen Quality-of-Service, falls das Netzwerk es erlaubt 
• Einfach zu implementieren
DLR.de • Folie 11 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
MQTT 
Broker 
MQTT 
Broker 
MQTT 
Broker 
Client 
publish 
Client 
Client 
Client 
subscribe 
(optional) 
Bridge 
topic/subtopic 
Client
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 12 Python > 29.11.2014 
MQTT 
Topics 
Messages in MQTT werden auf „Topics“ veröffentlicht 
• Keine Konfiguration notwendig, einfach auf dem Topic 
veröffentlichen 
• Topics sind hierarchisch mit „/“ als Trenner 
my/home/temperature/kitchen 
my/home/temperature/livingroom 
my/server/temperature
DLR.de • Folie 13 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
MQTT 
Implementierungen 
Server/Broker 
• IBM Websphere MQ 
• RSMB 
• Eclipse Paho 
• MQTT.js 
• Apache ActiveMQ 
• RabittMQ 
• HiveMQ 
Bibliotheken für 
• C/C++ 
• Java 
• Python 
• Perl 
• PHP 
• Ruby 
• … 
http://mqtt.org/wiki/software
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 14 Python > 29.11.2014 
MQTT mit Python 
Eclipse Paho 
Python Client-Modul 
• Eine einzelne Datei, reine Python-Implementierung 
• Veröffentlichen und Empfangen von Messages 
• Callbacks 
• Connect 
• Disconnect 
• Publish 
• Message 
• Subscribe 
https://eclipse.org/paho
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 15 Python > 29.11.2014 
MQTT mit Python 
Subscribe 
import paho.mqtt.client as mqtt 
def on_message(mosq, obj, msg): 
print(msg.topic + ' ' + str(msg.payload)) 
mqtt_client = mqtt.Client() 
mqtt_client.on_message = on_message 
mqtt_client.connect('test.mosquitto.org') 
mqtt_client.subscribe(‘#', 0) # all topics 
return_code = 0 
while return_code == 0: 
return_code = mqtt_client.loop()
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 16 Python > 29.11.2014 
MQTT mit Python 
Publish 
import paho.mqtt.client as mqtt 
mqtt_client = mqtt.Client() 
mqtt_client.connect('test.mosquitto.org') 
mqtt_client.publish('python/demo', 
'hello world', 1)
DLR.de • Folie 17 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
MQTT Anwendungsbeispiel 
Heimautomatisierung mit Raspberry Pi 
Messdaten mit Sensoren via 1-Wire 
• 1-Wire: Einkabel-Bussystem, 
niedrige Geschwindigkeit 
• Sensoren für Temperatur, Spannung, 
Licht, Feuchtigkeit, … 
Eclipse Paho auf Raspberry Pi 
installieren 
• apt-get install mosquitto 
Messwerte von 1-Wire-Sensoren 
• Mehrere Lösungen für Python
DLR.de • Folie 18 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Temperatur veröffentlichen 
OWFS: One Wire File System 
import time 
import os 
import paho.mqtt.client as mqtt 
file_name = os.path.join('/', 'mnt', '1wire', 
'10.67C6697351FF', 'temperature') 
mqtt_client = mqtt.Client('home-temperature') 
mqtt_client.connect('test.mosquitto.org') 
while 1: 
file_object = open(file_name, 'r') 
temperature = '%sC' % file_object.read() 
mqtt_client.publish('home/demo/temperature', temperature, 1) 
mqtt_client.loop() 
time.sleep(5) 
file_object.close()
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 19 Python > 29.11.2014 
Hardware für das Internet der Dinge 
WunderBar 
Relayr WunderBar 
• IoT Starter Kit 
• Verschiedene Sensoren 
• WiFi und Bluetooth LE 
• SDKs und APIs 
• Android 
• iOS/OSX 
• Python 
• Web/Javascript 
https://relayr.io 
Bild: relayr.io
DLR.de • Folie 20 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
WunderBar 
Hardware 
Bild: relayr.io
DLR.de • Folie 21 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
WunderBar 
Cloud Service und Web-Oberfläche
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 22 Python > 29.11.2014 
WunderBar 
Python SDK 
from relayr import Client 
client = Client(token='XXX') 
device = client.get_device(id='XXX') 
device.switch_led_on(True)
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 23 Python > 29.11.2014 
WunderBar 
Python SDK 
import time 
from relayr import Client 
def callback(message, channel): 
print(repr(message), type(message)) 
client = Client(token='<XXX>') 
device = client.get_device(id='<XXX>').get_info() 
user = client.get_user() 
conn = user.connect_device(device, callback) 
conn.start() 
time.sleep(10) 
conn.stop()
DLR.de • Folie 24 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Verbreitete Devices 
Smartphones
DLR.de • Folie 25 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Wie groß ist „Big“? 
Weltweit verkaufte Smartphones 
Quelle: http://en.wikipedia.org/wiki/Smartphone
DLR.de • Folie 26 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Wie groß ist „Big“? 
Verfügbare Apps im Google Play Store 
16 30 38 
70 
100 
200 
250 
300 
400 
450 
500 
600 
675 
700 
850 
900 
1.000 
1.300 
1400 
1200 
1000 
800 
600 
400 
200 
0 
Dez '09 Mär '10 Apr '10 Jul '10 Okt '10 Apr '11 Jul '11 Aug '11 Dez '11 Feb '12 Mai '12 Jun '12 Sep '12 Okt '12 Apr '13 Jul '13 Aug '13 Jul '14 
Anzahl der verfügbaren Apps (in 1.000) 
Weltweit; Dezember 2009 bis Juli 2014, Quelle: statista GmbH, http://de.statista.com/statistik/daten/studie/74368/umfrage/anzahl-der-verfuegbaren-apps-im-google-play-store/
DLR.de • Folie 27 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Sehr viele Apps… 
… aber die allerwenigsten sind 
in Python entwickelt!
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 28 Python > 29.11.2014 
Python auf Smartphones 
Frühe Technologien 
• PyS60 for Symbian 
• Python CE for Windows Mobile 
Aktuelle Technologien 
• Scripting Layer for Android (SL4A) 
• Python for Android (Py4A) 
• PySide / Qt for Android 
• WinRT / IronPython for Windows 8 
• Kivy…
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 29 Python > 29.11.2014 
Kivy 
Plattformübergreifendes Python-Framework 
Plattformen 
• Android 
• iOS 
• Meego 
• Windows 
• Linux 
• OS X 
• Raspberry Pi 
kivy.org 
Entwicklung in Python auf allen Plattformen – keine Emulation!
DLR.de • Folie 30 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Kivy 
„Hello World“ 
from kivy.app import App 
from kivy.uix.button import Button 
class TestApp(App): 
def build(self): 
return Button(text='Hello Cologne') 
TestApp().run()
DLR.de • Folie 31 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Kivy 
Sprache „KV“ für Layout und Grafik 
from kivy.app import App 
class HelloApp(App): 
pass 
HelloApp().run() 
#:kivy 1.0 
Button: 
Datei hello.kv 
definiert Root-Widget 
text: ‘Hello Hamburg’
DLR.de • Folie 32 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Kivy Apps 
Verfügbar zum Beispiel im Google Play Store
DLR.de • Folie 33 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Kivy Apps 
Geeignet für Prototypen
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 34 Python > 29.11.2014 
Kivy zur Erstellung von GUIs und Apps 
Beispiel aus der Raumfahrtbiologie 
Pflanzenbeleuchtung 
• Webcam nimmt Bild auf 
• Rechner erkennt Pflanze 
• Rechner berechnet anhand von 
Einstellungen ein Ausgabebild 
• Lichtquelle (z.B. Beamer) beleuchtet die 
Pflanze mit dem Bild
DLR.de • Folie 35 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014
DLR.de • Folie 36 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014
DLR.de • Folie 37 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 38 Python > 29.11.2014 
Python auf Smartphones 
Weitere Möglichkeiten… 
QPython – Python on Android (http://qpython.com)
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 39 Python > 29.11.2014 
Python auf Smartphones 
Weitere Möglichkeiten… 
Pythonista – Python on iOS 
http://omz-software.com/pythonista
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 40 Python > 29.11.2014 
Big Computers 
High Performance Computing
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 41 Python > 29.11.2014 
High Performance Computing (HPC) 
Spezialgebiet des Wissenschaftlichen Rechnens 
Wenn der Arbeitsplatzrechner nicht mehr ausreicht 
• Hohe Rechenleistung und hoher Speicherbedarf 
Bilder: http://www.isgtw.org 
Das Bild kann nicht angezeigt werden. Dieser Computer verfügt möglicherweise über zu wenig 
Arbeitsspeicher, um das Bild zu öffnen, oder das Bild ist beschädigt. Starten Sie den Computer neu, 
und öffnen Sie dann erneut die Datei. Wenn weiterhin das rote x angezeigt wird, müssen Sie das 
Bild möglicherweise löschen und dann erneut einfügen. 
Das Bild kann nicht angezeigt werden. Dieser Computer verfügt möglicherweise über zu wenig 
Arbeitsspeicher, um das Bild zu öffnen, oder das Bild ist beschädigt. Starten Sie den Computer neu, 
und öffnen Sie dann erneut die Datei. Wenn weiterhin das rote x angezeigt wird, müssen Sie das Bild 
möglicherweise löschen und dann erneut einfügen. 
Das Bild kann nicht angezeigt werden. Dieser Computer verfügt 
möglicherweise über zu wenig Arbeitsspeicher, um das Bild zu 
öffnen, oder das Bild ist beschädigt. Starten Sie den Computer neu, 
und öffnen Sie dann erneut die Datei. Wenn weiterhin das rote x 
angezeigt wird, müssen Sie das Bild möglicherweise löschen und 
dann erneut einfügen. 
Das Bild kann nicht angezeigt werden. Dieser Computer verfügt möglicherweise über 
zu wenig Arbeitsspeicher, um das Bild zu öffnen, oder das Bild ist beschädigt. Starten 
Sie den Computer neu, und öffnen Sie dann erneut die Datei. Wenn weiterhin das rote 
x angezeigt wird, müssen Sie das Bild möglicherweise löschen und dann erneut 
einfügen.
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 42 Python > 29.11.2014 
Wie groß ist „Big“? 
Aktuelle Supercomputer 
Aktuelle Supercomputer haben 
> 1.000.000 Cores 
> 10 PetaFLOPS 
Die drei derzeit größten Systeme (Nov 2014) 
1. Tianhe-2 (Guangzhou, China) 
3.120.000 Cores, 33,8 PetaFLOPS 
2. Titan (ORNL, USA) 
560.640 Cores, 17,5 PetaFLOPS 
3. Sequoia (LLNL, USA) 
1.572.864 Cores, 17,1 PetaFLOPS
DLR.de • Folie 43 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Supercomputer 
Tianhe-2 (天河二号)
DLR.de • Folie 44 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Supercomputer 
Titan 
Quelle: https://www.olcf.ornl.gov/titan/
DLR.de • Folie 45 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Supercomputer 
Sequoia 
Quelle: https://asc.llnl.gov/computing_resources/sequoia/
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 46 Python > 29.11.2014 
High Performance Computing 
Programmiertechnologien 
MPI (Message Passing Interface) 
• API für Distributed-Memory-Architekturen in C, C++, Fortran, ... 
OpenMP (Open Multi-Processing) 
• API für Shared-Memory-Architekturen in C, C++, Fortran 
OpenACC (Open Accelerators) 
• API für heterogene CPU/GPU-Systeme in C, C++, Fortran 
Global Arrays Toolkit 
• API für Shared-Memory-Programmierung auf Distributed-Memory- 
Architekturen in C, C++, Fortran und Python
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 47 Python > 29.11.2014 
GPGPU 
General-purpose computing on graphics processing units 
Architektur 
• Viele Core pro Node 
• Geeignet für Prozessierung von Datenströmen 
(viele parallele unabhängige Datenpunkte) 
Programmiertechnologien 
• CUDA 
• API von NVIDIA in C 
• Python-Binding: PyCUDA 
• OpenCL 
• Offenes Framework für heterogene Systeme 
• Python-Binding: PyOpenCL 
Bild: NVIDIA
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 48 Python > 29.11.2014 
Numba 
Optimierungs-Compiler für Python 
Just-in-time-Compiler 
• Annotationen 
• Nutzt LLVM
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 49 Python > 29.11.2014 
Beispiel Free-Wake 
Simulation von Hubschrauber-Rotoren 
Free-Wake (DLR) 
• Simulation dreidimensionaler Strömungen 
um einen aktiv gesteuerten Rotor 
eines Helikopters 
• Code entwickelt 1994-1996 
• MPI-parallelisiert in Fortran 
• Aufwendige Performance-Optimierung 
2013-2014 
• MPI und Open ACC
DLR.de • Folie 50 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Visualisierung der Wirbel
DLR.de • Folie 51 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Kern-Schleifen von Free-Wake (Standard Python) 
for iblades in range(numberOfBlades): 
for iradial in range(1, dimensionInRadialDirection): 
for iazimutal in range(dimensionInAzimualDirectionTotal): 
for i1 in range(len(vx[0])): 
for i2 in range(len(vx[0][0])): 
for i3 in range(len(vx[0][0][0])): 
# wilin-Aufruf 1 
for iblades in range(numberOfBlades): 
for iradial in range(dimensionInRadialDirection): 
for iazimutal in range(1, dimensionInAzimualDirectionTotal): 
for i1 in range(len(vx[0])): 
for i2 in range(len(vx[0][0])): 
for i3 in range(len(vx[0][0][0])): 
# wilin-Aufruf 2 
for iDir in range(3): 
for i in range(numberOfBlades): 
for j in range(dimensionInRadialDirection): 
for k in range(dimensionInAzimualDirectionTotal): 
x[iDir][i][j][k] = x[iDir][i][j][k] + 
dt * vx[iDir][i][j][k]
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 52 Python > 29.11.2014 
Free-Wake 
Performance-Vergleich Fortran – Python 
Vergleich der hoch-optimierten Fortran-Version mit parallelen 
Python-Versionen 
• Multi-core CPUs 
• Cython mit OpenMP 
• Python-Bindings für Global Array Toolkit 
• GPGPUs 
• NumbaPro
DLR.de • Folie 53 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Performance-Tests 
Single-Core Performance (Xeon E5645, 6 Cores)
DLR.de • Folie 54 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Performance-Tests 
Multi-Core Performance (Xeon E5645, 6 Cores)
DLR.de • Folie 55 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Performance-Tests 
GPGPU Perf. (NVIDIA Tesla C2075, 448 CUDA-Cores)
DLR.de • Folie 56 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Neue Rechnerarchitekturen 
Quantencomputer 
• Adiabatische Quantencomputer 
Bilder: NASA
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 57 Python > 29.11.2014 
Big Applications 
„Killer“-Applikationen in Wissenschaft und Technologie
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 58 Python > 29.11.2014 
Wichtige Anwendungssoftware 
Wissenschaft und Technik 
Viele kommerzielle Anwendungen sind noch Standard 
• Microsoft Excel 
• MATLAB 
• IDL 
• Fortran-Compiler 
Der Weg nach Python... 
• Open Source 
• Einheitliche Sprache für viele Anwendungsgebiete
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 59 Python > 29.11.2014 
Microsoft Excel 
Tabellenkalkulation 
Wesentliche Funktionen 
• Tabellen 
• Sortier-, Gruppier-, Filterfunktionen 
• Pivot-Tabellen 
• Diagramme 
Python-Alternative 
• IPython 
• pandas
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 60 Python > 29.11.2014 
The MathWorks MATLAB 
Numerische Matrixberechnungen 
Wesentliche Funktionen 
• Eigene proprietäre Programmiersprache 
• Viele Anwendungs-Toolboxes 
z.B. Statistik, Signal- und Bildverarbeitung 
Python-Alternative 
• NumPy 
• Matplotlib 
Nützliche Quelle: wiki.scipy.org/NumPy_for_Matlab_Users
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 61 Python > 29.11.2014 
IDL – Interactive Data Language 
Analyse und Visualisierung von Daten 
Wesentliche Funktionen 
• Array-basierte Programmiersprache 
• Gute Bildverarbeitungsfunktionen 
Python-Alternative 
• IDL-nach-Python-Compiler PIKE
DLR.de • Folie 62 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
PIKE 
Beispiel-Codes 
;; Simple image/ plotting and graphics tests 
pro MRI_demo 
;Load demo data file 
file = filepath("mri500x300x5.dat", subdirectory=["data"]) 
print,file 
device, decomposed=0 
loadct, 3 
openr, lun, file, /get_lun 
;Associate a variable with a data file 
img = assoc(lun, bytarr(500, 300)) 
!P.multi=[0,0,0,0] 
window, 0, xsize=500, ysize=300, 
title='MRI Demo - Flicker Loop' 
;Display the five images in a loop 
for j=0, 2 do begin 
for i=0, 4 do begin 
tvscl, img[i] 
wait, 0.1 
endfor 
endfor 
. . .
DLR.de • Folie 63 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
PIKE 
Beispiel-Codes 
import numpy as np 
import pike 
def mri_demo( ): 
#Load demo data file 
pike.setArrayOrder("0and1") # expected array ordering 
# %; Define detected undefined variables 
lun = 0 
file = pike.filepath("mri500x300x5.dat”, subdirectory=pike.catarr(["data"])) 
pike.print_(file) 
pike.device(decomposed=0) 
pike.loadct(3) 
lun = pike.openr(lun, file, get_lun=True) 
#Associate a variable with a data file 
img = pike.assoc(lun, pike.bytarr(500, 300)) 
pike.sysv.P.multi = pike.catarr([0, 0, 0, 0]) 
pike.window(0, title='MRI Demo - Flicker Loop', xsize=500, ysize=300) 
#Display the five images in a loop 
for j in xrange(np.int16(0), (np.int16(2))+(1)): 
for i in xrange(np.int16(0), (np.int16(4))+(1)): 
pike.tvscl(img[i]) 
pike.wait(0.1) 
. . .
DLR.de • Folie 64 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
PIKE 
Beispiel-Codes 
Bild: Torsion Analytics
DLR.de • Folie 65 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Entwerfen von Raumfahrzeugen
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 66 Python > 29.11.2014 
Entwerfen von Raumfahrzeugen 
Beispiel: Der DLR SpaceLiner 
SpaceLiner 
• Konzeptstudie für Passagiertransport 
• Mittelding zwischen Flugzeug und 
Raumschiff 
• Langstreckenflüge mit 
Hyperschallgeschwindigkeit (> Mach 5) 
• Strecke Europa – Australien in 90 Min. 
• Hochaufstieg mit Booster auf ca. 85 km 
• Gleitflug des Orbiters mit ca. Mach 20
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 67 Python > 29.11.2014 
Simulation in der Entwurfsphase 
Wärmeentwicklung beim Wiedereintritt 
Simulation mit verschiedenen Wärmeschutzsystemen 
• Wasserkühlung durch Verdampfung 
• Hochwärmeleitende Faserverbundstoffe
DLR.de • Folie 68 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Wärmeschutzsystem 
Magnetohydrodynamik mit supraleitenden Magneten
DLR.de • Folie 69 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Lorentzkraft in der Natur 
Aurora Borealis 
Bild: Alexander Gerst (https://twitter.com/Astro_Alex/status/507212904689848320)
DLR.de • Folie 70 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Lorentzkraft in der Raumfahrt 
Schutzschilde
DLR.de • Folie 71 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Wie entwirft man Raumschiffe?
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 72 Python > 29.11.2014 
Simulations-Workflow 
Vernetzung der Fachdisziplinen 
Geometrie 
Aerodynamik 
Thermal-management 
Subsystem-massen 
Struktur
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 73 Python > 29.11.2014 
Simulations-Workflow 
Mit Optimierung 
Geometrie Aerodynamik Thermal-management 
Subsystem-massen 
Struktur 
Optimierer
> Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 74 Python > 29.11.2014 
Simulations-Workflow 
Integration in eine Simulationsumgebung
DLR.de • Folie 75 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Simulationsumgebung RCE
DLR.de • Folie 76 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 
Vielen Dank! 
Fragen? 
Andreas.Schreiber@dlr.de 
www.DLR.de/sc | @onyame

Contenu connexe

Similaire à Big Python

Wolfgang Mader (Huemer Data Center)
Wolfgang Mader (Huemer Data Center)Wolfgang Mader (Huemer Data Center)
Wolfgang Mader (Huemer Data Center)Agenda Europe 2035
 
Build your own IoT Cloud! [GER]
Build your own IoT Cloud! [GER]Build your own IoT Cloud! [GER]
Build your own IoT Cloud! [GER]Christian Götz
 
Azure Notebooks
Azure NotebooksAzure Notebooks
Azure NotebooksTEitelberg
 
3d mit Python (PythonCamp)
3d mit Python (PythonCamp)3d mit Python (PythonCamp)
3d mit Python (PythonCamp)Martin Christen
 
Ein ansatz für die untersuchung von linkquellen einer webseite mithilfe von p...
Ein ansatz für die untersuchung von linkquellen einer webseite mithilfe von p...Ein ansatz für die untersuchung von linkquellen einer webseite mithilfe von p...
Ein ansatz für die untersuchung von linkquellen einer webseite mithilfe von p...E-Government
 
Programmierung von Mobiltelefonen mit Python
Programmierung von Mobiltelefonen mit PythonProgrammierung von Mobiltelefonen mit Python
Programmierung von Mobiltelefonen mit PythonAndreas Schreiber
 
Die Strategische Bedeutung Von Open Source FüR Das 3 D Internet V2
Die Strategische Bedeutung Von Open Source FüR Das 3 D Internet V2Die Strategische Bedeutung Von Open Source FüR Das 3 D Internet V2
Die Strategische Bedeutung Von Open Source FüR Das 3 D Internet V2Andreas Mertens
 
QGIS das Opensource GIS at Linuxwochen Wien 2019
QGIS das Opensource GIS at Linuxwochen Wien 2019QGIS das Opensource GIS at Linuxwochen Wien 2019
QGIS das Opensource GIS at Linuxwochen Wien 2019Anita Graser
 
Warum gRPC? – und wie in Python implementieren?
Warum gRPC? – und wie in Python implementieren?Warum gRPC? – und wie in Python implementieren?
Warum gRPC? – und wie in Python implementieren?cusy GmbH
 
Python Mike Müller
Python Mike MüllerPython Mike Müller
Python Mike MüllerAberla
 
Quantified Self mit Wearable Devices und Smartphone-Sensoren
Quantified Self mit Wearable Devices und Smartphone-SensorenQuantified Self mit Wearable Devices und Smartphone-Sensoren
Quantified Self mit Wearable Devices und Smartphone-SensorenAndreas Schreiber
 
Modernisierung in Zeiten wie diesen
Modernisierung in Zeiten wie diesenModernisierung in Zeiten wie diesen
Modernisierung in Zeiten wie diesenenpit GmbH & Co. KG
 
FMK2019 FileMaker Data API mit Node.js nutzen by Adam Augustin
FMK2019 FileMaker Data API mit Node.js nutzen by Adam AugustinFMK2019 FileMaker Data API mit Node.js nutzen by Adam Augustin
FMK2019 FileMaker Data API mit Node.js nutzen by Adam AugustinVerein FM Konferenz
 
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...Gregor Biswanger
 
Palo Alto Networks - Just another Firewall
Palo Alto Networks - Just another FirewallPalo Alto Networks - Just another Firewall
Palo Alto Networks - Just another Firewallpillardata
 

Similaire à Big Python (20)

OpenNTF 2015 Edition
OpenNTF 2015 EditionOpenNTF 2015 Edition
OpenNTF 2015 Edition
 
Wolfgang Mader (Huemer Data Center)
Wolfgang Mader (Huemer Data Center)Wolfgang Mader (Huemer Data Center)
Wolfgang Mader (Huemer Data Center)
 
Open source in der Unternehmenswelt
Open source in der UnternehmensweltOpen source in der Unternehmenswelt
Open source in der Unternehmenswelt
 
Build your own IoT Cloud! [GER]
Build your own IoT Cloud! [GER]Build your own IoT Cloud! [GER]
Build your own IoT Cloud! [GER]
 
Azure Notebooks
Azure NotebooksAzure Notebooks
Azure Notebooks
 
3d mit Python (PythonCamp)
3d mit Python (PythonCamp)3d mit Python (PythonCamp)
3d mit Python (PythonCamp)
 
Ein ansatz für die untersuchung von linkquellen einer webseite mithilfe von p...
Ein ansatz für die untersuchung von linkquellen einer webseite mithilfe von p...Ein ansatz für die untersuchung von linkquellen einer webseite mithilfe von p...
Ein ansatz für die untersuchung von linkquellen einer webseite mithilfe von p...
 
Cinema in the Cloud
Cinema in the CloudCinema in the Cloud
Cinema in the Cloud
 
Programmierung von Mobiltelefonen mit Python
Programmierung von Mobiltelefonen mit PythonProgrammierung von Mobiltelefonen mit Python
Programmierung von Mobiltelefonen mit Python
 
Die Strategische Bedeutung Von Open Source FüR Das 3 D Internet V2
Die Strategische Bedeutung Von Open Source FüR Das 3 D Internet V2Die Strategische Bedeutung Von Open Source FüR Das 3 D Internet V2
Die Strategische Bedeutung Von Open Source FüR Das 3 D Internet V2
 
QGIS das Opensource GIS at Linuxwochen Wien 2019
QGIS das Opensource GIS at Linuxwochen Wien 2019QGIS das Opensource GIS at Linuxwochen Wien 2019
QGIS das Opensource GIS at Linuxwochen Wien 2019
 
Warum gRPC? – und wie in Python implementieren?
Warum gRPC? – und wie in Python implementieren?Warum gRPC? – und wie in Python implementieren?
Warum gRPC? – und wie in Python implementieren?
 
Python Mike Müller
Python Mike MüllerPython Mike Müller
Python Mike Müller
 
Quantified Self mit Wearable Devices und Smartphone-Sensoren
Quantified Self mit Wearable Devices und Smartphone-SensorenQuantified Self mit Wearable Devices und Smartphone-Sensoren
Quantified Self mit Wearable Devices und Smartphone-Sensoren
 
Chatbot Hackathon Slidedeck
Chatbot Hackathon SlidedeckChatbot Hackathon Slidedeck
Chatbot Hackathon Slidedeck
 
Modernisierung in Zeiten wie diesen
Modernisierung in Zeiten wie diesenModernisierung in Zeiten wie diesen
Modernisierung in Zeiten wie diesen
 
FMK2019 FileMaker Data API mit Node.js nutzen by Adam Augustin
FMK2019 FileMaker Data API mit Node.js nutzen by Adam AugustinFMK2019 FileMaker Data API mit Node.js nutzen by Adam Augustin
FMK2019 FileMaker Data API mit Node.js nutzen by Adam Augustin
 
Twitter‘n mit Python
Twitter‘n mit PythonTwitter‘n mit Python
Twitter‘n mit Python
 
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
 
Palo Alto Networks - Just another Firewall
Palo Alto Networks - Just another FirewallPalo Alto Networks - Just another Firewall
Palo Alto Networks - Just another Firewall
 

Plus de Andreas Schreiber

Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...Andreas Schreiber
 
Visualization of Software Architectures in Virtual Reality and Augmented Reality
Visualization of Software Architectures in Virtual Reality and Augmented RealityVisualization of Software Architectures in Virtual Reality and Augmented Reality
Visualization of Software Architectures in Virtual Reality and Augmented RealityAndreas Schreiber
 
Provenance as a building block for an open science infrastructure
Provenance as a building block for an open science infrastructureProvenance as a building block for an open science infrastructure
Provenance as a building block for an open science infrastructureAndreas Schreiber
 
Raising Awareness about Open Source Licensing at the German Aerospace Center
Raising Awareness about Open Source Licensing at the German Aerospace CenterRaising Awareness about Open Source Licensing at the German Aerospace Center
Raising Awareness about Open Source Licensing at the German Aerospace CenterAndreas Schreiber
 
Open Source Licensing for Rocket Scientists
Open Source Licensing for Rocket ScientistsOpen Source Licensing for Rocket Scientists
Open Source Licensing for Rocket ScientistsAndreas Schreiber
 
Interactive Visualization of Software Components with Virtual Reality Headsets
Interactive Visualization of Software Components with Virtual Reality HeadsetsInteractive Visualization of Software Components with Virtual Reality Headsets
Interactive Visualization of Software Components with Virtual Reality HeadsetsAndreas Schreiber
 
Provenance for Reproducible Data Science
Provenance for Reproducible Data ScienceProvenance for Reproducible Data Science
Provenance for Reproducible Data ScienceAndreas Schreiber
 
Visualizing Provenance using Comics
Visualizing Provenance using ComicsVisualizing Provenance using Comics
Visualizing Provenance using ComicsAndreas Schreiber
 
Nachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
Nachvollziehbarkeit mit Hinblick auf Privacy-VerletzungenNachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
Nachvollziehbarkeit mit Hinblick auf Privacy-VerletzungenAndreas Schreiber
 
Reproducible Science with Python
Reproducible Science with PythonReproducible Science with Python
Reproducible Science with PythonAndreas Schreiber
 
A Provenance Model for Quantified Self Data
A Provenance Model for Quantified Self DataA Provenance Model for Quantified Self Data
A Provenance Model for Quantified Self DataAndreas Schreiber
 
Tracking after Stroke: Doctors, Dogs and All The Rest
Tracking after Stroke: Doctors, Dogs and All The RestTracking after Stroke: Doctors, Dogs and All The Rest
Tracking after Stroke: Doctors, Dogs and All The RestAndreas Schreiber
 
High Throughput Processing of Space Debris Data
High Throughput Processing of Space Debris DataHigh Throughput Processing of Space Debris Data
High Throughput Processing of Space Debris DataAndreas Schreiber
 
Bericht von der QS15 Conference & Exposition
Bericht von der QS15 Conference & ExpositionBericht von der QS15 Conference & Exposition
Bericht von der QS15 Conference & ExpositionAndreas Schreiber
 
Telemedizin: Gesundheit, messbar für jedermann
Telemedizin: Gesundheit, messbar für jedermannTelemedizin: Gesundheit, messbar für jedermann
Telemedizin: Gesundheit, messbar für jedermannAndreas Schreiber
 
Example Blood Pressure Report of BloodPressureCompanion
Example Blood Pressure Report of BloodPressureCompanionExample Blood Pressure Report of BloodPressureCompanion
Example Blood Pressure Report of BloodPressureCompanionAndreas Schreiber
 
Beispiel-Blutdruckbericht des BlutdruckBegleiter
Beispiel-Blutdruckbericht des BlutdruckBegleiterBeispiel-Blutdruckbericht des BlutdruckBegleiter
Beispiel-Blutdruckbericht des BlutdruckBegleiterAndreas Schreiber
 
Informatik für die Welt von Morgen
Informatik für die Welt von MorgenInformatik für die Welt von Morgen
Informatik für die Welt von MorgenAndreas Schreiber
 

Plus de Andreas Schreiber (20)

Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
 
Visualization of Software Architectures in Virtual Reality and Augmented Reality
Visualization of Software Architectures in Virtual Reality and Augmented RealityVisualization of Software Architectures in Virtual Reality and Augmented Reality
Visualization of Software Architectures in Virtual Reality and Augmented Reality
 
Provenance as a building block for an open science infrastructure
Provenance as a building block for an open science infrastructureProvenance as a building block for an open science infrastructure
Provenance as a building block for an open science infrastructure
 
Raising Awareness about Open Source Licensing at the German Aerospace Center
Raising Awareness about Open Source Licensing at the German Aerospace CenterRaising Awareness about Open Source Licensing at the German Aerospace Center
Raising Awareness about Open Source Licensing at the German Aerospace Center
 
Open Source Licensing for Rocket Scientists
Open Source Licensing for Rocket ScientistsOpen Source Licensing for Rocket Scientists
Open Source Licensing for Rocket Scientists
 
Interactive Visualization of Software Components with Virtual Reality Headsets
Interactive Visualization of Software Components with Virtual Reality HeadsetsInteractive Visualization of Software Components with Virtual Reality Headsets
Interactive Visualization of Software Components with Virtual Reality Headsets
 
Provenance for Reproducible Data Science
Provenance for Reproducible Data ScienceProvenance for Reproducible Data Science
Provenance for Reproducible Data Science
 
Visualizing Provenance using Comics
Visualizing Provenance using ComicsVisualizing Provenance using Comics
Visualizing Provenance using Comics
 
Quantified Self Comics
Quantified Self ComicsQuantified Self Comics
Quantified Self Comics
 
Nachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
Nachvollziehbarkeit mit Hinblick auf Privacy-VerletzungenNachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
Nachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
 
Reproducible Science with Python
Reproducible Science with PythonReproducible Science with Python
Reproducible Science with Python
 
Python at Warp Speed
Python at Warp SpeedPython at Warp Speed
Python at Warp Speed
 
A Provenance Model for Quantified Self Data
A Provenance Model for Quantified Self DataA Provenance Model for Quantified Self Data
A Provenance Model for Quantified Self Data
 
Tracking after Stroke: Doctors, Dogs and All The Rest
Tracking after Stroke: Doctors, Dogs and All The RestTracking after Stroke: Doctors, Dogs and All The Rest
Tracking after Stroke: Doctors, Dogs and All The Rest
 
High Throughput Processing of Space Debris Data
High Throughput Processing of Space Debris DataHigh Throughput Processing of Space Debris Data
High Throughput Processing of Space Debris Data
 
Bericht von der QS15 Conference & Exposition
Bericht von der QS15 Conference & ExpositionBericht von der QS15 Conference & Exposition
Bericht von der QS15 Conference & Exposition
 
Telemedizin: Gesundheit, messbar für jedermann
Telemedizin: Gesundheit, messbar für jedermannTelemedizin: Gesundheit, messbar für jedermann
Telemedizin: Gesundheit, messbar für jedermann
 
Example Blood Pressure Report of BloodPressureCompanion
Example Blood Pressure Report of BloodPressureCompanionExample Blood Pressure Report of BloodPressureCompanion
Example Blood Pressure Report of BloodPressureCompanion
 
Beispiel-Blutdruckbericht des BlutdruckBegleiter
Beispiel-Blutdruckbericht des BlutdruckBegleiterBeispiel-Blutdruckbericht des BlutdruckBegleiter
Beispiel-Blutdruckbericht des BlutdruckBegleiter
 
Informatik für die Welt von Morgen
Informatik für die Welt von MorgenInformatik für die Welt von Morgen
Informatik für die Welt von Morgen
 

Big Python

  • 1. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 1 Python > 29.11.2014 Big Python Andreas Schreiber <Andreas.Schreiber@dlr.de> Python Unconference Hamburg, 29.11.2014
  • 2. DLR.de • Folie 2 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Vorstellung Wissenschaftler, Abteilungsleiter Co-Gründer, Geschäftsführer Communities
  • 3. DLR.de • Folie 3 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Bild: Mariluna, CC BY-SA 3.0
  • 4. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 4 Python > 29.11.2014 Big Python Themen Big Number of Devices • Internet of Things • Smartphones Big Computers • High Performance Computing Big Applications • „Killer“-Applikationen in Wissenschaft und Technologie
  • 5. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 5 Python > 29.11.2014 Big Number of Devices • Internet of Things • Smartphones
  • 6. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 6 Python > 29.11.2014 Internet der Dinge Internet of Things Milliarden an Geräten, Sensoren und Chips • Verbundene physikalische Objekte (oder deren virtuelle Repräsentation) • Verbunden über das Internet • Eindeutig identifiziert • Sie interagieren miteinander
  • 7. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 7 Python > 29.11.2014 Geräte im Internet der Dinge Die „Dinge“ sind • Embedded Systeme • Sensoren • Aktuatoren In unseren Lebenswelten • Smart Home • Connected Car • Wearables • …
  • 8. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 8 Python > 29.11.2014 Wie groß ist „Big“? Wachstum Die Anzahl der mit Internet verbundenen Geräte steigt täglich 50.000.000.000 „Dinge“ bis 2020
  • 9. DLR.de • Folie 9 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Kommunikation Internet der Dinge Kommunikations-infrastruktur
  • 10. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 10 Python > 29.11.2014 Ein Kommunikationsprotokoll MQTT MQ Telemetry Transport • Machine-to-machine (M2M) connectivity protocol • Publish/Subscribe-Messaging • Rechnet mit unzuverlässigen Netzwerken mit geringer Bandbreite und hoher Latenzzeit • Rechnet mit Clients mit geringer Rechenleistung • Erlaubt hohen Quality-of-Service, falls das Netzwerk es erlaubt • Einfach zu implementieren
  • 11. DLR.de • Folie 11 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 MQTT Broker MQTT Broker MQTT Broker Client publish Client Client Client subscribe (optional) Bridge topic/subtopic Client
  • 12. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 12 Python > 29.11.2014 MQTT Topics Messages in MQTT werden auf „Topics“ veröffentlicht • Keine Konfiguration notwendig, einfach auf dem Topic veröffentlichen • Topics sind hierarchisch mit „/“ als Trenner my/home/temperature/kitchen my/home/temperature/livingroom my/server/temperature
  • 13. DLR.de • Folie 13 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 MQTT Implementierungen Server/Broker • IBM Websphere MQ • RSMB • Eclipse Paho • MQTT.js • Apache ActiveMQ • RabittMQ • HiveMQ Bibliotheken für • C/C++ • Java • Python • Perl • PHP • Ruby • … http://mqtt.org/wiki/software
  • 14. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 14 Python > 29.11.2014 MQTT mit Python Eclipse Paho Python Client-Modul • Eine einzelne Datei, reine Python-Implementierung • Veröffentlichen und Empfangen von Messages • Callbacks • Connect • Disconnect • Publish • Message • Subscribe https://eclipse.org/paho
  • 15. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 15 Python > 29.11.2014 MQTT mit Python Subscribe import paho.mqtt.client as mqtt def on_message(mosq, obj, msg): print(msg.topic + ' ' + str(msg.payload)) mqtt_client = mqtt.Client() mqtt_client.on_message = on_message mqtt_client.connect('test.mosquitto.org') mqtt_client.subscribe(‘#', 0) # all topics return_code = 0 while return_code == 0: return_code = mqtt_client.loop()
  • 16. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 16 Python > 29.11.2014 MQTT mit Python Publish import paho.mqtt.client as mqtt mqtt_client = mqtt.Client() mqtt_client.connect('test.mosquitto.org') mqtt_client.publish('python/demo', 'hello world', 1)
  • 17. DLR.de • Folie 17 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 MQTT Anwendungsbeispiel Heimautomatisierung mit Raspberry Pi Messdaten mit Sensoren via 1-Wire • 1-Wire: Einkabel-Bussystem, niedrige Geschwindigkeit • Sensoren für Temperatur, Spannung, Licht, Feuchtigkeit, … Eclipse Paho auf Raspberry Pi installieren • apt-get install mosquitto Messwerte von 1-Wire-Sensoren • Mehrere Lösungen für Python
  • 18. DLR.de • Folie 18 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Temperatur veröffentlichen OWFS: One Wire File System import time import os import paho.mqtt.client as mqtt file_name = os.path.join('/', 'mnt', '1wire', '10.67C6697351FF', 'temperature') mqtt_client = mqtt.Client('home-temperature') mqtt_client.connect('test.mosquitto.org') while 1: file_object = open(file_name, 'r') temperature = '%sC' % file_object.read() mqtt_client.publish('home/demo/temperature', temperature, 1) mqtt_client.loop() time.sleep(5) file_object.close()
  • 19. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 19 Python > 29.11.2014 Hardware für das Internet der Dinge WunderBar Relayr WunderBar • IoT Starter Kit • Verschiedene Sensoren • WiFi und Bluetooth LE • SDKs und APIs • Android • iOS/OSX • Python • Web/Javascript https://relayr.io Bild: relayr.io
  • 20. DLR.de • Folie 20 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 WunderBar Hardware Bild: relayr.io
  • 21. DLR.de • Folie 21 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 WunderBar Cloud Service und Web-Oberfläche
  • 22. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 22 Python > 29.11.2014 WunderBar Python SDK from relayr import Client client = Client(token='XXX') device = client.get_device(id='XXX') device.switch_led_on(True)
  • 23. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 23 Python > 29.11.2014 WunderBar Python SDK import time from relayr import Client def callback(message, channel): print(repr(message), type(message)) client = Client(token='<XXX>') device = client.get_device(id='<XXX>').get_info() user = client.get_user() conn = user.connect_device(device, callback) conn.start() time.sleep(10) conn.stop()
  • 24. DLR.de • Folie 24 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Verbreitete Devices Smartphones
  • 25. DLR.de • Folie 25 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Wie groß ist „Big“? Weltweit verkaufte Smartphones Quelle: http://en.wikipedia.org/wiki/Smartphone
  • 26. DLR.de • Folie 26 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Wie groß ist „Big“? Verfügbare Apps im Google Play Store 16 30 38 70 100 200 250 300 400 450 500 600 675 700 850 900 1.000 1.300 1400 1200 1000 800 600 400 200 0 Dez '09 Mär '10 Apr '10 Jul '10 Okt '10 Apr '11 Jul '11 Aug '11 Dez '11 Feb '12 Mai '12 Jun '12 Sep '12 Okt '12 Apr '13 Jul '13 Aug '13 Jul '14 Anzahl der verfügbaren Apps (in 1.000) Weltweit; Dezember 2009 bis Juli 2014, Quelle: statista GmbH, http://de.statista.com/statistik/daten/studie/74368/umfrage/anzahl-der-verfuegbaren-apps-im-google-play-store/
  • 27. DLR.de • Folie 27 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Sehr viele Apps… … aber die allerwenigsten sind in Python entwickelt!
  • 28. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 28 Python > 29.11.2014 Python auf Smartphones Frühe Technologien • PyS60 for Symbian • Python CE for Windows Mobile Aktuelle Technologien • Scripting Layer for Android (SL4A) • Python for Android (Py4A) • PySide / Qt for Android • WinRT / IronPython for Windows 8 • Kivy…
  • 29. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 29 Python > 29.11.2014 Kivy Plattformübergreifendes Python-Framework Plattformen • Android • iOS • Meego • Windows • Linux • OS X • Raspberry Pi kivy.org Entwicklung in Python auf allen Plattformen – keine Emulation!
  • 30. DLR.de • Folie 30 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Kivy „Hello World“ from kivy.app import App from kivy.uix.button import Button class TestApp(App): def build(self): return Button(text='Hello Cologne') TestApp().run()
  • 31. DLR.de • Folie 31 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Kivy Sprache „KV“ für Layout und Grafik from kivy.app import App class HelloApp(App): pass HelloApp().run() #:kivy 1.0 Button: Datei hello.kv definiert Root-Widget text: ‘Hello Hamburg’
  • 32. DLR.de • Folie 32 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Kivy Apps Verfügbar zum Beispiel im Google Play Store
  • 33. DLR.de • Folie 33 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Kivy Apps Geeignet für Prototypen
  • 34. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 34 Python > 29.11.2014 Kivy zur Erstellung von GUIs und Apps Beispiel aus der Raumfahrtbiologie Pflanzenbeleuchtung • Webcam nimmt Bild auf • Rechner erkennt Pflanze • Rechner berechnet anhand von Einstellungen ein Ausgabebild • Lichtquelle (z.B. Beamer) beleuchtet die Pflanze mit dem Bild
  • 35. DLR.de • Folie 35 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014
  • 36. DLR.de • Folie 36 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014
  • 37. DLR.de • Folie 37 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014
  • 38. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 38 Python > 29.11.2014 Python auf Smartphones Weitere Möglichkeiten… QPython – Python on Android (http://qpython.com)
  • 39. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 39 Python > 29.11.2014 Python auf Smartphones Weitere Möglichkeiten… Pythonista – Python on iOS http://omz-software.com/pythonista
  • 40. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 40 Python > 29.11.2014 Big Computers High Performance Computing
  • 41. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 41 Python > 29.11.2014 High Performance Computing (HPC) Spezialgebiet des Wissenschaftlichen Rechnens Wenn der Arbeitsplatzrechner nicht mehr ausreicht • Hohe Rechenleistung und hoher Speicherbedarf Bilder: http://www.isgtw.org Das Bild kann nicht angezeigt werden. Dieser Computer verfügt möglicherweise über zu wenig Arbeitsspeicher, um das Bild zu öffnen, oder das Bild ist beschädigt. Starten Sie den Computer neu, und öffnen Sie dann erneut die Datei. Wenn weiterhin das rote x angezeigt wird, müssen Sie das Bild möglicherweise löschen und dann erneut einfügen. Das Bild kann nicht angezeigt werden. Dieser Computer verfügt möglicherweise über zu wenig Arbeitsspeicher, um das Bild zu öffnen, oder das Bild ist beschädigt. Starten Sie den Computer neu, und öffnen Sie dann erneut die Datei. Wenn weiterhin das rote x angezeigt wird, müssen Sie das Bild möglicherweise löschen und dann erneut einfügen. Das Bild kann nicht angezeigt werden. Dieser Computer verfügt möglicherweise über zu wenig Arbeitsspeicher, um das Bild zu öffnen, oder das Bild ist beschädigt. Starten Sie den Computer neu, und öffnen Sie dann erneut die Datei. Wenn weiterhin das rote x angezeigt wird, müssen Sie das Bild möglicherweise löschen und dann erneut einfügen. Das Bild kann nicht angezeigt werden. Dieser Computer verfügt möglicherweise über zu wenig Arbeitsspeicher, um das Bild zu öffnen, oder das Bild ist beschädigt. Starten Sie den Computer neu, und öffnen Sie dann erneut die Datei. Wenn weiterhin das rote x angezeigt wird, müssen Sie das Bild möglicherweise löschen und dann erneut einfügen.
  • 42. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 42 Python > 29.11.2014 Wie groß ist „Big“? Aktuelle Supercomputer Aktuelle Supercomputer haben > 1.000.000 Cores > 10 PetaFLOPS Die drei derzeit größten Systeme (Nov 2014) 1. Tianhe-2 (Guangzhou, China) 3.120.000 Cores, 33,8 PetaFLOPS 2. Titan (ORNL, USA) 560.640 Cores, 17,5 PetaFLOPS 3. Sequoia (LLNL, USA) 1.572.864 Cores, 17,1 PetaFLOPS
  • 43. DLR.de • Folie 43 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Supercomputer Tianhe-2 (天河二号)
  • 44. DLR.de • Folie 44 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Supercomputer Titan Quelle: https://www.olcf.ornl.gov/titan/
  • 45. DLR.de • Folie 45 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Supercomputer Sequoia Quelle: https://asc.llnl.gov/computing_resources/sequoia/
  • 46. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 46 Python > 29.11.2014 High Performance Computing Programmiertechnologien MPI (Message Passing Interface) • API für Distributed-Memory-Architekturen in C, C++, Fortran, ... OpenMP (Open Multi-Processing) • API für Shared-Memory-Architekturen in C, C++, Fortran OpenACC (Open Accelerators) • API für heterogene CPU/GPU-Systeme in C, C++, Fortran Global Arrays Toolkit • API für Shared-Memory-Programmierung auf Distributed-Memory- Architekturen in C, C++, Fortran und Python
  • 47. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 47 Python > 29.11.2014 GPGPU General-purpose computing on graphics processing units Architektur • Viele Core pro Node • Geeignet für Prozessierung von Datenströmen (viele parallele unabhängige Datenpunkte) Programmiertechnologien • CUDA • API von NVIDIA in C • Python-Binding: PyCUDA • OpenCL • Offenes Framework für heterogene Systeme • Python-Binding: PyOpenCL Bild: NVIDIA
  • 48. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 48 Python > 29.11.2014 Numba Optimierungs-Compiler für Python Just-in-time-Compiler • Annotationen • Nutzt LLVM
  • 49. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 49 Python > 29.11.2014 Beispiel Free-Wake Simulation von Hubschrauber-Rotoren Free-Wake (DLR) • Simulation dreidimensionaler Strömungen um einen aktiv gesteuerten Rotor eines Helikopters • Code entwickelt 1994-1996 • MPI-parallelisiert in Fortran • Aufwendige Performance-Optimierung 2013-2014 • MPI und Open ACC
  • 50. DLR.de • Folie 50 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Visualisierung der Wirbel
  • 51. DLR.de • Folie 51 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Kern-Schleifen von Free-Wake (Standard Python) for iblades in range(numberOfBlades): for iradial in range(1, dimensionInRadialDirection): for iazimutal in range(dimensionInAzimualDirectionTotal): for i1 in range(len(vx[0])): for i2 in range(len(vx[0][0])): for i3 in range(len(vx[0][0][0])): # wilin-Aufruf 1 for iblades in range(numberOfBlades): for iradial in range(dimensionInRadialDirection): for iazimutal in range(1, dimensionInAzimualDirectionTotal): for i1 in range(len(vx[0])): for i2 in range(len(vx[0][0])): for i3 in range(len(vx[0][0][0])): # wilin-Aufruf 2 for iDir in range(3): for i in range(numberOfBlades): for j in range(dimensionInRadialDirection): for k in range(dimensionInAzimualDirectionTotal): x[iDir][i][j][k] = x[iDir][i][j][k] + dt * vx[iDir][i][j][k]
  • 52. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 52 Python > 29.11.2014 Free-Wake Performance-Vergleich Fortran – Python Vergleich der hoch-optimierten Fortran-Version mit parallelen Python-Versionen • Multi-core CPUs • Cython mit OpenMP • Python-Bindings für Global Array Toolkit • GPGPUs • NumbaPro
  • 53. DLR.de • Folie 53 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Performance-Tests Single-Core Performance (Xeon E5645, 6 Cores)
  • 54. DLR.de • Folie 54 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Performance-Tests Multi-Core Performance (Xeon E5645, 6 Cores)
  • 55. DLR.de • Folie 55 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Performance-Tests GPGPU Perf. (NVIDIA Tesla C2075, 448 CUDA-Cores)
  • 56. DLR.de • Folie 56 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Neue Rechnerarchitekturen Quantencomputer • Adiabatische Quantencomputer Bilder: NASA
  • 57. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 57 Python > 29.11.2014 Big Applications „Killer“-Applikationen in Wissenschaft und Technologie
  • 58. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 58 Python > 29.11.2014 Wichtige Anwendungssoftware Wissenschaft und Technik Viele kommerzielle Anwendungen sind noch Standard • Microsoft Excel • MATLAB • IDL • Fortran-Compiler Der Weg nach Python... • Open Source • Einheitliche Sprache für viele Anwendungsgebiete
  • 59. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 59 Python > 29.11.2014 Microsoft Excel Tabellenkalkulation Wesentliche Funktionen • Tabellen • Sortier-, Gruppier-, Filterfunktionen • Pivot-Tabellen • Diagramme Python-Alternative • IPython • pandas
  • 60. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 60 Python > 29.11.2014 The MathWorks MATLAB Numerische Matrixberechnungen Wesentliche Funktionen • Eigene proprietäre Programmiersprache • Viele Anwendungs-Toolboxes z.B. Statistik, Signal- und Bildverarbeitung Python-Alternative • NumPy • Matplotlib Nützliche Quelle: wiki.scipy.org/NumPy_for_Matlab_Users
  • 61. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 61 Python > 29.11.2014 IDL – Interactive Data Language Analyse und Visualisierung von Daten Wesentliche Funktionen • Array-basierte Programmiersprache • Gute Bildverarbeitungsfunktionen Python-Alternative • IDL-nach-Python-Compiler PIKE
  • 62. DLR.de • Folie 62 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 PIKE Beispiel-Codes ;; Simple image/ plotting and graphics tests pro MRI_demo ;Load demo data file file = filepath("mri500x300x5.dat", subdirectory=["data"]) print,file device, decomposed=0 loadct, 3 openr, lun, file, /get_lun ;Associate a variable with a data file img = assoc(lun, bytarr(500, 300)) !P.multi=[0,0,0,0] window, 0, xsize=500, ysize=300, title='MRI Demo - Flicker Loop' ;Display the five images in a loop for j=0, 2 do begin for i=0, 4 do begin tvscl, img[i] wait, 0.1 endfor endfor . . .
  • 63. DLR.de • Folie 63 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 PIKE Beispiel-Codes import numpy as np import pike def mri_demo( ): #Load demo data file pike.setArrayOrder("0and1") # expected array ordering # %; Define detected undefined variables lun = 0 file = pike.filepath("mri500x300x5.dat”, subdirectory=pike.catarr(["data"])) pike.print_(file) pike.device(decomposed=0) pike.loadct(3) lun = pike.openr(lun, file, get_lun=True) #Associate a variable with a data file img = pike.assoc(lun, pike.bytarr(500, 300)) pike.sysv.P.multi = pike.catarr([0, 0, 0, 0]) pike.window(0, title='MRI Demo - Flicker Loop', xsize=500, ysize=300) #Display the five images in a loop for j in xrange(np.int16(0), (np.int16(2))+(1)): for i in xrange(np.int16(0), (np.int16(4))+(1)): pike.tvscl(img[i]) pike.wait(0.1) . . .
  • 64. DLR.de • Folie 64 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 PIKE Beispiel-Codes Bild: Torsion Analytics
  • 65. DLR.de • Folie 65 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Entwerfen von Raumfahrzeugen
  • 66. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 66 Python > 29.11.2014 Entwerfen von Raumfahrzeugen Beispiel: Der DLR SpaceLiner SpaceLiner • Konzeptstudie für Passagiertransport • Mittelding zwischen Flugzeug und Raumschiff • Langstreckenflüge mit Hyperschallgeschwindigkeit (> Mach 5) • Strecke Europa – Australien in 90 Min. • Hochaufstieg mit Booster auf ca. 85 km • Gleitflug des Orbiters mit ca. Mach 20
  • 67. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 67 Python > 29.11.2014 Simulation in der Entwurfsphase Wärmeentwicklung beim Wiedereintritt Simulation mit verschiedenen Wärmeschutzsystemen • Wasserkühlung durch Verdampfung • Hochwärmeleitende Faserverbundstoffe
  • 68. DLR.de • Folie 68 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Wärmeschutzsystem Magnetohydrodynamik mit supraleitenden Magneten
  • 69. DLR.de • Folie 69 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Lorentzkraft in der Natur Aurora Borealis Bild: Alexander Gerst (https://twitter.com/Astro_Alex/status/507212904689848320)
  • 70. DLR.de • Folie 70 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Lorentzkraft in der Raumfahrt Schutzschilde
  • 71. DLR.de • Folie 71 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Wie entwirft man Raumschiffe?
  • 72. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 72 Python > 29.11.2014 Simulations-Workflow Vernetzung der Fachdisziplinen Geometrie Aerodynamik Thermal-management Subsystem-massen Struktur
  • 73. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 73 Python > 29.11.2014 Simulations-Workflow Mit Optimierung Geometrie Aerodynamik Thermal-management Subsystem-massen Struktur Optimierer
  • 74. > Python Unconference Hamburg 2014 > Andreas Schreiber • Big DLR.de • Folie 74 Python > 29.11.2014 Simulations-Workflow Integration in eine Simulationsumgebung
  • 75. DLR.de • Folie 75 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Simulationsumgebung RCE
  • 76. DLR.de • Folie 76 > Python Unconference Hamburg 2014 > Andreas Schreiber • Big Python > 29.11.2014 Vielen Dank! Fragen? Andreas.Schreiber@dlr.de www.DLR.de/sc | @onyame