tutorials
tutorials copied to clipboard
Add examples of using numpy traversal methods
See https://github.com/tskit-dev/tskit/issues/1788
I discussed this with @jeromekelleher - we wondered whether the example in the tutorial would be better moved to a section of the docs (not the tutorials), designed for simple examples like this. There we could illustrate 4 methods of getting the total branch length of a tree:
- Using
tree.nodes()to iterate through - Using numpy arrays
- High performance, using numpy arrays and numba
- Using the built-in branch length method
It would be nice to illustrate the difference in speed between the two, by picking an example that took (e.g.) 1 sec for method (1).
An example of 2. is given in https://github.com/tskit-dev/tskit/issues/1788#issuecomment-983979167