Skip to main content

BETSE, the BioElectric Tissue Simulation Engine.

Project description

Linux Build Status Windows Build Status


BETSE (BioElectric Tissue Simulation Engine) is an open-source cross-platform finite volume simulator for 2D computational multiphysics problems in the life sciences – including electrodiffusion, electro-osmosis, galvanotaxis, voltage-gated ion channels, gene regulatory networks, and biochemical reaction networks (e.g., metabolism). BETSE is associated with the Paul Allen Discovery Center at Tufts University and supported by a Paul Allen Discovery Center award from the Paul G. Allen Frontiers Group.

BETSE is portably implemented in pure Python 3, continuously stress-tested with GitLab-CI × Appveyor + py.test, and permissively distributed under the BSD 2-clause license.


BETSEE (BETSE Environment) is the official open-source cross-platform graphical user interface (GUI) for BETSE. BETSEE wraps the low-level command-line interface (CLI) bundled with BETSE in a high-level interactive modelling environment optimized for both new and advanced users alike.

Like BETSE, BETSEE is portably implemented in Python 3 and permissively distributed under the BSD 2-clause license. Unlike BETSE, BETSEE leverages the industry-standard PySide2-based Qt 5 application framework to deliver a modern scientific workflow.


BETSE currently supports Linux, macOS, and Windows out-of-the-box.


For new users, BETSE is readily installable as follows:

  • Under Ubuntu Linux 16.04 (Xenial Xerus) and newer:

    1. Open a terminal. [1]

    2. Run the following commands.

      wget && source betsee_ubuntu_16_04.bash
  • Under all other platforms: (e.g., macOS, Windows)

    1. Install the Python 3.x [2] (e.g., 3.6) variant of Anaconda. [3]

    2. Open a terminal. [1]

    3. Run the following commands.

      1. Install mandatory dependencies. [4]

        conda install dill
      2. Install BETSE. [5]

        python3 -m pip install betse
      3. (Optional) Install recommended dependencies. While not required for basic usage, the following third-party packages are required for advanced functionality (e.g., gene regulatory networks, animation video encoding).

        conda install -c anaconda graphviz && \
        conda install -c conda-forge ffmpeg networkx && \
        conda install -c rmg pydot
  • (Optional) Test BETSE. Run all modelling phases of a sample simulation from the current directory.

    betse try
[1](1, 2)

To open a POSIX-compatible terminal under:

  • Windows:
    1. Install Ubuntu Linux via the Windows Subsystem for Linux (WSL).
    2. Open an Ubuntu Linux terminal.
  • macOS:
    1. Open the Finder.
    2. Open the Applications folder.
    3. Open the Utilities folder.
    4. Open
  • Ubuntu Linux:
    1. Type Ctrl+Alt+t.
[2]Do not install the Python 2.7 variant of Anaconda. BETSE requires Python 3.x.
[3]If you prefer not to install Anaconda, BETSE dependencies are also installable with your platform-specific package manager (e.g., Homebrew on macOS, APT on Ubuntu Linux). Doing so is non-trivial and, if performed incorrectly, could produce a performance-crippled single-core installation of BETSE – which would be bad. Anaconda suffers no such issues and is guaranteed to produce a performance-optimized multicore installation of BETSE on all supported platforms – which is good.
[4]Most mandatory dependencies of BETSE (e.g., NumPy, SciPy) are already bundled by default with Anaconda. Some (e.g., dill, imageio) are not. The latter require manual installation.
[5]Always run the python3 -m pip command to install Python packages into the active Anaconda environment. Never run the pip or pip3 commands, which incorrectly refer to their non-Anaconda versions on some platforms (e.g., macOS), which prevents BETSE from finding packages installed with these commands – which is bad. The python3 -m pip command suffers no such issues and is guaranteed to install packages in a BETSE-aware manner on all supported platforms – which is good.


For developers and advanced users, any version of BETSE – including the live repository and prior stable releases – is manually installable as follows:

  1. Install Python 3.x and all dependencies required by BETSE. Under:

    • Linux, install these dependencies via your distribution-specific package manager (e.g., APT under Debian-based distributions). Do not use pip.[6]
    • macOS, either:
      • (Recommended) Install the Python 3.x variant of Anaconda.
      • Or both:
        1. Install a third-party package manager (e.g., Homebrew, MacPorts). Apple does not provide a package manager out-of-the-box.
        2. Install these dependencies via that package manager. Do not use pip.[6]
    • Windows, install the Python 3.x variant of Anaconda.[7]
  2. Open a terminal.

  3. Download either:

    • The unstable BETSE repository as follows:

      1. Install Git.

      2. Clone the master branch of this repository.

        git clone
      3. Prepare for installation.

        cd betse
    • Any stable BETSE release, including the most recent, as follows:

      1. Visit our source tarball archive.

      2. Click the download icon to the right of the desired release and select Download tar.gz.

      3. Extract the downloaded tarball into the current directory.

        tar -xvzf betse-*.tar.gz
      4. (Optional) Remove this tarball.

        rm betse-*.tar.gz
      5. Prepare for installation.

        cd betse-*
  4. Install BETSE either:

    • (Recommended) Editably, installing a cross-platform symbolic link to the current BETSE codebase. Modifications to this code are applied immediately without requiring reinstallation.

      sudo python3 develop
    • Non-editably, installing a physical copy of the current BETSE codebase. Modifications to this code are ignored and thus require reinstallation.

      sudo python3 install
  5. (Optional) Test BETSE, running all modelling phases of a sample simulation from a new directory.

    cd /tmp && betse try
