Bridge.SdAdapter#
Bridge.SdAdapter.py
Converts a legacy SerialData (sd) into a library SecSaxsData (ssd). This is an incremental step on the data-object consolidation track defined in Rule 13 of copilot-guidelines.md (target: molass-legacy GUI → molass-library).
Only the corrected-sd → ssd direction is implemented here. The reverse (ssd → sd) is not needed yet.
- make_ssd_from_corrected_sd(corrected_sd)#
Build a library SecSaxsData from a baseline-corrected legacy SerialData.
The input must be a corrected (baseline-subtracted) sd, i.e.
corrected_sd.baseline_corrected is True. The returned ssd has itstrimmedandcorrectedflags set so thatquick_decomposition()can be called directly without a redundantcorrected_copy()step.- Parameters:
corrected_sd (molass_legacy.SerialAnalyzer.SerialData.SerialData) – A trimmed, baseline-corrected legacy data object.
- Returns:
Library data object ready for
quick_decomposition().- Return type:
- decomposition_from_optimizer_params(fullopt, params, base_decomp)#
Build a library Decomposition from a legacy optimizer + flat params vector.
This is the model-dependent update path used by
JobStateCanvas._update_decomposition_to_current(). It reuses the existingComponentUtils.get_xr_ccurvesdispatch table, which already handles all five models (EGH, SDM, EDM/CEDM, LKM).- Parameters:
fullopt (molass_legacy.Optimizer.BasicOptimizer.BasicOptimizer) – The live legacy optimizer instance. Used only for
split_params_simple(params)andget_model_name()— no heavy computation is triggered.params (array-like) – Flat optimizer parameter vector at the desired snapshot (e.g.
demo_info[1][curr_index]).base_decomp (molass.LowRank.Decomposition.Decomposition) – The base decomposition that owns the
ssd. Itsssdis reused as the data container; only the component curves are replaced.
- Returns:
A new Decomposition whose XR/UV component curves reflect
params.- Return type:
- make_ssd_from_dsets(dsets, sd)#
Build a library SecSaxsData from a legacy OptDataSets + trimmed SerialData.
Used by
JobStateCanvasin the legacy GUI path, where onlydsets(already corrected) and the trimmedsd(for q-values and wavelengths) are available —corrected_sdis not stored in that path.- Parameters:
dsets (molass_legacy.Optimizer.OptDataSets.OptDataSets) – The prepared optimizer dataset. Iterated as
((xr_curve, D), rg_curve, (uv_curve, U)).sd (molass_legacy.SerialAnalyzer.SerialData.SerialData) – Trimmed (uncorrected) legacy data object — used only for
qvectorandabsorbance.wl_vector.
- Returns:
Library data object ready for
quick_decomposition().- Return type: