Ran update_copyright.py
[hooke.git] / hooke / plugin / vclamp.py
index 0dfaeab2bdd08dec77df256666a65a271381dad7..fcf49e8598c9c7a0cb1793716ae607bf5d132881 100644 (file)
@@ -6,15 +6,15 @@
 #
 # 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
@@ -46,8 +46,13 @@ def scale(hooke, curve):
     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
 
@@ -175,7 +180,7 @@ class SurfacePositionModel (ModelFitter):
         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']))