backends Package¶
MatplotlibBackend
Module¶
OpenGLBackend
Module¶
OpenGL/Qt backend
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
Bounds
(xMin, xMax, yMin, yMax, y2Min, y2Max)[source]¶ Bases:
object
Describes plot bounds with 2 y axis
-
xAxis
¶
-
y2Axis
¶
-
yAxis
¶
-
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
FocusManager
(eventHandlers=())[source]¶ Bases:
PyMca5.PyMcaGraph.backends.GLSupport.Interaction.StateMachine
Manages focus across multiple event handlers
On press an event handler can acquire focus. By default it looses focus when all buttons are released.
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
ItemsInteraction
(backend)[source]¶ Bases:
PyMca5.PyMcaGraph.backends.GLSupport.Interaction.ClickOrDrag
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
MiniOrderedDict
[source]¶ Bases:
object
Simple subset of OrderedDict for python 2.6 support
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
OpenGLBackend
(parent=None, **kw)[source]¶ Bases:
PySide.QtOpenGL.QGLWidget
,PyMca5.PyMcaGraph.backends.OpenGLBackend.OpenGLPlotCanvas
-
staticMetaObject
= <PySide.QtCore.QMetaObject object>¶
-
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
OpenGLPlotCanvas
(parent=None, **kw)[source]¶ Bases:
PyMca5.PyMcaGraph.PlotBackend.PlotBackend
Implements PlotBackend API using OpenGL.
WARNINGS: Unless stated otherwise, this API is NOT thread-safe and MUST be called from the main thread. When numpy arrays are passed as arguments to the API (through
addCurve()
andaddImage()
), they are copied only if required. So, the caller should not modify these arrays afterwards.-
addCurve
(x, y, legend=None, info=None, replace=False, replot=True, color=None, symbol=None, linestyle=None, xlabel=None, ylabel=None, yaxis=None, xerror=None, yerror=None, z=1, selectable=True, fill=None, **kw)[source]¶
-
addImage
(data, legend=None, info=None, replace=True, replot=True, xScale=None, yScale=None, z=0, selectable=False, draggable=False, colormap=None, **kw)[source]¶
-
addItem
(xList, yList, legend=None, info=None, replace=False, replot=True, shape='polygon', fill=True, color=None, **kw)[source]¶
-
dataBounds
¶ Bounds of the currently loaded data Not including markers (TODO check consistency with MPLBackend)
Type: Bounds
-
dataToPixel
(x=None, y=None, axis='left', check=True)[source]¶ Parameters: check (bool) – Toggle checking if data position is in displayed area. If False, this method never returns None. Raises: ValueError if x or y < 0. with log axis.
-
insertMarker
(x, y, legend=None, text=None, color='k', selectable=False, draggable=False, **kw)[source]¶
-
insertXMarker
(x, legend=None, text=None, color='k', selectable=False, draggable=False, **kw)[source]¶
-
insertYMarker
(y, legend=None, text=None, color='k', selectable=False, draggable=False, **kw)[source]¶
-
matrixPlotDataTransformedProj
¶ Orthographic projection matrix for rendering transformed data
Type: numpy.matrix
-
matrixY2PlotDataTransformedProj
¶ Orthographic projection matrix for rendering transformed data for the 2nd Y axis
Type: numpy.matrix
-
pixelToData
(x=None, y=None, axis='left', check=True)[source]¶ Parameters: check (bool) – Toggle checking if pixel is in plot area. If False, this method never returns None.
-
plotDataBounds
¶ Bounds of the displayed area in data coordinates
Type: Bounds
-
plotDataTransformedBounds
¶ Bounds of the displayed area in transformed data coordinates (i.e., log scale applied if any)
Type: Bounds
-
resetSelectionArea
(name=None)[source]¶ Remove the name selection area set by setSelectionArea. If name is None (the default), it removes all selection areas.
Parameters: name – The name key provided to setSelectionArea or None
-
saveGraph
(fileName, fileFormat='svg', dpi=None, **kw)[source]¶ Save the graph as an image to a file.
WARNING: This method is performing some OpenGL calls. It must be called from the main thread.
-
setSelectionArea
(points, fill=None, color=None, name=None)[source]¶ Set a polygon selection area overlaid on the plot. Multiple simultaneous areas are supported through the name parameter.
Parameters: - points (An iterable of (x, y) coordinates) – The 2D coordinates of the points of the polygon
- fill (str) – The fill mode: ‘hatch’, ‘solid’ or None (default)
- color (list or tuple of 4 float in the range [0, 1]) – RGBA color to use (default: black)
- name – The key associated with this selection area
-
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
Range
[source]¶ Bases:
PyMca5.PyMcaGraph.backends.OpenGLBackend.Range
Describes a 1D range
-
center
¶
-
range_
¶
-
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
Select
[source]¶ Bases:
object
-
color
¶
-
parameters
= {}¶
-
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
Select1Point
(backend, parameters)[source]¶ Bases:
PyMca5.PyMcaGraph.backends.GLSupport.Interaction.StateMachine
,PyMca5.PyMcaGraph.backends.OpenGLBackend.Select
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
Select2Points
(backend, parameters)[source]¶ Bases:
PyMca5.PyMcaGraph.backends.GLSupport.Interaction.StateMachine
,PyMca5.PyMcaGraph.backends.OpenGLBackend.Select
-
class
Select2Points.
Select
(machine)[source]¶ Bases:
PyMca5.PyMcaGraph.backends.GLSupport.Interaction.State
-
class
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
SelectHLine
(backend, parameters)[source]¶ Bases:
PyMca5.PyMcaGraph.backends.OpenGLBackend.Select1Point
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
SelectLine
(backend, parameters)[source]¶ Bases:
PyMca5.PyMcaGraph.backends.OpenGLBackend.Select2Points
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
SelectPolygon
(backend, parameters)[source]¶ Bases:
PyMca5.PyMcaGraph.backends.GLSupport.Interaction.StateMachine
,PyMca5.PyMcaGraph.backends.OpenGLBackend.Select
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
SelectRectangle
(backend, parameters)[source]¶ Bases:
PyMca5.PyMcaGraph.backends.OpenGLBackend.Select2Points
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
SelectVLine
(backend, parameters)[source]¶ Bases:
PyMca5.PyMcaGraph.backends.OpenGLBackend.Select1Point
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
Zoom
(backend, color)[source]¶ Bases:
PyMca5.PyMcaGraph.backends.GLSupport.Interaction.ClickOrDrag
-
class
PyMca5.PyMcaGraph.backends.OpenGLBackend.
ZoomAndSelect
(backend, color)[source]¶ Bases:
PyMca5.PyMcaGraph.backends.OpenGLBackend.FocusManager
-
PyMca5.PyMcaGraph.backends.OpenGLBackend.
convertRGBDataToPNG
(data)[source]¶ Convert a RGB bitmap to PNG.
It only supports RGB bitmap with one byte per channel stored as a 3D array. See Definitive Guide and Specification for details.
Parameters: data (numpy.ndarray of unsigned bytes) – A 3D array (h, w, rgb) storing an RGB image Returns: The PNG encoded data Return type: bytes
-
PyMca5.PyMcaGraph.backends.OpenGLBackend.
prepareCurveSignal
(button, label, type_, xData, yData, x, y, xPixel, yPixel)[source]¶
-
PyMca5.PyMcaGraph.backends.OpenGLBackend.
prepareDrawingSignal
(event, type_, points, parameters=None)[source]¶
-
PyMca5.PyMcaGraph.backends.OpenGLBackend.
prepareHoverSignal
(label, type_, posData, posPixel, draggable, selectable)[source]¶
-
PyMca5.PyMcaGraph.backends.OpenGLBackend.
prepareImageSignal
(button, label, type_, col, row, x, y, xPixel, yPixel)[source]¶
-
PyMca5.PyMcaGraph.backends.OpenGLBackend.
prepareMarkerSignal
(eventType, button, label, type_, draggable, selectable, posDataMarker, posPixelCursor=None, posDataCursor=None)[source]¶
-
PyMca5.PyMcaGraph.backends.OpenGLBackend.
prepareMouseSignal
(eventType, button, xData, yData, xPixel, yPixel)[source]¶
-
PyMca5.PyMcaGraph.backends.OpenGLBackend.
saveImageToFile
(data, fileNameOrObj, fileFormat)[source]¶ Save a RGB image to a file.
Parameters: - data (numpy.ndarray with of unsigned bytes.) – A 3D array (h, w, 3) storing an RGB image.
- fileNameOrObj (A str or a 'file-like' object with a 'write' method.) – Filename or object to use to write the image.
- fileType (str) – The type of the file in: ‘png’, ‘ppm’, ‘svg’, ‘tiff’.