fitbenchmarking.cli.checkpoint_handler module

This is a command line tool for handling checkpoint files for the FitBenchmarking software package. For more information on usage type fitbenchmarking –help or for more general information, see the online docs at docs.fitbenchmarking.com.

fitbenchmarking.cli.checkpoint_handler.generate_report(options_file='', additional_options=None, debug=False)

Generate the fitting reports and tables for a checkpoint file.

Parameters:
  • options_file (str, optional) – Path to an options file, defaults to ‘’

  • additional_options (dict, optional) –

    Extra options for the reporting. Available keys are:

    filename (str): The checkpoint file to use.

fitbenchmarking.cli.checkpoint_handler.get_parser() ArgumentParser

Creates and returns a parser for the args.

Returns:

Configured argument parser

Return type:

ArgumentParser

fitbenchmarking.cli.checkpoint_handler.main()

Entry point exposed as the fitbenchmarking-cp command.

fitbenchmarking.cli.checkpoint_handler.merge(A, B, strategy)

Merge the results from A and B This function can corrupt A and B, they should be discarded after calling.

Parameters:
  • A (dict[str, list[FittingResult]]) – The first set of results to merge

  • B (dict[str, list[FittingResult]]) – The set to merge into A

  • strategy (str) – The strategy to use to merge the results

Returns:

The merged checkpoint data.

Return type:

dict[str, any]

fitbenchmarking.cli.checkpoint_handler.merge_data_sets(files: list[str], output: str, strategy: str = 'first', debug: bool = False)
Combine multiple checkpoint files into one following these rules:
  1. The output will be the same as combining them one at a time in sequence. i.e. A + B + C = (A + B) + C The rules from here on will only reference A and B as the relation is recursive.

  2. Datasets

    2a) Datasets in A and B are identical if they agree on the label 2b) If A and B contain identical datasets, the problems and results

    are combined as below. The remainder of these rules assume that A and B are identical datasets as the alternative is trivial.

  3. Problems
    3a) If problems in A and B agree on name, ini_params, ini_y, x, y,

    and e then these problems are considered identical.

    3b) If A and B share identical problems, the details not specified in

    3a are taken from A.

    3c) If problems in A and B are not identical but share a name, the

    name of the project in B should be updated to “<problem_name>*”.

  4. Results
    4a) If results in A and B have identical problems and agree on name,

    software_tag, minimizer_tag, jacobian_tag, hessian_tag, and costfun_tag they are considered identical.

    4b) If A an B share identical results, the details not specified in 4a

    are taken from A if strategy is ‘first’, or B if strategy is ‘last’.

  5. As tables are grids of results, combining arbitrary results can lead to un-table-able checkpoint files. This occurs when the problems in A and B are not all identical and the set of combinations of software_tag, minimizer_tag, jacobian_tag, hessian_tag, and costfun_tag for which there are results in each of A and B are not identical. E.g. B has a problem not in A and uses a minimizer for which there are

    no results in A.

    5a) If the resulting checkpoint file would have the above issue, the

    checkpoints are incompatible.

    5b) Incompatible checkpoint files can be combined but should raise

    warnings and mark the dataset in the checkpoint file. Note: Some datasets may be incompatible where others can be

    successfully combined.

  6. Unselected minimizers and failed problems will be discarded when combining.

Parameters:
  • files (list[str]) – The files to combine.

  • output (str) – The name for the new checkpoint file.

  • strategy (str) – The stategy for merging identical elements. Options are ‘first’ or ‘last’.

  • debug (bool) – Enable debugging output.

fitbenchmarking.cli.checkpoint_handler.merge_problems(A: dict[str, dict], B: dict[str, dict])

Merge the problem sections of 2 checkpoint files. If problems have matching names but different values, the problem from B will be suffixed with a “*”.

In some cases this could lead to problems with several “*”s although this seems unlikely for most use cases.

Parameters:
  • A (dict[str, dict]) – The first checkpoint problems dict to merge

  • B (dict[str, dict]) – The second checkpoint problems dict to merge

Returns:

The merged checkpoint problems and a list of problems that have been renamed

Return type:

tuple[dict[str, dict[str, any]], list[str]]

fitbenchmarking.cli.checkpoint_handler.merge_results(A: list[dict], B: list[dict], strategy: str)

Merge the results sections of 2 checkpoint files.

Parameters:
  • A (list[dict[str, any]]) – The first checkpoint results list to merge

  • B (list[dict[str, any]]) – The second checkpoint results list to merge

  • strategy (str) – The merge strategy (which one to take in the case of conflicts)

Returns:

Merged results list

Return type:

list[dict[str, any]]