pulse2percept.implants.electrodes

Electrode, PointSource, DiskElectrode, SquareElectrode, HexElectrode

Classes

DiskElectrode(x, y, z, r[, name, activated])

Circular disk electrode

Electrode(x, y, z[, name, activated])

Abstract base class for all electrodes.

HexElectrode(x, y, z, a[, name, activated])

Hexagonal electrode

PointSource(x, y, z[, name, activated])

Idealized current point source

SquareElectrode(x, y, z, a[, name, activated])

Square electrode

class pulse2percept.implants.electrodes.Electrode(x, y, z, name=None, activated=True)[source]

Abstract base class for all electrodes.

Parameters:
  • x/y/z (double) – 3D location of the electrode (um). The coordinate system is centered over the fovea. Positive x values move the electrode into the right visual field. Positive y values move the electrode into the left visual field. Positive z values move the electrode either into the cortex or into the vitreos humor.

  • name (str, optional) – Electrode name

  • activated (bool) – To deactivate, set to False. Deactivated electrodes cannot receive stimuli.

Notes

  • Coordinates may be given as plain numbers of microns or as unitful quantities (e.g. 1.2 * mm), which are converted to microns. See pulse2percept.units. Electrodes always store plain numbers in microns: x, y and z are ordinary floats, and so is everything downstream of them.

coordinate_unit = um[source]

The unit electrode coordinates are stored in. Electrodes hold plain numbers, which is what every kernel downstream of them expects; this says what those numbers mean.

coordinates(unit=None)[source]

3D position of the electrode

Added in version 0.10.0.

Parameters:

unit (Unit, optional) – Length unit to express the position in. If None, the position is returned as it is stored (microns).

Returns:

coords – An ordinary NumPy array [x, y, z], never a Quantity.

Return type:

(3,) np.ndarray

Examples

>>> from pulse2percept.implants import DiskElectrode
>>> from pulse2percept.units import mm
>>> DiskElectrode(1000, 0, 100, 200).coordinates(mm)
array([1. , 0. , 0.1])
plot(autoscale=False, ax=None)[source]

Plot

Parameters:
  • autoscale (bool, optional) – Whether to adjust the x,y limits of the plot

  • ax (matplotlib.axes._subplots.AxesSubplot, optional) – A Matplotlib axes object. If None given, a new one will be created.

Returns:

ax – Returns the axis object of the plot

Return type:

matplotlib.axes.Axes

class pulse2percept.implants.electrodes.PointSource(x, y, z, name=None, activated=True)[source]

Idealized current point source

Parameters:
  • x/y/z (double) – 3D location of the electrode. The coordinate system is centered over the fovea. Positive x values move the electrode into the nasal retina. Positive y values move the electrode into the superior retina. Positive z values move the electrode away from the retina into the vitreous humor (sometimes called electrode-retina distance).

  • name (str, optional) – Electrode name

  • activated (bool) – To deactivate, set to False. Deactivated electrodes cannot receive stimuli.

electric_potential(x, y, z, amp, sigma)[source]

Calculate electric potential at (x, y, z)

Parameters:
  • x/y/z (double) – 3D location (um) at which to evaluate the electric potential. May be given as a unitful quantity, e.g. 0.2 * mm.

  • amp (double) – amplitude of the constant current pulse

  • sigma (double) – resistivity of the extracellular solution

Returns:

  • pot (double) – The electric potential at (x, y, z)

  • The electric potential \(V(r)\) of a point source is given by

  • .. math:: – V(r) = frac{sigma I}{4 pi r},

  • where \(\sigma\) is the resistivity of the extracellular solution

  • (typically Ames medium, \(\sigma = 110 \Ohm cm\)),

  • \(I\) is the amplitude of the constant current pulse,

  • and \(r\) is the distance from the stimulating electrode to the

  • point at which the voltage is being computed.

coordinate_unit = um[source]

The unit electrode coordinates are stored in. Electrodes hold plain numbers, which is what every kernel downstream of them expects; this says what those numbers mean.

coordinates(unit=None)[source]

3D position of the electrode

Added in version 0.10.0.

Parameters:

unit (Unit, optional) – Length unit to express the position in. If None, the position is returned as it is stored (microns).

Returns:

coords – An ordinary NumPy array [x, y, z], never a Quantity.

Return type:

(3,) np.ndarray

Examples

>>> from pulse2percept.implants import DiskElectrode
>>> from pulse2percept.units import mm
>>> DiskElectrode(1000, 0, 100, 200).coordinates(mm)
array([1. , 0. , 0.1])
plot(autoscale=False, ax=None)[source]

Plot

Parameters:
  • autoscale (bool, optional) – Whether to adjust the x,y limits of the plot

  • ax (matplotlib.axes._subplots.AxesSubplot, optional) – A Matplotlib axes object. If None given, a new one will be created.

Returns:

ax – Returns the axis object of the plot

Return type:

matplotlib.axes.Axes

class pulse2percept.implants.electrodes.DiskElectrode(x, y, z, r, name=None, activated=True)[source]

Circular disk electrode

Parameters:
  • x/y/z (double) – 3D location of the electrode. The coordinate system is centered over the fovea. Positive x values move the electrode into the nasal retina. Positive y values move the electrode into the superior retina. Positive z values move the electrode away from the retina into the vitreous humor (sometimes called electrode-retina distance).

  • r (double) – Disk radius (um) in the x,y plane

  • name (str, optional) – Electrode name

  • activated (bool) – To deactivate, set to False. Deactivated electrodes cannot receive stimuli.

Notes

  • Lengths may be given as plain numbers of microns or as unitful quantities (e.g. DiskElectrode(1 * mm, 0, 0.1 * mm, 200 * um)). See pulse2percept.units.

electric_potential(x, y, z, v0)[source]

