This commit is contained in:
@@ -8,6 +8,22 @@ import sys
|
||||
MIN_MASTER_FACETS = 4
|
||||
MIN_ACTIVE_CONTACTS = 2
|
||||
MIN_ACCUMULATED_SLIP = 1.0e-1
|
||||
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]]:
|
||||
@@ -38,6 +54,12 @@ def write_sliding_profile(result_dir: str, rows: list[dict[str, str]]) -> str:
|
||||
"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",
|
||||
"aug_factor",
|
||||
"aug_lambda",
|
||||
"search_masters",
|
||||
@@ -69,6 +91,14 @@ def write_sliding_profile(result_dir: str, rows: list[dict[str, str]]) -> str:
|
||||
"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"])
|
||||
),
|
||||
"aug_factor": float(row["aug_factor"]),
|
||||
"aug_lambda": float(row["aug_lambda"]),
|
||||
"search_masters": int(float(row.get("search_masters", "0") or "0")),
|
||||
@@ -84,6 +114,23 @@ def main() -> int:
|
||||
if not pair_rows:
|
||||
print("no contact pair rows found")
|
||||
return 1
|
||||
if len(pair_rows) < 2:
|
||||
print("contact diagnostic path is too short")
|
||||
return 1
|
||||
if not require_columns(
|
||||
pair_rows[0],
|
||||
STATE_COLUMNS
|
||||
+ [
|
||||
"gap_residual",
|
||||
"gap_l2",
|
||||
"slip_increment_norm",
|
||||
"slip_residual",
|
||||
"friction_residual",
|
||||
"aug_factor",
|
||||
"aug_lambda",
|
||||
],
|
||||
):
|
||||
return 1
|
||||
|
||||
profile_path = write_sliding_profile(result_dir, pair_rows)
|
||||
max_active = max(int(float(row["active_count"])) for row in pair_rows)
|
||||
@@ -108,6 +155,19 @@ 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_slip_state = max(
|
||||
int(float(row["closed_slip_count"]))
|
||||
+ int(float(row["closed_restick_count"]))
|
||||
for row in pair_rows
|
||||
)
|
||||
max_closed_stick_state = max(
|
||||
int(float(row["closed_stick_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_aug_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)
|
||||
@@ -140,6 +200,24 @@ def main() -> int:
|
||||
if max_failed_projection != 0:
|
||||
print(f"unexpected failed projection count: {max_failed_projection}")
|
||||
return 1
|
||||
if max_state_failed_projection != 0:
|
||||
print(f"unexpected failed projection state: {max_state_failed_projection}")
|
||||
return 1
|
||||
if max_closed_slip_state <= 0 or max_closed_stick_state <= 0:
|
||||
print("stick/slip contact 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("contact state counters do not describe exactly one pair state")
|
||||
return 1
|
||||
if max_aug_factor <= 0.0 or max_aug_lambda <= 0.0:
|
||||
print("augmentation diagnostics were not reported")
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user