flimanalyzer 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. flimanalyzer-0.6.0/.gitignore +28 -0
  2. flimanalyzer-0.6.0/LICENSE +19 -0
  3. flimanalyzer-0.6.0/PKG-INFO +262 -0
  4. flimanalyzer-0.6.0/README.md +204 -0
  5. flimanalyzer-0.6.0/flim/__init__.py +2 -0
  6. flimanalyzer-0.6.0/flim/_version.py +5 -0
  7. flimanalyzer-0.6.0/flim/analysis/__init__.py +1 -0
  8. flimanalyzer-0.6.0/flim/analysis/ml/__init__.py +0 -0
  9. flimanalyzer-0.6.0/flim/analysis/ml/autoencoder.py +188 -0
  10. flimanalyzer-0.6.0/flim/analyzerapp.py +131 -0
  11. flimanalyzer-0.6.0/flim/batch.py +235 -0
  12. flimanalyzer-0.6.0/flim/configs/__init__.py +77 -0
  13. flimanalyzer-0.6.0/flim/configs/analysis.py +554 -0
  14. flimanalyzer-0.6.0/flim/configs/data.py +278 -0
  15. flimanalyzer-0.6.0/flim/configs/plot.py +543 -0
  16. flimanalyzer-0.6.0/flim/configs/workflow.py +204 -0
  17. flimanalyzer-0.6.0/flim/core/__init__.py +0 -0
  18. flimanalyzer-0.6.0/flim/core/calculator.py +0 -0
  19. flimanalyzer-0.6.0/flim/core/config.py +305 -0
  20. flimanalyzer-0.6.0/flim/core/execution.py +110 -0
  21. flimanalyzer-0.6.0/flim/core/fields.py +226 -0
  22. flimanalyzer-0.6.0/flim/core/filter.py +179 -0
  23. flimanalyzer-0.6.0/flim/core/graph.py +111 -0
  24. flimanalyzer-0.6.0/flim/core/headers.py +72 -0
  25. flimanalyzer-0.6.0/flim/core/importer.py +269 -0
  26. flimanalyzer-0.6.0/flim/core/parser.py +305 -0
  27. flimanalyzer-0.6.0/flim/core/paths.py +66 -0
  28. flimanalyzer-0.6.0/flim/core/prefect_server.py +152 -0
  29. flimanalyzer-0.6.0/flim/core/preprocessor.py +287 -0
  30. flimanalyzer-0.6.0/flim/core/registry.py +108 -0
  31. flimanalyzer-0.6.0/flim/core/runner.py +703 -0
  32. flimanalyzer-0.6.0/flim/core/schema.py +114 -0
  33. flimanalyzer-0.6.0/flim/core/settings.py +419 -0
  34. flimanalyzer-0.6.0/flim/core/tool.py +284 -0
  35. flimanalyzer-0.6.0/flim/core/tools.py +76 -0
  36. flimanalyzer-0.6.0/flim/core/types.py +113 -0
  37. flimanalyzer-0.6.0/flim/core/validation.py +272 -0
  38. flimanalyzer-0.6.0/flim/core/workflow.py +148 -0
  39. flimanalyzer-0.6.0/flim/gui/__init__.py +12 -0
  40. flimanalyzer-0.6.0/flim/gui/app.py +953 -0
  41. flimanalyzer-0.6.0/flim/gui/configdialog.py +495 -0
  42. flimanalyzer-0.6.0/flim/gui/datapanel.py +841 -0
  43. flimanalyzer-0.6.0/flim/gui/delimpanel.py +56 -0
  44. flimanalyzer-0.6.0/flim/gui/dialogs/__init__.py +473 -0
  45. flimanalyzer-0.6.0/flim/gui/dialogs/autoencoder.py +89 -0
  46. flimanalyzer-0.6.0/flim/gui/dialogs/categoryorder.py +130 -0
  47. flimanalyzer-0.6.0/flim/gui/dialogs/filter.py +86 -0
  48. flimanalyzer-0.6.0/flim/gui/dialogs/unpivot.py +72 -0
  49. flimanalyzer-0.6.0/flim/gui/dicttablepanel.py +178 -0
  50. flimanalyzer-0.6.0/flim/gui/editors.py +1578 -0
  51. flimanalyzer-0.6.0/flim/gui/events.py +162 -0
  52. flimanalyzer-0.6.0/flim/gui/icons.py +16 -0
  53. flimanalyzer-0.6.0/flim/gui/importdlg.py +391 -0
  54. flimanalyzer-0.6.0/flim/gui/listcontrol.py +472 -0
  55. flimanalyzer-0.6.0/flim/gui/macos.py +77 -0
  56. flimanalyzer-0.6.0/flim/gui/plotframe.py +73 -0
  57. flimanalyzer-0.6.0/flim/gui/progressdlg.py +290 -0
  58. flimanalyzer-0.6.0/flim/resources/aeaugment.png +0 -0
  59. flimanalyzer-0.6.0/flim/resources/aefeatureworkflow.png +0 -0
  60. flimanalyzer-0.6.0/flim/resources/aerun.png +0 -0
  61. flimanalyzer-0.6.0/flim/resources/aetrain.png +0 -0
  62. flimanalyzer-0.6.0/flim/resources/aetuneworkflow.png +0 -0
  63. flimanalyzer-0.6.0/flim/resources/barplot.png +0 -0
  64. flimanalyzer-0.6.0/flim/resources/boxplot.png +0 -0
  65. flimanalyzer-0.6.0/flim/resources/categorize.png +0 -0
  66. flimanalyzer-0.6.0/flim/resources/concatenate.png +0 -0
  67. flimanalyzer-0.6.0/flim/resources/fileopen.png +0 -0
  68. flimanalyzer-0.6.0/flim/resources/filter.png +0 -0
  69. flimanalyzer-0.6.0/flim/resources/flimanalyzer.ico +0 -0
  70. flimanalyzer-0.6.0/flim/resources/flimanalyzer.png +0 -0
  71. flimanalyzer-0.6.0/flim/resources/flirrplot.png +0 -0
  72. flimanalyzer-0.6.0/flim/resources/flirrworkflow.png +0 -0
  73. flimanalyzer-0.6.0/flim/resources/gmm.png +0 -0
  74. flimanalyzer-0.6.0/flim/resources/heatmap.png +0 -0
  75. flimanalyzer-0.6.0/flim/resources/histogram.png +0 -0
  76. flimanalyzer-0.6.0/flim/resources/import.png +0 -0
  77. flimanalyzer-0.6.0/flim/resources/kde.png +0 -0
  78. flimanalyzer-0.6.0/flim/resources/kmeans.png +0 -0
  79. flimanalyzer-0.6.0/flim/resources/ks.png +0 -0
  80. flimanalyzer-0.6.0/flim/resources/lineplot.png +0 -0
  81. flimanalyzer-0.6.0/flim/resources/merge.png +0 -0
  82. flimanalyzer-0.6.0/flim/resources/order.png +0 -0
  83. flimanalyzer-0.6.0/flim/resources/pairplot.png +0 -0
  84. flimanalyzer-0.6.0/flim/resources/pca.png +0 -0
  85. flimanalyzer-0.6.0/flim/resources/pivot.png +0 -0
  86. flimanalyzer-0.6.0/flim/resources/randomforest.png +0 -0
  87. flimanalyzer-0.6.0/flim/resources/relchange.png +0 -0
  88. flimanalyzer-0.6.0/flim/resources/scatter.png +0 -0
  89. flimanalyzer-0.6.0/flim/resources/seriesanalysis.png +0 -0
  90. flimanalyzer-0.6.0/flim/resources/sort.png +0 -0
  91. flimanalyzer-0.6.0/flim/resources/split.png +0 -0
  92. flimanalyzer-0.6.0/flim/resources/summary.png +0 -0
  93. flimanalyzer-0.6.0/flim/resources/swarmplot.png +0 -0
  94. flimanalyzer-0.6.0/flim/resources/unpivot.png +0 -0
  95. flimanalyzer-0.6.0/flim/resources/violinplot.png +0 -0
  96. flimanalyzer-0.6.0/flim/resources/workflow.png +0 -0
  97. flimanalyzer-0.6.0/flim/results.py +70 -0
  98. flimanalyzer-0.6.0/flim/tools/__init__.py +7 -0
  99. flimanalyzer-0.6.0/flim/tools/autoencoder.py +662 -0
  100. flimanalyzer-0.6.0/flim/tools/common.py +62 -0
  101. flimanalyzer-0.6.0/flim/tools/data.py +301 -0
  102. flimanalyzer-0.6.0/flim/tools/ml.py +311 -0
  103. flimanalyzer-0.6.0/flim/tools/plot.py +1439 -0
  104. flimanalyzer-0.6.0/flim/tools/statistics.py +348 -0
  105. flimanalyzer-0.6.0/flim/utils.py +43 -0
  106. flimanalyzer-0.6.0/flim/workflow/__init__.py +3 -0
  107. flimanalyzer-0.6.0/flim/workflow/aefeature.py +145 -0
  108. flimanalyzer-0.6.0/flim/workflow/aetune.py +163 -0
  109. flimanalyzer-0.6.0/flim/workflow/basicflow.py +99 -0
  110. flimanalyzer-0.6.0/pyproject.toml +174 -0
  111. flimanalyzer-0.6.0/write_version_info.py +55 -0
