Author: bugman Date: Wed Mar 27 15:24:08 2013 New Revision: 19237 URL: http://svn.gna.org/viewcvs/relax?rev=19237&view=rev Log: Ported r8687 from the old relax_disp branch into the new branch. The command used was: svn merge -r8686:8687 svn+ssh://bugman@xxxxxxxxxxx/svn/relax/branches/relax_disp/specific_fns/@r18123 specific_analyses The prompt package changes were manually ported to the user_functions package. ..... r8687 | semor | 2009-01-27 23:11:53 +0100 (Tue, 27 Jan 2009) | 3 lines Changed paths: M /branches/relax_disp/prompt/relax_disp.py M /branches/relax_disp/specific_fns/relax_disp.py A few fixes based on the unit tests problems. ..... Modified: branches/relax_disp/specific_analyses/relax_disp.py branches/relax_disp/user_functions/relax_disp.py Modified: branches/relax_disp/specific_analyses/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp.py?rev=19237&r1=19236&r2=19237&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp.py (original) +++ branches/relax_disp/specific_analyses/relax_disp.py Wed Mar 27 15:24:08 2013 @@ -241,7 +241,7 @@ return results[result_index] - def calc_r2eff(self, exp_type='cpmg', id=None, delayT=None, int_cpmg=0.0, int_ref=0.0): + def calc_r2eff(self, exp_type='cpmg', id=None, delayT=None, int_cpmg=0.0, int_ref=1.0): """Calculate the effective transversal relaxation rate from the peak intensities. The equation depends on the experiment type chosen, either 'cpmg' or 'r1rho'. @@ -258,10 +258,20 @@ @type int_ref: float """ - if exp_type == 'cpmg': + # Avoid division by zero. + if int_ref == 0: + raise RelaxError, "The reference peak intensity should not have a value of 0 (zero)" + + # Avoid other inmpossible mathematical situation. + if int_cpmg == 0: + raise RelaxError, "The CPMG peak intensity should not have a value of 0 (zero)" + + if delayT == 0: + raise RelaxError, "The CPMG constant time delay (T) should not have a value of 0 (zero)" + + if exp_type == 'cpmg' and delayT != None: r2eff = - ( 1 / delayT ) * log ( int_cpmg / int_ref ) - - return r2eff + return r2eff def cpmg_frq(self, cpmg_frq=None, spectrum_id=None): Modified: branches/relax_disp/user_functions/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/user_functions/relax_disp.py?rev=19237&r1=19236&r2=19237&view=diff ============================================================================== --- branches/relax_disp/user_functions/relax_disp.py (original) +++ branches/relax_disp/user_functions/relax_disp.py Wed Mar 27 15:24:08 2013 @@ -70,7 +70,7 @@ ) uf.add_keyarg( name = "int_ref", - default = "0.0", + default = "1.0", py_type = "float", desc_short = "reference peak intensity", desc = "Intensity of the peak in the reference spectrum.."