debugg crop and get cropped ROI for NGC1068 and IC5063
1
.gitignore
vendored
@@ -13,3 +13,4 @@ ipython_config.py
|
|||||||
*.npy
|
*.npy
|
||||||
*.par
|
*.par
|
||||||
data/IC5063_x3nl030/POLARIZATION_COMPARISON/POLARIZATION_COMPARISON-20220329T133819Z-001.zip
|
data/IC5063_x3nl030/POLARIZATION_COMPARISON/POLARIZATION_COMPARISON-20220329T133819Z-001.zip
|
||||||
|
src/IC5063_x_y_F_P_PA.txt
|
||||||
|
|||||||
BIN
plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop.png
Normal file
|
After Width: | Height: | Size: 603 KiB |
BIN
plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_IQU.png
Normal file
|
After Width: | Height: | Size: 97 KiB |
BIN
plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_I_err.png
Normal file
|
After Width: | Height: | Size: 335 KiB |
BIN
plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_P.png
Normal file
|
After Width: | Height: | Size: 273 KiB |
BIN
plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_P_err.png
Normal file
|
After Width: | Height: | Size: 330 KiB |
BIN
plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_P_flux.png
Normal file
|
After Width: | Height: | Size: 324 KiB |
BIN
plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_SNRi.png
Normal file
|
After Width: | Height: | Size: 1024 KiB |
BIN
plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_SNRp.png
Normal file
|
After Width: | Height: | Size: 859 KiB |
BIN
plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop.png
Normal file
|
After Width: | Height: | Size: 669 KiB |
BIN
plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_IQU.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_I_err.png
Normal file
|
After Width: | Height: | Size: 511 KiB |
BIN
plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_P.png
Normal file
|
After Width: | Height: | Size: 488 KiB |
BIN
plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_P_err.png
Normal file
|
After Width: | Height: | Size: 523 KiB |
|
After Width: | Height: | Size: 609 KiB |
BIN
plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_SNRi.png
Normal file
|
After Width: | Height: | Size: 1004 KiB |
BIN
plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_SNRp.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
@@ -18,12 +18,12 @@ from lib.deconvolve import from_file_psf
|
|||||||
def main():
|
def main():
|
||||||
##### User inputs
|
##### User inputs
|
||||||
## Input and output locations
|
## Input and output locations
|
||||||
# globals()['data_folder'] = "../data/NGC1068_x274020/"
|
globals()['data_folder'] = "../data/NGC1068_x274020/"
|
||||||
# infiles = ['x274020at.c0f.fits','x274020bt.c0f.fits','x274020ct.c0f.fits',
|
infiles = ['x274020at.c0f.fits','x274020bt.c0f.fits','x274020ct.c0f.fits',
|
||||||
# 'x274020dt.c0f.fits','x274020et.c0f.fits','x274020ft.c0f.fits',
|
'x274020dt.c0f.fits','x274020et.c0f.fits','x274020ft.c0f.fits',
|
||||||
# 'x274020gt.c0f.fits','x274020ht.c0f.fits','x274020it.c0f.fits']
|
'x274020gt.c0f.fits','x274020ht.c0f.fits','x274020it.c0f.fits']
|
||||||
# psf_file = 'NGC1068_f253m00.fits'
|
psf_file = 'NGC1068_f253m00.fits'
|
||||||
# globals()['plots_folder'] = "../plots/NGC1068_x274020/"
|
globals()['plots_folder'] = "../plots/NGC1068_x274020/"
|
||||||
|
|
||||||
# globals()['data_folder'] = "../data/NGC1068_x14w010/"
|
# globals()['data_folder'] = "../data/NGC1068_x14w010/"
|
||||||
# infiles = ['x14w0101t_c0f.fits','x14w0102t_c0f.fits','x14w0103t_c0f.fits',
|
# infiles = ['x14w0101t_c0f.fits','x14w0102t_c0f.fits','x14w0103t_c0f.fits',
|
||||||
@@ -62,10 +62,10 @@ def main():
|
|||||||
# 'x3995202r_c0f.fits','x3995206r_c0f.fits']
|
# 'x3995202r_c0f.fits','x3995206r_c0f.fits']
|
||||||
# globals()['plots_folder'] = "../plots/PG1630+377_x39510/"
|
# globals()['plots_folder'] = "../plots/PG1630+377_x39510/"
|
||||||
|
|
||||||
globals()['data_folder'] = "../data/IC5063_x3nl030/"
|
# globals()['data_folder'] = "../data/IC5063_x3nl030/"
|
||||||
infiles = ['x3nl0301r_c0f.fits','x3nl0302r_c0f.fits','x3nl0303r_c0f.fits']
|
# infiles = ['x3nl0301r_c0f.fits','x3nl0302r_c0f.fits','x3nl0303r_c0f.fits']
|
||||||
psf_file = 'IC5063_f502m00.fits'
|
# psf_file = 'IC5063_f502m00.fits'
|
||||||
globals()['plots_folder'] = "../plots/IC5063_x3nl030/"
|
# globals()['plots_folder'] = "../plots/IC5063_x3nl030/"
|
||||||
|
|
||||||
# globals()['data_folder'] = "../data/MKN3_x3nl010/"
|
# globals()['data_folder'] = "../data/MKN3_x3nl010/"
|
||||||
# infiles = ['x3nl0101r_c0f.fits','x3nl0102r_c0f.fits','x3nl0103r_c0f.fits']
|
# infiles = ['x3nl0101r_c0f.fits','x3nl0102r_c0f.fits','x3nl0103r_c0f.fits']
|
||||||
@@ -94,7 +94,7 @@ def main():
|
|||||||
psf_scale = 'arcsec'
|
psf_scale = 'arcsec'
|
||||||
psf_shape=(9,9)
|
psf_shape=(9,9)
|
||||||
iterations = 10
|
iterations = 10
|
||||||
# Cropping
|
# Initial crop
|
||||||
display_crop = False
|
display_crop = False
|
||||||
# Error estimation
|
# Error estimation
|
||||||
error_sub_shape = (75,75)
|
error_sub_shape = (75,75)
|
||||||
@@ -115,8 +115,10 @@ def main():
|
|||||||
# Rotation
|
# Rotation
|
||||||
rotate_stokes = True #rotation to North convention can give erroneous results
|
rotate_stokes = True #rotation to North convention can give erroneous results
|
||||||
rotate_data = False #rotation to North convention can give erroneous results
|
rotate_data = False #rotation to North convention can give erroneous results
|
||||||
|
# Final crop
|
||||||
|
crop = True #Crop to desired ROI
|
||||||
# Polarization map output
|
# Polarization map output
|
||||||
figname = 'IC5063_FOC' #target/intrument name
|
figname = 'NGC1068_FOC' #target/intrument name
|
||||||
figtype = '_combine_FWHM020' #additionnal informations
|
figtype = '_combine_FWHM020' #additionnal informations
|
||||||
SNRp_cut = 10. #P measurments with SNR>3
|
SNRp_cut = 10. #P measurments with SNR>3
|
||||||
SNRi_cut = 100. #I measurments with SNR>30, which implies an uncertainty in P of 4.7%.
|
SNRi_cut = 100. #I measurments with SNR>30, which implies an uncertainty in P of 4.7%.
|
||||||
@@ -189,10 +191,12 @@ def main():
|
|||||||
|
|
||||||
## Step 5:
|
## Step 5:
|
||||||
# crop to desired region of interest (roi)
|
# crop to desired region of interest (roi)
|
||||||
stokescrop = proj_plots.crop_Stokes(deepcopy(Stokes_test))
|
if crop:
|
||||||
stokescrop.crop()
|
figtype += "_crop"
|
||||||
stokescrop.writeto(data_folder+figname+figtype+"_crop.fits")
|
stokescrop = proj_plots.crop_Stokes(deepcopy(Stokes_test))
|
||||||
stokes_crop, data_mask = stokescrop.hdul_crop, stokescrop.data_mask
|
stokescrop.crop()
|
||||||
|
stokescrop.writeto(data_folder+figname+figtype+".fits")
|
||||||
|
Stokes_test, data_mask = stokescrop.hdul_crop, stokescrop.data_mask
|
||||||
|
|
||||||
# Plot polarization map (Background is either total Flux, Polarization degree or Polarization degree error).
|
# Plot polarization map (Background is either total Flux, Polarization degree or Polarization degree error).
|
||||||
if px_scale.lower() not in ['full','integrate']:
|
if px_scale.lower() not in ['full','integrate']:
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ def polarization_map(Stokes, data_mask=None, rectangle=None, SNRp_cut=3., SNRi_c
|
|||||||
if step_vec == 0:
|
if step_vec == 0:
|
||||||
pol.data[np.isfinite(pol.data)] = 1./2.
|
pol.data[np.isfinite(pol.data)] = 1./2.
|
||||||
step_vec = 1
|
step_vec = 1
|
||||||
X, Y = np.meshgrid(np.linspace(0,stkI.data.shape[0],stkI.data.shape[0])-0.5, np.linspace(0,stkI.data.shape[1],stkI.data.shape[1])-0.5)
|
X, Y = np.meshgrid(np.linspace(0,stkI.data.shape[1],stkI.data.shape[1])-0.5, np.linspace(0,stkI.data.shape[0],stkI.data.shape[0])-0.5)
|
||||||
U, V = pol.data*np.cos(np.pi/2.+pang.data*np.pi/180.), pol.data*np.sin(np.pi/2.+pang.data*np.pi/180.)
|
U, V = pol.data*np.cos(np.pi/2.+pang.data*np.pi/180.), pol.data*np.sin(np.pi/2.+pang.data*np.pi/180.)
|
||||||
Q = ax.quiver(X[::step_vec,::step_vec],Y[::step_vec,::step_vec],U[::step_vec,::step_vec],V[::step_vec,::step_vec],units='xy',angles='uv',scale=0.5,scale_units='xy',pivot='mid',headwidth=0.,headlength=0.,headaxislength=0.,width=0.1,color='w')
|
Q = ax.quiver(X[::step_vec,::step_vec],Y[::step_vec,::step_vec],U[::step_vec,::step_vec],V[::step_vec,::step_vec],units='xy',angles='uv',scale=0.5,scale_units='xy',pivot='mid',headwidth=0.,headlength=0.,headaxislength=0.,width=0.1,color='w')
|
||||||
pol_sc = AnchoredSizeBar(ax.transData, 2., r"$P$= 100 %", 4, pad=0.5, sep=5, borderpad=0.5, frameon=False, size_vertical=0.005, color='w', fontproperties=fontprops)
|
pol_sc = AnchoredSizeBar(ax.transData, 2., r"$P$= 100 %", 4, pad=0.5, sep=5, borderpad=0.5, frameon=False, size_vertical=0.005, color='w', fontproperties=fontprops)
|
||||||
@@ -796,7 +796,6 @@ class crop_Stokes(crop_map):
|
|||||||
else:
|
else:
|
||||||
dataset.data = dataset.data[vertex[2]:vertex[3], vertex[0]:vertex[1]]
|
dataset.data = dataset.data[vertex[2]:vertex[3], vertex[0]:vertex[1]]
|
||||||
dataset.header.update(self.wcs_crop.to_header())
|
dataset.header.update(self.wcs_crop.to_header())
|
||||||
self.data_mask = self.hdul_crop[-1].data
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
convert_flux = self.hdul_crop[0].header['photflam']
|
convert_flux = self.hdul_crop[0].header['photflam']
|
||||||
@@ -820,4 +819,4 @@ class crop_Stokes(crop_map):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def data_mask(self):
|
def data_mask(self):
|
||||||
return self.data_mask
|
return self.hdul_crop[-1].data
|
||||||