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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

komamripy-0.0.10.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

komamripy-0.0.10-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file komamripy-0.0.10.tar.gz.

File metadata

  • Download URL: komamripy-0.0.10.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for komamripy-0.0.10.tar.gz
Algorithm Hash digest
SHA256 d3fc5c44bb5ca71d14ca3844a9ad9e3b07bc94694c9c4d45fd8ebad260b4a518
MD5 71618c211d253f578c2297897d64babe
BLAKE2b-256 52ede1acf99b00f5034ded9c404ae9272534fd8db73cb2b3cc28a916d0ffab7b

See more details on using hashes here.

File details

Details for the file komamripy-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: komamripy-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for komamripy-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 007c3526ac459c3be663d7c01bd18f872b18863381ed2fce5516ab49cf2bdb91
MD5 da8cbf6b67291774c1dd6d970b0ba5ab
BLAKE2b-256 232472de82392df110320c8c78ebeed83620d0125ba3d50c222836b77d4a176e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page