Author: tlinnet Date: Tue Aug 12 10:54:43 2014 New Revision: 24986 URL: http://svn.gna.org/viewcvs/relax?rev=24986&view=rev Log: Modified nesting function to return all model info for the current model, and the comparable model. sr #3135(https://gna.org/support/?3135): Optimisation of the R1 relaxation rate for the off-resonance R1rho relaxation dispersion models. Modified: branches/R1_fitting/auto_analyses/relax_disp.py branches/R1_fitting/specific_analyses/relax_disp/variables.py branches/R1_fitting/test_suite/unit_tests/_specific_analyses/_relax_disp/test_variables.py Modified: branches/R1_fitting/auto_analyses/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/R1_fitting/auto_analyses/relax_disp.py?rev=24986&r1=24985&r2=24986&view=diff ============================================================================== --- branches/R1_fitting/auto_analyses/relax_disp.py (original) +++ branches/R1_fitting/auto_analyses/relax_disp.py Tue Aug 12 10:54:43 2014 @@ -287,9 +287,9 @@ subsection(file=sys.stdout, text="Nesting and model equivalence checks", prespace=1) # The simpler model. - nested_model = nesting_model(self_models=self.models, model=model) - if nested_model != None: - nested_pipe = self.name_pipe(nested_model) + model_info, comparable_model_info = nesting_model(self_models=self.models, model=model) + if comparable_model_info != None: + nested_pipe = self.name_pipe(comparable_model_info.model) else: nested_pipe = None Modified: branches/R1_fitting/specific_analyses/relax_disp/variables.py URL: http://svn.gna.org/viewcvs/relax/branches/R1_fitting/specific_analyses/relax_disp/variables.py?rev=24986&r1=24985&r2=24986&view=diff ============================================================================== --- branches/R1_fitting/specific_analyses/relax_disp/variables.py (original) +++ branches/R1_fitting/specific_analyses/relax_disp/variables.py Tue Aug 12 10:54:43 2014 @@ -844,8 +844,8 @@ @type self_models: list of str @keyword model: The current model to analyse. @type model: str - @return: The model to nest from. - @rtype: str + @return: The current model info, the possible nest model info. + @rtype: class, class """ @@ -878,7 +878,7 @@ # Loop over the list of comparable models, if the parameters are the same, return that as nested model. for compa_model in compa_models: if compa_model.params == model_info.params: - return compa_model.model + return model_info, compa_model # Loop over the list of comparable models, if the parameters (other than R20 params) are the same, return that as nested model. for compa_model in compa_models: @@ -891,7 +891,7 @@ # If the partial params are the same, then return that model. if part_compa_model_params == part_model_params: - return compa_model.model + return model_info, compa_model # Loop over the list of comparable models, if the parameters are part of the more complex model, return that as nested model. for compa_model in compa_models: @@ -915,7 +915,7 @@ # If all parameters are found in the more complex model. if param_in: - return compa_model.model + return model_info, compa_model # Special case for LM63 if model == MODEL_LM63_3SITE: @@ -923,7 +923,7 @@ for compa_model in compa_models: # If one of the comparable models is MODEL_LM63, return this. if compa_model.model == MODEL_LM63: - return compa_model.model + return model_info, compa_model # Special case for MODEL_NS_MMQ_3SITE or MODEL_NS_MMQ_3SITE_LINEAR, getting parameters from MODEL_NS_MMQ_2SITE. elif model in [MODEL_NS_MMQ_3SITE, MODEL_NS_MMQ_3SITE_LINEAR]: @@ -931,7 +931,7 @@ for compa_model in compa_models: # If one of the comparable models is MODEL_NS_MMQ_2SITE, return this. if compa_model.model == MODEL_NS_MMQ_2SITE: - return compa_model.model + return model_info, compa_model # Special case for MODEL_NS_R1RHO_3SITE or MODEL_NS_R1RHO_3SITE_LINEAR, getting parameters from MODEL_NS_R1RHO_2SITE. elif model in [MODEL_NS_R1RHO_3SITE, MODEL_NS_R1RHO_3SITE_LINEAR]: @@ -939,7 +939,7 @@ for compa_model in compa_models: # If one of the comparable models is MODEL_NS_MMQ_2SITE, return this. if compa_model.model == MODEL_NS_R1RHO_2SITE: - return compa_model.model + return model_info, compa_model # Special case for DPL94. elif model in [MODEL_DPL94, MODEL_DPL94_FIT_R1]: @@ -947,7 +947,7 @@ for compa_model in compa_models: # If one of the comparable models is in list with R1rho R1, return this. if compa_model.model in MODEL_LIST_R1RHO_W_R1_ONLY + MODEL_LIST_R1RHO_FIT_R1_ONLY: - return compa_model.model + return model_info, compa_model # If there is no comparable models according to EXP_TYPE, check if some models can be nested anyway. @@ -961,7 +961,7 @@ for compa_model in compa_models: # If one of the comparable models is MODEL_CR72, return this. if compa_model.model == MODEL_CR72: - return compa_model.model + return model_info, compa_model else: - return None + return model_info, None Modified: branches/R1_fitting/test_suite/unit_tests/_specific_analyses/_relax_disp/test_variables.py URL: http://svn.gna.org/viewcvs/relax/branches/R1_fitting/test_suite/unit_tests/_specific_analyses/_relax_disp/test_variables.py?rev=24986&r1=24985&r2=24986&view=diff ============================================================================== --- branches/R1_fitting/test_suite/unit_tests/_specific_analyses/_relax_disp/test_variables.py (original) +++ branches/R1_fitting/test_suite/unit_tests/_specific_analyses/_relax_disp/test_variables.py Tue Aug 12 10:54:43 2014 @@ -91,7 +91,7 @@ model = MODEL_NS_CPMG_2SITE_STAR # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_NS_CPMG_2SITE_3D) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_NS_CPMG_2SITE_3D) ## Test numerical full model return. # Define all the models tested in the analysis. @@ -101,7 +101,7 @@ model = MODEL_NS_CPMG_2SITE_STAR_FULL # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_NS_CPMG_2SITE_3D_FULL) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_NS_CPMG_2SITE_3D_FULL) ## Test silico simple return from a full model request. # Define all the models tested in the analysis. @@ -111,7 +111,7 @@ model = MODEL_B14_FULL # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_NS_CPMG_2SITE_EXPANDED) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_NS_CPMG_2SITE_EXPANDED) ## Test LM63 model request. # Define all the models tested in the analysis. @@ -121,7 +121,7 @@ model = MODEL_LM63_3SITE # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_LM63) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_LM63) ## Test MODEL_CR72_FULL model request. # Define all the models tested in the analysis. @@ -131,7 +131,7 @@ model = MODEL_CR72_FULL # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_CR72) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_CR72) ## Test MODEL_CR72_FULL model request, when models are ordered different. # Define all the models tested in the analysis. @@ -141,7 +141,7 @@ model = MODEL_CR72_FULL # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_B14_FULL) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_B14_FULL) def test_nesting_model_cpmg_mmq(self): @@ -155,7 +155,7 @@ model = MODEL_MMQ_CR72 # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_CR72) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_CR72) ## Test MODEL_NS_MMQ_3SITE_LINEAR model request, when models are MODEL_NS_MMQ_2SITE. # Define all the models tested in the analysis. @@ -165,7 +165,7 @@ model = MODEL_NS_MMQ_3SITE_LINEAR # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_NS_MMQ_2SITE) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_NS_MMQ_2SITE) ## Test MODEL_NS_MMQ_3SITE model request, when models are MODEL_NS_MMQ_3SITE_LINEAR. # Define all the models tested in the analysis. @@ -175,7 +175,7 @@ model = MODEL_NS_MMQ_3SITE # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_NS_MMQ_3SITE_LINEAR) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_NS_MMQ_3SITE_LINEAR) ## Test MODEL_NS_MMQ_3SITE model request, when models are MODEL_NS_MMQ_2SITE. # Define all the models tested in the analysis. @@ -185,7 +185,7 @@ model = MODEL_NS_MMQ_3SITE # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_NS_MMQ_2SITE) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_NS_MMQ_2SITE) def test_nesting_model_r1rho_ns(self): @@ -199,7 +199,7 @@ model = MODEL_NS_R1RHO_3SITE_LINEAR # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_NS_R1RHO_2SITE) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_NS_R1RHO_2SITE) ## Test MODEL_NS_R1RHO_3SITE model request, when models are MODEL_NS_R1RHO_3SITE_LINEAR. # Define all the models tested in the analysis. @@ -209,7 +209,7 @@ model = MODEL_NS_R1RHO_3SITE # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_NS_R1RHO_3SITE_LINEAR) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_NS_R1RHO_3SITE_LINEAR) ## Test MODEL_NS_R1RHO_3SITE model request, when models are MODEL_NS_R1RHO_2SITE. # Define all the models tested in the analysis. @@ -219,7 +219,7 @@ model = MODEL_NS_R1RHO_3SITE # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_NS_R1RHO_2SITE) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_NS_R1RHO_2SITE) def test_nesting_model_r1rho(self): @@ -233,7 +233,7 @@ model = MODEL_MP05_FIT_R1 # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_TAP03_FIT_R1) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_TAP03_FIT_R1) ## Test MODEL_TP02_FIT_R1 model request, when models are all R1rho models with fitted R1, and MODEL_NS_R1RHO_2SITE_FIT_R1 was fitted first. # Define all the models tested in the analysis. @@ -243,7 +243,7 @@ model = MODEL_TP02_FIT_R1 # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_NS_R1RHO_2SITE_FIT_R1) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_NS_R1RHO_2SITE_FIT_R1) ## Test MODEL_DPL94_FIT_R1 model request, when models are all R1rho models with fitted R1, and MODEL_NS_R1RHO_2SITE_FIT_R1 was fitted first. # Define all the models tested in the analysis. @@ -253,7 +253,7 @@ model = MODEL_DPL94_FIT_R1 # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_NS_R1RHO_2SITE_FIT_R1) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_NS_R1RHO_2SITE_FIT_R1) ## Test MODEL_TP02_FIT_R1 model request, when model are all R1rho models with fitted R1, and MODEL_DPL94_FIT_R1 was fitted first. # Define all the models tested in the analysis. @@ -263,4 +263,4 @@ model = MODEL_TP02_FIT_R1 # Test the return. - self.assertEqual(nesting_model(self_models=self_models, model=model), MODEL_DPL94_FIT_R1) + self.assertEqual(nesting_model(self_models=self_models, model=model)[1].model, MODEL_DPL94_FIT_R1)