PyDVT.GraphView (version 1.1.0, 08/11/2002)
index
/mntdirect/_bliss/users/gobbo/PyDVT/PyDVT/GraphView.py

GraphView.py
View derived class for 1d plotting

 
Modules
            
Command
EventHandler
PyDVT.GraphViewSelect
Numeric
PyDVT
math
sys
types

 
Classes
            
PyDVT.Filter.Filter
GraphFilter
Graph
PolarGraph
HistFilter
Hist
PolarFilter
PyDVT.View.View(PyDVT.GUIBinding.Binding.Container)
GraphView

 
class Graph(GraphFilter)
      View's simplified filter for direct NumPy interface.
(creates and hides it's own data object)
 
  
DataChanged(self, par) from PyDVT.Filter.Filter
DataCoord2SelectionCoord(self, data_coord) from PyDVT.Filter.Filter
Destroy(self, source=None)
If filter gets out of scope, this should be called to destroy
internally created data object.
GetData(self) from PyDVT.Filter.Filter
GetDataSelection(self) from PyDVT.Filter.Filter
GetInput(self) from PyDVT.Filter.Filter
GetOutput(self) from GraphFilter
GetSource(self) from PyDVT.Filter.Filter
Refresh(self) from PyDVT.Filter.Filter
SelectionCoord2DataCoord(self, selection_coord) from PyDVT.Filter.Filter
SetSynchronized(self, synchronized) from PyDVT.Filter.Filter
__init__(self, data=None, yscale=0, xdata=None, pen=<PyDVT.GUIBinding.Binding.Pen instance>, symbol='none', name=None)
Parameters:
    data: NumPy 1d array to be displayed
    yscale: Optional. If yscale==1 the graphic is referenced to right-sided y scale.
    xdata: Optional NumPy array defining x coordinates
           (can be received by source  as well)
    pen: Optional Pen for drawing
    symbols: Optional string meaning the simbol for point representation.
             It can be: 'circle','square','diamond','plus','cross','star','triangle'
                        'none' = no symbols

 
class GraphFilter(PyDVT.Filter.Filter)
      View's standard filter.
 
  
DataChanged(self, par) from PyDVT.Filter.Filter
DataCoord2SelectionCoord(self, data_coord) from PyDVT.Filter.Filter
Destroy(self, source=None) from PyDVT.Filter.Filter
GetData(self) from PyDVT.Filter.Filter
GetDataSelection(self) from PyDVT.Filter.Filter
GetInput(self) from PyDVT.Filter.Filter
GetOutput(self)
Returns the selection data (dictionary)
Keys:
    "name": string: name of function or None
    "data": NumPy array
    "xdata" 1d NumPy array 
    "yscale": if 1, right-scale referenced
    "pen"  Pen object      
    "symbol"  plot symbol
GetSource(self) from PyDVT.Filter.Filter
Refresh(self) from PyDVT.Filter.Filter
SelectionCoord2DataCoord(self, selection_coord) from PyDVT.Filter.Filter
SetSynchronized(self, synchronized) from PyDVT.Filter.Filter
__init__(self, name=None, source=None, synchronized=1, buffer_input=0, yscale=0, xdata=None, pen=<PyDVT.GUIBinding.Binding.Pen instance>, symbol='none')
Parameters:
    name: Optional  name of the function
    source: Source Filter/DataSelection
    synchronized: non-zero if on-line
    buffer_input: see Filter.__init__
    yscale: Optional. If ysacale==1 the graphic is referenced to right-sided y scale.
    xdata: Optional NumPy array defining x coordinates
           (can be received by source  as well)
    pen: Optional Pen for drawing (it can be set afterwards with GraphView's SetPen)
    symbols: Optional string meaning the simbol for point representation.
             It can be: 'circle','square','diamond','plus','cross','star','triangle'
                        'none' = no symbols
             (it can be set afterwards with GraphView's SetSymbol)

 
class GraphView(PyDVT.View.View)
      View derived class for graphical plotting of 1d arrays.
GraphView expects the following keys from it's source (GetOutput
method):
"data": 1d NumPy array to be drawn (y values)
"xdata":1d NumPy array with the x values. If None, take's [0 .. x dimention of "data"]
        Have to be ordered(ascending or descending), but in Polar mode.
"name": Optional. Not used for the moment.
"yscale": Optional. If equals to one, plotting is referenced to right-side scale.    
"pen":  Optional. Pen for drawing current source.
"symbol":  Optional. Symbol for drawing current source.
"nopts": Optional. If set, defines the number of valid points in data
"delimeters": Optional. List of tuples defining (start,end) slices of xdata.
              When in style "Line" or "PointsLine", the extremes of these
              slices defined by (start,end) are not connected by lines.
           
 
 
Interface:
===========================
View interface
SetZoom
ResetZoom
ZoomTo
ClearZoomSelect
SetZoomStyle
SetLabels
SetXScaleLinear
SetXScaleLog
SetYScaleLinear
SetYScaleLog
GetPositionValues
GetClosestFunction
SetCursorType
SetPolarEnv
EnableLegend
GetPolarCoords
SetPen
SetSymbol
SetFunctionYScale
SetStyle
SetXAxis
SetYAxis
SetY2Axis
GetXAxis
GetYAxis
GetY2Axis
 
Overridables:    
===========================
View overridables
CreateMenu
EventPosition 
EventDoubleClick 
 
 
Some of Drawable's methods are callable at application level (they're accessed
through View.GetDrawable() (see GUIBinding.Drawable1D):
 
  
AddMenuPopupCascade(self, label, menu) from PyDVT.View.View
AddMenuPopupItem(self, label, Command, Style='command') from PyDVT.View.View
AddMenuSeparator(self) from PyDVT.View.View
ClearMenu(self) from PyDVT.View.View
ClearZoomSelect(self)
Called to destroy zoom ViewSelect object.
Called in the zoom selection event, but applications can assure
the destruction by calling this.
CreateDrawable(self)
Virtual: Implements creation of  a Drawable object (which implements the
Drawable interface)
CreateMenu(self)
Can be overwritten by derived classes to create a
different popup menu
DataChanged(self, source=None)
Virtual: See View.DataChanged
DataCoord2ImageCoord(self, data_coord) from PyDVT.View.View
DataCoord2ViewCoord(self, coord)
Virtual: See View.DataCoord2ImageCoord
DeleteMenuItem(self, index) from PyDVT.View.View
Destroy(self, source=None) from PyDVT.View.View
DisableMenuItem(self, index) from PyDVT.View.View
EnableLegend(self, enable, position='bottom')
Parameters:
    enable: if non-zero adds legend. If zero, removes.
    position: if enable is non-zero  sets the position of the legend: "top", "left",
              "right" or "bottom"
EnableMenuItem(self, index) from PyDVT.View.View
EventButtonPress(self, pos) from PyDVT.View.View
EventButtonPressMotion(self, pos) from PyDVT.View.View
EventButtonRelease(self, pos) from PyDVT.View.View
EventDoubleClick(self, pos)
Overridable: Double click callback event         Parameters:
    pos: position of the event
EventKeyPress(self, key, flags) from PyDVT.View.View
EventMotion(self, pos) from PyDVT.View.View
EventPosition(self, source)
Overridable: Cursor callback event                      GraphView threats it if "AddStaus" option set in __init__.
             In this case, if this function is overriden ,derived
             classes should call GraphView.EventPosition
Parameters:
    source: GraphViewSelect object thar generated the event
GetClosestFunction(self, coord)
Returns, if any, the closest source function to the coord=(x,y)
GetDrawable(self) from PyDVT.View.View
GetDrawableHeight(self) from PyDVT.View.View
GetDrawableWidth(self) from PyDVT.View.View
GetHeight(self) from PyDVT.GUIBinding.Binding.Container
GetPolarCoords(self, coords)
ViewSelect and mouse events are generated always in orthogonal coords,
regardless polar environment is enabled or not. In this case this 
method can be called to convert the coords.
Parameters:
  coords: orthogonal coords
Returns: polar coords
GetPopupMenu(self) from PyDVT.View.View
GetPosition(self, event)
Virtual: See View.GetPosition
GetPositionValues(self, position)
For a given plotting position=(x0,y0), returns a list of  tuples (name,(x,y))
where:
    - name is the name of a source function
    - x is the source function x value closest x to x0
    - y is the value of function at x
GetSaveFormats(self)
Returns tuple with supported save formats
GetSource(self) from PyDVT.View.View
GetWidth(self) from PyDVT.GUIBinding.Binding.Container
GetXAxis(self)
Returns X Axis = (min,max)
GetY2Axis(self)
Returns Y2 Axis = (min,max)
GetYAxis(self)
Returns Y Axis = (min,max)
ImageCoord2DataCoord(self, view_coord) from PyDVT.View.View
Invalidate(self) from PyDVT.View.View
IsVisible(self) from PyDVT.GUIBinding.Binding.Container
LockPosition(self, value)
Controls repositioning of view after data change.
Parameters:
Value: If zero, view stays at the same position and zoom state in the
       case of a DataChange event. Otherwise, views returns tu initial
       position. By default FlagLockPosition is set to zero.
Redraw(self)
Virtual: See View.Redraw
Refresh(self) from PyDVT.View.View
ResetZoom(self)
Resets zoom.
Save(self, filename, format) from PyDVT.View.View
SetCursor(self, cursor) from PyDVT.View.View
SetCursorType(self, cursortype)
Sets the cursor
Parameters: 
    cursortype: "None" (default), "Crosshairs or "Vertical""
                All types generate EventPosition events
SetFunctionYScale(self, name, yscale)
Sets y axis the function is related to
Parameters:
  name: name of the source function
  yscale: 0 or 1
SetLabels(self, title_label=None, x_label=None, y_label=None, y2_label=None)
Sets drawing labels
Parameters:
  title_label: Title of the drawing
  x_label: Label of x axis
  y_label: Label of y axis
  y2_label: Label of second (right-side) y axis
SetOnLine(self, value) from PyDVT.View.View
SetPen(self, name, pen)
Sets pen for a source plotting
Parameters:
  name: name of the source function
  pen: Pen object
SetPointer(self, pointer) from PyDVT.GUIBinding.Binding.Container
SetPolarEnv(self, value, rmax=None)
Sets/resets polar environment.
Parameters:
   value: if non-zero sets polar environment on.
   rmax: if value non-zero, indicates the maximum radius for the plotting.
         If None, set to the biggest value displayed
SetSize(self, width, height) from PyDVT.GUIBinding.Binding.Container
SetSource(self, source=()) from PyDVT.View.View
SetStyle(self, style)
Sets style for plotting
Parameters:
  style: "Line", "Points", "PointsLine" or "Bars"
SetSymbol(self, name, symbol)
Sets symbol for a source plotting
Parameters:
  name: name of the source function
  pen: Pen object
SetXAxis(self, x_axis=None)
Fixes the range of x axis.
Parameters:
  x_Axis: tuple (min_value,maxvalue)
          If x_Axis==None (default) range definition is automatic.
SetXScaleLinear(self)
Sets linear scale for x axis (default)
SetXScaleLog(self, minval=1)
Sets log scale for x axis
Parameters:
   minvalue: all values less than or equals to 0 are set to it
SetY2Axis(self, y2_axis=None)
Fixes the range of y2 axis.
Parameters:
  y2_Axis: tuple (min_value,maxvalue)
          If y2_Axis==None (default) range definition is automatic.
SetYAxis(self, y_axis=None)
Fixes the range of y axis.
Parameters:
  y_Axis: tuple (min_value,maxvalue)
          If y_Axis==None (default) range definition is automatic.
SetYScaleLinear(self)
Sets linear scale for y axis (default)
SetYScaleLog(self, minval=9.9999999999999995e-07)
Sets log scale for y axis
Parameters:
   minvalue: all values less than or equals to 0 are set to it
SetZoom(self, (x0, y0), (x1, y1))
Sets zoom to given plotting coordinates.
Parameters:
    (x0,y0): Upper-left coords
    (x1,y1): Lower-right coords
SetZoomStyle(self, pen=<PyDVT.GUIBinding.Binding.Pen instance>, brush=<PyDVT.GUIBinding.Binding.Brush instance>)
Changes pen and brush of the zoom GraphViewSelect object.
Show(self) from PyDVT.GUIBinding.Binding.Container
Update(self) from PyDVT.View.View
ViewCoord2DataCoord(self, coord)
Virtual: See View.ViewCoord2DataCoord
ZoomTo(self)
Creates GraphViewSelect object to get a zoom by the user through mouse interface.
_ButtonPress(self, event) from PyDVT.View.View
_ButtonPressMotion(self, event) from PyDVT.View.View
_ButtonRelease(self, event) from PyDVT.View.View
_CmdLockPosition(self) from PyDVT.View.View
_CmdOnLine(self) from PyDVT.View.View
_DataChanged(self, source=None) from PyDVT.View.View
_DataDeleted(self, source=None) from PyDVT.View.View
_DoubleClick(self, event) from PyDVT.View.View
_DrawAxis(self, sels)
_EventZoomSelection(self, source)
_KeyPress(self, key, flags=None) from PyDVT.View.View
_Motion(self, event) from PyDVT.View.View
_RightButtonPress(self, event) from PyDVT.View.View
_ToggleLogX(self)
_ToggleLogY(self)
__init__(self, parent=None, pars={}, **kw)
See View.__init__
Parameters:
  parent: Parent window
  pars:   Dictionary with View initialization options
          New options defined by this class (in addiction to base class options):
           "AddStyleSelect": Adds graph style selection in popup menu
                             (line, points, line+points and bars)
                             Default: 0
           "AddCursorSelect": Adds cursor selection in popup menu
                             (crosshairs, vertica and none)
                             Default: 0
           "AddStatus": Adds status bar to the view to display mouse position
                        or function values.
                        Default: 0
           "AutoHideStatus": if "AddCursorSelect" is selected, hides status
                             bar if "None" cursor is sele1cted.
                             Default: 0
           "AddLog": Adds log scale option in popup menu
                     Default: 1
  kw:     keywords to Container initializatregisterion

 
class Hist(HistFilter)
      View's simplified filter for calculate histograms, with direct NumPy interface 
(creates and hides it's own data object)
 
  
DataChanged(self, par) from PyDVT.Filter.Filter
DataCoord2SelectionCoord(self, data_coord) from PyDVT.Filter.Filter
Destroy(self, source=None)
If filter gets out of scope, this should be called to destroy
internally created data object.
GetData(self) from PyDVT.Filter.Filter
GetDataSelection(self) from PyDVT.Filter.Filter
GetInput(self) from PyDVT.Filter.Filter
GetOutput(self) from HistFilter
GetSource(self) from PyDVT.Filter.Filter
Refresh(self) from PyDVT.Filter.Filter
SelectionCoord2DataCoord(self, selection_coord) from PyDVT.Filter.Filter
SetDivisions(self, div) from HistFilter
SetSynchronized(self, synchronized) from PyDVT.Filter.Filter
__init__(self, data=None, yscale=0, pen=<PyDVT.GUIBinding.Binding.Pen instance>, symbol='none', name=None)
Parameters:
    data: NumPy 1d array to be displayed
    yscale: Optional. If yscale==1 the graphic is referenced to right-sided y scale.
    pen: Optional Pen for drawing
    symbols: Optional string meaning the simbol for point representation.
             It can be: 'circle','square','diamond','plus','cross','star','triangle'
                        'none' = no symbols

 
class HistFilter(GraphFilter)
      View's standard filter for histogram calculation
 
  
DataChanged(self, par) from PyDVT.Filter.Filter
DataCoord2SelectionCoord(self, data_coord) from PyDVT.Filter.Filter
Destroy(self, source=None) from PyDVT.Filter.Filter
GetData(self) from PyDVT.Filter.Filter
GetDataSelection(self) from PyDVT.Filter.Filter
GetInput(self) from PyDVT.Filter.Filter
GetOutput(self)
Returns the selection data (dictionary)
Keys: same as GraphFilter
GetSource(self) from PyDVT.Filter.Filter
Refresh(self) from PyDVT.Filter.Filter
SelectionCoord2DataCoord(self, selection_coord) from PyDVT.Filter.Filter
SetDivisions(self, div)
Sets number of divisions for histogram calculation.
Default is 100.
SetSynchronized(self, synchronized) from PyDVT.Filter.Filter
__init__(self, name=None, source=None, synchronized=1, buffer_input=0, yscale=0, pen=<PyDVT.GUIBinding.Binding.Pen instance>, symbol='none')
Parameters:
    name: Optional  name of the function
    source: Source Filter/DataSelection
    synchronized: non-zero if on-line
    buffer_input: see Filter.__init__
    yscale: Optional. If ysacale==1 the graphic is referenced to right-sided y scale.
    pen: Optional Pen for drawing
    symbols: Optional string meaning the simbol for point representation.
             It can be: 'circle','square','diamond','plus','cross','star','triangle'
                        'none' = no symbols

 
class PolarFilter(GraphFilter)
      View's standard filter in polar coordinates.
Assumes receiving polar coords teta in "xdata" and r in "data"
 
  
DataChanged(self, par) from PyDVT.Filter.Filter
DataCoord2SelectionCoord(self, data_coord) from PyDVT.Filter.Filter
Destroy(self, source=None) from PyDVT.Filter.Filter
GetData(self) from PyDVT.Filter.Filter
GetDataSelection(self) from PyDVT.Filter.Filter
GetInput(self) from PyDVT.Filter.Filter
GetOutput(self)
Returns the selection data (dictionary)
Keys: same as GraphFilter
GetSource(self) from PyDVT.Filter.Filter
Refresh(self) from PyDVT.Filter.Filter
SelectionCoord2DataCoord(self, selection_coord) from PyDVT.Filter.Filter
SetSynchronized(self, synchronized) from PyDVT.Filter.Filter
__init__(self, name=None, source=None, synchronized=1, buffer_input=0, pen=<PyDVT.GUIBinding.Binding.Pen instance>, symbol='none')
Parameters:
    name: Optional  name of the function
    source: Source Filter/DataSelection
    synchronized: non-zero if on-line
    buffer_input: see Filter.__init__
    pen: Optional Pen for drawing
    symbols: Optional string meaning the simbol for point representation.
             It can be: 'circle','square','diamond','plus','cross','star','triangle'
                        'none' = no symbols

 
class PolarGraph(Graph)
      View's simplified filter for direct NumPy interface in polar coordinates.
(creates and hides it's own data object)
 
  
DataChanged(self, par) from PyDVT.Filter.Filter
DataCoord2SelectionCoord(self, data_coord) from PyDVT.Filter.Filter
Destroy(self, source=None) from Graph
GetData(self) from PyDVT.Filter.Filter
GetDataSelection(self) from PyDVT.Filter.Filter
GetInput(self) from PyDVT.Filter.Filter
GetOutput(self) from GraphFilter
GetSource(self) from PyDVT.Filter.Filter
Refresh(self) from PyDVT.Filter.Filter
SelectionCoord2DataCoord(self, selection_coord) from PyDVT.Filter.Filter
SetSynchronized(self, synchronized) from PyDVT.Filter.Filter
__init__(self, rdata, tdata, pen=<PyDVT.GUIBinding.Binding.Pen instance>, symbol='none', name=None)
Parameters:
    rdata: NumPy 1d array - R coords
    tdata: NumPy 1d array - Teta coords
    pen: Optional Pen for drawing
    symbols: Optional string meaning the simbol for point representation.
             It can be: 'circle','square','diamond','plus','cross','star','triangle'
                        'none' = no symbols

 
Author
             Alexandre Gobbo (gobbo@esrf.fr)