ncempy.viz.widgets module

ipywidgets-based interactive visualization tools for use in Jupyter notebooks.

Requires the ‘jupyter’ extra:

pip install ncempy[jupyter]

Functions

SI_interactive : Browse a spectrum image by spatial position. image_and_plot : Scroll through an image series with a linked line plot. fourDstem_interactive : Browse 4D-STEM diffraction patterns by probe position. stack_browse : Scroll through a 3D image stack. stemtomo_browse : Browse STEMTomo7 data by tilt angle and image index. bandpass_interactive : Interactively apply a bandpass filter to an image. volume_slicer : View orthogonal slices through a 3D volume.

ncempy.viz.widgets.SI_interactive(data, box_size)[source]

Browse a spectrum image by moving a spatial position selector.

Parameters:
  • data (ndarray, shape (energy, Y, X)) – The spectrum image dataset.

  • box_size (int) – Half-width of the summation box around the selected position. Must be >= 1.

Returns:

The interactive widget. Call display() on the result to show it.

Return type:

ipywidgets.interactive

ncempy.viz.widgets.bandpass_interactive(im)[source]

Interactively apply a bandpass filter to a 2D image.

Shows the filtered image and its FFT magnitude side by side. The inner and outer frequency cutoffs and the Gaussian smoothing width are adjustable.

Parameters:

im (ndarray, shape (Y, X)) – The input image to filter.

Returns:

The interactive widget. Call display() on the result to show it.

Return type:

ipywidgets.interactive

ncempy.viz.widgets.fourDstem_interactive(data, image)[source]

Browse 4D-STEM diffraction patterns by probe position.

Parameters:
  • data (ndarray, shape (Y, X, ky, kx)) – The 4D-STEM dataset.

  • image (ndarray, shape (Y, X)) – Real-space image (e.g. bright-field) used to select the probe position.

Returns:

The interactive widget. Call display() on the result to show it.

Return type:

ipywidgets.interactive

ncempy.viz.widgets.image_and_plot(images, plots)[source]

Scroll through an image series with a linked line plot.

Parameters:
  • images (ndarray, shape (N, Y, X)) – Stack of images to display.

  • plots (ndarray, shape (N, M)) – Corresponding 1D data to plot for each image (mean-subtracted on display).

Returns:

The interactive widget. Call display() on the result to show it.

Return type:

ipywidgets.interactive

ncempy.viz.widgets.stack_browse(data, **kwargs)[source]

Scroll through a 3D image stack slice by slice.

Parameters:
  • data (ndarray, shape (N, Y, X)) – The image stack. The first axis is the slicing axis.

  • **kwargs – Passed to pyplot.imshow().

Returns:

The interactive widget. Call display() on the result to show it.

Return type:

ipywidgets.interactive

ncempy.viz.widgets.stemtomo_browse(data, **kwargs)[source]

Browse STEMTomo7 data by tilt angle and image index.

Parameters:
  • data (ndarray, shape (tilts, images, Y, X)) – Data output from the STEMTomo7 acquisition program.

  • **kwargs – Passed to pyplot.imshow().

Returns:

The interactive widget. Call display() on the result to show it.

Return type:

ipywidgets.interactive

ncempy.viz.widgets.volume_slicer(data)[source]

View orthogonal slices through a 3D volume with linked crosshair markers.

Displays XY, XZ, and YZ slices with a red crosshair showing the current slice position, plus a summed projection for reference.

Parameters:

data (ndarray, shape (Z, Y, X)) – The 3D volume to explore.

Returns:

The interactive widget. Call display() on the result to show it.

Return type:

ipywidgets.interactive