Skip to main content

FLIMAnalyzer

Python Tests codecov Documentation Status DOI

Python package for analysis of Fluorescence Lifetime Imaging Microscopy (FLIM) data.

Documentation: https://flimanalyzer.readthedocs.io

Requirements

  • Python 3.12 or later
  • All Python dependencies, including PyTorch and Prefect, are declared in pyproject.toml and installed automatically.

Installation

uv creates a virtual environment in .venv (installing a matching Python if needed). Then install FLIMAnalyzer with its graphical user interface (GUI) into it:

uv venv --python 3.12
source .venv/bin/activate    # Windows: .venv\Scripts\activate
uv pip install "flimanalyzer[gui]"

The gui extra installs the GUI. Without it, uv pip install flimanalyzer installs only what batch mode needs, for example on a computing cluster. Add dask for the optional Dask support (see Concurrent and distributed execution), e.g. "flimanalyzer[gui,dask]".

From PyPI with pip

python3.12 -m venv .venv
source .venv/bin/activate    # Windows: .venv\Scripts\activate
pip install "flimanalyzer[gui]"

PyTorch and the GPU

Installed from PyPI, FLIMAnalyzer gets PyTorch from PyPI, which provides a different build on each platform:

  • Linux: the PyPI build includes CUDA, so an NVIDIA GPU is used if its driver is recent enough.
  • Windows: the PyPI build is CPU-only. For an NVIDIA GPU, install with uv pip install "flimanalyzer[gui]" --torch-backend=cu128, or with pip install the CUDA build first: pip install torch --index-url https://download.pytorch.org/whl/cu128. See pytorch.org for other CUDA versions.
  • macOS: only Apple Silicon is supported, because current PyTorch versions are not available for Intel Macs. The PyPI build uses the Apple GPU (MPS).

Latest development version

To install the current state of the repository, clone it and let uv create the environment. uv sync installs FLIMAnalyzer with the GUI in editable mode, with the exact package versions from uv.lock (the versions the tests run with). On Windows and Linux (x86_64), it installs the CUDA 12.8 build of PyTorch:

git clone https://github.com/uvaKCCI/flimanalyzer.git
cd flimanalyzer
uv sync

Without the GUI, with the test dependencies, or with Dask support:

uv sync --no-group gui
uv sync --extra test
uv sync --extra dask

With pip, in a virtual environment in the cloned folder: pip install -e ".[gui]".

With Docker

The Docker images run only batch mode. They don't include the GUI. Each release is published to the GitHub Container Registry:

Image
ghcr.io/uvakcci/flimanalyzer:<version>, :latest with the CUDA build of PyTorch (x86_64, several GB)
ghcr.io/uvakcci/flimanalyzer:<version>-cpu, :latest-cpu CPU only (x86_64 and ARM), much smaller
docker pull ghcr.io/uvakcci/flimanalyzer:latest-cpu

To build an image from the repository instead: with the CUDA 12.8 build of PyTorch, with the build for another CUDA version (here 12.6), with the CPU-only build, or with Dask support:

docker build -t flimanalyzer .
docker build -t flimanalyzer:cu126 --build-arg TORCH_INDEX=https://download.pytorch.org/whl/cu126 .
docker build -t flimanalyzer:cpu --build-arg TORCH_INDEX=https://download.pytorch.org/whl/cpu .
docker build -t flimanalyzer:dask --build-arg EXTRAS=dask .

TORCH_INDEX replaces PyTorch with the build from that PyTorch package index, in the same PyTorch version (the one in uv.lock, currently 2.11.0). Choose the CUDA version that the NVIDIA driver of your computer supports. PyTorch 2.11.0 is available for CUDA 12.6 (cu126), 12.8 (cu128, the default), 12.9 (cu129) and 13.0 (cu130).

EXTRAS=gui stops the build with an error, because the images do not support a display.

Start FLIMAnalyzer with the GUI

With uv, no activation is needed:

uv run flimanalyzer

In an activated environment:

flimanalyzer

To open data files (tab- or comma-separated) right away, each in its own window:

uv run flimanalyzer -i results.txt more-results.csv

