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.3.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.3.0-cp313-cp313-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.13Windows x86-64

pygraft_gui-0.3.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.3.0-cp313-cp313-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pygraft_gui-0.3.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.3.0-cp312-cp312-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.12Windows x86-64

pygraft_gui-0.3.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.3.0-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pygraft_gui-0.3.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.3.0-cp311-cp311-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.11Windows x86-64

pygraft_gui-0.3.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.3.0-cp311-cp311-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pygraft_gui-0.3.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.3.0-cp310-cp310-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.10Windows x86-64

pygraft_gui-0.3.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.3.0-cp310-cp310-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pygraft_gui-0.3.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.3.0.tar.gz.

File metadata

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

File hashes

Hashes for pygraft_gui-0.3.0.tar.gz
Algorithm Hash digest
SHA256 333f83c34fadd60521e23f3bc8401687bb4d42fa847ee313c1cb5787063c773f
MD5 76ead97733c1d633529be395ded8a2ba
BLAKE2b-256 4f000cacc7b5e782642868815aa8b88072471cd1d4ec15b5a63decb30f8bfd59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 70e70412535a2201801cedaba53b1085faf27878aeef5d62a6811147863f5c92
MD5 2b1448585bba5a1fee6693da24d89688
BLAKE2b-256 a29540874a6a39f785426d096b39321faa7350516bde4ac0cdc7c1036d29b3fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3b976b3a5347e9b791dc328d9cf6defaa855b34df6356dba0207d878ea761f55
MD5 533e5ac0eb1690a66e7f780972add7ac
BLAKE2b-256 cfefb78afc29544637a39561639459c3734fa539d162997c54d4a886eab7e43d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 29c1bd12a12a8db0a278a675006aac5b77202c20514a164939bb5b0481f66d1b
MD5 85cf09307000af2e7339704da1c57de2
BLAKE2b-256 dbddbf47c12e54907ff73d569b3139c438fbe0bc0eb7f393f2251a2ec4d18993

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f48187c5719dbdec70b0f2701d6a612979a6152ebc6f722328ec5404654aeff7
MD5 46bc16d8ee10e5f72fb818a6ba09e4c2
BLAKE2b-256 978cc26cd9b1e13ef01cd8f93568a6a64eed5bcb6778c6508c089731dcd72bd2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e5dffb8fed0e62ce3b1076c84af9e09d046bde9e70cd024c0f2f31ed113dfeb2
MD5 d20f38be65fb70c6ab36ffa7bc49e26e
BLAKE2b-256 a083f475c09819631c1eee3791b5b1ab1862b5159f5d9ae5244b12836020f9f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 421e1c44910ff6162ddca68b5a896aa145d30dd5b6628311446e92061bc7fcd7
MD5 153d5b0016de51394c1e34644ab54202
BLAKE2b-256 81795df4e5a8318950ca7ec26a3ef8b85df1a82704314b1d986d7a1db957c324

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0d126b9407a1983313c0c0ea42cb219696c73311a98bdb6404d8b7d933253e6f
MD5 018ceba9f0280361da89e15bd4f13e27
BLAKE2b-256 5cae371bbf05191bc98257861b5057492218526a4c895f4fc4d4593ce32beade

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 4795fabf526f287b70774297ada7c3cc67c368e26d390d5b57d9a9c05dde293b
MD5 7c8ec42c628839578cf50ecf7bafec39
BLAKE2b-256 72ef4c0947b638aebe11c482f01b98f6618a7f55df5d4217aaa634fbcc02ee59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5c3c2e0555a2589633b328e430637ec39c4e99317e1160a83d98da43edc023f9
MD5 76fdadae51c7e19f69e2206dcf3340c9
BLAKE2b-256 727ea58b9281e29d00cfac9b9719c167273d39dd164b97195c341260c8dbece1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 98f29975225b87a0d823635a4cb960836ab0bcf2ae2b3498e9d5ee6b51838410
MD5 fd435c47f21a41b3a09713199bc801cc
BLAKE2b-256 e8e58288936ae33b608c1025d507635a57f1a1612a628b7f8837b902106d811c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b21232e518c450caba6730e40107e79a961fc0291fdcee4f65857df8265950f
MD5 18b8882f8589edef7ed3f05f32de175c
BLAKE2b-256 f8fdb8305ed1234477150bda734357249dd37dc81b64da6f144c0534431bce41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 236b83aa3c22b5b2236d07d2269fa8ebee9af29a3902d02a73ce9d2a11a4ec73
MD5 e8cd0b238610ec24812571470b5af258
BLAKE2b-256 09a4bfa88e2e9dd05c5aa1edb88326730f88d63d35213ac7082a913d3945dcb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fa15f7cc093ffd92178a334c253081c2bd08b3bb17828f0ac8f4bccd54c3fe2f
MD5 f3349101409eb04a7e5f5a1ed09324f7
BLAKE2b-256 2a4018c4220fc895d15283f6a1c2afcf59b5a83100041aeedf3c818749ea6140

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 05c52f444eb9fd57db0c5f268334dd406d7af5cb3609f9b9abd45e382b9417f0
MD5 5c409be2cc5a5bf838ce6ce92bd78078
BLAKE2b-256 0fe647888b7319921f5e5e35dc842ace9ef63485be70f637ef758a8f6c39a04f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f4009370aaf5e09cecde62e21c1d515b7427b2198d0c0b3d27de2199366e879
MD5 e708eccd1bbc971c2d09b8cbe935c9b7
BLAKE2b-256 2a9a63b1ff73842fbca2fd4e8c9bd0671f741360fe8eed878e579a12694dd007

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygraft_gui-0.3.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 75f1505f12ab2f8f41e6764fa927b08d5c776f04ac0a46bc8cd44f6e3d18894a
MD5 671269f145d961eed3588814bc66d805
BLAKE2b-256 d169a671cbda2bb6a988730223b59778f060410d9c92edf89139991b7cab806e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

17 files

0.2.0

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