Testing.HeadlessPeakEditor

Testing.HeadlessPeakEditor#

Testing.HeadlessPeakEditor — headless reproduction of PeakEditor.draw_scores()

Returns the same (init_params, fv, sv, score_names, scores) the GUI displays, without launching any GUI. Useful for:

  • Programmatic SV comparison across molass_legacy versions

  • Regression tests verifying PeakEditor SV for specific datasets

Quick start:

from molass.Testing.HeadlessPeakEditor import draw_scores_headless
from molass_data import SAMPLE1

result = draw_scores_headless(SAMPLE1)
print(f"PeakEditor SV = {result['sv']:.2f}")

Copyright (c) 2025-2026, SAXS Team, KEK-PF

draw_scores_headless(sample_folder, num_peaks=3, use_library_rg=True, poresize=76.0, poresize_bounds=(71.0, 81.0))#

Headless equivalent of PeakEditor.draw_scores().

Replicates the optimizer setup in PeakEditor exactly:
  1. load_data + prepare (get_lrf_source)

  2. compute rg_curve (legacy or library path)

  3. inject rg_curve into dsets

  4. construct_optimizer + compute_init_params

  5. prepare_for_optimization + objective_func(init_params)

Parameters:
  • sample_folder (str) – Path to raw data folder (e.g. SAMPLE1).

  • num_peaks (int) – Number of protein components (matches PeakEditor “Number of Components” spinbox). Default: 3.

  • use_library_rg (bool) –

    True (default) → library ssd.get_rg_curve() with w(j)=q·Ĩ weighting

    (current dev path, recommended).

    False → legacy RgCurve starting at first-peak frame

    (matches installed 1.6.5 behavior).

  • poresize (float) – Column pore size in Å. Default: 76.0 (Superdex 75).

  • poresize_bounds (tuple) – (lower, upper) bounds for pore size. Default: (71.0, 81.0).

Returns:

molass_legacy_path (str), n_params (int), init_params (np.ndarray), fv (float), sv (float), score_names (list[str]), scores (np.ndarray)

Return type:

dict with keys

Example

>>> from molass.Testing.HeadlessPeakEditor import draw_scores_headless
>>> from molass_data import SAMPLE1
>>> result = draw_scores_headless(SAMPLE1)
>>> print(f"PeakEditor SV = {result['sv']:.2f}")