Commit 34f505a8 authored by jansen31's avatar jansen31
Browse files

typos

parent 2a3a0eb6
......@@ -103,7 +103,7 @@ class OrthogonalOrbitals(PlanarMolecule):
self.createRandomGuess()
# some variables wich are necessary for the algorithm:
# some variables which are necessary for the algorithm:
self.data_sq = self.data ** 2
self.data_zeros = np.where(self.data == 0)
......@@ -182,7 +182,7 @@ class OrthogonalOrbitals(PlanarMolecule):
u_hat = prop.eval(u)
fourier_intensity = np.sqrt(np.sum(abs(u_hat) ** 2, axis=0))
if interpolate_and_zoom:
u_show = self.interp_zoom_field(u)
u_show = interp_zoom_field(u)
else:
u_show = u
fig, ax = plt.subplots(2, len(u) + 1, figsize=figsize, num=name)
......@@ -203,24 +203,6 @@ class OrthogonalOrbitals(PlanarMolecule):
plt.show()
return fig
def interp_zoom_field(self, u, interpolation=2, zoom=0.5):
"""
interpolate a field and zoom in to the center
"""
nt, ny, nx = u.shape
cm = center_of_mass(np.sum(abs(u) ** 2, axis=0))
to_shift = (0, -1*int(np.round(cm[0] - ny / 2)), -1*int(np.round(cm[1] - nx / 2)))
centered = np.roll(u, to_shift, axis=(0, 1, 2))
zmy = int(ny * zoom) // 2
zmx = int(nx * zoom) // 2
zoomed = centered[:, zmy:ny - zmy, zmx:nx - zmx]
interpolated = np.array([fourier_interpolate(u_i, factor=interpolation) for u_i in zoomed])
return interpolated
def support_from_stack(input_array: np.ndarray,
threshold: float = 0.1,
......@@ -234,7 +216,7 @@ def support_from_stack(input_array: np.ndarray,
Args:
input_array: either the measured diffraction patterns (arpes patterns) or guesses of the objects
threshold: support is everywhere where the autocorrelation is higher than the threshold
relative_threshold: If true, threshold at threshold*np.amax(autocorrelation)
relative_threshold: If true, threshold at threshold * np.max(autocorrelation)
input_in_fourier_domain: False if a guess of the object is given in input_array
absolute_autocorrelation: Take the absolute value of the autocorrelation? (Generally a
good idea for objects which are not non-negative)
......@@ -257,7 +239,7 @@ def support_from_stack(input_array: np.ndarray,
# Take the sum along the first axis to get the average of the autocorrelations
autocorrelation = np.sum(autocorrelation, axis=0)
# Detetmine thresholding
# Determine thresholding
maxval = np.amax(autocorrelation)
if relative_threshold:
threshold_val = threshold * maxval
......@@ -270,3 +252,22 @@ def support_from_stack(input_array: np.ndarray,
support = binary_dilation(support, iterations=binary_dilate_support).astype(np.uint)
return support
def interp_zoom_field(u, interpolation=2, zoom=0.5):
"""
interpolate a field and zoom in to the center
"""
nt, ny, nx = u.shape
cm = center_of_mass(np.sum(abs(u) ** 2, axis=0))
to_shift = (0, -1*int(np.round(cm[0] - ny / 2)), -1*int(np.round(cm[1] - nx / 2)))
centered = np.roll(u, to_shift, axis=(0, 1, 2))
zmy = int(ny * zoom) // 2
zmx = int(nx * zoom) // 2
zoomed = centered[:, zmy:ny - zmy, zmx:nx - zmx]
interpolated = np.array([fourier_interpolate(u_i, factor=interpolation) for u_i in zoomed])
return interpolated
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment