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
[MRG] Make cell morphology plots reflect actual cell size #481
Conversation
Going through the code, the issue here is that In the code however, the length attribute is used by default when building the cell: Line 416 in bab8196
In my mind, the easiest solution is to somehow extract the real |
Wouldn't we then need to restrict plotting morphology until after |
I was thinking more in line with building the cell in Neuron, updating the values, and then deleting the object. Alternatively, we could make the interface more flexible and explicitly build the whole network without simulating, Then we could allow |
You could also copy the logic from here: Probably easier than rebuilding and destroying neuron objects ... but that trick might be useful elsewhere :) |
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.
I think there's still a bit more to do here, like call |
@rythorpe is right, there's a few things to take care of still. Good suggestion moving it to be a method of Right now the plots do update. However, all of the neighboring sections remain in place so the pieces are now disconnected. |
After working at this more, I honestly think building the cell is the best way to actually plot the morphology. Inspecting the geometry more closely, the points defined in With a built cell you can compare the two with print(net.cell_types['L5_pyramidal'].sections['apical_trunk'].end_pts)
print(net.cell_types['L5_pyramidal']._nrn_sections['apical_trunk'].psection()['morphology']['pts3d'])
[[0, 0, 23], [0, 0, 83]]
[(0.0, 0.0, 39.0, 10.199999809265137), (0.0, 0.0, 141.0, 10.199999809265137)] The length of the apical trunk is This also raises the question, why is there such a mismatch with the points defined here? |
Different approach, I've implemented net = jones_2009_model()
#Default end_pts
net.cell_types['L5_pyramidal'].plot_morphology()
# Actual end_pts
net.cell_types['L5_pyramidal'].update_end_pts()
net.cell_types['L5_pyramidal'].plot_morphology()
# Modified end_pts
net.cell_types['L5_pyramidal'].sections['soma'].L = 500
net.cell_types['L5_pyramidal'].update_end_pts()
net.cell_types['L5_pyramidal'].plot_morphology() |
Codecov Report
@@ Coverage Diff @@
## master #481 +/- ##
==========================================
+ Coverage 87.63% 87.74% +0.10%
==========================================
Files 19 19
Lines 3792 3826 +34
==========================================
+ Hits 3323 3357 +34
Misses 469 469
Continue to review full report at Codecov.
|
I'm not a big fan of the 2-step API ... can you make it so that everything is consistent as soon as you update the lengths? The user shouldn't have to remember to call another method for the lengths to be consistent. |
So I have made it so that all attribute modifications go through the common function While before it was nice to be able to directly modify section attributes like |
agreed about that. Consistency in the API is important. Make sure to update whats_new when ready! |
Thanks @ntolley ! 🥳 |
Closes #433.