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

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.13
File Size Uploaded Provenance
komamripy-0.0.13.tar.gz 4.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 11.4 kB

Release files / komamripy-0.0.13.tar.gz

Download URL komamripy-0.0.13.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7b72844e5c4da171d75a20555b07a557021565d71c99db55d757c361638302ff
BLAKE2b-256 checksum
How to use checksums
adde2bb84a6b0db318756205deea5147a2fc8e260ed9f0e5fbee9d89518afccb
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.13-py3-none-any.whl

Download URL komamripy-0.0.13-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7e1e75c35e5c8059ea5d975f820dfe8f10fd49b4bd8b5eb630580d02b4d42cf
BLAKE2b-256 checksum
How to use checksums
7170efa6044ba78cc032b348e9210c7c471351d1ebb61294e2372f75316a06a4
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}

Security for komamripy 0.0.13

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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