Skip to content

Port remaining converter functions from C to Python - #235

Open
witNie wants to merge 17 commits into
masterfrom
229-port-remaining-converter-functions
Open

witNie wants to merge 17 commits into
masterfrom
229-port-remaining-converter-functions

Conversation

@witNie

@witNie witNie commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Closes #229. Supersedes #230 (same converter changes, rebased onto current master without the stale branch-62 merge history).

Summary

Ports the remaining converter functions from libamtrack to pyamtrack.converters, and makes every converter take an explicit particle argument with an optional cartesian_product flag.

New converters

  • gamma_from_energy / energy_from_gamma
  • momentum_from_energy / energy_from_momentum
  • dose_from_fluence / fluence_from_dose
  • energy_per_amu_from_energy / energy_from_energy_per_amu

Changed converters

  • beta_from_energy(energy_MeV, particle) and energy_from_beta(beta, particle) now take a particle and total kinetic energy in MeV, instead of assuming MeV/u.

Call sites

  • Updated the CI smoke tests (Linux, macOS, Windows), scripts/build_linux.sh, docs/naming_convention.md, examples/example.ipynb, and the tests (test_converters.py, test_function_behavior.py, test_multidim_input.py) to the new signatures.

Testing

  • pip install . and pytest tests: 106 passed.

…ude particle argument and cartesian product option
Copilot review has found some mistakes like wrong naming scheme and wrong function names in few of them

Signed-off-by: Piotr Pich <ppich@student.agh.edu.pl>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port remaining converter functions from C/C++ to Python

2 participants