neuroclamp: Patch Clamp Simulator
neuroclamp is a Python library for simulating neuronal electrophysiology using the
Hodgkin-Huxley model.
It models how action potentials arise at a neuron's membrane by simulating the dynamics
of voltage-gated ion channels over time. The core model includes the classic sodium,
potassium, and leak channels, and can be extended with 10 additional channel types
(Ih, IKa, INaP, INaR, IM, IKir, IKCa, ICaL, ICaT, ICaN) via a pluggable channel
architecture.
Key features:
- Hodgkin-Huxley neuron model with configurable conductances, ion concentrations, and temperature. Reversal potentials are derived via the Nernst equation, with Goldman-Hodgkin-Katz support for mixed-ion channels (e.g. Ih). Optional intracellular calcium dynamics are coupled to calcium-permeable channels.
- Current clamp simulations: inject a stimulus current and record the resulting membrane voltage response.
- Voltage clamp simulations: hold the membrane at a commanded voltage and record the resulting ionic currents.
- A library of stimulation protocols: current clamp (step, ramp, pulse train, sinusoidal, chirp, noise) and voltage clamp (step, ramp, pulse train, I-V curve).
Web UI
neuroclamp includes an interactive web interface inspired by pClamp electrophysiology software.
- Configure neuron parameters and enable/disable additional ion channels with conductance sliders
- Run current clamp and voltage clamp protocols
- Sweep overlay with click/hover/keyboard selection
- Continuous simulation mode for oscilloscope-like real-time recording
- 6 built-in presets: Action Potential, Subthreshold Response, Repetitive Firing, I-V Curve, Na+ Channel Activation, Frequency Response
Installing from PyPI
pip install neuroclamp # core library only
pip install "neuroclamp[ui]" # library plus the web UI
Start the web UI from any directory:
neuroclamp ui
The app opens in your browser at http://localhost:3000 once it is ready.
Options:
--port PORT: serve on a different port (default 3000).--host HOST: interface to bind to (default127.0.0.1, this computer only). If you bind to0.0.0.0and open the app from another machine, also setREFLEX_API_URLto the URL the browser uses, for exampleREFLEX_API_URL=http://myhost:3000.--no-browser: do not open a browser.--workdir PATH: where the generated config and frontend build are kept (default:$NEUROCLAMP_WORKDIR, else a per-user cache directory such as~/.cache/neuroclamp/<version>/on Linux).--reset: delete the working directory first and rebuild the frontend. The launcher only writes to, or deletes, a directory it created (or an empty one), so--workdircannot overwrite an existing folder.-v,--verbose: show detailed progress, including the command that runs the server.
The first launch downloads a JavaScript runtime and builds the web frontend.
This takes a few minutes and needs internet access; later launches reuse the
build. On minimal Linux systems the download needs curl and unzip.
Running from a source checkout
uv sync --frozen --extra=ui
uv run reflex run
Then open http://localhost:3000 in your browser.
Running with Docker
You can run the web UI without installing uv, Python, or Node; only Docker is required. From the repository root:
docker build -t neuroclamp .
docker run --rm -p 3000:3000 neuroclamp
or, with Docker Compose:
docker compose up --build
Then open http://localhost:3000. The container runs Reflex in production
mode and serves both the UI and the backend on port 3000. Each start rebuilds
the frontend bundle, which takes a few seconds before the app responds.
If the browser reaches the app at any URL other than http://localhost:3000,
pass that URL as REFLEX_API_URL:
docker run --rm -p 8080:3000 -e REFLEX_API_URL=http://localhost:8080 neuroclamp
- Different host port (e.g.
-p 8080:3000): withoutREFLEX_API_URLthe page cannot reach its backend at all, so nothing responds. - Another machine on port 3000 (e.g.
http://192.168.1.20:3000): withoutREFLEX_API_URLthe UI connects, but trace plots and Export CSV fail.
The container runs as a non-root user (uid 1000) and needs a writable filesystem, because Reflex writes its build and session state at startup. Reflex telemetry is disabled in the image.
Getting started with development
Prerequisites
You should have the following installed:
- uv: Python package manager
Development tooling
Common development tasks are run directly via uv. The commands below assume
you are at the top level of the repository.
Installing the development environment
uv sync --frozen --group=dev
This creates a Python venv virtual environment under the name .venv
in the top-level directory of the repository.
Managing dependencies
To regenerate and update project dependencies, run:
uv lock --upgrade
Unit tests
The full unit test suite can be run using:
uv run --frozen -m pytest --verbose
Test coverage
To see a line-by-line coverage report for the core library:
uv run --frozen -m pytest --cov=neuroclamp --cov-report=term-missing
To generate an HTML report (written to htmlcov/):
uv run --frozen -m pytest --cov=neuroclamp --cov-report=html
Linting and code style
Python code is styled using Ruff. Ruff is configured to cover typical flake8, black and isort behavior.
Formatting fixes can be applied using:
uvx ruff format .
uvx ruff check . --fix-only
Conformance to the styling rules can be checked with:
uvx ruff check .
uvx ruff format --check .
Type checking
uvx ty check
License
This project is licensed under the GNU General Public License v3.0 or later.
Metadata
Release files for neuroclamp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| neuroclamp-0.1.0.tar.gz | 948.0 kB | With provenance | Details for neuroclamp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| neuroclamp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for neuroclamp-0.1.0-py3-none-any.whl |
Total release size: 2.0 MB
Release files / neuroclamp-0.1.0.tar.gz
| Download URL | neuroclamp-0.1.0.tar.gz |
|---|---|
| Size | 948.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a5111092eb013b44213851993aa38f1b81582fb358dd28120c93837fb2c1831
|
|
BLAKE2b-256 checksum How to use checksums |
31bb7a681ad93b77339be67359aa6d201c8fade1552bad74f98ce4de108fa431
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / neuroclamp-0.1.0-py3-none-any.whl
| Download URL | neuroclamp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63764f0e5e1f664976e6315ba34471dfa5558c9741bcb2536e3e3c06de20a404
|
|
BLAKE2b-256 checksum How to use checksums |
ff0e843e3f4ff1e3b77db99ccf8906dbe4f8d7c216dee7f978b569293f32c469
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logSecurity for neuroclamp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for neuroclamp-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.