mailr22091 - /trunk/specific_analyses/noe/main.py


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

Header


Content

Posted by edward on January 31, 2014 - 11:26:
Author: bugman
Date: Fri Jan 31 11:26:09 2014
New Revision: 22091

URL: http://svn.gna.org/viewcvs/relax?rev=22091&view=rev
Log:
Another fix for the NOE analysis for when replicated spectra have been 
collected.

Variance averaging rather than error averaging is now used for the peak 
intensity errors.  This is
important if the errors for each replicated spectra are different - a case 
which is rarely
encountered as the replicates are almost always used to determine one error 
for all the replicates.


Modified:
    trunk/specific_analyses/noe/main.py

Modified: trunk/specific_analyses/noe/main.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/noe/main.py?rev=22091&r1=22090&r2=22091&view=diff
==============================================================================
--- trunk/specific_analyses/noe/main.py (original)
+++ trunk/specific_analyses/noe/main.py Fri Jan 31 11:26:09 2014
@@ -118,37 +118,37 @@
             if not spin.select:
                 continue
 
-            # Average intensities (if required).
+            # Average intensities and squared errors (if required).
             sat = 0.0
-            sat_err = 0.0
+            sat_err2 = 0.0
             sat_count = 0
             ref = 0.0
-            ref_err = 0.0
+            ref_err2 = 0.0
             ref_count = 0
             for id in cdp.spectrum_ids:
                 # Sat spectra.
                 if cdp.spectrum_type[id] == 'sat':
                     sat += spin.intensities[id]
-                    sat_err += spin.intensity_err[id]
+                    sat_err2 += spin.intensity_err[id]**2
                     sat_count += 1
 
                 # Ref spectra.
                 if cdp.spectrum_type[id] == 'ref':
                     ref += spin.intensities[id]
-                    ref_err += spin.intensity_err[id]
+                    ref_err2 += spin.intensity_err[id]**2
                     ref_count += 1
 
-            # Average the values.
+            # Average the values and errors (variance averaging).
             sat = sat / sat_count
-            sat_err = sat_err / sat_count
+            sat_err2 = sat_err2 / sat_count
             ref = ref / ref_count
-            ref_err = ref_err / ref_count
+            ref_err2 = ref_err2 / ref_count
 
             # Calculate the NOE.
             spin.noe = sat / ref
 
             # Calculate the error.
-            spin.noe_err = sqrt((sat_err * ref)**2 + (ref_err * sat)**2) / 
ref**2
+            spin.noe_err = sqrt(sat_err2 * ref**2 + ref_err2 * sat**2) / 
ref**2
 
 
     def overfit_deselect(self, data_check=True, verbose=True):




Related Messages


Powered by MHonArc, Updated Fri Jan 31 11:40:02 2014