pulse2percept.viz

Various visualization functions.

base correlation_matrix, scatter_correlation
axon_map plot_axon_map, plot_implant_on_axon_map
pulse2percept.viz.correlation_matrix(X, cols=None, dropna=True, ax=None)[source]

Plot feature correlation matrix (requires seaborn)

New in version 0.7.

Parameters:
  • X (pd.DataFrame) – Data matrix as a Pandas DataFrame
  • cols (list or None) – List of columns to include in the correlation matrix
  • dropna ({True, False}) – Flag whether to drop columns or rows with NaN values
  • ax (matplotlib.axes.Axes or list thereof; optional, default: None) – A Matplotlib Axes object or a list thereof (one per electrode to plot). If None, a new Axes object will be created.
pulse2percept.viz.plot_argus_phosphenes(data, argus, scale=1.0, axon_map=None, show_fovea=True, ax=None)[source]

Plots phosphenes centered over the corresponding electrodes

New in version 0.7.

Parameters:
  • data (pd.DataFrame) – The Beyeler2019 dataset, a subset thereof, or a DataFrame with identical organization (i.e., must contain columns ‘subject’, ‘image’, ‘xrange’, and ‘yrange’).
  • argus (ArgusI or ArgusII) – Either an Argus I or Argus II implant
  • scale (float) – Scaling factor to apply to the phosphenes
  • axon_map (AxonMapModel) – An instance of the axon map model to use for visualization.
  • show_fovea (bool) – Whether to indicate the location of the fovea with a square
  • ax (axis) – Matplotlib axis
pulse2percept.viz.plot_argus_simulated_phosphenes(percepts, argus, scale=1.0, axon_map=None, show_fovea=True, ax=None)[source]

Plots simulated phosphenes centered over the corresponding electrodes

New in version 0.7.

Parameters:
  • percepts (Percept) – A Percept object containing multiple frames, where each frame is the percept produced by activating a single electrode.
  • argus (ArgusI or ArgusII) – Either an Argus I or Argus II implant
  • scale (float) – Scaling factor to apply to the phosphenes
  • axon_map (AxonMapModel) – An instance of the axon map model to use for visualization.
  • show_fovea (bool) – Whether to indicate the location of the fovea with a square
  • ax (axis) – Matplotlib axis
pulse2percept.viz.plot_axon_map(eye='RE', loc_od=(15.5, 1.5), n_bundles=100, ax=None, upside_down=False, annotate=False, xlim=None, ylim=None)[source]

Deprecated since version 0.7: Function plot_axon_map is deprecated since version 0.7, and will be removed in version 0.8.

Plot an axon map

This function generates an axon map for a left/right eye and a given optic disc location.

eye : str
Either ‘LE’ for left eye or ‘RE’ for right eye
loc_od : (x_od, y_od), optional, default: (15.5, 1.5)
Location of the optic disc center (deg).
n_bundles : int, optional, default: 100
Number of nerve fiber bundles to plot.
ax : matplotlib.axes.Axes, optional, default: None
A Matplotlib axes object. If None given, a new one will be created.
upside_down : bool, optional, default: False
Flag whether to plot the retina upside-down, such that the upper half of the plot corresponds to the upper visual field. In general, inferior retina == upper visual field (and superior == lower).
annotate : bool, optional, default: True
Flag whether to annotate the four retinal quadrants (inferior/superior x temporal/nasal).
xlim: (xmin, xmax), optional, default: (-5000, 5000)
Range of x coordinates to visualize. If None, the center 10 mm of the retina will be shown.
ylim: (ymin, ymax), optional, default: (-4000, 4000)
Range of y coordinates to visualize. If None, the center 8 mm of the retina will be shown.
ax : matplotlib.axes.Axes
Returns the axis object of the plot
pulse2percept.viz.plot_implant_on_axon_map(implant, loc_od=(15.5, 1.5), n_bundles=100, ax=None, upside_down=False, annotate_implant=False, annotate_quadrants=True, xlim=None, ylim=None)[source]

Deprecated since version 0.7: Function plot_implant_on_axon_map is deprecated since version 0.7, and will be removed in version 0.8.

Plot an implant on top of the axon map

This function plots an electrode array on top of an axon map.

implant : p2p.implants.ProsthesisSystem
A ProsthesisSystem object. If a stimulus is given, stimulating electrodes will be highlighted in yellow.
loc_od : (x_od, y_od), optional, default: (15.5, 1.5)
Location of the optic disc center (deg).
n_bundles : int, optional, default: 100
Number of nerve fiber bundles to plot.
ax : matplotlib.axes._subplots.AxesSubplot, optional, default: None
A Matplotlib axes object. If None given, a new one will be created.
upside_down : bool, optional, default: False
Flag whether to plot the retina upside-down, such that the upper half of the plot corresponds to the upper visual field. In general, inferior retina == upper visual field (and superior == lower).
annotate_implant : bool, optional, default: True
Flag whether to label electrodes in the implant.
annotate_quadrants : bool, optional, default: True
Flag whether to annotate the four retinal quadrants (inferior/superior x temporal/nasal).
xlim : (xmin, xmax), optional, default: None
Range of x values to plot. If None, the plot will be centered over the implant.
ylim : (ymin, ymax), optional, default: None
Range of y values to plot. If None, the plot will be centered over the implant.
ax : matplotlib.axes.Axes
Returns the axis object of the plot
pulse2percept.viz.scatter_correlation(x, y, marker='o', color='k', ax=None, autoscale=True)[source]

Scatter plots some data points and fits a regression curve to them

New in version 0.7.

Parameters:
  • y (x,) – x, y coordinates of data points to scatter
  • marker (str) – Matplotlib marker style
  • color (str) – Matplotlib marker color
  • ax (axis) – Matplotlib axis
  • autoscale ({True, False}) – Flag whether to automatically adjust the axis limits