@@ -76,8 +76,8 @@ def test_diversity__windowed(sample_size):
76
76
77
77
# Calculate diversity using tskit windows
78
78
# Find the variant positions so we can have windows with a fixed number of variants
79
- positions = [ variant . site . position for variant in ts . variants ()]
80
- windows = [0 ] + positions [::25 ][1 :] + [ts .sequence_length ]
79
+ positions = ts . tables . sites . position
80
+ windows = np . concatenate (( [0 ], positions [::25 ][1 :], [ts .sequence_length ]))
81
81
ts_div = ts .diversity (windows = windows , span_normalise = False )
82
82
np .testing .assert_allclose (div , ts_div )
83
83
@@ -144,8 +144,8 @@ def test_divergence__windowed(sample_size, n_cohorts, chunks):
144
144
145
145
# Calculate diversity using tskit windows
146
146
# Find the variant positions so we can have windows with a fixed number of variants
147
- positions = [ variant . site . position for variant in ts . variants ()]
148
- windows = [0 ] + positions [::25 ][1 :] + [ts .sequence_length ]
147
+ positions = ts . tables . sites . position
148
+ windows = np . concatenate (( [0 ], positions [::25 ][1 :], [ts .sequence_length ]))
149
149
n_windows = len (windows ) - 1
150
150
ts_div = np .full ([n_windows , n_cohorts , n_cohorts ], np .nan )
151
151
for i , j in itertools .combinations (range (n_cohorts ), 2 ):
@@ -272,8 +272,8 @@ def test_Fst__windowed(sample_size, n_cohorts, chunks):
272
272
273
273
# Calculate Fst using tskit windows
274
274
# Find the variant positions so we can have windows with a fixed number of variants
275
- positions = [ variant . site . position for variant in ts . variants ()]
276
- windows = [0 ] + positions [::25 ][1 :] + [ts .sequence_length ]
275
+ positions = ts . tables . sites . position
276
+ windows = np . concatenate (( [0 ], positions [::25 ][1 :], [ts .sequence_length ]))
277
277
n_windows = len (windows ) - 1
278
278
ts_fst = np .full ([n_windows , n_cohorts , n_cohorts ], np .nan )
279
279
for i , j in itertools .combinations (range (n_cohorts ), 2 ):
0 commit comments