mailr10075 - in /1.3: generic_fns/pcs.py prompt/pcs.py


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

Header


Content

Posted by edward on December 09, 2009 - 10:21:
Author: bugman
Date: Wed Dec  9 10:21:33 2009
New Revision: 10075

URL: http://svn.gna.org/viewcvs/relax?rev=10075&view=rev
Log:
Added a verbosity arg to pcs.centre() to allow this thing to be silenced!


Modified:
    1.3/generic_fns/pcs.py
    1.3/prompt/pcs.py

Modified: 1.3/generic_fns/pcs.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/pcs.py?rev=10075&r1=10074&r2=10075&view=diff
==============================================================================
--- 1.3/generic_fns/pcs.py (original)
+++ 1.3/generic_fns/pcs.py Wed Dec  9 10:21:33 2009
@@ -135,7 +135,7 @@
         spin.relax_sim_data.append(values)
 
 
-def centre(pos=None, atom_id=None, pipe=None, ave_pos=False, force=False):
+def centre(pos=None, atom_id=None, pipe=None, verbosity=1, ave_pos=False, 
force=False):
     """Specify the atom in the loaded structure corresponding to the 
paramagnetic centre.
 
     @keyword pos:       The atomic position.  If set, the atom_id string 
will be ignored.
@@ -144,6 +144,8 @@
     @type atom_id:      str
     @keyword pipe:      An alternative data pipe to extract the paramagnetic 
centre from.
     @type pipe:         None or str
+    @keyword verbosity: The amount of information to print out.  The bigger 
the number, the more information.
+    @type verbosity:    int
     @keyword ave_pos:   A flag which if True causes the atomic positions 
from multiple models to be averaged.
     @type ave_pos:      bool
     @keyword force:     A flag which if True will cause the current PCS 
centre to be overwritten.
@@ -204,18 +206,21 @@
     centre = centre / float(num_pos)
 
     # Print out.
-    print("Paramagnetic centres located at:")
-    for pos in full_pos_list:
-        print(("    [%8.3f, %8.3f, %8.3f]" % (pos[0], pos[1], pos[2])))
-    print("\nAverage paramagnetic centre located at:")
-    print(("    [%8.3f, %8.3f, %8.3f]" % (centre[0], centre[1], centre[2])))
+    if verbosity:
+        print("Paramagnetic centres located at:")
+        for pos in full_pos_list:
+            print(("    [%8.3f, %8.3f, %8.3f]" % (pos[0], pos[1], pos[2])))
+        print("\nAverage paramagnetic centre located at:")
+        print(("    [%8.3f, %8.3f, %8.3f]" % (centre[0], centre[1], 
centre[2])))
 
     # Set the centre (place it into the current data pipe).
     if ave_pos:
-        print("\nUsing the average paramagnetic position.")
+        if verbosity:
+            print("\nUsing the average paramagnetic position.")
         cdp.paramagnetic_centre = centre
     else:
-        print("\nUsing all paramagnetic positions.")
+        if verbosity:
+            print("\nUsing all paramagnetic positions.")
         cdp.paramagnetic_centre = full_pos_list
 
 

Modified: 1.3/prompt/pcs.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/pcs.py?rev=10075&r1=10074&r2=10075&view=diff
==============================================================================
--- 1.3/prompt/pcs.py (original)
+++ 1.3/prompt/pcs.py Wed Dec  9 10:21:33 2009
@@ -59,7 +59,7 @@
         pcs.back_calc(align_id=align_id)
 
 
-    def centre(self, pos=None, atom_id=None, pipe=None, ave_pos=True, 
force=False):
+    def centre(self, pos=None, atom_id=None, pipe=None, verbosity=1, 
ave_pos=True, force=False):
         """Specify which atom is the paramagnetic centre.
 
         Keyword Arguments
@@ -70,6 +70,8 @@
         atom_id:  The atom ID string.
 
         pipe:  The data pipe containing the structures to extract the centre 
from.
+
+        verbosity:  The amount of information to print out.
 
         ave_pos:  A flag specifying if the position of the atom is to be 
averaged across all models.
 
@@ -120,6 +122,7 @@
             text = text + "pos=" + repr(pos)
             text = text + ", atom_id=" + repr(atom_id)
             text = text + ", pipe=" + repr(pipe)
+            text = text + ", verbosity=" + repr(verbosity)
             text = text + ", ave_pos=" + repr(ave_pos)
             text = text + ", force=" + repr(force) + ")"
             print(text)
@@ -128,11 +131,12 @@
         arg_check.is_num_list(pos, 'atomic position', can_be_none=True)
         arg_check.is_str(atom_id, 'atom ID string', can_be_none=True)
         arg_check.is_str(pipe, 'data pipe', can_be_none=True)
+        arg_check.is_int(verbosity, 'verbosity level')
         arg_check.is_bool(ave_pos, 'average position flag')
         arg_check.is_bool(force, 'force flag')
 
         # Execute the functional code.
-        pcs.centre(pos=pos, atom_id=atom_id, pipe=pipe, ave_pos=ave_pos, 
force=force)
+        pcs.centre(pos=pos, atom_id=atom_id, pipe=pipe, verbosity=verbosity, 
ave_pos=ave_pos, force=force)
 
 
     def copy(self, pipe_from=None, pipe_to=None, align_id=None):




Related Messages


Powered by MHonArc, Updated Wed Dec 09 11:40:02 2009