pulse2percept.models.retina.base
Classes
|
Abstract base class for spatial models of retinal stimulation. |
- class pulse2percept.models.retina.base.RetinalSpatial(implant, **params)[source]
Abstract base class for spatial models of retinal stimulation.
Adds to
SpatialModelthe behavior that is specific to simulating the retina:a retinotopic
visual_field_mapby default ([Curcio1990]);xrangeandyrangemay be given as a physical retinal extent, which is resolved throughvisual_field_map.
- Parameters:
implant (
Implant) – Implant whose electrode geometry is modeled.xrange ((float, float) or Quantity, optional) – Horizontal visual-field extent in degrees of visual angle. A physical retinal extent is accepted as shorthand and is resolved along the horizontal retinal meridian through
visual_field_map.yrange ((float, float) or Quantity, optional) – Vertical visual-field extent in degrees of visual angle. A physical retinal extent is resolved along the vertical meridian.
visual_field_map (VisualFieldMap, optional) – Retinotopic map between visual-field and retinal coordinates.
**params (keyword arguments) – Any other parameter of
SpatialModel.
Notes
xrangeandyrangealways describe the simulated visual field and are stored in degrees of visual angle. A retinal length is only shorthand for selecting that extent throughvisual_field_map; the resulting grid is still uniformly sampled in visual angle.steptherefore only accepts angular spacing.Added in version 0.11.0.
- property is_built
Return whether the grid matches the current retinal laterality
- build(**build_params)[source]
Build the model
- Parameters:
**build_params (keyword arguments) – Declared model parameters to set before building.
- Return type:
self
- extra_stimulus_units = ()
Additional stimulus units accepted by this model
- property implant
The prosthesis system whose geometry this model uses.
Rebinding invalidates the spatial build.
Added in version 0.11.0.
- property n_jobs
both names read and write the same value.
- Type:
Number of OpenMP threads to use during parallelization. An alias for
n_threads
- plot(use_dva=False, style='hull', autoscale=True, ax=None, figsize=None, show_implant=False)[source]
Plot the model
- Parameters:
use_dva (bool, optional) – Uses degrees of visual angle (dva) if True, else tissue coordinates (microns)
style ({'hull', 'scatter', 'cell'}, optional) –
Grid plotting style:
’hull’: Show the convex hull of the grid (that is, the outline of the smallest convex set that contains all grid points).
’scatter’: Scatter plot all grid points
’cell’: Show the outline of each grid cell as a polygon. Note that this can be costly for a high-resolution grid.
autoscale (bool, optional) – Whether to adjust the x,y limits of the plot to fit the implant
ax (matplotlib.axes._subplots.AxesSubplot, optional) – A Matplotlib axes object. If None, will either use the current axes (if exists) or create a new Axes object.
figsize ((float, float), optional) – Desired (width, height) of the figure in inches
show_implant (bool, optional) –
Draw the implant at its model-side placement. Requires
use_dva=False.Added in version 0.11.0.
- Returns:
ax – Returns the axis object of the plot
- Return type:
matplotlib.axes.Axes
- predict_percept(source, t_percept=None)[source]
Predict the spatial response.
- Parameters:
source (stimulus source) – Anything accepted by
prepare_stim().t_percept (float or array-like, optional) – Output times in
time_unit. If omitted, use the source time points. Unitful times are accepted.
- Returns:
percept – Percept with shape Y x X x T, or
Nonefor an empty source.- Return type:
Perceptor None
Notes
For an encoded image or video, a spatial-only model uses frame-level modulation rather than the delivered pulse train. In a composite
Modelwith a temporal stage, the spatial stage receives the delivered train so the temporal model can integrate it.Changed in version 0.11.0: Takes the stimulus source rather than an implant carrying a stimulus.