[6](1, 2) Do not install scientific dependencies (e.g., NumPy, SciPy) with either pip or easy_install; doing so typically degrades BETSE to single-core performance. To optimize BETSE across multiple cores, always install these dependencies with your platform-specific package manager (e.g., Homebrew, APT).
[7]Unlike Linux and macOS, Anaconda is (effectively) required under Windows. Due to Microsoft’s lack of support for POSIX-compliant toolchains, no reasonable alternatives for installing multicore-aware scientific dependencies exist.


BETSE itself provides the betse command, a low-level command line interface (CLI) optimized for non-interactive scripting (e.g., for implementing massively parallel genetic algorithms). See the following external documents for detailed usage instructions – complete with explanatory examples, sample plots, and ample screenshots:

Alternately, our sister project BETSEE provides the betsee command, a high-level graphical user interface (GUI) optimized for interactive experimentation.


BETSE simulates biorealistic electrochemical phenomena in gap junction-networked 2D cellular collectives. To predict bioelectric patterns and their spatio-temporal dynamics, BETSE:

  • Models ion channel and gap junction activity.
  • Tracks changes in ion concentration and net ionic charge.
  • Calculates endogenous voltages and currents.
  • Accepts simulation parameters, variables, and options as human-readable, well-commented configuration files in YAML format.
  • Exports simulation results to a variety of output formats, including:
    • Publication-quality:
      • Plots, charts, and animations driven by Matplotlib, the industry standard for open-source plot visualization.
      • Directed graphs (i.e., networks) driven by Graphviz, the industry standard for open-source graph visualization.
    • Internet-friendly compressed video driven by any of various popular open-source video encoders, including FFmpeg, Libav, and MEncoder.
    • Post-processable tabular data (e.g., comma-separated values (CSV)).
  • Imports bitmask images defining the shapes of:
    • Cell clusters.
    • Cell cluster regions localizing ion channel activity, typically signifying disparate types of adjacent tissue.

To assemble simple concepts into complex simulations, BETSE supplies a richly configurable, highly scalable biological toolset consisting of:


Simulations may enable arbitrary combinations of the principal ions implicated in bioelectrical signaling – including:

Ion Channels

Individual cells in simulations may enable arbitrary combinations of voltage-gated ion channels, each implementing the Hodgkin-Huxley (HH) formalism with experimentally-derived parameters sourced from reputable knowledge-based systems (e.g., Channelpedia). Explicitly supported channel types include:

Custom ion channels parametrized by user-selected constants may be trivially defined in the same manner (e.g., via a YAML-formatted configuration file).

Ion Pumps and Exchangers

For fine-grained control over cell dynamics, notable ion pumps and exchangers may also be selectively enabled – including:

Custom ion pumps and exchangers parametrized by user-selected constants may be trivially defined in the same manner (e.g., via a YAML-formatted configuration file).

Extracellular Space

Cells form interconnected intracellular networks via voltage-sensitive gap junction connections embedded within an extracellular environment, maintained by tight junctions at the cell cluster periphery. Simulation of this environment enables exploration of local field potentials, transepithelial potential, and ephaptic coupling between cells.

Biological Networks

Simulation of gene regulatory and biochemical reaction networks at both the cellular and mitochondrial level supports deep spatial analysis of otherwise intractable biological processes. Metabolism, disease, aging, and other genetic and epigenetic phenomena commonly associated with quasi-Big Data are all valid targets for exhaustive study with BETSE.

To integrate these potent control systems with bioelectrical signaling, the activity-modulated interaction between gene products and similar biochemicals is fully integrated with ion channels, ion pumps, and gap junctions.


BETSE is peer-reviewed software receiving continual evidence-based scrutiny. Simulation output is reproducibly synchronized with experimental observations on membrane permeability, resting potential, ion concentration, and similar real-world biophysical quantities. Predictable outcomes have been demonstrated for such well-known cases as:

For details, see our recently published introductory paper.


BETSE is open-source software released under the permissive BSD 2-clause license.


BETSE is formally described in our introductory paper. Third-party papers, theses, and other texts leveraging BETSE should (ideally) cite the following:

Pietak, Alexis and Levin, Michael, 2016. Exploring instructive physiological signaling with the bioelectric tissue simulation engine (BETSE). (Supplement). [8] Frontiers in Bioengineering and Biotechnology, 4(55). DOI: 10.3389/fbioe.2016.00055

Subsequent papers expanding the BETSE architecture with additional theory, experimental results, and comparative metrics include:

Pietak, Alexis and Levin, Michael, 2017. Bioelectric gene and reaction networks: computational modelling of genetic, biochemical and bioelectrical dynamics in pattern regulation. (Supplement). [8] Journal of The Royal Society Interface, 14(134), p.20170425. DOI: 10.1098/rsif.2017.0425
[8](1, 2) This article’s supplement extends the cursory theory presented by this article with a rigorous treatment of the mathematics, formalisms, and abstractions required to fully reproduce this work. If theoretical questions remain after completing the main article, please consult this supplement.


BETSE comes courtesy a dedicated community of authors and contributors – without whom this project would be computationally impoverished, biologically misaligned, and simply unusable.

Thanks, all.

See Also

For prospective users:

  • Installation, detailing BETSE’s installation with exhaustive platform-specific instructions.

For prospective contributors:

  • Development, detailing development of the BETSE codebase – philosophy, workflow, and otherwise.
  • Testing, detailing testing of the BETSE codebase – continuous integration, manual testing, and otherwise.
  • Freezing, detailing conversion of the BETSE codebase into redistributable platform-specific executable binaries.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
betse-0.7.0-py3-none-any.whl (2.1 MB) Copy SHA256 hash SHA256 Wheel py3
betse-0.7.0.tar.gz (1.5 MB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page