Skip to main content

TopasMOO

CI PyPI version Python versions License: MIT

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_mode for 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

topasmoo-0.2.0.tar.gz (46.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

topasmoo-0.2.0-py3-none-any.whl (58.1 kB view details)

Uploaded Python 3

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

Hashes for topasmoo-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d6c82f9e01e3b9d3b956dca70aeaea0244898b6b285f6f60345ca509cb6418ff
MD5 99a2a36b128f645a996f4bbac816a08e
BLAKE2b-256 8b9d39f53f39a9efa55e7a92ac03737d3cc74389e1c6f4523f3a2d01ee973cb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for topasmoo-0.2.0.tar.gz:

Publisher: release.yml on mindyharkness/TopasMOO

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for topasmoo-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da529782988d159092c545dc16907c11c5c06cf7c2a2d1e190c89355df214e24
MD5 a36e04e8631b57499708001abf48c3ec
BLAKE2b-256 7d50755aad0cbf271c2457ac20d398cfd0158dd559ae1c34ec266fd1dd1adf17

See more details on using hashes here.

Provenance

The following attestation bundles were made for topasmoo-0.2.0-py3-none-any.whl:

Publisher: release.yml on mindyharkness/TopasMOO

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page