-
Notifications
You must be signed in to change notification settings - Fork 83
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
You might hope that the span-normalised coalescence rate would be the same for a given tree, even if the tree sequences has empty regions at the start or end, or even in the middle. However, this test fails:
ts = tskit.Tree.generate_comb(10, span=10).tree_sequence
time_intervals = np.logspace(0, np.log10(ts.max_time), 4)
time_intervals = np.concatenate(([0], time_intervals, [np.inf]))
ts_with_missing = ts.delete_intervals([[0,2],[6,8]])
assert np.allclose(
ts.pair_coalescence_rates(time_intervals),
ts_with_missing.pair_coalescence_rates(time_intervals),
)It passes once we trim down:
ts_trimmed = ts.delete_intervals([[0,2],[6,10]]).trim()
assert np.allclose(
ts.pair_coalescence_rates(time_intervals),
ts_trimmed.pair_coalescence_rates(time_intervals),
)@nspope says
I see what the problem is. Basically, I'm assuming weights sum to 1 so that we can calculate rates even when there are multiple roots (e.g. decapitated trees). That won't be the case if we're incorrectly normalising, however
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working