A virtual staging record from StagingBench can tell you how long a generation took and how much the result changed the room structure. To summarize the wait, group seconds by tool and calculate a median. To examine how reported time and structural drift move together, calculate Spearman correlation across paired rows. Lower drift means better preservation of room structure, so the sign of the correlation matters when you describe the result.
The example uses 12 timed records from T02, T04, and T06. The sample was chosen to include ties in both columns, so it exercises the ranking behavior. Each tuple contains the tool, room, seconds, and drift, in that order. Room identifiers stay as strings to preserve the leading zero. The code uses the numeric values as recorded and leaves the approximation flag out of the calculation. Some of the times are app estimates or ranges, and one record (T06, room 09) failed automatic alignment, so its drift is a fallback score. The printed results describe the embedded sample only.
The loop builds a list of times for each tool and two lists for correlation. statistics.median finds the middle of each tool's recorded times. With an even count, it averages the two middle values. For T02, the middle values in this sample are 18.6 and 19.8 seconds, so the output is 19.20 seconds. The formatting sets two decimal places for display. The time and drift lists stay in the same row order so that each time stays paired with its own drift score.
For Spearman correlation, rank each numeric column from smallest to largest. Equal values share the average of the positions they occupy. In the sample, the two times of 18.6 seconds occupy positions 1 and 2, so each gets rank 1.5. The two drift scores of 26.6 occupy positions 7 and 8, so each gets rank 7.5. The helper sorts indexed values, groups equal values, and writes each group's shared rank back at the original indices. This last step preserves the pairing when the time and drift columns sort differently.
Finally, statistics.correlation applies Pearson correlation to the two lists of ranks. That gives Spearman's rho with average ranks for ties. The sample's coefficient is close to zero. Across all 69 timed records in the full data, the coefficient is about negative 0.18. Those calculations describe different sets of rows, so use the sample result to check the code and the full result to describe the timed records.
When using the full data, skip rows with blank seconds before building the paired lists. Keep the approximation flag available for reporting how many times are app estimates or ranges. If either ranked column is constant, the correlation is undefined. You can still calculate each tool's median wherever it has at least one recorded time.
from collections import defaultdict from itertools import groupby from statistics import correlation, median records = [ ("T02", "01", 18.6, 11.0), ("T02", "02", 19.8, 24.1), ("T02", "03", 18.6, 21.7), ("T02", "04", 22.0, 56.5), ("T04", "01", 35, 27.1), ("T04", "02", 30, 26.6), ("T04", "03", 38.6, 33.5), ("T04", "10", 45, 26.6), ("T06", "06", 54, 22.5), ("T06", "08", 55, 27.4), ("T06", "09", 55, 10.2), ("T06", "10", 55, 21.2), ] def average_ranks(values): ordered = sorted(enumerate(values), key=lambda item: item[1]) ranks = [0.0] * len(ordered) first_rank = 1 for _, group in groupby(ordered, key=lambda item: item[1]): tied = list(group) last_rank = first_rank + len(tied) - 1 rank = (first_rank + last_rank) / 2 for index, _ in tied: ranks[index] = rank first_rank = last_rank + 1 return ranks seconds_by_tool = defaultdict(list) seconds = [] drift = [] for tool, room, elapsed, drift_score in records: seconds_by_tool[tool].append(elapsed) seconds.append(elapsed) drift.append(drift_score) for tool, times in sorted(seconds_by_tool.items()): print(f"{tool} median: {median(times):.2f} s") rho = correlation(average_ranks(seconds), average_ranks(drift)) print(f"Spearman rho: {rho:.6f}") Output:
T02 median: 19.20 s T04 median: 36.80 s T06 median: 55.00 s Spearman rho: -0.031803