mailr22845 - /trunk/specific_analyses/api_common.py


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

Header


Content

Posted by edward on April 24, 2014 - 14:31:
Author: bugman
Date: Thu Apr 24 14:31:14 2014
New Revision: 22845

URL: http://svn.gna.org/viewcvs/relax?rev=22845&view=rev
Log:
Fixes for the specific API _set_param_values_spin() method for lists and 
dictionaries.

This is for the value.set user function to allow it to handle parameters of 
different types.  For
example the 'R2' parameter in the relaxation dispersion analysis.  This API 
common method now sets
all dictionary elements, list elements, or the variable to the given value.


Modified:
    trunk/specific_analyses/api_common.py

Modified: trunk/specific_analyses/api_common.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/api_common.py?rev=22845&r1=22844&r2=22845&view=diff
==============================================================================
--- trunk/specific_analyses/api_common.py       (original)
+++ trunk/specific_analyses/api_common.py       Thu Apr 24 14:31:14 2014
@@ -569,7 +569,17 @@
                     obj_name += '_err'
 
                 # Set the parameter.
-                setattr(spin, obj_name, value[i])
+                param_type = self._PARAMS.type(param[i])
+                if param_type == dict:
+                    obj = getattr(spin, obj_name)
+                    for key in obj:
+                        obj[key] = value[i]
+                elif param_type == list:
+                    obj = getattr(spin, obj_name)
+                    for j in range(len(obj)):
+                        obj[j] = value[i]
+                else:
+                    setattr(spin, obj_name, value[i])
 
 
     def _set_selected_sim_global(self, model_info, select_sim):




Related Messages


Powered by MHonArc, Updated Thu Apr 24 15:20:03 2014