lab_driver.plots#

Module Contents#

Functions#

get_plot_color

Getting the color string

get_font_size

Getting the font size for paper work

get_plot_marker

Getting the marker for plotting

save_figure

Saving figure in given format Args: fig: Matplot which will be saved path: Path for saving the figure name: Name of the plot formats: List with data formats for saving the figures Returns: None

scale_auto_value

Getting the scaling value and corresponding string notation for unit scaling in plots Args: data: Array or value for calculating the SI scaling value Returns: Tuple with [0] = scaling value and [1] = SI pre-unit

plot_transfer_function_norm

Function for plotting the transfer function

plot_transfer_function_metric

Function for plotting the metric, extracted from the transfer function

plot_spectral_data

Plotting the spectral data, measured with R&S MXO44

plot_fra_data

Plotting the data from Frequency Response Analysis (FRA) using R&S MXO44

plot_transient_data

API#

lab_driver.plots.get_plot_color(idx: int) str[source]#

Getting the color string

lab_driver.plots.get_font_size() int[source]#

Getting the font size for paper work

lab_driver.plots.get_plot_marker(idx: int) str[source]#

Getting the marker for plotting

lab_driver.plots.save_figure(fig, path: str, name: str, formats: list = ('pdf', 'svg')) None[source]#

Saving figure in given format Args: fig: Matplot which will be saved path: Path for saving the figure name: Name of the plot formats: List with data formats for saving the figures Returns: None

lab_driver.plots.scale_auto_value(data: numpy.ndarray | float) [float, str][source]#

Getting the scaling value and corresponding string notation for unit scaling in plots Args: data: Array or value for calculating the SI scaling value Returns: Tuple with [0] = scaling value and [1] = SI pre-unit

lab_driver.plots.plot_transfer_function_norm(data: dict, path2save: str = '', xlabel: str = 'Stimulus Input', ylabel: str = 'Stimulus Output', title: str = 'Transfer Function', file_name: str = '', show_plot: bool = True) None[source]#

Function for plotting the transfer function

Parameters:
  • data – Dictionary with extracted values from measurement data

  • path2save – Path for saving the figure

  • xlabel – Text Label for x-axis

  • ylabel – Text Label for y-axis

  • title – Text Label for title

  • file_name – File name of the saved figure

  • show_plot – Boolean for showing the plot

Returns:

None

lab_driver.plots.plot_transfer_function_metric(data: dict, func: object, path2save: str = '', xlabel: str = 'Stimulus Input', ylabel: str = 'Stimulus Output', title: str = 'Transfer Function', file_name: str = '') None[source]#

Function for plotting the metric, extracted from the transfer function

Parameters:
  • data – Dictionary with pre-processed data from measurement with keys: [‘stim’, ‘ch’: {‘mean’, ‘std’}}

  • func – Function for calculating the metric

  • path2save – Path for saving the figure

  • xlabel – Text Label for x-axis

  • ylabel – Text Label for y-axis

  • title – Text Label for title

  • file_name – File name of the saved figure

Returns:

None

lab_driver.plots.plot_spectral_data(data: dict, N_harmonics: int = 6, file_name: str = '', path2save: str = '', delta_peaks: int = 20, show_peaks: bool = True, show_plot: bool = True, is_input_db: bool = True) None[source]#

Plotting the spectral data, measured with R&S MXO44

Parameters:
  • data – Dictionary with spectral data from measurement

  • N_harmonics – Number of harmonics for calculation and plot

  • file_name – File name of the saved figure

  • path2save – Path for saving the figure

  • delta_peaks – Number of positions around the peaks

  • show_peaks – Boolean for highlighting the harmonics

  • show_plot – Boolean for showing the plot

  • is_input_db – Boolean for whether the data is logarithmic [dB]

Returns:

None

lab_driver.plots.plot_fra_data(data: dict, file_name: str = '', path2save: str = '', show_plot: bool = True) None[source]#

Plotting the data from Frequency Response Analysis (FRA) using R&S MXO44

Parameters:
  • data – Dictionary with measured data from device

  • file_name – File name of the saved figure

  • path2save – Path for saving the figure

  • show_plot – Boolean for showing the plot

lab_driver.plots.plot_transient_data(data: dict, file_name: str = '', path2save: str = '', show_plot: bool = False, xzoom: list = [0, -1]) None[source]#