mailr28102 - in /trunk: lib/structure/pca.py pipe_control/structure/main.py user_functions/structure.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:02 2015
New Revision: 28102

URL: http://svn.gna.org/viewcvs/relax?rev=28102&view=rev
Log:
Added the 'algorithm' and 'num_modes' arguments to the structure.pca user 
function.

These are passed all the way into the relax library backend.

Modified:
    trunk/lib/structure/pca.py
    trunk/pipe_control/structure/main.py
    trunk/user_functions/structure.py

Modified: trunk/lib/structure/pca.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/structure/pca.py?rev=28102&r1=28101&r2=28102&view=diff
==============================================================================
--- trunk/lib/structure/pca.py  (original)
+++ trunk/lib/structure/pca.py  Wed Nov 25 18:38:02 2015
@@ -63,11 +63,13 @@
     return covariance_matrix
 
 
-def pca_analysis(coord=None, num_modes=4):
+def pca_analysis(coord=None, algorithm='eigen', num_modes=4):
     """Perform the PCA analysis.
 
     @keyword coord:         The list of coordinates of all models to 
superimpose.  The first index is the models, the second is the atomic 
positions, and the third is the xyz coordinates.
     @type coord:            list of numpy rank-2, Nx3 arrays
+    @keyword algorithm:     The PCA algorithm to use (either 'eigen' or 
'svd').
+    @type algorithm:        str
     @keyword num_modes:     The number of PCA modes to calculate.
     @type num_modes:        int
     """

Modified: trunk/pipe_control/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=28102&r1=28101&r2=28102&view=diff
==============================================================================
--- trunk/pipe_control/structure/main.py        (original)
+++ trunk/pipe_control/structure/main.py        Wed Nov 25 18:38:02 2015
@@ -1004,7 +1004,7 @@
     cdp.N = len(from_mols)
 
 
-def pca(pipes=None, models=None, molecules=None, atom_id=None):
+def pca(pipes=None, models=None, molecules=None, atom_id=None, 
algorithm=None, num_modes=4):
     """PCA analysis of the motions between all the loaded models.
 
     @keyword pipes:     The data pipes to determine the RMSD for.
@@ -1015,6 +1015,10 @@
     @type molecules:    None or list of lists of str
     @keyword atom_id:   The atom identification string of the coordinates of 
interest.  This matches the spin ID string format.
     @type atom_id:      str or None
+    @keyword algorithm: The PCA algorithm to use (either 'eigen' or 'svd').
+    @type algorithm:    str
+    @keyword num_modes: The number of PCA modes to calculate.
+    @type num_modes:    int
     """
 
     # Checks.
@@ -1024,7 +1028,7 @@
     coord, ids, mol_names, res_names, res_nums, atom_names, elements = 
assemble_structural_coordinates(pipes=pipes, models=models, 
molecules=molecules, atom_id=atom_id)
 
     # Perform the PCA analysis.
-    pca_analysis(coord=coord)
+    pca_analysis(coord=coord, algorithm=algorithm, num_modes=num_modes)
 
 
 def read_gaussian(file=None, dir=None, set_mol_name=None, 
set_model_num=None, verbosity=1, fail=True):

Modified: trunk/user_functions/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/user_functions/structure.py?rev=28102&r1=28101&r2=28102&view=diff
==============================================================================
--- trunk/user_functions/structure.py   (original)
+++ trunk/user_functions/structure.py   Wed Nov 25 18:38:02 2015
@@ -900,6 +900,25 @@
     desc = "The atom identification string of the coordinates of interest.",
     can_be_none = True
 )
+uf.add_keyarg(
+    name = "algorithm",
+    default = "eigen",
+    py_type = "str",
+    desc_short = "PCA algorithm",
+    desc = "The PCA algorithm used to find the principle components of.  
This can be either 'eigen' for an eigenvalue/eigenvector decomposition, or 
'svd' for a singular value decomposition.",
+    wiz_element_type = "combo",
+    wiz_combo_choices = ["eigen", "svd"],
+    wiz_read_only = True
+)
+uf.add_keyarg(
+    name = "num_modes",
+    py_type = "int",
+    default = 4,
+    min = 1,
+    max = 1000,
+    desc_short = "number of modes",
+    desc = "The number of PCA modes to calculate."
+)
 # Description.
 uf.desc.append(Desc_container())
 uf.desc[-1].add_paragraph("Perform a principle component analysis (PCA) for 
all the chosen structures.")
@@ -912,7 +931,7 @@
 uf.backend = pipe_control.structure.main.pca
 uf.menu_text = "&pca"
 uf.wizard_height_desc = 400
-uf.wizard_size = (900, 700)
+uf.wizard_size = (1000, 750)
 uf.wizard_image = WIZARD_IMAGE_PATH + 'structure' + sep + '2JK4.png'
 
 




Related Messages


Powered by MHonArc, Updated Wed Nov 25 18:40:03 2015