-#!/usr/bin/env python\r
-\r
-'''\r
-SHOW CONVOLUTED CURVE PLUGIN FOR HOOKE\r
-\r
-This plugin contains a plotmanipulator to show the convoluted curve.\r
-(c) Dr. Rolf Schmidt, 2009\r
-'''\r
-\r
-import libpeakspot\r
-\r
-class showconvolutedCommands:\r
-\r
- #def _plug_init(self):\r
- #pass\r
-\r
- def plotmanip_showconvoluted(self, plot, curve):\r
- '''\r
- BEGIN: taken from procplots.py\r
- might need some tweaking\r
- '''\r
- #use only for force spectroscopy experiments!\r
- if curve.driver.experiment != 'smfs':\r
- return plot\r
-\r
- '''\r
- END: taken from procplots.py\r
- '''\r
-\r
- #need to convert the string that contains the list into a list\r
- #convolution = eval(self.config['convfilt']['convolution']['value'])\r
- convolution = eval(self.GetStringFromConfig('flatfilts', 'convfilt', 'convolution'))\r
-\r
- xRet = plot.vectors[1][0]\r
- yRet = plot.vectors[1][1]\r
- convoluted = libpeakspot.conv_dx(yRet, convolution)\r
- #convoluted=libpeakspot.conv_dx(yRet, [-20, -10, -6, 0, 12, 12, 12])\r
- plot.add_set(xRet, convoluted)\r
- #plot.vectors[1][1]=[i for i in convoluted]\r
- #set contact point plot style to 'plot'\r
- #and the color to red\r
- plot.styles.append('plot')\r
- plot.colors.append('black')\r
- #peak_location, peak_size = self.has_peaks(plot, blindwindow, convolution, minpeaks)\r
- peak_locations, peak_sizes = self.has_peaks(plot, curve)\r
-\r
- if peak_locations:\r
- peak_locations_x = []\r
- peak_locations_y = []\r
- for location in peak_locations:\r
- peak_locations_x.append(xRet[location])\r
- peak_locations_y.append(yRet[location])\r
- plot.add_set(peak_locations_x, peak_locations_y)\r
- plot.styles.append('scatter')\r
- plot.colors.append('green')\r
- plot.add_set(peak_locations_x, peak_sizes)\r
- plot.styles.append('scatter')\r
- plot.colors.append('magenta')\r
-\r
- #Return the plot object.\r
- return plot\r
+# Copyright (C) 2009-2012 Rolf Schmidt <rschmidt@alcor.concordia.ca>
+# W. Trevor King <wking@tremily.us>
+#
+# This file is part of Hooke.
+#
+# Hooke is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# Hooke is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Hooke. If not, see <http://www.gnu.org/licenses/>.
+
+"""This plugin contains a plotmanipulator to show the convoluted curve.
+"""
+
+import libpeakspot
+
+class showconvolutedCommands:
+
+ #def _plug_init(self):
+ #pass
+
+ def plotmanip_showconvoluted(self, plot, curve):
+ '''
+ BEGIN: taken from procplots.py
+ might need some tweaking
+ '''
+ #use only for force spectroscopy experiments!
+ if curve.driver.experiment != 'smfs':
+ return plot
+
+ '''
+ END: taken from procplots.py
+ '''
+
+ #need to convert the string that contains the list into a list
+ #convolution = eval(self.config['convfilt']['convolution']['value'])
+ convolution = eval(self.GetStringFromConfig('flatfilts', 'convfilt', 'convolution'))
+
+ xRet = plot.vectors[1][0]
+ yRet = plot.vectors[1][1]
+ convoluted = libpeakspot.conv_dx(yRet, convolution)
+ #convoluted=libpeakspot.conv_dx(yRet, [-20, -10, -6, 0, 12, 12, 12])
+ plot.add_set(xRet, convoluted)
+ #plot.vectors[1][1]=[i for i in convoluted]
+ #set contact point plot style to 'plot'
+ #and the color to red
+ plot.styles.append('plot')
+ plot.colors.append('black')
+ #peak_location, peak_size = self.has_peaks(plot, blindwindow, convolution, minpeaks)
+ peak_locations, peak_sizes = self.has_peaks(plot, curve)
+
+ if peak_locations:
+ peak_locations_x = []
+ peak_locations_y = []
+ for location in peak_locations:
+ peak_locations_x.append(xRet[location])
+ peak_locations_y.append(yRet[location])
+ plot.add_set(peak_locations_x, peak_locations_y)
+ plot.styles.append('scatter')
+ plot.colors.append('green')
+ plot.add_set(peak_locations_x, peak_sizes)
+ plot.styles.append('scatter')
+ plot.colors.append('magenta')
+
+ #Return the plot object.
+ return plot