lantz.stats

Implements an statistical accumulator

copyright:2015 by Lantz Authors, see AUTHORS for more details.
license:BSD, see LICENSE for more details.
class lantz.stats.RunningState(value=None)[source]

Accumulator for events.

Parameters:value – first value to add.
add(value)[source]

Add to the accumulator.

Parameters:value – value to be added.
class lantz.stats.RunningStats[source]

Accumulator for categorized event statistics.

add(key, value)[source]

Add an event to a given accumulator.

Parameters:
  • key – category to which the event should be added.
  • value – value of the event.
stats(key)[source]

Return the statistics for the current accumulator.

Return type:Stats.
class lantz.stats.Stats(last, count, mean, std, min, max)

Data structure

count

Alias for field number 1

last

Alias for field number 0

max

Alias for field number 5

mean

Alias for field number 2

min

Alias for field number 4

std

Alias for field number 3

lantz.stats.stats(state)[source]

Return the statistics for given state.

Parameters:state (RunningState) – state
Returns:statistics
Return type:Stats named tuple