mailr8085 - /branches/spectral_errors/specific_fns/base_class.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 - 16:20:
Author: bugman
Date: Mon Dec  1 16:20:36 2008
New Revision: 8085

URL: http://svn.gna.org/viewcvs/relax?rev=8085&view=rev
Log:
Modified the specific base class method return_value() to handle peak heights 
by spectrum id.


Modified:
    branches/spectral_errors/specific_fns/base_class.py

Modified: branches/spectral_errors/specific_fns/base_class.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/spectral_errors/specific_fns/base_class.py?rev=8085&r1=8084&r2=8085&view=diff
==============================================================================
--- branches/spectral_errors/specific_fns/base_class.py (original)
+++ branches/spectral_errors/specific_fns/base_class.py Mon Dec  1 16:20:36 
2008
@@ -213,19 +213,30 @@
         @rtype:         tuple of length 2 of floats or None
         """
 
+        # Initialise.
+        cdp = pipes.get_pipe()
+        index = None
+
         # Get the object name.
         object_name = self.return_data_name(param)
 
+        # The error and simulation names.
+        if object_name:
+            object_error = object_name + '_err'
+            object_sim = object_name + '_sim'
+
         # The data type does not exist.
-        if not object_name:
-            raise RelaxError, "The parameter " + `param` + " does not exist."
-
-        # The error and simulation names.
-        object_error = object_name + '_err'
-        object_sim = object_name + '_sim'
-
-        # Alias the current data pipe.
-        cdp = pipes.get_pipe()
+        else:
+            # Is it a spectrum id?
+            if param in cdp.spectrum_ids:
+                index = cdp.spectrum_ids.index(param)
+                object_name = 'intensities'
+                object_error = 'intensity_err'
+                object_sim = 'intensity_sim'
+
+            # Unknown data type.
+            else:
+                raise RelaxError, "The parameter " + `param` + " does not 
exist."
 
         # Initial values.
         value = None
@@ -236,23 +247,35 @@
             # Get the value.
             if hasattr(spin, object_name):
                 value = getattr(spin, object_name)
+                if index:
+                    value = value[index]
             elif hasattr(cdp, object_name):
                 value = getattr(cdp, object_name)
+                if index:
+                    value = value[index]
 
             # Get the error.
             if hasattr(spin, object_error):
                 error = getattr(spin, object_error)
+                if index:
+                    error = error[index]
             elif hasattr(cdp, object_error):
                 error = getattr(cdp, object_error)
+                if index:
+                    error = error[index]
 
         # Simulation value.
         else:
             # Get the value.
             if hasattr(spin, object_sim):
                 object = getattr(spin, object_sim)
+                if index:
+                    object = object[index]
                 value = object[sim]
             elif hasattr(cdp, object_sim):
                 object = getattr(cdp, object_sim)
+                if index:
+                    object = object[index]
                 value = object[sim]
 
         # Return the data.




Related Messages


Powered by MHonArc, Updated Mon Dec 01 16:40:02 2008