AnaSim
AnaSim is an interactive adult anesthesia and physiology simulator for teaching and model exploration.
What AnaSim models
AnaSim simulates drug delivery, pharmacokinetics, pharmacodynamics, cardiorespiratory physiology, ventilation, fluids, temperature, and common perioperative events in real time. The desktop interface uses standard patient monitor and anesthesia machine conventions. Headless mode supports scripted runs and CSV recording.
AnaSim includes propofol, remifentanil, sevoflurane, rocuronium, sugammadex, norepinephrine, epinephrine, phenylephrine, vasopressin, dobutamine, and milrinone. Ventilation modes include VCV, PCV, PSV, CPAP, and bag-mask ventilation.
Install and start
AnaSim requires Python 3.10 or later. Install it in a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install anasim-simulator
anasim
On Windows, activate the environment with .venv\Scripts\activate.
The package name is anasim-simulator. The command and Python module are both
named anasim.
First session
Run the guided TIVA induction to become familiar with the interface:
- Launch
anasim. - Select Guided scenario and Induction (TIVA).
- Confirm the default patient and select Start simulation.
- Use Open machine, Open medications, and Open events in the objective panel to open each control area.
- Start the clock when you are ready to observe the physiologic response.
Interface
| Area | Purpose |
|---|---|
| Monitor | Waveforms, displayed vital signs, anesthetic gas, temperature, neuromuscular function, and fluid balance |
| Machine | Airway connection, fresh gas flow, vaporizer, manual ventilation, and mechanical ventilation |
| Medications | Manual infusions, effect-site TCI, boluses, vasoactive agents, and reversal |
| Events and fluids | Fluids, blood products, surgical stimulation, airway events, hemorrhage, anaphylaxis, and sepsis |
Guided scenarios cover TIVA and inhalational induction, emergence, hemorrhage, anaphylaxis, septic shock, and oxygen supply failure. Open simulation mode provides direct control of the same environment.
Model scope and limits
AnaSim accepts these patient inputs:
| Input | Supported range |
|---|---|
| Age | 18 to 70 years |
| Weight | 50 to 100 kg |
| Height | 150 to 200 cm |
| BMI (from weight and height) | 18 to 32 kg/m² |
| Hemoglobin | 6 to 20 g/dL |
| Hematocrit | 0.18 to 0.60 |
| Renal function factor | 0.4 to 1.0 |
| Hepatic function factor | 0.5 to 1.0 |
The body-size limits cover the healthy-adult cohort behind the Su hemodynamic and Li norepinephrine models. Renal and hepatic factors are dimensionless model inputs.
AnaSim combines published component models with simulator-specific models for respiratory drug interaction, neuromuscular block and reversal, vasoactive drug response, and arterial pressure display. See model references for sources.
Monitor values include measurement lag and artifact, so they can differ from the underlying physiology. Acid-base balance, lactate, tissue oxygen debt, and full anesthesia machine pneumatics are not modeled.
Headless use
Run a reproducible ten-second simulation:
anasim --mode headless --duration 10 --config patient.json --record
Configuration files set patient characteristics, model choices, initial state, random seed, and runtime options. See the CLI guide for the available fields.
Documentation
Development
git clone https://github.com/robchiral/AnaSim.git
cd AnaSim
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"
ruff check .
QT_QPA_PLATFORM=offscreen python -m pytest -q
Regenerate the animated demo with python scripts/capture_demo.py.
Initial TIVA implementations were derived from Python Anesthesia Simulator.
Citation and license
For teaching or research use, cite the software and release described in
CITATION.cff.
AnaSim is available under the
MIT License.
Release files for anasim-simulator 1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| anasim_simulator-1.2.tar.gz | 150.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| anasim_simulator-1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 289.1 kB
Release files / anasim_simulator-1.2.tar.gz
| Download URL | anasim_simulator-1.2.tar.gz |
|---|---|
| Size | 150.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af6ca2e7927573b9b91567652e32d062452ce6b0c541d01c8d8b6ba66fb6b2e8
|
|
BLAKE2b-256 checksum How to use checksums |
2ad8ece56e747bccf140c051dfa79cab1baca5659b1cf29a33d10cbfc48ee698
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 24, 2026.
Transparency logRelease files / anasim_simulator-1.2-py3-none-any.whl
| Download URL | anasim_simulator-1.2-py3-none-any.whl |
|---|---|
| Size | 139.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
48ddc33ef937e1d00726b26670178a4906e9cb57e1bffd3a65cd721a90178f8f
|
|
BLAKE2b-256 checksum How to use checksums |
a3b260899a338db8ea0ff29ec70b22e34c46017cb328b180433c5360c28fe21b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 24, 2026.
Transparency log