Skip to content

Incorrect span normalisation for ts.pair_coalescence_counts with missing data and windows #3175

Closed

Description

@nspope

There's a bug in how internal missing data is tallied by:

ts = msprime.sim_ancestry(samples=1, discrete_genome=False)                                                                              
ts = ts.delete_intervals(np.array([[0.3, 0.6]]))
counts = ts.pair_coalescence_counts(
    windows=np.array([0.0, 0.31, 1.0]),
    time_windows=np.array([0.0, np.inf]),
    span_normalise=True,
).flatten()
np.testing.assert_array_almost_equal(counts, np.ones(2))  # <<-- fails
#assert np.all(counts > 0)  # <<-- also fails

this issue doesn't occur when the missing data is all at the flanks.

Activity

  1. added
    bug
    on May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions