Reputation: 644
I'm trying to find the minimum of a 2d interpolation. I"m really stuck on trying to find a way to appropriately pass the data to the optimizer,
here is the code I have so far:
import scipy
from scipy.interpolate import interp2d
a_ca_energy_interp = interp2d(a, c_a, Energy)
def run_2d_params(params, func):
a, b = params
return func(a, b)
scipy.optimize.fmin(run_2d_params, np.array([1.60,6.075]),
args=a_ca_energy_interp)
Which throws the error:
TypeError: can only concatenate tuple (not "interp2d") to tuple
Upvotes: 0
Views: 309
Reputation: 23637
args
must be a tuple, even if it is only one argument:
scipy.optimize.fmin(run_2d_params, np.array([1.60,6.075]),
args=(a_ca_energy_interp, ))
Upvotes: 1