Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Add Vasculature section_offsets & section_connectivity #352

Merged
merged 9 commits into from
Nov 26, 2021
Merged

Add Vasculature section_offsets & section_connectivity #352

merged 9 commits into from
Nov 26, 2021

Conversation

eleftherioszisis
Copy link
Contributor

@eleftherioszisis eleftherioszisis commented Oct 12, 2021

Closes #160
Closes #159

@eleftherioszisis eleftherioszisis changed the title Add Vasculature section_offsets Add Vasculature section_offsets & section_connectivity Oct 31, 2021
"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"
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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.

offset += len(sec.points)
expected_offsets.append(offset)

npt.assert_allclose(morphology.section_offsets, expected_offsets)
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@eleftherioszisis eleftherioszisis merged commit 75d2e19 into BlueBrain:master Nov 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vasculature section offsets Vasculature section connectivity
2 participants