question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`plot_rasters` gives error if spike_train contains a single spike

See original GitHub issue
TypeError                                 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:closed
  • Created a year ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
lkeegancommented, May 3, 2022

@alejoe91 yes, this was using kilosort 2

1reaction
lkeegancommented, May 3, 2022

@alejoe91 thanks! that PR fixes both issues for me

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found