mailr19490 - in /branches/relax_disp: ./ lib/list.py pipe_control/spectrum.py


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

Header


Content

Posted by edward on April 17, 2013 - 23:04:
Author: bugman
Date: Wed Apr 17 23:04:13 2013
New Revision: 19490

URL: http://svn.gna.org/viewcvs/relax?rev=19490&view=rev
Log:
Merged revisions 19488-19489 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r19488 | bugman | 2013-04-17 23:00:53 +0200 (Wed, 17 Apr 2013) | 6 lines
  
  Fix for the spectrum.error_analysis user function for replicated spectra 
and subsets.
  
  A second call to spectrum.error_analysis was removing the results from the 
first call.  This is now
  avoided.
........
  r19489 | bugman | 2013-04-17 23:01:45 +0200 (Wed, 17 Apr 2013) | 3 lines
  
  Created the lib.list.unique_elements() function for returning a list with 
duplicates removed.
........

Modified:
    branches/relax_disp/   (props changed)
    branches/relax_disp/lib/list.py
    branches/relax_disp/pipe_control/spectrum.py

Propchange: branches/relax_disp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr 17 23:04:13 2013
@@ -1,1 +1,1 @@
-/trunk:1-19483
+/trunk:1-19489

Modified: branches/relax_disp/lib/list.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/list.py?rev=19490&r1=19489&r2=19490&view=diff
==============================================================================
--- branches/relax_disp/lib/list.py (original)
+++ branches/relax_disp/lib/list.py Wed Apr 17 23:04:13 2013
@@ -26,10 +26,26 @@
 def count_unique_elements(values=None):
     """Count the number of unique instances in the given list.
 
-    @keyword values:    The list of values to count.
+    @keyword values:    The original list.
     @type values:       list
     @return:            The number of unique instances.
     @rtype:             int
+    """
+
+    # Create a new list.
+    new_list = unique_elements(values=values)
+
+    # The number.
+    return len(new_list)
+
+
+def unique_elements(values=None):
+    """Return a new list with duplicates removed.
+
+    @keyword values:    The original list.
+    @type values:       list
+    @return:            The new list with duplicates removed.
+    @rtype:             list
     """
 
     # Create a new list.
@@ -38,5 +54,5 @@
         if i not in new_list:
             new_list.append(i)
 
-    # The number.
-    return len(new_list)
+    # Return the new list.
+    return new_list

Modified: branches/relax_disp/pipe_control/spectrum.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/pipe_control/spectrum.py?rev=19490&r1=19489&r2=19490&view=diff
==============================================================================
--- branches/relax_disp/pipe_control/spectrum.py (original)
+++ branches/relax_disp/pipe_control/spectrum.py Wed Apr 17 23:04:13 2013
@@ -81,8 +81,10 @@
         print("All spectra replicated:  Yes.")
 
     # Initialise.
-    cdp.sigma_I = {}
-    cdp.var_I = {}
+    if not hasattr(cdp, 'sigma_I'):
+        cdp.sigma_I = {}
+    if not hasattr(cdp, 'var_I'):
+        cdp.var_I = {}
 
     # The subset.
     subset_flag = False




Related Messages


Powered by MHonArc, Updated Wed Apr 17 23:20:02 2013