"""Check contraction tree statistics."""
import pickle, sys

path = sys.argv[1] if len(sys.argv) > 1 else "data/tree_q25_l10.pkl"
with open(path, 'rb') as f:
    tree = pickle.load(f)

print(f"File: {path}")
print(f"Peak memory elements: {tree.max_size():.2e}")
print(f"Peak memory (GB): {tree.max_size() * 16 / 1e9:.2f}")  # complex128 = 16 bytes
print(f"Total FLOPs: {tree.total_flops():.2e}")
print(f"Contraction width: {tree.contraction_width()}")
print(f"Multiplicity (slices): {tree.multiplicity}")
