Getting more out of Matplotlib with GR



Similar documents
GR.jl Plotting for Julia based on GR

GR Framework / MODBUS on Raspberry Pi

GR A universal framework for visualization applications

Scientific Visualization

Neutron Science Visualization Software

Nicolas P. Rougier PyConFr Conference 2014 Lyon, October 24 25

A Hybrid Visualization System for Molecular Models

imc FAMOS 6.3 visualization signal analysis data processing test reporting Comprehensive data analysis and documentation imc productive testing

PyCompArch: Python-Based Modules for Exploring Computer Architecture Concepts

Android Architecture. Alexandra Harrison & Jake Saxton

imc FAMOS 6.3 visualization signal analysis data processing test reporting Comprehensive data analysis and documentation imc productive testing

Session 85 IF, Predictive Analytics for Actuaries: Free Tools for Life and Health Care Analytics--R and Python: A New Paradigm!

Introduction to WebGL

Extending Tizen Native Framework with Node.js

CSE 237A Final Project Final Report

CS 378: Computer Game Technology

BogDan Vatra and Andy Gryc. Qt on Android: Is it right for you?

Interactive Visualization

HTML5 the new. standard for Interactive Web

Performance Optimization and Debug Tools for mobile games with PlayCanvas

Lecture Notes, CEng 477

3D Data visualization with Mayavi

Parallel Visualization of Petascale Simulation Results from GROMACS, NAMD and CP2K on IBM Blue Gene/P using VisIt Visualization Toolkit

Web 3D Service (W3DS) in Geoserver

The Most Popular UI/Apps Framework For IVI on Linux

Research on HTML5 in Web Development

Windows Embedded Compact 7 Multimedia Features 1

Color correction in 3D environments Nicholas Blackhawk

Advertising Specifications, Standards and Guidelines

Mobile Performance: for excellent User Experience

Introduce Web3D Development and Visualization. Moxie Zhang Esri R&D Center Beijing

Visualizing Data: Scalable Interactivity

<Insert Picture Here> Java, the language for the future

Parallel Web Programming

Revision history: New comments added to: m)! Universal Driver


Raising the Bar (Chart)

QML and JavaScript for Native App Development

Océ PRISMA archive software. Archiving made easy. Powerful, high-volume. archiving software

Embedded Linux RADAR device

Distributed Systems Seminar Spatio-Temporal Visualization System - STVS

Geant4 Visualization. Andrea Dotti April 19th, 2015 Geant4 M&C+SNA+MC 2015

Visualizing a Neo4j Graph Database with KeyLines

Driving the User Interface. Trends in Automotive GUIs

ADVERTISING SPECS. Base File Weight

Developing Applications for ios

Mobile Phones Operating Systems

Material for tutorial. Twitter: prabhu_r. Slides: Demos:

Windmill. Automated Testing for Web Applications

Scientific Visualization

Introduction to Android

Progressive Enhancement With GQuery and GWT. Ray Cromwell

2311A: Advanced Web Application Development using Microsoft ASP.NET Course 2311A Three days Instructor-led

-Android 2.3 is the most used version of Android on the market today with almost 60% of all Android devices running 2.3 Gingerbread -Winner of

4/25/2016 C. M. Boyd, Practical Data Visualization with JavaScript Talk Handout

Технологии Java. Android: Введение. Кузнецов Андрей Николаевич. Санкт-Петербургский Государственный Политехнический Университет

Web Based 3D Visualization for COMSOL Multiphysics

Shader Model 3.0. Ashu Rege. NVIDIA Developer Technology Group

Enterprise Mobile Application Development: Native or Hybrid?

MayaVi: A free tool for CFD data visualization

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

CLOUD GAMING WITH NVIDIA GRID TECHNOLOGIES Franck DIARD, Ph.D., SW Chief Software Architect GDC 2014

Coding for Desktop and Mobile with HTML5 and Java EE 7

Crosswalk: build world class hybrid mobile apps

Chapter 10: Multimedia and the Web

JavaFX Session Agenda

Reviewer s Guide. Morpheus Photo Animation Suite. Screenshots. Tutorial. Included in the Reviewer s Guide:

Postprocessing with Python

Digital and Mobile Advertising Specs. Preparing elements that increase revenue and improve results

Development. SriSeshaa Technologies. Table of Contents

HTML5 AUTOMOTIVE 2013 White Paper Series

Unlocking the True Value of Hadoop with Open Data Science

Some Experiences With Python For Android (Py4A) Nik Klever University of Applied Sciences Augsburg

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

HYBRID APPLICATION DEVELOPMENT IN PHONEGAP USING UI TOOLKITS

Mobile App Infrastructure for Cross-Platform Deployment (N11-38)

