mailRe: r23748 - /branches/disp_spin_speed/target_functions/relax_disp.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Troels Emtekær Linnet on June 10, 2014 - 14:36:
Hi Edward.

In the latest step, I convert all np.X to it correct version.
Keeping np. is just for speed coding, while i progress.

I think we can use chi2 function.

But I need to remove the axis=1 keyword.

It will not influence other results.
But I wanted to mess as little as possible with other functions.

2014-06-10 14:23 GMT+02:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:
For a proper solution which is portable to all analysis types, the
chi-squared value should be calculated using the target_functions.chi2
module.  All other analyses use this module, and the relaxation
dispersion analysis should too.  Maybe a new function is required in
this module which implements this in the numpy way (i.e. numpy.sum()).

You should also import the functions directly from numpy rather than
importing numpy as np.  I make sure that the math module and numpy
module function name clashes do not occur in relax, so 'import numpy
as np' is not used in relax.

Regards,

Edward



On 8 June 2014 23:56,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Sun Jun  8 23:56:36 2014
New Revision: 23748

URL: http://svn.gna.org/viewcvs/relax?rev=23748&view=rev
Log:
Just a tiny little more speed, by removing temporary storage of chi2 
calculation.

Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion 
models for Clustered analysis.

Modified:
    branches/disp_spin_speed/target_functions/relax_disp.py

Modified: branches/disp_spin_speed/target_functions/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/target_functions/relax_disp.py?rev=23748&r1=23747&r2=23748&view=diff
==============================================================================
--- branches/disp_spin_speed/target_functions/relax_disp.py     (original)
+++ branches/disp_spin_speed/target_functions/relax_disp.py     Sun Jun  8 
23:56:36 2014
@@ -553,7 +553,6 @@
         ## Back calculate the R2eff values.
         r2eff_CR72(r20a=self.R20A_a, r20b=self.R20B_a, pA=self.pA_a, 
dw=self.dw_frq_a, kex=self.kex_a, cpmg_frqs=self.cpmg_frqs_a, 
back_calc=self.back_calc_a, num_points=self.num_disp_points_a)

-
         ## For all missing data points, set the back-calculated value to 
the measured values so that it has no effect on the chi-squared value.
         if self.has_missing:
             # Loop over the spins.
@@ -566,14 +565,8 @@
                             #self.back_calc[0][si][mi][0][di] = 
self.values[0][si][mi][0][di]
                             self.back_calc_a[0][si][mi][0][di] = 
self.values[0][si][mi][0][di]

-                    ## Calculate and return the chi-squared value.
-                    #chi2_sum += chi2(self.values[0][si][mi][0], 
self.back_calc[0][si][mi][0], self.errors[0][si][mi][0])
-
         ## Calculate the chi-squared statistic.
-        chi2_sum = np.sum((1.0 / self.errors_a * (self.values_a - 
self.back_calc_a))**2)
-
-        # Return the total chi-squared value.
-        return chi2_sum
+        return chi2_sum = np.sum((1.0 / self.errors_a * (self.values_a - 
self.back_calc_a))**2)


     def calc_ns_cpmg_2site_3D_chi2(self, R20A=None, R20B=None, dw=None, 
pA=None, kex=None):


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

This is the relax-commits mailing list
relax-commits@xxxxxxx

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
relax-devel@xxxxxxx

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



Related Messages


Powered by MHonArc, Updated Tue Jun 10 15:00:11 2014