Skip to main content

bartorch

bartorch runs BART, the Berkeley Advanced Reconstruction Toolbox, inside the Python process on torch tensors: BART's applications as functions, its linear and nonlinear operators as composable objects, and its iterative solvers as classes. It computes nothing BART does not, except where it substitutes a faster implementation: FINUFFT for every non-Cartesian transform, and a SENSE operator that applies its coils in batches.

Install

pip install bartorch
pip install "bartorch[mkl]"          # Linux: MKL for BART's BLAS, LAPACK and FFT
pip install "bartorch[cufinufft]"    # non-Cartesian transforms on a CUDA device

Wheels are built for Linux x86_64 and macOS on Apple silicon; elsewhere pip builds from source, which needs clang or GCC 14+ and CMake. The installation guide covers CUDA builds and platform notes.

Where to start

Task Start here
Reconstruct with a BART application bartorch.tools: pics, nlinv, ecalib
Build an encoding and solve it bartorch.linop and bartorch.optim
Transform, filter or register arrays the functions in bartorch
Fit a torch signal model bartorch.nlop and bartorch.optim.IRGNM

Quickstart

import bartorch
import bartorch.tools as bt
from bartorch import linop, optim, prox

kspace = bt.phantom(128, coils=8, kspace=True)        # (8, 1, 128, 128)
maps = bt.ecalib(kspace, maps=1)

# BART's own application ...
image = bt.pics(kspace, maps, regularizers=prox.Wavelet((-1, -2), 0.005), solver="fista")

# ... or the same problem assembled from an operator and a solver.
# pics also scales the data first; see optim.data_scaling.
A = linop.Sense(maps.squeeze(1), (8, 128, 128))
x = optim.FISTA(prox.Wavelet((-1, -2), 0.005), maxiter=50)(kspace, A)

spectrum = bartorch.fft(bt.phantom(128), axes=(-2, -1), unitary=True)

Shapes are C order, so the last axis is the one BART calls the first, and wherever BART takes a bitmask or a dimension number a function here takes axis indices; pics takes bartorch.prox terms where BART takes -R strings.

License

MIT. BART is distributed under its own BSD license (external/bart/LICENSE); pocketfft (BSD-3) and BlocksRuntime (MIT) are vendored under external/ with their licenses.

Download files

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

Source Distribution

bartorch-0.0.2.tar.gz (1.8 MB view details)

Uploaded Source

Built Distributions

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

bartorch-0.0.2-py3-none-manylinux_2_28_x86_64.whl (1.8 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

bartorch-0.0.2-py3-none-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file bartorch-0.0.2.tar.gz.

File metadata

  • Download URL: bartorch-0.0.2.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bartorch-0.0.2.tar.gz
Algorithm Hash digest
SHA256 afaa4ef06682815c090dc94fbf9ae8e6a5405c47eecf11c537bce4a3b04c7692
MD5 36ac2f678c409409ae1df522779d90b5
BLAKE2b-256 50aa9769d685f1b157991a8fc4cd1fba6649bb11a7ab4e3e43922a98a7b622ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for bartorch-0.0.2.tar.gz:

Publisher: publish.yml on mcencini/bartorch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bartorch-0.0.2-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for bartorch-0.0.2-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1b430c312bcea24f0e3614e400ef6fb525da04ce962c44a656f5a60b00b11ef4
MD5 38d790af720578e3d0260cb1fc250150
BLAKE2b-256 9ef303fd378d2f1545e2fba90f23197400a175600bc52ece02f03d0c480f2b41

See more details on using hashes here.

Provenance

The following attestation bundles were made for bartorch-0.0.2-py3-none-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on mcencini/bartorch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bartorch-0.0.2-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bartorch-0.0.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 93daff284665eddf6581c7533ce677095ccd39c0c56da32d4649cee09f5ff1c1
MD5 ee650a2ee47fe2c00f89863d5791cc77
BLAKE2b-256 34451021d4257bd0fa3a6b59f6fb460da2e735304f05b8256c519226958fb633

See more details on using hashes here.

Provenance

The following attestation bundles were made for bartorch-0.0.2-py3-none-macosx_11_0_arm64.whl:

Publisher: publish.yml on mcencini/bartorch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.2 This release

3 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