Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Ludo Visser <l.c.visser@sc...>  20120524 18:17:00

> However, I am still not sure how one adds additional equations that > are not ODEs. > > Although not realistic and consistent in units, suppose that for > this oscillations example (Tutorial_linear.html) there are a number > of derived quantities: > > c1 = k/m > c2 = k*m^2 > z = y/k > > and that the differential equations are > > dx/dt = c1*z > dy/dt = k*x/m + c2*(dx/dt) > > For this simple example, we can do some trivial substitutions. > However, in general, how does one add additional auxiliary equations > that are then used in the simulation system? You can use the fnspec attribute for that. Building from your example, let's consider: dx/dt = c1*z, with c1 = k/m and z = y/k dy/dt = ... Your varspec would look like: varspec = {'x': 'c1(k,m)*z(y,k)', 'y': ...} Then, your fnspec would be: fnspec = {'c1': (['a', 'b'], 'a/b'), 'z': (['a', 'b'], 'a/b')} This defines the functions 'c1' and 'z', both taking 2 arguments. The keys of the fnspec dictionary defines the function name, the values are tuples of function arguments and function implementations. (Note that in this trivial example you could be done with defining only one function, since they both do the same.) Hope this helps, Ludo  Ludo C. Visser, M.Sc. Science Applied phone: +31 6 1066 3076 email: l.c.visser@... 
From: gyro funch <gyromagnetic@gm...>  20120524 12:48:41

Hi, I am a newbie with PyDSTool and would appreciate your advice on how to solve a large system of ODEs that also contains a lot of auxiliary equations that define and scale variables and parameters. Here is a small example that illustrates the sort of problem I am trying to solve: state variables  y1, y2, y3 parameters  a1,a2,a3 b1,b2,b3 c1,c2,c3 d1,d2,d3 conversion equations  s1 = a1/b1 s2 = a2/b2 s3 = a3/b3 z1 = y1/c1 z2 = y2/c2 z3 = y3/c3 differential equations  dy1/dt = s1*z1  s2*dy2/dt dy2/dt = s3*z1  s4*z3 dy3/dt = s2*z3  s3*z2*dy1/dt initial conditions  y1(0) = d1 y2(0) = d2 y3(0) = d3 The examples included in the documentation and distribution are helpful, but I am unclear on how to specify this system most efficiently. I am also not clear on when symbolic variables can be used or if they would help in this instance. Thank you very much. Kind regards, gyro 
From: Ludo Visser <l.c.visser@sc...>  20120524 13:33:43

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 semiautomate 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 On May 24, 2012, at 2:48 pm, gyro funch wrote: > Hi, > > I am a newbie with PyDSTool and would appreciate your advice on how > to solve a large system of ODEs that also contains a lot of > auxiliary equations that define and scale variables and parameters. > > Here is a small example that illustrates the sort of problem I am > trying to solve: > > > state variables >  > y1, y2, y3 > > parameters >  > a1,a2,a3 > b1,b2,b3 > c1,c2,c3 > d1,d2,d3 > > conversion equations >  > s1 = a1/b1 > s2 = a2/b2 > s3 = a3/b3 > z1 = y1/c1 > z2 = y2/c2 > z3 = y3/c3 > > differential equations >  > dy1/dt = s1*z1  s2*dy2/dt > dy2/dt = s3*z1  s4*z3 > dy3/dt = s2*z3  s3*z2*dy1/dt > > initial conditions >  > y1(0) = d1 > y2(0) = d2 > y3(0) = d3 > > > The examples included in the documentation and distribution are > helpful, but I am unclear on how to specify this system most > efficiently. I am also not clear on when symbolic variables can be > used or if they would help in this instance. > > Thank you very much. > > Kind regards, > gyro > >  > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > PyDSToolUsers mailing list > PyDSToolUsers@... > https://lists.sourceforge.net/lists/listinfo/pydstoolusers  Ludo C. Visser, M.Sc. Science Applied phone: +31 6 1066 3076 email: l.c.visser@... 
From: gyro funch <gyromagnetic@gm...>  20120524 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 semiautomate 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) * (vvca) )/c','w': 'vw' } 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 
From: Ludo Visser <l.c.visser@sc...>  20120524 14:39:18

