mailr15327 - in /branches/frame_order_testing: ./ generic_fns/pcs.py generic_fns/rdc.py prompt/pcs.py prompt/rdc.py


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

Header


Content

Posted by edward on February 08, 2012 - 15:35:
Author: bugman
Date: Wed Feb  8 15:35:41 2012
New Revision: 15327

URL: http://svn.gna.org/viewcvs/relax?rev=15327&view=rev
Log:
Merged revisions 15326 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3

........
  r15326 | bugman | 2012-02-08 15:33:34 +0100 (Wed, 08 Feb 2012) | 5 lines
  
  Implemented the rdc.delete and pcs.delete user function backends.
  
  This code previously did not exist, although the front ends were exposed to 
the user!
........

Modified:
    branches/frame_order_testing/   (props changed)
    branches/frame_order_testing/generic_fns/pcs.py
    branches/frame_order_testing/generic_fns/rdc.py
    branches/frame_order_testing/prompt/pcs.py
    branches/frame_order_testing/prompt/rdc.py

Propchange: branches/frame_order_testing/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Feb  8 15:35:41 2012
@@ -1,1 +1,1 @@
-/1.3:1-15322
+/1.3:1-15326

Modified: branches/frame_order_testing/generic_fns/pcs.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/pcs.py?rev=15327&r1=15326&r2=15327&view=diff
==============================================================================
--- branches/frame_order_testing/generic_fns/pcs.py (original)
+++ branches/frame_order_testing/generic_fns/pcs.py Wed Feb  8 15:35:41 2012
@@ -24,6 +24,7 @@
 """Module for the manipulation of pseudocontact shift data."""
 
 # Python module imports.
+from copy import deepcopy
 from math import pi, sqrt
 from numpy import array, float64, ones, zeros
 from numpy.linalg import norm
@@ -313,6 +314,54 @@
 
         # The main data.
         grace.write_xy_data(data=data, file=file, graph_type=graph_type)
+
+
+def delete(align_id=None):
+    """Delete the PCS data corresponding to the alignment ID.
+
+    @keyword align_id:  The alignment tensor ID string.  If not specified, 
all data will be deleted.
+    @type align_id:     str or None
+    """
+
+    # Test if the current data pipe exists.
+    pipes.test()
+
+    # Test if sequence data exists.
+    if not exists_mol_res_spin_data():
+        raise RelaxNoSequenceError
+
+    # Check that the ID exists.
+    if align_id and not align_id in cdp.pcs_ids:
+        raise RelaxError("The PCS alignment id '%s' does not exist" % 
align_id)
+
+    # The IDs.
+    if not align_id:
+        ids = deepcopy(cdp.pcs_ids)
+    else:
+        ids = [align_id]
+
+    # Loop over the alignments, removing all the corresponding data.
+    for id in ids:
+        # The PCS ID.
+        cdp.pcs_ids.pop(cdp.pcs_ids.index(id))
+
+        # The data type.
+        if hasattr(cdp, 'pcs_data_types') and cdp.pcs_data_types.has_key(id):
+            cdp.pcs_data_types.pop(id)
+
+        # The spin data.
+        for spin in spin_loop():
+            # The data.
+            if hasattr(spin, 'pcs') and spin.pcs.has_key(id):
+                spin.pcs.pop(id)
+
+            # The error.
+            if hasattr(spin, 'pcs_err') and spin.pcs_err.has_key(id):
+                spin.pcs_err.pop(id)
+
+        # Clean the global data.
+        if not hasattr(cdp, 'rdc_ids') or id not in cdp.rdc_ids:
+            cdp.align_ids.pop(id)
 
 
 def display(align_id=None, bc=False):

Modified: branches/frame_order_testing/generic_fns/rdc.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/rdc.py?rev=15327&r1=15326&r2=15327&view=diff
==============================================================================
--- branches/frame_order_testing/generic_fns/rdc.py (original)
+++ branches/frame_order_testing/generic_fns/rdc.py Wed Feb  8 15:35:41 2012
@@ -24,6 +24,7 @@
 """Module for the manipulation of RDC data."""
 
 # Python module imports.
+from copy import deepcopy
 from math import pi, sqrt
 from numpy import float64, ones, zeros
 from numpy.linalg import norm
@@ -240,6 +241,54 @@
 
         # The main data.
         grace.write_xy_data(data=data, file=file, graph_type=graph_type)
+
+
+def delete(align_id=None):
+    """Delete the RDC data corresponding to the alignment ID.
+
+    @keyword align_id:  The alignment tensor ID string.  If not specified, 
all data will be deleted.
+    @type align_id:     str or None
+    """
+
+    # Test if the current data pipe exists.
+    pipes.test()
+
+    # Test if sequence data exists.
+    if not exists_mol_res_spin_data():
+        raise RelaxNoSequenceError
+
+    # Check that the ID exists.
+    if align_id and not align_id in cdp.rdc_ids:
+        raise RelaxError("The RDC alignment id '%s' does not exist" % 
align_id)
+
+    # The IDs.
+    if not align_id:
+        ids = deepcopy(cdp.rdc_ids)
+    else:
+        ids = [align_id]
+
+    # Loop over the alignments, removing all the corresponding data.
+    for id in ids:
+        # The RDC ID.
+        cdp.rdc_ids.pop(cdp.rdc_ids.index(id))
+
+        # The data type.
+        if hasattr(cdp, 'rdc_data_types') and cdp.rdc_data_types.has_key(id):
+            cdp.rdc_data_types.pop(id)
+
+        # The spin data.
+        for spin in spin_loop():
+            # The data.
+            if hasattr(spin, 'rdc') and spin.rdc.has_key(id):
+                spin.rdc.pop(id)
+
+            # The error.
+            if hasattr(spin, 'rdc_err') and spin.rdc_err.has_key(id):
+                spin.rdc_err.pop(id)
+
+        # Clean the global data.
+        if not hasattr(cdp, 'pcs_ids') or id not in cdp.pcs_ids:
+            cdp.align_ids.pop(id)
 
 
 def display(align_id=None, bc=False):

Modified: branches/frame_order_testing/prompt/pcs.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/prompt/pcs.py?rev=15327&r1=15326&r2=15327&view=diff
==============================================================================
--- branches/frame_order_testing/prompt/pcs.py (original)
+++ branches/frame_order_testing/prompt/pcs.py Wed Feb  8 15:35:41 2012
@@ -231,7 +231,7 @@
             print(text)
 
         # The argument checks.
-        arg_check.is_str(align_id, 'alignment ID string')
+        arg_check.is_str(align_id, 'alignment ID string', can_be_none=True)
 
         # Execute the functional code.
         pcs.delete(align_id=align_id)

Modified: branches/frame_order_testing/prompt/rdc.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/prompt/rdc.py?rev=15327&r1=15326&r2=15327&view=diff
==============================================================================
--- branches/frame_order_testing/prompt/rdc.py (original)
+++ branches/frame_order_testing/prompt/rdc.py Wed Feb  8 15:35:41 2012
@@ -231,7 +231,7 @@
             print(text)
 
         # The argument checks.
-        arg_check.is_str(align_id, 'alignment ID string')
+        arg_check.is_str(align_id, 'alignment ID string', can_be_none=True)
 
         # Execute the functional code.
         rdc.delete(align_id=align_id)




Related Messages


Powered by MHonArc, Updated Wed Feb 08 16:00:01 2012