Author: bugman
Date: Tue Aug 26 09:06:32 2014
New Revision: 25261

URL: http://svn.gna.org/viewcvs/relax?rev=25261&view=rev
Log:
Implementation of the specific_analyses.relax_fit.optimisation.dfunc_wrapper() 
function.

This interfaces with the target_functions.relax_fit C module and converts the 
gradient from a Python
list to a numpy array.


Modified:
    trunk/specific_analyses/relax_fit/optimisation.py

Modified: trunk/specific_analyses/relax_fit/optimisation.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_fit/optimisation.py?rev=25261&r1=25260&r2=25261&view=diff
==============================================================================
--- trunk/specific_analyses/relax_fit/optimisation.py   (original)
+++ trunk/specific_analyses/relax_fit/optimisation.py   Tue Aug 26 09:06:32 2014
@@ -22,13 +22,16 @@
 # Module docstring.
 """The R1 and R2 exponential relaxation curve fitting optimisation 
functions."""
 
+# Python module imports.
+from numpy import array, float64
+
 # relax module imports.
 from dep_check import C_module_exp_fn
 from specific_analyses.relax_fit.parameters import assemble_param_vector
 
 # C modules.
 if C_module_exp_fn:
-    from target_functions.relax_fit import setup, func, back_calc_I
+    from target_functions.relax_fit import setup, func, dfunc, back_calc_I
 
 
 def back_calc(spin=None, relax_time_id=None):
@@ -97,6 +100,12 @@
     The currently does nothing.
     """
 
+    # Call the C code.
+    dchi2 = dfunc(params.tolist())
+
+    # Return the chi2 gradient as a numpy array.
+    return array(dchi2, float64)
+
 
 def d2func_wrapper(params):
     """Wrapper function for the C module, for converting numpy arrays.


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
[email protected]

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits

Reply via email to