helpers.stats_helper module

filter_stats(stats, comm=None, recomputed=None, **kwargs)[source]

Helper function to extract data from the dictionary of statistics. Please supply metadata as keyword arguments.

Parameters:
  • stats (dict) – raw statistics from a controller run

  • recomputed (bool) – filter recomputed values from stats if set to anything other than None

  • comm (mpi4py.MPI.Intracomm) – Communicator (or None if not applicable)

Returns:

dictionary containing only the entries corresponding to the filter

Return type:

dict

get_list_of_types(stats)[source]

Helper function to get list of types registered in stats

Parameters:

stats (dict) – dictionary with statistics

Returns:

list of types registered

Return type:

list

get_sorted(stats, sortby='time', **kwargs)[source]

Utility for filtering and sorting stats in a single call. Pass a communicator if using MPI. Keyword arguments are passed to filter_stats for filtering.

stats (dict): raw statistics from a controller run sortby (str): string to specify which key to use for sorting

Returns:

list of tuples containing the sortby item and the value

Return type:

list

sort_stats(stats, sortby)[source]

Helper function to transform stats dictionary to sorted list of tuples

Parameters:
  • stats (dict) – dictionary of statistics

  • sortby (str) – string to specify which key to use for sorting

Returns:

list of tuples containing the sortby item and the value

Return type:

list