mailr7135 - /branches/rdc_analysis/generic_fns/temperature.py


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

Header


Content

Posted by edward on August 11, 2008 - 11:58:
Author: bugman
Date: Mon Aug 11 11:58:38 2008
New Revision: 7135

URL: http://svn.gna.org/viewcvs/relax?rev=7135&view=rev
Log:
Completed the generic_fns.temperature.set() function.


Modified:
    branches/rdc_analysis/generic_fns/temperature.py

Modified: branches/rdc_analysis/generic_fns/temperature.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/rdc_analysis/generic_fns/temperature.py?rev=7135&r1=7134&r2=7135&view=diff
==============================================================================
--- branches/rdc_analysis/generic_fns/temperature.py (original)
+++ branches/rdc_analysis/generic_fns/temperature.py Mon Aug 11 11:58:38 2008
@@ -25,6 +25,7 @@
 
 # relax module imports.
 from data import Relax_data_store; ds = Relax_data_store()
+from relax_errors import RelaxError
 
 
 def set(id=None, temp=None):
@@ -36,3 +37,21 @@
     @keyword temp:  The temperature in kelvin.
     @type temp:     float
     """
+
+    # Test if the current data pipe exists.
+    if not ds.current_pipe:
+        raise RelaxNoPipeError
+
+    # Alias the current data pipe.
+    cdp = ds[ds.current_pipe]
+
+    # Set up the dictionary data structure if it doesn't exist yet.
+    if not hasattr(cdp, 'temperature'):
+        cdp.temperature = {}
+
+    # Test the temperature has not already been set.
+    if cdp.temperature.has_key(id):
+        raise RelaxError, "The temperature for the experiment " + `id` + " 
has already been set."
+
+    # Set the temperature.
+    cdp.temperature[id] = temp




Related Messages


Powered by MHonArc, Updated Mon Aug 11 12:00:45 2008