Rigorous.GuiReplay#
molass.Rigorous.GuiReplay
Reconstruct a legacy GUI optimizer run in-process for notebook introspection.
This module bridges the gap between the opaque LEG-GUI subprocess path and the notebook API. It reads the files produced by a completed GUI run (callback.txt, init_params.txt, optimizer.log, opt_settings.txt, ip_*.npy) and reconstructs the optimizer in the calling process so it can be:
queried for score_breakdown at any parameter vector
re-run with any solver for direct comparison
compared against LIB-IN results using compare_dsets()
Alignment with the refactor architecture: - molass-library is the home for active computational code (ARCHITECTURE.md) - This module calls molass-legacy’s DsetsDebug layer for raw reconstruction - Returns RunInfo so the result is consumable through the library’s API - Serves the data-object consolidation track: makes the GUI’s sd-based
landscape directly inspectable, creating pressure to replace sd with ssd
Usage example#
from molass.Rigorous.GuiReplay import load_gui_scenario
scenario = load_gui_scenario(r’C:PyToolsreportsanalysis-005’) print(‘fv_init from GUI callback:’, scenario.fv_init) print(‘fv_init reproduced :’, scenario.eval_init())
# Re-run in-process with BH for comparison run = scenario.run_inprocess(method=’BH’, niter=20) run.wait() bd = run.get_score_breakdown()
Copyright (c) 2026, SAXS Team, KEK-PF
- class GuiScenario(analysis_folder, work_folder, optimizer, init_params, fv_init, n_components, class_code)#
Bases:
objectReconstructed GUI optimizer scenario, ready for in-process introspection.
- optimizer#
Fully constructed and prepared (
prepare_for_optimizationalready called withinit_params).- Type:
legacy optimizer object
- init_params#
Physical parameter vector from
init_params.txt.- Type:
ndarray
- eval_init()#
Evaluate the objective at init_params in-process.
Returns the reproduced fv_init. Compare with self.fv_init (from callback.txt) to verify the reconstruction is faithful.
- get_score_breakdown(params=None)#
Return score breakdown at init_params (or any given params).
- Returns:
dict {‘fv’ – Same structure as RunInfo.get_score_breakdown().
- Return type:
float, ‘scores’: {name: value}}
- run_inprocess(method='BH', niter=20, seed=1234, analysis_folder=None, **solver_kwargs)#
Re-run the optimizer in-process with any solver.
This lets you run BH or DE on exactly the GUI’s data and compare the result against the original LEG-GUI outcome.
- Parameters:
- Return type:
- load_gui_scenario(analysis_folder, job='000')#
Reconstruct a completed GUI run as a GuiScenario for notebook introspection.
Reads all files produced by the LEG-GUI subprocess (init_params.txt, optimizer.log, opt_settings.txt, ip_*.npy) and reconstructs the optimizer in the calling process with the same data the subprocess used.
- Parameters:
- Return type:
- Raises:
FileNotFoundError – If required files are missing.