mailr8863 - in /branches/bmrb: ./ generic_fns/minimise.py generic_fns/relax_data.py generic_fns/value.py


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

Header


Content

Posted by edward on February 22, 2009 - 23:06:
Author: bugman
Date: Sun Feb 22 23:06:04 2009
New Revision: 8863

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

........
  r8861 | bugman | 2009-02-22 23:00:08 +0100 (Sun, 22 Feb 2009) | 3 lines
  
  Fixed some circular import issues.
........
  r8862 | bugman | 2009-02-22 23:03:48 +0100 (Sun, 22 Feb 2009) | 3 lines
  
  Converted the rest of the generic_fns.relax_data module to the 1.3 line 
relax design.
........

Modified:
    branches/bmrb/   (props changed)
    branches/bmrb/generic_fns/minimise.py
    branches/bmrb/generic_fns/relax_data.py
    branches/bmrb/generic_fns/value.py

Propchange: branches/bmrb/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Feb 22 23:06:04 2009
@@ -1,1 +1,1 @@
-/1.3:1-8832
+/1.3:1-8862

Modified: branches/bmrb/generic_fns/minimise.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/minimise.py?rev=8863&r1=8862&r2=8863&view=diff
==============================================================================
--- branches/bmrb/generic_fns/minimise.py (original)
+++ branches/bmrb/generic_fns/minimise.py Sun Feb 22 23:06:04 2009
@@ -30,7 +30,7 @@
 from generic_fns.mol_res_spin import spin_loop
 from generic_fns import pipes
 from relax_errors import RelaxError
-from specific_fns.setup import get_specific_fn
+import specific_fns
 
 
 def reset_min_stats(data_pipe=None, spin=None):
@@ -122,8 +122,8 @@
     cdp = pipes.get_pipe()
 
     # Specific calculate function setup.
-    calculate = get_specific_fn('calculate', cdp.pipe_type)
-    overfit_deselect = get_specific_fn('overfit_deselect', cdp.pipe_type)
+    calculate = specific_fns.setup.get_specific_fn('calculate', 
cdp.pipe_type)
+    overfit_deselect = 
specific_fns.setup.get_specific_fn('overfit_deselect', cdp.pipe_type)
 
     # Deselect residues lacking data:
     overfit_deselect()
@@ -166,8 +166,8 @@
     cdp = pipes.get_pipe()
 
     # Specific grid search function.
-    grid_search = get_specific_fn('grid_search', cdp.pipe_type)
-    overfit_deselect = get_specific_fn('overfit_deselect', cdp.pipe_type)
+    grid_search = specific_fns.setup.get_specific_fn('grid_search', 
cdp.pipe_type)
+    overfit_deselect = 
specific_fns.setup.get_specific_fn('overfit_deselect', cdp.pipe_type)
 
     # Deselect residues lacking data:
     overfit_deselect()
@@ -217,8 +217,8 @@
     cdp = pipes.get_pipe()
 
     # Specific minimisation function.
-    minimise = get_specific_fn('minimise', cdp.pipe_type)
-    overfit_deselect = get_specific_fn('overfit_deselect', cdp.pipe_type)
+    minimise = specific_fns.setup.get_specific_fn('minimise', cdp.pipe_type)
+    overfit_deselect = 
specific_fns.setup.get_specific_fn('overfit_deselect', cdp.pipe_type)
 
     # Deselect residues lacking data:
     overfit_deselect()

Modified: branches/bmrb/generic_fns/relax_data.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/relax_data.py?rev=8863&r1=8862&r2=8863&view=diff
==============================================================================
--- branches/bmrb/generic_fns/relax_data.py (original)
+++ branches/bmrb/generic_fns/relax_data.py Sun Feb 22 23:06:04 2009
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2008 Edward d'Auvergne                                  
 #
+# Copyright (C) 2003-2009 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -31,6 +31,7 @@
 from data import Relax_data_store; ds = Relax_data_store()
 from generic_fns.mol_res_spin import exists_mol_res_spin_data, 
generate_spin_id_data_array, return_spin, spin_index_loop, spin_loop
 from generic_fns import pipes
+from generic_fns import value
 from relax_errors import RelaxError, RelaxNoRiError, RelaxNoSequenceError, 
RelaxNoSpinError, RelaxRiError
 from relax_io import extract_data, strip
 import specific_fns
@@ -162,7 +163,7 @@
         raise RelaxNoSequenceError
 
     # Test if relaxation data corresponding to 'ri_label' and 'frq_label' 
already exists.
-    if test_labels():
+    if test_labels(ri_label, frq_label):
         raise RelaxRiError, (ri_label, frq_label)
 
 
