Author: tlinnet Date: Wed Aug 27 10:05:03 2014 New Revision: 25325 URL: http://svn.gna.org/viewcvs/relax?rev=25325&view=rev Log: Modified wrapper function for curve_fit, to only change to list type, if the type is a ndarray. task #7822(https://gna.org/task/index.php?7822): Implement user function to estimate R2eff and associated errors for exponential curve fitting. 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=25325&r1=25324&r2=25325&view=diff ============================================================================== --- trunk/specific_analyses/relax_fit/optimisation.py (original) +++ trunk/specific_analyses/relax_fit/optimisation.py Wed Aug 27 10:05:03 2014 @@ -23,7 +23,7 @@ """The R1 and R2 exponential relaxation curve fitting optimisation functions.""" # Python module imports. -from numpy import array, float64 +from numpy import array, float64, ndarray # relax module imports. from dep_check import C_module_exp_fn @@ -87,8 +87,12 @@ @rtype: float """ + # Convert if necessary. + if type(params) == ndarray: + params = params.tolist() + # Call the C code. - chi2 = func(params.tolist()) + chi2 = func(params) # Return the chi2 value. return chi2 @@ -103,8 +107,12 @@ @rtype: numpy float64 array """ + # Convert if necessary. + if type(params) == ndarray: + params = params.tolist() + # Call the C code. - dchi2 = dfunc(params.tolist()) + dchi2 = dfunc(params) # Return the chi2 gradient as a numpy array. return array(dchi2, float64) @@ -119,8 +127,12 @@ @rtype: numpy float64 rank-2 array """ + # Convert if necessary. + if type(params) == ndarray: + params = params.tolist() + # Call the C code. - d2chi2 = d2func(params.tolist()) + d2chi2 = d2func(params) # Return the chi2 Hessian as a numpy array. return array(d2chi2, float64)