Hi Troels, I'm guessing you've already done this, but RelaxError checking in the test suite uses the self.assertRaises() method call to check that the correct error is always raised.
Cheers, Edward On 2 August 2014 15:27, <[email protected]> wrote: > Author: tlinnet > Date: Sat Aug 2 15:27:40 2014 > New Revision: 24918 > > URL: http://svn.gna.org/viewcvs/relax?rev=24918&view=rev > Log: > Modified the warning and error messages beeing raised when calling > return_r1_data(). > > Now warnings is raised if no R1 data is available. An error is raised if the > R1rho model is expected to have R1 data, and it is not available. > > That makes systemtest: Relax_disp.test_r1rho_kjaergaard_missing_r1() fail, > which is the expected behaviour. > > sr #3135(https://gna.org/support/?3135): Optimisation of the R1 relaxation > rate for the off-resonance R1rho relaxation dispersion models. > bug #21788(https://gna.org/bugs/?21788): Only Warning is raised for missing > loading R1 relaxation rate for the off-resonance R1rho relaxation dispersion > models. > > Modified: > branches/R1_fitting/specific_analyses/relax_disp/data.py > > Modified: branches/R1_fitting/specific_analyses/relax_disp/data.py > URL: > http://svn.gna.org/viewcvs/relax/branches/R1_fitting/specific_analyses/relax_disp/data.py?rev=24918&r1=24917&r2=24918&view=diff > ============================================================================== > --- branches/R1_fitting/specific_analyses/relax_disp/data.py (original) > +++ branches/R1_fitting/specific_analyses/relax_disp/data.py Sat Aug 2 > 15:27:40 2014 > @@ -79,7 +79,7 @@ > from pipe_control import value > import specific_analyses > from specific_analyses.relax_disp.checks import check_exp_type, > check_interpolate_offset_cpmg_model, check_mixed_curve_types > -from specific_analyses.relax_disp.variables import EXP_TYPE_CPMG_DQ, > EXP_TYPE_CPMG_MQ, EXP_TYPE_CPMG_PROTON_MQ, EXP_TYPE_CPMG_PROTON_SQ, > EXP_TYPE_CPMG_SQ, EXP_TYPE_CPMG_ZQ, EXP_TYPE_DESC_CPMG_DQ, > EXP_TYPE_DESC_CPMG_MQ, EXP_TYPE_DESC_CPMG_PROTON_MQ, > EXP_TYPE_DESC_CPMG_PROTON_SQ, EXP_TYPE_DESC_CPMG_SQ, EXP_TYPE_DESC_CPMG_ZQ, > EXP_TYPE_DESC_R1RHO, EXP_TYPE_LIST, EXP_TYPE_LIST_CPMG, EXP_TYPE_LIST_R1RHO, > EXP_TYPE_R1RHO, MODEL_B14, MODEL_B14_FULL, MODEL_DPL94, MODEL_LIST_MMQ, > MODEL_LIST_NUMERIC_CPMG, MODEL_LIST_R1RHO, MODEL_LIST_R1RHO_FULL, MODEL_MP05, > MODEL_NS_R1RHO_2SITE, MODEL_PARAMS, MODEL_R2EFF, MODEL_TAP03, MODEL_TP02, > PARAMS_R20 > +from specific_analyses.relax_disp.variables import EXP_TYPE_CPMG_DQ, > EXP_TYPE_CPMG_MQ, EXP_TYPE_CPMG_PROTON_MQ, EXP_TYPE_CPMG_PROTON_SQ, > EXP_TYPE_CPMG_SQ, EXP_TYPE_CPMG_ZQ, EXP_TYPE_DESC_CPMG_DQ, > EXP_TYPE_DESC_CPMG_MQ, EXP_TYPE_DESC_CPMG_PROTON_MQ, > EXP_TYPE_DESC_CPMG_PROTON_SQ, EXP_TYPE_DESC_CPMG_SQ, EXP_TYPE_DESC_CPMG_ZQ, > EXP_TYPE_DESC_R1RHO, EXP_TYPE_LIST, EXP_TYPE_LIST_CPMG, EXP_TYPE_LIST_R1RHO, > EXP_TYPE_R1RHO, MODEL_B14, MODEL_B14_FULL, MODEL_DPL94, MODEL_LIST_MMQ, > MODEL_LIST_NUMERIC_CPMG, MODEL_LIST_R1RHO, MODEL_LIST_R1RHO_FULL, > MODEL_LIST_R1RHO_W_R1, MODEL_MP05, MODEL_NS_R1RHO_2SITE, MODEL_PARAMS, > MODEL_R2EFF, MODEL_TAP03, MODEL_TP02, PARAMS_R20 > from stat import S_IRWXU, S_IRGRP, S_IROTH > from os import chmod, sep > > @@ -4032,9 +4032,29 @@ > > # Check for the presence of data. > if not hasattr(cdp, 'ri_ids'): > + warn_text = "No R1 relaxation data has been loaded. Setting it to > 0.0. This is essential for the proper handling of offsets in off-resonance > R1rho experiments." > + error_text = "No R1 relaxation data has been loaded. This is > essential for the proper handling of offsets in off-resonance R1rho > experiments." > if has_r1rho_exp_type(): > - warn(RelaxWarning("No R1 relaxation data has been loaded. This > is essential for the proper handling of offsets in off-resonance R1rho > experiments.")) > - return 0.0 * r1 > + # Spin loop. > + for si in range(spin_num): > + # Assign spin. > + spin=spins[si] > + > + # For all R1rho models using R1, raise an error, if R1 has > not been loaded. > + if spin.model in MODEL_LIST_R1RHO_W_R1: > + raise RelaxError(error_text) > + > + # For all models not listed in R1rho models, raise a > warning, and set 0.0 as value. > + else: > + warn(RelaxWarning(warn_text)) > + r1[si] = 0.0 * r1[si] > + > + # For all non-R1rho experiments, return 0.0. > + else: > + r1 = 0.0 * r1 > + > + # Return r1 > + return r1 > > # Loop over the Rx IDs. > flags = [False]*field_count > > > _______________________________________________ > relax (http://www.nmr-relax.com) > > This is the relax-commits mailing list > [email protected] > > To unsubscribe from this list, get a password > reminder, or change your subscription options, > visit the list information page at > https://mail.gna.org/listinfo/relax-commits _______________________________________________ relax (http://www.nmr-relax.com) This is the relax-devel mailing list [email protected] To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-devel

