pyfli.analysis.fit_analysis#
Plot fitted parameter maps, diagnostics, classifier summaries, and two-dimensional comparisons.
This module belongs to pyfli.analysis and is part of PyFLI post-processing,
diagnostics, statistical comparison, and result-loading utilities for fitted FLI/FLIM
datasets. Public API includes functions plot_fitting_maps(),
plot_diagnostics(), plot_pixel_evidence(),
plot_statistical_comparison(), plot_2d_analysis(), and
run_mono_bi_classifier().
Functions
|
Return the threshold for map_key, checking user overrides first. |
|
2D subplot analysis (map + histogram + violin + boxplot + KDE + qq + CDF) per parameter map, for every fitting result. |
|
Pixel diagnostic overlays for all fitting results (log and linear scale). |
|
Plot parameter maps for every fitting result. |
|
Single-pixel fit evidence plot for a randomly selected valid pixel. |
|
Comparative statistical plot per parameter key (box / violin / KDE / ...). |
|
Run mono bi classifier. |
- plot_fitting_maps(all_datasets, names, map_keys, v_ranges=None, saver=None, cmap=None)[source]#
Plot parameter maps for every fitting result.
- Parameters:
all_datasets (
list[dict] from load_fitting_results())names (
list[str])map_keys (
list[str] keystoextract,e.g. [``’tau_map’``] or) – [‘alpha1_map’, ‘tau1_map’, ‘tau2_map’]v_ranges (
list[tuple]orNone) – Display range per map, e.g. [(0, 1.5)] or [(0,1),(0,2),(0,2)]. Pass None to let DataViewer auto-scale.saver (
DataSaverorNone)cmap (
colormap — defaultstojet with zero→black)
- Return type:
None
- plot_diagnostics(binned_decay, all_fitset, names, mask, saver=None)[source]#
Pixel diagnostic overlays for all fitting results (log and linear scale).
- plot_pixel_evidence(binned_decay, binned_irf, all_fitset, all_datasets, names, mask, saver=None, num=0)[source]#
Single-pixel fit evidence plot for a randomly selected valid pixel.
- plot_statistical_comparison(all_datasets, names, map_keys, mask, saver=None, graph_type='box', colors_list=None, test_type='none', per_key_thresholds=None, percentile_clip=(1, 99))[source]#
Comparative statistical plot per parameter key (box / violin / KDE / …).
One figure is produced per key so that each parameter is filtered by its own physically valid range (e.g. alpha ∈ [0,1] vs tau ∈ [0,5 ns]). Thresholds fall back to DEFAULT_KEY_THRESHOLDS when not overridden.
- Parameters:
all_datasets (
list[dict])names (
list[str])map_keys (
list[str] e.g. [``’tau_map’``] or) – [‘alpha1_map’, ‘tau1_map’, ‘tau2_map’]mask (
np.ndarray (H,W) bool)graph_type (str
'box','violin','swarm','overlay',) – ‘raincloud’, or ‘kde’test_type (str
'none','paired', or'welch')colors_list (
list per-source colour hex strings)per_key_thresholds (
dictorNone) – Override thresholds per key, e.g.{'tau_map': (0, 3), 'alpha1_map': (0, 1)}. Keys not listed fall back to DEFAULT_KEY_THRESHOLDS.percentile_clip (
tupleorNone (low%,high%) appliedtoevery key;) – pass None to disablesaver (Any | None)
- Returns:
figs
- Return type:
dict[str,Figure] keyed by map_key
- plot_2d_analysis(all_datasets, names, map_keys, mask, per_key_thresholds=None, saver=None, cmap='jet')[source]#
2D subplot analysis (map + histogram + violin + boxplot + KDE + qq + CDF) per parameter map, for every fitting result.
Thresholds are resolved per key via DEFAULT_KEY_THRESHOLDS so that alpha maps are automatically clipped to [0, 1] and tau maps to [0, 5] unless overridden.
- Parameters:
all_datasets (
list[dict])names (
list[str])map_keys (
list[str] e.g. [``’tau_map’``] or) – [‘alpha1_map’, ‘tau1_map’, ‘tau2_map’]mask (
np.ndarray (H,W) bool)per_key_thresholds (
dictorNone) – Override per key, e.g.{'tau2_map': (0, 3)}. Keys not listed fall back to DEFAULT_KEY_THRESHOLDS.saver (
DataSaverorNone)cmap (
str colormap for the spatial map panels)
- Return type:
None
- run_mono_bi_classifier(all_datasets, names, mask, alpha_upper=0.95, alpha_lower=0.05, tau_tol=0.01, scatter_keys=None, saver=None)[source]#
Run mono bi classifier.
- Parameters:
all_datasets (
Any) – Collection of fitted datasets to classify, compare, or summarize.names (
Any) – Dataset names used in summaries and plots.mask (
Any) – Boolean or labeled mask selecting pixels for the operation.alpha_upper (
float) – Upper alpha-fraction threshold used by the classifier.alpha_lower (
float) – Lower alpha-fraction threshold used by the classifier.tau_tol (
float) – Lifetime tolerance used by the mono/bi classifier.scatter_keys (
Any | None) – Parameter keys used in classifier scatter plots.saver (
Any | None) – Optional saver used to persist messages or figures.
- Returns:
Tuple containing classifier outputs and mono/bi-exponential labels.
- Return type:
tuple[Any,]