mailr19741 - in /branches/relax_disp: specific_analyses/relax_disp/cpmgfit.py user_functions/relax_disp.py


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

Header


Content

Posted by edward on May 24, 2013 - 19:06:
Author: bugman
Date: Fri May 24 19:06:08 2013
New Revision: 19741

URL: http://svn.gna.org/viewcvs/relax?rev=19741&view=rev
Log:
The relax_disp.cpmgfit_execute user function now correctly calls CPMGFit.

The -grid command line option has been added and the output for each spin is 
sent to a special
output file.


Modified:
    branches/relax_disp/specific_analyses/relax_disp/cpmgfit.py
    branches/relax_disp/user_functions/relax_disp.py

Modified: branches/relax_disp/specific_analyses/relax_disp/cpmgfit.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/cpmgfit.py?rev=19741&r1=19740&r2=19741&view=diff
==============================================================================
--- branches/relax_disp/specific_analyses/relax_disp/cpmgfit.py (original)
+++ branches/relax_disp/specific_analyses/relax_disp/cpmgfit.py Fri May 24 
19:06:08 2013
@@ -82,15 +82,19 @@
     # Loop over each spin.
     for spin, spin_id in spin_loop(return_id=True, skip_desel=True):
         # The spin input file name.
-        file_name = dir + sep + spin_file_name(spin_id=spin_id)
-        if not access(file_name, F_OK):
-            raise RelaxFileError("spin input", file_name)
+        file_in = dir + sep + spin_file_name(spin_id=spin_id)
+        if not access(file_in, F_OK):
+            raise RelaxFileError("spin input", file_in)
+
+        # The spin output file name.
+        file_out = dir + sep + spin_file_name(spin_id=spin_id, output=True)
 
         # Test the binary file string corresponds to a valid executable.
         test_binary(binary)
 
         # Execute CPMGFit.
-        cmd = "%s -xmgr -f %s\n" % (binary, file_name)
+        cmd = "%s -grid -xmgr -f %s | tee %s\n" % (binary, file_in, file_out)
+        print("\n\n%s" % cmd)
         pipe = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, 
close_fds=False)
 
         # Close the pipe.
@@ -239,16 +243,25 @@
     return file_name
 
 
-def spin_file_name(spin_id=None):
+def spin_file_name(spin_id=None, output=False):
     """Generate the unique file name for the given spin ID.
 
     @keyword spin_id:   The spin ID string.
     @type spin_id:      str
+    @keyword output:    A flag which if True will cause the CPMGFit output 
rather than input name to be returned.
     @return:            The file name.
     @rtype:             str
     """
 
-    return "spin_%s.in" % spin_id
+    # Construct the name.
+    name = "spin_%s." % spin_id
+    if output:
+        name += "out"
+    else:
+        name += "in"
+
+    # Return the file name.
+    return name
 
 
 def translate_model():

Modified: branches/relax_disp/user_functions/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/user_functions/relax_disp.py?rev=19741&r1=19740&r2=19741&view=diff
==============================================================================
--- branches/relax_disp/user_functions/relax_disp.py (original)
+++ branches/relax_disp/user_functions/relax_disp.py Fri May 24 19:06:08 2013
@@ -157,7 +157,7 @@
 # Description.
 uf.desc.append(Desc_container())
 uf.desc[-1].add_paragraph("CPMGFit will be executed once per spin as:")
-uf.desc[-1].add_prompt("$ cpmgfit -xmgr -f dir/spin_x.in")
+uf.desc[-1].add_prompt("$ cpmgfit -grid -xmgr -f dir/spin_x.in | tee 
dir/spin_x.out")
 uf.desc[-1].add_paragraph("where x is replaced by each spin ID string.  If 
you would like to use a different CPMGFit executable file, change the binary 
name to the appropriate file name.  If the file is not located within the 
environment's path, be sure to include the full path in front of the binary 
file name so it can be found.")
 uf.backend = cpmgfit_execute
 uf.menu_text = "&cpmgfit_execute"




Related Messages


Powered by MHonArc, Updated Mon May 27 13:20:02 2013