@@ -0,0 +1,28 @@
1
+ /dask-worker-space/
2
+ *.json
3
+ *.pyc
4
+ *.log
5
+ *.svg
6
+ *.model
7
+ /flimanalyzer.egg-info
8
+ /build
9
+ docs/_build
10
+ /data
11
+ /dist
12
+ /paper
13
+ .vscode
14
+ *.egg-info
15
+ flim/_version.py
16
+ .DS_Store
17
+ /references
18
+ .venv/
19
+ docs/codedocs/generated/
20
+ coverage.xml
21
+ .coverage
22
+
23
+ # IDE settings
24
+ .idea/
25
+
26
+ # local planning notes
27
+ PLAN-*.md
28
+ milestones.md
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2023 The University of Virginia
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,262 @@
1
+ Metadata-Version: 2.5
2
+ Name: flimanalyzer
3
+ Version: 0.6.0
4
+ Summary: Analysis of Fluorescence Lifetime Imaging Microscopy (FLIM) data.
5
+ Project-URL: Homepage, https://github.com/uvaKCCI/flimanalyzer
6
+ Project-URL: Issues, https://github.com/uvaKCCI/flimanalyzer/issues
7
+ Author-email: Karsten Siller <khsiller@gmail.com>
8
+ License: Copyright (c) 2023 The University of Virginia
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ License-File: LICENSE
28
+ Classifier: License :: OSI Approved :: MIT License
29
+ Classifier: Operating System :: OS Independent
30
+ Classifier: Programming Language :: Python :: 3 :: Only
31
+ Classifier: Programming Language :: Python :: 3.12
32
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
33
+ Requires-Python: >=3.12
34
+ Requires-Dist: importlib-resources<7
35
+ Requires-Dist: joblib<2
36
+ Requires-Dist: matplotlib<3.13,>=3.9
37
+ Requires-Dist: networkx<4,>=3
38
+ Requires-Dist: numpy<3,>=2.1
39
+ Requires-Dist: pandas<3,>=2.2.2
40
+ Requires-Dist: prefect<4,>=3.4.7
41
+ Requires-Dist: pydantic<3,>=2.7
42
+ Requires-Dist: scikit-learn<2,>=1.5
43
+ Requires-Dist: scipy<2,>=1.13
44
+ Requires-Dist: seaborn<0.14,>=0.13.2
45
+ Requires-Dist: torch<3,>2.7
46
+ Requires-Dist: xlsxwriter<4
47
+ Provides-Extra: dask
48
+ Requires-Dist: prefect-dask<1,>=0.3.7; extra == 'dask'
49
+ Provides-Extra: gui
50
+ Requires-Dist: pypubsub<5; extra == 'gui'
51
+ Requires-Dist: wxpython<4.3,>=4.2.2; extra == 'gui'
52
+ Provides-Extra: test
53
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
54
+ Requires-Dist: pytest-mock>=3.10.0; extra == 'test'
55
+ Requires-Dist: pytest-xdist>=3.6; extra == 'test'
56
+ Requires-Dist: pytest>=7.0.0; extra == 'test'
57
+ Description-Content-Type: text/markdown
58
+
59
+ # <img src="flim/resources/flimanalyzer.png" alt="" width="80" align="top"> FLIMAnalyzer
60
+
61
+ [![Python](https://img.shields.io/badge/python-3.12%2B-blue)](https://github.com/uvaKCCI/flimanalyzer/blob/main/pyproject.toml) [![Tests](https://github.com/uvaKCCI/flimanalyzer/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/uvaKCCI/flimanalyzer/actions/workflows/tests.yml) [![codecov](https://codecov.io/gh/uvaKCCI/flimanalyzer/branch/main/graph/badge.svg)](https://codecov.io/gh/uvaKCCI/flimanalyzer) [![Documentation Status](https://readthedocs.org/projects/flimanalyzer/badge/?version=latest)](https://flimanalyzer.readthedocs.io/en/latest/) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23426563.svg)](https://doi.org/10.5281/zenodo.23426563)
62
+
63
+ Python package for analysis of Fluorescence Lifetime Imaging Microscopy (FLIM) data.
64
+
65
+ Documentation: https://flimanalyzer.readthedocs.io
66
+
67
+ ## Requirements
68
+
69
+ * Python 3.12 or later
70
+ * All Python dependencies, including [PyTorch](https://pytorch.org) and [Prefect](https://www.prefect.io), are declared in `pyproject.toml` and installed automatically.
71
+
72
+ ## Installation
73
+
74
+ ### From PyPI with uv (recommended)
75
+
76
+ [uv](https://docs.astral.sh/uv/) creates a virtual environment in `.venv` (installing a matching Python if needed). Then install FLIMAnalyzer with its graphical user interface (GUI) into it:
77
+
78
+ uv venv --python 3.12
79
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
80
+ uv pip install "flimanalyzer[gui]"
81
+
82
+ The `gui` extra installs the GUI. Without it, `uv pip install flimanalyzer` installs only what [batch mode](#run-flimanalyzer-in-batch-mode) needs, for example on a computing cluster. Add `dask` for the optional Dask support (see [Concurrent and distributed execution](#concurrent-and-distributed-execution)), e.g. `"flimanalyzer[gui,dask]"`.
83
+
84
+ ### From PyPI with pip
85
+
86
+ python3.12 -m venv .venv
87
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
88
+ pip install "flimanalyzer[gui]"
89
+
90
+ ### PyTorch and the GPU
91
+
92
+ Installed from PyPI, FLIMAnalyzer gets PyTorch from PyPI, which provides a different build on each platform:
93
+
94
+ * **Linux:** the PyPI build includes CUDA, so an NVIDIA GPU is used if its driver is recent enough.
95
+ * **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](https://pytorch.org/get-started/locally/) for other CUDA versions.
96
+ * **macOS:** only Apple Silicon is supported, because current PyTorch versions are not available for Intel Macs. The PyPI build uses the Apple GPU (MPS).
97
+
98
+ ### Latest development version
99
+
100
+ 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:
101
+
102
+ git clone https://github.com/uvaKCCI/flimanalyzer.git
103
+ cd flimanalyzer
104
+ uv sync
105
+
106
+ Without the GUI, with the test dependencies, or with Dask support:
107
+
108
+ uv sync --no-group gui
109
+ uv sync --extra test
110
+ uv sync --extra dask
111
+
112
+ With pip, in a virtual environment in the cloned folder: `pip install -e ".[gui]"`.
113
+
114
+ ### With Docker
115
+
116
+ The Docker images run only [batch mode](#run-flimanalyzer-in-batch-mode). They don't include the GUI. Each release is published to the GitHub Container Registry:
117
+
118
+ | Image | |
119
+ |---|---|
120
+ | `ghcr.io/uvakcci/flimanalyzer:<version>`, `:latest` | with the CUDA build of PyTorch (x86_64, several GB) |
121
+ | `ghcr.io/uvakcci/flimanalyzer:<version>-cpu`, `:latest-cpu` | CPU only (x86_64 and ARM), much smaller |
122
+
123
+ docker pull ghcr.io/uvakcci/flimanalyzer:latest-cpu
124
+
125
+ 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:
126
+
127
+ docker build -t flimanalyzer .
128
+ docker build -t flimanalyzer:cu126 --build-arg TORCH_INDEX=https://download.pytorch.org/whl/cu126 .
129
+ docker build -t flimanalyzer:cpu --build-arg TORCH_INDEX=https://download.pytorch.org/whl/cpu .
130
+ docker build -t flimanalyzer:dask --build-arg EXTRAS=dask .
131
+
132
+ `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`).
133
+
134
+ `EXTRAS=gui` stops the build with an error, because the images do not support a display.
135
+
136
+ ## Start FLIMAnalyzer with the GUI
137
+
138
+ With uv, no activation is needed:
139
+
140
+ uv run flimanalyzer
141
+
142
+ In an activated environment:
143
+
144
+ flimanalyzer
145
+
146
+ To open data files (tab- or comma-separated) right away, each in its own window:
147
+
148
+ uv run flimanalyzer -i results.txt more-results.csv
149
+
150
+ Run `flimanalyzer --help` for all command line options.
151
+
152
+ ## Using a GPU
153
+
154
+ 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:
155
+
156
+ * `auto` (default): an NVIDIA GPU (`cuda`) if available, otherwise the Apple GPU (`mps`), otherwise the CPU.
157
+ * `cpu`, `cuda` or `mps`: uses that device, or the CPU if it is not available.
158
+
159
+ Which GPU can be used depends on the PyTorch build that was installed (see [Installation](#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.
160
+
161
+ ## Run FLIMAnalyzer in batch mode
162
+
163
+ `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.
164
+
165
+ uv run flimbatch -i data/ -o results/ -c settings.json \
166
+ --run Summarize --run "Basic FLIRR Analysis"
167
+
168
+ 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.
169
+
170
+ `flimanalyzer --batch …` does the same as `flimbatch …`. On Windows, use `flimbatch`: `flimanalyzer` starts without a console there, so its messages are not shown.
171
+
172
+ ### In Docker
173
+
174
+ The image runs `flimbatch`. Make the folder with the data and the settings file available inside the container as `/work`:
175
+
176
+ docker run --rm -v "$PWD:/work" ghcr.io/uvakcci/flimanalyzer:latest-cpu \
177
+ -i data/ -o results/ -c settings.json --run Summarize --no-prefect-server
178
+
179
+ * On Linux, add `-u $(id -u)` so that the result files belong to you.
180
+ * With the CUDA image, add `--gpus all` to use the GPU.
181
+ * 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`.
182
+
183
+ ## Prefect server
184
+
185
+ FLIMAnalyzer runs analyses and workflows as [Prefect](https://www.prefect.io) flows. At startup it looks for a Prefect server in this order:
186
+
187
+ 1. The server configured in the active Prefect profile or in the `PREFECT_API_URL` environment variable, e.g.
188
+
189
+ prefect profile use <profile>
190
+ # or
191
+ export PREFECT_API_URL=https://my-prefect-server/api
192
+
193
+ 2. A server already running locally at `http://127.0.0.1:4200/api`.
194
+ 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`.
195
+
196
+ Flow and task runs can be inspected in the Prefect UI of the server in use, e.g. [http://127.0.0.1:4200](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.
197
+
198
+ ## Concurrent and distributed execution
199
+
200
+ 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.
201
+
202
+ By default, up to one task per CPU core runs at a time, as threads. To change that number:
203
+
204
+ uv run flimanalyzer --execargs="num_workers=4"
205
+
206
+ `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.
207
+
208
+ FLIMAnalyzer can also use [Dask](https://www.dask.org). Dask support is optional; install it with `uv sync --extra dask` (or `pip install -e ".[dask]"`).
209
+
210
+ On a *single node*, start a local Dask cluster:
211
+
212
+ uv run flimanalyzer -e LocalDaskExecutor --execargs="scheduler=processes,num_workers=8"
213
+
214
+ 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.
215
+
216
+ To use an existing Dask cluster:
217
+
218
+ uv run flimanalyzer -e DaskExecutor --execargs="address=tcp://<scheduler-host>:8786"
219
+
220
+ ### Concurrency limits
221
+
222
+ Prefect applies [tag concurrency limits](https://docs.prefect.io/v3/develop/task-run-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:
223
+
224
+ uv run prefect concurrency-limit create "Autoencoder: Train" 1
225
+
226
+ `uv run prefect concurrency-limit ls` lists the limits, and `uv run prefect concurrency-limit delete <tag>` removes one.
227
+
228
+ ## How to cite
229
+
230
+ If you use FLIMAnalyzer, please cite:
231
+
232
+ 1. **The original publication**, in all cases:
233
+
234
+ 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](https://doi.org/10.1002/jbio.202400426)
235
+
236
+ 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.
237
+
238
+ | Your version | Publication | Software DOI |
239
+ |---|---|---|
240
+ | 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](https://doi.org/10.1186/s10020-026-01605-2) | [10.5281/zenodo.23438157](https://doi.org/10.5281/zenodo.23438157) |
241
+ | v0.4.1 or earlier | Zhang et al. (2025), the original publication above | [10.5281/zenodo.23426564](https://doi.org/10.5281/zenodo.23426564) |
242
+
243
+ The concept DOI [10.5281/zenodo.23426563](https://doi.org/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`](CITATION.cff); GitHub shows it under "Cite this repository".
244
+
245
+ ## Development
246
+
247
+ Run the test suite:
248
+
249
+ uv sync --extra test
250
+ uv run pytest
251
+
252
+ Tests that run flows use a temporary Prefect server and database and do not report to any configured server.
253
+
254
+ 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`:
255
+
256
+ uv run pytest -n auto tests/core
257
+
258
+ Build the documentation (output in `docs/_build/html`):
259
+
260
+ uv run --group docs sphinx-build -b html docs docs/_build/html
261
+
262
+ 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`).
@@ -0,0 +1,204 @@
1
+ # <img src="flim/resources/flimanalyzer.png" alt="" width="80" align="top"> FLIMAnalyzer
2
+
3
+ [![Python](https://img.shields.io/badge/python-3.12%2B-blue)](https://github.com/uvaKCCI/flimanalyzer/blob/main/pyproject.toml) [![Tests](https://github.com/uvaKCCI/flimanalyzer/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/uvaKCCI/flimanalyzer/actions/workflows/tests.yml) [![codecov](https://codecov.io/gh/uvaKCCI/flimanalyzer/branch/main/graph/badge.svg)](https://codecov.io/gh/uvaKCCI/flimanalyzer) [![Documentation Status](https://readthedocs.org/projects/flimanalyzer/badge/?version=latest)](https://flimanalyzer.readthedocs.io/en/latest/) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23426563.svg)](https://doi.org/10.5281/zenodo.23426563)
4
+
5
+ Python package for analysis of Fluorescence Lifetime Imaging Microscopy (FLIM) data.
6
+
7
+ Documentation: https://flimanalyzer.readthedocs.io
8
+
9
+ ## Requirements
10
+
11
+ * Python 3.12 or later
12
+ * All Python dependencies, including [PyTorch](https://pytorch.org) and [Prefect](https://www.prefect.io), are declared in `pyproject.toml` and installed automatically.
13
+
14
+ ## Installation
15
+
16
+ ### From PyPI with uv (recommended)
17
+
18
+ [uv](https://docs.astral.sh/uv/) creates a virtual environment in `.venv` (installing a matching Python if needed). Then install FLIMAnalyzer with its graphical user interface (GUI) into it:
19
+
20
+ uv venv --python 3.12
21
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
22
+ uv pip install "flimanalyzer[gui]"
23
+
24
+ The `gui` extra installs the GUI. Without it, `uv pip install flimanalyzer` installs only what [batch mode](#run-flimanalyzer-in-batch-mode) needs, for example on a computing cluster. Add `dask` for the optional Dask support (see [Concurrent and distributed execution](#concurrent-and-distributed-execution)), e.g. `"flimanalyzer[gui,dask]"`.
25
+
26
+ ### From PyPI with pip
27
+
28
+ python3.12 -m venv .venv
29
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
30
+ pip install "flimanalyzer[gui]"
31
+
32
+ ### PyTorch and the GPU
33
+
34
+ Installed from PyPI, FLIMAnalyzer gets PyTorch from PyPI, which provides a different build on each platform:
35
+
36
+ * **Linux:** the PyPI build includes CUDA, so an NVIDIA GPU is used if its driver is recent enough.
37
+ * **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](https://pytorch.org/get-started/locally/) for other CUDA versions.
38
+ * **macOS:** only Apple Silicon is supported, because current PyTorch versions are not available for Intel Macs. The PyPI build uses the Apple GPU (MPS).
39
+
40
+ ### Latest development version
41
+
42
+ 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:
43
+
44
+ git clone https://github.com/uvaKCCI/flimanalyzer.git
45
+ cd flimanalyzer
46
+ uv sync
47
+
48
+ Without the GUI, with the test dependencies, or with Dask support:
49
+
50
+ uv sync --no-group gui
51
+ uv sync --extra test
52
+ uv sync --extra dask
53
+
54
+ With pip, in a virtual environment in the cloned folder: `pip install -e ".[gui]"`.
55
+
56
+ ### With Docker
57
+
58
+ The Docker images run only [batch mode](#run-flimanalyzer-in-batch-mode). They don't include the GUI. Each release is published to the GitHub Container Registry:
59
+
60
+ | Image | |
61
+ |---|---|
62
+ | `ghcr.io/uvakcci/flimanalyzer:<version>`, `:latest` | with the CUDA build of PyTorch (x86_64, several GB) |
63
+ | `ghcr.io/uvakcci/flimanalyzer:<version>-cpu`, `:latest-cpu` | CPU only (x86_64 and ARM), much smaller |
64
+
65
+ docker pull ghcr.io/uvakcci/flimanalyzer:latest-cpu
66
+
67
+ 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:
68
+
69
+ docker build -t flimanalyzer .
70
+ docker build -t flimanalyzer:cu126 --build-arg TORCH_INDEX=https://download.pytorch.org/whl/cu126 .
71
+ docker build -t flimanalyzer:cpu --build-arg TORCH_INDEX=https://download.pytorch.org/whl/cpu .
72
+ docker build -t flimanalyzer:dask --build-arg EXTRAS=dask .
73
+
74
+ `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`).
75
+
76
+ `EXTRAS=gui` stops the build with an error, because the images do not support a display.
77
+
78
+ ## Start FLIMAnalyzer with the GUI
79
+
80
+ With uv, no activation is needed:
81
+
82
+ uv run flimanalyzer
83
+
84
+ In an activated environment:
85
+
86
+ flimanalyzer
87
+
88
+ To open data files (tab- or comma-separated) right away, each in its own window:
89
+
90
+ uv run flimanalyzer -i results.txt more-results.csv
91
+
92
+ Run `flimanalyzer --help` for all command line options.
93
+
94
+ ## Using a GPU
95
+
96
+ 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:
97
+
98
+ * `auto` (default): an NVIDIA GPU (`cuda`) if available, otherwise the Apple GPU (`mps`), otherwise the CPU.
99
+ * `cpu`, `cuda` or `mps`: uses that device, or the CPU if it is not available.
100
+
101
+ Which GPU can be used depends on the PyTorch build that was installed (see [Installation](#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.
102
+
103
+ ## Run FLIMAnalyzer in batch mode
104
+
105
+ `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.
106
+
107
+ uv run flimbatch -i data/ -o results/ -c settings.json \
108
+ --run Summarize --run "Basic FLIRR Analysis"
109
+
110
+ 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.
111
+
112
+ `flimanalyzer --batch …` does the same as `flimbatch …`. On Windows, use `flimbatch`: `flimanalyzer` starts without a console there, so its messages are not shown.
113
+
114
+ ### In Docker
115
+
116
+ The image runs `flimbatch`. Make the folder with the data and the settings file available inside the container as `/work`:
117
+
118
+ docker run --rm -v "$PWD:/work" ghcr.io/uvakcci/flimanalyzer:latest-cpu \
119
+ -i data/ -o results/ -c settings.json --run Summarize --no-prefect-server
120
+
121
+ * On Linux, add `-u $(id -u)` so that the result files belong to you.
122
+ * With the CUDA image, add `--gpus all` to use the GPU.
123
+ * 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`.
124
+
125
+ ## Prefect server
126
+
127
+ FLIMAnalyzer runs analyses and workflows as [Prefect](https://www.prefect.io) flows. At startup it looks for a Prefect server in this order:
128
+
129
+ 1. The server configured in the active Prefect profile or in the `PREFECT_API_URL` environment variable, e.g.
130
+
131
+ prefect profile use <profile>
132
+ # or
133
+ export PREFECT_API_URL=https://my-prefect-server/api
134
+
135
+ 2. A server already running locally at `http://127.0.0.1:4200/api`.
136
+ 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`.
137
+
138
+ Flow and task runs can be inspected in the Prefect UI of the server in use, e.g. [http://127.0.0.1:4200](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.
139
+
140
+ ## Concurrent and distributed execution
141
+
142
+ 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.
143
+
144
+ By default, up to one task per CPU core runs at a time, as threads. To change that number:
145
+
146
+ uv run flimanalyzer --execargs="num_workers=4"
147
+
148
+ `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.
149
+
150
+ FLIMAnalyzer can also use [Dask](https://www.dask.org). Dask support is optional; install it with `uv sync --extra dask` (or `pip install -e ".[dask]"`).
151
+
152
+ On a *single node*, start a local Dask cluster:
153
+
154
+ uv run flimanalyzer -e LocalDaskExecutor --execargs="scheduler=processes,num_workers=8"
155
+
156
+ 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.
157
+
158
+ To use an existing Dask cluster:
159
+
160
+ uv run flimanalyzer -e DaskExecutor --execargs="address=tcp://<scheduler-host>:8786"
161
+
162
+ ### Concurrency limits
163
+
164
+ Prefect applies [tag concurrency limits](https://docs.prefect.io/v3/develop/task-run-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:
165
+
166
+ uv run prefect concurrency-limit create "Autoencoder: Train" 1
167
+
168
+ `uv run prefect concurrency-limit ls` lists the limits, and `uv run prefect concurrency-limit delete <tag>` removes one.
169
+
170
+ ## How to cite
171
+
172
+ If you use FLIMAnalyzer, please cite:
173
+
174
+ 1. **The original publication**, in all cases:
175
+
176
+ 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](https://doi.org/10.1002/jbio.202400426)
177
+
178
+ 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.
179
+
180
+ | Your version | Publication | Software DOI |
181
+ |---|---|---|
182
+ | 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](https://doi.org/10.1186/s10020-026-01605-2) | [10.5281/zenodo.23438157](https://doi.org/10.5281/zenodo.23438157) |
183
+ | v0.4.1 or earlier | Zhang et al. (2025), the original publication above | [10.5281/zenodo.23426564](https://doi.org/10.5281/zenodo.23426564) |
184
+
185
+ The concept DOI [10.5281/zenodo.23426563](https://doi.org/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`](CITATION.cff); GitHub shows it under "Cite this repository".
186
+
187
+ ## Development
188
+
189
+ Run the test suite:
190
+
191
+ uv sync --extra test
192
+ uv run pytest
193
+
194
+ Tests that run flows use a temporary Prefect server and database and do not report to any configured server.
195
+
196
+ 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`:
197
+
198
+ uv run pytest -n auto tests/core
199
+
200
+ Build the documentation (output in `docs/_build/html`):
201
+
202
+ uv run --group docs sphinx-build -b html docs docs/_build/html
203
+
204
+ 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`).
@@ -0,0 +1,2 @@
1
+ # Importing flim does not load the tools or the GUI: tools register when flim.tools
2
+ # is imported (the application does that), so flim.core can be used without wxPython.
@@ -0,0 +1,5 @@
1
+ # Generated by versioningit
2
+ __version__ = "0.6.0"
3
+ __build_date__ = "2026-11-03 13:58:33.016407+00:00"
4
+ __git_commit__ = "835f0b5776d57eda8214ed7da58ee09df86784ed"
5
+ __dirty__ = False
@@ -0,0 +1 @@
1
+ """Machine learning models of the autoencoder tools (``flim.analysis.ml``)."""
File without changes