Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASCII art for segment tree #2224

Merged

Conversation

thorstenhater
Copy link
Contributor

@thorstenhater thorstenhater commented Sep 20, 2023

Allow ASCII rendering of segment trees and morphologies for debugging
Example segment_tree

                      |              |                +-[-- id=1161 --]-+-[-- id=1709 --]---[-- id=2234 --]-+-[-- id=2625 --]---[-- id=3172 --]
                      |              |                |                 |                                   +-[-- id=2928 --]---[-- id=3765 --]
                      |              |                |                 |
                      |              |                |                 +-[-- id=1721 --]---[-- id=3504 --]---[-- id=3846 --]
                      |              |                |
                      |              |                +-[-- id=1867 --]
                      |              |
                      |              +-[-- id=1451 --]-+-[-- id=2356 --]
                      |                                +-[-- id=2471 --]---[-- id=2670 --]---[-- id=4031 --]
                      |
                      |
                      +-[-- id=35 --]---[-- id=263 --]-+-[-- id=409 --]-+-[-- id=475 --]---[-- id=1347 --]
                      |                                |                +-[-- id=480 --]-+-[-- id=1764 --]-+-[-- id=1912 --]
                      |                                |                |                |                 +-[-- id=2975 --]
                      |                                |                |                |
                      |                                |                |                +-[-- id=2047 --]
                      |                                |                |
                      |                                |                +-[-- id=3124 --]
                      |                                |
                      |                                +-[-- id=548 --]-+-[-- id=1436 --]---[-- id=1699 --]
                      |                                |                +-[-- id=2194 --]
                      |                                |                +-[-- id=3250 --]
                      |                                |                +-[-- id=3281 --]
                      |                                |                +-[-- id=3589 --]
                      |                                |
                      |                                +-[-- id=651 --]-+-[-- id=943 --]-+-[-- id=1024 --]-+-[-- id=1070 --]-+-[-- id=1477 --]-+-[-- id=1939 --]
                      |                                |                |                |                 |                 |                 +-[-- id=3457 --]
                      |                                |                |                |                 |                 |
                      |                                |                |                |                 |                 +-[-- id=2475 --]
                      |                                |                |                |                 |
                      |                                |                |                |                 +-[-- id=1929 --]
                      |                                |                |                |
                      |                                |                |                +-[-- id=1314 --]---[-- id=2677 --]
                      |                                |                |
                      |                                |                +-[-- id=1793 --]---[-- id=2792 --]
                      |                                |
                      |                                +-[-- id=1391 --]-+-[-- id=2548 --]
                      |                                                  +-[-- id=2743 --]
                      |
                      |
                      +-[-- id=1621 --]---[-- id=3879 --]
                      +-[-- id=1914 --]-+-[-- id=2572 --]
                      |                 +-[-- id=3385 --]
                      |
                      +-[-- id=3991 --]

and the same snippet in the equivalent morphology

                   +-<-- id=217 len=1 -->-+-<-- id=301 len=1 -->-+-<-- id=310 len=2 -->-+-<-- id=2246 len=2 -->
                   |                      |                      |                      +-<-- id=2830 len=1 -->
                   |                      |                      |
                   |                      |                      +-<-- id=323 len=1 -->-+-<-- id=361 len=3 -->
                   |                      |                      |                      +-<-- id=1696 len=1 -->-+-<-- id=2166 len=1 -->
                   |                      |                      |                      |                       +-<-- id=2260 len=2 -->
                   |                      |                      |                      |
                   |                      |                      |                      +-<-- id=1735 len=1 -->-+-<-- id=1818 len=1 -->
                   |                      |                      |                      |                       +-<-- id=2118 len=1 -->
                   |                      |                      |                      |
                   |                      |                      |                      +-<-- id=1909 len=3 -->
                   |                      |                      |                      +-<-- id=2772 len=1 -->
                   |                      |                      |                      +-<-- id=3004 len=1 -->
                   |                      |                      |
                   |                      |                      +-<-- id=344 len=1 -->-+-<-- id=714 len=1 -->-+-<-- id=937 len=2 -->
                   |                      |                      |                      |                      +-<-- id=1292 len=2 -->
                   |                      |                      |                      |                      +-<-- id=1698 len=1 -->-+-<-- id=2036 len=1 -->
                   |                      |                      |                      |                                              +-<-- id=2382 len=1 -->
                   |                      |                      |                      |
                   |                      |                      |                      |
                   |                      |                      |                      +-<-- id=864 len=4 -->
                   |                      |                      |                      +-<-- id=2412 len=2 -->
                   |                      |                      |
                   |                      |                      +-<-- id=1570 len=1 -->
                   |                      |
                   |                      +-<-- id=355 len=1 -->-+-<-- id=928 len=1 -->-+-<-- id=2200 len=2 -->
                   |                      |                      |                      +-<-- id=2427 len=1 -->
                   |                      |                      |                      +-<-- id=2523 len=1 -->
                   |                      |                      |                      +-<-- id=2988 len=1 -->
                   |                      |                      |
                   |                      |                      +-<-- id=1303 len=1 -->-+-<-- id=2169 len=1 -->-+-<-- id=2334 len=1 -->
                   |                      |                      |                       |                       +-<-- id=2708 len=2 -->
                   |                      |                      |                       |
                   |                      |                      |                       +-<-- id=2647 len=1 -->
                   |                      |                      |
                   |                      |                      +-<-- id=1399 len=1 -->
                   |                      |
                   |                      +-<-- id=704 len=2 -->
                   |
                   +-<-- id=1157 len=2 -->

Closes #2132

@halfflat
Copy link
Contributor

Would this be something that might better live in arborio/? Especially if down the track we're looking towards pretty-printed representations of e.g. morphologies too.

@thorstenhater
Copy link
Contributor Author

thorstenhater commented Sep 21, 2023

Yes, adding a centralised location to put debug printers is probably nice.

arbor/morph/segment_tree.cpp Outdated Show resolved Hide resolved
arborio/debug.cpp Outdated Show resolved Hide resolved
doc/cpp/morphology.rst Show resolved Hide resolved
@thorstenhater thorstenhater requested a review from ErbB4 August 13, 2024 12:50
Copy link
Collaborator

@ErbB4 ErbB4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great. I don't know that generating such a tree representation of ASCII is something hehe

@@ -1,4 +1,3 @@
#include <stdexcept>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed anymore?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation under python?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation under cpp?

@thorstenhater thorstenhater merged commit 2c08a56 into arbor-sim:master Aug 15, 2024
23 checks passed
@thorstenhater thorstenhater deleted the feat/ascii-art-segment-tree branch August 15, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ASCII rendering segment trees
4 participants