pyfli.phasor.phasorS.phasor_simple_plots#

Plotting mixins for phasor maps, overlays, pixel fits and harmonics.

Classes

PhasorPlotsMixin()

Add plotting methods to phasor analyzers.

class PhasorPlotsMixin[source]#

Bases: object

Add plotting methods to phasor analyzers. The mixin renders phasor diagrams, color maps, overlays, pixel fits, harmonic views, and traceable analysis panels without owning acquisition state.

phasor_colormap(G, S, intensity=None, colormap='viridis')[source]#

Run the phasor colormap routine.

Parameters:
  • G (np.ndarray) – Phasor real coordinate.

  • S (np.ndarray) – Phasor imaginary coordinate or shift amount.

  • intensity (np.ndarray | None) – Intensity map used to weight or color phasor output.

  • colormap (str) – Colormap used to convert phasor coordinates to colors.

Returns:

Object produced by phasor colormap.

Return type:

Any

phasor_radial_color(G, S, colormap='viridis', norm_color=False, half_circle=True)[source]#

Run the phasor radial color routine.

Parameters:
  • G (np.ndarray) – Phasor real coordinate.

  • S (np.ndarray) – Phasor imaginary coordinate or shift amount.

  • colormap (str) – Colormap used to convert phasor coordinates to colors.

  • norm_color (bool) – Whether phasor colors are normalized before display.

  • half_circle (bool) – Whether to draw only the upper half of the universal phasor circle.

Returns:

Object produced by phasor radial color.

Return type:

Any

plot_phasor_diagram(G, S, mask=None, colors=None, hexbin_color=None, ax=None, figsize=(8, 3), half_circle=True, title='Phasor Diagram', xlim=(-0.1, 1.1), ylim=(0.0, 0.6), kdeplot=False, kde_color='white', kde_levels=5, kde_linewidths=1, kde_alpha=0.5)[source]#

Plot phasor diagram.

Parameters:
  • G (np.ndarray) – Phasor real coordinate.

  • S (np.ndarray) – Phasor imaginary coordinate or shift amount.

  • mask (np.ndarray | None) – Boolean or labeled mask selecting pixels for the operation.

  • colors (Any | None) – Color sequence used for plotted sources or groups.

  • hexbin_color (np.ndarray | None) – Optional values used to color phasor hexbin density.

  • ax (Any | None) – Matplotlib axes object on which the plot is drawn.

  • figsize (tuple[int, ]) – Figure size passed to Matplotlib.

  • half_circle (bool) – Whether to draw only the upper half of the universal phasor circle.

  • title (str) – Title displayed on the generated plot.

  • xlim (tuple[float, ]) – X-axis limits for the phasor plot.

  • ylim (tuple[float, ]) – Y-axis limits for the phasor plot.

  • kdeplot (bool) – Whether to overlay a KDE density contour on the phasor points.

  • kde_color (str) – Color used for the KDE density contour lines.

  • kde_levels (int) – Number of contour levels drawn for the KDE overlay.

  • kde_linewidths (float) – Line width of the KDE contour lines.

  • kde_alpha (float) – Opacity of the KDE contour lines.

Returns:

Matplotlib figure or axes containing the phasor diagram.

Return type:

np.ndarray

plot_map(image, scales=[0, 2], title='', ax=None, figsize=(8, 6))[source]#

Plot map.

Parameters:
  • image (np.ndarray) – Image array displayed or processed by the routine.

  • scales (list[Any]) – Display limits used when plotting an image.

  • title (str) – Title displayed on the generated plot.

  • ax (Any | None) – Matplotlib axes object on which the plot is drawn.

  • figsize (tuple[int, ]) – Figure size passed to Matplotlib.

Returns:

Matplotlib figure or axes containing the rendered map.

Return type:

np.ndarray

plot_phasor_overlay(decay, G, S, colormap='viridis', ax=None, figsize=(8, 8))[source]#

Plot phasor overlay.

Parameters:
  • decay (np.ndarray) – Time-resolved decay signal or decay cube.

  • G (np.ndarray) – Phasor real coordinate.

  • S (np.ndarray) – Phasor imaginary coordinate or shift amount.

  • colormap (str) – Colormap used to convert phasor coordinates to colors.

  • ax (Any | None) – Matplotlib axes object on which the plot is drawn.

  • figsize (tuple[int, ]) – Figure size passed to Matplotlib.

Returns:

Matplotlib figure or axes containing the phasor overlay.

Return type:

np.ndarray

plot_pure_phasor_map(G, S, decay, noise_removed=True, colormap='viridis', ax=None, figsize=(4, 4))[source]#

Plot pure phasor map.

Parameters:
  • G (np.ndarray) – Phasor real coordinate.

  • S (np.ndarray) – Phasor imaginary coordinate or shift amount.

  • decay (np.ndarray) – Time-resolved decay signal or decay cube.

  • noise_removed (bool) – Whether noise-filtered phasor points are shown.

  • colormap (str) – Colormap used to convert phasor coordinates to colors.

  • ax (Any | None) – Matplotlib axes object on which the plot is drawn.

  • figsize (tuple[int, ]) – Figure size passed to Matplotlib.

Returns:

Matplotlib figure or axes containing the pure phasor map.

Return type:

np.ndarray

plot_overlay_subplots(decay, G, S, mask=None, colormaps=['jet', 'jet', 'viridis', 'jet'], noise_removed=True, figsize=(15, 10), half_circle=True, xlim=(-0.1, 1.1), ylim=(0.0, 0.6), bg_color='black', transpose=False, kdeplot=True, kde_levels=3)[source]#