@@ -295,7 +296,7 @@
 
 
 def data_init(container, global_flag=False):
-    """Function for initialising the data structures for a spin container.
+    """Initialise the data structures for a spin container.
 
     @param container:       The data pipe or spin data container 
(PipeContainer or SpinContainer).
     @type container:        class instance
@@ -403,12 +404,13 @@
 
 
 def delete(ri_label=None, frq_label=None):
-    """Function for deleting relaxation data corresponding to ri_label and 
frq_label."""
-
-    # Arguments.
-    self.run = run
-    self.ri_label = ri_label
-    self.frq_label = frq_label
+    """Delete relaxation data corresponding to the Ri and frequency labels.
+
+    @param ri_label:    The relaxation data type, ie 'R1', 'R2', or 'NOE'.
+    @type ri_label:     str
+    @param frq_label:   The field strength label.
+    @type frq_label:    str
+    """
 
     # Test if the current pipe exists.
     pipes.test()
@@ -417,67 +419,62 @@
     if not exists_mol_res_spin_data():
         raise RelaxNoSequenceError
 
-    # Test if data corresponding to 'self.ri_label' and 'self.frq_label' 
exists.
-    if not self.test_labels():
-        raise RelaxNoRiError, (self.ri_label, self.frq_label)
-
-    # Loop over the sequence.
-    for i in xrange(len(ds.res[self.run])):
-        # Remap the data structure 'ds.res[self.run][i]'.
-        data = ds.res[self.run][i]
-
+    # Test if data corresponding to 'ri_label' and 'frq_label' exists.
+    if not test_labels(ri_label, frq_label):
+        raise RelaxNoRiError, (ri_label, frq_label)
+
+    # Loop over the spins.
+    for spin in spin_loop():
         # Global data flag.
-        self.global_flag = 0
+        global_flag = False
 
         # Find the index corresponding to 'ri_label' and 'frq_label'.
-        index = self.find_index(data, ri_label, frq_label)
+        index = find_index(spin, ri_label, frq_label)
 
         # Catch any problems.
         if index == None:
             continue
 
         # Relaxation data and errors.
-        data.relax_data.pop(index)
-        data.relax_error.pop(index)
+        spin.relax_data.pop(index)
+        spin.relax_error.pop(index)
 
         # Update the number of relaxation data points.
-        data.num_ri = data.num_ri - 1
+        spin.num_ri = spin.num_ri - 1
 
         # Delete ri_label from the data types.
-        data.ri_labels.pop(index)
+        spin.ri_labels.pop(index)
 
         # Update the remap table.
-        data.remap_table.pop(index)
-
-        # Find if there is other data corresponding to 'self.frq_label'
-        frq_index = data.frq_labels.index(self.frq_label)
-        if not frq_index in data.remap_table:
+        spin.remap_table.pop(index)
+
+        # Find if there is other data corresponding to 'frq_label'
+        frq_index = spin.frq_labels.index(frq_label)
+        if not frq_index in spin.remap_table:
             # Update the number of frequencies.
-            data.num_frq = data.num_frq - 1
+            spin.num_frq = spin.num_frq - 1
 
             # Update the frequency labels.
-            data.frq_labels.pop(frq_index)
+            spin.frq_labels.pop(frq_index)
 
             # Update the frequency array.
-            data.frq.pop(frq_index)
+            spin.frq.pop(frq_index)
 
         # Update the NOE R1 translation table.
-        data.noe_r1_table.pop(index)
-        for j in xrange(data.num_ri):
-            if data.noe_r1_table[j] > index:
-                data.noe_r1_table[j] = data.noe_r1_table[j] - 1
-
-    # Clean up the runs.
-    self.relax.generic.runs.eliminate_unused_runs()
+        spin.noe_r1_table.pop(index)
+        for j in xrange(spin.num_ri):
+            if spin.noe_r1_table[j] > index:
+                spin.noe_r1_table[j] = spin.noe_r1_table[j] - 1
 
 
 def display(ri_label=None, frq_label=None):
-    """Function for displaying relaxation data corresponding to ri_label and 
frq_label."""
-
-    # Arguments.
-    self.run = run
-    self.ri_label = ri_label
-    self.frq_label = frq_label
+    """Display relaxation data corresponding to the Ri and frequency labels.
+
+    @param ri_label:    The relaxation data type, ie 'R1', 'R2', or 'NOE'.
+    @type ri_label:     str
+    @param frq_label:   The field strength label.
+    @type frq_label:    str
+    """
 
     # Test if the current pipe exists.
     pipes.test()
