diff --git a/data/PGN1630377_x39510/README.md b/data/PG1630+377_x39510/README.md similarity index 100% rename from data/PGN1630377_x39510/README.md rename to data/PG1630+377_x39510/README.md diff --git a/plots/3C405_x136060/3C405_FOC.png b/plots/3C405_x136060/3C405_FOC.png index d1fc2f4..52b9d4b 100644 Binary files a/plots/3C405_x136060/3C405_FOC.png and b/plots/3C405_x136060/3C405_FOC.png differ diff --git a/plots/3C405_x136060/3C405_FOC_P.png b/plots/3C405_x136060/3C405_FOC_P.png index 238aad5..9f9830a 100644 Binary files a/plots/3C405_x136060/3C405_FOC_P.png and b/plots/3C405_x136060/3C405_FOC_P.png differ diff --git a/plots/3C405_x136060/3C405_FOC_P_err.png b/plots/3C405_x136060/3C405_FOC_P_err.png index 5c7812b..e52a91b 100644 Binary files a/plots/3C405_x136060/3C405_FOC_P_err.png and b/plots/3C405_x136060/3C405_FOC_P_err.png differ diff --git a/plots/3C405_x136060/3C405_FOC_center_image.png b/plots/3C405_x136060/3C405_FOC_center_image.png index a7e2882..f0c3d60 100644 Binary files a/plots/3C405_x136060/3C405_FOC_center_image.png and b/plots/3C405_x136060/3C405_FOC_center_image.png differ diff --git a/plots/3C405_x136060/3C405_FOC_combine_FWHM035.png b/plots/3C405_x136060/3C405_FOC_combine_FWHM035.png new file mode 100644 index 0000000..9f619d5 Binary files /dev/null and b/plots/3C405_x136060/3C405_FOC_combine_FWHM035.png differ diff --git a/plots/3C405_x136060/3C405_FOC_combine_FWHM035_P.png b/plots/3C405_x136060/3C405_FOC_combine_FWHM035_P.png new file mode 100644 index 0000000..d70fa90 Binary files /dev/null and b/plots/3C405_x136060/3C405_FOC_combine_FWHM035_P.png differ diff --git a/plots/3C405_x136060/3C405_FOC_combine_FWHM035_P_err.png b/plots/3C405_x136060/3C405_FOC_combine_FWHM035_P_err.png new file mode 100644 index 0000000..32552e0 Binary files /dev/null and b/plots/3C405_x136060/3C405_FOC_combine_FWHM035_P_err.png differ diff --git a/plots/3C405_x136060/3C405_FOC_combine_FWHM070.png b/plots/3C405_x136060/3C405_FOC_combine_FWHM070.png new file mode 100644 index 0000000..a1f6987 Binary files /dev/null and b/plots/3C405_x136060/3C405_FOC_combine_FWHM070.png differ diff --git a/plots/3C405_x136060/3C405_FOC_combine_FWHM070_P.png b/plots/3C405_x136060/3C405_FOC_combine_FWHM070_P.png new file mode 100644 index 0000000..43490d8 Binary files /dev/null and b/plots/3C405_x136060/3C405_FOC_combine_FWHM070_P.png differ diff --git a/plots/3C405_x136060/3C405_FOC_combine_FWHM070_P_err.png b/plots/3C405_x136060/3C405_FOC_combine_FWHM070_P_err.png new file mode 100644 index 0000000..54f42ff Binary files /dev/null and b/plots/3C405_x136060/3C405_FOC_combine_FWHM070_P_err.png differ diff --git a/plots/3C405_x136060/3C405_FOC_combine_FWHM1.png b/plots/3C405_x136060/3C405_FOC_combine_FWHM1.png new file mode 100644 index 0000000..40d7a94 Binary files /dev/null and b/plots/3C405_x136060/3C405_FOC_combine_FWHM1.png differ diff --git a/plots/3C405_x136060/3C405_FOC_combine_FWHM1_P.png b/plots/3C405_x136060/3C405_FOC_combine_FWHM1_P.png new file mode 100644 index 0000000..3bd7ef2 Binary files /dev/null and b/plots/3C405_x136060/3C405_FOC_combine_FWHM1_P.png differ diff --git a/plots/3C405_x136060/3C405_FOC_combine_FWHM1_P_err.png b/plots/3C405_x136060/3C405_FOC_combine_FWHM1_P_err.png new file mode 100644 index 0000000..55ba799 Binary files /dev/null and b/plots/3C405_x136060/3C405_FOC_combine_FWHM1_P_err.png differ diff --git a/plots/3C405_x136060/3C405_FOC_combine_FWHM2.png b/plots/3C405_x136060/3C405_FOC_combine_FWHM2.png deleted file mode 100644 index 2983e92..0000000 Binary files a/plots/3C405_x136060/3C405_FOC_combine_FWHM2.png and /dev/null differ diff --git a/plots/3C405_x136060/3C405_FOC_combine_FWHM2_P.png b/plots/3C405_x136060/3C405_FOC_combine_FWHM2_P.png deleted file mode 100644 index 30da01b..0000000 Binary files a/plots/3C405_x136060/3C405_FOC_combine_FWHM2_P.png and /dev/null differ diff --git a/plots/3C405_x136060/3C405_FOC_combine_FWHM2_P_err.png b/plots/3C405_x136060/3C405_FOC_combine_FWHM2_P_err.png deleted file mode 100644 index ac7a6ae..0000000 Binary files a/plots/3C405_x136060/3C405_FOC_combine_FWHM2_P_err.png and /dev/null differ diff --git a/plots/3C405_x136060/3C405_FOC_errors_background_flux.png b/plots/3C405_x136060/3C405_FOC_errors_background_flux.png index ac45821..2bde4a0 100644 Binary files a/plots/3C405_x136060/3C405_FOC_errors_background_flux.png and b/plots/3C405_x136060/3C405_FOC_errors_background_flux.png differ diff --git a/plots/3C405_x136060/3C405_FOC_errors_background_location.png b/plots/3C405_x136060/3C405_FOC_errors_background_location.png index e22e8ae..dea7a7c 100644 Binary files a/plots/3C405_x136060/3C405_FOC_errors_background_location.png and b/plots/3C405_x136060/3C405_FOC_errors_background_location.png differ diff --git a/plots/3C405_x136060/3C405_FOC_gaussian_FWHM070.png b/plots/3C405_x136060/3C405_FOC_gaussian_FWHM070.png new file mode 100644 index 0000000..960d544 Binary files /dev/null and b/plots/3C405_x136060/3C405_FOC_gaussian_FWHM070.png differ diff --git a/plots/3C405_x136060/3C405_FOC_gaussian_FWHM070_P.png b/plots/3C405_x136060/3C405_FOC_gaussian_FWHM070_P.png new file mode 100644 index 0000000..a4712db Binary files /dev/null and b/plots/3C405_x136060/3C405_FOC_gaussian_FWHM070_P.png differ diff --git a/plots/3C405_x136060/3C405_FOC_gaussian_FWHM070_P_err.png b/plots/3C405_x136060/3C405_FOC_gaussian_FWHM070_P_err.png new file mode 100644 index 0000000..32dfc49 Binary files /dev/null and b/plots/3C405_x136060/3C405_FOC_gaussian_FWHM070_P_err.png differ diff --git a/plots/PGN1630377_x39510/PGN1630+377_FOC_center_image.png b/plots/PG1630+377_x39510/PG1630+377_FOC_center_image.png similarity index 100% rename from plots/PGN1630377_x39510/PGN1630+377_FOC_center_image.png rename to plots/PG1630+377_x39510/PG1630+377_FOC_center_image.png diff --git a/plots/PGN1630377_x39510/PGN1630+377_FOC_errors_background_flux.png b/plots/PG1630+377_x39510/PG1630+377_FOC_errors_background_flux.png similarity index 100% rename from plots/PGN1630377_x39510/PGN1630+377_FOC_errors_background_flux.png rename to plots/PG1630+377_x39510/PG1630+377_FOC_errors_background_flux.png diff --git a/plots/PGN1630377_x39510/PGN1630+377_FOC_errors_background_location.png b/plots/PG1630+377_x39510/PG1630+377_FOC_errors_background_location.png similarity index 100% rename from plots/PGN1630377_x39510/PGN1630+377_FOC_errors_background_location.png rename to plots/PG1630+377_x39510/PG1630+377_FOC_errors_background_location.png diff --git a/src/FOC_reduction.py b/src/FOC_reduction.py index e05c47d..f788a3f 100755 --- a/src/FOC_reduction.py +++ b/src/FOC_reduction.py @@ -29,10 +29,10 @@ def main(): # 'x14w0104t_c1f.fits','x14w0105p_c1f.fits','x14w0106t_c1f.fits'] # globals()['plots_folder'] = "../plots/NGC1068_x14w010/" -# globals()['data_folder'] = "../data/3C405_x136060/" -# infiles = ['x1360601t_c0f.fits','x1360602t_c0f.fits','x1360603t_c0f.fits'] -# infiles = ['x1360601t_c1f.fits','x1360602t_c1f.fits','x1360603t_c1f.fits'] -# globals()['plots_folder'] = "../plots/3C405_x136060/" + globals()['data_folder'] = "../data/3C405_x136060/" + infiles = ['x1360601t_c0f.fits','x1360602t_c0f.fits','x1360603t_c0f.fits'] + infiles = ['x1360601t_c1f.fits','x1360602t_c1f.fits','x1360603t_c1f.fits'] + globals()['plots_folder'] = "../plots/3C405_x136060/" # globals()['data_folder'] = "../data/CygnusA_x43w0/" # infiles = ['x43w0101r_c0f.fits', 'x43w0104r_c0f.fits', 'x43w0107r_c0f.fits', @@ -46,14 +46,6 @@ def main(): # infiles = ['x3mc0101m_c0f.fits','x3mc0102m_c0f.fits','x3mc0103m_c0f.fits'] # globals()['plots_folder'] = "../plots/3C109_x3mc010/" - globals()['data_folder'] = "../data/PGN1630377_x39510/" - infiles = ['x3990201m_c0f.fits', 'x3990205m_c0f.fits', 'x3995101r_c0f.fits', - 'x3995105r_c0f.fits', 'x3995109r_c0f.fits', 'x3995201r_c0f.fits', - 'x3995205r_c0f.fits', 'x3990202m_c0f.fits', 'x3990206m_c0f.fits', - 'x3995102r_c0f.fits', 'x3995106r_c0f.fits', 'x399510ar_c0f.fits', - 'x3995202r_c0f.fits','x3995206r_c0f.fits'] - globals()['plots_folder'] = "../plots/PGN1630377_x39510/" - # globals()['data_folder'] = "../data/MKN463_x2rp030/" # infiles = ['x2rp0201t_c0f.fits', 'x2rp0203t_c0f.fits', 'x2rp0205t_c0f.fits', # 'x2rp0207t_c0f.fits', 'x2rp0302t_c0f.fits', 'x2rp0304t_c0f.fits', @@ -62,6 +54,14 @@ def main(): # 'x2rp0305t_c0f.fits', 'x2rp0307t_c0f.fits'] # globals()['plots_folder'] = "../plots/MKN463_x2rp030/" +# globals()['data_folder'] = "../data/PG1630+377_x39510/" +# infiles = ['x3990201m_c0f.fits', 'x3990205m_c0f.fits', 'x3995101r_c0f.fits', +# 'x3995105r_c0f.fits', 'x3995109r_c0f.fits', 'x3995201r_c0f.fits', +# 'x3995205r_c0f.fits', 'x3990202m_c0f.fits', 'x3990206m_c0f.fits', +# 'x3995102r_c0f.fits', 'x3995106r_c0f.fits', 'x399510ar_c0f.fits', +# 'x3995202r_c0f.fits','x3995206r_c0f.fits'] +# globals()['plots_folder'] = "../plots/PG1630+377_x39510/" + ## Reduction parameters # Deconvolution deconvolve = False @@ -70,28 +70,28 @@ def main(): psf_FWHM = 0.10 psf_scale = 'arcsec' psf_shape=(9,9) - iterations = 5 + iterations = 10 # Error estimation - error_sub_shape = (100,100) - display_error = True + error_sub_shape = (200,200) + display_error = False # Data binning rebin = True if rebin: - pxsize = 0.10 + pxsize = 0.35 px_scale = 'arcsec' #pixel or arcsec rebin_operation = 'sum' #sum or average # Alignement align_center = 'image' #If None will align image to image center - display_data = True + display_data = False # Smoothing smoothing_function = 'combine' #gaussian or combine smoothing_FWHM = None #If None, no smoothing is done - smoothing_scale = 'pixel' #pixel or arcsec + smoothing_scale = 'arcsec' #pixel or arcsec # Rotation rotate = False #rotation to North convention can give erroneous results rotate_library = 'scipy' #scipy or pillow # Polarization map output - figname = 'PGN1630+377_FOC' #target/intrument name + figname = '3C405_FOC' #target/intrument name figtype = '' #additionnal informations SNRp_cut = 3 #P measurments with SNR>3 SNRi_cut = 30 #I measurments with SNR>30, which implies an uncertainty in P of 4.7%. diff --git a/src/lib/reduction.py b/src/lib/reduction.py index de39652..ad6e14c 100755 --- a/src/lib/reduction.py +++ b/src/lib/reduction.py @@ -716,7 +716,7 @@ def align_data(data_array, error_array=None, upsample_factor=1., ref_data=None, return rescaled_image, rescaled_error -def smooth_data(data_array, error_array, FWHM=1., scale='pixel', +def smooth_data(data_array, error_array, headers, FWHM=1., scale='pixel', smoothing='gaussian'): """ Smooth a data_array using selected function. @@ -727,6 +727,8 @@ def smooth_data(data_array, error_array, FWHM=1., scale='pixel', error_array : numpy.ndarray Array of images (2D floats, aligned and of the same shape) containing the error in each pixel of the observation images in data_array. + headers : header list + List of headers corresponding to the images in data_array. FWHM : float, optional Full Width at Half Maximum for desired smoothing in 'scale' units. Defaults to 1. @@ -887,14 +889,18 @@ def polarizer_avg(data_array, error_array, headers, FWHM=None, scale='pixel', err60_array = error_array[is_pol60] err120_array = error_array[is_pol120] + headers0 = [header for header in headers if header['filtnam1']=='POL0'] + headers60 = [header for header in headers if header['filtnam1']=='POL60'] + headers120 = [header for header in headers if header['filtnam1']=='POL120'] + if not(FWHM is None) and (smoothing.lower() in ['combine','combining']): # Smooth by combining each polarizer images - pol0, err0 = smooth_data(pol0_array, err0_array, FWHM=FWHM, - scale=scale, smoothing=smoothing) - pol60, err60 = smooth_data(pol60_array, err60_array, FWHM=FWHM, - scale=scale, smoothing=smoothing) - pol120, err120 = smooth_data(pol120_array, err120_array, FWHM=FWHM, - scale=scale, smoothing=smoothing) + pol0, err0 = smooth_data(pol0_array, err0_array, headers0, + FWHM=FWHM, scale=scale, smoothing=smoothing) + pol60, err60 = smooth_data(pol60_array, err60_array, headers60, + FWHM=FWHM, scale=scale, smoothing=smoothing) + pol120, err120 = smooth_data(pol120_array, err120_array, headers120, + FWHM=FWHM, scale=scale, smoothing=smoothing) else: # Average on each polarization filter. @@ -908,10 +914,12 @@ def polarizer_avg(data_array, error_array, headers, FWHM=None, scale='pixel', err60 = np.mean(err60_array,axis=0)/np.sqrt(err60_array.shape[0]) err120 = np.mean(err120_array,axis=0)/np.sqrt(err120_array.shape[0]) polerr_array = np.array([err0, err60, err120]) + + headers_array = headers0 + headers60 + headers120 if not(FWHM is None): # Smooth by convoluting with a gaussian each polX image. pol_array, polerr_array = smooth_data(pol_array, polerr_array, - FWHM=FWHM, scale=scale) + headers_array, FWHM=FWHM, scale=scale) pol0, pol60, pol120 = pol_array err0, err60, err120 = polerr_array