Previous topic

plot module

Next topic

secondary_structure module

This Page

principal_components module

This module contains functions for principal components analysis. It can be used to calculate principal components from a trajectory, graphically display the principal components, reconstruct a trajectory from a chosen set of components and so on.

RepresentPrincipalComponentOnStruccture(ev, U, pc_index=0, go_name='pc0', color=gfx.RGBA(1, 0, 0, 1) gfx.HSV(0, 1, 1))[source]
ProjectOnPrincipalComponentsAtomWise(t, ev, first=0, last=-1, stride=1)[source]

Calculates the principal components for each atom and projects the trajectory on them. It returns:

  • The list of principal axes in which the ith element is a 3x3 matrix

with in its columns the principal axes for the ith atom in ev. - The positions projected on the principal axes

ProjectOnPrincipalComponent(atom_pos_list, U, pc_index=0, first=0, last=-1)[source]
ReconstructTrajFromPrincipalComponents(ev, U, S, V, mean_atom_pos, pc_indices=[0, 1])[source]
CalculatePrincipalComponents(t, pc_sele, superposition_sele=None, first=0, last=-1, stride=1)[source]

This function calculates the principal components for the positions of the N atoms in ev, i.e the 3N eigenvalues and eigenvectors. Specifically it performs an svd decomposition A=U*S*V Return: a tuple (U,S,V,mean_atom_pos,atom_pos_list) containing:

-The unitary matrix U containing the eigenvectors in its columns -The singular values S, so that S*S are the eigenvalues -The unitary matrix V -A list of the average positions for each atoms in pc_sele -A list with all the positions for each atom and each frame.