def get_waveforms_amplitude(self, cluster_id): nt = self.get_cluster_templates(cluster_id) # Find the template with the highest number of spikes belonging # to the selected cluster. template_id = np.argmax(nt) # Find the masked template waveform amplitude. mw = self.templates[[template_id]] mm = get_masks(mw) mw = mw[0, ...] mm = mm[0, ...] assert mw.ndim == 2 assert mw.ndim == 2 return get_waveform_amplitude(mm, mw)
def get_waveforms_amplitude(self, cluster_id): nt = self.get_cluster_templates(cluster_id) # Find the template with the highest number of spikes belonging # to the selected cluster. template_id = np.argmax(nt) # Find the masked template waveform amplitude. mw = self.templates[[template_id]] mm = self.template_masks[[template_id]] mw = mw[0, ...] mm = mm[0, ...] assert mw.ndim == 2 assert mw.ndim == 2 return get_waveform_amplitude(mm, mw)
def _get_waveforms(self, cluster_id): """Return a selection of waveforms for a cluster.""" pos = self.model.channel_positions spike_ids = self.selector.select_spikes( [cluster_id], self.n_spikes_waveforms, self.batch_size_waveforms, ) data = self.model.all_waveforms[spike_ids] mm = self._get_mean_masks(cluster_id) mw = np.mean(data, axis=0) amp = get_waveform_amplitude(mm, mw) masks = self._get_masks(cluster_id) # Find the best channels. channel_ids = np.argsort(amp)[::-1] return Bunch( data=data[..., channel_ids], channel_ids=channel_ids, channel_positions=pos[channel_ids], masks=masks[:, channel_ids], )
def get_waveforms_amplitude(self, cluster_id): mm = self.get_mean_masks(cluster_id) mw = self.get_mean_waveforms(cluster_id) assert mw.ndim == 2 return get_waveform_amplitude(mm, mw)