# Postprocessing Architecture Refactor This merge request introduces a comprehensive refactor of BOSS's postprocessing functionality, introducing modular classes that lets our users create custom visualizations while maintaining backward compatibility with the old `PPMain`-based workflow. ## Changes Overview ### New Modular Architecture The postprocessing system has been restructured into three distinct layers: 1. **`PPMain` (High-level orchestrator)** - `boss/pp/pp_main.py` * Maintains the user-facing API for automated postprocessing workflows * Delegates plot creation to the new `Plotter` class * Delegates data dumps to the new `Dumper` class * Coordinates generation of all diagnostic outputs and data dumps * **No breaking changes to existing user code** 2. **`Plotter` (Mid-level plotting interface)** - `boss/pp/plotter.py` * New high-level plotting interface for interactive and custom visualizations * Can be used independently of `PPMain` for greater control * Provides convenient methods for common plots: `plot_model()`, `plot_acq_func()`, `plot_acquisitions()`, `plot_convergence()`, `plot_hyperparameters()`, etc. * Supports both automated workflows and manual customization 3. **Graphics primitives (Low-level building blocks)** - `boss/pp/graphics.py` and `boss/pp/elements.py` * **Graphics objects** (`Curve`, `Contour`, `Surface`): Create mesh-based visualizations of functions over input spaces * **Element objects** (`Acquisitions`, `Minimum`, `NextAcquisition`): Composable overlays that can be added to graphics using the `+=` operator * Maximum flexibility for advanced users who need fine-grained control * Some groundwork for supporting multi-objective BO has also been done in these classes 4. `Dumper` - `boss/pp/dumper.py` * Handles all writing of results to file. ### Key Benefits * **Separation of concerns**: Plotting logic is now cleanly separated from orchestration and data dumping * **Reusability**: Graphics and elements can be composed and reused in custom visualizations * **Flexibility**: Users can choose the appropriate level of abstraction for their needs: * Use `PPMain` for automated, comprehensive postprocessing * Use `Plotter` for interactive exploration and standard plots with some customization * Use `Graphics` and `Elements` directly for maximum control over visualizations * **Backward compatibility**: Existing code using `PPMain` continues to work unchanged ## Documentation Comprehensive tutorials demonstrating the new functionality have been added: * **`doc/tutorials/notebooks/advanced_plotting_part1.ipynb`**: Introduction to the `Plotter` class, covering all plotting methods and common use cases * **`doc/tutorials/notebooks/advanced_plotting_part2.ipynb`**: Deep dive into `Graphics` and `Elements` objects for advanced customization