mailr21027 - in /branches/relax_disp: ./ pipe_control/spectrum.py test_suite/gui_tests/rx.py test_suite/system_tests/relax_fit.py


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

Header


Content

Posted by edward on October 09, 2013 - 18:01:
Author: bugman
Date: Wed Oct  9 18:01:30 2013
New Revision: 21027

URL: http://svn.gna.org/viewcvs/relax?rev=21027&view=rev
Log:
Merged revisions 21025-21026 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r21025 | bugman | 2013-10-09 18:00:30 +0200 (Wed, 09 Oct 2013) | 6 lines
  
  Updated the spectrum.error_analysis user function backend to use the 
lib.statistics.std() function.
  
  This simplifies the code.  It affects only the peak intensity error 
analysis when spectra have been
  replicated.
........
  r21026 | bugman | 2013-10-09 18:00:57 +0200 (Wed, 09 Oct 2013) | 3 lines
  
  Updated the test suite with slight changes needed due to r21025.
........

Modified:
    branches/relax_disp/   (props changed)
    branches/relax_disp/pipe_control/spectrum.py
    branches/relax_disp/test_suite/gui_tests/rx.py
    branches/relax_disp/test_suite/system_tests/relax_fit.py

Propchange: branches/relax_disp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Oct  9 18:01:30 2013
@@ -1,1 +1,1 @@
-/trunk:1-21015
+/trunk:1-21026

Modified: branches/relax_disp/pipe_control/spectrum.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/pipe_control/spectrum.py?rev=21027&r1=21026&r2=21027&view=diff
==============================================================================
--- branches/relax_disp/pipe_control/spectrum.py (original)
+++ branches/relax_disp/pipe_control/spectrum.py Wed Oct  9 18:01:30 2013
@@ -34,6 +34,7 @@
 from lib.errors import RelaxError, RelaxImplementError, RelaxNoSpectraError
 from lib.io import write_data
 from lib.spectrum.peak_list import read_peak_list
+from lib.statistics import std
 from lib.warnings import RelaxWarning, RelaxNoSpinWarning
 from pipe_control import pipes
 from pipe_control.mol_res_spin import check_mol_res_spin_data, 
generate_spin_id_unique, return_spin, spin_loop
@@ -110,14 +111,14 @@
         # Number of spectra.
         num_spectra = len(spectra)
 
-        # Print out.
+        # Printout.
         print("\nReplicated spectra:  " + repr(spectra))
         if verbosity:
-            print("%-5s%-6s%-20s%-20s" % ("Num", "Name", "Average", "SD"))
+            print("%-20s%-20s" % ("Spin_ID", "SD"))
 
         # Calculate the mean value.
         count = 0
-        for spin in spin_loop():
+        for spin, spin_id in spin_loop(return_id=True):
             # Skip deselected spins.
             if not spin.select:
                 continue
@@ -135,33 +136,22 @@
             if missing:
                 continue
 
-            # Average intensity.
-            ave_intensity = 0.0
+            # The peak intensities.
+            values = []
             for j in range(num_spectra):
-                ave_intensity = ave_intensity + spin.intensities[spectra[j]]
-            ave_intensity = ave_intensity / num_spectra
-
-            # Sum of squared errors.
-            SSE = 0.0
-            for j in range(num_spectra):
-                SSE = SSE + (spin.intensities[spectra[j]] - ave_intensity) 
** 2
-
-            # Variance.
-            #
-            #                   1
-            #       sigma^2 = ----- * sum({Xi - Xav}^2)]
-            #                 n - 1
-            #
-            var_I = 1.0 / (num_spectra - 1.0) * SSE
-
-            # Print out.
+                values.append(spin.intensities[spectra[j]])
+
+            # The standard deviation.
+            sd = std(values=values, dof=1)
+
+            # Printout.
             if verbosity:
-                print("%-5i%-6s%-20s%-20s" % (spin.num, spin.name, 
repr(ave_intensity), repr(var_I)))
+                print("%-20s%-20s" % (spin_id, sd))
 
             # Sum of variances (for average).
             if not id in cdp.var_I:
                 cdp.var_I[id] = 0.0
-            cdp.var_I[id] = cdp.var_I[id] + var_I
+            cdp.var_I[id] = cdp.var_I[id] + sd**2
             count = count + 1
 
         # No data catch.

Modified: branches/relax_disp/test_suite/gui_tests/rx.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/gui_tests/rx.py?rev=21027&r1=21026&r2=21027&view=diff
==============================================================================
--- branches/relax_disp/test_suite/gui_tests/rx.py (original)
+++ branches/relax_disp/test_suite/gui_tests/rx.py Wed Oct  9 18:01:30 2013
@@ -72,8 +72,8 @@
 
         # Check the errors.
         for key in cdp.sigma_I:
-            self.assertEqual(cdp.sigma_I[key], 10578.03948242143)
-            self.assertEqual(cdp.var_I[key], 111894919.29166666)
+            self.assertEqual(cdp.sigma_I[key], 10578.039482421433)
+            self.assertEqual(cdp.var_I[key], 111894919.29166669)
 
         # Spin data check.
         i = 0

Modified: branches/relax_disp/test_suite/system_tests/relax_fit.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/system_tests/relax_fit.py?rev=21027&r1=21026&r2=21027&view=diff
==============================================================================
--- branches/relax_disp/test_suite/system_tests/relax_fit.py (original)
+++ branches/relax_disp/test_suite/system_tests/relax_fit.py Wed Oct  9 
18:01:30 2013
@@ -82,8 +82,8 @@
 
         # Check the errors.
         for key in cdp.sigma_I:
-            self.assertEqual(cdp.sigma_I[key], 10578.03948242143)
-            self.assertEqual(cdp.var_I[key], 111894919.29166666)
+            self.assertEqual(cdp.sigma_I[key], 10578.039482421433)
+            self.assertEqual(cdp.var_I[key], 111894919.29166669)
 
         # Spin data check.
         i = 0




Related Messages


Powered by MHonArc, Updated Wed Oct 09 18:20:01 2013