pyfli.bayes_utils.posterior_pixel_plot#
Plot a single pixel’s posterior-sample decay reconstructions against its measured decay, in the style of a posterior-predictive check: shaded credible- interval bands plus a chosen central curve (best-fitting sample, median, or mean), overlaid on the actual measured decay.
Belongs to pyfli.bayes_utils, downstream of
pyfli.bayes_utils.param_combinations.ParamSelector and
pyfli.reconstruction.ParamToDecay.
Module Attributes
Valid values for the center argument. |
Functions
|
Reconstruct every posterior sample's decay curve at one pixel, scaled to that pixel's measured photon count the same way |
|
Pick the posterior sample that best fits this one pixel, by delegating to |
|
Plot one pixel's posterior-sample decay reconstructions as nested credible-interval bands, a chosen central curve, and the measured decay. |
- plot_pixel_posterior_fit(output_combination, decay, irf, freq_acq, pixel, model_type='bi-exponential', center='median', metric='reduced_chi2', ci_levels=(92, 68), title=None, ax=None)[source]#
Plot one pixel’s posterior-sample decay reconstructions as nested credible-interval bands, a chosen central curve, and the measured decay.
- Parameters:
output_combination (
dict[str,np.ndarray]) – Posterior-sample parameter maps, e.g.{'tau1': (H,W,NUM_SAMPLES), 'tau2': (H,W,NUM_SAMPLES), 'alpha1': (H,W,NUM_SAMPLES)}for bi-exponential, or{'tau': (H,W,NUM_SAMPLES)}for mono-exponential – same shape convention asParamSelector.decay (
np.ndarray) – Measured decay,(H, W, T).irf (
np.ndarray) – IRF,(T,)(shared) or(H, W, T)(per-pixel).freq_acq (
float) – Acquisition frequency (MHz), i.e.freq[1].pixel (
tuple[int,int]) –(x, y)pixel to plot.model_type (
str) –"bi-exponential"or"mono-exponential".center (
str) – Which curve to draw as the central line:"median"or"mean"across posterior samples, or"best"(the single sample that optimizesmetricat this pixel, viaParamSelector.select_best_combination()).metric (
str) – Only used whencenter="best"; one ofParamSelector.METRICS("chi2","reduced_chi2","RMSE","R2").ci_levels (
tuple[int,]) – Nested credible-interval widths to shade, e.g.(92, 68)shades a 92% and a 68% band (percentiles(4, 96)and(16, 84)of the per-bin sample distribution).title (
str | None) – Axes title; defaults tof"Pixel ({x}, {y})".ax (
matplotlib.axes.Axes | None) – Axes to draw into. If omitted, a new figure/axes is created and shown.
- Return type:
tuple[matplotlib.figure.Figure,matplotlib.axes.Axes]