====== 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 [[courbes_res|result curves]] #1, #2 and #3 are defined in the ''ValuesManager''. To view the graphical curves * ''VectorDataCurve'' #1 : abscissa = curve #1, ordinate = curve #2 * ''VectorDataCurve'' #2 : abscissa = curve #1, ordinate = curve #3 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 ((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'')): 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'' {{doc:user:curves_vizwin.jpg?200|Exemple d'affichage de courbes dans VizWin}} {{doc:user:curves_bwin.jpg?100|Panneau de config de la visualisation des courbes}}