Author: bugman Date: Wed Sep 4 17:50:08 2013 New Revision: 20808 URL: http://svn.gna.org/viewcvs/relax?rev=20808&view=rev Log: Merged revisions 20807 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r20807 | bugman | 2013-09-04 17:47:45 +0200 (Wed, 04 Sep 2013) | 3 lines Created the pipe_control.spectrum.test_spectrum_id() function for checking if a spectrum ID exists. ........ Modified: branches/relax_disp/ (props changed) branches/relax_disp/pipe_control/spectrum.py Propchange: branches/relax_disp/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Wed Sep 4 17:50:08 2013 @@ -1,1 +1,1 @@ -/trunk:1-20793 +/trunk:1-20807 Modified: branches/relax_disp/pipe_control/spectrum.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/pipe_control/spectrum.py?rev=20808&r1=20807&r2=20808&view=diff ============================================================================== --- branches/relax_disp/pipe_control/spectrum.py (original) +++ branches/relax_disp/pipe_control/spectrum.py Wed Sep 4 17:50:08 2013 @@ -726,3 +726,19 @@ # Return the list. return repl + + +def test_spectrum_id(id): + """Test that the give spectrum ID exists. + + @param id: The spectrum ID to check for. + @type id: str + """ + + # Check that the spectrum ID structure exists. + if not hasattr(cdp, 'spectrum_ids'): + raise RelaxNoSpectraError(id) + + # Test if the spectrum ID exists. + if spectrum_id not in cdp.spectrum_ids: + raise RelaxNoSpectraError(id)