fix WCS computation, cdelt should not be sorted
This commit is contained in:
@@ -45,8 +45,8 @@ def main(target=None, proposal_id=None, infiles=None, output_dir="./data", crop=
|
||||
display_bkg = True
|
||||
|
||||
# Data binning
|
||||
pxsize = 0.05
|
||||
pxscale = "arcsec" # pixel, arcsec or full
|
||||
pxsize = 4
|
||||
pxscale = "px" # pixel, arcsec or full
|
||||
rebin_operation = "sum" # sum or average
|
||||
|
||||
# Alignement
|
||||
@@ -59,15 +59,15 @@ def main(target=None, proposal_id=None, infiles=None, output_dir="./data", crop=
|
||||
|
||||
# Smoothing
|
||||
smoothing_function = "combine" # gaussian_after, weighted_gaussian_after, gaussian, weighted_gaussian or combine
|
||||
smoothing_FWHM = 0.075 # If None, no smoothing is done
|
||||
smoothing_scale = "arcsec" # pixel or arcsec
|
||||
smoothing_FWHM = 1.5 # If None, no smoothing is done
|
||||
smoothing_scale = "px" # pixel or arcsec
|
||||
|
||||
# Rotation
|
||||
rotate_North = True
|
||||
|
||||
# Polarization map output
|
||||
P_cut = 5 # if >=1.0 cut on the signal-to-noise else cut on the confidence level in Q, U
|
||||
SNRi_cut = 5.0 # I measurments with SNR>30, which implies an uncertainty in P of 4.7%.
|
||||
P_cut = 3 # if >=1.0 cut on the signal-to-noise else cut on the confidence level in Q, U
|
||||
SNRi_cut = 1.0 # I measurments with SNR>30, which implies an uncertainty in P of 4.7%.
|
||||
flux_lim = None # lowest and highest flux displayed on plot, defaults to bkg and maximum in cut if None
|
||||
scale_vec = 3
|
||||
step_vec = 1 # plot all vectors in the array. if step_vec = 2, then every other vector will be plotted if step_vec = 0 then all vectors are displayed at full length
|
||||
|
||||
@@ -16,7 +16,7 @@ from astropy.io import fits
|
||||
from astropy.wcs import WCS
|
||||
|
||||
from .convex_hull import clean_ROI
|
||||
from .utils import wcs_PA
|
||||
from .utils import wcs_PA, princ_angle
|
||||
|
||||
|
||||
def get_obs_data(infiles, data_folder="", compute_flux=False):
|
||||
@@ -72,13 +72,13 @@ def get_obs_data(infiles, data_folder="", compute_flux=False):
|
||||
for key in keys:
|
||||
header.remove(key, ignore_missing=True)
|
||||
new_cdelt = np.linalg.eigvals(wcs.wcs.cd)
|
||||
new_cdelt.sort()
|
||||
# new_cdelt.sort()
|
||||
new_wcs.wcs.pc = wcs.wcs.cd.dot(np.diag(1.0 / new_cdelt))
|
||||
new_wcs.wcs.cdelt = new_cdelt
|
||||
for key, val in new_wcs.to_header().items():
|
||||
header[key] = val
|
||||
try:
|
||||
_ = header["ORIENTAT"]
|
||||
header["ORIENTAT"] = princ_angle(float(header["ORIENTAT"]))
|
||||
except KeyError:
|
||||
header["ORIENTAT"] = wcs_PA(new_wcs.wcs.pc[1, 0], np.diag(new_wcs.wcs.pc).mean())
|
||||
|
||||
|
||||
@@ -177,4 +177,4 @@ def wcs_PA(PC21, PC22):
|
||||
orient = np.arccos(PC22) * 180.0 / np.pi
|
||||
elif (abs(PC21) < abs(PC22)) and (PC22 < 0):
|
||||
orient = -np.arccos(PC22) * 180.0 / np.pi
|
||||
return orient
|
||||
return princ_angle(orient)
|
||||
|
||||
Reference in New Issue
Block a user