tskit
tskit copied to clipboard
Copy child/parent semantics for split_edges and decapitate
In #2334 we simplified the semantics of the population argument in split_edges and decapitate to default to -1 rather than inherit from the child node. It will probably be useful at some point (and would be straightforward to implement) to specify that inserted nodes should inherit these values from the parent or child of the edge as discussed here https://github.com/tskit-dev/tskit/pull/2331#issuecomment-1152384397
The proposal is to have an API that looks something like this:
def decapitate, time, *, flags=None, population=None, metadata=None, copy_parent=False, copy_child=False):
"""
If flags, population or metadata are not specified and copy_parent is True, copy the value from the edge's
parent node (likewise for copy_child). If values are explicitly provided for any of the node fields, the field
in question will **not** be copied from the child/parent.
"""