Seeq Interactions

seeq.addons.correlation.utils._sdl.pull_only_signals(url, grid='auto')[source]

Pull only the signals shown in the display pane of a Seeq Analysis Worksheet. The time range used for the pull will be taken from the display range in the worksheet. Conditions will be disregarded.

Parameters:
  • url (str) – The url of a Seeq worksheet. On

  • grid (str) – The grid of the data pull used in spy.pull

Returns:

df – A dataframe with signal data of the worksheet

Return type:

pd. DataFrame

seeq.addons.correlation._seeq_worksheet_writer.create_worksheet(df, target, max_time_shift='auto', metadata=None, workbook='Correlation >> Correlation Analysis', worksheet='From Correlation', datasource=None, overwrite=False, api_client=None, include_original_signals=False, suffix='', new_condition=True, bypass_preprocessing=False)[source]

Creates a new Seeq worksheet with the signals from the dataframe column names, including the time shifted signals based on the time shifts calculated to maximize cross-correlation. This function can append or overwrite the worksheet if it already exists.

Parameters:
  • df (pandas.DataFrame) – The dataframe containing the signals and target that will be included in the worksheet.

  • target (str) – Name of the signal (from DataFrame column names) to be used as a target to maximize cross-correlation. All other signals in the dataframe will be time shifted with respect to the target to maximize cross-correlations.

  • max_time_shift ({'auto', str, None}, default 'auto') – Maximum time (e.g. ’15s’, or ‘1min’) that the signals are allowed to slide in time 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.

  • metadata (pandas.DataFrame, default None) – A dataframe with at least two columns: Name and ID. This dataframe is typically the output of the spy.search() function. If the dataframe was obtained with spy.pull, the metadata is already stored in the property ‘spy.query_df’. If that is the case this metadata parameter might be omitted.

  • workbook ({str, None}, default 'Correlation >> Correlation Analysis') – The path to a workbook (in the form of ‘Folder >> Path >> Workbook Name’) or an ID that all pushed items will be ‘scoped to’. Items scoped to a certain workbook will not be visible/searchable using the data panel in other workbooks. The ID for a workbook is visible in the URL of Seeq Workbench, directly after the “workbook/” part.

  • worksheet (str, default 'from Correlation') – The name of a worksheet within the workbook to create/update that will render the signals that are been pushed with their respective time shifted signals based on maximum cross-correlations.

  • datasource (str, optional) – The name of the datasource within which to contain all the pushed items. By default, all pushed items will be contained in a “Seeq Data Lab” datasource. Do not create new datasources unless you really want to and you have permission from your administrator.

  • overwrite (bool) – Whether the worksheet is overwritten if already exists.

  • api_client ({spy.client, None}, default None) – API client use for authentication with the Seeq server

  • include_original_signals (bool, default True) – Whether the worksheet will include the original signals along with the shifted signals with respect to a target or only the shifted signals.

  • suffix (str, default to "") – Suffix added to the shifted signals tha will be created

  • new_condition (bool) – True if a new condition with one capsule for the analysis time range will be created

  • 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:

- – Creates a Seeq worksheet with the signals in the DataFrame and the lagged signals to maximize cross correlations

Return type:

None

seeq.addons.correlation._seeq_worksheet_writer.worksheet_corrs_and_time_shifts(signal_pairs_ids: list, workbook_id: str, worksheet_name: str, start_time: str, end_time: str, corr_coeff_signals=True, time_shifted_for_correlation=True, output_time_unit=None, max_time_shift=None, suffix='', time_shifts_signals=True, window_size=None, period=None, corr_thrs=0.5, condition_id=None, overwrite=True, api_client=None, datasource=None)[source]

Creates a new Seeq worksheet with the either the cross-correlation coefficient signals or the time shifted signals to maximize cross- correlation, or both, for each pair of signals passed to the function. It can append or overwrite the worksheet if it already exists.

Parameters:
  • signal_pairs_ids (list) – List of two-item tuples. The items of each tuple are a Seeq signal ID. Each pair of signals is used to compute the cross-correlation coefficient and, if requested, the time shift to maximize the correlation coefficient.

  • workbook_id (str) – The ID of the Seeq workbook that the resulting signals will be scoped to.

  • worksheet_name (str) – The name of the Seeq worksheet that will be created to display the resulting signals.

  • start_time (str) – The start time for the display range of the worksheet.

  • end_time (str) – The end time for the display range of the worksheet.

  • corr_coeff_signals (bool, default True) – Whether a cross-correlation signal for each input signal pair will be calculated.

  • time_shifted_for_correlation (bool, default True) – Whether to allow time shift that maximizes cross-correlation of each input signal pair. This option will not push a time shift signal to the Seeq server. It simply allows a time shift calculation behind the scenes to calculate the maximum correlation coefficient within the allowable max_time_shift.

  • output_time_unit ({str, None}, default None) – The time unit of the output time shifted signal

  • max_time_shift ({str, None}, default None) – Maximum allowable time shift to maximize cross-correlations of each input signal pair.

  • suffix (str, default '') – Suffix added to the names of the resulting signals

  • time_shifts_signals (bool, default True) – Whether to calculate a time shifted signal that maximizes cross- correlation of each input signal pair.

  • window_size ({str, None}, default None) – Size (timeframe) of the rolling window used for the calculations.

  • period ({str, None}, default None) – Spacing between rolling windows used for the calculations

  • corr_thrs (float, default 0.5) – The minimum acceptable correlation coefficient value for a time shift to be valid. When the correlation coefficient is below this threshold, the corresponding time shift value will not be considered for the final offset. Choose a threshold value between 0-1.

  • condition_id ({str, None}, default None) – Seeq condition ID used to tag the analysis

  • overwrite (bool, default True) – Overwrite the current worksheet

  • api_client (spy.client, default None) – Authenticated Seeq client

  • datasource ({str, None}, default None) – The name of the datasource within which to contain all the pushed items. Do not create new datasources unless you really want to and you have permission from your administrator.

Returns:

url – The URL of the Seeq Worksheet where the correlation and time shifted signals are displayed.

Return type:

str

seeq.addons.correlation._seeq_formulas.correlation_udfs(api_client)[source]

This function creates Cross Correlation package of User Defined Functions in the Seeq server. Once installed, these formula functions can be used either standalone in the Seeq server, or called by the Correlation Analysis Add-On for more interactive calculations

Parameters:

api_client (spy.client, default None) – Authenticated Seeq client

Returns:

package.id – The ID of the Seeq UDF package

Return type:

str