Loading metis_l2_prep_vl_polariz.pro +33 −33 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ pro metis_l2_prep_vl_polariz ; calibration block data = !null history = !null err_info = !null data_header = !null data_subdark = !null Loading @@ -53,29 +54,31 @@ pro metis_l2_prep_vl_polariz for k = 0, 3 do begin ; read the input image image = mrdfits(input.file_name[k], 0, primary_header, /silent) image = mrdfits(input.file_name[k], 0, header, /silent) ; fix compression header check_compression, image, primary_header check_compression, image, header ; patch to fix the lack of the keyword SEQ_NUM ; fix the lack of the keyword seq_num seq_num = fxpar(primary_header, 'SEQ_NUM', missing = 0) if seq_num eq 0 then begin obj_cnt = fxpar(primary_header, 'OBJ_CNT') n_pol = fxpar(primary_header, 'N_POL', missing = 4) if fxpar(header, 'SEQ_NUM', missing = 0) eq 0 then begin obj_cnt = fxpar(header, 'OBJ_CNT') n_pol = fxpar(header, 'N_POL', missing = 4) seq_num = ((obj_cnt - 1) / n_pol + 1) fxaddpar, primary_header, 'SEQ_NUM', seq_num, before = 'POL_ID' fxaddpar, header, 'SEQ_NUM', seq_num, before = 'POL_ID' endif if k eq 0 then comment = fxpar(primary_header, 'COMMENT') else begin sxdelpar, primary_header, 'COMMENT' foreach line, comment do $ fxaddpar, primary_header, 'COMMENT', line endelse if k eq 0 then primary_header = header ; remove comments and history from header sxdelpar, header, 'COMMENT' sxdelpar, header, 'HISTORY' ; convert string header to idl structure header = fits_hdr2struct(primary_header) header = fits_hdr2struct(header) ; ====================================================================== ; for old l1 data Loading Loading @@ -177,10 +180,9 @@ pro metis_l2_prep_vl_polariz ; apply dark correction to compute stokes i and total brightness history = !null image_subdark = metis_dark_vlda(image, header, cal_pack, err_info, $ quality_matrix = image_quality_matrix, history = history) quality_matrix = image_quality_matrix, $ history = k eq 0 ? history : !null) ; ====================================================================== ; for data already subtracted of dark Loading Loading @@ -327,9 +329,6 @@ pro metis_l2_prep_vl_polariz string(angles, format = '(3(f0.1, ", "), f0.1)') + $ ' deg' tb_history = [history, demod_history] pb_history = demod_history ; retrieve the stokes parameters i = reform(stokes_subdark[*, *, 0]) Loading @@ -346,23 +345,20 @@ pro metis_l2_prep_vl_polariz i = metis_flat_field(i, header, cal_pack, err_info, $ quality_matrix = quality_matrix, $ history = tb_history) history = cal_history) i = metis_vignetting(i, header, cal_pack, err_info, $ quality_matrix = quality_matrix, $ history = tb_history) history = cal_history) i = metis_rad_cal(i, header, cal_pack, err_info, $ quality_matrix = quality_matrix, $ history = tb_history, $ history = cal_history, $ /polarimetric) journal, 'Calibrating Stokes parameter Q...' q = metis_flat_field(q, header, cal_pack, err_info, $ history = pb_history) q = metis_vignetting(q, header, cal_pack, err_info, $ history = pb_history) q = metis_rad_cal(q, header, cal_pack, err_info, $ history = pb_history, /polarimetric) q = metis_flat_field(q, header, cal_pack, err_info) q = metis_vignetting(q, header, cal_pack, err_info) q = metis_rad_cal(q, header, cal_pack, err_info, /polarimetric) journal, 'Calibrating Stokes parameter U...' Loading Loading @@ -482,6 +478,8 @@ pro metis_l2_prep_vl_polariz foreach element, wcs do $ fxaddpar, primary_header, element.name, element.value, element.comment, before = 'DATATYPE' wcs_history = ['Update WCS and solar ephemeris:', ' SKD version = ' + kernel_version] ; append solar ephemeris keywords ephemeris = solo_get_ephemeris(header, cal_pack) Loading @@ -493,12 +491,10 @@ pro metis_l2_prep_vl_polariz fxaddpar, primary_header, 'COMMENT', 'Uncertainty matrix in the FITS extension is preliminary.' fxaddpar, primary_header, 'COMMENT', 'Rotate CROTA degrees counter-clockwise to have Solar North up.' history = ['Update WCS and solar ephemeris:', ' SKD version = ' + kernel_version] ; separate histories for tb and pb images tb_history = [tb_history, history] pb_history = [pb_history, history] tb_history = [history, demod_history, cal_history, wcs_history] pb_history = [demod_history, cal_history, wcs_history] ; format acquisition time in utc for the file names Loading Loading @@ -538,6 +534,7 @@ pro metis_l2_prep_vl_polariz ; add the history keyword for k = 0, n_elements(pb_history) - 1 do fxaddpar, primary_pb_header, 'HISTORY', pb_history[k] fxaddpar, primary_pb_header, 'HISTORY', 'L2 FITS file created on ' + date ; write the fits file Loading Loading @@ -628,6 +625,7 @@ pro metis_l2_prep_vl_polariz ; add the history keyword for k = 0, n_elements(tb_history) - 1 do fxaddpar, primary_tb_header, 'HISTORY', tb_history[k] fxaddpar, primary_tb_header, 'HISTORY', 'L2 FITS file created on ' + date ; write the fits file Loading Loading @@ -718,6 +716,7 @@ pro metis_l2_prep_vl_polariz ; add the history keyword for k = 0, n_elements(pb_history) - 1 do fxaddpar, primary_polangle_header, 'HISTORY', pb_history[k] fxaddpar, primary_polangle_header, 'HISTORY', 'L2 FITS file created on ' + date ; write the fits file Loading Loading @@ -810,6 +809,7 @@ pro metis_l2_prep_vl_polariz ; add the history keyword for k = 0, n_elements(tb_history) - 1 do fxaddpar, primary_stokes_header, 'HISTORY', tb_history[k] fxaddpar, primary_stokes_header, 'HISTORY', 'L2 FITS file created on ' + date ; write the fits file Loading Loading
metis_l2_prep_vl_polariz.pro +33 −33 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ pro metis_l2_prep_vl_polariz ; calibration block data = !null history = !null err_info = !null data_header = !null data_subdark = !null Loading @@ -53,29 +54,31 @@ pro metis_l2_prep_vl_polariz for k = 0, 3 do begin ; read the input image image = mrdfits(input.file_name[k], 0, primary_header, /silent) image = mrdfits(input.file_name[k], 0, header, /silent) ; fix compression header check_compression, image, primary_header check_compression, image, header ; patch to fix the lack of the keyword SEQ_NUM ; fix the lack of the keyword seq_num seq_num = fxpar(primary_header, 'SEQ_NUM', missing = 0) if seq_num eq 0 then begin obj_cnt = fxpar(primary_header, 'OBJ_CNT') n_pol = fxpar(primary_header, 'N_POL', missing = 4) if fxpar(header, 'SEQ_NUM', missing = 0) eq 0 then begin obj_cnt = fxpar(header, 'OBJ_CNT') n_pol = fxpar(header, 'N_POL', missing = 4) seq_num = ((obj_cnt - 1) / n_pol + 1) fxaddpar, primary_header, 'SEQ_NUM', seq_num, before = 'POL_ID' fxaddpar, header, 'SEQ_NUM', seq_num, before = 'POL_ID' endif if k eq 0 then comment = fxpar(primary_header, 'COMMENT') else begin sxdelpar, primary_header, 'COMMENT' foreach line, comment do $ fxaddpar, primary_header, 'COMMENT', line endelse if k eq 0 then primary_header = header ; remove comments and history from header sxdelpar, header, 'COMMENT' sxdelpar, header, 'HISTORY' ; convert string header to idl structure header = fits_hdr2struct(primary_header) header = fits_hdr2struct(header) ; ====================================================================== ; for old l1 data Loading Loading @@ -177,10 +180,9 @@ pro metis_l2_prep_vl_polariz ; apply dark correction to compute stokes i and total brightness history = !null image_subdark = metis_dark_vlda(image, header, cal_pack, err_info, $ quality_matrix = image_quality_matrix, history = history) quality_matrix = image_quality_matrix, $ history = k eq 0 ? history : !null) ; ====================================================================== ; for data already subtracted of dark Loading Loading @@ -327,9 +329,6 @@ pro metis_l2_prep_vl_polariz string(angles, format = '(3(f0.1, ", "), f0.1)') + $ ' deg' tb_history = [history, demod_history] pb_history = demod_history ; retrieve the stokes parameters i = reform(stokes_subdark[*, *, 0]) Loading @@ -346,23 +345,20 @@ pro metis_l2_prep_vl_polariz i = metis_flat_field(i, header, cal_pack, err_info, $ quality_matrix = quality_matrix, $ history = tb_history) history = cal_history) i = metis_vignetting(i, header, cal_pack, err_info, $ quality_matrix = quality_matrix, $ history = tb_history) history = cal_history) i = metis_rad_cal(i, header, cal_pack, err_info, $ quality_matrix = quality_matrix, $ history = tb_history, $ history = cal_history, $ /polarimetric) journal, 'Calibrating Stokes parameter Q...' q = metis_flat_field(q, header, cal_pack, err_info, $ history = pb_history) q = metis_vignetting(q, header, cal_pack, err_info, $ history = pb_history) q = metis_rad_cal(q, header, cal_pack, err_info, $ history = pb_history, /polarimetric) q = metis_flat_field(q, header, cal_pack, err_info) q = metis_vignetting(q, header, cal_pack, err_info) q = metis_rad_cal(q, header, cal_pack, err_info, /polarimetric) journal, 'Calibrating Stokes parameter U...' Loading Loading @@ -482,6 +478,8 @@ pro metis_l2_prep_vl_polariz foreach element, wcs do $ fxaddpar, primary_header, element.name, element.value, element.comment, before = 'DATATYPE' wcs_history = ['Update WCS and solar ephemeris:', ' SKD version = ' + kernel_version] ; append solar ephemeris keywords ephemeris = solo_get_ephemeris(header, cal_pack) Loading @@ -493,12 +491,10 @@ pro metis_l2_prep_vl_polariz fxaddpar, primary_header, 'COMMENT', 'Uncertainty matrix in the FITS extension is preliminary.' fxaddpar, primary_header, 'COMMENT', 'Rotate CROTA degrees counter-clockwise to have Solar North up.' history = ['Update WCS and solar ephemeris:', ' SKD version = ' + kernel_version] ; separate histories for tb and pb images tb_history = [tb_history, history] pb_history = [pb_history, history] tb_history = [history, demod_history, cal_history, wcs_history] pb_history = [demod_history, cal_history, wcs_history] ; format acquisition time in utc for the file names Loading Loading @@ -538,6 +534,7 @@ pro metis_l2_prep_vl_polariz ; add the history keyword for k = 0, n_elements(pb_history) - 1 do fxaddpar, primary_pb_header, 'HISTORY', pb_history[k] fxaddpar, primary_pb_header, 'HISTORY', 'L2 FITS file created on ' + date ; write the fits file Loading Loading @@ -628,6 +625,7 @@ pro metis_l2_prep_vl_polariz ; add the history keyword for k = 0, n_elements(tb_history) - 1 do fxaddpar, primary_tb_header, 'HISTORY', tb_history[k] fxaddpar, primary_tb_header, 'HISTORY', 'L2 FITS file created on ' + date ; write the fits file Loading Loading @@ -718,6 +716,7 @@ pro metis_l2_prep_vl_polariz ; add the history keyword for k = 0, n_elements(pb_history) - 1 do fxaddpar, primary_polangle_header, 'HISTORY', pb_history[k] fxaddpar, primary_polangle_header, 'HISTORY', 'L2 FITS file created on ' + date ; write the fits file Loading Loading @@ -810,6 +809,7 @@ pro metis_l2_prep_vl_polariz ; add the history keyword for k = 0, n_elements(tb_history) - 1 do fxaddpar, primary_stokes_header, 'HISTORY', tb_history[k] fxaddpar, primary_stokes_header, 'HISTORY', 'L2 FITS file created on ' + date ; write the fits file Loading