empyer.misc¶
Submodules¶
empyer.misc.angular_correlation module¶
-
empyer.misc.angular_correlation.
angular_correlation
(r_theta_img, mask=None, binning=1, cut_off=0, normalize=True)¶ A program that takes a 2d image and then preforms an angular correlation on the image. :Parameters: * r_theta_img (array_like) – The index of the axes
- mask (boolean array) – The name of the axis
- binning (int) – binning factor
- cut_off (int) – The cut off in pixels to
- normalize (bool) – Subtract <I( heta)>^2 and divide by <I( heta)>^2
-
empyer.misc.angular_correlation.
get_S_Q
(r_theta_img, plot=False)¶ Get the S of Q for the images.
Parameters: r_theta_img
-
empyer.misc.angular_correlation.
power_spectrum
(correlation, method='FFT')¶ Take the power spectrum for some correlation. Takes the FFT of the correlation
Parameters: - correlation (array-like) – Taking the FFT of the angular correlation to find the symmetry present
- method (str (“FFT”)) – Right now this doesn’t actually do anything but I want to add in other methods.
Returns: pow_spectrum – The resulting power spectrum from the angular correlation. Gives indexes 0-180.
Return type: array-like
empyer.misc.cartesain_to_polar module¶
-
empyer.misc.cartesain_to_polar.
convert
(img, center=None, angle=None, lengths=None, radius=[0, 100], phase_width=720)¶ Function for converting an image in cartesian coordinates to polar coordinates.
Parameters: - img (array-like) – A n by 2-d array for the image to convert to polar coordinates
- center (list) – [X,Y] coordinates for the center of the image
- angle (float) – Angle of rotation if the sample is elliptical
- lengths (list) – The major and minor lengths of the ellipse
- radius (list) – The inner and outer indexes to define the radius by.
- phase_width (int) – The number of “pixels” in the polar image along the x direction
Returns: polar_img – A numpy array of the input img in polar coordiates. Dim (radius[1]-radius[0]) x phase_width
Return type: array-like
empyer.misc.ellipse_analysis module¶
-
empyer.misc.ellipse_analysis.
advanced_solve_ellipse
(img, center, lengths, angle, phase_width, radius, num_points=500)¶ This is a method in development. Better at optimizing angular correlations
This method is in development. Due to the fact that an ellipse will have maximum 2-fold symmetry when the center is correctly determined and maximum 2*n-fold symmetry when the major/ minor axes as well as the angle of rotation is correct. This algorithm optimizes for these quantities.
- img: Array-like
- 2-d Array of some image
- range: list
- The lower and upper limits to look at. Usually should just look at the first ring.
- num_points: int
- The number of points to look at to determine the characteristic ellipse.
- center: list
- The x and y coordinates of the center
- lengths: list
- The major and minor axes
- angle: float
- The angle of rotation for the ellipse
-
empyer.misc.ellipse_analysis.
get_max_positions
(image, num_points=None, radius=None)¶
-
empyer.misc.ellipse_analysis.
invcot
(val)¶
-
empyer.misc.ellipse_analysis.
solve_ellipse
(img, interactive=False, num_points=500, plot=False, suspected_radius=None)¶ Takes a 2-d array and allows you to solve for the equivalent ellipse. Everything is done in array coord.
- Fitzgibbon, A. W., Fisher, R. B., Hill, F., & Eh, E. (1999). Direct Least Squres Fitting of Ellipses.
- IEEE Transactions on Pattern Analysis and Machine Intelligence, 21(5), 476–480.
http://nicky.vanforeest.com/misc/fitEllipse/fitEllipse.html
Parameters: - img (array-like) – Image with ellipse with more intense
- interactive (bool) – Allows you to pick points for the ellipse instead of taking the top 2000 points
- plot (bool) – plots the unwrapped image as well as a super imposed ellipse
Returns: - center (array-like) – In cartesian coordinates or (x,y)!!!!!! arrays are in y,x
- lengths (array-like) – The ‘length’ in pixels of the major and minor axis
- angle (float) – In radians based on the major axis
empyer.misc.fem module¶
-
empyer.misc.fem.
fem
(r_theta_imgs, version='omega', binning=1, cut=40)¶ Calculated the variance among some image
Parameters: - r_theta_imgs (array_like) – polar images
- version (str) – The name of the FEM equation to use
- binning (int) – binning factor
- cut (int) – The cut off in pixels to not consider
empyer.misc.image module¶
-
empyer.misc.image.
bin_2d
(image, binning_factor)¶ Binning a 2-dimensional image by some factor
Parameters: - image (2-d array)
- binning_factor (int)
Returns: new_image
Return type: 2-d array
-
empyer.misc.image.
cartesian_list_to_polar
(x_list, y_list, center)¶ A function that converts a list of x,y coordinates to (r,theta)
Parameters: - r (float) – radius
- theta (float) – angle
- center (array) – center of the array [x,y]
Returns: - theta_list (2-d array)
- r_list (2-d array)
-
empyer.misc.image.
cartesian_to_polar
(x, y, center)¶ A function that converts the x,y coordinates to polar ones. -Does not do the circular correction
-
empyer.misc.image.
create_grid
(dimension1, dimension2)¶ Parameters: - dimension1 (array)
- dimension2 (array)
Returns: - a (array)
- b (array)
-
empyer.misc.image.
distort
(image, center, angle, lengths)¶ Takes an image and distorts the image based on an elliptical distortion
Parameters: - image (array-like) – The image to apply the elliptical distortion to
- center (list) – The center of the ellipse
- angle (float) – The angle of the major axis in radians
- lengths (The lengths of the major and minor axis of the ellipse)
Returns: distorted – The elliptically distorted image
Return type: array-like
-
empyer.misc.image.
ellipsoid_list_to_cartesian
(r_list, theta_list, center, axes_lengths=None, angle=None)¶ Takes a list of ellipsoid points and then use then find their cartesian equivalent
Parameters: - r_list (array) – list of all of the radius. Can either be all values or even_spaced
- theta_list (array) – list of all of the radius. Can either be all values or even_spaced
- center (array_like) – center of the ellipsoid
- lengths (float) – length of the major axis
- minor (float) – length of the minor axis
- angle (float) – angle of the major axis in radians
Returns: - x_list (array_like) – list of x points
- y_list (array_like) – list of y points
-
empyer.misc.image.
flatten_axis
(array, axis)¶
-
empyer.misc.image.
polar_list_to_cartesian
(r_list, theta_list, center)¶ Parameters: - r_list (array_like) – radius
- theta_list (array_like) – angle
- center (array) – center of the array [x,y]
Returns: - x_list (array)
- y_list (array)
-
empyer.misc.image.
polar_to_cartesian
(r, theta, center)¶ A function that converts polar (r,theta) coordinates to cartesian(x,y) ones
Parameters: - r (float) – radius
- theta (float) – angle
- center (array) – center of the array [x,y]
Returns: - x (float)
- y (float)
-
empyer.misc.image.
random_ellipse
(num_points, center, foci, angle)¶
-
empyer.misc.image.
rotate
(x, y, angle)¶
-
empyer.misc.image.
square
(array)¶