@@ -365,6 +365,8 @@ def show(
365365 # loop over images
366366 from py4DSTEM .visualize import show
367367
368+ if show_fft :
369+ ar = np .abs (np .fft .fftshift (np .fft .fft2 (ar .copy ())))
368370 for a0 in range (num_images ):
369371 im = show (
370372 ar [a0 ],
@@ -386,18 +388,18 @@ def show(
386388
387389 # Assemble final image
388390 sat_change = np .maximum (val_total - 1.0 , 0.0 )
389- ar_rgb = np .zeros ((ar [0 ].shape [0 ], ar [0 ].shape [1 ], 3 ))
390- ar_rgb [:, :, 0 ] = np .mod (
391+ ar_hsv = np .zeros ((ar [0 ].shape [0 ], ar [0 ].shape [1 ], 3 ))
392+ ar_hsv [:, :, 0 ] = np .mod (
391393 np .arctan2 (sin_total , cos_total ) / (2 * np .pi ), 1.0
392394 )
393- ar_rgb [:, :, 1 ] = 1 - sat_change
394- ar_rgb [:, :, 2 ] = val_total # np.sqrt(cos_total**2 + sin_total**2)
395- ar_rgb = np .clip (ar_rgb , 0.0 , 1.0 )
395+ ar_hsv [:, :, 1 ] = 1 - sat_change
396+ ar_hsv [:, :, 2 ] = val_total # np.sqrt(cos_total**2 + sin_total**2)
397+ ar_hsv = np .clip (ar_hsv , 0.0 , 1.0 )
396398
397399 # Convert to RGB
398400 from matplotlib .colors import hsv_to_rgb
399401
400- ar_rgb = hsv_to_rgb (ar_rgb )
402+ ar_rgb = hsv_to_rgb (ar_hsv )
401403
402404 # Output image for plotting
403405 ar = ar_rgb
@@ -441,10 +443,10 @@ def show(
441443 ar = ar .data
442444 else :
443445 raise Exception ('input argument "ar" has unsupported type ' + str (type (ar )))
444-
445446 # Otherwise, plot one image
446447 if show_fft :
447- ar = np .abs (np .fft .fftshift (np .fft .fft2 (ar .copy ())))
448+ if combine_images is False :
449+ ar = np .abs (np .fft .fftshift (np .fft .fft2 (ar .copy ())))
448450
449451 # get image from a masked array
450452 if mask is not None :
0 commit comments