Skip to content

Commit 2155335

Browse files
hyanwongbenjeffery
authored andcommitted
Coerce NODE_IS_SAMPLE to correct numpy type before negation
Fixes #937
1 parent 342454c commit 2155335

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tsinfer/inference.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1970,7 +1970,10 @@ def get_samples_tree_sequence(self, map_additional_sites=True):
19701970

19711971
# All true ancestors are samples in the ancestors tree sequence. We unset
19721972
# the SAMPLE flag but keep other flags intact.
1973-
new_flags = np.bitwise_and(tables.nodes.flags, ~tskit.NODE_IS_SAMPLE)
1973+
new_flags = tables.nodes.flags
1974+
new_flags = np.bitwise_and(
1975+
new_flags, ~new_flags.dtype.type(tskit.NODE_IS_SAMPLE)
1976+
)
19741977
tables.nodes.flags = new_flags.astype(np.uint32)
19751978
sample_ids = list(self.sample_id_map.values())
19761979
assert len(tables.nodes) == sample_ids[0]

0 commit comments

Comments
 (0)