mailr8136 - /1.3/generic_fns/grace.py


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

Header


Content

Posted by edward on December 04, 2008 - 18:13:
Author: bugman
Date: Thu Dec  4 18:13:21 2008
New Revision: 8136

URL: http://svn.gna.org/viewcvs/relax?rev=8136&view=rev
Log:
Complete fix for bug #12679 (https://gna.org/bugs/index.php?12679).

This bug was reported by Michael Funk (mifu att nmr dot mpibpc dot mpg dot 
de).

The last issue was that when there multiple graphs, one per spin, the spin 
labels for the graphs
were set to the x-axis values rather than the spin_id.


Modified:
    1.3/generic_fns/grace.py

Modified: 1.3/generic_fns/grace.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/grace.py?rev=8136&r1=8135&r2=8136&view=diff
==============================================================================
--- 1.3/generic_fns/grace.py (original)
+++ 1.3/generic_fns/grace.py Thu Dec  4 18:13:21 2008
@@ -31,7 +31,7 @@
 
 # relax module imports.
 import generic_fns
-from generic_fns.mol_res_spin import count_molecules, count_residues, 
count_spins, exists_mol_res_spin_data, spin_loop
+from generic_fns.mol_res_spin import count_molecules, count_residues, 
count_spins, exists_mol_res_spin_data, generate_spin_id, spin_loop
 from generic_fns import pipes
 from relax_errors import RelaxError, RelaxNoSequenceError, RelaxNoSimError, 
RelaxRegExpError
 from relax_io import get_file_path, open_write_file, test_binary
@@ -313,6 +313,11 @@
     # Get the data.
     data = get_data(spin_id, x_data_type=x_data_type, 
y_data_type=y_data_type, plot_data=plot_data)
 
+    # Generate the spin_ids for all the data.
+    spin_ids = []
+    for line in data:
+        spin_ids.append(generate_spin_id(line[0], line[1], line[2], line[3], 
line[4]))
+
     # No data, so close the empty file and exit.
     if data == None or data == []:
         warn(RelaxWarning("No data could be found, creating an empty file."))
@@ -330,7 +335,7 @@
     # Multiple data sets.
     if multi:
         # Write the header.
-        write_multi_header(data, file=file, spin_id=spin_id, 
x_data_type=x_data_type, y_data_type=y_data_type, 
x_return_units=x_return_units, y_return_units=y_return_units, 
x_return_grace_string=x_return_grace_string, 
y_return_grace_string=y_return_grace_string, norm=norm)
+        write_multi_header(data, file=file, spin_ids=spin_ids, 
x_data_type=x_data_type, y_data_type=y_data_type, 
x_return_units=x_return_units, y_return_units=y_return_units, 
x_return_grace_string=x_return_grace_string, 
y_return_grace_string=y_return_grace_string, norm=norm)
 
         # Write the data.
         write_multi_data(data, file=file, graph_type=graph_type, norm=norm)
@@ -573,15 +578,15 @@
         file.write("&\n")
 
 
-def write_multi_header(data, file=None, spin_id=None, x_data_type=None, 
y_data_type=None, x_return_units=None, y_return_units=None, 
x_return_grace_string=None, y_return_grace_string=None, norm=False):
+def write_multi_header(data, file=None, spin_ids=None, x_data_type=None, 
y_data_type=None, x_return_units=None, y_return_units=None, 
x_return_grace_string=None, y_return_grace_string=None, norm=False):
     """Write the grace header.
 
     @param data:                    The graph numerical data.
     @type data:                     list of lists of float
     @keyword file:                  The file object to write the data to.
     @type file:                     file object
-    @keyword spin_id:               The spin identification string.
-    @type spin_id:                  str
+    @keyword spin_ids:              A list of spin identification strings.
+    @type spin_ids:                 list of str
     @keyword x_data_type:           The category of the X-axis data.
     @type x_data_type:              str
     @keyword y_data_type:           The category of the Y-axis data.
@@ -683,4 +688,4 @@
         file.write("@    s%i errorbar riser linewidth 0.5\n" % i)
 
         # Legend.
-        file.write("@    s%i legend \"Spin %s\"\n" % (i, data[i][5]))
+        file.write("@    s%i legend \"Spin %s\"\n" % (i, spin_ids[i]))




Related Messages


Powered by MHonArc, Updated Thu Dec 04 18:40:02 2008