mailr10018 - /1.3/specific_fns/api_common.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on November 30, 2009 - 10:27:
Author: bugman
Date: Mon Nov 30 10:27:24 2009
New Revision: 10018

URL: http://svn.gna.org/viewcvs/relax?rev=10018&view=rev
Log:
Modified the analysis API common method _set_param_values_spin() to accepts 
lists as args.


Modified:
    1.3/specific_fns/api_common.py

Modified: 1.3/specific_fns/api_common.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/specific_fns/api_common.py?rev=10018&r1=10017&r2=10018&view=diff
==============================================================================
--- 1.3/specific_fns/api_common.py (original)
+++ 1.3/specific_fns/api_common.py Mon Nov 30 10:27:24 2009
@@ -333,10 +333,10 @@
     def _set_param_values_spin(self, param=None, value=None, spin_id=None, 
force=True):
         """Set the spin specific parameter values.
 
-        @keyword param:     The parameter name.
-        @type param:        str
-        @keyword value:     The parameter value.
-        @type value:        number
+        @keyword param:     The parameter name list.
+        @type param:        list of str
+        @keyword value:     The parameter value list.
+        @type value:        list
         @keyword spin_id:   The spin identification string, only used for 
spin specific parameters.
         @type spin_id:      None or str
         @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.
@@ -344,24 +344,26 @@
         """
 
         # Checks.
-        arg_check.is_str(param, 'parameter name')
-        arg_check.is_num(value, 'parameter value')
-
-        # Get the object's name.
-        obj_name = self.return_data_name(param)
-
-        # Is the parameter is valid?
-        if not obj_name:
-            raise RelaxError("The parameter '%s' is not valid for this data 
pipe type." % param)
-
-        # Spin loop.
-        for spin in spin_loop(spin_id):
-            # Skip deselected spins.
-            if not spin.select:
-                continue
-
-            # Set the parameter.
-            setattr(spin, obj_name, value)
+        arg_check.is_str_list(param, 'parameter name')
+        arg_check.is_list(value, 'parameter value')
+
+        # Loop over the parameters.
+        for i in range(len(param)):
+            # Get the object's name.
+            obj_name = self.return_data_name(param[i])
+
+            # Is the parameter is valid?
+            if not obj_name:
+                raise RelaxError("The parameter '%s' is not valid for this 
data pipe type." % param[i])
+
+            # Spin loop.
+            for spin in spin_loop(spin_id):
+                # Skip deselected spins.
+                if not spin.select:
+                    continue
+
+                # Set the parameter.
+                setattr(spin, obj_name, value[i])
 
 
     def _set_selected_sim_spin(self, model_info, select_sim):




Related Messages


Powered by MHonArc, Updated Mon Nov 30 10:40:02 2009