Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
L2 pipelines
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Metis scientific pipeline
L2 pipelines
Commits
9e472063
Commit
9e472063
authored
1 year ago
by
Roberto Susino
Browse files
Options
Downloads
Patches
Plain Diff
Improve history handling in polariz. pipeline
parent
335f72d5
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
metis_l2_prep_vl_polariz.pro
+34
-31
34 additions, 31 deletions
metis_l2_prep_vl_polariz.pro
with
34 additions
and
31 deletions
metis_l2_prep_vl_polariz.pro
+
34
−
31
View file @
9e472063
...
...
@@ -43,6 +43,7 @@ pro metis_l2_prep_vl_polariz
;
calibration
block
data
=
!
null
history
=
!
null
abs_error
=
!
null
data_header
=
!
null
data_subdark
=
!
null
...
...
@@ -52,25 +53,28 @@ 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
)
;
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
)
seq_num
=
fxpar
(
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
)
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
header
=
fits_hdr2struct
(
primary_header
)
;
clean
header
from
comments
and
history
sxdelpar
,
header
,
'COMMENT'
sxdelpar
,
header
,
'HISTORY'
;
convert
header
to
idl
structure
header
=
fits_hdr2struct
(
header
)
;
======================================================================
;
for
old
l1
data
...
...
@@ -126,9 +130,7 @@ pro metis_l2_prep_vl_polariz
;
apply
dark
correction
to
compute
stokes
i
and
total
brightness
tb_history
=
!
null
image_subdark
=
metis_dark_vlda
(
image
,
header
,
error
=
image_error
,
quality_matrix
=
image_quality_matrix
,
cal_pack
,
history
=
tb_history
)
image_subdark
=
metis_dark_vlda
(
image
,
header
,
error
=
image_error
,
quality_matrix
=
image_quality_matrix
,
cal_pack
,
history
=
k
eq
0
?
history
:
!
null
)
;
======================================================================
;
for
data
already
subtracted
of
dark
...
...
@@ -269,9 +271,6 @@ pro metis_l2_prep_vl_polariz
demod_history
=
'Demodulation performed for angles '
+
string
(
angles
,
format
=
'(3(f0.1, ", "), f0.1)'
)
+
' deg'
tb_history
=
[
tb_history
,
demod_history
]
pb_history
=
demod_history
i
=
reform
(
stokes_subdark
[
*,
*,
0
])
i_abs_error
=
reform
(
stokes_abs_error
[
*,
*,
0
])
q
=
reform
(
stokes
[
*,
*,
1
])
...
...
@@ -281,13 +280,15 @@ pro metis_l2_prep_vl_polariz
;
compute
the
tb
from
the
dark
-
subtracted
stokes
i
and
apply
other
calibrations
cal_history
=
!
null
journal
,
'Calibrating total brightness...'
tb_image
=
i
tb_error
=
(
i_abs_error
/
i
)
^
2
tb_image
=
metis_flat_field
(
tb_image
,
header
,
error
=
tb_error
,
quality_matrix
=
quality_matrix
,
cal_pack
,
history
=
tb
_history
)
tb_image
=
metis_vignetting
(
tb_image
,
header
,
error
=
tb_error
,
quality_matrix
=
quality_matrix
,
cal_pack
,
history
=
tb
_history
)
tb_image
=
metis_rad_cal
(
tb_image
,
header
,
error
=
tb_error
,
quality_matrix
=
quality_matrix
,
cal_pack
,
history
=
tb
_history
,
/
polarimetric
)
tb_image
=
metis_flat_field
(
tb_image
,
header
,
error
=
tb_error
,
quality_matrix
=
quality_matrix
,
cal_pack
,
history
=
cal
_history
)
tb_image
=
metis_vignetting
(
tb_image
,
header
,
error
=
tb_error
,
quality_matrix
=
quality_matrix
,
cal_pack
,
history
=
cal
_history
)
tb_image
=
metis_rad_cal
(
tb_image
,
header
,
error
=
tb_error
,
quality_matrix
=
quality_matrix
,
cal_pack
,
history
=
cal
_history
,
/
polarimetric
)
;
compute
the
pb
from
the
stokes
q
and
u
and
apply
other
calibrations
...
...
@@ -295,9 +296,9 @@ pro metis_l2_prep_vl_polariz
pb_image
=
sqrt
(
q
^
2
+
u
^
2
)
pb_error
=
(
q
^
2
*
q_abs_error
^
2
+
u
^
2
*
u_abs_error
^
2
)
/
pb_image
^
4
pb_image
=
metis_flat_field
(
pb_image
,
header
,
error
=
pb_error
,
cal_pack
,
history
=
pb_history
)
pb_image
=
metis_vignetting
(
pb_image
,
header
,
error
=
pb_error
,
cal_pack
,
history
=
pb_history
)
pb_image
=
metis_rad_cal
(
pb_image
,
header
,
error
=
pb_error
,
cal_pack
,
history
=
pb_history
,
/
polarimetric
)
pb_image
=
metis_flat_field
(
pb_image
,
header
,
error
=
pb_error
,
cal_pack
)
pb_image
=
metis_vignetting
(
pb_image
,
header
,
error
=
pb_error
,
cal_pack
)
pb_image
=
metis_rad_cal
(
pb_image
,
header
,
error
=
pb_error
,
cal_pack
,
/
polarimetric
)
;
==========================================================================
;
for
simple
radiometric
calibration
...
...
@@ -372,21 +373,18 @@ pro metis_l2_prep_vl_polariz
wcs
=
metis_wcs
(
header
,
cal_pack
,
ref_detector
=
ref_detector
)
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
)
foreach
element
,
ephemeris
do
fxaddpar
,
primary_header
,
element
.
name
,
element
.
value
,
element
.
comment
,
before
=
'DATATYPE'
;
update
the
comment
and
history
keyword
s
;
update
the
comment
keyword
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
]
tb_history
=
[
tb_history
,
history
]
pb_history
=
[
pb_history
,
history
]
;
delete
useless
keywords
sxdelpar
,
primary_header
,
'BLANK'
...
...
@@ -443,7 +441,9 @@ pro metis_l2_prep_vl_polariz
;
add
the
history
keyword
pb_history
=
[
demod_history
,
cal_history
,
wcs_history
]
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
...
...
@@ -532,8 +532,9 @@ pro metis_l2_prep_vl_polariz
fxaddpar
,
primary_tb_header
,
'DATAMAX'
,
max
(
tb_image
,
/
nan
)
;
add
the
history
keyword
tb_history
=
[
history
,
demod_history
,
cal_history
,
wcs_history
]
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
...
...
@@ -624,6 +625,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
...
...
@@ -734,6 +736,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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment