@@ -1294,9 +1294,9 @@ def test_span_normalise(self):
1294
1294
proto = proto_pair_coalescence_counts (ts , windows = windows , span_normalise = False )
1295
1295
np .testing .assert_allclose (proto , check )
1296
1296
1297
- def test_span_normalise_with_missing (self ):
1297
+ def test_span_normalise_with_missing_flanks (self ):
1298
1298
"""
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
1300
1300
"""
1301
1301
ts = self .example_ts ()
1302
1302
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):
1313
1313
proto = proto_pair_coalescence_counts (ts , windows = windows , span_normalise = True )
1314
1314
np .testing .assert_allclose (proto , check )
1315
1315
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
+
1316
1340
def test_empty_windows (self ):
1317
1341
"""
1318
1342
test that windows without nodes contain zeros
0 commit comments