Advanced Rendering for Engineering & Styling

Technical Specifications: tog Live

Cisco Interactive Services Solution: Cisco Interactive Experience Client 4600 Series

Programming 3D Applications with HTML5 and WebGL

Writing standalone Qt & Python applications for Android

Web Development with R

Rich Internet Applications

Why are we teaching you VisIt?

Web-Based Enterprise Data Visualization a 3D Approach. Oleg Kachirski, Black and Veatch

Multiprocess System for Virtual Instruments in Python

Today's Topics. COMP 388/441: Human-Computer Interaction. simple 2D plotting. 1D techniques. Ancient plotting techniques. Data Visualization:

Web Interface using HTML5 for Interaction between Mobile Device & Cloud- Services

Development Techniques for Native/Hybrid Tizen Apps. Presented by Kirill Kruchinkin

AUTOMATED CONFERENCE CD-ROM BUILDER AN OPEN SOURCE APPROACH Stefan Karastanev

ArcGIS ArcMap: Printing, Exporting, and ArcPress

RTC:engine. WebRTC SOLUTION SIPWISE AND DEUTSCHE TELEKOM / TLABS ANNOUNCE COOPERATION FOR THE

Visualizing an OrientDB Graph Database with KeyLines

Transcription:

Member of the Helmholtz Association Getting more out of Matplotlib with GR July 20 th 26 th, 2015 Bilbao EuroPython 2015 Josef Heinen @josef_heinen

Visualization needs visualize and analyzing two- and three-dimensional data sets plot 2D data for real-time monitoring purposes (signal processing) visualize large data sets, probably with a dynamic component, preferably in real-time create publication-quality and web-ready graphics create animations or videos on the fly 2

Python visualization solutions Plotly Bokeh Matplotlib de-facto standard ( workhorse ) Browser solutions: Bokeh, plot.ly Mayavi (mlab) powerful, but overhead from VTK ggplot, chaco statistical, 2D graphics VTK versatile, but difficult to learn ggplot chaco Vispy, Glumpy, OpenGL fast, but low-level API 2D 3D 3

Problems so far Crux of the matter separated 2D and (hardware accelerated) 3D world Interop some graphics backends "only" produce "figures" no presentation of continuous data streams speed up only by means of backend specific code poor performance on large data sets Speed Quality 4

Where to go from here? How can we improve the performance? Several Python modules can be compiled into native code, making them much faster (Cython) Compiling hotspots on the fly (Numba, PyPy) can significantly speed up numerical code segments Use hardware acceleration, but these approaches cannot easily be applied to visualization software! Could another backend speedup Matplotlib and improve interop? 5

Use GR to achieve more graphics performance procedural graphics backend (completely written in C) presentation of continuous data streams builtin support for 2D plotting and OpenGL (GR3) coexistent 2D and 3D world interoperability with GUI toolkits and Web frameworks good user interaction 6

Use GR to extend Matplotlib s capabilities combine the power of Matplotlib and GR next Matplotlib release will allow selecting the backend by setting the environment variable MPLBACKEND produce video contents on the fly by adding a single line of code no need to import an animation module or write extra code create plots containing both 2D and 3D graphics elements 7

