Author: tlinnet Date: Mon Aug 25 01:09:00 2014 New Revision: 25236 URL: http://svn.gna.org/viewcvs/relax?rev=25236&view=rev Log: Small changes to verification scripts, to use chi2 function and use the scaling matrix correct. task #7822(https://gna.org/task/index.php?7822): Implement user function to estimate R2eff and associated errors for exponential curve fitting. Modified: trunk/test_suite/shared_data/curve_fitting/profiling/profiling_relax_fit.py trunk/test_suite/shared_data/curve_fitting/profiling/verify_error.py Modified: trunk/test_suite/shared_data/curve_fitting/profiling/profiling_relax_fit.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/curve_fitting/profiling/profiling_relax_fit.py?rev=25236&r1=25235&r2=25236&view=diff ============================================================================== --- trunk/test_suite/shared_data/curve_fitting/profiling/profiling_relax_fit.py (original) +++ trunk/test_suite/shared_data/curve_fitting/profiling/profiling_relax_fit.py Mon Aug 25 01:09:00 2014 @@ -57,6 +57,7 @@ # relax module imports. from status import Status; status = Status() from target_functions.relax_fit import setup, func, dfunc, d2func, back_calc_I +from target_functions.chi2 import chi2_rankN from target_functions.relax_disp_curve_fit import Exponential @@ -289,6 +290,8 @@ #param_vector = array([ 0., 0.]) self.param_vector = array([ 8.800000000000001e+00, 2.000000000800000e+05]) self.scaling_list = [1.0, 1.0] + self.scaling_matrix = array( [ [self.scaling_list[0], 0], [0, self.scaling_list[1]] ]) + self.func_tol = 1e-25 self.grad_tol = None #self.max_iterations = 10000000 @@ -372,7 +375,7 @@ for values, errors, times, struct, num_times in C.loop_data(): # Initialise the function to minimise. - exp_class = Exponential(num_params=len(C.param_vector), num_times=num_times, values=values, sd=errors, relax_times=times, scaling_matrix=C.scaling_list) + exp_class = Exponential(num_params=len(C.param_vector), num_times=num_times, values=values, sd=errors, relax_times=times, scaling_matrix=C.scaling_matrix) results = generic_minimise(func=exp_class.func_exp, args=(), x0=C.param_vector, min_algor=C.min_algor, min_options=C.min_options, func_tol=C.func_tol, grad_tol=C.grad_tol, maxiter=C.max_iterations, A=C.A, b=C.b, full_output=True, print_flag=C.verbosity) @@ -394,7 +397,7 @@ for values, errors, times, struct, num_times in C.loop_data(): # Initialise the function to minimise. - exp_class = Exponential(num_params=len(C.param_vector), num_times=num_times, values=values, sd=errors, relax_times=times, scaling_matrix=C.scaling_list) + exp_class = Exponential() # Do optimisation with scipy.optimize.curve_fit # sigma : None or M-length sequence, optional. If not None, these values are used as weights in the least-squares problem. @@ -478,7 +481,7 @@ back_calc = exp_class.calc_exp(times=times, r2eff=popt[0], i0=popt[1]) # Calculate chi2. - chi2 = exp_class.chi2_rankN(data=values, back_calc_vals=back_calc, errors=errors) + chi2 = chi2_rankN(data=values, back_calc_vals=back_calc, errors=errors) chi2_list.append(chi2) Modified: trunk/test_suite/shared_data/curve_fitting/profiling/verify_error.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/curve_fitting/profiling/verify_error.py?rev=25236&r1=25235&r2=25236&view=diff ============================================================================== --- trunk/test_suite/shared_data/curve_fitting/profiling/verify_error.py (original) +++ trunk/test_suite/shared_data/curve_fitting/profiling/verify_error.py Mon Aug 25 01:09:00 2014 @@ -30,6 +30,7 @@ #from specific_analyses.relax_disp.data import average_intensity, generate_r20_key, get_curve_type, has_exponential_exp_type, has_r1rho_exp_type, loop_exp_frq, loop_exp_frq_offset_point, loop_exp_frq_offset_point_time, loop_time, return_grace_file_name_ini, return_param_key_from_data from specific_analyses.relax_disp.data import average_intensity, find_intensity_keys, loop_exp_frq_offset_point, loop_time, return_param_key_from_data from status import Status; status = Status() +from target_functions.chi2 import chi2_rankN # Initial try for Exponential class. from target_functions.relax_disp_curve_fit import Exponential @@ -197,7 +198,7 @@ back_calc = exp_class.calc_exp(times=times, r2eff=popt[0], i0=popt[1]) # Calculate chi2. - chi2 = exp_class.chi2_rankN(data=values, back_calc_vals=back_calc, errors=errors) + chi2 = chi2_rankN(data=values, back_calc_vals=back_calc, errors=errors) # 'pcov': The estimated covariance of popt. # The diagonals provide the variance of the parameter estimate.