Skip to main content

komamripy

CI PyPI version License Python versions

Pulseq-compatible, high-performance MRI simulation in Python.

komamripy is a thin Python interface to KomaMRI.jl, a high-performance Julia framework for MRI simulation. It exposes KomaMRI to Python through juliacall, so Python users can run fast CPU/GPU MRI simulations without writing any Julia.

Installation

Install from PyPI with uv (recommended):

uv init project-folder && cd project-folder
uv add komamripy

or with pip:

pip install komamripy

Quick start

The first import downloads Julia and precompiles KomaMRI, which can take a few minutes. Subsequent runs are fast.

import komamripy as km
import numpy as np

km.load_cuda()  # GPU backend selection, optional

sys = km.Scanner()  # scanner hardware
obj = km.brain_phantom2D()  # 2D brain phantom
seq = km.PulseDesigner.EPI_example()  # example EPI sequence

sim_params = {"return_type": "mat"}  # return the raw signal matrix
raw = km.simulate(obj, seq, sys, sim_params=sim_params)

print(np.shape(raw))

You do not need to install Julia yourself: juliacall provisions a suitable Julia automatically, and KomaMRI is installed on first import.

How it works

komamripy mirrors the KomaMRI Julia namespace: any function or type that KomaMRI exposes is available as an attribute of komamripy. Julia code therefore translates to Python almost line for line.

Simulation results are returned as Julia objects; convert array-like results to NumPy with numpy.asarray.

Status

komamripy is under active development as a Google Summer of Code project.

Project status and roadmap are tracked in JuliaHealth/komamripy#9.

Metadata

Release files for komamripy 0.0.12

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

Source distribution (sdist)

Source distribution for komamripy 0.0.12
File Size Uploaded
komamripy-0.0.12.tar.gz 4.9 kB Details

Built distribution (wheel)

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

Total release size: 11.4 kB

Release files / komamripy-0.0.12.tar.gz

Download URL komamripy-0.0.12.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7a2f427622ea3d2db31f05c8a8cb150c1a7b5bb85a15a0a5d5a274c41af850f1
BLAKE2b-256 checksum
How to use checksums
baac7ad6d20aeb009ce06b1ef2c6af035c330abb42a24cc2a27b32497bbcc1c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.33 {"installer":{"name":"uv","version":"0.11.33","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / komamripy-0.0.12-py3-none-any.whl

Download URL komamripy-0.0.12-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfca6f27cc0b3f095203f8f0be5035608d11014ea85497dbf894c153f1107852
BLAKE2b-256 checksum
How to use checksums
b1ceeb30ae492ed98aba49ae6e8cd586a4a72872395d650b73da298048a83d09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.33 {"installer":{"name":"uv","version":"0.11.33","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.0.12 This release

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release 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