> > 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. Hi Gyro, I see what you mean now. I found this tutorial very useful in understanding the basics: http://www.ni.gsu.edu/~rclewley/PyDSTool/Tutorial/Tutorial_linear.html Essentially, you need to define: * a dictionary of parameters, with parameter names as keys and parameter values as values * a dictionary of initial conditions, with variable names as keys and initial values as values * a dictionary of ODEs, with variables names as keys and stringexpressions for the ODE, in terms of other variables and parameters Then you can use the argsobject to create a generator to compute the trajectories. I'm currently working on some examples myself, while learning how to work with PyDSTool. Maybe, once these examples can also be useful to you or others, but the fact that they may not be related to your field of research can be distracting rather than clarifying. My examples are in the field of mechanics; if you're interested, I can document them some more and post them here. Kind regards, Ludo  Ludo C. Visser, M.Sc. Science Applied phone: +31 6 1066 3076 email: l.c.visser@... 
From: gyro funch <gyromagnetic@gm...>  20120524 14:57:02

On 5/24/2012 8:39 AM, Ludo Visser wrote: >> >> 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. > > Hi Gyro, > > I see what you mean now. I found this tutorial very useful in understanding the basics: > http://www.ni.gsu.edu/~rclewley/PyDSTool/Tutorial/Tutorial_linear.html > > Essentially, you need to define: > * a dictionary of parameters, with parameter names as keys and parameter values as values > * a dictionary of initial conditions, with variable names as keys and initial values as values > * a dictionary of ODEs, with variables names as keys and stringexpressions for the ODE, in terms of other variables and parameters > > Then you can use the argsobject to create a generator to compute the trajectories. > > I'm currently working on some examples myself, while learning how to work with PyDSTool. Maybe, once these examples can also be useful to you or others, but the fact that they may not be related to your field of research can be distracting rather than clarifying. My examples are in the field of mechanics; if you're interested, I can document them some more and post them here. > > Kind regards, > Ludo > Hi Ludo, Thank you. That example is very clear. The construction of the parameter, initial condition, and ODE dictionaries is straightforward. However, I am still not sure how one adds additional equations that are not ODEs. Although not realistic and consistent in units, suppose that for this oscillations example (Tutorial_linear.html) there are a number of derived quantities: c1 = k/m c2 = k*m^2 z = y/k and that the differential equations are dx/dt = c1*z dy/dt = k*x/m + c2*(dx/dt) For this simple example, we can do some trivial substitutions. However, in general, how does one add additional auxiliary equations that are then used in the simulation system? Thanks. Kind regards, gyro 
From: Ludo Visser <l.c.visser@sc...>  20120524 18:17:00

> However, I am still not sure how one adds additional equations that > are not ODEs. > > Although not realistic and consistent in units, suppose that for > this oscillations example (Tutorial_linear.html) there are a number > of derived quantities: > > c1 = k/m > c2 = k*m^2 > z = y/k > > and that the differential equations are > > dx/dt = c1*z > dy/dt = k*x/m + c2*(dx/dt) > > For this simple example, we can do some trivial substitutions. > However, in general, how does one add additional auxiliary equations > that are then used in the simulation system? You can use the fnspec attribute for that. Building from your example, let's consider: dx/dt = c1*z, with c1 = k/m and z = y/k dy/dt = ... Your varspec would look like: varspec = {'x': 'c1(k,m)*z(y,k)', 'y': ...} Then, your fnspec would be: fnspec = {'c1': (['a', 'b'], 'a/b'), 'z': (['a', 'b'], 'a/b')} This defines the functions 'c1' and 'z', both taking 2 arguments. The keys of the fnspec dictionary defines the function name, the values are tuples of function arguments and function implementations. (Note that in this trivial example you could be done with defining only one function, since they both do the same.) Hope this helps, Ludo  Ludo C. Visser, M.Sc. Science Applied phone: +31 6 1066 3076 email: l.c.visser@... 
From: gyro funch <gyromagnetic@gm...>  20120525 02:34:21

