-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19f6288
commit 97b6de6
Showing
6 changed files
with
57 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
"""A set of functions to export the results of a test bench run.""" | ||
|
||
import pandas as pd | ||
|
||
from hpc_multibench.plot.plot_data import split_metric_uncertainty | ||
from hpc_multibench.run_configuration import RunConfiguration | ||
from hpc_multibench.uncertainties import UFloat | ||
from hpc_multibench.yaml_model import ExportModel | ||
|
||
|
||
def export_data( | ||
plot: ExportModel, | ||
all_metrics: list[tuple[RunConfiguration, dict[str, str | UFloat]]], | ||
) -> None: | ||
"""Construct and export a pandas data frame from the metrics.""" | ||
df_data: dict[str, list[float | str]] = {} | ||
for run_configuration, metrics in all_metrics: | ||
row_data: dict[str, float | str] = {"Run configuration": run_configuration.name} | ||
|
||
for metric in metrics: | ||
value, error = split_metric_uncertainty(metrics, metric) | ||
row_data[metric] = value | ||
if error is not None: | ||
row_data[f"{metric} error"] = error | ||
|
||
for column, cell in row_data.items(): | ||
if column not in df_data: | ||
df_data[column] = [] | ||
df_data[column].append(cell) | ||
|
||
export_df = pd.DataFrame(df_data) | ||
|
||
if plot.export_path is None: | ||
print(export_df.to_string()) | ||
elif plot.export_format == "csv": | ||
export_df.to_csv(plot.export_path) | ||
else: | ||
raise NotImplementedError( | ||
f"Export format '{plot.export_format}' not supported!" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters