Author: bugman Date: Thu Sep 5 17:04:38 2013 New Revision: 20855 URL: http://svn.gna.org/viewcvs/relax?rev=20855&view=rev Log: Added some sanity checks to the dispersion target function class. R1rho models cannot be used with CPMG-type experiments, and CPMG models cannot be used with R1rho-type experiments. Modified: branches/relax_disp/target_functions/relax_disp.py Modified: branches/relax_disp/target_functions/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/target_functions/relax_disp.py?rev=20855&r1=20854&r2=20855&view=diff ============================================================================== --- branches/relax_disp/target_functions/relax_disp.py (original) +++ branches/relax_disp/target_functions/relax_disp.py Thu Sep 5 17:04:38 2013 @@ -43,7 +43,7 @@ from lib.dispersion.tsmfk01 import r2eff_TSMFK01 from lib.errors import RelaxError from target_functions.chi2 import chi2 -from specific_analyses.relax_disp.variables import MODEL_CR72, MODEL_CR72_FULL, MODEL_DPL94, MODEL_IT99, MODEL_LIST_CPMG, MODEL_LIST_FULL, MODEL_LIST_R1RHO, MODEL_LM63, MODEL_LM63_3SITE, MODEL_M61, MODEL_M61B, MODEL_NOREX, MODEL_NS_CPMG_2SITE_3D, MODEL_NS_CPMG_2SITE_3D_FULL, MODEL_NS_CPMG_2SITE_EXPANDED, MODEL_NS_CPMG_2SITE_STAR, MODEL_NS_CPMG_2SITE_STAR_FULL, MODEL_NS_R1RHO_2SITE, MODEL_R2EFF, MODEL_TP02, MODEL_TSMFK01 +from specific_analyses.relax_disp.variables import EXP_TYPE_LIST_CPMG, EXP_TYPE_LIST_R1RHO, MODEL_CR72, MODEL_CR72_FULL, MODEL_DPL94, MODEL_IT99, MODEL_LIST_CPMG, MODEL_LIST_FULL, MODEL_LIST_R1RHO, MODEL_LM63, MODEL_LM63_3SITE, MODEL_M61, MODEL_M61B, MODEL_NOREX, MODEL_NS_CPMG_2SITE_3D, MODEL_NS_CPMG_2SITE_3D_FULL, MODEL_NS_CPMG_2SITE_EXPANDED, MODEL_NS_CPMG_2SITE_STAR, MODEL_NS_CPMG_2SITE_STAR_FULL, MODEL_NS_R1RHO_2SITE, MODEL_R2EFF, MODEL_TP02, MODEL_TSMFK01 class Dispersion: @@ -135,6 +135,7 @@ self.num_spins = num_spins self.num_frq = num_frq self.num_disp_points = num_disp_points + self.exp_types = exp_types self.values = values self.errors = errors self.missing = missing @@ -416,9 +417,16 @@ # The CPMG and R1rho single models. if self.model in MODEL_LIST_CPMG + MODEL_LIST_R1RHO: + # Remove the first dimension of the data structures. self.values = self.values[0] self.errors = self.errors[0] self.missing = self.missing[0] + + # Check that the data is correct. + if self.model in MODEL_LIST_CPMG and self.exp_types[0] in EXP_TYPE_LIST_R1RHO: + raise RelaxError("The '%s' CPMG model is not compatible with the R1rho experiment type." % self.model) + if self.model in MODEL_LIST_R1RHO and self.exp_types[0] in EXP_TYPE_LIST_CPMG: + raise RelaxError("The '%s' R1rho model is not compatible with the CPMG experiment type." % self.model) def func_CR72(self, params):