|
4 | 4 | from loguru import logger |
5 | 5 |
|
6 | 6 | from vivarium_profiling.tools.extraction import ExtractionConfig |
7 | | -from vivarium_profiling.tools.plotting import ( |
8 | | - create_figures, |
9 | | - plot_bottleneck_fractions, |
| 7 | +from vivarium_profiling.tools.notebook_generator import ( |
| 8 | + NOTEBOOK_NAME, |
| 9 | + create_analysis_notebook, |
10 | 10 | ) |
| 11 | +from vivarium_profiling.tools.plotting import create_figures, plot_bottleneck_fractions |
11 | 12 |
|
12 | 13 | """Benchmark summarization and visualization utilities.""" |
13 | 14 |
|
@@ -138,20 +139,19 @@ def run_summarize_analysis( |
138 | 139 | print(f"\nProcessing benchmark results from {benchmark_results_filepath}") |
139 | 140 | print(f"Summarizing results to {output_dir}\n") |
140 | 141 |
|
141 | | - # Skip summary generation if notebook requested and summary exists |
142 | | - if nb and summary_path.exists(): |
143 | | - print(f"Summary file already exists: {summary_path}") |
144 | | - print("Skipping summary generation...\n") |
145 | | - summary = pd.read_csv(summary_path) |
146 | | - else: |
147 | | - raw = pd.read_csv(benchmark_results_filepath) |
148 | | - if raw.isna().any().any(): |
149 | | - raise ValueError("NaNs found in raw data.") |
| 142 | + raw = pd.read_csv(benchmark_results_filepath) |
| 143 | + if raw.isna().any().any(): |
| 144 | + raise ValueError("NaNs found in raw data.") |
| 145 | + |
| 146 | + summary = summarize(raw, output_dir, config) |
150 | 147 |
|
151 | | - summary = summarize(raw, output_dir, config) |
| 148 | + # Generate Jupyter notebook if requested |
| 149 | + if nb: |
| 150 | + notebook_path = output_dir / NOTEBOOK_NAME |
| 151 | + create_analysis_notebook(benchmark_results_filepath, summary_path, notebook_path) |
152 | 152 |
|
153 | | - # Generate static plots (unless notebook-only mode) |
154 | | - if not nb: |
| 153 | + # Generate static plots |
| 154 | + else: |
155 | 155 | # Generate main performance analysis with memory |
156 | 156 | create_figures( |
157 | 157 | summary, output_dir, "performance_analysis", "rt_s", "mem_mb", "rt_s_pdiff" |
@@ -185,13 +185,6 @@ def run_summarize_analysis( |
185 | 185 | # Generate bottleneck fraction plots |
186 | 186 | plot_bottleneck_fractions(summary, output_dir, config) |
187 | 187 |
|
188 | | - # Generate Jupyter notebook if requested |
189 | | - if nb: |
190 | | - from vivarium_profiling.tools.notebook_generator import create_analysis_notebook |
191 | | - |
192 | | - notebook_path = output_dir / "analysis.ipynb" |
193 | | - create_analysis_notebook( |
194 | | - benchmark_results_filepath, summary_path, notebook_path) |
195 | 188 | print(f"\nCreated interactive notebook: {notebook_path}") |
196 | 189 |
|
197 | 190 | print("\n*** FINISHED ***") |
0 commit comments