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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afaa4ef06682815c090dc94fbf9ae8e6a5405c47eecf11c537bce4a3b04c7692
|
|
| MD5 |
36ac2f678c409409ae1df522779d90b5
|
|
| BLAKE2b-256 |
50aa9769d685f1b157991a8fc4cd1fba6649bb11a7ab4e3e43922a98a7b622ec
|
Provenance
The following attestation bundles were made for bartorch-0.0.2.tar.gz:
Publisher:
publish.yml on mcencini/bartorch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bartorch-0.0.2.tar.gz -
Subject digest:
afaa4ef06682815c090dc94fbf9ae8e6a5405c47eecf11c537bce4a3b04c7692 - Sigstore transparency entry: 2798025579
- Sigstore integration time:
-
Permalink:
mcencini/bartorch@a0a6aab943a286684d347adbccb687f05c924ad0 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/mcencini
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a0a6aab943a286684d347adbccb687f05c924ad0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bartorch-0.0.2-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: bartorch-0.0.2-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b430c312bcea24f0e3614e400ef6fb525da04ce962c44a656f5a60b00b11ef4
|
|
| MD5 |
38d790af720578e3d0260cb1fc250150
|
|
| BLAKE2b-256 |
9ef303fd378d2f1545e2fba90f23197400a175600bc52ece02f03d0c480f2b41
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bartorch-0.0.2-py3-none-manylinux_2_28_x86_64.whl -
Subject digest:
1b430c312bcea24f0e3614e400ef6fb525da04ce962c44a656f5a60b00b11ef4 - Sigstore transparency entry: 2798025841
- Sigstore integration time:
-
Permalink:
mcencini/bartorch@a0a6aab943a286684d347adbccb687f05c924ad0 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/mcencini
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a0a6aab943a286684d347adbccb687f05c924ad0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bartorch-0.0.2-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: bartorch-0.0.2-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93daff284665eddf6581c7533ce677095ccd39c0c56da32d4649cee09f5ff1c1
|
|
| MD5 |
ee650a2ee47fe2c00f89863d5791cc77
|
|
| BLAKE2b-256 |
34451021d4257bd0fa3a6b59f6fb460da2e735304f05b8256c519226958fb633
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bartorch-0.0.2-py3-none-macosx_11_0_arm64.whl -
Subject digest:
93daff284665eddf6581c7533ce677095ccd39c0c56da32d4649cee09f5ff1c1 - Sigstore transparency entry: 2798025712
- Sigstore integration time:
-
Permalink:
mcencini/bartorch@a0a6aab943a286684d347adbccb687f05c924ad0 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/mcencini
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a0a6aab943a286684d347adbccb687f05c924ad0 -
Trigger Event:
push
-
Statement type: