Skip to content

Commit eafbafe

Browse files
committed
Test node permutation via bin map
1 parent defd092 commit eafbafe

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

python/tests/test_lowlevel.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4259,6 +4259,15 @@ def test_output_dims(self):
42594259
coal = self.pair_coalescence_counts(ts, span_normalise=True)
42604260
assert coal.shape == dim
42614261

4262+
def test_node_shuffle(self):
4263+
rng = np.random.default_rng(1024)
4264+
ts = self.example_ts()
4265+
coal = self.pair_coalescence_counts(ts)
4266+
node_bin_map = np.arange(ts.get_num_nodes(), dtype=np.int32)
4267+
rng.shuffle(node_bin_map)
4268+
coal_shuffle = self.pair_coalescence_counts(ts, node_bin_map=node_bin_map)
4269+
np.testing.assert_allclose(coal_shuffle[..., node_bin_map], coal)
4270+
42624271
@pytest.mark.parametrize("bad_node", [-1, -2, 1000])
42634272
def test_c_tsk_err_node_out_of_bounds(self, bad_node):
42644273
ts = self.example_ts()

0 commit comments

Comments
 (0)