@@ -486,16 +483,16 @@
     if not exists_mol_res_spin_data():
         raise RelaxNoSequenceError
 
-    # Test if data corresponding to 'self.ri_label' and 'self.frq_label' 
exists.
-    if not self.test_labels():
-        raise RelaxNoRiError, (self.ri_label, self.frq_label)
+    # Test if data corresponding to 'ri_label' and 'frq_label' exists.
+    if not test_labels(ri_label, frq_label):
+        raise RelaxNoRiError, (ri_label, frq_label)
 
     # Print the data.
-    self.relax.generic.value.write_data(run=self.run, param=(self.ri_label, 
self.frq_label), file=sys.stdout, return_value=self.return_value)
+    value.write_data(param=(ri_label, frq_label), file=sys.stdout, 
return_value=return_value)
 
 
 def find_index(data, ri_label, frq_label):
-    """Function for finding the index corresponding to ri_label and 
frq_label.
+    """Find the index corresponding to ri_label and frq_label.
 
     @param data:        The class instance containing the ri_label and 
frq_label variables.
     @type data:         PipeContainer or SpinContainer
@@ -525,7 +522,7 @@
 
 
 def read(ri_label=None, frq_label=None, frq=None, file=None, dir=None, 
file_data=None, mol_name_col=None, res_num_col=0, res_name_col=1, 
spin_num_col=None, spin_name_col=None, data_col=2, error_col=3, sep=None):
-    """Function for reading R1, R2, or NOE relaxation data.
+    """Read R1, R2, or NOE relaxation data from a file.
 
     @param ri_label:        The relaxation data type, ie 'R1', 'R2', or 
'NOE'.
     @type ri_label:         str
@@ -681,26 +678,29 @@
         return 'The relaxation data errors'
 
 
-def return_value(i, data_type):
-    """Function for returning the value and error corresponding to 
'data_type'."""
-
-    # Arguments.
-    self.run = run
+def return_value(spin, data_type):
+    """Return the value and error corresponding to 'data_type'.
+
+    @param spin:        The spin container.
+    @type spin:         SpinContainer instance
+    @param data_type:   A tuple of the Ri label and the frequency label.
+    @type data_type:    tuple of str of length 2
+    """
 
     # Unpack the data_type tuple.
-    self.ri_label, self.frq_label = data_type
+    ri_label, frq_label = data_type
 
     # Initialise.
     value = None
     error = None
 
     # Find the index corresponding to 'ri_label' and 'frq_label'.
-    index = self.find_index(ds.res[self.run][i])
+    index = find_index(spin, ri_label, frq_label)
 
     # Get the data.
     if index != None:
-        value = ds.res[self.run][i].relax_data[index]
-        error = ds.res[self.run][i].relax_error[index]
+        value = spin.relax_data[index]
+        error = spin.relax_error[index]
 
     # Return the data.
     return value, error
@@ -709,9 +709,13 @@
 def test_labels(ri_label, frq_label):
     """Test if data corresponding to 'ri_label' and 'frq_label' currently 
exists.
 
-    @return:        The answer to the question of whether relaxation data 
exists corresponding to
-                    the given labels.
-    @rtype:         bool
+    @param ri_label:    The relaxation data type, ie 'R1', 'R2', or 'NOE'.
+    @type ri_label:     str
+    @param frq_label:   The field strength label.
+    @type frq_label:    str
+    @return:            The answer to the question of whether relaxation 
data exists corresponding
+                        to the given labels.
+    @rtype:             bool
     """
 
     # Loop over the spins.
@@ -731,7 +735,7 @@
 
 
 def update_data_structures_pipe(ri_label=None, frq_label=None, frq=None):
-    """Function for updating all relaxation data structures in the current 
data pipe.
+    """Update all relaxation data structures in the current data pipe.
 
     @param ri_label:        The relaxation data type, ie 'R1', 'R2', or 
'NOE'.
     @type ri_label:         str
@@ -796,7 +800,7 @@
 
 
 def update_data_structures_spin(spin=None, ri_label=None, frq_label=None, 
frq=None, value=None, error=None):
-    """Function for updating all relaxation data structures of the given 
spin container.
+    """Update all relaxation data structures of the given spin container.
 
     @param spin:            The SpinContainer object.
     @type spin:             class instance
@@ -909,12 +913,7 @@
 
 
 def write(ri_label=None, frq_label=None, file=None, dir=None, force=False):
-    """Function for writing relaxation data."""
-
-    # Arguments.
-    self.run = run
-    self.ri_label = ri_label
-    self.frq_label = frq_label
+    """Write relaxation data to a file."""
 
     # Test if the current pipe exists.
     pipes.test()
