nion-software / nionswift-usim

STEM microscope simulator
GNU General Public License v3.0
6 stars 13 forks source link

Add simulation of amorphous sample #12

Closed cmeyer closed 2 years ago

cmeyer commented 5 years ago

From Scanning Transmission Electron Microscopy book (p125): "sample function for an amorphous sample by generating a random phase and applying a Gaussian filter to the Fourier transform".

Andreas additional comment: "complex data with random imaginary part and 0 real part, Gaussian, IFFT"

Brow71189 commented 5 years ago

Figure_1

These images were created with the following code:

import numpy as np
from scipy.ndimage import gaussian_filter, fourier_gaussian
import matplotlib.pyplot as plt

random_data = np.random.rand(512, 512)*2-1
real_space = gaussian_filter(random_data, 3)
random_phase = np.fft.ifft2(fourier_gaussian(random_data*1j, 3)).real
fig, ax = plt.subplots(1, 2, figsize=(8, 4))
ax[0].matshow(real_space)
ax[0].set_title('real space')
ax[0].axis('off')
ax[1].matshow(random_phase)
ax[1].set_title('random phase')
ax[1].axis('off')
plt.show()
Brow71189 commented 4 years ago

Couldn't that be closed since we have the amorphous sample?