Author: bugman Date: Tue Feb 4 15:43:10 2014 New Revision: 22116 URL: http://svn.gna.org/viewcvs/relax?rev=22116&view=rev Log: Improvements for the steady-state NOE analysis overfit_deselect() method. The spin deselection which occurs at the start of the calc user function call, used to calculate the NOE, is now clearer. Each deselection condition is now explained in detail and the text is now far more informative. In addition, the special condition of all spins being deselected is now caught. If this happens, a RelaxError is raised to prevent the user from going forwards. This should remove confusion as to why the output file is empty. Modified: trunk/specific_analyses/noe/main.py Modified: trunk/specific_analyses/noe/main.py URL: http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/noe/main.py?rev=22116&r1=22115&r2=22116&view=diff ============================================================================== --- trunk/specific_analyses/noe/main.py (original) +++ trunk/specific_analyses/noe/main.py Tue Feb 4 15:43:10 2014 @@ -170,28 +170,50 @@ # Loop over spin data. deselect_flag = False + all_desel = True for spin, spin_id in spin_loop(return_id=True): # Skip deselected spins. if not spin.select: continue + # No intensity data. + if not hasattr(spin, 'intensities'): + warn(RelaxDeselectWarning(spin_id, 'the absence of intensity data')) + spin.select = False + deselect_flag = True + continue + # Check for sufficient data. - if not hasattr(spin, 'intensities') or not len(spin.intensities)
2:
- warn(RelaxDeselectWarning(spin_id, 'insufficient data')) + if not len(spin.intensities) > 2: + warn(RelaxDeselectWarning(spin_id, 'insufficient data (less than two data points)')) + spin.select = False + deselect_flag = True + continue + + # No error data. + if not hasattr(spin, 'intensity_err'): + warn(RelaxDeselectWarning(spin_id, 'the absence of errors')) spin.select = False deselect_flag = True continue # Check for sufficient errors. - elif not hasattr(spin, 'intensity_err') or not len(spin.intensity_err) > 2: - warn(RelaxDeselectWarning(spin_id, 'missing errors')) - spin.select = False - deselect_flag = True - continue + if not len(spin.intensity_err) > 2: + warn(RelaxDeselectWarning(spin_id, 'missing errors (less than two error points)')) + spin.select = False + deselect_flag = True + continue + + # Not all spins have been deselected. + all_desel = False # Final printout. if verbose and not deselect_flag: print("No spins have been deselected.") + + # Catch complete failures - i.e. no spins are selected. + if all_desel: + raise RelaxError("All spins have been deselected.") return_data_name_doc = Desc_container("NOE calculation data type string matching patterns")