(autopeak.py) Repeatedly asks for correct input.
authorfabrizio.benedetti.82 <devnull@localhost>
Wed, 11 Nov 2009 15:08:17 +0000 (15:08 +0000)
committerfabrizio.benedetti.82 <devnull@localhost>
Wed, 11 Nov 2009 15:08:17 +0000 (15:08 +0000)
autopeak.py

index a29cbd73d6547b8c113d4ae6e17136ebafe11caa..ca2b2cca1ca6baaee326363528c6285769f8ee0d 100644 (file)
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 
 from libhooke import WX_GOOD, ClickedPoint
 import wxversion
@@ -321,26 +322,31 @@ class autopeakCommands:
         print 'forces (pN)',forces
         print 'slopes (N/m)',slopes
         
-        #Ask the user what peaks to ignore from analysis.
-        print 'Peaks to ignore (0,1...n from contact point,return to take all)'
-        print 'N to discard measurement'
-        exclude_raw=raw_input('Input:')
-        if exclude_raw=='N':
-            print 'Discarded.'
-            return
-        if not exclude_raw=='':
-            exclude=exclude_raw.split(',')
-            try:
-                exclude=[int(item) for item in exclude]
-                for i in exclude:
-                    c_lengths[i]=None
-                    p_lengths[i]=None
-                    forces[i]=None
-                    slopes[i]=None
-                    sigma_c_lengths[i]=None
-                    sigma_p_lengths[i]=None
-            except:
-                 print 'Bad input, taking all...'
+        controller=False
+        while controller==False:
+         #Ask the user what peaks to ignore from analysis.
+         print 'Peaks to ignore (0,1...n from contact point,return to take all)'
+         print 'N to discard measurement'
+         exclude_raw=raw_input('Input:')
+         if exclude_raw=='N':
+             print 'Discarded.'
+             return
+         if not exclude_raw=='':
+             exclude=exclude_raw.split(',')
+             try:
+                 exclude=[int(item) for item in exclude]
+                 for i in exclude:
+                     c_lengths[i]=None
+                     p_lengths[i]=None
+                     forces[i]=None
+                     slopes[i]=None
+                     sigma_c_lengths[i]=None
+                     sigma_p_lengths[i]=None
+                      controller=True
+             except:
+                 print 'Bad input.'
+                  controller=False
+
         #Clean data vectors from ignored peaks        
         #FIXME:code duplication
         c_lengths=[item for item in c_lengths if item != None]