mailr8043 - /branches/spectral_errors/generic_fns/spectrum.py


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

Header


Content

Posted by edward on November 27, 2008 - 15:05:
Author: bugman
Date: Thu Nov 27 15:05:04 2008
New Revision: 8043

URL: http://svn.gna.org/viewcvs/relax?rev=8043&view=rev
Log:
Split up the error_analysis() function.

The two functions __errors_height_no_repl() and __errors_volume_no_repl() 
have been created.  The
other 4 analysis types will be added as functions later.


Modified:
    branches/spectral_errors/generic_fns/spectrum.py

Modified: branches/spectral_errors/generic_fns/spectrum.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/spectral_errors/generic_fns/spectrum.py?rev=8043&r1=8042&r2=8043&view=diff
==============================================================================
--- branches/spectral_errors/generic_fns/spectrum.py (original)
+++ branches/spectral_errors/generic_fns/spectrum.py Thu Nov 27 15:05:04 2008
@@ -40,6 +40,53 @@
 from relax_warnings import RelaxWarning, RelaxNoSpinWarning
 
 
+def __errors_height_no_repl():
+    """Calculate the errors for peak heights when no spectra are 
replicated."""
+
+    # Loop over the spins and set the error to the RMSD of the base plane 
noise.
+    for spin, spin_id in spin_loop(return_id=True):
+        # Skip deselected spins.
+        if not spin.select:
+            continue
+
+        # Skip spins missing intensity data.
+        if not hasattr(spin, 'intensities'):
+            continue
+
+        # Test if the RMSD has been set.
+        if not hasattr(spin, 'baseplane_rmsd'):
+            print spin
+            raise RelaxError, "The RMSD of the base plane noise for spin 
'%s' has not been set." % spin_id
+
+        # Set the error to the RMSD.
+        spin.intensity_err = spin.baseplane_rmsd
+
+
+def __errors_volume_no_repl():
+    """Calculate the errors for peak volumes when no spectra are 
replicated."""
+
+    # Loop over the spins and set the error to the RMSD of the base plane 
noise.
+    for spin, spin_id in spin_loop(return_id=True):
+        # Skip deselected spins.
+        if not spin.select:
+            continue
+
+        # Skip spins missing intensity data.
+        if not hasattr(spin, 'intensities'):
+            continue
+
+        # Test if the RMSD has been set.
+        if not hasattr(spin, 'baseplane_rmsd'):
+            raise RelaxError, "The RMSD of the base plane noise for spin 
'%s' has not been set." % spin_id
+
+        # Test that the total number of points have been set.
+        if not hasattr(spin, 'N'):
+            raise RelaxError, "The total number of points used in the volume 
integration has not been specified for spin '%s'." % spin_id
+
+        # Set the error to the RMSD multiplied by the square root of the 
total number of points.
+        spin.intensity_err = spin.baseplane_rmsd * sqrt(spin.N)
+
+
 def autodetect_format(file_data):
     """Automatically detect the format of the peak list.
 
@@ -184,24 +231,8 @@
             # Print out.
             print "Replicated spectra:  No."
 
-            # Loop over the spins and set the error to the RMSD of the base 
plane noise.
-            for spin, spin_id in spin_loop(return_id=True):
-                # Skip deselected spins.
-                if not spin.select:
-                    continue
-
-                # Skip spins missing intensity data.
-                if not hasattr(spin, 'intensities'):
-                    continue
-
-                # Test if the RMSD has been set.
-                if not hasattr(spin, 'baseplane_rmsd'):
-                    print spin
-                    raise RelaxError, "The RMSD of the base plane noise for 
spin '%s' has not been set." % spin_id
-
-                # Set the error to the RMSD.
-                spin.intensity_err = spin.baseplane_rmsd
-
+            # Set the errors.
+            __errors_height_no_repl()
 
     # Peak volume category.
     if cdp.int_method == 'volume':
@@ -219,26 +250,8 @@
             # Print out.
             print "Replicated spectra:  No."
 
-            # Loop over the spins and set the error to the RMSD of the base 
plane noise.
-            for spin, spin_id in spin_loop(return_id=True):
-                # Skip deselected spins.
-                if not spin.select:
-                    continue
-
-                # Skip spins missing intensity data.
-                if not hasattr(spin, 'intensities'):
-                    continue
-
-                # Test if the RMSD has been set.
-                if not hasattr(spin, 'baseplane_rmsd'):
-                    raise RelaxError, "The RMSD of the base plane noise for 
spin '%s' has not been set." % spin_id
-
-                # Test that the total number of points have been set.
-                if not hasattr(spin, 'N'):
-                    raise RelaxError, "The total number of points used in 
the volume integration has not been specified for spin '%s'." % spin_id
-
-                # Set the error to the RMSD multiplied by the square root of 
the total number of points.
-                spin.intensity_err = spin.baseplane_rmsd * sqrt(spin.N)
+            # Set the errors.
+            __errors_volume_no_repl()
 
 
 def intensity_generic(line, int_col):




Related Messages


Powered by MHonArc, Updated Thu Nov 27 16:40:03 2008