Cat
Functions
TestSPI Namespace Reference

Functions

def Edit (cat, obj, panel, path)
 
def createPlots (cat, obj, run)
 
def updatePlots (figs, obj)
 
def Plot (cat, obj, parent, id)
 

Function Documentation

◆ createPlots()

def TestSPI.createPlots (   cat,
  obj,
  run 
)

Definition at line 45 of file TestSPI.py.

45 def createPlots(cat, obj, run):
46  fig = plt.figure(figsize=(10,10))
47  fig.suptitle("Run "+str(run), fontsize=14, fontweight='bold')
48  for vplot in [1,2]:
49  ax = fig.add_subplot(2,1,vplot)
50  fig.show()
51  return [fig]
52 
def createPlots(cat, obj, run)
Definition: TestSPI.py:45

◆ Edit()

def TestSPI.Edit (   cat,
  obj,
  panel,
  path 
)

Definition at line 40 of file TestSPI.py.

40 def Edit (cat, obj, panel, path):
41  return TestSPI(cat, obj, panel, path)
42 
43 #----------------------------------------------------------------------
44 
def Edit(cat, obj, panel, path)
Definition: TestSPI.py:40

◆ Plot()

def TestSPI.Plot (   cat,
  obj,
  parent,
  id 
)

Definition at line 89 of file TestSPI.py.

References plotter.h1d(), Object.name(), and Object.title().

89 def Plot(cat, obj, parent, id):
90  from mpl_toolkits.mplot3d import Axes3D
91  from matplotlib import cm
92  import matplotlib as mpl
93  import matplotlib.pyplot as plt
94  import numpy as np
95 
96  plot=plotter(parent,id)
97  fig=plot.current()
98  fig.suptitle('TestSuite - Plot capabilities', fontsize=14, fontweight='bold')
99 
100  # plot of data set 0
101  p1=fig.add_subplot(2,3,1)
102  p1.plot(obj.data(0), 'bo', obj.data().vector(1),'k')
103  p1.set_title(r'$\sigma_0='+str(obj.sigma(0))+'$')
104 
105  # plot of data set 1
106  p2=fig.add_subplot(2,3,2)
107  p2.plot(obj.data(1), 'r--')
108  p2.set_title(r'$\sigma_1='+str(obj.sigma(1))+'$')
109 
110  # plot of data set 0 (histogram)
111  plt.subplot(2,3,3)
112  n, bins, h=plt.hist(obj.data().vector(0), 10)
113  plt.title(obj.data().title(0))
114  plt.grid(True)
115 
116  # plot of data set 1 (histogram)
117  plt.subplot(2,3,4)
118  plt.hist(obj.data().vector(1), 20)
119  plt.title(obj.data().name(1)+" : "+obj.data().title(1))
120  plt.grid(True)
121 
122  # plot histo root
123  p5=fig.add_subplot(2,3,5)
124  h1=h1d(p5, obj.hist1d(0), facecolor='red',linestyle='dashed')
125  p5.grid(True)
126 
def Plot(cat, obj, parent, id)
Definition: TestSPI.py:89
def h1d(fig, histo, alpha=0.5, facecolor='green', edgecolor='yellow', linestyle='dashed')
Definition: plotter.py:51

◆ updatePlots()

def TestSPI.updatePlots (   figs,
  obj 
)

Definition at line 53 of file TestSPI.py.

53 def updatePlots(figs, obj):
54  fig = figs[0]
55  ax1 = fig.add_subplot(2,1,1)
56  lines, = ax1.plot([],[], 'bo')
57  #Autoscale on unknown axis and known lims on the other
58  ax1.set_autoscaley_on(True)
59 # ax.set_xlim(self.min_x, self.max_x)
60  #Other stuff
61  ax1.grid()
62  lines.set_xdata(obj.data(0))
63  lines.set_ydata(obj.data(1))
64  #Need both of these in order to rescale
65  ax1.relim()
66  ax1.autoscale_view()
67 
68  ax2 = fig.add_subplot(2,1,2)
69  lines, = ax2.plot([],[], 'bo')
70  #Autoscale on unknown axis and known lims on the other
71  ax2.set_autoscaley_on(True)
72 # ax.set_xlim(self.min_x, self.max_x)
73  #Other stuff
74  ax2.grid()
75  lines.set_xdata(obj.data(2))
76  lines.set_ydata(obj.data(3))
77  #Need both of these in order to rescale
78  ax2.relim()
79  ax2.autoscale_view()
80 
81  #We need to draw *and* flush
82  fig.canvas.draw()
83  fig.canvas.flush_events()
84  fig.show()
85  return fig
86 
87 #----------------------------------------------------------------------
88 
def updatePlots(figs, obj)
Definition: TestSPI.py:53