Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

ensure_max_edge_length should process all trees #32

Open
jstriebel opened this issue Dec 4, 2019 · 2 comments
Open

ensure_max_edge_length should process all trees #32

jstriebel opened this issue Dec 4, 2019 · 2 comments

Comments

@jstriebel
Copy link
Contributor

jstriebel commented Dec 4, 2019

Current ensure_max_edge_length processes only trees that are part of a group. It should work on all trees instead.
The relevant lines seem to be https://github.com/scalableminds/wknml/blob/master/wknml/nml_utils.py#L101-L102

@jstriebel
Copy link
Contributor Author

@valentin-pinkau Do you know if this would be an easy fix?

@daniel-wer
Copy link
Member

It should also work with empty trees, see this stacktrace:

File "/usr/local/lib/python3.6/dist-packages/wknml/nml_utils.py", line 98, in ensure_max_edge_length
    max_id = detect_max_node_id_from_all_graphs(nml_graph)
  File "/usr/local/lib/python3.6/dist-packages/wknml/nml_utils.py", line 49, in detect_max_node_id_from_all_graphs
    max_id_of_current_tree = np.array(list(tree.nodes)).max()
  File "/usr/local/lib/python3.6/dist-packages/numpy/core/_methods.py", line 30, in _amax
    return umr_maximum(a, axis, None, out, keepdims, initial, where)
ValueError: zero-size array to reduction operation maximum which has no identity

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants