visualization module

edafm.visualization.make_input_plots(Xs, outdir='./predictions/', start_ind=0, constant_range=False, cmap='afmhot', verbose=1)[source]

Plot multiple AFM image stacks to files 0_input.png, 1_input.png, … etc.

Parameters
  • Xs – list of np.ndarray of shape (batch, x, y, z). Input AFM images to plot.

  • outdir – str. Directory where images are saved.

  • start_ind – int. Save index increments by one for each image. The first index is start_ind.

  • constant_range – Boolean. Whether the different slices should use the same value range or not.

  • cmap – str or matplotlib colormap. Colormap to use for plotting.

  • verbose – int 0 or 1. Whether to print output information.

edafm.visualization.make_prediction_plots(preds=None, true=None, losses=None, descriptors=None, outdir='./predictions/', start_ind=0, verbose=1)[source]

Plot predictions/references for image descriptors.

Parameters
  • preds – list of np.ndarray of shape (batch_size, x_dim, y_dim). Predicted maps. Each list element corresponds to one descriptor.

  • true – list of np.ndarray of shape (batch_size, x_dim, y_dim). Reference maps. Each list element corresponds to one descriptor.

  • losses – np.ndarray of shape (len(preds), batch_size). Losses for each predictions.

  • descriptors – list of str. Names of descriptors. The name “ES” causes the coolwarm colormap to be used.

  • outdir – str. Directory where images are saved.

  • start_ind – int. Starting index for saved images.

  • verbose – int 0 or 1. Whether to print output information.

edafm.visualization.plot_input(X, constant_range=False, cmap='afmhot')[source]

Plot single stack of AFM images.

Parameters
  • X – np.ndarray of shape (x, y, z). AFM image to plot.

  • constant_range – Boolean. Whether the different slices should use the same value range or not.

  • cmap – str or matplotlib colormap. Colormap to use for plotting.

Returns

matplotlib.pyplot.figure. Figure on which the image was plotted.