Skip to content

ODS Gen

Created on Apr 14, 2025

@author: Tom Schmidt

Formula

Bases: Formula

Extending odswriter.Formula class with the ability to handle sheet references and some minor fixes.

__str__() -> str

Get ods string representation.

ODSDoc

Class representing ODS document.

__init__(benchmark: result.BenchmarkMerge, measures: list[tuple[str, Any]])

Setup Instance and Class sheet.

Attributes:

Name Type Description
benchmark BenchmarkMerge

BenchmarkMerge object.

measures list[tuple[str, Any]]

Measures to be displayed.

add_runspec(runspec: result.Runspec) -> None

Attributes:

Name Type Description
runspec Runspec

Run specification.

finish() -> None

Complete sheets by adding formulas and summaries.

make_ods(out: str) -> None

Write ODS file.

Attributes:

Name Type Description
out str

Name of the generated ODS file.

Sheet

Class representing an ODS sheet.

__init__(benchmark: result.BenchmarkMerge, measures: list[tuple[str, Any]], name: str, ref_sheet: Optional[Sheet] = None)

Initialize sheet.

Attributes:

Name Type Description
benchmark BenchmarkMerge

Benchmark.

measures list[tuple[str, Any]]

Measures to be displayed.

name str

Name of the sheet.

refSheet Optional[Sheet]

Reference sheet.

add_benchclass_summary(block: SystemBlock, benchclass_result: result.ClassResult, benchclass_summary: dict[str, Any]) -> None

Add benchmark class summary to SystemBlock.

Attributes:

Name Type Description
block SystemBlock

SystemBlock to which summary is added.

benchclass_result ClassResult

ClassResult.

benchclass_summary dict[str, Any]

Summary of benchmark class.

add_col_summary() -> None

Add column summary if applicable to column type.

add_instance_results(block: SystemBlock, instance_result: result.InstanceResult, benchclass_summary: dict[str, Any]) -> None

Add instance results to SystemBlock and add values to summary if necessary.

Attributes:

Name Type Description
block SystemBlock

SystemBlock to which results are added.

instance_result InstanceResult

InstanceResult.

benchclass_summary dict[str, Any]

Summary of benchmark class.

add_row_summary(float_occur: dict[str, set[Any]], offset: int) -> None

Add row summary (min, max, median).

Attributes:

Name Type Description
float_occur dict[str, set[Any]]

Dict containing column references of float columns.

offset int

Column offset.

add_runspec(runspec: result.Runspec) -> None

Add results to the their respective blocks.

Attributes:

Name Type Description
runspec Runspec

Run specification

add_styles(float_occur: dict[str, Any]) -> None

Color float results and their summaries.

Attributes:

Name Type Description
float_occur dict[str, Any]

Dict containing column references of float columns.

finish() -> None

Finish ODS content.

SystemBlock dataclass

Dataframe containing results for system.

Attributes:

Name Type Description
setting Optional[Setting]

Benchmark setting.

machine Optional[Machine]

Machine.

content DataFrame

Results.

columns dict[str, Any]

Dictionary of columns and their types.

offset Optional[int]

Offset for final block position.

add_cell(row: int, name: str, value_type: str, value: Any) -> None

Add cell to dataframe.

Attributes:

Name Type Description
row int

Row of the new cell.

name str

Name of the column of the new cell (in most cases the measure).

valueType str

Data type of the new cell.

value Any

Value of the new cell.

gen_name(add_machine: bool) -> str

Generate name of the block.

Attributes:

Name Type Description
addMachine bool

Whether to include the machine name in the name.

get_cell_index(col: int, row: int, abs_col: bool = False, abs_row: bool = False) -> str

Calculate ODS cell index.

Attributes:

Name Type Description
col int

Column index.

row int

Row index.

abs_col bool

Set '$' for column.

abs_row bool

Set '$' for row.

try_float(v: Any) -> Any

Try to cast given value to float. Return input if not possible.

Attributes:

Name Type Description
v Any

Value tried to be cast to float.

write_row(self: ods.Sheet, cells: list[Any]) -> None

Method to write ods row. Replaces ods.Sheet.writerow