@@ -923,13 +922,13 @@
     if not exists_mol_res_spin_data():
         raise RelaxNoSequenceError
 
-    # Test if data corresponding to 'self.ri_label' and 'self.frq_label' 
exists.
-    if not self.test_labels():
-        raise RelaxNoRiError, (self.ri_label, self.frq_label)
+    # Test if data corresponding to 'ri_label' and 'frq_label' exists.
+    if not test_labels(ri_label, frq_label):
+        raise RelaxNoRiError, (ri_label, frq_label)
 
     # Create the file name if none is given.
     if file == None:
-        file = self.ri_label + "." + self.frq_label + ".out"
+        file = ri_label + "." + frq_label + ".out"
 
     # Write the data.
-    self.relax.generic.value.write(run=self.run, param=(self.ri_label, 
self.frq_label), file=file, dir=dir, force=force, 
return_value=self.return_value)
+    value.write(param=(ri_label, frq_label), file=file, dir=dir, 
force=force, return_value=return_value)

Modified: branches/bmrb/generic_fns/value.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/value.py?rev=8863&r1=8862&r2=8863&view=diff
==============================================================================
--- branches/bmrb/generic_fns/value.py (original)
+++ branches/bmrb/generic_fns/value.py Sun Feb 22 23:06:04 2009
@@ -33,7 +33,7 @@
 from generic_fns.sequence import write_header, write_line
 from relax_errors import RelaxError, RelaxFileEmptyError, 
RelaxNoSequenceError, RelaxNoSpinError, RelaxParamSetError, RelaxValueError
 from relax_io import extract_data, open_write_file, strip
-from specific_fns.setup import get_specific_fn
+import specific_fns
 
 
 def copy(pipe_from=None, pipe_to=None, param=None):
@@ -66,7 +66,7 @@
         raise RelaxNoSequenceError, pipe_to
 
     # Specific value and error returning function.
-    return_value = get_specific_fn('return_value', pipes.get_type(pipe_from))
+    return_value = specific_fns.setup.get_specific_fn('return_value', 
pipes.get_type(pipe_from))
 
     # Test if the data exists for pipe_to.
     for spin in spin_loop(pipe_to):
@@ -126,7 +126,7 @@
     """
 
     # Specific functions.
-    is_spin_param = get_specific_fn('is_spin_param', pipes.get_type())
+    is_spin_param = specific_fns.setup.get_specific_fn('is_spin_param', 
pipes.get_type())
 
     # Initialise.
     spin_params = []
@@ -245,7 +245,7 @@
         min_stat = False
 
         # Specific v
-        return_value = get_specific_fn('return_value', pipes.get_type())
+        return_value = specific_fns.setup.get_specific_fn('return_value', 
pipes.get_type())
 
         # Specific set function.
         set = set_spin_params
@@ -364,8 +364,8 @@
     pipes.test()
 
     # Specific functions.
-    return_value = get_specific_fn('return_value', pipes.get_type())
-    set_non_spin_params = get_specific_fn('set_non_spin_params', 
pipes.get_type())
+    return_value = specific_fns.setup.get_specific_fn('return_value', 
pipes.get_type())
+    set_non_spin_params = 
specific_fns.setup.get_specific_fn('set_non_spin_params', pipes.get_type())
 
     # The parameters have been specified.
     if param:
@@ -453,10 +453,10 @@
     """
 
     # Specific functions.
-    data_init = get_specific_fn('data_init', pipes.get_type())
-    default_value = get_specific_fn('default_value', pipes.get_type())
-    return_data_name = get_specific_fn('return_data_name', pipes.get_type())
-    set_update = get_specific_fn('set_update', pipes.get_type())
+    data_init = specific_fns.setup.get_specific_fn('data_init', 
pipes.get_type())
+    default_value = specific_fns.setup.get_specific_fn('default_value', 
pipes.get_type())
+    return_data_name = 
specific_fns.setup.get_specific_fn('return_data_name', pipes.get_type())
+    set_update = specific_fns.setup.get_specific_fn('set_update', 
pipes.get_type())
 
 
     # Setting the model parameters prior to minimisation.
@@ -601,7 +601,7 @@
 
     # Get the value and error returning function if required.
     if not return_value:
-        return_value = get_specific_fn('return_value', pipes.get_type())
+        return_value = specific_fns.setup.get_specific_fn('return_value', 
pipes.get_type())
 
     # Format string.
     format = "%-30s%-30s"




Related Messages


Powered by MHonArc, Updated Mon Feb 23 00:00:06 2009