elektronn2.utils.plotting module

class elektronn2.utils.plotting.Scroller(axes, images, names, init_z=None)[source]

Bases: object

onscroll(event)[source]
update()[source]
elektronn2.utils.plotting.add_timeticks(ax, times, steps, time_str='mins', num=5)[source]
elektronn2.utils.plotting.embedfilters(filters, border_width=1, normalize=False, output_ratio=1.0, rgb_axis=None)[source]

Embed an nd array into an 2d matrix by tiling. The last two dimensions of a are assumed to be spatial, the others are tiled recursively.

elektronn2.utils.plotting.my_quiver(x, y, img=None, c=None)[source]

first dim of x,y changes along vertical axis second dim changes along horizontal axis x: vertical vector component y: horizontal vector component

elektronn2.utils.plotting.plot_debug(var, debug_output_names, save_name)[source]
elektronn2.utils.plotting.plot_exectimes(exectimes, save_path='~/exectimes.png', max_items=32)[source]

Plot model execution time dict obtained from elektronn2.neuromancer.model.Model.measure_exectimes()

Parameters:
  • exectimes – OrderedDict of execution times (output of Model.measure_exectimes())
  • save_path – Where to save the plot
  • max_items – Only the max_items largest execution times are given names and are plotted independently. Everything else is grouped under ‘(other nodes)’.
elektronn2.utils.plotting.plot_hist(timeline, history, save_name, loss_smoothing_length=200, autoscale=True)[source]

Plot graphical info during Training

elektronn2.utils.plotting.plot_kde(pred, target, save_name, limit=90, scale='same', grid=50, take_last=4000)[source]
elektronn2.utils.plotting.plot_regression(pred, target, save_name, loss_smoothing_length=200, autoscale=True)[source]

Plot graphical info during Training

elektronn2.utils.plotting.plot_trainingtarget(img, lab, stride=1)[source]

Plots raw image vs target to check if valid batches are produced. Raw data is also shown overlaid with targets

Parameters:
  • img (2d array) – raw image from batch
  • lab (2d array) – targets
  • stride (int) – strides of targets
elektronn2.utils.plotting.plot_var(var, save_name)[source]
elektronn2.utils.plotting.scroll_plot(images, names=None, init_z=None)[source]

Creates a plot 1x2 image plot of 3d volume images Scrolling changes the displayed slices

Parameters:
  • images (list of arrays (or single)) – Each array of shape (z,y,x) or (z,y,x,RGB)
  • names (list of strings (or single)) – Names for each image
  • Usage
  • -----
  • the scroll interaction to work, the "scroller" object (For) –
  • be returned to the calling scope (must) –
  • fig, scroller = _scroll_plot4(images, names) (>>>) –
  • fig.show() (>>>) –
elektronn2.utils.plotting.sma(c, n)[source]

Returns box-SMA of c with box length n, the returned array has the same length as c and is const-padded at the beginning