Hi Troels,

As there is no Jacobian used in this method at all, maybe it's worth
removing all mentions of 'jacobian' in the docstring and variable.
That will lead to less confusion for future developers looking at this
code.

Cheers,

Edward



On 29 August 2014 15:17,  <[email protected]> wrote:
> Author: tlinnet
> Date: Fri Aug 29 15:17:05 2014
> New Revision: 25434
>
> URL: http://svn.gna.org/viewcvs/relax?rev=25434&view=rev
> Log:
> Replaced the way to calculate the chi2 Jacobian, for exponential fit in minfx.
>
> This is only for the test class, but reuses library code.
>
> This should make it much easier in the future to implement chi2 gradient 
> functions to minfx, since it
> is only necessary to implement the direct gradient of the function, and then 
> pass the direct gradient to chi2 library, which turn it into
> the chi2 gradient function which minfx use.
>
> 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_disp/estimate_r2eff.py
>
> Modified: trunk/specific_analyses/relax_disp/estimate_r2eff.py
> URL: 
> http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/estimate_r2eff.py?rev=25434&r1=25433&r2=25434&view=diff
> ==============================================================================
> --- trunk/specific_analyses/relax_disp/estimate_r2eff.py        (original)
> +++ trunk/specific_analyses/relax_disp/estimate_r2eff.py        Fri Aug 29 
> 15:17:05 2014
> @@ -591,7 +591,7 @@
>
>
>      def func_exp_chi2_grad(self, params=None, times=None, values=None, 
> errors=None):
> -        """Target function for the gradient (Jacobian matrix) of 
> func_exp_chi2() to minfx, for exponential fit .
> +        """Target function for the gradient (Jacobian matrix) to minfx, for 
> exponential fit .
>
>          @param params:  The vector of parameter values.
>          @type params:   numpy rank-1 float array
> @@ -605,25 +605,6 @@
>          @rtype:         numpy array
>          """
>
> -        # Get the Jacobian.
> -        exp_chi2_grad = func_exp_chi2_grad(params=params, times=times, 
> values=values, errors=errors)
> -
> -        # Transpose back, to get rows.
> -        exp_chi2_grad_t = transpose(exp_chi2_grad)
> -
> -        # Extract vectors:
> -        d_chi2_d_r2eff = exp_chi2_grad_t[0]
> -        d_chi2_d_i0 = exp_chi2_grad_t[1]
> -
> -        # Take the sum, to send to minfx.
> -        sum_d_chi2_d_r2eff = sum( d_chi2_d_r2eff )
> -        sum_d_chi2_d_i0 = sum( d_chi2_d_i0 )
> -
> -        # Define Jacobian as m rows with function derivatives and n columns 
> of parameters.
> -        sum_jacobian_matrix_exp_chi2 = transpose(array( [sum_d_chi2_d_r2eff 
> , sum_d_chi2_d_i0] ) )
> -
> -        ######### Try with lib function.
> -
>          # Get the back calc.
>          back_calc = self.func_exp(params=params, times=times)
>
> @@ -637,21 +618,13 @@
>          n = len(params)
>
>          # Define array to update parameters in.
> -        sum_jacobian_matrix_exp_chi2_minfx = zeros([2])
> +        jacobian_chi2_minfx = zeros([n])
>
>          # Update value elements.
> -        dchi2(dchi2=sum_jacobian_matrix_exp_chi2_minfx, M=n, data=values, 
> back_calc_vals=back_calc, back_calc_grad=exp_grad_t, errors=errors)
> -
> -        # Make test of two methods.
> -        test_eq = allclose(sum_jacobian_matrix_exp_chi2, 
> sum_jacobian_matrix_exp_chi2_minfx, rtol=1e-15, atol=1e-15)
> -
> -        if not test_eq:
> -            print("Chi2 gradient are not equal.")
> -            print(asd)
> -
> +        dchi2(dchi2=jacobian_chi2_minfx, M=n, data=values, 
> back_calc_vals=back_calc, back_calc_grad=exp_grad_t, errors=errors)
>
>          # Return Jacobian matrix.
> -        return sum_jacobian_matrix_exp_chi2_minfx
> +        return jacobian_chi2_minfx
>
>
>  def estimate_r2eff(method='minfx', min_algor='simplex', c_code=True, 
> constraints=False, chi2_jacobian=False, spin_id=None, ftol=1e-15, xtol=1e-15, 
> maxfev=10000000, factor=100.0, verbosity=1):
>
>
> _______________________________________________
> 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

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

This is the relax-devel 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-devel

Reply via email to