def get_spike_count_by_threshold(vm, thresholds=np.arange(-30, 15, 10) * pq.mV): counts = { float(thresh): len(spike_extraction(vm, threshold=thresh)) for thresh in thresholds } return counts
def count_stray_spikes(vm, stim_start, stim_end): spike_train = spike_extraction(vm, threshold=-20 * pq.mV) before_stim_train = spike_train.time_slice(0 * pq.s, stim_start * pq.s - 1 * pq.ms) after_stim_train = spike_train.time_slice(stim_end * pq.s + 5 * pq.ms, None) n_before = len(before_stim_train) n_after = len(after_stim_train) return n_before + n_after
def test_spike_extraction_waveform(self): spike_train = stgen.spike_extraction(self.vm.reshape(-1), extr_interval = (-1*ms, 2*ms)) try: assert_array_almost_equal(spike_train.waveforms[0][0].magnitude.reshape(-1), self.first_spike) except AttributeError: self.assertTrue( np.array_equal(spike_train.waveforms[0][0].magnitude, self.first_spike))