Re: [pydstool-users] simulation with many auxiliary equations
Status: Beta
Brought to you by:
robclewley
From: gyro f. <gyr...@gm...> - 2012-05-24 14:09:16
|
On 5/24/2012 7:33 AM, Ludo Visser wrote: > Hi, > > I'm not completely sure what the problem is that you're running into. > > If the complexity of the conversion equations is an issue, then you can use either the symbolic manipulation tools provided by PyDSTool (although I have no experience with that) or SymPy (I have a lot of experience with that, and SymPy plays really quite nice with PyDSTool) to take semi-automate the generation of the ODEs. Since all equations are specified as string expression, some clever string manipulation can get you a long way. > > For the rest, the problem you describe seems an ordinary first order system, so a single Generator instance, like used in the harmonic oscillation example, should work. > > Regards, > Ludo Visser > Thank you for the reply, Ludo. The problem is one of ignorance. I am accustomed to ODE integrators like scipy.odeint or MATLAB's ode45, where one writes a function that returns the numerical rhs of the ODE system at a given time point and the ODE solver takes this function as an argument. Although I am a decent Python programmer, the object oriented structure of the PyDSTool framework and the idea of specifying equations and parameters using strings and dictionaries is foreign to me. For instance, there is an example in the Elementary Tutorial for a calcium channel model that looks something like this: ----- DSargs = dst.args(name='Calcium channel model') DSargs.pars = { 'vl': -60, 'vca': 120, 'i': 0, ... DSargs.fnspecs = {'minf': (['v'], '0.5 * ... DSargs.varspecs = {'v': '( i + gl * (vl - v) - gca * minf(v) * (v-vca) )/c','w': 'v-w' } DSargs.ics = {'v': 0, 'w': 0 } ---- When I compare this to my model, it is unclear where my conversion equations should go and what syntax I should use. If you, or others, could show me a brief example, that would be greatly appreciated. Thank you. Best regards, gyro |