Adding further Tables¶
The tables that are currently supported are listed in FitBenchmarking Output. In order to add a new table, you will need to:
Give the table a name
<table_name>
. This will be used by users when selecting this output from FitBenchmarking.Create
fitbenchmarking/results_processing/<table_name>_table.py
which contains a new subclass ofTable
. The main functions to change are:-
Table.
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.
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 usesself.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
-
Additional functions to be changed are:
-
Table.
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 andcolour_scale
withinOptions
.Parameters: results (tuple) – tuple containing absolute and relative values Returns: dictionary containing HTML colours for the table Return type: dict
-
-
Table.
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
-
Extend the
table_type
option inPLOTTING
following the instructions in Adding new Options.Document the new table class is by setting the docstring to be the description of the table, and add to FitBenchmarking Output.
Create tests for the table in
fitbenchmarking/results_processing/tests/test_tables.py
. This is done by generating, ahead of time using the results problems constructed infitbenchmarking/results_processing/tests/test_tables.generate_mock_results
, both a HTML and text table output as the expected result and adding the new table name to the global variableSORTED_TABLE_NAMES
. This will automatically run the comparison tests for the tables.