Cat
StorageFifoAcquisition.py
Go to the documentation of this file.
1 import wx
2 from proc import *
3 from plotter import *
4 from libCatKernel import *
5 from matplotlib.path import Path
6 import matplotlib.patches as patches
7 
9  def __init__(self, cat, obj, panel, path):
10  proc.__init__(self,cat,obj,panel,path)
11  self.loadxrc()
12 
13  self.s1=self.getControl("s1")
14  self.s2=self.getControl("s2")
15  self.s3=self.getControl("s3")
16  self.s4=self.getControl("s4")
17  self.update()
18 
19  self.panel.Bind(wx.EVT_BUTTON, self.onApply, id=xrc.XRCID("Apply"))
20 
21  def onApply(self, event):
22  v1 = float(self.s1.GetValue())
23  v2 = float(self.s2.GetValue())
24  v3 = float(self.s3.GetValue())
25  v4 = float(self.s4.GetValue())
26  self.obj.setSigma(v1,v2,v3,v4)
27 
28  def update(self):
29  v1=self.obj.sigma(0)
30  v2=self.obj.sigma(1)
31  v3=self.obj.sigma(2)
32  v4=self.obj.sigma(3)
33 
34  self.s1.SetValue(str(v1))
35  self.s2.SetValue(str(v2))
36  self.s3.SetValue(str(v3))
37  self.s4.SetValue(str(v4))
38 
39 #----------------------------------------------------------------------
40 
41 def Edit (cat, obj, panel, path):
42  return StorageFifoAcquisition(cat, obj, panel, path)
43 
44 #----------------------------------------------------------------------
45 
46 def Plot(cat, obj, parent, id):
47  from mpl_toolkits.mplot3d import Axes3D
48  import matplotlib.ticker as ticker
49  from matplotlib import cm
50  import matplotlib as mpl
51  import matplotlib.pyplot as plt
52  import numpy as np
53 
54  plot=plotter(parent,id)
55  fig=plot.current()
56 
57  title = 'Acquisition Channel(s) '
58 
59  channels=obj.channels()
60  nch=0
61  for i in range(0,8):
62  if (channels>>i&1):
63  nch+=1
64  title+=' '+str(i)
65 
66  fig.suptitle(title, fontsize=14, fontweight='bold')
67 
68  depth= obj.depth()
69 
70  index=0
71  for c in range(0,nch):
72  for d in range(0,depth):
73  pl=fig.add_subplot(depth+2,nch,c+d*nch+1)
74  h=h1d(pl,obj.hist1d(index), facecolor='red',linestyle='dashed')
75  pl.xaxis.set_ticks([obj.hist1d(index).minX(),(obj.hist1d(index).maxX()-obj.hist1d(index).minX())/2.,obj.hist1d(index).maxX()])
76 # formatter = ticker.FormatStrFormatter('%1.2f')
77 # pl.xaxis.set_major_formatter(formatter)
78  index+=1
79  pl.grid(True)
80  pl=fig.add_subplot(depth+2,nch,c+depth*nch+1)
81  h=h1d(pl,obj.hist1d(index), facecolor='blue',linestyle='dashed')
82  index+=1
83  pl.grid(False)
84  pl=fig.add_subplot(depth+2,nch,c+(depth+1)*nch+1)
85  h=h1d(pl,obj.hist1d(index), facecolor='green',linestyle='dashed')
86  index+=1
87  pl.grid(False)
88 
89  return plot
def Edit(cat, obj, panel, path)
def Plot(cat, obj, parent, id)
def h1d(fig, histo, alpha=0.5, facecolor='green', edgecolor='yellow', linestyle='dashed')
Definition: plotter.py:51
Definition: proc.py:1