Author: bugman Date: Tue Aug 9 15:47:41 2011 New Revision: 14296 URL: http://svn.gna.org/viewcvs/relax?rev=14296&view=rev Log: Modified the dauvergne_protocol auto-analysis to be able to loop over all the global models. The diff_model arg can now be a list of global model names, allowing the protocol to loop over each diffusion model. Modified: branches/gui_testing/auto_analyses/dauvergne_protocol.py branches/gui_testing/gui/analyses/auto_model_free.py Modified: branches/gui_testing/auto_analyses/dauvergne_protocol.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/auto_analyses/dauvergne_protocol.py?rev=14296&r1=14295&r2=14296&view=diff ============================================================================== --- branches/gui_testing/auto_analyses/dauvergne_protocol.py (original) +++ branches/gui_testing/auto_analyses/dauvergne_protocol.py Tue Aug 9 15:47:41 2011 @@ -24,6 +24,7 @@ from os import F_OK, access, getcwd, listdir, sep from re import search from string import lower +from time import sleep # relax module imports. from doc_builder import LIST, PARAGRAPH, SECTION, SUBSECTION, TITLE, to_docstring @@ -125,8 +126,8 @@ @keyword pipe_name: The name of the data pipe containing the sequence info. This data pipe should have all values set including the CSA value, the bond length, the heteronucleus name and proton name. It should also have all relaxation data loaded. @keyword results_dir: The directory, where files are saved in. @type results_dir: str - @keyword diff_model: The global diffusion model to optimise. This can be one of 'local_tm', 'sphere', 'oblate', 'prolate', 'ellipsoid', or 'final'. - @type diff_model: str + @keyword diff_model: The global diffusion model to optimise. This can be one of 'local_tm', 'sphere', 'oblate', 'prolate', 'ellipsoid', or 'final'. If all or a subset of these are supplied as a list, then these will be automatically looped over and calculated. + @type diff_model: str or list of str @keyword mf_models: The model-free models. @type mf_models: list of str @keyword local_tm_models: The model-free models. @@ -152,7 +153,6 @@ # Store the args. self.pipe_name = pipe_name - self.diff_model = diff_model self.mf_models = mf_models self.local_tm_models = local_tm_models self.grid_inc = grid_inc @@ -162,6 +162,12 @@ self.max_iter = max_iter self.conv_loop = conv_loop + # The diffusion models. + if isinstance(diff_model, list): + self.diff_model_list = diff_model + else: + self.diff_model_list = [diff_model] + # Project directory (i.e. directory containing the model-free model results and the newly generated files) if results_dir: self.results_dir = results_dir + sep @@ -178,21 +184,6 @@ # Some info for the status. self.status_setup() - # Initialise the convergence data structures. - self.conv_data = Container() - self.conv_data.chi2 = [] - self.conv_data.models = [] - self.conv_data.diff_vals = [] - if self.diff_model == 'sphere': - self.conv_data.diff_params = ['tm'] - elif self.diff_model == 'oblate' or self.diff_model == 'prolate': - self.conv_data.diff_params = ['tm', 'Da', 'theta', 'phi'] - elif self.diff_model == 'ellipsoid': - self.conv_data.diff_params = ['tm', 'Da', 'Dr', 'alpha', 'beta', 'gamma'] - self.conv_data.spin_ids = [] - self.conv_data.mf_params = [] - self.conv_data.mf_vals = [] - # Load the interpreter. self.interpreter = Interpreter(show_script=False, quit=False, raise_relax_error=True) self.interpreter.populate_self() @@ -205,7 +196,33 @@ # Execute the protocol. try: - self.execute() + # Loop over the models. + for self.diff_model in self.diff_model_list: + # Wait a little while between diffusion models. + sleep(1) + + # Set the global model name. + status.auto_analysis[self.pipe_name].diff_model = self.diff_model + + # Initialise the convergence data structures. + self.conv_data = Container() + self.conv_data.chi2 = [] + self.conv_data.models = [] + self.conv_data.diff_vals = [] + if self.diff_model == 'sphere': + self.conv_data.diff_params = ['tm'] + elif self.diff_model == 'oblate' or self.diff_model == 'prolate': + self.conv_data.diff_params = ['tm', 'Da', 'theta', 'phi'] + elif self.diff_model == 'ellipsoid': + self.conv_data.diff_params = ['tm', 'Da', 'Dr', 'alpha', 'beta', 'gamma'] + self.conv_data.spin_ids = [] + self.conv_data.mf_params = [] + self.conv_data.mf_vals = [] + + # Execute the analysis for each diffusion model. + self.execute() + + # Clean up. finally: # Finish and unlock execution. status.auto_analysis[self.pipe_name].fin = True @@ -218,8 +235,9 @@ # The diff model. valid_models = ['local_tm', 'sphere', 'oblate', 'prolate', 'ellipsoid', 'final'] - if self.diff_model not in valid_models: - raise RelaxError("The self.diff_model user variable '%s' is incorrectly set. It must be one of %s." % (self.diff_model, valid_models)) + for i in range(len(self.diff_model_list)): + if self.diff_model_list[i] not in valid_models: + raise RelaxError("The diff_model value '%s' is incorrectly set. It must be one of %s." % (self.diff_model_list[i], valid_models)) # Model-free models. mf_models = ['m0', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9'] @@ -809,7 +827,7 @@ status.current_analysis = self.pipe_name # The global diffusion model. - status.auto_analysis[self.pipe_name].diff_model = self.diff_model + status.auto_analysis[self.pipe_name].diff_model = None # The round of optimisation, i.e. the global iteration. status.auto_analysis[self.pipe_name].round = None Modified: branches/gui_testing/gui/analyses/auto_model_free.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/auto_model_free.py?rev=14296&r1=14295&r2=14296&view=diff ============================================================================== --- branches/gui_testing/gui/analyses/auto_model_free.py (original) +++ branches/gui_testing/gui/analyses/auto_model_free.py Tue Aug 9 15:47:41 2011 @@ -731,10 +731,8 @@ def run_analysis(self): """Execute the calculation.""" - # Loop over the models. - for global_model in self.data.global_models: - # Start the protocol. - dauvergne_protocol.dAuvergne_protocol(pipe_name=self.data.pipe_name, results_dir=self.data.save_dir, diff_model=global_model, mf_models=self.data.mf_models, local_tm_models=self.data.local_tm_models, grid_inc=self.data.inc, diff_tensor_grid_inc=self.data.diff_tensor_grid_inc, mc_sim_num=self.data.mc_sim_num, max_iter=self.data.max_iter, conv_loop=self.data.conv_loop) + # Start the protocol. + dauvergne_protocol.dAuvergne_protocol(pipe_name=self.data.pipe_name, results_dir=self.data.save_dir, diff_model=self.data.global_models, mf_models=self.data.mf_models, local_tm_models=self.data.local_tm_models, grid_inc=self.data.inc, diff_tensor_grid_inc=self.data.diff_tensor_grid_inc, mc_sim_num=self.data.mc_sim_num, max_iter=self.data.max_iter, conv_loop=self.data.conv_loop)