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
1dc2c61e
Commit
1dc2c61e
authored
3 years ago
by
Roberto Susino
Browse files
Options
Downloads
Patches
Plain Diff
Update UVDA dark selection procedure
parent
34ce9be9
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_dark_uvda.pro
+57
-52
57 additions, 52 deletions
metis_dark_uvda.pro
with
57 additions
and
52 deletions
metis_dark_uvda.pro
+
57
−
52
View file @
1dc2c61e
function
metis_dark_uvda
,
data
,
header
,
cal_pack
,
history
=
history
function
metis_dark_uvda
,
data
,
header
,
cal_pack
,
error
=
error
,
quality_matrix
=
quality_matrix
,
history
=
history
dark
=
cal_pack
.
uv_channel
.
dark
dark
=
cal_pack
.
uv_channel
.
dark
dit
=
header
.
dit
/
1000
.
D0
dit
=
header
.
dit
nbin
=
header
.
nbin
ndit1
=
header
.
ndit1
ndit1
=
header
.
ndit1
ndit2
=
header
.
ndit2
ndit2
=
header
.
ndit2
nbin
=
sqrt
(
header
.
nbin
)
tsensor
=
header
.
tsensor
obj_cnt
=
header
.
obj_cnt
obj_cnt
=
header
.
obj_cnt
obt_beg
=
header
.
obt_beg
obt_beg
=
header
.
obt_beg
masking
=
header
.
masking
tsensor
=
header
.
tsensor
;
WARN
-
temporary
patch
to
handle
local
l1
fits
files
;
WARN
-
temporary
patch
to
handle
local
l1
fits
files
;
if
tsensor
eq
0
.
then
tsensor
=
-
25
.
if
tsensor
eq
0
.
then
tsensor
=
-
25
.
for
i
=
0
,
n_elements
(
dark
)
-
1
do
begin
if
(
dark
[
i
].
dit
eq
dit
)
and
(
dark
[
i
].
ndit1
eq
ndit1
)
and
(
dark
[
i
].
ndit2
eq
ndit2
)
and
(
abs
(
dark
[
i
].
tsensor
-
tsensor
)
lt
5
.)
and
(
abs
(
obt_beg
-
dark
[
i
].
obt_beg
)
lt
(
3600
.
*
24
.
*
10
.))
then
begin
if
obj_cnt
eq
1
then
begin
dark_file
=
dark
[
i
].
file_name
.
cnt_1
dark_image
=
float
(
readfits
(
cal_pack
.
path
+
dark_file
,
/
silent
))
dark_image
=
rebin
(
dark_image
,
header
.
naxis1
,
header
.
naxis2
)
*
nbin
^
2
mask
=
where
(
data
eq
0
.,
count
)
data
=
data
-
dark_image
*
ndit1
*
ndit2
data
[
mask
]
=
0
.
goto
,
jump
endif
else
begin
dark_file
=
dark
[
i
].
file_name
.
cnt_2
dark_image
=
float
(
readfits
(
cal_pack
.
path
+
dark_file
,
/
silent
))
dark_image
=
rebin
(
dark_image
,
header
.
naxis1
,
header
.
naxis2
)
*
nbin
^
2
mask
=
where
(
data
eq
0
.,
count
)
data
=
data
-
dark_image
*
ndit1
*
ndit2
data
[
mask
]
=
0
.
goto
,
jump
flag_use_extrapolated
=
1
endelse
flag_use_notfullset
=
1
endif
flag_normalize_dark
=
0
endfor
obt_available
=
!
null
obt_available
=
!
null
;
check
if
one
or
more
dark
matrices
with
same
dit
,
ndit1
,
ndit2
,
and
tsensor
exist
for
i
=
0
,
n_elements
(
dark
)
-
1
do
begin
for
i
=
0
,
n_elements
(
dark
)
-
1
do
begin
if
(
dark
[
i
].
dit
eq
dit
)
and
(
abs
(
dark
[
i
].
tsensor
-
tsensor
)
lt
5
.)
then
obt_available
=
[
obt_available
,
dark
[
i
].
obt_beg
]
if
$
(
dark
[
i
].
dit
eq
dit
)
and
$
(
abs
(
dark
[
i
].
tsensor
-
tsensor
)
lt
5
)
and
$
(
dark
[
i
].
ndit1
eq
ndit1
)
and
(
dark
[
i
].
ndit2
eq
ndit2
)
and
$
flag_use_notfullset
and
flag_use_extrapolated
then
$
obt_available
=
[
obt_available
,
dark
[
i
].
obt_beg
]
endfor
endfor
if
not
isa
(
obt_available
)
then
begin
;
if
not
,
exit
with
error
code
if
~
isa
(
obt_available
)
then
begin
journal
,
'Error 12: UV applicable dark file not found.'
journal
,
'Error 12: UV applicable dark file not found.'
journal
journal
exit
,
status
=
12
exit
,
status
=
12
endif
endif
;
if
yes
,
chose
the
temporally
closest
delta_obt
=
min
(
abs
(
obt_beg
-
obt_available
),
j
)
delta_obt
=
min
(
abs
(
obt_beg
-
obt_available
),
j
)
i
=
where
(
dark
.
obt_beg
eq
obt_available
[
j
])
i
=
where
(
dark
.
obt_beg
eq
obt_available
[
j
])
if
obj_cnt
eq
1
then
begin
transient
=
where
(
dark
[
i
].
filename
.
cnt_1
ne
''
,
n
)
if
(
ndit1
eq
dark
[
i
].
ndit1
)
and
(
ndit2
eq
dark
[
i
].
ndit2
)
then
begin
dark_file
=
dark
[
i
].
file_name
.
cnt_1
;
select
the
dark
matrix
corresponding
to
the
correct
transient
phase
dark_image
=
float
(
readfits
(
cal_pack
.
path
+
dark_file
,
/
silent
))
if
obj_cnt
le
n
then
$
endif
else
begin
dark_file
=
dark
[
i
].
filename
.
cnt_1
[
obj_cnt
-
1
]
else
$
q
=
ndit2
/
dark
[
i
].
ndit2
dark_file
=
dark
[
i
].
filename
.
cnt_2
dark_file
=
dark
[
i
].
file_name
.
cnt_1
+
' - '
+
dark
[
i
].
file_name
.
cnt_2
dark_1
=
float
(
readfits
(
cal_pack
.
path
+
dark
[
i
].
file_name
.
cnt_1
,
/
silent
))
;
apply
normalization
if
required
dark_2
=
float
(
readfits
(
cal_pack
.
path
+
dark
[
i
].
file_name
.
cnt_2
,
/
silent
))
if
flag_normalize_dark
and
masking
.
contains
(
'disabled'
,
/
fold
)
then
$
dark_image
=
(
dark_1
+
(
q
-
1
)
*
dark_2
)
/
q
dark_image
=
correzione_uvda
(
data
,
cal_pack
.
path
+
dark_file
)
else
$
endelse
endif
else
begin
dark_file
=
dark
[
i
].
file_name
.
cnt_2
dark_image
=
float
(
readfits
(
cal_pack
.
path
+
dark_file
,
/
silent
))
dark_image
=
float
(
readfits
(
cal_pack
.
path
+
dark_file
,
/
silent
))
endelse
dark_image
=
rebin
(
dark_image
,
header
.
naxis1
,
header
.
naxis2
)
*
nbin
^
2
dark_nobin
=
dark_image
;
rebin
the
dark
and
take
into
account
the
exposure
time
correction
of
l1
images
dark_image
=
rebin
(
dark_image
,
header
.
naxis1
,
header
.
naxis2
)
*
nbin
dark_image
=
dark_image
*
ndit1
*
ndit2
mask
=
where
(
data
eq
0
.,
count
)
mask
=
where
(
data
eq
0
.,
count
)
data
=
data
-
dark_image
*
ndit1
*
ndit2
data
=
data
-
dark_image
data
[
mask
]
=
0
.
;
set
values
in
masked
areas
equal
to
zero
if
count
gt
0
then
data
[
mask
]
=
0
.
;
read
the
dark
error
matrix
dark_error_file
=
dark
[
i
].
error
if
file_test
(
dark_error_file
)
then
$
dark_error
=
float
(
readfits
(
cal_pack
.
path
+
dark_error_file
,
/
silent
))
else
$
dark_error
=
fltarr
(
1024
,
1024
)
;
rebin
it
and
take
into
account
the
exposure
time
correction
dark_error
=
dark_image
*
sqrt
(
rebin
((
dark_error
/
dark_nobin
)
^
2
,
header
.
naxis1
,
header
.
naxis2
)
/
nbin
)
;
calculate
the
total
uncertainty
if
isa
(
error
)
then
error
+=
(
data
/
cal_pack
.
uv_channel
.
radiometry
.
iaps_gain
.
value
*
cal_pack
.
uv_channel
.
radiometry
.
f_noise
.
value
+
2
.
*
dark_error
^
2
)
/
data
^
2
jump
:
jump
:
s
=
where
(
data
le
0
.,
count
)
quality_matrix
[
s
]
=
0
if
~
isa
(
history
)
then
history
=
!
null
if
~
isa
(
history
)
then
history
=
!
null
history
=
[
history
,
'Dark-current correction: '
,
' '
+
dark_file
]
history
=
[
history
,
'Dark-current correction: '
,
' '
+
dark_file
]
journal
,
'Dark-current correction:'
journal
,
'Dark-current correction:'
journal
,
' dit = '
+
string
(
dit
,
format
=
'(
F
0)'
)
+
' s'
journal
,
' dit = '
+
string
(
dit
,
format
=
'(
I
0)'
)
+
'
m
s'
journal
,
' ndit1 = '
+
string
(
ndit1
,
format
=
'(I0)'
)
journal
,
' ndit1 = '
+
string
(
ndit1
,
format
=
'(I0)'
)
journal
,
' ndit2 = '
+
string
(
ndit2
,
format
=
'(I0)'
)
journal
,
' ndit2 = '
+
string
(
ndit2
,
format
=
'(I0)'
)
journal
,
' obj_cnt = '
+
string
(
obj_cnt
,
format
=
'(I0)'
)
journal
,
' obj_cnt = '
+
string
(
obj_cnt
,
format
=
'(I0)'
)
journal
,
' tsensor = '
+
string
(
tsensor
,
format
=
'(F0)'
)
+
' degC'
journal
,
' tsensor = '
+
string
(
tsensor
,
format
=
'(F0)'
)
+
' degC'
journal
,
' dark file = '
+
dark_file
journal
,
' dark file = '
+
dark_file
journal
,
' extrapolated dark = '
+
dark
[
i
].
extrapol
.
tolower
()
return
,
data
return
,
data
end
end
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