Author: bugman Date: Wed Sep 4 17:59:10 2013 New Revision: 20809 URL: http://svn.gna.org/viewcvs/relax?rev=20809&view=rev Log: Renamed pipe_control.spectrum.test_spectrum_id() to check_spectrum_id(). A bug in the function was also removed, and the other code in the module now uses this function. Modified: trunk/pipe_control/spectrum.py Modified: trunk/pipe_control/spectrum.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/spectrum.py?rev=20809&r1=20808&r2=20809&view=diff ============================================================================== --- trunk/pipe_control/spectrum.py (original) +++ trunk/pipe_control/spectrum.py Wed Sep 4 17:59:10 2013 @@ -295,6 +295,23 @@ spin.baseplane_rmsd[spectrum_id] = float(error) * scale +def check_spectrum_id(id): + """Check that the give spectrum ID exists. + + @param id: The spectrum ID to check for. + @type id: str + @raises: RelaxNoSpectraError if the ID does not exist. + """ + + # Check that the spectrum ID structure exists. + if not hasattr(cdp, 'spectrum_ids'): + raise RelaxNoSpectraError(id) + + # Test if the spectrum ID exists. + if id not in cdp.spectrum_ids: + raise RelaxNoSpectraError(id) + + def delete(spectrum_id=None): """Delete spectral data corresponding to the spectrum ID. @@ -302,16 +319,11 @@ @type spectrum_id: str """ - # Test if the current pipe exists. + # Tests. pipes.test() - - # Test if the sequence data is loaded. if not exists_mol_res_spin_data(): raise RelaxNoSequenceError - - # Test if data exists. - if not hasattr(cdp, 'spectrum_ids') or spectrum_id not in cdp.spectrum_ids: - raise RelaxNoSpectraError(spectrum_id) + check_spectrum_id(spectrum_id) # Remove the ID. cdp.spectrum_ids.pop(cdp.spectrum_ids.index(spectrum_id)) @@ -726,19 +738,3 @@ # 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)