Cat
CurrentMeasurement.py
Go to the documentation of this file.
1 import wx
2 from proc import *
3 from plotter import *
4 from libCatKernel import *
5 import matplotlib as mpl
6 import matplotlib.patches as patches
7 from matplotlib.path import Path
8 import matplotlib.pyplot as plt
9 import numpy as np
10 
12  def __init__(self, cat, obj, panel, path):
13  proc.__init__(self,cat,obj,panel,path)
14  self.loadxrc()
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  self.panel.Bind(wx.EVT_BUTTON, self.onApply, id=xrc.XRCID("Apply"))
21 
22  def onApply(self, event):
23  v1 = float(self.s1.GetValue())
24  v2 = float(self.s2.GetValue())
25  v3 = float(self.s3.GetValue())
26  v4 = float(self.s4.GetValue())
27  self.obj.setSigma(v1,v2,v3,v4)
28 
29  def update(self):
30  v1=self.obj.sigma(0)
31  v2=self.obj.sigma(1)
32  v3=self.obj.sigma(2)
33  v4=self.obj.sigma(3)
34 
35  self.s1.SetValue(str(v1))
36  self.s2.SetValue(str(v2))
37  self.s3.SetValue(str(v3))
38  self.s4.SetValue(str(v4))
39 
40 #----------------------------------------------------------------------
41 
42 def Edit (cat, obj, panel, path):
43  return CurrentMeasurement(cat, obj, panel, path)
44 
45 #----------------------------------------------------------------------
46 
47 def createPlot(cat, obj, run):
48  fig = plt.figure(figsize=(10,10))
49  fig.suptitle("Run "+str(run), fontsize=14, fontweight='bold')
50  ndevices = obj.element().numberOfDevices()
51  c=['r','b','g','c']
52  for i in range(ndevices):
53  for ch in range(4):
54  ax = fig.add_subplot(4,ndevices,ndevices*ch+1+i)
55  lines, = ax.plot([],[], color = c[ch], marker='^')
56  if ch==0: plt.title("Dev "+str(i+1))
57  if i==0: plt.ylabel("voltage (V)")
58  if ch==3: plt.xlabel("time (s)")
59  ax.set_autoscaley_on(False)
60  ax.set_ylim(0.,0.25)
61  ax.grid()
62  fig.show()
63  return fig
64 
65 def updatePlot(fig, obj):
66  ndevices = obj.element().numberOfDevices()
67  c=['r','b','g','c']
68  for i in range(ndevices):
69  for ch in range(4):
70  ax = fig.add_subplot(4,ndevices,ndevices*ch+1+i)
71  lines, = ax.plot([],[], color = c[ch], marker='^')
72  lines.set_xdata(obj.data(0+5*i))
73  lines.set_ydata(obj.data(ch+1+5*i))
74  ax.relim()
75  ax.autoscale_view()
76  ax.set_ylim(bottom=0.)
77 
78  fig.canvas.draw()
79  fig.canvas.flush_events()
80 
81 #----------------------------------------------------------------------
def updatePlot(fig, obj)
def __init__(self, cat, obj, panel, path)
def createPlot(cat, obj, run)
Definition: proc.py:1
def Edit(cat, obj, panel, path)