Skip to main content

Helper library and interactive anywidgets for the DartBrains fMRI course

Project description

dartbrains-tools

Helper library and interactive anywidgets for the DartBrains fMRI course. Extracted from the book repo so the widgets and helpers can be installed standalone — including in molab and pyodide/WASM marimo notebooks.

Install

pip install dartbrains-tools

# Optional: include marimo for notebook_utils.youtube()
pip install "dartbrains-tools[notebook]"

Modules

  • dartbrains_tools.data.localizer — load the Pinel Localizer dataset from the Hugging Face Hub. The same API is re-exported at dartbrains_tools.data for back-compat.
  • dartbrains_tools.data.sherlock — load the Sherlock naturalistic-fMRI dataset (Chen et al. 2017).
  • dartbrains_tools.data.paranoia — load the Paranoia naturalistic-fMRI dataset (Finn et al. 2018).
  • dartbrains_tools.mr_simulations — Bloch equation solvers, signal generators, HRF, and Plotly visualization helpers.
  • dartbrains_tools.mr_widgets — 10 anywidgets for interactive MR physics teaching (PrecessionWidget, SpinEnsembleWidget, KSpaceWidget, ConvolutionWidget, EncodingWidget, CompassWidget, NetMagnetizationWidget, TransformCubeWidget, CostFunctionWidget, SmoothingWidget).
  • dartbrains_tools.notebook_utils — small marimo helpers (youtube).

Quick start

from dartbrains_tools.mr_widgets import PrecessionWidget

w = PrecessionWidget(b0=3.0, flip_angle=90.0)
w  # Interactive 3D Three.js animation in any anywidget host.
# Localizer (default; back-compat — also works as dartbrains_tools.data.localizer)
from dartbrains_tools.data import get_subjects, get_file, load_events

subjects = get_subjects()
bold = get_file("S01", scope="derivatives", suffix="bold")
events = load_events("S01")

# Sherlock
from dartbrains_tools.data import sherlock

bold = sherlock.get_file("sub-01", task="sherlockPart1", suffix="bold")
onsets = sherlock.load_onsets("watch")

# Paranoia
from dartbrains_tools.data import paranoia

bold = paranoia.get_file("sub-tb2994", run=1, suffix="bold")
participants = paranoia.load_participants()

Development

git clone https://github.com/ljchang/dartbrains-tools
cd dartbrains-tools
uv sync
uv run pytest
uv build

License

MIT. The parent course materials at dartbrains remain CC-BY-SA-4.0; this companion library is permissive so it can be reused in any downstream project.

Project details


Download files

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

Source Distribution

dartbrains_tools-0.1.4.tar.gz (47.3 kB view details)

Uploaded Source

Built Distribution

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

dartbrains_tools-0.1.4-py3-none-any.whl (54.3 kB view details)

Uploaded Python 3

File details

Details for the file dartbrains_tools-0.1.4.tar.gz.

File metadata

  • Download URL: dartbrains_tools-0.1.4.tar.gz
  • Upload date:
  • Size: 47.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dartbrains_tools-0.1.4.tar.gz
Algorithm Hash digest
SHA256 6c47cc6ec6bdee4830e9eba115e7006c5e17e9850e1cd922ffa0a88b85521b17
MD5 cad725047bb6f413c1f6ea38bbfc1544
BLAKE2b-256 f89350171c5934828fc4c22558cfef4c57ce0b5ab15b101742e1747b9a1e3ec9

See more details on using hashes here.

Provenance

The following attestation bundles were made for dartbrains_tools-0.1.4.tar.gz:

Publisher: publish.yml on ljchang/dartbrains-tools

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

File details

Details for the file dartbrains_tools-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for dartbrains_tools-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c01d630b078a1dfbeb41f5a85961d070114ad9b5c0f7e774079b322c1d39a4aa
MD5 d5bddc601e900334264e2d12ac955a07
BLAKE2b-256 40e151ff4107f5562a3d192803681f4e7c8d7e17a195c90e86c55ce118a46d6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for dartbrains_tools-0.1.4-py3-none-any.whl:

Publisher: publish.yml on ljchang/dartbrains-tools

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

Supported by

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