示例#1
0
def test_ami():
    a = np.arange(100)
    assert np.isclose(np.exp(pypsr.ami(a, a)), 10)
    assert np.isclose(pypsr.ami(a, np.ones_like(a)), 0)
示例#2
0
def test_ami_unsqueezed_vector():
    a = np.arange(10)[:, np.newaxis]
    assert np.isclose(np.exp(pypsr.ami(a, a)), 10)
    assert np.isclose(pypsr.ami(a, np.ones_like(a)), 0)
示例#3
0
def test_ami_different_length_signals():
    a = np.arange(10)
    with pytest.raises(ValueError):
        pypsr.ami(a, a[:-1])
示例#4
0
def test_ami_only_one_signal():
    with pytest.raises(ValueError):
        pypsr.ami(np.arange(10))
示例#5
0
def test_ami_two_column_input():
    a = np.arange(100)
    assert np.isclose(np.exp(pypsr.ami(np.vstack((a, a)).transpose())), 10)