from ..plugin.curve import CurveArgument
from ..plugin.playlist import FilterCommand
from ..plugin.vclamp import scale
+from ..util.fit import PoorFit
from ..util.peak import find_peaks, find_peaks_arguments, Peak, _kwargs
if c.name=='convolution peaks'][0]
conv_command.run(hooke, inq, outq, **params)
peaks = outq.get()
+ if isinstance(peaks, UncaughtException) \
+ and isinstance(peaks.exception, PoorFit):
+ return False
if not (isinstance(peaks, list) and (len(peaks) == 0
or isinstance(peaks[0], Peak))):
raise Failure('Expected a list of Peaks, not %s' % peaks)
from numpy import diff
from scipy.signal.signaltools import medfilt
-from ..command import Command, Argument, Success, Failure
+from ..command import Command, Argument, Success, Failure, UncaughtException
from ..config import Setting
from ..experiment import VelocityClamp
from ..plugin import Plugin, argument_to_setting
from ..plugin.curve import CurveArgument
from ..plugin.playlist import FilterCommand
from ..plugin.vclamp import scale
+from ..util.fit import PoorFit
from ..util.peak import find_peaks, find_peaks_arguments, Peak, _kwargs
if c.name=='flat filter peaks'][0]
filt_command.run(hooke, inq, outq, **params)
peaks = outq.get()
+ if isinstance(peaks, UncaughtException) \
+ and isinstance(peaks.exception, PoorFit):
+ return False
if not (isinstance(peaks, list) and (len(peaks) == 0
or isinstance(peaks[0], Peak))):
raise Failure('Expected a list of Peaks, not %s' % peaks)
inqueue = None
outqueue = NullQueue()
for i,block in enumerate(curve.data):
+ numpy.savetxt(open('curve.dat', 'w'), block, delimiter='\t')
params = {'curve':curve, 'block':i}
- contact._run(hooke, inqueue, outqueue, params)
+ try:
+ contact._run(hooke, inqueue, outqueue, params)
+ except PoorFit, e:
+ raise PoorFit('Could not fit %s %s: %s'
+ % (curve.path, i, str(e)))
force._run(hooke, inqueue, outqueue, params)
return curve
if abs(params[3]*10) > abs(params[1]) :
raise PoorFit('Slope in non-contact region, or no slope in contact')
if params[2] < self.info['min position']+0.02*self.info['position range']:
- raise poorFit(
+ raise PoorFit(
'No kink (kink %g less than %g, need more space to left)'
% (params[2],
self.info['min position']+0.02*self.info['position range']))