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)
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)
def test_ami_different_length_signals(): a = np.arange(10) with pytest.raises(ValueError): pypsr.ami(a, a[:-1])
def test_ami_only_one_signal(): with pytest.raises(ValueError): pypsr.ami(np.arange(10))
def test_ami_two_column_input(): a = np.arange(100) assert np.isclose(np.exp(pypsr.ami(np.vstack((a, a)).transpose())), 10)