diff --git a/.gitignore b/.gitignore index e530053..b4c11ed 100755 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop.png b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop.png new file mode 100644 index 0000000..6bff077 Binary files /dev/null and b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop.png differ diff --git a/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_IQU.png b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_IQU.png new file mode 100644 index 0000000..89df4bb Binary files /dev/null and b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_IQU.png differ diff --git a/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_I_err.png b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_I_err.png new file mode 100644 index 0000000..5d93504 Binary files /dev/null and b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_I_err.png differ diff --git a/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_P.png b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_P.png new file mode 100644 index 0000000..10eea3d Binary files /dev/null and b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_P.png differ diff --git a/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_P_err.png b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_P_err.png new file mode 100644 index 0000000..838ee34 Binary files /dev/null and b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_P_err.png differ diff --git a/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_P_flux.png b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_P_flux.png new file mode 100644 index 0000000..8a441ef Binary files /dev/null and b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_P_flux.png differ diff --git a/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_SNRi.png b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_SNRi.png new file mode 100644 index 0000000..b22497b Binary files /dev/null and b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_SNRi.png differ diff --git a/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_SNRp.png b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_SNRp.png new file mode 100644 index 0000000..67b7cdd Binary files /dev/null and b/plots/IC5063_x3nl030/IC5063_FOC_combine_FWHM020_crop_SNRp.png differ diff --git a/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop.png b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop.png new file mode 100644 index 0000000..3832ad4 Binary files /dev/null and b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop.png differ diff --git a/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_IQU.png b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_IQU.png new file mode 100644 index 0000000..3986c6f Binary files /dev/null and b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_IQU.png differ diff --git a/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_I_err.png b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_I_err.png new file mode 100644 index 0000000..26e5b08 Binary files /dev/null and b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_I_err.png differ diff --git a/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_P.png b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_P.png new file mode 100644 index 0000000..47ca96f Binary files /dev/null and b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_P.png differ diff --git a/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_P_err.png b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_P_err.png new file mode 100644 index 0000000..d8dfba3 Binary files /dev/null and b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_P_err.png differ diff --git a/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_P_flux.png b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_P_flux.png new file mode 100644 index 0000000..e779fa0 Binary files /dev/null and b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_P_flux.png differ diff --git a/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_SNRi.png b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_SNRi.png new file mode 100644 index 0000000..146524d Binary files /dev/null and b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_SNRi.png differ diff --git a/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_SNRp.png b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_SNRp.png new file mode 100644 index 0000000..d3499a4 Binary files /dev/null and b/plots/NGC1068_x274020/NGC1068_FOC_combine_FWHM020_crop_SNRp.png differ diff --git a/src/FOC_reduction.py b/src/FOC_reduction.py index e41ed67..d87e35d 100755 --- a/src/FOC_reduction.py +++ b/src/FOC_reduction.py @@ -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']: diff --git a/src/lib/plots.py b/src/lib/plots.py index 41aa0af..38b8dd3 100755 --- a/src/lib/plots.py +++ b/src/lib/plots.py @@ -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 \ No newline at end of file + return self.hdul_crop[-1].data \ No newline at end of file