mailr28119 - /trunk/pipe_control/structure/main.py


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

Header


Content

Posted by edward on November 25, 2015 - 18:38:
Author: bugman
Date: Wed Nov 25 18:38:40 2015
New Revision: 28119

URL: http://svn.gna.org/viewcvs/relax?rev=28119&view=rev
Log:
Fixes and improvements for the graphs produced by the structure.pca user 
function.

The different sets are now correctly created, and are now labelled in the 
plots.

Modified:
    trunk/pipe_control/structure/main.py

Modified: trunk/pipe_control/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=28119&r1=28118&r2=28119&view=diff
==============================================================================
--- trunk/pipe_control/structure/main.py        (original)
+++ trunk/pipe_control/structure/main.py        Wed Nov 25 18:38:40 2015
@@ -1059,6 +1059,7 @@
                         weights[struct] = 0.0
 
     # Perform the PC analysis.
+    print("\n\nStarting the PCA analysis.\n")
     values, vectors, proj = pca_analysis(coord=coord, weights=weights, 
algorithm=algorithm, num_modes=num_modes)
 
     # Store the values.
@@ -1071,27 +1072,31 @@
         # Assemble the data.
         data = [[[]]]
         current = None
+        labels = []
         for struct in range(M):
             # Create a unique ID for pipe and molecule name.
             id = "%s - %s" % (object_id_list[struct], molecule_list[struct])
             if current == None:
                 current = id
+                labels.append(current)
 
             # Start a new set.
             if current != id:
                 data[-1].append([])
+                current = id
+                labels.append(current)
 
             # Add the projection.
             data[-1][-1].append([proj[mode, struct], proj[mode+1, struct]])
 
         # The number of graph sets.
-        sets = len(data[0][0])
+        sets = len(labels)
 
         # Open the file for writing.
         file = open_write_file("graph_pc%s_pc%s.agr" % (mode+1, mode+2), 
dir=dir, force=True)
 
         # The header.
-        write_xy_header(format=format, file=file, title="Principle component 
projections", sets=[sets], axis_labels=[['PC mode %i (\cE\C)' % (mode+1), 'PC 
mode %i (\cE\C)' % (mode+2)]], linestyle=[[0]*sets])
+        write_xy_header(format=format, file=file, title="Principle component 
projections", sets=[sets], set_names=[labels], axis_labels=[['PC mode %i 
(\cE\C)' % (mode+1), 'PC mode %i (\cE\C)' % (mode+2)]], linestyle=[[0]*sets])
 
         # The data.
         write_xy_data(format=format, data=data, file=file, graph_type='xy')




Related Messages


Powered by MHonArc, Updated Sat Nov 28 12:00:41 2015