Skip to content

Instantly share code, notes, and snippets.

@pmneila
Last active July 4, 2024 16:15
Show Gist options
  • Save pmneila/af899830eae663182ed7de71efcd042d to your computer and use it in GitHub Desktop.
Save pmneila/af899830eae663182ed7de71efcd042d to your computer and use it in GitHub Desktop.
Plot MMs
offsets = model.offsets(psa_angles)
plt.plot(offsets[:, 1], offsets[:, 0], '.-')
# plt.plot(offsets_bicubic[:, 1], offsets_bicubic[:, 0], '.-')
plt.plot(offsets[0, 1], offsets[0, 0], 'o')
plt.axis('equal')
plt.gca().invert_yaxis()
plt.xlabel(r"$\Delta{}x$ (px)", fontsize=14)
plt.ylabel(r"$\Delta{}y$ (px)", fontsize=14)
plt.grid()
def plot_mm(mm, wl_index=0, vmin=-1, vmax=1, vmin_off_diag=None, vmax_off_diag=None, with_extremes=False):
if vmin_off_diag is None:
vmin_off_diag = vmin
if vmax_off_diag is None:
vmax_off_diag = vmax
if with_extremes:
cmap = plt.cm.bwr.with_extremes(over='lime', under='yellow')
else:
cmap = plt.cm.bwr
fig, axes = plt.subplots(4, 4, sharex=True, sharey=True, figsize=(10, 10))
for (i, j), ax in zip(product(range(4), range(4)), axes.ravel()):
if i == j:
ax.imshow(mm[i, j, wl_index], vmin=vmin, vmax=vmax, cmap=cmap)
else:
ax.imshow(mm[i, j, wl_index], vmin=vmin_off_diag, vmax=vmax_off_diag, cmap=cmap)
fig.subplots_adjust(wspace=0.02, hspace=0.1)
return fig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment