-
Notifications
You must be signed in to change notification settings - Fork 50
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] ENH: Custom section colors in Cell.plot_morphology #646
Conversation
@@ -655,13 +655,20 @@ def parconnect_from_src(self, gid_presyn, nc_dict, postsyn, | |||
|
|||
return nc | |||
|
|||
def plot_morphology(self, ax=None, cell_types=None, show=True): |
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.
Also I don't think cell_types
is used anywhere? @jasmainak
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 thought this was a method of Network
object so you can loop over the cell_types
in a network objec ... I remember a student was working on this but not sure if it ever got merged
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.
Yeah I think that ended up getting dropped, the tests are passing so I think it's safe to remove for now
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## master #646 +/- ##
==========================================
+ Coverage 91.79% 91.90% +0.10%
==========================================
Files 22 22
Lines 4316 4323 +7
==========================================
+ Hits 3962 3973 +11
+ Misses 354 350 -4
|
Honestly the code for plotting the sections with different colors is pretty self contained. I think it would be better to bring this to merge to keep the diff small, and then I'll open the PR for plotting the network with the true cell morphologies |
I'm guessing you want granular control over section colors in order to map the section voltage to a color map for each frame? Re: the network plotting function, you can probably pull some of the logic from #499 since @mjpelah was working on a similar problem. My preference would be to name it Then, |
@@ -849,7 +865,8 @@ def plot_cell_morphology(cell, ax, show=True): | |||
xs.append(pt[0] + dx) | |||
ys.append(pt[1] + dz) | |||
zs.append(pt[2] + dy) | |||
ax.plot(xs, ys, zs, 'b-', linewidth=linewidth) |
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.
The 'b-'
is redundant now since the color 'b'
is explicitly set when None
is passed to color
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.
Looks good @ntolley! |
@rythorpe that's exactly right! Since the voltages recorded for each section are stored in a dictionary, it's really easy to convert that to cell colors |
I'd like to make a few additions to the visualization functions that will make animating HNN simulations more straight forward. The main change is allowing a custom color for each cell section in
Cell.plot_morphology
like so:The other addition will be a
plot_network_morphology
function (alternate name suggestions are appreciated!) that simply callsCell.plot_morphology
and places the cells in their appropriate 3D position.With these two functions the code to make animations is pretty slim and could be added as an example to the main website. Let me know what you guys think! @rythorpe @jasmainak @chenghuzi