Hi, The problem is shown in the line:
target_functions/relax_fit.c:21:20: error: Python.h: No such file or directory I.e. the Python headers cannot be found by the compiler. How do you compile this? Do you use 'scons'? Have you compiled the module before? Is the Python.h file in the directory /sbinlab2/software/python-enthought-dis/canopy-1.4.0-full-rh5-64/Canopy_64bit/User/include/python2.7? Regards, Edward On 26 August 2014 14:57, Troels Emtekær Linnet <tlin...@nmr-relax.com> wrote: > I get this when I try to compile: > > gcc -o target_functions/c_chi2.os -c > -I/sbinlab2/software/python- > enthought-dis/canopy-1.4.0-full-rh5-64/Canopy_64bit/User/include/python2.7 > -fPIC target_functions/c_chi2.c > gcc -o target_functions/exponential.os -c > -I/sbinlab2/software/python-enthought-dis/canopy-1.4.0-full-rh5-64/Canopy_64bit/User/include/python2.7 > -fPIC target_functions/exponential.c > gcc -o target_functions/relax_fit.os -c > -I/sbinlab2/software/python-enthought-dis/canopy-1.4.0-full-rh5-64/Canopy_64bit/User/include/python2.7 > -fPIC target_functions/relax_fit.c > target_functions/relax_fit.c:21:20: error: Python.h: No such file or directory > target_functions/relax_fit.c:31: error: expected '=', ',', ';', 'asm' > or '__attribute__' before '*' token > target_functions/relax_fit.c:80: error: expected '=', ',', ';', 'asm' > or '__attribute__' before '*' token > target_functions/relax_fit.c:118: error: expected '=', ',', ';', 'asm' > or '__attribute__' before '*' token > target_functions/relax_fit.c:168: error: expected '=', ',', ';', 'asm' > or '__attribute__' before '*' token > target_functions/relax_fit.c:179: error: expected '=', ',', ';', 'asm' > or '__attribute__' before '*' token > target_functions/relax_fit.c:196: error: expected '=', ',', ';', 'asm' > or '__attribute__' before '*' token > target_functions/relax_fit.c:244: error: expected '=', ',', ';', 'asm' > or '__attribute__' before 'relax_fit_methods' > target_functions/relax_fit.c: In function 'initrelax_fit': > target_functions/relax_fit.c:305: error: 'relax_fit_methods' > undeclared (first use in this function) > target_functions/relax_fit.c:305: error: (Each undeclared identifier > is reported only once > target_functions/relax_fit.c:305: error: for each function it appears in.) > scons: *** [target_functions/relax_fit.os] Error 1 > scons: building terminated because of errors. > > 2014-08-26 13:30 GMT+02:00 Edward d'Auvergne <edw...@nmr-relax.com>: >> The minfx equivalent algorithms as scipy.optimize.fmin_cg() and >> scipy.optimize.fmin_ncg(), as well as the other scipy.optimize >> functions are now working with the exponential curve-fitting in relax >> as the gradient is now implemented. None of the Scipy algorithms >> require the Hessian. They really need to implement the Newton >> optimisation technique to be taken seriously. This is quite different >> to NCG: >> >> http://home.gna.org/minfx/minfx.ncg-module.html >> http://home.gna.org/minfx/minfx.newton-module.html >> >> Regards, >> >> Edward >> >> >> On 26 August 2014 13:23, <tlin...@nmr-relax.com> wrote: >>> Author: tlinnet >>> Date: Tue Aug 26 13:23:47 2014 >>> New Revision: 25287 >>> >>> URL: http://svn.gna.org/viewcvs/relax?rev=25287&view=rev >>> Log: >>> Removed all code regarding scipy.optimize fmin_cg and fmin_ncg. >>> >>> This problem should soon be able to be solved with minfx. >>> >>> 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=25287&r1=25286&r2=25287&view=diff >>> ============================================================================== >>> --- trunk/specific_analyses/relax_disp/estimate_r2eff.py (original) >>> +++ trunk/specific_analyses/relax_disp/estimate_r2eff.py Tue Aug 26 >>> 13:23:47 2014 >>> @@ -45,7 +45,7 @@ >>> # Scipy installed. >>> if scipy_module: >>> # Import leastsq. >>> - from scipy.optimize import fmin_cg, fmin_ncg, leastsq >>> + from scipy.optimize import leastsq >>> >>> >>> class Exp: >>> @@ -424,7 +424,6 @@ >>> >>> # 'minfx' >>> # 'scipy.optimize.leastsq' >>> -# 'scipy.optimize.fmin_cg' >>> def estimate_r2eff(spin_id=None, ftol=1e-15, xtol=1e-15, maxfev=10000000, >>> factor=100.0, method='minfx', verbosity=1): >>> """Estimate r2eff and errors by exponential curve fitting with >>> scipy.optimize.leastsq. >>> >>> @@ -540,10 +539,6 @@ >>> # Acquire results. >>> results = minimise_leastsq(E=E) >>> >>> - elif method == 'scipy.optimize.fmin_cg': >>> - # Acquire results. >>> - results = minimise_fmin_cg(E=E) >>> - >>> elif method == 'minfx': >>> # Acquire results. >>> results = minimise_minfx(E=E) >>> @@ -715,46 +710,6 @@ >>> return results >>> >>> >>> -def minimise_fmin_cg(E=None): >>> - """Estimate r2eff and errors by exponential curve fitting with >>> scipy.optimize.fmin_cg. >>> - >>> - Unconstrained minimization of a function using the Newton-CG method. >>> - >>> - @keyword E: The Exponential function class, which contain data and >>> functions. >>> - @type E: class >>> - @return: Packed list with optimised parameter, estimated >>> parameter error, chi2, iter_count, f_count, g_count, h_count, warning >>> - @rtype: list >>> - """ >>> - >>> - # Check that scipy.optimize.leastsq is available. >>> - if not scipy_module: >>> - raise RelaxError("scipy module is not available.") >>> - >>> - # Initial guess for minimisation. Solved by linear least squares. >>> - x0 = E.estimate_x0_exp() >>> - >>> - # Define function to minimise. Use errors as weights in the >>> minimisation. >>> - use_weights = True >>> - >>> - if use_weights: >>> - func = E.func_exp_weighted_general >>> - dfunc = E.func_exp_weighted_grad >>> - d2func = E.func_exp_weighted_hess >>> - >>> - # There are no args to the function, since values and times are stored >>> in the class. >>> - args=() >>> - >>> - gfk = dfunc(x0) >>> - deltak = numpy.dot(gfk, gfk) >>> - >>> - # Cannot get this to work. >>> - >>> - #xopt, fopt, fcalls, gcalls, hcalls, warnflag = fmin_ncg(f=func, >>> x0=x0, fprime=dfunc, fhess=None, args=args, avextol=1e-05, >>> epsilon=1.4901161193847656e-08, maxiter=maxfev, full_output=1, disp=1, >>> retall=0, callback=None) >>> - #test = fmin_ncg(f=func, x0=x0, fprime=dfunc, fhess=d2func, args=args, >>> avextol=1e-05, epsilon=1.4901161193847656e-08, maxiter=maxfev) >>> - #fmin_cg(f, x0, fprime=None, args=(), gtol=1e-5, norm=Inf, >>> epsilon=_epsilon, maxiter=None, full_output=0, disp=1, retall=0, >>> callback=None): >>> - #fmin_cg(f=func, x0=x0, fprime=dfunc, args=args, gtol=1e-5) >>> - >>> - >>> def minimise_minfx(E=None): >>> """Estimate r2eff and errors by minimising with minfx. >>> >>> >>> >>> _______________________________________________ >>> relax (http://www.nmr-relax.com) >>> >>> This is the relax-commits mailing list >>> relax-comm...@gna.org >>> >>> 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@gna.org >> >> 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 _______________________________________________ relax (http://www.nmr-relax.com) This is the relax-devel mailing list relax-devel@gna.org 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