Skip to content

Commit 43154fe

Browse files
committed
more changes with TQ
1 parent 79709c0 commit 43154fe

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

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

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ def makeTableFromSourceCatalogs(icSrcs: dict[int, SourceCatalog], visitInfo: Vis
268268
table["coma1"] = table["ext_shapeHSM_HigherOrderMomentsSource_30"] + table["ext_shapeHSM_HigherOrderMomentsSource_12"]
269269
table["coma2"] = table["ext_shapeHSM_HigherOrderMomentsSource_21"] + table["ext_shapeHSM_HigherOrderMomentsSource_03"]
270270
table["coma"] = np.hypot(table["coma1"], table["coma2"])
271-
table["trefoil1"] = table["ext_shapeHSM_HigherOrderMomentsSource_30"] + table["ext_shapeHSM_HigherOrderMomentsSource_12"]
272-
table["trefoil2"] = table["ext_shapeHSM_HigherOrderMomentsSource_21"] - table["ext_shapeHSM_HigherOrderMomentsSource_03"]
271+
table["trefoil1"] = table["ext_shapeHSM_HigherOrderMomentsSource_30"] - 3*table["ext_shapeHSM_HigherOrderMomentsSource_12"]
272+
table["trefoil2"] = 3*table["ext_shapeHSM_HigherOrderMomentsSource_21"] - table["ext_shapeHSM_HigherOrderMomentsSource_03"]
273273
table["trefoil"] = np.hypot(table["trefoil1"], table["trefoil2"])
274274
table["kurtosis"] = table["ext_shapeHSM_HigherOrderMomentsSource_40"] + table["ext_shapeHSM_HigherOrderMomentsSource_04"] + 2*table["ext_shapeHSM_HigherOrderMomentsSource_22"]
275275
table["x"] = table["base_FPPosition_x"]
@@ -349,10 +349,10 @@ def makeFigureAndAxes() -> tuple[Figure, Any]:
349349
The created axes.
350350
"""
351351
# Note, tuning params here manually. Be careful if adjusting.
352-
fig = make_figure(figsize=(10, 6))
352+
fig = make_figure(figsize=(10, 8))
353353

354354
scatterSpec = GridSpec(
355-
nrows=2,
355+
nrows=3,
356356
ncols=2,
357357
figure=fig,
358358
left=0.05,
@@ -364,7 +364,7 @@ def makeFigureAndAxes() -> tuple[Figure, Any]:
364364
width_ratios=[1, 1.07], # Room for colorbar on right side
365365
)
366366
histSpec = GridSpec(
367-
nrows=2,
367+
nrows=3,
368368
ncols=1,
369369
figure=fig,
370370
left=0.65,
@@ -375,13 +375,16 @@ def makeFigureAndAxes() -> tuple[Figure, Any]:
375375
hspace=0.15,
376376
)
377377

378-
axs = np.empty((2, 3), dtype=object)
378+
axs = np.empty((3, 3), dtype=object)
379379
axs[0, 0] = fig.add_subplot(scatterSpec[0, 0])
380380
axs[0, 1] = fig.add_subplot(scatterSpec[0, 1])
381381
axs[1, 0] = fig.add_subplot(scatterSpec[1, 0])
382382
axs[1, 1] = fig.add_subplot(scatterSpec[1, 1])
383+
axs[2, 0] = fig.add_subplot(scatterSpec[2, 0])
384+
axs[2, 1] = fig.add_subplot(scatterSpec[2, 1])
383385
axs[0, 2] = fig.add_subplot(histSpec[0, 0])
384386
axs[1, 2] = fig.add_subplot(histSpec[1, 0])
387+
axs[2, 2] = fig.add_subplot(histSpec[2, 0])
385388

386389
for ax in axs[0, :2].ravel():
387390
ax.set_xticks([])
@@ -412,7 +415,14 @@ def plotData(
412415
e1 = table[prefix + "e1"]
413416
e2 = table[prefix + "e2"]
414417
e = table["e"]
418+
coma1 = table["coma1"]
419+
coma2 = table["coma2"]
420+
coma = table["coma"]
421+
trefoil1 = table["trefoil1"]
422+
trefoil2 = table["trefoil2"]
423+
trefoil = table["trefoil"]
415424
fwhm = table["FWHM"]
425+
kurtosis = table["kurtosis"]
416426

417427
# Quiver plot
418428
quiver_kwargs = {
@@ -436,11 +446,11 @@ def plotData(
436446
Q_coma = axs[2, 0].quiver(
437447
x,
438448
y,
439-
coma * np.cos(coma_angle)
449+
coma * np.cos(coma_angle),
440450
coma * np.sin(coma_angle),
441451
**quiver_kwargs,
442452
)
443-
453+
444454
trefoil_angle = np.arctan2(trefoil2, trefoil1) / 3 # spin-3
445455
Q_trefoil = axs[2, 1].quiver(
446456
x,
@@ -502,6 +512,22 @@ def plotData(
502512
axs[1, 2].axvline(eQuartiles[1], color="k", lw=2)
503513
axs[1, 2].axvline(eQuartiles[2], color="grey", lw=1)
504514

515+
# Kurtosis hist
516+
axs[2, 2].hist(kurtosis, bins=int(np.sqrt(len(table))), color="C3")
517+
kurtosisQuartiles = np.nanpercentile(kurtosis, [25, 50, 75])
518+
s = "Kurtosis\n"
519+
s += f"25%: {kurtosisQuartiles[0]:.3f}\n"
520+
s += f"50%: {kurtosisQuartiles[1]:.3f}\n"
521+
s += f"75%: {kurtosisQuartiles[2]:.3f}\n"
522+
axs[2, 2].text(
523+
s=s,
524+
transform=axs[2, 2].transAxes,
525+
**textKwargs,
526+
)
527+
axs[2, 2].axvline(kurtosisQuartiles[0], color="grey", lw=1)
528+
axs[2, 2].axvline(kurtosisQuartiles[1], color="k", lw=2)
529+
axs[2, 2].axvline(kurtosisQuartiles[2], color="grey", lw=1)
530+
505531

506532
def outlineDetectors(
507533
axs: npt.NDArray[np.object_],

0 commit comments

Comments
 (0)