Пример #1
0
def test_paramset_constrained_default_sigmas():
    pset = paramsets.constrained_by_normal(
        n_parameters=5,
        inits=[0, 1, 2, 3, 4],
        bounds=[(-1, 1), (-2, 2), (-3, 3), (-4, 4)],
        auxdata=[0, 0, 0, 0, 0],
    )
    assert pset.suggested_init == [0, 1, 2, 3, 4]
    assert pset.suggested_bounds == [(-1, 1), (-2, 2), (-3, 3), (-4, 4)]
    assert pset.constrained
    assert pset.width() == [1, 1, 1, 1, 1]
Пример #2
0
def test_paramset_constrained_custom_sigmas():
    pset = paramsets.constrained_by_normal(
        n_parameters=5,
        inits=[0, 1, 2, 3, 4],
        bounds=[(-1, 1), (-2, 2), (-3, 3), (-4, 4)],
        fixed=False,
        auxdata=[0, 0, 0, 0, 0],
        sigmas=[1, 2, 3, 4, 5],
    )
    assert pset.suggested_init == [0, 1, 2, 3, 4]
    assert pset.suggested_bounds == [(-1, 1), (-2, 2), (-3, 3), (-4, 4)]
    assert not pset.fixed
    assert pset.constrained
    assert pset.width() == [1, 2, 3, 4, 5]
Пример #3
0
def test_paramset_constrained_default_sigmas():
    pset = paramsets.constrained_by_normal(
        name='foo',
        is_scalar=False,
        n_parameters=5,
        inits=[0, 1, 2, 3, 4],
        bounds=[(-1, 1), (-2, 2), (-3, 3), (-4, 4)],
        fixed=False,
        auxdata=[0, 0, 0, 0, 0],
    )
    assert pset.suggested_init == [0, 1, 2, 3, 4]
    assert pset.suggested_bounds == [(-1, 1), (-2, 2), (-3, 3), (-4, 4)]
    assert pset.suggested_fixed == [False] * 5
    assert pset.constrained
    assert pset.width() == [1, 1, 1, 1, 1]