Skip to main content

beamio

Read, write, and convert acquired or modelled radiotherapy beam measurements using a shared NumPy-based data model.

Supported formats

Format Read Write Automatic detection
IBA myQA Accept 6 ASCII (.asc) Yes Yes Yes
SNC SunSCAN/SunDOSE text (.snctxt) Yes Yes Yes
SNC SunDOSE XML (.sncxml) Yes No Yes
PTW Mephysto MCC water-tank scans (.mcc) Yes No Yes
RayStation 2025+ measured-curves CSV (.csv, semicolon-delimited) Yes Yes No; use Raystation directly

Installation

Requires Python 3.12 or newer. NumPy is installed automatically.

python -m pip install beamio

Read and convert beam data

from beamio.rfa import BeamDataFactory, IBAAccept6
from beamio.tps.raystation import Raystation

# Detect and parse an IBA ASCII, SNC, or PTW MCC export.
beam = BeamDataFactory.from_file("measurements.asc")
# Or select the reader explicitly:
# beam = IBAAccept6("measurements.asc").parse()

for measurement in beam.measurements:
    print(measurement.type, measurement.energy, measurement.field_size)
    print(measurement.positions, measurement.doses)

# Conversion copies measurements and metadata; save writes the target format.
converted = beam.convert(Raystation)
converted.save("measured_curves.csv")

# RayStation CSV files use the explicit reader.
curves = Raystation("measured_curves.csv").parse()

SNC exports use the same interface:

from beamio.rfa import SNCSunScan

scans = SNCSunScan("measurements.sncxml").parse()  # latest processing layer
scans.save("measurements.snctxt")
scans.convert(Raystation).save("measured_curves.csv")

SNC positions, field sizes, and SSD are converted to millimetres. Sample order, duplicate positions, dose values, and measured XYZ coordinates are preserved. XML can also select an earlier layer with layer="raw" or a layer number.

PTW MCC water-tank exports use PTWMCC(path).parse() or automatic detection. The reader supports depth-dose, crossplane, and inplane scans, preserving exported sample order and signal scale. Optional reference readings are stored in measurement.metadata["PTW Reference"]; no reference correction or normalization is applied. MCC writing, detector arrays, and diagonal/angled MCC scans are not supported. See format details.

BeamData provides parse(), save(), and convert(). Each Measurement contains NumPy positions and doses arrays, a MeasurementType, a RadiationType, energy, SSD, field size, scan endpoints, and a metadata dictionary. The shared spatial fields use millimetres. Dose values retain the input scale; conversion does not normalize or calibrate them.

Conversion transfers the shared model and copies metadata, but format-specific writers may use defaults or omit unsupported metadata. In particular, the RayStation writer generates its default file header (including an export time) rather than preserving the input header. IBA parsing removes non-finite sample pairs and sorts and deduplicates positions. Axial start coordinates are rounded to 0.2 mm, with values within 0.2 mm of zero set to zero; diagonal scans retain measured XYZ samples. IBA output rounds coordinates to 0.1 mm. These operations mean that a save is not a byte-for-byte round trip.

Development

python -m venv .venv

Activate the environment with .venv\Scripts\Activate.ps1 in PowerShell or source .venv/bin/activate on macOS/Linux, then run:

python -m pip install -e ".[dev]"
python -m pytest
python -m build
python -m twine check --strict dist/*
python tools/check_dist.py

The tests generate synthetic measurements in temporary directories. CI tests the installed wheel on Linux, Windows, and macOS and rebuilds the wheel from the source distribution. Tests follow the source areas they exercise, with complete conversions under tests/integration.

beamio uses Conventional Commits and Python Semantic Release. Changes merged to main pass CI before automatic versioning, release-note generation, GitHub releases, and PyPI publishing. pyproject.toml is the version source; beamio.__version__ reads the installed distribution metadata.

Documentation

License

GNU General Public License version 2 only (GPL-2.0-only); see LICENSE.

Metadata

Release files for beamio 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for beamio 0.3.0
File Size Uploaded Provenance Actions
beamio-0.3.0.tar.gz 62.1 kB With provenance Details for beamio-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for beamio 0.3.0
File Interpreter ABI Platform Actions
beamio-0.3.0-py3-none-any.whl Python 3 none any Details for beamio-0.3.0-py3-none-any.whl

Total release size: 98.1 kB

Release files / beamio-0.3.0.tar.gz

Download URL beamio-0.3.0.tar.gz
Size 62.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5df593f3fa794cd80ecc9a9a5cac5ae54c923132b5804c171d6ff33ae45c4e49
BLAKE2b-256 checksum
How to use checksums
22719d8f4df78c494154a2acc29bfac02cb771a7b910fcfa3a27f62ff44a3527
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 Nov 3, 2026.

Transparency log

Release files / beamio-0.3.0-py3-none-any.whl

Download URL beamio-0.3.0-py3-none-any.whl
Size 36.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17c0dd25faa62548591f46e31d42ac1336847806b6ed374b7c84a0d5f4c480b3
BLAKE2b-256 checksum
How to use checksums
844c742cd24fe1f4f51f879bd0840bb5458f3705132578c0415d7d3057a58a1e
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 Nov 3, 2026.

Transparency log

Security for beamio 0.3.0

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for beamio-0.3.0.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 Nov 3, 2026.

Transparency log

A 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.

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