pulse2percept.viz

Various visualization functions.

base

correlation_matrix, scatter_correlation

argus

plot_argus_phosphenes, plot_argus_simulated_phosphenes

pulse2percept.viz.correlation_matrix(X, cols=None, dropna=True, ax=None)[source]

Plot feature correlation matrix (requires seaborn)

Added 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=None, scale=1.0, axon_map=None, show_fovea=True, ax=None)[source]

Plots phosphenes centered over the corresponding electrodes

Added 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. If None, the data is expected to contain additional columns: “implant_type_str”, “implant_x”, “implant_y”, and “implant_rot”, which together define the type and position of the implant. “implant_type_str” must be either “ArgusI” or “ArgusII”.

  • 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

Added 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.scatter_correlation(x, y, marker='o', marker_size=50, marker_alpha=0.5, color='k', text_size=10, show_slope_intercept=False, ax=None, autoscale=True)[source]

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

Added in version 0.7.

Parameters:
  • x (array-like) – x, y coordinates of data points to scatter

  • y (array-like) – x, y coordinates of data points to scatter

  • marker (str, optional) – Marker style passed to Matplotlib’s scatter

  • marker_size (float or array-like, shape (n, ), optional) – Marker size in points**2 passed to Matplotlib’s scatter

  • marker_alpha (float, optional) – Marker alpha value between 0 and 1

  • color (array-like or list of colors or color, optional) – Marker color passed to Matplotlib’s scatter

  • text_size (int, optional) – Font size for inset text and axis labels

  • ax (axis, optional) – Matplotlib axis

  • autoscale ({True, False}) – Flag whether to automatically adjust the axis limits