|
|
@@ -143,6 +143,30 @@ def run_vary_dim(args):
|
|
|
plt.tight_layout()
|
|
|
plt.show()
|
|
|
|
|
|
+def clean_data(df):
|
|
|
+ df["total_time"] = (
|
|
|
+ df["simulation_time"]
|
|
|
+ + df["creation_time"]
|
|
|
+ + df["setup_time"]
|
|
|
+ )
|
|
|
+
|
|
|
+ possible_group_cols = ["depth", "width", "number", "total_time"]
|
|
|
+ grouping_cols = [c for c in possible_group_cols if c in df.columns]
|
|
|
+
|
|
|
+ def clean(group):
|
|
|
+ Q1 = group["total_time"].quantile(0.25)
|
|
|
+ Q3 = group["total_time"].quantile(0.75)
|
|
|
+ IQR = Q3 - Q1
|
|
|
+ lower = Q1 - 1.5 * IQR
|
|
|
+ upper = Q3 + 1.5 * IQR
|
|
|
+ return group[(group["total_time"] >= lower) & (group["total_time"] <= upper)]
|
|
|
+
|
|
|
+ cleaned = (
|
|
|
+ df.groupby(grouping_cols, group_keys=False)[grouping_cols]
|
|
|
+ .apply(clean)
|
|
|
+ )
|
|
|
+
|
|
|
+ return cleaned
|
|
|
|
|
|
def run_csv_mode(args):
|
|
|
"""Mode 3: Read CSV, calculate theoretical DCP, plot vs Runtime"""
|
|
|
@@ -153,11 +177,7 @@ def run_csv_mode(args):
|
|
|
except FileNotFoundError:
|
|
|
print(f"Error: File {args.file} not found.")
|
|
|
return
|
|
|
-
|
|
|
- required = ['width', 'depth', 'simulation_time']
|
|
|
- if not all(col in df.columns for col in required):
|
|
|
- print(f"Error: CSV missing columns. Required: {required}")
|
|
|
- return
|
|
|
+ df = clean_data(df)
|
|
|
|
|
|
# Create 'dcp_calls' column
|
|
|
df['dcp_calls'] = 0.0
|
|
|
@@ -191,12 +211,12 @@ def run_csv_mode(args):
|
|
|
df.loc[group.index, 'dcp_calls'] = func(group['width'].values, group['depth'].values, n_vals)
|
|
|
|
|
|
plt.figure(figsize=(10, 6))
|
|
|
- scatter = plt.scatter(df['dcp_calls'], df['simulation_time'],
|
|
|
+ scatter = plt.scatter(df['dcp_calls'], df['total_time'],
|
|
|
c=df['atomic_models'], cmap='viridis', alpha=0.7, edgecolors='k', s=50)
|
|
|
|
|
|
plt.colorbar(scatter, label='# Atomic Models')
|
|
|
plt.xlabel('Theoretical DCP Calls')
|
|
|
- plt.ylabel('Simulation Time (s)')
|
|
|
+ plt.ylabel('Total Simulation Time (s)')
|
|
|
plt.title(f'Run Time vs DCP Calls for {model}')
|
|
|
plt.grid(True, linestyle='--', alpha=0.6)
|
|
|
plt.tight_layout()
|