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

Source Code for Module generic_fns.frq

 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 manipulating the spectrometer frequency of experiments.""" 
25   
26  # relax module imports. 
27  from generic_fns import pipes 
28  from relax_errors import RelaxError 
29   
30   
31 -def set(id=None, frq=None):
32 """Set the spectrometer frequency of the experiment. 33 34 @keyword id: The experimental identification string (allowing for multiple experiments per 35 data pipe). 36 @type id: str 37 @keyword frq: The spectrometer frequency in Hertz. 38 @type frq: 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, 'frq'): 46 cdp.frq = {} 47 48 # Test the frequency has not already been set. 49 if id in cdp.frq: 50 raise RelaxError("The frequency for the experiment " + repr(id) + " has already been set.") 51 52 # Set the frequency. 53 cdp.frq[id] = frq
54