Cat
UsbFTInterfaceTest.py
Go to the documentation of this file.
1 import wx
2 from proc import *
3 from plotter import *
4 
5 from libCatCore import *
6 
7 from matplotlib.path import Path
8 import matplotlib.patches as patches
9 
11  def __init__(self, cat, obj, panel, path):
12  proc.__init__(self,cat,obj,panel,path)
13  self.loadxrc()
14 
15  self.s1=self.getControl("s1")
16  self.s2=self.getControl("s2")
17  self.s3=self.getControl("s3")
18  self.s4=self.getControl("s4")
19  self.update()
20 
21  self.panel.Bind(wx.EVT_BUTTON, self.onApply, id=xrc.XRCID("Apply"))
22 
23  def onApply(self, event):
24  v1 = float(self.s1.GetValue())
25  v2 = float(self.s2.GetValue())
26  v3 = float(self.s3.GetValue())
27  v4 = float(self.s4.GetValue())
28  self.obj.setSigma(v1,v2,v3,v4)
29 
30  def update(self):
31  v1=self.obj.sigma(0)
32  v2=self.obj.sigma(1)
33  v3=self.obj.sigma(2)
34  v4=self.obj.sigma(3)
35 
36  self.s1.SetValue(str(v1))
37  self.s2.SetValue(str(v2))
38  self.s3.SetValue(str(v3))
39  self.s4.SetValue(str(v4))
40 
41 #----------------------------------------------------------------------
42 
43 def Edit (cat, obj, panel, path):
44  return UsbFTInterfaceTest(cat, obj, panel, path)
45 
46 #----------------------------------------------------------------------
47 
48 def Plot(cat, obj, parent, id):
49  from mpl_toolkits.mplot3d import Axes3D
50  from matplotlib import cm
51  import matplotlib as mpl
52  import matplotlib.pyplot as plt
53  import numpy as np
54 
55  plot=plotter(parent,id)
56 
57  fig=plot.current()
58  fig.suptitle('UsbFT Interface - Test Program', fontsize=14, fontweight='bold')
59 
60  p=obj
61 
62  p1=fig.add_subplot(2,2,1)
63  p1.plot(p.data(0), 'bo')
64  p1.set_title(r'$\sigma='+str(p.sigma())+'\ \mu='+str(p.mean())+'$')
65  p1.set_ylabel('Values')
66 
67  plt.subplot(2,2,2)
68  plt.hist(p.data().vector(0), 20)
69  plt.title(p.data().title(0))
70  plt.grid(True)
71 
72  p3=fig.add_subplot(2,2,3)
73  p3.plot(p.data(3), 'bs', p.data(4), 'g^')
74  p3.set_title(r'Time (Write/Read)')
75  p3.set_ylabel('Values')
76 
77  p4=fig.add_subplot(2,2,4)
78  p4.plot(p.data(1), 'k')
79  p4.set_title(r'Errors (Write)')
80  p4.set_ylabel('Values')
81 
82  return plot
std::string title()
Definition: Object.h:31
def Plot(cat, obj, parent, id)
def Edit(cat, obj, panel, path)
def __init__(self, cat, obj, panel, path)
Definition: proc.py:1