mailr8037 - /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 - 14:02:
Author: bugman
Date: Thu Nov 27 14:02:41 2008
New Revision: 8037

URL: http://svn.gna.org/viewcvs/relax?rev=8037&view=rev
Log:
Partial implementation of the error_analysis() code

The 2 categories now supported are both peak height and volumes when no 
spectra are replicated.


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=8037&r1=8036&r2=8037&view=diff
==============================================================================
--- branches/spectral_errors/generic_fns/spectrum.py (original)
+++ branches/spectral_errors/generic_fns/spectrum.py Thu Nov 27 14:02:41 2008
@@ -34,7 +34,7 @@
 # relax module imports.
 from generic_fns.mol_res_spin import exists_mol_res_spin_data, 
generate_spin_id, return_spin, spin_loop
 from generic_fns import pipes
-from relax_errors import RelaxError, RelaxArgNotInListError, 
RelaxNoSequenceError
+from relax_errors import RelaxError, RelaxArgNotInListError, 
RelaxImplementError, RelaxNoSequenceError
 from relax_io import extract_data, strip
 from relax_warnings import RelaxWarning, RelaxNoSpinWarning
 
@@ -162,6 +162,78 @@
 
     # Get the current data pipe.
     cdp = pipes.get_pipe()
+
+    # Test if spectra have been loaded.
+    if not hasattr(cdp, 'spectrum_ids'):
+        raise RelaxError, "Error analysis is not possible, no spectra have 
been loaded."
+
+    # Peak height category.
+    if cdp.int_method == 'height':
+        # Print out.
+        print "Intensity measure:  Peak heights."
+
+        # Do we have replicated spectra?
+        if hasattr(cdp, 'replicated'):
+            # Print out.
+            print "Replicated spectra:  Yes."
+            raise RelaxImplementError
+
+        # No replicated spectra.
+        else:
+            # 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
+
+
+    # Peak volume category.
+    if cdp.int_method == 'volume':
+        # Print out.
+        print "Intensity measure:  Peak volumes."
+
+        # Do we have replicated spectra?
+        if hasattr(cdp, 'replicated'):
+            # Print out.
+            print "Replicated spectra:  Yes."
+            raise RelaxImplementError
+
+        # No replicated spectra.
+        else:
+            # 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
+
+                # Set the error to the RMSD.
+                spin.intensity_err = spin.baseplane_rmsd
 
 
 def intensity_generic(line, int_col):
@@ -441,6 +513,13 @@
     # Get the current data pipe.
     cdp = pipes.get_pipe()
 
+    # Test that the intensity measures are identical.
+    if hasattr(cdp, 'int_method') and cdp.int_method != int_method:
+        raise RelaxError, "The '%s' measure of peak intensities does not 
match '%s' of the previously loaded spectra." % (int_method, cdp.int_method)
+
+    # Set the peak intensity measure.
+    cdp.int_method = int_method
+
     # Extract the data from the file.
     file_data = extract_data(file, dir)
 




Related Messages


Powered by MHonArc, Updated Thu Nov 27 14:20:04 2008