This commit is contained in:
@@ -5,6 +5,23 @@ import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
STATE_COLUMNS = [
|
||||
"open_count",
|
||||
"closed_stick_count",
|
||||
"closed_slip_count",
|
||||
"closed_restick_count",
|
||||
"separating_count",
|
||||
"state_failed_projection_count",
|
||||
]
|
||||
|
||||
|
||||
def require_columns(row: dict[str, str], columns: list[str]) -> bool:
|
||||
missing = [column for column in columns if column not in row]
|
||||
if missing:
|
||||
print("missing contact diagnostic columns: " + ", ".join(missing))
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def read_pair_rows(result_dir: str) -> list[dict[str, str]]:
|
||||
rows: list[dict[str, str]] = []
|
||||
@@ -20,6 +37,22 @@ def main() -> int:
|
||||
if not pair_rows:
|
||||
print("no contact pair rows found")
|
||||
return 1
|
||||
if len(pair_rows) < 2:
|
||||
print("shell-shell contact diagnostic path is too short")
|
||||
return 1
|
||||
if not require_columns(
|
||||
pair_rows[0],
|
||||
STATE_COLUMNS
|
||||
+ [
|
||||
"gap_residual",
|
||||
"gap_l2",
|
||||
"failed_projection_count",
|
||||
"active_set_flip_count",
|
||||
"aug_factor",
|
||||
"aug_lambda",
|
||||
],
|
||||
):
|
||||
return 1
|
||||
|
||||
profile_path = os.path.join(result_dir, "shell_shell_contact_profile.csv")
|
||||
with open(profile_path, "w", newline="") as stream:
|
||||
@@ -31,6 +64,12 @@ def main() -> int:
|
||||
"gap_l2",
|
||||
"failed_projection_count",
|
||||
"active_set_flip_count",
|
||||
"open_count",
|
||||
"closed_stick_count",
|
||||
"closed_slip_count",
|
||||
"closed_restick_count",
|
||||
"separating_count",
|
||||
"state_failed_projection_count",
|
||||
"status",
|
||||
"activation_count",
|
||||
"release_count",
|
||||
@@ -50,6 +89,14 @@ def main() -> int:
|
||||
"gap_l2": float(row["gap_l2"]),
|
||||
"failed_projection_count": int(float(row["failed_projection_count"])),
|
||||
"active_set_flip_count": int(float(row["active_set_flip_count"])),
|
||||
"open_count": int(float(row["open_count"])),
|
||||
"closed_stick_count": int(float(row["closed_stick_count"])),
|
||||
"closed_slip_count": int(float(row["closed_slip_count"])),
|
||||
"closed_restick_count": int(float(row["closed_restick_count"])),
|
||||
"separating_count": int(float(row["separating_count"])),
|
||||
"state_failed_projection_count": int(
|
||||
float(row["state_failed_projection_count"])
|
||||
),
|
||||
"status": int(float(row["status"])),
|
||||
"activation_count": int(float(row["activation_count"])),
|
||||
"release_count": int(float(row["release_count"])),
|
||||
@@ -64,6 +111,15 @@ def main() -> int:
|
||||
max_gap = max(float(row["gap_residual"]) for row in pair_rows)
|
||||
max_gap_l2 = max(float(row["gap_l2"]) for row in pair_rows)
|
||||
max_failed_projection = max(int(float(row["failed_projection_count"])) for row in pair_rows)
|
||||
max_state_failed_projection = max(
|
||||
int(float(row["state_failed_projection_count"])) for row in pair_rows
|
||||
)
|
||||
max_closed_state = max(
|
||||
int(float(row["closed_stick_count"]))
|
||||
+ int(float(row["closed_slip_count"]))
|
||||
+ int(float(row["closed_restick_count"]))
|
||||
for row in pair_rows
|
||||
)
|
||||
max_aug_factor = max(float(row["aug_factor"]) for row in pair_rows)
|
||||
max_lambda = max(float(row["aug_lambda"]) for row in pair_rows)
|
||||
max_masters = max(int(float(row.get("search_masters", "0") or "0")) for row in pair_rows)
|
||||
@@ -80,6 +136,24 @@ def main() -> int:
|
||||
if max_failed_projection != 0:
|
||||
print(f"unexpected shell-shell failed projection count: {max_failed_projection}")
|
||||
return 1
|
||||
if max_state_failed_projection != 0:
|
||||
print(f"unexpected shell-shell failed projection state: {max_state_failed_projection}")
|
||||
return 1
|
||||
if max_closed_state <= 0:
|
||||
print("shell-shell closed state counters were not reported")
|
||||
return 1
|
||||
if any(
|
||||
int(float(row["open_count"]))
|
||||
+ int(float(row["closed_stick_count"]))
|
||||
+ int(float(row["closed_slip_count"]))
|
||||
+ int(float(row["closed_restick_count"]))
|
||||
+ int(float(row["separating_count"]))
|
||||
+ int(float(row["state_failed_projection_count"]))
|
||||
!= 1
|
||||
for row in pair_rows
|
||||
):
|
||||
print("shell-shell state counters do not describe exactly one pair state")
|
||||
return 1
|
||||
if any(
|
||||
int(float(row["active_set_flip_count"]))
|
||||
< int(float(row["activation_count"])) + int(float(row["release_count"]))
|
||||
|
||||
Reference in New Issue
Block a user