STROOPWAFELCheckpoint

class cosmic.output.STROOPWAFELCheckpoint(config, mixture, samples, is_hit, generation, gaussian_idx, bpp, bcm, initC, kick_info, num_explored, num_hits, num_hits_exploratory, fraction_explored, prior_fraction_rejected)[source]

Bases: object

Serialisable snapshot of AdaptiveSampler state after exploration.

Saving this to disk decouples the exploration + adaptation phases from the (typically more expensive) refinement phase, which is the key enabler for multi-job SLURM workflows:

# Job 1 - exploration (embarrassingly parallel within the job)
python run_explore.py          # writes  checkpoint.h5

# Job 2 - refinement (can be a larger allocation)
python run_refine.py           # reads checkpoint.h5, writes result.h5

A checkpoint is self-contained: alongside the exploration data it stores everything needed to rebuild the sampler — the parameter space, BSEDict, the derive_params/reject_systems/is_interesting callables, the remaining scalar settings, and the live RNG state — so AdaptiveSampler.from_checkpoint() needs nothing but the file. The callables and parameter space are serialised with dill.

Parameters:
configdict

Everything needed to reconstruct the AdaptiveSampler for the refinement phase: the constructor keyword arguments (parameter_space, total_systems, batch_size, BSEDict, SSEDict, is_interesting, derive_params, reject_systems, nproc, kappa, n_generations, only_save_hit_tables, min_active_fraction, min_entropy_change) plus the live rng.

mixtureGaussianMixture or None

Gaussian mixture fitted to exploration hits. None if no hits were found or adaptation has not been run yet.

samplesnumpy.ndarray

(N, D) array of explored samples in sampling space (the internal transformed space used by the mixture model). Convert to physical space with param_space.to_physical(samples).

is_hit, generation, gaussian_idxnumpy.ndarray

Per-sample flags and bookkeeping arrays (shapes (N,)).

bpp, bcm, initC, kick_infopandas.DataFrame

COSMIC output from exploration, indexed by globally unique bin_num so that samples[bin_num] gives the corresponding physical parameters.

num_exploredint

Systems evolved during exploration.

num_hitsint

Raw hit count from exploration.

num_hits_exploratoryint

Same as num_hits (stored separately for use in _refine).

fraction_exploredfloat

Adaptive fraction of total budget used for exploration.

prior_fraction_rejectedfloat

Estimated fraction of prior samples that fail physical rejection.

Methods Summary

from_file(path)

Load a checkpoint previously written by save().

save(path)

Save to an HDF5 file.

Methods Documentation

classmethod from_file(path)[source]

Load a checkpoint previously written by save().

Parameters:
pathstr

File path to read.

Returns:
STROOPWAFELCheckpoint
save(path)[source]

Save to an HDF5 file.

Parameters:
pathstr

File path to create or overwrite.