atomcloud.utils package
Submodules
Module contents
Created on Mon Mar 14 19:26:59 2022
@author: hofer
- atomcloud.utils.calc_diff_elements(coords)[source]
Calculate the difference between each element in the x and y arrays. This is used to calculate the average pixel size along each axis.
- atomcloud.utils.coordinate_transformation2D(XY_tuple, x0=0, y0=0, theta=0)[source]
Transforms coordinates by first performing a translation and then a rotation
- atomcloud.utils.find_square_mask(mask)[source]
Find the square mask that completely encompasses the elliptical mask.
- Parameters:
mask (np.ndarray) – The elliptical mask.
Returns – np.ndarray: The square mask.
- Return type:
ndarray
- atomcloud.utils.generate_elliptical_mask2D(XY_tuple, x0, y0, sig_x, sig_y, theta, scale=1)[source]
Currently does mask edge at wx (2 * sigmax), but change it to sigmax
- atomcloud.utils.get_coordinates(shape)[source]
Returns meshgrid of x and y coordinates of shape
- Parameters:
shape (tuple) – shape of image
- Returns:
meshgrid of x and y coordinates
- Return type:
tuple
- atomcloud.utils.get_lab_widths(px, py, theta)[source]
Given two orthogonal parameters which are rotated by theta with respect to the x and y axes, this function returns the widths in the lab frame.
- Parameters:
px – x width
py – y width
theta – angle in radians
- Returns:
x and y widths in the lab frame
- Return type:
list
- atomcloud.utils.get_wrapped_angle(angle, angle_range=3.141592653589793, min_angle=-1.5707963267948966)[source]
wrap angles to be within a certain angle range
- atomcloud.utils.nominal_value(x)[source]
Return the nominal value of x if it is a quantity with uncertainty (i.e., an AffineScalarFunc object); otherwise, returns x unchanged.
This utility function is useful for transforming a series of numbers, when only some of them generally carry an uncertainty.
- atomcloud.utils.rotate_coordinates2D(coordinates, theta)[source]
Rotates coordinates by theta radians
- Parameters:
coordinates (tuple[numpy.ndarray, numpy.ndarray]) – tuple of x and y coordinates
theta (float) – angle in radians
- Returns:
rotated x and y coordinates
- Return type:
tuple