mailr7226 - /branches/rdc_analysis/specific_fns/n_state_model.py


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

Header


Content

Posted by edward on August 23, 2008 - 03:48:
Author: bugman
Date: Sat Aug 23 02:37:51 2008
New Revision: 7226

URL: http://svn.gna.org/viewcvs/relax?rev=7226&view=rev
Log:
Wrote the __minimise_bc_data() method to extract the back calculated data 
after minimisation.


Modified:
    branches/rdc_analysis/specific_fns/n_state_model.py

Modified: branches/rdc_analysis/specific_fns/n_state_model.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/rdc_analysis/specific_fns/n_state_model.py?rev=7226&r1=7225&r2=7226&view=diff
==============================================================================
--- branches/rdc_analysis/specific_fns/n_state_model.py (original)
+++ branches/rdc_analysis/specific_fns/n_state_model.py Sat Aug 23 02:37:51 
2008
@@ -382,6 +382,50 @@
 
         # Return the constraint objects.
         return A, b
+
+
+    def __minimise_bc_data(self, model):
+        """Extract and unpack the back calculated data.
+
+        @param model:   The instantiated class containing the target 
function.
+        @type model:    class instance
+        """
+
+        # Loop over each alignment.
+        for i in xrange(model.num_align):
+            # Indices.
+            pcs_index = 0
+            rdc_index = 0
+
+            # Spin loop.
+            for spin in spin_loop():
+                # Skip deselected spins.
+                if not spin.select:
+                    continue
+
+                # Spins with PCS data.
+                if hasattr(spin, 'pcs'):
+                    # Initialise the data structure if necessary.
+                    if not hasattr(spin, 'pcs_bc'):
+                        spin.pcs_bc = []
+
+                    # Append the back calculated PCS.
+                    spin.pcs_bc.append(model.deltaij_theta[i, pcs_index])
+
+                    # Increment the RDC index.
+                    pcs_index = pcs_index + 1
+
+                # Spins with RDC data.
+                if hasattr(spin, 'rdc'):
+                    # Initialise the data structure if necessary.
+                    if not hasattr(spin, 'rdc_bc'):
+                        spin.rdc_bc = []
+
+                    # Append the back calculated PCS.
+                    spin.rdc_bc.append(model.Dij_theta[i, rdc_index])
+
+                    # Increment the RDC index.
+                    rdc_index = rdc_index + 1
 
 
     def __minimise_setup_pcs(self):
@@ -1180,6 +1224,11 @@
             # Warning.
             cdp.warning = warning
 
+        # Statistical analysis.
+        if 'rdc' in data_types or 'pcs' in data_types:
+            # Get the final back calculated data (for the Q-factor and
+            self.__minimise_bc_data(model)
+
 
     def model_statistics(self, instance=None, spin_id=None, 
global_stats=None):
         """Return the k, n, and chi2 model statistics.




Related Messages


Powered by MHonArc, Updated Sat Aug 23 04:20:06 2008