我在将参数传递给python中的scipy.ode时遇到问题

时间:2018-07-05 03:01:07

标签: scipy ode

因此,我遇到了一个问题,我试图将参数节点,方法,启动器和TGFB_level传递到名为“ ODEfunc”的函数中,该函数用作scipy.ode调用的右侧。我使用方括号[]以列表形式显示了所有参数,我想知道是否应该以其他方式输入参数。我上面提到的特定参数由ODEfunc函数读取,并在函数中更改其他参数,即...

if promoter == 'cons':
        w[147]=1
if promoter == 'peri':
        w[145]=1
        w[146]=1

这似乎不应该引起问题,但我可能遗漏了一些东西。您能提供的任何帮助将不胜感激。

from scipy.integrate import ode
method2=['cDNA']
promoter=['peri']
TGFB_level=[0.25]

# Run single simulations for each node
node=['AngII']
tspan = [0, 10]

t = [] 

dt = tspan[1]/150. 
r = ode(ODEfunc).set_integrator('vode', method='adams', order=10, rtol=0, atol=1e-6, with_jacobian=False) 
r.set_initial_value(y0,tspan[0]).set_f_params(tau,ymax,w,n,EC50,node,method2,promoter,TGFB_level) 
results = np.empty([0,len(speciesNames)]) 
while r.successful() and r.t <= tspan[1]: 
    r.integrate(r.t + dt) 
    results = np.append(results,[r.y],axis=0) 
    t.append(r.t) 

这是我遇到的错误...

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-301-42fbb22b5bfd> in <module>()
     34 results = np.empty([0,len(speciesNames)])
     35 while r.successful() and r.t <= tspan[1]:
---> 36     r.integrate(r.t + dt)
     37     results = np.append(results,[r.y],axis=0)
     38     t.append(r.t)

/Users/andersnelson/anaconda/lib/python3.6/site-packages/scipy/integrate/_ode.py in integrate(self, t, step, relax)
    406             self._y, self.t = mth(self.f, self.jac or (lambda: None),
    407                                 self._y, self.t, t,
--> 408                                 self.f_params, self.jac_params)
    409         except SystemError:
    410             # f2py issue with tuple returns, see ticket 1187.

/Users/andersnelson/anaconda/lib/python3.6/site-packages/scipy/integrate/_ode.py in run(self, f, jac, y0, t0, t1, f_params, jac_params)
    863         args = ((f, jac, y0, t0, t1) + tuple(self.call_args) +
    864                 (f_params, jac_params))
--> 865         y1, t, istate = self.runner(*args)
    866         if istate < 0:
    867             warnings.warn(self.__class__.__name__ + ': ' +

error: failed in processing argument list for call-back f.

0 个答案:

没有答案