Embedding Visualization Applications with PyGR Object oriented interfaces and PyQt/PySide bindings for GR - a universal framework for visualization applications Georg Brandl, Christian Felder, Josef Heinen (a) Microphone Power Spectrum and Peaks (com- (b)Surface Plot with Contour Lines (c)3D Surface Plot puted using FFT) GR PyGR GRaphics Library optimized for real-time data visualizations Object oriented interface on top of GR Manipulating object states instead of fiddling with procedure calls • • • Procedural graphics backend (written in C) Convenience functions for Adding new functionality using derived objects, e.g. • • • Does not rely on creation of figures Zooming Clamp minimum values for selecting a Region of Interest (x , y > 0) • • • min min Panning 1 class ContourAxes(PlotAxes): Representation of continuous data streams • ) Selecting a Region def setWindow(self, xmin, xmax, ymin, ymax): Based on a Graphical Kernel System • if xmin < 1: • Detecting predefined Regions Of Interest (point in polygon test) xmin = 1 Device and Platform independent API • 6 • if ymin < 1: Large scale of logical device drivers/plugins: Independent of GUI Toolkits ymin = 1 • • return PlotAxes.setWindow(self, xmin, xmax, ymin, ymax) Qt, wxWidgets • X11, Quartz, Win32 Drawing a bar at a given position xi, yi to indicate a peak position • • PostScript, PDF, SVG class PeakBars(PlotCurve): • 2 GS (BMP, JPEG, PNG, TIFF) • def drawGR(self): MOV (MPEG4) if self.linetype is not None and self.x: • # preserve old values HTML5 lcolor = gr.inqlinecolorind() • 7 gr.setlinewidth(2) Builtin support for 2D plotting and OpenGL (GR3) gr.setlinecolorind(self.linecolor) • for xi, yi in zip(self.x, self.y): Coexistent 2D and 3D world gr.polyline([xi, xi], [0, yi]) ) 12 # restore old values gr.setlinecolorind(lcolor) QtGR gr.setlinewidth(1) Qt Widgets for drawing and interacting with GR Hide/Unhide dependent objects • • Specialized Qt Events, e. g. Mouse Events in different coordinate class DependentPlotCurve(PlotCurve): • systems (Normalized-, Device- and World Coordinates) # Constructor... # dependent property... MouseEvent 5 • # pylint: disable=W0221 WheelEvent @PlotCurve.visible.setter • PickEvent def visible(self, flag): • PlotCurve.visible.__set__(self, flag) ROIEvent 10 for dep in self.dependent: • dep.visible = flag LegendEvent • def drawGR(self): PlotCurve.drawGR(self) Support for PyQt and PySide 15 for dep in self.dependent: • if dep.visible: dep.drawGR() GR has been integrated into NICOS, a network-based experiment and instrument control system used for neutron scattering experiments at FRM II in Munich. Network Instrument COntrol System Ongoing Projects Replaced existing Panels Logarigthmic scale General purpose 3D plotting objects in PyGR • • • based on PyQwt (unmaintained) • Dynamic tick marks for different time domains Integrated live view for three-dimensional data Auto scaling in x- and/or y- direction • • • Legend items for curves Generation of SVG plots for HTML status monitor Adjust axes to fit all shown curves including error bars • • • Un/hide curve and dependencies, e.g. error bars or fit parameters Adjust in respect to user specified region of interests • • General purpose functions: Member of the Helmholtz Association Adjust axes in altering direction only • ! Zooming into a specific point (Mouse wheel zoom) • Support for different x axes Panning • • Fitting Peaks or arbitrary functions Selecting a Region of Interest • • Picking of fit parameters • Contact: [email protected] - Website: www.fz-juelich.de, gr-framework.org.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages1 Page
-
File Size-