debugg crop and get cropped ROI for NGC1068 and IC5063

This commit is contained in:
Thibault Barnouin
2022-03-31 10:54:44 +02:00
parent 707fd9823f
commit a0814ed7aa
19 changed files with 23 additions and 19 deletions

1
.gitignore vendored
View File

@@ -13,3 +13,4 @@ ipython_config.py
*.npy
*.par
data/IC5063_x3nl030/POLARIZATION_COMPARISON/POLARIZATION_COMPARISON-20220329T133819Z-001.zip
src/IC5063_x_y_F_P_PA.txt

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1024 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 859 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@@ -18,12 +18,12 @@ from lib.deconvolve import from_file_psf
def main():
##### User inputs
## Input and output locations
# globals()['data_folder'] = "../data/NGC1068_x274020/"
# infiles = ['x274020at.c0f.fits','x274020bt.c0f.fits','x274020ct.c0f.fits',
# 'x274020dt.c0f.fits','x274020et.c0f.fits','x274020ft.c0f.fits',
# 'x274020gt.c0f.fits','x274020ht.c0f.fits','x274020it.c0f.fits']
# psf_file = 'NGC1068_f253m00.fits'
# globals()['plots_folder'] = "../plots/NGC1068_x274020/"
globals()['data_folder'] = "../data/NGC1068_x274020/"
infiles = ['x274020at.c0f.fits','x274020bt.c0f.fits','x274020ct.c0f.fits',
'x274020dt.c0f.fits','x274020et.c0f.fits','x274020ft.c0f.fits',
'x274020gt.c0f.fits','x274020ht.c0f.fits','x274020it.c0f.fits']
psf_file = 'NGC1068_f253m00.fits'
globals()['plots_folder'] = "../plots/NGC1068_x274020/"
# globals()['data_folder'] = "../data/NGC1068_x14w010/"
# infiles = ['x14w0101t_c0f.fits','x14w0102t_c0f.fits','x14w0103t_c0f.fits',
@@ -62,10 +62,10 @@ def main():
# 'x3995202r_c0f.fits','x3995206r_c0f.fits']
# globals()['plots_folder'] = "../plots/PG1630+377_x39510/"
globals()['data_folder'] = "../data/IC5063_x3nl030/"
infiles = ['x3nl0301r_c0f.fits','x3nl0302r_c0f.fits','x3nl0303r_c0f.fits']
psf_file = 'IC5063_f502m00.fits'
globals()['plots_folder'] = "../plots/IC5063_x3nl030/"
# globals()['data_folder'] = "../data/IC5063_x3nl030/"
# infiles = ['x3nl0301r_c0f.fits','x3nl0302r_c0f.fits','x3nl0303r_c0f.fits']
# psf_file = 'IC5063_f502m00.fits'
# globals()['plots_folder'] = "../plots/IC5063_x3nl030/"
# globals()['data_folder'] = "../data/MKN3_x3nl010/"
# infiles = ['x3nl0101r_c0f.fits','x3nl0102r_c0f.fits','x3nl0103r_c0f.fits']
@@ -94,7 +94,7 @@ def main():
psf_scale = 'arcsec'
psf_shape=(9,9)
iterations = 10
# Cropping
# Initial crop
display_crop = False
# Error estimation
error_sub_shape = (75,75)
@@ -115,8 +115,10 @@ def main():
# Rotation
rotate_stokes = True #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
figname = 'IC5063_FOC' #target/intrument name
figname = 'NGC1068_FOC' #target/intrument name
figtype = '_combine_FWHM020' #additionnal informations
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%.
@@ -189,10 +191,12 @@ def main():
## Step 5:
# crop to desired region of interest (roi)
stokescrop = proj_plots.crop_Stokes(deepcopy(Stokes_test))
stokescrop.crop()
stokescrop.writeto(data_folder+figname+figtype+"_crop.fits")
stokes_crop, data_mask = stokescrop.hdul_crop, stokescrop.data_mask
if crop:
figtype += "_crop"
stokescrop = proj_plots.crop_Stokes(deepcopy(Stokes_test))
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).
if px_scale.lower() not in ['full','integrate']:

View File

@@ -338,7 +338,7 @@ def polarization_map(Stokes, data_mask=None, rectangle=None, SNRp_cut=3., SNRi_c
if step_vec == 0:
pol.data[np.isfinite(pol.data)] = 1./2.
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.)
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)
@@ -796,7 +796,6 @@ class crop_Stokes(crop_map):
else:
dataset.data = dataset.data[vertex[2]:vertex[3], vertex[0]:vertex[1]]
dataset.header.update(self.wcs_crop.to_header())
self.data_mask = self.hdul_crop[-1].data
try:
convert_flux = self.hdul_crop[0].header['photflam']
@@ -820,4 +819,4 @@ class crop_Stokes(crop_map):
@property
def data_mask(self):
return self.data_mask
return self.hdul_crop[-1].data