pyOMA.core.PreProcessingTools.SignalPlot#

class pyOMA.core.PreProcessingTools.SignalPlot(prep_signals)[source]#

Bases: object

__init__(prep_signals)[source]#

Methods

__init__(prep_signals)

plot_correlation([m_lags, channels, ax, ...])

Plots the Cross- and Auto-Correlation sequences of the signals.

plot_psd([n_lines, channels, ax, scale, ...])

Plots the Cross- and Auto-Power-Spectral Density of the signals.

plot_signals([channels, per_channel_axes, ...])

Plot time domain and/or frequency domain signals in various configurations:

plot_svd_spectrum([NFFT, log_scale, ax])

plot_timeseries([channels, ax, scale])

Plots the time histories of the signals

plot_correlation(m_lags=None, channels=None, ax=None, scale='lags', refs=None, plot_kwarg_dict={}, **kwargs)[source]#

Plots the Cross- and Auto-Correlation sequences of the signals. If correlations have not been estimated yet and no method parameter is supplied, Blackman-Tukeys’s method is used, else the most recently used estimation method is employed.

Parameters:
  • m_lags (integer, optional) – Number of lags (positive). Note: this includes the 0-lag, therefore excludes the m_lags-lag.

  • channels (int, list, tuple, np.ndarray) – The channels to plot, may be names, numbers/indices, etc.

  • ax (matplotlib.axes.Axes, optional) – Matplotlib Axes object to plot into

  • scale (str, ['lags','samples']) – Whether to display lag or sample values on the horizontal axis

  • refs ('auto', list-of-indices, optional) – Reference channels to consider for cross-correlations

  • method – The method to use for spectral estimation

  • plot_kwarg_dict – A dictionary to pass arguments to matplotlib.plot

  • **kwargs – Additional kwargs are passed to the spectral estimation method or contain figure/axes formatting options

Returns:

ax – Matplotlib Axes object containing the graphs

Return type:

matplotlib.axes.Axes, optional

Todo

  • correct labeling of channels and axis (using accel_, velo_, and disp_channels)

plot_psd(n_lines=None, channels=None, ax=None, scale='db', refs=None, plot_kwarg_dict={}, **kwargs)[source]#

Plots the Cross- and Auto-Power-Spectral Density of the signals. PSD estimation is performed by default using Welch’s method.

Parameters:
  • n_lines (integer, optional) – Number of frequency lines (positive + negative)

  • channels (int, list, tuple, np.ndarray) – The channels to plot, may be names, indices, etc.

  • ax (matplotlib.axes.Axes, optional) – Matplotlib Axes object to plot into

  • scale (str, ['db', 'power', 'rms', 'svd', 'phase']) – Scaling/Output quantity of the ordinate (value axis)

  • refs ('auto', list-of-indices, optional) – Reference channels to consider for cross-correlations

  • method – The method to use for spectral estimation

  • plot_kwarg_dict – A dictionary to pass arguments to matplotlib.plot

  • **kwargs – Additional kwargs are passed to the spectral estimation method

Returns:

ax – Matplotlib Axes object containing the graphs

Return type:

matplotlib.axes.Axes, optional

Todo

  • correct labeling of channels and axis (using accel_, velo_, and disp_channels)

  • do we need a svd in non-db scale?

  • do we need sample scaling on the abscissa

plot_signals(channels=None, per_channel_axes=False, timescale='time', psd_scale='db', axest=None, axesf=None, plot_kwarg_dict={}, **kwargs)[source]#
Plot time domain and/or frequency domain signals in various configurations:
  1. time history and spectrum of a single channel in two axes -> set channels = [channel] goto 2

  2. time history of multiple channels (all channels or specified) * if axes arguments are not None:must be (tuples, lists, ndarrays) of size = (num_channels,) regardless of the actual figure layout * else: generate axes for each channel and arrange them in lists

    1. time domain overlay in a single axes -> single axes is repeated in the axes list
      1. spectrum overlay in a single axes -> single axes is repeated in the axes list

      2. svd spectrum in a single axes -> needs an additional argument

    2. in multiple axes’ in a grid figure -> axes are generated as subplots
      1. spectrum in multiple axes’ -> axes are generated as subplots

      2. svd spectrum in a single axes -> needs an additional argument

Parameters:
  • channels (None, list-of-int, list-of-str, int, str) – The selected channels (see self._channel_numbers for explanation)

  • per_channel_axes (bool) – Whether to plot all channels into a single or multiple axes

  • timescale (str ['time', 'samples', 'lags']) – Whether to display time, sample or lag values on the horizontal axis ‘lags’ implies plotting (auto)-correlations instead of raw time histories

  • psd_scale (str, ['db', 'power', 'rms', 'svd', 'phase']) – Scaling/Output quantity of the ordinate (value axis)

  • axest (ndarray of size num_channels of matplotlib.axes.Axes objects) – User provided axes objects, into which to plot time domain signals

  • axesf (ndarray of size num_channels of matplotlib.axes.Axes objects) – User provided axes objects, into which to plot spectra

  • plot_kwarg_dict – A dictionary to pass arguments to matplotlib.plot

  • kwargs – Additional kwargs are passed to the spectral estimation method

plot_timeseries(channels=None, ax=None, scale='time', **kwargs)[source]#

Plots the time histories of the signals

Parameters:
  • channels (int, list, tuple, np.ndarray) – The channels to plot, may be names, indices, etc.

  • ax (matplotlib.axes.Axes, optional) – Matplotlib Axes object to plot into

  • scale (str, ['lags','samples']) – Whether to display time or sample values on the horizontal axis

  • kwargs – Additional kwargs are passed to matplotlib.plot

Returns:

ax – Matplotlib Axes object containing the graphs

Return type:

matplotlib.axes.Axes, optional

Todo

  • correct labeling of channels and axis (using accel_, velo_, and disp_channels)