Example #1
0
def do_1d_check_sorted(method, qe_method):
    xc = x.copy()
    yc = y.copy()
    s = SortedDiscreteSystem(xc, (1, 10), 10, Ny)
    # calculate all entropies
    s.calculate_entropies(method=method, calc=allcalc, qe_method=qe_method)
    # check output assinged
    assert_(s.H == getattr(s, 'H_%s' % method.replace('-', '')))
    v = np.array([s.H[k] for k in allcalc])
    assert_array_almost_equal(v, alltrue, decimal=2)
    # check didn't do something nasty to inputs
    assert_array_equal(x, xc)
    assert_array_equal(y, yc)
Example #2
0
def test_toy1_sorted():
    s = SortedDiscreteSystem(x, (3, 3), 2, Ny)
    s.calculate_entropies(method='plugin', calc=toycalc)
    v = np.array([s.H[t] for t in toycalc])
    assert_array_almost_equal(v, toytrue)