pulse2percept.implants.electrodes
Electrode,
PointSource,
DiskElectrode,
SquareElectrode,
HexElectrode
Classes
|
Circular disk electrode |
Abstract base class for all electrodes. |
|
|
Hexagonal electrode |
|
Idealized current point source |
|
Square electrode |
- class pulse2percept.implants.electrodes.Electrode[source]
Abstract base class for all electrodes.
- Parameters:
Notes
Coordinates may be given as plain numbers of microns or as unitful quantities (e.g.
1.2 * mm), which are converted to microns. Seepulse2percept.units. Electrodes always store plain numbers in microns:x,yandzare 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 aQuantity.- 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:
- 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 aQuantity.- 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, radius, name=None, activated=True)[source]
Circular disk electrode
- Parameters:
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)). Seepulse2percept.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 aQuantity.- 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, side_length, name=None, activated=True)[source]
Square electrode
Added in version 0.7.
- Parameters:
Notes
Lengths may be given as plain numbers of microns or as unitful quantities (e.g.
50 * um). Seepulse2percept.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 aQuantity.- 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, apothem, name=None, activated=True, orientation='vertical', rot=0)[source]
Hexagonal electrode
Added in version 0.7.
- Parameters:
x/y/z (double) – Location of the electrode (um) in the array’s own coordinate frame.
apothem (double) – Apothem (um) of the hexagon. The flat-to-flat width is
2 * apothem.name (str, optional) – Electrode name.
activated (bool) – To deactivate, set to
False. Deactivated electrodes cannot receive stimuli.orientation ({'horizontal', 'vertical'}, optional) –
Hexagon orientation. Defaults to
'vertical'.Added in version 0.11.0.
rot (double, optional) –
Rotation angle (deg, positive counter-clockwise).
Added in version 0.11.0.
Notes
Lengths may be given as plain numbers of microns or as unitful quantities. See
pulse2percept.units.
- property width
Flat-to-flat width (um) of the hexagon
Added in version 0.11.0.
- 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 aQuantity.- 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