mailr8073 - /branches/spectral_errors/specific_fns/relax_fit.py


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

Header


Content

Posted by edward on December 01, 2008 - 10:51:
Author: bugman
Date: Mon Dec  1 10:51:10 2008
New Revision: 8073

URL: http://svn.gna.org/viewcvs/relax?rev=8073&view=rev
Log:
Removal of the mean_and_error() method.  This is now part of 
generic_fns.spectrum.


Modified:
    branches/spectral_errors/specific_fns/relax_fit.py

Modified: branches/spectral_errors/specific_fns/relax_fit.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/spectral_errors/specific_fns/relax_fit.py?rev=8073&r1=8072&r2=8073&view=diff
==============================================================================
--- branches/spectral_errors/specific_fns/relax_fit.py (original)
+++ branches/spectral_errors/specific_fns/relax_fit.py Mon Dec  1 10:51:10 
2008
@@ -584,128 +584,6 @@
         b = array(b, float64)
 
         return A, b
-
-
-    def mean_and_error(self, verbosity=0):
-        """Calculate the average intensity and standard deviation of all 
spectra.
-
-        @keyword verbosity: The amount of information to print.  The higher 
the value, the greater
-                            the verbosity.
-        @type verbosity:    int
-        """
-
-        # Alias the current data pipe.
-        cdp = pipes.get_pipe()
-
-        # Test if the standard deviation has already been calculated.
-        if hasattr(cdp, 'sigma_I'):
-            raise RelaxError, "The average intensity and standard deviation 
of all spectra has already been calculated."
-
-        # Print out.
-        print "\nCalculating the average intensity and standard deviation of 
all spectra."
-
-        # Initialise.
-        cdp.sigma_I = []
-        cdp.var_I = []
-
-        # Loop over the time points.
-        for time_index in xrange(len(cdp.relax_times)):
-            # Print out.
-            print "\nTime point:  " + `cdp.relax_times[time_index]` + " s"
-            print "Number of spectra:  " + `cdp.num_spectra[time_index]`
-            if verbosity:
-                print "%-5s%-6s%-20s%-20s" % ("Num", "Name", "Average", "SD")
-
-            # Append zero to the global variance structure.
-            cdp.var_I.append(0.0)
-
-            # Test for multiple spectra.
-            if cdp.num_spectra[time_index] == 1:
-                multiple_spectra = 0
-            else:
-                multiple_spectra = 1
-
-            # Calculate the mean value.
-            for spin in spin_loop():
-                # Skip deselected spins.
-                if not spin.select:
-                    continue
-
-                # Skip and deselect spins which have no data.
-                if not hasattr(spin, 'intensities'):
-                    spin.select = False
-                    continue
-
-                # Initialise the average intensity and standard deviation 
data structures.
-                if not hasattr(spin, 'ave_intensities'):
-                    spin.ave_intensities = []
-                if not hasattr(spin, 'var_I'):
-                    spin.var_I = []
-
-                # Average intensity.
-                
spin.ave_intensities.append(average(spin.intensities[time_index]))
-
-                # Sum of squared errors.
-                SSE = 0.0
-                for j in xrange(cdp.num_spectra[time_index]):
-                    SSE = SSE + (spin.intensities[time_index][j] - 
spin.ave_intensities[time_index]) ** 2
-
-                # Variance.
-                #
-                #                   1
-                #       sigma^2 = ----- * sum({Xi - Xav}^2)]
-                #                 n - 1
-                #
-                if cdp.num_spectra[time_index] == 1:
-                    var_I = 0.0
-                else:
-                    var_I = 1.0 / (cdp.num_spectra[time_index] - 1.0) * SSE
-                spin.var_I.append(var_I)
-
-                # Print out.
-                if verbosity:
-                    print "%-5i%-6s%-20s%-20s" % (spin.num, spin.name, 
`spin.ave_intensities[time_index]`, `spin.var_I[time_index]`)
-
-                # Sum of variances (for average).
-                cdp.var_I[time_index] = cdp.var_I[time_index] + 
spin.var_I[time_index]
-
-            # Average variance.
-            cdp.var_I[time_index] = cdp.var_I[time_index] / 
float(count_spins())
-
-            # Print out.
-            print "Standard deviation for time point %s:  %s" % 
(`time_index`, `sqrt(cdp.var_I[time_index])`)
-
-
-        # Average across all spectra if there are time points with a single 
spectrum.
-        if 0.0 in cdp.var_I:
-            # Initialise.
-            var_I = 0.0
-            num_dups = 0
-
-            # Loop over all time points.
-            for i in xrange(len(cdp.relax_times)):
-                # Single spectrum (or extraordinarily accurate NMR spectra!).
-                if cdp.var_I[i] == 0.0:
-                    continue
-
-                # Sum and count.
-                var_I = var_I + cdp.var_I[i]
-                num_dups = num_dups + 1
-
-            # Average value.
-            var_I = var_I / float(num_dups)
-
-            # Assign the average value to all time points.
-            for i in xrange(len(cdp.relax_times)):
-                cdp.var_I[i] = var_I
-
-            # Print out.
-            print "\nStandard deviation (averaged over all spectra):  " + 
`var_I`
-
-        # Create the standard deviation data structure.
-        cdp.sigma_I = []
-        for var_I in cdp.var_I:
-            cdp.sigma_I.append(sqrt(var_I))
 
 
     def minimise(self, min_algor=None, min_options=None, func_tol=None, 
grad_tol=None, max_iterations=None, constraints=False, scaling=True, 
verbosity=0, sim_index=None, lower=None, upper=None, inc=None):




Related Messages


Powered by MHonArc, Updated Mon Dec 01 11:00:02 2008