Author: bugman Date: Tue Apr 2 11:08:27 2013 New Revision: 19289 URL: http://svn.gna.org/viewcvs/relax?rev=19289&view=rev Log: Manually ported r19283 from the 2.2 development line to trunk. The command used was: svn merge -r19283:19284 svn+ssh://bugman@xxxxxxxxxxx/svn/relax/branches/2.2 . ..... r19284 | bugman | 2013-04-02 11:02:34 +0200 (Tue, 02 Apr 2013) | 10 lines Changed paths: M /branches/2.2/specific_analyses/consistency_tests.py Fix for bug #20674 (https://gna.org/bugs/?20674) - the failure of the consistency testing analysis. This was reported by Mengjun Xue <mengjun dott xue att mailbox dott tu-berlin dot de>. The problem was that the first residue did not have a single proton 'H' in the PDB file, and therefore the dipolar relaxation interaction was not set up. The overfit_deselect() method of the consistency testing specific API was not checking for this. The method is now much more like that of the model-free specific analysis. ..... Modified: trunk/specific_analyses/consistency_tests.py Modified: trunk/specific_analyses/consistency_tests.py URL: http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/consistency_tests.py?rev=19289&r1=19288&r2=19289&view=diff ============================================================================== --- trunk/specific_analyses/consistency_tests.py (original) +++ trunk/specific_analyses/consistency_tests.py Tue Apr 2 11:08:27 2013 @@ -308,32 +308,68 @@ # Loop over spin data. deselect_flag = False + spin_count = 0 for spin, spin_id in spin_loop(return_id=True): # Skip deselected spins. if not spin.select: continue - # Check if data exists. - if not hasattr(spin, 'ri_data'): - warn(RelaxDeselectWarning(spin_id, 'missing relaxation data')) + # The interatomic data. + interatoms = return_interatom_list(spin_id) + + # Loop over the interatomic data. + dipole_relax = False + for i in range(len(interatoms)): + # No dipolar relaxation mechanism. + if not interatoms[i].dipole_pair: + continue + + # The surrounding spins. + if spin_id != interatoms[i].spin_id1: + spin_id2 = interatoms[i].spin_id1 + else: + spin_id2 = interatoms[i].spin_id2 + spin2 = return_spin(spin_id2) + + # Dipolar relaxation flag. + dipole_relax = True + + # No relaxation mechanism. + if not dipole_relax or not hasattr(spin, 'csa') or spin.csa == None: + warn(RelaxDeselectWarning(spin_id, 'an absence of relaxation mechanisms')) spin.select = False deselect_flag = True continue - # Require 3 or more data points. - else: - # Count the points. + # Data checks. + if data_check: + # The number of relaxation data points. data_points = 0 - for id in cdp.ri_ids: - if id in spin.ri_data and spin.ri_data[id] != None: - data_points += 1 - - # Not enough. + if hasattr(cdp, 'ri_ids') and hasattr(spin, 'ri_data'): + for id in cdp.ri_ids: + if id in spin.ri_data and spin.ri_data[id] != None: + data_points += 1 + + # Relaxation data must exist! + if not hasattr(spin, 'ri_data'): + warn(RelaxDeselectWarning(spin_id, 'missing relaxation data')) + spin.select = False + deselect_flag = True + continue + + # Require 3 or more data points. if data_points < 3: warn(RelaxDeselectWarning(spin_id, 'insufficient relaxation data, 3 or more data points are required')) 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: + warn(RelaxWarning("No spins are selected therefore the optimisation or calculation cannot proceed.")) # Final printout. if verbose and not deselect_flag: