Пример #1
0
def test_logn_trans():
    log3_trans = log_trans(3)
    _test_trans(log3_trans, arr)

    log4_trans = log_trans(4, domain=(0.1, 100),
                           breaks=mpl_breaks(),
                           minor_breaks=minor_breaks())
    _test_trans(log4_trans, arr)
Пример #2
0
def test_mpl_breaks():
    x = np.arange(100)
    limits = min(x), max(x)
    for nbins in (5, 7, 10, 13, 31):
        breaks = mpl_breaks(nbins=nbins)
        assert len(breaks(limits)) <= nbins + 1

    limits = float('-inf'), float('inf')
    breaks = mpl_breaks(n=5)
    assert len(breaks(limits)) == 0

    # Zero range discrete
    limits = [1, 1]
    assert len(breaks(limits)) == 1
    assert breaks(limits)[0] == limits[1]

    # Zero range continuous
    limits = [np.pi, np.pi]
    assert len(breaks(limits)) == 1
    assert breaks(limits)[0] == limits[1]
Пример #3
0
def test_mpl_breaks():
    x = np.arange(100)
    limits = min(x), max(x)
    for nbins in (5, 7, 10, 13, 31):
        breaks = mpl_breaks(nbins=nbins)
        assert len(breaks(limits)) <= nbins+1

    limits = float('-inf'), float('inf')
    breaks = mpl_breaks(n=5)
    assert len(breaks(limits)) == 0

    # Zero range discrete
    limits = [1, 1]
    assert len(breaks(limits)) == 1
    assert breaks(limits)[0] == limits[1]

    # Zero range continuous
    limits = [np.pi, np.pi]
    assert len(breaks(limits)) == 1
    assert breaks(limits)[0] == limits[1]