Skip to content

Commit

Permalink
Merge pull request #939 from hyanwong/numpy2-fix
Browse files Browse the repository at this point in the history
Coerce NODE_IS_SAMPLE to correct numpy type before negation
  • Loading branch information
benjeffery authored Jul 17, 2024
2 parents a41d838 + d46c7ce commit ba79ad8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tsinfer/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -2293,7 +2293,10 @@ def get_samples_tree_sequence(self, map_additional_sites=True):

# All true ancestors are samples in the ancestors tree sequence. We unset
# the SAMPLE flag but keep other flags intact.
new_flags = np.bitwise_and(tables.nodes.flags, ~tskit.NODE_IS_SAMPLE)
new_flags = tables.nodes.flags
new_flags = np.bitwise_and(
new_flags, ~new_flags.dtype.type(tskit.NODE_IS_SAMPLE)
)
tables.nodes.flags = new_flags.astype(np.uint32)
sample_ids = list(self.sample_id_map.values())
assert len(tables.nodes) == sample_ids[0]
Expand Down

0 comments on commit ba79ad8

Please sign in to comment.