Author: bugman Date: Tue Aug 26 11:16:02 2014 New Revision: 25270 URL: http://svn.gna.org/viewcvs/relax?rev=25270&view=rev Log: The I0 and R parameter indices are now defined in the target_function/relax_fit.h header file. This is to abstract the exponential curve parameter indices even more. Modified: trunk/target_functions/relax_fit.c trunk/target_functions/relax_fit.h Modified: trunk/target_functions/relax_fit.c URL: http://svn.gna.org/viewcvs/relax/trunk/target_functions/relax_fit.c?rev=25270&r1=25269&r2=25270&view=diff ============================================================================== --- trunk/target_functions/relax_fit.c (original) +++ trunk/target_functions/relax_fit.c Tue Aug 26 11:16:02 2014 @@ -108,7 +108,7 @@ } /* Back calculated the peak intensities */ - exponential(params[1], params[0], relax_times, back_calc, num_times); + exponential(params[index_I0], params[index_R], relax_times, back_calc, num_times); /* Calculate and return the chi-squared value */ return PyFloat_FromDouble(chi2(values, sd, back_calc, num_times)); @@ -145,11 +145,11 @@ } /* Back calculated the peak intensities */ - exponential(params[1], params[0], relax_times, back_calc, num_times); + exponential(params[index_I0], params[index_R], relax_times, back_calc, num_times); /* The partial derivates */ - exponential_dR(params[1], params[0], 0, relax_times, back_calc_grad, num_times); - exponential_dI0(params[1], params[0], 1, relax_times, back_calc_grad, num_times); + exponential_dR(params[index_I0], params[index_R], index_R, relax_times, back_calc_grad, num_times); + exponential_dI0(params[index_I0], params[index_R], index_I0, relax_times, back_calc_grad, num_times); /* The chi-squared gradient */ dchi2(dchi2_vals, values, back_calc, back_calc_grad, sd, num_times, num_params); @@ -220,8 +220,8 @@ } /* The partial derivates */ - exponential_dR(params[1], params[0], 0, relax_times, back_calc_grad, num_times); - exponential_dI0(params[1], params[0], 1, relax_times, back_calc_grad, num_times); + exponential_dR(params[index_I0], params[index_R], index_R, relax_times, back_calc_grad, num_times); + exponential_dI0(params[index_I0], params[index_R], index_I0, relax_times, back_calc_grad, num_times); /* Convert to a Python list of lists */ PyObject *list = PyList_New(0); Modified: trunk/target_functions/relax_fit.h URL: http://svn.gna.org/viewcvs/relax/trunk/target_functions/relax_fit.h?rev=25270&r1=25269&r2=25270&view=diff ============================================================================== --- trunk/target_functions/relax_fit.h (original) +++ trunk/target_functions/relax_fit.h Tue Aug 26 11:16:02 2014 @@ -37,6 +37,10 @@ /* Variables sent to the setup function to be stored for later use */ static int num_params, num_times; +/* Hardcoded parameter indices. */ +static int index_R = 0; +static int index_I0 = 1; + /* Variables used for storage during the function calls of optimisation */ static double back_calc[MAXTIMES]; static double back_calc_grad[MAXPARAMS][MAXTIMES];