fitbenchmarking.results_processing.base_table module

Implements the base class for the tables.

class fitbenchmarking.results_processing.base_table.Table(results, best_results, options, group_dir, pp_locations, table_name)

Bases: object

Base class for the FitBenchmarking HTML and text output tables.

colour_highlight(value, colour)

Takes the HTML colour values from get_colour() and maps it over the HTML table using the Pandas style mapper.

Parameters:
  • value (pandas.core.series.Series) – Row data from the pandas array
  • colour (dict) – dictionary containing error codes from the minimizers
Returns:

list of HTML colours

Return type:

list

create_pandas_data_frame(str_results)

Converts dictionary of results into a pandas data frame

Parameters:str_results (dict) – dictionary containing the string representation of the values in the table.
Returns:pandas data frame with from results
Return type:Pandas DataFrame
create_results_dict()

Generates a dictionary used to create HTML and txt tables.

Returns:dictionary containing results where the keys are the problem sets and the values are lists of results objects
Return type:dictionary
display_str(results)

Function which converts the results from get_values() into a string respresentation to be used in the tables. Base class implementation takes the absolute and relative values and uses self.output_string_type as a template for the string format. This can be overwritten to adequately display the results.

Parameters:results (tuple) – tuple containing absolute and relative values
Returns:dictionary containing the string representation of the values in the table.
Return type:dict
enable_error(value, error, template)

Enable error codes in table

Parameters:
  • value (pandas.core.series.Series) – Row data from the pandas array
  • error (dict) – dictionary containing error codes from the minimizers
Returns:

Row data from the pandas array with error codes enabled

Return type:

pandas.core.series.Series

Enable HTML links in values

Parameters:
  • value (pandas.core.series.Series) – Row data from the pandas array
  • links (dict) – dictionary containing links to the support pages
Returns:

Row data from the pandas array with links enabled

Return type:

pandas.core.series.Series

file_path

Getter function for the path to the table

Returns:path to table
Return type:str
get_colour(results)

Converts the result from get_values() into the HTML colours used in the tables. The base class implementation, for example, uses the relative results and colour_scale within Options.

Parameters:results (tuple) – tuple containing absolute and relative values
Returns:dictionary containing HTML colours for the table
Return type:dict
get_description(html_description)

Generates table description from class docstrings and converts them into html

Parameters:html_description (dict) – Dictionary containing table descriptions
Returns:Dictionary containing table descriptions
Return type:dict
get_error(results_dict)

Pulls out error code from the results object

Parameters:results (tuple) – tuple containing absolute and relative values
Returns:dictionary containing error codes from the minimizers
Return type:dict

Pulls out links to the individual support pages from the results object

Parameters:results (tuple) – tuple containing absolute and relative values
Returns:dictionary containing links to the support pages
Return type:dict
get_values(results_dict)

Gets the main values to be reported in the tables

Parameters:results_dict (dictionary) – dictionary containing results where the keys are the problem sets and the values are lists of results objects
Returns:tuple of dictionaries which contain the main values in the tables
Return type:tuple
table_title

Getter function for table name if self._table_title is None

Returns:name of table
Return type:str
to_html(table, colour, links, error)

Takes Pandas data frame and converts it into the HTML table output

Parameters:
  • table (Pandas DataFrame) – pandas data frame with from results
  • colour (dict) – dictionary containing error codes from the minimizers
  • links (dict) – dictionary containing links to the support pages
  • error (dict) – dictionary containing error codes from the minimizers
Returns:

HTLM table output

Return type:

str

to_txt(table, error)

Takes Pandas data frame and converts it into the plain text table output

Parameters:
  • table (Pandas DataFrame) – pandas data frame with from results
  • error (dict) – dictionary containing error codes from the minimizers
Returns:

plain text table output

Return type:

str