Mitglied der Helmholtz-Gemeinschaft GR A universal framework for visualization applications 26. April 2012 73. Koordinierungstreffen J. Heinen
GR Layer Structure Fortran C / C++ Objective-C Python Ruby... GR Pascal Fortran C / C++ / clang GLGr Graphics Kernel System (GKS) Qt X11 Quartz Win32 Java PS PDF SVG OpenGL (ES) Apple ios gksqt GKSTerm gksweb Logical device drivers / plugins: - CGM, GKSM, GIF, RF, UIL - WMF, Xfig - GS (BMP, JPEG, PNG, TIFF) 26. April 2012 J. Heinen, PGI/JCNS-TA, Scientific IT-Systems 2
KWS Live Display: Qt4 + GR workflow Instrument host OpenGL capable host / ios device Qt event loop Qt GUI Python GR App C / C++ socket communication GR C / Objective-C OpenGL C ES GKS GKS logical device drivers Qt gksqt 26. April 2012 X11 Quartz GKSTerm Win32 Java PS PDF SVG gksweb J. Heinen, PGI/JCNS-TA, Scientific IT-Systems 3
News Ø Simplified build procedure for Linux, Mac OS X and Windows (VC6) Ø Can now be installed in any directory (GRDIR environment variable) Ø GR now implemented as ctypes module with Docstrings; fully integrated into IPython Qt Console (command completion, class tips) Ø Version control using PGI/JCNS Git server with SSH public key support and GitWeb repository browser Ø GKS Qt (gksqt) now with multi document design 4
Polystrene spheres in D2O/H2O Example 4 3 2 R=00Å R=500Å -1 dσ/dω [cm ] produced by a Python script using simple GR commands and a Numpy function for smoothed curves (* R=350Å 1 0 R=150Å -1 λ=20å λ=4.5å -2 (* based on an OriginLab data set from A. Radulescu 26. April 2012-3 -2-1 -1 Q[Å ] J. Heinen, PGI/JCNS-TA, Scientific IT-Systems 5
#usr/bin/env python # -*- coding: iso-8859-1 -*- import gr import numpy import time def readfile(path) : fp = open(path, "r") x = [] y = [] for line in fp.readlines() : s = line.split() x.append(float(s[0])) y.append(float(s[1])) fp.close() return x, y def smooth(y): s = numpy.log(numpy.r_[y[:0:-1], y, y[-1:-11:-1]]) w = numpy.hanning(11) y = numpy.convolve(w / w.sum(), s, mode='valid') return map(none, numpy.exp(y[5:-5])) gr.setwsviewport(0, 0.2, 0, 0.2) gr.settextfontprec(8, 0) gr.setcharheight(0.024) gr.settextalign(2, 1) gr.setshadow(0.1, 0.1, 2) gr.textext(0.55, 0.96, 'Polystrene spheres in {D_2}O\/{H_2}O)') gr.textext(0.55, 0.1, 'Q[Å^{-1}]') gr.setcharup(-1, 0) gr.textext(0.05, 0.55, 'd\sigma\/d\omega [cm^{-1}]') gr.setcharup(0, 1) gr.setwindow(0.0005, 0.35, 0.01, 25000) gr.setscale(3) gr.setarrowstyle(11) gr.textext(0.35, 0.325, '\lambda=20å') gr.drawarrow(0.0007, 0.05, 0.007, 0.05) gr.textext(0.6, 0.275, '\lambda=4.5å') gr.drawarrow(0.0025, 0.02, 0.3, 0.02) gr.axes(2, 2, 0.0005, 0.01, 1, 1, 0.005) gr.axes(2, 2, 0.35, 25000, -1, -1, -0.005) gr.setmarkertype(gr.markertype_circle) gr.setmarkersize(1.5) gr.settextalign(1, 1) gr.setmarkercolorind(173) gr.setlinecolorind(121) x, y = readfile('r00a.dat') gr.polymarker(len(x), x, y) gr.polyline(len(x), x, smooth(y)) gr.text(0.375, 0.8, 'R=00Å') gr.setmarkercolorind(86) x, y = readfile('r500a.dat') gr.polymarker(len(x), x, y) gr.polyline(len(x), x, smooth(y)) gr.text(0.475, 0.7, 'R=500Å') gr.setmarkercolorind(2) x, y = readfile('r350a.dat') gr.polymarker(len(x), x, y) gr.polyline(len(x), x, smooth(y)) gr.text(0.55, 0.6, 'R=350Å') gr.setmarkercolorind(94) x, y = readfile('r150a.dat') gr.polymarker(len(x), x, y) gr.polyline(len(x), x, smooth(y)) gr.text(0.65, 0.45, 'R=150Å') gr.updatews() a simple GR script 6
IPython Command Language IPython + GR Ø Command Completion Ø Help information appears as you type 7
Git Repositories / GitWeb 8
GKS Qt 9
Current activities Ø Design of an abstraction layer for Qt4, wxwidgets, Gtk (bachelor thesis) Ø GR3 OpenGL integration (bachelor thesis) Highlights: draw molecules ( sticks and balls ), arrows (spins), meshes and surfaces; generate WebGL scripts Ø Replace math formula renderer with a native LaTeX module based on mimetex and LaTeX equation editor Planned activities Ø Setup a Wiki and/or Website
Lessons learned / conclusions Q: Does a review of the GR development help us to make a decision for a scripting environment? Ø Keep it simple Ø Avoid any prerequisites or dependencies to other software if possible Ø Software should be self-contained Ø Easy installation (without administrator privileges) Ø Prefer loosely coupled software technologies 11