On 5/24/2012 12:16 PM, Ludo Visser wrote: > > You can use the fnspec attribute for that. Building from your example, let's consider: > > dx/dt = c1*z, with c1 = k/m and z = y/k > dy/dt = ... > > Your varspec would look like: > > varspec = {'x': 'c1(k,m)*z(y,k)', > 'y': ...} > > Then, your fnspec would be: > fnspec = {'c1': (['a', 'b'], 'a/b'), > 'z': (['a', 'b'], 'a/b')} > > This defines the functions 'c1' and 'z', both taking 2 arguments. The keys of the fnspec dictionary defines the function name, the values are tuples of function arguments and function implementations. (Note that in this trivial example you could be done with defining only one function, since they both do the same.) > > Hope this helps, > Ludo > Thanks, Ludo. I'll see if that sort of approach will work for my model. I looked through a number of examples in the 'tests' directory of the distribution. It seems as if 'sloppycell_example.py' contains something very similar to what I need. Specifically, it defines an 'assignments' dictionary that contains expressions using various parameters: 'assignments': {'CLB2T_21': 'CLB2_20 + C2_4 + C2P_5 + F2_29 + F2P_30', 'F_28': 'exp(mu_39 * D_26)', 'mu_39': 'log(2) / mdt_216', 'Vacdh_58': 'kacdh_126 + kacdh_127 * CDC14_8', ...} I'll need to read through 'makeSloppyModel.py' to see how this can be used in a model. Kind regards, gyro 
From: Ludo Visser <l.c.visser@sc...>  20120525 07:52:52

On May 25, 2012, at 4:34 am, gyro funch wrote: > On 5/24/2012 12:16 PM, Ludo Visser wrote: >> >> You can use the fnspec attribute for that. Building from your example, let's consider: >> >> dx/dt = c1*z, with c1 = k/m and z = y/k >> dy/dt = ... >> >> Your varspec would look like: >> >> varspec = {'x': 'c1(k,m)*z(y,k)', >> 'y': ...} >> >> Then, your fnspec would be: >> fnspec = {'c1': (['a', 'b'], 'a/b'), >> 'z': (['a', 'b'], 'a/b')} >> >> This defines the functions 'c1' and 'z', both taking 2 arguments. The keys of the fnspec dictionary defines the function name, the values are tuples of function arguments and function implementations. (Note that in this trivial example you could be done with defining only one function, since they both do the same.) >> >> Hope this helps, >> Ludo >> > > > Thanks, Ludo. > > I'll see if that sort of approach will work for my model. > > I looked through a number of examples in the 'tests' directory of > the distribution. > It seems as if 'sloppycell_example.py' contains something very > similar to what I need. Specifically, it defines an 'assignments' > dictionary that contains expressions using various parameters: > > 'assignments': {'CLB2T_21': 'CLB2_20 + C2_4 + C2P_5 + F2_29 + > F2P_30', 'F_28': 'exp(mu_39 * D_26)', 'mu_39': 'log(2) / mdt_216', > 'Vacdh_58': 'kacdh_126 + kacdh_127 * CDC14_8', ...} > > I'll need to read through 'makeSloppyModel.py' to see how this can > be used in a model. > > Kind regards, > gyro A quick look into makeSloppyModel.py reveals that the specification of the assignment dictionary triggers a routine that wraps this dictionary in a ModelSpec object. I don't know (yet) how these work, so I can't help you with those... Regards, Ludo  Ludo C. Visser, M.Sc. Science Applied phone: +31 6 1066 3076 email: l.c.visser@... 
Sign up for the SourceForge newsletter:
No, thanks