1 # Copyright (C) 2009-2012 Rolf Schmidt <rschmidt@alcor.concordia.ca>
2 # W. Trevor King <wking@drexel.edu>
4 # This file is part of Hooke.
6 # Hooke is free software: you can redistribute it and/or modify it under the
7 # terms of the GNU Lesser General Public License as published by the Free
8 # Software Foundation, either version 3 of the License, or (at your option) any
11 # Hooke is distributed in the hope that it will be useful, but WITHOUT ANY
12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
16 # You should have received a copy of the GNU Lesser General Public License
17 # along with Hooke. If not, see <http://www.gnu.org/licenses/>.
19 """This plugin contains a plotmanipulator to show the convoluted curve.
24 class showconvolutedCommands:
26 #def _plug_init(self):
29 def plotmanip_showconvoluted(self, plot, curve):
31 BEGIN: taken from procplots.py
32 might need some tweaking
34 #use only for force spectroscopy experiments!
35 if curve.driver.experiment != 'smfs':
39 END: taken from procplots.py
42 #need to convert the string that contains the list into a list
43 #convolution = eval(self.config['convfilt']['convolution']['value'])
44 convolution = eval(self.GetStringFromConfig('flatfilts', 'convfilt', 'convolution'))
46 xRet = plot.vectors[1][0]
47 yRet = plot.vectors[1][1]
48 convoluted = libpeakspot.conv_dx(yRet, convolution)
49 #convoluted=libpeakspot.conv_dx(yRet, [-20, -10, -6, 0, 12, 12, 12])
50 plot.add_set(xRet, convoluted)
51 #plot.vectors[1][1]=[i for i in convoluted]
52 #set contact point plot style to 'plot'
54 plot.styles.append('plot')
55 plot.colors.append('black')
56 #peak_location, peak_size = self.has_peaks(plot, blindwindow, convolution, minpeaks)
57 peak_locations, peak_sizes = self.has_peaks(plot, curve)
62 for location in peak_locations:
63 peak_locations_x.append(xRet[location])
64 peak_locations_y.append(yRet[location])
65 plot.add_set(peak_locations_x, peak_locations_y)
66 plot.styles.append('scatter')
67 plot.colors.append('green')
68 plot.add_set(peak_locations_x, peak_sizes)
69 plot.styles.append('scatter')
70 plot.colors.append('magenta')
72 #Return the plot object.