How it works: GR layer architecture Qt console interaction Notebooks support for Python or Julia kernels Use GR as a Matplotlib backend; mix GR, MPL and GR3 code glgr / igr App C / ObjC OpenGL Qt / wx event loop ES socket communication IPython GR off-screen rendering PyPy Swift direct rendering GR3 C / C++ JavaScript generation Browser... POV-Ray generation GLUT GLFW wxglcanvas QGLWidget Generate ray-traced graphics scenes Create HTML5 output GKS WebGL OpenGL (WGL / CGL / GLX) POV-Ray Create video animations on the fly GKS logical device drivers Qt wx X11 Quartz Win32 TikZ PDF MOV gksqt GKSTerm LATEX PS 0MQ HTML5 SVG OpenGL... More logical device drivers / plugins: CGM, GKSM, GIF, RF, UIL WMF, Xfig GS (BMP, JPEG, PNG, TIFF) Highlights: simultaneous output to multiple output devices direct generation of MPEG4 image sequences flicker-free display ("double buffering ) IPython / Jupyter notebook integration

Matplotlib using the GR backend $( $& Arrow Line2D %#"# $% $)"' $# * $%"' ( $#"# Ellipse FancyBoxPatch & )"' % '"#! $! "!! %! $! #! "! #! "! # % & + ( #"* #") &"( #"& &"# #"# %"( 135 $"( &"# &"( '"# '"( ("# #"* #") &"( #"& &"# #"# %"( %"#! #") $"( &"( #!"# "!)+ "!'( "!%& "!## "!## "!%& "!'( "!)+ #!"# 6 4 0 ( 225 315! #"* &"# #! # &$% # %$') # &$* # %$(+ # '$% # '$% 2! #"& %"( %! $! 10 180 '"# %"# %! $"% '"( $"( $! 8! #"* %"( #! # %$&' # &$* '"# '"( # &$% # %$* %$% %$* &$% &$* '$% )/07,5/2- * (,0*82*9 1,6.!*440/+*7/32 73./-.# 5,63087/32 75/+327385/2-" 45! #") +327385- :/7. 0,9,06 %$%% &$%! #"& %"# %"# "! #"# $# *!! "! ( $"% '"# $"( %$&' ) %$% %"'!%!% '"( $"# $"# %$') 90 4+30351,6. :/7. 0,9,06 ("# &$% &! ' PathPatch %$(+ # %$* # Polygon &$* %$* %! Circle %$), &! $'"# - Rectangle "!! +, Wedge 051..-7-7/67!'%% 431276" '$% %%"' & $ " $ $ & " $ & ( "!' %$' "!* "!( "!& "!$ "!" "!$ "!& "!( "!* "!% "!$ "!" %$% "!$ "!% "!' #!" # %$' "!& #!" & ( ( 270 # &$% # &$% # %$' %$% %$' &$% "!& "!" "!" "!& "!& #!" #!" 9

GR in action 10

GR / Jupyter 700 Performance (anim.py) 600 fps 500 400 300 200 100 0 MPL MPL+GR GR click images to view notebooks

Performance analysis ncalls cumtime filename:lineno(function) 700 600 500 fps MPL 398 6.852 {method'draw'of'_macosx.figurecanvas'objects} 29378/397 6.771 artist.py:57(draw_wrapper) 397 6.769 figure.py:1004(draw) 397 6.574 _base.py:1989(draw) 794 5.894 axis.py:1106(draw) 5161 4.601 axis.py:232(draw) 199 3.616 pyplot.py:175(pause) 10719 3.609 lines.py:661(draw) 199 3.480 pyplot.py:551(draw) 7940 1.044 text.py:581(draw) most time spent in backend wrapper 400 ncalls cumtime filename:lineno(function) 300 200 100??? MPL + GR 199 4.412 pyplot.py:551(draw) 199 4.410 backend_gr.py:227(draw) 14726/199 4.237 artist.py:57(draw_wrapper) 199 4.236 figure.py:1004(draw) 199 4.138 _base.py:1989(draw) 398 3.770 axis.py:1106(draw) 2587 3.073 axis.py:232(draw) 5373 2.642 lines.py:661(draw) 5174 1.202 backend_bases.py:237(draw_markers) No room for further optimizations on the backend side 0 MPL MPL+GR GR GR ncalls cumtime filename:lineno(function) 199 3.263 init.py:1910(plot) 199 3.184 init.py:250(updatews)

GR + GR3 + Matplotlib interop Important: tells MPL backend not to update Matplotlib GR3 GR 13

Inline graphics Matplotlib GR ~ 10 times faster

Demos Animated graphics performance comparison: Matplotlib vs. GR (anim.ipynb) GR / mogli / Matplotlib interoperability example (interop.ipynb) Inline graphics performance comparison: Matplotlib vs. GR (inline.ipynb) Simple spectral (specgram.ipynb)

Outlook (GR release v0.15.0) JavaScript GR + GKS can be transpiled to JS (Emscripten: LLVM-to-JavaScript compiler) Use cases: embed JS code in IP[y]: or IJulia (Jypyter) parse GKS JavaScript logical device driver generated display list in browser

What else can GR be used for? pymoldyn see Poster session: Embedding visualization applications with pygr by Christian Felder

Conclusions Using the GR Matplotlib backend has not turned out satisfactory as the speedups were not as expected GR adds more plotting capabilities to Matplotlib allowing to mix 2D drawings and 3D graphics scenes or create movies on the fly Producing plots / figures is much faster with the GR framework (speedup for plots > 20, > 100 respectively) 18

What happens next? integrate JavaScript GKS logical device driver provide more convenience function migrate the GR3 library to modern OpenGL (using OpenGL shader language) visualize millions of vertices / faces simplify the installation 19

Resources Website: http://gr-framework.org GR framework: https://github.com/jheinen/gr PyPI: https://pypi.python.org/pypi/gr Talk material: Getting more out of Matplotlib with GR 20

Thank you for your attention Questions? Contact: j.heinen@fz-juelich.de @josef_heinen Thanks to: Fabian Beule, Steffen Drossard, Christian Felder, Marvin Goblet, Ingo Heimbach, Daniel Kaiser, Philip Klinkhammer, David Knodt, Florian Rhiem, Jörg Winkler et al. 21