Updated copyright blurbs in all files to '# Copyright'
[hooke.git] / hooke / plugin / generaltccd.py
1 # Copyright
2
3 """General utilities for TCCD stuff
4 """
5
6 class generaltccdCommands(object):
7
8     def plotmanip_threshold(self, plot, current, customvalue=False):
9         '''
10         Cuts from the plot everything below the threshold.
11         Set the threshold with "set tccd_threshold"
12         '''
13
14         if current.curve.experiment != 'smfluo':
15             return plot
16
17         if not self.config['tccd_threshold'] and (not customvalue):
18             return plot
19
20         if customvalue:
21             thresh=customvalue
22         else:
23             thresh=self.config['tccd_threshold']
24
25         for set in plot.vectors:
26             newy=[]
27             for value in set[1]:
28                 if abs(value) < thresh:
29                     newy.append(0)
30                 else:
31                     newy.append(value)
32
33             set[1]=newy
34
35         return plot
36
37
38     def plotmanip_coincident(self,plot,current, customvalue=False):
39         '''
40         Shows only coincident events
41         '''
42         if current.curve.experiment != 'smfluo':
43             return plot
44
45         if not self.config['tccd_coincident'] and (not customvalue):
46             return plot
47
48         newred=[]
49         newblue=[]
50         for index in range(len(plot.vectors[0][1])):
51             if abs(plot.vectors[0][1][index])>self.config['tccd_threshold'] and abs(plot.vectors[1][1][index])>self.config['tccd_threshold']:
52                 newred.append(plot.vectors[0][1][index])
53                 newblue.append(plot.vectors[1][1][index])
54             else:
55                 newred.append(0)
56                 newblue.append(0)
57
58         plot.vectors[0][1]=newred
59         plot.vectors[1][1]=newblue
60
61         return plot