Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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] Spikes raster plot colors #895
base: master
Are you sure you want to change the base?
[MRG] Spikes raster plot colors #895
Changes from 6 commits
b978cca
7f1747a
b25283d
fb13b78
9717ae7
308ffe8
6928cd8
834a8b1
c97f520
fec7b57
30fa1bb
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 docstring
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 don't fully follow the categorization ... maybe docstrings will clarify
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.
bad idea to have a default list in a function. You will get funky effects in Python ... default should not be a mutable
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.
Thanks, we're going to refactor this call to be aligned with the plot_spikes_hist implementation so that it can also take a dict of color assignments. I don't think we need to expose the cell_types as an argument... though I wish there was a way to get it dynamically from the network instead of hard-coding the 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.
see #916 ... it allows you to dynamically extract 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.
while you are at it, I am wondering if this could be addressed as well. The following line:
causes cells that spike with neighboring gids to overlap. I have been staring at these raster plots recently and it's very hard to tell how many times the same cell spiked (important to understand the underlying dynamics). Adding a small offset between nearby cells should address that problem
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 took a look into this. The overlap is due to both the y-position as you've identified and the line lengths defined during the plot function call on line 568. The y-position is the center of each line and the length is how much it extends from that center point (+-2.5 each way for a value of 5).
hnn-core/hnn_core/viz.py
Lines 559 to 568 in 27c6fc1
A simple solution is to change the line length to 1. However the lines will look more like dots with this change.
Another solution would be to analyze the cell times and gids, and apply a larger y-offset if they are within an X and Y bounding box of one another.
Let me know what you think.
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'm okay with the spikes looking like dots ... it's just a function of the number of cells in our network. Did a quick google image search of "spike raster plot" and the plots do look dotted when there are more neurons. I guess the y-offset = -gid is helpful since it allows you to identify the cell, so maybe best not to touch that. @ntolley any opinion here?