Skip to content

Commit

Permalink
format results table too to .4g
Browse files Browse the repository at this point in the history
  • Loading branch information
alinelena committed Nov 14, 2024
1 parent 98347f3 commit 7eb12b7
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions mace/tools/tables_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,18 @@ def create_error_table(
table.add_row(
[
name,
f"{metrics['rmse_e'] * 1000:8.1f}",
f"{metrics['rmse_f'] * 1000:8.1f}",
f"{metrics['rel_rmse_f']:8.2f}",
f"{metrics['rmse_e'] * 1000:.4g}",
f"{metrics['rmse_f'] * 1000:.4g}",
f"{metrics['rel_rmse_f']:.4g}",
]
)
elif table_type == "PerAtomRMSE":
table.add_row(
[
name,
f"{metrics['rmse_e_per_atom'] * 1000:8.1f}",
f"{metrics['rmse_f'] * 1000:8.1f}",
f"{metrics['rel_rmse_f']:8.2f}",
f"{metrics['rmse_e_per_atom'] * 1000:.4g}",
f"{metrics['rmse_f'] * 1000:.4g}",
f"{metrics['rel_rmse_f']:.4g}",
]
)
elif (
Expand All @@ -148,10 +148,10 @@ def create_error_table(
table.add_row(
[
name,
f"{metrics['rmse_e_per_atom'] * 1000:8.1f}",
f"{metrics['rmse_f'] * 1000:8.1f}",
f"{metrics['rel_rmse_f']:8.2f}",
f"{metrics['rmse_stress'] * 1000:8.1f}",
f"{metrics['rmse_e_per_atom'] * 1000:.4g}",
f"{metrics['rmse_f'] * 1000:.4g}",
f"{metrics['rel_rmse_f']:.4g}",
f"{metrics['rmse_stress'] * 1000:.4g}",
]
)
elif (
Expand All @@ -161,10 +161,10 @@ def create_error_table(
table.add_row(
[
name,
f"{metrics['rmse_e_per_atom'] * 1000:8.1f}",
f"{metrics['rmse_f'] * 1000:8.1f}",
f"{metrics['rel_rmse_f']:8.2f}",
f"{metrics['rmse_virials'] * 1000:8.1f}",
f"{metrics['rmse_e_per_atom'] * 1000:.4g}",
f"{metrics['rmse_f'] * 1000:.4g}",
f"{metrics['rel_rmse_f']:.4g}",
f"{metrics['rmse_virials'] * 1000:.4g}",
]
)
elif (
Expand All @@ -174,10 +174,10 @@ def create_error_table(
table.add_row(
[
name,
f"{metrics['mae_e_per_atom'] * 1000:8.1f}",
f"{metrics['mae_f'] * 1000:8.1f}",
f"{metrics['rel_mae_f']:8.2f}",
f"{metrics['mae_stress'] * 1000:8.1f}",
f"{metrics['mae_e_per_atom'] * 1000:.4g}",
f"{metrics['mae_f'] * 1000:.4g}",
f"{metrics['rel_mae_f']:.4g}",
f"{metrics['mae_stress'] * 1000:.4g}",
]
)
elif (
Expand All @@ -187,55 +187,55 @@ def create_error_table(
table.add_row(
[
name,
f"{metrics['mae_e_per_atom'] * 1000:8.1f}",
f"{metrics['mae_f'] * 1000:8.1f}",
f"{metrics['rel_mae_f']:8.2f}",
f"{metrics['mae_virials'] * 1000:8.1f}",
f"{metrics['mae_e_per_atom'] * 1000:.4g}",
f"{metrics['mae_f'] * 1000:.4g}",
f"{metrics['rel_mae_f']:.4g}",
f"{metrics['mae_virials'] * 1000:.4g}",
]
)
elif table_type == "TotalMAE":
table.add_row(
[
name,
f"{metrics['mae_e'] * 1000:8.1f}",
f"{metrics['mae_f'] * 1000:8.1f}",
f"{metrics['rel_mae_f']:8.2f}",
f"{metrics['mae_e'] * 1000:.4g}",
f"{metrics['mae_f'] * 1000:.4g}",
f"{metrics['rel_mae_f']:.4g}",
]
)
elif table_type == "PerAtomMAE":
table.add_row(
[
name,
f"{metrics['mae_e_per_atom'] * 1000:8.1f}",
f"{metrics['mae_f'] * 1000:8.1f}",
f"{metrics['rel_mae_f']:8.2f}",
f"{metrics['mae_e_per_atom'] * 1000:.4g}",
f"{metrics['mae_f'] * 1000:.4g}",
f"{metrics['rel_mae_f']:.4g}",
]
)
elif table_type == "DipoleRMSE":
table.add_row(
[
name,
f"{metrics['rmse_mu_per_atom'] * 1000:8.2f}",
f"{metrics['rel_rmse_mu']:8.1f}",
f"{metrics['rmse_mu_per_atom'] * 1000:.4g}",
f"{metrics['rel_rmse_mu']:.4g}",
]
)
elif table_type == "DipoleMAE":
table.add_row(
[
name,
f"{metrics['mae_mu_per_atom'] * 1000:8.2f}",
f"{metrics['rel_mae_mu']:8.1f}",
f"{metrics['mae_mu_per_atom'] * 1000:.4g}",
f"{metrics['rel_mae_mu']:.4g}",
]
)
elif table_type == "EnergyDipoleRMSE":
table.add_row(
[
name,
f"{metrics['rmse_e_per_atom'] * 1000:8.1f}",
f"{metrics['rmse_f'] * 1000:8.1f}",
f"{metrics['rel_rmse_f']:8.1f}",
f"{metrics['rmse_mu_per_atom'] * 1000:8.1f}",
f"{metrics['rel_rmse_mu']:8.1f}",
f"{metrics['rmse_e_per_atom'] * 1000:.4g}",
f"{metrics['rmse_f'] * 1000:.4g}",
f"{metrics['rel_rmse_f']:.4g}",
f"{metrics['rmse_mu_per_atom'] * 1000:.4g}",
f"{metrics['rel_rmse_mu']:.4g}",
]
)
return table

0 comments on commit 7eb12b7

Please sign in to comment.