-
Notifications
You must be signed in to change notification settings - Fork 24
Add Vasculature section_offsets & section_connectivity #352
Add Vasculature section_offsets & section_connectivity #352
Conversation
"Example: accessing diameters of n'th section will be located in the DIAMETERS\n" | ||
"array from DIAMETERS[sectionOffsets(n)] to DIAMETERS[sectionOffsets(n+1)-1]\n" | ||
"\n" | ||
"Note: for convenience, the last point of this array is the points array size\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I follow; I think the word point
in the last point of this array
is confusing, but I'm still not following when I substitute element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's say we have the following points (I list their ids):
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
And three sections:
S1: [0, 1, 2]
S2: [3, 4, 5]
S3: [6, 7, 8, 9]
The offsets will be:
[0, 3, 6, 10]
So the last entry is equal to the size of the points dataset. This allows for applying a diff for instance to calculate the section length (in terms of points) for each section without having to allocate an extra array to add that extra value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, ok; basicaly if that example can be copied to the test in tests/test_10_vasculature.py
that would be good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, I copied it there.
tests/test_10_vasculature.py
Outdated
offset += len(sec.points) | ||
expected_offsets.append(offset) | ||
|
||
npt.assert_allclose(morphology.section_offsets, expected_offsets) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add an example of using the ...for convenience,...
with a comment, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Closes #160
Closes #159