Skip to main content

pyGraFT

Python port of GraFT (Graph-Filtered Temporal dictionary learning), originally implemented in MATLAB at GraFT-analysis.

GraFT decomposes a pixel × time movie into a shared temporal dictionary and per-pixel sparse spatial maps, using a re-weighted L1 sparse coding step where the re-weighting is driven by a spatial/graph kernel that couples nearby or similar pixels. It's built for calcium-imaging data, but the algorithm itself is domain-agnostic.

Status

  • Core algorithm (graft.graft), Gaussian noise model, both the fixed- convolution and graph-embedding spatial kernels.
  • Patch-based processing + component merging (graft.patch_graft) for movies too large to fit comfortably in memory, including optional memory-mapped input (only the patch currently being processed is read from disk).
  • Preprocessing: denoising (wavelet shrinkage), centering/normalization, triangle-threshold masking (graft.preprocessing).
  • Motion correction: rigid and patch-based (piecewise-rigid) registration, built on scikit-image's subpixel phase correlation (graft.motion_correction).
  • A PySide6 GUI (graftapp, install the gui extra) covering the full workflow: load a movie → preprocess (motion-correct/denoise/ normalize/crop/mask) → set parameters → run → browse/ visualize/play results → save.
  • An optional compiled C++ extension (graft._native) accelerates the per-pixel sparse-inference solve, the dominant cost of a GraFT run; graft transparently falls back to an equivalent pure-Python solver if no C++17 compiler is available at install time.

Not yet ported: the Poisson noise model (likely_form='poisson' raises NotImplementedError) and post-hoc coefficient refinement (reCalcCoefSparse/WithLS.m).

Install

pip install pygraft-gui          # library only
pip install "pygraft-gui[gui]"   # library + the graftapp GUI

From source:

pip install -e ".[test,gui]"

Usage

Library

from graft import graft, patch_graft
from graft.simulate import sim_spatial_data

data, profiles, temporal = sim_spatial_data(dims=(30, 30, 100), n_dict=4)

# Single field-of-view
D, S, extras = graft(data, dict_init=None, corr_kern=None,
                      params={"n_dict": 4, "lambda": 0.6})

# Patch-based (splits into overlapping patches, then merges results).
# `data` can be a memory-mapped array (e.g. numpy.load(path, mmap_mode="r"))
# -- only each patch's own slice is read from disk.
D, S, extras = patch_graft(data, n_dict=4, patches=None, corr_kern=None,
                            params={"patchSize": (20, 20)})

GUI

graftapp
# or: python -m graftapp

Development

pip install -e ".[test,gui]"
pytest
python -m pyflakes src/ tests/

Download files

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

Source Distribution

pygraft_gui-0.2.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distributions

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

pygraft_gui-0.2.0-cp313-cp313-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.13Windows x86-64

pygraft_gui-0.2.0-cp313-cp313-manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

pygraft_gui-0.2.0-cp313-cp313-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pygraft_gui-0.2.0-cp313-cp313-macosx_10_13_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pygraft_gui-0.2.0-cp312-cp312-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.12Windows x86-64

pygraft_gui-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

pygraft_gui-0.2.0-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pygraft_gui-0.2.0-cp312-cp312-macosx_10_13_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

pygraft_gui-0.2.0-cp311-cp311-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.11Windows x86-64

pygraft_gui-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

pygraft_gui-0.2.0-cp311-cp311-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pygraft_gui-0.2.0-cp311-cp311-macosx_10_9_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pygraft_gui-0.2.0-cp310-cp310-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.10Windows x86-64

pygraft_gui-0.2.0-cp310-cp310-manylinux_2_28_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

pygraft_gui-0.2.0-cp310-cp310-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pygraft_gui-0.2.0-cp310-cp310-macosx_10_9_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pygraft_gui-0.2.0.tar.gz.

File metadata

  • Download URL: pygraft_gui-0.2.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for pygraft_gui-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6d68cca36ae6a36529a5391cccbf794225f689ba4fb3ba2e76a6d24a4dca4b4b
