Re: [Numpy-discussion] scipy curve_fit variable list of optimisation parameters

Aug. 3, 2016
7:53 a.m.
On 3 Aug 2016, at 13:00, numpy-discussion-request@scipy.org wrote:
Hi all I found the solution in the following thread: http://stackoverflow.com/questions/28969611/multiple-arguments-in-python One has to call curve_fit with 'p0' (giving curve_fit a clue about the unknown number of variables) I changed func2 to (note the *): def func2( x, *a ): # Bessel function tmp = scipy.special.j0( x[:,:] ) return np.dot( tmp[:,:] , a[:] ) and call it: N = number of optimisation parameters popt = scipy.optimize.curve_fit( func2, x, yi , p0=[1.0]*N) Regards, Siegfried Gonzi Met Office, Exeter, UK -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
3145
Age (days ago)
3145
Last active (days ago)
0 comments
1 participants
participants (1)
-
Siegfried Gonzi