polyTEM.crystal_peaks.flow_fieldsΒΆ
Functions
|
Display all files in the specified directory and number them in order. |
|
Assigns r, g, b values based on input angle. Inputs: theta: angle in degrees. Can be a single value or an array. Outputs: tuple of r, g, b values, each of which has the same shape as the input values. |
|
This function returns six functions that allow for easy conversion between cartesian coordinates, row-column coordinates, and subgrids within row-column coordinates. |
|
Returns a matrix of peak positions derived from a matrix of diffraction data. |
|
|
|
Provide a list of files in the specified directory, containing the specified file_type string |
|
Returns the 2d vector of the specified length at the specified angle in degrees |
|
Loads a numpy matrix with the correct data using my (Luke's) naming conventions. |
|
Plot flow Fields, By Luke Balhorn and Camila. |
|
Plots lines with non-constant RGBA or Width values. Inputs: trimmed_lines: (4 x m x n) matrix, which contains the (x, y, theta, is_active) values for each point m along each line n. This is the output of the trim_lines function. red: color value between 0 and 1 green: color value between 0 and 1 blue: color value between 0 and 1 alpha: transparency value between 0 and 1, where 1 is fully opaque and 0 is fully transparent. Interestingly, transparency does not seem to increase rendering time. width: line width. The value is not capped but is usually on the order of 1. |
|
Plots lines with a constant color and width. Inputs: propagated_lines: (4 x m x n) matrix, which contains the (x, y, theta, is_active) values for each point m along each line n. is_active is a binary value which is true if the line is still being drawn at that point. min_length: lines shorter than this will not be drawn sparsity: values greater than 1 reduce the number of lines drawn for speed and readability purposes. Outputs: fig: matplotlib.pyplot figure produces by this function. |
|
|
|
Combines data from trimmed lines and normalized intensities to give the angle, intensity, and other parameters at each point in the trimmed lines. |
|
Lines are extended in both direction from each line seed to create a more readable image. |
|
|
|
Rescales data such as intensity, q, or similar to values suitable for linewidth, alpha, or similar. |
|
Uses the peak matrix to produce a 3xn matrix of x, y, angle values to act as the start of lines that will be drawn. |
|
Moves a mask by an integer number of spaces in each direction. This allows a shape such as an ellipse to be drawn at any point on a matrix, and is faster than methods like np.roll. Inputs: mask: output of an np.where() function that you would like to move target_array_shape: shape of the array that was used in the np.where() function shift: tuple or numpy array of the number of spaces to move in each direction. Ouputs: formatted_mask: shifted mask in the same format as the original mask. |
|
Smooth a 2D array along axis 1 using a moving average. |
|
Trims lines created by the propagate_lines function for purposes of readability, rendering speed, and homogeneous line density. Inputs: propagated_lines: (4 x m x n) matrix, which contains the (x, y, theta, is_active) values for each point m along each line n. is_active is a boolean value which is true if the line is still being drawn at that point. intensity_matrix_shape: dimensions provided by intensity_matrix.shape step_size: real space distance between points in the intensity matrix, i.e. 10nm line_spacing: minimum distance between two lines before they start to overlap. Note that some overlaps may be allowed. spacing_resolution: higher values reduce geometric artifacts that cause greater spacing at certain angles. angle_spacing_degrees: minimum angular distance between two crossing lines before those lines count as overlapping. max_overlap_fraction: fraction of line that can overlap with already-drawn lines. If the line overlaps by more than this it is not drawn. min_length: lines with less points than the minimum length are not drawn verbose: Boolean. When true, extra troubleshooting information is shown, including the space-filling process. Outputs: trimmed_lines: matplotlib.pyplot figure drawn by the function. |
Classes
|