Module gonioanalysis.drosom.plotting.basics

Most commonly needed functions to plot the data.

Functions

def compare_3d_vectormaps(manalyser1, manalyser2, axes=None, illustrate=True, total_error=True, compact=False, animation=None, animation_type=None, animation_variable=None, optimal_ranges=None, pulsation_length=1, biphasic=False, kwargs1={}, kwargs2={}, kwargsD={}, **kwargs)

Calls get 3d vectors for both analysers. Arrow rotation option only affects manalyser2

Note! If total_error is true, sets attributes pupil_compare_errors and pupil_compare_rotations to the last ax in axes

manalyser1,manalyser2 : objects Analyser objects axes : list of objects List of Matplotlib Axes objects. Expected base length == 3 which is modified by options orientation, total_error and compact.

illustrate : bool Wheter to plot the illustrative plot. Increases the axes requirement by 1 total_error: bool Whether to plot the total error plot Increases the axes requirement by 1 compact : bool Join vectorplots in one. Decreases axes requirement by 1

animation : list For total error x-axis limits kwargs1,kwargs2 : dict List of keyword arguments to pass to plot_3d_vectormap() kwargsD : dict List of keywords arguments to pass to plot_3d_differencemap()

Returns [axes]

def compare_3d_vectormaps_compact(*args, **kwargs)

Wrapper for compare_3d_vectormaps but compact=True, total_error=False, illustrate=False

def compare_3d_vectormaps_manyviews(*args, axes=None, column_titles=['Microsaccades', 'Rhabdomere orientation', 'Difference', 'Mean microsaccade'], row_titles=['Dorsal\nview', 'Anterior\nview', 'Ventral\nview'], **kwargs)

Just with different views rendered

First axes gets attributes .orientation_ax and .error_ax

def plot_1d_magnitude(manalyser, image_folder=None, i_repeat=None, mean_repeats=False, mean_imagefolders=False, mean_eyes=False, color_eyes=False, gray_repeats=False, progressive_colors=False, show_mean=False, show_std=False, show_label=True, milliseconds=False, microns=False, phase=False, derivative=False, label='EYE-ANGLE-IREPEAT', ax=None)

Plots 1D displacement magnitude over time, separately for each eye.

Arguments

manalyser : object
MAnalyser object instance
image_folder : string or None
Image folder to plot the data from. If None (default), plot all image folders.
mean_repeats : bool
Wheter to take mean of the repeats or plot each repeat separately
mean_imagefolders : bool
If True and image_folder is None (plotting all image folders), takes the mean of all image folders.
mean_eyes : bool
Wheter to take a mean over the left and right eyes
label : string
Label to show. If None, no label. Otherwise EYE gets replaced with eye ANGLE gets replaced by image folder name IREPEAT gets reaplaced by the number of repeat
Returns
ax Matplotlib axes traces What has been plotted N_repeats The total number of repeats (independent of i_repeat)
def plot_2d_vectormap(manalyser, ax=None)

Plots a 2-dimensional vector map.

Arguments

manalyser : object
Instance of MAnalyser class or MAverager class (having get2DVectors method)
ax : object
Matplotlib axes object
def plot_3d_differencemap(manalyser1, manalyser2, ax=None, stats_map=False, elev=10, azim=70, colinear=True, direction=False, colorbar=True, colorbar_text=True, colorbar_ax=None, reverse_errors=False, colorbar_text_positions=[[1.1, 0.95, 'left', 'top'], [1.1, 0.5, 'left', 'center'], [1.1, 0.05, 'left', 'bottom']], i_frame=0, arrow_rotations=[0], pitch_rot=None, yaw_rot=None, roll_rot=None, hide_axes=False, hide_text=False, guidance=False, **kwargs)

Plots 3d heatmap presenting the diffrerence in the vector orientations for two analyser objects, by putting the get_3d_vectors of both analysers to field_error and making a surface plot.

Notes

  • Errors (differences) are calculated at manalyser1's points.
  • arrow_rotations, pitch_rot only affects manalyser2

manalyser1, manalyser2 : object Analyser objects to plot the difference with 3d vectors ax : object or None Matplotlib Axes object stats_map : bool If true, plot p-vals. colorbar : bool Whether to add the colors explaining colorbar colorbar_text: bool Wheter to add the text annotations on the colorbar colorbar_ax : object Optional Axes where to put the colorbar arrow_rotations : list Arrow rotations, for the second manalyser i_frame : int Neglected here hide_axes : bool hide_text : bool guidance : bool

def plot_3d_vectormap(manalyser, arrow_rotations=[0], rhabdomeres=False, repeats_separately=False, vertical_hardborder=False, elev=None, azim=None, pitch_rot=None, roll_rot=None, yaw_rot=None, animation=None, animation_type=None, animation_variable=None, i_frame=0, ax=None, *, points, vectors, color='black', mutation_scale=6, scale_length=1, i_pulsframe=None, guidance=False, camerapos=None, draw_sphere=True, vrot_lines=False, hide_axes=False, hide_text=False, **kwargs)

Plot a 3D vectormap, where the arrows point movement (MAnalyser, FAnalyser) or feature (OAnalyser) directions.

Arguments

manalyser : object
Analyser object
arrow_rotations : list of int
Rotation of arrows in the plane of the arrows (ie. radially).
rhabdomeres : bool
If True, draw rhabdomere pattern where the arrows are.
repeats_separately : bool
If True, and repeat data exists, draw each repeat with it's own arrow.
vertical_hardborder : bool
For MAverager, interpolate dorsal and ventral separetly
elev, azim : float or None
Plot elevation and azim
animation : None
 
animation_type : None
 
animation_variable : None
 
i_frame : int
 
ax : object
Maptlotlib ax object. If not specified, creates a new figure.
kwargs : dict
Variable keyword arguments are passed to vector_plot function.

Returns

ax : object
Matplotlib Axes object
vectors : list of objects
List of arrow artist drawn on the figure.
def plot_magnitude_probability(manalysers, wanted_imagefolders=None, ax=None, mean_repeats=False, mean_imagefolders=False, microns=True, milliseconds=True, xpoints=100)

With many analysers and image folders, calculate probablity of the magnitude response (2D histogram).

Arguments

manalysers : list of objs
Analyser objects
wanted_imagefolders : None or dict
Keys are analyser names, items lists of image folder names to incldue. If None, use all image folders.
def plot_xy_trajectory(manalysers, wanted_imagefolders=None, i_repeat=None, mean_repeats=True, ax=None)

A (x,y) 2D plot of the movement trajectory where time is encoded in color.

manalysers : list wanted_imagefolders : dict {specimen_name: [image_folder1, …]} i_repeat : int mean_repeats : bool