Skip to content

Commit

Permalink
Coerce NODE_IS_SAMPLE to correct numpy type before negation
Browse files Browse the repository at this point in the history
Fixes #937
  • Loading branch information
hyanwong authored and benjeffery committed Jul 17, 2024
1 parent 342454c commit 2155335
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 @@ -1970,7 +1970,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 2155335

Please sign in to comment.