Skip to content

Commit 58cd95a

Browse files
committed
Add support for unpaired AOS in zernikePredictedFwhm.py
1 parent 3a81ef1 commit 58cd95a

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

python/lsst/summit/extras/plotting/zernikePredictedFwhm.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,23 +206,33 @@ def makeDofPredictedFWHMPlot(
206206

207207
# ----- Zernike comparison at corners -----
208208
# -----------------------------------------
209+
zernikesMeasured = wavefrontData["zksMeasured"]
210+
numSensors = zernikesMeasured.shape[0]
211+
212+
# Check if we are using paired/unpaired and provide enough axes
213+
if numSensors <= 4:
214+
numAxes = 2
215+
else:
216+
numAxes = 3
217+
209218
gsTop = gridspec.GridSpecFromSubplotSpec(
210-
2,
211-
2,
219+
numAxes,
220+
numAxes,
212221
subplot_spec=gsTopSplit[1],
213222
wspace=0.05,
214223
hspace=0.1,
215224
)
216225

217-
axes = np.empty((2, 2), dtype=object)
218-
for i in range(2):
219-
for j in range(2):
226+
axes = np.empty((numAxes, numAxes), dtype=object)
227+
for i in range(numAxes):
228+
for j in range(numAxes):
220229
if i == 0 and j == 0:
221230
axes[i, j] = fig.add_subplot(gsTop[i, j])
231+
elif i*numAxes + j >= numSensors:
232+
continue
222233
else:
223234
axes[i, j] = fig.add_subplot(gsTop[i, j], sharex=axes[0, 0], sharey=axes[0, 0])
224235

225-
zernikesMeasured = wavefrontData["zksMeasured"]
226236
zernikesEstimated = wavefrontData["zksEstimated"][:, : zernikesMeasured.shape[1]]
227237
zkIds = np.arange(zMin, zernikesMeasured.shape[1])
228238
x = np.arange(len(zkIds))
@@ -259,13 +269,13 @@ def makeDofPredictedFWHMPlot(
259269
tickPos = [i - zMin for i in tickIds if i in zkIds]
260270
tickIdsPresent = [i for i in tickIds if i in zkIds]
261271
ax.set_xticks(tickPos)
262-
if sensor >= 2:
272+
if sensor >= (numAxes*numAxes - numAxes):
263273
ax.set_xlabel("Noll index", fontsize=11)
264274
ax.set_xticklabels(tickIdsPresent)
265275
else:
266276
ax.tick_params(axis="x", labelbottom=False)
267277

268-
if sensor % 2 == 0: # left column
278+
if sensor % numAxes == 0: # left column
269279
ax.set_ylabel("(um)", fontsize=11)
270280
else: # right column
271281
ax.tick_params(axis="y", labelleft=False)
@@ -275,7 +285,7 @@ def makeDofPredictedFWHMPlot(
275285
for z in np.arange(zMin, zernikesMeasured.shape[1]):
276286
ax.axvline(z - zMin, color="gray", linestyle="--", linewidth=0.5, alpha=0.4)
277287

278-
if sensor == 1:
288+
if sensor == numAxes-1:
279289
ax.legend(
280290
loc="lower center",
281291
bbox_to_anchor=(0.58, 1.03), # centered above this axis

0 commit comments

Comments
 (0)