mailr24839 - in /branches/frame_order_cleanup/specific_analyses/frame_order: api.py optimisation.py


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

Header


Content

Posted by edward on July 30, 2014 - 17:27:
Author: bugman
Date: Wed Jul 30 17:27:07 2014
New Revision: 24839

URL: http://svn.gna.org/viewcvs/relax?rev=24839&view=rev
Log:
Fixes for the removal of the RDC data checks from the frame order 
optimisation functions.

The specific analysis API method overfit_deselect() has now been created to 
deselect spins which do
not have PCS data or interatomic data containers missing RDC data.  The 
handling of deselected spins
and interatomic data containers is now also correctly handled throughout the 
frame order specific
code.


Modified:
    branches/frame_order_cleanup/specific_analyses/frame_order/api.py
    branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py

Modified: branches/frame_order_cleanup/specific_analyses/frame_order/api.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/api.py?rev=24839&r1=24838&r2=24839&view=diff
==============================================================================
--- branches/frame_order_cleanup/specific_analyses/frame_order/api.py   
(original)
+++ branches/frame_order_cleanup/specific_analyses/frame_order/api.py   Wed 
Jul 30 17:27:07 2014
@@ -37,7 +37,6 @@
 from pipe_control import pipes
 from pipe_control.interatomic import interatomic_loop, return_interatom
 from pipe_control.mol_res_spin import return_spin, spin_loop
-from pipe_control.rdc import check_rdcs
 from specific_analyses.api_base import API_base
 from specific_analyses.api_common import API_common
 from specific_analyses.frame_order.checks import check_pivot
@@ -63,7 +62,6 @@
         self.is_spin_param = self._is_spin_param_false
         self.model_loop = self._model_loop_single_global
         self.model_type = self._model_type_global
-        self.overfit_deselect = self._overfit_deselect_dummy
         self.print_model_title = self._print_model_title_global
         self.return_conversion_factor = self._return_no_conversion_factor
         self.set_param_values = self._set_param_values_global
@@ -86,8 +84,12 @@
 
         # Loop over the interatomic data containers for the moving domain 
(for the RDC data).
         for interatom in interatomic_loop(selection1=domain_moving()):
-            # RDC checks.
-            if not check_rdcs(interatom):
+            # Skip deselected containers.
+            if not interatom.select:
+                continue
+
+            # No RDC, so skip.
+            if not hasattr(interatom, 'rdc'):
                 continue
 
             # Loop over the alignment IDs.
@@ -619,6 +621,32 @@
         return k, n, cdp.chi2
 
 
+    def overfit_deselect(self, data_check=True, verbose=True):
+        """Deselect spins which have insufficient data to support 
minimisation.
+
+        @keyword data_check:    A flag to signal if the presence of base 
data is to be checked for.
+        @type data_check:       bool
+        @keyword verbose:       A flag which if True will allow printouts.
+        @type verbose:          bool
+        """
+
+        # Nothing to do.
+        if not data_check:
+            return
+
+        # Loop over spin data, checking for PCS data.
+        for spin, spin_id in spin_loop(return_id=True, skip_desel=True):
+            if not hasattr(spin, 'pcs'):
+                print("No PCS data is present, deselecting the spin '%s'." % 
spin_id)
+                spin.select = False
+
+        # Loop over the interatomic data containers, checking for RDC data.
+        for interatom in interatomic_loop(selection1=domain_moving()):
+            if not hasattr(interatom, 'rdc'):
+                print("No RDC data is present, deselecting the interatomic 
data container between spins '%s' and '%s'." % (interatom.spin_id1, 
interatom.spin_id2))
+                interatom.select = False
+
+
     def return_error(self, data_id):
         """Return the RDC or PCS error structure.
 

Modified: 
branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py?rev=24839&r1=24838&r2=24839&view=diff
==============================================================================
--- 
branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py  
(original)
+++ 
branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py  
Wed Jul 30 17:27:07 2014
@@ -364,14 +364,10 @@
         absolute.append([])
 
         # Interatom loop over the domain.
-        for interatom in interatomic_loop(domain_moving()):
+        for interatom in interatomic_loop(domain_moving(), skip_desel=True):
             # Get the spins.
             spin1 = return_spin(interatom.spin_id1)
             spin2 = return_spin(interatom.spin_id2)
-
-            # Skip deselected spins.
-            if not spin1.select or not spin2.select:
-                continue
 
             # Only use interatomic data containers with RDC and vector data.
             if not hasattr(interatom, 'rdc') or not hasattr(interatom, 
'vector'):
@@ -603,7 +599,7 @@
 
         # Interatomic data container loop.
         rdc_index = 0
-        for interatom in interatomic_loop(domain_moving()):
+        for interatom in interatomic_loop(domain_moving(), skip_desel=True):
             # Initialise the data structure.
             if not hasattr(interatom, 'rdc_bc'):
                 interatom.rdc_bc = {}




Related Messages


Powered by MHonArc, Updated Wed Jul 30 17:40:02 2014