mailr17944 - /trunk/specific_fns/model_free/main.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on October 31, 2012 - 16:40:
Author: bugman
Date: Wed Oct 31 16:40:14 2012
New Revision: 17944

URL: http://svn.gna.org/viewcvs/relax?rev=17944&view=rev
Log:
The model-free overfit deselection algorithm now fails with a RelaxError when 
no spins are selected.

This is to avoid situations such as bug #20277 (https://gna.org/bugs/?20277).


Modified:
    trunk/specific_fns/model_free/main.py

Modified: trunk/specific_fns/model_free/main.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_fns/model_free/main.py?rev=17944&r1=17943&r2=17944&view=diff
==============================================================================
--- trunk/specific_fns/model_free/main.py (original)
+++ trunk/specific_fns/model_free/main.py Wed Oct 31 16:40:14 2012
@@ -1950,6 +1950,7 @@
 
         # Loop over the sequence.
         deselect_flag = False
+        spin_count = 0
         for spin, spin_id in spin_loop(return_id=True):
             # Skip deselected spins.
             if not spin.select:
@@ -2025,6 +2026,13 @@
                         spin.select = False
                         deselect_flag = True
                         continue
+
+            # Increment the spin number.
+            spin_count += 1
+
+        # No spins selected, so fail hard to prevent the user from going any 
further.
+        if spin_count == 0:
+            raise RelaxError("No spins are selected, therefore the 
optimisation or calculation cannot proceed.")
 
         # Final printout.
         if verbose and not deselect_flag:




Related Messages


Powered by MHonArc, Updated Wed Oct 31 19:00:02 2012