Author: bugman Date: Sun Mar 24 15:54:57 2013 New Revision: 19108 URL: http://svn.gna.org/viewcvs/relax?rev=19108&view=rev Log: Shifted the pipe_control.structure.statistics module to lib.structure.statistics. Added: trunk/lib/structure/statistics.py - copied unchanged from r19105, trunk/pipe_control/structure/statistics.py Removed: trunk/pipe_control/structure/statistics.py Modified: trunk/lib/structure/__init__.py trunk/lib/structure/superimpose.py trunk/pipe_control/structure/__init__.py trunk/pipe_control/structure/main.py trunk/target_functions/ens_pivot_finder.py Modified: trunk/lib/structure/__init__.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/structure/__init__.py?rev=19108&r1=19107&r2=19108&view=diff ============================================================================== --- trunk/lib/structure/__init__.py (original) +++ trunk/lib/structure/__init__.py Sun Mar 24 15:54:57 2013 @@ -24,5 +24,6 @@ __all__ = [ 'rotor', + 'statistics', 'superimpose' ] Modified: trunk/lib/structure/superimpose.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/structure/superimpose.py?rev=19108&r1=19107&r2=19108&view=diff ============================================================================== --- trunk/lib/structure/superimpose.py (original) +++ trunk/lib/structure/superimpose.py Sun Mar 24 15:54:57 2013 @@ -29,7 +29,7 @@ from numpy.linalg import det, norm, svd # relax module import. -from pipe_control.structure.statistics import calc_mean_structure +from lib.structure.statistics import calc_mean_structure from lib.geometry.rotations import R_to_axis_angle, R_to_euler_zyz Modified: trunk/pipe_control/structure/__init__.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/__init__.py?rev=19108&r1=19107&r2=19108&view=diff ============================================================================== --- trunk/pipe_control/structure/__init__.py (original) +++ trunk/pipe_control/structure/__init__.py Sun Mar 24 15:54:57 2013 @@ -45,5 +45,4 @@ 'pdb_read', 'pdb_write', 'scientific', - 'statistics' ] Modified: trunk/pipe_control/structure/main.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=19108&r1=19107&r2=19108&view=diff ============================================================================== --- trunk/pipe_control/structure/main.py (original) +++ trunk/pipe_control/structure/main.py Sun Mar 24 15:54:57 2013 @@ -37,7 +37,7 @@ from pipe_control.structure.api_base import Displacements from pipe_control.structure.internal import Internal from pipe_control.structure.scientific import Scientific_data -from pipe_control.structure.statistics import atomic_rmsd +from lib.structure.statistics import atomic_rmsd from lib.structure.superimpose import fit_to_first, fit_to_mean from target_functions.ens_pivot_finder import Pivot_finder from lib.errors import RelaxError, RelaxFileError, RelaxNoPdbError, RelaxNoSequenceError Removed: trunk/pipe_control/structure/statistics.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/statistics.py?rev=19107&view=auto ============================================================================== --- trunk/pipe_control/structure/statistics.py (original) +++ trunk/pipe_control/structure/statistics.py (removed) @@ -1,111 +1,0 @@ -############################################################################### -# # -# Copyright (C) 2011-2013 Edward d'Auvergne # -# # -# This file is part of the program relax (http://www.nmr-relax.com). # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see <http://www.gnu.org/licenses/>. # -# # -############################################################################### - -# Module docstring. -"""Module for handling all types of structural statistics.""" - -# Python module imports. -from numpy import float64, mean, sqrt, std, zeros -from numpy.linalg import norm - - -def atomic_rmsd(coord, verbosity=0): - """Determine the RMSD for the given atomic coordinates. - - This is the per atom RMSD to the mean structure. - - - @keyword coord: The array of molecular coordinates. The first dimension corresponds to the model, the second the atom, the third the coordinate. - @type coord: rank-3 numpy array - @return: The RMSD value. - @rtype: float - """ - - # Init. - M = len(coord) - N = len(coord[0]) - model_rmsd = zeros(M, float64) - mean_str = zeros((N, 3), float64) - - # Calculate the mean structure. - calc_mean_structure(coord, mean_str) - - # Loop over the models. - for i in range(M): - # Loop over the atoms. - for j in range(N): - # The vector connecting the mean to model atom. - vect = mean_str[j] - coord[i][j] - - # The atomic RMSD. - model_rmsd[i] += norm(vect)**2 - - # Normalise, and sqrt. - model_rmsd[i] = sqrt(model_rmsd[i] / N) - - # Print out. - if verbosity: - print("Model %2s RMSD: %s" % (i, model_rmsd[i])) - - # Calculate the mean. - rmsd_mean = mean(model_rmsd) - - # Calculate the normal non-biased standard deviation. - try: - rmsd_sd = std(model_rmsd, ddof=1) - - # Handle old numpy versions not having the ddof argument. - except TypeError: - rmsd_sd = std(model_rmsd) * sqrt(M / (M - 1.0)) - - # Printout. - if verbosity: - print("\nGlobal RMSD: %s +/- %s" % (rmsd_mean, rmsd_sd)) - - # Return the average RMSD. - return rmsd_mean - - -def calc_mean_structure(coord=None, mean=None): - """Average the coordinates. - - @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 mean: The data storage for the mean structure. - @type mean: numpy rank-2, Nx3 array - """ - - # The number of atoms. - N = len(coord[0]) - M = len(coord) - - # Clear the mean data structure. - for i in range(N): - mean[i] = [0.0, 0.0, 0.0] - - # Loop over the atoms. - for i in range(N): - # Loop over the models. - for j in range(M): - mean[i] += coord[j][i] - - # Average. - mean[i] = mean[i] / M Modified: trunk/target_functions/ens_pivot_finder.py URL: http://svn.gna.org/viewcvs/relax/trunk/target_functions/ens_pivot_finder.py?rev=19108&r1=19107&r2=19108&view=diff ============================================================================== --- trunk/target_functions/ens_pivot_finder.py (original) +++ trunk/target_functions/ens_pivot_finder.py Sun Mar 24 15:54:57 2013 @@ -26,7 +26,7 @@ from copy import deepcopy # relax module import. -from pipe_control.structure.statistics import atomic_rmsd +from lib.structure.statistics import atomic_rmsd from lib.structure.superimpose import fit_to_mean