safe_run_sampler

ell1fit.mcmc_utils.safe_run_sampler(func_to_maximize, starting_pars, max_n=100000, outroot='chain_results', labels=None, corner_labels=None, n_autocorr=50, moves=None, local_frame=None)[source]

Run emcee with checkpointing, restart support, and convergence checks.

The chain is stored in an HDF5 backend (outroot + '.h5'). If a previous chain exists, sampling resumes from the stored state. Convergence is checked from the integrated autocorrelation time.

Parameters:
moveslist or None, optional

emcee move specification. None selects default_moves(), which is not emcee’s own default – pass emcee.moves.StretchMove() to get that back. A resumed chain is sampled with whatever is passed now, regardless of what produced the stored part; both target the same posterior, but an autocorrelation time measured across the join describes neither half.

local_framestr or None, optional

Key from local_frame_key() identifying the coordinate frame this run’s samples are written in. A stored chain whose recorded frame differs – or which records none at all, having been written before this was checked – is discarded rather than resumed, because its coordinates no longer mean what this run means by them. None skips the check and resumes as before, for callers that have no frame to declare.

Returns:
dict

Posterior summary dictionary from calculate_result_array_from_samples().