Author: bugman Date: Fri May 3 19:49:43 2013 New Revision: 19651 URL: http://svn.gna.org/viewcvs/relax?rev=19651&view=rev Log: Added the error flag argument to all of the specific analysis API set_param_values() methods. This will allow parameter errors as well as values to be set. Modified: trunk/specific_analyses/api_base.py trunk/specific_analyses/api_common.py trunk/specific_analyses/model_free/main.py trunk/specific_analyses/n_state_model.py Modified: trunk/specific_analyses/api_base.py URL: http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/api_base.py?rev=19651&r1=19650&r2=19651&view=diff ============================================================================== --- trunk/specific_analyses/api_base.py (original) +++ trunk/specific_analyses/api_base.py Fri May 3 19:49:43 2013 @@ -655,7 +655,7 @@ raise RelaxImplementError('set_error') - def set_param_values(self, param=None, value=None, spin_id=None, force=True): + def set_param_values(self, param=None, value=None, spin_id=None, error=False, force=True): """Set the model parameter values. @keyword param: The parameter name list. @@ -664,6 +664,8 @@ @type value: list @keyword spin_id: The spin identification string, only used for spin specific parameters. @type spin_id: None or str + @keyword error: A flag which if True will allow the parameter errors to be set instead of the values. + @type error: bool @keyword force: A flag which if True will cause current values to be overwritten. If False, a RelaxError will raised if the parameter value is already set. @type force: bool """ Modified: trunk/specific_analyses/api_common.py URL: http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/api_common.py?rev=19651&r1=19650&r2=19651&view=diff ============================================================================== --- trunk/specific_analyses/api_common.py (original) +++ trunk/specific_analyses/api_common.py Fri May 3 19:49:43 2013 @@ -435,7 +435,7 @@ inc = inc + 1 - def _set_param_values_global(self, param=None, value=None, spin_id=None, force=True): + def _set_param_values_global(self, param=None, value=None, spin_id=None, error=False, force=True): """Set the global parameter values in the top layer of the data pipe. @keyword param: The parameter name list. @@ -444,6 +444,8 @@ @type value: list @keyword spin_id: The spin identification string (unused). @type spin_id: None + @keyword error: A flag which if True will allow the parameter errors to be set instead of the values. + @type error: bool @keyword force: A flag which if True will cause current values to be overwritten. If False, a RelaxError will raised if the parameter value is already set. @type force: bool """ @@ -461,6 +463,10 @@ if not obj_name: raise RelaxError("The parameter '%s' is not valid for this data pipe type." % param[i]) + # Error object. + if error: + obj_name += '_err' + # Is the parameter already set. if not force and hasattr(cdp, obj_name) and getattr(cdp, obj_name) != None: raise RelaxError("The parameter '%s' already exists, set the force flag to True to overwrite." % param[i]) @@ -469,7 +475,7 @@ setattr(cdp, obj_name, value[i]) - def _set_param_values_spin(self, param=None, value=None, spin_id=None, force=True): + def _set_param_values_spin(self, param=None, value=None, spin_id=None, error=False, force=True): """Set the spin specific parameter values. @keyword param: The parameter name list. @@ -478,6 +484,8 @@ @type value: list @keyword spin_id: The spin identification string, only used for spin specific parameters. @type spin_id: None or str + @keyword error: A flag which if True will allow the parameter errors to be set instead of the values. + @type error: bool @keyword force: A flag which if True will cause current values to be overwritten. If False, a RelaxError will raised if the parameter value is already set. @type force: bool """ @@ -498,8 +506,13 @@ if not spin.select: continue + # The object name. + obj_name = param[i] + if error: + obj_name += '_err' + # Set the parameter. - setattr(spin, param[i], value[i]) + setattr(spin, obj_name, value[i]) def _set_selected_sim_global(self, model_info, select_sim): Modified: trunk/specific_analyses/model_free/main.py URL: http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/model_free/main.py?rev=19651&r1=19650&r2=19651&view=diff ============================================================================== --- trunk/specific_analyses/model_free/main.py (original) +++ trunk/specific_analyses/model_free/main.py Fri May 3 19:49:43 2013 @@ -2207,7 +2207,7 @@ inc = inc + 1 - def set_param_values(self, param=None, value=None, spin_id=None, force=True): + def set_param_values(self, param=None, value=None, spin_id=None, error=False, force=True): """Set the model-free parameter values. @keyword param: The parameter name list. @@ -2216,6 +2216,8 @@ @type value: list @keyword spin_id: The spin identification string, only used for spin specific parameters. @type spin_id: None or str + @keyword error: A flag which if True will allow the parameter errors to be set instead of the values. + @type error: bool @keyword force: A flag which if True will cause current values to be overwritten. If False, a RelaxError will raised if the parameter value is already set. @type force: bool """ @@ -2232,7 +2234,10 @@ # Diffusion tensor parameter. diff_obj = diffusion_tensor.return_data_name(param[i]) if diff_obj: - diff_params.append(param[i]) + if error: + diff_params.append(param[i] + '_err') + else: + diff_params.append(param[i]) diff_vals.append(value[i]) # Model-free parameter. @@ -2252,6 +2257,10 @@ # Check if it is a model-free parameter. if obj_name not in self.data_names(set='params', scope='spin') and obj_name not in self.data_names(set='generic', scope='spin'): raise RelaxError("The parameter '%s' is unknown. It should be one of %s or %s" % (mf_params[i], self.data_names(set='params', scope='spin'), self.data_names(set='generic', scope='spin'))) + + # The error object name. + if error: + obj_name += '_err' # Set the parameter. for spin in spin_loop(spin_id): Modified: trunk/specific_analyses/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/n_state_model.py?rev=19651&r1=19650&r2=19651&view=diff ============================================================================== --- trunk/specific_analyses/n_state_model.py (original) +++ trunk/specific_analyses/n_state_model.py Fri May 3 19:49:43 2013 @@ -2596,7 +2596,7 @@ return getattr(tensor, names[param_index]+'_err') - def set_param_values(self, param=None, value=None, spin_id=None, force=True): + def set_param_values(self, param=None, value=None, spin_id=None, error=False, force=True): """Set the N-state model parameter values. @keyword param: The parameter name list. @@ -2605,6 +2605,8 @@ @type value: list @keyword spin_id: The spin identification string (unused). @type spin_id: None + @keyword error: A flag which if True will allow the parameter errors to be set instead of the values. + @type error: bool @keyword force: A flag which if True will cause current values to be overwritten. If False, a RelaxError will raised if the parameter value is already set. @type force: bool """ @@ -2621,6 +2623,10 @@ # Is the parameter is valid? if not obj_name: raise RelaxError("The parameter '%s' is not valid for this data pipe type." % param[i]) + + # Error object. + if error: + obj_name += '_err' # Set the indexed parameter. if obj_name in ['probs', 'alpha', 'beta', 'gamma']: