Convert from DOS to UNIX line endings.
[hooke.git] / hooke / plugin / showconvoluted.py
1 #!/usr/bin/env python
2
3 '''
4 SHOW CONVOLUTED CURVE PLUGIN FOR HOOKE
5
6 This plugin contains a plotmanipulator to show the convoluted curve.
7 (c) Dr. Rolf Schmidt, 2009
8 '''
9
10 import libpeakspot
11
12 class showconvolutedCommands:
13
14     #def _plug_init(self):
15         #pass
16
17     def plotmanip_showconvoluted(self, plot, curve):
18         '''
19         BEGIN: taken from procplots.py
20         might need some tweaking
21         '''
22         #use only for force spectroscopy experiments!
23         if curve.driver.experiment != 'smfs':
24             return plot
25
26         '''
27         END: taken from procplots.py
28         '''
29
30         #need to convert the string that contains the list into a list
31         #convolution = eval(self.config['convfilt']['convolution']['value'])
32         convolution = eval(self.GetStringFromConfig('flatfilts', 'convfilt', 'convolution'))
33
34         xRet = plot.vectors[1][0]
35         yRet = plot.vectors[1][1]
36         convoluted = libpeakspot.conv_dx(yRet, convolution)
37         #convoluted=libpeakspot.conv_dx(yRet, [-20, -10, -6, 0, 12, 12, 12])
38         plot.add_set(xRet, convoluted)
39         #plot.vectors[1][1]=[i for i in convoluted]
40         #set contact point plot style to 'plot'
41         #and the color to red
42         plot.styles.append('plot')
43         plot.colors.append('black')
44         #peak_location, peak_size = self.has_peaks(plot, blindwindow, convolution, minpeaks)
45         peak_locations, peak_sizes = self.has_peaks(plot, curve)
46
47         if peak_locations:
48             peak_locations_x = []
49             peak_locations_y = []
50             for location in peak_locations:
51                 peak_locations_x.append(xRet[location])
52                 peak_locations_y.append(yRet[location])
53             plot.add_set(peak_locations_x, peak_locations_y)
54             plot.styles.append('scatter')
55             plot.colors.append('green')
56             plot.add_set(peak_locations_x, peak_sizes)
57             plot.styles.append('scatter')
58             plot.colors.append('magenta')
59
60         #Return the plot object.
61         return plot