mailr21346 - /trunk/pipe_control/spectrometer.py


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

Header


Content

Posted by edward on October 31, 2013 - 09:07:
Author: bugman
Date: Thu Oct 31 09:07:44 2013
New Revision: 21346

URL: http://svn.gna.org/viewcvs/relax?rev=21346&view=rev
Log:
Created the pipe_control.spectrometer.check_frequency() function to 
standardise this check.


Modified:
    trunk/pipe_control/spectrometer.py

Modified: trunk/pipe_control/spectrometer.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/spectrometer.py?rev=21346&r1=21345&r2=21346&view=diff
==============================================================================
--- trunk/pipe_control/spectrometer.py (original)
+++ trunk/pipe_control/spectrometer.py Thu Oct 31 09:07:44 2013
@@ -31,6 +31,18 @@
 from lib.physical_constants import g1H
 from lib.warnings import RelaxWarning
 from pipe_control import pipes
+
+
+def check_frequency(id=None):
+    """Check that the frequency for the given ID has been set.
+
+    @param id:          The experiment ID string.
+    @type id:           str
+    """
+
+    # Check for the ID.
+    if not hasattr(cdp, 'spectrometer_frq') or id not in 
cdp.spectrometer_frq.keys():
+        raise RelaxNoFrqError(id=id)
 
 
 def copy_frequencies(pipe_from=None, pipe_to=None, id=None):
@@ -88,12 +100,9 @@
     @type id:       str
     """
 
-    # Test if the current pipe exists.
+    # Checks.
     pipes.test()
-
-    # Test if data exists.
-    if not hasattr(cdp, 'spectrometer_frq') or id not in 
cdp.spectrometer_frq:
-        raise RelaxNoFrqError(id)
+    check_frequency(id=id)
 
     # Delete the frequency.
     frq = cdp.spectrometer_frq[id]




Related Messages


Powered by MHonArc, Updated Thu Oct 31 09:20:01 2013