rizer.misc.plt_simulation#

Plotting helpers for 2T0D constant-mass NRP simulation results.

This module provides SimulationPlotter, a class wrapping the figures produced from a Cantera SolutionArray simulation output. Per-plot configuration (axis limits, annotations) is externalized to a YAML file consumed by SimulationPlotter._apply_axis_config and SimulationPlotter._apply_annotations.

Classes#

SimulationPlotter

Plot results of the 2T0D constant-mass NRP simulation.

Functions#

tick_func(→ str)

Format x-ticks as ns (or µs above 1000 ns).

Module Contents#

rizer.misc.plt_simulation.tick_func(x: float, pos: int) str#

Format x-ticks as ns (or µs above 1000 ns).

Parameters:
  • x (float) – The x-value to format.

  • pos (int) – The position of the tick on the x-axis. Not used in this function.

Returns:

The formatted x-tick.

Return type:

str

class rizer.misc.plt_simulation.SimulationPlotter(states: cantera.SolutionArray, states_before_change: cantera.SolutionArray, states_after_change: cantera.SolutionArray | None, change_time: float | None, figure_subfolder: str, annotations_yaml_path: str | pathlib.Path | None = None, save: bool = True, show: bool = True, validate_text_positions: bool = True)#

Plot results of the 2T0D constant-mass NRP simulation.

Each plotting method builds a figure and returns it together with its axes. Saving and displaying are controlled by the save and show flags set on the instance.

Parameters:
  • states (cantera.SolutionArray) – Full simulation state array.

  • states_before_change (cantera.SolutionArray) – States up to (and excluding) the radius change.

  • states_after_change (cantera.SolutionArray or None) – States from the radius change onwards (None if no change was detected).

  • change_time (float or None) – Time of the radius change in seconds (None if no change was detected).

  • figure_subfolder (str) – Sub-path under figures/ where SVGs are saved.

  • annotations_yaml_path (str or pathlib.Path or None, optional) – Path to a YAML file with per-plot configuration keyed by method name. Each top-level key may contain an axes mapping (axis name -> {xlim, ylim}) and/or an annotations list (each entry matching rizer.misc.plt_utils.get_annotation() parameters). If None, no auto-applied configuration is loaded. When save is True, a copy of this YAML is dropped next to the figures (<figures>/<figure_subfolder>/) on the first successful save, so the saved figures and the configuration that produced them stay paired.

  • save (bool, optional) – If True, save each figure with save_current_figure. Default True.

  • show (bool, optional) – If True, call plt.show() after each figure. Default True.

  • validate_text_positions (bool, optional) – If True, just before saving/showing each figure, walk every axis and warn (via warnings) when a Text or Annotation artist sits outside the axis limits. Moveable positions (text and annotation xytext) are clamped just inside the limits; annotation xy arrow targets are flagged but never moved (clamping would silently re-anchor the arrow to a different data point). Default True.

states#
states_before_change#
states_after_change#
change_time#
figure_subfolder#
save = True#
show = True#
validate_text_positions = True#
times_ns#
annotations_yaml_path#
plot_experimental_electrical_signal() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes, matplotlib.axes.Axes]#

Plot the experimental electrical signal (voltage and current).

plot_electric_generators_comparison() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]#

Plot the experimental signal vs the trapezoidal generator voltage.

plot_temperatures_electric_field_zoomed() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes, matplotlib.axes.Axes]#

Plot zoomed temperatures, electric field and voltages.

plot_generator_plasma_voltage_zoomed() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes, matplotlib.axes.Axes]#

Plot the generator voltage (zoomed) with a placeholder twin axis.

plot_temperatures_electric_field_full() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes, matplotlib.axes.Axes]#

Plot full-time-range temperatures and plasma voltage.

plot_voltage_current_energy_zoomed() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes, matplotlib.axes.Axes, matplotlib.axes.Axes]#

Plot zoomed plasma voltage, current and cumulated energy.

plot_voltage_current_energy_full() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes, matplotlib.axes.Axes, matplotlib.axes.Axes]#

Plot full-range plasma voltage, current and cumulated energy.

plot_plasma_resistance() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]#

Plot the plasma resistance versus the cable impedance.

plot_electron_density_vs_experiment() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]#

Plot the simulated electron density against experimental data.

plot_species_mole_fractions() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]#

Plot the species mole fractions and the residual ‘Others’ curve.

plot_pressure() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]#

Plot the pressure versus time.

plot_plasma_radius() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]#

Plot the simulated plasma radius against experimental diameters.

plot_density() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]#

Plot the gas density versus time.

plot_acoustic_time() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]#

Plot the acoustic time and crossings of the t=t line.

plot_elastic_inelastic_power_ratio() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]#

Plot the inelastic-to-elastic power ratio with plasma-on shading.

plot_power_repartition() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]#

Plot the power repartition curves (no save in original code).