Skip to content

Commit

Permalink
Fixed latent bug with exlude_superpixels #30.
Browse files Browse the repository at this point in the history
  • Loading branch information
ichristen committed Feb 21, 2023
1 parent e572c47 commit 9ac3ecb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions slmsuite/hardware/cameraslms.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ def wavefront_calibrate(
# Set the reference superpixel to be centered on the SLM.
[nxref, nyref] = np.floor( np.flip(self.slm.shape)
/ superpixel_size / 2).astype(np.int)

reference_superpixel = [nxref, nyref]
else:
(nxref, nyref) = reference_superpixel
Expand Down Expand Up @@ -981,7 +981,7 @@ def measure(index, plot=False):
prange = tqdm(phases, position=0, leave=False, desc=description)
else:
prange = phases

if return_movie: frames = []

# Step 3: Measure phase
Expand All @@ -996,11 +996,11 @@ def measure(index, plot=False):
]
)

if return_movie:
if return_movie:
frames.append(
plot_labeled(
interference_image,
plot=plot,
plot=plot,
title="Phase = ${:1.2f}\pi$".format(phase / np.pi),
plot_zoom=True
)
Expand All @@ -1023,7 +1023,7 @@ def measure(index, plot=False):
self.wavefront_calibration = wavefront_calibration

if return_movie: return frames

return {
"power": pwr,
"normalization": norm,
Expand Down Expand Up @@ -1078,11 +1078,11 @@ def measure(index, plot=False):
# Exclude margin superpixels, if desired.
if nx < exclude_superpixels[0]:
continue
if nx > self.slm.shape[1] - exclude_superpixels[0]:
if nx > NX - exclude_superpixels[0]:
continue
if ny < exclude_superpixels[1]:
continue
if ny > self.slm.shape[0] - exclude_superpixels[1]:
if ny > NY - exclude_superpixels[1]:
continue

# Measure!
Expand Down Expand Up @@ -1231,7 +1231,7 @@ def average_neighbors(matrix):
2 * np.pi * (nx - nxref) * superpixel_size * self.slm.dx,
2 * np.pi * (ny - nyref) * superpixel_size * self.slm.dy)

# Make sure our adjacent pixel under test is within range and
# Make sure our adjacent pixel under test is within range and
if (tx >= 0 and tx < NX and ty >= 0 and ty < NY and
(r2s[ty, tx] >= r2_threshold)): # or pathing[ty, tx] == ny)):

Expand Down

0 comments on commit 9ac3ecb

Please sign in to comment.