get_diffraction_pattern#

Simulation2D.get_diffraction_pattern(shape: Tuple[int, int] = None, sigma: float = 10, direct_beam_position: Tuple[int, int] = None, in_plane_angle: float = 0, calibration: float = 0.01, mirrored: bool = False, fast: bool = True, normalize: bool = True, clip_threshold: float = 1)[source]#

Returns the diffraction data as a numpy array with two-dimensional Gaussians representing each diffracted peak. Should only be used for qualitative work.

Parameters:
shapetuple of ints

The size of a side length (in pixels)

sigmafloat

Standard deviation of the Gaussian function to be plotted (in pixels).

direct_beam_position: 2-tuple of ints, optional

The (x,y) coordinate in pixels of the direct beam. Defaults to the center of the image.

in_plane_angle: float, optional

In plane rotation of the pattern in degrees

mirrored: bool, optional

Whether the pattern should be flipped over the x-axis, corresponding to the inverted orientation

fast: bool, optional

Whether to speed up calculations by rounding spot coordinates down to integer pixel

normalize: bool, optional

Whether to normalize the pattern to values between 0 and 1

clip_threshold: float, optional

Only used when fast is False. Pixel intensity threshold, such that pixels which would be below this value are ignored. Thresholding performed before possible normalization. See diffsims.pattern.detector_functions.get_pattern_from_pixel_coordinates_and_intensities for details.

Returns
——-
diffraction-patternnumpy.array

The simulated electron diffraction pattern, normalized by default.

Notes

If don’t know the exact calibration of your diffraction signal using 1e-2 produces reasonably good patterns when the lattice parameters are on the order of 0.5nm and the default size and sigma are used.

Examples using Simulation2D.get_diffraction_pattern#

Simple Diffraction Pattern Simulation Examples

Simple Diffraction Pattern Simulation Examples