mailr15177 - /branches/spec_api/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 January 18, 2012 - 17:02:
Author: bugman
Date: Wed Jan 18 17:02:34 2012
New Revision: 15177

URL: http://svn.gna.org/viewcvs/relax?rev=15177&view=rev
Log:
Created a few additional specific API common methods.

These include:
    _return_data_name()
    _return_data_name_global()
    _return_units_global()


Modified:
    branches/spec_api/specific_fns/api_common.py

Modified: branches/spec_api/specific_fns/api_common.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/spec_api/specific_fns/api_common.py?rev=15177&r1=15176&r2=15177&view=diff
==============================================================================
--- branches/spec_api/specific_fns/api_common.py (original)
+++ branches/spec_api/specific_fns/api_common.py Wed Jan 18 17:02:34 2012
@@ -227,8 +227,11 @@
         return 1.0
 
 
-    def _return_data_name_spin(self, param):
-        """Return a unique identifying string for the parameter.
+    def _return_data_name(self, param):
+        """Return a unique identifying string for the global or spin 
parameter.
+
+        This first returns a global parameter if it exists, followed by a 
spin parameter, and None if neither exist.
+
 
         @param param:   The parameter name.
         @type param:    str
@@ -236,6 +239,44 @@
         @rtype:         str
         """
 
+        # Global parameter.
+        if self.GLOBAL_PARAMS.contains(param):
+            return param
+
+        # Spin parameter.
+        if self.SPIN_PARAMS.contains(param):
+            return param
+
+        # No matches.
+        return None
+
+
+    def _return_data_name_global(self, param):
+        """Return a unique identifying string for the global parameter.
+
+        @param param:   The parameter name.
+        @type param:    str
+        @return:        The unique parameter identifying string.
+        @rtype:         str
+        """
+
+        # No parameter.
+        if not self.GLOBAL_PARAMS.contains(param):
+            return None
+
+        # Return the name.
+        return param
+
+
+    def _return_data_name_spin(self, param):
+        """Return a unique identifying string for the spin parameter.
+
+        @param param:   The parameter name.
+        @type param:    str
+        @return:        The unique parameter identifying string.
+        @rtype:         str
+        """
+
         # No parameter.
         if not self.SPIN_PARAMS.contains(param):
             return None
@@ -310,7 +351,24 @@
             return None
 
         # Return the name.
-        return param
+        return self.SPIN_PARAMS.get_units(param)
+
+
+    def _return_units_global(self, param):
+        """Return a string representing the global parameter units.
+
+        @param param:   The parameter name.
+        @type param:    str
+        @return:        The string representation of the units.
+        @rtype:         None or str
+        """
+
+        # No parameter.
+        if not self.GLOBAL_PARAMS.contains(param):
+            return None
+
+        # Return the name.
+        return self.GLOBAL_PARAMS.get_units(param)
 
 
     def _return_value_general(self, spin, param, sim=None, bc=False):




Related Messages


Powered by MHonArc, Updated Wed Jan 18 17:20:02 2012