Skip to content

Conversation

alejoe91
Copy link
Member

@alejoe91 alejoe91 commented Sep 4, 2025

Fixes #2844

@eabhorrocks @meszena could you test this out when you get the chance?

@alejoe91 alejoe91 added exporters Related to exporters module widgets Related to widgets module labels Sep 4, 2025
Copy link

@eabhorrocks eabhorrocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into this error

Traceback (most recent call last):
  File "/home/saleem_lab/si_edd/SI_processing/runSpikeSorting.py", line 123, in <module>
    export_report(sorting_analyzer=probe_we_ks4, output_folder=save_folder +'probe'+str(probe)+'/sorters/kilosort4/report/')
  File "/home/saleem_lab/anaconda3/envs/siedd_env/lib/python3.11/site-packages/spikeinterface/exporters/report.py", line 144, in export_report
    sw.plot_unit_summary(sorting_analyzer, unit_id, figure=fig)
  File "/home/saleem_lab/anaconda3/envs/siedd_env/lib/python3.11/site-packages/spikeinterface/widgets/unit_summary.py", line 82, in __init__
    BaseWidget.__init__(self, plot_data, backend=backend, **backend_kwargs)
  File "/home/saleem_lab/anaconda3/envs/siedd_env/lib/python3.11/site-packages/spikeinterface/widgets/base.py", line 87, in __init__
    self.do_plot()
  File "/home/saleem_lab/anaconda3/envs/siedd_env/lib/python3.11/site-packages/spikeinterface/widgets/base.py", line 108, in do_plot
    func(self.data_plot, **self.backend_kwargs)
  File "/home/saleem_lab/anaconda3/envs/siedd_env/lib/python3.11/site-packages/spikeinterface/widgets/unit_summary.py", line 172, in plot_matplotlib
    UnitWaveformDensityMapWidget(
  File "/home/saleem_lab/anaconda3/envs/siedd_env/lib/python3.11/site-packages/spikeinterface/widgets/unit_waveforms_density_map.py", line 87, in __init__
    bins = np.arange(bin_min, bin_max, bin_size)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: arange: cannot compute length


replacing (lines 85, 86) didn't solve the issue.
#bin_min = np.min(templates) * 1.3
#bin_max = np.max(templates) * 1.3
bin_min = np.nanmin(templates) * 1.3
bin_max = np.nanmax(templates) * 1.3
bin_size = (bin_max - bin_min) / 100
bins = np.arange(bin_min, bin_max, bin_size)

but gave:
  File "/home/saleem_lab/anaconda3/envs/siedd_env/lib/python3.11/site-packages/spikeinterface/widgets/unit_waveforms_density_map.py", line 90, in __init__
    bin_size = (bin_max - bin_min) / 100
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: arange: cannot compute length

I saw there are some empty entries in the templates metrics csv, not sure if this is linked
Screenshot 2025-09-04 172439

Unfortunately, the way my code is factored makes this a bit painful to debug quickly

extremum_channel_indices = get_template_extremum_channel(sorting_analyzer, outputs="index")
for unit_id in unit_ids:
if np.any(np.isnan(unit_locations[unit_id])):
unit_locations[unit_id] = channel_locations[extremum_channel_indices[unit_id]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make a copy of unit_locaions in this case to avoid inplace replacement in the analyzer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporters Related to exporters module widgets Related to widgets module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ValueError in si.export_report and in si.plot_sorting_summary
3 participants