Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# cogent.maths.unifrac.fast_tree.sum_descendants

All Samples(10)  |  Call(8)  |  Derive(0)  |  Import(2)

```from cogent.util.unit_test import TestCase, main
from cogent.parse.tree import DndParser
from cogent.maths.unifrac.fast_tree import (count_envs, sum_env_dict,
index_envs, get_branch_lengths, index_tree, bind_to_array,
bind_to_parent_array, _is_parent_empty, delete_empty_parents,
```
```        a[3] = [1,0,0]
a[6] = [0,0,1]
sum_descendants(bindings)
self.assertEqual(a, \
array([[0,1,0],[0,1,0],[0,1,0],[1,0,0],[0,3,0],[1,0,0],\
```
```        envs = self.count_array
bound_indices = bind_to_array(self.nodes, envs)
sum_descendants(bound_indices)
bl = self.branch_lengths
tip_indices = [n._leaf_index for n in self.t.tips()]
```
```        envs = self.count_array
bound_indices = bind_to_array(self.nodes, envs)
sum_descendants(bound_indices)
bl = self.branch_lengths
tip_indices = [n._leaf_index for n in self.t.tips()]
```
```    def test_weighted_unifrac_vector(self):
"""weighted_unifrac_vector should ret correct results for model tree"""
envs = self.count_array
bound_indices = bind_to_array(self.nodes, envs)
sum_descendants(bound_indices)
```

```from cogent.util.unit_test import TestCase, main
from cogent.parse.tree import DndParser
from cogent.maths.unifrac.fast_tree import (count_envs, sum_env_dict,
index_envs, get_branch_lengths, index_tree, bind_to_array,
bind_to_parent_array, _is_parent_empty, delete_empty_parents,
```
```        a[3] = [1,0,0]
a[6] = [0,0,1]
sum_descendants(bindings)
self.assertEqual(a, \
array([[0,1,0],[0,1,0],[0,1,0],[1,0,0],[0,3,0],[1,0,0],\
```
```        envs = self.count_array
bound_indices = bind_to_array(self.nodes, envs)
sum_descendants(bound_indices)
bl = self.branch_lengths
tip_indices = [n._leaf_index for n in self.t.tips()]
```
```        envs = self.count_array
bound_indices = bind_to_array(self.nodes, envs)
sum_descendants(bound_indices)
bl = self.branch_lengths
tip_indices = [n._leaf_index for n in self.t.tips()]
```
```    def test_weighted_unifrac_vector(self):
"""weighted_unifrac_vector should ret correct results for model tree"""
envs = self.count_array
bound_indices = bind_to_array(self.nodes, envs)
sum_descendants(bound_indices)
```