@@ -1294,9 +1294,9 @@ def test_span_normalise(self):
12941294 proto = proto_pair_coalescence_counts (ts , windows = windows , span_normalise = False )
12951295 np .testing .assert_allclose (proto , check )
12961296
1297- def test_span_normalise_with_missing (self ):
1297+ def test_span_normalise_with_missing_flanks (self ):
12981298 """
1299- test case where span is normalised and there are intervals without trees
1299+ test case where span is normalised and there are flanking intervals without trees
13001300 """
13011301 ts = self .example_ts ()
13021302 missing = np .array ([[0.0 , 0.1 ], [0.8 , 1.0 ]]) * ts .sequence_length
@@ -1313,6 +1313,30 @@ def test_span_normalise_with_missing(self):
13131313 proto = proto_pair_coalescence_counts (ts , windows = windows , span_normalise = True )
13141314 np .testing .assert_allclose (proto , check )
13151315
1316+ def test_span_normalise_with_missing_interior (self ):
1317+ """
1318+ test that span normalisation correctly calculates internal missing data
1319+ """
1320+ ts = msprime .sim_ancestry (samples = 1 , discrete_genome = False )
1321+ missing_interval = np .array ([[0.3 , 0.6 ]]) * ts .sequence_length
1322+ windows = np .array ([0.0 , 0.31 , 1.0 ]) * ts .sequence_length
1323+ time_windows = np .array ([0.0 , np .inf ])
1324+ ts = ts .delete_intervals (missing_interval )
1325+ check = np .ones (windows .size - 1 )
1326+ implm = ts .pair_coalescence_counts (
1327+ windows = windows ,
1328+ time_windows = time_windows ,
1329+ span_normalise = True ,
1330+ ).flatten ()
1331+ np .testing .assert_array_almost_equal (implm , check )
1332+ proto = proto_pair_coalescence_counts (
1333+ ts ,
1334+ windows = windows ,
1335+ time_windows = time_windows ,
1336+ span_normalise = True ,
1337+ ).flatten ()
1338+ np .testing .assert_array_almost_equal (proto , check )
1339+
13161340 def test_empty_windows (self ):
13171341 """
13181342 test that windows without nodes contain zeros
0 commit comments