`plot_rasters` gives error if spike_train contains a single spike
See original GitHub issueTypeError Traceback (most recent call last)
Input In [4], in <module>
1 fig, ax = plt.subplots(figsize=(24, 8))
----> 2 w_rs = sw.plot_rasters(sorting, ax=ax)
File /gpfs/bwfor/work/ws/hd_uk239-measelab/miniconda3/envs/measelab/lib/python3.8/site-packages/spikeinterface/widgets/rasters.py:107, in plot_rasters(*args, **kwargs)
106 def plot_rasters(*args, **kwargs):
--> 107 W = RasterWidget(*args, **kwargs)
108 W.plot()
109 return W
File /gpfs/bwfor/work/ws/hd_uk239-measelab/miniconda3/envs/measelab/lib/python3.8/site-packages/spikeinterface/widgets/rasters.py:55, in RasterWidget.__init__(self, sorting, segment_index, unit_ids, time_range, color, figure, ax)
52 for unit_id in self._sorting.get_unit_ids():
53 spike_train = self._sorting.get_unit_spike_train(unit_id,
54 segment_index=self.segment_index)
---> 55 if len(spike_train) > 0:
56 curr_max_frame = np.max(spike_train)
57 if curr_max_frame > self._max_frame:
TypeError: len() of unsized object
Related to #601 - but I think just using .size
instead of len()
here would fix this.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
PlotRasters(SpikeTimes,start,varargin) - File Exchange
A function to plot rasters of neural spikes from a matrix of spike ... If SpikeTimes is a single matrix, the function assumes...
Read more >MATLAB Tutorial for NEUR/PHYS/BISC 335 - Goldman Lab
The plot gives the total number of spikes that occurred at a given time point over all of the trials. Since it is...
Read more >Simulating neural spike trains - Praneeth Namburi
Simulating spike trains like the ones in the raster plot above requires only one piece of information: the firing rate of the neuron....
Read more >Introduction to Spike Train Data
Visualize a set of spike trains as a peri-stimulus time histogram (PSTH) ... One spike train is not representative of what that neuron...
Read more >How do I get a raster plot of nonhomogeneous spikes if I have ...
I use another spike train generator based on the Poisson model. arrival_time_v3 <- function(firing_rate,tMax,sampling_rate){ lambda ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@alejoe91 yes, this was using kilosort 2
@alejoe91 thanks! that PR fixes both issues for me