Load a single TSV file into a DataFrame. Returns None if missing/empty.
(path: str)
| 43 | # --------------------------------------------------------------------------- |
| 44 | |
| 45 | def _load_single_tsv(path: str) -> pd.DataFrame | None: |
| 46 | """Load a single TSV file into a DataFrame. Returns None if missing/empty.""" |
| 47 | if not os.path.exists(path): |
| 48 | return None |
| 49 | |
| 50 | df = pd.read_csv(path, sep='\t') |
| 51 | if len(df) == 0: |
| 52 | return None |
| 53 | |
| 54 | # Normalise column names to lowercase |
| 55 | df.columns = [c.strip().lower() for c in df.columns] |
| 56 | |
| 57 | # Convert numeric columns |
| 58 | for col in ['experiment', 'throughput_tflops', 'latency_us', 'pct_peak', |
| 59 | 'speedup_vs_pytorch', 'peak_vram_mb']: |
| 60 | if col in df.columns: |
| 61 | df[col] = pd.to_numeric(df[col], errors='coerce') |
| 62 | |
| 63 | return df |
| 64 | |
| 65 | |
| 66 | def load_results(path: str = "results.tsv") -> pd.DataFrame | None: |