pyfli.bayes_utils.posterior_pixel_plot#
Posterior-predictive plot of one pixel’s sampled decay reconstructions against its measured decay.
Module Attributes
Valid values for the center argument. |
|
Valid values for the decay_style argument. |
Functions
|
The type of the None singleton. |
|
1x1 crop of an (H, W) shift map; scalars and None pass through. |
|
Per-sample |
|
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), decay_color=_DECAY_COLOR, fit_color=_FIT_COLOR, band_alpha=0.88, fit_alpha=1.0, decay_alpha=0.8, title=None, ax=None, decay_style='line', shift_method='zero_pad', h_shift=None, v_shift=None, excitation='bin_start', gate_width=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).decay_color (
str) – Colour of the measured-decay line (defaults to_DECAY_COLOR).fit_color (
str) – Colour of the central fit curve and the credible bands (which are tinted-toward-white shades of it); defaults to_FIT_COLOR.band_alpha (
floatortuple[float,]) – Opacity of the credible bands. A scalar applies to every band; a sequence sets them per band, matched positionally toci_levels.fit_alpha (
float) – Opacity of the central fit curve.decay_alpha (
float) – Opacity of the measured decay (line or scatter points, see decay_style).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.decay_style (
str) – How the measured decay is drawn:"line"(default) or"scatter"(one point per time bin).shift_method (
str) – Forward model,"zero_pad"or"circular", as used for the fit (seepyfli.reconstruction.ParamToDecay).h_shift (
float | np.ndarray | None) – Decay onset (ns) and per-bin background, a scalar or an (H, W) map;h_shift/v_shiftkeys in output_combination take precedence.Nonemeans 0 (seeParamSelector).v_shift (
float | np.ndarray | None) – Decay onset (ns) and per-bin background, a scalar or an (H, W) map;h_shift/v_shiftkeys in output_combination take precedence.Nonemeans 0 (seeParamSelector).excitation (str) – Forward-model options as used for the fit (see
pyfli.reconstruction.ParamToDecay).gate_width (float | None) – Forward-model options as used for the fit (see
pyfli.reconstruction.ParamToDecay).
- Return type:
tuple[matplotlib.figure.Figure,matplotlib.axes.Axes]