Author: bugman Date: Thu Oct 31 09:36:44 2013 New Revision: 21354 URL: http://svn.gna.org/viewcvs/relax?rev=21354&view=rev Log: The dispersion specific check_exp_type() function now accepts the id argument to check individual IDs. Modified: branches/relax_disp/specific_analyses/relax_disp/checks.py Modified: branches/relax_disp/specific_analyses/relax_disp/checks.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/checks.py?rev=21354&r1=21353&r2=21354&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/checks.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/checks.py Thu Oct 31 09:36:44 2013 @@ -70,19 +70,26 @@ raise RelaxError("The spin-lock field strength has not been set for the '%s' spectrum." % id) -def check_exp_type(): - """Check if the experiment types have been set up. - - @raises RelaxError: If the dispersion experiment type has not been set. +def check_exp_type(id=None): + """Check if the experiment type have been set up for one or all IDs. + + @param id: The experiment ID string. If not set, then all spectrum IDs will be checked. + @type id: None or str + @raises RelaxError: When the experiment type for the given ID is missing or, when not given, if the dispersion experiment type has not been set. """ # Test if the experiment type is set. if not hasattr(cdp, 'exp_type'): raise RelaxError("The relaxation dispersion experiment types have not been set for any spectra.") - # Check each spectrum ID. - for id in cdp.spectrum_ids: - if id not in cdp.exp_type: + # Individual ID. + if id != None: + if id not in cdp.exp_type.keys(): + raise RelaxError("The dispersion experiment type for the experiment ID '%s' has not been set." % id) + + # Check each spectrum ID. + for id in cdp.spectrum_ids: + if id not in cdp.exp_type.keys(): raise RelaxError("The relaxation dispersion experiment type has not been set for the '%s' spectrum." % id)