Deborah.Rebekah.JLD2Loader
Deborah.Rebekah.JLD2Loader._recurse_scan! — Method_recurse_scan!(
bad::Vector{String},
g::JLD2.Group,
basepath::AbstractString
) -> NothingRecursive depth-first traversal used internally by _scan_flat_vectors. Walks a JLD2.Group hierarchy and identifies suspicious values where a nested dictionary layout appears collapsed (i.e., a value is directly a Vector{Float64} instead of Dict{Symbol,Vector{Float64}}).
Arguments
bad::Vector{String}: Mutable accumulator collecting detected offending dataset paths.g::JLD2.Group: Current group node being scanned.basepath::AbstractString: Current hierarchical prefix used for reporting full dataset paths.
Behavior
- For each dataset:
- Attempts safe deserialization (
try/catchguarded). - Detects common serialized forms:
Vector{Pair{Symbol,Any}}(SerializedDict-style)Dictcontainers with shallowVector{Float64}leaves.
- Appends human-readable paths such as
"rw_data/solver1/w"when detected.
- Attempts safe deserialization (
Returns
Nothing(side-effect only; modifiesbad).
Notes
- A failure to deserialize a leaf does not abort scanning.
- This function intentionally avoids mutation or rewriting of
JLD2nodes; it only reports.
Deborah.Rebekah.JLD2Loader._scan_flat_vectors — Method_scan_flat_vectors(
filepath::AbstractString
) -> Vector{String}Diagnostic helper to inspect the internal schema of a .jld2 file and locate possible legacy or malformed entries introduced by older Miriam save formats.
Specifically scans leaf datasets for places where a nested structure expected to be of the form Dict{Symbol, Vector{Float64}} has instead been serialized one level too shallow as Vector{Float64}
This pattern frequently occurs when a SerializedDict round-trip produces a Vector{Pair{Symbol,Any}}, or when grouped solver metadata is written without explicit schema normalization.
Arguments
filepath::AbstractString: Path to a.jld2file opened read-only.
Returns
Vector{String}: List of dataset paths (group-style, e.g.,"summary/solver1/y") showing the locations where the suspicious flattening pattern was detected. If no issues are found, returns an empty vector.
Notes
- Does not modify the file; read-only inspection.
- Used to aid migration/repair of legacy bundles and provide context when
JLD2.loadthrows schema mismatch errors.
Deborah.Rebekah.JLD2Loader.load_jld2 — Methodload_jld2(
filepath::String
) -> NamedTupleLoad JLD2 data file containing summary statistics, labels, and training identifiers.
This function reads a .jld2 file and returns a named tuple with keys :summary, :labels, and :trains. It is typically used in workflows that do not require reweighting data.
Arguments
filepath::String: Path to the.jld2file to load.
Returns
- A
NamedTuplewith fieldssummary,labels, andtrains.
Deborah.Rebekah.JLD2Loader.load_jld2_Miriam — Methodload_jld2_Miriam(
filepath::String
) -> NamedTupleLoad a consolidated Miriam JLD2 bundle, including:
- results on multi-ensemble reweighting and transition point interpolation:
summary(keyword-indexed), - three measurement-style summaries from single-ensemble measurement points:
summary_trace_meas,summary_moment_meas,summary_cumulant_meas, - the kappa token list
kappa_list(e.g.,["13570", "13575", "13580"]), - the reweighting payload
rw_data, - the
NLsolve.jlconvergence payloadnlsolve_status(optional; defaults to empty dict), - and index metadata
labels,trains.
This loader is tailored for overlap/error analysis and measurement-based plotting workflows.
Arguments
filepath::String: Path to the.jld2file previously written bysave_miriam_results.
Returns
A NamedTuple with fields:
summary :: Dictsummary_trace_meas :: Dictsummary_moment_meas :: Dictsummary_cumulant_meas :: Dictkappa_list :: Vector{String}rw_data :: Dictnlsolve_status :: Dict(present if saved; otherwise empty)labels :: Vector{String}trains :: Vector{String}
Notes
- Measurement dictionaries are keyed as
(field, :avg/:err, tag, kappa_str)wherekappa_str$\in$kappa_list. Many plotting utilities render κ as0.<kappa_str>(e.g.,"13580"→0.13580). - All summary matrices are indexed
(label_index, train_index)and align withlabels/trains. nlsolve_statusenables convergence heatmaps; schema:Dict{String, Dict{String, Dict{String, NamedTuple{(:converged, :residual_norm), Tuple{Bool, Float64}}}}}with accessnlsolve_status[label][train][solver].- For backward compatibility, if
nlsolve_statusis not found in the file, an emptyDict()is returned instead of throwing.
Example
bundle = load_jld2_Miriam("out/miriam_results.jld2")
ks_tokens = bundle.kappa_list
trace_meas = bundle.summary_trace_meas
moment_meas = bundle.summary_moment_meas
cum_meas = bundle.summary_cumulant_meas
rw = bundle.rw_data
nls_status = bundle.nlsolve_status # {} if absent in older files