Plotting

This module contains functions that help visualize the scenewalk model.

The sw_plot module is used for making dynamical video files.

The nb_plot module are visualization functions that are useful for taking a quick look at data or settings before running estimations.

Example: Dynamic Visualization

The scenewalk model evolves continuously over time and therefore can be visualized as a video. Since we are visualizing all the in between steps this code is separate from the core model code however and needs to be changed separately in some places when new mechanisms are added.

_images/extended_sw.mp4

Dynamic plotting Notebook

Full Plotting Doc

Visualizing Scenewalk

Lisa Schwetlick 2019

University of Potsdam

scenewalk.plotting.sw_plot.plot_3_maps(ufinal_map=None, inhib_map=None, att_map=None)

Makes a nice plot of the three output maps (attention, inhibition, and final)

Parameters
ufinal_maparray

final SceneWalk map

inhib_maparray

SceneWalk inhibition map

att_maparray

SceneWalk attention map

Notes

For example see demo/detailed_look_at_sw.ipynb

scenewalk.plotting.sw_plot.plot_corrsac_dynamic_shifts_image(sw, fix_density_map, x_path, y_path, dur_path, filename, image, speed=100)

Make dynamic video plot of model evolution given a scanpath when the corrective saccade modification

Parameters
swscenewalk model object

scenewalk model object

fix_density_maparray

empirical density

x_path, y_path, dur_patharrays

list of datapoints, one for each fixation for x and y coordinates and duration

filenamestr

where to save. must end in “.mp4”

imagearray

base picture

speedint

frames per second (?)

Saves Result
scenewalk.plotting.sw_plot.plot_dynamic_shifts(sw, fix_density_map, x_path, y_path, dur_path, filename)

Make dynamic video plot of model evolution given a scanpath when the presaccadic attention shift is switched on.

Parameters
swscenewalk model object

scenewalk model object

fix_density_maparray

empirical density

x_path, y_path, dur_patharrays

list of datapoints, one for each fixation for x and y coordinates and duration

filenamestr

where to save. must end in “.mp4”

Saves Result
scenewalk.plotting.sw_plot.plot_dynamic_shifts_image(sw, fix_density_map, x_path, y_path, dur_path, filename, image, speed=100)

Make dinamic video plot of model evolution given a scanpath when the presaccadic attention shift is switched on.

Parameters
swscenewalk model object

scenewalk model object

fix_density_maparray

empirical density

x_path, y_path, dur_patharrays

list of datapoints, one for each fixation for x and y coordinates and duration

filenamestr

where to save. must end in “.mp4”

imagearray

base picture

speedint

frames per second (?)

Saves Result

Some useful visualization functions for Notebooks

scenewalk.plotting.nb_plots.plot_path_on_map(dens, x_path, y_path, sw)

plots a scanpath on top of the underlying image density

Parameters
densarray

empirical densities

x_path, y_patharrays

fixation locations

swscenewalk model object

scenewalk model object which includes the data range

Returns
fig, ax
scenewalk.plotting.nb_plots.priors_plot(priors, xlimsd=1, show_bounds=False)

Makes a simple plot of the priors in the dictionary

Parameters
Priorsdict

dictionary of priors where the key is the name and the value is an an instance of scipy.stats.truncated normal or some other distribution

xlimsdfloat

determines how large the xlims are. mean +_ sd*xlimsd

show_boundsbool

if true, makes xlims contingent on bounds, not on mean

Returns
fig, ax