ScientificPython with numarray support
A development release of Scientific Python that supports numarray as an alternative to NumPy (choice made at installation time) is now available at http://starship.python.net/~hinsen/ScientificPython/ or http://dirac.cnrs-orleans.fr/ScientificPython/ (Search for "2.51".) Note that some modules do not work under numarray because they rely on a NumPy feature that is currently implemented in numarray. They are listed in the README file. Konrad. -- --------------------------------------------------------------------- Konrad Hinsen Laboratoire Léon Brillouin, CEA Saclay, 91191 Gif-sur-Yvette Cedex, France Tel.: +33-1 69 08 79 25 Fax: +33-1 69 08 82 61 E-Mail: hinsen@llb.saclay.cea.fr ---------------------------------------------------------------------
On Thursday 13 January 2005 05:42 am, konrad.hinsen@laposte.net wrote:
A development release of Scientific Python that supports numarray as an alternative to NumPy
Hi Konrad, This is great news ! In the readme it says: """ Note that this is a new feature and not very well tested. Feedback is welcome. Note also that the modules Scientific.Functions.Derivatives Scientific.Functions.FirstDerivatives Scientific.Functions.LeastSquares do not work correctly with numarray because they rely on a feature of Numeric that is missing in current numarray releases. """ I'm just curious what the missing feature is. The LeastSquare-fit is exactly what I'm interested in, since I couldn't find something similar anywhere else (like: It's not in SciPy, right?) Thanks, Sebastian Haase
(choice made at installation time) is now available at
http://starship.python.net/~hinsen/ScientificPython/ or http://dirac.cnrs-orleans.fr/ScientificPython/
(Search for "2.51".)
Note that some modules do not work under numarray because they rely on a NumPy feature that is currently implemented in numarray. They are listed in the README file.
Konrad. -- --------------------------------------------------------------------- Konrad Hinsen Laboratoire Léon Brillouin, CEA Saclay, 91191 Gif-sur-Yvette Cedex, France Tel.: +33-1 69 08 79 25 Fax: +33-1 69 08 82 61 E-Mail: hinsen@llb.saclay.cea.fr ---------------------------------------------------------------------
------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
"Sebastian" == Sebastian Haase
writes: Sebastian> The LeastSquare-fit is exactly what I'm interested in, Sebastian> since I couldn't find something similar anywhere else Sebastian> (like: It's not in SciPy, right?)
from scipy import exp, arange, zeros, Float, ones, transpose from RandomArray import normal from scipy.optimize import leastsq parsTrue = 2.0, -.76, 0.1 distance = arange(0, 4, 0.001) def func(pars): a, alpha, k = pars return a*exp(alpha*distance) + k def errfunc(pars): return data - func(pars) #return the error # some pseudo data; add some noise data = func(parsTrue) + normal(0.0, 0.1, distance.shape) guess = 1.0, -.4, 0.0 # the intial guess of the params best, info, ier, mesg = leastsq(errfunc, guess, full_output=1) print 'true', parsTrue print 'best', best
On Friday 14 January 2005 04:15 pm, John Hunter wrote:
"Sebastian" == Sebastian Haase
writes: Sebastian> The LeastSquare-fit is exactly what I'm interested in, Sebastian> since I couldn't find something similar anywhere else Sebastian> (like: It's not in SciPy, right?)
from scipy import exp, arange, zeros, Float, ones, transpose from RandomArray import normal from scipy.optimize import leastsq
parsTrue = 2.0, -.76, 0.1 distance = arange(0, 4, 0.001)
def func(pars): a, alpha, k = pars return a*exp(alpha*distance) + k
def errfunc(pars): return data - func(pars) #return the error
# some pseudo data; add some noise data = func(parsTrue) + normal(0.0, 0.1, distance.shape)
guess = 1.0, -.4, 0.0 # the intial guess of the params
best, info, ier, mesg = leastsq(errfunc, guess, full_output=1)
print 'true', parsTrue print 'best', best
Thanks John, I thought it should be there. Is the code / algorithm about similar to what Konrad has in Scientific ? - Sebastian
On 15.01.2005, at 02:23, Sebastian Haase wrote:
I thought it should be there. Is the code / algorithm about similar to what Konrad has in Scientific ?
I don't know exactly what's in SciPy, but it's probably a variant of Levenberg-Marquart, just like in Scientific Python. However, there is one peculiarity of my implementation which is probably not shared by the SciPy one, and which is the cause of the incompatibility with numarray: the use of automatic derivatives in the linearization of the model. Most implementations use numerical differentiation. Automatic derivatives have the advantage of removing one numerical issue and one critical parameter (the differentiation step size), at the cost of somewhat limiting the applicability (the model must be expressed as an analytical function of the parameters) and of requiring a NumPy feature that numarray doesn't have (yet?). BTW, that feature was recenly discussed here: it is the possibility to apply the maths functions to objects of arbitrary type. This makes it possible to apply the same numerical code to numbers and arrays but also to the number-like objects that are used for automatic derivatives. Konrad. -- ------------------------------------------------------------------------ ------- Konrad Hinsen Laboratoire Leon Brillouin, CEA Saclay, 91191 Gif-sur-Yvette Cedex, France Tel.: +33-1 69 08 79 25 Fax: +33-1 69 08 82 61 E-Mail: hinsen@llb.saclay.cea.fr ------------------------------------------------------------------------ -------
participants (3)
-
John Hunter
-
konrad.hinsen@laposte.net
-
Sebastian Haase