mailr19320 - /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 03, 2013 - 12:57:
Author: bugman
Date: Wed Apr  3 12:57:40 2013
New Revision: 19320

URL: http://svn.gna.org/viewcvs/relax?rev=19320&view=rev
Log:
Created the specific API common method _data_init_spin().

This will be used as a general method for aliasing to data_init() for 
initialising spin parameters.


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=19320&r1=19319&r2=19320&view=diff
==============================================================================
--- trunk/specific_analyses/api_common.py (original)
+++ trunk/specific_analyses/api_common.py Wed Apr  3 12:57:40 2013
@@ -88,6 +88,30 @@
         """
 
 
+    def _data_init_spin(self, data_cont, sim=False):
+        """Initialise data structures (spin system specific).
+
+        @param data_cont:   The spin container.
+        @type data_cont:    SpinContainer instance
+        @keyword sim:       The Monte Carlo simulation flag, which if true 
will initialise the simulation data structure.
+        @type sim:          bool
+        """
+
+        # Loop over the parameters.
+        for name in self.PARAMS.loop(set='params', scope='spin', 
error_names=False, sim_names=sim):
+            # The default value.
+            param_type = self.PARAMS.get_type(name)
+            if param_type == 'dict':
+                value = {}
+            elif param_type == 'list':
+                value = []
+            else:
+                value = None
+
+            # Set the value.
+            setattr(data_cont, name, value)
+
+
     def _eliminate_false(self, name, value, model_info, args, sim=None):
         """Dummy method for model elimination.
 




Related Messages


Powered by MHonArc, Updated Wed Apr 03 13:00:01 2013