Check out the Hyperspy Workshop May 13-17, 2024 Online

diffraction#

This module contains utility functions for processing electron diffraction patterns.

Functions

apply_transformation(z, transformation, ...)

Apply a transformation to a 2-dimensional array.

azimuthal_integrate1d(z, ...[, mask, sum])

Calculate the azimuthal integral of z around a determined origin.

azimuthal_integrate2d(z, ...[, npt_azim, ...])

Calculate the azimuthal integral of z around a determined origin.

center_of_mass(z[, mask, threshold])

Estimate direct beam position by calculating the center of mass of the image.

circular_mask(shape, radius[, center])

Produces a mask of radius 'r' centered on 'center' of shape 'shape'.

convert_affine_to_transform(D, shape)

Converts an affine transform on a diffraction pattern to a suitable form for skimage.transform.warp()

ellipse_perimeter(r, c, r_radius, c_radius)

Generate ellipse perimeter coordinates.

find_beam_center_blur(z, sigma)

Estimate direct beam position by blurring the image with a large Gaussian kernel and finding the maximum.

find_beam_center_interpolate(z, sigma, ...)

Find the center of the primary beam in the image img by summing along X/Y directions and finding the position along the two directions independently.

find_beam_offset_cross_correlation(z, ...)

Find the offset of the direct beam from the image center by a cross-correlation algorithm.

find_hot_pixels(z[, threshold_multiplier, mask])

Find single pixels which have much larger values compared to neighbors.

gain_normalise(z, dref, bref)

Apply gain normalization to experimentally acquired electron diffraction pattern.

get_azimuthal_integrator(detector, ...[, ...])

[Deprecated] Basic method for creating a azimuthal integrator.

integrate_radially(z, azimuthal_integrator, ...)

Calculate the radial integrated profile curve as I = f(chi)

investigate_dog_background_removal_interactive(...)

[Deprecated] Utility function to help the parameter selection for the difference of gaussians (dog) background subtraction method

is_cupy_array(array)

Convenience function to determine if an array is a cupy array

match_template(image, template[, pad_input, ...])

Match a template to a 2-D or 3-D image using normalized correlation.

medfilt_1d(z, azimuthal_integrator, npt_rad, ...)

Perform the 2D integration and filter along each row using a median filter

normalize_template_match(z, template[, ...])

Matches a template with an image z.

peaks_as_gvectors(z, center, calibration)

Converts peaks found as array indices to calibrated units, for use in a hyperspy map function.

phase_cross_correlation(reference_image, ...)

Efficient subpixel image translation registration by cross-correlation.

reference_circle(coords, dimX, dimY, radius)

Draw the perimeter of an circle at a given position in the diffraction pattern (e.g. to provide a reference for finding the direct beam center).

regional_filter(z, h)

Perform a h-dome regional filtering of the an image for background subtraction.

remove_bad_pixels(z, bad_pixels)

Replace values in bad pixels with mean of neighbors.

remove_dead(z, deadpixels)

Remove dead pixels from experimental electron diffraction patterns.

sigma_clip(z, azimuthal_integrator, npt_rad, ...)

Perform the 2D integration and perform a sigm-clipping iterative

Classes

Version(version)

This class abstracts handling of a project's versions.

deprecated(since[, alternative, ...])

Decorator to mark deprecated functions with an informative warning.

interp1d(x, y[, kind, axis, copy, ...])

Interpolate a 1-D function.

tqdm(*_, **__)

Decorate an iterable object, returning an iterator which acts exactly like the original iterable, but prints a dynamically updating progressbar every time a value is requested.