Skip to content

Commit

Permalink
fix for ptycho aberration fit
Browse files Browse the repository at this point in the history
  • Loading branch information
smribet committed Oct 21, 2023
1 parent dfc312b commit b0e2c42
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions py4DSTEM/process/phase/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1549,10 +1549,10 @@ def aberrations_basis_function(
xp=np,
):
""" """
# mn = [[0,0,0]]
mn = []
mn = [[0,0,0]]
# mn = []

for m in range(1, max_radial_order):
for m in range(max_radial_order+1):
n_max = np.minimum(max_angular_order, m + 1)
for n in range(0, n_max + 1):
if (m + n) % 2:
Expand Down Expand Up @@ -1583,9 +1583,9 @@ def aberrations_basis_function(
theta = xp.arctan2(qy[None, :], qx[:, None])

# Aberration basis
aberrations_basis = xp.zeros((alpha.size, aberrations_num))
aberrations_basis = xp.ones((alpha.size, aberrations_num))

for a0 in range(aberrations_num):
for a0 in range(1,aberrations_num):
m, n, a = aberrations_mn[a0]
if n == 0:
# Radially symmetric basis
Expand Down Expand Up @@ -1641,7 +1641,7 @@ def fit_aberration_surface(

Aw = raveled_basis * raveled_weights[:, None]
bw = unwrapped_angle.ravel() * raveled_weights
coeff = -xp.linalg.lstsq(Aw, bw, rcond=None)[0]
coeff = xp.linalg.lstsq(Aw, bw, rcond=None)[0]

fitted_angle = xp.tensordot(raveled_basis, coeff, axes=1).reshape(probe_angle.shape)

Expand Down

0 comments on commit b0e2c42

Please sign in to comment.