handle margin for peak localisation
@@ -20,31 +20,35 @@ def test_localize_peaks():
outputs='numpy_compact'
)
- peak_locations = localize_peaks(recording, peaks,
- chunk_size=10000, verbose=True, progress_bar=False, )
+ #~ peak_locations = localize_peaks(recording, peaks, method='center_of_mass',
+ #~ chunk_size=10000, verbose=True, progress_bar=False, )
+ #~ assert peaks.size == peak_locations.shape[0]
+ peak_locations = localize_peaks(recording, peaks, method='monopolar_triangulation',
+ n_jobs=1, chunk_size=10000, verbose=True, progress_bar=True, )
assert peaks.size == peak_locations.shape[0]
+
# DEBUG
- # ~ import MEArec
- # ~ recgen = MEArec.load_recordings(recordings=local_path, return_h5_objects=True,
- # ~ check_suffix=False,
- # ~ load=['recordings', 'spiketrains', 'channel_positions'],
- # ~ load_waveforms=False)
- # ~ soma_positions = np.zeros((len(recgen.spiketrains), 3), dtype='float32')
- # ~ for i, st in enumerate(recgen.spiketrains):
- # ~ soma_positions[i, :] = st.annotations['soma_position']
-
- # ~ import matplotlib.pyplot as plt
- # ~ import spikeinterface.widgets as sw
- # ~ from probeinterface.plotting import plot_probe
- # ~ probe = recording.get_probe()
- # ~ fig, ax = plt.subplots()
- # ~ plot_probe(probe, ax=ax)
- # ~ ax.scatter(peak_locations[:, 0], peak_locations[:, 1], color='k', s=1, alpha=0.5)
- # ~ # MEArec is "yz" in 2D
- # ~ ax.scatter(soma_positions[:, 1], soma_positions[:, 2], color='g', s=20, marker='*')
- # ~ plt.show()
+ import MEArec
+ recgen = MEArec.load_recordings(recordings=local_path, return_h5_objects=True,
+ check_suffix=False,
+ load=['recordings', 'spiketrains', 'channel_positions'],
+ load_waveforms=False)
+ soma_positions = np.zeros((len(recgen.spiketrains), 3), dtype='float32')
+ for i, st in enumerate(recgen.spiketrains):
+ soma_positions[i, :] = st.annotations['soma_position']
+
+ import matplotlib.pyplot as plt
+ import spikeinterface.widgets as sw
+ from probeinterface.plotting import plot_probe
+ probe = recording.get_probe()
+ fig, ax = plt.subplots()
+ plot_probe(probe, ax=ax)
+ ax.scatter(peak_locations[:, 0], peak_locations[:, 1], color='k', s=1, alpha=0.5)
+ # MEArec is "yz" in 2D
+ ax.scatter(soma_positions[:, 1], soma_positions[:, 2], color='g', s=20, marker='*')
+ plt.show()
if __name__ == '__main__':
