Author: bugman Date: Thu Oct 31 09:13:25 2013 New Revision: 21347 URL: http://svn.gna.org/viewcvs/relax?rev=21347&view=rev Log: Merged revisions 21346 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r21346 | bugman | 2013-10-31 09:07:44 +0100 (Thu, 31 Oct 2013) | 3 lines Created the pipe_control.spectrometer.check_frequency() function to standardise this check. ........ Modified: branches/relax_disp/ (props changed) branches/relax_disp/pipe_control/spectrometer.py Propchange: branches/relax_disp/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Thu Oct 31 09:13:25 2013 @@ -1,1 +1,1 @@ -/trunk:1-21333 +/trunk:1-21346 Modified: branches/relax_disp/pipe_control/spectrometer.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/pipe_control/spectrometer.py?rev=21347&r1=21346&r2=21347&view=diff ============================================================================== --- branches/relax_disp/pipe_control/spectrometer.py (original) +++ branches/relax_disp/pipe_control/spectrometer.py Thu Oct 31 09:13:25 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]