cbi_toolbox.utils.plotting

The plotting module contains helper functions to plot animated movies in matplotlib.

class cbi_toolbox.utils.plotting.AnimImshow(images, interval=100)[source]

Bases: object

Create an animated figure over an array of images.

Parameters:
  • images (np.ndarray) – Array containing the images, shape [t, x, y].

  • interval (int, optional) – Frame duration in ms, by default 100.

save_to_gif(path)[source]

Save the animated figure as a gif file.

Parameters:

path (str) – Path to the file to save.

cbi_toolbox.utils.plotting.trace_points(points, coordinates)[source]

Compute point trace images from coordinates. Can be then used to plot point trajectory.

Parameters:
  • points (np.ndarray(N, 2)) – Coordinates of the N points for which to draw traces.

  • coordinates (np.ndarray(T, 2, W, H)) – Coordinate space in which the points are tracked, given as a sequence of T meshgrids.

Returns:

Array containing for each point the position of the closest point in the input coordinate arrays, at each step T in the sequence.

Return type:

np.ndarray(N, T, 2)