Author: bugman Date: Tue Jul 8 21:12:31 2008 New Revision: 6843 URL: http://svn.gna.org/viewcvs/relax?rev=6843&view=rev Log: Fix for the return_data_name() method when no match occurs and the index flag is True. Modified: branches/rdc_analysis/specific_fns/n_state_model.py Modified: branches/rdc_analysis/specific_fns/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/branches/rdc_analysis/specific_fns/n_state_model.py?rev=6843&r1=6842&r2=6843&view=diff ============================================================================== --- branches/rdc_analysis/specific_fns/n_state_model.py (original) +++ branches/rdc_analysis/specific_fns/n_state_model.py Tue Jul 8 21:12:31 2008 @@ -748,8 +748,9 @@ __docformat__ = "plaintext" # Probability. - if search('^p', name): + if search('^p[0-9]*$', name): # Get the state index, otherwise return with nothing if there is an error (parameter unknown). + print 'hello1' try: i = int(name[1:]) except ValueError: @@ -901,18 +902,29 @@ for i in xrange(len(param)): value.append(self.default_value(param[i])) + print param # Set the parameter values. for i in xrange(len(param)): # Get the object name and the parameter index. - object_name, index = self.return_data_name(param[i], index=True) + try: + object_name, index = self.return_data_name(param[i], index=True) + except: + print `self.return_data_name(param[i], index=True)` + raise if not object_name: raise RelaxError, "The data type " + `param[i]` + " does not exist." - # Get the object. - object = getattr(cdp, object_name) - - # Set the parameter value. - object[index] = value[i] + # Simple objects (not a list). + if index == None: + setattr(cdp, object_name, value[i]) + + # List objects. + else: + # Get the object. + object = getattr(cdp, object_name) + + # Set the parameter value. + object[index] = value[i] def set_type(self, tensor=None, red=None):