trappy.stats.Correlator module

The module responsible for correlation and related functionality

class trappy.stats.Correlator.Correlator(first, second, **kwargs)[source]

Bases: object

Class that allows to align and correlate two traces :param first: First Aggregator :type first: trappy.stats.Aggregator

Parameters:second (trappy.stats.Aggregator) – Second Aggregator
correlate(level, resample=True)[source]

This function returns the correlation between two traces

Parameters:
  • level (str) – The level at which the correlation is required
  • resample (bool) – Resample data
Returns:

A normalized correlation value is returned for each group in the level

plot(level, per_line=3)[source]

Temporary function to plot data. Expected to be implemented in plotter

Parameters:
  • level (str) – Topological Level (level in trappy.stats.Topology)
  • per_line (int) – Number of plots per line
trappy.stats.Correlator.align(s_x, s_y, mode='front')[source]

Function to align the input series

Parameters:
  • s_x (pandas.Series) – First Series
  • s_y (pandas.Series) – Second Series
  • mode (str) – Align Front/Back
trappy.stats.Correlator.shift_series(s_x, s_y, shift)[source]

Shift series to align :param s_x: First Series :type s_x: pandas.Series

Parameters:
  • s_y (pandas.Series) – Second Series
  • shift (int) – The number of index positions to be shifted