From aec75b243c42b537388206997d74105d336b4b86 Mon Sep 17 00:00:00 2001
From: Roberto Susino <roberto.susino@inaf.it>
Date: Thu, 9 Jun 2022 08:30:03 +0200
Subject: [PATCH] Improve journaling in dark-subtraction procedure

---
 metis_dark_uvda.pro | 13 +++++++------
 metis_dark_vlda.pro | 11 ++++++-----
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/metis_dark_uvda.pro b/metis_dark_uvda.pro
index 6a59e68..603828f 100644
--- a/metis_dark_uvda.pro
+++ b/metis_dark_uvda.pro
@@ -49,6 +49,13 @@ function metis_dark_uvda, data, header, cal_pack, error = error, quality_matrix
 	; WARN - temporary patch to handle local l1 fits files
 	; if tsensor eq 0. then tsensor = -25.
 
+	journal, 'Dark-current correction:'
+	journal, '  dit = ' + string(dit, format = '(I0)') + ' ms'
+	journal, '  ndit1 = ' + string(ndit1, format = '(I0)')
+	journal, '  ndit2 = ' + string(ndit2, format = '(I0)')
+	journal, '  obj_cnt = ' + string(obj_cnt, format = '(I0)')
+	journal, '  tsensor = ' + string(tsensor, format = '(F0)') + ' degC'
+
 	flag_use_extrapolated = 1
 	flag_use_notfullset = 1
 	flag_normalize_dark = 0
@@ -136,12 +143,6 @@ function metis_dark_uvda, data, header, cal_pack, error = error, quality_matrix
 	if ~ isa(history) then history = !null
 	history = [history, 'Dark-current correction: ', '  ' + dark_file]
 
-	journal, 'Dark-current correction:'
-	journal, '  dit = ' + string(dit, format = '(I0)') + ' ms'
-	journal, '  ndit1 = ' + string(ndit1, format = '(I0)')
-	journal, '  ndit2 = ' + string(ndit2, format = '(I0)')
-	journal, '  obj_cnt = ' + string(obj_cnt, format = '(I0)')
-	journal, '  tsensor = ' + string(tsensor, format = '(F0)') + ' degC'
 	journal, '  dark file = ' + dark_file
 	journal, '  extrapolated dark = ' + dark[i].extrapol.tolower()
 
diff --git a/metis_dark_vlda.pro b/metis_dark_vlda.pro
index e4b002d..fff2bd7 100644
--- a/metis_dark_vlda.pro
+++ b/metis_dark_vlda.pro
@@ -16,6 +16,12 @@ function metis_dark_vlda, data, header, cal_pack, error = error, quality_matrix
 	; WARN - temporary patch to handle local l1 fits files
 	; if tsensor eq 0. then tsensor = -30.
 
+	journal, 'Bias and dark-current correction:'
+	journal, '  dit = ' + string(dit, format = '(F0)') + ' s'
+	journal, '  ndit = ' + string(ndit, format = '(I0)')
+	journal, '  xposure = ' + string(xposure, format = '(F0)') + ' s'
+	journal, '  tsensor = ' + string(tsensor, format = '(F0)') + ' degC'
+
 	; check if one or more bias+dark matrices with same dit, binning, and tsensor exist
 	for i = 0, n_elements(bias_dark) - 1 do begin
 		if $
@@ -97,11 +103,6 @@ function metis_dark_vlda, data, header, cal_pack, error = error, quality_matrix
 	if ~ isa(history) then history = !null
 	history = [history, 'Bias and dark-current corrections: ', '  ' + dark_file]
 
-	journal, 'Bias and dark-current correction:'
-	journal, '  dit = ' + string(dit, format = '(F0)') + ' s'
-	journal, '  ndit = ' + string(ndit, format = '(I0)')
-	journal, '  xposure = ' + string(xposure, format = '(F0)') + ' s'
-	journal, '  tsensor = ' + string(tsensor, format = '(F0)') + ' degC'
 	journal, '  bias/dark file = ' + dark_file
 	return, data
 end
-- 
GitLab