Re: [pydstool-users] simulation with many auxiliary equations
Status: Beta
Brought to you by:
robclewley
From: gyro f. <gyr...@gm...> - 2012-05-25 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 |