Skip to content

LoadedBundle

@dataclass
class LoadedBundle()

LoadedBundle is the return value of load_bundle (and the underlying bundle.loader.build_from). Each field is None when the corresponding component is absent from the archive.

LoadedBundle is re-exported at SymbolicDSGE root.

Fields:

Name Type Description
manifest Manifest The full bundle manifest, including member inventory, checksums, and inline SimSpec.
reference SolvedModel \| None Re-solved reference model, or None if the bundle has no reference.yaml.
dgp SolvedModel \| None Re-solved DGP model, or None if absent.
estimation LoadedEstimation \| None Estimation artifacts, or None if estimation/ was not in the bundle.
mc LoadedMC \| None Monte Carlo artifacts, or None if montecarlo/ was not in the bundle.
simulation SimSpec \| None Simulation prefill, or None if not set.
Re-solving on load

reference and dgp are reconstructed by re-parsing the embedded YAML and re-running DSGESolver.compile(**compile_kwargs).solve(**solve_kwargs) with the kwargs recorded at compile time. The receiver does not need the original parser state.

LoadedEstimation

@dataclass
class LoadedEstimation()

Fields:

Name Type Description
spec EstimationSpec The text-only run specification. Always present when LoadedEstimation is.
result OptimizationResultMeta \| MCMCResultMeta \| None Result metadata (scalar slice). Discriminated by "type": "mcmc" \| "optimization" in the embedded JSON.
observed NDArray[np.float64] \| None Observed y matrix shaped (n, k), reconstructed from the CSV or Parquet member.
posterior dict[str, NDArray] \| None MCMC posterior columns — {"samples": (n_draws, n_params), "logpost": (n_draws,)} by convention.
Pairing metadata with traces

MCMCResultMeta carries only the scalar slice. To reconstruct the full sampling diagnostics or repaint the GUI, pair the metadata with posterior — both come back as part of the same LoadedEstimation so callers don't have to track member paths.

Re-running a loaded estimation

spec.to_estimator_inputs() lowers the spec to an EstimatorInputsestimated_params, theta0, priors (built Prior objects), and bounds — directly feedable to DSGESolver.estimate(...). The lowering lives in the core library, so a loaded estimation can be re-run without the [ui] extra. See the Bundle Loading Guide.

LoadedMC

@dataclass
class LoadedMC()

Fields:

Name Type Description
spec PipelineSpec The pipeline graph (nodes + edges). Always present when LoadedMC is.
document dict[str, Any] \| None Trace-free run document (test/regression summaries, timing, etc.).
traces dict[str, NDArray] \| None Bulk trace columns keyed by test.<name>.{statistic,pval,status} / regression.<name>.{coef,r2,status}.
resources dict[str, Any] Restored side-channel objects referenced by the spec, including raw-data arrays and custom callables.

Methods:

LoadedMC.wire(
) -> dict[str, Any] | None

Re-merge document and traces into the canonical UI wire shape (the same dict an in-process run would emit). Returns None when either side is missing.

When wire() returns None

A bundle authored with the pipeline spec only (no completed run attached) carries neither document nor traces. wire() reports None so callers can distinguish "no run available" from a run with empty traces.

Re-running a loaded pipeline

from SymbolicDSGE.monte_carlo import run_pipeline runs spec against the loaded models without the [ui] extra. Pass resources=loaded.mc.resources when the spec contains raw-data or custom nodes. See Monte Carlo > Overview for the core-side runner exports and the Bundle Loading Guide.

Example

from SymbolicDSGE import load_bundle

loaded = load_bundle("experiment-1.sdsge")

# Use the re-solved reference model directly.
if loaded.reference is not None:
    sim = loaded.reference.sim(T=25, observables=True)

# Inspect the estimation tab.
if loaded.estimation is not None:
    print(loaded.estimation.spec.method)
    if loaded.estimation.posterior is not None:
        samples = loaded.estimation.posterior["samples"]
        print(samples.shape)

# Manifest is always present.
print(loaded.manifest.created_by, loaded.manifest.created_at)

See also