fitbenchmarking.results_processing.local_min_table module

compare table

class fitbenchmarking.results_processing.local_min_table.LocalMinTable(results, best_results, options, group_dir, pp_locations, table_name)

Bases: fitbenchmarking.results_processing.base_table.Table

The local min results shows a True or False value together with \(\frac{|| J^T r||}{||r||}\). The True or False indicates whether the software finds a minimum with respect to the following criteria:

  • \(||r|| \leq\) RES_TOL,

  • \(|| J^T r|| \leq\) GRAD_TOL,

  • \(\frac{|| J^T r||}{||r||} \leq\) GRAD_TOL,

where \(J\) and \(r\) are the Jacobian and residual of \(f(x, p)\), respectively. The tolerances can be found in the results object.

display_str(value)

Combine the boolean value from variable local_min with the normalised residual

Parameters

value (bool, float) – Whether the minimizer found a local minimizer and the \(\frac{|| J^T r||}{||r||}\) value

Returns

string representation of the value for display in the table.

Return type

str

get_description()

Generates table description from class docstrings and converts them into html

Returns

Dictionary containing table descriptions

Return type

dict

classmethod get_error_str(result, *args, **kwargs)

Get the error string for a result based on error_template This can be overridden if tables require different error formatting.

Parameters

result (FittingResult) – The result to get the error string for

Returns

A string representation of the error

Return type

str

get_value(result)

Gets the main value to be reported in the tables for a given result

Note that the first value (relative accuracy) will be used in the default colour handling.

Parameters

result (FittingResult) – The result to generate the values for.

Returns

Whether the minimizer found a local minimizer (under the tests specified above) and \(\frac{|| J^T r||}{||r||}\)

Return type

bool, float

save_colourbar(fig_dir, n_divs=2, sz_in=None) str

Override default save_colourbar as there are only 2 possible divisions of the colour map (true or false).

Parameters
  • fig_dir (str) – path to figures directory

  • n_divs (int, Fixed to 2) – Unused number of divisions of shading in colourbar

  • sz_in (list[float] - 2 elements) – dimensions of png in inches [width, height]

Returns

The relative path to the colourbar image.

Return type

str

static vals_to_colour(vals, cmap, cmap_range, log_ulim)

Converts an array of values to a list of hexadecimal colour strings using sampling from a matplotlib colourmap according to whether a minimum was found.

Set to the bottom of the range if minimum was found, otherwise set to the top of the range.

Parameters
  • vals (list[float]) – values in the range [0, 1] to convert to colour strings

  • cmap (matplotlib colourmap object) – matplotlib colourmap

  • cmap_range (list[float], 2 elements) – values in range [0, 1] for colourmap cropping

  • log_ulim (float) – Unused log10 of worst shading cutoff value

Returns

Colours as hex strings for each input value and Foreground colours for the text as html rgb strings e.g. ‘rgb(255, 255, 255)’

Return type

tuple[list[str], list[str]]