MCPcopy Create free account
hub / github.com/LabPy/lantz / stats

Function stats

lantz/stats.py:18–33  ·  view source on GitHub ↗

Return the statistics for given state. :param state: state :type state: RunningState :return: statistics :rtype: Stats named tuple

(state)

Source from the content-addressed store, hash-verified

16
17
18def stats(state):
19 """Return the statistics for given state.
20
21 :param state: state
22 :type state: RunningState
23 :return: statistics
24 :rtype: Stats named tuple
25
26 """
27 if not state.count:
28 return Stats(0, 0, 0, 0, 0, 0)
29
30 mean = state.sum / state.count
31 std = (float(state.sum2 - 2.0 * state.sum * mean + state.count * mean ** 2.0) / float(state.count)) ** 0.5
32 return Stats(state.last, state.count,
33 mean, std, state.min, state.max)
34
35
36class RunningState(object):

Callers 1

statsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected