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.                                     # 
 6  #                                                                             # 
 7  # relax 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 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax 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 relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Module docstring. 
24  """Module for setting the experimental temperature.""" 
25   
26  # relax module imports. 
27  from generic_fns import pipes 
28  from relax_errors import RelaxError 
29   
30   
31 -def set(id=None, temp=None):
32 """Set the experimental temperature. 33 34 @keyword id: The experimental identification string (allowing for multiple experiments per 35 data pipe). 36 @type id: str 37 @keyword temp: The temperature in kelvin. 38 @type temp: float 39 """ 40 41 # Test if the current data pipe exists. 42 pipes.test() 43 44 # Set up the dictionary data structure if it doesn't exist yet. 45 if not hasattr(cdp, 'temperature'): 46 cdp.temperature = {} 47 48 # Test the temperature has not already been set. 49 if id in cdp.temperature: 50 raise RelaxError("The temperature for the experiment " + repr(id) + " has already been set.") 51 52 # Set the temperature. 53 cdp.temperature[id] = float(temp)
54