Contents

- Disclaimers
- Parameter Estimation
- Compartmental modeling for neural modeling
- DSSRT toolbox
- Phase response curves
- Phase plane tools
- Mechanical modeling
- Fractal dimension analysis
- Data analysis
- Sloppy cell modeling and SBML conversion

# 1. Disclaimers

- The contents of this page are incomplete, and more information will be added when time permits.
- The toolbox contents are also in continuing development, and are not intended to be complete in any sense of the word. They are utilities that we have found useful during our research that we are sharing in the hope that they will be useful to you.

If you have comments or wish contribute to these, or other, toolboxes then please contact us.

# 2. Parameter Estimation

`PyDSTool/Toolbox/ParamEst.py`

This toolbox has its own page, ParamEst.

# 3. Compartmental modeling for neural modeling

`PyDSTool/Toolbox/neuralcomp.py`

This toolbox is intended for use by computational neuroscientists. This toolbox is made up of ModelSpec sub-classes and object factory functions. It contains templates for common neural structures such as ion channels, compartments, synapses, and so forth. Examples of usage can be found in `/tests/CIN.py` and especially in `/tests/ModelSpec_test.py`.

Additional helper functions for making model building easier are provided in `Toolbox/ModelHelper.py`. A range of common symbolic functions for activation functions are provided in `Toolbox/ActivationFuncs.py`.

A "point neuron" refers to a single-compartment neuron model, for which synapses connect directly to the single compartment.

## 3.1. Classes provided

The template classes provided possess some hierarchical structure.

**Abstract classes:** (not intended for direct use)

- channel
- compartment

**Concrete classes:**

- soma (used as a point neuron for a single-compartment model)
- dendr_compartment (for multi-compartmental neuron only)
- synapse
- neuron (for multi-compartmental neuron only)
- exc_synapse (specialized sub-class for excitatory synapses)
- inh_synapse (specialized sub-class for inhibitory synapses)

## 3.2. Factory functions

### 3.2.1. Channels

- makeSynapseChannel
- makeBiasChannel
- makeChannel_halfact (half-activation/time-scale based)
- makeChannel_rates (rates based)
- makeExtInputCurrentChannel (external input signal as a current)
- makeExtInputConductanceChannel (external input signal as a conductance)

### 3.2.2. Other

- makeSoma
- makeSynapse
- makeAdaptingSynapse
- makePointNeuron
- makePointNeuronNetwork

The following function is only for multi-compartment network models, which are as yet untested.

- makeNeuronNetwork

## 3.3. Chemical synapse implementation

### 3.3.1. Dynamic synapse with associated ODE

Call the object factory function `connectWithSynapse`, which performs the following steps.

1.1 Creates a Leaf

`Component object of type 'synapse', containing the gating variable ODE, e.g. a rate equation using 1st order kinetics.`1.2 The ODE has a free name, that of a pre-synaptic voltage variable. The name is hierarchical in order to refer to a non-local variable, e.g.

`soma1.V`.1.3 A Leaf

`Component object of type 'channel' is created in the target cell's desired compartment (e.g. the soma for a point neuron), refering to that cell compartment's membrane potential. This creates a term in the current balance equation associated with that compartment, of the form``g*s*(V_rev - V)`where`s`is the synaptic gating variable from the ODE in (1.1) and V is the compartment's voltage variable. The channel object now exists in the cell compartment's ModelSpec registry and will be included in the generation of the RHS for the current balance ODE when the model is instantiated.1.4 The name of the target cell's compartment accessed in (1.3) is recorded in the synapse object under the attribute 'connxn

`Targets', a list of ModelSpec objects that the synapse object outputs to. In this example, this list will be a singleton.`1.5 The synapse object is returned from the function, for subsequent declaration to a ModelSpec object that represents a network.

### 3.3.2. Non-dynamic synapse with associated transition function

This is not currently implemented. An example would be the so-called "alpha function" post-synaptic timecourse function.

In order to implement this in the future, the `connectWithSynapse` function would be adapted to *not* create a `synapse` class instance, but to create a post-synaptic channel term in the target cell's compartment for which the gating variable is given by an explicit function of the pre-synaptic voltage, rather than a differential equation.

