Author: bugman Date: Thu Jan 17 10:19:47 2008 New Revision: 4804 URL: http://svn.gna.org/viewcvs/relax?rev=4804&view=rev Log: Created a base class method num_instances() to check the sequence and return the number of spins. The J(w) mapping and relaxation curve fitting num_instances() methods have been removed. Modified: 1.3/specific_fns/base_class.py 1.3/specific_fns/jw_mapping.py 1.3/specific_fns/relax_fit.py Modified: 1.3/specific_fns/base_class.py URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/base_class.py?rev=4804&r1=4803&r2=4804&view=diff ============================================================================== --- 1.3/specific_fns/base_class.py (original) +++ 1.3/specific_fns/base_class.py Thu Jan 17 10:19:47 2008 @@ -25,7 +25,7 @@ # relax module imports. from data import Data as relax_data_store -from generic_fns.selection import spin_loop +from generic_fns.selection import count_spins, exists_mol_res_spin_data, spin_loop from relax_errors import RelaxError, RelaxParamSetError @@ -66,6 +66,23 @@ # No errors found. return False + + + def num_instances(self): + """Function for returning the number of instances. + + The default in this base class is to return the number of spins. + + @return: The number of instances (equal to the number of spins). + @rtype: int + """ + + # Test if sequence data is loaded. + if not exists_mol_res_spin_data(): + raise RelaxNoSequenceError + + # Return the number of spins. + return count_spins() def overfit_deselect(self): Modified: 1.3/specific_fns/jw_mapping.py URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/jw_mapping.py?rev=4804&r1=4803&r2=4804&view=diff ============================================================================== --- 1.3/specific_fns/jw_mapping.py (original) +++ 1.3/specific_fns/jw_mapping.py Thu Jan 17 10:19:47 2008 @@ -237,20 +237,6 @@ return 'N' - def num_instances(self, run=None): - """Function for returning the number of instances.""" - - # Arguments. - self.run = run - - # Test if sequence data is loaded. - if not relax_data_store.res.has_key(self.run): - return 0 - - # Return the number of residues. - return len(relax_data_store.res[self.run]) - - def overfit_deselect(self, run): """Function for deselecting residues without sufficient data to support calculation""" Modified: 1.3/specific_fns/relax_fit.py URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/relax_fit.py?rev=4804&r1=4803&r2=4804&view=diff ============================================================================== --- 1.3/specific_fns/relax_fit.py (original) +++ 1.3/specific_fns/relax_fit.py Thu Jan 17 10:19:47 2008 @@ -800,20 +800,6 @@ relax_data_store.res[self.run][i].params = params - def num_instances(self, run=None): - """Function for returning the number of instances.""" - - # Arguments. - self.run = run - - # Test if sequence data is loaded. - if not relax_data_store.res.has_key(self.run): - return 0 - - # Return the number of residues. - return len(relax_data_store.res[self.run]) - - def overfit_deselect(self, run): """Function for deselecting residues without sufficient data to support minimisation"""