AnaSim
AnaSim simulates adult anesthesia for education and research. It combines published pharmacology and cardiorespiratory models with an interface for the patient monitor and anesthesia machine.
Run AnaSim
Open robche.com/AnaSim in your browser.
To run it locally, install it with Python 3.12 or later.
python3 -m venv .venv
source .venv/bin/activate
python -m pip install anasim-simulator
anasim
In Windows Command Prompt, use python in place of python3 and activate with
.venv\Scripts\activate.bat.
Features
| Feature | Supported controls and measurements |
|---|---|
| Patient variation | Age, body size, renal and hepatic function, coronary disease, heart failure, COPD, obesity, type 2 diabetes, baseline glucose, pregnancy with maternal positioning, and optional individual variation in drug kinetics and response |
| Anesthesia | Propofol, remifentanil, fentanyl, hydromorphone, morphine, naloxone, midazolam, flumazenil, etomidate, ketamine, lidocaine, bupivacaine, ropivacaine, sevoflurane, nitrous oxide, rocuronium, succinylcholine, sugammadex, and neostigmine |
| Cardiovascular drugs | Norepinephrine, epinephrine, phenylephrine, ephedrine, vasopressin, dobutamine, milrinone, esmolol, labetalol, atropine, glycopyrrolate, and amiodarone |
| Anesthesia machine | Central O₂, air, and N₂O pipelines with finite backup E-cylinders and pneumatic/electric ventilator drive gas, facemask with adjustable seal, supraglottic airway (SGA), tracheal tube, difficult-airway escalation tools and emergency front-of-neck access, fresh gas flow, vaporizer, and an adjustable pressure-limiting (APL) valve for bag ventilation and spontaneous breathing |
| Ventilation | Volume control (VCV), pressure control (PCV), pressure control with volume guarantee (PCV-VG), synchronized intermittent mandatory ventilation (SIMV), pressure support (PSV), and continuous positive airway pressure (CPAP) |
| Monitoring | ECG, pulse oximetry, arterial and noninvasive blood pressure, capnography, ventilation waveforms and loops, gas concentrations and source pressures, bispectral index (BIS), neuromuscular monitoring (TOF, PTC, and single twitch), temperature, arterial and extracorporeal blood gases, activated clotting time (ACT), coagulation panel (INR, fibrinogen, platelets), ROTEM, point-of-care blood glucose, fluid balance, trends, and alarms |
| Treatments | Fluids, variable-age packed red cells, FFP, platelets, cryoprecipitate, dextrose and regular insulin, heparin and protamine, spinal and epidural neuraxial anesthesia with bedside level checks, ECMO and cardiopulmonary bypass with Buckberg and del Nido cardioplegia, variable-quality chest compressions, selectable-energy defibrillation and synchronized cardioversion, temporary pacing, pleural decompression, central venous air aspiration, thrombolysis, lipid emulsion, dantrolene, methylene blue, calcium chloride, magnesium sulfate, sodium bicarbonate, fluid warming, forced-air warming, and surface cooling |
| Events | Surgical stimulation, laparoscopic CO₂ pneumoperitoneum, airway obstruction, difficult airway, esophageal intubation, bronchospasm, laryngospasm, tension pneumothorax, ARDS pulmonary shunt, arrhythmias, hemorrhage, anaphylaxis, sepsis, massive pulmonary embolism, venous air embolism, high spinal, malignant hyperthermia, local anesthetic systemic toxicity, methemoglobinemia, protamine reaction, and oxygen supply failure |
| Cases | Total intravenous anesthesia (TIVA) and balanced induction, TIVA and inhalational emergence, airway and thoracic crises (failed laryngoscopy, esophageal intubation, oxygen supply failure, and tension pneumothorax), circulatory and metabolic crises (hemorrhage, anaphylaxis, septic shock, venous air embolism, massive pulmonary embolism, high spinal, local anesthetic systemic toxicity, malignant hyperthermia, and cardiac arrest), and extracorporeal cases (VV ECMO, VA ECMO, CPB weaning, and protamine reversal), each in guided or independent mode with a debrief |
Depending on the drug, delivery options include boluses, manual infusions, and target-controlled infusion (TCI) to a plasma or effect-site target.
Limits
AnaSim supports adults aged 18 to 85 years within the input limits. The model guide describes how the models represent patient conditions.
Headless use
Run a 60-second simulation and save a CSV recording.
anasim --mode headless --duration 60 --record
Documentation
| Task | Guide |
|---|---|
| Configure patients, run scripts, or interpret CSV files | CLI and Python usage |
| Understand model behavior and assumptions | Models |
| Understand the code structure and step order | Architecture |
| Find the source studies | Model references |
| Compare model outputs with clinical recordings | VitalDB, MOVER, and simulator comparison |
| Change the code and choose which checks to run | Contributing |
| Review release changes | Changelog |
Citation and license
To cite AnaSim, use CITATION.cff.
Copyright © 2026 Robert Chen. Starting with version 26.12, AnaSim is licensed under the GNU Affero General Public License version 3. You may use, modify, and redistribute AnaSim under the license terms. AnaSim comes without warranty.
Metadata
Release files for anasim-simulator 26.12
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 |
|---|---|---|---|---|
| anasim_simulator-26.12.tar.gz | 1.1 MB | With provenance | Details for anasim_simulator-26.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anasim_simulator-26.12-py3-none-any.whl | Python 3 | none | any | Details for anasim_simulator-26.12-py3-none-any.whl |
Total release size: 1.8 MB
Release files / anasim_simulator-26.12.tar.gz
| Download URL | anasim_simulator-26.12.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
028c24f5484c3743e5f6c56df908d9a808aa265444501908e62b492ef109be26
|
|
BLAKE2b-256 checksum How to use checksums |
072dd835a7c7a5d9fa1fb80d4d87f5ed8a5294d3af5a798bb0554ae7674db3bb
|
| 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 Dec 1, 2026.
Transparency logRelease files / anasim_simulator-26.12-py3-none-any.whl
| Download URL | anasim_simulator-26.12-py3-none-any.whl |
|---|---|
| Size | 747.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5eddc872415a1a274e36ae3fa33ea37d9d3d743802616a70b43793612e3b96d2
|
|
BLAKE2b-256 checksum How to use checksums |
b4f9b69c0cd0ea4cceb7bc708f031540290e6334cad352644c3a2cb13c7366cc
|
| 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 Dec 1, 2026.
Transparency logSecurity for anasim-simulator 26.12
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 anasim_simulator-26.12.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 Dec 1, 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.