Author: bugman Date: Fri Apr 19 22:17:46 2013 New Revision: 19500 URL: http://svn.gna.org/viewcvs/relax?rev=19500&view=rev Log: Merged revisions 19498 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r19498 | bugman | 2013-04-19 22:13:09 +0200 (Fri, 19 Apr 2013) | 3 lines Renamed the new lib.stats module to lib.statistics. ........ Added: branches/relax_disp/lib/statistics.py - copied unchanged from r19498, trunk/lib/statistics.py Removed: branches/relax_disp/lib/stats.py Modified: branches/relax_disp/ (props changed) branches/relax_disp/lib/__init__.py branches/relax_disp/pipe_control/monte_carlo.py Propchange: branches/relax_disp/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Fri Apr 19 22:17:46 2013 @@ -1,1 +1,1 @@ -/trunk:1-19497 +/trunk:1-19499 Modified: branches/relax_disp/lib/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/__init__.py?rev=19500&r1=19499&r2=19500&view=diff ============================================================================== --- branches/relax_disp/lib/__init__.py (original) +++ branches/relax_disp/lib/__init__.py Fri Apr 19 22:17:46 2013 @@ -45,7 +45,7 @@ 'regex', 'selection', 'spectral_densities', - 'stats', + 'statistics', 'structure', 'text', 'warnings' Removed: branches/relax_disp/lib/stats.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/stats.py?rev=19499&view=auto ============================================================================== --- branches/relax_disp/lib/stats.py (original) +++ branches/relax_disp/lib/stats.py (removed) @@ -1,85 +1,0 @@ -############################################################################### -# # -# Copyright (C) 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 calculating simple statistics.""" - -# Python module imports. -from math import sqrt - - -def std(values=None, skip=None, dof=1): - """Calculate the standard deviation of the given values, skipping values if asked. - - @keyword values: The list of values to calculate the standard deviation of. - @type values: list of float - @keyword skip: An optional list of booleans specifying if a value should be skipped. The length of this list must match the values. An element of True will cause the corresponding value to not be included in the calculation. - @type skip: list of bool or None. - @keyword dof: The degrees of freedom, whereby the standard deviation is multipled by 1/(N - dof). - @type dof: int - @return: The standard deviation. - @rtype: float - """ - - # The total number of points. - n = 0 - for i in range(len(values)): - # Skip deselected values. - if skip != None and not skip[i]: - continue - - # Increment n. - n = n + 1 - - # Calculate the sum of the values for all points. - Xsum = 0.0 - for i in range(len(values)): - # Skip deselected values. - if skip != None and not skip[i]: - continue - - # Sum. - Xsum = Xsum + values[i] - - # Calculate the mean value for all points. - if n == 0: - Xav = 0.0 - else: - Xav = Xsum / float(n) - - # Calculate the sum part of the standard deviation. - sd = 0.0 - for i in range(len(values)): - # Skip deselected values. - if skip != None and not skip[i]: - continue - - # Sum. - sd = sd + (values[i] - Xav)**2 - - # Calculate the standard deviation. - if n <= 1: - sd = 0.0 - else: - sd = sqrt(sd / (float(n) - float(dof))) - - # Return the SD. - return sd Modified: branches/relax_disp/pipe_control/monte_carlo.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/pipe_control/monte_carlo.py?rev=19500&r1=19499&r2=19500&view=diff ============================================================================== --- branches/relax_disp/pipe_control/monte_carlo.py (original) +++ branches/relax_disp/pipe_control/monte_carlo.py Fri Apr 19 22:17:46 2013 @@ -29,7 +29,7 @@ # relax module imports. from lib.errors import RelaxError, RelaxNoSequenceError -from lib import stats +from lib import statistics from pipe_control.mol_res_spin import exists_mol_res_spin_data from pipe_control import pipes from specific_analyses.setup import get_specific_fn @@ -169,11 +169,11 @@ data.append(param_array[i][key]) # Calculate and store the SD. - sd[key] = stats.std(values=data, skip=select_sim) + sd[key] = statistics.std(values=data, skip=select_sim) # SD of simulation parameters with values (ie not None). elif param_array[0] != None: - sd = stats.std(values=param_array, skip=select_sim) + sd = statistics.std(values=param_array, skip=select_sim) # Simulation parameters with the value None. else: