mailr8327 - /branches/relax_disp/specific_fns/relax_disp.py


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

Header


Content

Posted by sebastien . morin . 1 on January 07, 2009 - 22:53:
Author: semor
Date: Wed Jan  7 22:53:12 2009
New Revision: 8327

URL: http://svn.gna.org/viewcvs/relax?rev=8327&view=rev
Log:
Made a few changes towards a functional relaxation dispersion code.

This includes several modifications as well as the addition of the exp_type() 
function.


Modified:
    branches/relax_disp/specific_fns/relax_disp.py

Modified: branches/relax_disp/specific_fns/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_fns/relax_disp.py?rev=8327&r1=8326&r2=8327&view=diff
==============================================================================
--- branches/relax_disp/specific_fns/relax_disp.py (original)
+++ branches/relax_disp/specific_fns/relax_disp.py Wed Jan  7 22:53:12 2009
@@ -1,6 +1,7 @@
 
###############################################################################
 #                                                                            
 #
 # Copyright (C) 2004-2008 Edward d'Auvergne                                  
 #
+# Copyright (C) 2009 Sebastien Morin                                         
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -21,7 +22,7 @@
 
###############################################################################
 
 # Module docstring.
-"""The relaxation curve fitting specific code."""
+"""The relaxation dispersion curve fitting specific code."""
 
 # Python module imports.
 from numpy import array, average, dot, float64, identity, zeros
@@ -38,10 +39,10 @@
 
 # C modules.
 if C_module_exp_fn:
-    from maths_fns.relax_fit import setup, func, dfunc, d2func, back_calc_I
-
-
-class Relax_fit(Common_functions):
+    from maths_fns.relax_disp import setup, func, dfunc, d2func, back_calc_I
+
+
+class Relax_disp(Common_functions):
     """Class containing functions for relaxation curve fitting."""
 
     def assemble_param_vector(self, spin=None, sim_index=None):
@@ -377,6 +378,40 @@
             # Intensity at infinity.
             if cdp.curve_type == 'inv':
                 spin.iinf = param_vector[2]
+
+
+    def exp_type(self, exp='cpmg'):
+        """Function for selecting the relaxation dispersion experiment type 
performed.
+        @keyword exp: The relaxation dispersion experiment type.  Can be one 
of 'cpmg' or 'r1rho'.
+        @type exp:    str
+        """
+
+        # Test if the current pipe exists.
+        pipes.test
+
+        # Get the current data pipe.
+        cdp = pipes.get_pipe()
+
+        # Test if the pipe type is set to 'relax_disp'.
+        function_type = cdp.pipe_type
+        if function_type != 'relax_disp':
+            raise RelaxFuncSetupError, 
specific_setup.get_string(function_type)
+
+        # Test if the sequence data is loaded.
+        if not exists_mol_res_spin_data():
+            raise RelaxNoSequenceError
+
+       # CPMG relaxation dispersion experiments.
+       if exp = 'cpmg':
+           print "CPMG relaxation dispersion experiments."
+
+       # R1rho relaxation dispersion experiments.
+       elif exp = 'r1rho':
+           print "R1rho relaxation dispersion experiments."
+
+       # Invalid relaxation dispersion experiment.
+       else:
+           raise RelaxError, "The relaxation dispersion experiment '" + exp 
+ "' is invalid."
 
 
     def grid_search(self, lower=None, upper=None, inc=None, 
constraints=True, verbosity=1, sim_index=None):
@@ -707,7 +742,7 @@
                     lm_error[index:index+len(relax_error[k])] = 
relax_error[k]
                     index = index + len(relax_error[k])
 
-                min_options = min_options + (self.relax_fit.lm_dri, lm_error)
+                min_options = min_options + (self.relax_disp.lm_dri, 
lm_error)
 
 
             # Minimisation.
@@ -968,10 +1003,11 @@
         return None
 
 
-    def select_model(self, model='exp'):
+    def select_model(self, model='fast'):
         """Function for selecting the model of the exponential curve.
 
-        @keyword model: The exponential curve type.  Can be one of 'exp' or 
'inv'.
+        @keyword model: The relaxation dispersion time scale for curve 
fitting.  Can be one of
+                        'fast' or 'slow'.
         @type model:    str
         """
 
@@ -981,24 +1017,24 @@
         # Get the current data pipe.
         cdp = pipes.get_pipe()
 
-        # Test if the pipe type is set to 'relax_fit'.
+        # Test if the pipe type is set to 'relax_disp'.
         function_type = cdp.pipe_type
-        if function_type != 'relax_fit':
+        if function_type != 'relax_disp':
             raise RelaxFuncSetupError, 
specific_setup.get_string(function_type)
 
         # Test if sequence data is loaded.
         if not exists_mol_res_spin_data():
             raise RelaxNoSequenceError
 
-        # Two parameter exponential fit.
-        if model == 'exp':
+        # Fast-exchange regime.
+        if model == 'fast':
             print "Two parameter exponential fit."
-            params = ['Rx', 'I0']
-
-        # Three parameter inversion recovery fit.
-        elif model == 'inv':
+            params = ['R2', 'Rex', 'kex']
+
+        # Slow-exchange regime.
+        elif model == 'slow':
             print "Three parameter inversion recovery fit."
-            params = ['Rx', 'I0', 'Iinf']
+            params = ['R2A', 'kA', 'dw']
 
         # Invalid model.
         else:
@@ -1010,7 +1046,7 @@
 
     def set_doc(self):
         """
-        Relaxation curve fitting set details
+        Relaxation dispersion curve fitting set details
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
         Only three parameters can be set, the relaxation rate (Rx), the 
initial intensity (I0), and




Related Messages


Powered by MHonArc, Updated Thu Jan 08 00:20:03 2009