Author: bugman Date: Fri Sep 17 14:57:56 2010 New Revision: 11602 URL: http://svn.gna.org/viewcvs/relax?rev=11602&view=rev Log: Running relax in debugging mode now turns threading and the relax controller off for the auto analyses. The model-free and Rx auto-analyses can now be easily debugged! Modified: branches/bieri_gui/gui_bieri/analyses/auto_model_free.py branches/bieri_gui/gui_bieri/analyses/auto_rx_base.py Modified: branches/bieri_gui/gui_bieri/analyses/auto_model_free.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/analyses/auto_model_free.py?rev=11602&r1=11601&r2=11602&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/analyses/auto_model_free.py (original) +++ branches/bieri_gui/gui_bieri/analyses/auto_model_free.py Fri Sep 17 14:57:56 2010 @@ -25,6 +25,7 @@ """Module for the automatic model-free protocol frame.""" # Python module imports. +import __main__ from os import getcwd, sep from string import replace import sys @@ -652,7 +653,8 @@ which_model = self.choose_global_model(False) # Display the relax controller. - self.gui.controller.Show() + if not __main__.debug: + self.gui.controller.Show() # Solve for all global models. if which_model == 'full': @@ -828,12 +830,15 @@ thread_cont = self.gui.calc_threads[-1] # Start the thread. - id = thread.start_new_thread(self.execute_thread, (), {'global_model': global_model, 'automatic': automatic}) - - # Add the thread info to the container. - thread_cont.id = id - thread_cont.analysis_type = 'model-free' - thread_cont.global_model = global_model + if __main__.debug: + self.execute_thread(global_model=global_model, automatic=automatic) + else: + id = thread.start_new_thread(self.execute_thread, (), {'global_model': global_model, 'automatic': automatic}) + + # Add the thread info to the container. + thread_cont.id = id + thread_cont.analysis_type = 'model-free' + thread_cont.global_model = global_model def execute_thread(self, global_model=None, automatic=True): @@ -852,14 +857,16 @@ # Value for progress bar during Monte Carlo simulation. self.gui.calc_threads[-1].progress = 5.0 - # Redirect relax output and errors to the controller. - redir = Redirect_text(self.gui.controller) - sys.stdout = redir - #sys.stderr = redir - - # Print a header in the controller. - wx.CallAfter(self.gui.controller.log_panel.AppendText, ('Starting Model-free calculation\n------------------------------------------\n\n') ) - time.sleep(0.5) + # Controller. + if not __main__.debug: + # Redirect relax output and errors to the controller. + redir = Redirect_text(self.gui.controller) + sys.stdout = redir + #sys.stderr = redir + + # Print a header in the controller. + wx.CallAfter(self.gui.controller.log_panel.AppendText, ('Starting Model-free calculation\n------------------------------------------\n\n') ) + time.sleep(0.5) # Start the protocol. dAuvergne_protocol(save_dir=data.save_dir, diff_model=global_model, mf_models=data.mf_models, local_tm_models=data.local_tm_models, pdb_file=data.structure_file, seq_args=data.seq_args, het_name=data.het_name, relax_data=data.relax_data, unres=data.unres, exclude=data.exclude, bond_length=data.bond_length, csa=data.csa, hetnuc=data.hetnuc, proton=data.proton, grid_inc=data.inc, min_algor=data.min_algor, mc_num=data.mc_num, max_iter=data.max_iter, conv_loop=data.conv_loop) Modified: branches/bieri_gui/gui_bieri/analyses/auto_rx_base.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/analyses/auto_rx_base.py?rev=11602&r1=11601&r2=11602&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/analyses/auto_rx_base.py (original) +++ branches/bieri_gui/gui_bieri/analyses/auto_rx_base.py Fri Sep 17 14:57:56 2010 @@ -25,6 +25,7 @@ """Module containing the base class for the automatic R1 and R2 analysis frames.""" # Python module imports. +import __main__ from os import sep from string import replace import sys @@ -421,10 +422,14 @@ self.sync_ds(upload=True) # Display the relax controller. - self.gui.controller.Show() + if not __main__.debug: + self.gui.controller.Show() # Start the thread. - id = thread.start_new_thread(self.execute_thread, ('dummy',)) + if __main__.debug: + self.execute_thread('dummy') + else: + id = thread.start_new_thread(self.execute_thread, ('dummy',)) # Terminate the event. event.Skip() @@ -433,19 +438,26 @@ def execute_thread(self, dummy_string): """Execute the calculation in a thread.""" - # Redirect relax output and errors to the controller. - redir = Redirect_text(self.gui.controller) - sys.stdout = redir - sys.stderr = redir - - # Print a header in the controller. - header = 'Starting %s calculation' % self.label - underline = '-' * len(header) - wx.CallAfter(self.gui.controller.log_panel.AppendText, (header+'\n\n')) - time.sleep(0.5) + # Controller. + if not __main__.debug: + # Redirect relax output and errors to the controller. + redir = Redirect_text(self.gui.controller) + sys.stdout = redir + sys.stderr = redir + + # Print a header in the controller. + header = 'Starting %s calculation' % self.label + underline = '-' * len(header) + wx.CallAfter(self.gui.controller.log_panel.AppendText, (header+'\n\n')) + time.sleep(0.5) # Assemble all the data needed for the Relax_fit class. - data = self.assemble_data() + data, complete = self.assemble_data() + + # Incomplete. + if not complete: + missing_data() + return # Execute. Relax_fit(filename=self.filename, pipe_name='rx'+'_'+str(time.asctime(time.localtime())),seq_args=data.seq_args, results_directory=data.save_dir, file_names=data.file_names, relax_times=data.relax_times, int_method=data.int_method, mc_num=data.mc_num, pdb_file=data.structure_file, unresolved=data.unresolved, view_plots = False, heteronuc=data.heteronuc, proton=data.proton, load_spin_ids=data.load_spin_ids, inc=data.inc)