fix the fits header handling

This commit is contained in:
sugar_jo
2024-07-17 12:03:43 +08:00
parent c41526c0a6
commit 2d0d8105be
2 changed files with 79 additions and 50 deletions

View File

@@ -102,10 +102,14 @@ def adaptive_binning(I_stokes, Q_stokes, U_stokes, Stokes_cov):
def plot_quiver(ax, stkI, stkQ, stkU, stk_cov, poldata, pangdata, step_vec=1., scale_vec=2., optimal_binning=False):
if optimal_binning:
bin_map, bin_num = adaptive_binning(stkI, stkQ, stkU, stk_cov)
shape = stkI.shape
for i in range(1, bin_num+1):
bin = np.where(bin_map==i)
x_center, y_center = np.mean(bin, axis=1)
if not (20 < x_center < shape[0]-20 and 20 < y_center < shape[1]-20): # avoid plotting vectors on the edges of the image
continue
bin_I = np.sum(stkI[bin])
bin_Q = np.sum(stkQ[bin])