### 3.3.3. Adaptive synapses (facilitation and depression)

We support a maximum of two synaptic variables per synaptic connection, which can be coupled together in a way that provides a simple model of facilitation or depression. An example of implementing facilitation is given in the `\tests\CIN.py` example script, using the `makeAdaptingSynapse` function.

### 3.3.4. Threshold functions

Users can specify their own voltage-threshold functions, for use in trigering a post-synaptic response. The default function is `0.5+0.5*tanh(V/4)`, where the voltage threshold is set at 0 mV.

### 3.3.5. Removing synaptic connections

The `disconnectSynapse` function undoes the creation of the synaptic channel in the target cell, and removes all associated entries in the target cell's ModelSpec registry. The synapse object is not actually deleted, in case the user wishes to re-use it later.

## 3.4. Electrical (gap junction) synapses

These are demonstrated in `/tests/ModelSpec_test.py`.

## 3.5. Second messengers

We now support ionic current models that involve second messengers such as calcium. These are demonstrated in `/tests/ModelSpec_test.py`.

# 4. DSSRT toolbox

`PyDSTool/Toolbox/dssrt.py`

This is demonstrated in `/tests/HH_DSSRTtest.py`.

## 4.1. Tools for interfacing with DSSRT in Matlab

`PyDSTool/Toolbox/DSSRT_tools.py`, `PyDSTool/Toolbox/FR.py`

