trappy.stats.Aggregator module

Aggregators are responsible for aggregating information for further analysis. These aggregations can produce both scalars and vectors and each aggregator implementation is expected to handle its “aggregation” mechanism.

class trappy.stats.Aggregator.AbstractAggregator(indexer, aggfunc=None)[source]

Bases: object

Abstract class for all aggregators

Parameters:
  • indexer (trappy.stats.Indexer.Indexer) – Indexer is passed on by the Child class for handling indices during correlation
  • aggfunc (function) – Function that accepts a pandas.Series and process it for aggregation.
aggregate(trace_idx, **kwargs)[source]

Abstract Method for aggregating data for various pivots.

Parameters:trace_idx (int) – Index of the trace to be aggregated
Returns:The aggregated result
class trappy.stats.Aggregator.MultiTriggerAggregator(triggers, topology, aggfunc=None)[source]

Bases: trappy.stats.Aggregator.AbstractAggregator

This aggregator accepts a list of triggers and each trigger has a value associated with it.

aggregate(**kwargs)[source]

Aggregate implementation that aggregates triggers for a given topological level. All the arguments passed to it are forwarded to the aggregator function except level (if present)

Returns:A scalar or a vector aggregated result. Each group in the level produces an element in the result list with a one to one index correspondence
groups["level"] = [[1,2], [3,4]]
result = [result_1, result_2]