looking for displacement of WCS in pipeline
This commit is contained in:
@@ -20,7 +20,6 @@ import lib.reduction as proj_red # Functions used in reduction pipeline
|
||||
import numpy as np
|
||||
from lib.utils import princ_angle, sci_not
|
||||
from matplotlib.colors import LogNorm
|
||||
from astropy.wcs import WCS
|
||||
|
||||
|
||||
def main(target=None, proposal_id=None, infiles=None, output_dir="./data", crop=False, interactive=False):
|
||||
|
||||
@@ -456,12 +456,12 @@ def polarization_map(
|
||||
else:
|
||||
vmin, vmax = 1.0 / 2.0 * np.median(np.sqrt(stk_cov[0, 0][stkI > 0.0]) * convert_flux), np.max(stkI[stkI > 0.0] * convert_flux)
|
||||
im = ax.imshow(stkI * convert_flux, norm=LogNorm(vmin, vmax), aspect="equal", cmap=kwargs["cmap"], alpha=1.0)
|
||||
ax.plot(*WCS(Stokes[1]).wcs.crpix, "g+")
|
||||
fig.colorbar(im, ax=ax, aspect=50, shrink=0.60, pad=0.025, label=r"$F_{\lambda}$ [$ergs \cdot cm^{-2} \cdot s^{-1} \cdot \AA^{-1}$]")
|
||||
# levelsI = np.array([0.8, 2.0, 5.0, 10.0, 20.0, 50.0]) / 100.0 * vmax
|
||||
# print("Stokes I contour levels : ", levelsI)
|
||||
# ax.contour(stkI * convert_flux, levels=levelsI, colors="grey", linewidths=0.5)
|
||||
levelsF = np.array([0.8, 2.0, 5.0, 10.0, 20.0, 50.0]) / 100.0 * np.max(flux[flux > 0.0])
|
||||
print("Flux density contour levels : ", levelsF)
|
||||
ax.contour(flux, levels=levelsF, transform=ax.get_transform(WCS(Stokes[0].header).celestial), colors="grey", linewidths=0.5)
|
||||
elif display.lower() in ["pf", "pol_flux"]:
|
||||
# Display polarization flux
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user