This toolbox provides utilities to export ODE models in PyDSTool to the analysis software package [http://www.cam.cornell.edu/~rclewley/DSSRT.html DSSRT], written in Matlab. DSSRT stands for *Dominant Scale System Reduction Tool*, and the software implementation works only for "conditionally linear" systems such as conductance-based neural networks, chemical kinetics netorks, and many other systems that can be written using a "kinetic" formalism.

The primary class of this toolbox is `DSSRT_info`. A single instance of it need not be initialized with any arguments, but there is an optional finite approximation to infinity, which defaults to 1e10. To trap bound violations this value can be dropped to a very modest finite number (e.g. in the '00s).

The `makeDSSRTcfg` method of this class is the intended access point for a user, but at this time **is not fully implemented**. To this method the user must supply a `Model` class instance containing a *single* ODE system Generator, *and also* the `ModelSpec` instance that defines it. The reason for this is that this method will only know how to convert a model to DSSRT format if it was created using the `neuralcomp` toolbox, described earlier on this page.

In lieu of the `makeDSSRTcfg` method, the class instance must be configured interactively. What follows is an example slightly adapted from a script for a stomatogastric ganglion model configuration, for which the object `STG` is an ODE Generator.

```
STG_dssrt = DSSRT_info('STG_PD', infty_val=120)
STG_dssrt.prepVarNames( ['PDa_Kd_m', 'PDa_L', 'PDa_Na_h', 'PDa_Na_m', 'PDa_V', 'PDs_A_h', 'PDs_A_m', 'PDs_Ca', 'PDs_CaS_m', 'PDs_CaT_h', 'PDs_CaT_m', 'PDs_I', 'PDs_KCa_m', 'PDs_Kd_m', 'PDs_L', 'PDs_NaP_h', 'PDs_NaP_m', 'PDs_V', 'PDs_h_m'])
dummyvars = ['PDs_L', 'PDs_I', 'PDa_L']
STG_dssrt.deqns = remain(remain(STG_dssrt.varsall, STG.funcspec.auxvars), dummyvars)
STG_dssrt.prepInputs(STG.funcspec.dependencies)
subsFnDef, not_depars = STG_dssrt.prepAuxFns(auxfndict, default_pars, makeMfiles=makeMfiles)
assert not_depars == [] # make sure all were DE pars
gate_m = ['PDs_CaT_m', 'PDs_CaS_m', 'PDs_h_m', 'PDs_NaP_m', 'PDs_Kd_m',
'PDs_KCa_m', 'PDs_A_m', 'PDa_Na_m', 'PDa_Kd_m']
STG_dssrt.setUnitBounds(['PDs_L', 'PDs_I', 'PDa_L'] \
+ gate_m + int_var_specs.keys())
for v in ['PDa_V', 'PDs_V']:
STG_dssrt.bounds[v] = [-60, -20]
STG_dssrt.bounds['PDs_Ca'] = [0, 25]
STG_dssrt.cfac = {'PDs_V': 'PDs_Cm', 'PDa_V': 'PDa_Cm'}
STG_dssrt.depars = default_pars
STG_dssrt.prepDEpars()
STG_dssrt.prepGraph(vbars_int={'PDs_CaT_h': 'PDs_CaT_m',
'PDs_NaP_h': 'PDs_NaP_m',
'PDs_A_h': 'PDs_A_m',
'PDa_Na_h': 'PDa_Na_m'})
plotNetworkGraph(STG_dssrt)
# display information about the setup
info(STG_dssrt, "STG DSSRT setup")
STG_dssrt.outputCFG('STG_PD')
```

When the `DSSRT_info` object has been configured, the DSSRT files can be created in the file system using the method call `outputCFG(<filename>)`, which includes the .cfg file. However, at this time, the specification of the GAMMA1TERMS and GAMMA2TERMS in the .cfg file still have to be filled in by hand before the files are ready for use in DSSRT. See the DSSRT documentation for details.

The `DSSRT_info` class makes use of the Fruchterman-Reingold graph drawing algorithm, provided in `FR.py`, in order to turn the connectivity network of an ODE system (where variables are nodes and their interconnections are links) into a convenient 2D graph representation.

# 5. Phase response curves

`PyDSTool/Toolbox/adjointPRC.py` and `PyDSTool/Toolbox/InputProfile.py`

The adjoint PRC calculation can be performed on an oscillator for which there exists a normally hyperbolic stable limit cycle. For direct PRC calculations the functions in `InputProfile.py` help to set up the database model of input signal to the oscillator. See the recent paper in Neural Computation by Govaerts and Sautois and the scholarpedia page on PRCs for details of both calculations.

# 6. Phase plane tools

`PyDSTool/Toolbox/phaseplane.py`

These are in development, and will be detailed on the page PhasePlane.

# 7. Mechanical modeling

`PyDSTool/Toolbox/mechmatlib.py`

This toolbox contains matrix utilities for mechanical modeling, such as for augmenting position or displacement 3-vectors to 4-vectors, and constructors for spatial transformations.

An example of a rigid-body ODE/DAE system describing finger motion (using equations for an inverted triple pendulum with non-constant mass matrices) are found in `PyDSTool/tests/freefinger_noforce_radau.py`.

# 8. Fractal dimension analysis

`PyDSTool/Toolbox/fracdim.py` and `PyDSTool/Toolbox/prep_boxplot.py`

Correlation and pointwise dimension analysis tools for time-series data analysis. For more information on pointwise dimension see J. Guckenheimer, "Dimension Estimates for Attractors", Contemporary Mathematics, Vol. 28, 1984. A journal publication concerning the use of these functions has been accepted for publication in IEEE Transactions on Biomedical Engineering (see the [http://www.cam.cornell.edu/~rclewley/Clewley_etal_IEEE_TBME_preprint.pdf preprint], and an extended version at the [http://www.arxiv.org/abs/q-bio.QM/0610058 arXiv]). The `prep_boxplot.py` functions provide plotting tools for the results of our pointwise dimension estimation algorithm PD-E, described in detail in the journal paper.

# 9. Data analysis

`PyDSTool/Toolbox/dataanalysis.py`

Data analysis tools and utilities, particularly involving estimation of dimension in data-driven modelling, using principal component analysis (PCA). Requires the [http://mdp-toolkit.sourceforge.net Modular toolkit for Data Processing] package.

# 10. Sloppy cell modeling and SBML conversion

`PyDSTool/Toolbox/makeSloppyModel.py`

For use with the Python package [http://sloppycell.sourceforge.net/ SloppyCell], developed by [http://www.lassp.cornell.edu/sethna/GeneDynamics/ Jim Sethna's group] at Cornell, for systems biology modeling. This interface toolkit builds PyDSTool models from exported Sloppy`Cell model specifications, using the ModelSpec scripting language. This is presently the means by which simple SBML specifications can be translated into PyDSTool models. `