ODE solution on networks with PyDSTool

After using scipy.integrate for a while, I am at a point where I need more functions, such as bifurcation analysis or parameter estimation. That's why they are interested in using PyDSTool, but from the documentation I can’t understand how to work with ModelSpec, and if this is actually what will lead me to the solution.

Here is an example of the game I'm trying to make: I have a network with two nodes, each of which has the same dynamics (SIR) described by the two ODEs, but different initial conditions. The equations are connected between nodes via Epsilon (see Formula below). formulas as an image for better reading, "n" and "m" are indexes, not indicators ~> http://image.noelshack.com/fichiers/2014/28/1404918182-odes.png (failed to use loading in stack, unfortunately)

In two cases of node, my code (using PyDSTool) looks like this:

#multiple SIR metapopulations

#parameter and initial condition definition; a dict is a must
import PyDSTool as pdt
params={'alpha': 0.7, 'beta':0.1, 'epsilon1':0.5,'epsilon2':0.5}
ini={'s1':0.99,'s2':1,'i1':0.01,'i2':0.00}

DSargs=pdt.args(name='SIRtest_multi',
                ics=ini,
                pars=params,
                tdata=[0,20],
                #the for-macro generates formulas for s1,s2 and i1,i2; 
                #sum works similar but sums over the expressions in it
                varspecs={'s[o]':'for(o,1,2,-alpha*s[o]*sum(k,1,2,epsilon[k]*i[k]))',
                          'i[l]':'for(l,1,2,alpha*s[l]*sum(m,1,2,epsilon[m]*i[m]))'})

#generator
DS = pdt.Generator.Vode_ODEsystem(DSargs)

#computation, a trajectory object is generated
trj=DS.compute('test')
#extraction of the points for plotting
pts=trj.sample()


#plotting; pylab is imported along with PyDSTool as plt
pdt.plt.plot(pts['t'],pts['s1'],label='s1')
pdt.plt.plot(pts['t'],pts['i1'],label='i1')
pdt.plt.plot(pts['t'],pts['s2'],label='s2')
pdt.plt.plot(pts['t'],pts['i2'],label='i2')
pdt.plt.legend()
pdt.plt.xlabel('t')
pdt.plt.show()

But in my original problem for each of them there are more than 1000 nodes and 5 ODEs, each node is associated with a different number of other nodes, and epsilon values ​​are not equal for all nodes. So messing with this syntax has not yet led me to a solution.

, , - / (?) node, (, node). . , , PyDSTool, .

PyDSTool, , , ! , -, , , . ( // : ( ) / , )

( , , , , !)

+4
1

, , . , . .

, ModelSpec. . "" .. , , PyDSTool , ODE. :

http://www.ni.gsu.edu/~rclewley/PyDSTool/Tutorial/Tutorial_compneuro.html

: ModelSpec_test.py, MultiCompartments.py. , (.. , ), , .

, . factory ( "makeSoma" neuralcomp.py), ODE, - . . "s1.epsilon", "i4.epsilon".

, , , ! . SourceForge , .

+3

Source: https://habr.com/ru/post/1547780/


All Articles