.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/ex_09_more_complicated_probe.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_ex_09_more_complicated_probe.py: More complicated probes ----------------------- This example demonstrates how to generate a more complicated probe with hybrid contacts shape and contact rotations within the `contact_plane_axes` attribute. .. GENERATED FROM PYTHON SOURCE LINES 11-18 .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from probeinterface import Probe from probeinterface.plotting import plot_probe .. GENERATED FROM PYTHON SOURCE LINES 19-20 Let's first set the positions of the contacts .. GENERATED FROM PYTHON SOURCE LINES 20-27 .. code-block:: Python n = 24 positions = np.zeros((n, 2)) for i in range(3): positions[i * 8: (i + 1) * 8, 0] = i * 30 positions[i * 8: (i + 1) * 8, 1] = np.arange(0, 240, 30) .. GENERATED FROM PYTHON SOURCE LINES 28-29 Electrode shapes can be arrays to handle hybrid shape contacts .. GENERATED FROM PYTHON SOURCE LINES 29-33 .. code-block:: Python shapes = np.array(['circle', 'square'] * 12) shape_params = np.array([{'radius': 8}, {'width': 12}] * 12) .. GENERATED FROM PYTHON SOURCE LINES 34-37 The `plane_axes` argument handles the axis for each contact. It can be used for contact-wise rotations.  `plane_axes` has a shape of (num_elec, 2, ndim) .. GENERATED FROM PYTHON SOURCE LINES 37-41 .. code-block:: Python plane_axes = [[[1 / np.sqrt(2), 1 / np.sqrt(2)], [-1 / np.sqrt(2), 1 / np.sqrt(2)]]] * n plane_axes = np.array(plane_axes) .. GENERATED FROM PYTHON SOURCE LINES 42-43 Create the probe .. GENERATED FROM PYTHON SOURCE LINES 43-49 .. code-block:: Python probe = Probe(ndim=2, si_units='um') probe.set_contacts(positions=positions, plane_axes=plane_axes, shapes=shapes, shape_params=shape_params) probe.create_auto_shape() .. GENERATED FROM PYTHON SOURCE LINES 50-53 .. code-block:: Python plot_probe(probe) .. image-sg:: /examples/images/sphx_glr_ex_09_more_complicated_probe_001.png :alt: Probe - 24ch :srcset: /examples/images/sphx_glr_ex_09_more_complicated_probe_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none (, ) .. GENERATED FROM PYTHON SOURCE LINES 54-55 We can also use the `rotate_contacts` to make contact-wise rotations: .. GENERATED FROM PYTHON SOURCE LINES 55-64 .. code-block:: Python from probeinterface import generate_multi_columns_probe probe = generate_multi_columns_probe(num_columns=3, num_contact_per_column=8, xpitch=20, ypitch=20, contact_shapes='square', contact_shape_params={'width': 12}) probe.rotate_contacts(45) plot_probe(probe) .. image-sg:: /examples/images/sphx_glr_ex_09_more_complicated_probe_002.png :alt: Probe - 24ch :srcset: /examples/images/sphx_glr_ex_09_more_complicated_probe_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none (, ) .. GENERATED FROM PYTHON SOURCE LINES 65-74 .. code-block:: Python probe = generate_multi_columns_probe(num_columns=5, num_contact_per_column=5, xpitch=20, ypitch=20, contact_shapes='square', contact_shape_params={'width': 12}) thetas = np.arange(25) * 360 / 25 probe.rotate_contacts(thetas) plot_probe(probe) plt.show() .. image-sg:: /examples/images/sphx_glr_ex_09_more_complicated_probe_003.png :alt: Probe - 25ch :srcset: /examples/images/sphx_glr_ex_09_more_complicated_probe_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.188 seconds) .. _sphx_glr_download_examples_ex_09_more_complicated_probe.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: ex_09_more_complicated_probe.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ex_09_more_complicated_probe.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: ex_09_more_complicated_probe.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_