User Interface

seeq.addons.correlation._heatmap.heatmap(df, max_time_shift='auto', output_values='coeffs', output_type='plot', time_output_unit='auto', bypass_preprocessing=False)[source]

Creates a heatmap plot of the cross-correlation coefficients between signals. The signals can be allowed to shift in time to find the maximum cross-correlation between signals.

Alternatively, a heatmap of the time shifts to maximize correlation of signals can be plotted as well.

Parameters:
  • df (pandas.DataFrame) – A DataFrame that contains a set of signals as columns and date-time as the index.

  • max_time_shift ({'auto', str, None}, default 'auto') – Maximum time (e.g. ’15s’, or ‘1min’) that the signals are allowed to slide in order to maximize cross-correlation. For times specified as a str, normal time units are accepted.If ‘auto’ is selected, a default maximum time shift is calculated based on the number of samples. If None, the raw signals are used and no time shifts are calculated.

  • output_values ({'coeffs', 'time_shifts'}, default 'coeffs') – Values to plot in the heatmap. Either the Pearson’s coefficients or the time shifts that the signals were shifted to maximize cross-correlation.

  • output_type ({'plot', 'table'}, default 'plot') – The heatmap can be outputted either as an (interactive) plot or as a DataFrame

  • time_output_unit ({'auto', str} default 'auto') – Specifies the time unit used to display the time shifts. Valid units are the ones accepted by pd.Timedelta

  • bypass_preprocessing (bool, default False) – Whether the data pre-processing routine is by-passed or not. Setting it to True is not recommended unless the data has been pre-processed elsewhere.

Returns:

  • Either one of the following

  • - (None) – Displays a Plotly figure with either Pearson’s coefficients or signal time shifts

  • table (pandas.DataFrame) – A DataFrame with either Pearson’s coefficients or times_shifts of all signal pairs

Examples

Create a heatmap plot of the cross-correlation coefficients for the signals in a DataFrame allowing for automatic guess of maximum time shifts

>>> seeq.addons.correlation.heatmap(df,
>>>                              max_time_shift='auto',
>>>                              output_values='coeffs',
>>>                              output_type='plot')

Create a heatmap plot of the cross-correlation coefficients for the signals in a DataFrame specifying a maximum time shift between signals of 1 hour

>>> seeq.addons.correlation.heatmap(df,
>>>                              max_time_shift='1h',
>>>                              output_values='coeffs',
>>>                              output_type='plot')

Create a table of the time shifts to maximize cross-correlation of the signals in a DataFrame specifying a maximum time shift between signals of 1 hour

>>> seeq.addons.correlation.heatmap(df,
>>>                              max_time_shift='1h',
>>>                              output_values='time_shifts',
>>>                              output_type='table')

Create a table of the cross-correlation coefficients for the signals in a DataFrame using the raw data (no time shift allowed)

>>> seeq.addons.correlation.heatmap(df,
>>>                              max_time_shift=None,
>>>                              output_values='coeffs',
>>>                              output_type='table')
seeq.addons.correlation._pairplot.pairplot(df, max_time_shift='auto', bypass_preprocessing=False)[source]

Creates a n x n matrix of static plots for the n-signals in the input dataframe with histograms in the diagonal of the matrix and density contour plots in the off-diagonal locations.

The signals can be allowed to slide among each other to find the best cross-correlation between signals.

Parameters:
  • df (pandas.DataFrame) – A DataFrame that contains a set of signals as columns and date-time as the index.

  • max_time_shift ({'auto', str, None}, default 'auto') – Maximum time (e.g. ’15s’, or ‘1min’) that the signals are allowed to slide in order to maximize cross-correlation. For times specified as a str, normal time units are accepted. If ‘auto’ is selected, a default maximum time shift is calculated based on the number of samples. If None, the raw signals are used and no time shifts are calculated.

  • bypass_preprocessing (bool, default False) – Whether the data pre-processing routine is by-passed or not. Setting it to True is not recommended unless the data has been pre-processed elsewhere.

Returns:

- – Displays a Plotly figure in Seeq DataLab with plots arrange in a n x n matrix.

Return type:

None

Examples

Create a plot matrix plot from the signals in the DataFrame allowing for automatic guess of maximum time shifts

>>> seeq.addons.correlation.pairplot(df, max_time_shift='auto')

Create a plot matrix plot from the signals in the DataFrame specifying a maximum time shift between signals of 1 hour

>>> seeq.addons.correlation.pairplot(df, max_time_shift='1h')

Create a plot matrix plot from the signals in the DataFrame using the raw data (no time shift allowed)

>>> seeq.addons.correlation.pairplot(df, max_time_shift=None)
class seeq.addons.correlation._seeq_add_on.CorrelationHeatmap(sdl_notebook_url=None, df=None, datasource=None, seeq_url=None)[source]

Bases: object

This is the main class for the User Interface of the Correlation Add-on. To create an instance, either a Seeq Data Lab project URL with appropriate query parameters or pd.DataFrame must be passed. If a pd.DataFrame is passed, the functionality to push data back to the Seeq server is disabled.

class seeq.addons.correlation._seeq_add_on.CreateSignalsMenu(**kwargs)[source]

Bases: Dialog

This class creates an ipyvuetify Dialog window with the options required to create correlation and time shifted signals in Seeq

class seeq.addons.correlation._seeq_add_on.HamburgerMenu(**kwargs)[source]

Bases: Menu

This class creates the hamburger menu (with its options) used in the top-right corner of the Correlation Add-on.

class seeq.addons.correlation._seeq_add_on.ToggleButtons(**kwargs)[source]

Bases: BtnToggle

This is an auxiliary class to generate toggle buttons with a specific style and including a tooltip