diff --git a/src/toolbox_scs/routines/boz.py b/src/toolbox_scs/routines/boz.py index 2f4296c55e10ea3a0a71017eef7740b89b3047dd..f3ebbe246d8ba09396abcfb6f7c9ee3213f278cb 100644 --- a/src/toolbox_scs/routines/boz.py +++ b/src/toolbox_scs/routines/boz.py @@ -795,26 +795,24 @@ def inspect_plane_fitting(avg, rois, vmin=None, vmax=None): fig, axs = plt.subplots(2, 3, sharex=True, figsize=(6, 6)) img_rois = {} + centers = {} + + for k, r in enumerate(['n', '0', 'p']): + roi = rois[r] + centers[r] = np.array([(roi['yl'] + roi['yh'])//2, + (roi['xl'] + roi['xh'])//2]) + d = '0' + roi = rois[d] for k, r in enumerate(['n', '0', 'p']): - img_rois[r] = avg[rois[r]['yl']:rois[r]['yh'], - rois[r]['xl']:rois[r]['xh']] + img_rois[r] = np.roll(avg, tuple(centers[r] - centers[d]))[ + roi['yl']:roi['yh'], roi['xl']:roi['xh']] im = axs[0, k].imshow(img_rois[r], vmin=vmin, vmax=vmax) for k, r in enumerate(['n', '0', 'p']): - if img_rois[r].shape[1] != img_rois['0'].shape[1]: - if k == 0: - n1 = img_rois[r].shape[1] - n = img_rois['0'].shape[1] - v = img_rois[r][:, (n1-n):]/img_rois['0'] - else: - n1 = img_rois[r].shape[1] - n = img_rois['0'].shape[1] - v = img_rois[r][:, :-(n1-n)]/img_rois['0'] - else: - v = img_rois[r]/img_rois['0'] + v = img_rois[r]/img_rois['0'] im2 = axs[1, k].imshow(v, vmin=0.2, vmax=1.1, cmap='RdBu_r') cbar = fig.colorbar(im, ax=axs[0, :], orientation="horizontal")