Skip to main content

ESPIRiT

PyTorch-based ESPIRiT coil sensitivity calibration for MRI.

Single codebase that runs on CPU, CUDA GPU, and Apple Silicon (MPS) — no separate code paths needed.

Notice

This package contains a PyTorch translation of the ESPIRiT implementation from the BART (Berkeley Advanced Reconstruction Toolbox), © 2013–2026 The Regents of the University of California and BART Developer Team. BART is licensed under the BSD 3-Clause License. See https://codeberg.org/mrirecon/bart.

Usage

1) CLI

uvx espirit kspace.npy

2) Python

uv add espirit
import numpy as np
import torch
from espirit import espirit

# NumPy
kspace_np = np.load("kspace.npy")
csm_np = espirit(kspace_np)

# PyTorch 
kspace_pt = torch.randn(8, 24, 24, 24, dtype=torch.complex64)
csm_pt = espirit(kspace_pt)

Options

csm = espirit(
    kspace,             # (n_coils, *spatial_dims)
    calib_size=24,      # calibration region size
    kernel_size=6,      # sliding-window kernel size
    threshold=0.001,     # singular-value threshold
    mask_threshold=0.8, # eigenvalue mask threshold
    normalize=True,     # RSS=1 normalization
    rotphase=True,      # remove phase ambiguity
    device=None,        # cuda, mps, or cpu (auto-detect when None)
    output_device=None, # final CSM device; use "cpu" to reduce 3D GPU memory
    verbose_memory=False,
)

For large 3D datasets, output_device="cpu" moves completed sensitivity-map slices to CPU immediately. This reduces peak GPU memory while keeping the calibration and eigenmap calculations on the selected compute device. Tensor inputs return a tensor on output_device; NumPy inputs always return a NumPy array.

Device support

Device Backend Notes
cpu NumPy/MKL Always available
cuda NVIDIA GPU Requires CUDA toolkit
mps Apple Metal macOS with Apple Silicon

The same code runs on all devices — PyTorch handles dispatch automatically.

Metadata

Release files for espirit 0.2.1

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

Source distribution (sdist)

Source distribution for espirit 0.2.1
File Size Uploaded Provenance Actions
espirit-0.2.1.tar.gz 20.4 kB With provenance Details for espirit-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 33.3 kB

Release files / espirit-0.2.1.tar.gz

Download URL espirit-0.2.1.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b1250740f80a681f3b47e08724d03fa410d0db4af8ebf76fa656d163cec28473
BLAKE2b-256 checksum
How to use checksums
36587a90f73ad066d9a309c6d1ebebc167d918aba05e74d11e5778fa5a073b8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 20, 2026.

Transparency log

Release files / espirit-0.2.1-py3-none-any.whl

Download URL espirit-0.2.1-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6269b12a9a29d6b69019088931f30997a2e91537357b96e964ca89e4c5a5470
BLAKE2b-256 checksum
How to use checksums
c452d8c09b6d0cb73186999f2a23eeb517c1df7a9eb7fab353a6a577e251a1e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 20, 2026.

Transparency log

Security for espirit 0.2.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for espirit-0.2.1.tar.gz

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 Sep 20, 2026.

Transparency log

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