How to use the emcee.moves.StretchMove function in emcee

To help you get started, we’ve selected a few emcee examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dfm / emcee / tests / unit / test_stretch.py View on Github external
def test_live_dangerously(nwalkers=32, nsteps=3000, seed=1234):
    warnings.filterwarnings("error")

    # Set up the random number generator.
    np.random.seed(seed)
    state = State(np.random.randn(nwalkers, 2 * nwalkers),
                  log_prob=np.random.randn(nwalkers))
    model = Model(
        None,
        lambda x: (np.zeros(len(x)), None),
        map,
        np.random
    )
    proposal = moves.StretchMove()

    # Test to make sure that the error is thrown if there aren't enough
    # walkers.
    with pytest.raises(RuntimeError):
        proposal.propose(model, state)

    # Living dangerously...
    proposal.live_dangerously = True
    proposal.propose(model, state)
github dfm / emcee / tests / integration / test_stretch.py View on Github external
def test_nsplits_stretch(**kwargs):
    _test_normal(moves.StretchMove(nsplits=5), **kwargs)
github dfm / emcee / tests / integration / test_stretch.py View on Github external
def test_randomize_stretch(**kwargs):
    _test_normal(moves.StretchMove(randomize_split=True), **kwargs)
github dfm / emcee / tests / integration / test_stretch.py View on Github external
def test_uniform_stretch(**kwargs):
    _test_uniform(moves.StretchMove(), **kwargs)
github dfm / emcee / tests / integration / test_stretch.py View on Github external
def test_normal_stretch(blobs, **kwargs):
    kwargs["blobs"] = blobs
    _test_normal(moves.StretchMove(), **kwargs)