Run flimanalyzer --help for all command line options.

Using a GPU

The autoencoder tools (Autoencoder: Train, Run and Augment Data, and the FLIM Data Augmentation Tuning and FLIM Feature Analysis workflows) have a Device setting, in the GUI and in batch mode:

  • auto (default): an NVIDIA GPU (cuda) if available, otherwise the Apple GPU (mps), otherwise the CPU.
  • cpu, cuda or mps: uses that device, or the CPU if it is not available.

Which GPU can be used depends on the PyTorch build that was installed (see Installation). Trained models are saved so that they don't need a GPU, so a model trained on a GPU can also be used on a computer without one.

Run FLIMAnalyzer in batch mode

flimbatch imports data files and runs tools or workflows on them without opening the GUI, for example on a computing cluster. It takes its settings from a settings file saved in the GUI (File > Export Settings...): the import settings and the settings of each tool. A tool's dialog can add its settings to such a file with Save Settings..., which keeps the file's other sections. Load Settings... reads the tool's own section back.

uv run flimbatch -i data/ -o results/ -c settings.json \
    --run Summarize --run "Basic FLIRR Analysis"

The imported table is saved as results/Imported.txt, and each tool's results in results/<tool name>/. A workflow column that is not in the data (for example FAD a1% for FAD a1[%]) is an error. --allow-guesses uses the closest column instead and lists it in the run summary. The exit code is 1 if a check or task failed. Run flimbatch --help for all options.

flimanalyzer --batch … does the same as flimbatch …. On Windows, use flimbatch: flimanalyzer starts without a console there, so its messages are not shown.

In Docker

The image runs flimbatch. Make the folder with the data and the settings file available inside the container as /work:

docker run --rm -v "$PWD:/work" ghcr.io/uvakcci/flimanalyzer:latest-cpu \
    -i data/ -o results/ -c settings.json --run Summarize --no-prefect-server
  • On Linux, add -u $(id -u) so that the result files belong to you.
  • With the CUDA image, add --gpus all to use the GPU.
  • With --no-prefect-server, each run uses a temporary Prefect server. To report to a Prefect server instead, pass its address, for example -e PREFECT_API_URL=http://prefect.example.org:4200/api.

Prefect server

FLIMAnalyzer runs analyses and workflows as Prefect flows. At startup it looks for a Prefect server in this order:

  1. The server configured in the active Prefect profile or in the PREFECT_API_URL environment variable, e.g.

    prefect profile use <profile>
    # or
    export PREFECT_API_URL=https://my-prefect-server/api
    
  2. A server already running locally at http://127.0.0.1:4200/api.

  3. If none is found, FLIMAnalyzer starts a local server (prefect server start) and stops it again when FLIMAnalyzer closes. The server's output is written to prefect-server.log.

Flow and task runs can be inspected in the Prefect UI of the server in use, e.g. http://127.0.0.1:4200 for a local server. To keep a local server running across sessions, start it yourself in a separate terminal with uv run prefect server start. Use --no-prefect-server to skip starting a server; Prefect then uses a temporary server that only runs as long as FLIMAnalyzer.

Concurrent and distributed execution

Every tool and workflow step runs as a Prefect task. A task starts as soon as the results it needs are ready. Tasks that don't depend on each other run concurrently, without waiting for each other. Tasks that draw figures take turns, because matplotlib's pyplot is not thread-safe.

By default, up to one task per CPU core runs at a time, as threads. To change that number:

uv run flimanalyzer --execargs="num_workers=4"

num_workers=1 runs one task at a time. Prefect's PREFECT_TASKS_RUNNER_THREAD_POOL_MAX_WORKERS setting, if set, is used as the default.

FLIMAnalyzer can also use Dask. Dask support is optional; install it with uv sync --extra dask (or pip install -e ".[dask]").

On a single node, start a local Dask cluster:

uv run flimanalyzer -e LocalDaskExecutor --execargs="scheduler=processes,num_workers=8"

As a general guideline, adjust num_workers to match the number of CPU cores in your system. Use scheduler=threads to run the workers as threads instead of processes.

