Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Adjust the z values:
if overwrite_z:
# Specify different height for every electrode in a list:
z_arr = np.asarray(z).flatten()
if z_arr.size != self.n_electrodes:
raise ValueError("If `z` is a list, it must have %d entries, "
"not %d." % (self.n_electrodes, z_arr.size))
for elec, z_elec in zip(self.earray.values(), z):
elec.z = z_elec
# Beware of race condition: Stim must be set last, because it requires
# indexing into self.electrodes:
self.stim = stim
class PRIMA40(ProsthesisSystem):
"""Create a PRIMA-40 array on the retina
This class creates a PRIMA array with 532 photovoltaic pixels (each 40um
in diameter), and places it in the subretinal space, such that that the
center of the array is located at 3D location (x,y,z), given in microns,
and the array is rotated by rotation angle ``rot``, given in radians.
The device consists of 532 35um-wide pixels separated by 5um trenches,
arranged in a 1-mm wide hexagonal pattern.
This corresponds to a 40um pitch, with adjacent rows separated by 48um.
The active electrode is a disk with 16um diameter.
.. important ::
The exact shape of the device has not been published yet. We assume the
'orientation': np.radians(30), 'fc': 'k',
'ec': 'k'},
{'radius': r, 'linewidth': 0, 'color': 'k',
'alpha': 0.5}]
def _pprint_params(self):
"""Return dict of class attributes to pretty-print"""
params = super()._pprint_params()
params.update({'r': self.r, 'a': self.a})
return params
def electric_potential(self, x, y, z, v0):
raise NotImplementedError
class PRIMA(ProsthesisSystem):
"""Create a PRIMA-100 array on the retina
This class creates a PRIMA array with 378 photovoltaic pixels (each
100um in diameter) as used in the clinical trial [Palanker2020]_, and
places it in the subretinal space such that the center of the array is
located at 3D location (x,y,z), given in microns, and the array is rotated
by rotation angle ``rot``, given in radians.
The device consists of 378 85um-wide pixels separated by 15um trenches,
arranged in a 2-mm wide hexagonal pattern.
This corresponds to a 100um pitch, with adjacent rows separated by 87um.
The active electrode is a disk with 28um diameter.
.. versionadded:: 0.7
names[row] = names[row][::-1]
# Build a new ordered dict:
electrodes = OrderedDict()
for name, obj in zip(names.ravel(), objects):
electrodes.update({name: obj})
# Assign the new ordered dict to earray:
self.earray.electrodes = electrodes
def _pprint_params(self):
"""Return dict of class attributes to pretty-print"""
params = super()._pprint_params()
params.update({'shape': self.shape})
return params
class ArgusII(ProsthesisSystem):
"""Create an Argus II array on the retina
This function creates an Argus II array and places it on the retina
such that the center of the array is located at (x,y,z), given in
microns, and the array is rotated by rotation angle ``rot``, given in
radians.
Argus II contains 60 electrodes of 225 um diameter arranged in a 6 x 10
grid (575 um center-to-center separation) [Yue2020]_.
The array is oriented upright in the visual field, such that an
array with center (0,0) has the top three rows lie in the lower
retina (upper visual field), as shown below:
.. raw:: html
"""`ArgusI`, `ArgusII`"""
import numpy as np
from collections import OrderedDict
from .base import ProsthesisSystem
from .electrodes import DiskElectrode
from .electrode_arrays import ElectrodeGrid
class ArgusI(ProsthesisSystem):
"""Create an Argus I array on the retina
This function creates an Argus I array and places it on the retina
such that the center of the array is located at 3D location (x,y,z),
given in microns, and the array is rotated by rotation angle ``rot``,
given in radians.
Argus I is a modified cochlear implant containing 16 electrodes in a 4x4
array with a center-to-center separation of 800 um, and two electrode
diameters (250 um and 500 um) arranged in a checkerboard pattern
[Yue2020]_.
The array is oriented in the visual field as shown in Fig. 1 of
[Horsager2009]_; that is, if placed in (0,0), the top two rows will lie in
the lower retina (upper visual field):
"""`BVT24`"""
import numpy as np
from .base import ProsthesisSystem
from .electrodes import DiskElectrode
from .electrode_arrays import ElectrodeArray
class BVT24(ProsthesisSystem):
"""24-channel suprachoroidal retinal prosthesis
This class creates a 24-channel suprachoroidal retinal prosthesis
[Layton2014]_, which was developed by the Bionic Vision Australia
Consortium and commercialized by Bionic Vision Technologies (BVT).
The center of the array is located at (x,y,z), given in microns, and the
array is rotated by rotation angle ``rot``, given in radians.
The array consists of:
- 33 platinum stimulating electrodes:
- 30 electrodes with 600um diameter (Electrodes 1-20 (except
9, 17, 19) and Electrodes 21a-m),
- 3 electrodes with 400um diameter (Electrodes 9, 17, 19)
# Adjust the z values:
if overwrite_z:
# Specify different height for every electrode in a list:
z_arr = np.asarray(z).flatten()
if z_arr.size != self.n_electrodes:
raise ValueError("If `z` is a list, it must have %d entries, "
"not %d." % (self.n_electrodes, z_arr.size))
for elec, z_elec in zip(self.earray.values(), z):
elec.z = z_elec
# Beware of race condition: Stim must be set last, because it requires
# indexing into self.electrodes:
self.stim = stim
class PRIMA75(ProsthesisSystem):
"""Create a PRIMA-75 array on the retina
This class creates a PRIMA array with 142 photovoltaic pixels (each 75um
in diameter) as described in [Lorach2015]_, and places it in the subretinal
space, such that that the center of the array is located at 3D location
(x,y,z), given in microns, and the array is rotated by rotation angle
``rot``, given in radians.
The device consists of 142 70um-wide pixels separated by 5um trenches,
arranged in a 1-mm wide hexagonal pattern.
This corresponds to a 75um pitch, with adjacent rows separated by 65um.
The active electrode is a disk with 20um diameter.
.. versionadded:: 0.7
"not %d." % (self.n_electrodes, z_arr.size))
for elec, z_elec in zip(self.earray.values(), z):
elec.z = z_elec
# Beware of race condition: Stim must be set last, because it requires
# indexing into self.electrodes:
self.stim = stim
def _pprint_params(self):
"""Return dict of class attributes to pretty-print"""
params = super()._pprint_params()
params.update({'shape': self.shape})
return params
class AlphaAMS(ProsthesisSystem):
"""Alpha-AMS
This class creates an Alpha-AMS array with 1600 photovoltaic pixels (each
30um in diameter) as described in [Stingl2017]_, and places it in the
subretinal space, such that the center of the array is located at (x,y,z),
given in microns, and the array is rotated by rotation angle ``rot``,
given in radians.
The device consists of 1600 30um-wide round pixels, arranged on a 40x40
rectangular grid with 70um pixel pitch.
The array is oriented upright in the visual field, such that an
array with center (0,0) has the top three rows lie in the lower
retina (upper visual field), as shown below:
An electrode can be addressed by name, row/column index, or integer index
"""`AlphaIMS`, `AlphaAMS`"""
import numpy as np
from collections import OrderedDict
from .base import ProsthesisSystem
from .electrodes import SquareElectrode, DiskElectrode
from .electrode_arrays import ElectrodeGrid
class AlphaIMS(ProsthesisSystem):
"""Alpha-IMS
This class creates an Alpha-IMS array with 1500 photovoltaic pixels (each
50um in diameter) as described in [Stingl2013]_, and places it in the
subretinal space, such that the center of the array is located at (x,y,z),
given in microns, and the array is rotated by rotation angle ``rot``,
given in radians.
The device consists of 1500 50um-wide square pixels, arranged on a 39x39
rectangular grid with 72um pixel pitch.
The array is oriented upright in the visual field, such that an
array with center (0,0) has the top three rows lie in the lower
retina (upper visual field).
An electrode can be addressed by name, row/column index, or integer index
# Adjust the z values:
if overwrite_z:
# Specify different height for every electrode in a list:
z_arr = np.asarray(z).flatten()
if z_arr.size != self.n_electrodes:
raise ValueError("If `z` is a list, it must have %d entries, "
"not %d." % (self.n_electrodes, z_arr.size))
for elec, z_elec in zip(self.earray.values(), z):
elec.z = z_elec
# Beware of race condition: Stim must be set last, because it requires
# indexing into self.electrodes:
self.stim = stim
class PRIMA55(ProsthesisSystem):
"""Create a PRIMA-55 array on the retina
This class creates a PRIMA array with 273 photovoltaic pixels (each 55um
in diameter), and places it in the subretinal space, such that that the
center of the array is located at 3D location (x,y,z), given in microns,
and the array is rotated by rotation angle ``rot``, given in radians.
The device consists of 273 50um-wide pixels separated by 5um trenches,
arranged in a 1-mm wide hexagonal pattern.
This corresponds to a 55um pitch, with adjacent rows separated by 48um.
The active electrode is a disk with 16um diameter.
.. warning ::
The exact shape of the device has not been published yet. We assume the