mailr10141 - /branches/multi_processor_merge/specific_fns/model_free/multi_processor_commands.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on January 07, 2010 - 17:33:
Author: bugman
Date: Thu Jan  7 17:33:05 2010
New Revision: 10141

URL: http://svn.gna.org/viewcvs/relax?rev=10141&view=rev
Log:
Clean up of the code before and after minfx execution.

This includes a number of simplifications.  pre_command_feed_back() is now 
called
initial_printout().  post_command_feedback() has been deleted.  This was for 
a kludge which can be
avoided by setting the minfx printout arg to zero.  The calls to 
set_generic_pre_and_post_amble()
and set_grid_pre_and_post_amble() were part of this kludge and are 
eliminated.  The self.silence
flag is now used to silence printouts when desired.


Modified:
    
branches/multi_processor_merge/specific_fns/model_free/multi_processor_commands.py

Modified: 
branches/multi_processor_merge/specific_fns/model_free/multi_processor_commands.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor_merge/specific_fns/model_free/multi_processor_commands.py?rev=10141&r1=10140&r2=10141&view=diff
==============================================================================
--- 
branches/multi_processor_merge/specific_fns/model_free/multi_processor_commands.py
 (original)
+++ 
branches/multi_processor_merge/specific_fns/model_free/multi_processor_commands.py
 Thu Jan  7 17:33:05 2010
@@ -168,9 +168,12 @@
         # A map containing generic information.
         self.info_map = {'spin_id':None, 'sim_index':None, 'grid_size':1}
 
-
-    def do_feedback(self):
-        """Minimisation print out."""
+        # A flag for silencing output.
+        self.silence = False
+
+
+    def initial_printout(self):
+        """Generate some print outs for normal analysis."""
 
         # Only print out if verbosity is turned on.
         if self.minimise_map['print_flag'] >= 1:
@@ -187,14 +190,6 @@
                 print(len(string) * '~')
 
 
-    def post_command_feedback(self, results, processor):
-        pass
-
-
-    def pre_command_feed_back(self, processor):
-        self.do_feedback()
-
-
     # rename confusing with processor process_results
     def process_results(self, results, processor, completed):
 
@@ -215,10 +210,14 @@
     def run(self, processor, completed):
         """Execute the model-free optimisation."""
 
+        # Silencing.
+        if self.silence:
+            self.minimise_map['print_flag'] = 0
+
         # Run catching all errors.
         try:
-            # Set up.
-            self.pre_command_feed_back(processor)
+            # Initial print outs.
+            self.initial_printout()
 
             # Initialise the function to minimise.
             self.mf = Mf(**self.mf_map)
@@ -227,7 +226,6 @@
             results = generic_minimise(func=self.mf.func, 
dfunc=self.mf.dfunc, d2func=self.mf.d2func, **self.minimise_map)
 
             # Processing.
-            self.post_command_feedback(results, processor)
             self.process_results(results, processor, completed)
 
         # An error occurred.
@@ -276,15 +274,14 @@
         # Execute the base class __init__() method.
         super(MF_grid_command, self).__init__()
 
-
-    def post_command_feedback(self, results, processor):
-        set_generic_pre_and_post_amble(True)
-        set_grid_pre_and_post_amble(True)
-
-
-    def pre_command_feed_back(self, processor):
-        set_generic_pre_and_post_amble(False)
-        set_grid_pre_and_post_amble(False)
+        # A flag for silencing output.
+        self.silence = True
+
+
+    def initial_printout(self, processor):
+        """Dummy method to overwrite the base class method."""
+
+        pass
 
 
     def process_results(self, results, processor, completed):




Related Messages


Powered by MHonArc, Updated Thu Jan 07 17:40:02 2010