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

vectors#

Utils for operating on 2D Diffraction Patterns.

Functions

detector_to_fourier(k_xy, wavelength, ...)

Maps two-dimensional Cartesian coordinates in the detector plane to three-dimensional coordinates in reciprocal space, with origo in [000].

calculate_norms(z)

Calculates the norm of an array of cartesian vectors.

calculate_norms_ragged(z)

Calculates the norm of an array of cartesian vectors.

filter_vectors_ragged(z, min_magnitude, ...)

Filters the diffraction vectors to accept only those with magnitudes within a user specified range.

filter_vectors_edge_ragged(z, x_threshold, ...)

Filters the diffraction vectors to accept only those not within a user specified proximity to detector edge.

normalize_or_zero(v)

Normalize v, or return the vector directly if it has zero length.

get_rotation_matrix_between_vectors(from_v1, ...)

Calculates the rotation matrix from one pair of vectors to the other.

get_npeaks(found_peaks)

Returns the number of entries in a list.

get_angle_cartesian_vec(a, b)

Compute the angles between two lists of vectors in a cartesian coordinate system.

get_angle_cartesian(a, b)

Compute the angle between two vectors in a cartesian coordinate system.

filter_vectors_near_basis(vectors, basis[, ...])

Filter an array of vectors to only the list of closest vectors to some set of basis vectors.

vectors_to_polar(vectors[, columns])

Converts a list of vectors to polar coordinates.

to_cart_three_angles(vectors)

polar_to_cartesian(vectors)

get_vectors_mesh(g1_norm, g2_norm, g_norm_max)

Calculate vectors coordinates of a mesh defined by a norm, a rotation and a shear component.

get_angles(angles)

This function takes a list of angles and returns the angles between each pair of angles.

get_filtered_combinations(pks, num[, ...])

Creates combinations of num peaks but forces at least one of the combinations to have an intensity higher than the intensity_threshold.

convert_to_markers(peaks, signal)

Convert a set of (flattened) peaks to a set of markers for plotting.

points_to_polygon(points[, num_points])

Convert a set of points to a polygon by creating a polygon.

points_to_poly_collection(points[, hull_index])

Convert a set of points to a polygon collection by creating a polygon.

column_mean(vectors, columns)

Calculate the mean of the columns of a set of vectors.

vectors2image(vectors, image_size, scales, ...)

Convert a set of vectors to an image by binning the vectors into a 2D histogram.

get_three_angles(pks[, k_index, ...])

This function takes the angle between three points and determines the angle between them, returning the angle if it is repeated using the accept_threshold to measure the acceptable difference between angle a and angle b.