pyresiflex.misc.plot#

Attributes#

Functions#

set_mpl_style(→ None)

Set the matplotlib style for plots.

save_figure(→ None)

Save a matplotlib figure to ./figures/<name>.

plot_voltage_current(voltage_time, voltage_value, ...)

Plot voltage and current signals on the same time axis.

Module Contents#

pyresiflex.misc.plot.set_mpl_style(nb_columns: int = 2) None#

Set the matplotlib style for plots.

Parameters:

nb_columns (int, optional) – Number of columns for the figure style. Options are 1 or 2. By default 2.

pyresiflex.misc.plot.save_figure(fig: matplotlib.figure.Figure, name: str, dpi: int = 300) None#

Save a matplotlib figure to ./figures/<name>.

Parameters:
  • fig (matplotlib.figure.Figure) – The matplotlib figure to save.

  • name (str) – The file name.

  • dpi (int, optional) – The resolution in dots per inch. By default 300.

pyresiflex.misc.plot.converted_units_time#
pyresiflex.misc.plot.converted_units_voltage#
pyresiflex.misc.plot.converted_units_current#
pyresiflex.misc.plot.plot_voltage_current(voltage_time: numpy.ndarray, voltage_value: numpy.ndarray, current_time: numpy.ndarray, current_value: numpy.ndarray, fig_axes: tuple[matplotlib.figure.Figure, matplotlib.axes.Axes, matplotlib.axes.Axes] | None = None, show: bool = False, voltage_time_unit: str = 'ns', current_time_unit: str = 'ns', voltage_value_unit: str = 'kV', current_value_unit: str = 'A')#

Plot voltage and current signals on the same time axis.

Parameters:
  • voltage_time (numpy.ndarray) – Time values for the voltage signal.

  • voltage_value (numpy.ndarray) – Voltage signal values.

  • current_time (numpy.ndarray) – Time values for the current signal.

  • current_value (numpy.ndarray) – Current signal values.

  • fig_axes (tuple of matplotlib.figure.Figure, matplotlib.axes.Axes, matplotlib.axes.Axes or None, optional) – A tuple containing the figure and two axes (one for voltage and one for current). If None, a new figure and axes are created. By default None

  • show (bool, optional) – Whether to display the plot immediately. By default False

  • voltage_time_unit (str, optional) – Unit for the voltage time axis. Options are ‘s’, ‘ms’, ‘us’, ‘ns’, ‘ps’. By default “ns”

  • current_time_unit (str, optional) – Unit for the current time axis. Options are ‘s’, ‘ms’, ‘us’, ‘ns’, ‘ps’. By default “ns”

  • voltage_value_unit (str, optional) – Unit for the voltage values. Options are ‘V’, ‘mV’, ‘kV’. By default “kV”

  • current_value_unit (str, optional) – Unit for the current values. Options are ‘A’, ‘mA’, ‘kA’. By default “A”

Returns:

The figure and the two axes (one for voltage and one for current).

Return type:

tuple of matplotlib.figure.Figure, matplotlib.axes.Axes, matplotlib.axes.Axes