PyMedPhys
PyMedPhys is an open-source Medical Physics Python library built by an open community that values code sharing, review, improvement, and learning from each other.
Description
|logo|
.. |logo| image:: https://github.com/pymedphys/pymedphys/raw/ca501275227f190a77e641a75af925d9070952b6/lib/pymedphys/docs/_static/pymedphys_title.svg :target: https://docs.pymedphys.com/
.. START_OF_DOCS_IMPORT
A community effort to develop an open standard library for Medical Physics in Python. We build high quality, transparent software together via peer review and open source distribution. Open code is better science.
|build| |pypi| |python| |license|
.. |build| image:: https://github.com/pymedphys/pymedphys/actions/workflows/ci.yml/badge.svg?branch=main :target: https://github.com/pymedphys/pymedphys/actions/workflows/ci.yml
.. |pypi| image:: https://img.shields.io/pypi/v/pymedphys :target: https://pypi.org/project/pymedphys/
.. |python| image:: https://img.shields.io/pypi/pyversions/pymedphys :target: https://pypi.org/project/pymedphys/
.. |license| image:: https://img.shields.io/pypi/l/pymedphys :target: https://choosealicense.com/licenses/apache-2.0/
What is PyMedPhys?
PyMedPhys is an open-source Medical Physics Python library built by an open
community that values code sharing, review, improvement, and learning from each
other. It is inspired by the collaborative work of our physics peers in
astronomy and the Astropy Project. PyMedPhys is available on PyPI and
GitHub_.
PyMedPhys supports three main ways of working:
- a Python library for notebooks, scripts, and clinic-specific tooling
- a command line interface (CLI) for repeatable automation
- a point-and-click app layer for selected workflows
Beta level of development
PyMedPhys is currently within the beta stage of its life-cycle. It will
stay in this stage until the version number leaves 0.x.x and enters
1.x.x. While PyMedPhys is in beta stage, no API is guaranteed to be
stable from one release to the next. Upgrading pymedphys can therefore
break existing scripts or workflows. We try to stay ahead of that by
documenting breaking changes in the Release Notes_.
Start here
If you are new to PyMedPhys, start with these four questions in order:
What PyMedPhys can do_Choose your path_Installation options_Quick Start Guide_
Common task areas
PyMedPhys is often used to:
- compare dose or fluence-like data with gamma, interpolation, and MetersetMap
- work with DICOM and pseudonymisation workflows
- work with delivery, logfile, and iCom data
- query or integrate with Mosaiq
- use point-and-click apps for selected workflows
Install PyMedPhys
PyMedPhys currently supports Python 3.12, 3.13, and 3.14.
For most users, we recommend using uv to create an environment and install
PyMedPhys:
.. code:: bash
uv python install 3.12
uv venv --python 3.12
uv pip install "pymedphys[user]"
If you cannot use uv on your workstation, the Quick Start Guide_ also
includes a standard Python + venv + pip fallback path.
Choose the right interface
Use the Python library when you want notebooks, analysis, plots, and clinic-specific workflows.
Use the CLI when you want repeatable commands, scheduled jobs, or shell automation.
Use the app layer when you want the least coding and a graphical workflow.
For a fuller comparison, read Choose your path_.
Documentation
The PyMedPhys documentation has two overarching guides:
-
The Users Guide: where you can
get started_ with the library, the CLI, and the app layer; read task-focusedhow-to guides; findbackground informationon larger projects and concepts; and browse theTechnical Reference_ when you already know the feature you need. -
The Contributors Guide: for those who want to contribute to PyMedPhys. This includes the
Contributors Guide_ landing page, detailedworkstation setup guides, importantrepository information, and sometips & tricks_ for common problems.
Community
PyMedPhys has a
GitHub Discussions <https://github.com/pymedphys/pymedphys/discussions>_
page to help users find their feet and to support collaboration and general
discussion.
.. END_OF_DOCS_IMPORT
Citing PyMedPhys
PyMedPhys' first paper in the Journal of Open Source Software contains more
background information, including the Statement of Need. You can access the
paper here <https://joss.theoj.org/papers/10.21105/joss.04555>.
When referencing PyMedPhys, please cite this paper as follows:
Biggs, S., Jennings, M., Swerdloff, S., Chlap, P., Lane, D., Rembish, J., McAloney, J., King, P., Ayala, R., Guan, F., Lambri, N., Crewson, C., Sobolewski, M. (2022). PyMedPhys: A community effort to develop an open, Python-based standard library for medical physics applications. Journal of Open Source Software, 7(78), 4555, https://doi.org/10.21105/joss.04555
Development
PyMedPhys uses uv_ for package and project management and Hatchling to build
distributions. See the Contributors Guide_ for the complete setup and PR
workflow.
After cloning the repository, install the PyMedPhys dependencies and set up pre-commit by running:
.. code:: bash
uv sync --python 3.14 --locked
uv run -- pre-commit install
Run automated tests with:
.. code:: bash
uv run -- pymedphys dev tests
Our Team
PyMedPhys is built and supported by its maintainers and contributors, past and present.
Maintainers
Matthew Jennings_Icon Oncology Group_, UK
.. _Matthew Jennings: https://github.com/Matthew-Jennings
Simon Biggs_ (founder)Anthropic PBC_
.. _Simon Biggs: https://github.com/SimonBiggs
Phillip Chlap_Radformation Inc._, USAUniversity of New South Wales_, Australia
.. _Phillip Chlap: https://github.com/pchlap
Stuart Swerdloff_SJS Targeted Solutions, LLP_, New Zealand
.. _Stuart Swerdloff: https://github.com/sjswerdloff
|sjs|
Recent contributors
Recent contributions include code, review, testing, documentation, and user support.
-
Jeffrey D. Cooney <https://github.com/jdotc1>_ -
Cody Crewson_Saskatchewan Cancer Agency_, Canada
.. _Cody Crewson: https://github.com/crcrewso
Derek Lane_ (DLaneAtElekta_)ELEKTA AB_, Houston TX
.. _Derek Lane: https://github.com/dg1an3
.. _DLaneAtElekta: https://github.com/DLaneAtElekta
-
Marchant Van der Walt <https://github.com/kkushsyndrome-stack>_ -
Vishu_Hansraj College_, India
.. _Vishu: https://github.com/httpsVishu
Matthew Ward <https://github.com/MattAWard>_
Contributor acknowledgements
Rafael Ayala <https://github.com/ayalalazaro>_ (QuickCheck tools and tests)Cedric Belanger <https://github.com/cedricbelanger>_ (RT Dose pixel spacing)David Buckle <https://github.com/db72-git>_ (plan complexity tools)Matthew Cooper <https://github.com/matthewdeancooper>_ (auto-contouring)Marcus Fisk_ (Streamlit and iCOM)Cancer Care Riverina_, Australia
.. _Marcus Fisk: https://github.com/laser47-hue
Fada Guan_ (gamma examples)Yale University School of Medicine_, USA
.. _Fada Guan: https://github.com/guanfada
Marcelo Jordao_ (TRF decoding)ELEKTA AB_, Hong Kong SAR
.. _Marcelo Jordao: https://github.com/mguerrajordao
Paul King <https://github.com/kingrpaul>_ (sinograms and profiles)Nicola Lambri_ (gamma tutorials and development tooling)IRCCS Humanitas Research Hospital_, ItalyHumanitas University_, Italy
.. _Nicola Lambri: https://github.com/nlambriICH
-
Pedro Martinez <https://github.com/peterg1t>_ (linac QA tools for graticules, jaws, and light and radiation field alignment, plus Oncentra brachytherapy utilities) -
Jacob McAloney <https://github.com/JacobMcAloney>_ (film comparison) -
mfizyczka <https://github.com/mfizyczka>_ (TRF test data and format investigation) -
Jake Rembish_ (plan transfer, weekly chart checks, plan scoring, and the JOSS paper)UT Health San Antonio_, USA
.. _Jake Rembish: https://github.com/rembishj
Matthew Sobolewski <https://github.com/msobolewski>_ (early Winston–Lutz development)Milo Vermeulen <https://github.com/mivermeu>_ (package path handling)Philip Yarra <https://github.com/PhilipYarra>_ (Pinnacle export)
|uth| |ccr|
See the GitHub contributor history_ for more contributors.
.. _GitHub contributor history: https://github.com/pymedphys/pymedphys/graphs/contributors
Third-party content
PyMedPhys includes third-party code and data under their own licences, whose files the package lists in its metadata.
PyMedPhys's DICOM de-identification includes tables generated from the DICOM Standard, edition 2026d, and rule files that name its attributes and codes:
- DICOM PS3.3 2026d, © NEMA
- DICOM PS3.4 2026d, © NEMA
- DICOM PS3.6 2026d, © NEMA
- DICOM PS3.15 2026d, © NEMA
- DICOM PS3.16 2026d, © NEMA
The National Electrical Manufacturers Association (NEMA) publishes the DICOM Standard at https://www.dicomstandard.org/. The tables were extracted automatically from the published DICOM Standard and may contain errors. The published Standard is authoritative. PyMedPhys regenerates the tables for each new edition of the DICOM Standard.
DICOM® is the registered trademark of the National Electrical Manufacturers Association (NEMA) for its standards publications relating to digital communications of medical information. NEMA does not endorse, sponsor, or certify PyMedPhys.
Some of PyMedPhys's data tables include LOINC codes, which carry this notice:
This material contains content from LOINC (http://loinc.org). LOINC is copyright © Regenstrief Institute, Inc. and the Logical Observation Identifiers Names and Codes (LOINC) Committee and is available at no cost under the license at http://loinc.org/license. LOINC® is a registered United States trademark of Regenstrief Institute, Inc.
.. Unfortunately :target: being a variable name is no longer supported by GitHub within README.rst files. So... unfortunately we have some duplication below.
.. |uth| image:: https://github.com/pymedphys/pymedphys/raw/3f8d82fc3b53eb636a75336477734e39fa406110/docs/logos/UTHSA_logo.png :target: https://www.uthscsa.edu/academics/biomedical-sciences/programs/radiological-sciences-phd
.. |sjs| image:: https://github.com/pymedphys/pymedphys/raw/7e9204656e0468b0843533472553a03a99387386/logos/swerdloff.png :target: https://github.com/sjswerdloff
.. |ccr| image:: https://github.com/pymedphys/pymedphys/raw/ec61e4e63a8624f4df44a8e90931bd0bca748e20/logos/cancercareriverina_200x200.png :target: https://cancercare.com.au/clinics/cancer-care-riverina/
.. _Anthropic PBC: https://www.anthropic.com/
.. _ELEKTA AB: https://www.elekta.com/
.. _Icon Oncology Group: https://icongroup.global/en/our-services/cancer-services-united-kingdom/
.. _University of New South Wales: https://www.unsw.edu.au/
.. _UT Health San Antonio: https://www.uthscsa.edu/academics/biomedical-sciences/programs/radiological-sciences-phd
.. _SJS Targeted Solutions, LLP: https://github.com/sjswerdloff
.. _Radformation Inc.: https://radformation.com/
.. _IRCCS Humanitas Research Hospital: https://www.humanitas.net/
.. _Saskatchewan Cancer Agency: http://www.saskcancer.ca/
.. _Humanitas University: https://www.hunimed.eu/
.. _Yale University School of Medicine: https://medicine.yale.edu/
.. _Cancer Care Riverina: https://cancercare.com.au/clinics/cancer-care-riverina/
.. _Hansraj College: https://hansrajcollege.ac.in/
.. _Astropy Project: https://www.astropy.org/
.. _PyPI: https://pypi.org/project/pymedphys/
.. _GitHub: https://github.com/pymedphys/pymedphys
.. _Release Notes: https://github.com/pymedphys/pymedphys/blob/main/CHANGELOG.md
.. _Statement of Need: https://docs.pymedphys.com/en/latest/statement-of-need.html
.. _What PyMedPhys can do: https://docs.pymedphys.com/en/latest/users/get-started/what-pymedphys-can-do.html
.. _Choose your path: https://docs.pymedphys.com/en/latest/users/get-started/choose-your-path.html
.. _Installation options: https://docs.pymedphys.com/en/latest/users/get-started/installation-options.html
.. _Quick Start Guide: https://docs.pymedphys.com/en/latest/users/get-started/quick-start.html
.. _get started: https://docs.pymedphys.com/en/latest/users/get-started/index.html
.. _how-to guides: https://docs.pymedphys.com/en/latest/users/howto/index.html
.. _background information: https://docs.pymedphys.com/en/latest/users/background/index.html
.. _Technical Reference: https://docs.pymedphys.com/en/latest/users/ref/index.html
.. _Contributors Guide: https://docs.pymedphys.com/en/latest/contrib/index.html
.. _workstation setup guides: https://docs.pymedphys.com/en/latest/contrib/setups/index.html
.. _repository information: https://docs.pymedphys.com/en/latest/contrib/info/index.html
.. _tips & tricks: https://docs.pymedphys.com/en/latest/contrib/tips/index.html
.. _uv: https://docs.astral.sh/uv/