statistics
— Statistics module¶
StatisticsManager
reference¶
Statistics manager is a reporting tool, surfacing basic metrics of kaa engine. To get the statistics manager instance use the
get_global_statistics_manager()
method.
class MyScene(Scene):
def __init__(self):
self.stats_manager = get_global_statistics_manager()
def update(self, dt):
self.stats_manager.push_value('custom statistic', random.gauss(10, 2))
print(self.stats_manager.get_last_all())
print(self.stats_manager.get_analysis_all())
-
class
statistics.
StatisticsManager
¶
Instance methods:
-
StatisticsManager.
get_last_all
()¶ Returns the last value of each metric. Returned is a list of tuples in form of (‘statistic name’, value)
-
StatisticsManager.
get_analysis_all
()¶ Returns aggregated metric data. Returned is a list of tuples in form of (‘statistic name’, <StatisticAnalysis instance>). Check out
StatisticAnalysis
for more information.
-
StatisticsManager.
push_value
(stat_name, value)¶ Allows to push your own custom statistic.
stat_name
must be a string, andvalue
must be a double. Your custom statistic will be reported byget_last_all()
andget_analysis_all()
methods.
StatisticAnalysis
reference¶
-
class
statistics.
StatisticAnalysis
¶ The
StatisticAnalysis
object wraps statistical properties of a larger sample of measurmenets.
Instance properties:
-
StatisticAnalysis.
samples_count
¶ Size of a sample.
-
StatisticAnalysis.
last_value
¶ The most recent value.
-
StatisticAnalysis.
mean_value
¶ The mean value.
-
StatisticAnalysis.
standard_deviation
¶ The standard deviation.
-
StatisticAnalysis.
max_value
¶ The maximum value.
-
StatisticAnalysis.
min_value
¶ The minimum value.
get_global_statistics_manager()
reference¶
-
statistics.
get_global_statistics_manager
()¶ A method to get the
StatisticsManager
instance.