Viewing curves in real time

VizWin can plot VectorDataCurve objects. They contain two vectors (abscissa, ordinate). These vectors can be obtained from curves extracted during the simulation, be can also be read on disk, allowing for example the comparison of an experimental curve to the modeled one during the computation.

To view several VectorDataCurve on only one window, a set of VectorDataCurve (named DataCurveSet) must be created.

Example: assume that the result curves #1, #2 and #3 are defined in the ValuesManager. To view the graphical curves

The 2 vectors VectorDataCurve to view are defined with:

vlm = metafor.getValuesManager()
cur1 = VectorDataCurve(1, vlm.getDataVector(1), vlm.getDataVector(2),'curveName')
cur2 = VectorDataCurve(2, vlm.getDataVector(1), vlm.getDataVector(3),vlm.getDataVector(3).getName())

These two VectorDataCurve are stored in a DataCurveSet to view then together a a single window:

dataCurveSet1 = DataCurveSet()
dataCurveSet1.add(cur1) 
dataCurveSet1.add(cur2)

Finally, this DataCurveSet is added to a VizWin window 1):

try:
    winc1 = VizWin()
    winc1.add(dataCurveSet1)
    metafor.addObserver(winc1)
except NameError:
    pass 

If one or both vector are part of a multiple extractor, the index of the curve in the extractor can be defined idxI = [0, vlm.getDataVector(i).size()[ :

cur1 = VectorDataCurve(1, vlm.getDataVector(1), idx1, vlm.getDataVector(2),       'curveName')
cur1 = VectorDataCurve(1, vlm.getDataVector(1),       vlm.getDataVector(2), idx2, 'curveName')
cur1 = VectorDataCurve(1, vlm.getDataVector(1), idx1, vlm.getDataVector(2), idx2, 'curveName')

Example:

the following example is found in apps/imp/profilage.py

Exemple d'affichage de courbes dans VizWin Panneau de config de la visualisation des courbes

1)
the viewing commands are put between try and except to handle automatically the case when Metafor was not compiled with the viewing tool and does not possess VizWin