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 ability to index individual trials when plotting rasters/histograms #472
Conversation
I think it will be necessary to add this to |
Codecov Report
@@ Coverage Diff @@
## master #472 +/- ##
==========================================
- Coverage 90.46% 90.36% -0.10%
==========================================
Files 18 18
Lines 3378 3395 +17
==========================================
+ Hits 3056 3068 +12
- Misses 322 327 +5
Continue to review full report at Codecov.
|
okay set the PR to [MRG] when ready and don't forget to update whats_new ! |
All set on my end! |
@@ -322,14 +322,15 @@ def mean_rates(self, tstart, tstop, gid_ranges, mean_type='all'): | |||
|
|||
return spike_rates | |||
|
|||
def plot_spikes_raster(self, ax=None, show=True): | |||
def plot_spikes_raster(self, trial_idx=None, ax=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.
this is an API breaking change. It will break code which does:
plot_spikes_raster(ax)
as a general rule, you want to put new arguments towards the end, but maybe before show
so API is consistent. Anyhow, I don't think we are doing deprecations at this point, so I'll let this pass but something to remember for the future :)
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.
Good catch, might be worth discussing the mechanics of deprecation warnings at some point. Especially identifying functions that are the most likely to change in the near future
hnn_core/viz.py
Outdated
_validate_type(trial_idx, list, 'trial_idx', 'int, list of int') | ||
|
||
# Extract desired trials | ||
if cell_response._spike_times[0]: |
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.
do you mean to check the length > 0 or do you want to compare against None
? Better to be explicit
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.
updated!
Co-authored-by: Mainak Jas <jasmainak@users.noreply.github.com>
Thanks @ntolley ! |
Thank you!! |
I have re-installed hnn-core to test plotting single results, (I believe multiple other pulls also have been merged). |
@jasmainak I played around with the seeding and re-produced the exact results from before. Thank you |
As for plotting rasters of single trials, Yeah it is great. It is working well but I get this warning which does not affect the outcome:
|
@ntolley do you know if it's safe to fix this by providing |
Closes #471 Implements the ability to filter out specific trials either through lists or integers: