def test_probe_view(qtbot, gui): n = 50 positions = staggered_positions(n) positions = positions.astype(np.int32) best_channels = lambda cluster_id: range(1, 9, 2) v = ProbeView(positions=positions, best_channels=best_channels, dead_channels=(3, 7, 12)) v.do_show_labels = False v.show() qtbot.waitForWindowShown(v.canvas) v.attach(gui) class Supervisor(object): pass v.toggle_show_labels(True) v.on_select(cluster_ids=[]) v.on_select(cluster_ids=[0]) v.on_select(cluster_ids=[0, 2, 3]) emit('select', Supervisor(), cluster_ids=[0, 2]) v.toggle_show_labels(False) _stop_and_close(qtbot, v)
def test_probe_view(qtbot, gui): n = 50 positions = staggered_positions(n) best_channels = lambda cluster_id: range(1, 9, 2) v = ProbeView(positions=positions, best_channels=best_channels) v.show() qtbot.waitForWindowShown(v.canvas) v.attach(gui) class Supervisor(object): pass v.on_select(cluster_ids=[]) v.on_select(cluster_ids=[0]) v.on_select(cluster_ids=[0, 2, 3]) emit('select', Supervisor(), cluster_ids=[0, 2]) _stop_and_close(qtbot, v)
def test_get_boxes(): positions = [[-1, 0], [1, 0]] boxes = _get_boxes(positions) ac(boxes, [[-1, -.25, 0, .25], [+0, -.25, 1, .25]], atol=1e-4) positions = [[-1, 0], [1, 0]] boxes = _get_boxes(positions, keep_aspect_ratio=False) ac(boxes, [[-1, -1, 0, 1], [0, -1, 1, 1]], atol=1e-4) positions = linear_positions(4) boxes = _get_boxes(positions) ac(boxes, [[-0.5, -1.0, +0.5, -0.5], [-0.5, -0.5, +0.5, +0.0], [-0.5, +0.0, +0.5, +0.5], [-0.5, +0.5, +0.5, +1.0], ], atol=1e-4) positions = staggered_positions(8) boxes = _get_boxes(positions) ac(boxes[:, 1], np.arange(.75, -1.1, -.25), atol=1e-6) ac(boxes[:, 3], np.arange(1, -.76, -.25), atol=1e-7)
def get_waveforms(cluster_id): return Bunch(data=w, masks=np.random.uniform(low=0., high=1., size=(ns, nc)), channel_ids=np.arange(nc), channel_labels=['%d' % (ch * 10) for ch in range(nc)], channel_positions=staggered_positions(nc))
def test_probe_layout(): positions = staggered_positions(32) channel_ids = {0: np.arange(1, 11, 2), 1: np.arange(7, 15, 2)} layout = probe_layout(positions, channel_ids) assert '<circle' in layout
def site_positions(n_channels): yield staggered_positions(n_channels)
def get_waveforms(cluster_id): return Bunch(data=w, channel_ids=np.arange(nc), channel_labels=['%d' % (ch * 10) for ch in range(nc)], waveform_duration=1000, channel_positions=staggered_positions(nc))