PyDSTool

PyDSTool

Description

PyDSTool uses the lib9ML library in order to import NineML models into closely corresponding PyDSTool model constructs that include regimes with zero-crossing events for transitions and auxiliary variables. PyDSTool is a Python-based simulation and analysis environment for general dynamical systems models, but with a focus on tools relevant to neuroscience and bioinformatics (Clewley, PLoS Comp Biol, 2012).

Installation

Instructions on how to download PyDSTool can be found on the project’s Sourceforge page (http://pydstool.sourceforge.net).

9ML support

A major distinguishing feature of PyDSTool is to support hybrid dynamical models that mix discrete and continuous model formalisms or that permit piecewise reductions of model order (ibid). The present interface to NineML supports flat multi-regime (i.e., hybrid) models that are also single components.

from PyDSTool import *
import nineml.abstraction_layer as al
from PyDSTool.Toolbox.NineML import *
import nineml


c = nineml.read('NineML_Izh_FS.xml')['IzhikevichClass']

# Convert to PyDSTool.ModelSpec and create HybridModel object
# Provide extra parameters iSyn and iExt which are missing from
# component definition in absence of any synaptic inputs coupled
# to the model membrane
izh = get_nineml_model(c, 'izh_9ML', extra_args=[Par('iExt'), Par('iSyn')],
                        max_t=100)

if Iexts is None:
    Iexts = [200]

izh.set(pars=dict(a=0.2, b=0.025, c=-45, k=1, Vpeak=25,
                  Vb=-55, Cm=20, Vr=-55, Vt=-40))
# set starting regime to be sub-threshold (PyDSTool will check consistency
# with V initial condition)
izh.set(ics={'V': -65, 'U': -1.625, 'regime_': 0},
         tdata=[0, 80],
         algparams={'init_step': 0.03})

# Reproduce figure in Neuroinformatics, 2015 article:
# "NineML: a declarative language for describing networks of hybrid
# spiking models"

for Iext in Iexts:
    izh.set(pars={'iExt': Iext})
    name = 'iExt=%.1f'%(float(Iext))
    izh.compute(name, verboselevel=0)
    pts = izh.sample(name)
    evs = izh.getTrajEventTimes(name)['spikeOutput']
    ISIs = np.diff(evs)
    print("iExt =", Iext, ":")
    print("  Mean ISI = %.3f, variance = %.6f" % (np.mean(ISIs), np.var(ISIs)))

    Vp = izh.query('pars')['Vpeak']
    plt.figure(6)
    plt.plot(pts['t'], pts['V'], label=name)
    plt.plot(evs, [Vp]*len(evs), 'ko')
    plt.title('Izhikevich fast spiking model')
    plt.xlabel('t')
    plt.ylabel('V')
    plt.legend()

    plt.figure(7)
    plt.plot(pts['t'], pts['U'], label=name)
    plt.xlabel('t')
    plt.ylabel('U')
    plt.legend()
plt.title('Izhikevich FS model')


Updated