Up | Draw | Overlay | Tool | Toollist | Timer | SPB | Camera | CameraImage | Bitmap | Historylist - ImageBuffer | Clipboard | ScorpionGeometry | Statistics | Curve | States | Logging | Panels | Shared Memory | BarCode Reader | StdCtrls

Release Notes
 

  

 
Curve
The Curve Module

The Curve Module contains controls and dialogs with Scorpion curve objects. A CurveView control is a visual object which may contain and view CurveData for one or more parameters.

The CurveDialog

The CurveDialog(name) creates a dialog with a embedded CurveView.

Note: the dialog objects lifetime returned by CurveDialog(name) is controlled by the Python Garbage Collector. If dialog is to be shown modeless, the object must be hold by another object or located at the global scope (ie, created in Central Start)

Attribute Access Type Description
curve R Curve the curve visual object
view R CurveView the GUI view


Methods Return Description
show(modal=0) bool show dialog either modeless or modal
hide() bool hide dialog if visible


The CurveData class

CurveData is a data container of either single value arrays or (x,y) point arrays.

Attribute Access Type Description
name R string name of object
caption R/W string caption shown in view - defaults to name
lineColor R/W string color of line in view
lineWidth R/W int width of line in view
autoY R/W bool auto y axis scaling
curveType R/W int trend:0, XYplot:1, YXPlot:2, History:3
percentile R/W int percentile if history curve
size R int number of items in data
count R int total number of items in data
last
min
max
mean
stddev
variance
totalVariance
R float statistics for current data
y
xy
history
R float/xy the curve data due to curveType


Methods Return Description
addData(value) int add data to curve - returns number if items added

Data may be

  * single float/integer
  * single point (x,y) Note: only when in plot mode, CurveMode = 1 or 2
  * array of floats/integers
  * array of (x,y)
reset() bool reset curvedata


The Curve class

Curve is the main curve of the view, a derived class of CurveData. In addition to properties and methods of CurveData, it has setup of the viewer class.

Attribute Access Type Description
parameter R string name of maincurve in a CurveView
title R/W string curve title
showTitle R/W bool show or hide title
paramInTitle R/W bool show or hide parameter name in addition to title
historyLength R/W int history length along x-axis - applies to trend/history mode only
minX / maxX R/W float x-axis range - applies to plot mode only
minY / maxY R/W float y-axis range
stairs R/W bool show line in stairs mode
scatter R/W bool scatter / line mode
legend R/W bool show/hide legend
notifyAlarms R/W bool  
manualUpdate R/W bool manual update of curve GUI - for high speed systems
       
nominalValue
lowAlarmLimit
highAlarmLimit
lowWarningLimit
highWarningLimit
R/W float alarm limits - applies to Scorpion mainform Curves only
curves R tuple all curves in Curve object
config R/W string Curve configuration as SPB xml string


Methods Return Description
addCurve(name,color=<default>, lineWidth=<default>) CurveData add a new CurveData object to Curve
getCurve(name) CurveData get named CurveData
deleteCurve(name) bool delete named CurveData
deleteCurves() bool delete all curves
reset() bool reset all CurveData objects


The TrendView class

The curve viewer GUI class. A TrendView may hold multiple curves. The TrendView consist of the curve selection list on top, a statusbar with the maincurve's statistics in bottom, and the chart object in the middle.

Attribute Access Type Description
enableSetup R/W bool enables selected curve's configuration dialog
manualUpdate R/W bool manual update of curve GUI - for high speed systems
showCaption R/W bool visibility of the caption panel on top, normally hidden
curves R tuple all curves in Curve object
showStatusbar R/W bool statusbar visibility
largeIcons R/W bool toggles curve icon size in the curve selector list
caption R Panel the caption panel
backColor R/W string The chart backgroud
count R int number of curves in view
selCurve R/W Curve/string the current selected curve. Returns curve object, set by name (string)
curves R list list of curve names in view
config R/W string Curve configuration as SPB xml string

Methods Return Description
addCurve(name,color=<default>, lineWidth=<default>) Curve add a new curve to view
getCurve(name) Curve get named curve
deleteCurve(name) bool delete named curve
deleteCurves() bool delete all curves
reset() bool reset all curves objects


The CurveView class

A TrendView derived class for single Curve objects.

Attribute Access Type Description
curve R Curve the main curve (equals TrendView.selCurve)
parameter R/W string the main curve name


Script Examples:

Example 1. Create a curve dialog in a BaseTool and show some info in execute

def init(self):
  """
  initiate curve dialog
  """
  self.dlg=CurveDialog('Intensity')
  self.dlg.curve.title='Image Intensity along vertical center'
  self.dlg.curve.paramInTitle=False
  self.dlg.curve.maxY=260

def execute(self,image):
  """
  calculate intensity along vertical centerline and curve it
  """
  dx,dy=image.dim()
  pix=[]
  for x in range(dx-1):
    pix.append(image[x*dy+dy/2])
  self.dlg.curve.historyLength=len(pix)+10
  self.dlg.curve.addData(pix)
  if self.hedit and not self.dlg.visible:self.dlg.show()
  elif not self.hedit and self.dlg.visible:self.dlg.hide()
  return 1

 

Scorpion Vision Version XV  : Build 764 - Date: 20200529
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2020 Tordivel AS.