def test_probegroup(): probegroup = ProbeGroup() for i in range(3): probe = generate_dummy_probe() probe.move([i * 100, i * 80]) probegroup.add_probe(probe) indices = probegroup.get_global_device_channel_indices() ids = probegroup.get_global_electrode_ids() df = probegroup.to_dataframe()
def test_probegroup(): probegroup = ProbeGroup() nchan = 0 for i in range(3): probe = generate_dummy_probe() probe.move([i * 100, i * 80]) n = probe.get_contact_count() probe.set_device_channel_indices(np.arange(n)[::-1] + nchan) shank_ids = np.ones(n) shank_ids[:n // 2] *= i * 2 shank_ids[n // 2:] *= i * 2 + 1 probe.set_shank_ids(shank_ids) probegroup.add_probe(probe) nchan += n indices = probegroup.get_global_device_channel_indices() ids = probegroup.get_global_contact_ids() df = probegroup.to_dataframe() #~ print(df['global_contact_ids']) arr = probegroup.to_numpy(complete=False) other = ProbeGroup.from_numpy(arr) arr = probegroup.to_numpy(complete=True) other = ProbeGroup.from_numpy(arr) d = probegroup.to_dict() other = ProbeGroup.from_dict(d) #~ from probeinterface.plotting import plot_probe_group, plot_probe #~ import matplotlib.pyplot as plt #~ plot_probe_group(probegroup) #~ plot_probe_group(other) #~ plt.show() # checking automatic generation of ids with new dummy probes probegroup.probes = [] for i in range(3): probegroup.add_probe(generate_dummy_probe()) probegroup.auto_generate_contact_ids() probegroup.auto_generate_probe_ids() for p in probegroup.probes: assert p.contact_ids is not None assert 'probe_id' in p.annotations
xpitch=75, ypitch=75, y_shift_per_column=[0, -37.5, 0], electrode_shapes='circle', electrode_shape_params={'radius': 12}) probe1 = probe0.copy() probe1.move([350, 200]) probegroup = ProbeGroup() probegroup.add_probe(probe0) probegroup.add_probe(probe1) # wire probe0 0 to 31 and shuffle channel_indices0 = np.arange(16) np.random.shuffle(channel_indices0) probe0.set_device_channel_indices(channel_indices0) # wire probe0 32 to 63 and shuffle channel_indices1 = np.arange(16, 32) np.random.shuffle(channel_indices1) probe1.set_device_channel_indices(channel_indices1) print(probegroup.get_global_device_channel_indices()) ############################################################################## # The indices of the probe group can also be plotted: fig, ax = plt.subplots() plot_probe_group(probegroup, with_channel_index=True, same_axe=True, ax=ax) ax.set_xlim(-100, 600) ax.set_ylim(-100, 600) plt.show()