MD5 628a17c71288e6aaeb8c825219f53329
BLAKE2b-256 4311eebbd843d6d6e822ca59b30c59476250fbf40852165a348f79e931dc9a30

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ee1cd2e0397c806e17537d5c096433a8f1ac8aa49505a4f84cefde56be79e746
MD5 828aba03955d39a86ec4efa7d3d2def3
BLAKE2b-256 88a6abf8c6bd8c836fe1c7f903a0c2ddcb30d22b8f6d4ec83b12872cabb4e7c3

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b3daec4604e62125635e0ec0f1be276dc9d0edc1f2b66e86b74d5185e812ba5c
MD5 5481fcc4777447798d433602134d2fa4
BLAKE2b-256 c7e850ce1b8777876ffea35cf931ed3f60dce4804e1cd72740762b2fb006c6e7

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 88e080687cb6878571d1844f280ab416aac41e0195996d7cf0515b19d2bf4cf4
MD5 c3e5c8a54e386c5dc6f2ebcc11051995
BLAKE2b-256 bd8db41d5de3af3e8efdf8d0c0aa9aa41d70e62b42dc864ad4d18799d4c17087

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0bb457d4221dd185a7a5657a604de946b8ee9363b076ac35b8dcdaaa91673d2a
MD5 71ec82134926f1e04baeab8ab6717830
BLAKE2b-256 88783399d1cd8d3fdc3d4d8c04ff6958404edc38797a1f22c68fd263fd0a5826

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f99b0875c1c3ca26cbc710d1f6ad0844126c0d726e2bfa55326825545a86360c
MD5 751d5298e821f28c37c494ef027952c2
BLAKE2b-256 de922d4872875eca0ae891f2261c2bf7ba1eb7fa25c881dd5b703e3b7482f839

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b0f0e692d00e2e6ea169525a10257183a52ab4dd8a1ea0e22ff77273eea56bb3
MD5 9aadf420dea4e43f679f65a7796bd6e1
BLAKE2b-256 dd1f99abb754e4a42b5c04286ec34185d8e69cd6e36f552c5d6df0178aa44887

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 954f0e89778fb50551a669f807b92548692cd54b6fdc66d981300ad4dec3dabd
MD5 d8c6e15009592893a2f5b8574dd9cc88
BLAKE2b-256 58cab849c66c79aa6eb8707212f1c58ad2905a1b980bf9258074437e17bbd805

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c8f7d96f2ee2e66ef9ca7397226406b7eff5ce0e3670058f811c8c7a12e1752a
MD5 7877efa73d553f193d5d99852f2b163e
BLAKE2b-256 79e9f9766ceb20b2bc21e547e53d1eef3eba3b7c971a7bae94c613a662578868

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 70ebd3d022e42965862712cb23d96f9ff6707610bf1fde6b48ab2f3269568f7c
MD5 d31204b823dd5383e97842162c7bb64b
BLAKE2b-256 5a265aee3e2694f01491f1540731804d43687af3cff0dc047ccafbd60cab86ea

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 52b6f2ae3b8b476f9de1f7a3ee6f373a958134d6ff9d337aa8f9937623c7fb2a
MD5 c1e82fe8993c95a83d05f4ee3b411554
BLAKE2b-256 38786a39e8b40d3a24d7d12b1494b43961d20bdd26e401c3117b2aa3a1c7fc61

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8cd85001260dd062f58e142ae0bfd684a46d6115233c79ba88e6693c692bf89
MD5 3bb35039fc08ab24ed559fd02a54997f
BLAKE2b-256 2f7d69d98263183e07a48c62b5b9410efc4d3b012251589f1fc3021eea1db7ee

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b49f22e280c083f20ed0458569538b8fd97cbd23b54254b8837eaef736822bbc
MD5 d79f6923d3c20836f6abdc718a7ee96e
BLAKE2b-256 7306bab4d57324e4aca805d2432e4ad7845a92654f0ab317685e72b1168728cd

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f49d944cedd814e43689ba2c50ff8afdca73ecfb565ab49608b932b99209ab4c
MD5 1552972253e97aac85f1e673bcd0d8c4
BLAKE2b-256 7a1c85b93758ea0ba61d4cac391d55634a9fef0d5dd34d39f12d54af55aa9444

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 33bc87816f3b64dd8ed14afb911847ee6187e1f5b129428f8207f492f482b635
MD5 e621ea3c5956c631f04cb486a6324672
BLAKE2b-256 711a07708bb1d9281daf9b1fb6c26bcddc1cb2f3be61e33891b3afd4e3f829eb

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b49cc7e8be7f6d25c44b777797e5cd7515a1b1f24f2daaa923aa6a8d7b5247a
MD5 5e248b2112eae5f7b706db085a43e336
BLAKE2b-256 c723944c63666197bd3cda8c8b17986bb74ec8e32b7649266db632b7b6af8056

See more details on using hashes here.

File details

Details for the file pygraft_gui-0.2.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pygraft_gui-0.2.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b8e7de047ba60d98dafaf2036eb36f0bc9a9332229de2d90623fde307f3e3441
MD5 7365d7ed68d3bba27eb8353c25aad616
BLAKE2b-256 f46916fc5e46b9867c5748f5d0e351184f9a728cdd1202cd3ae336ac23036f04

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.0

17 files

This release

0.2.0 This release

17 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