DendroTweaks: Interactive Neuronal Modeling with Bokeh

Hi Bokeh community! :waving_hand:

I’m excited to share DendroTweaks, a comprehensive toolbox for exploring and fine-tuning biophysical neuronal models, built with Bokeh as its visualization framework.

What is DendroTweaks?

DendroTweaks is a Python toolbox that makes detailed single-cell neuronal models interactive and accessible. It helps neuroscientists understand how the morphological and biophysical properties of neurons (particularly their dendrites) shape neuronal activity and function.

Key features:

  • Interactive cell viewer for detailed morphology inspection.
  • Graph-based visualization of dendritic trees with color-coded distributions of ion channels, synapses, etc.
  • Interactive parameter tuning with real-time visual feedback across synchronized plots.

For more on the scientific background and use cases, check out our recent eLife publication:

Roman Makarov, Spyridon Chavlis, Panayiota Poirazi (2024) DendroTweaks: An interactive approach for unraveling dendritic dynamics eLife 13:RP103324 DOI https://doi.org/10.7554/eLife.103324.1

How to get started

Implementation highlights

DendroTweaks follows a Model-View-Presenter (MVP) structure:

  • The Model manages the simulation backend (e.g., NEURON).
  • The View consists of Bokeh layouts, plots, and widgets.
  • The Presenter coordinates updates between them.

The Presenter class uses methods as callbacks for Bokeh widgets. Here are some representative examples:

def update_dt_callback(self, attr, old, new):
    self.model.simulator.dt = new

def voltage_callback_on_change(self, attr, old, new):
    if self.view.widgets.switches['run_on_interaction'].active:
        self.update_voltage()

def rotate_cell_renderer_callback(self, attr, old, new):
    self.model.point_tree.rotate(new - old)
    self.view.sources['cell'].data = self.get_cell_data()

The Presenter is modularized into several mixin classes, each handling a specific part of the interface or computation, while keeping the class interface flat. This design made it easy to scale DendroTweaks as we added new visualization modules and controls.

Final thoughts

It’s been a pleasant and insightful development journey. Many thanks to the Bokeh team for creating such a powerful and elegant framework!

We’d love to hear feedback from the Bokeh community, especially on architectural choices, performance optimization, UX/UI design, and experiences integrating Bokeh into scientific applications.

Your thoughts, questions, and suggestions are welcome!

1 Like

Thanks for sharing!!

1 Like