Deborah.Miriam.CumulantsBundleUtils

Deborah.Miriam.CumulantsBundleUtils.flatten_Q4_columnsMethod
flatten_Q4_columns(
    Q_data::Vector{Tuple{Int, Float64, Float64, Float64, Float64}}
) -> (
    Vector{Float64},  # column 2
    Vector{Float64},  # column 3
    Vector{Float64},  # column 4
    Vector{Float64}   # column 5
)

Extract and group columns 2-5 from each 5-tuple of the form (Int, Float64, Float64, Float64, Float64).

Arguments

  • Q_data: A vector of 5-element tuples where the first element is an Int and the remaining are Float64 values.

Returns

  • A 4-tuple of vectors, each collecting the respective components from position 2 to 5 across all tuples.
source
Deborah.Miriam.CumulantsBundleUtils.flatten_Q5_columnsMethod
flatten_Q5_columns(
    Q_data::Vector{Tuple{Int, Float64, Float64, Float64, Float64, Float64}}
) -> (
    Vector{Float64},  # column 2
    Vector{Float64},  # column 3
    Vector{Float64},  # column 4
    Vector{Float64},  # column 5
    Vector{Float64}   # column 6
)

Extract and group columns 2-6 from each 6-tuple of the form (Int, Float64, Float64, Float64, Float64, Float64).

Arguments

  • Q_data: A vector of 6-element tuples where the first element is an Int and the rest are Float64 values.

Returns

  • A 5-tuple of vectors, each collecting the respective components from position 2 to 6 across all tuples.
source
Deborah.Miriam.CumulantsBundleUtils.split_Q_fullMethod
split_Q_full(
    Q_bundle_ORG::Union{Nothing, NTuple{5, Vector{T}}}, 
    Q_bundle::Vector,
    bundle::Union{Ensemble.EnsembleArrayBundle{T}, ReweightingBundle.ReweightingSolverBundle},
    ens_idx::Union{Nothing, Int},
    jobid::Union{Nothing, String}=nothing;
    has_weight::Bool=false
) where T -> NTuple{7, Vector{<:Tuple}}

Split Q-observable rows into labeled subsets by using source_tags and secondary_tags attached to the ensemble bundles. Supports both raw-trace mode (Deborah.Miriam.Ensemble.EnsembleArrayBundle) and reweighting mode (Deborah.Miriam.ReweightingBundle.ReweightingSolverBundle).

Inputs

  • Q_bundle_ORG: Optional original tuple (Q1_ORG, Q2_ORG, Q3_ORG, Q4_ORG, w_ORG). If provided, Q_Y_ORG is built from these arrays (including w_ORG). If nothing, Q_Y_ORG is built from Q_bundle[1] (weight omitted).
  • Q_bundle::Vector: A vector of tuples holding (Q1, Q2, Q3, Q4) and, when has_weight=true, an optional 5th array w. The four entries are aligned with the bundle variants as follows:
    • Q_bundle[1]FULL-LBOG-ULOG (original; used for Q_Y_ORG and Y_ul)
    • Q_bundle[2]FULL-LBOG-ULML (Y_UL-replaced; used for YP_ul)
    • Q_bundle[3]LABL-TROG-BCOG (Y_LB-only, Y_BC original; used for Y_tr, Y_bc, and Y_lb)
    • Q_bundle[4]LABL-TROG-BCML (Y_LB-only, Y_BC replaced; used for YP_bc)
  • bundle: The corresponding bundle providing conf_nums, source_tags and secondary_tags. In reweighting mode (has_weight=true), these are read from bundle.solvers[k].ens.data; in raw-trace mode they are read from bundle.arrays[k].data[ens_idx].
  • ens_idx: Index for selecting an ensemble entry in raw-trace mode. Ignored in reweighting mode.
  • jobid: Optional job ID used for logging context.
  • has_weight: If true, each output tuple includes a weight component.

Tag semantics

  • source_tags: 0 → Y_tr, 1 → Y_bc/YP_bc, 2 → Y_ul/YP_ul
  • secondary_tags: 0 → Y_lb, 1 → Y_ul

Invariants enforced

  • In Q_bundle[2] (UL-replaced stream): rows with source_tags==2 must have secondary_tags==1.
  • In LB-only streams (Q_bundle[3], Q_bundle[4]): any row with secondary_tags==0 must not have source_tags==2.

Returns

Each element is a vector of tuples:

  • when has_weight=false: (conf, Q1, Q2, Q3, Q4)
  • when has_weight=true : (conf, Q1, Q2, Q3, Q4, w)

Return order:

  1. Q_Y_tr — rows with source_tags==0 from Q_bundle[3]
  2. Q_Y_bc — rows with source_tags==1 from Q_bundle[3]
  3. Q_YP_bc — rows with source_tags==1 from Q_bundle[4]
  4. Q_Y_ul — rows with source_tags==2 from Q_bundle[1]
  5. Q_YP_ul — rows with source_tags==2 from Q_bundle[2]
  6. Q_Y_lb — rows with secondary_tags==0 from Q_bundle[3]
  7. Q_Y_ORG — original stream aligned to conf_nums (uses Q_bundle_ORG if provided; otherwise from Q_bundle[1])

Notes

  • Y_LB now comes from Q_bundle[3] (Y_LB-only, Y_BC original). Q_Y_lb is a convenience union of all rows marked as secondary_tags==0 in that stream, so elements in Q_Y_tr and Q_Y_bc will also appear in Q_Y_lb by design.
  • Length consistency is checked between (Y_bc, YP_bc) and (Y_ul, YP_ul). If a predicted subset is empty (e.g., TRP=0), the check is skipped with a warning.
source