Plot overlay subplots.

Parameters:
  • decay (np.ndarray) – Time-resolved decay signal or decay cube.

  • G (np.ndarray) – Phasor real coordinate.

  • S (np.ndarray) – Phasor imaginary coordinate or shift amount.

  • mask (np.ndarray | None) – Boolean or labeled mask selecting pixels for the operation.

  • colormaps (list[Any]) – Colormap specifications used for overlay panels.

  • noise_removed (bool) – Whether noise-filtered phasor points are shown.

  • figsize (tuple[int, ]) – Figure size passed to Matplotlib.

  • half_circle (bool) – Whether to draw only the upper half of the universal phasor circle.

  • xlim (tuple[float, ]) – X-axis limits for the phasor plot.

  • ylim (tuple[float, ]) – Y-axis limits for the phasor plot.

  • bg_color (str) – Background color used behind the phasor overlay.

  • transpose (bool) – Whether image-like arrays are transposed before display.

  • kdeplot (bool) – Whether to overlay a KDE density contour on the color-scatter phasor panel.

  • kde_levels (int) – Number of contour levels drawn for the KDE overlay.

Returns:

Matplotlib figure or axes containing overlay subplot panels.

Return type:

np.ndarray

plot_pixel_fit(irf, decay, reconstructed_decay, x, y, log_scale=True, ax=None, figsize=(10, 6))[source]#

Plot pixel fit.

Parameters:
  • irf (np.ndarray) – Instrument response function aligned with the decay signal.

  • decay (np.ndarray) – Time-resolved decay signal or decay cube.

  • reconstructed_decay (np.ndarray) – Model decay reconstructed from fitted parameters.

  • x (np.ndarray) – Input array, coordinate, or signal being transformed.

  • y (np.ndarray) – Observed signal, target data, or coordinate array.

  • log_scale (bool) – Whether the decay axis is drawn on a logarithmic scale.

  • ax (Any | None) – Matplotlib axes object on which the plot is drawn.

  • figsize (tuple[int, ]) – Figure size passed to Matplotlib.

Returns:

Matplotlib figure or axes containing the pixel fit.

Return type:

np.ndarray

plot_pixel_fit_single_exp(irf, decay, tau_ns, x, y, log_scale=True, ax=None, figsize=(10, 6))[source]#

Plot pixel fit single exp.

Parameters:
  • irf (np.ndarray) – Instrument response function aligned with the decay signal.

  • decay (np.ndarray) – Time-resolved decay signal or decay cube.

  • tau_ns (np.ndarray) – Lifetime value in nanoseconds.

  • x (np.ndarray) – Input array, coordinate, or signal being transformed.

  • y (np.ndarray) – Observed signal, target data, or coordinate array.

  • log_scale (bool) – Whether the decay axis is drawn on a logarithmic scale.

  • ax (Any | None) – Matplotlib axes object on which the plot is drawn.

  • figsize (tuple[int, ]) – Figure size passed to Matplotlib.

Returns:

Matplotlib figure or axes containing the single-exponential pixel fit.

Return type:

np.ndarray

plot_phasor_harmonics(G, S, harmonics=(1, 2, 3, 4), mask=None, colors=None, hexbin_color=None, figsize=(22, 5), axes=None, half_circle=True, xlim=(-0.1, 1.1), ylim=(0.0, 0.6))[source]#

Plot phasor harmonics.

Parameters:
  • G (np.ndarray) – Phasor real coordinate.

  • S (np.ndarray) – Phasor imaginary coordinate or shift amount.

  • harmonics (tuple[int, ]) – Harmonic indices included in the phasor plot.

  • mask (np.ndarray | None) – Boolean or labeled mask selecting pixels for the operation.

  • colors (Any | None) – Color sequence used for plotted sources or groups.

  • hexbin_color (np.ndarray | None) – Optional values used to color phasor hexbin density.

  • figsize (tuple[int, ]) – Figure size passed to Matplotlib.

  • axes (Any | None) – Matplotlib axes collection used for drawing subplots.

  • half_circle (bool) – Whether to draw only the upper half of the universal phasor circle.

  • xlim (tuple[float, ]) – X-axis limits for the phasor plot.

  • ylim (tuple[float, ]) – Y-axis limits for the phasor plot.

Returns:

Matplotlib figure or axes containing phasor harmonics.

Return type:

np.ndarray

plot_traceable_analysis(G, S, mask=None, colormap='viridis', figsize=(14, 6), axes=None, half_circle=True, xlim=(-0.1, 1.1), ylim=(0.0, 0.6))[source]#

Plot traceable analysis.

Parameters:
  • G (np.ndarray) – Phasor real coordinate.

  • S (np.ndarray) – Phasor imaginary coordinate or shift amount.

  • mask (np.ndarray | None) – Boolean or labeled mask selecting pixels for the operation.

  • colormap (str) – Colormap used to convert phasor coordinates to colors.

  • figsize (tuple[int, ]) – Figure size passed to Matplotlib.

  • axes (Any | None) – Matplotlib axes collection used for drawing subplots.

  • half_circle (bool) – Whether to draw only the upper half of the universal phasor circle.

  • xlim (tuple[float, ]) – X-axis limits for the phasor plot.

  • ylim (tuple[float, ]) – Y-axis limits for the phasor plot.

Returns:

Matplotlib figure or axes containing traceable phasor analysis panels.

Return type:

np.ndarray