# PyRates Documentation¶

Documentation of PyRates, an open-source Python toolbox for neurodynamical systems modeling.

## Basic features:¶

- Different backends: Numpy for fast simulations of small- to medium-sized networks. Tensorflow for efficient parallelization on GPUs/CPUs, Fortran for parameter continuations.
- Each model is internally represented by a networkx graph of nodes and edges, with the former representing the model units (i.e. single cells, cell populations, …) and the latter the information transfer between them. In principle, this allows to implement any kind of dynamic neural system that can be expressed as a graph via PyRates.
- Solutions of initial value problems via different numerical solvers (e.g. full interface to scipy.integrate.solve_ivp)
- Parameter continuations and bifurcation analysis via PyAuto, an interface to auto-07p
- Storage of solutions in pandas.DataFrame
- Efficient parameter sweeps on single and multiple machines via the grid_search module
- Model optimization via genetic algorithms
- Visualization of results via seaborn
- Post-processing of simulation results via scipy and MNE Python
- The user has full control over the mathematical equations that nodes and edges are defined by.
- Model configuration and simulation can be done within a few lines of code.
- Various templates for rate-based population models are provided that can be used for neural network simulations imediatly.

## Installation:¶

PyRates can be installed via the pip command. We recommend to use Anaconda to create a new python environment with Python >= 3.6 and then simply run the following line from a terminal with the environment being activated:

```
pip install pyrates
```

You can install optional (non-default) packages by specifying one or more options in brackets, e.g.:

```
pip install pyrates[tf,plot]
```

Available options are tf, plot, proc, cluster, numba and all. The latter includes all optional packages.

Alternatively, it is possible to clone this repository and run one of the following lines from the directory in which the repository was cloned:

```
python setup.py install
```

or

```
pip install .[<options>]
```

Finally, a singularity container of the most recent version of this software can be found [here](https://singularity.gwdg.de/containers/3). This container provides a stand-alone version of PyRates including all necessary Python tools to be run, independent of local operating systems. To be able to use this container, you need to install Singularity on your local machine first. Follow these instructions to install singularity and run scripts inside the PyRates container.

## Reference¶

If you use PyRates, please cite:

## Contact¶

If you have questions, problems or suggestions regarding PyRates, please contact Richard Gast or Daniel Rose.

## Contribute¶

PyRates is an open-source project that everyone is welcome to contribute to. Check out our GitHub repository for all the source code, open issues etc. and send us a pull request, if you would like to contribute something to our software.

# Examples Gallery¶

orphan: |
---|

## Model Introductions¶

Here, you will find introductions of all models that are already implemented in PyRates, i.e. they do not require any further definition of model equations. For each model, there is a tutorial that introduces the underlying model equations and demonstrates how to load the model into PyRates and perform simulations on it.

Gallery generated by Sphinx-Gallery

orphan: |
---|

## PyRates user interfaces: From model definition to simulation¶

In PyRates, neurodynamic models are defined via sets of differential equations, for which solutions with respect to time can be found numerically. Such models can be defined via two different interfaces in PyRates: via YAML files or via the Python frontend. Once the models are defined, they can be compiled for numerical integration in time or parameter continuations. In this gallery, we will provide walk-throughs for all features and options that you have at each step between defining a model in PyRates and performing basic numerical simulations in time.

Gallery generated by Sphinx-Gallery

orphan: |
---|

## Parameter Sweeps¶

PyRates allows you to perform simulations of model behavior for multiple, different model parameterizations in parallel. This can be done on a single computer or on a cluster of machines. Here, we provide tutorial on how to use the parameter sweep functionalities of PyRates.

Gallery generated by Sphinx-Gallery

orphan: |
---|

## Model Optimization¶

The examples in this gallery provide tutorials for different algorithms that can be used to perform parameter optimization of models implemented in PyRates.

Gallery generated by Sphinx-Gallery

orphan: |
---|

# Parameter Continuations¶

In this gallery, you will find tutorials that demonstrate how to perform parameter continuations (1D, 2D and 3D) and bifurcation anaylses via the aut0-07p interface of PyRates.

**RESTRICTION:** This feature only works for scalar networks, as of now. This means, that the model has to be defined
inside a single operator, as a set of coupled differential equations.

PyRates will automatically generate the fortran files required to run auto-07p [1]. You will then be able to access every feature of auto-07p via the pyrates.utility.pyauto module.

**REQUIREMENT:** You will have to install auto-07p on your machine and follow
these installation instructions for any of the examples below
to work.