Re: [pydstool-users] simulation with many auxiliary equations
Status: Beta
Brought to you by:
robclewley
From: Ludo V. <l.c...@sc...> - 2012-05-25 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 e-mail: l.c...@sc... |