Package generic_fns :: Module temperature
[hide private]
[frames] | no frames]

Source Code for Module generic_fns.temperature

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2008-2009 Edward d'Auvergne                                   # 
 4  #                                                                             # 
 5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
 6  #                                                                             # 
 7  # This program is free software: you can redistribute it and/or modify        # 
 8  # it under the terms of the GNU General Public License as published by        # 
 9  # the Free Software Foundation, either version 3 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # This program is distributed in the hope that it will be useful,             # 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
15  # GNU General Public License for more details.                                # 
16  #                                                                             # 
17  # You should have received a copy of the GNU General Public License           # 
18  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
19  #                                                                             # 
20  ############################################################################### 
21   
22  # Module docstring. 
23  """Module for setting the experimental temperature.""" 
24   
25  # relax module imports. 
26  from generic_fns import pipes 
27  from relax_errors import RelaxError 
28   
29   
30 -def set(id=None, temp=None):
31 """Set the experimental temperature. 32 33 @keyword id: The experimental identification string (allowing for multiple experiments per 34 data pipe). 35 @type id: str 36 @keyword temp: The temperature in kelvin. 37 @type temp: float 38 """ 39 40 # Test if the current data pipe exists. 41 pipes.test() 42 43 # Set up the dictionary data structure if it doesn't exist yet. 44 if not hasattr(cdp, 'temperature'): 45 cdp.temperature = {} 46 47 # Test the temperature has not already been set. 48 if id in cdp.temperature: 49 raise RelaxError("The temperature for the experiment " + repr(id) + " has already been set.") 50 51 # Set the temperature. 52 cdp.temperature[id] = float(temp)
53