Calculate electric potential at (x, y, z)

Parameters:
  • x/y/z (double) – 3D location (um) at which to evaluate the electric potential. May be given as a unitful quantity, e.g. 0.2 * mm.

  • v0 (double) – The quasi-static disk potential relative to a ground electrode at infinity

Returns:

pot – The electric potential at (x, y, z).

Return type:

double

The electric potential \(V(r,z)\) of a disk electrode is given by [WileyWebster1982]:

\[V(r,z) = \sin^{-1} \bigg\{ \frac{2a}{\sqrt{(r-a)^2 + z^2} + \sqrt{(r+a)^2 + z^2}} \bigg\} \times \frac{2 V_0}{\pi},\]

for \(z \neq 0\), where \(r\) and \(z\) are the radial and axial distances from the center of the disk, \(V_0\) is the disk potential, \(\sigma\) is the medium conductivity, and \(a\) is the disk radius.

coordinate_unit = um[source]

The unit electrode coordinates are stored in. Electrodes hold plain numbers, which is what every kernel downstream of them expects; this says what those numbers mean.

coordinates(unit=None)[source]

3D position of the electrode

Added in version 0.10.0.

Parameters:

unit (Unit, optional) – Length unit to express the position in. If None, the position is returned as it is stored (microns).

Returns:

coords – An ordinary NumPy array [x, y, z], never a Quantity.

Return type:

(3,) np.ndarray

Examples

>>> from pulse2percept.implants import DiskElectrode
>>> from pulse2percept.units import mm
>>> DiskElectrode(1000, 0, 100, 200).coordinates(mm)
array([1. , 0. , 0.1])
plot(autoscale=False, ax=None)[source]

Plot

Parameters:
  • autoscale (bool, optional) – Whether to adjust the x,y limits of the plot

  • ax (matplotlib.axes._subplots.AxesSubplot, optional) – A Matplotlib axes object. If None given, a new one will be created.

Returns:

ax – Returns the axis object of the plot

Return type:

matplotlib.axes.Axes

class pulse2percept.implants.electrodes.SquareElectrode(x, y, z, a, name=None, activated=True)[source]

Square electrode

Added in version 0.7.

Parameters:
  • x/y/z (double) – 3D location of the electrode. The coordinate system is centered over the fovea. Positive x values move the electrode into the nasal retina. Positive y values move the electrode into the superior retina. Positive z values move the electrode away from the retina into the vitreous humor (sometimes called electrode-retina distance).

  • a (double) – Side length (um) of the square

  • name (str, optional) – Electrode name

  • activated (bool) – To deactivate, set to False. Deactivated electrodes cannot receive stimuli.

Notes

  • Lengths may be given as plain numbers of microns or as unitful quantities (e.g. 50 * um). See pulse2percept.units.

coordinate_unit = um[source]

The unit electrode coordinates are stored in. Electrodes hold plain numbers, which is what every kernel downstream of them expects; this says what those numbers mean.

coordinates(unit=None)[source]

3D position of the electrode

Added in version 0.10.0.

Parameters:

unit (Unit, optional) – Length unit to express the position in. If None, the position is returned as it is stored (microns).

Returns:

coords – An ordinary NumPy array [x, y, z], never a Quantity.

Return type:

(3,) np.ndarray

Examples

>>> from pulse2percept.implants import DiskElectrode
>>> from pulse2percept.units import mm
>>> DiskElectrode(1000, 0, 100, 200).coordinates(mm)
array([1. , 0. , 0.1])
plot(autoscale=False, ax=None)[source]

Plot

Parameters:
  • autoscale (bool, optional) – Whether to adjust the x,y limits of the plot

  • ax (matplotlib.axes._subplots.AxesSubplot, optional) – A Matplotlib axes object. If None given, a new one will be created.

Returns:

ax – Returns the axis object of the plot

Return type:

matplotlib.axes.Axes

class pulse2percept.implants.electrodes.HexElectrode(x, y, z, a, name=None, activated=True)[source]

Hexagonal electrode

Added in version 0.7.

Parameters:
  • x/y/z (double) – 3D location of the electrode. The coordinate system is centered over the fovea. Positive x values move the electrode into the nasal retina. Positive y values move the electrode into the superior retina. Positive z values move the electrode away from the retina into the vitreous humor (sometimes called electrode-retina distance).

  • a (double) – Length (um) of line drawn from the center of the hexagon to the midpoint of one of its sides.

  • name (str, optional) – Electrode name

  • activated (bool) – To deactivate, set to False. Deactivated electrodes cannot receive stimuli.

Notes

  • Lengths may be given as plain numbers of microns or as unitful quantities (e.g. 50 * um). See pulse2percept.units.

coordinate_unit = um[source]

The unit electrode coordinates are stored in. Electrodes hold plain numbers, which is what every kernel downstream of them expects; this says what those numbers mean.

coordinates(unit=None)[source]

3D position of the electrode

Added in version 0.10.0.

Parameters:

unit (Unit, optional) – Length unit to express the position in. If None, the position is returned as it is stored (microns).

Returns:

coords – An ordinary NumPy array [x, y, z], never a Quantity.

Return type:

(3,) np.ndarray

Examples

>>> from pulse2percept.implants import DiskElectrode
>>> from pulse2percept.units import mm
>>> DiskElectrode(1000, 0, 100, 200).coordinates(mm)
array([1. , 0. , 0.1])
plot(autoscale=False, ax=None)[source]

Plot

Parameters:
  • autoscale (bool, optional) – Whether to adjust the x,y limits of the plot

  • ax (matplotlib.axes._subplots.AxesSubplot, optional) – A Matplotlib axes object. If None given, a new one will be created.

Returns:

ax – Returns the axis object of the plot

Return type:

matplotlib.axes.Axes