X-Git-Url: http://git.tremily.us/?p=hooke.git;a=blobdiff_plain;f=hooke%2Fplugin%2Fcurve.py;h=6c13c6c76dfbc44ba187657ca102a4a818e91f23;hp=ded624e2456d242d93df21131504bfe4f050318f;hb=60b12a779acf92ec32ef2d0ed9e5766b11705150;hpb=6a31af632ca1a3393ee365aa3f3bf118de4b776c diff --git a/hooke/plugin/curve.py b/hooke/plugin/curve.py index ded624e..6c13c6c 100644 --- a/hooke/plugin/curve.py +++ b/hooke/plugin/curve.py @@ -1,23 +1,19 @@ -# Copyright (C) 2008-2011 Alberto Gomez-Casado -# Fabrizio Benedetti -# Massimo Sandal -# W. Trevor King +# Copyright (C) 2010-2012 W. Trevor King # # 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 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. +# 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 -# . +# You should have received a copy of the GNU Lesser General Public License +# along with Hooke. If not, see . """The ``curve`` module provides :class:`CurvePlugin` and several associated :class:`hooke.command.Command`\s for handling @@ -28,6 +24,7 @@ import copy import os.path import re +from FFT_tools import unitary_avg_power_spectrum import numpy import yaml @@ -36,7 +33,6 @@ from ..command_stack import CommandStack from ..curve import Data from ..engine import CommandMessage from ..util.calculus import derivative -from ..util.fft import unitary_avg_power_spectrum from ..util.si import ppSI, join_data_label, split_data_label from . import Builtin from .playlist import current_playlist_callback @@ -817,21 +813,22 @@ class OldCruft (object): maxpoint=True if rebase: - print 'Select baseline' + print('Select baseline') self.basepoints=self._measure_N_points(N=2, whatset=whatset) self.basecurrent=self.current.path if maxpoint: - print 'Select two points' + print('Select two points') points=self._measure_N_points(N=2, whatset=whatset) boundpoints=[points[0].index, points[1].index] boundpoints.sort() try: y=min(plot.vectors[whatset][1][boundpoints[0]:boundpoints[1]]) except ValueError: - print 'Chosen interval not valid. Try picking it again. Did you pick the same point as begin and end of interval?' + print('Chosen interval not valid. Try picking it again. Did ' + 'you pick the same point as begin and end of interval?') else: - print 'Select point to measure' + print('Select point to measure') points=self._measure_N_points(N=1, whatset=whatset) #whatplot=points[0].dest y=points[0].graph_coords[1] @@ -843,7 +840,7 @@ class OldCruft (object): avg=np.mean(to_average) forcebase=abs(y-avg) - print str(forcebase*(10**12))+' pN' + print('{} pN'.format(forcebase * 10**12)) to_dump='forcebase '+self.current.path+' '+str(forcebase*(10**12))+' pN' self.outlet.push(to_dump) @@ -872,17 +869,17 @@ class OldCruft (object): # Decides between the two forms of user input, as per (args) if fitspan == 0: # Gets the Xs of two clicked points as indexes on the current curve vector - print 'Click twice to delimit chunk' + print('Click twice to delimit chunk') points=self._measure_N_points(N=2,whatset=1) else: - print 'Click once on the leftmost point of the chunk (i.e.usually the peak)' + print('Click once on the leftmost point of the chunk (i.e.usually the peak)') points=self._measure_N_points(N=1,whatset=1) slope=self._slope(points,fitspan) # Outputs the relevant slope parameter - print 'Slope:' - print str(slope) + print('Slope:') + print(str(slope)) to_dump='slope '+self.current.path+' '+str(slope) self.outlet.push(to_dump) @@ -898,12 +895,12 @@ class OldCruft (object): try: parameters=self.linefit_between(clickedpoints[0],clickedpoints[1]) except: - print 'Cannot fit. Did you click twice the same point?' + print('Cannot fit. Did you click twice the same point?') return # Outputs the relevant slope parameter - print 'Slope:' - print str(parameters[0]) + print('Slope:') + print(str(parameters[0])) to_dump='slope '+self.curve.path+' '+str(parameters[0]) self.outlet.push(to_dump)