TopasMOO
TopasMOO is a Python toolkit for multi-objective optimization of TOPAS Monte Carlo radiation therapy simulations, enabling automated discovery of Pareto-optimal treatment designs.
Installation
pip install topasmoo
# or from source:
git clone https://github.com/mindyharkness/TopasMOO.git
cd TopasMOO
pip install -e .
For local development with uv:
uv sync --extra dev
uv run ruff check TopasMOO tests
uv run pytest
Requirements
- Python >= 3.10, < 3.13
- A working TOPAS installation for full Monte Carlo runs (or use
testing_modefor development and benchmarks)
Quick Start
The optimizer expects a project directory with GenerateTopasScripts.py and TopasObjectiveFunction.py, following the TopasOpt layout. The repository’s examples/DevelopmentExample folder implements the ZDT1 benchmark: TOPAS is not run, but those two files are still present so the workflow matches a real study.
From the repository root, after installing the package:
from pathlib import Path
import numpy as np
from TopasMOO import NSGAII_Optimizer
opt_dir = Path("examples/DevelopmentExample")
optimization_params = {
"ParameterNames": ["x1", "x2", "x3", "x4", "x5"],
"UpperBounds": np.ones(5),
"LowerBounds": np.zeros(5),
"start_point": np.full(5, 0.5),
"n_generations": 20,
"n_objectives": 2,
}
optimizer = NSGAII_Optimizer(
optimization_params=optimization_params,
BaseDirectory=str(opt_dir),
SimulationName="QuickStart",
OptimizationDirectory=opt_dir,
TopasLocation="testing_mode",
Overwrite=True,
pop_size=12,
publication_variant="clean", # or "nature" / "ieee" / "medicalphysics"
)
results = optimizer.RunOptimization()
# results.X: decision variables on the Pareto set; results.F: objective values
For a full walkthrough, plots, and validation metrics, run python DevelopmentExample_main.py inside examples/DevelopmentExample/. For collimator optimization with TOPAS, see examples/ApertureOptimization.
Citation
If you use TopasMOO, please cite it (placeholder entry until a DOI is available) and the TopasOpt paper:
@software{harkness_topasmoo_2026,
author = {Harkness, Mindy},
title = {{TopasMOO}: Multi-objective optimization for {TOPAS} {Monte} {Carlo} simulations},
year = {2026},
url = {https://github.com/mindyharkness/TopasMOO},
note = {Placeholder: replace with published citation when available},
}
@article{whelan_topasopt_2022,
title = {{TopasOpt}: {An} open-source library for optimization with {Topas} {Monte} {Carlo}},
journal = {Medical Physics},
author = {Whelan, Brendan and Loo Jr, Billy W. and Wang, Jinghui and Keall, Paul},
year = {2022},
publisher = {Wiley Online Library},
}
License
This project is released under the MIT License.
Related Projects
- TopasOpt — single-objective optimization for TOPAS
- TOPAS — Monte Carlo simulation for medical physics
- pymoo — multi-objective optimization algorithms in Python
TopasMOO is intended for multi-objective problems (at least two objectives). For a single scalar objective, use TopasOpt.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file topasmoo-0.2.0.tar.gz.
File metadata
- Download URL: topasmoo-0.2.0.tar.gz
- Upload date:
- Size: 46.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6c82f9e01e3b9d3b956dca70aeaea0244898b6b285f6f60345ca509cb6418ff
|
|
| MD5 |
99a2a36b128f645a996f4bbac816a08e
|
|
| BLAKE2b-256 |
8b9d39f53f39a9efa55e7a92ac03737d3cc74389e1c6f4523f3a2d01ee973cb0
|
Provenance
The following attestation bundles were made for topasmoo-0.2.0.tar.gz:
Publisher:
release.yml on mindyharkness/TopasMOO
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
topasmoo-0.2.0.tar.gz -
Subject digest:
d6c82f9e01e3b9d3b956dca70aeaea0244898b6b285f6f60345ca509cb6418ff - Sigstore transparency entry: 2196240580
- Sigstore integration time:
-
Permalink:
mindyharkness/TopasMOO@bda4e0e1f9ee4847c9451f83a1615b03378c4017 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/mindyharkness
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bda4e0e1f9ee4847c9451f83a1615b03378c4017 -
Trigger Event:
push
-
Statement type:
File details
Details for the file topasmoo-0.2.0-py3-none-any.whl.
File metadata
- Download URL: topasmoo-0.2.0-py3-none-any.whl
- Upload date:
- Size: 58.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da529782988d159092c545dc16907c11c5c06cf7c2a2d1e190c89355df214e24
|
|
| MD5 |
a36e04e8631b57499708001abf48c3ec
|
|
| BLAKE2b-256 |
7d50755aad0cbf271c2457ac20d398cfd0158dd559ae1c34ec266fd1dd1adf17
|
Provenance
The following attestation bundles were made for topasmoo-0.2.0-py3-none-any.whl:
Publisher:
release.yml on mindyharkness/TopasMOO
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
topasmoo-0.2.0-py3-none-any.whl -
Subject digest:
da529782988d159092c545dc16907c11c5c06cf7c2a2d1e190c89355df214e24 - Sigstore transparency entry: 2196240910
- Sigstore integration time:
-
Permalink:
mindyharkness/TopasMOO@bda4e0e1f9ee4847c9451f83a1615b03378c4017 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/mindyharkness
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bda4e0e1f9ee4847c9451f83a1615b03378c4017 -
Trigger Event:
push
-
Statement type: