Author: bugman Date: Wed May 21 21:30:56 2008 New Revision: 6188 URL: http://svn.gna.org/viewcvs/relax?rev=6188&view=rev Log: Updated the select_model() method to the new design. Modified: 1.3/specific_fns/relax_fit.py Modified: 1.3/specific_fns/relax_fit.py URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/relax_fit.py?rev=6188&r1=6187&r2=6188&view=diff ============================================================================== --- 1.3/specific_fns/relax_fit.py (original) +++ 1.3/specific_fns/relax_fit.py Wed May 21 21:30:56 2008 @@ -31,7 +31,7 @@ from data import Data as relax_data_store from base_class import Common_functions from generic_fns import intensity -from generic_fns.mol_res_spin import count_spins, spin_loop +from generic_fns.mol_res_spin import count_spins, exists_mol_res_spin_data, spin_loop from minimise.generic import generic_minimise from relax_errors import RelaxError, RelaxFuncSetupError, RelaxLenError, RelaxNoModelError, RelaxNoPipeError, RelaxNoSequenceError @@ -980,24 +980,25 @@ return None - def select_model(self, run=None, model='exp'): - """Function for selecting the model of the exponential curve.""" - - # Arguments. - self.run = run - - # Test if the run exists. - if not self.run in relax_data_store.run_names: - raise RelaxNoPipeError, self.run - - # Test if the run type is set to 'relax_fit'. - function_type = relax_data_store.run_types[relax_data_store.run_names.index(self.run)] + def select_model(self, model='exp'): + """Function for selecting the model of the exponential curve. + + @keyword model: The exponential curve type. Can be one of 'exp' or 'inv'. + @type model: str + """ + + # Test if the current pipe exists. + if not relax_data_store.current_pipe: + raise RelaxNoPipeError + + # Test if the pipe type is set to 'relax_fit'. + function_type = relax_data_store[relax_data_store.current_pipe].pipe_type if function_type != 'relax_fit': - raise RelaxFuncSetupError, self.relax.specific_setup.get_string(function_type) + raise RelaxFuncSetupError, specific_setup.get_string(function_type) # Test if sequence data is loaded. - if not relax_data_store.res.has_key(self.run): - raise RelaxNoSequenceError, self.run + if not exists_mol_res_spin_data(): + raise RelaxNoSequenceError # Two parameter exponential fit. if model == 'exp':