| 106 | @pytest.mark.parametrize("T_A, T_B", test_data) |
| 107 | @pytest.mark.parametrize("percentages", percentages) |
| 108 | def test_scraamp_self_join(T_A, T_B, percentages): |
| 109 | m = 3 |
| 110 | zone = int(np.ceil(m / 4)) |
| 111 | |
| 112 | for p in [1.0, 2.0, 3.0]: |
| 113 | for percentage in percentages: |
| 114 | seed = np.random.randint(100000) |
| 115 | |
| 116 | np.random.seed(seed) |
| 117 | ref_P, ref_I, ref_left_I, ref_right_I = naive.scraamp( |
| 118 | T_B, m, T_B, percentage, zone, False, None, p=p |
| 119 | ) |
| 120 | |
| 121 | np.random.seed(seed) |
| 122 | approx = scraamp( |
| 123 | T_B, |
| 124 | m, |
| 125 | ignore_trivial=True, |
| 126 | percentage=percentage, |
| 127 | pre_scraamp=False, |
| 128 | p=p, |
| 129 | ) |
| 130 | approx.update() |
| 131 | comp_P = approx.P_ |
| 132 | comp_I = approx.I_ |
| 133 | comp_left_I = approx.left_I_ |
| 134 | comp_right_I = approx.right_I_ |
| 135 | |
| 136 | naive.replace_inf(ref_P) |
| 137 | naive.replace_inf(comp_P) |
| 138 | npt.assert_almost_equal(ref_P, comp_P) |
| 139 | npt.assert_almost_equal(ref_I, comp_I) |
| 140 | npt.assert_almost_equal(ref_left_I, comp_left_I) |
| 141 | npt.assert_almost_equal(ref_right_I, comp_right_I) |
| 142 | |
| 143 | |
| 144 | @pytest.mark.parametrize("T_A, T_B", test_data) |