mailr8044 - /branches/spectral_errors/specific_fns/noe.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 - 16:22:
Author: bugman
Date: Thu Nov 27 16:22:56 2008
New Revision: 8044

URL: http://svn.gna.org/viewcvs/relax?rev=8044&view=rev
Log:
Wrote the NOE spectrum_type() method.


Modified:
    branches/spectral_errors/specific_fns/noe.py

Modified: branches/spectral_errors/specific_fns/noe.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/spectral_errors/specific_fns/noe.py?rev=8044&r1=8043&r2=8044&view=diff
==============================================================================
--- branches/spectral_errors/specific_fns/noe.py (original)
+++ branches/spectral_errors/specific_fns/noe.py Thu Nov 27 16:22:56 2008
@@ -249,3 +249,35 @@
                 spin.ref_err = float(error)
             elif spectrum_id == 'sat':
                 spin.sat_err = float(error)
+
+
+    def spectrum_type(self, spectrum_type=None, spectrum_id=None):
+        """Set the spectrum type corresponding to the spectrum_id.
+
+        @keyword spectrum_type: The type of NOE spectrum, one of 'ref' or 
'sat'.
+        @type spectrum_type:    str
+        @keyword spectrum_id:   The spectrum id string.
+        @type spectrum_id:      str
+        """
+
+        # Test if the current pipe exists
+        pipes.test()
+
+        # Get the current data pipe.
+        cdp = pipes.get_pipe()
+
+        # Test the spectrum id string.
+        if spectrum_id not in cdp.spectrum_ids:
+            raise RelaxError, "The peak intensities corresponding to the 
spectrum id '%s' does not exist." % spectrum_id
+
+        # The spectrum id index.
+        spect_index = cdp.spectrum_ids.index(spectrum_id)
+
+        # Initialise or update the spectrum_type data structure as necessary.
+        if not hasattr(cdp, 'spectrum_type'):
+            cdp.spectrum_type = [None] * len(cdp.spectrum_ids)
+        elif len(cdp.spectrum_type) < len(cdp.spectrum_ids):
+            cdp.spectrum_type.append([None] * (len(cdp.spectrum_ids) - 
len(cdp.spectrum_type)))
+
+        # Set the error.
+        cdp.spectrum_type[spect_index] = spectrum_type




Related Messages


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