Skip to content

Conversation

@ecobost
Copy link
Contributor

@ecobost ecobost commented Dec 25, 2025

Currently, sw.plot_unit_waveforms_density_map(analyzer, unit_ids=[0], use_max_channel=True) produces this:
density_map_pre
The density map has some spurious high values on the very first row (more visible near the peaks) and also on the bottom although less visible in this example.

The issue comes from the clipping in

wf_bined = wf_bined.clip(0, bins.size - 1)

that counts any value with amplitude less than bin_min as belonging to the first bin and any value above bin_max as belonging to the last bin of the histogram, thus producing those lines on the plot.

This PR uses equal-sized bins from bin_min to bin_max and uses np.histogram to count occurrences. It produces:
density_map_post
without any artifacts. (Also tested it with multiple channels and multiple units)

Granted, it looks uglier but it's more correct. And it will look better for nicer data, this is a 2-minute recording just for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant