Rigorous.RigorousImplement#
Rigorous.RigorousImplement
Subprocess Coordinate Contract (Issue #80)#
When optimize_rigorously() exports data for the legacy subprocess
(needs_export=True, e.g. anomaly-masked datasets), the following
contract applies:
Exported filenames carry original frame numbers from
ssd.xr.jv(e.g.PREFIX_00032.dat), so the legacy loader setsstart_file_nocorrectly.The restrict-lists written to
trimming.txtare identity(0, N, N)— no re-trimming, since the data is already trimmed.The subprocess does NOT need
elution_recognition, anomaly masks, or original trimming info — all preprocessing is already applied.
- make_rigorous_decomposition_impl(decomposition, rgcurve, analysis_folder=None, niter=20, method='BH', frozen_components=None, frozen_param_groups=None, trimmed_ssd=None, clear_jobs=True, function_code=None, in_process=True, monitor=True, async_=True, progress='dashboard', max_trials=0, debug=False, _dry_run=False, ns_narrow_bounds=True, ns_adaptive_nsteps=False, ns_nsteps=None, solver_kwargs=None)#
Make a rigorous decomposition using a given RG curve.
- Parameters:
decomposition (Decomposition) – The initial decomposition to refine (built on corrected data).
rgcurve (RgComponentCurve) – The Rg component curve to use for refinement.
analysis_folder (str, optional) – The folder to save analysis results.
niter (int, optional) –
Iteration budget. Meaning depends on
method:'BH': literal number of Basin-Hopping outer steps (default 20).'NS': multiplied by 7 000 to formmax_ncallsfor UltraNest (niter=20→ 140 000 likelihood evaluations).
Default 20.
method (str, optional) – Optimization algorithm:
'BH'(Basin-Hopping, default) or'NS'(Nested Sampling / UltraNest).frozen_components (list of int, optional) – 0-based indices of protein components to freeze during optimization. Their EGH shape parameters, Rg, and UV scale will be held constant at the values from the initial decomposition.
trimmed_ssd (SecSaxsData, optional) – Trimmed but not baseline-corrected SSD. When provided, the optimizer fits against this data (with baseline as a free parameter) instead of the corrected data in decomposition.ssd.
clear_jobs (bool, optional) – If True (default), clear existing job folders before starting.
in_process (bool, optional) – If True (default), run the optimizer in this Python process instead of spawning a subprocess. The library-prepared optimizer (with the live dsets, base curves, and spectral vectors built above) is the one that runs — no re-derivation from disk, no parent/subprocess divergence. Set
Falseto use the legacy subprocess path (required by the tkinter GUI; available as an escape hatch for notebook users who need process isolation). Seemolass-library/Copilot/DESIGN_split_optimizer_architecture.md.monitor (bool, optional) – Controls the
MplMonitoripywidgets dashboard. When True (default), a live dashboard is shown whether the run is in-process or subprocess. When False, no dashboard is created — the run proceeds silently. Usemonitor=Falsefor batch / comparison runs (e.g.compare_optimization_paths) where the widget is not needed.progress (str or None, optional) – Deprecated and ignored — use
monitor=True/Falseinstead. Kept in the signature only for backward compatibility.debug (bool, optional) – If True, enable debug mode with additional output.
- Returns:
The refined decomposition object.
- Return type: