PyGROG
GPU-accelerated GROG (GRAPPA Operator Gridding) for non-Cartesian MRI reconstruction.
PyGROG implements the GROG algorithm — a data-driven, parallel-imaging-aware gridding method that maps non-Cartesian k-space samples onto a Cartesian grid using GRAPPA kernels trained from an auto-calibration region. It provides:
- GROG interpolator (
pygrog.calib.GrogInterpolator) — non-Cartesian to Cartesian gridding via fractional GRAPPA operators. - SparseFFT operator (
pygrog.operator.SparseFFT) — fast sparse forward and adjoint Cartesian FFT for undersampled MRI, with optional sensitivity maps and GPU pipelining. - MaskedFFT operator (
pygrog.operator.MaskedFFT) — dense-grid masked FFT companion for GROG gridded paths. - Reconstruction gadgets (
pygrog.gadgets) — off-resonance correction and low-rank subspace projection, stackable on any base operator. Public aliases includeSubspaceGadget,OffResonanceGadget,with_subspace, andwith_offresonance. - Calibration utilities (
pygrog.utils) — NLINV coil sensitivity estimation and PCA coil compression. - Iterative solvers (
op.solve(...),pygrog.solve) — CG/LSMR interfaces that accept torch, NumPy, and CuPy arrays (CuPy via DLPack, no CPU copy). - Interoperability (
pygrog.interop) — drop-in adapters for mri-nufft, sigpy, mrpro, and deepinverse.
Quick Start
pip install pygrog
CUDA builds are published on GitHub Releases (not on PyPI). If your PyTorch is
CUDA-enabled, install the matching PyGROG CUDA wheel with -f:
# CUDA must match your installed torch wheel: cu126 | cu128 | cu130
CUDA=cu128
PYGROG_VERSION=1.0.0
pip install "pygrog==${PYGROG_VERSION}+${CUDA}" \
-f "https://github.com/FiRMLAB-Pisa/pygrog/releases/expanded_assets/v${PYGROG_VERSION}"
Find your torch CUDA version with:
python -c "import torch; print(torch.version.cuda)"
import numpy as np
from pygrog.calib import GrogInterpolator
from pygrog.operator import SparseFFT
# 1. Build the GROG plan from the non-Cartesian trajectory
grog = GrogInterpolator(shape=(256, 256), coords=coords)
# 2. Fit GRAPPA kernels from the auto-calibration region (ACR)
grog.calc_interp_table(acr_data)
# 3. Grid and reconstruct in one call
image = grog.interpolate(kspace_nc, ret_image=True)
See the documentation for full examples, API reference, and theory.
Documentation
Full documentation (installation, examples, API, theory) lives at https://pygrog.readthedocs.io/en/latest/.
Installation
# CPU (from PyPI)
pip install pygrog
# Development install with all optional dependencies
pip install --no-build-isolation -e ".[dev]"
CUDA wheels are attached to each GitHub Release.
Install them with a torch-scatter-style -f command:
# CUDA must match your installed torch wheel: cu126 | cu128 | cu130
CUDA=cu128
PYGROG_VERSION=1.0.0
pip install "pygrog==${PYGROG_VERSION}+${CUDA}" \
-f "https://github.com/FiRMLAB-Pisa/pygrog/releases/expanded_assets/v${PYGROG_VERSION}"
Development Style
For contributors, formatting and linting are Ruff-only:
ruff format .
ruff check .
ruff check is configured to apply safe auto-fixes by default.
Related Projects
- mri-nufft — Non-uniform FFT for MRI
- mrpro — MRI reconstruction in PyTorch
- sigpy — Signal processing for inverse problems
- deepinverse — Deep learning for inverse problems
License
MIT — see LICENSE for details.
Metadata
Release files for pygrog 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pygrog-0.1.2-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details |
| pygrog-0.1.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 | Details |
| pygrog-0.1.2-cp313-cp313-macosx_12_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 12.0+ ARM64 | Details |
| pygrog-0.1.2-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| pygrog-0.1.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 | Details |
| pygrog-0.1.2-cp312-cp312-macosx_12_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 12.0+ ARM64 | Details |
| pygrog-0.1.2-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details |
| pygrog-0.1.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| pygrog-0.1.2-cp311-cp311-macosx_12_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 12.0+ ARM64 | Details |
| pygrog-0.1.2-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details |
| pygrog-0.1.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 | Details |
| pygrog-0.1.2-cp310-cp310-macosx_12_0_arm64.whl | CPython 3.10 | CPython 3.10 | macOS 12.0+ ARM64 | Details |
Total release size: 224.7 MB
Release files / pygrog-0.1.2-cp313-cp313-win_amd64.whl
| Download URL | pygrog-0.1.2-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 229.8 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
53613ac25adbff487eb3d329bea543580a942a16d808730a9dac479a738234cf
|
|
BLAKE2b-256 checksum How to use checksums |
d0a4eb6c05430dfeedc5a80fb34c42de487db80fcde424c8d27a982bec5cdf7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 6, 2026.
Transparency logRelease files / pygrog-0.1.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pygrog-0.1.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 232.2 kB |
| Tags | CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
9146cff065ffe91c75c3278f133026c713671f75960d5fa873d21a1cafd66b6e
|
|
BLAKE2b-256 checksum How to use checksums |
11cd7764ebaddc29c40d7c3973ff30008af64d2defd9237b820fc3e7cea52ead
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 6, 2026.
Transparency logRelease files / pygrog-0.1.2-cp313-cp313-macosx_12_0_arm64.whl
| Download URL | pygrog-0.1.2-cp313-cp313-macosx_12_0_arm64.whl |
|---|---|
| Size | 55.8 MB |
| Tags | CPython 3.13 macOS 12.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f54a75da7f189bc1aa4a279ee386fafdf89b39a154102ef9702fab1ce8f26752
|
|
BLAKE2b-256 checksum How to use checksums |
18878f207d2471ea63c4855d65b62449ada78b6e435e21ec3d8d19a359af6ab4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 6, 2026.
Transparency logRelease files / pygrog-0.1.2-cp312-cp312-win_amd64.whl
| Download URL | pygrog-0.1.2-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 229.8 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
16958b414a11787b6f72bd5975d5851ea1e15ecffb889700a38844da98197704
|
|
BLAKE2b-256 checksum How to use checksums |
6bea2e0fa4591ec13d49e64ca0b16c6bea6447f34c9ed889e14811729ffa854d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 6, 2026.
Transparency logRelease files / pygrog-0.1.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pygrog-0.1.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 231.6 kB |
| Tags | CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
1293d7f0db19ad43ec3e08575c5a2fe6d448e6cfc1c2774bb131e1f36e78f50c
|
|
BLAKE2b-256 checksum How to use checksums |
b02a88a051cd13d98eab7ebc46954b5ef33c9008ad3b00e47da48025139ead56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 6, 2026.
Transparency logRelease files / pygrog-0.1.2-cp312-cp312-macosx_12_0_arm64.whl
| Download URL | pygrog-0.1.2-cp312-cp312-macosx_12_0_arm64.whl |
|---|---|
| Size | 55.8 MB |
| Tags | CPython 3.12 macOS 12.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c55c5a791b9958b309333661442d9031494c987d7cce29ee101258abfc7eca6f
|
|
BLAKE2b-256 checksum How to use checksums |
7fbab56f5c12a63c9fb5fe3890c2fcc2cb1d71ec57411032ffdc665a13dcc6d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 6, 2026.
Transparency logRelease files / pygrog-0.1.2-cp311-cp311-win_amd64.whl
| Download URL | pygrog-0.1.2-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 228.9 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
404335f954abaa7086fa66b488e59cfc247bbe3a51ddd165e9d4f58994c24259
|
|
BLAKE2b-256 checksum How to use checksums |
c1298e75fd3845d34689e7dacb46e01c36851c592c5325d4b8cc784e977c0e08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 6, 2026.
Transparency logRelease files / pygrog-0.1.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pygrog-0.1.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 225.7 kB |
| Tags | CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
b234ecbbf5b8609cdbb145d6dab6cb27ca99f6469ffd6d71e95560d8cf9626f2
|
|
BLAKE2b-256 checksum How to use checksums |
a349d185768066de7a4db8b74e1f2d839083f413b7aba84efdbf43d3240773b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 6, 2026.
Transparency logRelease files / pygrog-0.1.2-cp311-cp311-macosx_12_0_arm64.whl
| Download URL | pygrog-0.1.2-cp311-cp311-macosx_12_0_arm64.whl |
|---|---|
| Size | 55.7 MB |
| Tags | CPython 3.11 macOS 12.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
065ae7d78e1d73f7bd82e0d45dbc97624c6f02069b4ade7118ae029774e3872e
|
|
BLAKE2b-256 checksum How to use checksums |
4b0213ddb01144020dca6d16d622155da6c8df012b537ab0e49ada0276c7570b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 6, 2026.
Transparency logRelease files / pygrog-0.1.2-cp310-cp310-win_amd64.whl
| Download URL | pygrog-0.1.2-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 227.9 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8fa404fbdba9e0f171af7810d53e1caa1ed23733ee2e69a2b63aa9f120ca8add
|
|
BLAKE2b-256 checksum How to use checksums |
6446f2adc293f20853d5ef55d41d4c6d35127ac658bf877cffa445b21625977f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 6, 2026.
Transparency logRelease files / pygrog-0.1.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pygrog-0.1.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 226.6 kB |
| Tags | CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
be8ec14db62477c6948e11c9063d9011531854d2576aadfd93a3e861ef731fb7
|
|
BLAKE2b-256 checksum How to use checksums |
5fbac8c7e67b065916d53f84eb9067514865c5f821c143302056ae317194df9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 6, 2026.
Transparency logRelease files / pygrog-0.1.2-cp310-cp310-macosx_12_0_arm64.whl
| Download URL | pygrog-0.1.2-cp310-cp310-macosx_12_0_arm64.whl |
|---|---|
| Size | 55.7 MB |
| Tags | CPython 3.10 macOS 12.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
dce65d8a5ea5d2176aee5997a046f5632f11f7b68facab47589280385d54f7d0
|
|
BLAKE2b-256 checksum How to use checksums |
5c5be4d20264b498ef913b88792d5425894a049ed447853907b16d451d1b819e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 6, 2026.
Transparency log