Hi Troels, I don't think this change is a good idea. There is no way to reach this inf chi2 point when optimisating exponential curves in Minfx or any other optimisation package (http://thread.gmane.org/gmane.science.nmr.relax.scm/23232/focus=6972). Constraints are not necessary, because this exponential function mimics the log-barrier constraint function :) It's pretty much the same thing - the more negative the rate is, the higher the penalty is. The function creates its own natural lower bound. Note that in the methods of multipliers and log-barrier constraint algorithms, the value of Inf is returned by these methods whenever a point is a long way outside the bounds. This is what you are seeing from the exp() function as well. The only way to reach this inf point is if the user sets an initial value which is a large negative number. It is ok to have inf values, and almost all other analyses in relax produce this value when extreme and non-logical numbers are input into them. The numpy.nan_to_num() function call just add unnecessary overhead. Regards, Edward On 1 September 2014 01:16, <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet Date: Mon Sep 1 01:16:17 2014 New Revision: 25495 URL: http://svn.gna.org/viewcvs/relax?rev=25495&view=rev Log: Fix for inf values beeing returned from C-code exponential function. Values are now converted to high values. This fixes systemtest Relax_disp.test_finite_value. Example: x = np.array([np.inf, -np.inf, np.nan, -128, 128]) np.nan_to_num(x) array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000, -1.28000000e+002, 1.28000000e+002]) bug #22552(https://gna.org/bugs/index.php?22552): Chi2 value returned from C-code Curve-fitting return 0.0 for wrong parameters -> Expected influence on Monte-Carlo sim. Ref: http://docs.scipy.org/doc/numpy/reference/generated/numpy.nan_to_num.html 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=25495&r1=25494&r2=25495&view=diff ============================================================================== --- trunk/specific_analyses/relax_fit/optimisation.py (original) +++ trunk/specific_analyses/relax_fit/optimisation.py Mon Sep 1 01:16:17 2014 @@ -23,7 +23,7 @@ """The R1 and R2 exponential relaxation curve fitting optimisation functions.""" # Python module imports. -from numpy import array, float64, ndarray +from numpy import array, float64, ndarray, nan_to_num # relax module imports. from dep_check import C_module_exp_fn @@ -95,7 +95,7 @@ chi2 = func(params) # Return the chi2 value. - return chi2 + return nan_to_num(chi2) def dfunc_wrapper(params): _______________________________________________ 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