looking for displacement of WCS in pipeline

This commit is contained in:
2025-04-01 16:20:40 +02:00
parent 3da6cbcfaf
commit 0087d18cba
3 changed files with 4 additions and 3 deletions

View File

@@ -637,7 +637,8 @@ def rebin_array(data_array, error_array, headers, pxsize=2, scale="px", operatio
pxsize, scale = "", "full"
else:
raise ValueError("'{0:s}' invalid scale for binning.".format(scale))
new_shape = np.ceil(min(image.shape / Dxy_arr, key=lambda x: x[0] + x[1])).astype(int)
new_shape_float = min(image.shape / Dxy_arr, key=lambda x: x[0] + x[1])
new_shape = np.ceil(new_shape_float).astype(int)
for i, (image, error, header) in enumerate(list(zip(data_array, error_array, headers))):
# Get current pixel size
@@ -666,6 +667,7 @@ def rebin_array(data_array, error_array, headers, pxsize=2, scale="px", operatio
# Update header
nw = w.deepcopy()
nw.wcs.cdelt *= Dxy
# nw.wcs.crpix += np.abs(new_shape_float - new_shape) * np.array(new_shape) / Dxy
nw.wcs.crpix /= Dxy
nw.array_shape = new_shape
nw.wcs.set()