Rigorous.InitialScore#

molass.Rigorous.InitialScore

Evaluate the rigorous objective function once at initial parameters, returning SV, score breakdown, and a PeakEditor-like visual — without running full BH/NS optimization.

Usage#

result = decomp.score_initial(trimmed_ssd=trimmed)
print(f"SV = {result.sv:.2f}")
result.plot(title="Auto EGH initial score")
result.print_summary()
for d in result.diagnose():
    print(f"[{d.status}] {d.score}: {d.reason}")

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

class InitialScoreResult(fv, sv, breakdown, optimizer, init_params)#

Bases: object

Result of a single rigorous objective evaluation at initial parameters.

Produced by score_initial().

fv#

Raw objective value (lower is better).

Type:

float

sv#

Score value on the 0–100 scale (higher is better).

Type:

float

breakdown#

{'fv': float, 'scores': {name: value, ...}} — same structure as get_score_breakdown().

Type:

dict

optimizer#

Fully constructed and prepared at init_params.

Type:

legacy optimizer object

init_params#

Physical parameter vector used for the evaluation.

Type:

ndarray

plot(title=None)#

Produce the 3-panel UV/XR/scores figure (like PeakEditor’s final plot).

The three panels show:

  • Left: UV elution decomposition (data vs modelled components)

  • Centre: XR elution decomposition (data vs modelled components)

  • Right: objective function score components (bar chart)

Parameters:

title (str, optional) – Figure suptitle. Defaults to "Initial score SV=<value>".

Return type:

matplotlib.figure.Figure

diagnose(breakdown=None)#

Map score values to physical interpretations.

Delegates to the same rules as diagnose().

Parameters:

breakdown (dict, optional) – If None (default), uses self.breakdown.

Returns:

Each has score, status, reason, suggestion.

Return type:

list of Diagnosis namedtuples

print_summary()#

Print SV, breakdown table, and diagnosis to stdout.

make_initial_score_impl(decomposition, trimmed_ssd=None, analysis_folder=None, function_code=None, debug=False)#

Set up the rigorous optimizer, evaluate the objective once, return InitialScoreResult.

This mirrors the setup phase of make_rigorous_decomposition_impl() but stops immediately after optimizer.prepare_for_optimization(init_params) and evaluates the objective function once instead of running BH/NS.

A temporary folder is used when analysis_folder is None (cleaned up after the call).

Parameters:
  • decomposition (Decomposition)

  • trimmed_ssd (SecSaxsData, optional) – Trimmed (uncorrected) SSD. Recommended (Pattern B).

  • analysis_folder (str, optional) – Where to write optimizer setup files. Defaults to a temp folder.

  • function_code (str, optional) – Override auto-detected function code.

  • debug (bool, optional)