mailr19470 - /branches/relax_disp/specific_analyses/relax_disp.py


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

Header


Content

Posted by edward on April 11, 2013 - 18:03:
Author: bugman
Date: Thu Apr 11 18:03:00 2013
New Revision: 19470

URL: http://svn.gna.org/viewcvs/relax?rev=19470&view=rev
Log:
Clustering is now enabled for relaxation dispersion.

The model_loop() analysis specific API method now loops over the spin 
clusterings, allowing a cluster
of spins to be optimised simultaneously to one set of model parameters.


Modified:
    branches/relax_disp/specific_analyses/relax_disp.py

Modified: branches/relax_disp/specific_analyses/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp.py?rev=19470&r1=19469&r2=19470&view=diff
==============================================================================
--- branches/relax_disp/specific_analyses/relax_disp.py (original)
+++ branches/relax_disp/specific_analyses/relax_disp.py Thu Apr 11 18:03:00 
2013
@@ -1396,14 +1396,41 @@
         @rtype:     tuple of list of SpinContainer instances and list of 
spin IDs
         """
 
-        # Loop over the sequence.
-        for spin, spin_id in spin_loop(return_id=True):
-            # Skip deselected spins.
-            if not spin.select:
-                continue
-
-            # Return the spin container as a stop-gap measure.
-            yield [spin], [spin_id]
+        # No clustering, so loop over the sequence.
+        if not hasattr(cdp, 'clustering'):
+            for spin, spin_id in spin_loop(return_id=True):
+                # Skip deselected spins.
+                if not spin.select:
+                    continue
+
+                # Return the spin container as a stop-gap measure.
+                yield [spin], [spin_id]
+
+        # Loop over the clustering.
+        else:
+            # The clusters.
+            for key in cdp.clustering.keys():
+                # Skip the free spins.
+                if key == 'free spins':
+                    continue
+
+                # Create the spin container and ID lists.
+                spin_list = []
+                spin_id_list = []
+                for spin_id in cdp.clustering[key]:
+                    spin_list.append(return_spin(spin_id))
+                    spin_id_list.append(spin_id)
+
+                # Yield the cluster.
+                yield spin_list, spin_id_list
+
+            # The free spins.
+            for spin_id in cdp.clustering['free spins']:
+                # Get the spin container.
+                spin = return_spin(spin_id)
+
+                # Yield each spin individually.
+                yield [spin], [spin_id]
 
 
     def overfit_deselect(self, data_check=True, verbose=True):




Related Messages


Powered by MHonArc, Updated Thu Apr 11 19:20:02 2013