mailr19498 - in /trunk: lib/__init__.py lib/statistics.py lib/stats.py pipe_control/monte_carlo.py


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

Header


Content

Posted by edward on April 19, 2013 - 22:13:
Author: bugman
Date: Fri Apr 19 22:13:09 2013
New Revision: 19498

URL: http://svn.gna.org/viewcvs/relax?rev=19498&view=rev
Log:
Renamed the new lib.stats module to lib.statistics.


Added:
    trunk/lib/statistics.py
      - copied unchanged from r19497, trunk/lib/stats.py
Removed:
    trunk/lib/stats.py
Modified:
    trunk/lib/__init__.py
    trunk/pipe_control/monte_carlo.py

Modified: trunk/lib/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/__init__.py?rev=19498&r1=19497&r2=19498&view=diff
==============================================================================
--- trunk/lib/__init__.py (original)
+++ trunk/lib/__init__.py Fri Apr 19 22:13:09 2013
@@ -44,7 +44,7 @@
     'regex',
     'selection',
     'spectral_densities',
-    'stats',
+    'statistics',
     'structure',
     'text',
     'warnings'

Removed: trunk/lib/stats.py
URL: http://svn.gna.org/viewcvs/relax/trunk/lib/stats.py?rev=19497&view=auto
==============================================================================
--- trunk/lib/stats.py (original)
+++ trunk/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: trunk/pipe_control/monte_carlo.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/monte_carlo.py?rev=19498&r1=19497&r2=19498&view=diff
==============================================================================
--- trunk/pipe_control/monte_carlo.py (original)
+++ trunk/pipe_control/monte_carlo.py Fri Apr 19 22:13:09 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:




Related Messages


Powered by MHonArc, Updated Fri Apr 19 22:20:02 2013