-
Notifications
You must be signed in to change notification settings - Fork 52
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] add method to plot cell morphologies #319
Conversation
1740d3c
to
1d4e701
Compare
697f6b2
to
8d57230
Compare
Codecov Report
@@ Coverage Diff @@
## master #319 +/- ##
==========================================
+ Coverage 90.43% 90.53% +0.10%
==========================================
Files 14 14
Lines 2425 2493 +68
==========================================
+ Hits 2193 2257 +64
- Misses 232 236 +4
Continue to review full report at Codecov.
|
doc/whats_new.rst
Outdated
@@ -16,6 +16,8 @@ Changelog | |||
~~~~~~~~~ | |||
- Store all connectivity information under :attr:`~hnn_core.Network.connectivity` before building the network, by `Nick Tolley`_ in `#276 <https://github.com/jonescompneurolab/hnn-core/pull/276>`_ | |||
|
|||
- Add new function :func:`~hnn_core.viz.plot_cell_morphology` to visualize cell morphology in `#319 <https://github.com/jonescompneurolab/hnn-core/pull/319>`_ |
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.
- Add new function :func:`~hnn_core.viz.plot_cell_morphology` to visualize cell morphology in `#319 <https://github.com/jonescompneurolab/hnn-core/pull/319>`_ | |
- Add new function :func:`~hnn_core.viz.plot_cell_morphology` to visualize cell morphology, by `Mainak Jas`_ in `#319 <https://github.com/jonescompneurolab/hnn-core/pull/319>`_ |
hnn_core/network.py
Outdated
---------- | ||
axes : list of instance of Axes3D | ||
Matplotlib 3D axis | ||
cell_types : 'L5Pyr' | 'L5Basket' | list |
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.
cell_types : 'L5Pyr' | 'L5Basket' | list | |
cell_types : str | list of str |
hnn_core/network.py
Outdated
axes : list of instance of Axes3D | ||
Matplotlib 3D axis | ||
cell_types : 'L5Pyr' | 'L5Basket' | list | ||
The cell types. |
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 cell types. | |
The cell types. Valid strings include: 'L5Pyr', 'L2Pyr' |
hnn_core/viz.py
Outdated
---------- | ||
axes : list of instance of Axes3D | ||
Matplotlib 3D axis | ||
cell_types : 'L5Pyr' | 'L5Basket' | list |
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.
cell_types : 'L5Pyr' | 'L5Basket' | list | |
cell_types : str | list of str |
hnn_core/viz.py
Outdated
axes : list of instance of Axes3D | ||
Matplotlib 3D axis | ||
cell_types : 'L5Pyr' | 'L5Basket' | list | ||
The cell types. |
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 cell types. | |
The cell types. Valid strings include: 'L5Pyr', 'L2Pyr' |
I like the barebones first pass at (any!) visualisation. This could clearly be improved on in future PRs. Could we make this 2D? The 3rd dimension is super confusing: rotating the axes isn't stable with effectively two degrees of freedom. As long as our basal oblique dendrites are in the same plane, I think we should plot them in a XZ-system, where Z is the cortical depth direction. The NEURON sections are defined as (x, z, y), which no doubt has a historical reason. I'd also advocate fixing the Z-range to always start from 0 (white matter begins). That way the size difference between L2/3 and L5 pyramidals becomes obvious, as does their relative depth in cortex. |
okay starting in reverse order with comments. @cjayb better? it's still a matplotlib 3D plot but since axes are turned off, I don't anticipate users to interact with. It also keeps the door open for future additions where there is a non-zero projection of a dendrite along the third axis |
I guess I prefer the new axes-less plot, yes. Emphasises relative size and location, which are important. |
def secs(self): | ||
return _secs_Basket() | ||
|
||
def set_geometry(self): |
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.
this should be unified with Pyramidal
class set_geometry
but I would keep this for a followup PR
7796c4c
to
050e609
Compare
050e609
to
2a2d519
Compare
As mentioned in #202, could we please agree on our axes? I think this PR should be relatable to the output of The above is clearly rotated to align the apical dendrites with the Z-direction (which intuitively makes more sense to me...) |
@rythorpe see caed5ff which gives now I do concede that the sections are not cylindrical but you don't realize that until you interact with this figure. Personally, for me, this is good enough for the use case I outlined above (educational). Cylindrical is possible although probably not worth it currently |
I like this, +1 for merge and iterate later |
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 see I hadn't submitted this, sorry... @jasmainak see my one question in the test, otherwise good to merge?
hnn_core/tests/test_viz.py
Outdated
with pytest.raises(ValueError, match='Unrecognized cell type'): | ||
plot_cell_morphology(cell_types='blah') | ||
axes = plot_cell_morphology(cell_types='L2Pyr') | ||
len(axes) == 1 |
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.
Missing assert?
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.
@jasmainak could you confirm this before I merge?
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.
oops indeed, fixed now
Go @jasmainak ! |
Plots the cell morphology