To use an existing Dask cluster:

uv run flimanalyzer -e DaskExecutor --execargs="address=tcp://<scheduler-host>:8786"

Concurrency limits

Prefect applies tag concurrency limits set on the Prefect server, whichever executor is used. Every task is tagged with its tool's name as shown in the menu (e.g. Autoencoder: Train, not the Python class name), also as a step of a workflow; workflow steps can carry more tags, which also name their results folders. For example, to let only one autoencoder training run at a time, also inside workflows:

uv run prefect concurrency-limit create "Autoencoder: Train" 1

uv run prefect concurrency-limit ls lists the limits, and uv run prefect concurrency-limit delete <tag> removes one.

How to cite

If you use FLIMAnalyzer, please cite:

  1. The original publication, in all cases:

    Zhang J, Wallrabe H, Siller K, Mbogo B, Cassidy T, Alam SR, Periasamy A. Measuring metabolic changes in cancer cells using two-photon fluorescence lifetime imaging microscopy and machine-learning analysis. Journal of Biophotonics 18(1), e202400426 (2025). doi:10.1002/jbio.202400426

  2. The publication closest to the version you used, plus that release's software DOI, from the table below. Use the newest release that is not newer than your version. The version is shown in the FLIMAnalyzer window title.

Your version Publication Software DOI
v0.5.0 or later Alam SR, Siller K, Dreicer R, Periasamy A. Label-free optical biomarker for prostate cancer diagnosis. Molecular Medicine 32(1), 165 (2026). doi:10.1186/s10020-026-01605-2 10.5281/zenodo.23438157
v0.4.1 or earlier Zhang et al. (2025), the original publication above 10.5281/zenodo.23426564

The concept DOI 10.5281/zenodo.23426563 covers all versions archived on Zenodo and resolves to the latest of them. Not every release is archived on Zenodo; the table above lists the versions used in publications. Citation metadata is also in CITATION.cff; GitHub shows it under "Cite this repository".

Development

Run the test suite:

uv sync --extra test
uv run pytest

Tests that run flows use a temporary Prefect server and database and do not report to any configured server.

The tests run one after another. The GUI tests depend on wxPython's event loop and on timing, so they must not run in parallel. Only the core tests (no GUI) can run in parallel, one process per CPU core, with pytest-xdist:

uv run pytest -n auto tests/core

Build the documentation (output in docs/_build/html):

uv run --group docs sphinx-build -b html docs docs/_build/html

The docs dependency group contains only Sphinx and the lightweight packages needed to document the code; docs/conf.py imports flim from the source tree and mocks wxPython, PyTorch and Prefect. This is also how the documentation is built on Read the Docs (see .readthedocs.yaml).

Metadata

Release files for flimanalyzer 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flimanalyzer 0.6.0
File Size Uploaded Provenance Actions
flimanalyzer-0.6.0.tar.gz 240.3 kB With provenance Details for flimanalyzer-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flimanalyzer 0.6.0
File Interpreter ABI Platform Actions
flimanalyzer-0.6.0-py3-none-any.whl Python 3 none any Details for flimanalyzer-0.6.0-py3-none-any.whl

Total release size: 521.4 kB

Release files / flimanalyzer-0.6.0.tar.gz

Download URL flimanalyzer-0.6.0.tar.gz
Size 240.3 kB
Tags Source
SHA-256 checksum
How to use checksums
839b9ca847f2415ac7f544085694cb0abbadf16735d003f608926d652ae32569
BLAKE2b-256 checksum
How to use checksums
61a8253f4b0a457cb5fd19b08905f739b73a8bc73b4b426f9068651773cb3942
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / flimanalyzer-0.6.0-py3-none-any.whl

Download URL flimanalyzer-0.6.0-py3-none-any.whl
Size 281.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b391985ce28ed91e5b46ae21156f4c6a55276c0151e676a060837f15c6062de4
BLAKE2b-256 checksum
How to use checksums
c980bfe971991197fe2f670495773e36033920af0e337f5cb54967de2d87c706
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for flimanalyzer 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for flimanalyzer-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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