레이블이 scipy인 게시물을 표시합니다. 모든 게시물 표시
레이블이 scipy인 게시물을 표시합니다. 모든 게시물 표시

11/28/2013

scipy optimize curve_fit fitting to cumtom function


ref:  http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html

>>> import numpy as np
>>> from scipy.optimize import curve_fit
>>> def func(x, a, b, c):
...     return a*np.exp(-b*x) + c
>>> x = np.linspace(0,4,50)
>>> y = func(x, 2.5, 1.3, 0.5)
>>> yn = y + 0.2*np.random.normal(size=len(x))
>>> popt, pcov = curve_fit(func, x, yn)

4/02/2012

scipy 0.7 to 0.9 arpack interface change

http://docs.scipy.org/doc/scipy-0.9.0/reference/release.0.9.0.html?highlight=arpack#arpack-interface-changes


Other changes

ARPACK interface changes

The interface to the ARPACK eigenvalue routines in scipy.sparse.linalg was changed for more robustness.
The eigenvalue and SVD routines now raise ArpackNoConvergence if the eigenvalue iteration fails to converge. If partially converged results are desired, they can be accessed as follows:
import numpy as np
from scipy.sparse.linalg import eigs, ArpackNoConvergence

m = np.random.randn(30, 30)
try:
    w, v = eigs(m, 6)
except ArpackNoConvergence, err:
    partially_converged_w = err.eigenvalues
    partially_converged_v = err.eigenvectors
Several bugs were also fixed.
The routines were moreover renamed as follows:
  • eigen –> eigs
  • eigen_symmetric –> eigsh
  • svd –> svds

7/20/2009

install scipy 0.7.1 on ubuntu hardy

1. download numpy 1.3.0 and scipy 0.7.1
2. remove gfortran and libatlas3gf-sse2 (and related packages which use gfortran)
(numpy and scipy must use g77.. not gfortran)
sudo apt-get install atlas3-base-dev
sudo apt-get install atlas3-sse2

3. tar -xvzf numpy-1.3.0.tar.gz
4. cd numpy-1.3.0
5. python setup.py build --fcompiler=gnu
6. sudo python setup.py install

7. tar -xvzf scipy-0.7.1.tar.gz
8. cd scipy-0.7.1
9. sudo python setup.py install