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
def test_probegroup_3d(): probegroup = ProbeGroup() for i in range(3): probe = generate_dummy_probe().to_3d() probe.move([i * 100, i * 80, i * 30]) probegroup.add_probe(probe) assert probegroup.ndim == 3
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_plot_probe(): probe = generate_dummy_probe() plot_probe(probe) plot_probe(probe, with_channel_index=True) # with color n = probe.get_electrode_count() electrode_colors = np.random.rand(n, 3) plot_probe(probe, electrode_colors=electrode_colors) # 3d probe_3d = probe.to_3d(plane='xz') plot_probe(probe_3d)
def test_generate(): probe = generate_dummy_probe() probegroup = generate_dummy_probe_group() tetrode = generate_tetrode() multi_columns = generate_multi_columns_probe(num_columns=3, num_elec_per_column=[10, 12, 10], xpitch=22, ypitch=20, y_shift_per_column=[0, -10, 0]) linear = generate_linear_probe(num_elec=16, ypitch=20, electrode_shapes='square', electrode_shape_params={'width': 15}) multi_shank = generate_multi_shank()
############################################################################## # Import import numpy as np import matplotlib.pyplot as plt from probeinterface import Probe, ProbeGroup from probeinterface.plotting import plot_probe_group from probeinterface import generate_dummy_probe ############################################################################## # Generate 2 dummy `Probe` objects with the utils function: # probe0 = generate_dummy_probe(elec_shapes='square') probe1 = generate_dummy_probe(elec_shapes='circle') probe1.move([250, -90]) ############################################################################## # Let's create a `ProbeGroup` and # add the `Probe` objects into it: probegroup = ProbeGroup() probegroup.add_probe(probe0) probegroup.add_probe(probe1) print('probe0.get_electrode_count()', probe0.get_electrode_count()) print('probe1.get_electrode_count()', probe1.get_electrode_count()) print('probegroup.get_channel_count()', probegroup.get_channel_count())