[cpl-plugin-kmos] 05/06: New upstream version 1.2.6
Ole Streicher
olebole-guest at moszumanska.debian.org
Wed Nov 27 15:29:15 UTC 2013
This is an automated email from the git hooks/post-receive script.
olebole-guest pushed a commit to branch debian
in repository cpl-plugin-kmos.
commit 763f2a2d5fd64f55843fb79f6518c06989466f78
Author: Ole Streicher <debian at liska.ath.cx>
Date: Wed Nov 27 16:18:34 2013 +0100
New upstream version 1.2.6
---
ChangeLog | 1 +
Makefile.purify.in | 2 +-
acinclude.m4 | 2 +-
calib/dic/ESO-DFS-DIC.KMOS_QC | 6 +-
calib/dic/ESO-VLT-DIC.KMOS_DCS | 4 +-
calib/dic/ESO-VLT-DIC.KMOS_ICS | 4 +-
calib/dic/ESO-VLT-DIC.KMOS_OS | 4 +-
calib/dic/ESO-VLT-DIC.KMOS_TPL | 4 +-
calib/dic/ESO-VLT-DIC.NGCCON | 2 +-
calib/dic/ESO-VLT-DIC.NGCDCS | 4 +-
calib/gasgano/config/KMOS.prefs | 2 +-
configure | 22 +-
configure.ac | 2 +-
...l => dir_cf7033f5228c85e1a96cc09a6a6f109b.html} | 9 +-
html/dirs.html | 6 +-
html/files.html | 5 +-
html/group__kmo__arithmetic.html | 4 +-
html/group__kmo__combine.html | 4 +-
html/group__kmo__copy.html | 4 +-
html/group__kmo__dark.html | 4 +-
html/group__kmo__dev__setup.html | 4 +-
html/group__kmo__extract__spec.html | 4 +-
html/group__kmo__fit__profile.html | 4 +-
html/group__kmo__fits__check.html | 4 +-
html/group__kmo__fits__stack.html | 4 +-
html/group__kmo__fits__strip.html | 4 +-
html/group__kmo__flat.html | 4 +-
html/group__kmo__illumination.html | 6 +-
...ct.html => group__kmo__illumination__flat.html} | 14 +-
html/group__kmo__make__image.html | 4 +-
html/group__kmo__multi__reconstruct.html | 11 +-
html/group__kmo__noise__map.html | 4 +-
html/group__kmo__reconstruct.html | 4 +-
html/group__kmo__rotate.html | 4 +-
html/group__kmo__sci__red.html | 6 +-
html/group__kmo__shift.html | 4 +-
html/group__kmo__sky__mask.html | 4 +-
html/group__kmo__sky__tweak.html | 6 +-
html/group__kmo__stats.html | 4 +-
html/group__kmo__std__star.html | 4 +-
html/group__kmo__wave__cal.html | 4 +-
html/index.html | 4 +-
html/kmo__arithmetic_8c_source.html | 1249 +++---
html/kmo__combine_8c_source.html | 12 +-
html/kmo__copy_8c_source.html | 12 +-
html/kmo__dark_8c_source.html | 12 +-
html/kmo__dev__setup_8c_source.html | 12 +-
html/kmo__extract__spec_8c_source.html | 12 +-
html/kmo__fit__profile_8c_source.html | 12 +-
html/kmo__fits__check_8c_source.html | 12 +-
html/kmo__fits__stack_8c_source.html | 12 +-
html/kmo__fits__strip_8c_source.html | 175 +-
html/kmo__flat_8c_source.html | 629 +--
html/kmo__illumination_8c_source.html | 3392 +++++++--------
html/kmo__illumination__flat_8c_source.html | 1358 ++++++
html/kmo__make__image_8c_source.html | 12 +-
html/kmo__multi__reconstruct_8c_source.html | 2583 +++++++-----
html/kmo__noise__map_8c_source.html | 12 +-
html/kmo__reconstruct_8c_source.html | 1713 ++++----
html/kmo__rotate_8c_source.html | 12 +-
html/kmo__sci__red_8c_source.html | 4399 ++++++++++----------
html/kmo__shift_8c_source.html | 12 +-
html/kmo__sky__mask_8c_source.html | 12 +-
html/kmo__sky__tweak_8c_source.html | 538 +--
html/kmo__stats_8c_source.html | 12 +-
html/kmo__std__star_8c_source.html | 2162 +++++-----
html/kmo__wave__cal_8c_source.html | 311 +-
html/modules.html | 7 +-
html/yves__kmo__flat_8c_source.html | 12 +-
irplib/irplib_calib.c | 6 +-
irplib/irplib_calib.h | 6 +-
irplib/irplib_cat.c | 6 +-
irplib/irplib_cat.h | 6 +-
irplib/irplib_distortion.c | 6 +-
irplib/irplib_distortion.h | 6 +-
irplib/irplib_flat.c | 6 +-
irplib/irplib_flat.h | 6 +-
irplib/irplib_framelist.c | 6 +-
irplib/irplib_framelist.h | 6 +-
irplib/irplib_hist.c | 6 +-
irplib/irplib_hist.h | 6 +-
irplib/irplib_ksigma_clip.c | 6 +-
irplib/irplib_ksigma_clip.h | 6 +-
irplib/irplib_ksigma_clip_body.h | 6 +-
irplib/irplib_match_cats.c | 6 +-
irplib/irplib_match_cats.h | 6 +-
irplib/irplib_mkmaster.c | 6 +-
irplib/irplib_mkmaster.h | 6 +-
irplib/irplib_oddeven.c | 6 +-
irplib/irplib_oddeven.h | 6 +-
irplib/irplib_plugin.c | 15 +-
irplib/irplib_plugin.h | 6 +-
irplib/irplib_polynomial.c | 6 +-
irplib/irplib_polynomial.h | 6 +-
irplib/irplib_ppm.c | 6 +-
irplib/irplib_ppm.h | 6 +-
irplib/irplib_slitpos.c | 6 +-
irplib/irplib_slitpos.h | 6 +-
irplib/irplib_spectrum.c | 6 +-
irplib/irplib_spectrum.h | 6 +-
irplib/irplib_stdstar.c | 6 +-
irplib/irplib_stdstar.h | 6 +-
irplib/irplib_strehl.c | 6 +-
irplib/irplib_strehl.h | 6 +-
irplib/irplib_utils.c | 6 +-
irplib/irplib_utils.h | 14 +-
irplib/irplib_wavecal.c | 6 +-
irplib/irplib_wavecal.h | 6 +-
irplib/irplib_wavecal_impl.h | 6 +-
irplib/irplib_wcs.c | 6 +-
irplib/irplib_wcs.h | 6 +-
irplib/irplib_wlxcorr.c | 6 +-
irplib/irplib_wlxcorr.h | 6 +-
irplib/tests/irplib_cat-test.c | 6 +-
irplib/tests/irplib_polynomial-test.c | 6 +-
irplib/tests/irplib_wcs-test.c | 6 +-
irplib/tests/irplib_wlxcorr-test.c | 6 +-
kmclipm/include/kmclipm_compatibility_cpl.h | 2 +-
kmclipm/include/kmclipm_constants.h | 6 +-
kmclipm/include/kmclipm_functions.h | 7 +-
kmclipm/include/kmclipm_math.h | 2 +-
kmclipm/include/kmclipm_priv_constants.h | 2 +-
kmclipm/include/kmclipm_priv_error.h | 2 +-
kmclipm/include/kmclipm_priv_functions.h | 2 +-
kmclipm/include/kmclipm_priv_reconstruct.h | 15 +-
kmclipm/include/kmclipm_priv_splines.h | 2 +-
kmclipm/include/kmclipm_vector.h | 2 +-
kmclipm/src/kmclipm_functions.c | 196 +-
kmclipm/src/kmclipm_math.c | 2 +-
kmclipm/src/kmclipm_priv_constants.c | 2 +-
kmclipm/src/kmclipm_priv_error.c | 2 +-
kmclipm/src/kmclipm_priv_functions.c | 2 +-
kmclipm/src/kmclipm_priv_reconstruct.c | 401 +-
kmclipm/src/kmclipm_priv_splines.c | 91 +-
kmclipm/src/kmclipm_vector.c | 2 +-
kmos/kmo_constants.h | 10 +-
kmos/kmo_cpl_extensions.c | 6 +-
kmos/kmo_cpl_extensions.h | 6 +-
kmos/kmo_debug.c | 6 +-
kmos/kmo_debug.h | 6 +-
kmos/kmo_dfs.c | 209 +-
kmos/kmo_dfs.h | 24 +-
kmos/kmo_error.h | 6 +-
kmos/kmo_functions.c | 427 +-
kmos/kmo_functions.h | 77 +-
kmos/kmo_priv_arithmetic.c | 6 +-
kmos/kmo_priv_arithmetic.h | 6 +-
kmos/kmo_priv_combine.c | 174 +-
kmos/kmo_priv_combine.h | 6 +-
kmos/kmo_priv_copy.c | 6 +-
kmos/kmo_priv_copy.h | 6 +-
kmos/kmo_priv_dark.c | 6 +-
kmos/kmo_priv_dark.h | 6 +-
kmos/kmo_priv_extract_spec.c | 6 +-
kmos/kmo_priv_extract_spec.h | 6 +-
kmos/kmo_priv_fit_profile.c | 6 +-
kmos/kmo_priv_fit_profile.h | 6 +-
kmos/kmo_priv_fits_check.c | 6 +-
kmos/kmo_priv_fits_check.h | 6 +-
kmos/kmo_priv_fits_stack.c | 6 +-
kmos/kmo_priv_fits_stack.h | 6 +-
kmos/kmo_priv_flat.c | 1835 ++++----
kmos/kmo_priv_flat.h | 65 +-
kmos/kmo_priv_functions.c | 113 +-
kmos/kmo_priv_functions.h | 13 +-
kmos/kmo_priv_lcorr.c | 10 +-
kmos/kmo_priv_lcorr.h | 10 +-
kmos/kmo_priv_make_image.c | 6 +-
kmos/kmo_priv_make_image.h | 6 +-
kmos/kmo_priv_multi_reconstruct.c | 1627 +++++---
kmos/kmo_priv_multi_reconstruct.h | 109 +-
kmos/kmo_priv_noise_map.c | 6 +-
kmos/kmo_priv_noise_map.h | 6 +-
kmos/kmo_priv_reconstruct.c | 27 +-
kmos/kmo_priv_reconstruct.h | 6 +-
kmos/kmo_priv_rotate.c | 6 +-
kmos/kmo_priv_rotate.h | 6 +-
kmos/kmo_priv_shift.c | 6 +-
kmos/kmo_priv_shift.h | 6 +-
kmos/kmo_priv_sky_mask.c | 6 +-
kmos/kmo_priv_sky_mask.h | 6 +-
kmos/kmo_priv_sky_tweak.c | 48 +-
kmos/kmo_priv_sky_tweak.h | 50 +-
kmos/kmo_priv_stats.c | 6 +-
kmos/kmo_priv_stats.h | 6 +-
kmos/kmo_priv_std_star.c | 6 +-
kmos/kmo_priv_std_star.h | 6 +-
kmos/kmo_priv_wave_cal.c | 17 +-
kmos/kmo_priv_wave_cal.h | 6 +-
kmos/kmo_test_create_data.c | 6 +-
kmos/kmo_test_create_data.h | 6 +-
kmos/kmo_utils.c | 20 +-
kmos/kmo_utils.h | 6 +-
kmos/tests/kmo_cpl_extensions-test.c | 10 +-
kmos/tests/kmo_debug-test.c | 10 +-
kmos/tests/kmo_dfs-test.c | 10 +-
kmos/tests/kmo_functions-test.c | 10 +-
kmos/tests/kmo_priv_arithmetic-test.c | 10 +-
kmos/tests/kmo_priv_combine-test.c | 10 +-
kmos/tests/kmo_priv_copy-test.c | 10 +-
kmos/tests/kmo_priv_dark-test.c | 10 +-
kmos/tests/kmo_priv_extract_spec-test.c | 10 +-
kmos/tests/kmo_priv_fit_profile-test.c | 10 +-
kmos/tests/kmo_priv_fits_check-test.c | 10 +-
kmos/tests/kmo_priv_fits_stack-test.c | 10 +-
kmos/tests/kmo_priv_flat-test.c | 4120 ++++++++----------
kmos/tests/kmo_priv_functions-test.c | 10 +-
kmos/tests/kmo_priv_lcorr-test.c | 6 +-
kmos/tests/kmo_priv_make_image-test.c | 10 +-
kmos/tests/kmo_priv_noise_map-test.c | 10 +-
kmos/tests/kmo_priv_reconstruct-test.c | 10 +-
kmos/tests/kmo_priv_rotate-test.c | 10 +-
kmos/tests/kmo_priv_shift-test.c | 10 +-
kmos/tests/kmo_priv_sky_mask-test.c | 10 +-
kmos/tests/kmo_priv_sky_tweak-test.c | 19 +-
kmos/tests/kmo_priv_stats-test.c | 10 +-
kmos/tests/kmo_priv_std_star-test.c | 10 +-
kmos/tests/kmo_priv_wave_cal-test.c | 10 +-
kmos/tests/kmo_utils-test.c | 10 +-
recipes/Makefile.am | 6 +
recipes/Makefile.in | 16 +
recipes/kmo_arithmetic.c | 15 +-
recipes/kmo_combine.c | 6 +-
recipes/kmo_copy.c | 6 +-
recipes/kmo_dark.c | 6 +-
recipes/kmo_dev_setup.c | 6 +-
recipes/kmo_extract_spec.c | 6 +-
recipes/kmo_fit_profile.c | 6 +-
recipes/kmo_fits_check.c | 6 +-
recipes/kmo_fits_stack.c | 6 +-
recipes/kmo_fits_strip.c | 3 +-
recipes/kmo_flat.c | 57 +-
recipes/kmo_illumination.c | 166 +-
...{kmo_illumination.c => kmo_illumination_flat.c} | 1161 ++----
recipes/kmo_make_image.c | 6 +-
recipes/kmo_multi_reconstruct.c | 1606 ++++---
recipes/kmo_noise_map.c | 6 +-
recipes/kmo_reconstruct.c | 57 +-
recipes/kmo_rotate.c | 6 +-
recipes/kmo_sci_red.c | 571 +--
recipes/kmo_shift.c | 6 +-
recipes/kmo_sky_mask.c | 6 +-
recipes/kmo_sky_tweak.c | 38 +-
recipes/kmo_stats.c | 6 +-
recipes/kmo_std_star.c | 20 +-
recipes/kmo_wave_cal.c | 25 +-
recipes/tests/Makefile.am | 5 +
recipes/tests/Makefile.in | 22 +-
recipes/tests/kmo_arithmetic-test.c | 10 +-
recipes/tests/kmo_combine-test.c | 10 +-
recipes/tests/kmo_copy-test.c | 10 +-
recipes/tests/kmo_dark-test.c | 10 +-
recipes/tests/kmo_dev_setup-test.c | 10 +-
recipes/tests/kmo_extract_spec-test.c | 10 +-
recipes/tests/kmo_fit_profile-test.c | 10 +-
recipes/tests/kmo_fits_check-test.c | 10 +-
recipes/tests/kmo_fits_stack-test.c | 10 +-
recipes/tests/kmo_fits_strip-test.c | 12 +-
recipes/tests/kmo_flat-test.c | 10 +-
recipes/tests/kmo_illumination-test.c | 10 +-
...ination-test.c => kmo_illumination_flat-test.c} | 48 +-
recipes/tests/kmo_make_image-test.c | 10 +-
recipes/tests/kmo_multi_reconstruct-test.c | 17 +-
recipes/tests/kmo_noise_map-test.c | 10 +-
recipes/tests/kmo_reconstruct-test.c | 10 +-
recipes/tests/kmo_rotate-test.c | 10 +-
recipes/tests/kmo_sci_red-test.c | 22 +-
recipes/tests/kmo_shift-test.c | 10 +-
recipes/tests/kmo_sky_mask-test.c | 10 +-
recipes/tests/kmo_stats-test.c | 10 +-
recipes/tests/kmo_std_star-test.c | 16 +-
recipes/tests/kmo_wave_cal-test.c | 10 +-
recipes/tests/leak_check-test.c | 10 +-
reflex/kmo_wave_cal.py | 19 +-
reflex/kmos.xml.in | 3928 +++++++++--------
regtests/tests/Makefile.am | 2 +-
regtests/tests/Makefile.in | 2 +-
setup | 4 +-
tools/easySPARK/Makefile | 46 +-
tools/easySPARK/Makefile.am | 2 +
tools/easySPARK/Makefile.in | 2 +
tools/easySPARK/easySPARK_calibration.sh | 353 +-
tools/easySPARK/easySPARK_dark.sh | 60 +-
tools/easySPARK/easySPARK_flat.sh | 45 +-
tools/easySPARK/easySPARK_illumination.sh | 46 +-
tools/easySPARK/easySPARK_multi_reconstruct.sh | 57 +-
tools/easySPARK/easySPARK_reconstruct.sh | 46 +-
tools/easySPARK/easySPARK_sci_red.sh | 46 +-
tools/easySPARK/easySPARK_std_star.sh | 46 +-
tools/easySPARK/easySPARK_test.sh | 457 ++
tools/easySPARK/easySPARK_wave_cal.sh | 51 +-
291 files changed, 20825 insertions(+), 17975 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5e00ace..014608c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
------------------------------------------------------------------
Releases
------------------------------------------------------------------
+v1.2.5 2013.10.14 - Several bug fixes, new kmo_multi_reconstruct, easySPARK_calibration.sh
v1.2.4 2013.08.07 - Bug fix for installation on MacOSX
v1.2.3 2013.08.02 - Bug fixes for SV1 data
v1.2.2 2013.06.29 - Bug fixes in reconstruction and kmo_std_star
diff --git a/Makefile.purify.in b/Makefile.purify.in
index a8cf6a3..14f1594 100644
--- a/Makefile.purify.in
+++ b/Makefile.purify.in
@@ -1,7 +1,7 @@
#*******************************************************************************
# E.S.O. - VLT project
#
-# "@(#) $Id: Makefile.purify.in,v 1.1 2013/03/01 08:31:14 yjung Exp $"
+# "@(#) $Id: Makefile.purify.in,v 1.1 2013-03-01 08:31:14 yjung Exp $"
#
# Makefile of Pipeline subsystem.
#
diff --git a/acinclude.m4 b/acinclude.m4
index 57d2387..0259235 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -143,7 +143,7 @@ AC_DEFUN([KMOS_CREATE_SYMBOLS],
# Symbols for package include file and library search paths
- KMOS_INCLUDES='-I$(top_srcdir)/kmos -I$(top_srcdir)/irplib'
+ KMOS_INCLUDES='-I$(top_srcdir)/kmos -I$(top_srcdir)/irplib -I$(top_srcdir)/kmclipm'
KMOS_LDFLAGS='-L$(top_builddir)/kmos'
all_includes='$(KMOS_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES) $(XXCLIPM_INCLUDES)'
diff --git a/calib/dic/ESO-DFS-DIC.KMOS_QC b/calib/dic/ESO-DFS-DIC.KMOS_QC
index 6bf5e36..d6ceab5 100644
--- a/calib/dic/ESO-DFS-DIC.KMOS_QC
+++ b/calib/dic/ESO-DFS-DIC.KMOS_QC
@@ -1,9 +1,9 @@
#******************************************************************************
# E.S.O. - VLT project
#
-# $Id: ESO-DFS-DIC.KMOS_QC,v 1.2 2012/03/23 13:51:07 aagudo Exp $
+# $Id: ESO-DFS-DIC.KMOS_QC,v 1.2 2012-03-23 13:51:07 aagudo Exp $
# $Author: aagudo $
-# $Date: 2012/03/23 13:51:07 $
+# $Date: 2012-03-23 13:51:07 $
# $Revision: 1.2 $
#
#******************************************************************************
@@ -14,7 +14,7 @@
Dictionary Name: ESO-DFS-DIC.KMOS_QC
Scope: QC
Source: ESO DFS/DMD
-Version Control: "$Id: ESO-DFS-DIC.KMOS_QC,v 1.2 2012/03/23 13:51:07 aagudo Exp $"
+Version Control: "$Id: ESO-DFS-DIC.KMOS_QC,v 1.2 2012-03-23 13:51:07 aagudo Exp $"
Revision: 1.0
Date: 2012-01-10
Status: submitted
diff --git a/calib/dic/ESO-VLT-DIC.KMOS_DCS b/calib/dic/ESO-VLT-DIC.KMOS_DCS
index c97fc45..f1fae0a 100644
--- a/calib/dic/ESO-VLT-DIC.KMOS_DCS
+++ b/calib/dic/ESO-VLT-DIC.KMOS_DCS
@@ -1,7 +1,7 @@
#******************************************************************************
# E.S.O. - VLT project
#
-# "@(#) $Id: ESO-VLT-DIC.KMOS_DCS,v 1.1.1.1 2012/01/18 10:14:06 yjung Exp $"
+# "@(#) $Id: ESO-VLT-DIC.KMOS_DCS,v 1.1.1.1 2012-01-18 10:14:06 yjung Exp $"
#
# CRIRES_DCS dictionary
#
@@ -27,7 +27,7 @@
Dictionary Name: ESO-VLT-DIC.KMOS_DCS
Scope: KMOS
Source: ESO VLT
-Version Control: @(#) $Id: ESO-VLT-DIC.KMOS_DCS,v 1.1.1.1 2012/01/18 10:14:06 yjung Exp $
+Version Control: @(#) $Id: ESO-VLT-DIC.KMOS_DCS,v 1.1.1.1 2012-01-18 10:14:06 yjung Exp $
Revision: $Revision: 1.1.1.1 $
Date: 2012-01-10
Status: Development
diff --git a/calib/dic/ESO-VLT-DIC.KMOS_ICS b/calib/dic/ESO-VLT-DIC.KMOS_ICS
index 5d6c30d..9163f1a 100644
--- a/calib/dic/ESO-VLT-DIC.KMOS_ICS
+++ b/calib/dic/ESO-VLT-DIC.KMOS_ICS
@@ -1,7 +1,7 @@
#******************************************************************************
# E.S.O. - VLT project
#
-# "@(#) $Id: ESO-VLT-DIC.KMOS_ICS,v 1.2 2012/01/31 13:46:39 yjung Exp $"
+# "@(#) $Id: ESO-VLT-DIC.KMOS_ICS,v 1.2 2012-01-31 13:46:39 yjung Exp $"
#
# KMOS_ICS/ICB_CFG dictionaries
#
@@ -60,7 +60,7 @@
Dictionary Name: ESO-VLT-DIC.KMOS_ICS
Scope: KMOS
Source: ESO VLT
-Version Control: @(#) $Id: ESO-VLT-DIC.KMOS_ICS,v 1.2 2012/01/31 13:46:39 yjung Exp $
+Version Control: @(#) $Id: ESO-VLT-DIC.KMOS_ICS,v 1.2 2012-01-31 13:46:39 yjung Exp $
Revision: $Revision: 1.2 $
Date: 2012-01-25
Status: Development
diff --git a/calib/dic/ESO-VLT-DIC.KMOS_OS b/calib/dic/ESO-VLT-DIC.KMOS_OS
index e18ca86..ff408fd 100644
--- a/calib/dic/ESO-VLT-DIC.KMOS_OS
+++ b/calib/dic/ESO-VLT-DIC.KMOS_OS
@@ -1,7 +1,7 @@
#******************************************************************************
# E.S.O. - VLT project
#
-# "@(#) $Id: ESO-VLT-DIC.KMOS_OS,v 1.2 2012/01/31 13:46:39 yjung Exp $"
+# "@(#) $Id: ESO-VLT-DIC.KMOS_OS,v 1.2 2012-01-31 13:46:39 yjung Exp $"
#
# KMOS_OS dictionary
#
@@ -44,7 +44,7 @@
Dictionary Name: ESO-VLT-DIC.KMOS_OS
Scope: KMOS
Source: ESO VLT
-Version Control: @(#) $Id: ESO-VLT-DIC.KMOS_OS,v 1.2 2012/01/31 13:46:39 yjung Exp $
+Version Control: @(#) $Id: ESO-VLT-DIC.KMOS_OS,v 1.2 2012-01-31 13:46:39 yjung Exp $
Revision: $Revision: 1.2 $
Date: 2012-01-25
Status: Development
diff --git a/calib/dic/ESO-VLT-DIC.KMOS_TPL b/calib/dic/ESO-VLT-DIC.KMOS_TPL
index 34c6cb7..61a5841 100644
--- a/calib/dic/ESO-VLT-DIC.KMOS_TPL
+++ b/calib/dic/ESO-VLT-DIC.KMOS_TPL
@@ -1,7 +1,7 @@
#*******************************************************************
# E.S.O. - VLT project
#
-# "@(#) $Id: ESO-VLT-DIC.KMOS_TPL,v 1.1.1.1 2012/01/18 10:14:06 yjung Exp $"
+# "@(#) $Id: ESO-VLT-DIC.KMOS_TPL,v 1.1.1.1 2012-01-18 10:14:06 yjung Exp $"
#
# who when what
# -------- -------- ----------------------------------------------
@@ -26,7 +26,7 @@
Dictionary Name: ESO-VLT-DIC.KMOS_TPL
Scope: KMOS
Source: ESO VLT
-Version Control: @(#) $Id: ESO-VLT-DIC.KMOS_TPL,v 1.1.1.1 2012/01/18 10:14:06 yjung Exp $
+Version Control: @(#) $Id: ESO-VLT-DIC.KMOS_TPL,v 1.1.1.1 2012-01-18 10:14:06 yjung Exp $
Revision: $Revision: 1.1.1.1 $
Date: 2012-01-10
Status: Development
diff --git a/calib/dic/ESO-VLT-DIC.NGCCON b/calib/dic/ESO-VLT-DIC.NGCCON
index b0c062b..ac6fbb4 100644
--- a/calib/dic/ESO-VLT-DIC.NGCCON
+++ b/calib/dic/ESO-VLT-DIC.NGCCON
@@ -1,7 +1,7 @@
Dictionary Name: ESO-VLT-DIC.NGCCON
Scope: ESO NGC DCS
Source: jstegmei at eso.org
-Version Control: "@(#) $Id: ESO-VLT-DIC.NGCCON,v 1.1 2012/01/31 13:46:39 yjung Exp $"
+Version Control: "@(#) $Id: ESO-VLT-DIC.NGCCON,v 1.1 2012-01-31 13:46:39 yjung Exp $"
Revision: 2.51
Date: 2010-09-24
Status: draft
diff --git a/calib/dic/ESO-VLT-DIC.NGCDCS b/calib/dic/ESO-VLT-DIC.NGCDCS
index caf9c02..c62286a 100644
--- a/calib/dic/ESO-VLT-DIC.NGCDCS
+++ b/calib/dic/ESO-VLT-DIC.NGCDCS
@@ -1,7 +1,7 @@
#******************************************************************************
# E.S.O. - VLT project
#
-# "@(#) $Id: ESO-VLT-DIC.NGCDCS,v 1.1 2012/01/31 13:46:39 yjung Exp $"
+# "@(#) $Id: ESO-VLT-DIC.NGCDCS,v 1.1 2012-01-31 13:46:39 yjung Exp $"
#
# who when what
# -------- -------- ----------------------------------------------
@@ -17,7 +17,7 @@
Dictionary Name: ESO-VLT-DIC.NGCDCS
Scope: GENERIC
Source: ESO INS
-Version Control: "@(#) $Id: ESO-VLT-DIC.NGCDCS,v 1.1 2012/01/31 13:46:39 yjung Exp $"
+Version Control: "@(#) $Id: ESO-VLT-DIC.NGCDCS,v 1.1 2012-01-31 13:46:39 yjung Exp $"
Revision: 2.51
Date: 2010-09-24
Status: draft
diff --git a/calib/gasgano/config/KMOS.prefs b/calib/gasgano/config/KMOS.prefs
index 990bbcc..0047fa7 100644
--- a/calib/gasgano/config/KMOS.prefs
+++ b/calib/gasgano/config/KMOS.prefs
@@ -41,7 +41,7 @@ PRINTER_NAME=lp
PRINT_FONT=Monospaced:16
PRINT_ORIENTATION=P
RADEC_CONVERSION=true
-RECIPE_SET=kmo_arithmetic=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.4/kmo_arithmetic.so;kmo_combine=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.4/kmo_combine.so;kmo_copy=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.4/kmo_copy.so;kmo_dark=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.4/kmo_dark.so;kmo_extract_spec=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.4/kmo_extract_spec.so;kmo_fit_profile=/home/quality/pipelin [...]
+RECIPE_SET=kmo_arithmetic=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.6/kmo_arithmetic.so;kmo_combine=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.6/kmo_combine.so;kmo_copy=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.6/kmo_copy.so;kmo_dark=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.6/kmo_dark.so;kmo_extract_spec=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.6/kmo_extract_spec.so;kmo_fit_profile=/home/quality/pipelin [...]
SCRIPTS_DIR=gasgano/scripts
SHORTEN_FILES_PATH=true
SHORT_FILENAME=true
diff --git a/configure b/configure
index 5725901..bab39f7 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for KMOS Instrument Pipeline 1.2.4.
+# Generated by GNU Autoconf 2.68 for KMOS Instrument Pipeline 1.2.6.
#
# Report bugs to <kmos-spark at mpe.mpg.de>.
#
@@ -570,8 +570,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='KMOS Instrument Pipeline'
PACKAGE_TARNAME='kmos'
-PACKAGE_VERSION='1.2.4'
-PACKAGE_STRING='KMOS Instrument Pipeline 1.2.4'
+PACKAGE_VERSION='1.2.6'
+PACKAGE_STRING='KMOS Instrument Pipeline 1.2.6'
PACKAGE_BUGREPORT='kmos-spark at mpe.mpg.de'
PACKAGE_URL=''
@@ -1351,7 +1351,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures KMOS Instrument Pipeline 1.2.4 to adapt to many kinds of systems.
+\`configure' configures KMOS Instrument Pipeline 1.2.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1422,7 +1422,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of KMOS Instrument Pipeline 1.2.4:";;
+ short | recursive ) echo "Configuration of KMOS Instrument Pipeline 1.2.6:";;
esac
cat <<\_ACEOF
@@ -1543,7 +1543,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-KMOS Instrument Pipeline configure 1.2.4
+KMOS Instrument Pipeline configure 1.2.6
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1958,7 +1958,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by KMOS Instrument Pipeline $as_me 1.2.4, which was
+It was created by KMOS Instrument Pipeline $as_me 1.2.6, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2888,7 +2888,7 @@ fi
# Define the identity of the package.
PACKAGE='kmos'
- VERSION='1.2.4'
+ VERSION='1.2.6'
cat >>confdefs.h <<_ACEOF
@@ -13561,7 +13561,7 @@ $as_echo "no" >&6; }
# Symbols for package include file and library search paths
- KMOS_INCLUDES='-I$(top_srcdir)/kmos -I$(top_srcdir)/irplib'
+ KMOS_INCLUDES='-I$(top_srcdir)/kmos -I$(top_srcdir)/irplib -I$(top_srcdir)/kmclipm'
KMOS_LDFLAGS='-L$(top_builddir)/kmos'
all_includes='$(KMOS_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES) $(XXCLIPM_INCLUDES)'
@@ -14159,7 +14159,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by KMOS Instrument Pipeline $as_me 1.2.4, which was
+This file was extended by KMOS Instrument Pipeline $as_me 1.2.6, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14225,7 +14225,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-KMOS Instrument Pipeline config.status 1.2.4
+KMOS Instrument Pipeline config.status 1.2.6
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index a364d75..b01e2ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
-AC_INIT([KMOS Instrument Pipeline], [1.2.4], [kmos-spark at mpe.mpg.de],
+AC_INIT([KMOS Instrument Pipeline], [1.2.6], [kmos-spark at mpe.mpg.de],
[kmos])
AC_PREREQ([2.59])
diff --git a/html/dir_a86dc504884ba10769fa325b50ed7308.html b/html/dir_cf7033f5228c85e1a96cc09a6a6f109b.html
similarity index 91%
rename from html/dir_a86dc504884ba10769fa325b50ed7308.html
rename to html/dir_cf7033f5228c85e1a96cc09a6a6f109b.html
index 5306b2b..b2a15f8 100644
--- a/html/dir_a86dc504884ba10769fa325b50ed7308.html
+++ b/html/dir_cf7033f5228c85e1a96cc09a6a6f109b.html
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
-<title>KMOS Pipeline Reference Manual: /home/yjung/tmp/1.2.4/kmosp/recipes/ Directory Reference</title>
+<title>KMOS Pipeline Reference Manual: /home/yjung/tmp/kmos-1_2_6/kmosp/recipes/ Directory Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -46,7 +46,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -70,6 +70,7 @@ Files</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>kmo_fits_strip.c</b> <a href="kmo__fits__strip_8c_source.html">[code]</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>kmo_flat.c</b> <a href="kmo__flat_8c_source.html">[code]</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>kmo_illumination.c</b> <a href="kmo__illumination_8c_source.html">[code]</a></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>kmo_illumination_flat.c</b> <a href="kmo__illumination__flat_8c_source.html">[code]</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>kmo_make_image.c</b> <a href="kmo__make__image_8c_source.html">[code]</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>kmo_multi_reconstruct.c</b> <a href="kmo__multi__reconstruct_8c_source.html">[code]</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><b>kmo_noise_map.c</b> <a href="kmo__noise__map_8c_source.html">[code]</a></td></tr>
@@ -88,7 +89,7 @@ Files</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/dirs.html b/html/dirs.html
index 62353b2..78e88cf 100644
--- a/html/dirs.html
+++ b/html/dirs.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,13 +51,13 @@
</div><!--header-->
<div class="contents">
<div class="textblock">This directory hierarchy is sorted roughly, but not completely, alphabetically:</div><ul>
-<li><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a></li>
+<li><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a></li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/files.html b/html/files.html
index 6aac6a3..8951f57 100644
--- a/html/files.html
+++ b/html/files.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -68,6 +68,7 @@
<tr><td class="indexkey"><b>kmo_fits_strip.c</b> <a href="kmo__fits__strip_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><b>kmo_flat.c</b> <a href="kmo__flat_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><b>kmo_illumination.c</b> <a href="kmo__illumination_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>kmo_illumination_flat.c</b> <a href="kmo__illumination__flat_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><b>kmo_make_image.c</b> <a href="kmo__make__image_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><b>kmo_multi_reconstruct.c</b> <a href="kmo__multi__reconstruct_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey"><b>kmo_noise_map.c</b> <a href="kmo__noise__map_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
@@ -86,7 +87,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__arithmetic.html b/html/group__kmo__arithmetic.html
index d8d3fb2..a42eeed 100644
--- a/html/group__kmo__arithmetic.html
+++ b/html/group__kmo__arithmetic.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__combine.html b/html/group__kmo__combine.html
index 62b6b99..0bcbf60 100644
--- a/html/group__kmo__combine.html
+++ b/html/group__kmo__combine.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__copy.html b/html/group__kmo__copy.html
index 81b21c3..dd02b96 100644
--- a/html/group__kmo__copy.html
+++ b/html/group__kmo__copy.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__dark.html b/html/group__kmo__dark.html
index 2caed5c..bf9f5fe 100644
--- a/html/group__kmo__dark.html
+++ b/html/group__kmo__dark.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__dev__setup.html b/html/group__kmo__dev__setup.html
index a49435b..9982aef 100644
--- a/html/group__kmo__dev__setup.html
+++ b/html/group__kmo__dev__setup.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__extract__spec.html b/html/group__kmo__extract__spec.html
index 84f2eed..01246b9 100644
--- a/html/group__kmo__extract__spec.html
+++ b/html/group__kmo__extract__spec.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__fit__profile.html b/html/group__kmo__fit__profile.html
index 2a34f53..5d384f0 100644
--- a/html/group__kmo__fit__profile.html
+++ b/html/group__kmo__fit__profile.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__fits__check.html b/html/group__kmo__fits__check.html
index f3663b7..3d7a6aa 100644
--- a/html/group__kmo__fits__check.html
+++ b/html/group__kmo__fits__check.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -55,7 +55,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__fits__stack.html b/html/group__kmo__fits__stack.html
index a479bd4..da76404 100644
--- a/html/group__kmo__fits__stack.html
+++ b/html/group__kmo__fits__stack.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__fits__strip.html b/html/group__kmo__fits__strip.html
index 0206df7..c138c0a 100644
--- a/html/group__kmo__fits__strip.html
+++ b/html/group__kmo__fits__strip.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__flat.html b/html/group__kmo__flat.html
index 095d3c9..a4d84a5 100644
--- a/html/group__kmo__flat.html
+++ b/html/group__kmo__flat.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__illumination.html b/html/group__kmo__illumination.html
index 9f4a4b7..577c36d 100644
--- a/html/group__kmo__illumination.html
+++ b/html/group__kmo__illumination.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -86,7 +86,7 @@ Functions</h2></td></tr>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
<p>Create the recipe instance and make it available to the application using the interface. This function is exported. </p>
-<p>Definition at line <a class="el" href="kmo__illumination_8c_source.html#l00196">196</a> of file <a class="el" href="kmo__illumination_8c_source.html">kmo_illumination.c</a>.</p>
+<p>Definition at line <a class="el" href="kmo__illumination_8c_source.html#l00198">198</a> of file <a class="el" href="kmo__illumination_8c_source.html">kmo_illumination.c</a>.</p>
</div>
</div>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__multi__reconstruct.html b/html/group__kmo__illumination__flat.html
similarity index 80%
copy from html/group__kmo__multi__reconstruct.html
copy to html/group__kmo__illumination__flat.html
index 53f860d..2296731 100644
--- a/html/group__kmo__multi__reconstruct.html
+++ b/html/group__kmo__illumination__flat.html
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
-<title>KMOS Pipeline Reference Manual: kmo_multi_reconstruct Combine cubes</title>
+<title>KMOS Pipeline Reference Manual: kmo_illumination_flat Create a calibration frame to correct spatial non-uniformity of flatfield</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -49,19 +49,19 @@
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
-<div class="title">kmo_multi_reconstruct Combine cubes</div> </div>
+<div class="title">kmo_illumination_flat Create a calibration frame to correct spatial non-uniformity of flatfield</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
-<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__kmo__multi__reconstruct.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693">cpl_plugin_get_info</a> (cpl_pluginlist *list)</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__kmo__illumination__flat.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693">cpl_plugin_get_info</a> (cpl_pluginlist *list)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Build the list of available plugins, for this module. <a href="#ga31d1fccd4cd15b1c1f3c5edc8cb18693"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>See recipe description for details. </p>
<hr/><h2>Function Documentation</h2>
-<a class="anchor" id="ga31d1fccd4cd15b1c1f3c5edc8cb18693"></a><!-- doxytag: member="kmo_multi_reconstruct.c::cpl_plugin_get_info" ref="ga31d1fccd4cd15b1c1f3c5edc8cb18693" args="(cpl_pluginlist *list)" -->
+<a class="anchor" id="ga31d1fccd4cd15b1c1f3c5edc8cb18693"></a><!-- doxytag: member="kmo_illumination_flat.c::cpl_plugin_get_info" ref="ga31d1fccd4cd15b1c1f3c5edc8cb18693" args="(cpl_pluginlist *list)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
@@ -86,7 +86,7 @@ Functions</h2></td></tr>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
<p>Create the recipe instance and make it available to the application using the interface. This function is exported. </p>
-<p>Definition at line <a class="el" href="kmo__multi__reconstruct_8c_source.html#l00230">230</a> of file <a class="el" href="kmo__multi__reconstruct_8c_source.html">kmo_multi_reconstruct.c</a>.</p>
+<p>Definition at line <a class="el" href="kmo__illumination__flat_8c_source.html#l00184">184</a> of file <a class="el" href="kmo__illumination__flat_8c_source.html">kmo_illumination_flat.c</a>.</p>
</div>
</div>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__make__image.html b/html/group__kmo__make__image.html
index 3858a57..ef59c4c 100644
--- a/html/group__kmo__make__image.html
+++ b/html/group__kmo__make__image.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -95,7 +95,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__multi__reconstruct.html b/html/group__kmo__multi__reconstruct.html
index 53f860d..b7c4d1b 100644
--- a/html/group__kmo__multi__reconstruct.html
+++ b/html/group__kmo__multi__reconstruct.html
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
-<title>KMOS Pipeline Reference Manual: kmo_multi_reconstruct Combine cubes</title>
+<title>KMOS Pipeline Reference Manual: kmo_multi_reconstruct Reconstruct and combine</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -49,7 +49,7 @@
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
-<div class="title">kmo_multi_reconstruct Combine cubes</div> </div>
+<div class="title">kmo_multi_reconstruct Reconstruct and combine</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
@@ -59,6 +59,7 @@ Functions</h2></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Build the list of available plugins, for this module. <a href="#ga31d1fccd4cd15b1c1f3c5edc8cb18693"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
+<p>data frames dividing illumination and telluric correction</p>
<p>See recipe description for details. </p>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga31d1fccd4cd15b1c1f3c5edc8cb18693"></a><!-- doxytag: member="kmo_multi_reconstruct.c::cpl_plugin_get_info" ref="ga31d1fccd4cd15b1c1f3c5edc8cb18693" args="(cpl_pluginlist *list)" -->
@@ -86,7 +87,7 @@ Functions</h2></td></tr>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
<p>Create the recipe instance and make it available to the application using the interface. This function is exported. </p>
-<p>Definition at line <a class="el" href="kmo__multi__reconstruct_8c_source.html#l00230">230</a> of file <a class="el" href="kmo__multi__reconstruct_8c_source.html">kmo_multi_reconstruct.c</a>.</p>
+<p>Definition at line <a class="el" href="kmo__multi__reconstruct_8c_source.html#l00273">273</a> of file <a class="el" href="kmo__multi__reconstruct_8c_source.html">kmo_multi_reconstruct.c</a>.</p>
</div>
</div>
@@ -94,7 +95,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__noise__map.html b/html/group__kmo__noise__map.html
index a5c9ec9..b820c7f 100644
--- a/html/group__kmo__noise__map.html
+++ b/html/group__kmo__noise__map.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__reconstruct.html b/html/group__kmo__reconstruct.html
index 1b86963..30bed5e 100644
--- a/html/group__kmo__reconstruct.html
+++ b/html/group__kmo__reconstruct.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__rotate.html b/html/group__kmo__rotate.html
index 1bdb3d0..5b5be95 100644
--- a/html/group__kmo__rotate.html
+++ b/html/group__kmo__rotate.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__sci__red.html b/html/group__kmo__sci__red.html
index 74cf18d..6832387 100644
--- a/html/group__kmo__sci__red.html
+++ b/html/group__kmo__sci__red.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -86,7 +86,7 @@ Functions</h2></td></tr>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
<p>Create the recipe instance and make it available to the application using the interface. This function is exported. </p>
-<p>Definition at line <a class="el" href="kmo__sci__red_8c_source.html#l00303">303</a> of file <a class="el" href="kmo__sci__red_8c_source.html">kmo_sci_red.c</a>.</p>
+<p>Definition at line <a class="el" href="kmo__sci__red_8c_source.html#l00306">306</a> of file <a class="el" href="kmo__sci__red_8c_source.html">kmo_sci_red.c</a>.</p>
</div>
</div>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__shift.html b/html/group__kmo__shift.html
index 179d140..91bba5c 100644
--- a/html/group__kmo__shift.html
+++ b/html/group__kmo__shift.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__sky__mask.html b/html/group__kmo__sky__mask.html
index e841ab6..5418113 100644
--- a/html/group__kmo__sky__mask.html
+++ b/html/group__kmo__sky__mask.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__sky__tweak.html b/html/group__kmo__sky__tweak.html
index fd1865f..31e7755 100644
--- a/html/group__kmo__sky__tweak.html
+++ b/html/group__kmo__sky__tweak.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -86,7 +86,7 @@ Functions</h2></td></tr>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 if everything is ok, -1 otherwise</dd></dl>
<p>Create the recipe instance and make it available to the application using the interface. This function is exported. </p>
-<p>Definition at line <a class="el" href="kmo__sky__tweak_8c_source.html#l00089">89</a> of file <a class="el" href="kmo__sky__tweak_8c_source.html">kmo_sky_tweak.c</a>.</p>
+<p>Definition at line <a class="el" href="kmo__sky__tweak_8c_source.html#l00093">93</a> of file <a class="el" href="kmo__sky__tweak_8c_source.html">kmo_sky_tweak.c</a>.</p>
</div>
</div>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__stats.html b/html/group__kmo__stats.html
index 60148ce..07e3121 100644
--- a/html/group__kmo__stats.html
+++ b/html/group__kmo__stats.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__std__star.html b/html/group__kmo__std__star.html
index aeb9ff5..fe4bafa 100644
--- a/html/group__kmo__std__star.html
+++ b/html/group__kmo__std__star.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/group__kmo__wave__cal.html b/html/group__kmo__wave__cal.html
index c7f3580..b8cf424 100644
--- a/html/group__kmo__wave__cal.html
+++ b/html/group__kmo__wave__cal.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/index.html b/html/index.html
index 429a53b..04d274a 100644
--- a/html/index.html
+++ b/html/index.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -54,7 +54,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__arithmetic_8c_source.html b/html/kmo__arithmetic_8c_source.html
index 49a0662..79274eb 100644
--- a/html/kmo__arithmetic_8c_source.html
+++ b/html/kmo__arithmetic_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_arithmetic.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_arithmetic.c,v 1.14 2013/06/07 15:41:19 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_arithmetic.c,v 1.15 2013-09-05 12:24:58 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/06/07 15:41:19 $</span>
-<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.14 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-09-05 12:24:58 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.15 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -601,628 +601,629 @@
<a name="l00586"></a>00586 op));
<a name="l00587"></a>00587 }
<a name="l00588"></a>00588
-<a name="l00589"></a>00589 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00590"></a>00590 kmo_update_sub_keywords(sub_header_data, FALSE, FALSE,
-<a name="l00591"></a>00591 detector_frame, i));
-<a name="l00592"></a>00592
-<a name="l00593"></a>00593 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00594"></a>00594 kmo_dfs_save_image(op1_2d, fn_out, <span class="stringliteral">""</span>,
-<a name="l00595"></a>00595 sub_header_data, 0./0.));
-<a name="l00596"></a>00596 <span class="keywordflow">break</span>;
-<a name="l00597"></a>00597 <span class="keywordflow">case</span> f2d_fits:
-<a name="l00598"></a>00598 KMO_TRY_EXIT_IF_NULL(
-<a name="l00599"></a>00599 op1_2d = kmo_dfs_load_image(frameset, <span class="stringliteral">"0"</span>, i,
-<a name="l00600"></a>00600 FALSE, FALSE, NULL));
-<a name="l00601"></a>00601 <span class="comment">//</span>
-<a name="l00602"></a>00602 <span class="comment">// process F2D & F2D</span>
-<a name="l00603"></a>00603 <span class="comment">// process F2D & RAW</span>
-<a name="l00604"></a>00604 <span class="comment">//</span>
-<a name="l00605"></a>00605 <span class="keywordflow">if</span> ((desc2.fits_type == f2d_fits) ||
-<a name="l00606"></a>00606 (desc2.fits_type == raw_fits))
-<a name="l00607"></a>00607 {
-<a name="l00608"></a>00608 KMO_TRY_EXIT_IF_NULL(
-<a name="l00609"></a>00609 op2_2d = kmo_dfs_load_image(frameset, <span class="stringliteral">"1"</span>, i,
-<a name="l00610"></a>00610 FALSE, FALSE, NULL));
-<a name="l00611"></a>00611 <span class="comment">// load noise</span>
-<a name="l00612"></a>00612 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
-<a name="l00613"></a>00613 (desc2.ex_noise == TRUE)) {
-<a name="l00614"></a>00614 KMO_TRY_EXIT_IF_NULL(
-<a name="l00615"></a>00615 op1_noise_2d = kmo_dfs_load_image(frameset,
-<a name="l00616"></a>00616 <span class="stringliteral">"0"</span>, i, TRUE, FALSE, NULL));
-<a name="l00617"></a>00617
-<a name="l00618"></a>00618 KMO_TRY_EXIT_IF_NULL(
-<a name="l00619"></a>00619 op2_noise_2d = kmo_dfs_load_image(frameset,
-<a name="l00620"></a>00620 <span class="stringliteral">"1"</span>, i, TRUE, FALSE, NULL));
-<a name="l00621"></a>00621 }
-<a name="l00622"></a>00622 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00623"></a>00623 kmo_arithmetic_2D_2D(op1_2d, op2_2d,
-<a name="l00624"></a>00624 op1_noise_2d, op2_noise_2d,
-<a name="l00625"></a>00625 op));
-<a name="l00626"></a>00626 }
-<a name="l00627"></a>00627 <span class="comment">//</span>
-<a name="l00628"></a>00628 <span class="comment">// process F2D & scalar</span>
-<a name="l00629"></a>00629 <span class="comment">//</span>
-<a name="l00630"></a>00630 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
-<a name="l00631"></a>00631 <span class="comment">// process data & noise</span>
-<a name="l00632"></a>00632 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
-<a name="l00633"></a>00633 KMO_TRY_EXIT_IF_NULL(
-<a name="l00634"></a>00634 op1_noise_2d = kmo_dfs_load_image(frameset,
-<a name="l00635"></a>00635 <span class="stringliteral">"0"</span>, i, TRUE, FALSE, NULL));
-<a name="l00636"></a>00636 }
-<a name="l00637"></a>00637 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00638"></a>00638 kmo_arithmetic_2D_scalar(op1_2d,
-<a name="l00639"></a>00639 op2_scalar,
-<a name="l00640"></a>00640 op1_noise_2d,
-<a name="l00641"></a>00641 op));
-<a name="l00642"></a>00642 }
-<a name="l00643"></a>00643
-<a name="l00644"></a>00644 <span class="comment">// save data (and noise)</span>
-<a name="l00645"></a>00645 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00646"></a>00646 kmo_dfs_save_image(op1_2d, fn_out, <span class="stringliteral">""</span>,
-<a name="l00647"></a>00647 sub_header_data, 0./0.));
-<a name="l00648"></a>00648
-<a name="l00649"></a>00649 <span class="keywordflow">if</span> (op1_noise_2d != NULL) {
-<a name="l00650"></a>00650 KMO_TRY_EXIT_IF_NULL(
-<a name="l00651"></a>00651 sub_header_noise = kmo_dfs_load_sub_header(frameset,
-<a name="l00652"></a>00652 <span class="stringliteral">"0"</span>, i, TRUE));
-<a name="l00653"></a>00653 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00654"></a>00654 kmo_dfs_save_image(op1_noise_2d, fn_out, <span class="stringliteral">""</span>,
-<a name="l00655"></a>00655 sub_header_noise, 0./0.));
-<a name="l00656"></a>00656
-<a name="l00657"></a>00657 cpl_propertylist_delete(sub_header_noise);
-<a name="l00658"></a>00658 sub_header_noise = NULL;
-<a name="l00659"></a>00659 }
-<a name="l00660"></a>00660 <span class="keywordflow">break</span>;
-<a name="l00661"></a>00661 <span class="keywordflow">case</span> f3i_fits:
-<a name="l00662"></a>00662 calc_f3i = FALSE;
-<a name="l00663"></a>00663
-<a name="l00664"></a>00664 <span class="comment">// check if IFUs are valid</span>
-<a name="l00665"></a>00665 <span class="keywordflow">if</span> (desc1.ex_noise == FALSE) {
-<a name="l00666"></a>00666 <span class="keywordflow">if</span> (desc1.sub_desc[i - 1].valid_data == TRUE) {
-<a name="l00667"></a>00667 <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
-<a name="l00668"></a>00668 calc_f3i = TRUE;
-<a name="l00669"></a>00669 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (((single_ifu == TRUE) &&
-<a name="l00670"></a>00670 (desc2.sub_desc[0].valid_data == TRUE))
-<a name="l00671"></a>00671 ||
-<a name="l00672"></a>00672 (desc2.sub_desc[i - 1].valid_data == TRUE))
-<a name="l00673"></a>00673 {
-<a name="l00674"></a>00674 calc_f3i = TRUE;
-<a name="l00675"></a>00675 }
-<a name="l00676"></a>00676 }
-<a name="l00677"></a>00677 }
-<a name="l00678"></a>00678 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
-<a name="l00679"></a>00679 <span class="keywordflow">if</span> (desc1.sub_desc[2 * i - 1].valid_data == TRUE) {
-<a name="l00680"></a>00680 calc_f3i = TRUE;
-<a name="l00681"></a>00681 }
-<a name="l00682"></a>00682 }
-<a name="l00683"></a>00683 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) && (desc2.ex_noise == TRUE)) {
-<a name="l00684"></a>00684 <span class="keywordflow">if</span> (desc1.sub_desc[2 * i - 1].valid_data == TRUE) {
-<a name="l00685"></a>00685 <span class="keywordflow">if</span> (((single_ifu == TRUE) &&
-<a name="l00686"></a>00686 (desc2.sub_desc[1].valid_data == TRUE))
-<a name="l00687"></a>00687 ||
-<a name="l00688"></a>00688 (desc2.sub_desc[2 * i - 1].valid_data == TRUE))
-<a name="l00689"></a>00689 {
-<a name="l00690"></a>00690 calc_f3i = TRUE;
-<a name="l00691"></a>00691 }
-<a name="l00692"></a>00692 }
-<a name="l00693"></a>00693 }
-<a name="l00694"></a>00694 <span class="keywordflow">if</span> ((single_ifu == TRUE) && (desc1.ex_noise == FALSE)) {
-<a name="l00695"></a>00695 <span class="keywordflow">if</span> ((desc1.sub_desc[i - 1].valid_data == TRUE) &&
-<a name="l00696"></a>00696 (desc2.sub_desc[0].valid_data == TRUE)) {
-<a name="l00697"></a>00697 calc_f3i = TRUE;
-<a name="l00698"></a>00698 }
-<a name="l00699"></a>00699 }
-<a name="l00700"></a>00700
-<a name="l00701"></a>00701 <span class="keywordflow">if</span> (calc_f3i == TRUE)
-<a name="l00702"></a>00702 {
-<a name="l00703"></a>00703 KMO_TRY_EXIT_IF_NULL(
-<a name="l00704"></a>00704 op1_3d = kmo_dfs_load_cube(frameset, <span class="stringliteral">"0"</span>,
-<a name="l00705"></a>00705 devnr1, FALSE));
-<a name="l00706"></a>00706 <span class="comment">//</span>
-<a name="l00707"></a>00707 <span class="comment">// process F3I & F3I</span>
-<a name="l00708"></a>00708 <span class="comment">//</span>
-<a name="l00709"></a>00709 <span class="keywordflow">if</span> (desc2.fits_type == f3i_fits) {
-<a name="l00710"></a>00710 <span class="keywordflow">if</span> (single_ifu == FALSE) {
-<a name="l00711"></a>00711 KMO_TRY_EXIT_IF_NULL(
-<a name="l00712"></a>00712 op2_3d = kmo_dfs_load_cube(frameset,
-<a name="l00713"></a>00713 <span class="stringliteral">"1"</span>, devnr2,
-<a name="l00714"></a>00714 FALSE));
-<a name="l00715"></a>00715 }
-<a name="l00716"></a>00716
-<a name="l00717"></a>00717 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
-<a name="l00718"></a>00718 (desc2.ex_noise == TRUE))
-<a name="l00719"></a>00719 {
-<a name="l00720"></a>00720 KMO_TRY_EXIT_IF_NULL(
-<a name="l00721"></a>00721 op1_noise_3d = kmo_dfs_load_cube(frameset,
-<a name="l00722"></a>00722 <span class="stringliteral">"0"</span>, devnr1,
-<a name="l00723"></a>00723 TRUE));
-<a name="l00724"></a>00724
-<a name="l00725"></a>00725 <span class="keywordflow">if</span> (single_ifu == FALSE) {
-<a name="l00726"></a>00726 KMO_TRY_EXIT_IF_NULL(
-<a name="l00727"></a>00727 op2_noise_3d = kmo_dfs_load_cube(
-<a name="l00728"></a>00728 frameset,
-<a name="l00729"></a>00729 <span class="stringliteral">"1"</span>, devnr2,
-<a name="l00730"></a>00730 TRUE));
-<a name="l00731"></a>00731 }
-<a name="l00732"></a>00732 }
-<a name="l00733"></a>00733
-<a name="l00734"></a>00734 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00735"></a>00735 kmo_arithmetic_3D_3D(op1_3d, op2_3d,
-<a name="l00736"></a>00736 op1_noise_3d, op2_noise_3d,
-<a name="l00737"></a>00737 op));
-<a name="l00738"></a>00738 }
-<a name="l00739"></a>00739
-<a name="l00740"></a>00740 <span class="comment">//</span>
-<a name="l00741"></a>00741 <span class="comment">// process F3I & F2I</span>
-<a name="l00742"></a>00742 <span class="comment">//</span>
-<a name="l00743"></a>00743 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (desc2.fits_type == f2i_fits) {
-<a name="l00744"></a>00744 <span class="keywordflow">if</span> (single_ifu == FALSE) {
-<a name="l00745"></a>00745 KMO_TRY_EXIT_IF_NULL(
-<a name="l00746"></a>00746 op2_2d = kmo_dfs_load_image(frameset,
-<a name="l00747"></a>00747 <span class="stringliteral">"1"</span>, devnr2,
-<a name="l00748"></a>00748 FALSE, FALSE, NULL));
-<a name="l00749"></a>00749 }
-<a name="l00750"></a>00750
-<a name="l00751"></a>00751 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
-<a name="l00752"></a>00752 (desc2.ex_noise == TRUE))
-<a name="l00753"></a>00753 {
-<a name="l00754"></a>00754 KMO_TRY_EXIT_IF_NULL(
-<a name="l00755"></a>00755 op1_noise_3d = kmo_dfs_load_cube(frameset,
-<a name="l00756"></a>00756 <span class="stringliteral">"0"</span>, devnr1,
-<a name="l00757"></a>00757 TRUE));
-<a name="l00758"></a>00758
-<a name="l00759"></a>00759 <span class="keywordflow">if</span> (single_ifu == FALSE) {
-<a name="l00760"></a>00760 KMO_TRY_EXIT_IF_NULL(
-<a name="l00761"></a>00761 op2_noise_2d = kmo_dfs_load_image(
-<a name="l00762"></a>00762 frameset,
-<a name="l00763"></a>00763 <span class="stringliteral">"1"</span>, devnr2,
-<a name="l00764"></a>00764 TRUE, FALSE, NULL));
-<a name="l00765"></a>00765 }
-<a name="l00766"></a>00766 }
-<a name="l00767"></a>00767
-<a name="l00768"></a>00768 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00769"></a>00769 kmo_arithmetic_3D_2D(op1_3d, op2_2d,
-<a name="l00770"></a>00770 op1_noise_3d, op2_noise_2d,
-<a name="l00771"></a>00771 op));
-<a name="l00772"></a>00772 }
-<a name="l00773"></a>00773 <span class="comment">//</span>
-<a name="l00774"></a>00774 <span class="comment">// process F3I & F1I</span>
-<a name="l00775"></a>00775 <span class="comment">//</span>
-<a name="l00776"></a>00776 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (desc2.fits_type == f1i_fits) {
-<a name="l00777"></a>00777 <span class="keywordflow">if</span> (single_ifu == FALSE) {
-<a name="l00778"></a>00778 KMO_TRY_EXIT_IF_NULL(
-<a name="l00779"></a>00779 op2_1d = kmo_dfs_load_vector(frameset,
-<a name="l00780"></a>00780 <span class="stringliteral">"1"</span>, devnr2,
-<a name="l00781"></a>00781 FALSE));
-<a name="l00782"></a>00782 }
-<a name="l00783"></a>00783
-<a name="l00784"></a>00784 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
-<a name="l00785"></a>00785 (desc2.ex_noise == TRUE))
-<a name="l00786"></a>00786 {
-<a name="l00787"></a>00787 KMO_TRY_EXIT_IF_NULL(
-<a name="l00788"></a>00788 op1_noise_3d = kmo_dfs_load_cube(frameset,
-<a name="l00789"></a>00789 <span class="stringliteral">"0"</span>, devnr1,
-<a name="l00790"></a>00790 TRUE));
-<a name="l00791"></a>00791
-<a name="l00792"></a>00792 <span class="keywordflow">if</span> (single_ifu == FALSE) {
-<a name="l00793"></a>00793 KMO_TRY_EXIT_IF_NULL(
-<a name="l00794"></a>00794 op2_noise_1d = kmo_dfs_load_vector(
-<a name="l00795"></a>00795 frameset,
-<a name="l00796"></a>00796 <span class="stringliteral">"1"</span>, devnr2,
-<a name="l00797"></a>00797 TRUE));
-<a name="l00798"></a>00798 }
-<a name="l00799"></a>00799 }
-<a name="l00800"></a>00800
-<a name="l00801"></a>00801 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00802"></a>00802 kmo_arithmetic_3D_1D(op1_3d, op2_1d,
-<a name="l00803"></a>00803 op1_noise_3d, op2_noise_1d,
-<a name="l00804"></a>00804 op));
-<a name="l00805"></a>00805 }
-<a name="l00806"></a>00806 <span class="comment">//</span>
-<a name="l00807"></a>00807 <span class="comment">// process F3I & scalar</span>
-<a name="l00808"></a>00808 <span class="comment">//</span>
-<a name="l00809"></a>00809 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
-<a name="l00810"></a>00810 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
-<a name="l00811"></a>00811 KMO_TRY_EXIT_IF_NULL(
-<a name="l00812"></a>00812 op1_noise_3d = kmo_dfs_load_cube(frameset,
-<a name="l00813"></a>00813 <span class="stringliteral">"0"</span>, devnr1,
-<a name="l00814"></a>00814 TRUE));
-<a name="l00815"></a>00815 }
-<a name="l00816"></a>00816
-<a name="l00817"></a>00817 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00818"></a>00818 kmo_arithmetic_3D_scalar(op1_3d,
-<a name="l00819"></a>00819 op2_scalar,
-<a name="l00820"></a>00820 op1_noise_3d,
-<a name="l00821"></a>00821 op));
-<a name="l00822"></a>00822 }
-<a name="l00823"></a>00823
-<a name="l00824"></a>00824 <span class="comment">// save data (and noise)</span>
-<a name="l00825"></a>00825 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00826"></a>00826 kmo_dfs_save_cube(op1_3d, fn_out, <span class="stringliteral">""</span>,
-<a name="l00827"></a>00827 sub_header_data, 0./0.));
-<a name="l00828"></a>00828
-<a name="l00829"></a>00829 <span class="keywordflow">if</span> (op1_noise_3d != NULL) {
-<a name="l00830"></a>00830 KMO_TRY_EXIT_IF_NULL(
-<a name="l00831"></a>00831 sub_header_noise = kmo_dfs_load_sub_header(
-<a name="l00832"></a>00832 frameset,
-<a name="l00833"></a>00833 <span class="stringliteral">"0"</span>, devnr1,
-<a name="l00834"></a>00834 TRUE));
-<a name="l00835"></a>00835
-<a name="l00836"></a>00836 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00837"></a>00837 kmo_dfs_save_cube(op1_noise_3d, fn_out, <span class="stringliteral">""</span>,
-<a name="l00838"></a>00838 sub_header_noise, 0./0.));
-<a name="l00839"></a>00839
-<a name="l00840"></a>00840 cpl_propertylist_delete(sub_header_noise);
-<a name="l00841"></a>00841 sub_header_noise = NULL;
-<a name="l00842"></a>00842 }
-<a name="l00843"></a>00843 } <span class="keywordflow">else</span> {
-<a name="l00844"></a>00844 <span class="comment">//</span>
-<a name="l00845"></a>00845 <span class="comment">// invalid IFU, just save sub_header</span>
-<a name="l00846"></a>00846 <span class="comment">//</span>
-<a name="l00847"></a>00847 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00848"></a>00848 kmo_dfs_save_sub_header(fn_out, <span class="stringliteral">""</span>,
-<a name="l00849"></a>00849 sub_header_data));
-<a name="l00850"></a>00850
-<a name="l00851"></a>00851 <span class="comment">// save noise if it has been calculated</span>
-<a name="l00852"></a>00852 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
-<a name="l00853"></a>00853 ((((desc2.fits_type == f3i_fits) ||
-<a name="l00854"></a>00854 (desc2.fits_type == f2i_fits) ||
-<a name="l00855"></a>00855 (desc2.fits_type == f1i_fits)
-<a name="l00856"></a>00856 ) &&
-<a name="l00857"></a>00857 (desc2.ex_noise == TRUE)
-<a name="l00858"></a>00858 ) ||
-<a name="l00859"></a>00859 (op2_scalar != -DBL_MAX)
-<a name="l00860"></a>00860 )
-<a name="l00861"></a>00861 )
-<a name="l00862"></a>00862 {
-<a name="l00863"></a>00863
-<a name="l00864"></a>00864 KMO_TRY_EXIT_IF_NULL(
-<a name="l00865"></a>00865 sub_header_noise = kmo_dfs_load_sub_header(
-<a name="l00866"></a>00866 frameset,
-<a name="l00867"></a>00867 <span class="stringliteral">"0"</span>, devnr1,
-<a name="l00868"></a>00868 TRUE));
-<a name="l00869"></a>00869 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00870"></a>00870 kmo_dfs_save_sub_header(fn_out, <span class="stringliteral">""</span>,
-<a name="l00871"></a>00871 sub_header_noise));
-<a name="l00872"></a>00872
-<a name="l00873"></a>00873 cpl_propertylist_delete(sub_header_noise);
-<a name="l00874"></a>00874 sub_header_noise = NULL;
-<a name="l00875"></a>00875 }
-<a name="l00876"></a>00876 }
-<a name="l00877"></a>00877 <span class="keywordflow">break</span>;
-<a name="l00878"></a>00878 <span class="keywordflow">case</span> f2i_fits:
-<a name="l00879"></a>00879 calc_f2i = FALSE;
-<a name="l00880"></a>00880
-<a name="l00881"></a>00881 <span class="comment">// check if IFUs are valid</span>
-<a name="l00882"></a>00882 <span class="keywordflow">if</span> (desc1.ex_noise == FALSE) {
-<a name="l00883"></a>00883 <span class="keywordflow">if</span> (desc1.sub_desc[i - 1].valid_data == TRUE) {
-<a name="l00884"></a>00884 <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
-<a name="l00885"></a>00885 calc_f2i = TRUE;
-<a name="l00886"></a>00886 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (((single_ifu == TRUE) &&
-<a name="l00887"></a>00887 (desc2.sub_desc[0].valid_data == TRUE))
-<a name="l00888"></a>00888 ||
-<a name="l00889"></a>00889 (desc2.sub_desc[i - 1].valid_data == TRUE))
-<a name="l00890"></a>00890 {
-<a name="l00891"></a>00891 calc_f2i = TRUE;
-<a name="l00892"></a>00892 }
-<a name="l00893"></a>00893 }
-<a name="l00894"></a>00894 }
-<a name="l00895"></a>00895 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
-<a name="l00896"></a>00896 <span class="keywordflow">if</span> (desc1.sub_desc[2 * i - 1].valid_data == TRUE) {
-<a name="l00897"></a>00897 calc_f2i = TRUE;
-<a name="l00898"></a>00898 }
-<a name="l00899"></a>00899 }
-<a name="l00900"></a>00900 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) && (desc2.ex_noise == TRUE)) {
-<a name="l00901"></a>00901 <span class="keywordflow">if</span> (desc1.sub_desc[2 * i - 1].valid_data == TRUE) {
-<a name="l00902"></a>00902 <span class="keywordflow">if</span> (((single_ifu == TRUE) &&
-<a name="l00903"></a>00903 (desc2.sub_desc[1].valid_data == TRUE))
-<a name="l00904"></a>00904 ||
-<a name="l00905"></a>00905 (desc2.sub_desc[2 * i - 1].valid_data == TRUE))
-<a name="l00906"></a>00906 {
-<a name="l00907"></a>00907 calc_f2i = TRUE;
-<a name="l00908"></a>00908 }
-<a name="l00909"></a>00909 }
-<a name="l00910"></a>00910 }
-<a name="l00911"></a>00911 <span class="keywordflow">if</span> ((single_ifu == TRUE) && (desc1.ex_noise == FALSE)) {
-<a name="l00912"></a>00912 <span class="keywordflow">if</span> ((desc1.sub_desc[i - 1].valid_data == TRUE) &&
-<a name="l00913"></a>00913 (desc2.sub_desc[0].valid_data == TRUE)) {
-<a name="l00914"></a>00914 calc_f2i = TRUE;
-<a name="l00915"></a>00915 }
-<a name="l00916"></a>00916 }
-<a name="l00917"></a>00917
-<a name="l00918"></a>00918 <span class="keywordflow">if</span> (calc_f2i == TRUE)
-<a name="l00919"></a>00919 {
-<a name="l00920"></a>00920 KMO_TRY_EXIT_IF_NULL(
-<a name="l00921"></a>00921 op1_2d = kmo_dfs_load_image(frameset, <span class="stringliteral">"0"</span>,
-<a name="l00922"></a>00922 devnr1, FALSE, FALSE, NULL));
-<a name="l00923"></a>00923 <span class="comment">//</span>
-<a name="l00924"></a>00924 <span class="comment">// process F2I & F2I</span>
-<a name="l00925"></a>00925 <span class="comment">//</span>
-<a name="l00926"></a>00926 <span class="keywordflow">if</span> (desc2.fits_type == f2i_fits) {
-<a name="l00927"></a>00927 <span class="keywordflow">if</span> (single_ifu == FALSE) {
-<a name="l00928"></a>00928 KMO_TRY_EXIT_IF_NULL(
-<a name="l00929"></a>00929 op2_2d = kmo_dfs_load_image(frameset, <span class="stringliteral">"1"</span>,
-<a name="l00930"></a>00930 devnr2, FALSE, FALSE, NULL));
-<a name="l00931"></a>00931 }
-<a name="l00932"></a>00932
-<a name="l00933"></a>00933 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
-<a name="l00934"></a>00934 (desc2.ex_noise == TRUE))
-<a name="l00935"></a>00935 {
-<a name="l00936"></a>00936 KMO_TRY_EXIT_IF_NULL(
-<a name="l00937"></a>00937 op1_noise_2d = kmo_dfs_load_image(
-<a name="l00938"></a>00938 frameset, <span class="stringliteral">"0"</span>,
-<a name="l00939"></a>00939 devnr1, TRUE, FALSE, NULL));
-<a name="l00940"></a>00940
-<a name="l00941"></a>00941 <span class="keywordflow">if</span> (single_ifu == FALSE) {
-<a name="l00942"></a>00942 KMO_TRY_EXIT_IF_NULL(
-<a name="l00943"></a>00943 op2_noise_2d = kmo_dfs_load_image(
-<a name="l00944"></a>00944 frameset, <span class="stringliteral">"1"</span>,
-<a name="l00945"></a>00945 devnr2, TRUE, FALSE, NULL));
-<a name="l00946"></a>00946 }
-<a name="l00947"></a>00947 }
-<a name="l00948"></a>00948
-<a name="l00949"></a>00949 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00950"></a>00950 kmo_arithmetic_2D_2D(op1_2d, op2_2d,
-<a name="l00951"></a>00951 op1_noise_2d, op2_noise_2d,
-<a name="l00952"></a>00952 op));
-<a name="l00953"></a>00953 }
-<a name="l00954"></a>00954 <span class="comment">//</span>
-<a name="l00955"></a>00955 <span class="comment">// process F2I & scalar</span>
-<a name="l00956"></a>00956 <span class="comment">//</span>
-<a name="l00957"></a>00957 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
-<a name="l00958"></a>00958 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
-<a name="l00959"></a>00959 KMO_TRY_EXIT_IF_NULL(
-<a name="l00960"></a>00960 op1_noise_2d = kmo_dfs_load_image(
-<a name="l00961"></a>00961 frameset, <span class="stringliteral">"0"</span>,
-<a name="l00962"></a>00962 devnr1, TRUE, FALSE, NULL));
-<a name="l00963"></a>00963 }
-<a name="l00964"></a>00964
-<a name="l00965"></a>00965 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00966"></a>00966 kmo_arithmetic_2D_scalar(op1_2d,
-<a name="l00967"></a>00967 op2_scalar,
-<a name="l00968"></a>00968 op1_noise_2d,
-<a name="l00969"></a>00969 op));
-<a name="l00970"></a>00970 }
-<a name="l00971"></a>00971
-<a name="l00972"></a>00972 <span class="comment">// save data (and noise)</span>
-<a name="l00973"></a>00973 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00974"></a>00974 kmo_dfs_save_image(op1_2d, fn_out, <span class="stringliteral">""</span>,
-<a name="l00975"></a>00975 sub_header_data, 0./0.));
-<a name="l00976"></a>00976
-<a name="l00977"></a>00977 <span class="keywordflow">if</span> (op1_noise_2d != NULL) {
-<a name="l00978"></a>00978 KMO_TRY_EXIT_IF_NULL(
-<a name="l00979"></a>00979 sub_header_noise = kmo_dfs_load_sub_header(
-<a name="l00980"></a>00980 frameset, <span class="stringliteral">"0"</span>,
-<a name="l00981"></a>00981 devnr1, TRUE));
-<a name="l00982"></a>00982
-<a name="l00983"></a>00983 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00984"></a>00984 kmo_dfs_save_image(op1_noise_2d, fn_out, <span class="stringliteral">""</span>,
-<a name="l00985"></a>00985 sub_header_noise, 0./0.));
-<a name="l00986"></a>00986
-<a name="l00987"></a>00987 cpl_propertylist_delete(sub_header_noise);
-<a name="l00988"></a>00988 sub_header_noise = NULL;
-<a name="l00989"></a>00989 }
-<a name="l00990"></a>00990 } <span class="keywordflow">else</span> {
-<a name="l00991"></a>00991 <span class="comment">//</span>
-<a name="l00992"></a>00992 <span class="comment">// invalid IFU, just save sub_header</span>
-<a name="l00993"></a>00993 <span class="comment">//</span>
-<a name="l00994"></a>00994 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00995"></a>00995 kmo_dfs_save_sub_header(fn_out, <span class="stringliteral">""</span>, sub_header_data));
-<a name="l00996"></a>00996
-<a name="l00997"></a>00997 <span class="comment">// save noise if it has been calculated</span>
-<a name="l00998"></a>00998 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE)
-<a name="l00999"></a>00999 &&
-<a name="l01000"></a>01000 (((desc2.fits_type == f2i_fits) && (desc2.ex_noise == TRUE)) ||
-<a name="l01001"></a>01001 (op2_scalar != -DBL_MAX)))
-<a name="l01002"></a>01002 {
-<a name="l01003"></a>01003
-<a name="l01004"></a>01004 KMO_TRY_EXIT_IF_NULL(
-<a name="l01005"></a>01005 sub_header_noise = kmo_dfs_load_sub_header(
-<a name="l01006"></a>01006 frameset,
-<a name="l01007"></a>01007 <span class="stringliteral">"0"</span>, devnr1,
-<a name="l01008"></a>01008 TRUE));
-<a name="l01009"></a>01009 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01010"></a>01010 kmo_dfs_save_sub_header(fn_out, <span class="stringliteral">""</span>, sub_header_noise));
-<a name="l01011"></a>01011
-<a name="l01012"></a>01012 cpl_propertylist_delete(sub_header_noise);
-<a name="l01013"></a>01013 sub_header_noise = NULL;
-<a name="l01014"></a>01014 }
-<a name="l01015"></a>01015 }
-<a name="l01016"></a>01016 <span class="keywordflow">break</span>;
-<a name="l01017"></a>01017 <span class="keywordflow">case</span> f1i_fits:
-<a name="l01018"></a>01018 calc_f1i = FALSE;
-<a name="l01019"></a>01019
-<a name="l01020"></a>01020 <span class="comment">// check if IFUs are valid</span>
-<a name="l01021"></a>01021 <span class="keywordflow">if</span> (desc1.ex_noise == FALSE) {
-<a name="l01022"></a>01022 <span class="keywordflow">if</span> (desc1.sub_desc[i - 1].valid_data == TRUE) {
-<a name="l01023"></a>01023 <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
-<a name="l01024"></a>01024 calc_f1i = TRUE;
-<a name="l01025"></a>01025 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (((single_ifu == TRUE) &&
-<a name="l01026"></a>01026 (desc2.sub_desc[0].valid_data == TRUE))
-<a name="l01027"></a>01027 ||
-<a name="l01028"></a>01028 (desc2.sub_desc[i - 1].valid_data == TRUE))
-<a name="l01029"></a>01029 {
-<a name="l01030"></a>01030 calc_f1i = TRUE;
-<a name="l01031"></a>01031 }
-<a name="l01032"></a>01032 }
-<a name="l01033"></a>01033 }
-<a name="l01034"></a>01034 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
-<a name="l01035"></a>01035 <span class="keywordflow">if</span> (desc1.sub_desc[2 * i - 1].valid_data == TRUE) {
-<a name="l01036"></a>01036 calc_f1i = TRUE;
-<a name="l01037"></a>01037 }
-<a name="l01038"></a>01038 }
-<a name="l01039"></a>01039 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) && (desc2.ex_noise == TRUE)) {
-<a name="l01040"></a>01040 <span class="keywordflow">if</span> (desc1.sub_desc[2 * i - 1].valid_data == TRUE) {
-<a name="l01041"></a>01041 <span class="keywordflow">if</span> (((single_ifu == TRUE) &&
-<a name="l01042"></a>01042 (desc2.sub_desc[1].valid_data == TRUE))
-<a name="l01043"></a>01043 ||
-<a name="l01044"></a>01044 (desc2.sub_desc[2 * i - 1].valid_data == TRUE))
-<a name="l01045"></a>01045 {
-<a name="l01046"></a>01046 calc_f1i = TRUE;
-<a name="l01047"></a>01047 }
-<a name="l01048"></a>01048 }
-<a name="l01049"></a>01049 }
-<a name="l01050"></a>01050 <span class="keywordflow">if</span> ((single_ifu == TRUE) && (desc1.ex_noise == FALSE)) {
-<a name="l01051"></a>01051 <span class="keywordflow">if</span> ((desc1.sub_desc[i - 1].valid_data == TRUE) &&
-<a name="l01052"></a>01052 (desc2.sub_desc[0].valid_data == TRUE)) {
-<a name="l01053"></a>01053 calc_f1i = TRUE;
-<a name="l01054"></a>01054 }
-<a name="l01055"></a>01055 }
-<a name="l01056"></a>01056
-<a name="l01057"></a>01057 <span class="keywordflow">if</span> (calc_f1i == TRUE)
-<a name="l01058"></a>01058 {
-<a name="l01059"></a>01059 KMO_TRY_EXIT_IF_NULL(
-<a name="l01060"></a>01060 op1_1d = kmo_dfs_load_vector(frameset, <span class="stringliteral">"0"</span>,
-<a name="l01061"></a>01061 devnr1, FALSE));
-<a name="l01062"></a>01062 <span class="comment">//</span>
-<a name="l01063"></a>01063 <span class="comment">// process F1I & F1I</span>
-<a name="l01064"></a>01064 <span class="comment">//</span>
-<a name="l01065"></a>01065 <span class="keywordflow">if</span> (desc2.fits_type == f1i_fits) {
-<a name="l01066"></a>01066 <span class="keywordflow">if</span> (single_ifu == FALSE) {
-<a name="l01067"></a>01067 KMO_TRY_EXIT_IF_NULL(
-<a name="l01068"></a>01068 op2_1d = kmo_dfs_load_vector(frameset, <span class="stringliteral">"1"</span>,
-<a name="l01069"></a>01069 devnr2, FALSE));
-<a name="l01070"></a>01070 }
-<a name="l01071"></a>01071
-<a name="l01072"></a>01072 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
-<a name="l01073"></a>01073 (desc2.ex_noise == TRUE))
-<a name="l01074"></a>01074 {
-<a name="l01075"></a>01075 KMO_TRY_EXIT_IF_NULL(
-<a name="l01076"></a>01076 op1_noise_1d = kmo_dfs_load_vector(
-<a name="l01077"></a>01077 frameset, <span class="stringliteral">"0"</span>,
-<a name="l01078"></a>01078 devnr1, TRUE));
-<a name="l01079"></a>01079
-<a name="l01080"></a>01080 <span class="keywordflow">if</span> (single_ifu == FALSE) {
-<a name="l01081"></a>01081 KMO_TRY_EXIT_IF_NULL(
-<a name="l01082"></a>01082 op2_noise_1d = kmo_dfs_load_vector(
-<a name="l01083"></a>01083 frameset, <span class="stringliteral">"1"</span>,
-<a name="l01084"></a>01084 devnr2, TRUE));
-<a name="l01085"></a>01085 }
-<a name="l01086"></a>01086 }
-<a name="l01087"></a>01087
-<a name="l01088"></a>01088 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01089"></a>01089 kmo_arithmetic_1D_1D(op1_1d, op2_1d,
-<a name="l01090"></a>01090 op1_noise_1d, op2_noise_1d,
-<a name="l01091"></a>01091 op));
-<a name="l01092"></a>01092 }
-<a name="l01093"></a>01093 <span class="comment">//</span>
-<a name="l01094"></a>01094 <span class="comment">// process F1I & scalar</span>
-<a name="l01095"></a>01095 <span class="comment">//</span>
-<a name="l01096"></a>01096 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
-<a name="l01097"></a>01097 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
-<a name="l01098"></a>01098 KMO_TRY_EXIT_IF_NULL(
-<a name="l01099"></a>01099 op1_noise_1d = kmo_dfs_load_vector(
-<a name="l01100"></a>01100 frameset, <span class="stringliteral">"0"</span>,
-<a name="l01101"></a>01101 devnr1, TRUE));
-<a name="l01102"></a>01102 }
-<a name="l01103"></a>01103
-<a name="l01104"></a>01104 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01105"></a>01105 kmo_arithmetic_1D_scalar(op1_1d,
-<a name="l01106"></a>01106 op2_scalar,
-<a name="l01107"></a>01107 op1_noise_1d,
-<a name="l01108"></a>01108 op));
-<a name="l01109"></a>01109 }
-<a name="l01110"></a>01110
-<a name="l01111"></a>01111 <span class="comment">// save data (and noise)</span>
-<a name="l01112"></a>01112 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01113"></a>01113 kmo_dfs_save_vector(op1_1d, fn_out, <span class="stringliteral">""</span>,
-<a name="l01114"></a>01114 sub_header_data, 0./0.));
-<a name="l01115"></a>01115
-<a name="l01116"></a>01116 <span class="keywordflow">if</span> (op1_noise_1d != NULL) {
-<a name="l01117"></a>01117 KMO_TRY_EXIT_IF_NULL(
-<a name="l01118"></a>01118 sub_header_noise = kmo_dfs_load_sub_header(
-<a name="l01119"></a>01119 frameset, <span class="stringliteral">"0"</span>,
-<a name="l01120"></a>01120 devnr1, TRUE));
-<a name="l01121"></a>01121
-<a name="l01122"></a>01122 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01123"></a>01123 kmo_dfs_save_vector(op1_noise_1d, fn_out, <span class="stringliteral">""</span>,
-<a name="l01124"></a>01124 sub_header_noise, 0./0.));
-<a name="l01125"></a>01125
-<a name="l01126"></a>01126 cpl_propertylist_delete(sub_header_noise);
-<a name="l01127"></a>01127 sub_header_noise = NULL;
-<a name="l01128"></a>01128 }
-<a name="l01129"></a>01129 } <span class="keywordflow">else</span> {
-<a name="l01130"></a>01130 <span class="comment">//</span>
-<a name="l01131"></a>01131 <span class="comment">// invalid IFU, just save sub_header</span>
-<a name="l01132"></a>01132 <span class="comment">//</span>
-<a name="l01133"></a>01133 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01134"></a>01134 kmo_dfs_save_sub_header(fn_out, <span class="stringliteral">""</span>, sub_header_data));
-<a name="l01135"></a>01135
-<a name="l01136"></a>01136 <span class="comment">// save noise if it has been calculated</span>
-<a name="l01137"></a>01137 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE)
-<a name="l01138"></a>01138 &&
-<a name="l01139"></a>01139 (((desc2.fits_type == f2i_fits) && (desc2.ex_noise == TRUE)) ||
-<a name="l01140"></a>01140 (op2_scalar != -DBL_MAX)))
-<a name="l01141"></a>01141 {
-<a name="l01142"></a>01142
-<a name="l01143"></a>01143 KMO_TRY_EXIT_IF_NULL(
-<a name="l01144"></a>01144 sub_header_noise = kmo_dfs_load_sub_header(
-<a name="l01145"></a>01145 frameset,
-<a name="l01146"></a>01146 <span class="stringliteral">"0"</span>, devnr1,
-<a name="l01147"></a>01147 TRUE));
-<a name="l01148"></a>01148 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01149"></a>01149 kmo_dfs_save_sub_header(fn_out, <span class="stringliteral">""</span>,
-<a name="l01150"></a>01150 sub_header_noise));
-<a name="l01151"></a>01151
-<a name="l01152"></a>01152 cpl_propertylist_delete(sub_header_noise);
-<a name="l01153"></a>01153 sub_header_noise = NULL;
-<a name="l01154"></a>01154 }
-<a name="l01155"></a>01155 }
-<a name="l01156"></a>01156 <span class="keywordflow">break</span>;
-<a name="l01157"></a>01157 <span class="keywordflow">default</span>:
-<a name="l01158"></a>01158 <span class="keywordflow">break</span>;
-<a name="l01159"></a>01159 }
-<a name="l01160"></a>01160
-<a name="l01161"></a>01161 cpl_propertylist_delete(sub_header_data); sub_header_data = NULL;
-<a name="l01162"></a>01162
-<a name="l01163"></a>01163 cpl_image_delete(op1_2d); op1_2d = NULL;
-<a name="l01164"></a>01164 cpl_imagelist_delete(op1_3d); op1_3d = NULL;
-<a name="l01165"></a>01165
-<a name="l01166"></a>01166 cpl_image_delete(op1_noise_2d); op1_noise_2d = NULL;
-<a name="l01167"></a>01167 cpl_imagelist_delete(op1_noise_3d); op1_noise_3d = NULL;
-<a name="l01168"></a>01168
-<a name="l01169"></a>01169 <span class="keywordflow">if</span> (single_ifu == FALSE) {
-<a name="l01170"></a>01170 kmclipm_vector_delete(op2_1d); op2_1d = NULL,
-<a name="l01171"></a>01171 cpl_image_delete(op2_2d); op2_2d = NULL;
-<a name="l01172"></a>01172 cpl_imagelist_delete(op2_3d); op2_3d = NULL;
-<a name="l01173"></a>01173
-<a name="l01174"></a>01174 kmclipm_vector_delete(op2_noise_1d); op2_noise_1d = NULL,
-<a name="l01175"></a>01175 cpl_image_delete(op2_noise_2d); op2_noise_2d = NULL;
-<a name="l01176"></a>01176 cpl_imagelist_delete(op2_noise_3d); op2_noise_3d = NULL;
-<a name="l01177"></a>01177 }
-<a name="l01178"></a>01178 }
-<a name="l01179"></a>01179 }
-<a name="l01180"></a>01180 KMO_CATCH
-<a name="l01181"></a>01181 {
-<a name="l01182"></a>01182 KMO_CATCH_MSG();
-<a name="l01183"></a>01183 ret_val = -1;
-<a name="l01184"></a>01184 }
-<a name="l01185"></a>01185
-<a name="l01186"></a>01186 kmo_free_fits_desc(&desc1);
-<a name="l01187"></a>01187 kmo_free_fits_desc(&desc2);
-<a name="l01188"></a>01188 cpl_free(fn_out); fn_out = NULL;
-<a name="l01189"></a>01189 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l01190"></a>01190 cpl_propertylist_delete(sub_header_data); sub_header_data = NULL;
-<a name="l01191"></a>01191 cpl_propertylist_delete(sub_header_noise); sub_header_noise = NULL;
-<a name="l01192"></a>01192 cpl_image_delete(op1_2d); op1_2d = NULL;
-<a name="l01193"></a>01193 cpl_imagelist_delete(op1_3d); op1_3d = NULL;
-<a name="l01194"></a>01194 kmclipm_vector_delete(op2_1d); op2_1d = NULL;
-<a name="l01195"></a>01195 cpl_image_delete(op2_2d); op2_2d = NULL;
-<a name="l01196"></a>01196 cpl_imagelist_delete(op2_3d); op2_3d = NULL;
-<a name="l01197"></a>01197 cpl_image_delete(op1_noise_2d); op1_noise_2d = NULL;
-<a name="l01198"></a>01198 cpl_imagelist_delete(op1_noise_3d); op1_noise_3d = NULL;
-<a name="l01199"></a>01199 kmclipm_vector_delete(op2_noise_1d); op2_noise_1d = NULL;
-<a name="l01200"></a>01200 cpl_image_delete(op2_noise_2d); op2_noise_2d = NULL;
-<a name="l01201"></a>01201 cpl_imagelist_delete(op2_noise_3d); op2_noise_3d = NULL;
-<a name="l01202"></a>01202
-<a name="l01203"></a>01203 <span class="keywordflow">return</span> ret_val;
-<a name="l01204"></a>01204 }
-<a name="l01205"></a>01205
+<a name="l00589"></a>00589 <span class="comment">// keep EXTNAME from op1 (e.g. CHIP1.INT1 instead of creating DET.1.DATA)</span>
+<a name="l00590"></a>00590 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
+<a name="l00591"></a>00591 <span class="comment">// kmo_update_sub_keywords(sub_header_data, FALSE, FALSE,</span>
+<a name="l00592"></a>00592 <span class="comment">// detector_frame, i));</span>
+<a name="l00593"></a>00593
+<a name="l00594"></a>00594 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00595"></a>00595 kmo_dfs_save_image(op1_2d, fn_out, <span class="stringliteral">""</span>,
+<a name="l00596"></a>00596 sub_header_data, 0./0.));
+<a name="l00597"></a>00597 <span class="keywordflow">break</span>;
+<a name="l00598"></a>00598 <span class="keywordflow">case</span> f2d_fits:
+<a name="l00599"></a>00599 KMO_TRY_EXIT_IF_NULL(
+<a name="l00600"></a>00600 op1_2d = kmo_dfs_load_image(frameset, <span class="stringliteral">"0"</span>, i,
+<a name="l00601"></a>00601 FALSE, FALSE, NULL));
+<a name="l00602"></a>00602 <span class="comment">//</span>
+<a name="l00603"></a>00603 <span class="comment">// process F2D & F2D</span>
+<a name="l00604"></a>00604 <span class="comment">// process F2D & RAW</span>
+<a name="l00605"></a>00605 <span class="comment">//</span>
+<a name="l00606"></a>00606 <span class="keywordflow">if</span> ((desc2.fits_type == f2d_fits) ||
+<a name="l00607"></a>00607 (desc2.fits_type == raw_fits))
+<a name="l00608"></a>00608 {
+<a name="l00609"></a>00609 KMO_TRY_EXIT_IF_NULL(
+<a name="l00610"></a>00610 op2_2d = kmo_dfs_load_image(frameset, <span class="stringliteral">"1"</span>, i,
+<a name="l00611"></a>00611 FALSE, FALSE, NULL));
+<a name="l00612"></a>00612 <span class="comment">// load noise</span>
+<a name="l00613"></a>00613 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
+<a name="l00614"></a>00614 (desc2.ex_noise == TRUE)) {
+<a name="l00615"></a>00615 KMO_TRY_EXIT_IF_NULL(
+<a name="l00616"></a>00616 op1_noise_2d = kmo_dfs_load_image(frameset,
+<a name="l00617"></a>00617 <span class="stringliteral">"0"</span>, i, TRUE, FALSE, NULL));
+<a name="l00618"></a>00618
+<a name="l00619"></a>00619 KMO_TRY_EXIT_IF_NULL(
+<a name="l00620"></a>00620 op2_noise_2d = kmo_dfs_load_image(frameset,
+<a name="l00621"></a>00621 <span class="stringliteral">"1"</span>, i, TRUE, FALSE, NULL));
+<a name="l00622"></a>00622 }
+<a name="l00623"></a>00623 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00624"></a>00624 kmo_arithmetic_2D_2D(op1_2d, op2_2d,
+<a name="l00625"></a>00625 op1_noise_2d, op2_noise_2d,
+<a name="l00626"></a>00626 op));
+<a name="l00627"></a>00627 }
+<a name="l00628"></a>00628 <span class="comment">//</span>
+<a name="l00629"></a>00629 <span class="comment">// process F2D & scalar</span>
+<a name="l00630"></a>00630 <span class="comment">//</span>
+<a name="l00631"></a>00631 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
+<a name="l00632"></a>00632 <span class="comment">// process data & noise</span>
+<a name="l00633"></a>00633 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
+<a name="l00634"></a>00634 KMO_TRY_EXIT_IF_NULL(
+<a name="l00635"></a>00635 op1_noise_2d = kmo_dfs_load_image(frameset,
+<a name="l00636"></a>00636 <span class="stringliteral">"0"</span>, i, TRUE, FALSE, NULL));
+<a name="l00637"></a>00637 }
+<a name="l00638"></a>00638 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00639"></a>00639 kmo_arithmetic_2D_scalar(op1_2d,
+<a name="l00640"></a>00640 op2_scalar,
+<a name="l00641"></a>00641 op1_noise_2d,
+<a name="l00642"></a>00642 op));
+<a name="l00643"></a>00643 }
+<a name="l00644"></a>00644
+<a name="l00645"></a>00645 <span class="comment">// save data (and noise)</span>
+<a name="l00646"></a>00646 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00647"></a>00647 kmo_dfs_save_image(op1_2d, fn_out, <span class="stringliteral">""</span>,
+<a name="l00648"></a>00648 sub_header_data, 0./0.));
+<a name="l00649"></a>00649
+<a name="l00650"></a>00650 <span class="keywordflow">if</span> (op1_noise_2d != NULL) {
+<a name="l00651"></a>00651 KMO_TRY_EXIT_IF_NULL(
+<a name="l00652"></a>00652 sub_header_noise = kmo_dfs_load_sub_header(frameset,
+<a name="l00653"></a>00653 <span class="stringliteral">"0"</span>, i, TRUE));
+<a name="l00654"></a>00654 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00655"></a>00655 kmo_dfs_save_image(op1_noise_2d, fn_out, <span class="stringliteral">""</span>,
+<a name="l00656"></a>00656 sub_header_noise, 0./0.));
+<a name="l00657"></a>00657
+<a name="l00658"></a>00658 cpl_propertylist_delete(sub_header_noise);
+<a name="l00659"></a>00659 sub_header_noise = NULL;
+<a name="l00660"></a>00660 }
+<a name="l00661"></a>00661 <span class="keywordflow">break</span>;
+<a name="l00662"></a>00662 <span class="keywordflow">case</span> f3i_fits:
+<a name="l00663"></a>00663 calc_f3i = FALSE;
+<a name="l00664"></a>00664
+<a name="l00665"></a>00665 <span class="comment">// check if IFUs are valid</span>
+<a name="l00666"></a>00666 <span class="keywordflow">if</span> (desc1.ex_noise == FALSE) {
+<a name="l00667"></a>00667 <span class="keywordflow">if</span> (desc1.sub_desc[i - 1].valid_data == TRUE) {
+<a name="l00668"></a>00668 <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
+<a name="l00669"></a>00669 calc_f3i = TRUE;
+<a name="l00670"></a>00670 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (((single_ifu == TRUE) &&
+<a name="l00671"></a>00671 (desc2.sub_desc[0].valid_data == TRUE))
+<a name="l00672"></a>00672 ||
+<a name="l00673"></a>00673 (desc2.sub_desc[i - 1].valid_data == TRUE))
+<a name="l00674"></a>00674 {
+<a name="l00675"></a>00675 calc_f3i = TRUE;
+<a name="l00676"></a>00676 }
+<a name="l00677"></a>00677 }
+<a name="l00678"></a>00678 }
+<a name="l00679"></a>00679 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
+<a name="l00680"></a>00680 <span class="keywordflow">if</span> (desc1.sub_desc[2 * i - 1].valid_data == TRUE) {
+<a name="l00681"></a>00681 calc_f3i = TRUE;
+<a name="l00682"></a>00682 }
+<a name="l00683"></a>00683 }
+<a name="l00684"></a>00684 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) && (desc2.ex_noise == TRUE)) {
+<a name="l00685"></a>00685 <span class="keywordflow">if</span> (desc1.sub_desc[2 * i - 1].valid_data == TRUE) {
+<a name="l00686"></a>00686 <span class="keywordflow">if</span> (((single_ifu == TRUE) &&
+<a name="l00687"></a>00687 (desc2.sub_desc[1].valid_data == TRUE))
+<a name="l00688"></a>00688 ||
+<a name="l00689"></a>00689 (desc2.sub_desc[2 * i - 1].valid_data == TRUE))
+<a name="l00690"></a>00690 {
+<a name="l00691"></a>00691 calc_f3i = TRUE;
+<a name="l00692"></a>00692 }
+<a name="l00693"></a>00693 }
+<a name="l00694"></a>00694 }
+<a name="l00695"></a>00695 <span class="keywordflow">if</span> ((single_ifu == TRUE) && (desc1.ex_noise == FALSE)) {
+<a name="l00696"></a>00696 <span class="keywordflow">if</span> ((desc1.sub_desc[i - 1].valid_data == TRUE) &&
+<a name="l00697"></a>00697 (desc2.sub_desc[0].valid_data == TRUE)) {
+<a name="l00698"></a>00698 calc_f3i = TRUE;
+<a name="l00699"></a>00699 }
+<a name="l00700"></a>00700 }
+<a name="l00701"></a>00701
+<a name="l00702"></a>00702 <span class="keywordflow">if</span> (calc_f3i == TRUE)
+<a name="l00703"></a>00703 {
+<a name="l00704"></a>00704 KMO_TRY_EXIT_IF_NULL(
+<a name="l00705"></a>00705 op1_3d = kmo_dfs_load_cube(frameset, <span class="stringliteral">"0"</span>,
+<a name="l00706"></a>00706 devnr1, FALSE));
+<a name="l00707"></a>00707 <span class="comment">//</span>
+<a name="l00708"></a>00708 <span class="comment">// process F3I & F3I</span>
+<a name="l00709"></a>00709 <span class="comment">//</span>
+<a name="l00710"></a>00710 <span class="keywordflow">if</span> (desc2.fits_type == f3i_fits) {
+<a name="l00711"></a>00711 <span class="keywordflow">if</span> (single_ifu == FALSE) {
+<a name="l00712"></a>00712 KMO_TRY_EXIT_IF_NULL(
+<a name="l00713"></a>00713 op2_3d = kmo_dfs_load_cube(frameset,
+<a name="l00714"></a>00714 <span class="stringliteral">"1"</span>, devnr2,
+<a name="l00715"></a>00715 FALSE));
+<a name="l00716"></a>00716 }
+<a name="l00717"></a>00717
+<a name="l00718"></a>00718 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
+<a name="l00719"></a>00719 (desc2.ex_noise == TRUE))
+<a name="l00720"></a>00720 {
+<a name="l00721"></a>00721 KMO_TRY_EXIT_IF_NULL(
+<a name="l00722"></a>00722 op1_noise_3d = kmo_dfs_load_cube(frameset,
+<a name="l00723"></a>00723 <span class="stringliteral">"0"</span>, devnr1,
+<a name="l00724"></a>00724 TRUE));
+<a name="l00725"></a>00725
+<a name="l00726"></a>00726 <span class="keywordflow">if</span> (single_ifu == FALSE) {
+<a name="l00727"></a>00727 KMO_TRY_EXIT_IF_NULL(
+<a name="l00728"></a>00728 op2_noise_3d = kmo_dfs_load_cube(
+<a name="l00729"></a>00729 frameset,
+<a name="l00730"></a>00730 <span class="stringliteral">"1"</span>, devnr2,
+<a name="l00731"></a>00731 TRUE));
+<a name="l00732"></a>00732 }
+<a name="l00733"></a>00733 }
+<a name="l00734"></a>00734
+<a name="l00735"></a>00735 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00736"></a>00736 kmo_arithmetic_3D_3D(op1_3d, op2_3d,
+<a name="l00737"></a>00737 op1_noise_3d, op2_noise_3d,
+<a name="l00738"></a>00738 op));
+<a name="l00739"></a>00739 }
+<a name="l00740"></a>00740
+<a name="l00741"></a>00741 <span class="comment">//</span>
+<a name="l00742"></a>00742 <span class="comment">// process F3I & F2I</span>
+<a name="l00743"></a>00743 <span class="comment">//</span>
+<a name="l00744"></a>00744 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (desc2.fits_type == f2i_fits) {
+<a name="l00745"></a>00745 <span class="keywordflow">if</span> (single_ifu == FALSE) {
+<a name="l00746"></a>00746 KMO_TRY_EXIT_IF_NULL(
+<a name="l00747"></a>00747 op2_2d = kmo_dfs_load_image(frameset,
+<a name="l00748"></a>00748 <span class="stringliteral">"1"</span>, devnr2,
+<a name="l00749"></a>00749 FALSE, FALSE, NULL));
+<a name="l00750"></a>00750 }
+<a name="l00751"></a>00751
+<a name="l00752"></a>00752 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
+<a name="l00753"></a>00753 (desc2.ex_noise == TRUE))
+<a name="l00754"></a>00754 {
+<a name="l00755"></a>00755 KMO_TRY_EXIT_IF_NULL(
+<a name="l00756"></a>00756 op1_noise_3d = kmo_dfs_load_cube(frameset,
+<a name="l00757"></a>00757 <span class="stringliteral">"0"</span>, devnr1,
+<a name="l00758"></a>00758 TRUE));
+<a name="l00759"></a>00759
+<a name="l00760"></a>00760 <span class="keywordflow">if</span> (single_ifu == FALSE) {
+<a name="l00761"></a>00761 KMO_TRY_EXIT_IF_NULL(
+<a name="l00762"></a>00762 op2_noise_2d = kmo_dfs_load_image(
+<a name="l00763"></a>00763 frameset,
+<a name="l00764"></a>00764 <span class="stringliteral">"1"</span>, devnr2,
+<a name="l00765"></a>00765 TRUE, FALSE, NULL));
+<a name="l00766"></a>00766 }
+<a name="l00767"></a>00767 }
+<a name="l00768"></a>00768
+<a name="l00769"></a>00769 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00770"></a>00770 kmo_arithmetic_3D_2D(op1_3d, op2_2d,
+<a name="l00771"></a>00771 op1_noise_3d, op2_noise_2d,
+<a name="l00772"></a>00772 op));
+<a name="l00773"></a>00773 }
+<a name="l00774"></a>00774 <span class="comment">//</span>
+<a name="l00775"></a>00775 <span class="comment">// process F3I & F1I</span>
+<a name="l00776"></a>00776 <span class="comment">//</span>
+<a name="l00777"></a>00777 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (desc2.fits_type == f1i_fits) {
+<a name="l00778"></a>00778 <span class="keywordflow">if</span> (single_ifu == FALSE) {
+<a name="l00779"></a>00779 KMO_TRY_EXIT_IF_NULL(
+<a name="l00780"></a>00780 op2_1d = kmo_dfs_load_vector(frameset,
+<a name="l00781"></a>00781 <span class="stringliteral">"1"</span>, devnr2,
+<a name="l00782"></a>00782 FALSE));
+<a name="l00783"></a>00783 }
+<a name="l00784"></a>00784
+<a name="l00785"></a>00785 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
+<a name="l00786"></a>00786 (desc2.ex_noise == TRUE))
+<a name="l00787"></a>00787 {
+<a name="l00788"></a>00788 KMO_TRY_EXIT_IF_NULL(
+<a name="l00789"></a>00789 op1_noise_3d = kmo_dfs_load_cube(frameset,
+<a name="l00790"></a>00790 <span class="stringliteral">"0"</span>, devnr1,
+<a name="l00791"></a>00791 TRUE));
+<a name="l00792"></a>00792
+<a name="l00793"></a>00793 <span class="keywordflow">if</span> (single_ifu == FALSE) {
+<a name="l00794"></a>00794 KMO_TRY_EXIT_IF_NULL(
+<a name="l00795"></a>00795 op2_noise_1d = kmo_dfs_load_vector(
+<a name="l00796"></a>00796 frameset,
+<a name="l00797"></a>00797 <span class="stringliteral">"1"</span>, devnr2,
+<a name="l00798"></a>00798 TRUE));
+<a name="l00799"></a>00799 }
+<a name="l00800"></a>00800 }
+<a name="l00801"></a>00801
+<a name="l00802"></a>00802 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00803"></a>00803 kmo_arithmetic_3D_1D(op1_3d, op2_1d,
+<a name="l00804"></a>00804 op1_noise_3d, op2_noise_1d,
+<a name="l00805"></a>00805 op));
+<a name="l00806"></a>00806 }
+<a name="l00807"></a>00807 <span class="comment">//</span>
+<a name="l00808"></a>00808 <span class="comment">// process F3I & scalar</span>
+<a name="l00809"></a>00809 <span class="comment">//</span>
+<a name="l00810"></a>00810 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
+<a name="l00811"></a>00811 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
+<a name="l00812"></a>00812 KMO_TRY_EXIT_IF_NULL(
+<a name="l00813"></a>00813 op1_noise_3d = kmo_dfs_load_cube(frameset,
+<a name="l00814"></a>00814 <span class="stringliteral">"0"</span>, devnr1,
+<a name="l00815"></a>00815 TRUE));
+<a name="l00816"></a>00816 }
+<a name="l00817"></a>00817
+<a name="l00818"></a>00818 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00819"></a>00819 kmo_arithmetic_3D_scalar(op1_3d,
+<a name="l00820"></a>00820 op2_scalar,
+<a name="l00821"></a>00821 op1_noise_3d,
+<a name="l00822"></a>00822 op));
+<a name="l00823"></a>00823 }
+<a name="l00824"></a>00824
+<a name="l00825"></a>00825 <span class="comment">// save data (and noise)</span>
+<a name="l00826"></a>00826 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00827"></a>00827 kmo_dfs_save_cube(op1_3d, fn_out, <span class="stringliteral">""</span>,
+<a name="l00828"></a>00828 sub_header_data, 0./0.));
+<a name="l00829"></a>00829
+<a name="l00830"></a>00830 <span class="keywordflow">if</span> (op1_noise_3d != NULL) {
+<a name="l00831"></a>00831 KMO_TRY_EXIT_IF_NULL(
+<a name="l00832"></a>00832 sub_header_noise = kmo_dfs_load_sub_header(
+<a name="l00833"></a>00833 frameset,
+<a name="l00834"></a>00834 <span class="stringliteral">"0"</span>, devnr1,
+<a name="l00835"></a>00835 TRUE));
+<a name="l00836"></a>00836
+<a name="l00837"></a>00837 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00838"></a>00838 kmo_dfs_save_cube(op1_noise_3d, fn_out, <span class="stringliteral">""</span>,
+<a name="l00839"></a>00839 sub_header_noise, 0./0.));
+<a name="l00840"></a>00840
+<a name="l00841"></a>00841 cpl_propertylist_delete(sub_header_noise);
+<a name="l00842"></a>00842 sub_header_noise = NULL;
+<a name="l00843"></a>00843 }
+<a name="l00844"></a>00844 } <span class="keywordflow">else</span> {
+<a name="l00845"></a>00845 <span class="comment">//</span>
+<a name="l00846"></a>00846 <span class="comment">// invalid IFU, just save sub_header</span>
+<a name="l00847"></a>00847 <span class="comment">//</span>
+<a name="l00848"></a>00848 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00849"></a>00849 kmo_dfs_save_sub_header(fn_out, <span class="stringliteral">""</span>,
+<a name="l00850"></a>00850 sub_header_data));
+<a name="l00851"></a>00851
+<a name="l00852"></a>00852 <span class="comment">// save noise if it has been calculated</span>
+<a name="l00853"></a>00853 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
+<a name="l00854"></a>00854 ((((desc2.fits_type == f3i_fits) ||
+<a name="l00855"></a>00855 (desc2.fits_type == f2i_fits) ||
+<a name="l00856"></a>00856 (desc2.fits_type == f1i_fits)
+<a name="l00857"></a>00857 ) &&
+<a name="l00858"></a>00858 (desc2.ex_noise == TRUE)
+<a name="l00859"></a>00859 ) ||
+<a name="l00860"></a>00860 (op2_scalar != -DBL_MAX)
+<a name="l00861"></a>00861 )
+<a name="l00862"></a>00862 )
+<a name="l00863"></a>00863 {
+<a name="l00864"></a>00864
+<a name="l00865"></a>00865 KMO_TRY_EXIT_IF_NULL(
+<a name="l00866"></a>00866 sub_header_noise = kmo_dfs_load_sub_header(
+<a name="l00867"></a>00867 frameset,
+<a name="l00868"></a>00868 <span class="stringliteral">"0"</span>, devnr1,
+<a name="l00869"></a>00869 TRUE));
+<a name="l00870"></a>00870 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00871"></a>00871 kmo_dfs_save_sub_header(fn_out, <span class="stringliteral">""</span>,
+<a name="l00872"></a>00872 sub_header_noise));
+<a name="l00873"></a>00873
+<a name="l00874"></a>00874 cpl_propertylist_delete(sub_header_noise);
+<a name="l00875"></a>00875 sub_header_noise = NULL;
+<a name="l00876"></a>00876 }
+<a name="l00877"></a>00877 }
+<a name="l00878"></a>00878 <span class="keywordflow">break</span>;
+<a name="l00879"></a>00879 <span class="keywordflow">case</span> f2i_fits:
+<a name="l00880"></a>00880 calc_f2i = FALSE;
+<a name="l00881"></a>00881
+<a name="l00882"></a>00882 <span class="comment">// check if IFUs are valid</span>
+<a name="l00883"></a>00883 <span class="keywordflow">if</span> (desc1.ex_noise == FALSE) {
+<a name="l00884"></a>00884 <span class="keywordflow">if</span> (desc1.sub_desc[i - 1].valid_data == TRUE) {
+<a name="l00885"></a>00885 <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
+<a name="l00886"></a>00886 calc_f2i = TRUE;
+<a name="l00887"></a>00887 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (((single_ifu == TRUE) &&
+<a name="l00888"></a>00888 (desc2.sub_desc[0].valid_data == TRUE))
+<a name="l00889"></a>00889 ||
+<a name="l00890"></a>00890 (desc2.sub_desc[i - 1].valid_data == TRUE))
+<a name="l00891"></a>00891 {
+<a name="l00892"></a>00892 calc_f2i = TRUE;
+<a name="l00893"></a>00893 }
+<a name="l00894"></a>00894 }
+<a name="l00895"></a>00895 }
+<a name="l00896"></a>00896 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
+<a name="l00897"></a>00897 <span class="keywordflow">if</span> (desc1.sub_desc[2 * i - 1].valid_data == TRUE) {
+<a name="l00898"></a>00898 calc_f2i = TRUE;
+<a name="l00899"></a>00899 }
+<a name="l00900"></a>00900 }
+<a name="l00901"></a>00901 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) && (desc2.ex_noise == TRUE)) {
+<a name="l00902"></a>00902 <span class="keywordflow">if</span> (desc1.sub_desc[2 * i - 1].valid_data == TRUE) {
+<a name="l00903"></a>00903 <span class="keywordflow">if</span> (((single_ifu == TRUE) &&
+<a name="l00904"></a>00904 (desc2.sub_desc[1].valid_data == TRUE))
+<a name="l00905"></a>00905 ||
+<a name="l00906"></a>00906 (desc2.sub_desc[2 * i - 1].valid_data == TRUE))
+<a name="l00907"></a>00907 {
+<a name="l00908"></a>00908 calc_f2i = TRUE;
+<a name="l00909"></a>00909 }
+<a name="l00910"></a>00910 }
+<a name="l00911"></a>00911 }
+<a name="l00912"></a>00912 <span class="keywordflow">if</span> ((single_ifu == TRUE) && (desc1.ex_noise == FALSE)) {
+<a name="l00913"></a>00913 <span class="keywordflow">if</span> ((desc1.sub_desc[i - 1].valid_data == TRUE) &&
+<a name="l00914"></a>00914 (desc2.sub_desc[0].valid_data == TRUE)) {
+<a name="l00915"></a>00915 calc_f2i = TRUE;
+<a name="l00916"></a>00916 }
+<a name="l00917"></a>00917 }
+<a name="l00918"></a>00918
+<a name="l00919"></a>00919 <span class="keywordflow">if</span> (calc_f2i == TRUE)
+<a name="l00920"></a>00920 {
+<a name="l00921"></a>00921 KMO_TRY_EXIT_IF_NULL(
+<a name="l00922"></a>00922 op1_2d = kmo_dfs_load_image(frameset, <span class="stringliteral">"0"</span>,
+<a name="l00923"></a>00923 devnr1, FALSE, FALSE, NULL));
+<a name="l00924"></a>00924 <span class="comment">//</span>
+<a name="l00925"></a>00925 <span class="comment">// process F2I & F2I</span>
+<a name="l00926"></a>00926 <span class="comment">//</span>
+<a name="l00927"></a>00927 <span class="keywordflow">if</span> (desc2.fits_type == f2i_fits) {
+<a name="l00928"></a>00928 <span class="keywordflow">if</span> (single_ifu == FALSE) {
+<a name="l00929"></a>00929 KMO_TRY_EXIT_IF_NULL(
+<a name="l00930"></a>00930 op2_2d = kmo_dfs_load_image(frameset, <span class="stringliteral">"1"</span>,
+<a name="l00931"></a>00931 devnr2, FALSE, FALSE, NULL));
+<a name="l00932"></a>00932 }
+<a name="l00933"></a>00933
+<a name="l00934"></a>00934 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
+<a name="l00935"></a>00935 (desc2.ex_noise == TRUE))
+<a name="l00936"></a>00936 {
+<a name="l00937"></a>00937 KMO_TRY_EXIT_IF_NULL(
+<a name="l00938"></a>00938 op1_noise_2d = kmo_dfs_load_image(
+<a name="l00939"></a>00939 frameset, <span class="stringliteral">"0"</span>,
+<a name="l00940"></a>00940 devnr1, TRUE, FALSE, NULL));
+<a name="l00941"></a>00941
+<a name="l00942"></a>00942 <span class="keywordflow">if</span> (single_ifu == FALSE) {
+<a name="l00943"></a>00943 KMO_TRY_EXIT_IF_NULL(
+<a name="l00944"></a>00944 op2_noise_2d = kmo_dfs_load_image(
+<a name="l00945"></a>00945 frameset, <span class="stringliteral">"1"</span>,
+<a name="l00946"></a>00946 devnr2, TRUE, FALSE, NULL));
+<a name="l00947"></a>00947 }
+<a name="l00948"></a>00948 }
+<a name="l00949"></a>00949
+<a name="l00950"></a>00950 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00951"></a>00951 kmo_arithmetic_2D_2D(op1_2d, op2_2d,
+<a name="l00952"></a>00952 op1_noise_2d, op2_noise_2d,
+<a name="l00953"></a>00953 op));
+<a name="l00954"></a>00954 }
+<a name="l00955"></a>00955 <span class="comment">//</span>
+<a name="l00956"></a>00956 <span class="comment">// process F2I & scalar</span>
+<a name="l00957"></a>00957 <span class="comment">//</span>
+<a name="l00958"></a>00958 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
+<a name="l00959"></a>00959 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
+<a name="l00960"></a>00960 KMO_TRY_EXIT_IF_NULL(
+<a name="l00961"></a>00961 op1_noise_2d = kmo_dfs_load_image(
+<a name="l00962"></a>00962 frameset, <span class="stringliteral">"0"</span>,
+<a name="l00963"></a>00963 devnr1, TRUE, FALSE, NULL));
+<a name="l00964"></a>00964 }
+<a name="l00965"></a>00965
+<a name="l00966"></a>00966 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00967"></a>00967 kmo_arithmetic_2D_scalar(op1_2d,
+<a name="l00968"></a>00968 op2_scalar,
+<a name="l00969"></a>00969 op1_noise_2d,
+<a name="l00970"></a>00970 op));
+<a name="l00971"></a>00971 }
+<a name="l00972"></a>00972
+<a name="l00973"></a>00973 <span class="comment">// save data (and noise)</span>
+<a name="l00974"></a>00974 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00975"></a>00975 kmo_dfs_save_image(op1_2d, fn_out, <span class="stringliteral">""</span>,
+<a name="l00976"></a>00976 sub_header_data, 0./0.));
+<a name="l00977"></a>00977
+<a name="l00978"></a>00978 <span class="keywordflow">if</span> (op1_noise_2d != NULL) {
+<a name="l00979"></a>00979 KMO_TRY_EXIT_IF_NULL(
+<a name="l00980"></a>00980 sub_header_noise = kmo_dfs_load_sub_header(
+<a name="l00981"></a>00981 frameset, <span class="stringliteral">"0"</span>,
+<a name="l00982"></a>00982 devnr1, TRUE));
+<a name="l00983"></a>00983
+<a name="l00984"></a>00984 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00985"></a>00985 kmo_dfs_save_image(op1_noise_2d, fn_out, <span class="stringliteral">""</span>,
+<a name="l00986"></a>00986 sub_header_noise, 0./0.));
+<a name="l00987"></a>00987
+<a name="l00988"></a>00988 cpl_propertylist_delete(sub_header_noise);
+<a name="l00989"></a>00989 sub_header_noise = NULL;
+<a name="l00990"></a>00990 }
+<a name="l00991"></a>00991 } <span class="keywordflow">else</span> {
+<a name="l00992"></a>00992 <span class="comment">//</span>
+<a name="l00993"></a>00993 <span class="comment">// invalid IFU, just save sub_header</span>
+<a name="l00994"></a>00994 <span class="comment">//</span>
+<a name="l00995"></a>00995 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00996"></a>00996 kmo_dfs_save_sub_header(fn_out, <span class="stringliteral">""</span>, sub_header_data));
+<a name="l00997"></a>00997
+<a name="l00998"></a>00998 <span class="comment">// save noise if it has been calculated</span>
+<a name="l00999"></a>00999 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE)
+<a name="l01000"></a>01000 &&
+<a name="l01001"></a>01001 (((desc2.fits_type == f2i_fits) && (desc2.ex_noise == TRUE)) ||
+<a name="l01002"></a>01002 (op2_scalar != -DBL_MAX)))
+<a name="l01003"></a>01003 {
+<a name="l01004"></a>01004
+<a name="l01005"></a>01005 KMO_TRY_EXIT_IF_NULL(
+<a name="l01006"></a>01006 sub_header_noise = kmo_dfs_load_sub_header(
+<a name="l01007"></a>01007 frameset,
+<a name="l01008"></a>01008 <span class="stringliteral">"0"</span>, devnr1,
+<a name="l01009"></a>01009 TRUE));
+<a name="l01010"></a>01010 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01011"></a>01011 kmo_dfs_save_sub_header(fn_out, <span class="stringliteral">""</span>, sub_header_noise));
+<a name="l01012"></a>01012
+<a name="l01013"></a>01013 cpl_propertylist_delete(sub_header_noise);
+<a name="l01014"></a>01014 sub_header_noise = NULL;
+<a name="l01015"></a>01015 }
+<a name="l01016"></a>01016 }
+<a name="l01017"></a>01017 <span class="keywordflow">break</span>;
+<a name="l01018"></a>01018 <span class="keywordflow">case</span> f1i_fits:
+<a name="l01019"></a>01019 calc_f1i = FALSE;
+<a name="l01020"></a>01020
+<a name="l01021"></a>01021 <span class="comment">// check if IFUs are valid</span>
+<a name="l01022"></a>01022 <span class="keywordflow">if</span> (desc1.ex_noise == FALSE) {
+<a name="l01023"></a>01023 <span class="keywordflow">if</span> (desc1.sub_desc[i - 1].valid_data == TRUE) {
+<a name="l01024"></a>01024 <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
+<a name="l01025"></a>01025 calc_f1i = TRUE;
+<a name="l01026"></a>01026 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (((single_ifu == TRUE) &&
+<a name="l01027"></a>01027 (desc2.sub_desc[0].valid_data == TRUE))
+<a name="l01028"></a>01028 ||
+<a name="l01029"></a>01029 (desc2.sub_desc[i - 1].valid_data == TRUE))
+<a name="l01030"></a>01030 {
+<a name="l01031"></a>01031 calc_f1i = TRUE;
+<a name="l01032"></a>01032 }
+<a name="l01033"></a>01033 }
+<a name="l01034"></a>01034 }
+<a name="l01035"></a>01035 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
+<a name="l01036"></a>01036 <span class="keywordflow">if</span> (desc1.sub_desc[2 * i - 1].valid_data == TRUE) {
+<a name="l01037"></a>01037 calc_f1i = TRUE;
+<a name="l01038"></a>01038 }
+<a name="l01039"></a>01039 }
+<a name="l01040"></a>01040 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) && (desc2.ex_noise == TRUE)) {
+<a name="l01041"></a>01041 <span class="keywordflow">if</span> (desc1.sub_desc[2 * i - 1].valid_data == TRUE) {
+<a name="l01042"></a>01042 <span class="keywordflow">if</span> (((single_ifu == TRUE) &&
+<a name="l01043"></a>01043 (desc2.sub_desc[1].valid_data == TRUE))
+<a name="l01044"></a>01044 ||
+<a name="l01045"></a>01045 (desc2.sub_desc[2 * i - 1].valid_data == TRUE))
+<a name="l01046"></a>01046 {
+<a name="l01047"></a>01047 calc_f1i = TRUE;
+<a name="l01048"></a>01048 }
+<a name="l01049"></a>01049 }
+<a name="l01050"></a>01050 }
+<a name="l01051"></a>01051 <span class="keywordflow">if</span> ((single_ifu == TRUE) && (desc1.ex_noise == FALSE)) {
+<a name="l01052"></a>01052 <span class="keywordflow">if</span> ((desc1.sub_desc[i - 1].valid_data == TRUE) &&
+<a name="l01053"></a>01053 (desc2.sub_desc[0].valid_data == TRUE)) {
+<a name="l01054"></a>01054 calc_f1i = TRUE;
+<a name="l01055"></a>01055 }
+<a name="l01056"></a>01056 }
+<a name="l01057"></a>01057
+<a name="l01058"></a>01058 <span class="keywordflow">if</span> (calc_f1i == TRUE)
+<a name="l01059"></a>01059 {
+<a name="l01060"></a>01060 KMO_TRY_EXIT_IF_NULL(
+<a name="l01061"></a>01061 op1_1d = kmo_dfs_load_vector(frameset, <span class="stringliteral">"0"</span>,
+<a name="l01062"></a>01062 devnr1, FALSE));
+<a name="l01063"></a>01063 <span class="comment">//</span>
+<a name="l01064"></a>01064 <span class="comment">// process F1I & F1I</span>
+<a name="l01065"></a>01065 <span class="comment">//</span>
+<a name="l01066"></a>01066 <span class="keywordflow">if</span> (desc2.fits_type == f1i_fits) {
+<a name="l01067"></a>01067 <span class="keywordflow">if</span> (single_ifu == FALSE) {
+<a name="l01068"></a>01068 KMO_TRY_EXIT_IF_NULL(
+<a name="l01069"></a>01069 op2_1d = kmo_dfs_load_vector(frameset, <span class="stringliteral">"1"</span>,
+<a name="l01070"></a>01070 devnr2, FALSE));
+<a name="l01071"></a>01071 }
+<a name="l01072"></a>01072
+<a name="l01073"></a>01073 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE) &&
+<a name="l01074"></a>01074 (desc2.ex_noise == TRUE))
+<a name="l01075"></a>01075 {
+<a name="l01076"></a>01076 KMO_TRY_EXIT_IF_NULL(
+<a name="l01077"></a>01077 op1_noise_1d = kmo_dfs_load_vector(
+<a name="l01078"></a>01078 frameset, <span class="stringliteral">"0"</span>,
+<a name="l01079"></a>01079 devnr1, TRUE));
+<a name="l01080"></a>01080
+<a name="l01081"></a>01081 <span class="keywordflow">if</span> (single_ifu == FALSE) {
+<a name="l01082"></a>01082 KMO_TRY_EXIT_IF_NULL(
+<a name="l01083"></a>01083 op2_noise_1d = kmo_dfs_load_vector(
+<a name="l01084"></a>01084 frameset, <span class="stringliteral">"1"</span>,
+<a name="l01085"></a>01085 devnr2, TRUE));
+<a name="l01086"></a>01086 }
+<a name="l01087"></a>01087 }
+<a name="l01088"></a>01088
+<a name="l01089"></a>01089 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01090"></a>01090 kmo_arithmetic_1D_1D(op1_1d, op2_1d,
+<a name="l01091"></a>01091 op1_noise_1d, op2_noise_1d,
+<a name="l01092"></a>01092 op));
+<a name="l01093"></a>01093 }
+<a name="l01094"></a>01094 <span class="comment">//</span>
+<a name="l01095"></a>01095 <span class="comment">// process F1I & scalar</span>
+<a name="l01096"></a>01096 <span class="comment">//</span>
+<a name="l01097"></a>01097 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (op2_scalar != -DBL_MAX) {
+<a name="l01098"></a>01098 <span class="keywordflow">if</span> (desc1.ex_noise == TRUE) {
+<a name="l01099"></a>01099 KMO_TRY_EXIT_IF_NULL(
+<a name="l01100"></a>01100 op1_noise_1d = kmo_dfs_load_vector(
+<a name="l01101"></a>01101 frameset, <span class="stringliteral">"0"</span>,
+<a name="l01102"></a>01102 devnr1, TRUE));
+<a name="l01103"></a>01103 }
+<a name="l01104"></a>01104
+<a name="l01105"></a>01105 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01106"></a>01106 kmo_arithmetic_1D_scalar(op1_1d,
+<a name="l01107"></a>01107 op2_scalar,
+<a name="l01108"></a>01108 op1_noise_1d,
+<a name="l01109"></a>01109 op));
+<a name="l01110"></a>01110 }
+<a name="l01111"></a>01111
+<a name="l01112"></a>01112 <span class="comment">// save data (and noise)</span>
+<a name="l01113"></a>01113 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01114"></a>01114 kmo_dfs_save_vector(op1_1d, fn_out, <span class="stringliteral">""</span>,
+<a name="l01115"></a>01115 sub_header_data, 0./0.));
+<a name="l01116"></a>01116
+<a name="l01117"></a>01117 <span class="keywordflow">if</span> (op1_noise_1d != NULL) {
+<a name="l01118"></a>01118 KMO_TRY_EXIT_IF_NULL(
+<a name="l01119"></a>01119 sub_header_noise = kmo_dfs_load_sub_header(
+<a name="l01120"></a>01120 frameset, <span class="stringliteral">"0"</span>,
+<a name="l01121"></a>01121 devnr1, TRUE));
+<a name="l01122"></a>01122
+<a name="l01123"></a>01123 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01124"></a>01124 kmo_dfs_save_vector(op1_noise_1d, fn_out, <span class="stringliteral">""</span>,
+<a name="l01125"></a>01125 sub_header_noise, 0./0.));
+<a name="l01126"></a>01126
+<a name="l01127"></a>01127 cpl_propertylist_delete(sub_header_noise);
+<a name="l01128"></a>01128 sub_header_noise = NULL;
+<a name="l01129"></a>01129 }
+<a name="l01130"></a>01130 } <span class="keywordflow">else</span> {
+<a name="l01131"></a>01131 <span class="comment">//</span>
+<a name="l01132"></a>01132 <span class="comment">// invalid IFU, just save sub_header</span>
+<a name="l01133"></a>01133 <span class="comment">//</span>
+<a name="l01134"></a>01134 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01135"></a>01135 kmo_dfs_save_sub_header(fn_out, <span class="stringliteral">""</span>, sub_header_data));
+<a name="l01136"></a>01136
+<a name="l01137"></a>01137 <span class="comment">// save noise if it has been calculated</span>
+<a name="l01138"></a>01138 <span class="keywordflow">if</span> ((desc1.ex_noise == TRUE)
+<a name="l01139"></a>01139 &&
+<a name="l01140"></a>01140 (((desc2.fits_type == f2i_fits) && (desc2.ex_noise == TRUE)) ||
+<a name="l01141"></a>01141 (op2_scalar != -DBL_MAX)))
+<a name="l01142"></a>01142 {
+<a name="l01143"></a>01143
+<a name="l01144"></a>01144 KMO_TRY_EXIT_IF_NULL(
+<a name="l01145"></a>01145 sub_header_noise = kmo_dfs_load_sub_header(
+<a name="l01146"></a>01146 frameset,
+<a name="l01147"></a>01147 <span class="stringliteral">"0"</span>, devnr1,
+<a name="l01148"></a>01148 TRUE));
+<a name="l01149"></a>01149 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01150"></a>01150 kmo_dfs_save_sub_header(fn_out, <span class="stringliteral">""</span>,
+<a name="l01151"></a>01151 sub_header_noise));
+<a name="l01152"></a>01152
+<a name="l01153"></a>01153 cpl_propertylist_delete(sub_header_noise);
+<a name="l01154"></a>01154 sub_header_noise = NULL;
+<a name="l01155"></a>01155 }
+<a name="l01156"></a>01156 }
+<a name="l01157"></a>01157 <span class="keywordflow">break</span>;
+<a name="l01158"></a>01158 <span class="keywordflow">default</span>:
+<a name="l01159"></a>01159 <span class="keywordflow">break</span>;
+<a name="l01160"></a>01160 }
+<a name="l01161"></a>01161
+<a name="l01162"></a>01162 cpl_propertylist_delete(sub_header_data); sub_header_data = NULL;
+<a name="l01163"></a>01163
+<a name="l01164"></a>01164 cpl_image_delete(op1_2d); op1_2d = NULL;
+<a name="l01165"></a>01165 cpl_imagelist_delete(op1_3d); op1_3d = NULL;
+<a name="l01166"></a>01166
+<a name="l01167"></a>01167 cpl_image_delete(op1_noise_2d); op1_noise_2d = NULL;
+<a name="l01168"></a>01168 cpl_imagelist_delete(op1_noise_3d); op1_noise_3d = NULL;
+<a name="l01169"></a>01169
+<a name="l01170"></a>01170 <span class="keywordflow">if</span> (single_ifu == FALSE) {
+<a name="l01171"></a>01171 kmclipm_vector_delete(op2_1d); op2_1d = NULL,
+<a name="l01172"></a>01172 cpl_image_delete(op2_2d); op2_2d = NULL;
+<a name="l01173"></a>01173 cpl_imagelist_delete(op2_3d); op2_3d = NULL;
+<a name="l01174"></a>01174
+<a name="l01175"></a>01175 kmclipm_vector_delete(op2_noise_1d); op2_noise_1d = NULL,
+<a name="l01176"></a>01176 cpl_image_delete(op2_noise_2d); op2_noise_2d = NULL;
+<a name="l01177"></a>01177 cpl_imagelist_delete(op2_noise_3d); op2_noise_3d = NULL;
+<a name="l01178"></a>01178 }
+<a name="l01179"></a>01179 }
+<a name="l01180"></a>01180 }
+<a name="l01181"></a>01181 KMO_CATCH
+<a name="l01182"></a>01182 {
+<a name="l01183"></a>01183 KMO_CATCH_MSG();
+<a name="l01184"></a>01184 ret_val = -1;
+<a name="l01185"></a>01185 }
+<a name="l01186"></a>01186
+<a name="l01187"></a>01187 kmo_free_fits_desc(&desc1);
+<a name="l01188"></a>01188 kmo_free_fits_desc(&desc2);
+<a name="l01189"></a>01189 cpl_free(fn_out); fn_out = NULL;
+<a name="l01190"></a>01190 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l01191"></a>01191 cpl_propertylist_delete(sub_header_data); sub_header_data = NULL;
+<a name="l01192"></a>01192 cpl_propertylist_delete(sub_header_noise); sub_header_noise = NULL;
+<a name="l01193"></a>01193 cpl_image_delete(op1_2d); op1_2d = NULL;
+<a name="l01194"></a>01194 cpl_imagelist_delete(op1_3d); op1_3d = NULL;
+<a name="l01195"></a>01195 kmclipm_vector_delete(op2_1d); op2_1d = NULL;
+<a name="l01196"></a>01196 cpl_image_delete(op2_2d); op2_2d = NULL;
+<a name="l01197"></a>01197 cpl_imagelist_delete(op2_3d); op2_3d = NULL;
+<a name="l01198"></a>01198 cpl_image_delete(op1_noise_2d); op1_noise_2d = NULL;
+<a name="l01199"></a>01199 cpl_imagelist_delete(op1_noise_3d); op1_noise_3d = NULL;
+<a name="l01200"></a>01200 kmclipm_vector_delete(op2_noise_1d); op2_noise_1d = NULL;
+<a name="l01201"></a>01201 cpl_image_delete(op2_noise_2d); op2_noise_2d = NULL;
+<a name="l01202"></a>01202 cpl_imagelist_delete(op2_noise_3d); op2_noise_3d = NULL;
+<a name="l01203"></a>01203
+<a name="l01204"></a>01204 <span class="keywordflow">return</span> ret_val;
+<a name="l01205"></a>01205 }
+<a name="l01206"></a>01206
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:50 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:35 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__combine_8c_source.html b/html/kmo__combine_8c_source.html
index 497b181..9fda1e3 100644
--- a/html/kmo__combine_8c_source.html
+++ b/html/kmo__combine_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_combine.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_combine.c,v 1.32 2013/06/27 13:10:21 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_combine.c,v 1.32 2013-06-27 13:10:21 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/06/27 13:10:21 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-06-27 13:10:21 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.32 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -1074,7 +1074,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:50 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:35 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__copy_8c_source.html b/html/kmo__copy_8c_source.html
index 04936dd..4a0611d 100644
--- a/html/kmo__copy_8c_source.html
+++ b/html/kmo__copy_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_copy.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_copy.c,v 1.12 2013/05/21 12:13:58 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_copy.c,v 1.12 2013-05-21 12:13:58 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/05/21 12:13:58 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-05-21 12:13:58 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.12 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -1404,7 +1404,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:50 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:35 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__dark_8c_source.html b/html/kmo__dark_8c_source.html
index 48cc90b..7e27d44 100644
--- a/html/kmo__dark_8c_source.html
+++ b/html/kmo__dark_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_dark.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_dark.c,v 1.21 2013/07/02 09:37:22 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_dark.c,v 1.21 2013-07-02 09:37:22 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/07/02 09:37:22 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-07-02 09:37:22 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.21 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -876,7 +876,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:50 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:35 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__dev__setup_8c_source.html b/html/kmo__dev__setup_8c_source.html
index 5b98d38..333f4fa 100644
--- a/html/kmo__dev__setup_8c_source.html
+++ b/html/kmo__dev__setup_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_dev_setup.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_dev_setup.c,v 1.10 2013/06/18 07:56:47 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_dev_setup.c,v 1.10 2013-06-18 07:56:47 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/06/18 07:56:47 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-06-18 07:56:47 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.10 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -1259,7 +1259,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:50 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__extract__spec_8c_source.html b/html/kmo__extract__spec_8c_source.html
index 80cd7d6..eb3b9f6 100644
--- a/html/kmo__extract__spec_8c_source.html
+++ b/html/kmo__extract__spec_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_extract_spec.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_extract_spec.c,v 1.15 2013/06/07 15:41:20 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_extract_spec.c,v 1.15 2013-06-07 15:41:20 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/06/07 15:41:20 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-06-07 15:41:20 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.15 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -814,7 +814,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:50 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__fit__profile_8c_source.html b/html/kmo__fit__profile_8c_source.html
index a29a645..c097b65 100644
--- a/html/kmo__fit__profile_8c_source.html
+++ b/html/kmo__fit__profile_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_fit_profile.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_fit_profile.c,v 1.10 2013/06/07 15:41:21 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_fit_profile.c,v 1.10 2013-06-07 15:41:21 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/06/07 15:41:21 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-06-07 15:41:21 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.10 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -708,7 +708,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:50 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__fits__check_8c_source.html b/html/kmo__fits__check_8c_source.html
index c28d77b..5962372 100644
--- a/html/kmo__fits__check_8c_source.html
+++ b/html/kmo__fits__check_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_fits_check.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_fits_check.c,v 1.7 2013/05/21 12:13:58 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_fits_check.c,v 1.7 2013-05-21 12:13:58 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/05/21 12:13:58 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-05-21 12:13:58 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.7 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -510,7 +510,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:50 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__fits__stack_8c_source.html b/html/kmo__fits__stack_8c_source.html
index f13ea99..eb6e825 100644
--- a/html/kmo__fits__stack_8c_source.html
+++ b/html/kmo__fits__stack_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_fits_stack.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_fits_stack.c,v 1.8 2013/05/21 12:13:58 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_fits_stack.c,v 1.8 2013-05-21 12:13:58 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/05/21 12:13:58 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-05-21 12:13:58 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.8 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -390,7 +390,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:50 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__fits__strip_8c_source.html b/html/kmo__fits__strip_8c_source.html
index 1ca9900..72381a5 100644
--- a/html/kmo__fits__strip_8c_source.html
+++ b/html/kmo__fits__strip_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -84,7 +84,7 @@
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/08/02 09:09:54 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.14 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -710,94 +710,95 @@
<a name="l00699"></a>00699 desc.frame_type,
<a name="l00700"></a>00700 actDetNr));
<a name="l00701"></a>00701 print_cal_angle_msg_once = FALSE;
-<a name="l00702"></a>00702 KMO_TRY_EXIT_IF_NULL(
-<a name="l00703"></a>00703 img = kmo_dfs_load_cal_image(frameset, <span class="stringliteral">"0"</span>,
-<a name="l00704"></a>00704 i+1, n, angle,
-<a name="l00705"></a>00705 FALSE, NULL,
-<a name="l00706"></a>00706 &ret_angle, -1, 0, 0));
-<a name="l00707"></a>00707
-<a name="l00708"></a>00708 <span class="keywordflow">if</span> (fabs(angle-ret_angle) > 0.01) {
-<a name="l00709"></a>00709 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"Angle provided: %g, angle found: %g"</span>, angle, ret_angle);
-<a name="l00710"></a>00710 }
-<a name="l00711"></a>00711 <span class="keywordflow">if</span> (n == remove_noise) {
-<a name="l00712"></a>00712 actDetNr++;
-<a name="l00713"></a>00713 }
-<a name="l00714"></a>00714 }
-<a name="l00715"></a>00715 <span class="keywordflow">if</span> (img != NULL) {
-<a name="l00716"></a>00716 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00717"></a>00717 kmo_dfs_save_image(img, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
-<a name="l00718"></a>00718 }
-<a name="l00719"></a>00719 } <span class="keywordflow">else</span> {
-<a name="l00720"></a>00720 img = cpl_image_load(filename,CPL_TYPE_FLOAT, 0, index);
-<a name="l00721"></a>00721 <span class="keywordflow">if</span> (CPL_ERROR_NONE != cpl_error_get_code()) {
-<a name="l00722"></a>00722 cpl_error_reset();
-<a name="l00723"></a>00723 <span class="keywordflow">if</span> (!remove_empty) {
-<a name="l00724"></a>00724 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00725"></a>00725 kmo_dfs_save_image(img, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
-<a name="l00726"></a>00726 }
-<a name="l00727"></a>00727 } <span class="keywordflow">else</span> {
-<a name="l00728"></a>00728 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00729"></a>00729 kmo_dfs_save_image(img, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
-<a name="l00730"></a>00730 }
-<a name="l00731"></a>00731 }
-<a name="l00732"></a>00732 cpl_image_delete(img); img = NULL;
-<a name="l00733"></a>00733 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (desc.fits_type == f3i_fits) {
-<a name="l00734"></a>00734 cube = cpl_imagelist_load(filename,CPL_TYPE_FLOAT, index);
-<a name="l00735"></a>00735 <span class="keywordflow">if</span> (CPL_ERROR_NONE != cpl_error_get_code()) {
-<a name="l00736"></a>00736 cpl_error_reset();
-<a name="l00737"></a>00737 <span class="keywordflow">if</span> (!remove_empty) {
-<a name="l00738"></a>00738 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00739"></a>00739 kmo_dfs_save_cube(cube, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
-<a name="l00740"></a>00740 }
-<a name="l00741"></a>00741 } <span class="keywordflow">else</span> {
-<a name="l00742"></a>00742 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00743"></a>00743 kmo_dfs_save_cube(cube, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
-<a name="l00744"></a>00744 }
-<a name="l00745"></a>00745 cpl_imagelist_delete(cube); cube = NULL;
-<a name="l00746"></a>00746 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (desc.fits_type == f1i_fits) {
-<a name="l00747"></a>00747 vec = cpl_vector_load(filename, index);
-<a name="l00748"></a>00748 <span class="keywordflow">if</span> (CPL_ERROR_NONE != cpl_error_get_code()) {
-<a name="l00749"></a>00749 cpl_error_reset();
-<a name="l00750"></a>00750 <span class="keywordflow">if</span> (!remove_empty) {
-<a name="l00751"></a>00751 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00752"></a>00752 kmo_dfs_save_vector(NULL, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
-<a name="l00753"></a>00753 }
-<a name="l00754"></a>00754 } <span class="keywordflow">else</span> {
-<a name="l00755"></a>00755 KMO_TRY_EXIT_IF_NULL(
-<a name="l00756"></a>00756 kv = kmclipm_vector_create(vec));
-<a name="l00757"></a>00757 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00758"></a>00758 kmo_dfs_save_vector(kv, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
-<a name="l00759"></a>00759 }
-<a name="l00760"></a>00760 kmclipm_vector_delete(kv); kv = NULL;
-<a name="l00761"></a>00761 }
-<a name="l00762"></a>00762 } <span class="comment">// if (found_angle)</span>
-<a name="l00763"></a>00763 cpl_propertylist_delete(header); header = NULL;
-<a name="l00764"></a>00764 } <span class="comment">// for (n)</span>
-<a name="l00765"></a>00765 } <span class="comment">// for (i = nr_devices)</span>
-<a name="l00766"></a>00766 } <span class="comment">// if ((!remove_empty) && (!remove_noise) && (!remove_angle))</span>
-<a name="l00767"></a>00767 }
-<a name="l00768"></a>00768 KMO_CATCH
-<a name="l00769"></a>00769 {
-<a name="l00770"></a>00770 KMO_CATCH_MSG();
-<a name="l00771"></a>00771
-<a name="l00772"></a>00772 ret_val = -1;
-<a name="l00773"></a>00773 }
-<a name="l00774"></a>00774
-<a name="l00775"></a>00775 cpl_propertylist_delete(header); header = NULL;
-<a name="l00776"></a>00776 cpl_imagelist_delete(cube); cube = NULL;
-<a name="l00777"></a>00777 cpl_image_delete(img); img = NULL;
-<a name="l00778"></a>00778 kmclipm_vector_delete(kv); kv = NULL;
-<a name="l00779"></a>00779 kmo_free_fits_desc(&desc);
-<a name="l00780"></a>00780 cpl_vector_delete(extension); extension = NULL;
-<a name="l00781"></a>00781
-<a name="l00782"></a>00782 <span class="keywordflow">return</span> ret_val;
-<a name="l00783"></a>00783 }
-<a name="l00784"></a>00784
+<a name="l00702"></a>00702 print_xcal_angle_msg_once = FALSE;
+<a name="l00703"></a>00703 KMO_TRY_EXIT_IF_NULL(
+<a name="l00704"></a>00704 img = kmo_dfs_load_cal_image(frameset, <span class="stringliteral">"0"</span>,
+<a name="l00705"></a>00705 i+1, n, angle,
+<a name="l00706"></a>00706 FALSE, NULL,
+<a name="l00707"></a>00707 &ret_angle, -1, 0, 0));
+<a name="l00708"></a>00708
+<a name="l00709"></a>00709 <span class="keywordflow">if</span> (fabs(angle-ret_angle) > 0.01) {
+<a name="l00710"></a>00710 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"Angle provided: %g, angle found: %g"</span>, angle, ret_angle);
+<a name="l00711"></a>00711 }
+<a name="l00712"></a>00712 <span class="keywordflow">if</span> (n == remove_noise) {
+<a name="l00713"></a>00713 actDetNr++;
+<a name="l00714"></a>00714 }
+<a name="l00715"></a>00715 }
+<a name="l00716"></a>00716 <span class="keywordflow">if</span> (img != NULL) {
+<a name="l00717"></a>00717 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00718"></a>00718 kmo_dfs_save_image(img, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
+<a name="l00719"></a>00719 }
+<a name="l00720"></a>00720 } <span class="keywordflow">else</span> {
+<a name="l00721"></a>00721 img = cpl_image_load(filename,CPL_TYPE_FLOAT, 0, index);
+<a name="l00722"></a>00722 <span class="keywordflow">if</span> (CPL_ERROR_NONE != cpl_error_get_code()) {
+<a name="l00723"></a>00723 cpl_error_reset();
+<a name="l00724"></a>00724 <span class="keywordflow">if</span> (!remove_empty) {
+<a name="l00725"></a>00725 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00726"></a>00726 kmo_dfs_save_image(img, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
+<a name="l00727"></a>00727 }
+<a name="l00728"></a>00728 } <span class="keywordflow">else</span> {
+<a name="l00729"></a>00729 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00730"></a>00730 kmo_dfs_save_image(img, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
+<a name="l00731"></a>00731 }
+<a name="l00732"></a>00732 }
+<a name="l00733"></a>00733 cpl_image_delete(img); img = NULL;
+<a name="l00734"></a>00734 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (desc.fits_type == f3i_fits) {
+<a name="l00735"></a>00735 cube = cpl_imagelist_load(filename,CPL_TYPE_FLOAT, index);
+<a name="l00736"></a>00736 <span class="keywordflow">if</span> (CPL_ERROR_NONE != cpl_error_get_code()) {
+<a name="l00737"></a>00737 cpl_error_reset();
+<a name="l00738"></a>00738 <span class="keywordflow">if</span> (!remove_empty) {
+<a name="l00739"></a>00739 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00740"></a>00740 kmo_dfs_save_cube(cube, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
+<a name="l00741"></a>00741 }
+<a name="l00742"></a>00742 } <span class="keywordflow">else</span> {
+<a name="l00743"></a>00743 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00744"></a>00744 kmo_dfs_save_cube(cube, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
+<a name="l00745"></a>00745 }
+<a name="l00746"></a>00746 cpl_imagelist_delete(cube); cube = NULL;
+<a name="l00747"></a>00747 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (desc.fits_type == f1i_fits) {
+<a name="l00748"></a>00748 vec = cpl_vector_load(filename, index);
+<a name="l00749"></a>00749 <span class="keywordflow">if</span> (CPL_ERROR_NONE != cpl_error_get_code()) {
+<a name="l00750"></a>00750 cpl_error_reset();
+<a name="l00751"></a>00751 <span class="keywordflow">if</span> (!remove_empty) {
+<a name="l00752"></a>00752 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00753"></a>00753 kmo_dfs_save_vector(NULL, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
+<a name="l00754"></a>00754 }
+<a name="l00755"></a>00755 } <span class="keywordflow">else</span> {
+<a name="l00756"></a>00756 KMO_TRY_EXIT_IF_NULL(
+<a name="l00757"></a>00757 kv = kmclipm_vector_create(vec));
+<a name="l00758"></a>00758 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00759"></a>00759 kmo_dfs_save_vector(kv, STRIP, <span class="stringliteral">""</span>, header, 0./0.));
+<a name="l00760"></a>00760 }
+<a name="l00761"></a>00761 kmclipm_vector_delete(kv); kv = NULL;
+<a name="l00762"></a>00762 }
+<a name="l00763"></a>00763 } <span class="comment">// if (found_angle)</span>
+<a name="l00764"></a>00764 cpl_propertylist_delete(header); header = NULL;
+<a name="l00765"></a>00765 } <span class="comment">// for (n)</span>
+<a name="l00766"></a>00766 } <span class="comment">// for (i = nr_devices)</span>
+<a name="l00767"></a>00767 } <span class="comment">// if ((!remove_empty) && (!remove_noise) && (!remove_angle))</span>
+<a name="l00768"></a>00768 }
+<a name="l00769"></a>00769 KMO_CATCH
+<a name="l00770"></a>00770 {
+<a name="l00771"></a>00771 KMO_CATCH_MSG();
+<a name="l00772"></a>00772
+<a name="l00773"></a>00773 ret_val = -1;
+<a name="l00774"></a>00774 }
+<a name="l00775"></a>00775
+<a name="l00776"></a>00776 cpl_propertylist_delete(header); header = NULL;
+<a name="l00777"></a>00777 cpl_imagelist_delete(cube); cube = NULL;
+<a name="l00778"></a>00778 cpl_image_delete(img); img = NULL;
+<a name="l00779"></a>00779 kmclipm_vector_delete(kv); kv = NULL;
+<a name="l00780"></a>00780 kmo_free_fits_desc(&desc);
+<a name="l00781"></a>00781 cpl_vector_delete(extension); extension = NULL;
+<a name="l00782"></a>00782
+<a name="l00783"></a>00783 <span class="keywordflow">return</span> ret_val;
+<a name="l00784"></a>00784 }
+<a name="l00785"></a>00785
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:50 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__flat_8c_source.html b/html/kmo__flat_8c_source.html
index e88dc8a..ae6cc38 100644
--- a/html/kmo__flat_8c_source.html
+++ b/html/kmo__flat_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_flat.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_flat.c,v 1.46 2013/07/05 09:19:41 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_flat.c,v 1.49 2013-09-20 13:10:47 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/07/05 09:19:41 $</span>
-<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.46 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-09-20 13:10:47 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.49 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -959,7 +959,7 @@
<a name="l00945"></a>00945 <span class="comment">//</span>
<a name="l00946"></a>00946
<a name="l00947"></a>00947 <span class="keywordflow">for</span> (a = 0; a < nr_angles; a++) {
-<a name="l00948"></a>00948 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Processing rotator angle %d -> %d degree"</span>, a,rotang_found[a]);
+<a name="l00948"></a>00948 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Processing rotator angle %d -> %d degree"</span>, a, rotang_found[a]);
<a name="l00949"></a>00949 <span class="keywordflow">for</span> (i = 1; i <= nr_devices; i++) {
<a name="l00950"></a>00950 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Processing detector No. %d"</span>, i);
<a name="l00951"></a>00951
@@ -1414,312 +1414,325 @@
<a name="l01400"></a>01400 KMO_TRY_EXIT_IF_NULL(
<a name="l01401"></a>01401 sub_header = kmo_dfs_load_sub_header(frameset, FLAT_ON, i,
<a name="l01402"></a>01402 FALSE));
-<a name="l01403"></a>01403 cpl_propertylist_erase(sub_header, CRPIX1);
-<a name="l01404"></a>01404 cpl_propertylist_erase(sub_header, CRPIX2);
-<a name="l01405"></a>01405
-<a name="l01406"></a>01406 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01407"></a>01407 kmclipm_update_property_double(sub_header,CAL_ROTANGLE,
-<a name="l01408"></a>01408 ((<span class="keywordtype">double</span>) rotang_found[a]),
-<a name="l01409"></a>01409 <span class="stringliteral">"[deg] Rotator relative to nasmyth"</span>));
-<a name="l01410"></a>01410
-<a name="l01411"></a>01411 <span class="comment">// AA: commented this out: not needed for the moment. Additionally there were only</span>
-<a name="l01412"></a>01412 <span class="comment">// 34 values saved instead of 48?!?</span>
-<a name="l01413"></a>01413 <span class="comment">// And sometimes the keyword was named IFU-2_L insted of IFU2_L ?!?</span>
-<a name="l01414"></a>01414 <span class="comment">// // write BOUNDS as well into subheaders</span>
-<a name="l01415"></a>01415 <span class="comment">// if (i == 1) {</span>
-<a name="l01416"></a>01416 <span class="comment">// for (ii = 0; ii < nr_devices; ii++) {</span>
-<a name="l01417"></a>01417 <span class="comment">// for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {</span>
-<a name="l01418"></a>01418 <span class="comment">// if (all_bounds[a][ii][2*j] > -1) {</span>
-<a name="l01419"></a>01419 <span class="comment">// KMO_TRY_EXIT_IF_NULL(</span>
-<a name="l01420"></a>01420 <span class="comment">// tmpstr= cpl_sprintf("%s%d%s",</span>
-<a name="l01421"></a>01421 <span class="comment">// BOUNDS_PREFIX,</span>
-<a name="l01422"></a>01422 <span class="comment">// ii*KMOS_IFUS_PER_DETECTOR + j+1,</span>
-<a name="l01423"></a>01423 <span class="comment">// "_L"));</span>
-<a name="l01424"></a>01424 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
-<a name="l01425"></a>01425 <span class="comment">// kmclipm_update_property_int(sub_header,</span>
-<a name="l01426"></a>01426 <span class="comment">// tmpstr, all_bounds[a][ii][2*j],</span>
-<a name="l01427"></a>01427 <span class="comment">// "[pix] left boundary for reconstr."));</span>
-<a name="l01428"></a>01428 <span class="comment">// cpl_free(tmpstr); tmpstr = NULL;</span>
-<a name="l01429"></a>01429 <span class="comment">// }</span>
-<a name="l01430"></a>01430 <span class="comment">//</span>
-<a name="l01431"></a>01431 <span class="comment">// if (all_bounds[a][ii][2*j+1] > -1) {</span>
-<a name="l01432"></a>01432 <span class="comment">// KMO_TRY_EXIT_IF_NULL(</span>
-<a name="l01433"></a>01433 <span class="comment">// tmpstr= cpl_sprintf("%s%d%s",</span>
-<a name="l01434"></a>01434 <span class="comment">// BOUNDS_PREFIX,</span>
-<a name="l01435"></a>01435 <span class="comment">// ii-1*KMOS_IFUS_PER_DETECTOR + j+1,</span>
-<a name="l01436"></a>01436 <span class="comment">// "_R"));</span>
-<a name="l01437"></a>01437 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
-<a name="l01438"></a>01438 <span class="comment">// kmclipm_update_property_int(sub_header,</span>
-<a name="l01439"></a>01439 <span class="comment">// tmpstr, all_bounds[a][ii][2*j+1],</span>
-<a name="l01440"></a>01440 <span class="comment">// "[pix] right boundary for reconstr."));</span>
-<a name="l01441"></a>01441 <span class="comment">// cpl_free(tmpstr); tmpstr = NULL;</span>
-<a name="l01442"></a>01442 <span class="comment">// }</span>
-<a name="l01443"></a>01443 <span class="comment">// }</span>
-<a name="l01444"></a>01444 <span class="comment">// } // for (nr_devices)</span>
-<a name="l01445"></a>01445 <span class="comment">// }</span>
-<a name="l01446"></a>01446
-<a name="l01447"></a>01447 <span class="keywordflow">if</span> (spec_found[sx] == CPL_ERROR_NONE) {
-<a name="l01448"></a>01448 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01449"></a>01449 kmclipm_update_property_int(sub_header,
-<a name="l01450"></a>01450 QC_FLAT_SAT,
-<a name="l01451"></a>01451 stored_qc_flat_sat[sx],
-<a name="l01452"></a>01452 <span class="stringliteral">"[] nr. saturated pixels of master flat"</span>));
-<a name="l01453"></a>01453 <span class="comment">// load gain</span>
-<a name="l01454"></a>01454 gain = kmo_dfs_get_property_double(sub_header, GAIN);
-<a name="l01455"></a>01455 KMO_TRY_CHECK_ERROR_STATE_MSG(
-<a name="l01456"></a>01456 <span class="stringliteral">"GAIN-keyword in fits-header is missing!"</span>);
-<a name="l01457"></a>01457
-<a name="l01458"></a>01458 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01459"></a>01459 kmclipm_update_property_double(sub_header,
-<a name="l01460"></a>01460 QC_FLAT_EFF,
-<a name="l01461"></a>01461 stored_qc_flat_eff[sx]/gain,
-<a name="l01462"></a>01462 <span class="stringliteral">"[e-/s] rel. brightness of flat lamp"</span>));
-<a name="l01463"></a>01463 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01464"></a>01464 kmclipm_update_property_double(sub_header,
-<a name="l01465"></a>01465 QC_FLAT_SN,
-<a name="l01466"></a>01466 stored_qc_flat_sn[sx],
-<a name="l01467"></a>01467 <span class="stringliteral">"[] S/N of master flat"</span>));
-<a name="l01468"></a>01468 }
-<a name="l01469"></a>01469
-<a name="l01470"></a>01470 <span class="comment">// store qc parameters only if any slitlet- and gap-width has been</span>
-<a name="l01471"></a>01471 <span class="comment">// detected (should be the case when at least one IFU is active)</span>
-<a name="l01472"></a>01472 <span class="keywordflow">if</span> (stored_xcal[sx] != NULL) {
-<a name="l01473"></a>01473 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01474"></a>01474 kmclipm_update_property_double(sub_header,
-<a name="l01475"></a>01475 QC_GAP_MEAN,
-<a name="l01476"></a>01476 stored_gapmean[sx],
-<a name="l01477"></a>01477 <span class="stringliteral">"[pix] mean gap width between slitlets"</span>));
-<a name="l01478"></a>01478 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01479"></a>01479 kmclipm_update_property_double(sub_header,
-<a name="l01480"></a>01480 QC_GAP_SDV,
-<a name="l01481"></a>01481 stored_gapsdv[sx],
-<a name="l01482"></a>01482 <span class="stringliteral">"[pix] stdev of gap width between slitlets"</span>));
-<a name="l01483"></a>01483 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01484"></a>01484 kmclipm_update_property_double(sub_header,
-<a name="l01485"></a>01485 QC_GAP_MAXDEV,
-<a name="l01486"></a>01486 stored_gapmaxdev[sx],
-<a name="l01487"></a>01487 <span class="stringliteral">"[pix] max gap deviation between slitlets"</span>));
-<a name="l01488"></a>01488 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01489"></a>01489 kmclipm_update_property_double(sub_header,
-<a name="l01490"></a>01490 QC_SLIT_MEAN,
-<a name="l01491"></a>01491 stored_slitmean[sx],
-<a name="l01492"></a>01492 <span class="stringliteral">"[pix] mean slitlet width"</span>));
-<a name="l01493"></a>01493 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01494"></a>01494 kmclipm_update_property_double(sub_header,
-<a name="l01495"></a>01495 QC_SLIT_SDV,
-<a name="l01496"></a>01496 stored_slitsdv[sx],
-<a name="l01497"></a>01497 <span class="stringliteral">"[pix] stdev of slitlet widths"</span>));
-<a name="l01498"></a>01498 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01499"></a>01499 kmclipm_update_property_double(sub_header,
-<a name="l01500"></a>01500 QC_SLIT_MAXDEV,
-<a name="l01501"></a>01501 stored_slitmaxdev[sx],
-<a name="l01502"></a>01502 <span class="stringliteral">"[pix] max slitlet width deviation"</span>));
-<a name="l01503"></a>01503 }
-<a name="l01504"></a>01504
-<a name="l01505"></a>01505 <span class="comment">// calculate QC.BADPIX.NCOUNT</span>
-<a name="l01506"></a>01506 nr_bad_pix = cpl_image_count_rejected(stored_badpix[sx]);
-<a name="l01507"></a>01507 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01508"></a>01508
-<a name="l01509"></a>01509 <span class="comment">// remove 4pixel-border as bad pixels</span>
-<a name="l01510"></a>01510 nr_bad_pix -= 2*KMOS_BADPIX_BORDER*(nx-2*KMOS_BADPIX_BORDER) +
-<a name="l01511"></a>01511 2*KMOS_BADPIX_BORDER*ny;
-<a name="l01512"></a>01512
-<a name="l01513"></a>01513 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01514"></a>01514 kmclipm_update_property_int(sub_header,
-<a name="l01515"></a>01515 QC_NR_BAD_PIX,
-<a name="l01516"></a>01516 nr_bad_pix,
-<a name="l01517"></a>01517 <span class="stringliteral">"[] nr. of bad pixels"</span>));
-<a name="l01518"></a>01518 <span class="comment">// save flat frame</span>
-<a name="l01519"></a>01519 KMO_TRY_EXIT_IF_NULL(
-<a name="l01520"></a>01520 extname = kmo_extname_creator(detector_frame, i, EXT_DATA));
-<a name="l01521"></a>01521 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01522"></a>01522 kmclipm_update_property_string(sub_header, EXTNAME,
-<a name="l01523"></a>01523 extname,
-<a name="l01524"></a>01524 <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01525"></a>01525 cpl_free(extname); extname = NULL;
-<a name="l01526"></a>01526
-<a name="l01527"></a>01527 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01528"></a>01528 kmclipm_update_property_int(sub_header,
-<a name="l01529"></a>01529 EXTVER,
-<a name="l01530"></a>01530 sx+1,
-<a name="l01531"></a>01531 <span class="stringliteral">"FITS extension ver"</span>));
-<a name="l01532"></a>01532
-<a name="l01533"></a>01533 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01534"></a>01534 kmo_dfs_save_image(stored_flat[sx], filename_flat,
-<a name="l01535"></a>01535 fn_suffix, sub_header, 0./0.));
-<a name="l01536"></a>01536
-<a name="l01537"></a>01537 <span class="comment">// save noise frame only when enough input frames were available</span>
-<a name="l01538"></a>01538 KMO_TRY_EXIT_IF_NULL(
-<a name="l01539"></a>01539 extname = kmo_extname_creator(detector_frame, i,
-<a name="l01540"></a>01540 EXT_NOISE));
-<a name="l01541"></a>01541 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01542"></a>01542 kmclipm_update_property_string(sub_header, EXTNAME,
-<a name="l01543"></a>01543 extname,
-<a name="l01544"></a>01544 <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01545"></a>01545 cpl_free(extname); extname = NULL;
-<a name="l01546"></a>01546
-<a name="l01547"></a>01547 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01548"></a>01548 kmo_dfs_save_image(stored_noise[sx], filename_flat,
-<a name="l01549"></a>01549 fn_suffix, sub_header, 0./0.));
-<a name="l01550"></a>01550
-<a name="l01551"></a>01551 <span class="comment">// save bad_pix frame</span>
-<a name="l01552"></a>01552 KMO_TRY_EXIT_IF_NULL(
-<a name="l01553"></a>01553 extname = kmo_extname_creator(detector_frame, i, EXT_BADPIX));
-<a name="l01554"></a>01554 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01555"></a>01555 kmclipm_update_property_string(sub_header, EXTNAME,
-<a name="l01556"></a>01556 extname,
-<a name="l01557"></a>01557 <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01558"></a>01558 cpl_free(extname); extname = NULL;
-<a name="l01559"></a>01559
-<a name="l01560"></a>01560 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01561"></a>01561 kmo_dfs_save_image(stored_badpix[sx], filename_bad,
-<a name="l01562"></a>01562 fn_suffix, sub_header, 0.));
-<a name="l01563"></a>01563
-<a name="l01564"></a>01564 <span class="comment">// save xcal and ycal-frame</span>
-<a name="l01565"></a>01565 KMO_TRY_EXIT_IF_NULL(
-<a name="l01566"></a>01566 extname = kmo_extname_creator(detector_frame, i, EXT_DATA));
-<a name="l01567"></a>01567 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01568"></a>01568 kmclipm_update_property_string(sub_header, EXTNAME,
-<a name="l01569"></a>01569 extname,
-<a name="l01570"></a>01570 <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01571"></a>01571 cpl_free(extname); extname = NULL;
-<a name="l01572"></a>01572
-<a name="l01573"></a>01573 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01574"></a>01574 kmo_dfs_save_image(stored_xcal[sx], filename_xcal,
-<a name="l01575"></a>01575 fn_suffix, sub_header, 0./0.));
-<a name="l01576"></a>01576
-<a name="l01577"></a>01577 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01578"></a>01578 kmo_dfs_save_image(stored_ycal[sx], filename_ycal,
-<a name="l01579"></a>01579 fn_suffix, sub_header, 0./0.));
-<a name="l01580"></a>01580
-<a name="l01581"></a>01581 <span class="comment">// save edge_pars-frame</span>
-<a name="l01582"></a>01582 KMO_TRY_EXIT_IF_NULL(
-<a name="l01583"></a>01583 extname = kmo_extname_creator(list_frame, i, EXT_DATA));
-<a name="l01584"></a>01584 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01585"></a>01585 kmclipm_update_property_string(sub_header, EXTNAME,
-<a name="l01586"></a>01586 extname,
-<a name="l01587"></a>01587 <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01588"></a>01588 cpl_free(extname); extname = NULL;
-<a name="l01589"></a>01589
-<a name="l01590"></a>01590 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l01403"></a>01403 <span class="comment">// leave keywords in for proper fitsverify output</span>
+<a name="l01404"></a>01404 <span class="comment">// cpl_propertylist_erase(sub_header, CRPIX1);</span>
+<a name="l01405"></a>01405 <span class="comment">// cpl_propertylist_erase(sub_header, CRPIX2);</span>
+<a name="l01406"></a>01406
+<a name="l01407"></a>01407 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01408"></a>01408 kmclipm_update_property_double(sub_header,CAL_ROTANGLE,
+<a name="l01409"></a>01409 ((<span class="keywordtype">double</span>) rotang_found[a]),
+<a name="l01410"></a>01410 <span class="stringliteral">"[deg] Rotator relative to nasmyth"</span>));
+<a name="l01411"></a>01411
+<a name="l01412"></a>01412 <span class="comment">// AA: commented this out: not needed for the moment. Additionally there were only</span>
+<a name="l01413"></a>01413 <span class="comment">// 34 values saved instead of 48?!?</span>
+<a name="l01414"></a>01414 <span class="comment">// And sometimes the keyword was named IFU-2_L instead of IFU2_L ?!?</span>
+<a name="l01415"></a>01415 <span class="comment">// // write BOUNDS as well into subheaders</span>
+<a name="l01416"></a>01416 <span class="comment">// if (i == 1) {</span>
+<a name="l01417"></a>01417 <span class="comment">// for (ii = 0; ii < nr_devices; ii++) {</span>
+<a name="l01418"></a>01418 <span class="comment">// for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {</span>
+<a name="l01419"></a>01419 <span class="comment">// if (all_bounds[a][ii][2*j] > -1) {</span>
+<a name="l01420"></a>01420 <span class="comment">// KMO_TRY_EXIT_IF_NULL(</span>
+<a name="l01421"></a>01421 <span class="comment">// tmpstr= cpl_sprintf("%s%d%s",</span>
+<a name="l01422"></a>01422 <span class="comment">// BOUNDS_PREFIX,</span>
+<a name="l01423"></a>01423 <span class="comment">// ii*KMOS_IFUS_PER_DETECTOR + j+1,</span>
+<a name="l01424"></a>01424 <span class="comment">// "_L"));</span>
+<a name="l01425"></a>01425 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
+<a name="l01426"></a>01426 <span class="comment">// kmclipm_update_property_int(sub_header,</span>
+<a name="l01427"></a>01427 <span class="comment">// tmpstr, all_bounds[a][ii][2*j],</span>
+<a name="l01428"></a>01428 <span class="comment">// "[pix] left boundary for reconstr."));</span>
+<a name="l01429"></a>01429 <span class="comment">// cpl_free(tmpstr); tmpstr = NULL;</span>
+<a name="l01430"></a>01430 <span class="comment">// }</span>
+<a name="l01431"></a>01431 <span class="comment">//</span>
+<a name="l01432"></a>01432 <span class="comment">// if (all_bounds[a][ii][2*j+1] > -1) {</span>
+<a name="l01433"></a>01433 <span class="comment">// KMO_TRY_EXIT_IF_NULL(</span>
+<a name="l01434"></a>01434 <span class="comment">// tmpstr= cpl_sprintf("%s%d%s",</span>
+<a name="l01435"></a>01435 <span class="comment">// BOUNDS_PREFIX,</span>
+<a name="l01436"></a>01436 <span class="comment">// ii-1*KMOS_IFUS_PER_DETECTOR + j+1,</span>
+<a name="l01437"></a>01437 <span class="comment">// "_R"));</span>
+<a name="l01438"></a>01438 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
+<a name="l01439"></a>01439 <span class="comment">// kmclipm_update_property_int(sub_header,</span>
+<a name="l01440"></a>01440 <span class="comment">// tmpstr, all_bounds[a][ii][2*j+1],</span>
+<a name="l01441"></a>01441 <span class="comment">// "[pix] right boundary for reconstr."));</span>
+<a name="l01442"></a>01442 <span class="comment">// cpl_free(tmpstr); tmpstr = NULL;</span>
+<a name="l01443"></a>01443 <span class="comment">// }</span>
+<a name="l01444"></a>01444 <span class="comment">// }</span>
+<a name="l01445"></a>01445 <span class="comment">// } // for (nr_devices)</span>
+<a name="l01446"></a>01446 <span class="comment">// }</span>
+<a name="l01447"></a>01447
+<a name="l01448"></a>01448 <span class="keywordflow">if</span> (spec_found[sx] == CPL_ERROR_NONE) {
+<a name="l01449"></a>01449 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01450"></a>01450 kmclipm_update_property_int(sub_header,
+<a name="l01451"></a>01451 QC_FLAT_SAT,
+<a name="l01452"></a>01452 stored_qc_flat_sat[sx],
+<a name="l01453"></a>01453 <span class="stringliteral">"[] nr. saturated pixels of master flat"</span>));
+<a name="l01454"></a>01454 <span class="comment">// load gain</span>
+<a name="l01455"></a>01455 gain = kmo_dfs_get_property_double(sub_header, GAIN);
+<a name="l01456"></a>01456 KMO_TRY_CHECK_ERROR_STATE_MSG(
+<a name="l01457"></a>01457 <span class="stringliteral">"GAIN-keyword in fits-header is missing!"</span>);
+<a name="l01458"></a>01458
+<a name="l01459"></a>01459 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01460"></a>01460 kmclipm_update_property_double(sub_header,
+<a name="l01461"></a>01461 QC_FLAT_EFF,
+<a name="l01462"></a>01462 stored_qc_flat_eff[sx]/gain,
+<a name="l01463"></a>01463 <span class="stringliteral">"[e-/s] rel. brightness of flat lamp"</span>));
+<a name="l01464"></a>01464 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01465"></a>01465 kmclipm_update_property_double(sub_header,
+<a name="l01466"></a>01466 QC_FLAT_SN,
+<a name="l01467"></a>01467 stored_qc_flat_sn[sx],
+<a name="l01468"></a>01468 <span class="stringliteral">"[] S/N of master flat"</span>));
+<a name="l01469"></a>01469 }
+<a name="l01470"></a>01470
+<a name="l01471"></a>01471 <span class="comment">// store qc parameters only if any slitlet- and gap-width has been</span>
+<a name="l01472"></a>01472 <span class="comment">// detected (should be the case when at least one IFU is active)</span>
+<a name="l01473"></a>01473 <span class="keywordflow">if</span> (stored_xcal[sx] != NULL) {
+<a name="l01474"></a>01474 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01475"></a>01475 kmclipm_update_property_double(sub_header,
+<a name="l01476"></a>01476 QC_GAP_MEAN,
+<a name="l01477"></a>01477 stored_gapmean[sx],
+<a name="l01478"></a>01478 <span class="stringliteral">"[pix] mean gap width between slitlets"</span>));
+<a name="l01479"></a>01479 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01480"></a>01480 kmclipm_update_property_double(sub_header,
+<a name="l01481"></a>01481 QC_GAP_SDV,
+<a name="l01482"></a>01482 stored_gapsdv[sx],
+<a name="l01483"></a>01483 <span class="stringliteral">"[pix] stdev of gap width between slitlets"</span>));
+<a name="l01484"></a>01484 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01485"></a>01485 kmclipm_update_property_double(sub_header,
+<a name="l01486"></a>01486 QC_GAP_MAXDEV,
+<a name="l01487"></a>01487 stored_gapmaxdev[sx],
+<a name="l01488"></a>01488 <span class="stringliteral">"[pix] max gap deviation between slitlets"</span>));
+<a name="l01489"></a>01489 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01490"></a>01490 kmclipm_update_property_double(sub_header,
+<a name="l01491"></a>01491 QC_SLIT_MEAN,
+<a name="l01492"></a>01492 stored_slitmean[sx],
+<a name="l01493"></a>01493 <span class="stringliteral">"[pix] mean slitlet width"</span>));
+<a name="l01494"></a>01494 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01495"></a>01495 kmclipm_update_property_double(sub_header,
+<a name="l01496"></a>01496 QC_SLIT_SDV,
+<a name="l01497"></a>01497 stored_slitsdv[sx],
+<a name="l01498"></a>01498 <span class="stringliteral">"[pix] stdev of slitlet widths"</span>));
+<a name="l01499"></a>01499 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01500"></a>01500 kmclipm_update_property_double(sub_header,
+<a name="l01501"></a>01501 QC_SLIT_MAXDEV,
+<a name="l01502"></a>01502 stored_slitmaxdev[sx],
+<a name="l01503"></a>01503 <span class="stringliteral">"[pix] max slitlet width deviation"</span>));
+<a name="l01504"></a>01504 }
+<a name="l01505"></a>01505
+<a name="l01506"></a>01506 <span class="comment">// calculate QC.BADPIX.NCOUNT</span>
+<a name="l01507"></a>01507 nr_bad_pix = cpl_image_count_rejected(stored_badpix[sx]);
+<a name="l01508"></a>01508 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01509"></a>01509
+<a name="l01510"></a>01510 <span class="comment">// remove 4pixel-border as bad pixels</span>
+<a name="l01511"></a>01511 nr_bad_pix -= 2*KMOS_BADPIX_BORDER*(nx-2*KMOS_BADPIX_BORDER) +
+<a name="l01512"></a>01512 2*KMOS_BADPIX_BORDER*ny;
+<a name="l01513"></a>01513
+<a name="l01514"></a>01514 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01515"></a>01515 kmclipm_update_property_int(sub_header,
+<a name="l01516"></a>01516 QC_NR_BAD_PIX,
+<a name="l01517"></a>01517 nr_bad_pix,
+<a name="l01518"></a>01518 <span class="stringliteral">"[] nr. of bad pixels"</span>));
+<a name="l01519"></a>01519 <span class="comment">// save flat frame</span>
+<a name="l01520"></a>01520 KMO_TRY_EXIT_IF_NULL(
+<a name="l01521"></a>01521 extname = kmo_extname_creator(detector_frame, i, EXT_DATA));
+<a name="l01522"></a>01522 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01523"></a>01523 kmclipm_update_property_string(sub_header, EXTNAME,
+<a name="l01524"></a>01524 extname,
+<a name="l01525"></a>01525 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01526"></a>01526 cpl_free(extname); extname = NULL;
+<a name="l01527"></a>01527
+<a name="l01528"></a>01528 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01529"></a>01529 kmclipm_update_property_int(sub_header,
+<a name="l01530"></a>01530 EXTVER,
+<a name="l01531"></a>01531 sx+1,
+<a name="l01532"></a>01532 <span class="stringliteral">"FITS extension ver"</span>));
+<a name="l01533"></a>01533
+<a name="l01534"></a>01534 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01535"></a>01535 kmo_dfs_save_image(stored_flat[sx], filename_flat,
+<a name="l01536"></a>01536 fn_suffix, sub_header, 0./0.));
+<a name="l01537"></a>01537
+<a name="l01538"></a>01538 <span class="comment">// save noise frame only when enough input frames were available</span>
+<a name="l01539"></a>01539 KMO_TRY_EXIT_IF_NULL(
+<a name="l01540"></a>01540 extname = kmo_extname_creator(detector_frame, i,
+<a name="l01541"></a>01541 EXT_NOISE));
+<a name="l01542"></a>01542 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01543"></a>01543 kmclipm_update_property_string(sub_header, EXTNAME,
+<a name="l01544"></a>01544 extname,
+<a name="l01545"></a>01545 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01546"></a>01546 cpl_free(extname); extname = NULL;
+<a name="l01547"></a>01547
+<a name="l01548"></a>01548 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01549"></a>01549 kmo_dfs_save_image(stored_noise[sx], filename_flat,
+<a name="l01550"></a>01550 fn_suffix, sub_header, 0./0.));
+<a name="l01551"></a>01551
+<a name="l01552"></a>01552 <span class="comment">// save bad_pix frame</span>
+<a name="l01553"></a>01553 KMO_TRY_EXIT_IF_NULL(
+<a name="l01554"></a>01554 extname = kmo_extname_creator(detector_frame, i, EXT_BADPIX));
+<a name="l01555"></a>01555 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01556"></a>01556 kmclipm_update_property_string(sub_header, EXTNAME,
+<a name="l01557"></a>01557 extname,
+<a name="l01558"></a>01558 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01559"></a>01559 cpl_free(extname); extname = NULL;
+<a name="l01560"></a>01560
+<a name="l01561"></a>01561 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01562"></a>01562 kmo_dfs_save_image(stored_badpix[sx], filename_bad,
+<a name="l01563"></a>01563 fn_suffix, sub_header, 0.));
+<a name="l01564"></a>01564
+<a name="l01565"></a>01565 <span class="comment">// save xcal and ycal-frame</span>
+<a name="l01566"></a>01566 KMO_TRY_EXIT_IF_NULL(
+<a name="l01567"></a>01567 extname = kmo_extname_creator(detector_frame, i, EXT_DATA));
+<a name="l01568"></a>01568 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01569"></a>01569 kmclipm_update_property_string(sub_header, EXTNAME,
+<a name="l01570"></a>01570 extname,
+<a name="l01571"></a>01571 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01572"></a>01572 cpl_free(extname); extname = NULL;
+<a name="l01573"></a>01573
+<a name="l01574"></a>01574 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01575"></a>01575 kmo_dfs_save_image(stored_xcal[sx], filename_xcal,
+<a name="l01576"></a>01576 fn_suffix, sub_header, 0./0.));
+<a name="l01577"></a>01577
+<a name="l01578"></a>01578 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01579"></a>01579 kmo_dfs_save_image(stored_ycal[sx], filename_ycal,
+<a name="l01580"></a>01580 fn_suffix, sub_header, 0./0.));
+<a name="l01581"></a>01581
+<a name="l01582"></a>01582 <span class="comment">// save edge_pars-frame</span>
+<a name="l01583"></a>01583 cpl_free(extname); extname = NULL;
+<a name="l01584"></a>01584
+<a name="l01585"></a>01585 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l01586"></a>01586 KMO_TRY_EXIT_IF_NULL(
+<a name="l01587"></a>01587 extname = cpl_sprintf(<span class="stringliteral">"%s_IFU.%d_ANGLE.%d"</span>,
+<a name="l01588"></a>01588 EXT_LIST,
+<a name="l01589"></a>01589 j+1+(i-1)*KMOS_IFUS_PER_DETECTOR,
+<a name="l01590"></a>01590 rotang_found[a]));
<a name="l01591"></a>01591 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01592"></a>01592 kmclipm_update_property_int(sub_header, CAL_IFU_NR,
-<a name="l01593"></a>01593 j+1+(i-1)*KMOS_IFUS_PER_DETECTOR,
-<a name="l01594"></a>01594 <span class="stringliteral">"IFU Number {1..24}"</span>));
-<a name="l01595"></a>01595
-<a name="l01596"></a>01596 <span class="comment">// save edge-parameters as product</span>
-<a name="l01597"></a>01597 <span class="keywordflow">if</span> (spec_found[sx] != CPL_ERROR_DATA_NOT_FOUND) {
-<a name="l01598"></a>01598 <span class="keywordflow">if</span> (edge_table[sx][j] != NULL) {
-<a name="l01599"></a>01599 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01600"></a>01600 kmo_dfs_save_table(edge_table[sx][j], filename_edge, fn_suffix, sub_header));
-<a name="l01601"></a>01601 } <span class="keywordflow">else</span> {
-<a name="l01602"></a>01602 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01603"></a>01603 kmo_dfs_save_table(NULL, filename_edge, fn_suffix, sub_header));
-<a name="l01604"></a>01604 }
-<a name="l01605"></a>01605 } <span class="keywordflow">else</span> {
-<a name="l01606"></a>01606 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01607"></a>01607 kmo_dfs_save_table(NULL, filename_edge, fn_suffix, sub_header));
-<a name="l01608"></a>01608 }
-<a name="l01609"></a>01609 }
-<a name="l01610"></a>01610
-<a name="l01611"></a>01611 cpl_propertylist_delete(sub_header); sub_header = NULL;
-<a name="l01612"></a>01612
-<a name="l01613"></a>01613 cpl_image_delete(stored_flat[sx]); stored_flat[sx] = NULL;
-<a name="l01614"></a>01614 cpl_image_delete(stored_noise[sx]); stored_noise[sx] = NULL;
-<a name="l01615"></a>01615 cpl_image_delete(stored_badpix[sx]); stored_badpix[sx] = NULL;
-<a name="l01616"></a>01616 } <span class="comment">// for (i = nr_devices)</span>
-<a name="l01617"></a>01617 } <span class="comment">// for (a = nr_angles)</span>
-<a name="l01618"></a>01618 }
-<a name="l01619"></a>01619 KMO_CATCH
-<a name="l01620"></a>01620 {
-<a name="l01621"></a>01621 KMO_CATCH_MSG();
-<a name="l01622"></a>01622 ret_val = -1;
-<a name="l01623"></a>01623 }
-<a name="l01624"></a>01624 <span class="comment">// delete temporary files</span>
-<a name="l01625"></a>01625 unlink(fn_flat);
-<a name="l01626"></a>01626 unlink(fn_noise);
-<a name="l01627"></a>01627 unlink(fn_badpix);
-<a name="l01628"></a>01628
-<a name="l01629"></a>01629 kmo_free_fits_desc(&desc1);
-<a name="l01630"></a>01630 kmo_free_fits_desc(&desc2);
-<a name="l01631"></a>01631 kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
-<a name="l01632"></a>01632 kmo_free_unused_ifus(unused_ifus_after); unused_ifus_after = NULL;
-<a name="l01633"></a>01633 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l01634"></a>01634 cpl_propertylist_delete(main_header_xcal); main_header_xcal = NULL;
-<a name="l01635"></a>01635 cpl_propertylist_delete(sub_header); sub_header = NULL;
-<a name="l01636"></a>01636 cpl_imagelist_delete(det_lamp_on); det_lamp_on = NULL;
-<a name="l01637"></a>01637 cpl_imagelist_delete(det_lamp_off); det_lamp_off = NULL;
-<a name="l01638"></a>01638 cpl_image_delete(combined_data_off); combined_data_off = NULL;
-<a name="l01639"></a>01639 cpl_image_delete(combined_noise_off); combined_noise_off = NULL;
-<a name="l01640"></a>01640 cpl_image_delete(bad_pix_mask_dark); bad_pix_mask_dark = NULL;
-<a name="l01641"></a>01641 cpl_free(stored_qc_flat_sat); stored_qc_flat_sat = NULL;
-<a name="l01642"></a>01642 cpl_free(stored_qc_flat_eff); stored_qc_flat_eff = NULL;
-<a name="l01643"></a>01643 cpl_free(stored_qc_flat_sn); stored_qc_flat_sn = NULL;
-<a name="l01644"></a>01644 cpl_free(stored_gapmean); stored_gapmean = NULL;
-<a name="l01645"></a>01645 cpl_free(stored_gapsdv); stored_gapsdv = NULL;
-<a name="l01646"></a>01646 cpl_free(stored_gapmaxdev); stored_gapmaxdev = NULL;
-<a name="l01647"></a>01647 cpl_free(stored_slitmean); stored_slitmean = NULL;
-<a name="l01648"></a>01648 cpl_free(stored_slitsdv); stored_slitsdv = NULL;
-<a name="l01649"></a>01649 cpl_free(stored_slitmaxdev); stored_slitmaxdev = NULL;
-<a name="l01650"></a>01650 cpl_free(readmode); readmode = NULL;
-<a name="l01651"></a>01651 cpl_free(suffix); suffix = NULL;
-<a name="l01652"></a>01652 cpl_free(fn_suffix); fn_suffix = NULL;
-<a name="l01653"></a>01653 <span class="keywordflow">if</span> (total_bounds != NULL) {
-<a name="l01654"></a>01654 <span class="keywordflow">for</span> (i = 0; i < nr_devices; i++) {
-<a name="l01655"></a>01655 cpl_free(total_bounds[i]); total_bounds[i] = NULL;
-<a name="l01656"></a>01656 }
-<a name="l01657"></a>01657 }
-<a name="l01658"></a>01658 cpl_free(total_bounds); total_bounds = NULL;
-<a name="l01659"></a>01659 <span class="keywordflow">for</span> (i = 0; i < nr_devices * nr_angles; i++) {
-<a name="l01660"></a>01660 cpl_image_delete(stored_flat[i]); stored_flat[i] = NULL;
-<a name="l01661"></a>01661 cpl_image_delete(stored_noise[i]); stored_noise[i] = NULL;
-<a name="l01662"></a>01662 cpl_image_delete(stored_badpix[i]); stored_badpix[i] = NULL;
-<a name="l01663"></a>01663 cpl_image_delete(stored_xcal[i]); stored_xcal[i] = NULL;
-<a name="l01664"></a>01664 cpl_image_delete(stored_ycal[i]); stored_ycal[i] = NULL;
-<a name="l01665"></a>01665 }
-<a name="l01666"></a>01666 cpl_free(stored_flat); stored_flat = NULL;
-<a name="l01667"></a>01667 cpl_free(stored_noise); stored_noise = NULL;
-<a name="l01668"></a>01668 cpl_free(stored_badpix); stored_badpix = NULL;
-<a name="l01669"></a>01669 cpl_free(stored_xcal); stored_xcal = NULL;
-<a name="l01670"></a>01670 cpl_free(stored_ycal); stored_ycal = NULL;
-<a name="l01671"></a>01671 <span class="keywordflow">for</span> (a = 0; a < nr_angles; a++) {
-<a name="l01672"></a>01672 cpl_frameset_delete(angle_frameset[a]); angle_frameset[a] = NULL;
-<a name="l01673"></a>01673 <span class="comment">// if ((all_bounds != NULL) && (all_bounds[a] != NULL)) {</span>
-<a name="l01674"></a>01674 <span class="comment">// for (i = 0; i < nr_devices; i++) {</span>
-<a name="l01675"></a>01675 <span class="comment">// cpl_free(all_bounds[a][i]); all_bounds[a][i] = NULL;</span>
-<a name="l01676"></a>01676 <span class="comment">// }</span>
-<a name="l01677"></a>01677 <span class="comment">// cpl_free(all_bounds[a]); all_bounds[a] = NULL;</span>
-<a name="l01678"></a>01678 <span class="comment">// }</span>
-<a name="l01679"></a>01679 }
-<a name="l01680"></a>01680 cpl_free(angle_frameset); angle_frameset = NULL;
-<a name="l01681"></a>01681 <span class="comment">// cpl_free(all_bounds); all_bounds = NULL;</span>
-<a name="l01682"></a>01682 <span class="keywordflow">if</span> (edge_table != NULL) {
-<a name="l01683"></a>01683 <span class="keywordflow">for</span> (i = 0; i < KMOS_NR_DETECTORS * nr_angles; i++) {
-<a name="l01684"></a>01684 <span class="keywordflow">if</span> (edge_table[i] != NULL) {
-<a name="l01685"></a>01685 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
-<a name="l01686"></a>01686 cpl_table_delete(edge_table[i][j]);
-<a name="l01687"></a>01687 edge_table[i][j] = NULL;
-<a name="l01688"></a>01688 }
-<a name="l01689"></a>01689 cpl_free(edge_table[i]); edge_table[i] = NULL;
-<a name="l01690"></a>01690 }
-<a name="l01691"></a>01691 }
-<a name="l01692"></a>01692 cpl_free(edge_table); edge_table = NULL;
-<a name="l01693"></a>01693 }
-<a name="l01694"></a>01694 <span class="keywordflow">if</span> (bounds != NULL) {
-<a name="l01695"></a>01695 cpl_free(bounds); bounds = NULL;
-<a name="l01696"></a>01696 }
-<a name="l01697"></a>01697 <span class="keywordflow">if</span> (spec_found != NULL) {
-<a name="l01698"></a>01698 cpl_free(spec_found); spec_found = NULL;
-<a name="l01699"></a>01699 }
-<a name="l01700"></a>01700
-<a name="l01701"></a>01701 <span class="keywordflow">return</span> ret_val;
-<a name="l01702"></a>01702 }
-<a name="l01703"></a>01703
+<a name="l01592"></a>01592 kmclipm_update_property_string(sub_header, EXTNAME,
+<a name="l01593"></a>01593 extname,
+<a name="l01594"></a>01594 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01595"></a>01595 cpl_free(extname); extname = NULL;
+<a name="l01596"></a>01596
+<a name="l01597"></a>01597 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01598"></a>01598 kmclipm_update_property_int(sub_header, CAL_IFU_NR,
+<a name="l01599"></a>01599 j+1+(i-1)*KMOS_IFUS_PER_DETECTOR,
+<a name="l01600"></a>01600 <span class="stringliteral">"IFU Number {1..24}"</span>));
+<a name="l01601"></a>01601
+<a name="l01602"></a>01602 <span class="comment">// save edge-parameters as product</span>
+<a name="l01603"></a>01603 <span class="keywordflow">if</span> ((spec_found[sx] != CPL_ERROR_DATA_NOT_FOUND) && (edge_table[sx][j] != NULL)) {
+<a name="l01604"></a>01604 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01605"></a>01605 kmo_dfs_save_table(edge_table[sx][j], filename_edge, fn_suffix, sub_header));
+<a name="l01606"></a>01606 } <span class="keywordflow">else</span> {
+<a name="l01607"></a>01607 cpl_propertylist_erase(sub_header, CRVAL1);
+<a name="l01608"></a>01608 cpl_propertylist_erase(sub_header, CRVAL2);
+<a name="l01609"></a>01609 cpl_propertylist_erase(sub_header, CD1_1);
+<a name="l01610"></a>01610 cpl_propertylist_erase(sub_header, CD1_2);
+<a name="l01611"></a>01611 cpl_propertylist_erase(sub_header, CD2_1);
+<a name="l01612"></a>01612 cpl_propertylist_erase(sub_header, CD2_2);
+<a name="l01613"></a>01613 cpl_propertylist_erase(sub_header, CRPIX1);
+<a name="l01614"></a>01614 cpl_propertylist_erase(sub_header, CRPIX2);
+<a name="l01615"></a>01615 cpl_propertylist_erase(sub_header, CTYPE1);
+<a name="l01616"></a>01616 cpl_propertylist_erase(sub_header, CTYPE2);
+<a name="l01617"></a>01617 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01618"></a>01618
+<a name="l01619"></a>01619 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01620"></a>01620 kmo_dfs_save_table(NULL, filename_edge, fn_suffix, sub_header));
+<a name="l01621"></a>01621 }
+<a name="l01622"></a>01622 }
+<a name="l01623"></a>01623
+<a name="l01624"></a>01624 cpl_propertylist_delete(sub_header); sub_header = NULL;
+<a name="l01625"></a>01625
+<a name="l01626"></a>01626 cpl_image_delete(stored_flat[sx]); stored_flat[sx] = NULL;
+<a name="l01627"></a>01627 cpl_image_delete(stored_noise[sx]); stored_noise[sx] = NULL;
+<a name="l01628"></a>01628 cpl_image_delete(stored_badpix[sx]); stored_badpix[sx] = NULL;
+<a name="l01629"></a>01629 } <span class="comment">// for (i = nr_devices)</span>
+<a name="l01630"></a>01630 } <span class="comment">// for (a = nr_angles)</span>
+<a name="l01631"></a>01631 }
+<a name="l01632"></a>01632 KMO_CATCH
+<a name="l01633"></a>01633 {
+<a name="l01634"></a>01634 KMO_CATCH_MSG();
+<a name="l01635"></a>01635 ret_val = -1;
+<a name="l01636"></a>01636 }
+<a name="l01637"></a>01637 <span class="comment">// delete temporary files</span>
+<a name="l01638"></a>01638 unlink(fn_flat);
+<a name="l01639"></a>01639 unlink(fn_noise);
+<a name="l01640"></a>01640 unlink(fn_badpix);
+<a name="l01641"></a>01641
+<a name="l01642"></a>01642 kmo_free_fits_desc(&desc1);
+<a name="l01643"></a>01643 kmo_free_fits_desc(&desc2);
+<a name="l01644"></a>01644 kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
+<a name="l01645"></a>01645 kmo_free_unused_ifus(unused_ifus_after); unused_ifus_after = NULL;
+<a name="l01646"></a>01646 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l01647"></a>01647 cpl_propertylist_delete(main_header_xcal); main_header_xcal = NULL;
+<a name="l01648"></a>01648 cpl_propertylist_delete(sub_header); sub_header = NULL;
+<a name="l01649"></a>01649 cpl_imagelist_delete(det_lamp_on); det_lamp_on = NULL;
+<a name="l01650"></a>01650 cpl_imagelist_delete(det_lamp_off); det_lamp_off = NULL;
+<a name="l01651"></a>01651 cpl_image_delete(combined_data_off); combined_data_off = NULL;
+<a name="l01652"></a>01652 cpl_image_delete(combined_noise_off); combined_noise_off = NULL;
+<a name="l01653"></a>01653 cpl_image_delete(bad_pix_mask_dark); bad_pix_mask_dark = NULL;
+<a name="l01654"></a>01654 cpl_free(stored_qc_flat_sat); stored_qc_flat_sat = NULL;
+<a name="l01655"></a>01655 cpl_free(stored_qc_flat_eff); stored_qc_flat_eff = NULL;
+<a name="l01656"></a>01656 cpl_free(stored_qc_flat_sn); stored_qc_flat_sn = NULL;
+<a name="l01657"></a>01657 cpl_free(stored_gapmean); stored_gapmean = NULL;
+<a name="l01658"></a>01658 cpl_free(stored_gapsdv); stored_gapsdv = NULL;
+<a name="l01659"></a>01659 cpl_free(stored_gapmaxdev); stored_gapmaxdev = NULL;
+<a name="l01660"></a>01660 cpl_free(stored_slitmean); stored_slitmean = NULL;
+<a name="l01661"></a>01661 cpl_free(stored_slitsdv); stored_slitsdv = NULL;
+<a name="l01662"></a>01662 cpl_free(stored_slitmaxdev); stored_slitmaxdev = NULL;
+<a name="l01663"></a>01663 cpl_free(readmode); readmode = NULL;
+<a name="l01664"></a>01664 cpl_free(suffix); suffix = NULL;
+<a name="l01665"></a>01665 cpl_free(fn_suffix); fn_suffix = NULL;
+<a name="l01666"></a>01666 <span class="keywordflow">if</span> (total_bounds != NULL) {
+<a name="l01667"></a>01667 <span class="keywordflow">for</span> (i = 0; i < nr_devices; i++) {
+<a name="l01668"></a>01668 cpl_free(total_bounds[i]); total_bounds[i] = NULL;
+<a name="l01669"></a>01669 }
+<a name="l01670"></a>01670 }
+<a name="l01671"></a>01671 cpl_free(total_bounds); total_bounds = NULL;
+<a name="l01672"></a>01672 <span class="keywordflow">for</span> (i = 0; i < nr_devices * nr_angles; i++) {
+<a name="l01673"></a>01673 cpl_image_delete(stored_flat[i]); stored_flat[i] = NULL;
+<a name="l01674"></a>01674 cpl_image_delete(stored_noise[i]); stored_noise[i] = NULL;
+<a name="l01675"></a>01675 cpl_image_delete(stored_badpix[i]); stored_badpix[i] = NULL;
+<a name="l01676"></a>01676 cpl_image_delete(stored_xcal[i]); stored_xcal[i] = NULL;
+<a name="l01677"></a>01677 cpl_image_delete(stored_ycal[i]); stored_ycal[i] = NULL;
+<a name="l01678"></a>01678 }
+<a name="l01679"></a>01679 cpl_free(stored_flat); stored_flat = NULL;
+<a name="l01680"></a>01680 cpl_free(stored_noise); stored_noise = NULL;
+<a name="l01681"></a>01681 cpl_free(stored_badpix); stored_badpix = NULL;
+<a name="l01682"></a>01682 cpl_free(stored_xcal); stored_xcal = NULL;
+<a name="l01683"></a>01683 cpl_free(stored_ycal); stored_ycal = NULL;
+<a name="l01684"></a>01684 <span class="keywordflow">for</span> (a = 0; a < nr_angles; a++) {
+<a name="l01685"></a>01685 cpl_frameset_delete(angle_frameset[a]); angle_frameset[a] = NULL;
+<a name="l01686"></a>01686 <span class="comment">// if ((all_bounds != NULL) && (all_bounds[a] != NULL)) {</span>
+<a name="l01687"></a>01687 <span class="comment">// for (i = 0; i < nr_devices; i++) {</span>
+<a name="l01688"></a>01688 <span class="comment">// cpl_free(all_bounds[a][i]); all_bounds[a][i] = NULL;</span>
+<a name="l01689"></a>01689 <span class="comment">// }</span>
+<a name="l01690"></a>01690 <span class="comment">// cpl_free(all_bounds[a]); all_bounds[a] = NULL;</span>
+<a name="l01691"></a>01691 <span class="comment">// }</span>
+<a name="l01692"></a>01692 }
+<a name="l01693"></a>01693 cpl_free(angle_frameset); angle_frameset = NULL;
+<a name="l01694"></a>01694 <span class="comment">// cpl_free(all_bounds); all_bounds = NULL;</span>
+<a name="l01695"></a>01695 <span class="keywordflow">if</span> (edge_table != NULL) {
+<a name="l01696"></a>01696 <span class="keywordflow">for</span> (i = 0; i < KMOS_NR_DETECTORS * nr_angles; i++) {
+<a name="l01697"></a>01697 <span class="keywordflow">if</span> (edge_table[i] != NULL) {
+<a name="l01698"></a>01698 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l01699"></a>01699 cpl_table_delete(edge_table[i][j]);
+<a name="l01700"></a>01700 edge_table[i][j] = NULL;
+<a name="l01701"></a>01701 }
+<a name="l01702"></a>01702 cpl_free(edge_table[i]); edge_table[i] = NULL;
+<a name="l01703"></a>01703 }
+<a name="l01704"></a>01704 }
+<a name="l01705"></a>01705 cpl_free(edge_table); edge_table = NULL;
+<a name="l01706"></a>01706 }
+<a name="l01707"></a>01707 <span class="keywordflow">if</span> (bounds != NULL) {
+<a name="l01708"></a>01708 cpl_free(bounds); bounds = NULL;
+<a name="l01709"></a>01709 }
+<a name="l01710"></a>01710 <span class="keywordflow">if</span> (spec_found != NULL) {
+<a name="l01711"></a>01711 cpl_free(spec_found); spec_found = NULL;
+<a name="l01712"></a>01712 }
+<a name="l01713"></a>01713
+<a name="l01714"></a>01714 <span class="keywordflow">return</span> ret_val;
+<a name="l01715"></a>01715 }
+<a name="l01716"></a>01716
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__illumination_8c_source.html b/html/kmo__illumination_8c_source.html
index dcad0f5..305ea2c 100644
--- a/html/kmo__illumination_8c_source.html
+++ b/html/kmo__illumination_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_illumination.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_illumination.c,v 1.58 2013/07/25 09:45:32 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_illumination.c,v 1.65 2013-10-21 13:44:54 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/07/25 09:45:32 $</span>
-<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.58 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-10-21 13:44:54 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.65 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -131,1724 +131,1738 @@
<a name="l00069"></a>00069 <span class="stringliteral">"generates the spectral calibration frame needed in this recipe. As input at\n"</span>
<a name="l00070"></a>00070 <span class="stringliteral">"least a sky, a master dark, a master flat and the spatial and spectral cali-\n"</span>
<a name="l00071"></a>00071 <span class="stringliteral">"bration frames are required.\n"</span>
-<a name="l00072"></a>00072 <span class="stringliteral">"\n"</span>
-<a name="l00073"></a>00073 <span class="stringliteral">"BASIC PARAMETERS:\n"</span>
-<a name="l00074"></a>00074 <span class="stringliteral">"-----------------\n"</span>
-<a name="l00075"></a>00075 <span class="stringliteral">"--imethod\n"</span>
-<a name="l00076"></a>00076 <span class="stringliteral">"The interpolation method used for reconstruction.\n"</span>
-<a name="l00077"></a>00077 <span class="stringliteral">"\n"</span>
-<a name="l00078"></a>00078 <span class="stringliteral">"--range\n"</span>
-<a name="l00079"></a>00079 <span class="stringliteral">"The spectral ranges to combine when collapsing the reconstructed cubes. e.g.\n"</span>
-<a name="l00080"></a>00080 <span class="stringliteral">"\"x1_start,x1_end;x2_start,x2_end\" (microns)\n"</span>
-<a name="l00081"></a>00081 <span class="stringliteral">"\n"</span>
-<a name="l00082"></a>00082 <span class="stringliteral">"ADVANCED PARAMETERS\n"</span>
-<a name="l00083"></a>00083 <span class="stringliteral">"-------------------\n"</span>
-<a name="l00084"></a>00084 <span class="stringliteral">"--flux\n"</span>
-<a name="l00085"></a>00085 <span class="stringliteral">"Specify if flux conservation should be applied.\n"</span>
-<a name="l00086"></a>00086 <span class="stringliteral">"\n"</span>
-<a name="l00087"></a>00087 <span class="stringliteral">"--add-all\n"</span>
-<a name="l00088"></a>00088 <span class="stringliteral">"By default the first FLAT_SKY frame is omitted, since in the\n"</span>
-<a name="l00089"></a>00089 <span class="stringliteral">"KMOS_spec_cal_skyflat template this is an acquisition frame to estimate the\n"</span>
-<a name="l00090"></a>00090 <span class="stringliteral">"needed exposure time for the subsequent FLAT_SKY frames. If anyway all frames\n"</span>
-<a name="l00091"></a>00091 <span class="stringliteral">"should be considered, set this parameter to TRUE.\n"</span>
-<a name="l00092"></a>00092 <span class="stringliteral">"\n"</span>
-<a name="l00093"></a>00093 <span class="stringliteral">"--neighborhoodRange\n"</span>
-<a name="l00094"></a>00094 <span class="stringliteral">"Defines the range to search for neighbors during reconstruction\n"</span>
-<a name="l00095"></a>00095 <span class="stringliteral">"\n"</span>
-<a name="l00096"></a>00096 <span class="stringliteral">"--b_samples\n"</span>
-<a name="l00097"></a>00097 <span class="stringliteral">"The number of samples in spectral direction for the reconstructed cube.\n"</span>
-<a name="l00098"></a>00098 <span class="stringliteral">"Ideally this number should be greater than 2048, the detector size.\n"</span>
-<a name="l00099"></a>00099 <span class="stringliteral">"\n"</span>
-<a name="l00100"></a>00100 <span class="stringliteral">"--b_start\n"</span>
-<a name="l00101"></a>00101 <span class="stringliteral">"--b_end\n"</span>
-<a name="l00102"></a>00102 <span class="stringliteral">"Used to define manually the start and end wavelength for the reconstructed\n"</span>
-<a name="l00103"></a>00103 <span class="stringliteral">"cube. By default the internally defined values are used.\n"</span>
-<a name="l00104"></a>00104 <span class="stringliteral">"\n"</span>
-<a name="l00105"></a>00105 <span class="stringliteral">"--cmethod\n"</span>
-<a name="l00106"></a>00106 <span class="stringliteral">"Following methods of frame combination are available:\n"</span>
-<a name="l00107"></a>00107 <span class="stringliteral">" * 'ksigma' (Default)\n"</span>
-<a name="l00108"></a>00108 <span class="stringliteral">" An iterative sigma clipping. For each position all pixels in the spectrum\n"</span>
-<a name="l00109"></a>00109 <span class="stringliteral">" are examined. If they deviate significantly, they will be rejected according\n"</span>
-<a name="l00110"></a>00110 <span class="stringliteral">" to the conditions:\n"</span>
-<a name="l00111"></a>00111 <span class="stringliteral">" val > mean + stdev * cpos_rej\n"</span>
-<a name="l00112"></a>00112 <span class="stringliteral">" and\n"</span>
-<a name="l00113"></a>00113 <span class="stringliteral">" val < mean - stdev * cneg_rej\n"</span>
-<a name="l00114"></a>00114 <span class="stringliteral">" where --cpos_rej, --cneg_rej and --citer are the corresponding configuration\n"</span>
-<a name="l00115"></a>00115 <span class="stringliteral">" parameters. In the first iteration median and percentile level are used.\n"</span>
-<a name="l00116"></a>00116 <span class="stringliteral">"\n"</span>
-<a name="l00117"></a>00117 <span class="stringliteral">" * 'median'\n"</span>
-<a name="l00118"></a>00118 <span class="stringliteral">" At each pixel position the median is calculated.\n"</span>
-<a name="l00119"></a>00119 <span class="stringliteral">"\n"</span>
-<a name="l00120"></a>00120 <span class="stringliteral">" * 'average'\n"</span>
-<a name="l00121"></a>00121 <span class="stringliteral">" At each pixel position the average is calculated.\n"</span>
-<a name="l00122"></a>00122 <span class="stringliteral">"\n"</span>
-<a name="l00123"></a>00123 <span class="stringliteral">" * 'sum'\n"</span>
-<a name="l00124"></a>00124 <span class="stringliteral">" At each pixel position the sum is calculated.\n"</span>
-<a name="l00125"></a>00125 <span class="stringliteral">"\n"</span>
-<a name="l00126"></a>00126 <span class="stringliteral">" * 'min_max'\n"</span>
-<a name="l00127"></a>00127 <span class="stringliteral">" The specified number of minimum and maximum pixel values will be rejected.\n"</span>
-<a name="l00128"></a>00128 <span class="stringliteral">" --cmax and --cmin apply to this method.\n"</span>
-<a name="l00129"></a>00129 <span class="stringliteral">"\n"</span>
-<a name="l00130"></a>00130 <span class="stringliteral">"--cpos_rej\n"</span>
-<a name="l00131"></a>00131 <span class="stringliteral">"--cneg_rej\n"</span>
-<a name="l00132"></a>00132 <span class="stringliteral">"--citer\n"</span>
-<a name="l00133"></a>00133 <span class="stringliteral">"see --cmethod='ksigma'\n"</span>
-<a name="l00134"></a>00134 <span class="stringliteral">"\n"</span>
-<a name="l00135"></a>00135 <span class="stringliteral">"--cmax\n"</span>
-<a name="l00136"></a>00136 <span class="stringliteral">"--cmin\n"</span>
-<a name="l00137"></a>00137 <span class="stringliteral">"see --cmethod='min_max'\n"</span>
-<a name="l00138"></a>00138 <span class="stringliteral">"\n"</span>
-<a name="l00139"></a>00139 <span class="stringliteral">"--pix_scale\n"</span>
-<a name="l00140"></a>00140 <span class="stringliteral">"Change the pixel scale [arcsec]. Default of 0.2\" results into cubes of\n"</span>
-<a name="l00141"></a>00141 <span class="stringliteral">"14x14pix, a scale of 0.1\" results into cubes of 28x28pix, etc.\n"</span>
-<a name="l00142"></a>00142 <span class="stringliteral">"\n"</span>
-<a name="l00143"></a>00143 <span class="stringliteral">"--suppress_extension\n"</span>
-<a name="l00144"></a>00144 <span class="stringliteral">"If set to TRUE, the arbitrary filename extensions are supressed. If multiple\n"</span>
-<a name="l00145"></a>00145 <span class="stringliteral">"products with the same category are produced, they will be numered consecutively\n"</span>
-<a name="l00146"></a>00146 <span class="stringliteral">"starting from 0.\n"</span>
-<a name="l00147"></a>00147 <span class="stringliteral">"\n"</span>
-<a name="l00148"></a>00148 <span class="stringliteral">"-------------------------------------------------------------------------------\n"</span>
-<a name="l00149"></a>00149 <span class="stringliteral">" Input files:\n"</span>
-<a name="l00150"></a>00150 <span class="stringliteral">"\n"</span>
-<a name="l00151"></a>00151 <span class="stringliteral">" DO KMOS \n"</span>
-<a name="l00152"></a>00152 <span class="stringliteral">" category Type Explanation Required #Frames\n"</span>
-<a name="l00153"></a>00153 <span class="stringliteral">" -------- ----- ----------- -------- -------\n"</span>
-<a name="l00154"></a>00154 <span class="stringliteral">" FLAT_SKY F2D Sky exposures Y 1-n \n"</span>
-<a name="l00155"></a>00155 <span class="stringliteral">" (at least 3 frames recommended) \n"</span>
-<a name="l00156"></a>00156 <span class="stringliteral">" MASTER_DARK F2D Master dark Y 1 \n"</span>
-<a name="l00157"></a>00157 <span class="stringliteral">" MASTER_FLAT F2D Master flat Y 1 \n"</span>
-<a name="l00158"></a>00158 <span class="stringliteral">" XCAL F2D x calibration frame Y 1 \n"</span>
-<a name="l00159"></a>00159 <span class="stringliteral">" YCAL F2D y calibration frame Y 1 \n"</span>
-<a name="l00160"></a>00160 <span class="stringliteral">" LCAL F2D Wavelength calib. frame Y 1 \n"</span>
-<a name="l00161"></a>00161 <span class="stringliteral">" WAVE_BAND F2L Table with start-/end-wavelengths Y 1 \n"</span>
-<a name="l00162"></a>00162 <span class="stringliteral">" FLAT_EDGE F2L Table with fitted slitlet edges N 0,1 \n"</span>
-<a name="l00163"></a>00163 <span class="stringliteral">"\n"</span>
-<a name="l00164"></a>00164 <span class="stringliteral">" Output files:\n"</span>
+<a name="l00072"></a>00072 <span class="stringliteral">"The created product, the illumination correction, can be used as input for\n"</span>
+<a name="l00073"></a>00073 <span class="stringliteral">"kmo_std_star and kmo_sci_red.\n"</span>
+<a name="l00074"></a>00074 <span class="stringliteral">"\n"</span>
+<a name="l00075"></a>00075 <span class="stringliteral">"BASIC PARAMETERS:\n"</span>
+<a name="l00076"></a>00076 <span class="stringliteral">"-----------------\n"</span>
+<a name="l00077"></a>00077 <span class="stringliteral">"--imethod\n"</span>
+<a name="l00078"></a>00078 <span class="stringliteral">"The interpolation method used for reconstruction.\n"</span>
+<a name="l00079"></a>00079 <span class="stringliteral">"\n"</span>
+<a name="l00080"></a>00080 <span class="stringliteral">"--range\n"</span>
+<a name="l00081"></a>00081 <span class="stringliteral">"The spectral ranges to combine when collapsing the reconstructed cubes. e.g.\n"</span>
+<a name="l00082"></a>00082 <span class="stringliteral">"\"x1_start,x1_end;x2_start,x2_end\" (microns)\n"</span>
+<a name="l00083"></a>00083 <span class="stringliteral">"\n"</span>
+<a name="l00084"></a>00084 <span class="stringliteral">"ADVANCED PARAMETERS\n"</span>
+<a name="l00085"></a>00085 <span class="stringliteral">"-------------------\n"</span>
+<a name="l00086"></a>00086 <span class="stringliteral">"--flux\n"</span>
+<a name="l00087"></a>00087 <span class="stringliteral">"Specify if flux conservation should be applied.\n"</span>
+<a name="l00088"></a>00088 <span class="stringliteral">"\n"</span>
+<a name="l00089"></a>00089 <span class="stringliteral">"--add-all\n"</span>
+<a name="l00090"></a>00090 <span class="stringliteral">"By default the first FLAT_SKY frame is omitted, since in the\n"</span>
+<a name="l00091"></a>00091 <span class="stringliteral">"KMOS_spec_cal_skyflat template this is an acquisition frame to estimate the\n"</span>
+<a name="l00092"></a>00092 <span class="stringliteral">"needed exposure time for the subsequent FLAT_SKY frames. If anyway all frames\n"</span>
+<a name="l00093"></a>00093 <span class="stringliteral">"should be considered, set this parameter to TRUE.\n"</span>
+<a name="l00094"></a>00094 <span class="stringliteral">"\n"</span>
+<a name="l00095"></a>00095 <span class="stringliteral">"--neighborhoodRange\n"</span>
+<a name="l00096"></a>00096 <span class="stringliteral">"Defines the range to search for neighbors during reconstruction\n"</span>
+<a name="l00097"></a>00097 <span class="stringliteral">"\n"</span>
+<a name="l00098"></a>00098 <span class="stringliteral">"--b_samples\n"</span>
+<a name="l00099"></a>00099 <span class="stringliteral">"The number of samples in spectral direction for the reconstructed cube.\n"</span>
+<a name="l00100"></a>00100 <span class="stringliteral">"Ideally this number should be greater than 2048, the detector size.\n"</span>
+<a name="l00101"></a>00101 <span class="stringliteral">"\n"</span>
+<a name="l00102"></a>00102 <span class="stringliteral">"--b_start\n"</span>
+<a name="l00103"></a>00103 <span class="stringliteral">"--b_end\n"</span>
+<a name="l00104"></a>00104 <span class="stringliteral">"Used to define manually the start and end wavelength for the reconstructed\n"</span>
+<a name="l00105"></a>00105 <span class="stringliteral">"cube. By default the internally defined values are used.\n"</span>
+<a name="l00106"></a>00106 <span class="stringliteral">"\n"</span>
+<a name="l00107"></a>00107 <span class="stringliteral">"--cmethod\n"</span>
+<a name="l00108"></a>00108 <span class="stringliteral">"Following methods of frame combination are available:\n"</span>
+<a name="l00109"></a>00109 <span class="stringliteral">" * 'ksigma' (Default)\n"</span>
+<a name="l00110"></a>00110 <span class="stringliteral">" An iterative sigma clipping. For each position all pixels in the spectrum\n"</span>
+<a name="l00111"></a>00111 <span class="stringliteral">" are examined. If they deviate significantly, they will be rejected according\n"</span>
+<a name="l00112"></a>00112 <span class="stringliteral">" to the conditions:\n"</span>
+<a name="l00113"></a>00113 <span class="stringliteral">" val > mean + stdev * cpos_rej\n"</span>
+<a name="l00114"></a>00114 <span class="stringliteral">" and\n"</span>
+<a name="l00115"></a>00115 <span class="stringliteral">" val < mean - stdev * cneg_rej\n"</span>
+<a name="l00116"></a>00116 <span class="stringliteral">" where --cpos_rej, --cneg_rej and --citer are the corresponding configuration\n"</span>
+<a name="l00117"></a>00117 <span class="stringliteral">" parameters. In the first iteration median and percentile level are used.\n"</span>
+<a name="l00118"></a>00118 <span class="stringliteral">"\n"</span>
+<a name="l00119"></a>00119 <span class="stringliteral">" * 'median'\n"</span>
+<a name="l00120"></a>00120 <span class="stringliteral">" At each pixel position the median is calculated.\n"</span>
+<a name="l00121"></a>00121 <span class="stringliteral">"\n"</span>
+<a name="l00122"></a>00122 <span class="stringliteral">" * 'average'\n"</span>
+<a name="l00123"></a>00123 <span class="stringliteral">" At each pixel position the average is calculated.\n"</span>
+<a name="l00124"></a>00124 <span class="stringliteral">"\n"</span>
+<a name="l00125"></a>00125 <span class="stringliteral">" * 'sum'\n"</span>
+<a name="l00126"></a>00126 <span class="stringliteral">" At each pixel position the sum is calculated.\n"</span>
+<a name="l00127"></a>00127 <span class="stringliteral">"\n"</span>
+<a name="l00128"></a>00128 <span class="stringliteral">" * 'min_max'\n"</span>
+<a name="l00129"></a>00129 <span class="stringliteral">" The specified number of minimum and maximum pixel values will be rejected.\n"</span>
+<a name="l00130"></a>00130 <span class="stringliteral">" --cmax and --cmin apply to this method.\n"</span>
+<a name="l00131"></a>00131 <span class="stringliteral">"\n"</span>
+<a name="l00132"></a>00132 <span class="stringliteral">"--cpos_rej\n"</span>
+<a name="l00133"></a>00133 <span class="stringliteral">"--cneg_rej\n"</span>
+<a name="l00134"></a>00134 <span class="stringliteral">"--citer\n"</span>
+<a name="l00135"></a>00135 <span class="stringliteral">"see --cmethod='ksigma'\n"</span>
+<a name="l00136"></a>00136 <span class="stringliteral">"\n"</span>
+<a name="l00137"></a>00137 <span class="stringliteral">"--cmax\n"</span>
+<a name="l00138"></a>00138 <span class="stringliteral">"--cmin\n"</span>
+<a name="l00139"></a>00139 <span class="stringliteral">"see --cmethod='min_max'\n"</span>
+<a name="l00140"></a>00140 <span class="stringliteral">"\n"</span>
+<a name="l00141"></a>00141 <span class="stringliteral">"--pix_scale\n"</span>
+<a name="l00142"></a>00142 <span class="stringliteral">"Change the pixel scale [arcsec]. Default of 0.2\" results into cubes of\n"</span>
+<a name="l00143"></a>00143 <span class="stringliteral">"14x14pix, a scale of 0.1\" results into cubes of 28x28pix, etc.\n"</span>
+<a name="l00144"></a>00144 <span class="stringliteral">"\n"</span>
+<a name="l00145"></a>00145 <span class="stringliteral">"--suppress_extension\n"</span>
+<a name="l00146"></a>00146 <span class="stringliteral">"If set to TRUE, the arbitrary filename extensions are supressed. If multiple\n"</span>
+<a name="l00147"></a>00147 <span class="stringliteral">"products with the same category are produced, they will be numered consecutively\n"</span>
+<a name="l00148"></a>00148 <span class="stringliteral">"starting from 0.\n"</span>
+<a name="l00149"></a>00149 <span class="stringliteral">"\n"</span>
+<a name="l00150"></a>00150 <span class="stringliteral">"-------------------------------------------------------------------------------\n"</span>
+<a name="l00151"></a>00151 <span class="stringliteral">" Input files:\n"</span>
+<a name="l00152"></a>00152 <span class="stringliteral">"\n"</span>
+<a name="l00153"></a>00153 <span class="stringliteral">" DO KMOS \n"</span>
+<a name="l00154"></a>00154 <span class="stringliteral">" category Type Explanation Required #Frames\n"</span>
+<a name="l00155"></a>00155 <span class="stringliteral">" -------- ----- ----------- -------- -------\n"</span>
+<a name="l00156"></a>00156 <span class="stringliteral">" FLAT_SKY F2D Sky exposures Y 1-n \n"</span>
+<a name="l00157"></a>00157 <span class="stringliteral">" (at least 3 frames recommended) \n"</span>
+<a name="l00158"></a>00158 <span class="stringliteral">" MASTER_DARK F2D Master dark Y 1 \n"</span>
+<a name="l00159"></a>00159 <span class="stringliteral">" MASTER_FLAT F2D Master flat Y 1 \n"</span>
+<a name="l00160"></a>00160 <span class="stringliteral">" XCAL F2D x calibration frame Y 1 \n"</span>
+<a name="l00161"></a>00161 <span class="stringliteral">" YCAL F2D y calibration frame Y 1 \n"</span>
+<a name="l00162"></a>00162 <span class="stringliteral">" LCAL F2D Wavelength calib. frame Y 1 \n"</span>
+<a name="l00163"></a>00163 <span class="stringliteral">" WAVE_BAND F2L Table with start-/end-wavelengths Y 1 \n"</span>
+<a name="l00164"></a>00164 <span class="stringliteral">" FLAT_EDGE F2L Table with fitted slitlet edges N 0,1 \n"</span>
<a name="l00165"></a>00165 <span class="stringliteral">"\n"</span>
-<a name="l00166"></a>00166 <span class="stringliteral">" DO KMOS\n"</span>
-<a name="l00167"></a>00167 <span class="stringliteral">" category Type Explanation\n"</span>
-<a name="l00168"></a>00168 <span class="stringliteral">" -------- ----- -----------\n"</span>
-<a name="l00169"></a>00169 <span class="stringliteral">" ILLUM_CORR F2I Illumination calibration frame \n"</span>
-<a name="l00170"></a>00170 <span class="stringliteral">" If FLAT_EDGE is provided: \n"</span>
-<a name="l00171"></a>00171 <span class="stringliteral">" SKYFLAT_EDGE F2L Frame containing parameters of fitted \n"</span>
-<a name="l00172"></a>00172 <span class="stringliteral">" slitlets of all IFUs of all detectors\n"</span>
-<a name="l00173"></a>00173 <span class="stringliteral">"-------------------------------------------------------------------------------\n"</span>
-<a name="l00174"></a>00174 <span class="stringliteral">"\n"</span>;
-<a name="l00175"></a>00175
-<a name="l00176"></a>00176 <span class="comment">/*-----------------------------------------------------------------------------</span>
-<a name="l00177"></a>00177 <span class="comment"> * Functions code</span>
-<a name="l00178"></a>00178 <span class="comment"> *----------------------------------------------------------------------------*/</span>
-<a name="l00179"></a>00179
-<a name="l00196"></a><a class="code" href="group__kmo__illumination.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693">00196</a> <span class="keywordtype">int</span> <a class="code" href="group__kmo__arithmetic.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693" title="Build the list of available plugins, for this module.">cpl_plugin_get_info</a>(cpl_pluginlist *list)
-<a name="l00197"></a>00197 {
-<a name="l00198"></a>00198 cpl_recipe *recipe = cpl_calloc(1, <span class="keyword">sizeof</span> *recipe);
-<a name="l00199"></a>00199 cpl_plugin *plugin = &recipe->interface;
-<a name="l00200"></a>00200
-<a name="l00201"></a>00201 cpl_plugin_init(plugin,
-<a name="l00202"></a>00202 CPL_PLUGIN_API,
-<a name="l00203"></a>00203 KMOS_BINARY_VERSION,
-<a name="l00204"></a>00204 CPL_PLUGIN_TYPE_RECIPE,
-<a name="l00205"></a>00205 <span class="stringliteral">"kmo_illumination"</span>,
-<a name="l00206"></a>00206 <span class="stringliteral">"Create a calibration frame to correct spatial "</span>
-<a name="l00207"></a>00207 <span class="stringliteral">"non-uniformity of flatfield."</span>,
-<a name="l00208"></a>00208 kmo_illumination_description,
-<a name="l00209"></a>00209 <span class="stringliteral">"Alex Agudo Berbel"</span>,
-<a name="l00210"></a>00210 <span class="stringliteral">"kmos-spark at mpe.mpg.de"</span>,
-<a name="l00211"></a>00211 kmos_get_license(),
-<a name="l00212"></a>00212 kmo_illumination_create,
-<a name="l00213"></a>00213 kmo_illumination_exec,
-<a name="l00214"></a>00214 kmo_illumination_destroy);
-<a name="l00215"></a>00215
-<a name="l00216"></a>00216 cpl_pluginlist_append(list, plugin);
+<a name="l00166"></a>00166 <span class="stringliteral">" Output files:\n"</span>
+<a name="l00167"></a>00167 <span class="stringliteral">"\n"</span>
+<a name="l00168"></a>00168 <span class="stringliteral">" DO KMOS\n"</span>
+<a name="l00169"></a>00169 <span class="stringliteral">" category Type Explanation\n"</span>
+<a name="l00170"></a>00170 <span class="stringliteral">" -------- ----- -----------\n"</span>
+<a name="l00171"></a>00171 <span class="stringliteral">" ILLUM_CORR F2I Illumination calibration frame \n"</span>
+<a name="l00172"></a>00172 <span class="stringliteral">" If FLAT_EDGE is provided: \n"</span>
+<a name="l00173"></a>00173 <span class="stringliteral">" SKYFLAT_EDGE F2L Frame containing parameters of fitted \n"</span>
+<a name="l00174"></a>00174 <span class="stringliteral">" slitlets of all IFUs of all detectors\n"</span>
+<a name="l00175"></a>00175 <span class="stringliteral">"-------------------------------------------------------------------------------\n"</span>
+<a name="l00176"></a>00176 <span class="stringliteral">"\n"</span>;
+<a name="l00177"></a>00177
+<a name="l00178"></a>00178 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00179"></a>00179 <span class="comment"> * Functions code</span>
+<a name="l00180"></a>00180 <span class="comment"> *----------------------------------------------------------------------------*/</span>
+<a name="l00181"></a>00181
+<a name="l00198"></a><a class="code" href="group__kmo__illumination.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693">00198</a> <span class="keywordtype">int</span> <a class="code" href="group__kmo__arithmetic.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693" title="Build the list of available plugins, for this module.">cpl_plugin_get_info</a>(cpl_pluginlist *list)
+<a name="l00199"></a>00199 {
+<a name="l00200"></a>00200 cpl_recipe *recipe = cpl_calloc(1, <span class="keyword">sizeof</span> *recipe);
+<a name="l00201"></a>00201 cpl_plugin *plugin = &recipe->interface;
+<a name="l00202"></a>00202
+<a name="l00203"></a>00203 cpl_plugin_init(plugin,
+<a name="l00204"></a>00204 CPL_PLUGIN_API,
+<a name="l00205"></a>00205 KMOS_BINARY_VERSION,
+<a name="l00206"></a>00206 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00207"></a>00207 <span class="stringliteral">"kmo_illumination"</span>,
+<a name="l00208"></a>00208 <span class="stringliteral">"Create a calibration frame to correct spatial "</span>
+<a name="l00209"></a>00209 <span class="stringliteral">"non-uniformity of flatfield."</span>,
+<a name="l00210"></a>00210 kmo_illumination_description,
+<a name="l00211"></a>00211 <span class="stringliteral">"Alex Agudo Berbel"</span>,
+<a name="l00212"></a>00212 <span class="stringliteral">"kmos-spark at mpe.mpg.de"</span>,
+<a name="l00213"></a>00213 kmos_get_license(),
+<a name="l00214"></a>00214 kmo_illumination_create,
+<a name="l00215"></a>00215 kmo_illumination_exec,
+<a name="l00216"></a>00216 kmo_illumination_destroy);
<a name="l00217"></a>00217
-<a name="l00218"></a>00218 <span class="keywordflow">return</span> 0;
-<a name="l00219"></a>00219 }
-<a name="l00220"></a>00220
-<a name="l00228"></a>00228 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_create(cpl_plugin *plugin)
-<a name="l00229"></a>00229 {
-<a name="l00230"></a>00230 cpl_recipe *recipe;
-<a name="l00231"></a>00231 cpl_parameter *p;
-<a name="l00232"></a>00232
-<a name="l00233"></a>00233 <span class="comment">/* Check that the plugin is part of a valid recipe */</span>
-<a name="l00234"></a>00234 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
-<a name="l00235"></a>00235 recipe = (cpl_recipe *)plugin;
-<a name="l00236"></a>00236 <span class="keywordflow">else</span>
-<a name="l00237"></a>00237 <span class="keywordflow">return</span> -1;
-<a name="l00238"></a>00238
-<a name="l00239"></a>00239 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
-<a name="l00240"></a>00240 recipe->parameters = cpl_parameterlist_new();
-<a name="l00241"></a>00241
-<a name="l00242"></a>00242 <span class="comment">/* Fill the parameters list */</span>
-<a name="l00243"></a>00243 <span class="comment">/* --imethod */</span>
-<a name="l00244"></a>00244 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.imethod"</span>,
-<a name="l00245"></a>00245 CPL_TYPE_STRING,
-<a name="l00246"></a>00246 <span class="stringliteral">"Method to use for interpolation: "</span>
-<a name="l00247"></a>00247 <span class="stringliteral">"[\"NN\" (nearest neighbour), "</span>
-<a name="l00248"></a>00248 <span class="stringliteral">"\"lwNN\" (linear weighted nearest neighbor),"</span>
-<a name="l00249"></a>00249 <span class="stringliteral">"\"swNN\" (square weighted nearest neighbor)"</span>
-<a name="l00250"></a>00250 <span class="stringliteral">"\"MS\" (Modified Shepard's method)"</span>
-<a name="l00251"></a>00251 <span class="stringliteral">"\"CS\" (Cubic spline)]"</span>,
-<a name="l00252"></a>00252 <span class="stringliteral">"kmos.kmo_illumination"</span>,
-<a name="l00253"></a>00253 <span class="stringliteral">"CS"</span>);
-<a name="l00254"></a>00254 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"imethod"</span>);
-<a name="l00255"></a>00255 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00256"></a>00256 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00257"></a>00257
-<a name="l00258"></a>00258 <span class="comment">/* --neighborhoodRange */</span>
-<a name="l00259"></a>00259 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.neighborhoodRange"</span>,
-<a name="l00260"></a>00260 CPL_TYPE_DOUBLE,
-<a name="l00261"></a>00261 <span class="stringliteral">"Defines the range to search for neighbors."</span>
-<a name="l00262"></a>00262 <span class="stringliteral">"in pixels"</span>,
-<a name="l00263"></a>00263 <span class="stringliteral">"kmos.kmo_illumination"</span>,
-<a name="l00264"></a>00264 1.001);
-<a name="l00265"></a>00265 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"neighborhoodRange"</span>);
-<a name="l00266"></a>00266 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00267"></a>00267 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00268"></a>00268
-<a name="l00269"></a>00269 <span class="comment">/* --range */</span>
-<a name="l00270"></a>00270 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.range"</span>,
-<a name="l00271"></a>00271 CPL_TYPE_STRING,
-<a name="l00272"></a>00272 <span class="stringliteral">"The spectral ranges to combine when collapsing"</span>
-<a name="l00273"></a>00273 <span class="stringliteral">"the reconstructed cubes. e.g."</span>
-<a name="l00274"></a>00274 <span class="stringliteral">"\"x1_start,x1_end;x2_start,x2_end\" (microns)"</span>,
-<a name="l00275"></a>00275 <span class="stringliteral">"kmos.kmo_illumination"</span>,
-<a name="l00276"></a>00276 <span class="stringliteral">""</span>);
-<a name="l00277"></a>00277 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"range"</span>);
-<a name="l00278"></a>00278 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00279"></a>00279 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00280"></a>00280
-<a name="l00281"></a>00281 <span class="comment">/* --flux */</span>
-<a name="l00282"></a>00282 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.flux"</span>,
-<a name="l00283"></a>00283 CPL_TYPE_BOOL,
-<a name="l00284"></a>00284 <span class="stringliteral">"TRUE: Apply flux conservation. FALSE: otherwise"</span>,
-<a name="l00285"></a>00285 <span class="stringliteral">"kmos.kmo_illumination"</span>,
-<a name="l00286"></a>00286 FALSE);
-<a name="l00287"></a>00287 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"flux"</span>);
-<a name="l00288"></a>00288 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00289"></a>00289 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00290"></a>00290
-<a name="l00291"></a>00291 <span class="comment">/* --add-all */</span>
-<a name="l00292"></a>00292 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.add-all"</span>,
-<a name="l00293"></a>00293 CPL_TYPE_BOOL,
-<a name="l00294"></a>00294 <span class="stringliteral">"FALSE: omit 1st FLAT_SKY frame (acquisition), "</span>
-<a name="l00295"></a>00295 <span class="stringliteral">"TRUE: don't perform any checks, add them all"</span>,
-<a name="l00296"></a>00296 <span class="stringliteral">"kmos.kmo_illumination"</span>,
-<a name="l00297"></a>00297 FALSE);
-<a name="l00298"></a>00298 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"add-all"</span>);
-<a name="l00299"></a>00299 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00300"></a>00300 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00301"></a>00301
-<a name="l00302"></a>00302 <span class="comment">/* --pix_scale */</span>
-<a name="l00303"></a>00303 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.pix_scale"</span>,
-<a name="l00304"></a>00304 CPL_TYPE_DOUBLE,
-<a name="l00305"></a>00305 <span class="stringliteral">"Change the pixel scale [arcsec]. "</span>
-<a name="l00306"></a>00306 <span class="stringliteral">"Default of 0.2\" results into cubes of 14x14pix, "</span>
-<a name="l00307"></a>00307 <span class="stringliteral">"a scale of 0.1\" results into cubes of 28x28pix, "</span>
-<a name="l00308"></a>00308 <span class="stringliteral">"etc."</span>,
-<a name="l00309"></a>00309 <span class="stringliteral">"kmos.kmo_illumination"</span>,
-<a name="l00310"></a>00310 KMOS_PIX_RESOLUTION);
-<a name="l00311"></a>00311 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"pix_scale"</span>);
-<a name="l00312"></a>00312 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00313"></a>00313 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00314"></a>00314
-<a name="l00315"></a>00315 <span class="comment">/* --suppress_extension */</span>
-<a name="l00316"></a>00316 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.suppress_extension"</span>,
-<a name="l00317"></a>00317 CPL_TYPE_BOOL,
-<a name="l00318"></a>00318 <span class="stringliteral">"Suppress arbitrary filename extension."</span>
-<a name="l00319"></a>00319 <span class="stringliteral">"(TRUE (apply) or FALSE (don't apply)"</span>,
-<a name="l00320"></a>00320 <span class="stringliteral">"kmos.kmo_illumination"</span>,
-<a name="l00321"></a>00321 FALSE);
-<a name="l00322"></a>00322 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"suppress_extension"</span>);
-<a name="l00323"></a>00323 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00324"></a>00324 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00325"></a>00325
-<a name="l00326"></a>00326 <span class="comment">// add parameters for band-definition</span>
-<a name="l00327"></a>00327 kmo_band_pars_create(recipe->parameters,
-<a name="l00328"></a>00328 <span class="stringliteral">"kmos.kmo_illumination"</span>);
-<a name="l00329"></a>00329
-<a name="l00330"></a>00330 <span class="comment">// add parameters for combining</span>
-<a name="l00331"></a>00331 <span class="keywordflow">return</span> kmo_combine_pars_create(recipe->parameters,
-<a name="l00332"></a>00332 <span class="stringliteral">"kmos.kmo_illumination"</span>,
-<a name="l00333"></a>00333 DEF_REJ_METHOD,
-<a name="l00334"></a>00334 FALSE);
-<a name="l00335"></a>00335 }
-<a name="l00336"></a>00336
-<a name="l00342"></a>00342 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_exec(cpl_plugin *plugin)
-<a name="l00343"></a>00343 {
-<a name="l00344"></a>00344 cpl_recipe *recipe;
-<a name="l00345"></a>00345
-<a name="l00346"></a>00346 <span class="comment">/* Get the recipe out of the plugin */</span>
-<a name="l00347"></a>00347 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
-<a name="l00348"></a>00348 recipe = (cpl_recipe *)plugin;
-<a name="l00349"></a>00349 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1;
-<a name="l00350"></a>00350
-<a name="l00351"></a>00351 <span class="keywordflow">return</span> kmo_illumination(recipe->parameters, recipe->frames);
-<a name="l00352"></a>00352 }
-<a name="l00353"></a>00353
-<a name="l00359"></a>00359 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_destroy(cpl_plugin *plugin)
-<a name="l00360"></a>00360 {
-<a name="l00361"></a>00361 cpl_recipe *recipe;
-<a name="l00362"></a>00362
-<a name="l00363"></a>00363 <span class="comment">/* Get the recipe out of the plugin */</span>
-<a name="l00364"></a>00364 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
-<a name="l00365"></a>00365 recipe = (cpl_recipe *)plugin;
-<a name="l00366"></a>00366 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
-<a name="l00367"></a>00367
-<a name="l00368"></a>00368 cpl_parameterlist_delete(recipe->parameters);
-<a name="l00369"></a>00369 <span class="keywordflow">return</span> 0 ;
-<a name="l00370"></a>00370 }
-<a name="l00371"></a>00371
-<a name="l00386"></a>00386 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
-<a name="l00387"></a>00387 {
-<a name="l00388"></a>00388 <span class="keywordtype">int</span> ret_val = 0,
-<a name="l00389"></a>00389 nr_devices = 0,
-<a name="l00390"></a>00390 ifu_nr = 0,
-<a name="l00391"></a>00391 nx = 0,
-<a name="l00392"></a>00392 ny = 0,
-<a name="l00393"></a>00393 process_noise = FALSE,
-<a name="l00394"></a>00394 cmax = 0,
-<a name="l00395"></a>00395 cmin = 0,
-<a name="l00396"></a>00396 citer = 0,
-<a name="l00397"></a>00397 *bounds = NULL,
-<a name="l00398"></a>00398 cnt = 0,
-<a name="l00399"></a>00399 qc_max_dev_id = 0,
-<a name="l00400"></a>00400 qc_max_nonunif_id = 0,
-<a name="l00401"></a>00401 flux = FALSE,
-<a name="l00402"></a>00402 background = FALSE,
-<a name="l00403"></a>00403 add_all_sky = FALSE,
-<a name="l00404"></a>00404 same_exptime = TRUE,
-<a name="l00405"></a>00405 suppress_extension = FALSE,
-<a name="l00406"></a>00406 has_flat_edge = FALSE,
-<a name="l00407"></a>00407 i = 0, j = 0, x = 0, y = 0, ix = 0, iy = 0, det_nr = 0, edgeNr = 0;
-<a name="l00408"></a>00408 <span class="keyword">const</span> <span class="keywordtype">int</span> *punused_ifus = NULL;
-<a name="l00409"></a>00409 <span class="keywordtype">float</span> *pbad_pix_mask = NULL;
-<a name="l00410"></a>00410 <span class="keywordtype">double</span> exptime = 0.,
-<a name="l00411"></a>00411 exptime1 = 0.,
-<a name="l00412"></a>00412 exptime2 = 0.,
-<a name="l00413"></a>00413 cpos_rej = 0.0,
-<a name="l00414"></a>00414 cneg_rej = 0.0,
-<a name="l00415"></a>00415 neighborhoodRange = 1.001,
-<a name="l00416"></a>00416 mean_data = 0.0,
-<a name="l00417"></a>00417 ifu_crpix = 0.0,
-<a name="l00418"></a>00418 ifu_crval = 0.0,
-<a name="l00419"></a>00419 ifu_cdelt = 0.0,
-<a name="l00420"></a>00420 qc_spat_unif = 0.0,
-<a name="l00421"></a>00421 qc_max_dev = 0.0,
-<a name="l00422"></a>00422 qc_max_nonunif = 0.0,
-<a name="l00423"></a>00423 tmp_stdev = 0.0,
-<a name="l00424"></a>00424 tmp_mean = 0.0,
-<a name="l00425"></a>00425 rotangle = 0.0,
-<a name="l00426"></a>00426 tmp_rotangle = 0.0,
-<a name="l00427"></a>00427 rotangle_found = 0.0,
-<a name="l00428"></a>00428 pix_scale = 0.0;
-<a name="l00429"></a>00429 <span class="keywordtype">char</span> *keyword = NULL,
-<a name="l00430"></a>00430 *fn_lut = NULL,
-<a name="l00431"></a>00431 *suffix = NULL,
-<a name="l00432"></a>00432 *fn_suffix = NULL,
-<a name="l00433"></a>00433 *extname = NULL,
-<a name="l00434"></a>00434 *filter = NULL;
-<a name="l00435"></a>00435 <span class="keyword">const</span> <span class="keywordtype">char</span> *method = NULL,
-<a name="l00436"></a>00436 *cmethod = NULL,
-<a name="l00437"></a>00437 *filter_id_l = NULL,
-<a name="l00438"></a>00438 *filter_id = NULL,
-<a name="l00439"></a>00439 *ranges_txt = NULL;
-<a name="l00440"></a>00440 cpl_array *calTimestamp = NULL,
-<a name="l00441"></a>00441 **unused_ifus_before = NULL,
-<a name="l00442"></a>00442 **unused_ifus_after = NULL;
-<a name="l00443"></a>00443 cpl_frame *frame = NULL,
-<a name="l00444"></a>00444 *xcalFrame = NULL,
-<a name="l00445"></a>00445 *ycalFrame = NULL,
-<a name="l00446"></a>00446 *lcalFrame = NULL;
-<a name="l00447"></a>00447 cpl_frameset *frameset_sky = NULL;
-<a name="l00448"></a>00448 cpl_image *img_in = NULL,
-<a name="l00449"></a>00449 *img_dark = NULL,
-<a name="l00450"></a>00450 *img_dark_noise = NULL,
-<a name="l00451"></a>00451 *img_flat = NULL,
-<a name="l00452"></a>00452 *img_flat_noise = NULL,
-<a name="l00453"></a>00453 *combined_data = NULL,
-<a name="l00454"></a>00454 *combined_noise = NULL,
-<a name="l00455"></a>00455 *xcal = NULL,
-<a name="l00456"></a>00456 *ycal = NULL,
-<a name="l00457"></a>00457 *lcal = NULL,
-<a name="l00458"></a>00458 *bad_pix_mask = NULL,
-<a name="l00459"></a>00459 *data_ifu = NULL,
-<a name="l00460"></a>00460 *noise_ifu = NULL,
-<a name="l00461"></a>00461 **stored_data_images = NULL,
-<a name="l00462"></a>00462 **stored_noise_images = NULL;
-<a name="l00463"></a>00463 cpl_imagelist *cube_data = NULL,
-<a name="l00464"></a>00464 *cube_noise = NULL,
-<a name="l00465"></a>00465 *detector_in = NULL,
-<a name="l00466"></a>00466 **stored_data_cubes = NULL,
-<a name="l00467"></a>00467 **stored_noise_cubes = NULL;
-<a name="l00468"></a>00468 cpl_matrix **edgepars = NULL;
-<a name="l00469"></a>00469 cpl_propertylist *main_header = NULL,
-<a name="l00470"></a>00470 *tmp_header = NULL,
-<a name="l00471"></a>00471 *sub_header = NULL,
-<a name="l00472"></a>00472 **stored_sub_data_headers = NULL,
-<a name="l00473"></a>00473 **stored_sub_noise_headers = NULL;
-<a name="l00474"></a>00474 cpl_table *band_table = NULL,
-<a name="l00475"></a>00475 ***edge_table_sky = NULL,
-<a name="l00476"></a>00476 **edge_table_flat = NULL;
-<a name="l00477"></a>00477 cpl_vector *ranges = NULL,
-<a name="l00478"></a>00478 *identified_slices = NULL,
-<a name="l00479"></a>00479 *calAngles = NULL,
-<a name="l00480"></a>00480 **slitlet_ids = NULL,
-<a name="l00481"></a>00481 *shift_vec = NULL,
-<a name="l00482"></a>00482 *edge_vec = NULL;
-<a name="l00483"></a>00483 main_fits_desc desc_sky,
-<a name="l00484"></a>00484 desc_dark,
-<a name="l00485"></a>00485 desc_flat,
-<a name="l00486"></a>00486 desc_xcal,
-<a name="l00487"></a>00487 desc_ycal,
-<a name="l00488"></a>00488 desc_lcal;
-<a name="l00489"></a>00489 gridDefinition gd;
-<a name="l00490"></a>00490
-<a name="l00491"></a>00491 KMO_TRY
-<a name="l00492"></a>00492 {
-<a name="l00493"></a>00493 kmo_init_fits_desc(&desc_sky);
-<a name="l00494"></a>00494 kmo_init_fits_desc(&desc_dark);
-<a name="l00495"></a>00495 kmo_init_fits_desc(&desc_flat);
-<a name="l00496"></a>00496 kmo_init_fits_desc(&desc_xcal);
-<a name="l00497"></a>00497 kmo_init_fits_desc(&desc_ycal);
-<a name="l00498"></a>00498 kmo_init_fits_desc(&desc_lcal);
-<a name="l00499"></a>00499
-<a name="l00500"></a>00500 <span class="comment">/* --- check input --- */</span>
-<a name="l00501"></a>00501 KMO_TRY_ASSURE((parlist != NULL) &&
-<a name="l00502"></a>00502 (frameset != NULL),
-<a name="l00503"></a>00503 CPL_ERROR_NULL_INPUT,
-<a name="l00504"></a>00504 <span class="stringliteral">"Not all input data is provided!"</span>);
-<a name="l00505"></a>00505
-<a name="l00506"></a>00506 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, FLAT_SKY) >= 1,
-<a name="l00507"></a>00507 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00508"></a>00508 <span class="stringliteral">"One or more FLAT_SKY frames are required!"</span>);
-<a name="l00509"></a>00509
-<a name="l00510"></a>00510 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, FLAT_SKY) < 3) {
-<a name="l00511"></a>00511 cpl_msg_warning(cpl_func, <span class="stringliteral">"It is recommended to provide at least "</span>
-<a name="l00512"></a>00512 <span class="stringliteral">"3 FLAT_SKY frames!"</span>);
-<a name="l00513"></a>00513 }
-<a name="l00514"></a>00514
-<a name="l00515"></a>00515 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, MASTER_DARK) == 1,
-<a name="l00516"></a>00516 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00517"></a>00517 <span class="stringliteral">"Exactly one MASTER_DARK frame is required!"</span>);
-<a name="l00518"></a>00518
-<a name="l00519"></a>00519 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, MASTER_FLAT) == 1,
-<a name="l00520"></a>00520 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00521"></a>00521 <span class="stringliteral">"Exactly one MASTER_FLAT frame is required!"</span>);
-<a name="l00522"></a>00522
-<a name="l00523"></a>00523 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, XCAL) == 1,
-<a name="l00524"></a>00524 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00525"></a>00525 <span class="stringliteral">"Exactly one XCAL frame is required!"</span>);
-<a name="l00526"></a>00526
-<a name="l00527"></a>00527 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, YCAL) == 1,
-<a name="l00528"></a>00528 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00529"></a>00529 <span class="stringliteral">"Exactly one YCAL frame is required!"</span>);
-<a name="l00530"></a>00530
-<a name="l00531"></a>00531 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, LCAL) == 1,
-<a name="l00532"></a>00532 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00533"></a>00533 <span class="stringliteral">"Exactly one LCAL frame is required!"</span>);
-<a name="l00534"></a>00534
-<a name="l00535"></a>00535 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, WAVE_BAND) == 1,
-<a name="l00536"></a>00536 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00537"></a>00537 <span class="stringliteral">"Exactly one WAVE_BAND frame is required!"</span>);
-<a name="l00538"></a>00538
-<a name="l00539"></a>00539 KMO_TRY_ASSURE((cpl_frameset_count_tags(frameset, FLAT_EDGE) == 1) ||
-<a name="l00540"></a>00540 (cpl_frameset_count_tags(frameset, FLAT_EDGE) == 0),
-<a name="l00541"></a>00541 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00542"></a>00542 <span class="stringliteral">"Exactly one FLAT_EDGE frame is required!"</span>);
-<a name="l00543"></a>00543
-<a name="l00544"></a>00544 has_flat_edge = cpl_frameset_count_tags(frameset, FLAT_EDGE);
+<a name="l00218"></a>00218 cpl_pluginlist_append(list, plugin);
+<a name="l00219"></a>00219
+<a name="l00220"></a>00220 <span class="keywordflow">return</span> 0;
+<a name="l00221"></a>00221 }
+<a name="l00222"></a>00222
+<a name="l00230"></a>00230 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_create(cpl_plugin *plugin)
+<a name="l00231"></a>00231 {
+<a name="l00232"></a>00232 cpl_recipe *recipe;
+<a name="l00233"></a>00233 cpl_parameter *p;
+<a name="l00234"></a>00234
+<a name="l00235"></a>00235 <span class="comment">/* Check that the plugin is part of a valid recipe */</span>
+<a name="l00236"></a>00236 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00237"></a>00237 recipe = (cpl_recipe *)plugin;
+<a name="l00238"></a>00238 <span class="keywordflow">else</span>
+<a name="l00239"></a>00239 <span class="keywordflow">return</span> -1;
+<a name="l00240"></a>00240
+<a name="l00241"></a>00241 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00242"></a>00242 recipe->parameters = cpl_parameterlist_new();
+<a name="l00243"></a>00243
+<a name="l00244"></a>00244 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00245"></a>00245 <span class="comment">/* --imethod */</span>
+<a name="l00246"></a>00246 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.imethod"</span>,
+<a name="l00247"></a>00247 CPL_TYPE_STRING,
+<a name="l00248"></a>00248 <span class="stringliteral">"Method to use for interpolation: "</span>
+<a name="l00249"></a>00249 <span class="stringliteral">"[\"NN\" (nearest neighbour), "</span>
+<a name="l00250"></a>00250 <span class="stringliteral">"\"lwNN\" (linear weighted nearest neighbor), "</span>
+<a name="l00251"></a>00251 <span class="stringliteral">"\"swNN\" (square weighted nearest neighbor), "</span>
+<a name="l00252"></a>00252 <span class="stringliteral">"\"MS\" (Modified Shepard's method), "</span>
+<a name="l00253"></a>00253 <span class="stringliteral">"\"CS\" (Cubic spline)]"</span>,
+<a name="l00254"></a>00254 <span class="stringliteral">"kmos.kmo_illumination"</span>,
+<a name="l00255"></a>00255 <span class="stringliteral">"CS"</span>);
+<a name="l00256"></a>00256 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"imethod"</span>);
+<a name="l00257"></a>00257 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00258"></a>00258 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00259"></a>00259
+<a name="l00260"></a>00260 <span class="comment">/* --neighborhoodRange */</span>
+<a name="l00261"></a>00261 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.neighborhoodRange"</span>,
+<a name="l00262"></a>00262 CPL_TYPE_DOUBLE,
+<a name="l00263"></a>00263 <span class="stringliteral">"Defines the range to search for neighbors. "</span>
+<a name="l00264"></a>00264 <span class="stringliteral">"in pixels"</span>,
+<a name="l00265"></a>00265 <span class="stringliteral">"kmos.kmo_illumination"</span>,
+<a name="l00266"></a>00266 1.001);
+<a name="l00267"></a>00267 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"neighborhoodRange"</span>);
+<a name="l00268"></a>00268 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00269"></a>00269 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00270"></a>00270
+<a name="l00271"></a>00271 <span class="comment">/* --range */</span>
+<a name="l00272"></a>00272 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.range"</span>,
+<a name="l00273"></a>00273 CPL_TYPE_STRING,
+<a name="l00274"></a>00274 <span class="stringliteral">"The spectral ranges to combine when collapsing "</span>
+<a name="l00275"></a>00275 <span class="stringliteral">"the reconstructed cubes. e.g. "</span>
+<a name="l00276"></a>00276 <span class="stringliteral">"\"x1_start,x1_end;x2_start,x2_end\" (microns)"</span>,
+<a name="l00277"></a>00277 <span class="stringliteral">"kmos.kmo_illumination"</span>,
+<a name="l00278"></a>00278 <span class="stringliteral">""</span>);
+<a name="l00279"></a>00279 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"range"</span>);
+<a name="l00280"></a>00280 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00281"></a>00281 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00282"></a>00282
+<a name="l00283"></a>00283 <span class="comment">/* --flux */</span>
+<a name="l00284"></a>00284 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.flux"</span>,
+<a name="l00285"></a>00285 CPL_TYPE_BOOL,
+<a name="l00286"></a>00286 <span class="stringliteral">"TRUE: Apply flux conservation. FALSE: otherwise"</span>,
+<a name="l00287"></a>00287 <span class="stringliteral">"kmos.kmo_illumination"</span>,
+<a name="l00288"></a>00288 FALSE);
+<a name="l00289"></a>00289 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"flux"</span>);
+<a name="l00290"></a>00290 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00291"></a>00291 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00292"></a>00292
+<a name="l00293"></a>00293 <span class="comment">/* --add-all */</span>
+<a name="l00294"></a>00294 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.add-all"</span>,
+<a name="l00295"></a>00295 CPL_TYPE_BOOL,
+<a name="l00296"></a>00296 <span class="stringliteral">"FALSE: omit 1st FLAT_SKY frame (acquisition), "</span>
+<a name="l00297"></a>00297 <span class="stringliteral">"TRUE: don't perform any checks, add them all"</span>,
+<a name="l00298"></a>00298 <span class="stringliteral">"kmos.kmo_illumination"</span>,
+<a name="l00299"></a>00299 FALSE);
+<a name="l00300"></a>00300 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"add-all"</span>);
+<a name="l00301"></a>00301 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00302"></a>00302 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00303"></a>00303
+<a name="l00304"></a>00304 <span class="comment">/* --pix_scale */</span>
+<a name="l00305"></a>00305 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.pix_scale"</span>,
+<a name="l00306"></a>00306 CPL_TYPE_DOUBLE,
+<a name="l00307"></a>00307 <span class="stringliteral">"Change the pixel scale [arcsec]. "</span>
+<a name="l00308"></a>00308 <span class="stringliteral">"Default of 0.2\" results into cubes of 14x14pix, "</span>
+<a name="l00309"></a>00309 <span class="stringliteral">"a scale of 0.1\" results into cubes of 28x28pix, "</span>
+<a name="l00310"></a>00310 <span class="stringliteral">"etc."</span>,
+<a name="l00311"></a>00311 <span class="stringliteral">"kmos.kmo_illumination"</span>,
+<a name="l00312"></a>00312 KMOS_PIX_RESOLUTION);
+<a name="l00313"></a>00313 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"pix_scale"</span>);
+<a name="l00314"></a>00314 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00315"></a>00315 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00316"></a>00316
+<a name="l00317"></a>00317 <span class="comment">/* --suppress_extension */</span>
+<a name="l00318"></a>00318 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination.suppress_extension"</span>,
+<a name="l00319"></a>00319 CPL_TYPE_BOOL,
+<a name="l00320"></a>00320 <span class="stringliteral">"Suppress arbitrary filename extension. "</span>
+<a name="l00321"></a>00321 <span class="stringliteral">"(TRUE (apply) or FALSE (don't apply)"</span>,
+<a name="l00322"></a>00322 <span class="stringliteral">"kmos.kmo_illumination"</span>,
+<a name="l00323"></a>00323 FALSE);
+<a name="l00324"></a>00324 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"suppress_extension"</span>);
+<a name="l00325"></a>00325 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00326"></a>00326 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00327"></a>00327
+<a name="l00328"></a>00328 <span class="comment">// add parameters for band-definition</span>
+<a name="l00329"></a>00329 kmo_band_pars_create(recipe->parameters,
+<a name="l00330"></a>00330 <span class="stringliteral">"kmos.kmo_illumination"</span>);
+<a name="l00331"></a>00331
+<a name="l00332"></a>00332 <span class="comment">// add parameters for combining</span>
+<a name="l00333"></a>00333 <span class="keywordflow">return</span> kmo_combine_pars_create(recipe->parameters,
+<a name="l00334"></a>00334 <span class="stringliteral">"kmos.kmo_illumination"</span>,
+<a name="l00335"></a>00335 DEF_REJ_METHOD,
+<a name="l00336"></a>00336 FALSE);
+<a name="l00337"></a>00337 }
+<a name="l00338"></a>00338
+<a name="l00344"></a>00344 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_exec(cpl_plugin *plugin)
+<a name="l00345"></a>00345 {
+<a name="l00346"></a>00346 cpl_recipe *recipe;
+<a name="l00347"></a>00347
+<a name="l00348"></a>00348 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00349"></a>00349 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00350"></a>00350 recipe = (cpl_recipe *)plugin;
+<a name="l00351"></a>00351 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1;
+<a name="l00352"></a>00352
+<a name="l00353"></a>00353 <span class="keywordflow">return</span> kmo_illumination(recipe->parameters, recipe->frames);
+<a name="l00354"></a>00354 }
+<a name="l00355"></a>00355
+<a name="l00361"></a>00361 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_destroy(cpl_plugin *plugin)
+<a name="l00362"></a>00362 {
+<a name="l00363"></a>00363 cpl_recipe *recipe;
+<a name="l00364"></a>00364
+<a name="l00365"></a>00365 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00366"></a>00366 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00367"></a>00367 recipe = (cpl_recipe *)plugin;
+<a name="l00368"></a>00368 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00369"></a>00369
+<a name="l00370"></a>00370 cpl_parameterlist_delete(recipe->parameters);
+<a name="l00371"></a>00371 <span class="keywordflow">return</span> 0 ;
+<a name="l00372"></a>00372 }
+<a name="l00373"></a>00373
+<a name="l00388"></a>00388 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
+<a name="l00389"></a>00389 {
+<a name="l00390"></a>00390 <span class="keywordtype">int</span> ret_val = 0,
+<a name="l00391"></a>00391 nr_devices = 0,
+<a name="l00392"></a>00392 ifu_nr = 0,
+<a name="l00393"></a>00393 nx = 0,
+<a name="l00394"></a>00394 ny = 0,
+<a name="l00395"></a>00395 process_noise = FALSE,
+<a name="l00396"></a>00396 cmax = 0,
+<a name="l00397"></a>00397 cmin = 0,
+<a name="l00398"></a>00398 citer = 0,
+<a name="l00399"></a>00399 *bounds = NULL,
+<a name="l00400"></a>00400 cnt = 0,
+<a name="l00401"></a>00401 qc_max_dev_id = 0,
+<a name="l00402"></a>00402 qc_max_nonunif_id = 0,
+<a name="l00403"></a>00403 flux = FALSE,
+<a name="l00404"></a>00404 background = FALSE,
+<a name="l00405"></a>00405 add_all_sky = FALSE,
+<a name="l00406"></a>00406 same_exptime = TRUE,
+<a name="l00407"></a>00407 suppress_extension = FALSE,
+<a name="l00408"></a>00408 has_flat_edge = FALSE,
+<a name="l00409"></a>00409 i = 0, j = 0, x = 0, y = 0, ix = 0, iy = 0, det_nr = 0, edgeNr = 0;
+<a name="l00410"></a>00410 <span class="keyword">const</span> <span class="keywordtype">int</span> *punused_ifus = NULL;
+<a name="l00411"></a>00411 <span class="keywordtype">float</span> *pbad_pix_mask = NULL;
+<a name="l00412"></a>00412 <span class="keywordtype">double</span> exptime = 0.,
+<a name="l00413"></a>00413 exptime1 = 0.,
+<a name="l00414"></a>00414 exptime2 = 0.,
+<a name="l00415"></a>00415 cpos_rej = 0.0,
+<a name="l00416"></a>00416 cneg_rej = 0.0,
+<a name="l00417"></a>00417 neighborhoodRange = 1.001,
+<a name="l00418"></a>00418 mean_data = 0.0,
+<a name="l00419"></a>00419 ifu_crpix = 0.0,
+<a name="l00420"></a>00420 ifu_crval = 0.0,
+<a name="l00421"></a>00421 ifu_cdelt = 0.0,
+<a name="l00422"></a>00422 qc_spat_unif = 0.0,
+<a name="l00423"></a>00423 qc_max_dev = 0.0,
+<a name="l00424"></a>00424 qc_max_nonunif = 0.0,
+<a name="l00425"></a>00425 tmp_stdev = 0.0,
+<a name="l00426"></a>00426 tmp_mean = 0.0,
+<a name="l00427"></a>00427 rotangle = 0.0,
+<a name="l00428"></a>00428 tmp_rotangle = 0.0,
+<a name="l00429"></a>00429 rotangle_found = 0.0,
+<a name="l00430"></a>00430 pix_scale = 0.0;
+<a name="l00431"></a>00431 <span class="keywordtype">char</span> *keyword = NULL,
+<a name="l00432"></a>00432 *fn_lut = NULL,
+<a name="l00433"></a>00433 *suffix = NULL,
+<a name="l00434"></a>00434 *fn_suffix = NULL,
+<a name="l00435"></a>00435 *extname = NULL,
+<a name="l00436"></a>00436 *filter = NULL;
+<a name="l00437"></a>00437 <span class="keyword">const</span> <span class="keywordtype">char</span> *method = NULL,
+<a name="l00438"></a>00438 *cmethod = NULL,
+<a name="l00439"></a>00439 *filter_id_l = NULL,
+<a name="l00440"></a>00440 *filter_id = NULL,
+<a name="l00441"></a>00441 *ranges_txt = NULL;
+<a name="l00442"></a>00442 cpl_array *calTimestamp = NULL,
+<a name="l00443"></a>00443 **unused_ifus_before = NULL,
+<a name="l00444"></a>00444 **unused_ifus_after = NULL;
+<a name="l00445"></a>00445 cpl_frame *frame = NULL,
+<a name="l00446"></a>00446 *xcalFrame = NULL,
+<a name="l00447"></a>00447 *ycalFrame = NULL,
+<a name="l00448"></a>00448 *lcalFrame = NULL;
+<a name="l00449"></a>00449 cpl_frameset *frameset_sky = NULL;
+<a name="l00450"></a>00450 cpl_image *img_in = NULL,
+<a name="l00451"></a>00451 *img_dark = NULL,
+<a name="l00452"></a>00452 *img_dark_noise = NULL,
+<a name="l00453"></a>00453 *img_flat = NULL,
+<a name="l00454"></a>00454 *img_flat_noise = NULL,
+<a name="l00455"></a>00455 *combined_data = NULL,
+<a name="l00456"></a>00456 *combined_noise = NULL,
+<a name="l00457"></a>00457 *xcal = NULL,
+<a name="l00458"></a>00458 *ycal = NULL,
+<a name="l00459"></a>00459 *lcal = NULL,
+<a name="l00460"></a>00460 *bad_pix_mask = NULL,
+<a name="l00461"></a>00461 *data_ifu = NULL,
+<a name="l00462"></a>00462 *noise_ifu = NULL,
+<a name="l00463"></a>00463 **stored_data_images = NULL,
+<a name="l00464"></a>00464 **stored_noise_images = NULL;
+<a name="l00465"></a>00465 cpl_imagelist *cube_data = NULL,
+<a name="l00466"></a>00466 *cube_noise = NULL,
+<a name="l00467"></a>00467 *detector_in = NULL,
+<a name="l00468"></a>00468 **stored_data_cubes = NULL,
+<a name="l00469"></a>00469 **stored_noise_cubes = NULL;
+<a name="l00470"></a>00470 cpl_matrix **edgepars = NULL;
+<a name="l00471"></a>00471 cpl_propertylist *main_header = NULL,
+<a name="l00472"></a>00472 *tmp_header = NULL,
+<a name="l00473"></a>00473 *sub_header = NULL,
+<a name="l00474"></a>00474 **stored_sub_data_headers = NULL,
+<a name="l00475"></a>00475 **stored_sub_noise_headers = NULL;
+<a name="l00476"></a>00476 cpl_table *band_table = NULL,
+<a name="l00477"></a>00477 ***edge_table_sky = NULL,
+<a name="l00478"></a>00478 **edge_table_flat = NULL;
+<a name="l00479"></a>00479 cpl_vector *ranges = NULL,
+<a name="l00480"></a>00480 *identified_slices = NULL,
+<a name="l00481"></a>00481 *calAngles = NULL,
+<a name="l00482"></a>00482 **slitlet_ids = NULL,
+<a name="l00483"></a>00483 *shift_vec = NULL,
+<a name="l00484"></a>00484 *edge_vec = NULL;
+<a name="l00485"></a>00485 main_fits_desc desc_sky,
+<a name="l00486"></a>00486 desc_dark,
+<a name="l00487"></a>00487 desc_flat,
+<a name="l00488"></a>00488 desc_xcal,
+<a name="l00489"></a>00489 desc_ycal,
+<a name="l00490"></a>00490 desc_lcal;
+<a name="l00491"></a>00491 gridDefinition gd;
+<a name="l00492"></a>00492
+<a name="l00493"></a>00493 KMO_TRY
+<a name="l00494"></a>00494 {
+<a name="l00495"></a>00495 kmo_init_fits_desc(&desc_sky);
+<a name="l00496"></a>00496 kmo_init_fits_desc(&desc_dark);
+<a name="l00497"></a>00497 kmo_init_fits_desc(&desc_flat);
+<a name="l00498"></a>00498 kmo_init_fits_desc(&desc_xcal);
+<a name="l00499"></a>00499 kmo_init_fits_desc(&desc_ycal);
+<a name="l00500"></a>00500 kmo_init_fits_desc(&desc_lcal);
+<a name="l00501"></a>00501
+<a name="l00502"></a>00502 <span class="comment">/* --- check input --- */</span>
+<a name="l00503"></a>00503 KMO_TRY_ASSURE((parlist != NULL) &&
+<a name="l00504"></a>00504 (frameset != NULL),
+<a name="l00505"></a>00505 CPL_ERROR_NULL_INPUT,
+<a name="l00506"></a>00506 <span class="stringliteral">"Not all input data is provided!"</span>);
+<a name="l00507"></a>00507
+<a name="l00508"></a>00508 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, FLAT_SKY) >= 1,
+<a name="l00509"></a>00509 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00510"></a>00510 <span class="stringliteral">"One or more FLAT_SKY frames are required!"</span>);
+<a name="l00511"></a>00511
+<a name="l00512"></a>00512 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, FLAT_SKY) < 3) {
+<a name="l00513"></a>00513 cpl_msg_warning(cpl_func, <span class="stringliteral">"It is recommended to provide at least "</span>
+<a name="l00514"></a>00514 <span class="stringliteral">"3 FLAT_SKY frames!"</span>);
+<a name="l00515"></a>00515 }
+<a name="l00516"></a>00516
+<a name="l00517"></a>00517 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, MASTER_DARK) == 1,
+<a name="l00518"></a>00518 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00519"></a>00519 <span class="stringliteral">"Exactly one MASTER_DARK frame is required!"</span>);
+<a name="l00520"></a>00520
+<a name="l00521"></a>00521 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, MASTER_FLAT) == 1,
+<a name="l00522"></a>00522 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00523"></a>00523 <span class="stringliteral">"Exactly one MASTER_FLAT frame is required!"</span>);
+<a name="l00524"></a>00524
+<a name="l00525"></a>00525 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, XCAL) == 1,
+<a name="l00526"></a>00526 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00527"></a>00527 <span class="stringliteral">"Exactly one XCAL frame is required!"</span>);
+<a name="l00528"></a>00528
+<a name="l00529"></a>00529 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, YCAL) == 1,
+<a name="l00530"></a>00530 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00531"></a>00531 <span class="stringliteral">"Exactly one YCAL frame is required!"</span>);
+<a name="l00532"></a>00532
+<a name="l00533"></a>00533 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, LCAL) == 1,
+<a name="l00534"></a>00534 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00535"></a>00535 <span class="stringliteral">"Exactly one LCAL frame is required!"</span>);
+<a name="l00536"></a>00536
+<a name="l00537"></a>00537 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, WAVE_BAND) == 1,
+<a name="l00538"></a>00538 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00539"></a>00539 <span class="stringliteral">"Exactly one WAVE_BAND frame is required!"</span>);
+<a name="l00540"></a>00540
+<a name="l00541"></a>00541 KMO_TRY_ASSURE((cpl_frameset_count_tags(frameset, FLAT_EDGE) == 1) ||
+<a name="l00542"></a>00542 (cpl_frameset_count_tags(frameset, FLAT_EDGE) == 0),
+<a name="l00543"></a>00543 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00544"></a>00544 <span class="stringliteral">"Exactly one FLAT_EDGE frame is required!"</span>);
<a name="l00545"></a>00545
-<a name="l00546"></a>00546 KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, <span class="stringliteral">"kmo_illumination"</span>) == 1,
-<a name="l00547"></a>00547 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00548"></a>00548 <span class="stringliteral">"Cannot identify RAW and CALIB frames!"</span>);
-<a name="l00549"></a>00549
-<a name="l00550"></a>00550 <span class="comment">/* --- get parameters --- */</span>
-<a name="l00551"></a>00551 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"--- Parameter setup for kmo_illumination ---"</span>);
-<a name="l00552"></a>00552
-<a name="l00553"></a>00553 KMO_TRY_EXIT_IF_NULL(
-<a name="l00554"></a>00554 method = kmo_dfs_get_parameter_string(parlist,
-<a name="l00555"></a>00555 <span class="stringliteral">"kmos.kmo_illumination.imethod"</span>));
-<a name="l00556"></a>00556
-<a name="l00557"></a>00557 KMO_TRY_ASSURE((strcmp(method, <span class="stringliteral">"NN"</span>) == 0) ||
-<a name="l00558"></a>00558 (strcmp(method, <span class="stringliteral">"lwNN"</span>) == 0) ||
-<a name="l00559"></a>00559 (strcmp(method, <span class="stringliteral">"swNN"</span>) == 0) ||
-<a name="l00560"></a>00560 (strcmp(method, <span class="stringliteral">"MS"</span>) == 0) ||
-<a name="l00561"></a>00561 (strcmp(method, <span class="stringliteral">"CS"</span>) == 0),
-<a name="l00562"></a>00562 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00563"></a>00563 <span class="stringliteral">"method must be either \"NN\", \"lwNN\", "</span>
-<a name="l00564"></a>00564 <span class="stringliteral">"\"swNN\", \"MS\" or \"CS\"!"</span>);
-<a name="l00565"></a>00565
-<a name="l00566"></a>00566 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00567"></a>00567 kmo_dfs_print_parameter_help(parlist,
-<a name="l00568"></a>00568 <span class="stringliteral">"kmos.kmo_illumination.imethod"</span>));
-<a name="l00569"></a>00569
-<a name="l00570"></a>00570 neighborhoodRange = kmo_dfs_get_parameter_double(parlist,
-<a name="l00571"></a>00571 <span class="stringliteral">"kmos.kmo_illumination.neighborhoodRange"</span>);
-<a name="l00572"></a>00572 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00573"></a>00573
-<a name="l00574"></a>00574 KMO_TRY_ASSURE(neighborhoodRange > 0.0,
-<a name="l00575"></a>00575 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00576"></a>00576 <span class="stringliteral">"neighborhoodRange must be greater than 0.0"</span>);
-<a name="l00577"></a>00577
-<a name="l00578"></a>00578 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00579"></a>00579 kmo_dfs_print_parameter_help(parlist,
-<a name="l00580"></a>00580 <span class="stringliteral">"kmos.kmo_illumination.neighborhoodRange"</span>));
-<a name="l00581"></a>00581
-<a name="l00582"></a>00582 ranges_txt = kmo_dfs_get_parameter_string(parlist,
-<a name="l00583"></a>00583 <span class="stringliteral">"kmos.kmo_illumination.range"</span>);
-<a name="l00584"></a>00584 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00585"></a>00585
-<a name="l00586"></a>00586 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00587"></a>00587 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_illumination.range"</span>));
-<a name="l00588"></a>00588
-<a name="l00589"></a>00589 ranges = kmo_identify_ranges(ranges_txt);
-<a name="l00590"></a>00590 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00591"></a>00591
-<a name="l00592"></a>00592 flux = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00593"></a>00593 <span class="stringliteral">"kmos.kmo_illumination.flux"</span>);
-<a name="l00594"></a>00594
-<a name="l00595"></a>00595 KMO_TRY_ASSURE((flux == 0) ||
-<a name="l00596"></a>00596 (flux == 1),
-<a name="l00597"></a>00597 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00598"></a>00598 <span class="stringliteral">"flux must be either FALSE or TRUE!"</span>);
-<a name="l00599"></a>00599
-<a name="l00600"></a>00600 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00601"></a>00601 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_illumination.flux"</span>));
-<a name="l00602"></a>00602
-<a name="l00603"></a>00603 add_all_sky = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00604"></a>00604 <span class="stringliteral">"kmos.kmo_illumination.add-all"</span>);
-<a name="l00605"></a>00605
-<a name="l00606"></a>00606 KMO_TRY_ASSURE((add_all_sky == 0) ||
-<a name="l00607"></a>00607 (add_all_sky == 1),
-<a name="l00608"></a>00608 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00609"></a>00609 <span class="stringliteral">"add_all must be either FALSE or TRUE!"</span>);
-<a name="l00610"></a>00610
-<a name="l00611"></a>00611 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00612"></a>00612 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_illumination.add-all"</span>));
-<a name="l00613"></a>00613
-<a name="l00614"></a>00614 pix_scale = kmo_dfs_get_parameter_double(parlist,
-<a name="l00615"></a>00615 <span class="stringliteral">"kmos.kmo_illumination.pix_scale"</span>);
-<a name="l00616"></a>00616 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00617"></a>00617 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00618"></a>00618 kmo_dfs_print_parameter_help(parlist,
-<a name="l00619"></a>00619 <span class="stringliteral">"kmos.kmo_illumination.pix_scale"</span>));
-<a name="l00620"></a>00620 KMO_TRY_ASSURE((pix_scale >= 0.01) &&
-<a name="l00621"></a>00621 (pix_scale <= 0.4),
-<a name="l00622"></a>00622 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00623"></a>00623 <span class="stringliteral">"pix_scale must be between 0.01 and 0.4 (results in cubes "</span>
-<a name="l00624"></a>00624 <span class="stringliteral">"with 7x7 to 280x280 pixels)!"</span>);
-<a name="l00625"></a>00625
-<a name="l00626"></a>00626 suppress_extension = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00627"></a>00627 <span class="stringliteral">"kmos.kmo_illumination.suppress_extension"</span>);
-<a name="l00628"></a>00628 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00629"></a>00629 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00630"></a>00630 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_illumination.suppress_extension"</span>));
-<a name="l00631"></a>00631
-<a name="l00632"></a>00632 KMO_TRY_ASSURE((suppress_extension == TRUE) || (suppress_extension == FALSE),
-<a name="l00633"></a>00633 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00634"></a>00634 <span class="stringliteral">"suppress_extension must be TRUE or FALSE!"</span>);
-<a name="l00635"></a>00635
-<a name="l00636"></a>00636 kmo_band_pars_load(parlist, <span class="stringliteral">"kmos.kmo_illumination"</span>);
+<a name="l00546"></a>00546 has_flat_edge = cpl_frameset_count_tags(frameset, FLAT_EDGE);
+<a name="l00547"></a>00547
+<a name="l00548"></a>00548 KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, <span class="stringliteral">"kmo_illumination"</span>) == 1,
+<a name="l00549"></a>00549 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00550"></a>00550 <span class="stringliteral">"Cannot identify RAW and CALIB frames!"</span>);
+<a name="l00551"></a>00551
+<a name="l00552"></a>00552 <span class="comment">/* --- get parameters --- */</span>
+<a name="l00553"></a>00553 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"--- Parameter setup for kmo_illumination ---"</span>);
+<a name="l00554"></a>00554
+<a name="l00555"></a>00555 KMO_TRY_EXIT_IF_NULL(
+<a name="l00556"></a>00556 method = kmo_dfs_get_parameter_string(parlist,
+<a name="l00557"></a>00557 <span class="stringliteral">"kmos.kmo_illumination.imethod"</span>));
+<a name="l00558"></a>00558
+<a name="l00559"></a>00559 KMO_TRY_ASSURE((strcmp(method, <span class="stringliteral">"NN"</span>) == 0) ||
+<a name="l00560"></a>00560 (strcmp(method, <span class="stringliteral">"lwNN"</span>) == 0) ||
+<a name="l00561"></a>00561 (strcmp(method, <span class="stringliteral">"swNN"</span>) == 0) ||
+<a name="l00562"></a>00562 (strcmp(method, <span class="stringliteral">"MS"</span>) == 0) ||
+<a name="l00563"></a>00563 (strcmp(method, <span class="stringliteral">"CS"</span>) == 0),
+<a name="l00564"></a>00564 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00565"></a>00565 <span class="stringliteral">"method must be either \"NN\", \"lwNN\", "</span>
+<a name="l00566"></a>00566 <span class="stringliteral">"\"swNN\", \"MS\" or \"CS\"!"</span>);
+<a name="l00567"></a>00567
+<a name="l00568"></a>00568 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00569"></a>00569 kmo_dfs_print_parameter_help(parlist,
+<a name="l00570"></a>00570 <span class="stringliteral">"kmos.kmo_illumination.imethod"</span>));
+<a name="l00571"></a>00571
+<a name="l00572"></a>00572 neighborhoodRange = kmo_dfs_get_parameter_double(parlist,
+<a name="l00573"></a>00573 <span class="stringliteral">"kmos.kmo_illumination.neighborhoodRange"</span>);
+<a name="l00574"></a>00574 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00575"></a>00575
+<a name="l00576"></a>00576 KMO_TRY_ASSURE(neighborhoodRange > 0.0,
+<a name="l00577"></a>00577 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00578"></a>00578 <span class="stringliteral">"neighborhoodRange must be greater than 0.0"</span>);
+<a name="l00579"></a>00579
+<a name="l00580"></a>00580 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00581"></a>00581 kmo_dfs_print_parameter_help(parlist,
+<a name="l00582"></a>00582 <span class="stringliteral">"kmos.kmo_illumination.neighborhoodRange"</span>));
+<a name="l00583"></a>00583
+<a name="l00584"></a>00584 ranges_txt = kmo_dfs_get_parameter_string(parlist,
+<a name="l00585"></a>00585 <span class="stringliteral">"kmos.kmo_illumination.range"</span>);
+<a name="l00586"></a>00586 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00587"></a>00587
+<a name="l00588"></a>00588 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00589"></a>00589 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_illumination.range"</span>));
+<a name="l00590"></a>00590
+<a name="l00591"></a>00591 ranges = kmo_identify_ranges(ranges_txt);
+<a name="l00592"></a>00592 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00593"></a>00593
+<a name="l00594"></a>00594 flux = kmo_dfs_get_parameter_bool(parlist,
+<a name="l00595"></a>00595 <span class="stringliteral">"kmos.kmo_illumination.flux"</span>);
+<a name="l00596"></a>00596
+<a name="l00597"></a>00597 KMO_TRY_ASSURE((flux == 0) ||
+<a name="l00598"></a>00598 (flux == 1),
+<a name="l00599"></a>00599 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00600"></a>00600 <span class="stringliteral">"flux must be either FALSE or TRUE!"</span>);
+<a name="l00601"></a>00601
+<a name="l00602"></a>00602 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00603"></a>00603 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_illumination.flux"</span>));
+<a name="l00604"></a>00604
+<a name="l00605"></a>00605 add_all_sky = kmo_dfs_get_parameter_bool(parlist,
+<a name="l00606"></a>00606 <span class="stringliteral">"kmos.kmo_illumination.add-all"</span>);
+<a name="l00607"></a>00607
+<a name="l00608"></a>00608 KMO_TRY_ASSURE((add_all_sky == 0) ||
+<a name="l00609"></a>00609 (add_all_sky == 1),
+<a name="l00610"></a>00610 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00611"></a>00611 <span class="stringliteral">"add_all must be either FALSE or TRUE!"</span>);
+<a name="l00612"></a>00612
+<a name="l00613"></a>00613 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00614"></a>00614 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_illumination.add-all"</span>));
+<a name="l00615"></a>00615
+<a name="l00616"></a>00616 pix_scale = kmo_dfs_get_parameter_double(parlist,
+<a name="l00617"></a>00617 <span class="stringliteral">"kmos.kmo_illumination.pix_scale"</span>);
+<a name="l00618"></a>00618 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00619"></a>00619 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00620"></a>00620 kmo_dfs_print_parameter_help(parlist,
+<a name="l00621"></a>00621 <span class="stringliteral">"kmos.kmo_illumination.pix_scale"</span>));
+<a name="l00622"></a>00622 KMO_TRY_ASSURE((pix_scale >= 0.01) &&
+<a name="l00623"></a>00623 (pix_scale <= 0.4),
+<a name="l00624"></a>00624 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00625"></a>00625 <span class="stringliteral">"pix_scale must be between 0.01 and 0.4 (results in cubes "</span>
+<a name="l00626"></a>00626 <span class="stringliteral">"with 7x7 to 280x280 pixels)!"</span>);
+<a name="l00627"></a>00627
+<a name="l00628"></a>00628 suppress_extension = kmo_dfs_get_parameter_bool(parlist,
+<a name="l00629"></a>00629 <span class="stringliteral">"kmos.kmo_illumination.suppress_extension"</span>);
+<a name="l00630"></a>00630 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00631"></a>00631 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00632"></a>00632 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_illumination.suppress_extension"</span>));
+<a name="l00633"></a>00633
+<a name="l00634"></a>00634 KMO_TRY_ASSURE((suppress_extension == TRUE) || (suppress_extension == FALSE),
+<a name="l00635"></a>00635 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00636"></a>00636 <span class="stringliteral">"suppress_extension must be TRUE or FALSE!"</span>);
<a name="l00637"></a>00637
-<a name="l00638"></a>00638 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00639"></a>00639 kmo_combine_pars_load(parlist,
-<a name="l00640"></a>00640 <span class="stringliteral">"kmos.kmo_illumination"</span>,
-<a name="l00641"></a>00641 &cmethod,
-<a name="l00642"></a>00642 &cpos_rej,
-<a name="l00643"></a>00643 &cneg_rej,
-<a name="l00644"></a>00644 &citer,
-<a name="l00645"></a>00645 &cmin,
-<a name="l00646"></a>00646 &cmax,
-<a name="l00647"></a>00647 FALSE));
-<a name="l00648"></a>00648 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
-<a name="l00649"></a>00649
-<a name="l00650"></a>00650 <span class="comment">// check if filter_id, grating_id and rotator offset match for all</span>
-<a name="l00651"></a>00651 <span class="comment">// detectors</span>
-<a name="l00652"></a>00652 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00653"></a>00653 kmo_check_frameset_setup(frameset, FLAT_SKY,
-<a name="l00654"></a>00654 TRUE, FALSE, TRUE));
-<a name="l00655"></a>00655 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00656"></a>00656 kmo_check_frame_setup(frameset, FLAT_SKY, XCAL,
-<a name="l00657"></a>00657 TRUE, FALSE, TRUE));
-<a name="l00658"></a>00658 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00659"></a>00659 kmo_check_frame_setup(frameset, XCAL, YCAL,
-<a name="l00660"></a>00660 TRUE, FALSE, TRUE));
-<a name="l00661"></a>00661 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00662"></a>00662 kmo_check_frame_setup(frameset, XCAL, LCAL,
-<a name="l00663"></a>00663 TRUE, FALSE, TRUE));
-<a name="l00664"></a>00664 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00665"></a>00665 kmo_check_frame_setup(frameset, XCAL, MASTER_FLAT,
-<a name="l00666"></a>00666 TRUE, FALSE, TRUE));
-<a name="l00667"></a>00667
-<a name="l00668"></a>00668 KMO_TRY_EXIT_IF_NULL(
-<a name="l00669"></a>00669 frame = kmo_dfs_get_frame(frameset, XCAL));
+<a name="l00638"></a>00638 kmo_band_pars_load(parlist, <span class="stringliteral">"kmos.kmo_illumination"</span>);
+<a name="l00639"></a>00639
+<a name="l00640"></a>00640 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00641"></a>00641 kmo_combine_pars_load(parlist,
+<a name="l00642"></a>00642 <span class="stringliteral">"kmos.kmo_illumination"</span>,
+<a name="l00643"></a>00643 &cmethod,
+<a name="l00644"></a>00644 &cpos_rej,
+<a name="l00645"></a>00645 &cneg_rej,
+<a name="l00646"></a>00646 &citer,
+<a name="l00647"></a>00647 &cmin,
+<a name="l00648"></a>00648 &cmax,
+<a name="l00649"></a>00649 FALSE));
+<a name="l00650"></a>00650 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
+<a name="l00651"></a>00651
+<a name="l00652"></a>00652 <span class="comment">// check if filter_id, grating_id and rotator offset match for all</span>
+<a name="l00653"></a>00653 <span class="comment">// detectors</span>
+<a name="l00654"></a>00654 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00655"></a>00655 kmo_check_frameset_setup(frameset, FLAT_SKY,
+<a name="l00656"></a>00656 TRUE, FALSE, TRUE));
+<a name="l00657"></a>00657 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00658"></a>00658 kmo_check_frame_setup(frameset, FLAT_SKY, XCAL,
+<a name="l00659"></a>00659 TRUE, FALSE, TRUE));
+<a name="l00660"></a>00660 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00661"></a>00661 kmo_check_frame_setup(frameset, XCAL, YCAL,
+<a name="l00662"></a>00662 TRUE, FALSE, TRUE));
+<a name="l00663"></a>00663 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00664"></a>00664 kmo_check_frame_setup(frameset, XCAL, LCAL,
+<a name="l00665"></a>00665 TRUE, FALSE, TRUE));
+<a name="l00666"></a>00666 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00667"></a>00667 kmo_check_frame_setup(frameset, XCAL, MASTER_FLAT,
+<a name="l00668"></a>00668 TRUE, FALSE, TRUE));
+<a name="l00669"></a>00669
<a name="l00670"></a>00670 KMO_TRY_EXIT_IF_NULL(
-<a name="l00671"></a>00671 suffix = kmo_dfs_get_suffix(frame, TRUE, FALSE));
-<a name="l00672"></a>00672
-<a name="l00673"></a>00673 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00674"></a>00674 kmo_check_frame_setup_md5_xycal(frameset));
+<a name="l00671"></a>00671 frame = kmo_dfs_get_frame(frameset, XCAL));
+<a name="l00672"></a>00672 KMO_TRY_EXIT_IF_NULL(
+<a name="l00673"></a>00673 suffix = kmo_dfs_get_suffix(frame, TRUE, FALSE));
+<a name="l00674"></a>00674
<a name="l00675"></a>00675 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00676"></a>00676 kmo_check_frame_setup_md5(frameset));
-<a name="l00677"></a>00677
-<a name="l00678"></a>00678 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Detected instrument setup: %s"</span>, suffix+1);
-<a name="l00679"></a>00679 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"(grating 1, 2 & 3)"</span>);
-<a name="l00680"></a>00680
-<a name="l00681"></a>00681 <span class="comment">// check which IFUs are active for all frames</span>
-<a name="l00682"></a>00682 KMO_TRY_EXIT_IF_NULL(
-<a name="l00683"></a>00683 unused_ifus_before = kmo_get_unused_ifus(frameset, 0, 0));
-<a name="l00684"></a>00684
-<a name="l00685"></a>00685 KMO_TRY_EXIT_IF_NULL(
-<a name="l00686"></a>00686 unused_ifus_after = kmo_duplicate_unused_ifus(unused_ifus_before));
-<a name="l00687"></a>00687
-<a name="l00688"></a>00688 kmo_print_unused_ifus(unused_ifus_before, FALSE);
+<a name="l00676"></a>00676 kmo_check_frame_setup_md5_xycal(frameset));
+<a name="l00677"></a>00677 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00678"></a>00678 kmo_check_frame_setup_md5(frameset));
+<a name="l00679"></a>00679
+<a name="l00680"></a>00680 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Detected instrument setup: %s"</span>, suffix+1);
+<a name="l00681"></a>00681 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"(grating 1, 2 & 3)"</span>);
+<a name="l00682"></a>00682
+<a name="l00683"></a>00683 <span class="comment">// check which IFUs are active for all frames</span>
+<a name="l00684"></a>00684 KMO_TRY_EXIT_IF_NULL(
+<a name="l00685"></a>00685 unused_ifus_before = kmo_get_unused_ifus(frameset, 0, 0));
+<a name="l00686"></a>00686
+<a name="l00687"></a>00687 KMO_TRY_EXIT_IF_NULL(
+<a name="l00688"></a>00688 unused_ifus_after = kmo_duplicate_unused_ifus(unused_ifus_before));
<a name="l00689"></a>00689
-<a name="l00690"></a>00690 <span class="comment">// load desc for MASTER_DARK and check</span>
-<a name="l00691"></a>00691 KMO_TRY_EXIT_IF_NULL(
-<a name="l00692"></a>00692 frame = kmo_dfs_get_frame(frameset, MASTER_DARK));
-<a name="l00693"></a>00693 desc_dark = kmo_identify_fits_header(
-<a name="l00694"></a>00694 cpl_frame_get_filename(frame));
-<a name="l00695"></a>00695 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"MASTER_DARK frame doesn't seem to "</span>
-<a name="l00696"></a>00696 <span class="stringliteral">"be in KMOS-format!"</span>);
-<a name="l00697"></a>00697 KMO_TRY_ASSURE((desc_dark.nr_ext == 2*KMOS_NR_DETECTORS) &&
-<a name="l00698"></a>00698 (desc_dark.ex_badpix == FALSE) &&
-<a name="l00699"></a>00699 (desc_dark.fits_type == f2d_fits) &&
-<a name="l00700"></a>00700 (desc_dark.frame_type == detector_frame),
-<a name="l00701"></a>00701 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00702"></a>00702 <span class="stringliteral">"MASTER_DARK isn't in the correct format!!!"</span>);
-<a name="l00703"></a>00703 nx = desc_dark.naxis1;
-<a name="l00704"></a>00704 ny = desc_dark.naxis2;
-<a name="l00705"></a>00705
-<a name="l00706"></a>00706 <span class="comment">// load desc for MASTER_FLAT and check</span>
-<a name="l00707"></a>00707 KMO_TRY_EXIT_IF_NULL(
-<a name="l00708"></a>00708 frame = kmo_dfs_get_frame(frameset, MASTER_FLAT));
-<a name="l00709"></a>00709 desc_flat = kmo_identify_fits_header(cpl_frame_get_filename(frame));
-<a name="l00710"></a>00710 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"MASTER_FLAT frame doesn't seem to "</span>
-<a name="l00711"></a>00711 <span class="stringliteral">"be in KMOS-format!"</span>);
-<a name="l00712"></a>00712 KMO_TRY_ASSURE((desc_flat.nr_ext % (2*KMOS_NR_DETECTORS) == 0) &&
-<a name="l00713"></a>00713 (desc_flat.ex_badpix == FALSE) &&
-<a name="l00714"></a>00714 (desc_flat.fits_type == f2d_fits) &&
-<a name="l00715"></a>00715 (desc_flat.frame_type == detector_frame),
-<a name="l00716"></a>00716 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00717"></a>00717 <span class="stringliteral">"MASTER_FLAT isn't in the correct format!!!"</span>);
-<a name="l00718"></a>00718
-<a name="l00719"></a>00719 <span class="comment">// load desc for XCAL and check</span>
-<a name="l00720"></a>00720 KMO_TRY_EXIT_IF_NULL(
-<a name="l00721"></a>00721 xcalFrame = kmo_dfs_get_frame(frameset, XCAL));
-<a name="l00722"></a>00722 desc_xcal = kmo_identify_fits_header(cpl_frame_get_filename(xcalFrame));
-<a name="l00723"></a>00723 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"XCAL frame doesn't seem to "</span>
-<a name="l00724"></a>00724 <span class="stringliteral">"be in KMOS-format!"</span>);
-<a name="l00725"></a>00725 KMO_TRY_ASSURE((desc_xcal.nr_ext % KMOS_NR_DETECTORS == 0) &&
-<a name="l00726"></a>00726 (desc_xcal.ex_badpix == FALSE) &&
-<a name="l00727"></a>00727 (desc_xcal.fits_type == f2d_fits) &&
-<a name="l00728"></a>00728 (desc_xcal.frame_type == detector_frame),
-<a name="l00729"></a>00729 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00730"></a>00730 <span class="stringliteral">"XCAL isn't in the correct format!!!"</span>);
-<a name="l00731"></a>00731 KMO_TRY_ASSURE((desc_xcal.naxis1 == nx) &&
-<a name="l00732"></a>00732 (desc_xcal.naxis2 == ny),
-<a name="l00733"></a>00733 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00734"></a>00734 <span class="stringliteral">"MASTER_DARK and XCAL frame haven't same dimensions! "</span>
-<a name="l00735"></a>00735 <span class="stringliteral">"(x,y): (%d,%d) vs (%d,%d)"</span>,
-<a name="l00736"></a>00736 nx, ny, desc_xcal.naxis1, desc_xcal.naxis2);
-<a name="l00737"></a>00737
-<a name="l00738"></a>00738 nr_devices = desc_xcal.nr_ext;
+<a name="l00690"></a>00690 kmo_print_unused_ifus(unused_ifus_before, FALSE);
+<a name="l00691"></a>00691
+<a name="l00692"></a>00692 <span class="comment">// load desc for MASTER_DARK and check</span>
+<a name="l00693"></a>00693 KMO_TRY_EXIT_IF_NULL(
+<a name="l00694"></a>00694 frame = kmo_dfs_get_frame(frameset, MASTER_DARK));
+<a name="l00695"></a>00695 desc_dark = kmo_identify_fits_header(
+<a name="l00696"></a>00696 cpl_frame_get_filename(frame));
+<a name="l00697"></a>00697 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"MASTER_DARK frame doesn't seem to "</span>
+<a name="l00698"></a>00698 <span class="stringliteral">"be in KMOS-format!"</span>);
+<a name="l00699"></a>00699 KMO_TRY_ASSURE((desc_dark.nr_ext == 2*KMOS_NR_DETECTORS) &&
+<a name="l00700"></a>00700 (desc_dark.ex_badpix == FALSE) &&
+<a name="l00701"></a>00701 (desc_dark.fits_type == f2d_fits) &&
+<a name="l00702"></a>00702 (desc_dark.frame_type == detector_frame),
+<a name="l00703"></a>00703 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00704"></a>00704 <span class="stringliteral">"MASTER_DARK isn't in the correct format!!!"</span>);
+<a name="l00705"></a>00705 nx = desc_dark.naxis1;
+<a name="l00706"></a>00706 ny = desc_dark.naxis2;
+<a name="l00707"></a>00707
+<a name="l00708"></a>00708 <span class="comment">// load desc for MASTER_FLAT and check</span>
+<a name="l00709"></a>00709 KMO_TRY_EXIT_IF_NULL(
+<a name="l00710"></a>00710 frame = kmo_dfs_get_frame(frameset, MASTER_FLAT));
+<a name="l00711"></a>00711 desc_flat = kmo_identify_fits_header(cpl_frame_get_filename(frame));
+<a name="l00712"></a>00712 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"MASTER_FLAT frame doesn't seem to "</span>
+<a name="l00713"></a>00713 <span class="stringliteral">"be in KMOS-format!"</span>);
+<a name="l00714"></a>00714 KMO_TRY_ASSURE((desc_flat.nr_ext % (2*KMOS_NR_DETECTORS) == 0) &&
+<a name="l00715"></a>00715 (desc_flat.ex_badpix == FALSE) &&
+<a name="l00716"></a>00716 (desc_flat.fits_type == f2d_fits) &&
+<a name="l00717"></a>00717 (desc_flat.frame_type == detector_frame),
+<a name="l00718"></a>00718 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00719"></a>00719 <span class="stringliteral">"MASTER_FLAT isn't in the correct format!!!"</span>);
+<a name="l00720"></a>00720
+<a name="l00721"></a>00721 <span class="comment">// load desc for XCAL and check</span>
+<a name="l00722"></a>00722 KMO_TRY_EXIT_IF_NULL(
+<a name="l00723"></a>00723 xcalFrame = kmo_dfs_get_frame(frameset, XCAL));
+<a name="l00724"></a>00724 desc_xcal = kmo_identify_fits_header(cpl_frame_get_filename(xcalFrame));
+<a name="l00725"></a>00725 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"XCAL frame doesn't seem to "</span>
+<a name="l00726"></a>00726 <span class="stringliteral">"be in KMOS-format!"</span>);
+<a name="l00727"></a>00727 KMO_TRY_ASSURE((desc_xcal.nr_ext % KMOS_NR_DETECTORS == 0) &&
+<a name="l00728"></a>00728 (desc_xcal.ex_badpix == FALSE) &&
+<a name="l00729"></a>00729 (desc_xcal.fits_type == f2d_fits) &&
+<a name="l00730"></a>00730 (desc_xcal.frame_type == detector_frame),
+<a name="l00731"></a>00731 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00732"></a>00732 <span class="stringliteral">"XCAL isn't in the correct format!!!"</span>);
+<a name="l00733"></a>00733 KMO_TRY_ASSURE((desc_xcal.naxis1 == nx) &&
+<a name="l00734"></a>00734 (desc_xcal.naxis2 == ny),
+<a name="l00735"></a>00735 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00736"></a>00736 <span class="stringliteral">"MASTER_DARK and XCAL frame haven't same dimensions! "</span>
+<a name="l00737"></a>00737 <span class="stringliteral">"(x,y): (%d,%d) vs (%d,%d)"</span>,
+<a name="l00738"></a>00738 nx, ny, desc_xcal.naxis1, desc_xcal.naxis2);
<a name="l00739"></a>00739
-<a name="l00740"></a>00740 <span class="comment">// load desc for YCAL and check</span>
-<a name="l00741"></a>00741 KMO_TRY_EXIT_IF_NULL(
-<a name="l00742"></a>00742 ycalFrame = kmo_dfs_get_frame(frameset, YCAL));
-<a name="l00743"></a>00743 desc_ycal = kmo_identify_fits_header(cpl_frame_get_filename(ycalFrame));
-<a name="l00744"></a>00744 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"YCAL frame doesn't seem to "</span>
-<a name="l00745"></a>00745 <span class="stringliteral">"be in KMOS-format!"</span>);
-<a name="l00746"></a>00746 KMO_TRY_ASSURE((desc_ycal.nr_ext == desc_xcal.nr_ext) &&
-<a name="l00747"></a>00747 (desc_ycal.ex_badpix == desc_xcal.ex_badpix) &&
-<a name="l00748"></a>00748 (desc_ycal.fits_type == desc_xcal.fits_type) &&
-<a name="l00749"></a>00749 (desc_ycal.frame_type == desc_xcal.frame_type),
-<a name="l00750"></a>00750 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00751"></a>00751 <span class="stringliteral">"YCAL isn't in the correct format!!!"</span>);
-<a name="l00752"></a>00752 KMO_TRY_ASSURE((desc_ycal.naxis1 == desc_xcal.naxis1) &&
-<a name="l00753"></a>00753 (desc_ycal.naxis2 == desc_xcal.naxis2),
-<a name="l00754"></a>00754 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00755"></a>00755 <span class="stringliteral">"MASTER_DARK and YCAL frame haven't same dimensions! "</span>
-<a name="l00756"></a>00756 <span class="stringliteral">"(x,y): (%d,%d) vs (%d,%d)"</span>,
-<a name="l00757"></a>00757 nx, ny, desc_ycal.naxis1, desc_ycal.naxis2);
-<a name="l00758"></a>00758
-<a name="l00759"></a>00759 <span class="comment">// load desc for LCAL and check</span>
-<a name="l00760"></a>00760 KMO_TRY_EXIT_IF_NULL(
-<a name="l00761"></a>00761 lcalFrame = kmo_dfs_get_frame(frameset, LCAL));
-<a name="l00762"></a>00762 desc_lcal = kmo_identify_fits_header(cpl_frame_get_filename(lcalFrame));
-<a name="l00763"></a>00763 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"LCAL frame doesn't seem to "</span>
-<a name="l00764"></a>00764 <span class="stringliteral">"be in KMOS-format!"</span>);
-<a name="l00765"></a>00765 KMO_TRY_ASSURE((desc_lcal.ex_badpix == desc_xcal.ex_badpix) &&
-<a name="l00766"></a>00766 (desc_lcal.fits_type == desc_xcal.fits_type) &&
-<a name="l00767"></a>00767 (desc_lcal.frame_type == desc_xcal.frame_type),
-<a name="l00768"></a>00768 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00769"></a>00769 <span class="stringliteral">"LCAL isn't in the correct format!!!"</span>);
-<a name="l00770"></a>00770 KMO_TRY_ASSURE((desc_lcal.naxis1 == desc_xcal.naxis1) &&
-<a name="l00771"></a>00771 (desc_lcal.naxis2 == desc_xcal.naxis2),
-<a name="l00772"></a>00772 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00773"></a>00773 <span class="stringliteral">"MASTER_DARK and LCAL frame haven't same dimensions! "</span>
-<a name="l00774"></a>00774 <span class="stringliteral">"(x,y): (%d,%d) vs (%d,%d)"</span>,
-<a name="l00775"></a>00775 nx, ny, desc_lcal.naxis1, desc_lcal.naxis2);
-<a name="l00776"></a>00776 KMO_TRY_EXIT_IF_NULL(
-<a name="l00777"></a>00777 tmp_header = kmo_dfs_load_primary_header(frameset, LCAL));
-<a name="l00778"></a>00778
-<a name="l00779"></a>00779 <span class="comment">// load desc for FLAT_SKY and check</span>
-<a name="l00780"></a>00780 nr_devices = KMOS_NR_DETECTORS;
-<a name="l00781"></a>00781 KMO_TRY_EXIT_IF_NULL(
-<a name="l00782"></a>00782 frame = kmo_dfs_get_frame(frameset, FLAT_SKY));
-<a name="l00783"></a>00783
-<a name="l00784"></a>00784 KMO_TRY_EXIT_IF_NULL(
-<a name="l00785"></a>00785 main_header = kmclipm_propertylist_load(
-<a name="l00786"></a>00786 cpl_frame_get_filename(frame), 0));
-<a name="l00787"></a>00787 rotangle = cpl_propertylist_get_double(main_header, ROTANGLE);
-<a name="l00788"></a>00788 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"Cannot retrieve ROTANGLE FITS keyword from sky frame!"</span>);
-<a name="l00789"></a>00789 kmclipm_strip_angle(&rotangle);
-<a name="l00790"></a>00790 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l00791"></a>00791
-<a name="l00792"></a>00792 cnt = 1;
-<a name="l00793"></a>00793 <span class="keywordflow">while</span> (frame != NULL) {
-<a name="l00794"></a>00794 KMO_TRY_EXIT_IF_NULL(
-<a name="l00795"></a>00795 main_header = kmclipm_propertylist_load(
-<a name="l00796"></a>00796 cpl_frame_get_filename(frame), 0));
-<a name="l00797"></a>00797
-<a name="l00798"></a>00798 desc_sky = kmo_identify_fits_header(
-<a name="l00799"></a>00799 cpl_frame_get_filename(frame));
-<a name="l00800"></a>00800 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"FLAT_SKY frame doesn't seem to "</span>
-<a name="l00801"></a>00801 <span class="stringliteral">"be in KMOS-format!"</span>);
-<a name="l00802"></a>00802 KMO_TRY_ASSURE((desc_sky.nr_ext == 3) &&
-<a name="l00803"></a>00803 (desc_sky.ex_badpix == FALSE) &&
-<a name="l00804"></a>00804 (desc_sky.fits_type == raw_fits) &&
-<a name="l00805"></a>00805 (desc_sky.frame_type == detector_frame),
-<a name="l00806"></a>00806 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00807"></a>00807 <span class="stringliteral">"FLAT_SKY isn't in the correct format!!!"</span>);
-<a name="l00808"></a>00808 KMO_TRY_ASSURE((desc_sky.naxis1 == nx) &&
-<a name="l00809"></a>00809 (desc_sky.naxis2 == ny) &&
-<a name="l00810"></a>00810 (desc_sky.nr_ext == nr_devices),
-<a name="l00811"></a>00811 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00812"></a>00812 <span class="stringliteral">"MASTER_DARK and FLAT_SKY (no. %d) frame haven't "</span>
-<a name="l00813"></a>00813 <span class="stringliteral">"same dimensions! (x,y): (%d,%d) vs (%d,%d)"</span>,
-<a name="l00814"></a>00814 cnt, nx, ny, desc_flat.naxis1, desc_flat.naxis2);
-<a name="l00815"></a>00815 kmo_free_fits_desc(&desc_sky);
-<a name="l00816"></a>00816 kmo_init_fits_desc(&desc_sky);
-<a name="l00817"></a>00817
-<a name="l00818"></a>00818 KMO_TRY_ASSURE(
-<a name="l00819"></a>00819 (kmo_check_lamp(main_header, INS_LAMP1_ST) == FALSE) &&
-<a name="l00820"></a>00820 (kmo_check_lamp(main_header, INS_LAMP2_ST) == FALSE) &&
-<a name="l00821"></a>00821 (kmo_check_lamp(main_header, INS_LAMP3_ST) == FALSE) &&
-<a name="l00822"></a>00822 (kmo_check_lamp(main_header, INS_LAMP4_ST) == FALSE),
-<a name="l00823"></a>00823 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00824"></a>00824 <span class="stringliteral">"All lamps must be switched off for the FLAT_SKY frames!"</span>);
-<a name="l00825"></a>00825
-<a name="l00826"></a>00826 <span class="comment">// assert that filters have correct IDs and that all detectors of</span>
-<a name="l00827"></a>00827 <span class="comment">// all input frames have the same filter set</span>
-<a name="l00828"></a>00828 <span class="keywordflow">for</span> (i = 1; i <= KMOS_NR_DETECTORS; i++) {
-<a name="l00829"></a>00829 <span class="comment">// ESO INS FILTi ID</span>
-<a name="l00830"></a>00830 KMO_TRY_EXIT_IF_NULL(
-<a name="l00831"></a>00831 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_FILTID_PREFIX, i, IFU_FILTID_POSTFIX));
+<a name="l00740"></a>00740 nr_devices = desc_xcal.nr_ext;
+<a name="l00741"></a>00741
+<a name="l00742"></a>00742 <span class="comment">// load desc for YCAL and check</span>
+<a name="l00743"></a>00743 KMO_TRY_EXIT_IF_NULL(
+<a name="l00744"></a>00744 ycalFrame = kmo_dfs_get_frame(frameset, YCAL));
+<a name="l00745"></a>00745 desc_ycal = kmo_identify_fits_header(cpl_frame_get_filename(ycalFrame));
+<a name="l00746"></a>00746 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"YCAL frame doesn't seem to "</span>
+<a name="l00747"></a>00747 <span class="stringliteral">"be in KMOS-format!"</span>);
+<a name="l00748"></a>00748 KMO_TRY_ASSURE((desc_ycal.nr_ext == desc_xcal.nr_ext) &&
+<a name="l00749"></a>00749 (desc_ycal.ex_badpix == desc_xcal.ex_badpix) &&
+<a name="l00750"></a>00750 (desc_ycal.fits_type == desc_xcal.fits_type) &&
+<a name="l00751"></a>00751 (desc_ycal.frame_type == desc_xcal.frame_type),
+<a name="l00752"></a>00752 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00753"></a>00753 <span class="stringliteral">"YCAL isn't in the correct format!!!"</span>);
+<a name="l00754"></a>00754 KMO_TRY_ASSURE((desc_ycal.naxis1 == desc_xcal.naxis1) &&
+<a name="l00755"></a>00755 (desc_ycal.naxis2 == desc_xcal.naxis2),
+<a name="l00756"></a>00756 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00757"></a>00757 <span class="stringliteral">"MASTER_DARK and YCAL frame haven't same dimensions! "</span>
+<a name="l00758"></a>00758 <span class="stringliteral">"(x,y): (%d,%d) vs (%d,%d)"</span>,
+<a name="l00759"></a>00759 nx, ny, desc_ycal.naxis1, desc_ycal.naxis2);
+<a name="l00760"></a>00760
+<a name="l00761"></a>00761 <span class="comment">// load desc for LCAL and check</span>
+<a name="l00762"></a>00762 KMO_TRY_EXIT_IF_NULL(
+<a name="l00763"></a>00763 lcalFrame = kmo_dfs_get_frame(frameset, LCAL));
+<a name="l00764"></a>00764 desc_lcal = kmo_identify_fits_header(cpl_frame_get_filename(lcalFrame));
+<a name="l00765"></a>00765 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"LCAL frame doesn't seem to "</span>
+<a name="l00766"></a>00766 <span class="stringliteral">"be in KMOS-format!"</span>);
+<a name="l00767"></a>00767 KMO_TRY_ASSURE((desc_lcal.ex_badpix == desc_xcal.ex_badpix) &&
+<a name="l00768"></a>00768 (desc_lcal.fits_type == desc_xcal.fits_type) &&
+<a name="l00769"></a>00769 (desc_lcal.frame_type == desc_xcal.frame_type),
+<a name="l00770"></a>00770 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00771"></a>00771 <span class="stringliteral">"LCAL isn't in the correct format!!!"</span>);
+<a name="l00772"></a>00772 KMO_TRY_ASSURE((desc_lcal.naxis1 == desc_xcal.naxis1) &&
+<a name="l00773"></a>00773 (desc_lcal.naxis2 == desc_xcal.naxis2),
+<a name="l00774"></a>00774 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00775"></a>00775 <span class="stringliteral">"MASTER_DARK and LCAL frame haven't same dimensions! "</span>
+<a name="l00776"></a>00776 <span class="stringliteral">"(x,y): (%d,%d) vs (%d,%d)"</span>,
+<a name="l00777"></a>00777 nx, ny, desc_lcal.naxis1, desc_lcal.naxis2);
+<a name="l00778"></a>00778 KMO_TRY_EXIT_IF_NULL(
+<a name="l00779"></a>00779 tmp_header = kmo_dfs_load_primary_header(frameset, LCAL));
+<a name="l00780"></a>00780
+<a name="l00781"></a>00781 <span class="comment">// load desc for FLAT_SKY and check</span>
+<a name="l00782"></a>00782 nr_devices = KMOS_NR_DETECTORS;
+<a name="l00783"></a>00783 KMO_TRY_EXIT_IF_NULL(
+<a name="l00784"></a>00784 frame = kmo_dfs_get_frame(frameset, FLAT_SKY));
+<a name="l00785"></a>00785
+<a name="l00786"></a>00786 KMO_TRY_EXIT_IF_NULL(
+<a name="l00787"></a>00787 main_header = kmclipm_propertylist_load(
+<a name="l00788"></a>00788 cpl_frame_get_filename(frame), 0));
+<a name="l00789"></a>00789 rotangle = cpl_propertylist_get_double(main_header, ROTANGLE);
+<a name="l00790"></a>00790 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"Cannot retrieve ROTANGLE FITS keyword from sky frame!"</span>);
+<a name="l00791"></a>00791 kmclipm_strip_angle(&rotangle);
+<a name="l00792"></a>00792 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l00793"></a>00793
+<a name="l00794"></a>00794 cnt = 1;
+<a name="l00795"></a>00795 <span class="keywordflow">while</span> (frame != NULL) {
+<a name="l00796"></a>00796 KMO_TRY_EXIT_IF_NULL(
+<a name="l00797"></a>00797 main_header = kmclipm_propertylist_load(
+<a name="l00798"></a>00798 cpl_frame_get_filename(frame), 0));
+<a name="l00799"></a>00799
+<a name="l00800"></a>00800 desc_sky = kmo_identify_fits_header(
+<a name="l00801"></a>00801 cpl_frame_get_filename(frame));
+<a name="l00802"></a>00802 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"FLAT_SKY frame doesn't seem to "</span>
+<a name="l00803"></a>00803 <span class="stringliteral">"be in KMOS-format!"</span>);
+<a name="l00804"></a>00804 KMO_TRY_ASSURE((desc_sky.nr_ext == 3) &&
+<a name="l00805"></a>00805 (desc_sky.ex_badpix == FALSE) &&
+<a name="l00806"></a>00806 (desc_sky.fits_type == raw_fits) &&
+<a name="l00807"></a>00807 (desc_sky.frame_type == detector_frame),
+<a name="l00808"></a>00808 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00809"></a>00809 <span class="stringliteral">"FLAT_SKY isn't in the correct format!!!"</span>);
+<a name="l00810"></a>00810 KMO_TRY_ASSURE((desc_sky.naxis1 == nx) &&
+<a name="l00811"></a>00811 (desc_sky.naxis2 == ny) &&
+<a name="l00812"></a>00812 (desc_sky.nr_ext == nr_devices),
+<a name="l00813"></a>00813 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00814"></a>00814 <span class="stringliteral">"MASTER_DARK and FLAT_SKY (no. %d) frame haven't "</span>
+<a name="l00815"></a>00815 <span class="stringliteral">"same dimensions! (x,y): (%d,%d) vs (%d,%d)"</span>,
+<a name="l00816"></a>00816 cnt, nx, ny, desc_flat.naxis1, desc_flat.naxis2);
+<a name="l00817"></a>00817 kmo_free_fits_desc(&desc_sky);
+<a name="l00818"></a>00818 kmo_init_fits_desc(&desc_sky);
+<a name="l00819"></a>00819
+<a name="l00820"></a>00820 KMO_TRY_ASSURE(
+<a name="l00821"></a>00821 (kmo_check_lamp(main_header, INS_LAMP1_ST) == FALSE) &&
+<a name="l00822"></a>00822 (kmo_check_lamp(main_header, INS_LAMP2_ST) == FALSE) &&
+<a name="l00823"></a>00823 (kmo_check_lamp(main_header, INS_LAMP3_ST) == FALSE) &&
+<a name="l00824"></a>00824 (kmo_check_lamp(main_header, INS_LAMP4_ST) == FALSE),
+<a name="l00825"></a>00825 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00826"></a>00826 <span class="stringliteral">"All lamps must be switched off for the FLAT_SKY frames!"</span>);
+<a name="l00827"></a>00827
+<a name="l00828"></a>00828 <span class="comment">// assert that filters have correct IDs and that all detectors of</span>
+<a name="l00829"></a>00829 <span class="comment">// all input frames have the same filter set</span>
+<a name="l00830"></a>00830 <span class="keywordflow">for</span> (i = 1; i <= KMOS_NR_DETECTORS; i++) {
+<a name="l00831"></a>00831 <span class="comment">// ESO INS FILTi ID</span>
<a name="l00832"></a>00832 KMO_TRY_EXIT_IF_NULL(
-<a name="l00833"></a>00833 filter_id = cpl_propertylist_get_string(main_header, keyword));
-<a name="l00834"></a>00834
-<a name="l00835"></a>00835 KMO_TRY_EXIT_IF_NULL(
-<a name="l00836"></a>00836 filter_id_l = cpl_propertylist_get_string(tmp_header, keyword));
-<a name="l00837"></a>00837 cpl_free(keyword); keyword = NULL;
-<a name="l00838"></a>00838
-<a name="l00839"></a>00839 KMO_TRY_ASSURE((strcmp(filter_id, <span class="stringliteral">"IZ"</span>) == 0) ||
-<a name="l00840"></a>00840 (strcmp(filter_id, <span class="stringliteral">"YJ"</span>) == 0) ||
-<a name="l00841"></a>00841 (strcmp(filter_id, <span class="stringliteral">"H"</span>) == 0) ||
-<a name="l00842"></a>00842 (strcmp(filter_id, <span class="stringliteral">"K"</span>) == 0) ||
-<a name="l00843"></a>00843 (strcmp(filter_id, <span class="stringliteral">"HK"</span>) == 0),
-<a name="l00844"></a>00844 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00845"></a>00845 <span class="stringliteral">"Filter ID in primary header must be either 'IZ', "</span>
-<a name="l00846"></a>00846 <span class="stringliteral">"'YJ', 'H', 'K' or "</span> <span class="stringliteral">"'HK' !"</span>);
-<a name="l00847"></a>00847
-<a name="l00848"></a>00848 KMO_TRY_ASSURE(strcmp(filter_id, filter_id_l) == 0,
-<a name="l00849"></a>00849 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00850"></a>00850 <span class="stringliteral">"Filter IDs must be the same for FLAT_SKY frame"</span>
-<a name="l00851"></a>00851 <span class="stringliteral">" and lcal frame!"</span>
-<a name="l00852"></a>00852 <span class="stringliteral">"Detector No.: %d\n%s: %s\nLCAL: %s\n"</span>,
-<a name="l00853"></a>00853 i, cpl_frame_get_filename(frame),
-<a name="l00854"></a>00854 filter_id, filter_id_l);
-<a name="l00855"></a>00855
-<a name="l00856"></a>00856 <span class="comment">// ESO INS GRATi ID</span>
-<a name="l00857"></a>00857 KMO_TRY_EXIT_IF_NULL(
-<a name="l00858"></a>00858 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_GRATID_PREFIX, i, IFU_GRATID_POSTFIX));
+<a name="l00833"></a>00833 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_FILTID_PREFIX, i, IFU_FILTID_POSTFIX));
+<a name="l00834"></a>00834 KMO_TRY_EXIT_IF_NULL(
+<a name="l00835"></a>00835 filter_id = cpl_propertylist_get_string(main_header, keyword));
+<a name="l00836"></a>00836
+<a name="l00837"></a>00837 KMO_TRY_EXIT_IF_NULL(
+<a name="l00838"></a>00838 filter_id_l = cpl_propertylist_get_string(tmp_header, keyword));
+<a name="l00839"></a>00839 cpl_free(keyword); keyword = NULL;
+<a name="l00840"></a>00840
+<a name="l00841"></a>00841 KMO_TRY_ASSURE((strcmp(filter_id, <span class="stringliteral">"IZ"</span>) == 0) ||
+<a name="l00842"></a>00842 (strcmp(filter_id, <span class="stringliteral">"YJ"</span>) == 0) ||
+<a name="l00843"></a>00843 (strcmp(filter_id, <span class="stringliteral">"H"</span>) == 0) ||
+<a name="l00844"></a>00844 (strcmp(filter_id, <span class="stringliteral">"K"</span>) == 0) ||
+<a name="l00845"></a>00845 (strcmp(filter_id, <span class="stringliteral">"HK"</span>) == 0),
+<a name="l00846"></a>00846 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00847"></a>00847 <span class="stringliteral">"Filter ID in primary header must be either 'IZ', "</span>
+<a name="l00848"></a>00848 <span class="stringliteral">"'YJ', 'H', 'K' or "</span> <span class="stringliteral">"'HK' !"</span>);
+<a name="l00849"></a>00849
+<a name="l00850"></a>00850 KMO_TRY_ASSURE(strcmp(filter_id, filter_id_l) == 0,
+<a name="l00851"></a>00851 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00852"></a>00852 <span class="stringliteral">"Filter IDs must be the same for FLAT_SKY frame"</span>
+<a name="l00853"></a>00853 <span class="stringliteral">" and lcal frame!"</span>
+<a name="l00854"></a>00854 <span class="stringliteral">"Detector No.: %d\n%s: %s\nLCAL: %s\n"</span>,
+<a name="l00855"></a>00855 i, cpl_frame_get_filename(frame),
+<a name="l00856"></a>00856 filter_id, filter_id_l);
+<a name="l00857"></a>00857
+<a name="l00858"></a>00858 <span class="comment">// ESO INS GRATi ID</span>
<a name="l00859"></a>00859 KMO_TRY_EXIT_IF_NULL(
-<a name="l00860"></a>00860 filter_id = cpl_propertylist_get_string(main_header, keyword));
-<a name="l00861"></a>00861
-<a name="l00862"></a>00862 KMO_TRY_EXIT_IF_NULL(
-<a name="l00863"></a>00863 filter_id_l = cpl_propertylist_get_string(tmp_header, keyword));
-<a name="l00864"></a>00864 cpl_free(keyword); keyword = NULL;
-<a name="l00865"></a>00865
-<a name="l00866"></a>00866 KMO_TRY_ASSURE((strcmp(filter_id, <span class="stringliteral">"IZ"</span>) == 0) ||
-<a name="l00867"></a>00867 (strcmp(filter_id, <span class="stringliteral">"YJ"</span>) == 0) ||
-<a name="l00868"></a>00868 (strcmp(filter_id, <span class="stringliteral">"H"</span>) == 0) ||
-<a name="l00869"></a>00869 (strcmp(filter_id, <span class="stringliteral">"K"</span>) == 0) ||
-<a name="l00870"></a>00870 (strcmp(filter_id, <span class="stringliteral">"HK"</span>) == 0),
-<a name="l00871"></a>00871 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00872"></a>00872 <span class="stringliteral">"Grating ID in primary header must be either "</span>
-<a name="l00873"></a>00873 <span class="stringliteral">"'IZ', 'YJ', 'H', 'K' or "</span> <span class="stringliteral">"'HK' !"</span>);
-<a name="l00874"></a>00874
-<a name="l00875"></a>00875 KMO_TRY_ASSURE(strcmp(filter_id, filter_id_l) == 0,
-<a name="l00876"></a>00876 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00877"></a>00877 <span class="stringliteral">"Grating IDs must be the same for FLAT_SKY frame"</span>
-<a name="l00878"></a>00878 <span class="stringliteral">" and lcal frame!"</span>
-<a name="l00879"></a>00879 <span class="stringliteral">"Detector No.: %d\n%s: %s\nLCAL: %s\n"</span>,
-<a name="l00880"></a>00880 i, cpl_frame_get_filename(frame),
-<a name="l00881"></a>00881 filter_id, filter_id_l);
-<a name="l00882"></a>00882
-<a name="l00883"></a>00883 tmp_rotangle = cpl_propertylist_get_double(main_header, ROTANGLE);
-<a name="l00884"></a>00884 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"Cannot retrieve ROTANGLE FITS keyword from sky frame!"</span>);
-<a name="l00885"></a>00885 kmclipm_strip_angle(&tmp_rotangle);
-<a name="l00886"></a>00886 KMO_TRY_ASSURE((abs(rotangle - tmp_rotangle) < 10.0) ||
-<a name="l00887"></a>00887 (abs(rotangle - tmp_rotangle) > 360.-10.) ,
-<a name="l00888"></a>00888 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00889"></a>00889 <span class="stringliteral">"OCS ROT NAANGLE of sky flat frames differ to much: %f %f"</span>,
-<a name="l00890"></a>00890 rotangle, tmp_rotangle);
-<a name="l00891"></a>00891 }
-<a name="l00892"></a>00892 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l00893"></a>00893
-<a name="l00894"></a>00894 <span class="comment">// get next FLAT_SKY frame</span>
-<a name="l00895"></a>00895 frame = kmo_dfs_get_frame(frameset, NULL);
-<a name="l00896"></a>00896 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00897"></a>00897 cnt++;
-<a name="l00898"></a>00898 }
-<a name="l00899"></a>00899
-<a name="l00900"></a>00900 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l00860"></a>00860 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_GRATID_PREFIX, i, IFU_GRATID_POSTFIX));
+<a name="l00861"></a>00861 KMO_TRY_EXIT_IF_NULL(
+<a name="l00862"></a>00862 filter_id = cpl_propertylist_get_string(main_header, keyword));
+<a name="l00863"></a>00863
+<a name="l00864"></a>00864 KMO_TRY_EXIT_IF_NULL(
+<a name="l00865"></a>00865 filter_id_l = cpl_propertylist_get_string(tmp_header, keyword));
+<a name="l00866"></a>00866 cpl_free(keyword); keyword = NULL;
+<a name="l00867"></a>00867
+<a name="l00868"></a>00868 KMO_TRY_ASSURE((strcmp(filter_id, <span class="stringliteral">"IZ"</span>) == 0) ||
+<a name="l00869"></a>00869 (strcmp(filter_id, <span class="stringliteral">"YJ"</span>) == 0) ||
+<a name="l00870"></a>00870 (strcmp(filter_id, <span class="stringliteral">"H"</span>) == 0) ||
+<a name="l00871"></a>00871 (strcmp(filter_id, <span class="stringliteral">"K"</span>) == 0) ||
+<a name="l00872"></a>00872 (strcmp(filter_id, <span class="stringliteral">"HK"</span>) == 0),
+<a name="l00873"></a>00873 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00874"></a>00874 <span class="stringliteral">"Grating ID in primary header must be either "</span>
+<a name="l00875"></a>00875 <span class="stringliteral">"'IZ', 'YJ', 'H', 'K' or "</span> <span class="stringliteral">"'HK' !"</span>);
+<a name="l00876"></a>00876
+<a name="l00877"></a>00877 KMO_TRY_ASSURE(strcmp(filter_id, filter_id_l) == 0,
+<a name="l00878"></a>00878 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00879"></a>00879 <span class="stringliteral">"Grating IDs must be the same for FLAT_SKY frame"</span>
+<a name="l00880"></a>00880 <span class="stringliteral">" and lcal frame!"</span>
+<a name="l00881"></a>00881 <span class="stringliteral">"Detector No.: %d\n%s: %s\nLCAL: %s\n"</span>,
+<a name="l00882"></a>00882 i, cpl_frame_get_filename(frame),
+<a name="l00883"></a>00883 filter_id, filter_id_l);
+<a name="l00884"></a>00884
+<a name="l00885"></a>00885 tmp_rotangle = cpl_propertylist_get_double(main_header, ROTANGLE);
+<a name="l00886"></a>00886 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"Cannot retrieve ROTANGLE FITS keyword from sky frame!"</span>);
+<a name="l00887"></a>00887 kmclipm_strip_angle(&tmp_rotangle);
+<a name="l00888"></a>00888 KMO_TRY_ASSURE((abs(rotangle - tmp_rotangle) < 10.0) ||
+<a name="l00889"></a>00889 (abs(rotangle - tmp_rotangle) > 360.-10.) ,
+<a name="l00890"></a>00890 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00891"></a>00891 <span class="stringliteral">"OCS ROT NAANGLE of sky flat frames differ too much: %f %f"</span>,
+<a name="l00892"></a>00892 rotangle, tmp_rotangle);
+<a name="l00893"></a>00893 }
+<a name="l00894"></a>00894 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l00895"></a>00895
+<a name="l00896"></a>00896 <span class="comment">// get next FLAT_SKY frame</span>
+<a name="l00897"></a>00897 frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l00898"></a>00898 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00899"></a>00899 cnt++;
+<a name="l00900"></a>00900 }
<a name="l00901"></a>00901
-<a name="l00902"></a>00902 <span class="comment">//</span>
-<a name="l00903"></a>00903 <span class="comment">// noise will be propagated when:</span>
-<a name="l00904"></a>00904 <span class="comment">// MASTER_DARK and MASTER_FLAT have noise extensions and if at least</span>
-<a name="l00905"></a>00905 <span class="comment">// 2 FLAT_SKY frames are provided.</span>
-<a name="l00906"></a>00906 <span class="comment">// Otherwise noise will be ignored.</span>
-<a name="l00907"></a>00907 <span class="comment">//</span>
-<a name="l00908"></a>00908 <span class="keywordflow">if</span> (desc_dark.ex_noise &&
-<a name="l00909"></a>00909 desc_flat.ex_noise &&
-<a name="l00910"></a>00910 (cpl_frameset_count_tags(frameset, FLAT_SKY) >= 2)) {
-<a name="l00911"></a>00911 process_noise = TRUE;
-<a name="l00912"></a>00912 }
-<a name="l00913"></a>00913
-<a name="l00914"></a>00914 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, FLAT_SKY) == 1) {
-<a name="l00915"></a>00915 cpl_msg_warning(cpl_func, <span class="stringliteral">"cmethod is changed to 'average' "</span>
-<a name="l00916"></a>00916 <span class="stringliteral">"since there is only one input frame! (The output "</span>
-<a name="l00917"></a>00917 <span class="stringliteral">"file won't have any noise extensions)"</span>);
-<a name="l00918"></a>00918
-<a name="l00919"></a>00919 cmethod = <span class="stringliteral">"average"</span>;
-<a name="l00920"></a>00920 }
-<a name="l00921"></a>00921
-<a name="l00922"></a>00922 <span class="comment">//</span>
-<a name="l00923"></a>00923 <span class="comment">// Check whether 1st FLAT_SKY should be omitted</span>
+<a name="l00902"></a>00902 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l00903"></a>00903
+<a name="l00904"></a>00904 <span class="comment">//</span>
+<a name="l00905"></a>00905 <span class="comment">// noise will be propagated when:</span>
+<a name="l00906"></a>00906 <span class="comment">// MASTER_DARK and MASTER_FLAT have noise extensions and if at least</span>
+<a name="l00907"></a>00907 <span class="comment">// 2 FLAT_SKY frames are provided.</span>
+<a name="l00908"></a>00908 <span class="comment">// Otherwise noise will be ignored.</span>
+<a name="l00909"></a>00909 <span class="comment">//</span>
+<a name="l00910"></a>00910 <span class="keywordflow">if</span> (desc_dark.ex_noise &&
+<a name="l00911"></a>00911 desc_flat.ex_noise &&
+<a name="l00912"></a>00912 (cpl_frameset_count_tags(frameset, FLAT_SKY) >= 2)) {
+<a name="l00913"></a>00913 process_noise = TRUE;
+<a name="l00914"></a>00914 }
+<a name="l00915"></a>00915
+<a name="l00916"></a>00916 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, FLAT_SKY) == 1) {
+<a name="l00917"></a>00917 cpl_msg_warning(cpl_func, <span class="stringliteral">"cmethod is changed to 'average' "</span>
+<a name="l00918"></a>00918 <span class="stringliteral">"since there is only one input frame! (The output "</span>
+<a name="l00919"></a>00919 <span class="stringliteral">"file won't have any noise extensions)"</span>);
+<a name="l00920"></a>00920
+<a name="l00921"></a>00921 cmethod = <span class="stringliteral">"average"</span>;
+<a name="l00922"></a>00922 }
+<a name="l00923"></a>00923
<a name="l00924"></a>00924 <span class="comment">//</span>
-<a name="l00925"></a>00925 KMO_TRY_EXIT_IF_NULL(
-<a name="l00926"></a>00926 frameset_sky = cpl_frameset_new());
-<a name="l00927"></a>00927
-<a name="l00928"></a>00928 <span class="keywordflow">if</span> (add_all_sky) {
-<a name="l00929"></a>00929 <span class="comment">// just add all FLAT_SKY frames without check</span>
-<a name="l00930"></a>00930 frame = kmo_dfs_get_frame(frameset, FLAT_SKY);
-<a name="l00931"></a>00931 <span class="keywordflow">while</span> (frame != NULL) {
-<a name="l00932"></a>00932 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00933"></a>00933 cpl_frameset_insert(frameset_sky, cpl_frame_duplicate(frame)));
-<a name="l00934"></a>00934 frame = kmo_dfs_get_frame(frameset, NULL);
-<a name="l00935"></a>00935 }
-<a name="l00936"></a>00936 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Add all FLAT_SKY without checking for acquisition frame."</span>);
-<a name="l00937"></a>00937 } <span class="keywordflow">else</span> {
-<a name="l00938"></a>00938 <span class="comment">// check if 1st FLAT_SKY has different exposure time and whether to omit it</span>
-<a name="l00939"></a>00939 KMO_TRY_EXIT_IF_NULL(
-<a name="l00940"></a>00940 frame = kmo_dfs_get_frame(frameset, FLAT_SKY));
-<a name="l00941"></a>00941
-<a name="l00942"></a>00942 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, FLAT_SKY) == 1) {
-<a name="l00943"></a>00943 <span class="comment">// just one FLAT_SKY, always add</span>
-<a name="l00944"></a>00944 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00945"></a>00945 cpl_frameset_insert(frameset_sky, cpl_frame_duplicate(frame)));
-<a name="l00946"></a>00946 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00947"></a>00947 } <span class="keywordflow">else</span> {
-<a name="l00948"></a>00948 <span class="comment">// several FLAT_SKY frames, check exptime</span>
-<a name="l00949"></a>00949
-<a name="l00950"></a>00950 <span class="comment">// get exptime 1</span>
-<a name="l00951"></a>00951 KMO_TRY_EXIT_IF_NULL(
-<a name="l00952"></a>00952 main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
-<a name="l00953"></a>00953 exptime1 = cpl_propertylist_get_double(main_header, EXPTIME);
-<a name="l00954"></a>00954 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00955"></a>00955 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l00956"></a>00956
-<a name="l00957"></a>00957 <span class="comment">// get exptime 2</span>
-<a name="l00958"></a>00958 frame = kmo_dfs_get_frame(frameset, NULL);
-<a name="l00959"></a>00959 KMO_TRY_EXIT_IF_NULL(
-<a name="l00960"></a>00960 main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
-<a name="l00961"></a>00961 exptime2 = cpl_propertylist_get_double(main_header, EXPTIME);
-<a name="l00962"></a>00962 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00963"></a>00963 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l00964"></a>00964
-<a name="l00965"></a>00965 <span class="comment">// loop remaining frames</span>
-<a name="l00966"></a>00966 same_exptime = TRUE;
-<a name="l00967"></a>00967 frame = kmo_dfs_get_frame(frameset, NULL);
-<a name="l00968"></a>00968 <span class="keywordflow">while</span> (same_exptime && (frame != NULL)) {
-<a name="l00969"></a>00969 KMO_TRY_EXIT_IF_NULL(
-<a name="l00970"></a>00970 main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
-<a name="l00971"></a>00971 exptime = cpl_propertylist_get_double(main_header, EXPTIME);
-<a name="l00972"></a>00972 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00973"></a>00973 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l00974"></a>00974 <span class="keywordflow">if</span> (fabs(exptime-exptime2) > 0.01) {
-<a name="l00975"></a>00975 <span class="comment">// not same</span>
-<a name="l00976"></a>00976 same_exptime = FALSE;
-<a name="l00977"></a>00977 }
-<a name="l00978"></a>00978 frame = kmo_dfs_get_frame(frameset, NULL);
-<a name="l00979"></a>00979 }
-<a name="l00980"></a>00980
-<a name="l00981"></a>00981 <span class="keywordflow">if</span> (same_exptime) {
-<a name="l00982"></a>00982 <span class="comment">// frame [2,n] have same exptime, add them</span>
-<a name="l00983"></a>00983 frame = kmo_dfs_get_frame(frameset, FLAT_SKY);
-<a name="l00984"></a>00984 KMO_TRY_EXIT_IF_NULL(
-<a name="l00985"></a>00985 main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
-<a name="l00986"></a>00986 exptime = cpl_propertylist_get_double(main_header, EXPTIME);
-<a name="l00987"></a>00987 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00988"></a>00988 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l00989"></a>00989 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Omit FLAT_SKY: %s with EXPTIME of %g sec (acquisition), other frame(s) have EXPTIME of %g sec"</span>, cpl_frame_get_filename(frame), exptime, exptime2);
-<a name="l00990"></a>00990 frame = kmo_dfs_get_frame(frameset, NULL);
-<a name="l00991"></a>00991 <span class="keywordflow">while</span> (frame != NULL) {
-<a name="l00992"></a>00992 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00993"></a>00993 cpl_frameset_insert(frameset_sky, cpl_frame_duplicate(frame)));
-<a name="l00994"></a>00994 frame = kmo_dfs_get_frame(frameset, NULL);
-<a name="l00995"></a>00995 }
-<a name="l00996"></a>00996 <span class="keywordflow">if</span> (fabs(exptime1-exptime2) < 0.01) {
-<a name="l00997"></a>00997 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"The 1st FLAT_SKY has the same exposure time as the following ones. "</span>
-<a name="l00998"></a>00998 <span class="stringliteral">"It has anyway been omitted since we assume it is an acquisition frame. "</span>
-<a name="l00999"></a>00999 <span class="stringliteral">"If you want to add it anyway call this recipe with the --add-all parameter"</span>);
-<a name="l01000"></a>01000 }
-<a name="l01001"></a>01001 } <span class="keywordflow">else</span> {
-<a name="l01002"></a>01002 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"The exposure times of the FLAT_SKY frames don't match!"</span>);
-<a name="l01003"></a>01003 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"We assume that the 1st frame is an acquisition frame and would be omitted."</span>);
-<a name="l01004"></a>01004 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"The following frames should have the same exposure time if they originate from the same template."</span>);
-<a name="l01005"></a>01005 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"If you want to reduce them anyway call this recipe with the --add-all parameter"</span>);
-<a name="l01006"></a>01006 frame = kmo_dfs_get_frame(frameset, FLAT_SKY);
-<a name="l01007"></a>01007 <span class="keywordflow">while</span> (frame != NULL) {
-<a name="l01008"></a>01008 KMO_TRY_EXIT_IF_NULL(
-<a name="l01009"></a>01009 main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
-<a name="l01010"></a>01010 exptime = cpl_propertylist_get_double(main_header, EXPTIME);
-<a name="l01011"></a>01011 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01012"></a>01012 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l01013"></a>01013 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"FLAT_SKY: %s, EXPTIME: %g"</span>, cpl_frame_get_filename(frame), exptime);
-<a name="l01014"></a>01014 frame = kmo_dfs_get_frame(frameset, NULL);
-<a name="l01015"></a>01015 }
-<a name="l01016"></a>01016 cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT);
-<a name="l01017"></a>01017 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01018"></a>01018 }
-<a name="l01019"></a>01019 }
-<a name="l01020"></a>01020 }
-<a name="l01021"></a>01021
-<a name="l01022"></a>01022 KMO_TRY_EXIT_IF_NULL(
-<a name="l01023"></a>01023 frame = kmo_dfs_get_frame(frameset_sky, FLAT_SKY));
+<a name="l00925"></a>00925 <span class="comment">// Check whether 1st FLAT_SKY should be omitted</span>
+<a name="l00926"></a>00926 <span class="comment">//</span>
+<a name="l00927"></a>00927 KMO_TRY_EXIT_IF_NULL(
+<a name="l00928"></a>00928 frameset_sky = cpl_frameset_new());
+<a name="l00929"></a>00929
+<a name="l00930"></a>00930 <span class="keywordflow">if</span> (add_all_sky) {
+<a name="l00931"></a>00931 <span class="comment">// just add all FLAT_SKY frames without check</span>
+<a name="l00932"></a>00932 frame = kmo_dfs_get_frame(frameset, FLAT_SKY);
+<a name="l00933"></a>00933 <span class="keywordflow">while</span> (frame != NULL) {
+<a name="l00934"></a>00934 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00935"></a>00935 cpl_frameset_insert(frameset_sky, cpl_frame_duplicate(frame)));
+<a name="l00936"></a>00936 frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l00937"></a>00937 }
+<a name="l00938"></a>00938 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Add all FLAT_SKY without checking for acquisition frame."</span>);
+<a name="l00939"></a>00939 } <span class="keywordflow">else</span> {
+<a name="l00940"></a>00940 <span class="comment">// check if 1st FLAT_SKY has different exposure time and whether to omit it</span>
+<a name="l00941"></a>00941 KMO_TRY_EXIT_IF_NULL(
+<a name="l00942"></a>00942 frame = kmo_dfs_get_frame(frameset, FLAT_SKY));
+<a name="l00943"></a>00943
+<a name="l00944"></a>00944 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, FLAT_SKY) == 1) {
+<a name="l00945"></a>00945 <span class="comment">// just one FLAT_SKY, always add</span>
+<a name="l00946"></a>00946 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00947"></a>00947 cpl_frameset_insert(frameset_sky, cpl_frame_duplicate(frame)));
+<a name="l00948"></a>00948 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00949"></a>00949 } <span class="keywordflow">else</span> {
+<a name="l00950"></a>00950 <span class="comment">// several FLAT_SKY frames, check exptime</span>
+<a name="l00951"></a>00951
+<a name="l00952"></a>00952 <span class="comment">// get exptime 1</span>
+<a name="l00953"></a>00953 KMO_TRY_EXIT_IF_NULL(
+<a name="l00954"></a>00954 main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
+<a name="l00955"></a>00955 exptime1 = cpl_propertylist_get_double(main_header, EXPTIME);
+<a name="l00956"></a>00956 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00957"></a>00957 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l00958"></a>00958
+<a name="l00959"></a>00959 <span class="comment">// get exptime 2</span>
+<a name="l00960"></a>00960 frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l00961"></a>00961 KMO_TRY_EXIT_IF_NULL(
+<a name="l00962"></a>00962 main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
+<a name="l00963"></a>00963 exptime2 = cpl_propertylist_get_double(main_header, EXPTIME);
+<a name="l00964"></a>00964 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00965"></a>00965 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l00966"></a>00966
+<a name="l00967"></a>00967 <span class="comment">// loop remaining frames</span>
+<a name="l00968"></a>00968 same_exptime = TRUE;
+<a name="l00969"></a>00969 frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l00970"></a>00970 <span class="keywordflow">while</span> (same_exptime && (frame != NULL)) {
+<a name="l00971"></a>00971 KMO_TRY_EXIT_IF_NULL(
+<a name="l00972"></a>00972 main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
+<a name="l00973"></a>00973 exptime = cpl_propertylist_get_double(main_header, EXPTIME);
+<a name="l00974"></a>00974 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00975"></a>00975 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l00976"></a>00976 <span class="keywordflow">if</span> (fabs(exptime-exptime2) > 0.01) {
+<a name="l00977"></a>00977 <span class="comment">// not same</span>
+<a name="l00978"></a>00978 same_exptime = FALSE;
+<a name="l00979"></a>00979 }
+<a name="l00980"></a>00980 frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l00981"></a>00981 }
+<a name="l00982"></a>00982
+<a name="l00983"></a>00983 <span class="keywordflow">if</span> (same_exptime) {
+<a name="l00984"></a>00984 <span class="comment">// frame [2,n] have same exptime, add them</span>
+<a name="l00985"></a>00985 frame = kmo_dfs_get_frame(frameset, FLAT_SKY);
+<a name="l00986"></a>00986 KMO_TRY_EXIT_IF_NULL(
+<a name="l00987"></a>00987 main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
+<a name="l00988"></a>00988 exptime = cpl_propertylist_get_double(main_header, EXPTIME);
+<a name="l00989"></a>00989 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00990"></a>00990 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l00991"></a>00991 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Omit FLAT_SKY: %s with EXPTIME of %g sec (acquisition), other frame(s) have EXPTIME of %g sec"</span>, cpl_frame_get_filename(frame), exptime, exptime2);
+<a name="l00992"></a>00992 frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l00993"></a>00993 <span class="keywordflow">while</span> (frame != NULL) {
+<a name="l00994"></a>00994 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00995"></a>00995 cpl_frameset_insert(frameset_sky, cpl_frame_duplicate(frame)));
+<a name="l00996"></a>00996 frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l00997"></a>00997 }
+<a name="l00998"></a>00998 <span class="keywordflow">if</span> (fabs(exptime1-exptime2) < 0.01) {
+<a name="l00999"></a>00999 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"The 1st FLAT_SKY has the same exposure time as the following ones. "</span>
+<a name="l01000"></a>01000 <span class="stringliteral">"It has anyway been omitted since we assume it is an acquisition frame. "</span>
+<a name="l01001"></a>01001 <span class="stringliteral">"If you want to add it anyway call this recipe with the --add-all parameter"</span>);
+<a name="l01002"></a>01002 }
+<a name="l01003"></a>01003 } <span class="keywordflow">else</span> {
+<a name="l01004"></a>01004 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"The exposure times of the FLAT_SKY frames don't match!"</span>);
+<a name="l01005"></a>01005 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"We assume that the 1st frame is an acquisition frame and would be omitted."</span>);
+<a name="l01006"></a>01006 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"The following frames should have the same exposure time if they originate from the same template."</span>);
+<a name="l01007"></a>01007 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"If you want to reduce them anyway call this recipe with the --add-all parameter"</span>);
+<a name="l01008"></a>01008 frame = kmo_dfs_get_frame(frameset, FLAT_SKY);
+<a name="l01009"></a>01009 <span class="keywordflow">while</span> (frame != NULL) {
+<a name="l01010"></a>01010 KMO_TRY_EXIT_IF_NULL(
+<a name="l01011"></a>01011 main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
+<a name="l01012"></a>01012 exptime = cpl_propertylist_get_double(main_header, EXPTIME);
+<a name="l01013"></a>01013 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01014"></a>01014 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l01015"></a>01015 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"FLAT_SKY: %s, EXPTIME: %g"</span>, cpl_frame_get_filename(frame), exptime);
+<a name="l01016"></a>01016 frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l01017"></a>01017 }
+<a name="l01018"></a>01018 cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT);
+<a name="l01019"></a>01019 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01020"></a>01020 }
+<a name="l01021"></a>01021 }
+<a name="l01022"></a>01022 }
+<a name="l01023"></a>01023
<a name="l01024"></a>01024 KMO_TRY_EXIT_IF_NULL(
-<a name="l01025"></a>01025 main_header = kmo_dfs_load_primary_header(frameset_sky, FLAT_SKY));
+<a name="l01025"></a>01025 frame = kmo_dfs_get_frame(frameset_sky, FLAT_SKY));
<a name="l01026"></a>01026 KMO_TRY_EXIT_IF_NULL(
-<a name="l01027"></a>01027 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_GRATID_PREFIX, 1, IFU_GRATID_POSTFIX));
+<a name="l01027"></a>01027 main_header = kmo_dfs_load_primary_header(frameset_sky, FLAT_SKY));
<a name="l01028"></a>01028 KMO_TRY_EXIT_IF_NULL(
-<a name="l01029"></a>01029 filter = cpl_sprintf(<span class="stringliteral">"%s"</span>, cpl_propertylist_get_string(main_header, keyword)));
-<a name="l01030"></a>01030 cpl_free(keyword); keyword = NULL;
-<a name="l01031"></a>01031
-<a name="l01032"></a>01032 <span class="comment">//</span>
-<a name="l01033"></a>01033 <span class="comment">// set default band-specific ranges for collapsing</span>
+<a name="l01029"></a>01029 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_GRATID_PREFIX, 1, IFU_GRATID_POSTFIX));
+<a name="l01030"></a>01030 KMO_TRY_EXIT_IF_NULL(
+<a name="l01031"></a>01031 filter = cpl_sprintf(<span class="stringliteral">"%s"</span>, cpl_propertylist_get_string(main_header, keyword)));
+<a name="l01032"></a>01032 cpl_free(keyword); keyword = NULL;
+<a name="l01033"></a>01033
<a name="l01034"></a>01034 <span class="comment">//</span>
-<a name="l01035"></a>01035 <span class="keywordflow">if</span> (ranges == NULL) {
-<a name="l01036"></a>01036 <span class="keywordflow">if</span> (strcmp(filter, <span class="stringliteral">"IZ"</span>) == 0) {
-<a name="l01037"></a>01037 ranges_txt = <span class="stringliteral">"0.81,1.05"</span>;
-<a name="l01038"></a>01038 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter, <span class="stringliteral">"YJ"</span>) == 0) {
-<a name="l01039"></a>01039 ranges_txt = <span class="stringliteral">"1.025,1.3"</span>;
-<a name="l01040"></a>01040 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter, <span class="stringliteral">"H"</span>) == 0) {
-<a name="l01041"></a>01041 ranges_txt = <span class="stringliteral">"1.5,1.7"</span>;
-<a name="l01042"></a>01042 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter, <span class="stringliteral">"K"</span>) == 0) {
-<a name="l01043"></a>01043 ranges_txt = <span class="stringliteral">"2.1,2.35"</span>;
-<a name="l01044"></a>01044 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter, <span class="stringliteral">"HK"</span>) == 0) {
-<a name="l01045"></a>01045 ranges_txt = <span class="stringliteral">"1.5,1.7;2.1,2.35"</span>;
-<a name="l01046"></a>01046 <span class="comment">// ranges_txt = "1.5,1.7";</span>
-<a name="l01047"></a>01047 } <span class="keywordflow">else</span> {
-<a name="l01048"></a>01048 KMO_TRY_ASSURE(1 == 0,
-<a name="l01049"></a>01049 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01050"></a>01050 <span class="stringliteral">"We really shouldn't get here..."</span>);
-<a name="l01051"></a>01051 }
-<a name="l01052"></a>01052 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Spectral range to collapse has been set to %s um for this band."</span>, ranges_txt);
-<a name="l01053"></a>01053 ranges = kmo_identify_ranges(ranges_txt);
-<a name="l01054"></a>01054 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01055"></a>01055 }
-<a name="l01056"></a>01056
-<a name="l01057"></a>01057 <span class="comment">// setup grid definition, wavelength start and end points will be set</span>
-<a name="l01058"></a>01058 <span class="comment">// in the detector loop</span>
-<a name="l01059"></a>01059 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01060"></a>01060 kmclipm_setup_grid(&gd, method, neighborhoodRange, pix_scale));
-<a name="l01061"></a>01061
-<a name="l01062"></a>01062 <span class="comment">// create filename for LUT</span>
-<a name="l01063"></a>01063 KMO_TRY_EXIT_IF_NULL(
-<a name="l01064"></a>01064 fn_lut = cpl_sprintf(<span class="stringliteral">"%s%s"</span>, <span class="stringliteral">"lut"</span>, suffix));
-<a name="l01065"></a>01065
-<a name="l01066"></a>01066 <span class="comment">// extract bounds</span>
-<a name="l01067"></a>01067 KMO_TRY_EXIT_IF_NULL(
-<a name="l01068"></a>01068 tmp_header = kmo_dfs_load_primary_header(frameset, XCAL));
+<a name="l01035"></a>01035 <span class="comment">// set default band-specific ranges for collapsing</span>
+<a name="l01036"></a>01036 <span class="comment">//</span>
+<a name="l01037"></a>01037 <span class="keywordflow">if</span> (ranges == NULL) {
+<a name="l01038"></a>01038 <span class="keywordflow">if</span> (strcmp(filter, <span class="stringliteral">"IZ"</span>) == 0) {
+<a name="l01039"></a>01039 ranges_txt = <span class="stringliteral">"0.81,1.05"</span>;
+<a name="l01040"></a>01040 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter, <span class="stringliteral">"YJ"</span>) == 0) {
+<a name="l01041"></a>01041 ranges_txt = <span class="stringliteral">"1.025,1.3"</span>;
+<a name="l01042"></a>01042 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter, <span class="stringliteral">"H"</span>) == 0) {
+<a name="l01043"></a>01043 ranges_txt = <span class="stringliteral">"1.5,1.7"</span>;
+<a name="l01044"></a>01044 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter, <span class="stringliteral">"K"</span>) == 0) {
+<a name="l01045"></a>01045 ranges_txt = <span class="stringliteral">"2.1,2.35"</span>;
+<a name="l01046"></a>01046 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter, <span class="stringliteral">"HK"</span>) == 0) {
+<a name="l01047"></a>01047 ranges_txt = <span class="stringliteral">"1.5,1.7;2.1,2.35"</span>;
+<a name="l01048"></a>01048 <span class="comment">// ranges_txt = "1.5,1.7";</span>
+<a name="l01049"></a>01049 } <span class="keywordflow">else</span> {
+<a name="l01050"></a>01050 KMO_TRY_ASSURE(1 == 0,
+<a name="l01051"></a>01051 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01052"></a>01052 <span class="stringliteral">"We really shouldn't get here..."</span>);
+<a name="l01053"></a>01053 }
+<a name="l01054"></a>01054 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Spectral range to collapse has been set to [%s] um for this band."</span>, ranges_txt);
+<a name="l01055"></a>01055 ranges = kmo_identify_ranges(ranges_txt);
+<a name="l01056"></a>01056 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01057"></a>01057 }
+<a name="l01058"></a>01058
+<a name="l01059"></a>01059 <span class="comment">// setup grid definition, wavelength start and end points will be set</span>
+<a name="l01060"></a>01060 <span class="comment">// in the detector loop</span>
+<a name="l01061"></a>01061 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01062"></a>01062 kmclipm_setup_grid(&gd, method, neighborhoodRange, pix_scale, 0.));
+<a name="l01063"></a>01063
+<a name="l01064"></a>01064 <span class="comment">// create filename for LUT</span>
+<a name="l01065"></a>01065 KMO_TRY_EXIT_IF_NULL(
+<a name="l01066"></a>01066 fn_lut = cpl_sprintf(<span class="stringliteral">"%s%s"</span>, <span class="stringliteral">"lut"</span>, suffix));
+<a name="l01067"></a>01067
+<a name="l01068"></a>01068 <span class="comment">// extract bounds</span>
<a name="l01069"></a>01069 KMO_TRY_EXIT_IF_NULL(
-<a name="l01070"></a>01070 bounds = kmclipm_extract_bounds(tmp_header));
-<a name="l01071"></a>01071 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
-<a name="l01072"></a>01072
-<a name="l01073"></a>01073 <span class="comment">// get timestamps of xcal, ycal & lcal</span>
-<a name="l01074"></a>01074 KMO_TRY_EXIT_IF_NULL(
-<a name="l01075"></a>01075 calTimestamp = kmo_get_timestamps(xcalFrame, ycalFrame, lcalFrame));
-<a name="l01076"></a>01076
-<a name="l01077"></a>01077 <span class="comment">// create arrays to hold reconstructed data and noise cubes and</span>
-<a name="l01078"></a>01078 <span class="comment">// their headers</span>
-<a name="l01079"></a>01079 KMO_TRY_EXIT_IF_NULL(
-<a name="l01080"></a>01080 stored_data_cubes = (cpl_imagelist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
-<a name="l01081"></a>01081 <span class="keyword">sizeof</span>(cpl_imagelist*)));
-<a name="l01082"></a>01082 KMO_TRY_EXIT_IF_NULL(
-<a name="l01083"></a>01083 stored_noise_cubes = (cpl_imagelist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
-<a name="l01084"></a>01084 <span class="keyword">sizeof</span>(cpl_imagelist*)));
-<a name="l01085"></a>01085 KMO_TRY_EXIT_IF_NULL(
-<a name="l01086"></a>01086 stored_data_images = (cpl_image**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
-<a name="l01087"></a>01087 <span class="keyword">sizeof</span>(cpl_image*)));
-<a name="l01088"></a>01088 KMO_TRY_EXIT_IF_NULL(
-<a name="l01089"></a>01089 stored_noise_images = (cpl_image**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
-<a name="l01090"></a>01090 <span class="keyword">sizeof</span>(cpl_image*)));
-<a name="l01091"></a>01091 KMO_TRY_EXIT_IF_NULL(
-<a name="l01092"></a>01092 stored_sub_data_headers = (cpl_propertylist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
-<a name="l01093"></a>01093 <span class="keyword">sizeof</span>(cpl_propertylist*)));
-<a name="l01094"></a>01094 KMO_TRY_EXIT_IF_NULL(
-<a name="l01095"></a>01095 stored_sub_noise_headers = (cpl_propertylist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
-<a name="l01096"></a>01096 <span class="keyword">sizeof</span>(cpl_propertylist*)));
-<a name="l01097"></a>01097 KMO_TRY_EXIT_IF_NULL(
-<a name="l01098"></a>01098 edge_table_sky = (cpl_table***)cpl_calloc(KMOS_NR_DETECTORS,
-<a name="l01099"></a>01099 <span class="keyword">sizeof</span>(cpl_table**)));
-<a name="l01100"></a>01100 KMO_TRY_EXIT_IF_NULL(
-<a name="l01101"></a>01101 edge_table_flat = (cpl_table**)cpl_calloc(KMOS_IFUS_PER_DETECTOR,
-<a name="l01102"></a>01102 <span class="keyword">sizeof</span>(cpl_table*)));
-<a name="l01103"></a>01103 KMO_TRY_EXIT_IF_NULL(
-<a name="l01104"></a>01104 calAngles = cpl_vector_new(3));
-<a name="l01105"></a>01105
-<a name="l01106"></a>01106 <span class="comment">//</span>
-<a name="l01107"></a>01107 <span class="comment">// loop through all detectors</span>
+<a name="l01070"></a>01070 tmp_header = kmo_dfs_load_primary_header(frameset, XCAL));
+<a name="l01071"></a>01071 KMO_TRY_EXIT_IF_NULL(
+<a name="l01072"></a>01072 bounds = kmclipm_extract_bounds(tmp_header));
+<a name="l01073"></a>01073 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l01074"></a>01074
+<a name="l01075"></a>01075 <span class="comment">// get timestamps of xcal, ycal & lcal</span>
+<a name="l01076"></a>01076 KMO_TRY_EXIT_IF_NULL(
+<a name="l01077"></a>01077 calTimestamp = kmo_get_timestamps(xcalFrame, ycalFrame, lcalFrame));
+<a name="l01078"></a>01078
+<a name="l01079"></a>01079 <span class="comment">// create arrays to hold reconstructed data and noise cubes and</span>
+<a name="l01080"></a>01080 <span class="comment">// their headers</span>
+<a name="l01081"></a>01081 KMO_TRY_EXIT_IF_NULL(
+<a name="l01082"></a>01082 stored_data_cubes = (cpl_imagelist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
+<a name="l01083"></a>01083 <span class="keyword">sizeof</span>(cpl_imagelist*)));
+<a name="l01084"></a>01084 KMO_TRY_EXIT_IF_NULL(
+<a name="l01085"></a>01085 stored_noise_cubes = (cpl_imagelist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
+<a name="l01086"></a>01086 <span class="keyword">sizeof</span>(cpl_imagelist*)));
+<a name="l01087"></a>01087 KMO_TRY_EXIT_IF_NULL(
+<a name="l01088"></a>01088 stored_data_images = (cpl_image**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
+<a name="l01089"></a>01089 <span class="keyword">sizeof</span>(cpl_image*)));
+<a name="l01090"></a>01090 KMO_TRY_EXIT_IF_NULL(
+<a name="l01091"></a>01091 stored_noise_images = (cpl_image**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
+<a name="l01092"></a>01092 <span class="keyword">sizeof</span>(cpl_image*)));
+<a name="l01093"></a>01093 KMO_TRY_EXIT_IF_NULL(
+<a name="l01094"></a>01094 stored_sub_data_headers = (cpl_propertylist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
+<a name="l01095"></a>01095 <span class="keyword">sizeof</span>(cpl_propertylist*)));
+<a name="l01096"></a>01096 KMO_TRY_EXIT_IF_NULL(
+<a name="l01097"></a>01097 stored_sub_noise_headers = (cpl_propertylist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
+<a name="l01098"></a>01098 <span class="keyword">sizeof</span>(cpl_propertylist*)));
+<a name="l01099"></a>01099 KMO_TRY_EXIT_IF_NULL(
+<a name="l01100"></a>01100 edge_table_sky = (cpl_table***)cpl_calloc(KMOS_NR_DETECTORS,
+<a name="l01101"></a>01101 <span class="keyword">sizeof</span>(cpl_table**)));
+<a name="l01102"></a>01102 KMO_TRY_EXIT_IF_NULL(
+<a name="l01103"></a>01103 edge_table_flat = (cpl_table**)cpl_calloc(KMOS_IFUS_PER_DETECTOR,
+<a name="l01104"></a>01104 <span class="keyword">sizeof</span>(cpl_table*)));
+<a name="l01105"></a>01105 KMO_TRY_EXIT_IF_NULL(
+<a name="l01106"></a>01106 calAngles = cpl_vector_new(3));
+<a name="l01107"></a>01107
<a name="l01108"></a>01108 <span class="comment">//</span>
-<a name="l01109"></a>01109 <span class="keywordflow">for</span> (det_nr = 1; det_nr <= nr_devices; det_nr++) {
-<a name="l01110"></a>01110 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Processing detector No. %d"</span>, det_nr);
-<a name="l01111"></a>01111
-<a name="l01112"></a>01112 KMO_TRY_EXIT_IF_NULL(
-<a name="l01113"></a>01113 detector_in = cpl_imagelist_new());
-<a name="l01114"></a>01114
-<a name="l01115"></a>01115 <span class="comment">// load data of det_nr of all FLAT_SKY frames into an imagelist</span>
-<a name="l01116"></a>01116 KMO_TRY_EXIT_IF_NULL(
-<a name="l01117"></a>01117 img_in = kmo_dfs_load_image(frameset_sky, FLAT_SKY, det_nr, FALSE, TRUE, NULL));
-<a name="l01118"></a>01118
-<a name="l01119"></a>01119 cnt = 0;
-<a name="l01120"></a>01120 <span class="keywordflow">while</span> (img_in != NULL) {
-<a name="l01121"></a>01121 cpl_imagelist_set(detector_in, img_in, cnt);
-<a name="l01122"></a>01122 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01123"></a>01123
-<a name="l01124"></a>01124 <span class="comment">/* load same extension of next FLAT_SKY frame*/</span>
-<a name="l01125"></a>01125 img_in = kmo_dfs_load_image(frameset_sky, NULL, det_nr, FALSE, TRUE, NULL);
-<a name="l01126"></a>01126 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01127"></a>01127
-<a name="l01128"></a>01128 cnt++;
-<a name="l01129"></a>01129 }
-<a name="l01130"></a>01130
-<a name="l01131"></a>01131 <span class="comment">//</span>
-<a name="l01132"></a>01132 <span class="comment">// process imagelist</span>
+<a name="l01109"></a>01109 <span class="comment">// loop through all detectors</span>
+<a name="l01110"></a>01110 <span class="comment">//</span>
+<a name="l01111"></a>01111 <span class="keywordflow">for</span> (det_nr = 1; det_nr <= nr_devices; det_nr++) {
+<a name="l01112"></a>01112 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Processing detector No. %d"</span>, det_nr);
+<a name="l01113"></a>01113
+<a name="l01114"></a>01114 KMO_TRY_EXIT_IF_NULL(
+<a name="l01115"></a>01115 detector_in = cpl_imagelist_new());
+<a name="l01116"></a>01116
+<a name="l01117"></a>01117 <span class="comment">// load data of det_nr of all FLAT_SKY frames into an imagelist</span>
+<a name="l01118"></a>01118 KMO_TRY_EXIT_IF_NULL(
+<a name="l01119"></a>01119 img_in = kmo_dfs_load_image(frameset_sky, FLAT_SKY, det_nr, FALSE, TRUE, NULL));
+<a name="l01120"></a>01120
+<a name="l01121"></a>01121 cnt = 0;
+<a name="l01122"></a>01122 <span class="keywordflow">while</span> (img_in != NULL) {
+<a name="l01123"></a>01123 cpl_imagelist_set(detector_in, img_in, cnt);
+<a name="l01124"></a>01124 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01125"></a>01125
+<a name="l01126"></a>01126 <span class="comment">/* load same extension of next FLAT_SKY frame*/</span>
+<a name="l01127"></a>01127 img_in = kmo_dfs_load_image(frameset_sky, NULL, det_nr, FALSE, TRUE, NULL);
+<a name="l01128"></a>01128 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01129"></a>01129
+<a name="l01130"></a>01130 cnt++;
+<a name="l01131"></a>01131 }
+<a name="l01132"></a>01132
<a name="l01133"></a>01133 <span class="comment">//</span>
-<a name="l01134"></a>01134
-<a name="l01135"></a>01135 <span class="comment">// combine imagelist (data only) and create noise (stdev of data)</span>
-<a name="l01136"></a>01136 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Combining frames..."</span>);
-<a name="l01137"></a>01137 <span class="keywordflow">if</span> (process_noise) {
-<a name="l01138"></a>01138 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01139"></a>01139 kmclipm_combine_frames(detector_in,
-<a name="l01140"></a>01140 NULL,
-<a name="l01141"></a>01141 NULL,
-<a name="l01142"></a>01142 cmethod,
-<a name="l01143"></a>01143 cpos_rej,
-<a name="l01144"></a>01144 cneg_rej,
-<a name="l01145"></a>01145 citer,
-<a name="l01146"></a>01146 cmax,
-<a name="l01147"></a>01147 cmin,
-<a name="l01148"></a>01148 &combined_data,
-<a name="l01149"></a>01149 &combined_noise,
-<a name="l01150"></a>01150 -1.0));
-<a name="l01151"></a>01151 } <span class="keywordflow">else</span> {
-<a name="l01152"></a>01152 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01153"></a>01153 kmclipm_combine_frames(detector_in,
-<a name="l01154"></a>01154 NULL,
-<a name="l01155"></a>01155 NULL,
-<a name="l01156"></a>01156 cmethod,
-<a name="l01157"></a>01157 cpos_rej,
-<a name="l01158"></a>01158 cneg_rej,
-<a name="l01159"></a>01159 citer,
-<a name="l01160"></a>01160 cmax,
-<a name="l01161"></a>01161 cmin,
-<a name="l01162"></a>01162 &combined_data,
-<a name="l01163"></a>01163 NULL,
-<a name="l01164"></a>01164 -1.0));
-<a name="l01165"></a>01165 }
-<a name="l01166"></a>01166
-<a name="l01167"></a>01167 <span class="keywordflow">if</span> (kmclipm_omit_warning_one_slice > 10) {
-<a name="l01168"></a>01168 <span class="comment">// AA: commmented this out: Too unclear for the user, no benefit to know about this number</span>
-<a name="l01169"></a>01169 <span class="comment">// cpl_msg_warning(cpl_func, "Previous warning (number of "</span>
-<a name="l01170"></a>01170 <span class="comment">// "identified slices) occured %d times.",</span>
-<a name="l01171"></a>01171 <span class="comment">// kmclipm_omit_warning_one_slice);</span>
-<a name="l01172"></a>01172 kmclipm_omit_warning_one_slice = FALSE;
-<a name="l01173"></a>01173 }
-<a name="l01174"></a>01174
-<a name="l01175"></a>01175 cpl_imagelist_delete(detector_in); detector_in = NULL;
+<a name="l01134"></a>01134 <span class="comment">// process imagelist</span>
+<a name="l01135"></a>01135 <span class="comment">//</span>
+<a name="l01136"></a>01136
+<a name="l01137"></a>01137 <span class="comment">// combine imagelist (data only) and create noise (stdev of data)</span>
+<a name="l01138"></a>01138 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Combining frames..."</span>);
+<a name="l01139"></a>01139 <span class="keywordflow">if</span> (process_noise) {
+<a name="l01140"></a>01140 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01141"></a>01141 kmclipm_combine_frames(detector_in,
+<a name="l01142"></a>01142 NULL,
+<a name="l01143"></a>01143 NULL,
+<a name="l01144"></a>01144 cmethod,
+<a name="l01145"></a>01145 cpos_rej,
+<a name="l01146"></a>01146 cneg_rej,
+<a name="l01147"></a>01147 citer,
+<a name="l01148"></a>01148 cmax,
+<a name="l01149"></a>01149 cmin,
+<a name="l01150"></a>01150 &combined_data,
+<a name="l01151"></a>01151 &combined_noise,
+<a name="l01152"></a>01152 -1.0));
+<a name="l01153"></a>01153 } <span class="keywordflow">else</span> {
+<a name="l01154"></a>01154 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01155"></a>01155 kmclipm_combine_frames(detector_in,
+<a name="l01156"></a>01156 NULL,
+<a name="l01157"></a>01157 NULL,
+<a name="l01158"></a>01158 cmethod,
+<a name="l01159"></a>01159 cpos_rej,
+<a name="l01160"></a>01160 cneg_rej,
+<a name="l01161"></a>01161 citer,
+<a name="l01162"></a>01162 cmax,
+<a name="l01163"></a>01163 cmin,
+<a name="l01164"></a>01164 &combined_data,
+<a name="l01165"></a>01165 NULL,
+<a name="l01166"></a>01166 -1.0));
+<a name="l01167"></a>01167 }
+<a name="l01168"></a>01168
+<a name="l01169"></a>01169 <span class="keywordflow">if</span> (kmclipm_omit_warning_one_slice > 10) {
+<a name="l01170"></a>01170 <span class="comment">// AA: commmented this out: Too unclear for the user, no benefit to know about this number</span>
+<a name="l01171"></a>01171 <span class="comment">// cpl_msg_warning(cpl_func, "Previous warning (number of "</span>
+<a name="l01172"></a>01172 <span class="comment">// "identified slices) occured %d times.",</span>
+<a name="l01173"></a>01173 <span class="comment">// kmclipm_omit_warning_one_slice);</span>
+<a name="l01174"></a>01174 kmclipm_omit_warning_one_slice = FALSE;
+<a name="l01175"></a>01175 }
<a name="l01176"></a>01176
-<a name="l01177"></a>01177 <span class="comment">// load calibration files</span>
-<a name="l01178"></a>01178 KMO_TRY_EXIT_IF_NULL(
-<a name="l01179"></a>01179 xcal = kmo_dfs_load_cal_image(frameset, XCAL, det_nr, FALSE, rotangle,
-<a name="l01180"></a>01180 FALSE, NULL, &rotangle_found, -1, 0, 0));
-<a name="l01181"></a>01181
-<a name="l01182"></a>01182 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01183"></a>01183 cpl_vector_set(calAngles, 0, rotangle_found));
-<a name="l01184"></a>01184 KMO_TRY_EXIT_IF_NULL(
-<a name="l01185"></a>01185 ycal = kmo_dfs_load_cal_image(frameset, YCAL, det_nr, FALSE, rotangle,
-<a name="l01186"></a>01186 FALSE, NULL, &rotangle_found, -1, 0, 0));
-<a name="l01187"></a>01187 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01188"></a>01188 cpl_vector_set(calAngles, 1, rotangle_found));
-<a name="l01189"></a>01189 KMO_TRY_EXIT_IF_NULL(
-<a name="l01190"></a>01190 lcal = kmo_dfs_load_cal_image(frameset, LCAL, det_nr, FALSE, rotangle,
-<a name="l01191"></a>01191 FALSE, NULL, &rotangle_found, -1, 0, 0));
-<a name="l01192"></a>01192 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01193"></a>01193 cpl_vector_set(calAngles, 2, rotangle_found));
-<a name="l01194"></a>01194
-<a name="l01195"></a>01195 <span class="comment">// load bad pixel mask from XCAL and set NaNs to 0 and all other values to 1</span>
-<a name="l01196"></a>01196 KMO_TRY_EXIT_IF_NULL(
-<a name="l01197"></a>01197 bad_pix_mask = cpl_image_duplicate(xcal));
-<a name="l01198"></a>01198
-<a name="l01199"></a>01199 KMO_TRY_EXIT_IF_NULL(
-<a name="l01200"></a>01200 pbad_pix_mask = cpl_image_get_data_float(bad_pix_mask));
-<a name="l01201"></a>01201 <span class="keywordflow">for</span> (x = 0; x < nx; x++) {
-<a name="l01202"></a>01202 <span class="keywordflow">for</span> (y = 0; y < ny; y++) {
-<a name="l01203"></a>01203 <span class="keywordflow">if</span> (isnan(pbad_pix_mask[x+nx*y])) {
-<a name="l01204"></a>01204 pbad_pix_mask[x+nx*y] = 0.;
-<a name="l01205"></a>01205 } <span class="keywordflow">else</span> {
-<a name="l01206"></a>01206 pbad_pix_mask[x+nx*y] = 1.;
-<a name="l01207"></a>01207 }
-<a name="l01208"></a>01208 }
-<a name="l01209"></a>01209 }
-<a name="l01210"></a>01210 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01211"></a>01211
-<a name="l01212"></a>01212 <span class="comment">//</span>
-<a name="l01213"></a>01213 <span class="comment">// calculate SKYFLAT_EDGE</span>
+<a name="l01177"></a>01177 cpl_imagelist_delete(detector_in); detector_in = NULL;
+<a name="l01178"></a>01178
+<a name="l01179"></a>01179 <span class="comment">// load calibration files</span>
+<a name="l01180"></a>01180 KMO_TRY_EXIT_IF_NULL(
+<a name="l01181"></a>01181 xcal = kmo_dfs_load_cal_image(frameset, XCAL, det_nr, FALSE, rotangle,
+<a name="l01182"></a>01182 FALSE, NULL, &rotangle_found, -1, 0, 0));
+<a name="l01183"></a>01183
+<a name="l01184"></a>01184 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01185"></a>01185 cpl_vector_set(calAngles, 0, rotangle_found));
+<a name="l01186"></a>01186 KMO_TRY_EXIT_IF_NULL(
+<a name="l01187"></a>01187 ycal = kmo_dfs_load_cal_image(frameset, YCAL, det_nr, FALSE, rotangle,
+<a name="l01188"></a>01188 FALSE, NULL, &rotangle_found, -1, 0, 0));
+<a name="l01189"></a>01189 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01190"></a>01190 cpl_vector_set(calAngles, 1, rotangle_found));
+<a name="l01191"></a>01191 KMO_TRY_EXIT_IF_NULL(
+<a name="l01192"></a>01192 lcal = kmo_dfs_load_cal_image(frameset, LCAL, det_nr, FALSE, rotangle,
+<a name="l01193"></a>01193 FALSE, NULL, &rotangle_found, -1, 0, 0));
+<a name="l01194"></a>01194 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01195"></a>01195 cpl_vector_set(calAngles, 2, rotangle_found));
+<a name="l01196"></a>01196
+<a name="l01197"></a>01197 <span class="comment">// load bad pixel mask from XCAL and set NaNs to 0 and all other values to 1</span>
+<a name="l01198"></a>01198 KMO_TRY_EXIT_IF_NULL(
+<a name="l01199"></a>01199 bad_pix_mask = cpl_image_duplicate(xcal));
+<a name="l01200"></a>01200
+<a name="l01201"></a>01201 KMO_TRY_EXIT_IF_NULL(
+<a name="l01202"></a>01202 pbad_pix_mask = cpl_image_get_data_float(bad_pix_mask));
+<a name="l01203"></a>01203 <span class="keywordflow">for</span> (x = 0; x < nx; x++) {
+<a name="l01204"></a>01204 <span class="keywordflow">for</span> (y = 0; y < ny; y++) {
+<a name="l01205"></a>01205 <span class="keywordflow">if</span> (isnan(pbad_pix_mask[x+nx*y])) {
+<a name="l01206"></a>01206 pbad_pix_mask[x+nx*y] = 0.;
+<a name="l01207"></a>01207 } <span class="keywordflow">else</span> {
+<a name="l01208"></a>01208 pbad_pix_mask[x+nx*y] = 1.;
+<a name="l01209"></a>01209 }
+<a name="l01210"></a>01210 }
+<a name="l01211"></a>01211 }
+<a name="l01212"></a>01212 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01213"></a>01213
<a name="l01214"></a>01214 <span class="comment">//</span>
-<a name="l01215"></a>01215 <span class="keywordflow">if</span> (has_flat_edge) {
-<a name="l01216"></a>01216 <span class="comment">// get edge-edgepars from FLAT_SKY</span>
-<a name="l01217"></a>01217 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01218"></a>01218 kmo_calc_edgepars(combined_data,
-<a name="l01219"></a>01219 unused_ifus_after[det_nr-1],
-<a name="l01220"></a>01220 bad_pix_mask,
-<a name="l01221"></a>01221 det_nr,
-<a name="l01222"></a>01222 &slitlet_ids,
-<a name="l01223"></a>01223 &edgepars));
-<a name="l01224"></a>01224 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01225"></a>01225
-<a name="l01226"></a>01226 <span class="comment">// copy edgepars to table for saving later on</span>
-<a name="l01227"></a>01227 KMO_TRY_EXIT_IF_NULL(
-<a name="l01228"></a>01228 edge_table_sky[det_nr-1] = kmo_edgepars_to_table(slitlet_ids, edgepars));
-<a name="l01229"></a>01229
-<a name="l01230"></a>01230 <span class="keywordflow">if</span> (edgepars != NULL) {
-<a name="l01231"></a>01231 <span class="keywordflow">for</span> (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
-<a name="l01232"></a>01232 cpl_matrix_delete(edgepars[i]); edgepars[i] = NULL;
-<a name="l01233"></a>01233 }
-<a name="l01234"></a>01234 cpl_free(edgepars); edgepars = NULL;
-<a name="l01235"></a>01235 }
-<a name="l01236"></a>01236 <span class="keywordflow">if</span> (slitlet_ids != NULL) {
-<a name="l01237"></a>01237 <span class="keywordflow">for</span> (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
-<a name="l01238"></a>01238 cpl_vector_delete(slitlet_ids[i]); slitlet_ids[i] = NULL;
-<a name="l01239"></a>01239 }
-<a name="l01240"></a>01240 cpl_free(slitlet_ids); slitlet_ids = NULL;
-<a name="l01241"></a>01241 }
-<a name="l01242"></a>01242 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01243"></a>01243
-<a name="l01244"></a>01244 <span class="comment">//</span>
-<a name="l01245"></a>01245 <span class="comment">// correlate FLAT_EDGE and SKYFLAT_EDGE</span>
+<a name="l01215"></a>01215 <span class="comment">// calculate SKYFLAT_EDGE</span>
+<a name="l01216"></a>01216 <span class="comment">//</span>
+<a name="l01217"></a>01217 <span class="keywordflow">if</span> (has_flat_edge) {
+<a name="l01218"></a>01218 <span class="comment">// get edge-edgepars from FLAT_SKY</span>
+<a name="l01219"></a>01219 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01220"></a>01220 kmo_calc_edgepars(combined_data,
+<a name="l01221"></a>01221 unused_ifus_after[det_nr-1],
+<a name="l01222"></a>01222 bad_pix_mask,
+<a name="l01223"></a>01223 det_nr,
+<a name="l01224"></a>01224 &slitlet_ids,
+<a name="l01225"></a>01225 &edgepars));
+<a name="l01226"></a>01226 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01227"></a>01227
+<a name="l01228"></a>01228 <span class="comment">// copy edgepars to table for saving later on</span>
+<a name="l01229"></a>01229 KMO_TRY_EXIT_IF_NULL(
+<a name="l01230"></a>01230 edge_table_sky[det_nr-1] = kmo_edgepars_to_table(slitlet_ids, edgepars));
+<a name="l01231"></a>01231
+<a name="l01232"></a>01232 <span class="keywordflow">if</span> (edgepars != NULL) {
+<a name="l01233"></a>01233 <span class="keywordflow">for</span> (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01234"></a>01234 cpl_matrix_delete(edgepars[i]); edgepars[i] = NULL;
+<a name="l01235"></a>01235 }
+<a name="l01236"></a>01236 cpl_free(edgepars); edgepars = NULL;
+<a name="l01237"></a>01237 }
+<a name="l01238"></a>01238 <span class="keywordflow">if</span> (slitlet_ids != NULL) {
+<a name="l01239"></a>01239 <span class="keywordflow">for</span> (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01240"></a>01240 cpl_vector_delete(slitlet_ids[i]); slitlet_ids[i] = NULL;
+<a name="l01241"></a>01241 }
+<a name="l01242"></a>01242 cpl_free(slitlet_ids); slitlet_ids = NULL;
+<a name="l01243"></a>01243 }
+<a name="l01244"></a>01244 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01245"></a>01245
<a name="l01246"></a>01246 <span class="comment">//</span>
-<a name="l01247"></a>01247
-<a name="l01248"></a>01248 <span class="comment">// load flat_edge from MASTER_FLAT</span>
-<a name="l01249"></a>01249 KMO_TRY_EXIT_IF_NULL(
-<a name="l01250"></a>01250 frame = kmo_dfs_get_frame(frameset, FLAT_EDGE));
-<a name="l01251"></a>01251 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
-<a name="l01252"></a>01252 ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
-<a name="l01253"></a>01253
-<a name="l01254"></a>01254 KMO_TRY_EXIT_IF_NULL(
-<a name="l01255"></a>01255 punused_ifus = cpl_array_get_data_int_const(unused_ifus_after[det_nr-1]));
-<a name="l01256"></a>01256 <span class="keywordflow">if</span> (punused_ifus[j] == 0) {
-<a name="l01257"></a>01257 KMO_TRY_EXIT_IF_NULL(
-<a name="l01258"></a>01258 edge_table_flat[j] = kmclipm_cal_table_load(cpl_frame_get_filename(frame),
-<a name="l01259"></a>01259 ifu_nr, rotangle, 0, &tmp_rotangle));
-<a name="l01260"></a>01260 }
-<a name="l01261"></a>01261 }
-<a name="l01262"></a>01262
-<a name="l01263"></a>01263 <span class="comment">//</span>
-<a name="l01264"></a>01264 <span class="comment">// calculate shift value</span>
+<a name="l01247"></a>01247 <span class="comment">// correlate FLAT_EDGE and SKYFLAT_EDGE</span>
+<a name="l01248"></a>01248 <span class="comment">//</span>
+<a name="l01249"></a>01249
+<a name="l01250"></a>01250 <span class="comment">// load flat_edge from MASTER_FLAT</span>
+<a name="l01251"></a>01251 KMO_TRY_EXIT_IF_NULL(
+<a name="l01252"></a>01252 frame = kmo_dfs_get_frame(frameset, FLAT_EDGE));
+<a name="l01253"></a>01253 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l01254"></a>01254 ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
+<a name="l01255"></a>01255
+<a name="l01256"></a>01256 KMO_TRY_EXIT_IF_NULL(
+<a name="l01257"></a>01257 punused_ifus = cpl_array_get_data_int_const(unused_ifus_after[det_nr-1]));
+<a name="l01258"></a>01258 <span class="keywordflow">if</span> (punused_ifus[j] == 0) {
+<a name="l01259"></a>01259 KMO_TRY_EXIT_IF_NULL(
+<a name="l01260"></a>01260 edge_table_flat[j] = kmclipm_cal_table_load(cpl_frame_get_filename(frame),
+<a name="l01261"></a>01261 ifu_nr, rotangle, 0, &tmp_rotangle));
+<a name="l01262"></a>01262 }
+<a name="l01263"></a>01263 }
+<a name="l01264"></a>01264
<a name="l01265"></a>01265 <span class="comment">//</span>
-<a name="l01266"></a>01266
-<a name="l01267"></a>01267 KMO_TRY_EXIT_IF_NULL(
-<a name="l01268"></a>01268 shift_vec = cpl_vector_new(KMOS_IFUS_PER_DETECTOR));
+<a name="l01266"></a>01266 <span class="comment">// calculate shift value</span>
+<a name="l01267"></a>01267 <span class="comment">//</span>
+<a name="l01268"></a>01268
<a name="l01269"></a>01269 KMO_TRY_EXIT_IF_NULL(
-<a name="l01270"></a>01270 edge_vec = cpl_vector_new(2*KMOS_SLITLET_X));
-<a name="l01271"></a>01271
-<a name="l01272"></a>01272 <span class="comment">// get shift values for each IFU by comparing all edge parameters,</span>
-<a name="l01273"></a>01273 <span class="comment">// rejecting and applying median</span>
-<a name="l01274"></a>01274 <span class="keywordtype">int</span> row = 1024; <span class="comment">// middle of frame</span>
-<a name="l01275"></a>01275 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
-<a name="l01276"></a>01276 ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
-<a name="l01277"></a>01277 <span class="keywordflow">for</span> (edgeNr = 0; edgeNr < 2*KMOS_SLITLET_X; edgeNr++) {
-<a name="l01278"></a>01278 <span class="keywordflow">if</span> (edge_table_flat[j] != NULL) {
-<a name="l01279"></a>01279 <span class="keywordtype">double</span> flatval = kmo_calc_fitted_slitlet_edge(edge_table_flat[j], edgeNr, row);
-<a name="l01280"></a>01280 <span class="keywordtype">double</span> skyval = kmo_calc_fitted_slitlet_edge(edge_table_sky[det_nr-1][j], edgeNr, row);
-<a name="l01281"></a>01281 cpl_vector_set(edge_vec, edgeNr, flatval-skyval);
-<a name="l01282"></a>01282 }
-<a name="l01283"></a>01283 }
-<a name="l01284"></a>01284
-<a name="l01285"></a>01285 <span class="comment">// reject deviating edge-differences</span>
-<a name="l01286"></a>01286 kmclipm_vector *kv = NULL;
-<a name="l01287"></a>01287 KMO_TRY_EXIT_IF_NULL(
-<a name="l01288"></a>01288 kv = kmclipm_vector_create(cpl_vector_duplicate(edge_vec)));
-<a name="l01289"></a>01289 kmclipm_reject_deviant(kv, 3, 3, NULL, NULL);
-<a name="l01290"></a>01290
-<a name="l01291"></a>01291 <span class="comment">// set shift value for each IFU</span>
-<a name="l01292"></a>01292 cpl_vector_set(shift_vec, j, kmclipm_vector_get_median(kv, KMCLIPM_ARITHMETIC));
-<a name="l01293"></a>01293 kmclipm_vector_delete(kv); kv = NULL;
-<a name="l01294"></a>01294 }
-<a name="l01295"></a>01295 cpl_vector_delete(edge_vec); edge_vec = NULL;
-<a name="l01296"></a>01296 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01297"></a>01297
-<a name="l01298"></a>01298 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
-<a name="l01299"></a>01299 cpl_table_delete(edge_table_flat[j]);
-<a name="l01300"></a>01300 edge_table_flat[j] = NULL;
-<a name="l01301"></a>01301 }
-<a name="l01302"></a>01302
-<a name="l01303"></a>01303 <span class="comment">// take median of all IFU-shift-values</span>
-<a name="l01304"></a>01304 <span class="keywordtype">double</span> shift_val = -cpl_vector_get_median(shift_vec);
-<a name="l01305"></a>01305 cpl_vector_delete(shift_vec); shift_vec = NULL;
-<a name="l01306"></a>01306
-<a name="l01307"></a>01307 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Shift detector %d by %g pixels."</span>, det_nr, shift_val);
+<a name="l01270"></a>01270 shift_vec = cpl_vector_new(KMOS_IFUS_PER_DETECTOR));
+<a name="l01271"></a>01271 KMO_TRY_EXIT_IF_NULL(
+<a name="l01272"></a>01272 edge_vec = cpl_vector_new(2*KMOS_SLITLET_X));
+<a name="l01273"></a>01273
+<a name="l01274"></a>01274 <span class="comment">// get shift values for each IFU by comparing all edge parameters,</span>
+<a name="l01275"></a>01275 <span class="comment">// rejecting and applying median</span>
+<a name="l01276"></a>01276 <span class="keywordtype">int</span> row = 1024; <span class="comment">// middle of frame</span>
+<a name="l01277"></a>01277 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l01278"></a>01278 ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
+<a name="l01279"></a>01279 <span class="keywordflow">for</span> (edgeNr = 0; edgeNr < 2*KMOS_SLITLET_X; edgeNr++) {
+<a name="l01280"></a>01280 <span class="keywordflow">if</span> (edge_table_flat[j] != NULL) {
+<a name="l01281"></a>01281 <span class="keywordtype">double</span> flatval = kmo_calc_fitted_slitlet_edge(edge_table_flat[j], edgeNr, row);
+<a name="l01282"></a>01282 <span class="keywordtype">double</span> skyval = kmo_calc_fitted_slitlet_edge(edge_table_sky[det_nr-1][j], edgeNr, row);
+<a name="l01283"></a>01283 cpl_vector_set(edge_vec, edgeNr, flatval-skyval);
+<a name="l01284"></a>01284 }
+<a name="l01285"></a>01285 }
+<a name="l01286"></a>01286
+<a name="l01287"></a>01287 <span class="comment">// reject deviating edge-differences</span>
+<a name="l01288"></a>01288 kmclipm_vector *kv = NULL;
+<a name="l01289"></a>01289 KMO_TRY_EXIT_IF_NULL(
+<a name="l01290"></a>01290 kv = kmclipm_vector_create(cpl_vector_duplicate(edge_vec)));
+<a name="l01291"></a>01291 kmclipm_reject_deviant(kv, 3, 3, NULL, NULL);
+<a name="l01292"></a>01292
+<a name="l01293"></a>01293 <span class="comment">// set shift value for each IFU</span>
+<a name="l01294"></a>01294 cpl_vector_set(shift_vec, j, kmclipm_vector_get_median(kv, KMCLIPM_ARITHMETIC));
+<a name="l01295"></a>01295 kmclipm_vector_delete(kv); kv = NULL;
+<a name="l01296"></a>01296 }
+<a name="l01297"></a>01297 cpl_vector_delete(edge_vec); edge_vec = NULL;
+<a name="l01298"></a>01298 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01299"></a>01299
+<a name="l01300"></a>01300 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l01301"></a>01301 cpl_table_delete(edge_table_flat[j]);
+<a name="l01302"></a>01302 edge_table_flat[j] = NULL;
+<a name="l01303"></a>01303 }
+<a name="l01304"></a>01304
+<a name="l01305"></a>01305 <span class="comment">// take median of all IFU-shift-values</span>
+<a name="l01306"></a>01306 <span class="keywordtype">double</span> shift_val = -cpl_vector_get_median(shift_vec);
+<a name="l01307"></a>01307 cpl_vector_delete(shift_vec); shift_vec = NULL;
<a name="l01308"></a>01308
-<a name="l01309"></a>01309 <span class="keywordtype">int</span> xdim = cpl_image_get_size_x(combined_data),
-<a name="l01310"></a>01310 ydim = cpl_image_get_size_y(combined_data);
-<a name="l01311"></a>01311 <span class="keywordtype">double</span> *array_in = cpl_calloc(xdim, <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>)),
-<a name="l01312"></a>01312 *array_out = NULL;
-<a name="l01313"></a>01313 <span class="keywordtype">float</span> *pcombined_data = cpl_image_get_data_float(combined_data),
-<a name="l01314"></a>01314 *pcombined_noise = NULL;
-<a name="l01315"></a>01315 <span class="comment">// float *tmpArray = cpl_calloc(xdim, sizeof(float));</span>
-<a name="l01316"></a>01316 <span class="keywordflow">if</span> (process_noise) {
-<a name="l01317"></a>01317 pcombined_noise = cpl_image_get_data_float(combined_noise);
-<a name="l01318"></a>01318 }
-<a name="l01319"></a>01319
-<a name="l01320"></a>01320 <span class="keywordflow">for</span> (iy = 0; iy < ydim; iy++) {
-<a name="l01321"></a>01321 <span class="comment">// cubic spline</span>
-<a name="l01322"></a>01322 <span class="keywordflow">for</span> (ix = 0; ix < xdim; ix++) {
-<a name="l01323"></a>01323 array_in[ix] = pcombined_data[ix+iy*xdim];
-<a name="l01324"></a>01324 }
-<a name="l01325"></a>01325 array_out = cubicspline_reg_reg(xdim, 0., 1., array_in,
-<a name="l01326"></a>01326 xdim, shift_val, 1.0,
-<a name="l01327"></a>01327 NATURAL);
-<a name="l01328"></a>01328 <span class="keywordflow">for</span> (ix = 0; ix < xdim; ix++) {
-<a name="l01329"></a>01329 pcombined_data[ix+iy*xdim] = array_out[ix];
-<a name="l01330"></a>01330 }
-<a name="l01331"></a>01331 cpl_free(array_out);
-<a name="l01332"></a>01332
-<a name="l01333"></a>01333 <span class="comment">// // linear</span>
-<a name="l01334"></a>01334 <span class="comment">// for (ix = 1; ix < xdim; ix++) {</span>
-<a name="l01335"></a>01335 <span class="comment">// tmpArray[ix-1] = (pcombined_data[ix+iy*xdim]-pcombined_data[(ix-1)+iy*xdim])*shift_val +</span>
-<a name="l01336"></a>01336 <span class="comment">// pcombined_data[(ix-1)+iy*xdim];</span>
-<a name="l01337"></a>01337 <span class="comment">// }</span>
-<a name="l01338"></a>01338 <span class="comment">// for (ix = 1; ix < xdim; ix++) {</span>
-<a name="l01339"></a>01339 <span class="comment">// pcombined_data[ix+iy*xdim] = tmpArray[ix];</span>
-<a name="l01340"></a>01340 <span class="comment">// }</span>
-<a name="l01341"></a>01341
-<a name="l01342"></a>01342 <span class="keywordflow">if</span> (process_noise) {
-<a name="l01343"></a>01343 <span class="comment">// cubic spline</span>
-<a name="l01344"></a>01344 <span class="keywordflow">for</span> (ix = 0; ix < xdim; ix++) {
-<a name="l01345"></a>01345 array_in[ix] = pcombined_noise[ix+iy*xdim];
-<a name="l01346"></a>01346 }
-<a name="l01347"></a>01347 array_out = cubicspline_reg_reg(xdim, 0., 1., array_in,
-<a name="l01348"></a>01348 xdim, shift_val, 1.0,
-<a name="l01349"></a>01349 NATURAL);
-<a name="l01350"></a>01350 <span class="keywordflow">for</span> (ix = 0; ix < xdim; ix++) {
-<a name="l01351"></a>01351 pcombined_noise[ix+iy*xdim] = array_out[ix];
-<a name="l01352"></a>01352 }
-<a name="l01353"></a>01353 cpl_free(array_out);
-<a name="l01354"></a>01354
-<a name="l01355"></a>01355 <span class="comment">// // linear</span>
-<a name="l01356"></a>01356 <span class="comment">// for (ix = 1; ix < xdim; ix++) {</span>
-<a name="l01357"></a>01357 <span class="comment">// tmpArray[ix-1] = (pcombined_noise[ix+iy*xdim]-pcombined_noise[(ix-1)+iy*xdim])*shift_val +</span>
-<a name="l01358"></a>01358 <span class="comment">// pcombined_noise[(ix-1)+iy*xdim];</span>
-<a name="l01359"></a>01359 <span class="comment">// }</span>
-<a name="l01360"></a>01360 <span class="comment">// for (ix = 1; ix < xdim; ix++) {</span>
-<a name="l01361"></a>01361 <span class="comment">// pcombined_noise[ix+iy*xdim] = tmpArray[ix];</span>
-<a name="l01362"></a>01362 <span class="comment">// }</span>
-<a name="l01363"></a>01363 }
-<a name="l01364"></a>01364 }
-<a name="l01365"></a>01365 cpl_free(array_in); array_in = NULL;
-<a name="l01366"></a>01366 }
-<a name="l01367"></a>01367 <span class="comment">//</span>
-<a name="l01368"></a>01368 <span class="comment">// reconstruct</span>
+<a name="l01309"></a>01309 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Shift detector %d by %g pixels."</span>, det_nr, shift_val);
+<a name="l01310"></a>01310
+<a name="l01311"></a>01311 <span class="keywordtype">int</span> xdim = cpl_image_get_size_x(combined_data),
+<a name="l01312"></a>01312 ydim = cpl_image_get_size_y(combined_data);
+<a name="l01313"></a>01313 <span class="keywordtype">double</span> *array_in = cpl_calloc(xdim, <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>)),
+<a name="l01314"></a>01314 *array_out = NULL;
+<a name="l01315"></a>01315 <span class="keywordtype">float</span> *pcombined_data = cpl_image_get_data_float(combined_data),
+<a name="l01316"></a>01316 *pcombined_noise = NULL;
+<a name="l01317"></a>01317 <span class="comment">// float *tmpArray = cpl_calloc(xdim, sizeof(float));</span>
+<a name="l01318"></a>01318 <span class="keywordflow">if</span> (process_noise) {
+<a name="l01319"></a>01319 pcombined_noise = cpl_image_get_data_float(combined_noise);
+<a name="l01320"></a>01320 }
+<a name="l01321"></a>01321
+<a name="l01322"></a>01322 <span class="keywordflow">for</span> (iy = 0; iy < ydim; iy++) {
+<a name="l01323"></a>01323 <span class="comment">// cubic spline</span>
+<a name="l01324"></a>01324 <span class="keywordflow">for</span> (ix = 0; ix < xdim; ix++) {
+<a name="l01325"></a>01325 array_in[ix] = pcombined_data[ix+iy*xdim];
+<a name="l01326"></a>01326 }
+<a name="l01327"></a>01327 array_out = cubicspline_reg_reg(xdim, 0., 1., array_in,
+<a name="l01328"></a>01328 xdim, shift_val, 1.0,
+<a name="l01329"></a>01329 NATURAL);
+<a name="l01330"></a>01330 <span class="keywordflow">for</span> (ix = 0; ix < xdim; ix++) {
+<a name="l01331"></a>01331 pcombined_data[ix+iy*xdim] = array_out[ix];
+<a name="l01332"></a>01332 }
+<a name="l01333"></a>01333 cpl_free(array_out);
+<a name="l01334"></a>01334
+<a name="l01335"></a>01335 <span class="comment">// // linear</span>
+<a name="l01336"></a>01336 <span class="comment">// for (ix = 1; ix < xdim; ix++) {</span>
+<a name="l01337"></a>01337 <span class="comment">// tmpArray[ix-1] = (pcombined_data[ix+iy*xdim]-pcombined_data[(ix-1)+iy*xdim])*shift_val +</span>
+<a name="l01338"></a>01338 <span class="comment">// pcombined_data[(ix-1)+iy*xdim];</span>
+<a name="l01339"></a>01339 <span class="comment">// }</span>
+<a name="l01340"></a>01340 <span class="comment">// for (ix = 1; ix < xdim; ix++) {</span>
+<a name="l01341"></a>01341 <span class="comment">// pcombined_data[ix+iy*xdim] = tmpArray[ix];</span>
+<a name="l01342"></a>01342 <span class="comment">// }</span>
+<a name="l01343"></a>01343
+<a name="l01344"></a>01344 <span class="keywordflow">if</span> (process_noise) {
+<a name="l01345"></a>01345 <span class="comment">// cubic spline</span>
+<a name="l01346"></a>01346 <span class="keywordflow">for</span> (ix = 0; ix < xdim; ix++) {
+<a name="l01347"></a>01347 array_in[ix] = pcombined_noise[ix+iy*xdim];
+<a name="l01348"></a>01348 }
+<a name="l01349"></a>01349 array_out = cubicspline_reg_reg(xdim, 0., 1., array_in,
+<a name="l01350"></a>01350 xdim, shift_val, 1.0,
+<a name="l01351"></a>01351 NATURAL);
+<a name="l01352"></a>01352 <span class="keywordflow">for</span> (ix = 0; ix < xdim; ix++) {
+<a name="l01353"></a>01353 pcombined_noise[ix+iy*xdim] = array_out[ix];
+<a name="l01354"></a>01354 }
+<a name="l01355"></a>01355 cpl_free(array_out);
+<a name="l01356"></a>01356
+<a name="l01357"></a>01357 <span class="comment">// // linear</span>
+<a name="l01358"></a>01358 <span class="comment">// for (ix = 1; ix < xdim; ix++) {</span>
+<a name="l01359"></a>01359 <span class="comment">// tmpArray[ix-1] = (pcombined_noise[ix+iy*xdim]-pcombined_noise[(ix-1)+iy*xdim])*shift_val +</span>
+<a name="l01360"></a>01360 <span class="comment">// pcombined_noise[(ix-1)+iy*xdim];</span>
+<a name="l01361"></a>01361 <span class="comment">// }</span>
+<a name="l01362"></a>01362 <span class="comment">// for (ix = 1; ix < xdim; ix++) {</span>
+<a name="l01363"></a>01363 <span class="comment">// pcombined_noise[ix+iy*xdim] = tmpArray[ix];</span>
+<a name="l01364"></a>01364 <span class="comment">// }</span>
+<a name="l01365"></a>01365 }
+<a name="l01366"></a>01366 }
+<a name="l01367"></a>01367 cpl_free(array_in); array_in = NULL;
+<a name="l01368"></a>01368 }
<a name="l01369"></a>01369 <span class="comment">//</span>
-<a name="l01370"></a>01370 <span class="comment">// load MASTER_DARK and MASTER_FLAT</span>
-<a name="l01371"></a>01371 KMO_TRY_EXIT_IF_NULL(
-<a name="l01372"></a>01372 img_dark = kmo_dfs_load_image(frameset, MASTER_DARK,
-<a name="l01373"></a>01373 det_nr, FALSE, FALSE, NULL));
-<a name="l01374"></a>01374
-<a name="l01375"></a>01375 <span class="keywordflow">if</span> (process_noise) {
-<a name="l01376"></a>01376 KMO_TRY_EXIT_IF_NULL(
-<a name="l01377"></a>01377 img_dark_noise = kmo_dfs_load_image(frameset, MASTER_DARK,
-<a name="l01378"></a>01378 det_nr, TRUE, FALSE, NULL));
-<a name="l01379"></a>01379 }
-<a name="l01380"></a>01380
-<a name="l01381"></a>01381 KMO_TRY_EXIT_IF_NULL(
-<a name="l01382"></a>01382 img_flat = kmo_dfs_load_cal_image(frameset, MASTER_FLAT, det_nr, FALSE,
-<a name="l01383"></a>01383 rotangle, FALSE, NULL,
-<a name="l01384"></a>01384 &rotangle_found, -1, 0, 0));
-<a name="l01385"></a>01385
-<a name="l01386"></a>01386 <span class="keywordflow">if</span> (process_noise) {
-<a name="l01387"></a>01387 KMO_TRY_EXIT_IF_NULL(
-<a name="l01388"></a>01388 img_flat_noise = kmo_dfs_load_cal_image(frameset, MASTER_FLAT, det_nr, TRUE,
-<a name="l01389"></a>01389 rotangle, FALSE, NULL,
-<a name="l01390"></a>01390 &rotangle_found, -1, 0, 0));
-<a name="l01391"></a>01391 }
-<a name="l01392"></a>01392
-<a name="l01393"></a>01393 <span class="keywordtype">char</span> *tmp_band_method = getenv(<span class="stringliteral">"KMO_BAND_METHOD"</span>);
-<a name="l01394"></a>01394 <span class="keywordtype">int</span> band_method = 0;
-<a name="l01395"></a>01395 <span class="keywordflow">if</span> (tmp_band_method != NULL) {
-<a name="l01396"></a>01396 band_method = atoi(tmp_band_method);
-<a name="l01397"></a>01397 }
-<a name="l01398"></a>01398
-<a name="l01399"></a>01399 <span class="comment">// ESO INS FILTi ID</span>
-<a name="l01400"></a>01400 KMO_TRY_EXIT_IF_NULL(
-<a name="l01401"></a>01401 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_FILTID_PREFIX, det_nr,
-<a name="l01402"></a>01402 IFU_FILTID_POSTFIX));
-<a name="l01403"></a>01403 KMO_TRY_EXIT_IF_NULL(
-<a name="l01404"></a>01404 filter_id = cpl_propertylist_get_string(main_header, keyword));
-<a name="l01405"></a>01405 cpl_free(keyword); keyword = NULL;
-<a name="l01406"></a>01406
-<a name="l01407"></a>01407 KMO_TRY_EXIT_IF_NULL(
-<a name="l01408"></a>01408 band_table = kmo_dfs_load_table(frameset, WAVE_BAND, 1, 0));
-<a name="l01409"></a>01409 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01410"></a>01410 kmclipm_setup_grid_band_lcal(&gd, lcal, filter_id, band_method,
-<a name="l01411"></a>01411 band_table));
-<a name="l01412"></a>01412 cpl_table_delete(band_table); band_table = NULL;
-<a name="l01413"></a>01413
-<a name="l01414"></a>01414 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Reconstructing cubes..."</span>);
-<a name="l01415"></a>01415 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
-<a name="l01416"></a>01416 <span class="comment">// update sub-header</span>
-<a name="l01417"></a>01417 ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
-<a name="l01418"></a>01418
-<a name="l01419"></a>01419 <span class="comment">// load raw image and sub-header</span>
-<a name="l01420"></a>01420 KMO_TRY_EXIT_IF_NULL(
-<a name="l01421"></a>01421 sub_header = kmo_dfs_load_sub_header(frameset_sky, FLAT_SKY,
-<a name="l01422"></a>01422 det_nr, FALSE));
-<a name="l01423"></a>01423
-<a name="l01424"></a>01424 KMO_TRY_EXIT_IF_NULL(
-<a name="l01425"></a>01425 punused_ifus = cpl_array_get_data_int_const(
-<a name="l01426"></a>01426 unused_ifus_after[det_nr-1]));
-<a name="l01427"></a>01427
-<a name="l01428"></a>01428 <span class="comment">// check if IFU is valid according to main header keywords &</span>
-<a name="l01429"></a>01429 <span class="comment">// calibration files</span>
-<a name="l01430"></a>01430 KMO_TRY_EXIT_IF_NULL(
-<a name="l01431"></a>01431 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_VALID_PREFIX, ifu_nr,
-<a name="l01432"></a>01432 IFU_VALID_POSTFIX));
-<a name="l01433"></a>01433 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01434"></a>01434 ranges_txt = cpl_propertylist_get_string(main_header, keyword);
-<a name="l01435"></a>01435 cpl_free(keyword); keyword = NULL;
-<a name="l01436"></a>01436
-<a name="l01437"></a>01437 <span class="keywordflow">if</span> ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) &&
-<a name="l01438"></a>01438 (bounds[2*(ifu_nr-1)] != -1) &&
-<a name="l01439"></a>01439 (bounds[2*(ifu_nr-1)+1] != -1) &&
-<a name="l01440"></a>01440 (punused_ifus[j] == 0))
-<a name="l01441"></a>01441 {
-<a name="l01442"></a>01442 <span class="comment">// IFU is valid</span>
-<a name="l01443"></a>01443 cpl_error_reset();
-<a name="l01444"></a>01444
-<a name="l01445"></a>01445 <span class="comment">// calculate WCS</span>
-<a name="l01446"></a>01446 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01447"></a>01447 kmo_calc_wcs_gd(main_header, sub_header, ifu_nr, gd));
-<a name="l01448"></a>01448
-<a name="l01449"></a>01449 <span class="comment">// reconstruct data</span>
-<a name="l01450"></a>01450 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01451"></a>01451 kmo_reconstruct_sci_image(ifu_nr,
-<a name="l01452"></a>01452 bounds[2*(ifu_nr-1)],
-<a name="l01453"></a>01453 bounds[2*(ifu_nr-1)+1],
-<a name="l01454"></a>01454 combined_data,
-<a name="l01455"></a>01455 combined_noise,
-<a name="l01456"></a>01456 img_dark,
-<a name="l01457"></a>01457 img_dark_noise,
-<a name="l01458"></a>01458 img_flat,
-<a name="l01459"></a>01459 img_flat_noise,
-<a name="l01460"></a>01460 xcal,
-<a name="l01461"></a>01461 ycal,
-<a name="l01462"></a>01462 lcal,
-<a name="l01463"></a>01463 &gd,
-<a name="l01464"></a>01464 calTimestamp,
-<a name="l01465"></a>01465 calAngles,
-<a name="l01466"></a>01466 fn_lut,
-<a name="l01467"></a>01467 &cube_data,
-<a name="l01468"></a>01468 &cube_noise,
-<a name="l01469"></a>01469 flux,
-<a name="l01470"></a>01470 background));
-<a name="l01471"></a>01471 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01472"></a>01472 } <span class="keywordflow">else</span> {
-<a name="l01473"></a>01473 <span class="comment">// IFU is invalid</span>
-<a name="l01474"></a>01474 cpl_error_reset();
-<a name="l01475"></a>01475 } <span class="comment">// if ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) ...</span>
-<a name="l01476"></a>01476
-<a name="l01477"></a>01477 <span class="comment">// save output</span>
-<a name="l01478"></a>01478 KMO_TRY_EXIT_IF_NULL(
-<a name="l01479"></a>01479 extname = kmo_extname_creator(ifu_frame, ifu_nr, EXT_DATA));
-<a name="l01480"></a>01480
-<a name="l01481"></a>01481 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01482"></a>01482 kmclipm_update_property_string(sub_header, EXTNAME,
-<a name="l01483"></a>01483 extname,
-<a name="l01484"></a>01484 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01370"></a>01370 <span class="comment">// reconstruct</span>
+<a name="l01371"></a>01371 <span class="comment">//</span>
+<a name="l01372"></a>01372 <span class="comment">// load MASTER_DARK and MASTER_FLAT</span>
+<a name="l01373"></a>01373 KMO_TRY_EXIT_IF_NULL(
+<a name="l01374"></a>01374 img_dark = kmo_dfs_load_image(frameset, MASTER_DARK,
+<a name="l01375"></a>01375 det_nr, FALSE, FALSE, NULL));
+<a name="l01376"></a>01376
+<a name="l01377"></a>01377 <span class="keywordflow">if</span> (process_noise) {
+<a name="l01378"></a>01378 KMO_TRY_EXIT_IF_NULL(
+<a name="l01379"></a>01379 img_dark_noise = kmo_dfs_load_image(frameset, MASTER_DARK,
+<a name="l01380"></a>01380 det_nr, TRUE, FALSE, NULL));
+<a name="l01381"></a>01381 }
+<a name="l01382"></a>01382
+<a name="l01383"></a>01383 KMO_TRY_EXIT_IF_NULL(
+<a name="l01384"></a>01384 img_flat = kmo_dfs_load_cal_image(frameset, MASTER_FLAT, det_nr, FALSE,
+<a name="l01385"></a>01385 rotangle, FALSE, NULL,
+<a name="l01386"></a>01386 &rotangle_found, -1, 0, 0));
+<a name="l01387"></a>01387
+<a name="l01388"></a>01388 <span class="keywordflow">if</span> (process_noise) {
+<a name="l01389"></a>01389 KMO_TRY_EXIT_IF_NULL(
+<a name="l01390"></a>01390 img_flat_noise = kmo_dfs_load_cal_image(frameset, MASTER_FLAT, det_nr, TRUE,
+<a name="l01391"></a>01391 rotangle, FALSE, NULL,
+<a name="l01392"></a>01392 &rotangle_found, -1, 0, 0));
+<a name="l01393"></a>01393 }
+<a name="l01394"></a>01394
+<a name="l01395"></a>01395 <span class="keywordtype">char</span> *tmp_band_method = getenv(<span class="stringliteral">"KMO_BAND_METHOD"</span>);
+<a name="l01396"></a>01396 <span class="keywordtype">int</span> band_method = 0;
+<a name="l01397"></a>01397 <span class="keywordflow">if</span> (tmp_band_method != NULL) {
+<a name="l01398"></a>01398 band_method = atoi(tmp_band_method);
+<a name="l01399"></a>01399 }
+<a name="l01400"></a>01400
+<a name="l01401"></a>01401 <span class="comment">// ESO INS FILTi ID</span>
+<a name="l01402"></a>01402 KMO_TRY_EXIT_IF_NULL(
+<a name="l01403"></a>01403 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_FILTID_PREFIX, det_nr,
+<a name="l01404"></a>01404 IFU_FILTID_POSTFIX));
+<a name="l01405"></a>01405 KMO_TRY_EXIT_IF_NULL(
+<a name="l01406"></a>01406 filter_id = cpl_propertylist_get_string(main_header, keyword));
+<a name="l01407"></a>01407 cpl_free(keyword); keyword = NULL;
+<a name="l01408"></a>01408
+<a name="l01409"></a>01409 KMO_TRY_EXIT_IF_NULL(
+<a name="l01410"></a>01410 band_table = kmo_dfs_load_table(frameset, WAVE_BAND, 1, 0));
+<a name="l01411"></a>01411 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01412"></a>01412 kmclipm_setup_grid_band_lcal(&gd, lcal, filter_id, band_method,
+<a name="l01413"></a>01413 band_table));
+<a name="l01414"></a>01414 cpl_table_delete(band_table); band_table = NULL;
+<a name="l01415"></a>01415
+<a name="l01416"></a>01416 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Reconstructing cubes..."</span>);
+<a name="l01417"></a>01417 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l01418"></a>01418 <span class="comment">// update sub-header</span>
+<a name="l01419"></a>01419 ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
+<a name="l01420"></a>01420
+<a name="l01421"></a>01421 <span class="comment">// load raw image and sub-header</span>
+<a name="l01422"></a>01422 KMO_TRY_EXIT_IF_NULL(
+<a name="l01423"></a>01423 sub_header = kmo_dfs_load_sub_header(frameset_sky, FLAT_SKY,
+<a name="l01424"></a>01424 det_nr, FALSE));
+<a name="l01425"></a>01425
+<a name="l01426"></a>01426 KMO_TRY_EXIT_IF_NULL(
+<a name="l01427"></a>01427 punused_ifus = cpl_array_get_data_int_const(
+<a name="l01428"></a>01428 unused_ifus_after[det_nr-1]));
+<a name="l01429"></a>01429
+<a name="l01430"></a>01430 <span class="comment">// check if IFU is valid according to main header keywords &</span>
+<a name="l01431"></a>01431 <span class="comment">// calibration files</span>
+<a name="l01432"></a>01432 KMO_TRY_EXIT_IF_NULL(
+<a name="l01433"></a>01433 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_VALID_PREFIX, ifu_nr,
+<a name="l01434"></a>01434 IFU_VALID_POSTFIX));
+<a name="l01435"></a>01435 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01436"></a>01436 ranges_txt = cpl_propertylist_get_string(main_header, keyword);
+<a name="l01437"></a>01437 cpl_free(keyword); keyword = NULL;
+<a name="l01438"></a>01438
+<a name="l01439"></a>01439 <span class="keywordflow">if</span> ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) &&
+<a name="l01440"></a>01440 (bounds[2*(ifu_nr-1)] != -1) &&
+<a name="l01441"></a>01441 (bounds[2*(ifu_nr-1)+1] != -1) &&
+<a name="l01442"></a>01442 (punused_ifus[j] == 0))
+<a name="l01443"></a>01443 {
+<a name="l01444"></a>01444 <span class="comment">// IFU is valid</span>
+<a name="l01445"></a>01445 cpl_error_reset();
+<a name="l01446"></a>01446
+<a name="l01447"></a>01447 <span class="comment">// calculate WCS</span>
+<a name="l01448"></a>01448 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01449"></a>01449 kmo_calc_wcs_gd(main_header, sub_header, ifu_nr, gd));
+<a name="l01450"></a>01450
+<a name="l01451"></a>01451 <span class="comment">// reconstruct data</span>
+<a name="l01452"></a>01452 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01453"></a>01453 kmo_reconstruct_sci_image(ifu_nr,
+<a name="l01454"></a>01454 bounds[2*(ifu_nr-1)],
+<a name="l01455"></a>01455 bounds[2*(ifu_nr-1)+1],
+<a name="l01456"></a>01456 combined_data,
+<a name="l01457"></a>01457 combined_noise,
+<a name="l01458"></a>01458 img_dark,
+<a name="l01459"></a>01459 img_dark_noise,
+<a name="l01460"></a>01460 img_flat,
+<a name="l01461"></a>01461 img_flat_noise,
+<a name="l01462"></a>01462 xcal,
+<a name="l01463"></a>01463 ycal,
+<a name="l01464"></a>01464 lcal,
+<a name="l01465"></a>01465 &gd,
+<a name="l01466"></a>01466 calTimestamp,
+<a name="l01467"></a>01467 calAngles,
+<a name="l01468"></a>01468 fn_lut,
+<a name="l01469"></a>01469 &cube_data,
+<a name="l01470"></a>01470 &cube_noise,
+<a name="l01471"></a>01471 flux,
+<a name="l01472"></a>01472 background,
+<a name="l01473"></a>01473 NULL,
+<a name="l01474"></a>01474 NULL,
+<a name="l01475"></a>01475 NULL));
+<a name="l01476"></a>01476 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01477"></a>01477 } <span class="keywordflow">else</span> {
+<a name="l01478"></a>01478 <span class="comment">// IFU is invalid</span>
+<a name="l01479"></a>01479 cpl_error_reset();
+<a name="l01480"></a>01480 } <span class="comment">// if ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) ...</span>
+<a name="l01481"></a>01481
+<a name="l01482"></a>01482 <span class="comment">// save output</span>
+<a name="l01483"></a>01483 KMO_TRY_EXIT_IF_NULL(
+<a name="l01484"></a>01484 extname = kmo_extname_creator(ifu_frame, ifu_nr, EXT_DATA));
<a name="l01485"></a>01485
-<a name="l01486"></a>01486 cpl_free(extname); extname = NULL;
-<a name="l01487"></a>01487
-<a name="l01488"></a>01488 <span class="comment">// store cube and sub header into array for later</span>
-<a name="l01489"></a>01489 stored_data_cubes[ifu_nr - 1] = cube_data;
-<a name="l01490"></a>01490 stored_sub_data_headers[ifu_nr - 1] = sub_header;
-<a name="l01491"></a>01491
-<a name="l01492"></a>01492 <span class="keywordflow">if</span> (process_noise) {
-<a name="l01493"></a>01493 KMO_TRY_EXIT_IF_NULL(
-<a name="l01494"></a>01494 sub_header = cpl_propertylist_duplicate(
-<a name="l01495"></a>01495 stored_sub_data_headers[ifu_nr - 1]));
-<a name="l01496"></a>01496 KMO_TRY_EXIT_IF_NULL(
-<a name="l01497"></a>01497 extname = kmo_extname_creator(ifu_frame, ifu_nr,
-<a name="l01498"></a>01498 EXT_NOISE));
-<a name="l01499"></a>01499
-<a name="l01500"></a>01500 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01501"></a>01501 kmclipm_update_property_string(sub_header,
-<a name="l01502"></a>01502 EXTNAME,
-<a name="l01503"></a>01503 extname,
-<a name="l01504"></a>01504 <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01505"></a>01505
-<a name="l01506"></a>01506 cpl_free(extname); extname = NULL;
-<a name="l01507"></a>01507
-<a name="l01508"></a>01508 stored_noise_cubes[ifu_nr - 1] = cube_noise;
-<a name="l01509"></a>01509 stored_sub_noise_headers[ifu_nr - 1] = sub_header;
-<a name="l01510"></a>01510 }
-<a name="l01511"></a>01511 cpl_image_delete(data_ifu); data_ifu = NULL;
-<a name="l01512"></a>01512 cpl_image_delete(noise_ifu); noise_ifu = NULL;
-<a name="l01513"></a>01513 cube_data = NULL;
-<a name="l01514"></a>01514 cube_noise = NULL;
-<a name="l01515"></a>01515 } <span class="comment">// for j IFUs</span>
-<a name="l01516"></a>01516
-<a name="l01517"></a>01517 <span class="comment">// free memory</span>
-<a name="l01518"></a>01518 cpl_image_delete(combined_data); combined_data = NULL;
-<a name="l01519"></a>01519 cpl_image_delete(combined_noise); combined_noise = NULL;
-<a name="l01520"></a>01520 cpl_image_delete(xcal); xcal = NULL;
-<a name="l01521"></a>01521 cpl_image_delete(ycal); ycal = NULL;
-<a name="l01522"></a>01522 cpl_image_delete(lcal); lcal = NULL;
-<a name="l01523"></a>01523 cpl_image_delete(img_dark); img_dark = NULL;
-<a name="l01524"></a>01524 cpl_image_delete(img_flat); img_flat = NULL;
-<a name="l01525"></a>01525 cpl_image_delete(bad_pix_mask); bad_pix_mask = NULL;
-<a name="l01526"></a>01526 <span class="keywordflow">if</span> (process_noise) {
-<a name="l01527"></a>01527 cpl_image_delete(img_dark_noise); img_dark_noise = NULL;
-<a name="l01528"></a>01528 cpl_image_delete(img_flat_noise); img_flat_noise = NULL;
-<a name="l01529"></a>01529 }
-<a name="l01530"></a>01530 } <span class="comment">// for nr_devices</span>
-<a name="l01531"></a>01531
-<a name="l01532"></a>01532 cpl_free(edge_table_flat); edge_table_flat = NULL;
-<a name="l01533"></a>01533
-<a name="l01534"></a>01534 <span class="comment">// collapse cubes using rejection</span>
-<a name="l01535"></a>01535 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Collapsing cubes..."</span>);
-<a name="l01536"></a>01536 <span class="keywordflow">for</span> (det_nr = 1; det_nr <= nr_devices; det_nr++) {
-<a name="l01537"></a>01537 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
-<a name="l01538"></a>01538 ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
-<a name="l01539"></a>01539
-<a name="l01540"></a>01540 KMO_TRY_EXIT_IF_NULL(
-<a name="l01541"></a>01541 punused_ifus = cpl_array_get_data_int_const(
-<a name="l01542"></a>01542 unused_ifus_after[det_nr-1]));
-<a name="l01543"></a>01543 <span class="keywordflow">if</span> (punused_ifus[j] == 0) {
-<a name="l01544"></a>01544 <span class="keywordflow">if</span> (stored_sub_data_headers[ifu_nr-1] != NULL) {
-<a name="l01545"></a>01545 <span class="comment">// IFU is valid</span>
-<a name="l01546"></a>01546 ifu_crpix = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
-<a name="l01547"></a>01547 CRPIX3);
-<a name="l01548"></a>01548 KMO_TRY_CHECK_ERROR_STATE_MSG(
-<a name="l01549"></a>01549 <span class="stringliteral">"CRPIX3 keyword in FITS-header is missing!"</span>);
-<a name="l01550"></a>01550
-<a name="l01551"></a>01551 ifu_crval = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
-<a name="l01552"></a>01552 CRVAL3);
-<a name="l01553"></a>01553 KMO_TRY_CHECK_ERROR_STATE_MSG(
-<a name="l01554"></a>01554 <span class="stringliteral">"CRVAL3 keyword in FITS-header is missing!"</span>);
+<a name="l01486"></a>01486 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01487"></a>01487 kmclipm_update_property_string(sub_header, EXTNAME,
+<a name="l01488"></a>01488 extname,
+<a name="l01489"></a>01489 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01490"></a>01490
+<a name="l01491"></a>01491 cpl_free(extname); extname = NULL;
+<a name="l01492"></a>01492
+<a name="l01493"></a>01493 <span class="comment">// store cube and sub header into array for later</span>
+<a name="l01494"></a>01494 stored_data_cubes[ifu_nr - 1] = cube_data;
+<a name="l01495"></a>01495 stored_sub_data_headers[ifu_nr - 1] = sub_header;
+<a name="l01496"></a>01496
+<a name="l01497"></a>01497 <span class="keywordflow">if</span> (process_noise) {
+<a name="l01498"></a>01498 KMO_TRY_EXIT_IF_NULL(
+<a name="l01499"></a>01499 sub_header = cpl_propertylist_duplicate(
+<a name="l01500"></a>01500 stored_sub_data_headers[ifu_nr - 1]));
+<a name="l01501"></a>01501 KMO_TRY_EXIT_IF_NULL(
+<a name="l01502"></a>01502 extname = kmo_extname_creator(ifu_frame, ifu_nr,
+<a name="l01503"></a>01503 EXT_NOISE));
+<a name="l01504"></a>01504
+<a name="l01505"></a>01505 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01506"></a>01506 kmclipm_update_property_string(sub_header,
+<a name="l01507"></a>01507 EXTNAME,
+<a name="l01508"></a>01508 extname,
+<a name="l01509"></a>01509 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01510"></a>01510
+<a name="l01511"></a>01511 cpl_free(extname); extname = NULL;
+<a name="l01512"></a>01512
+<a name="l01513"></a>01513 stored_noise_cubes[ifu_nr - 1] = cube_noise;
+<a name="l01514"></a>01514 stored_sub_noise_headers[ifu_nr - 1] = sub_header;
+<a name="l01515"></a>01515 }
+<a name="l01516"></a>01516 cpl_image_delete(data_ifu); data_ifu = NULL;
+<a name="l01517"></a>01517 cpl_image_delete(noise_ifu); noise_ifu = NULL;
+<a name="l01518"></a>01518 cube_data = NULL;
+<a name="l01519"></a>01519 cube_noise = NULL;
+<a name="l01520"></a>01520 } <span class="comment">// for j IFUs</span>
+<a name="l01521"></a>01521
+<a name="l01522"></a>01522 <span class="comment">// free memory</span>
+<a name="l01523"></a>01523 cpl_image_delete(combined_data); combined_data = NULL;
+<a name="l01524"></a>01524 cpl_image_delete(combined_noise); combined_noise = NULL;
+<a name="l01525"></a>01525 cpl_image_delete(xcal); xcal = NULL;
+<a name="l01526"></a>01526 cpl_image_delete(ycal); ycal = NULL;
+<a name="l01527"></a>01527 cpl_image_delete(lcal); lcal = NULL;
+<a name="l01528"></a>01528 cpl_image_delete(img_dark); img_dark = NULL;
+<a name="l01529"></a>01529 cpl_image_delete(img_flat); img_flat = NULL;
+<a name="l01530"></a>01530 cpl_image_delete(bad_pix_mask); bad_pix_mask = NULL;
+<a name="l01531"></a>01531 <span class="keywordflow">if</span> (process_noise) {
+<a name="l01532"></a>01532 cpl_image_delete(img_dark_noise); img_dark_noise = NULL;
+<a name="l01533"></a>01533 cpl_image_delete(img_flat_noise); img_flat_noise = NULL;
+<a name="l01534"></a>01534 }
+<a name="l01535"></a>01535 } <span class="comment">// for nr_devices</span>
+<a name="l01536"></a>01536
+<a name="l01537"></a>01537 cpl_free(edge_table_flat); edge_table_flat = NULL;
+<a name="l01538"></a>01538
+<a name="l01539"></a>01539 <span class="comment">// collapse cubes using rejection</span>
+<a name="l01540"></a>01540 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Collapsing cubes..."</span>);
+<a name="l01541"></a>01541 <span class="keywordflow">for</span> (det_nr = 1; det_nr <= nr_devices; det_nr++) {
+<a name="l01542"></a>01542 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l01543"></a>01543 ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
+<a name="l01544"></a>01544
+<a name="l01545"></a>01545 KMO_TRY_EXIT_IF_NULL(
+<a name="l01546"></a>01546 punused_ifus = cpl_array_get_data_int_const(
+<a name="l01547"></a>01547 unused_ifus_after[det_nr-1]));
+<a name="l01548"></a>01548 <span class="keywordflow">if</span> (punused_ifus[j] == 0) {
+<a name="l01549"></a>01549 <span class="keywordflow">if</span> (stored_sub_data_headers[ifu_nr-1] != NULL) {
+<a name="l01550"></a>01550 <span class="comment">// IFU is valid</span>
+<a name="l01551"></a>01551 ifu_crpix = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
+<a name="l01552"></a>01552 CRPIX3);
+<a name="l01553"></a>01553 KMO_TRY_CHECK_ERROR_STATE_MSG(
+<a name="l01554"></a>01554 <span class="stringliteral">"CRPIX3 keyword in FITS-header is missing!"</span>);
<a name="l01555"></a>01555
-<a name="l01556"></a>01556 ifu_cdelt = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
-<a name="l01557"></a>01557 CDELT3);
-<a name="l01558"></a>01558 KMO_TRY_CHECK_ERROR_STATE_MSG(
-<a name="l01559"></a>01559 <span class="stringliteral">"CDELT3 keyword in FITS-header is missing!"</span>);
+<a name="l01556"></a>01556 ifu_crval = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
+<a name="l01557"></a>01557 CRVAL3);
+<a name="l01558"></a>01558 KMO_TRY_CHECK_ERROR_STATE_MSG(
+<a name="l01559"></a>01559 <span class="stringliteral">"CRVAL3 keyword in FITS-header is missing!"</span>);
<a name="l01560"></a>01560
-<a name="l01561"></a>01561 KMO_TRY_EXIT_IF_NULL(
-<a name="l01562"></a>01562 identified_slices = kmo_identify_slices(ranges,
-<a name="l01563"></a>01563 ifu_crpix,
-<a name="l01564"></a>01564 ifu_crval,
-<a name="l01565"></a>01565 ifu_cdelt,
-<a name="l01566"></a>01566 gd.l.dim));
-<a name="l01567"></a>01567 }<span class="comment">/* else {</span>
-<a name="l01568"></a>01568 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
-<a name="l01569"></a>01569 <span class="comment"> identified_slices = cpl_vector_new(gd.l.dim));</span>
-<a name="l01570"></a>01570 <span class="comment"> cpl_vector_fill(identified_slices, 1.);</span>
-<a name="l01571"></a>01571 <span class="comment"> }*/</span>
-<a name="l01572"></a>01572
-<a name="l01573"></a>01573 <span class="keywordflow">if</span> (stored_data_cubes[ifu_nr-1] != NULL) {
-<a name="l01574"></a>01574 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01575"></a>01575 kmclipm_make_image(stored_data_cubes[ifu_nr-1],
-<a name="l01576"></a>01576 stored_noise_cubes[ifu_nr-1],
-<a name="l01577"></a>01577 &stored_data_images[ifu_nr-1],
-<a name="l01578"></a>01578 &stored_noise_images[ifu_nr-1],
-<a name="l01579"></a>01579 identified_slices,
-<a name="l01580"></a>01580 cmethod, cpos_rej, cneg_rej,
-<a name="l01581"></a>01581 citer, cmax, cmin));
-<a name="l01582"></a>01582 }
-<a name="l01583"></a>01583 cpl_vector_delete(identified_slices); identified_slices = NULL;
-<a name="l01584"></a>01584 } <span class="keywordflow">else</span> {
-<a name="l01585"></a>01585 <span class="comment">// IFU is invalid</span>
-<a name="l01586"></a>01586 }
-<a name="l01587"></a>01587 }
-<a name="l01588"></a>01588 }
-<a name="l01589"></a>01589
-<a name="l01590"></a>01590 <span class="comment">// normalise all IFUs as a group.</span>
-<a name="l01591"></a>01591 <span class="comment">// Calculate mean of each IFU, add up and divide by number of successful</span>
-<a name="l01592"></a>01592 <span class="comment">// averaged IFUs.</span>
-<a name="l01593"></a>01593 <span class="comment">// Then divide all valid IFUs with mean value</span>
-<a name="l01594"></a>01594 cnt = 0;
-<a name="l01595"></a>01595 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
-<a name="l01596"></a>01596 <span class="keywordflow">if</span> (stored_data_images[i] != NULL) {
-<a name="l01597"></a>01597 KMO_TRY_ASSURE(cpl_image_count_rejected(stored_data_images[i]) <
-<a name="l01598"></a>01598 cpl_image_get_size_x(stored_data_images[i])*
-<a name="l01599"></a>01599 cpl_image_get_size_y(stored_data_images[i]),
-<a name="l01600"></a>01600 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01601"></a>01601 <span class="stringliteral">"The collapsed, dark-subtracted image contains "</span>
-<a name="l01602"></a>01602 <span class="stringliteral">"only invalid values! Probably the provided "</span>
-<a name="l01603"></a>01603 <span class="stringliteral">"FLAT_SKY frames are exactly the same as the "</span>
-<a name="l01604"></a>01604 <span class="stringliteral">"frames used for MASTER_DARK calculation."</span>);
-<a name="l01605"></a>01605
-<a name="l01606"></a>01606 mean_data += cpl_image_get_mean(stored_data_images[i]);
-<a name="l01607"></a>01607 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01608"></a>01608 cnt++;
-<a name="l01609"></a>01609 }
-<a name="l01610"></a>01610
-<a name="l01611"></a>01611 }
-<a name="l01612"></a>01612 mean_data /= cnt;
-<a name="l01613"></a>01613
-<a name="l01614"></a>01614 <span class="keywordflow">if</span> (mean_data != 0.0) {
-<a name="l01615"></a>01615 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
-<a name="l01616"></a>01616 <span class="keywordflow">if</span> (stored_data_images[i] != NULL) {
-<a name="l01617"></a>01617 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01618"></a>01618 cpl_image_divide_scalar(stored_data_images[i],
-<a name="l01619"></a>01619 mean_data));
-<a name="l01620"></a>01620 }
-<a name="l01621"></a>01621 }
-<a name="l01622"></a>01622 } <span class="keywordflow">else</span> {
-<a name="l01623"></a>01623 cpl_msg_warning(cpl_func, <span class="stringliteral">"Data couldn't be normalised "</span>
-<a name="l01624"></a>01624 <span class="stringliteral">"(mean = 0.0)!"</span>);
-<a name="l01625"></a>01625 }
-<a name="l01626"></a>01626
-<a name="l01627"></a>01627 <span class="keywordflow">if</span> (process_noise) {
-<a name="l01628"></a>01628 <span class="keywordflow">if</span> (mean_data != 0.0) {
-<a name="l01629"></a>01629 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
-<a name="l01630"></a>01630 <span class="keywordflow">if</span> (stored_noise_images[i] != NULL) {
-<a name="l01631"></a>01631 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01632"></a>01632 cpl_image_divide_scalar(stored_noise_images[i],
-<a name="l01633"></a>01633 mean_data));
-<a name="l01634"></a>01634 }
-<a name="l01635"></a>01635 }
-<a name="l01636"></a>01636 } <span class="keywordflow">else</span> {
-<a name="l01637"></a>01637 cpl_msg_warning(cpl_func, <span class="stringliteral">"Noise couldn't be normalised "</span>
-<a name="l01638"></a>01638 <span class="stringliteral">"(mean = 0.0)!"</span>);
-<a name="l01639"></a>01639 }
-<a name="l01640"></a>01640 }
-<a name="l01641"></a>01641
-<a name="l01642"></a>01642 <span class="comment">// calculate qc parameters on normalised data</span>
-<a name="l01643"></a>01643 qc_spat_unif = 0.0;
-<a name="l01644"></a>01644 cnt = 0;
-<a name="l01645"></a>01645 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
-<a name="l01646"></a>01646 <span class="keywordflow">if</span> (stored_data_images[i] != NULL) {
-<a name="l01647"></a>01647 tmp_mean = cpl_image_get_mean(stored_data_images[i]);
-<a name="l01648"></a>01648 tmp_stdev = cpl_image_get_stdev (stored_data_images[i]);
-<a name="l01649"></a>01649
-<a name="l01650"></a>01650 qc_spat_unif += pow(tmp_mean-1, 2);
-<a name="l01651"></a>01651 <span class="keywordflow">if</span> (fabs(tmp_mean) > qc_max_dev) {
-<a name="l01652"></a>01652 qc_max_dev = tmp_mean-1;
-<a name="l01653"></a>01653 qc_max_dev_id = i+1;
-<a name="l01654"></a>01654 }
-<a name="l01655"></a>01655 <span class="keywordflow">if</span> (fabs(tmp_stdev) > qc_max_nonunif) {
-<a name="l01656"></a>01656 qc_max_nonunif = tmp_stdev;
-<a name="l01657"></a>01657 qc_max_nonunif_id = i+1;
-<a name="l01658"></a>01658 }
-<a name="l01659"></a>01659 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01660"></a>01660 cnt++;
-<a name="l01661"></a>01661 }
-<a name="l01662"></a>01662 }
-<a name="l01663"></a>01663 qc_spat_unif = sqrt(qc_spat_unif / cnt);
-<a name="l01664"></a>01664
-<a name="l01665"></a>01665 <span class="comment">//</span>
-<a name="l01666"></a>01666 <span class="comment">// save data</span>
-<a name="l01667"></a>01667 <span class="comment">//</span>
-<a name="l01668"></a>01668
-<a name="l01669"></a>01669 <span class="comment">// update which IFUs are not used</span>
-<a name="l01670"></a>01670 kmo_print_unused_ifus(unused_ifus_after, TRUE);
-<a name="l01671"></a>01671
-<a name="l01672"></a>01672 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01673"></a>01673 kmo_set_unused_ifus(unused_ifus_after, main_header,
-<a name="l01674"></a>01674 <span class="stringliteral">"kmo_illumination"</span>));
-<a name="l01675"></a>01675
-<a name="l01676"></a>01676 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Saving data..."</span>);
-<a name="l01677"></a>01677
-<a name="l01678"></a>01678 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01679"></a>01679 kmclipm_update_property_double(main_header, QC_SPAT_UNIF, qc_spat_unif,
-<a name="l01680"></a>01680 <span class="stringliteral">"[adu] uniformity of illumination correction"</span>));
-<a name="l01681"></a>01681 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01682"></a>01682 kmclipm_update_property_double(main_header, QC_SPAT_MAX_DEV, qc_max_dev,
-<a name="l01683"></a>01683 <span class="stringliteral">"[adu] max. deviation from unity"</span>));
+<a name="l01561"></a>01561 ifu_cdelt = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
+<a name="l01562"></a>01562 CDELT3);
+<a name="l01563"></a>01563 KMO_TRY_CHECK_ERROR_STATE_MSG(
+<a name="l01564"></a>01564 <span class="stringliteral">"CDELT3 keyword in FITS-header is missing!"</span>);
+<a name="l01565"></a>01565
+<a name="l01566"></a>01566 KMO_TRY_EXIT_IF_NULL(
+<a name="l01567"></a>01567 identified_slices = kmo_identify_slices(ranges,
+<a name="l01568"></a>01568 ifu_crpix,
+<a name="l01569"></a>01569 ifu_crval,
+<a name="l01570"></a>01570 ifu_cdelt,
+<a name="l01571"></a>01571 gd.l.dim));
+<a name="l01572"></a>01572 }<span class="comment">/* else {</span>
+<a name="l01573"></a>01573 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
+<a name="l01574"></a>01574 <span class="comment"> identified_slices = cpl_vector_new(gd.l.dim));</span>
+<a name="l01575"></a>01575 <span class="comment"> cpl_vector_fill(identified_slices, 1.);</span>
+<a name="l01576"></a>01576 <span class="comment"> }*/</span>
+<a name="l01577"></a>01577
+<a name="l01578"></a>01578 <span class="keywordflow">if</span> (stored_data_cubes[ifu_nr-1] != NULL) {
+<a name="l01579"></a>01579 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01580"></a>01580 kmclipm_make_image(stored_data_cubes[ifu_nr-1],
+<a name="l01581"></a>01581 stored_noise_cubes[ifu_nr-1],
+<a name="l01582"></a>01582 &stored_data_images[ifu_nr-1],
+<a name="l01583"></a>01583 &stored_noise_images[ifu_nr-1],
+<a name="l01584"></a>01584 identified_slices,
+<a name="l01585"></a>01585 cmethod, cpos_rej, cneg_rej,
+<a name="l01586"></a>01586 citer, cmax, cmin));
+<a name="l01587"></a>01587 }
+<a name="l01588"></a>01588 cpl_vector_delete(identified_slices); identified_slices = NULL;
+<a name="l01589"></a>01589 } <span class="keywordflow">else</span> {
+<a name="l01590"></a>01590 <span class="comment">// IFU is invalid</span>
+<a name="l01591"></a>01591 }
+<a name="l01592"></a>01592 }
+<a name="l01593"></a>01593 }
+<a name="l01594"></a>01594
+<a name="l01595"></a>01595 <span class="comment">// normalise all IFUs of a detector as a group.</span>
+<a name="l01596"></a>01596 <span class="comment">// Calculate mean of each IFU, add up and divide by number of successful</span>
+<a name="l01597"></a>01597 <span class="comment">// averaged IFUs.</span>
+<a name="l01598"></a>01598 <span class="comment">// Then divide all valid IFUs with mean value</span>
+<a name="l01599"></a>01599 <span class="keywordtype">int</span> jj;
+<a name="l01600"></a>01600 <span class="keywordflow">for</span> (jj = 0; jj < nr_devices; jj++) {
+<a name="l01601"></a>01601 cnt = 0;
+<a name="l01602"></a>01602 mean_data = 0;
+<a name="l01603"></a>01603 <span class="keywordflow">for</span> (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01604"></a>01604 ifu_nr = jj*KMOS_IFUS_PER_DETECTOR + i;
+<a name="l01605"></a>01605 <span class="keywordflow">if</span> (stored_data_images[ifu_nr] != NULL) {
+<a name="l01606"></a>01606 KMO_TRY_ASSURE(cpl_image_count_rejected(stored_data_images[ifu_nr]) <
+<a name="l01607"></a>01607 cpl_image_get_size_x(stored_data_images[ifu_nr])*
+<a name="l01608"></a>01608 cpl_image_get_size_y(stored_data_images[ifu_nr]),
+<a name="l01609"></a>01609 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01610"></a>01610 <span class="stringliteral">"The collapsed, dark-subtracted image contains "</span>
+<a name="l01611"></a>01611 <span class="stringliteral">"only invalid values! Probably the provided "</span>
+<a name="l01612"></a>01612 <span class="stringliteral">"FLAT_SKY frames are exactly the same as the "</span>
+<a name="l01613"></a>01613 <span class="stringliteral">"frames used for MASTER_DARK calculation."</span>);
+<a name="l01614"></a>01614
+<a name="l01615"></a>01615 mean_data += cpl_image_get_mean(stored_data_images[ifu_nr]);
+<a name="l01616"></a>01616 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01617"></a>01617 cnt++;
+<a name="l01618"></a>01618 }
+<a name="l01619"></a>01619
+<a name="l01620"></a>01620 }
+<a name="l01621"></a>01621 mean_data /= cnt;
+<a name="l01622"></a>01622
+<a name="l01623"></a>01623 <span class="keywordflow">if</span> (mean_data != 0.0) {
+<a name="l01624"></a>01624 <span class="keywordflow">for</span> (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01625"></a>01625 ifu_nr = jj*KMOS_IFUS_PER_DETECTOR + i;
+<a name="l01626"></a>01626 <span class="keywordflow">if</span> (stored_data_images[ifu_nr] != NULL) {
+<a name="l01627"></a>01627 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01628"></a>01628 cpl_image_divide_scalar(stored_data_images[ifu_nr],
+<a name="l01629"></a>01629 mean_data));
+<a name="l01630"></a>01630 }
+<a name="l01631"></a>01631 }
+<a name="l01632"></a>01632 } <span class="keywordflow">else</span> {
+<a name="l01633"></a>01633 cpl_msg_warning(cpl_func, <span class="stringliteral">"Data couldn't be normalised "</span>
+<a name="l01634"></a>01634 <span class="stringliteral">"(mean = 0.0)!"</span>);
+<a name="l01635"></a>01635 }
+<a name="l01636"></a>01636
+<a name="l01637"></a>01637 <span class="keywordflow">if</span> (process_noise) {
+<a name="l01638"></a>01638 <span class="keywordflow">if</span> (mean_data != 0.0) {
+<a name="l01639"></a>01639 <span class="keywordflow">for</span> (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01640"></a>01640 ifu_nr = jj*KMOS_IFUS_PER_DETECTOR + i;
+<a name="l01641"></a>01641 <span class="keywordflow">if</span> (stored_noise_images[ifu_nr] != NULL) {
+<a name="l01642"></a>01642 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01643"></a>01643 cpl_image_divide_scalar(stored_noise_images[ifu_nr],
+<a name="l01644"></a>01644 mean_data));
+<a name="l01645"></a>01645 }
+<a name="l01646"></a>01646 }
+<a name="l01647"></a>01647 } <span class="keywordflow">else</span> {
+<a name="l01648"></a>01648 cpl_msg_warning(cpl_func, <span class="stringliteral">"Noise couldn't be normalised "</span>
+<a name="l01649"></a>01649 <span class="stringliteral">"(mean = 0.0)!"</span>);
+<a name="l01650"></a>01650 }
+<a name="l01651"></a>01651 }
+<a name="l01652"></a>01652 } <span class="comment">// end for(jj)</span>
+<a name="l01653"></a>01653
+<a name="l01654"></a>01654 <span class="comment">// calculate qc parameters on normalised data</span>
+<a name="l01655"></a>01655 qc_spat_unif = 0.0;
+<a name="l01656"></a>01656 cnt = 0;
+<a name="l01657"></a>01657 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01658"></a>01658 <span class="keywordflow">if</span> (stored_data_images[i] != NULL) {
+<a name="l01659"></a>01659 tmp_mean = cpl_image_get_mean(stored_data_images[i]);
+<a name="l01660"></a>01660 tmp_stdev = cpl_image_get_stdev (stored_data_images[i]);
+<a name="l01661"></a>01661
+<a name="l01662"></a>01662 qc_spat_unif += pow(tmp_mean-1, 2);
+<a name="l01663"></a>01663 <span class="keywordflow">if</span> (fabs(tmp_mean) > qc_max_dev) {
+<a name="l01664"></a>01664 qc_max_dev = tmp_mean-1;
+<a name="l01665"></a>01665 qc_max_dev_id = i+1;
+<a name="l01666"></a>01666 }
+<a name="l01667"></a>01667 <span class="keywordflow">if</span> (fabs(tmp_stdev) > qc_max_nonunif) {
+<a name="l01668"></a>01668 qc_max_nonunif = tmp_stdev;
+<a name="l01669"></a>01669 qc_max_nonunif_id = i+1;
+<a name="l01670"></a>01670 }
+<a name="l01671"></a>01671 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01672"></a>01672 cnt++;
+<a name="l01673"></a>01673 }
+<a name="l01674"></a>01674 }
+<a name="l01675"></a>01675 qc_spat_unif = sqrt(qc_spat_unif / cnt);
+<a name="l01676"></a>01676
+<a name="l01677"></a>01677 <span class="comment">//</span>
+<a name="l01678"></a>01678 <span class="comment">// save data</span>
+<a name="l01679"></a>01679 <span class="comment">//</span>
+<a name="l01680"></a>01680
+<a name="l01681"></a>01681 <span class="comment">// update which IFUs are not used</span>
+<a name="l01682"></a>01682 kmo_print_unused_ifus(unused_ifus_after, TRUE);
+<a name="l01683"></a>01683
<a name="l01684"></a>01684 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01685"></a>01685 kmclipm_update_property_int(main_header, QC_SPAT_MAX_DEV_ID, qc_max_dev_id,
-<a name="l01686"></a>01686 <span class="stringliteral">"[] IFU ID with max. dev. from unity"</span>));
-<a name="l01687"></a>01687 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01688"></a>01688 kmclipm_update_property_double(main_header, QC_SPAT_MAX_NONUNIF, qc_max_nonunif,
-<a name="l01689"></a>01689 <span class="stringliteral">"[adu] max. stdev of illumination corr."</span>));
+<a name="l01685"></a>01685 kmo_set_unused_ifus(unused_ifus_after, main_header,
+<a name="l01686"></a>01686 <span class="stringliteral">"kmo_illumination"</span>));
+<a name="l01687"></a>01687
+<a name="l01688"></a>01688 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Saving data..."</span>);
+<a name="l01689"></a>01689
<a name="l01690"></a>01690 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01691"></a>01691 kmclipm_update_property_int(main_header, QC_SPAT_MAX_NONUNIF_ID, qc_max_nonunif_id,
-<a name="l01692"></a>01692 <span class="stringliteral">"[] IFU ID with max. stdev in illum. corr."</span>));
-<a name="l01693"></a>01693
-<a name="l01694"></a>01694 <span class="keywordflow">if</span> (!suppress_extension) {
-<a name="l01695"></a>01695 KMO_TRY_EXIT_IF_NULL(
-<a name="l01696"></a>01696 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, suffix));
-<a name="l01697"></a>01697 } <span class="keywordflow">else</span> {
-<a name="l01698"></a>01698 KMO_TRY_EXIT_IF_NULL(
-<a name="l01699"></a>01699 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">""</span>));
-<a name="l01700"></a>01700 }
-<a name="l01701"></a>01701 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01702"></a>01702 kmo_dfs_save_main_header(frameset, ILLUM_CORR, fn_suffix, frame,
-<a name="l01703"></a>01703 main_header, parlist, cpl_func));
-<a name="l01704"></a>01704
-<a name="l01705"></a>01705 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01706"></a>01706 kmo_dfs_save_main_header(frameset, SKYFLAT_EDGE, fn_suffix, frame,
-<a name="l01707"></a>01707 main_header, parlist, cpl_func));
-<a name="l01708"></a>01708
-<a name="l01709"></a>01709 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
-<a name="l01710"></a>01710 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01711"></a>01711 kmo_dfs_save_image(stored_data_images[i], ILLUM_CORR, fn_suffix,
-<a name="l01712"></a>01712 stored_sub_data_headers[i], 0./0.));
-<a name="l01713"></a>01713
-<a name="l01714"></a>01714 <span class="keywordflow">if</span> (process_noise) {
-<a name="l01715"></a>01715 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01716"></a>01716 kmo_dfs_save_image(stored_noise_images[i], ILLUM_CORR,
-<a name="l01717"></a>01717 fn_suffix, stored_sub_noise_headers[i], 0./0.));
-<a name="l01718"></a>01718 }
-<a name="l01719"></a>01719 }
-<a name="l01720"></a>01720
-<a name="l01721"></a>01721 <span class="keywordflow">for</span> (det_nr = 1; det_nr <= nr_devices; det_nr++) {
-<a name="l01722"></a>01722 <span class="keywordflow">for</span> (ifu_nr = 0; ifu_nr < KMOS_IFUS_PER_DETECTOR; ifu_nr++) {
-<a name="l01723"></a>01723 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01724"></a>01724 kmclipm_update_property_int(stored_sub_data_headers[(det_nr-1)*KMOS_IFUS_PER_DETECTOR+ifu_nr],
-<a name="l01725"></a>01725 CAL_IFU_NR,
-<a name="l01726"></a>01726 ifu_nr+1+(det_nr-1)*KMOS_IFUS_PER_DETECTOR,
-<a name="l01727"></a>01727 <span class="stringliteral">"IFU Number {1..24}"</span>));
-<a name="l01728"></a>01728 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01729"></a>01729 kmclipm_update_property_double(
-<a name="l01730"></a>01730 stored_sub_data_headers[(det_nr-1)*KMOS_IFUS_PER_DETECTOR+ifu_nr],
-<a name="l01731"></a>01731 CAL_ROTANGLE,
-<a name="l01732"></a>01732 rotangle_found,
-<a name="l01733"></a>01733 <span class="stringliteral">"[deg] Rotator relative to nasmyth"</span>));
-<a name="l01734"></a>01734 <span class="keywordflow">if</span> (has_flat_edge) {
-<a name="l01735"></a>01735 <span class="comment">// save edge-parameters as product</span>
-<a name="l01736"></a>01736 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01737"></a>01737 kmo_dfs_save_table(edge_table_sky[det_nr-1][ifu_nr], SKYFLAT_EDGE, fn_suffix,
-<a name="l01738"></a>01738 stored_sub_data_headers[(det_nr-1)*KMOS_IFUS_PER_DETECTOR+ifu_nr]));
-<a name="l01739"></a>01739 }
-<a name="l01740"></a>01740 }
-<a name="l01741"></a>01741 }
-<a name="l01742"></a>01742 }
-<a name="l01743"></a>01743 KMO_CATCH
-<a name="l01744"></a>01744 {
-<a name="l01745"></a>01745 KMO_CATCH_MSG();
-<a name="l01746"></a>01746 ret_val = -1;
-<a name="l01747"></a>01747 }
-<a name="l01748"></a>01748 kmo_free_fits_desc(&desc_sky);
-<a name="l01749"></a>01749 kmo_free_fits_desc(&desc_dark);
-<a name="l01750"></a>01750 kmo_free_fits_desc(&desc_flat);
-<a name="l01751"></a>01751 kmo_free_fits_desc(&desc_xcal);
-<a name="l01752"></a>01752 kmo_free_fits_desc(&desc_ycal);
-<a name="l01753"></a>01753 kmo_free_fits_desc(&desc_lcal);
-<a name="l01754"></a>01754 cpl_image_delete(combined_data); combined_data = NULL;
-<a name="l01755"></a>01755 cpl_image_delete(combined_noise); combined_noise = NULL;
-<a name="l01756"></a>01756 cpl_image_delete(xcal); xcal = NULL;
-<a name="l01757"></a>01757 cpl_image_delete(ycal); ycal = NULL;
-<a name="l01758"></a>01758 cpl_image_delete(lcal); lcal = NULL;
-<a name="l01759"></a>01759 cpl_image_delete(img_dark); img_dark = NULL;
-<a name="l01760"></a>01760 cpl_image_delete(img_dark_noise); img_dark_noise = NULL;
-<a name="l01761"></a>01761 cpl_image_delete(img_flat); img_flat = NULL;
-<a name="l01762"></a>01762 cpl_image_delete(img_flat_noise); img_flat_noise = NULL;
-<a name="l01763"></a>01763 cpl_array_delete(calTimestamp); calTimestamp = NULL;
-<a name="l01764"></a>01764 cpl_free(bounds); bounds = NULL;
-<a name="l01765"></a>01765 kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
-<a name="l01766"></a>01766 kmo_free_unused_ifus(unused_ifus_after); unused_ifus_after = NULL;
-<a name="l01767"></a>01767 cpl_free(fn_lut); fn_lut = NULL;
-<a name="l01768"></a>01768 cpl_free(suffix); suffix = NULL;
-<a name="l01769"></a>01769 cpl_free(fn_suffix); fn_suffix = NULL;
-<a name="l01770"></a>01770 cpl_frameset_delete(frameset_sky); frameset_sky = NULL;
-<a name="l01771"></a>01771 cpl_vector_delete(ranges); ranges = NULL;
-<a name="l01772"></a>01772 cpl_free(filter); filter = NULL;
-<a name="l01773"></a>01773 <span class="keywordflow">if</span> (calAngles != NULL) {
-<a name="l01774"></a>01774 cpl_vector_delete(calAngles); calAngles = NULL;
-<a name="l01775"></a>01775 }
-<a name="l01776"></a>01776 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l01777"></a>01777 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
-<a name="l01778"></a>01778 <span class="keywordflow">if</span> (stored_data_cubes != NULL) {
-<a name="l01779"></a>01779 cpl_imagelist_delete(stored_data_cubes[i]);
-<a name="l01780"></a>01780 stored_data_cubes[i] = NULL;
-<a name="l01781"></a>01781 }
-<a name="l01782"></a>01782 <span class="keywordflow">if</span> (stored_noise_cubes != NULL) {
-<a name="l01783"></a>01783 cpl_imagelist_delete(stored_noise_cubes[i]);
-<a name="l01784"></a>01784 stored_noise_cubes[i] = NULL;
-<a name="l01785"></a>01785 }
-<a name="l01786"></a>01786 <span class="keywordflow">if</span> (stored_data_images != NULL) {
-<a name="l01787"></a>01787 cpl_image_delete(stored_data_images[i]);
-<a name="l01788"></a>01788 stored_data_images[i] = NULL;
-<a name="l01789"></a>01789 }
-<a name="l01790"></a>01790 <span class="keywordflow">if</span> (stored_noise_images != NULL) {
-<a name="l01791"></a>01791 cpl_image_delete(stored_noise_images[i]);
-<a name="l01792"></a>01792 stored_noise_images[i] = NULL;
-<a name="l01793"></a>01793 }
-<a name="l01794"></a>01794 <span class="keywordflow">if</span> (stored_sub_data_headers != NULL) {
-<a name="l01795"></a>01795 cpl_propertylist_delete(stored_sub_data_headers[i]);
-<a name="l01796"></a>01796 stored_sub_data_headers[i] = NULL;
-<a name="l01797"></a>01797 }
-<a name="l01798"></a>01798 <span class="keywordflow">if</span> (stored_sub_noise_headers != NULL) {
-<a name="l01799"></a>01799 cpl_propertylist_delete(stored_sub_noise_headers[i]);
-<a name="l01800"></a>01800 stored_sub_noise_headers[i] = NULL;
-<a name="l01801"></a>01801 }
-<a name="l01802"></a>01802 }
-<a name="l01803"></a>01803 cpl_free(stored_data_cubes); stored_data_cubes = NULL;
-<a name="l01804"></a>01804 cpl_free(stored_noise_cubes); stored_noise_cubes = NULL;
-<a name="l01805"></a>01805 cpl_free(stored_data_images); stored_data_images = NULL;
-<a name="l01806"></a>01806 cpl_free(stored_noise_images); stored_noise_images = NULL;
-<a name="l01807"></a>01807 cpl_free(stored_sub_data_headers); stored_sub_data_headers = NULL;
-<a name="l01808"></a>01808 cpl_free(stored_sub_noise_headers); stored_sub_noise_headers = NULL;
-<a name="l01809"></a>01809 <span class="keywordflow">if</span> (edge_table_sky != NULL) {
-<a name="l01810"></a>01810 <span class="keywordflow">for</span> (i = 0; i < KMOS_NR_DETECTORS; i++) {
-<a name="l01811"></a>01811 <span class="keywordflow">if</span> (edge_table_sky[i] != NULL) {
-<a name="l01812"></a>01812 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
-<a name="l01813"></a>01813 cpl_table_delete(edge_table_sky[i][j]);
-<a name="l01814"></a>01814 edge_table_sky[i][j] = NULL;
-<a name="l01815"></a>01815 }
-<a name="l01816"></a>01816 cpl_free(edge_table_sky[i]); edge_table_sky[i] = NULL;
-<a name="l01817"></a>01817 }
-<a name="l01818"></a>01818 }
-<a name="l01819"></a>01819 cpl_free(edge_table_sky); edge_table_sky = NULL;
-<a name="l01820"></a>01820 }
-<a name="l01821"></a>01821 <span class="keywordflow">if</span> (edge_table_flat != NULL) {
-<a name="l01822"></a>01822 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
-<a name="l01823"></a>01823 cpl_table_delete(edge_table_flat[j]);
-<a name="l01824"></a>01824 edge_table_flat[j] = NULL;
-<a name="l01825"></a>01825 }
-<a name="l01826"></a>01826 cpl_free(edge_table_flat); edge_table_flat = NULL;
-<a name="l01827"></a>01827 }
-<a name="l01828"></a>01828
-<a name="l01829"></a>01829 <span class="keywordflow">return</span> ret_val;
-<a name="l01830"></a>01830 }
-<a name="l01831"></a>01831
+<a name="l01691"></a>01691 kmclipm_update_property_double(main_header, QC_SPAT_UNIF, qc_spat_unif,
+<a name="l01692"></a>01692 <span class="stringliteral">"[adu] uniformity of illumination correction"</span>));
+<a name="l01693"></a>01693 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01694"></a>01694 kmclipm_update_property_double(main_header, QC_SPAT_MAX_DEV, qc_max_dev,
+<a name="l01695"></a>01695 <span class="stringliteral">"[adu] max. deviation from unity"</span>));
+<a name="l01696"></a>01696 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01697"></a>01697 kmclipm_update_property_int(main_header, QC_SPAT_MAX_DEV_ID, qc_max_dev_id,
+<a name="l01698"></a>01698 <span class="stringliteral">"[] IFU ID with max. dev. from unity"</span>));
+<a name="l01699"></a>01699 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01700"></a>01700 kmclipm_update_property_double(main_header, QC_SPAT_MAX_NONUNIF, qc_max_nonunif,
+<a name="l01701"></a>01701 <span class="stringliteral">"[adu] max. stdev of illumination corr."</span>));
+<a name="l01702"></a>01702 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01703"></a>01703 kmclipm_update_property_int(main_header, QC_SPAT_MAX_NONUNIF_ID, qc_max_nonunif_id,
+<a name="l01704"></a>01704 <span class="stringliteral">"[] IFU ID with max. stdev in illum. corr."</span>));
+<a name="l01705"></a>01705
+<a name="l01706"></a>01706 <span class="keywordflow">if</span> (!suppress_extension) {
+<a name="l01707"></a>01707 KMO_TRY_EXIT_IF_NULL(
+<a name="l01708"></a>01708 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, suffix));
+<a name="l01709"></a>01709 } <span class="keywordflow">else</span> {
+<a name="l01710"></a>01710 KMO_TRY_EXIT_IF_NULL(
+<a name="l01711"></a>01711 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">""</span>));
+<a name="l01712"></a>01712 }
+<a name="l01713"></a>01713 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01714"></a>01714 kmo_dfs_save_main_header(frameset, ILLUM_CORR, fn_suffix, frame,
+<a name="l01715"></a>01715 main_header, parlist, cpl_func));
+<a name="l01716"></a>01716
+<a name="l01717"></a>01717 <span class="keywordflow">if</span> (has_flat_edge) {
+<a name="l01718"></a>01718 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01719"></a>01719 kmo_dfs_save_main_header(frameset, SKYFLAT_EDGE, fn_suffix, frame,
+<a name="l01720"></a>01720 main_header, parlist, cpl_func));
+<a name="l01721"></a>01721 }
+<a name="l01722"></a>01722
+<a name="l01723"></a>01723 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01724"></a>01724 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01725"></a>01725 kmo_dfs_save_image(stored_data_images[i], ILLUM_CORR, fn_suffix,
+<a name="l01726"></a>01726 stored_sub_data_headers[i], 0./0.));
+<a name="l01727"></a>01727
+<a name="l01728"></a>01728 <span class="keywordflow">if</span> (process_noise) {
+<a name="l01729"></a>01729 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01730"></a>01730 kmo_dfs_save_image(stored_noise_images[i], ILLUM_CORR,
+<a name="l01731"></a>01731 fn_suffix, stored_sub_noise_headers[i], 0./0.));
+<a name="l01732"></a>01732 }
+<a name="l01733"></a>01733 }
+<a name="l01734"></a>01734
+<a name="l01735"></a>01735 <span class="keywordflow">for</span> (det_nr = 1; det_nr <= nr_devices; det_nr++) {
+<a name="l01736"></a>01736 <span class="keywordflow">for</span> (ifu_nr = 0; ifu_nr < KMOS_IFUS_PER_DETECTOR; ifu_nr++) {
+<a name="l01737"></a>01737 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01738"></a>01738 kmclipm_update_property_int(stored_sub_data_headers[(det_nr-1)*KMOS_IFUS_PER_DETECTOR+ifu_nr],
+<a name="l01739"></a>01739 CAL_IFU_NR,
+<a name="l01740"></a>01740 ifu_nr+1+(det_nr-1)*KMOS_IFUS_PER_DETECTOR,
+<a name="l01741"></a>01741 <span class="stringliteral">"IFU Number {1..24}"</span>));
+<a name="l01742"></a>01742 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01743"></a>01743 kmclipm_update_property_double(
+<a name="l01744"></a>01744 stored_sub_data_headers[(det_nr-1)*KMOS_IFUS_PER_DETECTOR+ifu_nr],
+<a name="l01745"></a>01745 CAL_ROTANGLE,
+<a name="l01746"></a>01746 rotangle_found,
+<a name="l01747"></a>01747 <span class="stringliteral">"[deg] Rotator relative to nasmyth"</span>));
+<a name="l01748"></a>01748 <span class="keywordflow">if</span> (has_flat_edge) {
+<a name="l01749"></a>01749 <span class="comment">// save edge-parameters as product</span>
+<a name="l01750"></a>01750 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01751"></a>01751 kmo_dfs_save_table(edge_table_sky[det_nr-1][ifu_nr], SKYFLAT_EDGE, fn_suffix,
+<a name="l01752"></a>01752 stored_sub_data_headers[(det_nr-1)*KMOS_IFUS_PER_DETECTOR+ifu_nr]));
+<a name="l01753"></a>01753 }
+<a name="l01754"></a>01754 }
+<a name="l01755"></a>01755 }
+<a name="l01756"></a>01756 }
+<a name="l01757"></a>01757 KMO_CATCH
+<a name="l01758"></a>01758 {
+<a name="l01759"></a>01759 KMO_CATCH_MSG();
+<a name="l01760"></a>01760 ret_val = -1;
+<a name="l01761"></a>01761 }
+<a name="l01762"></a>01762 kmo_free_fits_desc(&desc_sky);
+<a name="l01763"></a>01763 kmo_free_fits_desc(&desc_dark);
+<a name="l01764"></a>01764 kmo_free_fits_desc(&desc_flat);
+<a name="l01765"></a>01765 kmo_free_fits_desc(&desc_xcal);
+<a name="l01766"></a>01766 kmo_free_fits_desc(&desc_ycal);
+<a name="l01767"></a>01767 kmo_free_fits_desc(&desc_lcal);
+<a name="l01768"></a>01768 cpl_image_delete(combined_data); combined_data = NULL;
+<a name="l01769"></a>01769 cpl_image_delete(combined_noise); combined_noise = NULL;
+<a name="l01770"></a>01770 cpl_image_delete(xcal); xcal = NULL;
+<a name="l01771"></a>01771 cpl_image_delete(ycal); ycal = NULL;
+<a name="l01772"></a>01772 cpl_image_delete(lcal); lcal = NULL;
+<a name="l01773"></a>01773 cpl_image_delete(img_dark); img_dark = NULL;
+<a name="l01774"></a>01774 cpl_image_delete(img_dark_noise); img_dark_noise = NULL;
+<a name="l01775"></a>01775 cpl_image_delete(img_flat); img_flat = NULL;
+<a name="l01776"></a>01776 cpl_image_delete(img_flat_noise); img_flat_noise = NULL;
+<a name="l01777"></a>01777 cpl_array_delete(calTimestamp); calTimestamp = NULL;
+<a name="l01778"></a>01778 cpl_free(bounds); bounds = NULL;
+<a name="l01779"></a>01779 kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
+<a name="l01780"></a>01780 kmo_free_unused_ifus(unused_ifus_after); unused_ifus_after = NULL;
+<a name="l01781"></a>01781 cpl_free(fn_lut); fn_lut = NULL;
+<a name="l01782"></a>01782 cpl_free(suffix); suffix = NULL;
+<a name="l01783"></a>01783 cpl_free(fn_suffix); fn_suffix = NULL;
+<a name="l01784"></a>01784 cpl_frameset_delete(frameset_sky); frameset_sky = NULL;
+<a name="l01785"></a>01785 cpl_vector_delete(ranges); ranges = NULL;
+<a name="l01786"></a>01786 cpl_free(filter); filter = NULL;
+<a name="l01787"></a>01787 <span class="keywordflow">if</span> (calAngles != NULL) {
+<a name="l01788"></a>01788 cpl_vector_delete(calAngles); calAngles = NULL;
+<a name="l01789"></a>01789 }
+<a name="l01790"></a>01790 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l01791"></a>01791 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01792"></a>01792 <span class="keywordflow">if</span> (stored_data_cubes != NULL) {
+<a name="l01793"></a>01793 cpl_imagelist_delete(stored_data_cubes[i]);
+<a name="l01794"></a>01794 stored_data_cubes[i] = NULL;
+<a name="l01795"></a>01795 }
+<a name="l01796"></a>01796 <span class="keywordflow">if</span> (stored_noise_cubes != NULL) {
+<a name="l01797"></a>01797 cpl_imagelist_delete(stored_noise_cubes[i]);
+<a name="l01798"></a>01798 stored_noise_cubes[i] = NULL;
+<a name="l01799"></a>01799 }
+<a name="l01800"></a>01800 <span class="keywordflow">if</span> (stored_data_images != NULL) {
+<a name="l01801"></a>01801 cpl_image_delete(stored_data_images[i]);
+<a name="l01802"></a>01802 stored_data_images[i] = NULL;
+<a name="l01803"></a>01803 }
+<a name="l01804"></a>01804 <span class="keywordflow">if</span> (stored_noise_images != NULL) {
+<a name="l01805"></a>01805 cpl_image_delete(stored_noise_images[i]);
+<a name="l01806"></a>01806 stored_noise_images[i] = NULL;
+<a name="l01807"></a>01807 }
+<a name="l01808"></a>01808 <span class="keywordflow">if</span> (stored_sub_data_headers != NULL) {
+<a name="l01809"></a>01809 cpl_propertylist_delete(stored_sub_data_headers[i]);
+<a name="l01810"></a>01810 stored_sub_data_headers[i] = NULL;
+<a name="l01811"></a>01811 }
+<a name="l01812"></a>01812 <span class="keywordflow">if</span> (stored_sub_noise_headers != NULL) {
+<a name="l01813"></a>01813 cpl_propertylist_delete(stored_sub_noise_headers[i]);
+<a name="l01814"></a>01814 stored_sub_noise_headers[i] = NULL;
+<a name="l01815"></a>01815 }
+<a name="l01816"></a>01816 }
+<a name="l01817"></a>01817 cpl_free(stored_data_cubes); stored_data_cubes = NULL;
+<a name="l01818"></a>01818 cpl_free(stored_noise_cubes); stored_noise_cubes = NULL;
+<a name="l01819"></a>01819 cpl_free(stored_data_images); stored_data_images = NULL;
+<a name="l01820"></a>01820 cpl_free(stored_noise_images); stored_noise_images = NULL;
+<a name="l01821"></a>01821 cpl_free(stored_sub_data_headers); stored_sub_data_headers = NULL;
+<a name="l01822"></a>01822 cpl_free(stored_sub_noise_headers); stored_sub_noise_headers = NULL;
+<a name="l01823"></a>01823 <span class="keywordflow">if</span> (edge_table_sky != NULL) {
+<a name="l01824"></a>01824 <span class="keywordflow">for</span> (i = 0; i < KMOS_NR_DETECTORS; i++) {
+<a name="l01825"></a>01825 <span class="keywordflow">if</span> (edge_table_sky[i] != NULL) {
+<a name="l01826"></a>01826 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l01827"></a>01827 cpl_table_delete(edge_table_sky[i][j]);
+<a name="l01828"></a>01828 edge_table_sky[i][j] = NULL;
+<a name="l01829"></a>01829 }
+<a name="l01830"></a>01830 cpl_free(edge_table_sky[i]); edge_table_sky[i] = NULL;
+<a name="l01831"></a>01831 }
+<a name="l01832"></a>01832 }
+<a name="l01833"></a>01833 cpl_free(edge_table_sky); edge_table_sky = NULL;
+<a name="l01834"></a>01834 }
+<a name="l01835"></a>01835 <span class="keywordflow">if</span> (edge_table_flat != NULL) {
+<a name="l01836"></a>01836 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l01837"></a>01837 cpl_table_delete(edge_table_flat[j]);
+<a name="l01838"></a>01838 edge_table_flat[j] = NULL;
+<a name="l01839"></a>01839 }
+<a name="l01840"></a>01840 cpl_free(edge_table_flat); edge_table_flat = NULL;
+<a name="l01841"></a>01841 }
+<a name="l01842"></a>01842
+<a name="l01843"></a>01843 <span class="keywordflow">return</span> ret_val;
+<a name="l01844"></a>01844 }
+<a name="l01845"></a>01845
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__illumination__flat_8c_source.html b/html/kmo__illumination__flat_8c_source.html
new file mode 100644
index 0000000..186b1d7
--- /dev/null
+++ b/html/kmo__illumination__flat_8c_source.html
@@ -0,0 +1,1358 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<title>KMOS Pipeline Reference Manual: kmo_illumination_flat.c Source File</title>
+
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+
+
+
+</head>
+<body>
+<div id="top"><!-- do not remove this div! -->
+
+
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+
+
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">KMOS Pipeline Reference Manual
+ <span id="projectnumber">1.2.6</span>
+ </div>
+
+ </td>
+
+
+
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<!-- Generated by Doxygen 1.7.6.1 -->
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li class="current"><a href="files.html"><span>Files</span></a></li>
+ <li><a href="dirs.html"><span>Directories</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="files.html"><span>File List</span></a></li>
+ </ul>
+ </div>
+ <div id="nav-path" class="navpath">
+ <ul>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">kmo_illumination_flat.c</div> </div>
+</div><!--header-->
+<div class="contents">
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_illumination_flat.c,v 1.1 2013/10/21 13:44:55 aagudo Exp $</span>
+<a name="l00002"></a>00002 <span class="comment"> *</span>
+<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
+<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
+<a name="l00005"></a>00005 <span class="comment"> *</span>
+<a name="l00006"></a>00006 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
+<a name="l00007"></a>00007 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
+<a name="l00008"></a>00008 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
+<a name="l00009"></a>00009 <span class="comment"> * (at your option) any later version.</span>
+<a name="l00010"></a>00010 <span class="comment"> *</span>
+<a name="l00011"></a>00011 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
+<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
+<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
+<a name="l00014"></a>00014 <span class="comment"> * GNU General Public License for more details.</span>
+<a name="l00015"></a>00015 <span class="comment"> *</span>
+<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
+<a name="l00017"></a>00017 <span class="comment"> * along with this program; if not, write to the Free Software</span>
+<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
+<a name="l00019"></a>00019 <span class="comment"> */</span>
+<a name="l00020"></a>00020
+<a name="l00021"></a>00021 <span class="comment">/*</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/10/21 13:44:55 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.1 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: $</span>
+<a name="l00026"></a>00026 <span class="comment"> */</span>
+<a name="l00027"></a>00027
+<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
+<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
+<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
+<a name="l00031"></a>00031 <span class="preprocessor"></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> * Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> *----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
+<a name="l00037"></a>00037 <span class="preprocessor">#include <string.h></span>
+<a name="l00038"></a>00038
+<a name="l00039"></a>00039 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00040"></a>00040
+<a name="l00041"></a>00041 <span class="preprocessor">#include "kmo_priv_reconstruct.h"</span>
+<a name="l00042"></a>00042 <span class="preprocessor">#include "kmo_priv_functions.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "kmo_priv_flat.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "kmo_priv_wave_cal.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "kmclipm_priv_splines.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "kmo_functions.h"</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#include "kmo_cpl_extensions.h"</span>
+<a name="l00048"></a>00048 <span class="preprocessor">#include "kmo_dfs.h"</span>
+<a name="l00049"></a>00049 <span class="preprocessor">#include "kmo_error.h"</span>
+<a name="l00050"></a>00050 <span class="preprocessor">#include "kmo_constants.h"</span>
+<a name="l00051"></a>00051 <span class="preprocessor">#include "kmo_debug.h"</span>
+<a name="l00052"></a>00052
+<a name="l00053"></a>00053 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00054"></a>00054 <span class="comment"> * Functions prototypes</span>
+<a name="l00055"></a>00055 <span class="comment"> *----------------------------------------------------------------------------*/</span>
+<a name="l00056"></a>00056
+<a name="l00057"></a>00057 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_flat_create(cpl_plugin *);
+<a name="l00058"></a>00058 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_flat_exec(cpl_plugin *);
+<a name="l00059"></a>00059 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_flat_destroy(cpl_plugin *);
+<a name="l00060"></a>00060 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_flat(cpl_parameterlist *, cpl_frameset *);
+<a name="l00061"></a>00061
+<a name="l00062"></a>00062 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00063"></a>00063 <span class="comment"> * Static variables</span>
+<a name="l00064"></a>00064 <span class="comment"> *----------------------------------------------------------------------------*/</span>
+<a name="l00065"></a>00065
+<a name="l00066"></a>00066 <span class="keyword">static</span> <span class="keywordtype">char</span> kmo_illumination_flat_description[] =
+<a name="l00067"></a>00067 <span class="stringliteral">"This recipe creates the spatial non-uniformity calibration frame needed for\n"</span>
+<a name="l00068"></a>00068 <span class="stringliteral">"all three detectors. It must be called after the kmo_wave_cal-recipe, which\n"</span>
+<a name="l00069"></a>00069 <span class="stringliteral">"generates the spectral calibration frame needed in this recipe. As input at\n"</span>
+<a name="l00070"></a>00070 <span class="stringliteral">"least a flatfield frame is required.\n"</span>
+<a name="l00071"></a>00071 <span class="stringliteral">"Contrary to kmo_illumination it doesn't use flat sky frames but rather the\n"</span>
+<a name="l00072"></a>00072 <span class="stringliteral">"flatfield frames from the internal flat lamp. This recipe can be used if no\n"</span>
+<a name="l00073"></a>00073 <span class="stringliteral">"acceptable flat sky frames are available.\n"</span>
+<a name="l00074"></a>00074 <span class="stringliteral">"The created product, the illumination correction, can be used as input for\n"</span>
+<a name="l00075"></a>00075 <span class="stringliteral">"kmo_std_star and kmo_sci_red.\n"</span>
+<a name="l00076"></a>00076 <span class="stringliteral">"\n"</span>
+<a name="l00077"></a>00077 <span class="stringliteral">"BASIC PARAMETERS:\n"</span>
+<a name="l00078"></a>00078 <span class="stringliteral">"-----------------\n"</span>
+<a name="l00079"></a>00079 <span class="stringliteral">"--imethod\n"</span>
+<a name="l00080"></a>00080 <span class="stringliteral">"The interpolation method used for reconstruction.\n"</span>
+<a name="l00081"></a>00081 <span class="stringliteral">"\n"</span>
+<a name="l00082"></a>00082 <span class="stringliteral">"ADVANCED PARAMETERS\n"</span>
+<a name="l00083"></a>00083 <span class="stringliteral">"-------------------\n"</span>
+<a name="l00084"></a>00084 <span class="stringliteral">"--flux\n"</span>
+<a name="l00085"></a>00085 <span class="stringliteral">"Specify if flux conservation should be applied.\n"</span>
+<a name="l00086"></a>00086 <span class="stringliteral">"\n"</span>
+<a name="l00087"></a>00087 <span class="stringliteral">"--neighborhoodRange\n"</span>
+<a name="l00088"></a>00088 <span class="stringliteral">"Defines the range to search for neighbors during reconstruction\n"</span>
+<a name="l00089"></a>00089 <span class="stringliteral">"\n"</span>
+<a name="l00090"></a>00090 <span class="stringliteral">"--b_samples\n"</span>
+<a name="l00091"></a>00091 <span class="stringliteral">"The number of samples in spectral direction for the reconstructed cube.\n"</span>
+<a name="l00092"></a>00092 <span class="stringliteral">"Ideally this number should be greater than 2048, the detector size.\n"</span>
+<a name="l00093"></a>00093 <span class="stringliteral">"\n"</span>
+<a name="l00094"></a>00094 <span class="stringliteral">"--b_start\n"</span>
+<a name="l00095"></a>00095 <span class="stringliteral">"--b_end\n"</span>
+<a name="l00096"></a>00096 <span class="stringliteral">"Used to define manually the start and end wavelength for the reconstructed\n"</span>
+<a name="l00097"></a>00097 <span class="stringliteral">"cube. By default the internally defined values are used.\n"</span>
+<a name="l00098"></a>00098 <span class="stringliteral">"\n"</span>
+<a name="l00099"></a>00099 <span class="stringliteral">"--cmethod\n"</span>
+<a name="l00100"></a>00100 <span class="stringliteral">"Following methods of frame combination are available:\n"</span>
+<a name="l00101"></a>00101 <span class="stringliteral">" * 'ksigma' (Default)\n"</span>
+<a name="l00102"></a>00102 <span class="stringliteral">" An iterative sigma clipping. For each position all pixels in the spectrum\n"</span>
+<a name="l00103"></a>00103 <span class="stringliteral">" are examined. If they deviate significantly, they will be rejected according\n"</span>
+<a name="l00104"></a>00104 <span class="stringliteral">" to the conditions:\n"</span>
+<a name="l00105"></a>00105 <span class="stringliteral">" val > mean + stdev * cpos_rej\n"</span>
+<a name="l00106"></a>00106 <span class="stringliteral">" and\n"</span>
+<a name="l00107"></a>00107 <span class="stringliteral">" val < mean - stdev * cneg_rej\n"</span>
+<a name="l00108"></a>00108 <span class="stringliteral">" where --cpos_rej, --cneg_rej and --citer are the corresponding configuration\n"</span>
+<a name="l00109"></a>00109 <span class="stringliteral">" parameters. In the first iteration median and percentile level are used.\n"</span>
+<a name="l00110"></a>00110 <span class="stringliteral">"\n"</span>
+<a name="l00111"></a>00111 <span class="stringliteral">" * 'median'\n"</span>
+<a name="l00112"></a>00112 <span class="stringliteral">" At each pixel position the median is calculated.\n"</span>
+<a name="l00113"></a>00113 <span class="stringliteral">"\n"</span>
+<a name="l00114"></a>00114 <span class="stringliteral">" * 'average'\n"</span>
+<a name="l00115"></a>00115 <span class="stringliteral">" At each pixel position the average is calculated.\n"</span>
+<a name="l00116"></a>00116 <span class="stringliteral">"\n"</span>
+<a name="l00117"></a>00117 <span class="stringliteral">" * 'sum'\n"</span>
+<a name="l00118"></a>00118 <span class="stringliteral">" At each pixel position the sum is calculated.\n"</span>
+<a name="l00119"></a>00119 <span class="stringliteral">"\n"</span>
+<a name="l00120"></a>00120 <span class="stringliteral">" * 'min_max'\n"</span>
+<a name="l00121"></a>00121 <span class="stringliteral">" The specified number of minimum and maximum pixel values will be rejected.\n"</span>
+<a name="l00122"></a>00122 <span class="stringliteral">" --cmax and --cmin apply to this method.\n"</span>
+<a name="l00123"></a>00123 <span class="stringliteral">"\n"</span>
+<a name="l00124"></a>00124 <span class="stringliteral">"--cpos_rej\n"</span>
+<a name="l00125"></a>00125 <span class="stringliteral">"--cneg_rej\n"</span>
+<a name="l00126"></a>00126 <span class="stringliteral">"--citer\n"</span>
+<a name="l00127"></a>00127 <span class="stringliteral">"see --cmethod='ksigma'\n"</span>
+<a name="l00128"></a>00128 <span class="stringliteral">"\n"</span>
+<a name="l00129"></a>00129 <span class="stringliteral">"--cmax\n"</span>
+<a name="l00130"></a>00130 <span class="stringliteral">"--cmin\n"</span>
+<a name="l00131"></a>00131 <span class="stringliteral">"see --cmethod='min_max'\n"</span>
+<a name="l00132"></a>00132 <span class="stringliteral">"\n"</span>
+<a name="l00133"></a>00133 <span class="stringliteral">"--pix_scale\n"</span>
+<a name="l00134"></a>00134 <span class="stringliteral">"Change the pixel scale [arcsec]. Default of 0.2\" results into cubes of\n"</span>
+<a name="l00135"></a>00135 <span class="stringliteral">"14x14pix, a scale of 0.1\" results into cubes of 28x28pix, etc.\n"</span>
+<a name="l00136"></a>00136 <span class="stringliteral">"\n"</span>
+<a name="l00137"></a>00137 <span class="stringliteral">"--suppress_extension\n"</span>
+<a name="l00138"></a>00138 <span class="stringliteral">"If set to TRUE, the arbitrary filename extensions are supressed. If multiple\n"</span>
+<a name="l00139"></a>00139 <span class="stringliteral">"products with the same category are produced, they will be numered consecutively\n"</span>
+<a name="l00140"></a>00140 <span class="stringliteral">"starting from 0.\n"</span>
+<a name="l00141"></a>00141 <span class="stringliteral">"\n"</span>
+<a name="l00142"></a>00142 <span class="stringliteral">"-------------------------------------------------------------------------------\n"</span>
+<a name="l00143"></a>00143 <span class="stringliteral">" Input files:\n"</span>
+<a name="l00144"></a>00144 <span class="stringliteral">"\n"</span>
+<a name="l00145"></a>00145 <span class="stringliteral">" DO KMOS \n"</span>
+<a name="l00146"></a>00146 <span class="stringliteral">" category Type Explanation Required #Frames\n"</span>
+<a name="l00147"></a>00147 <span class="stringliteral">" -------- ----- ----------- -------- -------\n"</span>
+<a name="l00148"></a>00148 <span class="stringliteral">" FLAT_SKY_FLAT F2D Flatlamp-on exposures Y 1-n \n"</span>
+<a name="l00149"></a>00149 <span class="stringliteral">" (at least 3 frames recommended) \n"</span>
+<a name="l00150"></a>00150 <span class="stringliteral">" XCAL F2D x calibration frame Y 1 \n"</span>
+<a name="l00151"></a>00151 <span class="stringliteral">" YCAL F2D y calibration frame Y 1 \n"</span>
+<a name="l00152"></a>00152 <span class="stringliteral">" LCAL F2D Wavelength calib. frame Y 1 \n"</span>
+<a name="l00153"></a>00153 <span class="stringliteral">" WAVE_BAND F2L Table with start-/end-wavelengths Y 1 \n"</span>
+<a name="l00154"></a>00154 <span class="stringliteral">"\n"</span>
+<a name="l00155"></a>00155 <span class="stringliteral">" Output files:\n"</span>
+<a name="l00156"></a>00156 <span class="stringliteral">"\n"</span>
+<a name="l00157"></a>00157 <span class="stringliteral">" DO KMOS\n"</span>
+<a name="l00158"></a>00158 <span class="stringliteral">" category Type Explanation\n"</span>
+<a name="l00159"></a>00159 <span class="stringliteral">" -------- ----- -----------\n"</span>
+<a name="l00160"></a>00160 <span class="stringliteral">" ILLUM_CORR F2I Illumination calibration frame \n"</span>
+<a name="l00161"></a>00161 <span class="stringliteral">"-------------------------------------------------------------------------------\n"</span>
+<a name="l00162"></a>00162 <span class="stringliteral">"\n"</span>;
+<a name="l00163"></a>00163
+<a name="l00164"></a>00164 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00165"></a>00165 <span class="comment"> * Functions code</span>
+<a name="l00166"></a>00166 <span class="comment"> *----------------------------------------------------------------------------*/</span>
+<a name="l00167"></a>00167
+<a name="l00184"></a><a class="code" href="group__kmo__illumination__flat.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693">00184</a> <span class="keywordtype">int</span> <a class="code" href="group__kmo__arithmetic.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693" title="Build the list of available plugins, for this module.">cpl_plugin_get_info</a>(cpl_pluginlist *list)
+<a name="l00185"></a>00185 {
+<a name="l00186"></a>00186 cpl_recipe *recipe = cpl_calloc(1, <span class="keyword">sizeof</span> *recipe);
+<a name="l00187"></a>00187 cpl_plugin *plugin = &recipe->interface;
+<a name="l00188"></a>00188
+<a name="l00189"></a>00189 cpl_plugin_init(plugin,
+<a name="l00190"></a>00190 CPL_PLUGIN_API,
+<a name="l00191"></a>00191 KMOS_BINARY_VERSION,
+<a name="l00192"></a>00192 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00193"></a>00193 <span class="stringliteral">"kmo_illumination_flat"</span>,
+<a name="l00194"></a>00194 <span class="stringliteral">"Alternative to kmo_illumination based on flatfield frames."</span>,
+<a name="l00195"></a>00195 kmo_illumination_flat_description,
+<a name="l00196"></a>00196 <span class="stringliteral">"Alex Agudo Berbel"</span>,
+<a name="l00197"></a>00197 <span class="stringliteral">"kmos-spark at mpe.mpg.de"</span>,
+<a name="l00198"></a>00198 kmos_get_license(),
+<a name="l00199"></a>00199 kmo_illumination_flat_create,
+<a name="l00200"></a>00200 kmo_illumination_flat_exec,
+<a name="l00201"></a>00201 kmo_illumination_flat_destroy);
+<a name="l00202"></a>00202
+<a name="l00203"></a>00203 cpl_pluginlist_append(list, plugin);
+<a name="l00204"></a>00204
+<a name="l00205"></a>00205 <span class="keywordflow">return</span> 0;
+<a name="l00206"></a>00206 }
+<a name="l00207"></a>00207
+<a name="l00215"></a>00215 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_flat_create(cpl_plugin *plugin)
+<a name="l00216"></a>00216 {
+<a name="l00217"></a>00217 cpl_recipe *recipe;
+<a name="l00218"></a>00218 cpl_parameter *p;
+<a name="l00219"></a>00219
+<a name="l00220"></a>00220 <span class="comment">/* Check that the plugin is part of a valid recipe */</span>
+<a name="l00221"></a>00221 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00222"></a>00222 recipe = (cpl_recipe *)plugin;
+<a name="l00223"></a>00223 <span class="keywordflow">else</span>
+<a name="l00224"></a>00224 <span class="keywordflow">return</span> -1;
+<a name="l00225"></a>00225
+<a name="l00226"></a>00226 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00227"></a>00227 recipe->parameters = cpl_parameterlist_new();
+<a name="l00228"></a>00228
+<a name="l00229"></a>00229 <span class="comment">/* Fill the parameters list */</span>
+<a name="l00230"></a>00230 <span class="comment">/* --imethod */</span>
+<a name="l00231"></a>00231 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination_flat.imethod"</span>,
+<a name="l00232"></a>00232 CPL_TYPE_STRING,
+<a name="l00233"></a>00233 <span class="stringliteral">"Method to use for interpolation: "</span>
+<a name="l00234"></a>00234 <span class="stringliteral">"[\"NN\" (nearest neighbour), "</span>
+<a name="l00235"></a>00235 <span class="stringliteral">"\"lwNN\" (linear weighted nearest neighbor), "</span>
+<a name="l00236"></a>00236 <span class="stringliteral">"\"swNN\" (square weighted nearest neighbor), "</span>
+<a name="l00237"></a>00237 <span class="stringliteral">"\"MS\" (Modified Shepard's method), "</span>
+<a name="l00238"></a>00238 <span class="stringliteral">"\"CS\" (Cubic spline)]"</span>,
+<a name="l00239"></a>00239 <span class="stringliteral">"kmos.kmo_illumination_flat"</span>,
+<a name="l00240"></a>00240 <span class="stringliteral">"CS"</span>);
+<a name="l00241"></a>00241 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"imethod"</span>);
+<a name="l00242"></a>00242 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00243"></a>00243 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00244"></a>00244
+<a name="l00245"></a>00245 <span class="comment">/* --neighborhoodRange */</span>
+<a name="l00246"></a>00246 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination_flat.neighborhoodRange"</span>,
+<a name="l00247"></a>00247 CPL_TYPE_DOUBLE,
+<a name="l00248"></a>00248 <span class="stringliteral">"Defines the range to search for neighbors. "</span>
+<a name="l00249"></a>00249 <span class="stringliteral">"in pixels"</span>,
+<a name="l00250"></a>00250 <span class="stringliteral">"kmos.kmo_illumination_flat"</span>,
+<a name="l00251"></a>00251 1.001);
+<a name="l00252"></a>00252 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"neighborhoodRange"</span>);
+<a name="l00253"></a>00253 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00254"></a>00254 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00255"></a>00255
+<a name="l00256"></a>00256 <span class="comment">/* --flux */</span>
+<a name="l00257"></a>00257 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination_flat.flux"</span>,
+<a name="l00258"></a>00258 CPL_TYPE_BOOL,
+<a name="l00259"></a>00259 <span class="stringliteral">"TRUE: Apply flux conservation. FALSE: otherwise"</span>,
+<a name="l00260"></a>00260 <span class="stringliteral">"kmos.kmo_illumination_flat"</span>,
+<a name="l00261"></a>00261 FALSE);
+<a name="l00262"></a>00262 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"flux"</span>);
+<a name="l00263"></a>00263 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00264"></a>00264 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00265"></a>00265
+<a name="l00266"></a>00266 <span class="comment">/* --pix_scale */</span>
+<a name="l00267"></a>00267 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination_flat.pix_scale"</span>,
+<a name="l00268"></a>00268 CPL_TYPE_DOUBLE,
+<a name="l00269"></a>00269 <span class="stringliteral">"Change the pixel scale [arcsec]. "</span>
+<a name="l00270"></a>00270 <span class="stringliteral">"Default of 0.2\" results into cubes of 14x14pix, "</span>
+<a name="l00271"></a>00271 <span class="stringliteral">"a scale of 0.1\" results into cubes of 28x28pix, "</span>
+<a name="l00272"></a>00272 <span class="stringliteral">"etc."</span>,
+<a name="l00273"></a>00273 <span class="stringliteral">"kmos.kmo_illumination_flat"</span>,
+<a name="l00274"></a>00274 KMOS_PIX_RESOLUTION);
+<a name="l00275"></a>00275 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"pix_scale"</span>);
+<a name="l00276"></a>00276 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00277"></a>00277 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00278"></a>00278
+<a name="l00279"></a>00279 <span class="comment">/* --suppress_extension */</span>
+<a name="l00280"></a>00280 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_illumination_flat.suppress_extension"</span>,
+<a name="l00281"></a>00281 CPL_TYPE_BOOL,
+<a name="l00282"></a>00282 <span class="stringliteral">"Suppress arbitrary filename extension. "</span>
+<a name="l00283"></a>00283 <span class="stringliteral">"(TRUE (apply) or FALSE (don't apply)"</span>,
+<a name="l00284"></a>00284 <span class="stringliteral">"kmos.kmo_illumination_flat"</span>,
+<a name="l00285"></a>00285 FALSE);
+<a name="l00286"></a>00286 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"suppress_extension"</span>);
+<a name="l00287"></a>00287 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00288"></a>00288 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00289"></a>00289
+<a name="l00290"></a>00290 <span class="comment">// add parameters for band-definition</span>
+<a name="l00291"></a>00291 kmo_band_pars_create(recipe->parameters,
+<a name="l00292"></a>00292 <span class="stringliteral">"kmos.kmo_illumination_flat"</span>);
+<a name="l00293"></a>00293
+<a name="l00294"></a>00294 <span class="comment">// add parameters for combining</span>
+<a name="l00295"></a>00295 <span class="keywordflow">return</span> kmo_combine_pars_create(recipe->parameters,
+<a name="l00296"></a>00296 <span class="stringliteral">"kmos.kmo_illumination_flat"</span>,
+<a name="l00297"></a>00297 DEF_REJ_METHOD,
+<a name="l00298"></a>00298 FALSE);
+<a name="l00299"></a>00299 }
+<a name="l00300"></a>00300
+<a name="l00306"></a>00306 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_flat_exec(cpl_plugin *plugin)
+<a name="l00307"></a>00307 {
+<a name="l00308"></a>00308 cpl_recipe *recipe;
+<a name="l00309"></a>00309
+<a name="l00310"></a>00310 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00311"></a>00311 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00312"></a>00312 recipe = (cpl_recipe *)plugin;
+<a name="l00313"></a>00313 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1;
+<a name="l00314"></a>00314
+<a name="l00315"></a>00315 <span class="keywordflow">return</span> kmo_illumination_flat(recipe->parameters, recipe->frames);
+<a name="l00316"></a>00316 }
+<a name="l00317"></a>00317
+<a name="l00323"></a>00323 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_flat_destroy(cpl_plugin *plugin)
+<a name="l00324"></a>00324 {
+<a name="l00325"></a>00325 cpl_recipe *recipe;
+<a name="l00326"></a>00326
+<a name="l00327"></a>00327 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00328"></a>00328 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00329"></a>00329 recipe = (cpl_recipe *)plugin;
+<a name="l00330"></a>00330 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00331"></a>00331
+<a name="l00332"></a>00332 cpl_parameterlist_delete(recipe->parameters);
+<a name="l00333"></a>00333 <span class="keywordflow">return</span> 0 ;
+<a name="l00334"></a>00334 }
+<a name="l00335"></a>00335
+<a name="l00350"></a>00350 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_illumination_flat(cpl_parameterlist *parlist, cpl_frameset *frameset)
+<a name="l00351"></a>00351 {
+<a name="l00352"></a>00352 <span class="keywordtype">int</span> ret_val = 0,
+<a name="l00353"></a>00353 nr_devices = 0,
+<a name="l00354"></a>00354 ifu_nr = 0,
+<a name="l00355"></a>00355 nx = 0,
+<a name="l00356"></a>00356 ny = 0,
+<a name="l00357"></a>00357 cmax = 0,
+<a name="l00358"></a>00358 cmin = 0,
+<a name="l00359"></a>00359 citer = 0,
+<a name="l00360"></a>00360 *bounds = NULL,
+<a name="l00361"></a>00361 cnt = 0,
+<a name="l00362"></a>00362 qc_max_dev_id = 0,
+<a name="l00363"></a>00363 qc_max_nonunif_id = 0,
+<a name="l00364"></a>00364 flux = FALSE,
+<a name="l00365"></a>00365 background = FALSE,
+<a name="l00366"></a>00366 suppress_extension = FALSE,
+<a name="l00367"></a>00367 mhalf = 3, <span class="comment">//width of median filter is mhalf*2 + 1</span>
+<a name="l00368"></a>00368 boxsize = 0,
+<a name="l00369"></a>00369 i = 0, j = 0, ix = 0, iy = 0, det_nr = 0,
+<a name="l00370"></a>00370 firstx = 0, lastx = 0, firsty = 0, lasty = 0,
+<a name="l00371"></a>00371 xmin = 0, xmax = 0, ymin = 0, ymax = 0;
+<a name="l00372"></a>00372 <span class="keyword">const</span> <span class="keywordtype">int</span> *punused_ifus = NULL;
+<a name="l00373"></a>00373 <span class="keywordtype">float</span> *pbad_pix_mask = NULL,
+<a name="l00374"></a>00374 *pdata = NULL,
+<a name="l00375"></a>00375 *pnoise = NULL;
+<a name="l00376"></a>00376 <span class="keywordtype">double</span> exptime = 0.,
+<a name="l00377"></a>00377 cpos_rej = 0.0,
+<a name="l00378"></a>00378 cneg_rej = 0.0,
+<a name="l00379"></a>00379 neighborhoodRange = 1.001,
+<a name="l00380"></a>00380 mean_data = 0.0,
+<a name="l00381"></a>00381 qc_spat_unif = 0.0,
+<a name="l00382"></a>00382 qc_max_dev = 0.0,
+<a name="l00383"></a>00383 qc_max_nonunif = 0.0,
+<a name="l00384"></a>00384 tmp_stdev = 0.0,
+<a name="l00385"></a>00385 tmp_mean = 0.0,
+<a name="l00386"></a>00386 rotangle = 0.0,
+<a name="l00387"></a>00387 tmp_rotangle = 0.0,
+<a name="l00388"></a>00388 rotangle_found = 0.0,
+<a name="l00389"></a>00389 pix_scale = 0.0;
+<a name="l00390"></a>00390 <span class="keywordtype">char</span> *keyword = NULL,
+<a name="l00391"></a>00391 *fn_lut = NULL,
+<a name="l00392"></a>00392 *suffix = NULL,
+<a name="l00393"></a>00393 *fn_suffix = NULL,
+<a name="l00394"></a>00394 *extname = NULL,
+<a name="l00395"></a>00395 *filter = NULL,
+<a name="l00396"></a>00396 content[256];
+<a name="l00397"></a>00397 <span class="keyword">const</span> <span class="keywordtype">char</span> *method = NULL,
+<a name="l00398"></a>00398 *cmethod = NULL,
+<a name="l00399"></a>00399 *filter_id_l = NULL,
+<a name="l00400"></a>00400 *filter_id = NULL,
+<a name="l00401"></a>00401 *tmp_str = NULL;
+<a name="l00402"></a>00402 cpl_array *calTimestamp = NULL,
+<a name="l00403"></a>00403 **unused_ifus_before = NULL,
+<a name="l00404"></a>00404 **unused_ifus_after = NULL;
+<a name="l00405"></a>00405 cpl_frame *frame = NULL,
+<a name="l00406"></a>00406 *xcalFrame = NULL,
+<a name="l00407"></a>00407 *ycalFrame = NULL,
+<a name="l00408"></a>00408 *lcalFrame = NULL;
+<a name="l00409"></a>00409 cpl_image *img_in = NULL,
+<a name="l00410"></a>00410 *img_dark = NULL,
+<a name="l00411"></a>00411 *img_flat = NULL,
+<a name="l00412"></a>00412 *combined_data = NULL,
+<a name="l00413"></a>00413 *xcal = NULL,
+<a name="l00414"></a>00414 *ycal = NULL,
+<a name="l00415"></a>00415 *lcal = NULL,
+<a name="l00416"></a>00416 *bad_pix_mask = NULL,
+<a name="l00417"></a>00417 *data_ifu = NULL,
+<a name="l00418"></a>00418 *noise_ifu = NULL,
+<a name="l00419"></a>00419 **stored_data_images = NULL,
+<a name="l00420"></a>00420 **stored_noise_images = NULL,
+<a name="l00421"></a>00421 *tmp_img = NULL;
+<a name="l00422"></a>00422 cpl_imagelist *cube_data = NULL,
+<a name="l00423"></a>00423 *detector_in = NULL,
+<a name="l00424"></a>00424 **stored_data_cubes = NULL;
+<a name="l00425"></a>00425 cpl_propertylist *main_header = NULL,
+<a name="l00426"></a>00426 *tmp_header = NULL,
+<a name="l00427"></a>00427 *sub_header = NULL,
+<a name="l00428"></a>00428 **stored_sub_headers = NULL;
+<a name="l00429"></a>00429 cpl_table *band_table = NULL;
+<a name="l00430"></a>00430 cpl_vector *identified_slices = NULL,
+<a name="l00431"></a>00431 *calAngles = NULL;
+<a name="l00432"></a>00432 main_fits_desc desc_sky,
+<a name="l00433"></a>00433 desc_xcal,
+<a name="l00434"></a>00434 desc_ycal,
+<a name="l00435"></a>00435 desc_lcal;
+<a name="l00436"></a>00436 gridDefinition gd;
+<a name="l00437"></a>00437 <span class="keyword">enum</span> kmo_frame_type fr_type;
+<a name="l00438"></a>00438
+<a name="l00439"></a>00439 KMO_TRY
+<a name="l00440"></a>00440 {
+<a name="l00441"></a>00441 kmo_init_fits_desc(&desc_sky);
+<a name="l00442"></a>00442 kmo_init_fits_desc(&desc_xcal);
+<a name="l00443"></a>00443 kmo_init_fits_desc(&desc_ycal);
+<a name="l00444"></a>00444 kmo_init_fits_desc(&desc_lcal);
+<a name="l00445"></a>00445
+<a name="l00446"></a>00446 <span class="comment">/* --- check input --- */</span>
+<a name="l00447"></a>00447 KMO_TRY_ASSURE((parlist != NULL) &&
+<a name="l00448"></a>00448 (frameset != NULL),
+<a name="l00449"></a>00449 CPL_ERROR_NULL_INPUT,
+<a name="l00450"></a>00450 <span class="stringliteral">"Not all input data is provided!"</span>);
+<a name="l00451"></a>00451
+<a name="l00452"></a>00452 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, FLAT_SKY_FLAT) >= 1,
+<a name="l00453"></a>00453 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00454"></a>00454 <span class="stringliteral">"One or more FLAT_SKY_FLAT frames are required!"</span>);
+<a name="l00455"></a>00455
+<a name="l00456"></a>00456 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, FLAT_SKY_FLAT) < 3) {
+<a name="l00457"></a>00457 cpl_msg_warning(cpl_func, <span class="stringliteral">"It is recommended to provide at least "</span>
+<a name="l00458"></a>00458 <span class="stringliteral">"3 FLAT_SKY_FLAT frames!"</span>);
+<a name="l00459"></a>00459 }
+<a name="l00460"></a>00460
+<a name="l00461"></a>00461 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, XCAL) == 1,
+<a name="l00462"></a>00462 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00463"></a>00463 <span class="stringliteral">"Exactly one XCAL frame is required!"</span>);
+<a name="l00464"></a>00464
+<a name="l00465"></a>00465 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, YCAL) == 1,
+<a name="l00466"></a>00466 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00467"></a>00467 <span class="stringliteral">"Exactly one YCAL frame is required!"</span>);
+<a name="l00468"></a>00468
+<a name="l00469"></a>00469 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, LCAL) == 1,
+<a name="l00470"></a>00470 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00471"></a>00471 <span class="stringliteral">"Exactly one LCAL frame is required!"</span>);
+<a name="l00472"></a>00472
+<a name="l00473"></a>00473 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, WAVE_BAND) == 1,
+<a name="l00474"></a>00474 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00475"></a>00475 <span class="stringliteral">"Exactly one WAVE_BAND frame is required!"</span>);
+<a name="l00476"></a>00476
+<a name="l00477"></a>00477 KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, <span class="stringliteral">"kmo_illumination_flat"</span>) == 1,
+<a name="l00478"></a>00478 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00479"></a>00479 <span class="stringliteral">"Cannot identify RAW and CALIB frames!"</span>);
+<a name="l00480"></a>00480
+<a name="l00481"></a>00481 <span class="comment">/* --- get parameters --- */</span>
+<a name="l00482"></a>00482 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"--- Parameter setup for kmo_illumination_flat ---"</span>);
+<a name="l00483"></a>00483
+<a name="l00484"></a>00484 KMO_TRY_EXIT_IF_NULL(
+<a name="l00485"></a>00485 method = kmo_dfs_get_parameter_string(parlist, <span class="stringliteral">"kmos.kmo_illumination_flat.imethod"</span>));
+<a name="l00486"></a>00486
+<a name="l00487"></a>00487 KMO_TRY_ASSURE((strcmp(method, <span class="stringliteral">"NN"</span>) == 0) ||
+<a name="l00488"></a>00488 (strcmp(method, <span class="stringliteral">"lwNN"</span>) == 0) ||
+<a name="l00489"></a>00489 (strcmp(method, <span class="stringliteral">"swNN"</span>) == 0) ||
+<a name="l00490"></a>00490 (strcmp(method, <span class="stringliteral">"MS"</span>) == 0) ||
+<a name="l00491"></a>00491 (strcmp(method, <span class="stringliteral">"CS"</span>) == 0),
+<a name="l00492"></a>00492 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00493"></a>00493 <span class="stringliteral">"method must be either \"NN\", \"lwNN\", "</span>
+<a name="l00494"></a>00494 <span class="stringliteral">"\"swNN\", \"MS\" or \"CS\"!"</span>);
+<a name="l00495"></a>00495
+<a name="l00496"></a>00496 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00497"></a>00497 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_illumination_flat.imethod"</span>));
+<a name="l00498"></a>00498
+<a name="l00499"></a>00499 neighborhoodRange = kmo_dfs_get_parameter_double(parlist, <span class="stringliteral">"kmos.kmo_illumination_flat.neighborhoodRange"</span>);
+<a name="l00500"></a>00500 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00501"></a>00501
+<a name="l00502"></a>00502 KMO_TRY_ASSURE(neighborhoodRange > 0.0,
+<a name="l00503"></a>00503 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00504"></a>00504 <span class="stringliteral">"neighborhoodRange must be greater than 0.0"</span>);
+<a name="l00505"></a>00505
+<a name="l00506"></a>00506 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00507"></a>00507 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_illumination_flat.neighborhoodRange"</span>));
+<a name="l00508"></a>00508
+<a name="l00509"></a>00509 flux = kmo_dfs_get_parameter_bool(parlist, <span class="stringliteral">"kmos.kmo_illumination_flat.flux"</span>);
+<a name="l00510"></a>00510 KMO_TRY_ASSURE((flux == 0) || (flux == 1),
+<a name="l00511"></a>00511 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00512"></a>00512 <span class="stringliteral">"flux must be either FALSE or TRUE!"</span>);
+<a name="l00513"></a>00513 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00514"></a>00514 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_illumination_flat.flux"</span>));
+<a name="l00515"></a>00515
+<a name="l00516"></a>00516 pix_scale = kmo_dfs_get_parameter_double(parlist, <span class="stringliteral">"kmos.kmo_illumination_flat.pix_scale"</span>);
+<a name="l00517"></a>00517 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00518"></a>00518 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00519"></a>00519 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_illumination_flat.pix_scale"</span>));
+<a name="l00520"></a>00520 KMO_TRY_ASSURE((pix_scale >= 0.01) && (pix_scale <= 0.4),
+<a name="l00521"></a>00521 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00522"></a>00522 <span class="stringliteral">"pix_scale must be between 0.01 and 0.4 (results in cubes "</span>
+<a name="l00523"></a>00523 <span class="stringliteral">"with 7x7 to 280x280 pixels)!"</span>);
+<a name="l00524"></a>00524
+<a name="l00525"></a>00525 suppress_extension = kmo_dfs_get_parameter_bool(parlist, <span class="stringliteral">"kmos.kmo_illumination_flat.suppress_extension"</span>);
+<a name="l00526"></a>00526 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00527"></a>00527 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00528"></a>00528 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_illumination_flat.suppress_extension"</span>));
+<a name="l00529"></a>00529
+<a name="l00530"></a>00530 KMO_TRY_ASSURE((suppress_extension == TRUE) || (suppress_extension == FALSE),
+<a name="l00531"></a>00531 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00532"></a>00532 <span class="stringliteral">"suppress_extension must be TRUE or FALSE!"</span>);
+<a name="l00533"></a>00533
+<a name="l00534"></a>00534 kmo_band_pars_load(parlist, <span class="stringliteral">"kmos.kmo_illumination_flat"</span>);
+<a name="l00535"></a>00535
+<a name="l00536"></a>00536 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00537"></a>00537 kmo_combine_pars_load(parlist, <span class="stringliteral">"kmos.kmo_illumination_flat"</span>,
+<a name="l00538"></a>00538 &cmethod, &cpos_rej, &cneg_rej,
+<a name="l00539"></a>00539 &citer, &cmin, &cmax, FALSE));
+<a name="l00540"></a>00540 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
+<a name="l00541"></a>00541
+<a name="l00542"></a>00542 <span class="comment">// check if filter_id, grating_id and rotator offset match for all</span>
+<a name="l00543"></a>00543 <span class="comment">// detectors</span>
+<a name="l00544"></a>00544 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00545"></a>00545 kmo_check_frameset_setup(frameset, FLAT_SKY_FLAT, TRUE, FALSE, TRUE));
+<a name="l00546"></a>00546 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00547"></a>00547 kmo_check_frame_setup(frameset, FLAT_SKY_FLAT, XCAL, TRUE, FALSE, TRUE));
+<a name="l00548"></a>00548 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00549"></a>00549 kmo_check_frame_setup(frameset, XCAL, YCAL, TRUE, FALSE, TRUE));
+<a name="l00550"></a>00550 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00551"></a>00551 kmo_check_frame_setup(frameset, XCAL, LCAL, TRUE, FALSE, TRUE));
+<a name="l00552"></a>00552
+<a name="l00553"></a>00553 KMO_TRY_EXIT_IF_NULL(
+<a name="l00554"></a>00554 frame = kmo_dfs_get_frame(frameset, XCAL));
+<a name="l00555"></a>00555 KMO_TRY_EXIT_IF_NULL(
+<a name="l00556"></a>00556 suffix = kmo_dfs_get_suffix(frame, TRUE, FALSE));
+<a name="l00557"></a>00557
+<a name="l00558"></a>00558 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00559"></a>00559 kmo_check_frame_setup_md5_xycal(frameset));
+<a name="l00560"></a>00560 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00561"></a>00561 kmo_check_frame_setup_md5(frameset));
+<a name="l00562"></a>00562
+<a name="l00563"></a>00563 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Detected instrument setup: %s"</span>, suffix+1);
+<a name="l00564"></a>00564 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"(grating 1, 2 & 3)"</span>);
+<a name="l00565"></a>00565
+<a name="l00566"></a>00566 <span class="comment">// check which IFUs are active for all frames</span>
+<a name="l00567"></a>00567 KMO_TRY_EXIT_IF_NULL(
+<a name="l00568"></a>00568 unused_ifus_before = kmo_get_unused_ifus(frameset, 0, 0));
+<a name="l00569"></a>00569
+<a name="l00570"></a>00570 KMO_TRY_EXIT_IF_NULL(
+<a name="l00571"></a>00571 unused_ifus_after = kmo_duplicate_unused_ifus(unused_ifus_before));
+<a name="l00572"></a>00572
+<a name="l00573"></a>00573 kmo_print_unused_ifus(unused_ifus_before, FALSE);
+<a name="l00574"></a>00574
+<a name="l00575"></a>00575 <span class="comment">// load desc for XCAL and check</span>
+<a name="l00576"></a>00576 KMO_TRY_EXIT_IF_NULL(
+<a name="l00577"></a>00577 xcalFrame = kmo_dfs_get_frame(frameset, XCAL));
+<a name="l00578"></a>00578 desc_xcal = kmo_identify_fits_header(cpl_frame_get_filename(xcalFrame));
+<a name="l00579"></a>00579 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"XCAL frame doesn't seem to "</span>
+<a name="l00580"></a>00580 <span class="stringliteral">"be in KMOS-format!"</span>);
+<a name="l00581"></a>00581 KMO_TRY_ASSURE((desc_xcal.nr_ext % KMOS_NR_DETECTORS == 0) &&
+<a name="l00582"></a>00582 (desc_xcal.ex_badpix == FALSE) &&
+<a name="l00583"></a>00583 (desc_xcal.fits_type == f2d_fits) &&
+<a name="l00584"></a>00584 (desc_xcal.frame_type == detector_frame),
+<a name="l00585"></a>00585 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00586"></a>00586 <span class="stringliteral">"XCAL isn't in the correct format!!!"</span>);
+<a name="l00587"></a>00587 nx = desc_xcal.naxis1;
+<a name="l00588"></a>00588 ny = desc_xcal.naxis2;
+<a name="l00589"></a>00589 nr_devices = desc_xcal.nr_ext;
+<a name="l00590"></a>00590
+<a name="l00591"></a>00591 <span class="comment">// load desc for YCAL and check</span>
+<a name="l00592"></a>00592 KMO_TRY_EXIT_IF_NULL(
+<a name="l00593"></a>00593 ycalFrame = kmo_dfs_get_frame(frameset, YCAL));
+<a name="l00594"></a>00594 desc_ycal = kmo_identify_fits_header(cpl_frame_get_filename(ycalFrame));
+<a name="l00595"></a>00595 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"YCAL frame doesn't seem to "</span>
+<a name="l00596"></a>00596 <span class="stringliteral">"be in KMOS-format!"</span>);
+<a name="l00597"></a>00597 KMO_TRY_ASSURE((desc_ycal.nr_ext == desc_xcal.nr_ext) &&
+<a name="l00598"></a>00598 (desc_ycal.ex_badpix == desc_xcal.ex_badpix) &&
+<a name="l00599"></a>00599 (desc_ycal.fits_type == desc_xcal.fits_type) &&
+<a name="l00600"></a>00600 (desc_ycal.frame_type == desc_xcal.frame_type),
+<a name="l00601"></a>00601 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00602"></a>00602 <span class="stringliteral">"YCAL isn't in the correct format!!!"</span>);
+<a name="l00603"></a>00603 KMO_TRY_ASSURE((desc_ycal.naxis1 == desc_xcal.naxis1) &&
+<a name="l00604"></a>00604 (desc_ycal.naxis2 == desc_xcal.naxis2),
+<a name="l00605"></a>00605 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00606"></a>00606 <span class="stringliteral">"XCAL and YCAL frame haven't same dimensions! "</span>
+<a name="l00607"></a>00607 <span class="stringliteral">"(x,y): (%d,%d) vs (%d,%d)"</span>,
+<a name="l00608"></a>00608 nx, ny, desc_ycal.naxis1, desc_ycal.naxis2);
+<a name="l00609"></a>00609
+<a name="l00610"></a>00610 <span class="comment">// load desc for LCAL and check</span>
+<a name="l00611"></a>00611 KMO_TRY_EXIT_IF_NULL(
+<a name="l00612"></a>00612 lcalFrame = kmo_dfs_get_frame(frameset, LCAL));
+<a name="l00613"></a>00613 desc_lcal = kmo_identify_fits_header(cpl_frame_get_filename(lcalFrame));
+<a name="l00614"></a>00614 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"LCAL frame doesn't seem to "</span>
+<a name="l00615"></a>00615 <span class="stringliteral">"be in KMOS-format!"</span>);
+<a name="l00616"></a>00616 KMO_TRY_ASSURE((desc_lcal.ex_badpix == desc_xcal.ex_badpix) &&
+<a name="l00617"></a>00617 (desc_lcal.fits_type == desc_xcal.fits_type) &&
+<a name="l00618"></a>00618 (desc_lcal.frame_type == desc_xcal.frame_type),
+<a name="l00619"></a>00619 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00620"></a>00620 <span class="stringliteral">"LCAL isn't in the correct format!!!"</span>);
+<a name="l00621"></a>00621 KMO_TRY_ASSURE((desc_lcal.naxis1 == desc_xcal.naxis1) &&
+<a name="l00622"></a>00622 (desc_lcal.naxis2 == desc_xcal.naxis2),
+<a name="l00623"></a>00623 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00624"></a>00624 <span class="stringliteral">"XCAL and LCAL frame haven't same dimensions! "</span>
+<a name="l00625"></a>00625 <span class="stringliteral">"(x,y): (%d,%d) vs (%d,%d)"</span>,
+<a name="l00626"></a>00626 nx, ny, desc_lcal.naxis1, desc_lcal.naxis2);
+<a name="l00627"></a>00627 KMO_TRY_EXIT_IF_NULL(
+<a name="l00628"></a>00628 tmp_header = kmo_dfs_load_primary_header(frameset, LCAL));
+<a name="l00629"></a>00629
+<a name="l00630"></a>00630 <span class="comment">// load desc for FLAT_SKY_FLAT and check</span>
+<a name="l00631"></a>00631 nr_devices = KMOS_NR_DETECTORS;
+<a name="l00632"></a>00632 KMO_TRY_EXIT_IF_NULL(
+<a name="l00633"></a>00633 frame = kmo_dfs_get_frame(frameset, FLAT_SKY_FLAT));
+<a name="l00634"></a>00634
+<a name="l00635"></a>00635 KMO_TRY_EXIT_IF_NULL(
+<a name="l00636"></a>00636 main_header = kmclipm_propertylist_load(
+<a name="l00637"></a>00637 cpl_frame_get_filename(frame), 0));
+<a name="l00638"></a>00638 rotangle = cpl_propertylist_get_double(main_header, ROTANGLE);
+<a name="l00639"></a>00639 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"Cannot retrieve ROTANGLE FITS keyword from sky frame!"</span>);
+<a name="l00640"></a>00640 kmclipm_strip_angle(&rotangle);
+<a name="l00641"></a>00641 exptime = cpl_propertylist_get_double(main_header, EXPTIME);
+<a name="l00642"></a>00642 KMO_TRY_CHECK_ERROR_STATE(<span class="stringliteral">"EXPTIME keyword in main header "</span>
+<a name="l00643"></a>00643 <span class="stringliteral">"missing!"</span>);
+<a name="l00644"></a>00644 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l00645"></a>00645
+<a name="l00646"></a>00646 cnt = 1;
+<a name="l00647"></a>00647 <span class="keywordflow">while</span> (frame != NULL) {
+<a name="l00648"></a>00648 KMO_TRY_EXIT_IF_NULL(
+<a name="l00649"></a>00649 main_header = kmclipm_propertylist_load(
+<a name="l00650"></a>00650 cpl_frame_get_filename(frame), 0));
+<a name="l00651"></a>00651
+<a name="l00652"></a>00652 desc_sky = kmo_identify_fits_header(
+<a name="l00653"></a>00653 cpl_frame_get_filename(frame));
+<a name="l00654"></a>00654 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"FLAT_SKY_FLAT frame doesn't seem to "</span>
+<a name="l00655"></a>00655 <span class="stringliteral">"be in KMOS-format!"</span>);
+<a name="l00656"></a>00656 KMO_TRY_ASSURE((desc_sky.nr_ext == 3) &&
+<a name="l00657"></a>00657 (desc_sky.ex_badpix == FALSE) &&
+<a name="l00658"></a>00658 (desc_sky.fits_type == raw_fits) &&
+<a name="l00659"></a>00659 (desc_sky.frame_type == detector_frame),
+<a name="l00660"></a>00660 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00661"></a>00661 <span class="stringliteral">"FLAT_SKY_FLAT isn't in the correct format!!!"</span>);
+<a name="l00662"></a>00662 kmo_free_fits_desc(&desc_sky);
+<a name="l00663"></a>00663 kmo_init_fits_desc(&desc_sky);
+<a name="l00664"></a>00664
+<a name="l00665"></a>00665 KMO_TRY_ASSURE(
+<a name="l00666"></a>00666 (kmo_check_lamp(main_header, INS_LAMP1_ST) == FALSE) &&
+<a name="l00667"></a>00667 (kmo_check_lamp(main_header, INS_LAMP2_ST) == FALSE),
+<a name="l00668"></a>00668 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00669"></a>00669 <span class="stringliteral">"Arc lamps must be switched off!"</span>);
+<a name="l00670"></a>00670
+<a name="l00671"></a>00671 KMO_TRY_ASSURE(cpl_propertylist_get_double(main_header, EXPTIME) == exptime,
+<a name="l00672"></a>00672 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00673"></a>00673 <span class="stringliteral">"EXPTIME isn't the same for all frames: (is %g and %g)."</span>,
+<a name="l00674"></a>00674 cpl_propertylist_get_double(main_header, EXPTIME), exptime);
+<a name="l00675"></a>00675
+<a name="l00676"></a>00676 <span class="comment">// assert that filters have correct IDs and that all detectors of</span>
+<a name="l00677"></a>00677 <span class="comment">// all input frames have the same filter set</span>
+<a name="l00678"></a>00678 <span class="keywordflow">for</span> (i = 1; i <= KMOS_NR_DETECTORS; i++) {
+<a name="l00679"></a>00679 <span class="comment">// ESO INS FILTi ID</span>
+<a name="l00680"></a>00680 KMO_TRY_EXIT_IF_NULL(
+<a name="l00681"></a>00681 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_FILTID_PREFIX, i, IFU_FILTID_POSTFIX));
+<a name="l00682"></a>00682 KMO_TRY_EXIT_IF_NULL(
+<a name="l00683"></a>00683 filter_id = cpl_propertylist_get_string(main_header, keyword));
+<a name="l00684"></a>00684
+<a name="l00685"></a>00685 KMO_TRY_EXIT_IF_NULL(
+<a name="l00686"></a>00686 filter_id_l = cpl_propertylist_get_string(tmp_header, keyword));
+<a name="l00687"></a>00687 cpl_free(keyword); keyword = NULL;
+<a name="l00688"></a>00688
+<a name="l00689"></a>00689 KMO_TRY_ASSURE((strcmp(filter_id, <span class="stringliteral">"IZ"</span>) == 0) ||
+<a name="l00690"></a>00690 (strcmp(filter_id, <span class="stringliteral">"YJ"</span>) == 0) ||
+<a name="l00691"></a>00691 (strcmp(filter_id, <span class="stringliteral">"H"</span>) == 0) ||
+<a name="l00692"></a>00692 (strcmp(filter_id, <span class="stringliteral">"K"</span>) == 0) ||
+<a name="l00693"></a>00693 (strcmp(filter_id, <span class="stringliteral">"HK"</span>) == 0),
+<a name="l00694"></a>00694 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00695"></a>00695 <span class="stringliteral">"Filter ID in primary header must be either 'IZ', "</span>
+<a name="l00696"></a>00696 <span class="stringliteral">"'YJ', 'H', 'K' or "</span> <span class="stringliteral">"'HK' !"</span>);
+<a name="l00697"></a>00697
+<a name="l00698"></a>00698 KMO_TRY_ASSURE(strcmp(filter_id, filter_id_l) == 0,
+<a name="l00699"></a>00699 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00700"></a>00700 <span class="stringliteral">"Filter IDs must be the same for FLAT_SKY_FLAT frame"</span>
+<a name="l00701"></a>00701 <span class="stringliteral">" and lcal frame!"</span>
+<a name="l00702"></a>00702 <span class="stringliteral">"Detector No.: %d\n%s: %s\nLCAL: %s\n"</span>,
+<a name="l00703"></a>00703 i, cpl_frame_get_filename(frame),
+<a name="l00704"></a>00704 filter_id, filter_id_l);
+<a name="l00705"></a>00705
+<a name="l00706"></a>00706 <span class="comment">// ESO INS GRATi ID</span>
+<a name="l00707"></a>00707 KMO_TRY_EXIT_IF_NULL(
+<a name="l00708"></a>00708 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_GRATID_PREFIX, i, IFU_GRATID_POSTFIX));
+<a name="l00709"></a>00709 KMO_TRY_EXIT_IF_NULL(
+<a name="l00710"></a>00710 filter_id = cpl_propertylist_get_string(main_header, keyword));
+<a name="l00711"></a>00711
+<a name="l00712"></a>00712 KMO_TRY_EXIT_IF_NULL(
+<a name="l00713"></a>00713 filter_id_l = cpl_propertylist_get_string(tmp_header, keyword));
+<a name="l00714"></a>00714 cpl_free(keyword); keyword = NULL;
+<a name="l00715"></a>00715
+<a name="l00716"></a>00716 KMO_TRY_ASSURE((strcmp(filter_id, <span class="stringliteral">"IZ"</span>) == 0) ||
+<a name="l00717"></a>00717 (strcmp(filter_id, <span class="stringliteral">"YJ"</span>) == 0) ||
+<a name="l00718"></a>00718 (strcmp(filter_id, <span class="stringliteral">"H"</span>) == 0) ||
+<a name="l00719"></a>00719 (strcmp(filter_id, <span class="stringliteral">"K"</span>) == 0) ||
+<a name="l00720"></a>00720 (strcmp(filter_id, <span class="stringliteral">"HK"</span>) == 0),
+<a name="l00721"></a>00721 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00722"></a>00722 <span class="stringliteral">"Grating ID in primary header must be either "</span>
+<a name="l00723"></a>00723 <span class="stringliteral">"'IZ', 'YJ', 'H', 'K' or "</span> <span class="stringliteral">"'HK' !"</span>);
+<a name="l00724"></a>00724
+<a name="l00725"></a>00725 KMO_TRY_ASSURE(strcmp(filter_id, filter_id_l) == 0,
+<a name="l00726"></a>00726 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00727"></a>00727 <span class="stringliteral">"Grating IDs must be the same for FLAT_SKY_FLAT frame"</span>
+<a name="l00728"></a>00728 <span class="stringliteral">" and lcal frame!"</span>
+<a name="l00729"></a>00729 <span class="stringliteral">"Detector No.: %d\n%s: %s\nLCAL: %s\n"</span>,
+<a name="l00730"></a>00730 i, cpl_frame_get_filename(frame),
+<a name="l00731"></a>00731 filter_id, filter_id_l);
+<a name="l00732"></a>00732
+<a name="l00733"></a>00733 tmp_rotangle = cpl_propertylist_get_double(main_header, ROTANGLE);
+<a name="l00734"></a>00734 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"Cannot retrieve ROTANGLE FITS keyword from sky frame!"</span>);
+<a name="l00735"></a>00735 kmclipm_strip_angle(&tmp_rotangle);
+<a name="l00736"></a>00736 KMO_TRY_ASSURE((abs(rotangle - tmp_rotangle) < 10.0) ||
+<a name="l00737"></a>00737 (abs(rotangle - tmp_rotangle) > 360.-10.) ,
+<a name="l00738"></a>00738 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00739"></a>00739 <span class="stringliteral">"OCS ROT NAANGLE of sky flat frames differ too much: %f %f"</span>,
+<a name="l00740"></a>00740 rotangle, tmp_rotangle);
+<a name="l00741"></a>00741 }
+<a name="l00742"></a>00742 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l00743"></a>00743
+<a name="l00744"></a>00744 <span class="comment">// get next FLAT_SKY_FLAT frame</span>
+<a name="l00745"></a>00745 frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l00746"></a>00746 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00747"></a>00747 cnt++;
+<a name="l00748"></a>00748 }
+<a name="l00749"></a>00749
+<a name="l00750"></a>00750 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l00751"></a>00751
+<a name="l00752"></a>00752 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, FLAT_SKY_FLAT) == 1) {
+<a name="l00753"></a>00753 cpl_msg_warning(cpl_func, <span class="stringliteral">"cmethod is changed to 'average' "</span>
+<a name="l00754"></a>00754 <span class="stringliteral">"since there is only one input frame! (The output "</span>
+<a name="l00755"></a>00755 <span class="stringliteral">"file won't have any noise extensions)"</span>);
+<a name="l00756"></a>00756
+<a name="l00757"></a>00757 cmethod = <span class="stringliteral">"average"</span>;
+<a name="l00758"></a>00758 }
+<a name="l00759"></a>00759
+<a name="l00760"></a>00760 KMO_TRY_EXIT_IF_NULL(
+<a name="l00761"></a>00761 frame = kmo_dfs_get_frame(frameset, FLAT_SKY_FLAT));
+<a name="l00762"></a>00762 KMO_TRY_EXIT_IF_NULL(
+<a name="l00763"></a>00763 main_header = kmo_dfs_load_primary_header(frameset, FLAT_SKY_FLAT));
+<a name="l00764"></a>00764 KMO_TRY_EXIT_IF_NULL(
+<a name="l00765"></a>00765 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_GRATID_PREFIX, 1, IFU_GRATID_POSTFIX));
+<a name="l00766"></a>00766 KMO_TRY_EXIT_IF_NULL(
+<a name="l00767"></a>00767 filter = cpl_sprintf(<span class="stringliteral">"%s"</span>, cpl_propertylist_get_string(main_header, keyword)));
+<a name="l00768"></a>00768 cpl_free(keyword); keyword = NULL;
+<a name="l00769"></a>00769
+<a name="l00770"></a>00770 <span class="comment">// setup grid definition, wavelength start and end points will be set</span>
+<a name="l00771"></a>00771 <span class="comment">// in the detector loop</span>
+<a name="l00772"></a>00772 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00773"></a>00773 kmclipm_setup_grid(&gd, method, neighborhoodRange, pix_scale, 0.));
+<a name="l00774"></a>00774
+<a name="l00775"></a>00775 <span class="comment">// create filename for LUT</span>
+<a name="l00776"></a>00776 KMO_TRY_EXIT_IF_NULL(
+<a name="l00777"></a>00777 fn_lut = cpl_sprintf(<span class="stringliteral">"%s%s"</span>, <span class="stringliteral">"lut"</span>, suffix));
+<a name="l00778"></a>00778
+<a name="l00779"></a>00779 <span class="comment">// extract bounds</span>
+<a name="l00780"></a>00780 KMO_TRY_EXIT_IF_NULL(
+<a name="l00781"></a>00781 tmp_header = kmo_dfs_load_primary_header(frameset, XCAL));
+<a name="l00782"></a>00782 KMO_TRY_EXIT_IF_NULL(
+<a name="l00783"></a>00783 bounds = kmclipm_extract_bounds(tmp_header));
+<a name="l00784"></a>00784 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l00785"></a>00785
+<a name="l00786"></a>00786 <span class="comment">// get timestamps of xcal, ycal & lcal</span>
+<a name="l00787"></a>00787 KMO_TRY_EXIT_IF_NULL(
+<a name="l00788"></a>00788 calTimestamp = kmo_get_timestamps(xcalFrame, ycalFrame, lcalFrame));
+<a name="l00789"></a>00789
+<a name="l00790"></a>00790 <span class="comment">// create arrays to hold reconstructed data and noise cubes and</span>
+<a name="l00791"></a>00791 <span class="comment">// their headers</span>
+<a name="l00792"></a>00792 KMO_TRY_EXIT_IF_NULL(
+<a name="l00793"></a>00793 stored_data_cubes = (cpl_imagelist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
+<a name="l00794"></a>00794 <span class="keyword">sizeof</span>(cpl_imagelist*)));
+<a name="l00795"></a>00795 KMO_TRY_EXIT_IF_NULL(
+<a name="l00796"></a>00796 stored_data_images = (cpl_image**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
+<a name="l00797"></a>00797 <span class="keyword">sizeof</span>(cpl_image*)));
+<a name="l00798"></a>00798 KMO_TRY_EXIT_IF_NULL(
+<a name="l00799"></a>00799 stored_noise_images = (cpl_image**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
+<a name="l00800"></a>00800 <span class="keyword">sizeof</span>(cpl_image*)));
+<a name="l00801"></a>00801 KMO_TRY_EXIT_IF_NULL(
+<a name="l00802"></a>00802 stored_sub_headers = (cpl_propertylist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
+<a name="l00803"></a>00803 <span class="keyword">sizeof</span>(cpl_propertylist*)));
+<a name="l00804"></a>00804 KMO_TRY_EXIT_IF_NULL(
+<a name="l00805"></a>00805 calAngles = cpl_vector_new(3));
+<a name="l00806"></a>00806
+<a name="l00807"></a>00807 <span class="comment">//</span>
+<a name="l00808"></a>00808 <span class="comment">// loop through all detectors</span>
+<a name="l00809"></a>00809 <span class="comment">//</span>
+<a name="l00810"></a>00810 <span class="keywordflow">for</span> (det_nr = 1; det_nr <= nr_devices; det_nr++) {
+<a name="l00811"></a>00811 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Processing detector No. %d"</span>, det_nr);
+<a name="l00812"></a>00812
+<a name="l00813"></a>00813 KMO_TRY_EXIT_IF_NULL(
+<a name="l00814"></a>00814 detector_in = cpl_imagelist_new());
+<a name="l00815"></a>00815
+<a name="l00816"></a>00816 <span class="comment">// load data of det_nr of all FLAT_SKY_FLAT frames into an imagelist</span>
+<a name="l00817"></a>00817 KMO_TRY_EXIT_IF_NULL(
+<a name="l00818"></a>00818 img_in = kmo_dfs_load_image(frameset, FLAT_SKY_FLAT, det_nr, FALSE, TRUE, NULL));
+<a name="l00819"></a>00819
+<a name="l00820"></a>00820 cnt = 0;
+<a name="l00821"></a>00821 <span class="keywordflow">while</span> (img_in != NULL) {
+<a name="l00822"></a>00822 cpl_imagelist_set(detector_in, img_in, cnt);
+<a name="l00823"></a>00823 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00824"></a>00824
+<a name="l00825"></a>00825 <span class="comment">/* load same extension of next FLAT_SKY_FLAT frame*/</span>
+<a name="l00826"></a>00826 img_in = kmo_dfs_load_image(frameset, NULL, det_nr, FALSE, TRUE, NULL);
+<a name="l00827"></a>00827 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00828"></a>00828
+<a name="l00829"></a>00829 cnt++;
+<a name="l00830"></a>00830 }
+<a name="l00831"></a>00831
+<a name="l00832"></a>00832 <span class="comment">//</span>
+<a name="l00833"></a>00833 <span class="comment">// process imagelist</span>
+<a name="l00834"></a>00834 <span class="comment">//</span>
+<a name="l00835"></a>00835
+<a name="l00836"></a>00836 <span class="comment">// combine imagelist (data only) and create noise (stdev of data)</span>
+<a name="l00837"></a>00837 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Combining frames..."</span>);
+<a name="l00838"></a>00838 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00839"></a>00839 kmclipm_combine_frames(detector_in,
+<a name="l00840"></a>00840 NULL,
+<a name="l00841"></a>00841 NULL,
+<a name="l00842"></a>00842 cmethod,
+<a name="l00843"></a>00843 cpos_rej,
+<a name="l00844"></a>00844 cneg_rej,
+<a name="l00845"></a>00845 citer,
+<a name="l00846"></a>00846 cmax,
+<a name="l00847"></a>00847 cmin,
+<a name="l00848"></a>00848 &combined_data,
+<a name="l00849"></a>00849 NULL,
+<a name="l00850"></a>00850 -1.0));
+<a name="l00851"></a>00851
+<a name="l00852"></a>00852 <span class="keywordflow">if</span> (img_dark == NULL) {
+<a name="l00853"></a>00853 KMO_TRY_EXIT_IF_NULL(
+<a name="l00854"></a>00854 img_dark = cpl_image_duplicate(combined_data));
+<a name="l00855"></a>00855 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00856"></a>00856 cpl_image_multiply_scalar(img_dark, 0));
+<a name="l00857"></a>00857 }
+<a name="l00858"></a>00858
+<a name="l00859"></a>00859 <span class="keywordflow">if</span> (img_flat == NULL) {
+<a name="l00860"></a>00860 KMO_TRY_EXIT_IF_NULL(
+<a name="l00861"></a>00861 img_flat = cpl_image_duplicate(combined_data));
+<a name="l00862"></a>00862 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00863"></a>00863 cpl_image_multiply_scalar(img_flat, 0));
+<a name="l00864"></a>00864 cpl_image_add_scalar(img_flat, 1);
+<a name="l00865"></a>00865 }
+<a name="l00866"></a>00866
+<a name="l00867"></a>00867 <span class="keywordflow">if</span> (kmclipm_omit_warning_one_slice > 10) {
+<a name="l00868"></a>00868 <span class="comment">// AA: commmented this out: Too unclear for the user, no benefit to know about this number</span>
+<a name="l00869"></a>00869 <span class="comment">// cpl_msg_warning(cpl_func, "Previous warning (number of "</span>
+<a name="l00870"></a>00870 <span class="comment">// "identified slices) occured %d times.",</span>
+<a name="l00871"></a>00871 <span class="comment">// kmclipm_omit_warning_one_slice);</span>
+<a name="l00872"></a>00872 kmclipm_omit_warning_one_slice = FALSE;
+<a name="l00873"></a>00873 }
+<a name="l00874"></a>00874
+<a name="l00875"></a>00875 cpl_imagelist_delete(detector_in); detector_in = NULL;
+<a name="l00876"></a>00876
+<a name="l00877"></a>00877 <span class="comment">// load calibration files</span>
+<a name="l00878"></a>00878 KMO_TRY_EXIT_IF_NULL(
+<a name="l00879"></a>00879 xcal = kmo_dfs_load_cal_image(frameset, XCAL, det_nr, FALSE, rotangle,
+<a name="l00880"></a>00880 FALSE, NULL, &rotangle_found, -1, 0, 0));
+<a name="l00881"></a>00881
+<a name="l00882"></a>00882 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00883"></a>00883 cpl_vector_set(calAngles, 0, rotangle_found));
+<a name="l00884"></a>00884 KMO_TRY_EXIT_IF_NULL(
+<a name="l00885"></a>00885 ycal = kmo_dfs_load_cal_image(frameset, YCAL, det_nr, FALSE, rotangle,
+<a name="l00886"></a>00886 FALSE, NULL, &rotangle_found, -1, 0, 0));
+<a name="l00887"></a>00887 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00888"></a>00888 cpl_vector_set(calAngles, 1, rotangle_found));
+<a name="l00889"></a>00889 KMO_TRY_EXIT_IF_NULL(
+<a name="l00890"></a>00890 lcal = kmo_dfs_load_cal_image(frameset, LCAL, det_nr, FALSE, rotangle,
+<a name="l00891"></a>00891 FALSE, NULL, &rotangle_found, -1, 0, 0));
+<a name="l00892"></a>00892 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00893"></a>00893 cpl_vector_set(calAngles, 2, rotangle_found));
+<a name="l00894"></a>00894
+<a name="l00895"></a>00895 <span class="comment">// load bad pixel mask from XCAL and set NaNs to 0 and all other values to 1</span>
+<a name="l00896"></a>00896 KMO_TRY_EXIT_IF_NULL(
+<a name="l00897"></a>00897 bad_pix_mask = cpl_image_duplicate(xcal));
+<a name="l00898"></a>00898
+<a name="l00899"></a>00899 KMO_TRY_EXIT_IF_NULL(
+<a name="l00900"></a>00900 pbad_pix_mask = cpl_image_get_data_float(bad_pix_mask));
+<a name="l00901"></a>00901 <span class="keywordflow">for</span> (ix = 0; ix < nx; ix++) {
+<a name="l00902"></a>00902 <span class="keywordflow">for</span> (iy = 0; iy < ny; iy++) {
+<a name="l00903"></a>00903 <span class="keywordflow">if</span> (isnan(pbad_pix_mask[ix+nx*iy])) {
+<a name="l00904"></a>00904 pbad_pix_mask[ix+nx*iy] = 0.;
+<a name="l00905"></a>00905 } <span class="keywordflow">else</span> {
+<a name="l00906"></a>00906 pbad_pix_mask[ix+nx*iy] = 1.;
+<a name="l00907"></a>00907 }
+<a name="l00908"></a>00908 }
+<a name="l00909"></a>00909 }
+<a name="l00910"></a>00910 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00911"></a>00911
+<a name="l00912"></a>00912 <span class="comment">//</span>
+<a name="l00913"></a>00913 <span class="comment">// reconstruct</span>
+<a name="l00914"></a>00914 <span class="comment">//</span>
+<a name="l00915"></a>00915 print_warning_once_reconstruct = FALSE;
+<a name="l00916"></a>00916
+<a name="l00917"></a>00917 <span class="keywordtype">char</span> *tmp_band_method = getenv(<span class="stringliteral">"KMO_BAND_METHOD"</span>);
+<a name="l00918"></a>00918 <span class="keywordtype">int</span> band_method = 0;
+<a name="l00919"></a>00919 <span class="keywordflow">if</span> (tmp_band_method != NULL) {
+<a name="l00920"></a>00920 band_method = atoi(tmp_band_method);
+<a name="l00921"></a>00921 }
+<a name="l00922"></a>00922
+<a name="l00923"></a>00923 <span class="comment">// ESO INS FILTi ID</span>
+<a name="l00924"></a>00924 KMO_TRY_EXIT_IF_NULL(
+<a name="l00925"></a>00925 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_FILTID_PREFIX, det_nr,
+<a name="l00926"></a>00926 IFU_FILTID_POSTFIX));
+<a name="l00927"></a>00927 KMO_TRY_EXIT_IF_NULL(
+<a name="l00928"></a>00928 filter_id = cpl_propertylist_get_string(main_header, keyword));
+<a name="l00929"></a>00929 cpl_free(keyword); keyword = NULL;
+<a name="l00930"></a>00930
+<a name="l00931"></a>00931 KMO_TRY_EXIT_IF_NULL(
+<a name="l00932"></a>00932 band_table = kmo_dfs_load_table(frameset, WAVE_BAND, 1, 0));
+<a name="l00933"></a>00933 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00934"></a>00934 kmclipm_setup_grid_band_lcal(&gd, lcal, filter_id, band_method,
+<a name="l00935"></a>00935 band_table));
+<a name="l00936"></a>00936 cpl_table_delete(band_table); band_table = NULL;
+<a name="l00937"></a>00937
+<a name="l00938"></a>00938 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Reconstructing cubes..."</span>);
+<a name="l00939"></a>00939 <span class="keywordflow">for</span> (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l00940"></a>00940 <span class="comment">// update sub-header</span>
+<a name="l00941"></a>00941 ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + i + 1;
+<a name="l00942"></a>00942
+<a name="l00943"></a>00943 <span class="comment">// load raw image and sub-header</span>
+<a name="l00944"></a>00944 KMO_TRY_EXIT_IF_NULL(
+<a name="l00945"></a>00945 sub_header = kmo_dfs_load_sub_header(frameset, FLAT_SKY_FLAT,
+<a name="l00946"></a>00946 det_nr, FALSE));
+<a name="l00947"></a>00947
+<a name="l00948"></a>00948 KMO_TRY_EXIT_IF_NULL(
+<a name="l00949"></a>00949 punused_ifus = cpl_array_get_data_int_const(
+<a name="l00950"></a>00950 unused_ifus_after[det_nr-1]));
+<a name="l00951"></a>00951
+<a name="l00952"></a>00952 <span class="comment">// check if IFU is valid according to main header keywords &</span>
+<a name="l00953"></a>00953 <span class="comment">// calibration files</span>
+<a name="l00954"></a>00954 KMO_TRY_EXIT_IF_NULL(
+<a name="l00955"></a>00955 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_VALID_PREFIX, ifu_nr,
+<a name="l00956"></a>00956 IFU_VALID_POSTFIX));
+<a name="l00957"></a>00957 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00958"></a>00958
+<a name="l00959"></a>00959 <span class="comment">// just to see if keyword exists</span>
+<a name="l00960"></a>00960 cpl_propertylist_get_string(main_header, keyword);
+<a name="l00961"></a>00961 cpl_free(keyword); keyword = NULL;
+<a name="l00962"></a>00962
+<a name="l00963"></a>00963 <span class="keywordflow">if</span> ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) &&
+<a name="l00964"></a>00964 (bounds[2*(ifu_nr-1)] != -1) &&
+<a name="l00965"></a>00965 (bounds[2*(ifu_nr-1)+1] != -1) &&
+<a name="l00966"></a>00966 (punused_ifus[i] == 0))
+<a name="l00967"></a>00967 {
+<a name="l00968"></a>00968 <span class="comment">// IFU is valid</span>
+<a name="l00969"></a>00969 cpl_error_reset();
+<a name="l00970"></a>00970
+<a name="l00971"></a>00971 <span class="comment">// calculate WCS</span>
+<a name="l00972"></a>00972 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00973"></a>00973 kmo_calc_wcs_gd(main_header, sub_header, ifu_nr, gd));
+<a name="l00974"></a>00974
+<a name="l00975"></a>00975 <span class="comment">// reconstruct data</span>
+<a name="l00976"></a>00976 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00977"></a>00977 kmo_reconstruct_sci_image(ifu_nr,
+<a name="l00978"></a>00978 bounds[2*(ifu_nr-1)],
+<a name="l00979"></a>00979 bounds[2*(ifu_nr-1)+1],
+<a name="l00980"></a>00980 combined_data,
+<a name="l00981"></a>00981 NULL,
+<a name="l00982"></a>00982 img_dark,
+<a name="l00983"></a>00983 NULL,
+<a name="l00984"></a>00984 img_flat,
+<a name="l00985"></a>00985 NULL,
+<a name="l00986"></a>00986 xcal,
+<a name="l00987"></a>00987 ycal,
+<a name="l00988"></a>00988 lcal,
+<a name="l00989"></a>00989 &gd,
+<a name="l00990"></a>00990 calTimestamp,
+<a name="l00991"></a>00991 calAngles,
+<a name="l00992"></a>00992 fn_lut,
+<a name="l00993"></a>00993 &cube_data,
+<a name="l00994"></a>00994 NULL,
+<a name="l00995"></a>00995 flux,
+<a name="l00996"></a>00996 background,
+<a name="l00997"></a>00997 NULL,
+<a name="l00998"></a>00998 NULL,
+<a name="l00999"></a>00999 NULL));
+<a name="l01000"></a>01000 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01001"></a>01001 } <span class="keywordflow">else</span> {
+<a name="l01002"></a>01002 <span class="comment">// IFU is invalid</span>
+<a name="l01003"></a>01003 cpl_error_reset();
+<a name="l01004"></a>01004 } <span class="comment">// if ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) ...</span>
+<a name="l01005"></a>01005
+<a name="l01006"></a>01006 <span class="comment">// save output</span>
+<a name="l01007"></a>01007 KMO_TRY_EXIT_IF_NULL(
+<a name="l01008"></a>01008 extname = kmo_extname_creator(ifu_frame, ifu_nr, EXT_DATA));
+<a name="l01009"></a>01009
+<a name="l01010"></a>01010 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01011"></a>01011 kmclipm_update_property_string(sub_header, EXTNAME,
+<a name="l01012"></a>01012 extname,
+<a name="l01013"></a>01013 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01014"></a>01014
+<a name="l01015"></a>01015 cpl_free(extname); extname = NULL;
+<a name="l01016"></a>01016
+<a name="l01017"></a>01017 <span class="comment">// store cube and sub header into array for later</span>
+<a name="l01018"></a>01018 stored_data_cubes[ifu_nr - 1] = cube_data;
+<a name="l01019"></a>01019 stored_sub_headers[ifu_nr - 1] = sub_header;
+<a name="l01020"></a>01020
+<a name="l01021"></a>01021 cpl_image_delete(data_ifu); data_ifu = NULL;
+<a name="l01022"></a>01022 cpl_image_delete(noise_ifu); noise_ifu = NULL;
+<a name="l01023"></a>01023 cube_data = NULL;
+<a name="l01024"></a>01024 } <span class="comment">// for i IFUs</span>
+<a name="l01025"></a>01025
+<a name="l01026"></a>01026 <span class="comment">// free memory</span>
+<a name="l01027"></a>01027 cpl_image_delete(combined_data); combined_data = NULL;
+<a name="l01028"></a>01028 cpl_image_delete(xcal); xcal = NULL;
+<a name="l01029"></a>01029 cpl_image_delete(ycal); ycal = NULL;
+<a name="l01030"></a>01030 cpl_image_delete(lcal); lcal = NULL;
+<a name="l01031"></a>01031 cpl_image_delete(bad_pix_mask); bad_pix_mask = NULL;
+<a name="l01032"></a>01032 } <span class="comment">// for nr_devices</span>
+<a name="l01033"></a>01033
+<a name="l01034"></a>01034 cpl_image_delete(img_dark); img_dark = NULL;
+<a name="l01035"></a>01035 cpl_image_delete(img_flat); img_flat = NULL;
+<a name="l01036"></a>01036
+<a name="l01037"></a>01037 <span class="comment">//</span>
+<a name="l01038"></a>01038 <span class="comment">// collapse cubes using rejection and apply median filtering</span>
+<a name="l01039"></a>01039 <span class="comment">//</span>
+<a name="l01040"></a>01040 KMO_TRY_EXIT_IF_NULL(
+<a name="l01041"></a>01041 identified_slices = cpl_vector_new(gd.l.dim));
+<a name="l01042"></a>01042 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01043"></a>01043 cpl_vector_fill(identified_slices, 1));
+<a name="l01044"></a>01044
+<a name="l01045"></a>01045 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Collapsing cubes..."</span>);
+<a name="l01046"></a>01046 <span class="keywordflow">for</span> (j = 0; j < nr_devices; j++) {
+<a name="l01047"></a>01047 <span class="keywordflow">for</span> (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01048"></a>01048 ifu_nr = j*KMOS_IFUS_PER_DETECTOR + i;
+<a name="l01049"></a>01049 KMO_TRY_EXIT_IF_NULL(
+<a name="l01050"></a>01050 punused_ifus = cpl_array_get_data_int_const(
+<a name="l01051"></a>01051 unused_ifus_after[j]));
+<a name="l01052"></a>01052 <span class="keywordflow">if</span> (punused_ifus[i] == 0) {
+<a name="l01053"></a>01053 <span class="keywordflow">if</span> (stored_data_cubes[ifu_nr] != NULL) {
+<a name="l01054"></a>01054 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01055"></a>01055 kmclipm_make_image(stored_data_cubes[ifu_nr],
+<a name="l01056"></a>01056 NULL,
+<a name="l01057"></a>01057 &stored_data_images[ifu_nr],
+<a name="l01058"></a>01058 &stored_noise_images[ifu_nr],
+<a name="l01059"></a>01059 identified_slices,
+<a name="l01060"></a>01060 cmethod, cpos_rej, cneg_rej,
+<a name="l01061"></a>01061 citer, cmax, cmin));
+<a name="l01062"></a>01062 }
+<a name="l01063"></a>01063
+<a name="l01064"></a>01064 <span class="comment">//</span>
+<a name="l01065"></a>01065 <span class="comment">// apply median smoothing</span>
+<a name="l01066"></a>01066 <span class="comment">//</span>
+<a name="l01067"></a>01067
+<a name="l01068"></a>01068 <span class="comment">// taking care of edges (IFUs 1-16 top/bottom, IFUs 17-24 left/right)</span>
+<a name="l01069"></a>01069 <span class="keywordflow">if</span> (ifu_nr+1 <= 2*KMOS_IFUS_PER_DETECTOR) {
+<a name="l01070"></a>01070 firstx = 0;
+<a name="l01071"></a>01071 lastx = 13;
+<a name="l01072"></a>01072 firsty = 1;
+<a name="l01073"></a>01073 lasty = 12;
+<a name="l01074"></a>01074 } <span class="keywordflow">else</span> {
+<a name="l01075"></a>01075 firstx = 1;
+<a name="l01076"></a>01076 lastx= 12;
+<a name="l01077"></a>01077 firsty = 0;
+<a name="l01078"></a>01078 lasty = 13;
+<a name="l01079"></a>01079 }
+<a name="l01080"></a>01080
+<a name="l01081"></a>01081 KMO_TRY_EXIT_IF_NULL(
+<a name="l01082"></a>01082 tmp_img = cpl_image_duplicate(stored_data_images[ifu_nr]));
+<a name="l01083"></a>01083 KMO_TRY_EXIT_IF_NULL(
+<a name="l01084"></a>01084 pdata = cpl_image_get_data_float(tmp_img));
+<a name="l01085"></a>01085 KMO_TRY_EXIT_IF_NULL(
+<a name="l01086"></a>01086 pnoise = cpl_image_get_data_float(stored_noise_images[ifu_nr]));
+<a name="l01087"></a>01087 nx = cpl_image_get_size_x(tmp_img);
+<a name="l01088"></a>01088 ny = cpl_image_get_size_y(tmp_img);
+<a name="l01089"></a>01089 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01090"></a>01090
+<a name="l01091"></a>01091 <span class="comment">// median filtering</span>
+<a name="l01092"></a>01092 <span class="keywordflow">for</span> (ix = 0; ix < nx; ix++) {
+<a name="l01093"></a>01093 <span class="keywordflow">for</span> (iy = 0; iy < ny; iy++) {
+<a name="l01094"></a>01094 <span class="keywordflow">if</span> (ix-mhalf > firstx) { xmin = ix-mhalf; } <span class="keywordflow">else</span> { xmin = firstx; }
+<a name="l01095"></a>01095 <span class="keywordflow">if</span> (ix+mhalf < lastx) { xmax = ix+mhalf; } <span class="keywordflow">else</span> { xmax = lastx; }
+<a name="l01096"></a>01096 <span class="keywordflow">if</span> (iy-mhalf > firsty) { ymin = iy-mhalf; } <span class="keywordflow">else</span> { ymin = firsty; }
+<a name="l01097"></a>01097 <span class="keywordflow">if</span> (iy+mhalf < lasty) { ymax = iy+mhalf; } <span class="keywordflow">else</span> { ymax = lasty; }
+<a name="l01098"></a>01098
+<a name="l01099"></a>01099 pdata[ix+nx*iy] = cpl_image_get_median_window(
+<a name="l01100"></a>01100 stored_data_images[ifu_nr],
+<a name="l01101"></a>01101 xmin+1, ymin+1, xmax+1, ymax+1);
+<a name="l01102"></a>01102 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01103"></a>01103
+<a name="l01104"></a>01104 <span class="keywordflow">if</span> (stored_noise_images[ifu_nr] != NULL) {
+<a name="l01105"></a>01105 boxsize = (xmax-xmin+1)*(ymax-ymin+1);
+<a name="l01106"></a>01106 pnoise[ix+nx*iy] /= boxsize; <span class="comment">//sqrt(boxsize*boxsize)</span>
+<a name="l01107"></a>01107 }
+<a name="l01108"></a>01108
+<a name="l01109"></a>01109 }
+<a name="l01110"></a>01110 }
+<a name="l01111"></a>01111
+<a name="l01112"></a>01112 <span class="comment">// replace images</span>
+<a name="l01113"></a>01113 cpl_image_delete(stored_data_images[ifu_nr]);
+<a name="l01114"></a>01114 stored_data_images[ifu_nr] = tmp_img;
+<a name="l01115"></a>01115 } <span class="keywordflow">else</span> {
+<a name="l01116"></a>01116 <span class="comment">// IFU is invalid</span>
+<a name="l01117"></a>01117 }
+<a name="l01118"></a>01118 } <span class="comment">// end for (i) ifu_nr</span>
+<a name="l01119"></a>01119 } <span class="comment">// end for (j) det_nr</span>
+<a name="l01120"></a>01120 cpl_vector_delete(identified_slices); identified_slices = NULL;
+<a name="l01121"></a>01121
+<a name="l01122"></a>01122 <span class="comment">// normalise all IFUs of a detector as a group.</span>
+<a name="l01123"></a>01123 <span class="comment">// Calculate mean of each IFU, add up and divide by number of successful</span>
+<a name="l01124"></a>01124 <span class="comment">// averaged IFUs.</span>
+<a name="l01125"></a>01125 <span class="comment">// Then divide all valid IFUs with mean value</span>
+<a name="l01126"></a>01126 <span class="keywordflow">for</span> (j = 0; j < nr_devices; j++) {
+<a name="l01127"></a>01127 cnt = 0;
+<a name="l01128"></a>01128 mean_data = 0;
+<a name="l01129"></a>01129 <span class="keywordflow">for</span> (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01130"></a>01130 ifu_nr = j*KMOS_IFUS_PER_DETECTOR + i;
+<a name="l01131"></a>01131 <span class="keywordflow">if</span> (stored_data_images[ifu_nr] != NULL) {
+<a name="l01132"></a>01132 KMO_TRY_ASSURE(cpl_image_count_rejected(stored_data_images[ifu_nr]) <
+<a name="l01133"></a>01133 cpl_image_get_size_x(stored_data_images[ifu_nr])*
+<a name="l01134"></a>01134 cpl_image_get_size_y(stored_data_images[ifu_nr]),
+<a name="l01135"></a>01135 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01136"></a>01136 <span class="stringliteral">"The collapsed image contains only invalid values!"</span>);
+<a name="l01137"></a>01137 mean_data += cpl_image_get_mean(stored_data_images[ifu_nr]);
+<a name="l01138"></a>01138 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01139"></a>01139 cnt++;
+<a name="l01140"></a>01140 }
+<a name="l01141"></a>01141
+<a name="l01142"></a>01142 } <span class="comment">// end for (i) ifu_nr</span>
+<a name="l01143"></a>01143 mean_data /= cnt;
+<a name="l01144"></a>01144 <span class="keywordflow">if</span> (mean_data != 0.0) {
+<a name="l01145"></a>01145 <span class="keywordflow">for</span> (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01146"></a>01146 ifu_nr = j*KMOS_IFUS_PER_DETECTOR + i;
+<a name="l01147"></a>01147 <span class="keywordflow">if</span> (stored_data_images[ifu_nr] != NULL) {
+<a name="l01148"></a>01148 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01149"></a>01149 cpl_image_divide_scalar(stored_data_images[ifu_nr], mean_data));
+<a name="l01150"></a>01150 }
+<a name="l01151"></a>01151 <span class="keywordflow">if</span> (stored_noise_images[ifu_nr] != NULL) {
+<a name="l01152"></a>01152 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01153"></a>01153 cpl_image_divide_scalar(stored_noise_images[ifu_nr], mean_data));
+<a name="l01154"></a>01154 }
+<a name="l01155"></a>01155 } <span class="comment">// end for (i) ifu_nr</span>
+<a name="l01156"></a>01156 } <span class="keywordflow">else</span> {
+<a name="l01157"></a>01157 cpl_msg_warning(cpl_func, <span class="stringliteral">"Data couldn't be normalised (mean = 0.0)!"</span>);
+<a name="l01158"></a>01158 }
+<a name="l01159"></a>01159 } <span class="comment">// end for (j) det_nr</span>
+<a name="l01160"></a>01160
+<a name="l01161"></a>01161 <span class="comment">//</span>
+<a name="l01162"></a>01162 <span class="comment">// invert data and noise</span>
+<a name="l01163"></a>01163 <span class="comment">//</span>
+<a name="l01164"></a>01164 <span class="keywordtype">double</span> old_val = 0.,
+<a name="l01165"></a>01165 new_val = 0.;
+<a name="l01166"></a>01166 <span class="keywordflow">for</span> (j = 0; j < nr_devices; j++) {
+<a name="l01167"></a>01167 cnt = 0;
+<a name="l01168"></a>01168 mean_data = 0;
+<a name="l01169"></a>01169 <span class="keywordflow">for</span> (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01170"></a>01170 ifu_nr = j*KMOS_IFUS_PER_DETECTOR + i;
+<a name="l01171"></a>01171 <span class="keywordflow">if</span> (stored_data_images[ifu_nr] != NULL) {
+<a name="l01172"></a>01172 <span class="comment">// invert data</span>
+<a name="l01173"></a>01173 KMO_TRY_EXIT_IF_NULL(
+<a name="l01174"></a>01174 pdata = cpl_image_get_data_float(stored_data_images[ifu_nr]));
+<a name="l01175"></a>01175 <span class="keywordflow">if</span> (stored_noise_images[ifu_nr] != NULL) {
+<a name="l01176"></a>01176 KMO_TRY_EXIT_IF_NULL(
+<a name="l01177"></a>01177 pnoise = cpl_image_get_data_float(stored_noise_images[ifu_nr]));
+<a name="l01178"></a>01178 }
+<a name="l01179"></a>01179 <span class="keywordflow">for</span> (ix = 0; ix < nx; ix++) {
+<a name="l01180"></a>01180 <span class="keywordflow">for</span> (iy = 0; iy < ny; iy++) {
+<a name="l01181"></a>01181 old_val = pdata[ix+nx*iy];
+<a name="l01182"></a>01182 pdata[ix+nx*iy] = 1. / pdata[ix+nx*iy];
+<a name="l01183"></a>01183 <span class="keywordflow">if</span> (stored_noise_images[ifu_nr] != NULL) {
+<a name="l01184"></a>01184 new_val = pdata[ix+nx*iy];
+<a name="l01185"></a>01185 pnoise[ix+nx*iy] = sqrt(pow(new_val, 2) *
+<a name="l01186"></a>01186 pow(pnoise[ix+nx*iy], 2) /
+<a name="l01187"></a>01187 pow(old_val, 2));
+<a name="l01188"></a>01188 }
+<a name="l01189"></a>01189 }
+<a name="l01190"></a>01190 }
+<a name="l01191"></a>01191 }
+<a name="l01192"></a>01192 } <span class="comment">// end for (i) ifu_nr</span>
+<a name="l01193"></a>01193 } <span class="comment">// end for (j) det_nr</span>
+<a name="l01194"></a>01194
+<a name="l01195"></a>01195 <span class="comment">// calculate qc parameters on normalised data</span>
+<a name="l01196"></a>01196 qc_spat_unif = 0.0;
+<a name="l01197"></a>01197 cnt = 0;
+<a name="l01198"></a>01198 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01199"></a>01199 <span class="keywordflow">if</span> (stored_data_images[i] != NULL) {
+<a name="l01200"></a>01200 tmp_mean = cpl_image_get_mean(stored_data_images[i]);
+<a name="l01201"></a>01201 tmp_stdev = cpl_image_get_stdev (stored_data_images[i]);
+<a name="l01202"></a>01202
+<a name="l01203"></a>01203 qc_spat_unif += pow(tmp_mean-1, 2);
+<a name="l01204"></a>01204 <span class="keywordflow">if</span> (fabs(tmp_mean) > qc_max_dev) {
+<a name="l01205"></a>01205 qc_max_dev = tmp_mean-1;
+<a name="l01206"></a>01206 qc_max_dev_id = i+1;
+<a name="l01207"></a>01207 }
+<a name="l01208"></a>01208 <span class="keywordflow">if</span> (fabs(tmp_stdev) > qc_max_nonunif) {
+<a name="l01209"></a>01209 qc_max_nonunif = tmp_stdev;
+<a name="l01210"></a>01210 qc_max_nonunif_id = i+1;
+<a name="l01211"></a>01211 }
+<a name="l01212"></a>01212 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01213"></a>01213 cnt++;
+<a name="l01214"></a>01214 }
+<a name="l01215"></a>01215 }
+<a name="l01216"></a>01216 qc_spat_unif = sqrt(qc_spat_unif / cnt);
+<a name="l01217"></a>01217
+<a name="l01218"></a>01218 <span class="comment">//</span>
+<a name="l01219"></a>01219 <span class="comment">// save data</span>
+<a name="l01220"></a>01220 <span class="comment">//</span>
+<a name="l01221"></a>01221
+<a name="l01222"></a>01222 <span class="comment">// update which IFUs are not used</span>
+<a name="l01223"></a>01223 kmo_print_unused_ifus(unused_ifus_after, TRUE);
+<a name="l01224"></a>01224
+<a name="l01225"></a>01225 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01226"></a>01226 kmo_set_unused_ifus(unused_ifus_after, main_header,
+<a name="l01227"></a>01227 <span class="stringliteral">"kmo_illumination_flat"</span>));
+<a name="l01228"></a>01228
+<a name="l01229"></a>01229 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Saving data..."</span>);
+<a name="l01230"></a>01230
+<a name="l01231"></a>01231 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01232"></a>01232 kmclipm_update_property_double(main_header, QC_SPAT_UNIF, qc_spat_unif,
+<a name="l01233"></a>01233 <span class="stringliteral">"[adu] uniformity of illumination correction"</span>));
+<a name="l01234"></a>01234 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01235"></a>01235 kmclipm_update_property_double(main_header, QC_SPAT_MAX_DEV, qc_max_dev,
+<a name="l01236"></a>01236 <span class="stringliteral">"[adu] max. deviation from unity"</span>));
+<a name="l01237"></a>01237 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01238"></a>01238 kmclipm_update_property_int(main_header, QC_SPAT_MAX_DEV_ID, qc_max_dev_id,
+<a name="l01239"></a>01239 <span class="stringliteral">"[] IFU ID with max. dev. from unity"</span>));
+<a name="l01240"></a>01240 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01241"></a>01241 kmclipm_update_property_double(main_header, QC_SPAT_MAX_NONUNIF, qc_max_nonunif,
+<a name="l01242"></a>01242 <span class="stringliteral">"[adu] max. stdev of illumination corr."</span>));
+<a name="l01243"></a>01243 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01244"></a>01244 kmclipm_update_property_int(main_header, QC_SPAT_MAX_NONUNIF_ID, qc_max_nonunif_id,
+<a name="l01245"></a>01245 <span class="stringliteral">"[] IFU ID with max. stdev in illum. corr."</span>));
+<a name="l01246"></a>01246
+<a name="l01247"></a>01247 <span class="keywordflow">if</span> (!suppress_extension) {
+<a name="l01248"></a>01248 KMO_TRY_EXIT_IF_NULL(
+<a name="l01249"></a>01249 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, suffix));
+<a name="l01250"></a>01250 } <span class="keywordflow">else</span> {
+<a name="l01251"></a>01251 KMO_TRY_EXIT_IF_NULL(
+<a name="l01252"></a>01252 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">""</span>));
+<a name="l01253"></a>01253 }
+<a name="l01254"></a>01254 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01255"></a>01255 kmo_dfs_save_main_header(frameset, ILLUM_CORR_FLAT, fn_suffix, frame,
+<a name="l01256"></a>01256 main_header, parlist, cpl_func));
+<a name="l01257"></a>01257
+<a name="l01258"></a>01258 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01259"></a>01259 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01260"></a>01260 kmo_dfs_save_image(stored_data_images[i], ILLUM_CORR_FLAT, fn_suffix,
+<a name="l01261"></a>01261 stored_sub_headers[i], 0./0.));
+<a name="l01262"></a>01262
+<a name="l01263"></a>01263 KMO_TRY_EXIT_IF_NULL(
+<a name="l01264"></a>01264 tmp_str = cpl_propertylist_get_string(stored_sub_headers[i], EXTNAME));
+<a name="l01265"></a>01265 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01266"></a>01266 kmo_extname_extractor(tmp_str, &fr_type, &ifu_nr, content));
+<a name="l01267"></a>01267 KMO_TRY_EXIT_IF_NULL(
+<a name="l01268"></a>01268 extname = kmo_extname_creator(ifu_frame, ifu_nr,
+<a name="l01269"></a>01269 EXT_NOISE));
+<a name="l01270"></a>01270 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01271"></a>01271 kmclipm_update_property_string(stored_sub_headers[i], EXTNAME,
+<a name="l01272"></a>01272 extname, <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01273"></a>01273 cpl_free(extname); extname = NULL;
+<a name="l01274"></a>01274
+<a name="l01275"></a>01275 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01276"></a>01276 kmo_dfs_save_image(stored_noise_images[i], ILLUM_CORR_FLAT,
+<a name="l01277"></a>01277 fn_suffix, stored_sub_headers[i], 0./0.));
+<a name="l01278"></a>01278 }
+<a name="l01279"></a>01279 }
+<a name="l01280"></a>01280 KMO_CATCH
+<a name="l01281"></a>01281 {
+<a name="l01282"></a>01282 KMO_CATCH_MSG();
+<a name="l01283"></a>01283 ret_val = -1;
+<a name="l01284"></a>01284 }
+<a name="l01285"></a>01285 kmo_free_fits_desc(&desc_sky);
+<a name="l01286"></a>01286 kmo_free_fits_desc(&desc_xcal);
+<a name="l01287"></a>01287 kmo_free_fits_desc(&desc_ycal);
+<a name="l01288"></a>01288 kmo_free_fits_desc(&desc_lcal);
+<a name="l01289"></a>01289 cpl_image_delete(combined_data); combined_data = NULL;
+<a name="l01290"></a>01290 cpl_image_delete(xcal); xcal = NULL;
+<a name="l01291"></a>01291 cpl_image_delete(ycal); ycal = NULL;
+<a name="l01292"></a>01292 cpl_image_delete(lcal); lcal = NULL;
+<a name="l01293"></a>01293 cpl_image_delete(img_dark); img_dark = NULL;
+<a name="l01294"></a>01294 cpl_image_delete(img_flat); img_flat = NULL;
+<a name="l01295"></a>01295 cpl_array_delete(calTimestamp); calTimestamp = NULL;
+<a name="l01296"></a>01296 cpl_free(bounds); bounds = NULL;
+<a name="l01297"></a>01297 kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
+<a name="l01298"></a>01298 kmo_free_unused_ifus(unused_ifus_after); unused_ifus_after = NULL;
+<a name="l01299"></a>01299 cpl_free(fn_lut); fn_lut = NULL;
+<a name="l01300"></a>01300 cpl_free(suffix); suffix = NULL;
+<a name="l01301"></a>01301 cpl_free(fn_suffix); fn_suffix = NULL;
+<a name="l01302"></a>01302 cpl_free(filter); filter = NULL;
+<a name="l01303"></a>01303 <span class="keywordflow">if</span> (calAngles != NULL) {
+<a name="l01304"></a>01304 cpl_vector_delete(calAngles); calAngles = NULL;
+<a name="l01305"></a>01305 }
+<a name="l01306"></a>01306 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l01307"></a>01307 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l01308"></a>01308 <span class="keywordflow">if</span> (stored_data_cubes != NULL) {
+<a name="l01309"></a>01309 cpl_imagelist_delete(stored_data_cubes[i]);
+<a name="l01310"></a>01310 stored_data_cubes[i] = NULL;
+<a name="l01311"></a>01311 }
+<a name="l01312"></a>01312 <span class="keywordflow">if</span> (stored_data_images != NULL) {
+<a name="l01313"></a>01313 cpl_image_delete(stored_data_images[i]);
+<a name="l01314"></a>01314 stored_data_images[i] = NULL;
+<a name="l01315"></a>01315 }
+<a name="l01316"></a>01316 <span class="keywordflow">if</span> (stored_noise_images != NULL) {
+<a name="l01317"></a>01317 cpl_image_delete(stored_noise_images[i]);
+<a name="l01318"></a>01318 stored_noise_images[i] = NULL;
+<a name="l01319"></a>01319 }
+<a name="l01320"></a>01320 <span class="keywordflow">if</span> (stored_sub_headers != NULL) {
+<a name="l01321"></a>01321 cpl_propertylist_delete(stored_sub_headers[i]);
+<a name="l01322"></a>01322 stored_sub_headers[i] = NULL;
+<a name="l01323"></a>01323 }
+<a name="l01324"></a>01324 }
+<a name="l01325"></a>01325 cpl_free(stored_data_cubes); stored_data_cubes = NULL;
+<a name="l01326"></a>01326 cpl_free(stored_data_images); stored_data_images = NULL;
+<a name="l01327"></a>01327 cpl_free(stored_noise_images); stored_noise_images = NULL;
+<a name="l01328"></a>01328 cpl_free(stored_sub_headers); stored_sub_headers = NULL;
+<a name="l01329"></a>01329
+<a name="l01330"></a>01330 <span class="keywordflow">return</span> ret_val;
+<a name="l01331"></a>01331 }
+<a name="l01332"></a>01332
+</pre></div></div><!-- contents -->
+
+
+<hr class="footer"/><address class="footer"><small>
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/>
+</a> 1.7.6.1
+</small></address>
+
+</body>
+</html>
diff --git a/html/kmo__make__image_8c_source.html b/html/kmo__make__image_8c_source.html
index b34c92b..8601ccb 100644
--- a/html/kmo__make__image_8c_source.html
+++ b/html/kmo__make__image_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_make_image.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_make_image.c,v 1.16 2013/06/07 13:37:26 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_make_image.c,v 1.16 2013-06-07 13:37:26 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/06/07 13:37:26 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-06-07 13:37:26 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.16 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -679,7 +679,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__multi__reconstruct_8c_source.html b/html/kmo__multi__reconstruct_8c_source.html
index b318a76..eec5e5c 100644
--- a/html/kmo__multi__reconstruct_8c_source.html
+++ b/html/kmo__multi__reconstruct_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_multi_reconstruct.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_multi_reconstruct.c,v 1.46 2013/08/02 09:38:57 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_multi_reconstruct.c,v 1.55 2013-10-08 14:55:01 erw Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -81,1195 +81,1464 @@
<a name="l00019"></a>00019 <span class="comment"> */</span>
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
-<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/08/02 09:38:57 $</span>
-<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.46 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: erw $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-10-08 14:55:01 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.55 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include <config.h></span>
<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span>
-<a name="l00032"></a>00032 <span class="preprocessor">#include <string.h></span>
-<a name="l00033"></a>00033 <span class="preprocessor">#include <math.h></span>
-<a name="l00034"></a>00034
-<a name="l00035"></a>00035 <span class="preprocessor">#include <cpl.h></span>
-<a name="l00036"></a>00036 <span class="preprocessor">#include <cpl_wcs.h></span>
+<a name="l00032"></a>00032 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00033"></a>00033 <span class="comment"> * Includes</span>
+<a name="l00034"></a>00034 <span class="comment"> *----------------------------------------------------------------------------*/</span>
+<a name="l00035"></a>00035 <span class="preprocessor">#include <string.h></span>
+<a name="l00036"></a>00036 <span class="preprocessor">#include <math.h></span>
<a name="l00037"></a>00037
-<a name="l00038"></a>00038 <span class="preprocessor">#include "kmo_debug.h"</span>
-<a name="l00039"></a>00039 <span class="preprocessor">#include "kmo_utils.h"</span>
-<a name="l00040"></a>00040 <span class="preprocessor">#include "kmo_dfs.h"</span>
-<a name="l00041"></a>00041 <span class="preprocessor">#include "kmo_error.h"</span>
-<a name="l00042"></a>00042 <span class="preprocessor">#include "kmo_priv_functions.h"</span>
-<a name="l00043"></a>00043 <span class="preprocessor">#include "kmo_cpl_extensions.h"</span>
-<a name="l00044"></a>00044 <span class="preprocessor">#include "kmo_constants.h"</span>
-<a name="l00045"></a>00045 <span class="preprocessor">#include "kmo_priv_multi_reconstruct.h"</span>
-<a name="l00046"></a>00046 <span class="preprocessor">#include "kmo_priv_reconstruct.h"</span>
-<a name="l00047"></a>00047
-<a name="l00048"></a>00048 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct_create(cpl_plugin *);
-<a name="l00049"></a>00049 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct_exec(cpl_plugin *);
-<a name="l00050"></a>00050 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct_destroy(cpl_plugin *);
-<a name="l00051"></a>00051 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct(cpl_parameterlist *, cpl_frameset *);
-<a name="l00052"></a>00052
-<a name="l00053"></a>00053 <span class="keyword">static</span> <span class="keywordtype">char</span> kmo_multi_reconstruct_description[] =
-<a name="l00054"></a>00054 <span class="stringliteral">"This recipe shifts several exposures of an object and combines them. The diffe-\n"</span>
-<a name="l00055"></a>00055 <span class="stringliteral">"rent methods to match the exposures are described below (--method parameter).\n"</span>
-<a name="l00056"></a>00056 <span class="stringliteral">"The output cube is larger than the input cubes, according to the shifts to be\n"</span>
-<a name="l00057"></a>00057 <span class="stringliteral">"applied. Additionally a border of NaN values is added. The WCS is the same as\n"</span>
-<a name="l00058"></a>00058 <span class="stringliteral">"for the first exposure.\n"</span>
-<a name="l00059"></a>00059 <span class="stringliteral">"For each spatial/spectral pixel a new value will be calculated (according the\n"</span>
-<a name="l00060"></a>00060 <span class="stringliteral">"--cmethod parameter) and written into the output cube.\n"</span>
-<a name="l00061"></a>00061 <span class="stringliteral">"Only exposures with equal orientation regarding the WCS can be combined (except\n"</span>
-<a name="l00062"></a>00062 <span class="stringliteral">"-–method=”none”), north must point to the same direction. It is recommended to\n"</span>
-<a name="l00063"></a>00063 <span class="stringliteral">"apply any rotation possibly after combining.\n"</span>
-<a name="l00064"></a>00064 <span class="stringliteral">"The default mapping mode is done via the --name parameter, where the name of\n"</span>
-<a name="l00065"></a>00065 <span class="stringliteral">"the object has to be provided. The recipe searches in all input data cubes IFUs\n"</span>
-<a name="l00066"></a>00066 <span class="stringliteral">"pointing to that object.\n"</span>
-<a name="l00067"></a>00067 <span class="stringliteral">"\n"</span>
-<a name="l00068"></a>00068 <span class="stringliteral">"BASIC PARAMETERS:\n"</span>
-<a name="l00069"></a>00069 <span class="stringliteral">"-----------------\n"</span>
-<a name="l00070"></a>00070 <span class="stringliteral">"--name\n"</span>
-<a name="l00071"></a>00071 <span class="stringliteral">"--ifus\n"</span>
-<a name="l00072"></a>00072 <span class="stringliteral">"Since an object can be present only once per exposure and since it can be\n"</span>
-<a name="l00073"></a>00073 <span class="stringliteral">"located in different IFUs for the existing exposures, there are two modes to\n"</span>
-<a name="l00074"></a>00074 <span class="stringliteral">"identify the objects:\n"</span>
-<a name="l00075"></a>00075 <span class="stringliteral">" * Combine by object names (default)\n"</span>
-<a name="l00076"></a>00076 <span class="stringliteral">" In this case the object name must be provided via the --name parameter. The\n"</span>
-<a name="l00077"></a>00077 <span class="stringliteral">" object name will be searched for in all primary headers of all provided frames\n"</span>
-<a name="l00078"></a>00078 <span class="stringliteral">" in the keyword ESO OCS ARMx NAME.\n"</span>
-<a name="l00079"></a>00079 <span class="stringliteral">"\n"</span>
-<a name="l00080"></a>00080 <span class="stringliteral">" * Combine by index (advanced)\n"</span>
-<a name="l00081"></a>00081 <span class="stringliteral">" In this case the --ifus parameter must be provided. The parameter must have\n"</span>
-<a name="l00082"></a>00082 <span class="stringliteral">" the same number of entries as frames are provided, e.g. \"3;1;24\" for 3 expo-\n"</span>
-<a name="l00083"></a>00083 <span class="stringliteral">" sures. The index doesn't reference the extension in the frame but the real\n"</span>
-<a name="l00084"></a>00084 <span class="stringliteral">" index of the IFU as defined in the EXTNAME keyword (e.g. 'IFU.3.DATA').\n"</span>
-<a name="l00085"></a>00085 <span class="stringliteral">"\n"</span>
-<a name="l00086"></a>00086 <span class="stringliteral">"--imethod\n"</span>
-<a name="l00087"></a>00087 <span class="stringliteral">"Method to use for interpolation.\n"</span>
+<a name="l00038"></a>00038 <span class="preprocessor">#include <cpl.h></span>
+<a name="l00039"></a>00039 <span class="preprocessor">#include "kmclipm_constants.h"</span>
+<a name="l00040"></a>00040 <span class="preprocessor">#include "kmclipm_functions.h"</span>
+<a name="l00041"></a>00041
+<a name="l00042"></a>00042 <span class="preprocessor">#include "kmo_debug.h"</span>
+<a name="l00043"></a>00043 <span class="preprocessor">#include "kmo_constants.h"</span>
+<a name="l00044"></a>00044 <span class="preprocessor">#include "kmo_cpl_extensions.h"</span>
+<a name="l00045"></a>00045 <span class="preprocessor">#include "kmo_priv_lcorr.h"</span>
+<a name="l00046"></a>00046 <span class="preprocessor">#include "kmo_utils.h"</span>
+<a name="l00047"></a>00047 <span class="preprocessor">#include "kmo_error.h"</span>
+<a name="l00048"></a>00048 <span class="preprocessor">#include "kmo_dfs.h"</span>
+<a name="l00049"></a>00049 <span class="preprocessor">#include "kmo_functions.h"</span>
+<a name="l00050"></a>00050 <span class="preprocessor">#include "kmo_priv_arithmetic.h"</span>
+<a name="l00051"></a>00051 <span class="preprocessor">#include "kmo_priv_combine.h"</span>
+<a name="l00052"></a>00052 <span class="preprocessor">#include "kmo_priv_functions.h"</span>
+<a name="l00053"></a>00053 <span class="preprocessor">#include "kmo_priv_reconstruct.h"</span>
+<a name="l00054"></a>00054 <span class="preprocessor">#include "kmo_priv_multi_reconstruct.h"</span>
+<a name="l00055"></a>00055
+<a name="l00056"></a>00056 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00057"></a>00057 <span class="comment"> * Types</span>
+<a name="l00058"></a>00058 <span class="comment"> *-----------------------------------------------------------------------------*/</span>
+<a name="l00059"></a>00059
+<a name="l00060"></a>00060 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00061"></a>00061 <span class="comment"> * Functions prototypes</span>
+<a name="l00062"></a>00062 <span class="comment"> *----------------------------------------------------------------------------*/</span>
+<a name="l00063"></a>00063
+<a name="l00064"></a>00064 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct_create(cpl_plugin *);
+<a name="l00065"></a>00065 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct_exec(cpl_plugin *);
+<a name="l00066"></a>00066 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct_destroy(cpl_plugin *);
+<a name="l00067"></a>00067 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct(cpl_parameterlist *, cpl_frameset *);
+<a name="l00068"></a>00068
+<a name="l00069"></a>00069 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00070"></a>00070 <span class="comment"> * Static variables</span>
+<a name="l00071"></a>00071 <span class="comment"> *----------------------------------------------------------------------------*/</span>
+<a name="l00072"></a>00072
+<a name="l00073"></a>00073 <span class="keyword">static</span> <span class="keywordtype">char</span> kmo_multi_reconstruct_description[] =
+<a name="l00074"></a>00074 <span class="stringliteral">"Ideally at least two data frames have to be provided since we need for each IFU\n"</span>
+<a name="l00075"></a>00075 <span class="stringliteral">"pointing to an object as well a sky frame for the same IFU.\n"</span>
+<a name="l00076"></a>00076 <span class="stringliteral">"If an OH spectrum is given in the SOF file the lambda axis will be corrected\n"</span>
+<a name="l00077"></a>00077 <span class="stringliteral">"using the OH lines as reference.\n"</span>
+<a name="l00078"></a>00078 <span class="stringliteral">"All IFUs with the same object name will be reconstructed and combined in one step\n"</span>
+<a name="l00079"></a>00079 <span class="stringliteral">"Telluric correction is only supported if the objects have been observed with\n"</span>
+<a name="l00080"></a>00080 <span class="stringliteral">"the same IFU on all exposures (dithering).\n"</span>
+<a name="l00081"></a>00081 <span class="stringliteral">"The number of created files depends on the number of objects of different name.\n"</span>
+<a name="l00082"></a>00082 <span class="stringliteral">"If the user just wants to combine a certain object, the parameters --name or\n"</span>
+<a name="l00083"></a>00083 <span class="stringliteral">"--ifus can be used.\n"</span>
+<a name="l00084"></a>00084 <span class="stringliteral">"\n"</span>
+<a name="l00085"></a>00085 <span class="stringliteral">"Exposures taken with the templates KMOS_spec_obs_mapping8 and\n"</span>
+<a name="l00086"></a>00086 <span class="stringliteral">"KMOS_spec_obs_mapping24 can't be processed with this recipe! Use kmo_sci_red\n"</span>
+<a name="l00087"></a>00087 <span class="stringliteral">"instead.\n"</span>
<a name="l00088"></a>00088 <span class="stringliteral">"\n"</span>
-<a name="l00089"></a>00089 <span class="stringliteral">"--method\n"</span>
-<a name="l00090"></a>00090 <span class="stringliteral">"There are following sources to get the shift parameters from:\n"</span>
-<a name="l00091"></a>00091 <span class="stringliteral">" * 'none' (default)\n"</span>
-<a name="l00092"></a>00092 <span class="stringliteral">" The cubes are directly recombined, not shifting at all. The ouput frame will\n"</span>
-<a name="l00093"></a>00093 <span class="stringliteral">" have the same dimensions as the input cubes.\n"</span>
-<a name="l00094"></a>00094 <span class="stringliteral">" If the size differs a warning will be emitted and the cubes will be aligned\n"</span>
-<a name="l00095"></a>00095 <span class="stringliteral">" to the lower left corner. If the orientation differs a warning will be emit-\n"</span>
-<a name="l00096"></a>00096 <span class="stringliteral">" ted, but the cubes are combined anyway.\n"</span>
-<a name="l00097"></a>00097 <span class="stringliteral">"\n"</span>
-<a name="l00098"></a>00098 <span class="stringliteral">" * 'header'\n"</span>
-<a name="l00099"></a>00099 <span class="stringliteral">" The shifts are calculated according to the WCS information stored in the\n"</span>
-<a name="l00100"></a>00100 <span class="stringliteral">" header of every IFU. The output frame will get larger, except the object is\n"</span>
-<a name="l00101"></a>00101 <span class="stringliteral">" at the exact same position for all exposures. The size of the exposures can\n"</span>
-<a name="l00102"></a>00102 <span class="stringliteral">" differ, but the orientation must be the same for all exposures.\n"</span>
+<a name="l00089"></a>00089 <span class="stringliteral">"BASIC PARAMETERS:\n"</span>
+<a name="l00090"></a>00090 <span class="stringliteral">"-----------------\n"</span>
+<a name="l00091"></a>00091 <span class="stringliteral">"--imethod\n"</span>
+<a name="l00092"></a>00092 <span class="stringliteral">"The interpolation method used for reconstruction.\n"</span>
+<a name="l00093"></a>00093 <span class="stringliteral">"\n"</span>
+<a name="l00094"></a>00094 <span class="stringliteral">"--name\n"</span>
+<a name="l00095"></a>00095 <span class="stringliteral">"--ifus\n"</span>
+<a name="l00096"></a>00096 <span class="stringliteral">"Since an object can be present only once per exposure and since it can be\n"</span>
+<a name="l00097"></a>00097 <span class="stringliteral">"located in different IFUs for the existing exposures, there are two modes to\n"</span>
+<a name="l00098"></a>00098 <span class="stringliteral">"identify the objects:\n"</span>
+<a name="l00099"></a>00099 <span class="stringliteral">" * Combine by object names (default)\n"</span>
+<a name="l00100"></a>00100 <span class="stringliteral">" In this case the object name must be provided via the --name parameter. The\n"</span>
+<a name="l00101"></a>00101 <span class="stringliteral">" object name will be searched for in all primary headers of all provided\n"</span>
+<a name="l00102"></a>00102 <span class="stringliteral">" frames in the keyword ESO OCS ARMx NAME.\n"</span>
<a name="l00103"></a>00103 <span class="stringliteral">"\n"</span>
-<a name="l00104"></a>00104 <span class="stringliteral">" * 'user'\n"</span>
-<a name="l00105"></a>00105 <span class="stringliteral">" Read the shifts from a user specified file. The path of the file must be pro-\n"</span>
-<a name="l00106"></a>00106 <span class="stringliteral">" vided using the --filename parameter. For every exposure (except the first one)\n"</span>
-<a name="l00107"></a>00107 <span class="stringliteral">" two shift values are expected per line, they have to be separated with simple\n"</span>
-<a name="l00108"></a>00108 <span class="stringliteral">" spaces. The values indicate pixel shifts and are referenced to the first\n"</span>
-<a name="l00109"></a>00109 <span class="stringliteral">" frame. The 1st value is the shift in x-direction to the left, the 2nd the\n"</span>
-<a name="l00110"></a>00110 <span class="stringliteral">" shift in y-direction upwards. The size of the exposures can differ, but the\n"</span>
-<a name="l00111"></a>00111 <span class="stringliteral">" orientation must be the same for all exposures.\n"</span>
-<a name="l00112"></a>00112 <span class="stringliteral">"\n"</span>
-<a name="l00113"></a>00113 <span class="stringliteral">" * 'center'\n"</span>
-<a name="l00114"></a>00114 <span class="stringliteral">" The shifts are calculated using a centering algorithm. The detector exposures\""</span>
-<a name="l00115"></a>00115 <span class="stringliteral">" will be reconstructed and the resulting data cubes will be collapsed to an image.\n"</span>
-<a name="l00116"></a>00116 <span class="stringliteral">" A 2D profile of the image will be fitted to it to identify the centre. With \n"</span>
-<a name="l00117"></a>00117 <span class="stringliteral">" the parameter --fmethod the function to fit can be provided. The size of the\n"</span>
-<a name="l00118"></a>00118 <span class="stringliteral">" exposures can differ, but the orientation must be the same for all exposures.\n"</span>
-<a name="l00119"></a>00119 <span class="stringliteral">"\n"</span>
-<a name="l00120"></a>00120 <span class="stringliteral">"ADVANCED PARAMETERS\n"</span>
-<a name="l00121"></a>00121 <span class="stringliteral">"-------------------\n"</span>
-<a name="l00122"></a>00122 <span class="stringliteral">"--size\n"</span>
-<a name="l00123"></a>00123 <span class="stringliteral">"Spatial size of the output cube.\n"</span>
-<a name="l00124"></a>00124 <span class="stringliteral">"\n"</span>
-<a name="l00125"></a>00125 <span class="stringliteral">"--suppress_extension\n"</span>
-<a name="l00126"></a>00126 <span class="stringliteral">"If set to TRUE, the arbitrary filename extensions are supressed. If multiple\n"</span>
-<a name="l00127"></a>00127 <span class="stringliteral">"products with the same category are produced, they will be numered consecutively\n"</span>
-<a name="l00128"></a>00128 <span class="stringliteral">"starting from 0.\n"</span>
-<a name="l00129"></a>00129 <span class="stringliteral">"\n"</span>
-<a name="l00130"></a>00130 <span class="stringliteral">"--fmethod\n"</span>
-<a name="l00131"></a>00131 <span class="stringliteral">"see --method='center'\n"</span>
-<a name="l00132"></a>00132 <span class="stringliteral">"The type of function that should be fitted spatially to the collapsed image.\n"</span>
-<a name="l00133"></a>00133 <span class="stringliteral">"This fit is used to create a mask to extract the spectrum of the object. Valid\n"</span>
-<a name="l00134"></a>00134 <span class="stringliteral">"values are 'gauss' and 'moffat'.\n"</span>
-<a name="l00135"></a>00135 <span class="stringliteral">"\n"</span>
-<a name="l00136"></a>00136 <span class="stringliteral">"--filename\n"</span>
-<a name="l00137"></a>00137 <span class="stringliteral">"see --method='user'\n"</span>
-<a name="l00138"></a>00138 <span class="stringliteral">"\n"</span>
-<a name="l00139"></a>00139 <span class="stringliteral">" Advanced reconstruction parameters\n"</span>
-<a name="l00140"></a>00140 <span class="stringliteral">" ----------------------------------\n"</span>
-<a name="l00141"></a>00141 <span class="stringliteral">"--pix_scale\n"</span>
-<a name="l00142"></a>00142 <span class="stringliteral">"Change the pixel scale [arcsec]. Default of 0.2\" results into cubes of\n"</span>
-<a name="l00143"></a>00143 <span class="stringliteral">"14x14pix, a scale of 0.1\" results into cubes of 28x28pix, etc.\n"</span>
-<a name="l00144"></a>00144 <span class="stringliteral">"\n"</span>
-<a name="l00145"></a>00145 <span class="stringliteral">"--neighborhoodRange\n"</span>
-<a name="l00146"></a>00146 <span class="stringliteral">"Defines the range to search for neighbors during reconstruction\n"</span>
-<a name="l00147"></a>00147 <span class="stringliteral">"\n"</span>
-<a name="l00148"></a>00148 <span class="stringliteral">"--b_samples\n"</span>
-<a name="l00149"></a>00149 <span class="stringliteral">"The number of samples in spectral direction for the reconstructed cube. Ideal-\n"</span>
-<a name="l00150"></a>00150 <span class="stringliteral">"ly this number should be greater than 2048, the detector size.\n"</span>
+<a name="l00104"></a>00104 <span class="stringliteral">" * Combine by index (advanced)\n"</span>
+<a name="l00105"></a>00105 <span class="stringliteral">" In this case the --ifus parameter must be provided. The parameter must have\n"</span>
+<a name="l00106"></a>00106 <span class="stringliteral">" the same number of entries as frames are provided, e.g. \"3;1;24\" for 3\n"</span>
+<a name="l00107"></a>00107 <span class="stringliteral">" exposures. The index doesn't reference the extension in the frame but the\n"</span>
+<a name="l00108"></a>00108 <span class="stringliteral">" real index of the IFU as defined in the EXTNAME keyword.\n"</span>
+<a name="l00109"></a>00109 <span class="stringliteral">" (e.g. 'IFU.3.DATA')\n"</span>
+<a name="l00110"></a>00110 <span class="stringliteral">"\n"</span>
+<a name="l00111"></a>00111 <span class="stringliteral">"ADVANCED PARAMETERS\n"</span>
+<a name="l00112"></a>00112 <span class="stringliteral">"-------------------\n"</span>
+<a name="l00113"></a>00113 <span class="stringliteral">"--flux\n"</span>
+<a name="l00114"></a>00114 <span class="stringliteral">"Specify if flux conservation should be applied.\n"</span>
+<a name="l00115"></a>00115 <span class="stringliteral">"\n"</span>
+<a name="l00116"></a>00116 <span class="stringliteral">"--background\n"</span>
+<a name="l00117"></a>00117 <span class="stringliteral">"Specify if background removal should be applied.\n"</span>
+<a name="l00118"></a>00118 <span class="stringliteral">"\n"</span>
+<a name="l00119"></a>00119 <span class="stringliteral">"--suppress_extension\n"</span>
+<a name="l00120"></a>00120 <span class="stringliteral">"If set to TRUE, the arbitrary filename extensions are supressed. If multiple\n"</span>
+<a name="l00121"></a>00121 <span class="stringliteral">"products with the same category are produced, they will be numered consecutively\n"</span>
+<a name="l00122"></a>00122 <span class="stringliteral">"starting from 0.\n"</span>
+<a name="l00123"></a>00123 <span class="stringliteral">"\n"</span>
+<a name="l00124"></a>00124 <span class="stringliteral">" Advanced reconstruction parameters\n"</span>
+<a name="l00125"></a>00125 <span class="stringliteral">" ----------------------------------\n"</span>
+<a name="l00126"></a>00126 <span class="stringliteral">"--neighborhoodRange\n"</span>
+<a name="l00127"></a>00127 <span class="stringliteral">"Defines the range to search for neighbors during reconstruction\n"</span>
+<a name="l00128"></a>00128 <span class="stringliteral">"\n"</span>
+<a name="l00129"></a>00129 <span class="stringliteral">"--b_samples\n"</span>
+<a name="l00130"></a>00130 <span class="stringliteral">"The number of samples in spectral direction for the reconstructed cube.\n"</span>
+<a name="l00131"></a>00131 <span class="stringliteral">"Ideally this number should be greater than 2048, the detector size.\n"</span>
+<a name="l00132"></a>00132 <span class="stringliteral">"\n"</span>
+<a name="l00133"></a>00133 <span class="stringliteral">"--b_start\n"</span>
+<a name="l00134"></a>00134 <span class="stringliteral">"--b_end\n"</span>
+<a name="l00135"></a>00135 <span class="stringliteral">"Used to define manually the start and end wavelength for the reconstructed\n"</span>
+<a name="l00136"></a>00136 <span class="stringliteral">"cube. By default the internally defined values are used.\n"</span>
+<a name="l00137"></a>00137 <span class="stringliteral">"\n"</span>
+<a name="l00138"></a>00138 <span class="stringliteral">"--pix_scale\n"</span>
+<a name="l00139"></a>00139 <span class="stringliteral">"Change the pixel scale [arcsec]. Default of 0.2\" results into cubes of\n"</span>
+<a name="l00140"></a>00140 <span class="stringliteral">"14x14pix, a scale of 0.1\" results into cubes of 28x28pix, etc.\n"</span>
+<a name="l00141"></a>00141 <span class="stringliteral">"\n"</span>
+<a name="l00142"></a>00142 <span class="stringliteral">"--no_subtract\n"</span>
+<a name="l00143"></a>00143 <span class="stringliteral">"If set to TRUE, the found objects and references won't be sky subtracted. \n"</span>
+<a name="l00144"></a>00144 <span class="stringliteral">"Additionally all IFUs will be reconstructed, even the ones containing skies. \n"</span>
+<a name="l00145"></a>00145 <span class="stringliteral">"This option sets the parameter no_combine to TRUE automatically.\n"</span>
+<a name="l00146"></a>00146 <span class="stringliteral">"\n"</span>
+<a name="l00147"></a>00147 <span class="stringliteral">"--xcal_interpolation\n"</span>
+<a name="l00148"></a>00148 <span class="stringliteral">"If true interpolate the pixel position in the slitlet (xcal) using the two\n"</span>
+<a name="l00149"></a>00149 <span class="stringliteral">"closest rotator angles in the calibration file. Otherwise take the values\n"</span>
+<a name="l00150"></a>00150 <span class="stringliteral">"of the closest rotator angle\n"</span>
<a name="l00151"></a>00151 <span class="stringliteral">"\n"</span>
-<a name="l00152"></a>00152 <span class="stringliteral">"--b_start\n"</span>
-<a name="l00153"></a>00153 <span class="stringliteral">"--b_end\n"</span>
-<a name="l00154"></a>00154 <span class="stringliteral">"Used to define manually the start and end wavelength for the reconstructed\n"</span>
-<a name="l00155"></a>00155 <span class="stringliteral">"cube. By default the internally defined values are used.\n"</span>
-<a name="l00156"></a>00156 <span class="stringliteral">"\n"</span>
-<a name="l00157"></a>00157 <span class="stringliteral">" Advanced combining parameters\n"</span>
-<a name="l00158"></a>00158 <span class="stringliteral">" ----------------------------------\n"</span>
-<a name="l00159"></a>00159 <span class="stringliteral">"--cmethod\n"</span>
-<a name="l00160"></a>00160 <span class="stringliteral">"Following methods of frame combination are available:\n"</span>
-<a name="l00161"></a>00161 <span class="stringliteral">" * 'ksigma' (Default)\n"</span>
-<a name="l00162"></a>00162 <span class="stringliteral">" An iterative sigma clipping. For each position all pixels in the spectrum\n"</span>
-<a name="l00163"></a>00163 <span class="stringliteral">" are examined. If they deviate significantly, they will be rejected according\n"</span>
-<a name="l00164"></a>00164 <span class="stringliteral">" to the conditions:\n"</span>
-<a name="l00165"></a>00165 <span class="stringliteral">" val > mean + stdev * cpos_rej\n"</span>
-<a name="l00166"></a>00166 <span class="stringliteral">" and\n"</span>
-<a name="l00167"></a>00167 <span class="stringliteral">" val < mean - stdev * cneg_rej\n"</span>
-<a name="l00168"></a>00168 <span class="stringliteral">" where --cpos_rej, --cneg_rej and --citer are the corresponding configuration\n"</span>
-<a name="l00169"></a>00169 <span class="stringliteral">" parameters. In the first iteration median and percentile level are used.\n"</span>
-<a name="l00170"></a>00170 <span class="stringliteral">"\n"</span>
-<a name="l00171"></a>00171 <span class="stringliteral">" * 'median'\n"</span>
-<a name="l00172"></a>00172 <span class="stringliteral">" At each pixel position the median is calculated.\n"</span>
-<a name="l00173"></a>00173 <span class="stringliteral">"\n"</span>
-<a name="l00174"></a>00174 <span class="stringliteral">" * 'average'\n"</span>
-<a name="l00175"></a>00175 <span class="stringliteral">" At each pixel position the average is calculated.\n"</span>
-<a name="l00176"></a>00176 <span class="stringliteral">"\n"</span>
-<a name="l00177"></a>00177 <span class="stringliteral">" * 'sum'\n"</span>
-<a name="l00178"></a>00178 <span class="stringliteral">" At each pixel position the sum is calculated.\n"</span>
-<a name="l00179"></a>00179 <span class="stringliteral">"\n"</span>
-<a name="l00180"></a>00180 <span class="stringliteral">" * 'min_max'\n"</span>
-<a name="l00181"></a>00181 <span class="stringliteral">" The specified number of minimum and maximum pixel values will be rejected.\n"</span>
-<a name="l00182"></a>00182 <span class="stringliteral">" --cmax and --cmin apply to this method.\n"</span>
-<a name="l00183"></a>00183 <span class="stringliteral">"\n"</span>
-<a name="l00184"></a>00184 <span class="stringliteral">"--cpos_rej\n"</span>
-<a name="l00185"></a>00185 <span class="stringliteral">"--cneg_rej\n"</span>
-<a name="l00186"></a>00186 <span class="stringliteral">"--citer\n"</span>
-<a name="l00187"></a>00187 <span class="stringliteral">"see --cmethod='ksigma'\n"</span>
-<a name="l00188"></a>00188 <span class="stringliteral">"\n"</span>
-<a name="l00189"></a>00189 <span class="stringliteral">"--cmax\n"</span>
-<a name="l00190"></a>00190 <span class="stringliteral">"--cmin\n"</span>
-<a name="l00191"></a>00191 <span class="stringliteral">"see --cmethod='min_max'\n"</span>
-<a name="l00192"></a>00192 <span class="stringliteral">"\n"</span>
-<a name="l00193"></a>00193 <span class="stringliteral">"-------------------------------------------------------------------------------\n"</span>
-<a name="l00194"></a>00194 <span class="stringliteral">" Input files:\n"</span>
-<a name="l00195"></a>00195 <span class="stringliteral">"\n"</span>
-<a name="l00196"></a>00196 <span class="stringliteral">" DO DO KMOS \n"</span>
-<a name="l00197"></a>00197 <span class="stringliteral">" category group Type Explanation Required #Frames\n"</span>
-<a name="l00198"></a>00198 <span class="stringliteral">" -------- ----- ----- ----------- -------- -------\n"</span>
-<a name="l00199"></a>00199 <span class="stringliteral">" SCIENCE RAW The science frames Y >=2 \n"</span>
-<a name="l00200"></a>00200 <span class="stringliteral">" XCAL F2D x calibration frame Y 1 \n"</span>
-<a name="l00201"></a>00201 <span class="stringliteral">" YCAL F2D y calibration frame Y 1 \n"</span>
-<a name="l00202"></a>00202 <span class="stringliteral">" LCAL F2D Wavelength calib. frame Y 1 \n"</span>
-<a name="l00203"></a>00203 <span class="stringliteral">" WAVE_BAND F2L Table with start-/end-wavelengths Y 1 \n"</span>
-<a name="l00204"></a>00204 <span class="stringliteral">"\n"</span>
-<a name="l00205"></a>00205 <span class="stringliteral">" Output files:\n"</span>
-<a name="l00206"></a>00206 <span class="stringliteral">"\n"</span>
-<a name="l00207"></a>00207 <span class="stringliteral">" DO KMOS\n"</span>
-<a name="l00208"></a>00208 <span class="stringliteral">" category Type Explanation\n"</span>
-<a name="l00209"></a>00209 <span class="stringliteral">" -------- ----- -----------\n"</span>
-<a name="l00210"></a>00210 <span class="stringliteral">" CUBE_MULTI_<name/ifu> F3I Combined data cube\n"</span>
-<a name="l00211"></a>00211 <span class="stringliteral">"-------------------------------------------------------------------------------\n"</span>
-<a name="l00212"></a>00212 <span class="stringliteral">"\n"</span>;
-<a name="l00213"></a>00213
-<a name="l00230"></a><a class="code" href="group__kmo__multi__reconstruct.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693">00230</a> <span class="keywordtype">int</span> <a class="code" href="group__kmo__arithmetic.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693" title="Build the list of available plugins, for this module.">cpl_plugin_get_info</a>(cpl_pluginlist *list)
-<a name="l00231"></a>00231 {
-<a name="l00232"></a>00232 cpl_recipe *recipe = cpl_calloc(1, <span class="keyword">sizeof</span> *recipe);
-<a name="l00233"></a>00233 cpl_plugin *plugin = &recipe->interface;
-<a name="l00234"></a>00234
-<a name="l00235"></a>00235 cpl_plugin_init(plugin,
-<a name="l00236"></a>00236 CPL_PLUGIN_API,
-<a name="l00237"></a>00237 KMOS_BINARY_VERSION,
-<a name="l00238"></a>00238 CPL_PLUGIN_TYPE_RECIPE,
-<a name="l00239"></a>00239 <span class="stringliteral">"kmo_multi_reconstruct"</span>,
-<a name="l00240"></a>00240 <span class="stringliteral">"Reconstruct and combine cubes in one processing step"</span>,
-<a name="l00241"></a>00241 kmo_multi_reconstruct_description,
-<a name="l00242"></a>00242 <span class="stringliteral">"Alex Agudo Berbel"</span>,
-<a name="l00243"></a>00243 <span class="stringliteral">"kmos-spark at mpe.mpg.de"</span>,
-<a name="l00244"></a>00244 kmos_get_license(),
-<a name="l00245"></a>00245 kmo_multi_reconstruct_create,
-<a name="l00246"></a>00246 kmo_multi_reconstruct_exec,
-<a name="l00247"></a>00247 kmo_multi_reconstruct_destroy);
-<a name="l00248"></a>00248
-<a name="l00249"></a>00249 cpl_pluginlist_append(list, plugin);
-<a name="l00250"></a>00250
-<a name="l00251"></a>00251 <span class="keywordflow">return</span> 0;
-<a name="l00252"></a>00252 }
-<a name="l00253"></a>00253
-<a name="l00261"></a>00261 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct_create(cpl_plugin *plugin)
-<a name="l00262"></a>00262 {
-<a name="l00263"></a>00263 cpl_recipe *recipe;
-<a name="l00264"></a>00264 cpl_parameter *p;
-<a name="l00265"></a>00265
-<a name="l00266"></a>00266 <span class="comment">/* Check that the plugin is part of a valid recipe */</span>
-<a name="l00267"></a>00267 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
-<a name="l00268"></a>00268 recipe = (cpl_recipe *)plugin;
-<a name="l00269"></a>00269 <span class="keywordflow">else</span>
-<a name="l00270"></a>00270 <span class="keywordflow">return</span> -1;
-<a name="l00271"></a>00271
-<a name="l00272"></a>00272 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
-<a name="l00273"></a>00273 recipe->parameters = cpl_parameterlist_new();
-<a name="l00274"></a>00274
-<a name="l00275"></a>00275 <span class="comment">/* Fill the parameters list */</span>
-<a name="l00276"></a>00276
-<a name="l00277"></a>00277 <span class="comment">/* --imethod (interpolation method) */</span>
-<a name="l00278"></a>00278 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.imethod"</span>,
-<a name="l00279"></a>00279 CPL_TYPE_STRING,
-<a name="l00280"></a>00280 <span class="stringliteral">"Method to use for interpolation. "</span>
-<a name="l00281"></a>00281 <span class="stringliteral">"[\"NN\" (nearest neighbour), "</span>
-<a name="l00282"></a>00282 <span class="stringliteral">"\"lwNN\" (linear weighted nearest neighbor), "</span>
-<a name="l00283"></a>00283 <span class="stringliteral">"\"swNN\" (square weighted nearest neighbor), "</span>
-<a name="l00284"></a>00284 <span class="stringliteral">"\"MS\" (Modified Shepard's method)"</span>,
-<a name="l00285"></a>00285 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
-<a name="l00286"></a>00286 <span class="stringliteral">"MS"</span>);
-<a name="l00287"></a>00287 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"imethod"</span>);
-<a name="l00288"></a>00288 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00289"></a>00289 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00290"></a>00290
-<a name="l00291"></a>00291 <span class="comment">/* --method (shift method) */</span>
-<a name="l00292"></a>00292 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.method"</span>,
-<a name="l00293"></a>00293 CPL_TYPE_STRING,
-<a name="l00294"></a>00294 <span class="stringliteral">"The shifting method: "</span>
-<a name="l00295"></a>00295 <span class="stringliteral">"'none': no shifting, combined directly "</span>
-<a name="l00296"></a>00296 <span class="stringliteral">"(default), "</span>
-<a name="l00297"></a>00297 <span class="stringliteral">"'header': shift according to WCS, "</span>
-<a name="l00298"></a>00298 <span class="stringliteral">"'center': centering algorithm, "</span>
-<a name="l00299"></a>00299 <span class="stringliteral">"'user': read shifts from file"</span>,
-<a name="l00300"></a>00300 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
-<a name="l00301"></a>00301 <span class="stringliteral">"header"</span>);
-<a name="l00302"></a>00302 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"method"</span>);
-<a name="l00303"></a>00303 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00304"></a>00304 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00305"></a>00305
-<a name="l00306"></a>00306 <span class="comment">/* --fmethod */</span>
-<a name="l00307"></a>00307 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.fmethod"</span>,
-<a name="l00308"></a>00308 CPL_TYPE_STRING,
-<a name="l00309"></a>00309 <span class="stringliteral">"The fitting method (applies only when "</span>
-<a name="l00310"></a>00310 <span class="stringliteral">"method='center'): "</span>
-<a name="l00311"></a>00311 <span class="stringliteral">"'gauss': fit a gauss function to collapsed "</span>
-<a name="l00312"></a>00312 <span class="stringliteral">"image (default), "</span>
-<a name="l00313"></a>00313 <span class="stringliteral">"'moffat': fit a moffat function to collapsed"</span>
-<a name="l00314"></a>00314 <span class="stringliteral">" image"</span>,
-<a name="l00315"></a>00315 <span class="stringliteral">"kmos.kmo_combine"</span>,
-<a name="l00316"></a>00316 <span class="stringliteral">"gauss"</span>);
-<a name="l00317"></a>00317 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"fmethod"</span>);
-<a name="l00318"></a>00318 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00319"></a>00319 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00320"></a>00320
-<a name="l00321"></a>00321 <span class="comment">/* --name */</span>
-<a name="l00322"></a>00322 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.name"</span>,
-<a name="l00323"></a>00323 CPL_TYPE_STRING,
-<a name="l00324"></a>00324 <span class="stringliteral">"Name of the object to combine."</span>,
-<a name="l00325"></a>00325 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
-<a name="l00326"></a>00326 <span class="stringliteral">""</span>);
-<a name="l00327"></a>00327 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"name"</span>);
-<a name="l00328"></a>00328 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00329"></a>00329 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00330"></a>00330
-<a name="l00331"></a>00331 <span class="comment">/* --ifus */</span>
-<a name="l00332"></a>00332 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.ifus"</span>,
-<a name="l00333"></a>00333 CPL_TYPE_STRING,
-<a name="l00334"></a>00334 <span class="stringliteral">"The indices of the IFUs to combine. "</span>
-<a name="l00335"></a>00335 <span class="stringliteral">"\"ifu1;ifu2;...\""</span>,
-<a name="l00336"></a>00336 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
-<a name="l00337"></a>00337 <span class="stringliteral">""</span>);
-<a name="l00338"></a>00338 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"ifus"</span>);
-<a name="l00339"></a>00339 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00340"></a>00340 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00341"></a>00341
-<a name="l00342"></a>00342 <span class="comment">/* --pix_scale */</span>
-<a name="l00343"></a>00343 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.pix_scale"</span>,
-<a name="l00344"></a>00344 CPL_TYPE_DOUBLE,
-<a name="l00345"></a>00345 <span class="stringliteral">"Change the pixel scale [arcsec]. "</span>
-<a name="l00346"></a>00346 <span class="stringliteral">"Default of 0.2\" results into cubes of 14x14pix, "</span>
-<a name="l00347"></a>00347 <span class="stringliteral">"a scale of 0.1\" results into cubes of 28x28pix, "</span>
-<a name="l00348"></a>00348 <span class="stringliteral">"etc."</span>,
-<a name="l00349"></a>00349 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
-<a name="l00350"></a>00350 KMOS_PIX_RESOLUTION);
-<a name="l00351"></a>00351 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"pix_scale"</span>);
-<a name="l00352"></a>00352 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00353"></a>00353 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00354"></a>00354
-<a name="l00355"></a>00355 <span class="comment">/* --suppress_extension */</span>
-<a name="l00356"></a>00356 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.suppress_extension"</span>,
-<a name="l00357"></a>00357 CPL_TYPE_BOOL,
-<a name="l00358"></a>00358 <span class="stringliteral">"Suppress arbitrary filename extension."</span>
-<a name="l00359"></a>00359 <span class="stringliteral">"(TRUE (apply) or FALSE (don't apply)"</span>,
-<a name="l00360"></a>00360 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
-<a name="l00361"></a>00361 FALSE);
-<a name="l00362"></a>00362 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"suppress_extension"</span>);
-<a name="l00363"></a>00363 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00364"></a>00364 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00365"></a>00365
-<a name="l00366"></a>00366 <span class="comment">/* --neighborhoodRange */</span>
-<a name="l00367"></a>00367 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.neighborhoodRange"</span>,
-<a name="l00368"></a>00368 CPL_TYPE_DOUBLE,
-<a name="l00369"></a>00369 <span class="stringliteral">"Defines the range to search for neighbors. "</span>
-<a name="l00370"></a>00370 <span class="stringliteral">"in pixels"</span>,
-<a name="l00371"></a>00371 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
-<a name="l00372"></a>00372 1.001);
-<a name="l00373"></a>00373 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"neighborhoodRange"</span>);
-<a name="l00374"></a>00374 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00375"></a>00375 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00376"></a>00376
-<a name="l00377"></a>00377 <span class="comment">/* --filename */</span>
-<a name="l00378"></a>00378 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.filename"</span>,
-<a name="l00379"></a>00379 CPL_TYPE_STRING,
-<a name="l00380"></a>00380 <span class="stringliteral">"The path to the file with the shift vectors."</span>
-<a name="l00381"></a>00381 <span class="stringliteral">"(Applies only to method='user')"</span>,
-<a name="l00382"></a>00382 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
-<a name="l00383"></a>00383 <span class="stringliteral">""</span>);
-<a name="l00384"></a>00384 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"filename"</span>);
-<a name="l00385"></a>00385 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00386"></a>00386 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00387"></a>00387
-<a name="l00388"></a>00388 <span class="comment">/* --dev_cal */</span>
-<a name="l00389"></a>00389 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.dev_cal"</span>,
-<a name="l00390"></a>00390 CPL_TYPE_BOOL,
-<a name="l00391"></a>00391 <span class="stringliteral">"Development only: If calibration data is to be "</span>
-<a name="l00392"></a>00392 <span class="stringliteral">"reconstructed the ALPHA/DELTA keywords are "</span>
-<a name="l00393"></a>00393 <span class="stringliteral">"missing. Setting this parameter to TRUE prevents "</span>
-<a name="l00394"></a>00394 <span class="stringliteral">"according data check"</span>,
-<a name="l00395"></a>00395 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
-<a name="l00396"></a>00396 FALSE);
-<a name="l00397"></a>00397 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"dev_cal"</span>);
-<a name="l00398"></a>00398 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00399"></a>00399 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00400"></a>00400
-<a name="l00401"></a>00401 <span class="comment">/* --size */</span>
-<a name="l00402"></a>00402 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.size"</span>,
-<a name="l00403"></a>00403 CPL_TYPE_STRING,
-<a name="l00404"></a>00404 <span class="stringliteral">"Spatial size of the output cube."</span>,
-<a name="l00405"></a>00405 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
-<a name="l00406"></a>00406 <span class="stringliteral">"max"</span>);
-<a name="l00407"></a>00407 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"size"</span>);
-<a name="l00408"></a>00408 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00409"></a>00409 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00410"></a>00410
-<a name="l00411"></a>00411 <span class="comment">// add parameters for band-definition</span>
-<a name="l00412"></a>00412 kmo_band_pars_create(recipe->parameters,
-<a name="l00413"></a>00413 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>);
-<a name="l00414"></a>00414
-<a name="l00415"></a>00415 <span class="keywordflow">return</span> kmo_combine_pars_create(recipe->parameters,
-<a name="l00416"></a>00416 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
-<a name="l00417"></a>00417 DEF_REJ_METHOD,
-<a name="l00418"></a>00418 FALSE);
-<a name="l00419"></a>00419 }
-<a name="l00420"></a>00420
-<a name="l00426"></a>00426 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct_exec(cpl_plugin *plugin)
-<a name="l00427"></a>00427 {
-<a name="l00428"></a>00428 cpl_recipe *recipe;
-<a name="l00429"></a>00429
-<a name="l00430"></a>00430 <span class="comment">/* Get the recipe out of the plugin */</span>
-<a name="l00431"></a>00431 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
-<a name="l00432"></a>00432 recipe = (cpl_recipe *)plugin;
-<a name="l00433"></a>00433 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
-<a name="l00434"></a>00434
-<a name="l00435"></a>00435 <span class="keywordflow">return</span> kmo_multi_reconstruct(recipe->parameters, recipe->frames);
-<a name="l00436"></a>00436 }
+<a name="l00152"></a>00152 <span class="stringliteral">" Advanced combining parameters\n"</span>
+<a name="l00153"></a>00153 <span class="stringliteral">" ----------------------------------\n"</span>
+<a name="l00154"></a>00154 <span class="stringliteral">"--method\n"</span>
+<a name="l00155"></a>00155 <span class="stringliteral">"There are following sources to get the shift parameters from:\n"</span>
+<a name="l00156"></a>00156 <span class="stringliteral">" * 'header' (default)\n"</span>
+<a name="l00157"></a>00157 <span class="stringliteral">" The shifts are calculated according to the WCS information stored in the\n"</span>
+<a name="l00158"></a>00158 <span class="stringliteral">" header of every IFU. The output frame will get larger, except the object is\n"</span>
+<a name="l00159"></a>00159 <span class="stringliteral">" at the exact same position for all exposures. The size of the exposures can\n"</span>
+<a name="l00160"></a>00160 <span class="stringliteral">" differ, but the orientation must be the same for all exposures.\n"</span>
+<a name="l00161"></a>00161 <span class="stringliteral">"\n"</span>
+<a name="l00162"></a>00162 <span class="stringliteral">" * 'none'\n"</span>
+<a name="l00163"></a>00163 <span class="stringliteral">" The cubes are directly recombined, not shifting at all. The ouput frame\n"</span>
+<a name="l00164"></a>00164 <span class="stringliteral">" will have the same dimensions as the input cubes.\n"</span>
+<a name="l00165"></a>00165 <span class="stringliteral">" If the size differs a warning will be emitted and the cubes will be aligned\n"</span>
+<a name="l00166"></a>00166 <span class="stringliteral">" to the lower left corner. If the orientation differs a warning will be\n"</span>
+<a name="l00167"></a>00167 <span class="stringliteral">" emitted, but the cubes are combined anyway.\n"</span>
+<a name="l00168"></a>00168 <span class="stringliteral">"\n"</span>
+<a name="l00169"></a>00169 <span class="stringliteral">" * 'center'\n"</span>
+<a name="l00170"></a>00170 <span class="stringliteral">" The shifts are calculated using a centering algorithm. The cube will be\n"</span>
+<a name="l00171"></a>00171 <span class="stringliteral">" collapsed and a 2D profile will be fitted to it to identify the centre.\n"</span>
+<a name="l00172"></a>00172 <span class="stringliteral">" With the parameter --fmethod the function to fit can be provided. The size\n"</span>
+<a name="l00173"></a>00173 <span class="stringliteral">" of the exposures can differ, but the orientation must be the same for all\n"</span>
+<a name="l00174"></a>00174 <span class="stringliteral">" exposures.\n"</span>
+<a name="l00175"></a>00175 <span class="stringliteral">"\n"</span>
+<a name="l00176"></a>00176 <span class="stringliteral">" * 'user'\n"</span>
+<a name="l00177"></a>00177 <span class="stringliteral">" Read the shifts from a user specified file. The path of the file must be\n"</span>
+<a name="l00178"></a>00178 <span class="stringliteral">" provided using the --filename parameter. For every exposure (except the\n"</span>
+<a name="l00179"></a>00179 <span class="stringliteral">" first one) two shift values are expected per line, they have to be separa-\n"</span>
+<a name="l00180"></a>00180 <span class="stringliteral">" ted with simple spaces. The values indicate pixel shifts and are referenced\n"</span>
+<a name="l00181"></a>00181 <span class="stringliteral">" to the first frame. The 1st value is the shift in x-direction to the left,\n"</span>
+<a name="l00182"></a>00182 <span class="stringliteral">" the 2nd the shift in y-direction upwards. The size of the exposures can\n"</span>
+<a name="l00183"></a>00183 <span class="stringliteral">" differ, but the orientation must be the same for all exposures.\n"</span>
+<a name="l00184"></a>00184 <span class="stringliteral">"\n"</span>
+<a name="l00185"></a>00185 <span class="stringliteral">"--fmethod\n"</span>
+<a name="l00186"></a>00186 <span class="stringliteral">"see --method='center'\n"</span>
+<a name="l00187"></a>00187 <span class="stringliteral">"The type of function that should be fitted spatially to the collapsed image.\n"</span>
+<a name="l00188"></a>00188 <span class="stringliteral">"This fit is used to create a mask to extract the spectrum of the object. Valid\n"</span>
+<a name="l00189"></a>00189 <span class="stringliteral">"values are 'gauss' and 'moffat'.\n"</span>
+<a name="l00190"></a>00190 <span class="stringliteral">"\n"</span>
+<a name="l00191"></a>00191 <span class="stringliteral">"--filename\n"</span>
+<a name="l00192"></a>00192 <span class="stringliteral">"see --method='user'\n"</span>
+<a name="l00193"></a>00193 <span class="stringliteral">"\n"</span>
+<a name="l00194"></a>00194 <span class="stringliteral">"--cmethod\n"</span>
+<a name="l00195"></a>00195 <span class="stringliteral">"Following methods of frame combination are available:\n"</span>
+<a name="l00196"></a>00196 <span class="stringliteral">" * 'ksigma' (Default)\n"</span>
+<a name="l00197"></a>00197 <span class="stringliteral">" An iterative sigma clipping. For each position all pixels in the spectrum\n"</span>
+<a name="l00198"></a>00198 <span class="stringliteral">" are examined. If they deviate significantly, they will be rejected according\n"</span>
+<a name="l00199"></a>00199 <span class="stringliteral">" to the conditions:\n"</span>
+<a name="l00200"></a>00200 <span class="stringliteral">" val > mean + stdev * cpos_rej\n"</span>
+<a name="l00201"></a>00201 <span class="stringliteral">" and\n"</span>
+<a name="l00202"></a>00202 <span class="stringliteral">" val < mean - stdev * cneg_rej\n"</span>
+<a name="l00203"></a>00203 <span class="stringliteral">" where --cpos_rej, --cneg_rej and --citer are the corresponding configuration\n"</span>
+<a name="l00204"></a>00204 <span class="stringliteral">" parameters. In the first iteration median and percentile level are used.\n"</span>
+<a name="l00205"></a>00205 <span class="stringliteral">"\n"</span>
+<a name="l00206"></a>00206 <span class="stringliteral">" * 'median'\n"</span>
+<a name="l00207"></a>00207 <span class="stringliteral">" At each pixel position the median is calculated.\n"</span>
+<a name="l00208"></a>00208 <span class="stringliteral">"\n"</span>
+<a name="l00209"></a>00209 <span class="stringliteral">" * 'average'\n"</span>
+<a name="l00210"></a>00210 <span class="stringliteral">" At each pixel position the average is calculated.\n"</span>
+<a name="l00211"></a>00211 <span class="stringliteral">"\n"</span>
+<a name="l00212"></a>00212 <span class="stringliteral">" * 'sum'\n"</span>
+<a name="l00213"></a>00213 <span class="stringliteral">" At each pixel position the sum is calculated.\n"</span>
+<a name="l00214"></a>00214 <span class="stringliteral">"\n"</span>
+<a name="l00215"></a>00215 <span class="stringliteral">" * 'min_max'\n"</span>
+<a name="l00216"></a>00216 <span class="stringliteral">" The specified number of minimum and maximum pixel values will be rejected.\n"</span>
+<a name="l00217"></a>00217 <span class="stringliteral">" --cmax and --cmin apply to this method.\n"</span>
+<a name="l00218"></a>00218 <span class="stringliteral">"\n"</span>
+<a name="l00219"></a>00219 <span class="stringliteral">"--cpos_rej\n"</span>
+<a name="l00220"></a>00220 <span class="stringliteral">"--cneg_rej\n"</span>
+<a name="l00221"></a>00221 <span class="stringliteral">"--citer\n"</span>
+<a name="l00222"></a>00222 <span class="stringliteral">"see --cmethod='ksigma'\n"</span>
+<a name="l00223"></a>00223 <span class="stringliteral">"\n"</span>
+<a name="l00224"></a>00224 <span class="stringliteral">"--cmax\n"</span>
+<a name="l00225"></a>00225 <span class="stringliteral">"--cmin\n"</span>
+<a name="l00226"></a>00226 <span class="stringliteral">"see --cmethod='min_max'\n"</span>
+<a name="l00227"></a>00227 <span class="stringliteral">"\n"</span>
+<a name="l00228"></a>00228 <span class="stringliteral">"------------------------------------------------------------------------------\n"</span>
+<a name="l00229"></a>00229 <span class="stringliteral">" Input files:\n"</span>
+<a name="l00230"></a>00230 <span class="stringliteral">"\n"</span>
+<a name="l00231"></a>00231 <span class="stringliteral">" DO KMOS \n"</span>
+<a name="l00232"></a>00232 <span class="stringliteral">" category Type Explanation Required #Frames\n"</span>
+<a name="l00233"></a>00233 <span class="stringliteral">" -------- ----- ----------- -------- -------\n"</span>
+<a name="l00234"></a>00234 <span class="stringliteral">" SCIENCE RAW The science frames Y >=1 \n"</span>
+<a name="l00235"></a>00235 <span class="stringliteral">" XCAL F2D x calibration frame Y 1 \n"</span>
+<a name="l00236"></a>00236 <span class="stringliteral">" YCAL F2D y calibration frame Y 1 \n"</span>
+<a name="l00237"></a>00237 <span class="stringliteral">" LCAL F2D Wavelength calib. frame Y 1 \n"</span>
+<a name="l00238"></a>00238 <span class="stringliteral">" MASTER_FLAT F2D Master flat Y 0,1 \n"</span>
+<a name="l00239"></a>00239 <span class="stringliteral">" WAVE_BAND F2L Table with start-/end-wavelengths Y 1 \n"</span>
+<a name="l00240"></a>00240 <span class="stringliteral">" TELLURIC F1I normalised telluric spectrum N 0,1 \n"</span>
+<a name="l00241"></a>00241 <span class="stringliteral">" OH_SPEC F1S Vector holding OH lines N 0,1 \n"</span>
+<a name="l00242"></a>00242 <span class="stringliteral">"\n"</span>
+<a name="l00243"></a>00243 <span class="stringliteral">" Output files:\n"</span>
+<a name="l00244"></a>00244 <span class="stringliteral">"\n"</span>
+<a name="l00245"></a>00245 <span class="stringliteral">" DO KMOS\n"</span>
+<a name="l00246"></a>00246 <span class="stringliteral">" category Type Explanation\n"</span>
+<a name="l00247"></a>00247 <span class="stringliteral">" -------- ----- -----------\n"</span>
+<a name="l00248"></a>00248 <span class="stringliteral">" CUBE_MULTI F3I Combined cubes with noise\n"</span>
+<a name="l00249"></a>00249 <span class="stringliteral">"------------------------------------------------------------------------------\n"</span>
+<a name="l00250"></a>00250 <span class="stringliteral">"\n"</span>;
+<a name="l00251"></a>00251
+<a name="l00252"></a>00252 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00253"></a>00253 <span class="comment"> * Functions code</span>
+<a name="l00254"></a>00254 <span class="comment"> *----------------------------------------------------------------------------*/</span>
+<a name="l00255"></a>00255
+<a name="l00273"></a><a class="code" href="group__kmo__multi__reconstruct.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693">00273</a> <span class="keywordtype">int</span> <a class="code" href="group__kmo__arithmetic.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693" title="Build the list of available plugins, for this module.">cpl_plugin_get_info</a>(cpl_pluginlist *list)
+<a name="l00274"></a>00274 {
+<a name="l00275"></a>00275 cpl_recipe *recipe = cpl_calloc(1, <span class="keyword">sizeof</span> *recipe);
+<a name="l00276"></a>00276 cpl_plugin *plugin = &recipe->interface;
+<a name="l00277"></a>00277
+<a name="l00278"></a>00278 cpl_plugin_init(plugin,
+<a name="l00279"></a>00279 CPL_PLUGIN_API,
+<a name="l00280"></a>00280 KMOS_BINARY_VERSION,
+<a name="l00281"></a>00281 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00282"></a>00282 <span class="stringliteral">"kmo_multi_reconstruct"</span>,
+<a name="l00283"></a>00283 <span class="stringliteral">"Reconstruct and combine obj/sky-pairs in one step."</span>,
+<a name="l00284"></a>00284 kmo_multi_reconstruct_description,
+<a name="l00285"></a>00285 <span class="stringliteral">"Alex Agudo Berbel"</span>,
+<a name="l00286"></a>00286 <span class="stringliteral">"kmos-spark at mpe.mpg.de"</span>,
+<a name="l00287"></a>00287 kmos_get_license(),
+<a name="l00288"></a>00288 kmo_multi_reconstruct_create,
+<a name="l00289"></a>00289 kmo_multi_reconstruct_exec,
+<a name="l00290"></a>00290 kmo_multi_reconstruct_destroy);
+<a name="l00291"></a>00291
+<a name="l00292"></a>00292 cpl_pluginlist_append(list, plugin);
+<a name="l00293"></a>00293
+<a name="l00294"></a>00294 <span class="keywordflow">return</span> 0;
+<a name="l00295"></a>00295 }
+<a name="l00296"></a>00296
+<a name="l00304"></a>00304 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct_create(cpl_plugin *plugin)
+<a name="l00305"></a>00305 {
+<a name="l00306"></a>00306 cpl_recipe *recipe;
+<a name="l00307"></a>00307 cpl_parameter *p;
+<a name="l00308"></a>00308
+<a name="l00309"></a>00309 <span class="comment">/* Check that the plugin is part of a valid recipe */</span>
+<a name="l00310"></a>00310 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00311"></a>00311 recipe = (cpl_recipe *)plugin;
+<a name="l00312"></a>00312 <span class="keywordflow">else</span>
+<a name="l00313"></a>00313 <span class="keywordflow">return</span> -1;
+<a name="l00314"></a>00314
+<a name="l00315"></a>00315 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00316"></a>00316 recipe->parameters = cpl_parameterlist_new();
+<a name="l00317"></a>00317
+<a name="l00318"></a>00318 <span class="comment">/* --imethod (interpolation method) */</span>
+<a name="l00319"></a>00319 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.imethod"</span>,
+<a name="l00320"></a>00320 CPL_TYPE_STRING,
+<a name="l00321"></a>00321 <span class="stringliteral">"Method to use for interpolation during reconstruction. "</span>
+<a name="l00322"></a>00322 <span class="stringliteral">"[\"NN\" (nearest neighbour), "</span>
+<a name="l00323"></a>00323 <span class="stringliteral">"\"lwNN\" (linear weighted nearest neighbor), "</span>
+<a name="l00324"></a>00324 <span class="stringliteral">"\"swNN\" (square weighted nearest neighbor), "</span>
+<a name="l00325"></a>00325 <span class="stringliteral">"\"MS\" (Modified Shepard's method)"</span>,
+<a name="l00326"></a>00326 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00327"></a>00327 <span class="stringliteral">"MS"</span>);
+<a name="l00328"></a>00328 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"imethod"</span>);
+<a name="l00329"></a>00329 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00330"></a>00330 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00331"></a>00331
+<a name="l00332"></a>00332 <span class="comment">/* --method (shift method) */</span>
+<a name="l00333"></a>00333 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.method"</span>,
+<a name="l00334"></a>00334 CPL_TYPE_STRING,
+<a name="l00335"></a>00335 <span class="stringliteral">"The shifting method: "</span>
+<a name="l00336"></a>00336 <span class="stringliteral">"'none': no shifting, combined directly, "</span>
+<a name="l00337"></a>00337 <span class="stringliteral">"'header': shift according to WCS (default), "</span>
+<a name="l00338"></a>00338 <span class="stringliteral">"'center': centering algorithm, "</span>
+<a name="l00339"></a>00339 <span class="stringliteral">"'user': read shifts from file"</span>,
+<a name="l00340"></a>00340 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00341"></a>00341 <span class="stringliteral">"header"</span>);
+<a name="l00342"></a>00342 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"method"</span>);
+<a name="l00343"></a>00343 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00344"></a>00344 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00345"></a>00345
+<a name="l00346"></a>00346 <span class="comment">/* --fmethod */</span>
+<a name="l00347"></a>00347 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.fmethod"</span>,
+<a name="l00348"></a>00348 CPL_TYPE_STRING,
+<a name="l00349"></a>00349 <span class="stringliteral">"The fitting method (applies only when "</span>
+<a name="l00350"></a>00350 <span class="stringliteral">"method='center'): "</span>
+<a name="l00351"></a>00351 <span class="stringliteral">"'gauss': fit a gauss function to collapsed "</span>
+<a name="l00352"></a>00352 <span class="stringliteral">"image (default), "</span>
+<a name="l00353"></a>00353 <span class="stringliteral">"'moffat': fit a moffat function to collapsed"</span>
+<a name="l00354"></a>00354 <span class="stringliteral">" image"</span>,
+<a name="l00355"></a>00355 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00356"></a>00356 <span class="stringliteral">"gauss"</span>);
+<a name="l00357"></a>00357 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"fmethod"</span>);
+<a name="l00358"></a>00358 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00359"></a>00359 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00360"></a>00360
+<a name="l00361"></a>00361 <span class="comment">/* --name */</span>
+<a name="l00362"></a>00362 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.name"</span>,
+<a name="l00363"></a>00363 CPL_TYPE_STRING,
+<a name="l00364"></a>00364 <span class="stringliteral">"Name of the object to combine."</span>,
+<a name="l00365"></a>00365 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00366"></a>00366 <span class="stringliteral">""</span>);
+<a name="l00367"></a>00367 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"name"</span>);
+<a name="l00368"></a>00368 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00369"></a>00369 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00370"></a>00370
+<a name="l00371"></a>00371 <span class="comment">/* --ifus */</span>
+<a name="l00372"></a>00372 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.ifus"</span>,
+<a name="l00373"></a>00373 CPL_TYPE_STRING,
+<a name="l00374"></a>00374 <span class="stringliteral">"The indices of the IFUs to combine. "</span>
+<a name="l00375"></a>00375 <span class="stringliteral">"\"ifu1;ifu2;...\""</span>,
+<a name="l00376"></a>00376 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00377"></a>00377 <span class="stringliteral">""</span>);
+<a name="l00378"></a>00378 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"ifus"</span>);
+<a name="l00379"></a>00379 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00380"></a>00380 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00381"></a>00381
+<a name="l00382"></a>00382 <span class="comment">/* --pix_scale */</span>
+<a name="l00383"></a>00383 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.pix_scale"</span>,
+<a name="l00384"></a>00384 CPL_TYPE_DOUBLE,
+<a name="l00385"></a>00385 <span class="stringliteral">"Change the pixel scale [arcsec]. "</span>
+<a name="l00386"></a>00386 <span class="stringliteral">"Default of 0.2\" results into cubes of 14x14pix, "</span>
+<a name="l00387"></a>00387 <span class="stringliteral">"a scale of 0.1\" results into cubes of 28x28pix, "</span>
+<a name="l00388"></a>00388 <span class="stringliteral">"etc."</span>,
+<a name="l00389"></a>00389 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00390"></a>00390 KMOS_PIX_RESOLUTION);
+<a name="l00391"></a>00391 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"pix_scale"</span>);
+<a name="l00392"></a>00392 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00393"></a>00393 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00394"></a>00394
+<a name="l00395"></a>00395 <span class="comment">/* --suppress_extension */</span>
+<a name="l00396"></a>00396 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.suppress_extension"</span>,
+<a name="l00397"></a>00397 CPL_TYPE_BOOL,
+<a name="l00398"></a>00398 <span class="stringliteral">"Suppress arbitrary filename extension."</span>
+<a name="l00399"></a>00399 <span class="stringliteral">"(TRUE (apply) or FALSE (don't apply)"</span>,
+<a name="l00400"></a>00400 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00401"></a>00401 FALSE);
+<a name="l00402"></a>00402 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"suppress_extension"</span>);
+<a name="l00403"></a>00403 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00404"></a>00404 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00405"></a>00405
+<a name="l00406"></a>00406 <span class="comment">/* --neighborhoodRange */</span>
+<a name="l00407"></a>00407 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.neighborhoodRange"</span>,
+<a name="l00408"></a>00408 CPL_TYPE_DOUBLE,
+<a name="l00409"></a>00409 <span class="stringliteral">"Defines the range to search for neighbors "</span>
+<a name="l00410"></a>00410 <span class="stringliteral">"in pixels"</span>,
+<a name="l00411"></a>00411 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00412"></a>00412 1.001);
+<a name="l00413"></a>00413 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"neighborhoodRange"</span>);
+<a name="l00414"></a>00414 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00415"></a>00415 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00416"></a>00416
+<a name="l00417"></a>00417 <span class="comment">/* --filename */</span>
+<a name="l00418"></a>00418 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.filename"</span>,
+<a name="l00419"></a>00419 CPL_TYPE_STRING,
+<a name="l00420"></a>00420 <span class="stringliteral">"The path to the file with the shift vectors."</span>
+<a name="l00421"></a>00421 <span class="stringliteral">"(Applies only to method='user')"</span>,
+<a name="l00422"></a>00422 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00423"></a>00423 <span class="stringliteral">""</span>);
+<a name="l00424"></a>00424 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"filename"</span>);
+<a name="l00425"></a>00425 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00426"></a>00426 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00427"></a>00427
+<a name="l00428"></a>00428 <span class="comment">/* --flux */</span>
+<a name="l00429"></a>00429 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.flux"</span>,
+<a name="l00430"></a>00430 CPL_TYPE_BOOL,
+<a name="l00431"></a>00431 <span class="stringliteral">"TRUE: Apply flux conservation. FALSE: otherwise"</span>,
+<a name="l00432"></a>00432 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00433"></a>00433 FALSE);
+<a name="l00434"></a>00434 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"flux"</span>);
+<a name="l00435"></a>00435 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00436"></a>00436 cpl_parameterlist_append(recipe->parameters, p);
<a name="l00437"></a>00437
-<a name="l00443"></a>00443 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct_destroy(cpl_plugin *plugin)
-<a name="l00444"></a>00444 {
-<a name="l00445"></a>00445 cpl_recipe *recipe;
-<a name="l00446"></a>00446
-<a name="l00447"></a>00447 <span class="comment">/* Get the recipe out of the plugin */</span>
-<a name="l00448"></a>00448 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
-<a name="l00449"></a>00449 recipe = (cpl_recipe *)plugin;
-<a name="l00450"></a>00450 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
-<a name="l00451"></a>00451
-<a name="l00452"></a>00452 cpl_parameterlist_delete(recipe->parameters);
-<a name="l00453"></a>00453 <span class="keywordflow">return</span> 0 ;
-<a name="l00454"></a>00454 }
-<a name="l00455"></a>00455
-<a name="l00470"></a>00470 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frameset)
-<a name="l00471"></a>00471 {
-<a name="l00472"></a>00472 <span class="keyword">const</span> <span class="keywordtype">char</span> *method = NULL,
-<a name="l00473"></a>00473 *cmethod = NULL,
-<a name="l00474"></a>00474 *fmethod = NULL,
-<a name="l00475"></a>00475 *imethod = NULL,
-<a name="l00476"></a>00476 *filename = NULL,
-<a name="l00477"></a>00477 *ifus_txt = NULL,
-<a name="l00478"></a>00478 *name = NULL,
-<a name="l00479"></a>00479 *size = NULL,
-<a name="l00480"></a>00480 *filter_id = NULL;
-<a name="l00481"></a>00481 <span class="keywordtype">char</span> *tmp_str = NULL,
-<a name="l00482"></a>00482 *filename_output_cube = NULL,
-<a name="l00483"></a>00483 *extname = NULL,
-<a name="l00484"></a>00484 *keyword = NULL,
-<a name="l00485"></a>00485 *suffix = NULL,
-<a name="l00486"></a>00486 *tmp_ocs = NULL,
-<a name="l00487"></a>00487 **exposure_filename = NULL,
-<a name="l00488"></a>00488 **exposure_objectname = NULL;
-<a name="l00489"></a>00489 <span class="keywordtype">int</span> ret_val = 0,
-<a name="l00490"></a>00490 device_nr = 0,
-<a name="l00491"></a>00491 citer = 0,
-<a name="l00492"></a>00492 cmin = 0,
-<a name="l00493"></a>00493 cmax = 0,
-<a name="l00494"></a>00494 nr_alloc = 0,
-<a name="l00495"></a>00495 suppress_extension = FALSE,
-<a name="l00496"></a>00496 i = 0,
-<a name="l00497"></a>00497 *exposure_ifus = NULL,
-<a name="l00498"></a>00498 nr_science_frames = 0,
-<a name="l00499"></a>00499 dev_cal = 0;
-<a name="l00500"></a>00500 <span class="keywordtype">double</span> neighborhoodRange = 1.001,
-<a name="l00501"></a>00501 cpos_rej = 0.0,
-<a name="l00502"></a>00502 cneg_rej = 0.0,
-<a name="l00503"></a>00503 pix_scale = 0.0,
-<a name="l00504"></a>00504 *xshifts = NULL,
-<a name="l00505"></a>00505 *yshifts = NULL,
-<a name="l00506"></a>00506 cd1_1 = 0.0,
-<a name="l00507"></a>00507 cd1_2 = 0.0,
-<a name="l00508"></a>00508 ang1 = 0.0,
-<a name="l00509"></a>00509 ang2 = 0.0,
-<a name="l00510"></a>00510 exposure_rotangle = 0.0,
-<a name="l00511"></a>00511 rotangle_found = 0.0;
-<a name="l00512"></a>00512 cpl_imagelist **data_cube_list = NULL,
-<a name="l00513"></a>00513 **noise_cube_list = NULL,
-<a name="l00514"></a>00514 *cube_combined_data = NULL,
-<a name="l00515"></a>00515 *cube_combined_noise = NULL;
-<a name="l00516"></a>00516 cpl_vector *ifus = NULL;
-<a name="l00517"></a>00517 cpl_propertylist *pl = NULL,
-<a name="l00518"></a>00518 *main_header = NULL,
-<a name="l00519"></a>00519 *ref_main_header = NULL,
-<a name="l00520"></a>00520 *ref_sub_header = NULL,
-<a name="l00521"></a>00521 *tmp_header = NULL,
-<a name="l00522"></a>00522 **header_data = NULL,
-<a name="l00523"></a>00523 **data_header_list = NULL,
-<a name="l00524"></a>00524 **noise_header_list = NULL;
-<a name="l00525"></a>00525 cpl_frame *frame = NULL,
-<a name="l00526"></a>00526 *lcal_frame = NULL,
-<a name="l00527"></a>00527 **empty_frames = NULL,
-<a name="l00528"></a>00528 *tmp_frame = NULL,
-<a name="l00529"></a>00529 *ref_frame = NULL;
-<a name="l00530"></a>00530 cpl_table *band_table = NULL;
-<a name="l00531"></a>00531 cpl_image *lcalImg = NULL;
-<a name="l00532"></a>00532 cpl_frameset *exposures = NULL;
-<a name="l00533"></a>00533 main_fits_desc desc;
-<a name="l00534"></a>00534 gridDefinition gd;
-<a name="l00535"></a>00535
-<a name="l00536"></a>00536 KMO_TRY
-<a name="l00537"></a>00537 {
-<a name="l00538"></a>00538 <span class="comment">//</span>
-<a name="l00539"></a>00539 <span class="comment">// check frameset</span>
-<a name="l00540"></a>00540 <span class="comment">//</span>
-<a name="l00541"></a>00541 KMO_TRY_ASSURE((parlist != NULL) &&
-<a name="l00542"></a>00542 (frameset != NULL),
-<a name="l00543"></a>00543 CPL_ERROR_NULL_INPUT,
-<a name="l00544"></a>00544 <span class="stringliteral">"Not all input data is provided!"</span>);
-<a name="l00545"></a>00545
-<a name="l00546"></a>00546 KMO_TRY_ASSURE(! ((cpl_frameset_count_tags(frameset, XCAL) == 0) &&
-<a name="l00547"></a>00547 (cpl_frameset_count_tags(frameset, YCAL) == 0) &&
-<a name="l00548"></a>00548 (cpl_frameset_count_tags(frameset, LCAL) == 0) &&
-<a name="l00549"></a>00549 (cpl_frameset_count_tags(frameset, WAVE_BAND) == 0)),
-<a name="l00550"></a>00550 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00551"></a>00551 <span class="stringliteral">"XCAL, YCAL, LCAL or WAVE_BAND frames missing in "</span>
-<a name="l00552"></a>00552 <span class="stringliteral">"frameset!!"</span>);
-<a name="l00553"></a>00553
-<a name="l00554"></a>00554 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, XCAL) == 1,
-<a name="l00555"></a>00555 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00556"></a>00556 <span class="stringliteral">"Exactly one XCAL frame is expected in frameset!"</span>);
-<a name="l00557"></a>00557
-<a name="l00558"></a>00558 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, YCAL) == 1,
-<a name="l00559"></a>00559 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00560"></a>00560 <span class="stringliteral">"Exactly one YCAL frame is expected in frameset!"</span>);
-<a name="l00561"></a>00561
-<a name="l00562"></a>00562 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, LCAL) == 1,
-<a name="l00563"></a>00563 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00564"></a>00564 <span class="stringliteral">"Exactly one LCAL frame is expected in frameset!"</span>);
-<a name="l00565"></a>00565
-<a name="l00566"></a>00566 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, WAVE_BAND) == 1,
-<a name="l00567"></a>00567 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00568"></a>00568 <span class="stringliteral">"Exactly one WAVE_BAND frame is expected in frameset!"</span>);
-<a name="l00569"></a>00569
-<a name="l00570"></a>00570 <span class="comment">// assert that at least two SCIENCE frames are available and create</span>
-<a name="l00571"></a>00571 <span class="comment">// intermediate frameset just with these science frames</span>
-<a name="l00572"></a>00572 nr_science_frames = cpl_frameset_count_tags(frameset, SCIENCE);
-<a name="l00573"></a>00573 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00574"></a>00574
-<a name="l00575"></a>00575 KMO_TRY_ASSURE(nr_science_frames > 1,
-<a name="l00576"></a>00576 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00577"></a>00577 <span class="stringliteral">"At least two SCIENCE frames must be provided to combine!"</span>);
-<a name="l00578"></a>00578
-<a name="l00579"></a>00579 KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, <span class="stringliteral">"kmo_multi_reconstruct"</span>) == 1,
-<a name="l00580"></a>00580 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00581"></a>00581 <span class="stringliteral">"Cannot identify RAW and CALIB frames!"</span>);
-<a name="l00582"></a>00582
-<a name="l00583"></a>00583 KMO_TRY_EXIT_IF_NULL(
-<a name="l00584"></a>00584 exposures = cpl_frameset_new());
-<a name="l00585"></a>00585 KMO_TRY_EXIT_IF_NULL(
-<a name="l00586"></a>00586 tmp_frame = kmo_dfs_get_frame(frameset, SCIENCE));
-<a name="l00587"></a>00587
-<a name="l00588"></a>00588 <span class="keywordflow">for</span> (i = 0; i < nr_science_frames; i++) {
-<a name="l00589"></a>00589 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00590"></a>00590 cpl_frameset_insert(exposures, cpl_frame_duplicate(tmp_frame)));
-<a name="l00591"></a>00591 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00592"></a>00592
-<a name="l00593"></a>00593 tmp_frame = kmo_dfs_get_frame(frameset, NULL);
-<a name="l00594"></a>00594 }
-<a name="l00595"></a>00595
-<a name="l00596"></a>00596 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"--- Parameter setup for kmo_multi_reconstruct -------"</span>);
-<a name="l00597"></a>00597
-<a name="l00598"></a>00598 KMO_TRY_EXIT_IF_NULL(
-<a name="l00599"></a>00599 imethod = kmo_dfs_get_parameter_string(parlist,
-<a name="l00600"></a>00600 <span class="stringliteral">"kmos.kmo_multi_reconstruct.imethod"</span>));
-<a name="l00601"></a>00601
-<a name="l00602"></a>00602 KMO_TRY_ASSURE((strcmp(imethod, <span class="stringliteral">"NN"</span>) == 0) ||
-<a name="l00603"></a>00603 (strcmp(imethod, <span class="stringliteral">"lwNN"</span>) == 0) ||
-<a name="l00604"></a>00604 (strcmp(imethod, <span class="stringliteral">"swNN"</span>) == 0) ||
-<a name="l00605"></a>00605 (strcmp(imethod, <span class="stringliteral">"MS"</span>) == 0),
-<a name="l00606"></a>00606 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00607"></a>00607 <span class="stringliteral">"imethod must be either \"NN\", \"lwNN\", "</span>
-<a name="l00608"></a>00608 <span class="stringliteral">"\"swNN\" or \"MS\"!"</span>);
-<a name="l00609"></a>00609
-<a name="l00610"></a>00610 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00611"></a>00611 kmo_dfs_print_parameter_help(parlist,
-<a name="l00612"></a>00612 <span class="stringliteral">"kmos.kmo_multi_reconstruct.imethod"</span>));
+<a name="l00438"></a>00438 <span class="comment">/* --background */</span>
+<a name="l00439"></a>00439 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.background"</span>,
+<a name="l00440"></a>00440 CPL_TYPE_BOOL,
+<a name="l00441"></a>00441 <span class="stringliteral">"TRUE: Apply background removal. FALSE: otherwise"</span>,
+<a name="l00442"></a>00442 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00443"></a>00443 FALSE);
+<a name="l00444"></a>00444 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"background"</span>);
+<a name="l00445"></a>00445 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00446"></a>00446 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00447"></a>00447
+<a name="l00448"></a>00448 <span class="comment">/* --xcal_interpolation */</span>
+<a name="l00449"></a>00449 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.xcal_interpolation"</span>,
+<a name="l00450"></a>00450 CPL_TYPE_BOOL,
+<a name="l00451"></a>00451 <span class="stringliteral">"TRUE: Interpolate xcal between rotator angles. FALSE: otherwise"</span>,
+<a name="l00452"></a>00452 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00453"></a>00453 TRUE);
+<a name="l00454"></a>00454 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"xcal_interpolation"</span>);
+<a name="l00455"></a>00455 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00456"></a>00456 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00457"></a>00457
+<a name="l00458"></a>00458 <span class="comment">/* --no_subtract */</span>
+<a name="l00459"></a>00459 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.no_subtract"</span>,
+<a name="l00460"></a>00460 CPL_TYPE_BOOL,
+<a name="l00461"></a>00461 <span class="stringliteral">"Don't sky subtract object and references."</span>
+<a name="l00462"></a>00462 <span class="stringliteral">"(TRUE (apply) or "</span>
+<a name="l00463"></a>00463 <span class="stringliteral">"FALSE (don't apply)"</span>,
+<a name="l00464"></a>00464 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00465"></a>00465 FALSE);
+<a name="l00466"></a>00466 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"no_subtract"</span>);
+<a name="l00467"></a>00467 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00468"></a>00468 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00469"></a>00469
+<a name="l00470"></a>00470 <span class="comment">/* --dev_cal */</span>
+<a name="l00471"></a>00471 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_multi_reconstruct.dev_cal"</span>,
+<a name="l00472"></a>00472 CPL_TYPE_BOOL,
+<a name="l00473"></a>00473 <span class="stringliteral">"Development only: If calibration data is to be "</span>
+<a name="l00474"></a>00474 <span class="stringliteral">"reconstructed the ALPHA/DELTA keywords are "</span>
+<a name="l00475"></a>00475 <span class="stringliteral">"missing. Setting this parameter to TRUE prevents "</span>
+<a name="l00476"></a>00476 <span class="stringliteral">"according data check"</span>,
+<a name="l00477"></a>00477 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00478"></a>00478 FALSE);
+<a name="l00479"></a>00479 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"dev_cal"</span>);
+<a name="l00480"></a>00480 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00481"></a>00481 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00482"></a>00482
+<a name="l00483"></a>00483 <span class="comment">// add parameters for band-definition</span>
+<a name="l00484"></a>00484 kmo_band_pars_create(recipe->parameters,
+<a name="l00485"></a>00485 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>);
+<a name="l00486"></a>00486
+<a name="l00487"></a>00487 <span class="keywordflow">return</span> kmo_combine_pars_create(recipe->parameters,
+<a name="l00488"></a>00488 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00489"></a>00489 DEF_REJ_METHOD,
+<a name="l00490"></a>00490 FALSE);
+<a name="l00491"></a>00491 }
+<a name="l00492"></a>00492
+<a name="l00498"></a>00498 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct_exec(cpl_plugin *plugin)
+<a name="l00499"></a>00499 {
+<a name="l00500"></a>00500 cpl_recipe *recipe;
+<a name="l00501"></a>00501
+<a name="l00502"></a>00502 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00503"></a>00503 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00504"></a>00504 recipe = (cpl_recipe *)plugin;
+<a name="l00505"></a>00505 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00506"></a>00506
+<a name="l00507"></a>00507 <span class="keywordflow">return</span> kmo_multi_reconstruct(recipe->parameters, recipe->frames);
+<a name="l00508"></a>00508 }
+<a name="l00509"></a>00509
+<a name="l00515"></a>00515 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct_destroy(cpl_plugin *plugin)
+<a name="l00516"></a>00516 {
+<a name="l00517"></a>00517 cpl_recipe *recipe;
+<a name="l00518"></a>00518
+<a name="l00519"></a>00519 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00520"></a>00520 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00521"></a>00521 recipe = (cpl_recipe *)plugin;
+<a name="l00522"></a>00522 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00523"></a>00523
+<a name="l00524"></a>00524 cpl_parameterlist_delete(recipe->parameters);
+<a name="l00525"></a>00525 <span class="keywordflow">return</span> 0 ;
+<a name="l00526"></a>00526 }
+<a name="l00527"></a>00527
+<a name="l00542"></a>00542 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_multi_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frameset)
+<a name="l00543"></a>00543 {
+<a name="l00544"></a>00544 <span class="keywordtype">int</span> ret_val = 0,
+<a name="l00545"></a>00545 nr_science_frames = 0,
+<a name="l00546"></a>00546 has_illum_corr = 0,
+<a name="l00547"></a>00547 has_master_flat = 0,
+<a name="l00548"></a>00548 has_telluric = 0,
+<a name="l00549"></a>00549 *bounds = NULL,
+<a name="l00550"></a>00550 citer = 0,
+<a name="l00551"></a>00551 cmin = 0,
+<a name="l00552"></a>00552 cmax = 0,
+<a name="l00553"></a>00553 flux = FALSE,
+<a name="l00554"></a>00554 background = FALSE,
+<a name="l00555"></a>00555 no_subtract = FALSE,
+<a name="l00556"></a>00556 xcal_interpolation = FALSE,
+<a name="l00557"></a>00557 suppress_extension = FALSE,
+<a name="l00558"></a>00558 dev_cal = 0,
+<a name="l00559"></a>00559 cnt = 0,
+<a name="l00560"></a>00560 arm_index = 0,
+<a name="l00561"></a>00561 suppress_index = 0,
+<a name="l00562"></a>00562 xdim = 0,
+<a name="l00563"></a>00563 ydim = 0,
+<a name="l00564"></a>00564 iy = 0,
+<a name="l00565"></a>00565 ix = 0,
+<a name="l00566"></a>00566 ifu_nr = 0,
+<a name="l00567"></a>00567 nr_frames = 0;
+<a name="l00568"></a>00568 <span class="keywordtype">double</span> xmin = DBL_MAX,
+<a name="l00569"></a>00569 xmax = -DBL_MAX,
+<a name="l00570"></a>00570 ymin = DBL_MAX,
+<a name="l00571"></a>00571 ymax = -DBL_MAX,
+<a name="l00572"></a>00572 gxshift = 0.,
+<a name="l00573"></a>00573 gyshift = 0.,
+<a name="l00574"></a>00574 gxdim = 0.,
+<a name="l00575"></a>00575 gydim = 0.,
+<a name="l00576"></a>00576 neighborhoodRange = 1.001,
+<a name="l00577"></a>00577 cpos_rej = 0.0,
+<a name="l00578"></a>00578 cneg_rej = 0.0,
+<a name="l00579"></a>00579 pix_scale = 0.0,
+<a name="l00580"></a>00580 *xshifts = NULL,
+<a name="l00581"></a>00581 *yshifts = NULL;
+<a name="l00582"></a>00582 <span class="keywordtype">char</span> *suffix = NULL,
+<a name="l00583"></a>00583 *mapping_mode = NULL,
+<a name="l00584"></a>00584 *fn_cube = NULL,
+<a name="l00585"></a>00585 *fn_suffix = NULL,
+<a name="l00586"></a>00586 *filter_id = NULL,
+<a name="l00587"></a>00587 *extname = NULL;
+<a name="l00588"></a>00588 <span class="keyword">const</span> <span class="keywordtype">char</span> *imethod = NULL,
+<a name="l00589"></a>00589 *ifus_txt = NULL,
+<a name="l00590"></a>00590 *name = NULL,
+<a name="l00591"></a>00591 *tmp_str = NULL,
+<a name="l00592"></a>00592 *filename = NULL,
+<a name="l00593"></a>00593 *comb_method = NULL,
+<a name="l00594"></a>00594 *cmethod = NULL,
+<a name="l00595"></a>00595 *fmethod = NULL,
+<a name="l00596"></a>00596 *filter_keyword = <span class="stringliteral">"ESO INS FILT1 ID"</span>;
+<a name="l00597"></a>00597 cpl_array **unused_ifus_before = NULL,
+<a name="l00598"></a>00598 **unused_ifus_after = NULL;
+<a name="l00599"></a>00599 cpl_frame *xcal_frame = NULL,
+<a name="l00600"></a>00600 *ycal_frame = NULL,
+<a name="l00601"></a>00601 *lcal_frame = NULL,
+<a name="l00602"></a>00602 *flat_frame = NULL,
+<a name="l00603"></a>00603 *illum_frame = NULL,
+<a name="l00604"></a>00604 *telluric_frame = NULL,
+<a name="l00605"></a>00605 *science_frame = NULL,
+<a name="l00606"></a>00606 *ref_spectrum_frame = NULL;
+<a name="l00607"></a>00607 cpl_propertylist *tmp_header = NULL,
+<a name="l00608"></a>00608 *ref_sub_header = NULL,
+<a name="l00609"></a>00609 *science_frame_header = NULL,
+<a name="l00610"></a>00610 **sub_headers = NULL;
+<a name="l00611"></a>00611 cpl_vector *ifus = NULL;
+<a name="l00612"></a>00612 cpl_table *band_table = NULL;
<a name="l00613"></a>00613
-<a name="l00614"></a>00614 pix_scale = kmo_dfs_get_parameter_double(parlist,
-<a name="l00615"></a>00615 <span class="stringliteral">"kmos.kmo_multi_reconstruct.pix_scale"</span>);
-<a name="l00616"></a>00616 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00617"></a>00617 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00618"></a>00618 kmo_dfs_print_parameter_help(parlist,
-<a name="l00619"></a>00619 <span class="stringliteral">"kmos.kmo_multi_reconstruct.pix_scale"</span>));
-<a name="l00620"></a>00620 KMO_TRY_ASSURE((pix_scale >= 0.01) &&
-<a name="l00621"></a>00621 (pix_scale <= 0.4),
-<a name="l00622"></a>00622 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00623"></a>00623 <span class="stringliteral">"pix_scale must be between 0.01 and 0.4 (results in cubes "</span>
-<a name="l00624"></a>00624 <span class="stringliteral">"with 7x7 to 280x280 pixels)!"</span>);
-<a name="l00625"></a>00625
-<a name="l00626"></a>00626 neighborhoodRange = kmo_dfs_get_parameter_double(parlist,
-<a name="l00627"></a>00627 <span class="stringliteral">"kmos.kmo_multi_reconstruct.neighborhoodRange"</span>);
-<a name="l00628"></a>00628 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00614"></a>00614 cpl_polynomial **lcorr_coeffs = NULL;
+<a name="l00615"></a>00615 cpl_imagelist *cube_combined_data = NULL,
+<a name="l00616"></a>00616 *cube_combined_noise = NULL,
+<a name="l00617"></a>00617 **pre_data_cube_list = NULL;
+<a name="l00618"></a>00618 kmclipm_vector *telluric_data = NULL,
+<a name="l00619"></a>00619 *telluric_noise = NULL;
+<a name="l00620"></a>00620 main_fits_desc desc1,
+<a name="l00621"></a>00621 desc2,
+<a name="l00622"></a>00622 desc_telluric;
+<a name="l00623"></a>00623 gridDefinition gd,
+<a name="l00624"></a>00624 gd_14x14;
+<a name="l00625"></a>00625 armNameStruct *arm_name_struct = NULL;
+<a name="l00626"></a>00626
+<a name="l00627"></a>00627 KMO_TRY
+<a name="l00628"></a>00628 {
<a name="l00629"></a>00629
-<a name="l00630"></a>00630 KMO_TRY_ASSURE(neighborhoodRange > 0.0,
-<a name="l00631"></a>00631 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00632"></a>00632 <span class="stringliteral">"neighborhoodRange must be greater than 0.0"</span>);
+<a name="l00630"></a>00630 kmo_init_fits_desc(&desc1);
+<a name="l00631"></a>00631 kmo_init_fits_desc(&desc2);
+<a name="l00632"></a>00632 kmo_init_fits_desc(&desc_telluric);
<a name="l00633"></a>00633
-<a name="l00634"></a>00634 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00635"></a>00635 kmo_dfs_print_parameter_help(parlist,
-<a name="l00636"></a>00636 <span class="stringliteral">"kmos.kmo_multi_reconstruct.neighborhoodRange"</span>));
-<a name="l00637"></a>00637
-<a name="l00638"></a>00638 KMO_TRY_EXIT_IF_NULL(
-<a name="l00639"></a>00639 size = kmo_dfs_get_parameter_string(parlist,
-<a name="l00640"></a>00640 <span class="stringliteral">"kmos.kmo_multi_reconstruct.size"</span>));
+<a name="l00634"></a>00634 <span class="comment">//</span>
+<a name="l00635"></a>00635 <span class="comment">// check frameset</span>
+<a name="l00636"></a>00636 <span class="comment">//</span>
+<a name="l00637"></a>00637 KMO_TRY_ASSURE((parlist != NULL) &&
+<a name="l00638"></a>00638 (frameset != NULL),
+<a name="l00639"></a>00639 CPL_ERROR_NULL_INPUT,
+<a name="l00640"></a>00640 <span class="stringliteral">"Not all input data is provided!"</span>);
<a name="l00641"></a>00641
-<a name="l00642"></a>00642 KMO_TRY_EXIT_IF_NULL(
-<a name="l00643"></a>00643 method = kmo_dfs_get_parameter_string(parlist,
-<a name="l00644"></a>00644 <span class="stringliteral">"kmos.kmo_multi_reconstruct.method"</span>));
-<a name="l00645"></a>00645
-<a name="l00646"></a>00646 KMO_TRY_EXIT_IF_NULL(
-<a name="l00647"></a>00647 fmethod = kmo_dfs_get_parameter_string(parlist,
-<a name="l00648"></a>00648 <span class="stringliteral">"kmos.kmo_multi_reconstruct.fmethod"</span>));
-<a name="l00649"></a>00649
-<a name="l00650"></a>00650 KMO_TRY_ASSURE((strcmp(size, <span class="stringliteral">"max"</span>) == 0) ||
-<a name="l00651"></a>00651 (strcmp(size, <span class="stringliteral">"std"</span>) == 0),
-<a name="l00652"></a>00652 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00653"></a>00653 <span class="stringliteral">"Following output cube size specifications are available: "</span>
-<a name="l00654"></a>00654 <span class="stringliteral">"'std' or 'max'"</span>);
-<a name="l00655"></a>00655
+<a name="l00642"></a>00642 nr_science_frames = cpl_frameset_count_tags(frameset, SCIENCE);
+<a name="l00643"></a>00643 KMO_TRY_ASSURE(nr_science_frames >= 1,
+<a name="l00644"></a>00644 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00645"></a>00645 <span class="stringliteral">"At least one SCIENCE frame is required!"</span>);
+<a name="l00646"></a>00646 <span class="keywordflow">if</span> (nr_science_frames == 1) {
+<a name="l00647"></a>00647 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"At least two SCIENCE frames should be provided "</span>
+<a name="l00648"></a>00648 <span class="stringliteral">"in order to apply sky subtraction!"</span>);
+<a name="l00649"></a>00649 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"All IFUs will be reconstructed regardless if "</span>
+<a name="l00650"></a>00650 <span class="stringliteral">"they contain object, reference or sky!"</span>);
+<a name="l00651"></a>00651 }
+<a name="l00652"></a>00652
+<a name="l00653"></a>00653 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, XCAL) == 1,
+<a name="l00654"></a>00654 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00655"></a>00655 <span class="stringliteral">"Exactly one XCAL frame is required!"</span>);
<a name="l00656"></a>00656
-<a name="l00657"></a>00657 KMO_TRY_ASSURE((strcmp(method, <span class="stringliteral">"none"</span>) == 0) ||
-<a name="l00658"></a>00658 (strcmp(method, <span class="stringliteral">"header"</span>) == 0) ||
-<a name="l00659"></a>00659 (strcmp(method, <span class="stringliteral">"center"</span>) == 0) ||
-<a name="l00660"></a>00660 (strcmp(method, <span class="stringliteral">"user"</span>) == 0),
-<a name="l00661"></a>00661 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00662"></a>00662 <span class="stringliteral">"Following shift methods are available : 'none', "</span>
-<a name="l00663"></a>00663 <span class="stringliteral">"'header', 'center' or 'user'"</span>);
+<a name="l00657"></a>00657 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, YCAL) == 1,
+<a name="l00658"></a>00658 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00659"></a>00659 <span class="stringliteral">"Exactly one YCAL frame is required!"</span>);
+<a name="l00660"></a>00660
+<a name="l00661"></a>00661 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, LCAL) == 1,
+<a name="l00662"></a>00662 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00663"></a>00663 <span class="stringliteral">"Exactly one LCAL frame is required!"</span>);
<a name="l00664"></a>00664
-<a name="l00665"></a>00665 <span class="keywordflow">if</span> (strcmp(method, <span class="stringliteral">"user"</span>) == 0) {
-<a name="l00666"></a>00666 filename = kmo_dfs_get_parameter_string(parlist,
-<a name="l00667"></a>00667 <span class="stringliteral">"kmos.kmo_multi_reconstruct.filename"</span>);
-<a name="l00668"></a>00668 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00665"></a>00665 has_master_flat = cpl_frameset_count_tags(frameset, MASTER_FLAT);
+<a name="l00666"></a>00666 KMO_TRY_ASSURE((has_master_flat == 0) || (has_master_flat == 1),
+<a name="l00667"></a>00667 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00668"></a>00668 <span class="stringliteral">"At most one MASTER_FLAT frame can be provided!"</span>);
<a name="l00669"></a>00669
-<a name="l00670"></a>00670 KMO_TRY_ASSURE(strcmp(filename, <span class="stringliteral">""</span>) != 0,
-<a name="l00671"></a>00671 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00672"></a>00672 <span class="stringliteral">"path of file with shift information must be "</span>
-<a name="l00673"></a>00673 <span class="stringliteral">"provided!"</span>);
-<a name="l00674"></a>00674
-<a name="l00675"></a>00675 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00676"></a>00676 kmo_dfs_print_parameter_help(parlist,
-<a name="l00677"></a>00677 <span class="stringliteral">"kmos.kmo_multi_reconstruct.filename"</span>));
-<a name="l00678"></a>00678 }
-<a name="l00679"></a>00679
-<a name="l00680"></a>00680 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00681"></a>00681 kmo_dfs_print_parameter_help(parlist,
-<a name="l00682"></a>00682 <span class="stringliteral">"kmos.kmo_multi_reconstruct.method"</span>));
+<a name="l00670"></a>00670 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, WAVE_BAND) == 1,
+<a name="l00671"></a>00671 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00672"></a>00672 <span class="stringliteral">"Exactly one WAVE_BAND frame is required!"</span>);
+<a name="l00673"></a>00673
+<a name="l00674"></a>00674 has_illum_corr = cpl_frameset_count_tags(frameset, ILLUM_CORR);
+<a name="l00675"></a>00675 KMO_TRY_ASSURE((has_illum_corr == 0) || (has_illum_corr == 1),
+<a name="l00676"></a>00676 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00677"></a>00677 <span class="stringliteral">"At most one ILLUM_CORR frame can be provided!"</span>);
+<a name="l00678"></a>00678
+<a name="l00679"></a>00679 has_telluric = cpl_frameset_count_tags(frameset, TELLURIC);
+<a name="l00680"></a>00680 KMO_TRY_ASSURE((has_telluric == 0) || (has_telluric == 1),
+<a name="l00681"></a>00681 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00682"></a>00682 <span class="stringliteral">"At most one TELLURIC frame can be provided!"</span>);
<a name="l00683"></a>00683
-<a name="l00684"></a>00684 ifus_txt = kmo_dfs_get_parameter_string(parlist,
-<a name="l00685"></a>00685 <span class="stringliteral">"kmos.kmo_multi_reconstruct.ifus"</span>);
-<a name="l00686"></a>00686 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00684"></a>00684 KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, <span class="stringliteral">"kmo_multi_reconstruct"</span>) == 1,
+<a name="l00685"></a>00685 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00686"></a>00686 <span class="stringliteral">"Cannot identify RAW and CALIB frames!"</span>);
<a name="l00687"></a>00687
-<a name="l00688"></a>00688 name = kmo_dfs_get_parameter_string(parlist,
-<a name="l00689"></a>00689 <span class="stringliteral">"kmos.kmo_multi_reconstruct.name"</span>);
-<a name="l00690"></a>00690 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00691"></a>00691
-<a name="l00692"></a>00692 <span class="keywordflow">if</span> (strcmp(ifus_txt, <span class="stringliteral">""</span>) != 0) {
-<a name="l00693"></a>00693 KMO_TRY_ASSURE(strcmp(name, <span class="stringliteral">""</span>) == 0,
-<a name="l00694"></a>00694 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00695"></a>00695 <span class="stringliteral">"name parameter must be NULL if IFU indices are "</span>
-<a name="l00696"></a>00696 <span class="stringliteral">"provided!"</span>);
-<a name="l00697"></a>00697
-<a name="l00698"></a>00698 KMO_TRY_EXIT_IF_NULL(
-<a name="l00699"></a>00699 ifus = kmo_identify_values(ifus_txt));
-<a name="l00700"></a>00700
-<a name="l00701"></a>00701 KMO_TRY_ASSURE(cpl_vector_get_size(ifus) == nr_science_frames,
-<a name="l00702"></a>00702 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00703"></a>00703 <span class="stringliteral">"ifus parameter must have the same number of values "</span>
-<a name="l00704"></a>00704 <span class="stringliteral">"than frames provided ) (%lld!=%d)"</span>,
-<a name="l00705"></a>00705 cpl_vector_get_size(ifus), nr_science_frames);
-<a name="l00706"></a>00706
-<a name="l00707"></a>00707 <span class="keywordflow">for</span> (i = 0; i < nr_science_frames; i++) {
-<a name="l00708"></a>00708 KMO_TRY_ASSURE((cpl_vector_get(ifus, i) > 0.5 &&
-<a name="l00709"></a>00709 cpl_vector_get(ifus, i) < 24.5 ),
-<a name="l00710"></a>00710 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00711"></a>00711 <span class="stringliteral">"IFU numbers must be in the range 1..24"</span>);
-<a name="l00712"></a>00712 }
-<a name="l00713"></a>00713 }
-<a name="l00714"></a>00714
-<a name="l00715"></a>00715 <span class="keywordflow">if</span> (strcmp(name, <span class="stringliteral">""</span>) != 0) {
-<a name="l00716"></a>00716 KMO_TRY_ASSURE(strcmp(ifus_txt, <span class="stringliteral">""</span>) == 0,
-<a name="l00717"></a>00717 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00718"></a>00718 <span class="stringliteral">"ifus parameter must be NULL if name is provided!"</span>);
-<a name="l00719"></a>00719 }
-<a name="l00720"></a>00720
-<a name="l00721"></a>00721 KMO_TRY_ASSURE((strcmp(name, <span class="stringliteral">""</span>) != 0) || (strcmp(ifus_txt, <span class="stringliteral">""</span>) != 0),
-<a name="l00722"></a>00722 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00723"></a>00723 <span class="stringliteral">"Either the name of the object or the numbers of the "</span>
-<a name="l00724"></a>00724 <span class="stringliteral">"IFUs to combine must be provided (--name or --ifus "</span>
-<a name="l00725"></a>00725 <span class="stringliteral">"parameters)"</span>);
-<a name="l00726"></a>00726
-<a name="l00727"></a>00727 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00728"></a>00728 kmo_dfs_print_parameter_help(parlist,
-<a name="l00729"></a>00729 <span class="stringliteral">"kmos.kmo_multi_reconstruct.ifus"</span>));
-<a name="l00730"></a>00730
-<a name="l00731"></a>00731 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00732"></a>00732 kmo_dfs_print_parameter_help(parlist,
-<a name="l00733"></a>00733 <span class="stringliteral">"kmos.kmo_multi_reconstruct.name"</span>));
-<a name="l00734"></a>00734
-<a name="l00735"></a>00735
-<a name="l00736"></a>00736 suppress_extension = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00737"></a>00737 <span class="stringliteral">"kmos.kmo_multi_reconstruct.suppress_extension"</span>);
-<a name="l00738"></a>00738 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00739"></a>00739 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00740"></a>00740 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.suppress_extension"</span>));
-<a name="l00741"></a>00741
-<a name="l00742"></a>00742 KMO_TRY_ASSURE((suppress_extension == TRUE) || (suppress_extension == FALSE),
-<a name="l00743"></a>00743 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00744"></a>00744 <span class="stringliteral">"suppress_extension must be TRUE or FALSE!"</span>);
-<a name="l00745"></a>00745
-<a name="l00746"></a>00746 dev_cal = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00747"></a>00747 <span class="stringliteral">"kmos.kmo_multi_reconstruct.dev_cal"</span>);
-<a name="l00748"></a>00748 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00749"></a>00749 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00750"></a>00750 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.dev_cal"</span>));
-<a name="l00751"></a>00751
-<a name="l00752"></a>00752 KMO_TRY_ASSURE((dev_cal == TRUE) || (dev_cal == FALSE),
-<a name="l00753"></a>00753 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00754"></a>00754 <span class="stringliteral">"dev_cal must be TRUE or FALSE!"</span>);
+<a name="l00688"></a>00688 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, OH_SPEC) == 0 ||
+<a name="l00689"></a>00689 cpl_frameset_count_tags(frameset, OH_SPEC) == 1,
+<a name="l00690"></a>00690 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00691"></a>00691 <span class="stringliteral">"Only a single reference spectrum can be provided!"</span>);
+<a name="l00692"></a>00692 <span class="comment">//</span>
+<a name="l00693"></a>00693 <span class="comment">// get parameters</span>
+<a name="l00694"></a>00694 <span class="comment">//</span>
+<a name="l00695"></a>00695 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"--- Parameter setup for kmo_multi_reconstruct ------"</span>);
+<a name="l00696"></a>00696
+<a name="l00697"></a>00697 flux = kmo_dfs_get_parameter_bool(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.flux"</span>);
+<a name="l00698"></a>00698 KMO_TRY_ASSURE((flux == 0) ||
+<a name="l00699"></a>00699 (flux == 1),
+<a name="l00700"></a>00700 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00701"></a>00701 <span class="stringliteral">"flux must be either FALSE or TRUE! %d"</span>, flux);
+<a name="l00702"></a>00702 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00703"></a>00703 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.flux"</span>));
+<a name="l00704"></a>00704
+<a name="l00705"></a>00705 background = kmo_dfs_get_parameter_bool(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.background"</span>);
+<a name="l00706"></a>00706 KMO_TRY_ASSURE((background == 0) ||
+<a name="l00707"></a>00707 (background == 1),
+<a name="l00708"></a>00708 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00709"></a>00709 <span class="stringliteral">"background must be either FALSE or TRUE! %d"</span>, background);
+<a name="l00710"></a>00710 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00711"></a>00711 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.background"</span>));
+<a name="l00712"></a>00712
+<a name="l00713"></a>00713 KMO_TRY_EXIT_IF_NULL(
+<a name="l00714"></a>00714 imethod = kmo_dfs_get_parameter_string(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.imethod"</span>));
+<a name="l00715"></a>00715 KMO_TRY_ASSURE((strcmp(imethod, <span class="stringliteral">"NN"</span>) == 0) ||
+<a name="l00716"></a>00716 (strcmp(imethod, <span class="stringliteral">"lwNN"</span>) == 0) ||
+<a name="l00717"></a>00717 (strcmp(imethod, <span class="stringliteral">"swNN"</span>) == 0) ||
+<a name="l00718"></a>00718 (strcmp(imethod, <span class="stringliteral">"MS"</span>) == 0),
+<a name="l00719"></a>00719 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00720"></a>00720 <span class="stringliteral">"imethod must be either \"NN\", \"lwNN\", "</span>
+<a name="l00721"></a>00721 <span class="stringliteral">"\"swNN\" or \"MS\"!"</span>);
+<a name="l00722"></a>00722 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00723"></a>00723 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.imethod"</span>));
+<a name="l00724"></a>00724
+<a name="l00725"></a>00725 neighborhoodRange = kmo_dfs_get_parameter_double(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.neighborhoodRange"</span>);
+<a name="l00726"></a>00726 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00727"></a>00727 KMO_TRY_ASSURE(neighborhoodRange > 0.0,
+<a name="l00728"></a>00728 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00729"></a>00729 <span class="stringliteral">"neighborhoodRange must be greater than 0.0"</span>);
+<a name="l00730"></a>00730 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00731"></a>00731 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.neighborhoodRange"</span>));
+<a name="l00732"></a>00732
+<a name="l00733"></a>00733 KMO_TRY_EXIT_IF_NULL(
+<a name="l00734"></a>00734 comb_method = kmo_dfs_get_parameter_string(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.method"</span>));
+<a name="l00735"></a>00735 KMO_TRY_EXIT_IF_NULL(
+<a name="l00736"></a>00736 fmethod = kmo_dfs_get_parameter_string(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.fmethod"</span>));
+<a name="l00737"></a>00737 KMO_TRY_ASSURE((strcmp(comb_method, <span class="stringliteral">"none"</span>) == 0) ||
+<a name="l00738"></a>00738 (strcmp(comb_method, <span class="stringliteral">"header"</span>) == 0) ||
+<a name="l00739"></a>00739 (strcmp(comb_method, <span class="stringliteral">"center"</span>) == 0) ||
+<a name="l00740"></a>00740 (strcmp(comb_method, <span class="stringliteral">"user"</span>) == 0),
+<a name="l00741"></a>00741 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00742"></a>00742 <span class="stringliteral">"Following shift methods are available : 'none', "</span>
+<a name="l00743"></a>00743 <span class="stringliteral">"'header', 'center' or 'user'"</span>);
+<a name="l00744"></a>00744
+<a name="l00745"></a>00745 <span class="keywordflow">if</span> (strcmp(comb_method, <span class="stringliteral">"user"</span>) == 0) {
+<a name="l00746"></a>00746 filename = kmo_dfs_get_parameter_string(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.filename"</span>);
+<a name="l00747"></a>00747 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00748"></a>00748 KMO_TRY_ASSURE(strcmp(filename, <span class="stringliteral">""</span>) != 0,
+<a name="l00749"></a>00749 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00750"></a>00750 <span class="stringliteral">"path of file with shift information must be "</span>
+<a name="l00751"></a>00751 <span class="stringliteral">"provided!"</span>);
+<a name="l00752"></a>00752 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00753"></a>00753 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.filename"</span>));
+<a name="l00754"></a>00754 }
<a name="l00755"></a>00755
<a name="l00756"></a>00756 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00757"></a>00757 kmo_combine_pars_load(parlist,
-<a name="l00758"></a>00758 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
-<a name="l00759"></a>00759 &cmethod,
-<a name="l00760"></a>00760 &cpos_rej,
-<a name="l00761"></a>00761 &cneg_rej,
-<a name="l00762"></a>00762 &citer,
-<a name="l00763"></a>00763 &cmin,
-<a name="l00764"></a>00764 &cmax,
-<a name="l00765"></a>00765 FALSE));
-<a name="l00766"></a>00766
-<a name="l00767"></a>00767 kmo_band_pars_load(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>);
-<a name="l00768"></a>00768
-<a name="l00769"></a>00769 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
-<a name="l00770"></a>00770
-<a name="l00771"></a>00771 KMO_TRY_EXIT_IF_NULL(
-<a name="l00772"></a>00772 tmp_frame = kmo_dfs_get_frame(frameset, SCIENCE));
-<a name="l00773"></a>00773
-<a name="l00774"></a>00774 KMO_TRY_EXIT_IF_NULL(
-<a name="l00775"></a>00775 suffix = kmo_dfs_get_suffix(tmp_frame, TRUE, FALSE));
-<a name="l00776"></a>00776
-<a name="l00777"></a>00777 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00778"></a>00778 kmo_check_frame_setup_md5_xycal(frameset));
-<a name="l00779"></a>00779 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00780"></a>00780 kmo_check_frame_setup_md5(frameset));
-<a name="l00781"></a>00781
-<a name="l00782"></a>00782 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Detected instrument setup: %s"</span>, suffix+1);
-<a name="l00783"></a>00783 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"(grating 1, 2 & 3)"</span>);
-<a name="l00784"></a>00784 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
-<a name="l00785"></a>00785
-<a name="l00786"></a>00786 <span class="comment">// assure that filters and grating match for</span>
-<a name="l00787"></a>00787 <span class="comment">// XCAL, YCAL, LCAL and for data frames to reconstruct</span>
-<a name="l00788"></a>00788 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00789"></a>00789 kmo_check_frameset_setup(frameset, XCAL, TRUE, FALSE, FALSE));
-<a name="l00790"></a>00790 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00791"></a>00791 kmo_check_frameset_setup(frameset, YCAL, TRUE, FALSE, FALSE));
-<a name="l00792"></a>00792 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00793"></a>00793 kmo_check_frameset_setup(frameset, LCAL, TRUE, FALSE, FALSE));
-<a name="l00794"></a>00794 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00795"></a>00795 kmo_check_frame_setup(frameset, XCAL, YCAL, TRUE, FALSE, TRUE));
-<a name="l00796"></a>00796 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00797"></a>00797 kmo_check_frame_setup(frameset, XCAL, LCAL, TRUE, FALSE, TRUE));
-<a name="l00798"></a>00798 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00799"></a>00799 kmo_check_frameset_setup(frameset, SCIENCE, TRUE, FALSE, FALSE));
-<a name="l00800"></a>00800 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00801"></a>00801 kmo_check_frame_setup(frameset, XCAL, SCIENCE, TRUE, FALSE, TRUE));
-<a name="l00802"></a>00802 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00803"></a>00803 kmo_check_frame_setup_md5_xycal(frameset));
-<a name="l00804"></a>00804 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00805"></a>00805 kmo_check_frame_setup_md5(frameset));
-<a name="l00806"></a>00806
-<a name="l00807"></a>00807 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
-<a name="l00808"></a>00808 <span class="comment">// kmo_check_cal_frames_rotangle(frameset, XCAL, YCAL));</span>
-<a name="l00809"></a>00809 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
-<a name="l00810"></a>00810 <span class="comment">// kmo_check_cal_frames_rotangle(frameset, XCAL, LCAL));</span>
+<a name="l00757"></a>00757 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.method"</span>));
+<a name="l00758"></a>00758 ifus_txt = kmo_dfs_get_parameter_string(parlist,
+<a name="l00759"></a>00759 <span class="stringliteral">"kmos.kmo_multi_reconstruct.ifus"</span>);
+<a name="l00760"></a>00760 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00761"></a>00761 name = kmo_dfs_get_parameter_string(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.name"</span>);
+<a name="l00762"></a>00762 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00763"></a>00763
+<a name="l00764"></a>00764 <span class="keywordflow">if</span> (strcmp(ifus_txt, <span class="stringliteral">""</span>) != 0) {
+<a name="l00765"></a>00765 KMO_TRY_ASSURE(strcmp(name, <span class="stringliteral">""</span>) == 0,
+<a name="l00766"></a>00766 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00767"></a>00767 <span class="stringliteral">"name parameter must be NULL if IFU indices are "</span>
+<a name="l00768"></a>00768 <span class="stringliteral">"provided!"</span>);
+<a name="l00769"></a>00769
+<a name="l00770"></a>00770 KMO_TRY_EXIT_IF_NULL(
+<a name="l00771"></a>00771 ifus = kmo_identify_values(ifus_txt));
+<a name="l00772"></a>00772
+<a name="l00773"></a>00773 KMO_TRY_ASSURE(cpl_vector_get_size(ifus) == nr_science_frames,
+<a name="l00774"></a>00774 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00775"></a>00775 <span class="stringliteral">"ifus parameter must have the same number of values "</span>
+<a name="l00776"></a>00776 <span class="stringliteral">"than frames provided (for frames just containing "</span>
+<a name="l00777"></a>00777 <span class="stringliteral">"skies insert 0)) (%lld=%d)"</span>,
+<a name="l00778"></a>00778 cpl_vector_get_size(ifus), nr_science_frames);
+<a name="l00779"></a>00779 }
+<a name="l00780"></a>00780
+<a name="l00781"></a>00781 <span class="keywordflow">if</span> (strcmp(name, <span class="stringliteral">""</span>) != 0) {
+<a name="l00782"></a>00782 KMO_TRY_ASSURE(strcmp(ifus_txt, <span class="stringliteral">""</span>) == 0,
+<a name="l00783"></a>00783 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00784"></a>00784 <span class="stringliteral">"ifus parameter must be NULL if name is provided!"</span>);
+<a name="l00785"></a>00785 }
+<a name="l00786"></a>00786
+<a name="l00787"></a>00787 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00788"></a>00788 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.ifus"</span>));
+<a name="l00789"></a>00789 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00790"></a>00790 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.name"</span>));
+<a name="l00791"></a>00791
+<a name="l00792"></a>00792 kmo_band_pars_load(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>);
+<a name="l00793"></a>00793
+<a name="l00794"></a>00794 no_subtract = kmo_dfs_get_parameter_bool(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.no_subtract"</span>);
+<a name="l00795"></a>00795 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00796"></a>00796 KMO_TRY_ASSURE((no_subtract == TRUE) || (no_subtract == FALSE),
+<a name="l00797"></a>00797 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00798"></a>00798 <span class="stringliteral">"no_subtract must be TRUE or FALSE!"</span>);
+<a name="l00799"></a>00799 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00800"></a>00800 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.no_subtract"</span>));
+<a name="l00801"></a>00801
+<a name="l00802"></a>00802 pix_scale = kmo_dfs_get_parameter_double(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.pix_scale"</span>);
+<a name="l00803"></a>00803 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00804"></a>00804 KMO_TRY_ASSURE((pix_scale >= 0.01) &&
+<a name="l00805"></a>00805 (pix_scale <= 0.4),
+<a name="l00806"></a>00806 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00807"></a>00807 <span class="stringliteral">"pix_scale must be between 0.01 and 0.4 (results in cubes "</span>
+<a name="l00808"></a>00808 <span class="stringliteral">"with 7x7 to 280x280 pixels)!"</span>);
+<a name="l00809"></a>00809 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00810"></a>00810 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.pix_scale"</span>));
<a name="l00811"></a>00811
-<a name="l00812"></a>00812 nr_alloc = nr_science_frames;
-<a name="l00813"></a>00813 KMO_TRY_EXIT_IF_NULL(
-<a name="l00814"></a>00814 exposure_filename = cpl_malloc(nr_alloc * <span class="keyword">sizeof</span>(<span class="keywordtype">char</span> *)));
-<a name="l00815"></a>00815 KMO_TRY_EXIT_IF_NULL(
-<a name="l00816"></a>00816 exposure_objectname = cpl_malloc(nr_alloc * <span class="keyword">sizeof</span>(<span class="keywordtype">char</span> *)));
-<a name="l00817"></a>00817 KMO_TRY_EXIT_IF_NULL(
-<a name="l00818"></a>00818 exposure_ifus = cpl_malloc(nr_alloc * <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>)));
-<a name="l00819"></a>00819
-<a name="l00820"></a>00820 <span class="comment">// check exposure frames</span>
-<a name="l00821"></a>00821 <span class="keywordflow">for</span> (i = 0; i < nr_science_frames; i++) {
-<a name="l00822"></a>00822 KMO_TRY_EXIT_IF_NULL(
-<a name="l00823"></a>00823 tmp_str = cpl_sprintf(<span class="stringliteral">"%d"</span>, i));
-<a name="l00824"></a>00824
-<a name="l00825"></a>00825 KMO_TRY_EXIT_IF_NULL(
-<a name="l00826"></a>00826 frame = kmo_dfs_get_frame(exposures, tmp_str));
-<a name="l00827"></a>00827 cpl_free(tmp_str);
+<a name="l00812"></a>00812 xcal_interpolation = kmo_dfs_get_parameter_bool(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.xcal_interpolation"</span>);
+<a name="l00813"></a>00813 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00814"></a>00814 KMO_TRY_ASSURE((xcal_interpolation == TRUE) ||
+<a name="l00815"></a>00815 (xcal_interpolation == FALSE),
+<a name="l00816"></a>00816 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00817"></a>00817 <span class="stringliteral">"xcal_interpolation must be TRUE or FALSE!"</span>);
+<a name="l00818"></a>00818 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00819"></a>00819 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.xcal_interpolation"</span>));
+<a name="l00820"></a>00820
+<a name="l00821"></a>00821 suppress_extension = kmo_dfs_get_parameter_bool(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.suppress_extension"</span>);
+<a name="l00822"></a>00822 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00823"></a>00823 KMO_TRY_ASSURE((suppress_extension == TRUE) || (suppress_extension == FALSE),
+<a name="l00824"></a>00824 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00825"></a>00825 <span class="stringliteral">"suppress_extension must be TRUE or FALSE!"</span>);
+<a name="l00826"></a>00826 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00827"></a>00827 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.suppress_extension"</span>));
<a name="l00828"></a>00828
-<a name="l00829"></a>00829 KMO_TRY_EXIT_IF_NULL(
-<a name="l00830"></a>00830 exposure_filename[i] = (<span class="keywordtype">char</span>*)cpl_frame_get_filename(frame));
-<a name="l00831"></a>00831
-<a name="l00832"></a>00832 kmo_init_fits_desc(&desc);
-<a name="l00833"></a>00833
-<a name="l00834"></a>00834 desc = kmo_identify_fits_header(exposure_filename[i]);
-<a name="l00835"></a>00835 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"Provided fits file doesn't seem to "</span>
-<a name="l00836"></a>00836 <span class="stringliteral">"be in KMOS-format!"</span>);
-<a name="l00837"></a>00837
-<a name="l00838"></a>00838 KMO_TRY_ASSURE(((desc.nr_ext == KMOS_NR_DETECTORS) ||
-<a name="l00839"></a>00839 ((desc.nr_ext == 2*KMOS_NR_DETECTORS))) &&
-<a name="l00840"></a>00840 (desc.ex_badpix == FALSE) &&
-<a name="l00841"></a>00841 ((desc.fits_type == raw_fits) ||
-<a name="l00842"></a>00842 (desc.fits_type == f2d_fits)) &&
-<a name="l00843"></a>00843 (desc.frame_type == detector_frame),
-<a name="l00844"></a>00844 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00845"></a>00845 <span class="stringliteral">"The frame to reconstruct isn't in the correct "</span>
-<a name="l00846"></a>00846 <span class="stringliteral">"format!!!"</span>);
-<a name="l00847"></a>00847 kmo_free_fits_desc(&desc);
-<a name="l00848"></a>00848 }
+<a name="l00829"></a>00829 dev_cal = kmo_dfs_get_parameter_bool(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.dev_cal"</span>);
+<a name="l00830"></a>00830 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00831"></a>00831 KMO_TRY_ASSURE((dev_cal == TRUE) || (dev_cal == FALSE),
+<a name="l00832"></a>00832 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00833"></a>00833 <span class="stringliteral">"dev_cal must be TRUE or FALSE!"</span>);
+<a name="l00834"></a>00834 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00835"></a>00835 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_multi_reconstruct.dev_cal"</span>));
+<a name="l00836"></a>00836
+<a name="l00837"></a>00837 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00838"></a>00838 kmo_combine_pars_load(parlist,
+<a name="l00839"></a>00839 <span class="stringliteral">"kmos.kmo_multi_reconstruct"</span>,
+<a name="l00840"></a>00840 &cmethod,
+<a name="l00841"></a>00841 &cpos_rej,
+<a name="l00842"></a>00842 &cneg_rej,
+<a name="l00843"></a>00843 &citer,
+<a name="l00844"></a>00844 &cmin,
+<a name="l00845"></a>00845 &cmax,
+<a name="l00846"></a>00846 FALSE));
+<a name="l00847"></a>00847
+<a name="l00848"></a>00848 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
<a name="l00849"></a>00849
-<a name="l00850"></a>00850 <span class="comment">// select IFU for each exposure</span>
-<a name="l00851"></a>00851 KMO_TRY_EXIT_IF_NULL(
-<a name="l00852"></a>00852 empty_frames = cpl_malloc(nr_alloc * <span class="keyword">sizeof</span>(cpl_frame *)));
-<a name="l00853"></a>00853 <span class="keywordtype">int</span> found=0;
-<a name="l00854"></a>00854 <span class="keywordflow">for</span> (i = 0; i < nr_science_frames; i++) {
-<a name="l00855"></a>00855 empty_frames[i] = NULL;
-<a name="l00856"></a>00856 <span class="keywordflow">if</span> (strcmp(ifus_txt, <span class="stringliteral">""</span>) != 0) { <span class="comment">//IFU selected by user given list</span>
-<a name="l00857"></a>00857 found = 1;
-<a name="l00858"></a>00858 <span class="comment">// const char *tmpString;</span>
-<a name="l00859"></a>00859 exposure_ifus[i] = (int) (cpl_vector_get(ifus, i) + 0.1);
-<a name="l00860"></a>00860 KMO_TRY_EXIT_IF_NULL(
-<a name="l00861"></a>00861 pl = kmclipm_propertylist_load(exposure_filename[i], 0));
-<a name="l00862"></a>00862 KMO_TRY_EXIT_IF_NULL(
-<a name="l00863"></a>00863 tmp_ocs = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_NAME_PREFIX,
-<a name="l00864"></a>00864 exposure_ifus[i], IFU_NAME_POSTFIX));
-<a name="l00865"></a>00865 <span class="keywordflow">if</span> (cpl_propertylist_has(pl, tmp_ocs)) {
-<a name="l00866"></a>00866 tmp_str = (<span class="keywordtype">char</span>*)cpl_propertylist_get_string(pl, tmp_ocs);
-<a name="l00867"></a>00867 } <span class="keywordflow">else</span> {
-<a name="l00868"></a>00868 tmp_str = <span class="stringliteral">""</span>;
-<a name="l00869"></a>00869 }
-<a name="l00870"></a>00870 KMO_TRY_EXIT_IF_NULL(
-<a name="l00871"></a>00871 exposure_objectname[i] = cpl_sprintf(<span class="stringliteral">"%s"</span>, tmp_str));
-<a name="l00872"></a>00872 cpl_free(tmp_ocs);
-<a name="l00873"></a>00873 cpl_propertylist_delete(pl); pl = NULL;
-<a name="l00874"></a>00874 } <span class="keywordflow">else</span> { <span class="comment">//IFU selected by user given object name</span>
-<a name="l00875"></a>00875 exposure_objectname[i] = (<span class="keywordtype">char</span>*)name;
-<a name="l00876"></a>00876 KMO_TRY_EXIT_IF_NULL(
-<a name="l00877"></a>00877 tmp_str = cpl_sprintf(<span class="stringliteral">"%d"</span>, i));
+<a name="l00850"></a>00850 <span class="comment">//</span>
+<a name="l00851"></a>00851 <span class="comment">// assure that filters, grating and rotation offsets match for</span>
+<a name="l00852"></a>00852 <span class="comment">// XCAL, YCAL, LCAL and for data frame to reconstruct (except DARK</span>
+<a name="l00853"></a>00853 <span class="comment">// frames)</span>
+<a name="l00854"></a>00854 <span class="comment">//</span>
+<a name="l00855"></a>00855
+<a name="l00856"></a>00856 <span class="comment">// check if filter_id and grating_id match for all detectors</span>
+<a name="l00857"></a>00857 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00858"></a>00858 kmo_check_frameset_setup(frameset, SCIENCE, TRUE, FALSE, TRUE));
+<a name="l00859"></a>00859 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00860"></a>00860 kmo_check_frame_setup(frameset, SCIENCE, YCAL, TRUE, FALSE, TRUE));
+<a name="l00861"></a>00861 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00862"></a>00862 kmo_check_frame_setup(frameset, XCAL, YCAL, TRUE, FALSE, TRUE));
+<a name="l00863"></a>00863 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00864"></a>00864 kmo_check_frame_setup(frameset, XCAL, LCAL, TRUE, FALSE, TRUE));
+<a name="l00865"></a>00865 <span class="keywordflow">if</span> (has_master_flat) {
+<a name="l00866"></a>00866 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00867"></a>00867 kmo_check_frame_setup(frameset, XCAL, MASTER_FLAT, TRUE, FALSE, TRUE));
+<a name="l00868"></a>00868 }
+<a name="l00869"></a>00869 <span class="keywordflow">if</span> (has_telluric) {
+<a name="l00870"></a>00870 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00871"></a>00871 kmo_check_frame_setup(frameset, XCAL, TELLURIC,
+<a name="l00872"></a>00872 TRUE, FALSE, TRUE));
+<a name="l00873"></a>00873 }
+<a name="l00874"></a>00874
+<a name="l00875"></a>00875 <span class="comment">// check descriptors of all frames</span>
+<a name="l00876"></a>00876 KMO_TRY_EXIT_IF_NULL(
+<a name="l00877"></a>00877 xcal_frame = kmo_dfs_get_frame(frameset, XCAL));
<a name="l00878"></a>00878
-<a name="l00879"></a>00879 KMO_TRY_EXIT_IF_NULL(
-<a name="l00880"></a>00880 frame = kmo_dfs_get_frame(exposures, tmp_str));
-<a name="l00881"></a>00881 cpl_free(tmp_str);
-<a name="l00882"></a>00882
-<a name="l00883"></a>00883 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00884"></a>00884 <span class="keywordtype">int</span> this_ifu = kmo_get_index_from_ocs_name(frame, name);
-<a name="l00885"></a>00885 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00886"></a>00886 <span class="keywordflow">if</span> (this_ifu > 0) {
-<a name="l00887"></a>00887 found = 1;
-<a name="l00888"></a>00888 exposure_ifus[i] = this_ifu;
-<a name="l00889"></a>00889 } <span class="keywordflow">else</span> {
-<a name="l00890"></a>00890 empty_frames[i] = frame;
-<a name="l00891"></a>00891 exposure_ifus[i] = -1;
-<a name="l00892"></a>00892 cpl_msg_warning(<span class="stringliteral">""</span>,
-<a name="l00893"></a>00893 <span class="stringliteral">"Could not find any IFU with an object "</span>
-<a name="l00894"></a>00894 <span class="stringliteral">"named '%s' in file %s"</span>,
-<a name="l00895"></a>00895 name, exposure_filename[i]);
-<a name="l00896"></a>00896 }
-<a name="l00897"></a>00897 }
-<a name="l00898"></a>00898 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00899"></a>00899 }
-<a name="l00900"></a>00900 <span class="keywordflow">if</span> (! found) {
-<a name="l00901"></a>00901 cpl_msg_error(<span class="stringliteral">""</span>,
-<a name="l00902"></a>00902 <span class="stringliteral">"Could not find any IFU with an object named '%s' in "</span>
-<a name="l00903"></a>00903 <span class="stringliteral">"any input file"</span>, name);
-<a name="l00904"></a>00904 KMO_TRY_EXIT_WITH_ERROR(CPL_ERROR_ILLEGAL_INPUT);
-<a name="l00905"></a>00905 }
-<a name="l00906"></a>00906 <span class="keywordtype">int</span> j = 0;
-<a name="l00907"></a>00907 <span class="keywordflow">for</span> (i = 0; i < nr_alloc; i++) {
-<a name="l00908"></a>00908 <span class="keywordflow">if</span> (empty_frames[i] != NULL) {
-<a name="l00909"></a>00909 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00910"></a>00910 cpl_frameset_erase_frame(exposures, empty_frames[i]));
-<a name="l00911"></a>00911 nr_science_frames--;
-<a name="l00912"></a>00912 exposure_ifus[j] = exposure_ifus[i];
-<a name="l00913"></a>00913 } <span class="keywordflow">else</span> {
-<a name="l00914"></a>00914 exposure_ifus[j] = exposure_ifus[i];
-<a name="l00915"></a>00915 j++;
-<a name="l00916"></a>00916 }
-<a name="l00917"></a>00917 }
-<a name="l00918"></a>00918 <span class="keywordflow">for</span> (i = 0; i < nr_science_frames; i++) {
-<a name="l00919"></a>00919 KMO_TRY_EXIT_IF_NULL(
-<a name="l00920"></a>00920 tmp_str = cpl_sprintf(<span class="stringliteral">"%d"</span>, i));
-<a name="l00921"></a>00921
-<a name="l00922"></a>00922 KMO_TRY_EXIT_IF_NULL(
-<a name="l00923"></a>00923 frame = kmo_dfs_get_frame(exposures, tmp_str));
-<a name="l00924"></a>00924 cpl_free(tmp_str);
-<a name="l00925"></a>00925
-<a name="l00926"></a>00926 KMO_TRY_EXIT_IF_NULL(
-<a name="l00927"></a>00927 exposure_filename[i] = (<span class="keywordtype">char</span>*)cpl_frame_get_filename(frame));
-<a name="l00928"></a>00928 }
-<a name="l00929"></a>00929
-<a name="l00930"></a>00930 cpl_free(empty_frames); empty_frames = NULL;
-<a name="l00931"></a>00931
-<a name="l00932"></a>00932 <span class="comment">// get reference header, subheader and set grid definition</span>
-<a name="l00933"></a>00933 device_nr = ((exposure_ifus[0] -1) / KMOS_IFUS_PER_DETECTOR) + 1;
-<a name="l00934"></a>00934
-<a name="l00935"></a>00935 KMO_TRY_EXIT_IF_NULL(
-<a name="l00936"></a>00936 ref_main_header = kmclipm_propertylist_load(exposure_filename[0],0));
-<a name="l00937"></a>00937 KMO_TRY_EXIT_IF_NULL(
-<a name="l00938"></a>00938 ref_frame = cpl_frameset_get_first(exposures));
-<a name="l00939"></a>00939 KMO_TRY_EXIT_IF_NULL(
-<a name="l00940"></a>00940 ref_sub_header = kmclipm_propertylist_load(exposure_filename[0],
-<a name="l00941"></a>00941 device_nr));
-<a name="l00942"></a>00942 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00943"></a>00943 kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale));
-<a name="l00944"></a>00944
-<a name="l00945"></a>00945 exposure_rotangle = kmo_mr_get_rot_angle(kmo_dfs_get_frame(exposures, <span class="stringliteral">"0"</span>));
-<a name="l00946"></a>00946
-<a name="l00947"></a>00947 KMO_TRY_EXIT_IF_NULL(
-<a name="l00948"></a>00948 lcal_frame = kmo_dfs_get_frame(frameset, LCAL));
-<a name="l00949"></a>00949
-<a name="l00950"></a>00950 KMO_TRY_EXIT_IF_NULL(
-<a name="l00951"></a>00951 lcalImg = kmo_dfs_load_cal_image_frame(lcal_frame,
-<a name="l00952"></a>00952 1, 0, exposure_rotangle,
-<a name="l00953"></a>00953 FALSE, NULL,
-<a name="l00954"></a>00954 &rotangle_found, -1, 0, 0));
-<a name="l00955"></a>00955
-<a name="l00956"></a>00956 KMO_TRY_EXIT_IF_NULL(
-<a name="l00957"></a>00957 tmp_header = kmo_dfs_load_primary_header(frameset, LCAL));
-<a name="l00958"></a>00958
-<a name="l00959"></a>00959 KMO_TRY_EXIT_IF_NULL(
-<a name="l00960"></a>00960 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_FILTID_PREFIX, device_nr,
-<a name="l00961"></a>00961 IFU_FILTID_POSTFIX));
-<a name="l00962"></a>00962 KMO_TRY_EXIT_IF_NULL(
-<a name="l00963"></a>00963 filter_id = cpl_propertylist_get_string(tmp_header, keyword));
-<a name="l00964"></a>00964
-<a name="l00965"></a>00965 <span class="keywordtype">int</span> band_method = 0;
-<a name="l00966"></a>00966 KMO_TRY_EXIT_IF_NULL(
-<a name="l00967"></a>00967 band_table = kmo_dfs_load_table(frameset, WAVE_BAND, 1, 0));
-<a name="l00968"></a>00968
-<a name="l00969"></a>00969 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00970"></a>00970 kmclipm_setup_grid_band_lcal(&gd, lcalImg, filter_id,
-<a name="l00971"></a>00971 band_method, band_table));
-<a name="l00972"></a>00972 cpl_image_delete(lcalImg); lcalImg = NULL;
-<a name="l00973"></a>00973 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
-<a name="l00974"></a>00974 cpl_free(keyword); keyword = NULL;
-<a name="l00975"></a>00975 cpl_table_delete(band_table); band_table = NULL;
+<a name="l00879"></a>00879 desc1 = kmo_identify_fits_header(cpl_frame_get_filename(xcal_frame));
+<a name="l00880"></a>00880 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00881"></a>00881
+<a name="l00882"></a>00882 KMO_TRY_ASSURE((desc1.nr_ext % KMOS_NR_DETECTORS == 0) &&
+<a name="l00883"></a>00883 (desc1.ex_badpix == FALSE) &&
+<a name="l00884"></a>00884 (desc1.fits_type == f2d_fits) &&
+<a name="l00885"></a>00885 (desc1.frame_type == detector_frame),
+<a name="l00886"></a>00886 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00887"></a>00887 <span class="stringliteral">"XCAL isn't in the correct format!!!"</span>);
+<a name="l00888"></a>00888
+<a name="l00889"></a>00889 KMO_TRY_EXIT_IF_NULL(
+<a name="l00890"></a>00890 ycal_frame = kmo_dfs_get_frame(frameset, YCAL));
+<a name="l00891"></a>00891 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(ycal_frame));
+<a name="l00892"></a>00892 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00893"></a>00893
+<a name="l00894"></a>00894 KMO_TRY_ASSURE((desc1.nr_ext == desc2.nr_ext) &&
+<a name="l00895"></a>00895 (desc1.ex_badpix == desc2.ex_badpix) &&
+<a name="l00896"></a>00896 (desc1.fits_type == desc2.fits_type) &&
+<a name="l00897"></a>00897 (desc1.frame_type == desc2.frame_type),
+<a name="l00898"></a>00898 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00899"></a>00899 <span class="stringliteral">"YCAL isn't in the correct format!!!"</span>);
+<a name="l00900"></a>00900 kmo_free_fits_desc(&desc2);
+<a name="l00901"></a>00901 kmo_init_fits_desc(&desc2);
+<a name="l00902"></a>00902
+<a name="l00903"></a>00903 KMO_TRY_EXIT_IF_NULL(
+<a name="l00904"></a>00904 lcal_frame = kmo_dfs_get_frame(frameset, LCAL));
+<a name="l00905"></a>00905 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(lcal_frame));
+<a name="l00906"></a>00906 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00907"></a>00907
+<a name="l00908"></a>00908 KMO_TRY_ASSURE((desc2.nr_ext % KMOS_NR_DETECTORS == 0) &&
+<a name="l00909"></a>00909 (desc1.ex_badpix == desc2.ex_badpix) &&
+<a name="l00910"></a>00910 (desc1.fits_type == desc2.fits_type) &&
+<a name="l00911"></a>00911 (desc1.frame_type == desc2.frame_type),
+<a name="l00912"></a>00912 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00913"></a>00913 <span class="stringliteral">"LCAL isn't in the correct format!!!"</span>);
+<a name="l00914"></a>00914 kmo_free_fits_desc(&desc2);
+<a name="l00915"></a>00915 kmo_init_fits_desc(&desc2);
+<a name="l00916"></a>00916
+<a name="l00917"></a>00917 <span class="keywordflow">if</span> (has_master_flat) {
+<a name="l00918"></a>00918 KMO_TRY_EXIT_IF_NULL(
+<a name="l00919"></a>00919 flat_frame = kmo_dfs_get_frame(frameset, MASTER_FLAT));
+<a name="l00920"></a>00920 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(flat_frame));
+<a name="l00921"></a>00921 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00922"></a>00922
+<a name="l00923"></a>00923 KMO_TRY_ASSURE((desc2.nr_ext % (2*KMOS_NR_DETECTORS) == 0) &&
+<a name="l00924"></a>00924 (desc1.ex_badpix == desc2.ex_badpix) &&
+<a name="l00925"></a>00925 (desc1.fits_type == desc2.fits_type) &&
+<a name="l00926"></a>00926 (desc1.frame_type == desc2.frame_type),
+<a name="l00927"></a>00927 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00928"></a>00928 <span class="stringliteral">"MASTER_FLAT isn't in the correct format!!!"</span>);
+<a name="l00929"></a>00929 kmo_free_fits_desc(&desc2);
+<a name="l00930"></a>00930 kmo_init_fits_desc(&desc2);
+<a name="l00931"></a>00931 }
+<a name="l00932"></a>00932
+<a name="l00933"></a>00933 <span class="keywordflow">if</span> (has_illum_corr) {
+<a name="l00934"></a>00934 KMO_TRY_EXIT_IF_NULL(
+<a name="l00935"></a>00935 illum_frame = kmo_dfs_get_frame(frameset, ILLUM_CORR));
+<a name="l00936"></a>00936 desc2 = kmo_identify_fits_header(
+<a name="l00937"></a>00937 cpl_frame_get_filename(illum_frame));
+<a name="l00938"></a>00938 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00939"></a>00939 KMO_TRY_ASSURE(((desc2.nr_ext == 24) || (desc2.nr_ext == 48)) &&
+<a name="l00940"></a>00940 (desc2.ex_badpix == FALSE) &&
+<a name="l00941"></a>00941 (desc2.fits_type == f2i_fits) &&
+<a name="l00942"></a>00942 (desc2.frame_type == ifu_frame),
+<a name="l00943"></a>00943 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00944"></a>00944 <span class="stringliteral">"ILLUM_CORR isn't in the correct format!!!"</span>);
+<a name="l00945"></a>00945 kmo_free_fits_desc(&desc2);
+<a name="l00946"></a>00946 kmo_init_fits_desc(&desc2);
+<a name="l00947"></a>00947 }
+<a name="l00948"></a>00948
+<a name="l00949"></a>00949 <span class="keywordflow">if</span> (has_telluric) {
+<a name="l00950"></a>00950 KMO_TRY_EXIT_IF_NULL(
+<a name="l00951"></a>00951 telluric_frame = kmo_dfs_get_frame(frameset, TELLURIC));
+<a name="l00952"></a>00952 desc_telluric = kmo_identify_fits_header(
+<a name="l00953"></a>00953 cpl_frame_get_filename(telluric_frame));
+<a name="l00954"></a>00954 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00955"></a>00955 KMO_TRY_ASSURE(((desc_telluric.nr_ext == 24) || (desc_telluric.nr_ext == 48)) &&
+<a name="l00956"></a>00956 (desc_telluric.ex_badpix == FALSE) &&
+<a name="l00957"></a>00957 (desc_telluric.fits_type == f1i_fits) &&
+<a name="l00958"></a>00958 (desc_telluric.frame_type == ifu_frame),
+<a name="l00959"></a>00959 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00960"></a>00960 <span class="stringliteral">"TELLURIC isn't in the correct format!!!"</span>);
+<a name="l00961"></a>00961 }
+<a name="l00962"></a>00962
+<a name="l00963"></a>00963 KMO_TRY_EXIT_IF_NULL(
+<a name="l00964"></a>00964 science_frame = kmo_dfs_get_frame(frameset, SCIENCE));
+<a name="l00965"></a>00965 <span class="keywordflow">while</span> (science_frame != NULL ) {
+<a name="l00966"></a>00966 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(science_frame));
+<a name="l00967"></a>00967 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00968"></a>00968 KMO_TRY_ASSURE((desc2.nr_ext == 3) &&
+<a name="l00969"></a>00969 (desc2.ex_badpix == FALSE) &&
+<a name="l00970"></a>00970 (desc2.fits_type == raw_fits) &&
+<a name="l00971"></a>00971 (desc2.frame_type == detector_frame),
+<a name="l00972"></a>00972 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00973"></a>00973 <span class="stringliteral">"SCIENCE isn't in the correct format!!!"</span>);
+<a name="l00974"></a>00974 kmo_free_fits_desc(&desc2);
+<a name="l00975"></a>00975 kmo_init_fits_desc(&desc2);
<a name="l00976"></a>00976
-<a name="l00977"></a>00977 <span class="comment">//extract sub-headers for each exposures, calculate WCS</span>
-<a name="l00978"></a>00978 KMO_TRY_EXIT_IF_NULL(
-<a name="l00979"></a>00979 header_data = cpl_malloc(nr_science_frames*<span class="keyword">sizeof</span>(cpl_propertylist*)));
-<a name="l00980"></a>00980 <span class="keywordflow">for</span> (i = 0; i < nr_science_frames; i++) {
-<a name="l00981"></a>00981 device_nr = ((exposure_ifus[0] -1) / KMOS_IFUS_PER_DETECTOR) + 1;
-<a name="l00982"></a>00982 KMO_TRY_EXIT_IF_NULL(
-<a name="l00983"></a>00983 header_data[i] = kmclipm_propertylist_load(exposure_filename[i],
-<a name="l00984"></a>00984 device_nr));
-<a name="l00985"></a>00985 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00986"></a>00986 kmclipm_update_property_int(header_data[i],<span class="stringliteral">"NAXIS"</span>, 3,<span class="stringliteral">""</span>));
-<a name="l00987"></a>00987 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00988"></a>00988 kmclipm_update_property_int(header_data[i],<span class="stringliteral">"NAXIS1"</span>,gd.x.dim,<span class="stringliteral">""</span>));
-<a name="l00989"></a>00989 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00990"></a>00990 kmclipm_update_property_int(header_data[i],<span class="stringliteral">"NAXIS2"</span>,gd.y.dim,<span class="stringliteral">""</span>));
-<a name="l00991"></a>00991 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00992"></a>00992 kmclipm_update_property_int(header_data[i],<span class="stringliteral">"NAXIS3"</span>,gd.l.dim,<span class="stringliteral">""</span>));
-<a name="l00993"></a>00993 cpl_propertylist *tmpHeader;
-<a name="l00994"></a>00994 KMO_TRY_EXIT_IF_NULL(
-<a name="l00995"></a>00995 tmpHeader = kmclipm_propertylist_load(exposure_filename[i],0));
-<a name="l00996"></a>00996 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00997"></a>00997 kmo_calc_wcs_gd(tmpHeader, header_data[i], exposure_ifus[i], gd));
-<a name="l00998"></a>00998 cpl_propertylist_delete(tmpHeader);
-<a name="l00999"></a>00999 }
-<a name="l01000"></a>01000
-<a name="l01001"></a>01001 <span class="comment">// check rotation angle</span>
-<a name="l01002"></a>01002 <span class="keywordflow">if</span> (dev_cal == FALSE) {
-<a name="l01003"></a>01003 cd1_1 = kmo_dfs_get_property_double(header_data[0], CD1_1);
-<a name="l01004"></a>01004 cd1_2 = kmo_dfs_get_property_double(header_data[0], CD1_2);
-<a name="l01005"></a>01005 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01006"></a>01006 ang1 = atan(cd1_2/cd1_1)*180/CPL_MATH_PI;
-<a name="l01007"></a>01007 <span class="keywordflow">for</span> (i = 1; i < nr_science_frames; i++) {
-<a name="l01008"></a>01008 cd1_1 = kmo_dfs_get_property_double(header_data[i], CD1_1);
-<a name="l01009"></a>01009 cd1_2 = kmo_dfs_get_property_double(header_data[i], CD1_2);
-<a name="l01010"></a>01010 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01011"></a>01011 ang2 = atan(cd1_2/cd1_1)*180/CPL_MATH_PI;
-<a name="l01012"></a>01012
-<a name="l01013"></a>01013 <span class="keywordflow">if</span> (strcmp(method, <span class="stringliteral">"none"</span>) != 0) {
-<a name="l01014"></a>01014 <span class="comment">// center, header, user</span>
-<a name="l01015"></a>01015 KMO_TRY_ASSURE(fabs(ang1-ang2) <= 0.5,
-<a name="l01016"></a>01016 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01017"></a>01017 <span class="stringliteral">"Orientation of cube 1 (%gdeg) and cube %d "</span>
-<a name="l01018"></a>01018 <span class="stringliteral">"(%gdeg) differ! "</span>
-<a name="l01019"></a>01019 <span class="stringliteral">"Align the orientation of this cube with "</span>
-<a name="l01020"></a>01020 <span class="stringliteral">"kmo_rotate before applying this recipe."</span>,
-<a name="l01021"></a>01021 ang1, i+1, ang2);
-<a name="l01022"></a>01022 } <span class="keywordflow">else</span> {
-<a name="l01023"></a>01023 <span class="comment">// none</span>
-<a name="l01024"></a>01024 <span class="keywordflow">if</span> (fabs(ang1-ang2) > 0.5) {
-<a name="l01025"></a>01025 cpl_msg_warning(<span class="stringliteral">""</span>,
-<a name="l01026"></a>01026 <span class="stringliteral">"Orientation of cube 1 (%gdeg) and cube %d "</span>
-<a name="l01027"></a>01027 <span class="stringliteral">"(%gdeg) differ! Processing anyway."</span>,
-<a name="l01028"></a>01028 ang1, i+1, ang2);
-<a name="l01029"></a>01029 }
-<a name="l01030"></a>01030 }
-<a name="l01031"></a>01031 }
-<a name="l01032"></a>01032 }
-<a name="l01033"></a>01033
-<a name="l01034"></a>01034 <span class="comment">// set x/y shifts</span>
-<a name="l01035"></a>01035 KMO_TRY_EXIT_IF_NULL(
-<a name="l01036"></a>01036 xshifts = cpl_malloc(nr_science_frames * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>)));
-<a name="l01037"></a>01037 KMO_TRY_EXIT_IF_NULL(
-<a name="l01038"></a>01038 yshifts = cpl_malloc(nr_science_frames * <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>)));
-<a name="l01039"></a>01039 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01040"></a>01040 kmo_mr_get_offsets(nr_science_frames, method, imethod, neighborhoodRange,
-<a name="l01041"></a>01041 filename, frameset, exposures, exposure_ifus,
-<a name="l01042"></a>01042 (<span class="keyword">const</span> cpl_propertylist**)header_data,
-<a name="l01043"></a>01043 fmethod,
-<a name="l01044"></a>01044 cmethod,
-<a name="l01045"></a>01045 cpos_rej,
-<a name="l01046"></a>01046 cneg_rej,
-<a name="l01047"></a>01047 citer,
-<a name="l01048"></a>01048 cmin,
-<a name="l01049"></a>01049 cmax,
-<a name="l01050"></a>01050 pix_scale,
-<a name="l01051"></a>01051 xshifts, yshifts));
-<a name="l01052"></a>01052
-<a name="l01053"></a>01053 <span class="keywordflow">for</span> (i = 0; i < nr_science_frames; i++) {
-<a name="l01054"></a>01054 printf(<span class="stringliteral">"exposure %d: filename %s, selected IFU %d, object name "</span>
-<a name="l01055"></a>01055 <span class="stringliteral">"\"%s\", xshift %f, yshift %f\n"</span>, i, exposure_filename[i],
-<a name="l01056"></a>01056 exposure_ifus[i], exposure_objectname[i], xshifts[i], yshifts[i]);
-<a name="l01057"></a>01057 }
-<a name="l01058"></a>01058
-<a name="l01059"></a>01059 <span class="comment">//</span>
-<a name="l01060"></a>01060 <span class="comment">// set spatial part of the grid</span>
-<a name="l01061"></a>01061 <span class="comment">//</span>
-<a name="l01062"></a>01062 <span class="comment">// size = "max";</span>
-<a name="l01063"></a>01063 <span class="keywordflow">if</span> (strcmp(size, <span class="stringliteral">"max"</span>) == 0) {
-<a name="l01064"></a>01064 <span class="keywordtype">double</span> xmin=0, xmax=0, ymin=0, ymax=0;
-<a name="l01065"></a>01065 <span class="keywordtype">double</span> gxshift, gyshift, gxdim, gydim;
-<a name="l01066"></a>01066 <span class="keywordtype">double</span> pixel_resolution = pix_scale;
-<a name="l01067"></a>01067 <span class="keywordtype">int</span> xdim, ydim;
-<a name="l01068"></a>01068
-<a name="l01069"></a>01069 <span class="keywordflow">for</span> (i = 0; i < nr_science_frames; i++) {
-<a name="l01070"></a>01070 <span class="keywordflow">if</span> (xmin > xshifts[i]) { xmin = xshifts[i]; }
-<a name="l01071"></a>01071 <span class="keywordflow">if</span> (xmax < xshifts[i]) { xmax = xshifts[i]; }
-<a name="l01072"></a>01072 <span class="keywordflow">if</span> (ymin > yshifts[i]) { ymin = yshifts[i]; }
-<a name="l01073"></a>01073 <span class="keywordflow">if</span> (ymax < yshifts[i]) { ymax = yshifts[i]; }
-<a name="l01074"></a>01074 }
-<a name="l01075"></a>01075 <span class="keywordflow">if</span> (xmax > 0.0001) {
-<a name="l01076"></a>01076 gxshift = - ceil(xmax);
+<a name="l00977"></a>00977 <span class="keywordflow">if</span> (mapping_mode == NULL) {
+<a name="l00978"></a>00978 KMO_TRY_EXIT_IF_NULL(
+<a name="l00979"></a>00979 tmp_header =
+<a name="l00980"></a>00980 kmclipm_propertylist_load(
+<a name="l00981"></a>00981 cpl_frame_get_filename(science_frame), 0));
+<a name="l00982"></a>00982 <span class="keywordflow">if</span> (cpl_propertylist_has(tmp_header, TPL_ID)) {
+<a name="l00983"></a>00983 KMO_TRY_EXIT_IF_NULL(
+<a name="l00984"></a>00984 tmp_str = cpl_propertylist_get_string(tmp_header,
+<a name="l00985"></a>00985 TPL_ID));
+<a name="l00986"></a>00986 <span class="keywordflow">if</span> (strcmp(tmp_str, MAPPING8) == 0)
+<a name="l00987"></a>00987 {
+<a name="l00988"></a>00988 mapping_mode = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">"mapping8"</span>);
+<a name="l00989"></a>00989 }
+<a name="l00990"></a>00990 <span class="keywordflow">if</span> (strcmp(tmp_str, MAPPING24) == 0)
+<a name="l00991"></a>00991 {
+<a name="l00992"></a>00992 mapping_mode = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">"mapping24"</span>);
+<a name="l00993"></a>00993 }
+<a name="l00994"></a>00994 }
+<a name="l00995"></a>00995
+<a name="l00996"></a>00996 <span class="comment">// when mapping-mode should be supported, remove this if-statement...</span>
+<a name="l00997"></a>00997 <span class="keywordflow">if</span> (mapping_mode != NULL) {
+<a name="l00998"></a>00998 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"*******************************************************"</span>);
+<a name="l00999"></a>00999 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"*******************************************************"</span>);
+<a name="l01000"></a>01000 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"*** ***"</span>);
+<a name="l01001"></a>01001 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"*** The provided SCIENCE frames have been produced ***"</span>);
+<a name="l01002"></a>01002 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"*** with template %s ***"</span>, tmp_str);
+<a name="l01003"></a>01003 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"*** ***"</span>);
+<a name="l01004"></a>01004 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"*** kmo_multi_reconstruct doesn't support yet this ***"</span>);
+<a name="l01005"></a>01005 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"*** observation mode. Please use recipe kmo_sci_red ***"</span>);
+<a name="l01006"></a>01006 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"*** instead! ***"</span>);
+<a name="l01007"></a>01007 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"*** ***"</span>);
+<a name="l01008"></a>01008 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"*******************************************************"</span>);
+<a name="l01009"></a>01009 cpl_msg_error(<span class="stringliteral">""</span>, <span class="stringliteral">"*******************************************************"</span>);
+<a name="l01010"></a>01010 KMO_TRY_ASSURE(1==0,
+<a name="l01011"></a>01011 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01012"></a>01012 <span class="stringliteral">" "</span>);
+<a name="l01013"></a>01013 }
+<a name="l01014"></a>01014
+<a name="l01015"></a>01015 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l01016"></a>01016 }
+<a name="l01017"></a>01017
+<a name="l01018"></a>01018 science_frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l01019"></a>01019 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01020"></a>01020 }
+<a name="l01021"></a>01021
+<a name="l01022"></a>01022 <span class="keywordflow">if</span> ((mapping_mode != NULL) && ((ifus != NULL) || (strcmp(name, <span class="stringliteral">""</span>) != 0))) {
+<a name="l01023"></a>01023 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"The SCIENCE frames have been taken in one of the "</span>
+<a name="l01024"></a>01024 <span class="stringliteral">"mapping modes AND specific IFUs have been "</span>
+<a name="l01025"></a>01025 <span class="stringliteral">"specified! --> Only processing these!"</span>);
+<a name="l01026"></a>01026 }
+<a name="l01027"></a>01027
+<a name="l01028"></a>01028 KMO_TRY_EXIT_IF_NULL(
+<a name="l01029"></a>01029 suffix = kmo_dfs_get_suffix(xcal_frame, TRUE, FALSE));
+<a name="l01030"></a>01030
+<a name="l01031"></a>01031 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01032"></a>01032 kmo_check_frame_setup_md5_xycal(frameset));
+<a name="l01033"></a>01033 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01034"></a>01034 kmo_check_frame_setup_md5(frameset));
+<a name="l01035"></a>01035 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01036"></a>01036 kmo_check_frame_setup_sampling(frameset));
+<a name="l01037"></a>01037
+<a name="l01038"></a>01038 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Detected instrument setup: %s"</span>, suffix+1);
+<a name="l01039"></a>01039 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"(grating 1, 2 & 3)"</span>);
+<a name="l01040"></a>01040 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
+<a name="l01041"></a>01041 cpl_free(suffix); suffix = NULL;
+<a name="l01042"></a>01042
+<a name="l01043"></a>01043 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, OH_SPEC) != 0) {
+<a name="l01044"></a>01044 <span class="keywordtype">int</span> is_all_obs = TRUE,
+<a name="l01045"></a>01045 has_all_origfile = TRUE;
+<a name="l01046"></a>01046 cpl_frame *tmp_frame = NULL;
+<a name="l01047"></a>01047
+<a name="l01048"></a>01048 KMO_TRY_EXIT_IF_NULL(
+<a name="l01049"></a>01049 tmp_frame = kmo_dfs_get_frame(frameset, SCIENCE));
+<a name="l01050"></a>01050 <span class="keywordflow">while</span> (tmp_frame != NULL ) {
+<a name="l01051"></a>01051 KMO_TRY_EXIT_IF_NULL(
+<a name="l01052"></a>01052 tmp_header = kmclipm_propertylist_load(cpl_frame_get_filename(tmp_frame), 0));
+<a name="l01053"></a>01053
+<a name="l01054"></a>01054 <span class="keywordflow">if</span> (cpl_propertylist_has(tmp_header, ORIGFILE)) {
+<a name="l01055"></a>01055 KMO_TRY_EXIT_IF_NULL(
+<a name="l01056"></a>01056 tmp_str = cpl_propertylist_get_string(tmp_header, ORIGFILE));
+<a name="l01057"></a>01057 <span class="keywordflow">if</span> (strstr(tmp_str, <span class="stringliteral">"OBS"</span>) == NULL) {
+<a name="l01058"></a>01058 is_all_obs = FALSE;
+<a name="l01059"></a>01059 }
+<a name="l01060"></a>01060 } <span class="keywordflow">else</span> {
+<a name="l01061"></a>01061 has_all_origfile = FALSE;
+<a name="l01062"></a>01062 }
+<a name="l01063"></a>01063 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l01064"></a>01064 tmp_frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l01065"></a>01065 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01066"></a>01066 }
+<a name="l01067"></a>01067
+<a name="l01068"></a>01068 <span class="keywordflow">if</span> (has_all_origfile) {
+<a name="l01069"></a>01069 <span class="keywordflow">if</span> (is_all_obs) {
+<a name="l01070"></a>01070 <span class="comment">// we are reconstructing an OBS-frame, allow OH_SPEC correction</span>
+<a name="l01071"></a>01071 KMO_TRY_EXIT_IF_NULL(
+<a name="l01072"></a>01072 ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
+<a name="l01073"></a>01073 } <span class="keywordflow">else</span> {
+<a name="l01074"></a>01074 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"Supplied OH_SPEC is ignored since a calibration "</span>
+<a name="l01075"></a>01075 <span class="stringliteral">"frame is being used as SCIENCE frame."</span>);
+<a name="l01076"></a>01076 }
<a name="l01077"></a>01077 } <span class="keywordflow">else</span> {
-<a name="l01078"></a>01078 gxshift = 0.;
-<a name="l01079"></a>01079 }
-<a name="l01080"></a>01080 <span class="keywordflow">if</span> (ymin < -0.0001) {
-<a name="l01081"></a>01081 gyshift = floor(ymin);
-<a name="l01082"></a>01082 } <span class="keywordflow">else</span> {
-<a name="l01083"></a>01083 gyshift = 0.;
-<a name="l01084"></a>01084 }
-<a name="l01085"></a>01085 <span class="keywordflow">if</span> (xmin < -0.0001) {
-<a name="l01086"></a>01086 gxdim = - floor(xmin);
-<a name="l01087"></a>01087 } <span class="keywordflow">else</span> {
-<a name="l01088"></a>01088 gxdim = 0.;
-<a name="l01089"></a>01089 }
-<a name="l01090"></a>01090 <span class="keywordflow">if</span> (ymax > 0.0001) {
-<a name="l01091"></a>01091 gydim = ceil(ymax);
-<a name="l01092"></a>01092 } <span class="keywordflow">else</span> {
-<a name="l01093"></a>01093 gydim = 0.;
-<a name="l01094"></a>01094 }
-<a name="l01095"></a>01095
-<a name="l01096"></a>01096 xdim = (int) (gxdim - gxshift + .5);
-<a name="l01097"></a>01097 ydim = (int) (gydim - gyshift + .5);
-<a name="l01098"></a>01098 gd.x.start += gxshift * pixel_resolution;
-<a name="l01099"></a>01099 gd.y.start += gyshift * pixel_resolution;
-<a name="l01100"></a>01100 gd.x.dim += xdim;
-<a name="l01101"></a>01101 gd.y.dim += ydim;
-<a name="l01102"></a>01102 <span class="comment">// printf("X: %f < %f Y: %f < %f \n",xmin,xmax,ymin,ymax);</span>
-<a name="l01103"></a>01103 <span class="comment">// printf("gxshift: %f gxdim: %f xdim: %d gyshift: %f gydim: %f ydim: %d \n",</span>
-<a name="l01104"></a>01104 <span class="comment">// gxshift, gxdim, xdim, gyshift, gydim, ydim);</span>
-<a name="l01105"></a>01105 <span class="comment">// printf("GD: %f %d %f %d\n", gd.x.start, gd.x.dim, gd.y.start, gd.y.dim);</span>
-<a name="l01106"></a>01106 }
+<a name="l01078"></a>01078 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"The supplied SCIENCE frames are all assumed to be "</span>
+<a name="l01079"></a>01079 <span class="stringliteral">"science frames. If any of them is a calibration frame, "</span>
+<a name="l01080"></a>01080 <span class="stringliteral">"omit OH_SPEC from sof-file"</span>);
+<a name="l01081"></a>01081 KMO_TRY_EXIT_IF_NULL(
+<a name="l01082"></a>01082 ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
+<a name="l01083"></a>01083 }
+<a name="l01084"></a>01084 }
+<a name="l01085"></a>01085
+<a name="l01086"></a>01086 <span class="comment">//</span>
+<a name="l01087"></a>01087 <span class="comment">// check which IFUs are active for all frames</span>
+<a name="l01088"></a>01088 <span class="comment">//</span>
+<a name="l01089"></a>01089 KMO_TRY_EXIT_IF_NULL(
+<a name="l01090"></a>01090 unused_ifus_before = kmo_get_unused_ifus(frameset, 1, 1));
+<a name="l01091"></a>01091
+<a name="l01092"></a>01092 KMO_TRY_EXIT_IF_NULL(
+<a name="l01093"></a>01093 unused_ifus_after = kmo_duplicate_unused_ifus(unused_ifus_before));
+<a name="l01094"></a>01094
+<a name="l01095"></a>01095 kmo_print_unused_ifus(unused_ifus_before, FALSE);
+<a name="l01096"></a>01096
+<a name="l01097"></a>01097 <span class="comment">//</span>
+<a name="l01098"></a>01098 <span class="comment">// get bounds, setup grid, setup arm_name-struct</span>
+<a name="l01099"></a>01099 <span class="comment">//</span>
+<a name="l01100"></a>01100
+<a name="l01101"></a>01101 <span class="comment">// get left and right bounds of IFUs</span>
+<a name="l01102"></a>01102 KMO_TRY_EXIT_IF_NULL(
+<a name="l01103"></a>01103 tmp_header = kmo_dfs_load_primary_header(frameset, XCAL));
+<a name="l01104"></a>01104 KMO_TRY_EXIT_IF_NULL(
+<a name="l01105"></a>01105 bounds = kmclipm_extract_bounds(tmp_header));
+<a name="l01106"></a>01106 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
<a name="l01107"></a>01107
-<a name="l01108"></a>01108 <span class="comment">//</span>
-<a name="l01109"></a>01109 <span class="comment">// reconstruct multiple detector images</span>
-<a name="l01110"></a>01110 <span class="comment">//</span>
-<a name="l01111"></a>01111
-<a name="l01112"></a>01112 <span class="comment">// printf("GD: %f %f %d %f %f %d %f %f %d\n",</span>
-<a name="l01113"></a>01113 <span class="comment">// gd.x.start, gd.x.delta, gd.x.dim,</span>
-<a name="l01114"></a>01114 <span class="comment">// gd.y.start, gd.y.delta, gd.y.dim,</span>
-<a name="l01115"></a>01115 <span class="comment">// gd.l.start, gd.l.delta, gd.l.dim);</span>
-<a name="l01116"></a>01116
-<a name="l01117"></a>01117 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01118"></a>01118 kmo_priv_multi_reconstruct(frameset,
-<a name="l01119"></a>01119 exposures,
-<a name="l01120"></a>01120 exposure_ifus,
-<a name="l01121"></a>01121 xshifts,
-<a name="l01122"></a>01122 yshifts,
-<a name="l01123"></a>01123 gd,
-<a name="l01124"></a>01124 &cube_combined_data,
-<a name="l01125"></a>01125 &cube_combined_noise,
-<a name="l01126"></a>01126 pix_scale));
+<a name="l01108"></a>01108 <span class="comment">// setup grid definition, wavelength start and end points will be set</span>
+<a name="l01109"></a>01109 <span class="comment">// in the detector loop</span>
+<a name="l01110"></a>01110 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01111"></a>01111 kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale, 0.));
+<a name="l01112"></a>01112 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01113"></a>01113 kmclipm_setup_grid(&gd_14x14, imethod, neighborhoodRange, pix_scale, 0.));
+<a name="l01114"></a>01114
+<a name="l01115"></a>01115 KMO_TRY_EXIT_IF_NULL(
+<a name="l01116"></a>01116 band_table = kmo_dfs_load_table(frameset, WAVE_BAND, 1, 0));
+<a name="l01117"></a>01117 KMO_TRY_EXIT_IF_NULL(
+<a name="l01118"></a>01118 tmp_header = kmo_dfs_load_primary_header(frameset, LCAL));
+<a name="l01119"></a>01119 KMO_TRY_EXIT_IF_NULL(
+<a name="l01120"></a>01120 filter_id = cpl_sprintf(<span class="stringliteral">"%s"</span>, cpl_propertylist_get_string(tmp_header, filter_keyword)));
+<a name="l01121"></a>01121 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01122"></a>01122 kmclipm_setup_grid_band_lcal(&gd, NULL, filter_id, 0, band_table));
+<a name="l01123"></a>01123 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01124"></a>01124 kmclipm_setup_grid_band_lcal(&gd_14x14, NULL, filter_id, 0, band_table));
+<a name="l01125"></a>01125 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l01126"></a>01126 cpl_table_delete(band_table); band_table = NULL;
<a name="l01127"></a>01127
-<a name="l01128"></a>01128 <span class="keywordflow">if</span> (!suppress_extension) {
-<a name="l01129"></a>01129 <span class="comment">// setup output category COMBINE + ESO PRO CATG</span>
-<a name="l01130"></a>01130 <span class="keywordflow">if</span> (strcmp(ifus_txt, <span class="stringliteral">""</span>) != 0) { <span class="comment">//IFU selected by user given list</span>
-<a name="l01131"></a>01131 KMO_TRY_EXIT_IF_NULL(
-<a name="l01132"></a>01132 tmp_str = cpl_sprintf(<span class="stringliteral">"IFU"</span>));
-<a name="l01133"></a>01133 } <span class="keywordflow">else</span> {
-<a name="l01134"></a>01134 KMO_TRY_EXIT_IF_NULL(
-<a name="l01135"></a>01135 tmp_str = cpl_sprintf(<span class="stringliteral">"%s"</span>, name));
-<a name="l01136"></a>01136 }
-<a name="l01137"></a>01137
-<a name="l01138"></a>01138 KMO_TRY_EXIT_IF_NULL(
-<a name="l01139"></a>01139 filename_output_cube = cpl_sprintf(<span class="stringliteral">"%s_%s"</span>, CUBE_MULTI, tmp_str));
-<a name="l01140"></a>01140 cpl_free(tmp_str); tmp_str = NULL;
-<a name="l01141"></a>01141 } <span class="keywordflow">else</span> {
-<a name="l01142"></a>01142 KMO_TRY_EXIT_IF_NULL(
-<a name="l01143"></a>01143 filename_output_cube = cpl_sprintf(<span class="stringliteral">"%s"</span>, CUBE_MULTI));
-<a name="l01144"></a>01144 }
-<a name="l01145"></a>01145
-<a name="l01146"></a>01146 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01147"></a>01147 kmo_dfs_save_main_header(frameset, filename_output_cube, <span class="stringliteral">""</span>,
-<a name="l01148"></a>01148 ref_frame, NULL, parlist, cpl_func));
-<a name="l01149"></a>01149 <span class="comment">// save output</span>
-<a name="l01150"></a>01150 KMO_TRY_EXIT_IF_NULL(
-<a name="l01151"></a>01151 extname = kmo_extname_creator(ifu_frame, exposure_ifus[0],
-<a name="l01152"></a>01152 EXT_DATA));
-<a name="l01153"></a>01153
-<a name="l01154"></a>01154 <span class="comment">// calculate WCS</span>
-<a name="l01155"></a>01155 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01156"></a>01156 kmo_calc_wcs_gd(ref_main_header, ref_sub_header, exposure_ifus[0], gd));
-<a name="l01157"></a>01157
-<a name="l01158"></a>01158 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01159"></a>01159 kmclipm_update_property_string(ref_sub_header,
-<a name="l01160"></a>01160 EXTNAME,
-<a name="l01161"></a>01161 extname,
-<a name="l01162"></a>01162 <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01163"></a>01163 cpl_free(extname); extname = NULL;
-<a name="l01164"></a>01164
-<a name="l01165"></a>01165 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01166"></a>01166 kmo_dfs_save_cube(cube_combined_data, filename_output_cube,
-<a name="l01167"></a>01167 <span class="stringliteral">""</span>, ref_sub_header, 0./0.));
-<a name="l01168"></a>01168
-<a name="l01169"></a>01169 <span class="keywordflow">if</span> (cube_combined_noise != NULL) {
-<a name="l01170"></a>01170 KMO_TRY_EXIT_IF_NULL(
-<a name="l01171"></a>01171 extname = kmo_extname_creator(ifu_frame, exposure_ifus[0],
-<a name="l01172"></a>01172 EXT_NOISE));
-<a name="l01173"></a>01173
-<a name="l01174"></a>01174 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01175"></a>01175 kmclipm_update_property_string(ref_sub_header,
-<a name="l01176"></a>01176 EXTNAME,
-<a name="l01177"></a>01177 extname,
-<a name="l01178"></a>01178 <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01179"></a>01179 cpl_free(extname); extname = NULL;
-<a name="l01180"></a>01180
-<a name="l01181"></a>01181 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01182"></a>01182 kmo_dfs_save_cube(cube_combined_noise, filename_output_cube,
-<a name="l01183"></a>01183 <span class="stringliteral">""</span>, ref_sub_header, 0./0.));
-<a name="l01184"></a>01184 }
-<a name="l01185"></a>01185 }
-<a name="l01186"></a>01186 KMO_CATCH
-<a name="l01187"></a>01187 {
-<a name="l01188"></a>01188 KMO_CATCH_MSG();
-<a name="l01189"></a>01189 ret_val = -1;
-<a name="l01190"></a>01190 }
-<a name="l01191"></a>01191
-<a name="l01192"></a>01192 cpl_free(suffix); suffix = NULL;
-<a name="l01193"></a>01193 cpl_free(filename_output_cube); filename_output_cube = NULL;
-<a name="l01194"></a>01194 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l01195"></a>01195 cpl_vector_delete(ifus); ifus = NULL;
-<a name="l01196"></a>01196 cpl_imagelist_delete(cube_combined_data); cube_combined_data = NULL;
-<a name="l01197"></a>01197 cpl_imagelist_delete(cube_combined_noise); cube_combined_noise = NULL;
-<a name="l01198"></a>01198 <span class="keywordflow">if</span> (exposures != NULL) {cpl_frameset_delete(exposures);}
-<a name="l01199"></a>01199 <span class="keywordflow">if</span> (exposure_filename != NULL) {cpl_free(exposure_filename);}
-<a name="l01200"></a>01200 <span class="keywordflow">if</span> ((ifus_txt != NULL) && (strcmp(ifus_txt, <span class="stringliteral">""</span>) != 0)) { <span class="comment">//IFU selected by user given list</span>
-<a name="l01201"></a>01201 <span class="keywordflow">for</span> (i = 0; i < nr_alloc; i++) {
-<a name="l01202"></a>01202 cpl_free(exposure_objectname[i]);
-<a name="l01203"></a>01203 }
-<a name="l01204"></a>01204 }
-<a name="l01205"></a>01205 <span class="keywordflow">if</span> (exposure_objectname != NULL) {cpl_free(exposure_objectname);}
-<a name="l01206"></a>01206 <span class="keywordflow">if</span> (exposure_ifus != NULL) {cpl_free(exposure_ifus);}
-<a name="l01207"></a>01207 <span class="keywordflow">if</span> (ref_main_header != NULL) {cpl_propertylist_delete(ref_main_header);}
-<a name="l01208"></a>01208 <span class="keywordflow">if</span> (ref_sub_header != NULL) {cpl_propertylist_delete(ref_sub_header);}
-<a name="l01209"></a>01209 <span class="keywordflow">if</span> (xshifts != NULL) {cpl_free(xshifts);}
-<a name="l01210"></a>01210 <span class="keywordflow">if</span> (yshifts != NULL) {cpl_free(yshifts);}
-<a name="l01211"></a>01211
-<a name="l01212"></a>01212 <span class="keywordflow">if</span> (data_cube_list != NULL) {
-<a name="l01213"></a>01213 <span class="keywordflow">for</span> (i = 0; i < nr_science_frames; i++) {
-<a name="l01214"></a>01214 cpl_imagelist_delete(data_cube_list[i]); data_cube_list[i] = NULL;
-<a name="l01215"></a>01215 }
-<a name="l01216"></a>01216 cpl_free(data_cube_list); data_cube_list = NULL;
-<a name="l01217"></a>01217 }
-<a name="l01218"></a>01218
-<a name="l01219"></a>01219 <span class="keywordflow">if</span> (noise_cube_list != NULL) {
-<a name="l01220"></a>01220 <span class="keywordflow">for</span> (i = 0; i < nr_science_frames; i++) {
-<a name="l01221"></a>01221 cpl_imagelist_delete(noise_cube_list[i]); noise_cube_list[i] = NULL;
-<a name="l01222"></a>01222 }
-<a name="l01223"></a>01223 cpl_free(noise_cube_list); noise_cube_list = NULL;
-<a name="l01224"></a>01224 }
-<a name="l01225"></a>01225
-<a name="l01226"></a>01226 <span class="keywordflow">if</span> (data_header_list != NULL) {
-<a name="l01227"></a>01227 <span class="keywordflow">for</span> (i = 0; i < nr_science_frames; i++) {
-<a name="l01228"></a>01228 cpl_propertylist_delete(data_header_list[i]);
-<a name="l01229"></a>01229 data_header_list[i] = NULL;
-<a name="l01230"></a>01230 }
-<a name="l01231"></a>01231 cpl_free(data_header_list); data_header_list = NULL;
-<a name="l01232"></a>01232 }
-<a name="l01233"></a>01233
-<a name="l01234"></a>01234 <span class="keywordflow">if</span> (noise_header_list != NULL) {
-<a name="l01235"></a>01235 <span class="keywordflow">for</span> (i = 0; i < nr_science_frames; i++) {
-<a name="l01236"></a>01236 cpl_propertylist_delete(noise_header_list[i]);
-<a name="l01237"></a>01237 noise_header_list[i] = NULL;
-<a name="l01238"></a>01238 }
-<a name="l01239"></a>01239 cpl_free(noise_header_list); noise_header_list = NULL;
-<a name="l01240"></a>01240 }
-<a name="l01241"></a>01241
-<a name="l01242"></a>01242 <span class="keywordflow">if</span> (header_data != NULL) {
-<a name="l01243"></a>01243 <span class="keywordflow">for</span> (i = 0; i < nr_science_frames; i++) {
-<a name="l01244"></a>01244 cpl_propertylist_delete(header_data[i]);
-<a name="l01245"></a>01245 header_data[i] = NULL;
-<a name="l01246"></a>01246 }
-<a name="l01247"></a>01247 cpl_free(header_data); header_data = NULL;
-<a name="l01248"></a>01248 }
-<a name="l01249"></a>01249
-<a name="l01250"></a>01250 <span class="keywordflow">return</span> ret_val;
-<a name="l01251"></a>01251 }
+<a name="l01128"></a>01128 <span class="comment">//</span>
+<a name="l01129"></a>01129 <span class="comment">// get valid object names to process, either one object name across</span>
+<a name="l01130"></a>01130 <span class="comment">// several SCIENCE frames, or all object names</span>
+<a name="l01131"></a>01131 <span class="comment">//</span>
+<a name="l01132"></a>01132 KMO_TRY_EXIT_IF_NULL(
+<a name="l01133"></a>01133 arm_name_struct = kmo_create_armNameStruct(frameset,
+<a name="l01134"></a>01134 SCIENCE,
+<a name="l01135"></a>01135 ifus,
+<a name="l01136"></a>01136 name,
+<a name="l01137"></a>01137 unused_ifus_after,
+<a name="l01138"></a>01138 bounds,
+<a name="l01139"></a>01139 mapping_mode,
+<a name="l01140"></a>01140 no_subtract));
+<a name="l01141"></a>01141 cpl_free(bounds); bounds = NULL;
+<a name="l01142"></a>01142
+<a name="l01143"></a>01143 kmo_print_armNameStruct(frameset, arm_name_struct);
+<a name="l01144"></a>01144
+<a name="l01145"></a>01145 <span class="comment">//</span>
+<a name="l01146"></a>01146 <span class="comment">// check availability of tellurics for the different IFUs used</span>
+<a name="l01147"></a>01147 <span class="comment">//</span>
+<a name="l01148"></a>01148 <span class="keywordflow">if</span> (has_telluric && (mapping_mode != NULL)) {
+<a name="l01149"></a>01149 <span class="comment">// in mapping-mode check if for all IFUs there is either no telluric at all</span>
+<a name="l01150"></a>01150 <span class="comment">// or the same number of tellurics than object names</span>
+<a name="l01151"></a>01151 <span class="keywordtype">int</span> telluric_ok = TRUE;
+<a name="l01152"></a>01152 <span class="keywordflow">for</span> (cnt = 0; cnt < arm_name_struct->nrNames; cnt++) {
+<a name="l01153"></a>01153 <span class="keywordflow">if</span> (!((arm_name_struct->telluricCnt[cnt] == arm_name_struct->namesCnt[cnt]) ||
+<a name="l01154"></a>01154 (arm_name_struct->telluricCnt[cnt] == 0)))
+<a name="l01155"></a>01155 {
+<a name="l01156"></a>01156 telluric_ok = FALSE;
+<a name="l01157"></a>01157 <span class="keywordflow">break</span>;
+<a name="l01158"></a>01158 }
+<a name="l01159"></a>01159 }
+<a name="l01160"></a>01160 <span class="keywordflow">if</span> (!telluric_ok) {
+<a name="l01161"></a>01161 KMO_TRY_ASSURE(1==0,
+<a name="l01162"></a>01162 CPL_ERROR_UNSUPPORTED_MODE,
+<a name="l01163"></a>01163 <span class="stringliteral">"Mosaics need a TELLURIC frame with at least a telluric correction per detector available! "</span>
+<a name="l01164"></a>01164 <span class="stringliteral">"Omit the TELLURIC from your sof-file or choose another TELLURIC!"</span>);
+<a name="l01165"></a>01165 }
+<a name="l01166"></a>01166 }
+<a name="l01167"></a>01167
+<a name="l01168"></a>01168 <span class="comment">//</span>
+<a name="l01169"></a>01169 <span class="comment">// loop over all object names</span>
+<a name="l01170"></a>01170 <span class="comment">// (for mapping template only once,)</span>
+<a name="l01171"></a>01171 <span class="comment">// (when ifus or name is set as well only once)</span>
+<a name="l01172"></a>01172 <span class="comment">//</span>
+<a name="l01173"></a>01173 <span class="keywordflow">for</span> (arm_index = 0; arm_index < arm_name_struct->nrNames; arm_index++) {
+<a name="l01174"></a>01174
+<a name="l01175"></a>01175 nr_frames = arm_name_struct->namesCnt[arm_index];
+<a name="l01176"></a>01176
+<a name="l01177"></a>01177 KMO_TRY_EXIT_IF_NULL(
+<a name="l01178"></a>01178 sub_headers = kmo_mr_get_headers(arm_name_struct,
+<a name="l01179"></a>01179 arm_index+1,
+<a name="l01180"></a>01180 frameset,
+<a name="l01181"></a>01181 gd_14x14));
+<a name="l01182"></a>01182
+<a name="l01183"></a>01183 <span class="keywordflow">if</span> ((strcmp(comb_method, <span class="stringliteral">"center"</span>) == 0) ||
+<a name="l01184"></a>01184 (ref_spectrum_frame != NULL))
+<a name="l01185"></a>01185 {
+<a name="l01186"></a>01186 <span class="comment">//</span>
+<a name="l01187"></a>01187 <span class="comment">// reconstruct preliminary cubes</span>
+<a name="l01188"></a>01188 <span class="comment">//</span>
+<a name="l01189"></a>01189 KMO_TRY_EXIT_IF_NULL(
+<a name="l01190"></a>01190 pre_data_cube_list = kmo_mr_create_datacubes(arm_name_struct,
+<a name="l01191"></a>01191 arm_index+1,
+<a name="l01192"></a>01192 frameset,
+<a name="l01193"></a>01193 gd_14x14,
+<a name="l01194"></a>01194 xcal_interpolation));
+<a name="l01195"></a>01195 <span class="comment">//</span>
+<a name="l01196"></a>01196 <span class="comment">// calculate lambda-correction coefficients</span>
+<a name="l01197"></a>01197 <span class="comment">//</span>
+<a name="l01198"></a>01198 <span class="keywordflow">if</span> (ref_spectrum_frame != NULL) {
+<a name="l01199"></a>01199 KMO_TRY_EXIT_IF_NULL(
+<a name="l01200"></a>01200 lcorr_coeffs = cpl_calloc(nr_frames, <span class="keyword">sizeof</span>(cpl_polynomial*)));
+<a name="l01201"></a>01201
+<a name="l01202"></a>01202 cnt = 0;
+<a name="l01203"></a>01203 <span class="keywordflow">for</span> (iy = 0; iy < arm_name_struct->size; iy++) {
+<a name="l01204"></a>01204 <span class="keywordflow">for</span> (ix = 0; ix < KMOS_NR_IFUS; ix++) {
+<a name="l01205"></a>01205 ifu_nr = ix + 1;
+<a name="l01206"></a>01206 <span class="keywordflow">if</span> (arm_name_struct->name_ids[ix+iy*KMOS_NR_IFUS] == arm_index+1) {
+<a name="l01207"></a>01207 KMO_TRY_EXIT_IF_NULL(
+<a name="l01208"></a>01208 lcorr_coeffs[cnt] = kmo_lcorr_get(pre_data_cube_list[cnt],
+<a name="l01209"></a>01209 sub_headers[cnt],
+<a name="l01210"></a>01210 ref_spectrum_frame,
+<a name="l01211"></a>01211 gd_14x14,
+<a name="l01212"></a>01212 filter_id,
+<a name="l01213"></a>01213 ifu_nr));
+<a name="l01214"></a>01214 cnt++;
+<a name="l01215"></a>01215 }
+<a name="l01216"></a>01216 }
+<a name="l01217"></a>01217 }
+<a name="l01218"></a>01218 } <span class="comment">// end if (lcorr)</span>
+<a name="l01219"></a>01219 } <span class="comment">// end if (center, lcorr)</span>
+<a name="l01220"></a>01220
+<a name="l01221"></a>01221 <span class="comment">//</span>
+<a name="l01222"></a>01222 <span class="comment">// calculate offsets</span>
+<a name="l01223"></a>01223 <span class="comment">//</span>
+<a name="l01224"></a>01224 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01225"></a>01225 kmo_mr_get_offsets(arm_name_struct,
+<a name="l01226"></a>01226 arm_index+1,
+<a name="l01227"></a>01227 comb_method,
+<a name="l01228"></a>01228 imethod,
+<a name="l01229"></a>01229 filename,
+<a name="l01230"></a>01230 frameset,
+<a name="l01231"></a>01231 pre_data_cube_list,
+<a name="l01232"></a>01232 sub_headers,
+<a name="l01233"></a>01233 fmethod,
+<a name="l01234"></a>01234 cmethod,
+<a name="l01235"></a>01235 cpos_rej,
+<a name="l01236"></a>01236 cneg_rej,
+<a name="l01237"></a>01237 citer,
+<a name="l01238"></a>01238 cmin,
+<a name="l01239"></a>01239 cmax,
+<a name="l01240"></a>01240 dev_cal,
+<a name="l01241"></a>01241 mapping_mode,
+<a name="l01242"></a>01242 &xshifts,
+<a name="l01243"></a>01243 &yshifts));
+<a name="l01244"></a>01244
+<a name="l01245"></a>01245 KMO_TRY_EXIT_IF_NULL(
+<a name="l01246"></a>01246 ref_sub_header = cpl_propertylist_duplicate(sub_headers[0]));
+<a name="l01247"></a>01247
+<a name="l01248"></a>01248 <span class="keywordflow">for</span> (cnt = 0; cnt < nr_frames; cnt++) {
+<a name="l01249"></a>01249 cpl_propertylist_delete(sub_headers[cnt]); sub_headers[cnt] = NULL;
+<a name="l01250"></a>01250 }
+<a name="l01251"></a>01251 cpl_free(sub_headers); sub_headers = NULL;
<a name="l01252"></a>01252
+<a name="l01253"></a>01253 <span class="keywordflow">if</span> (pre_data_cube_list != NULL) {
+<a name="l01254"></a>01254 <span class="keywordflow">for</span> (cnt = 0; cnt < nr_frames; cnt++) {
+<a name="l01255"></a>01255 cpl_imagelist_delete(pre_data_cube_list[cnt]);
+<a name="l01256"></a>01256 }
+<a name="l01257"></a>01257 cpl_free(pre_data_cube_list); pre_data_cube_list = NULL;
+<a name="l01258"></a>01258 }
+<a name="l01259"></a>01259
+<a name="l01260"></a>01260 <span class="comment">//</span>
+<a name="l01261"></a>01261 <span class="comment">// set spatial part of the grid</span>
+<a name="l01262"></a>01262 <span class="comment">//</span>
+<a name="l01263"></a>01263 <span class="keywordflow">for</span> (cnt = 0; cnt < nr_frames; cnt++) {
+<a name="l01264"></a>01264 <span class="keywordflow">if</span> (xmin > xshifts[cnt]) {
+<a name="l01265"></a>01265 xmin = xshifts[cnt];
+<a name="l01266"></a>01266 }
+<a name="l01267"></a>01267 <span class="keywordflow">if</span> (xmax < xshifts[cnt]) {
+<a name="l01268"></a>01268 xmax = xshifts[cnt];
+<a name="l01269"></a>01269 }
+<a name="l01270"></a>01270 <span class="keywordflow">if</span> (ymin > yshifts[cnt]) {
+<a name="l01271"></a>01271 ymin = yshifts[cnt];
+<a name="l01272"></a>01272 }
+<a name="l01273"></a>01273 <span class="keywordflow">if</span> (ymax < yshifts[cnt]) {
+<a name="l01274"></a>01274 ymax = yshifts[cnt];
+<a name="l01275"></a>01275 }
+<a name="l01276"></a>01276 }
+<a name="l01277"></a>01277
+<a name="l01278"></a>01278 <span class="keywordflow">if</span> (xmax > 0.0001) {
+<a name="l01279"></a>01279 gxshift = -rint(xmax); <span class="comment">//(int)xmax; // gxshift = - ceil(xmax);</span>
+<a name="l01280"></a>01280 } <span class="keywordflow">else</span> {
+<a name="l01281"></a>01281 gxshift = 0.;
+<a name="l01282"></a>01282 }
+<a name="l01283"></a>01283 <span class="keywordflow">if</span> (ymin < -0.0001) {
+<a name="l01284"></a>01284 gyshift = rint(ymin); <span class="comment">//(int)ymin; // gyshift = floor(ymin);</span>
+<a name="l01285"></a>01285 } <span class="keywordflow">else</span> {
+<a name="l01286"></a>01286 gyshift = 0.;
+<a name="l01287"></a>01287 }
+<a name="l01288"></a>01288 <span class="keywordflow">if</span> (xmin < -0.0001) {
+<a name="l01289"></a>01289 gxdim = - floor(xmin);
+<a name="l01290"></a>01290 } <span class="keywordflow">else</span> {
+<a name="l01291"></a>01291 gxdim = 0.;
+<a name="l01292"></a>01292 }
+<a name="l01293"></a>01293 <span class="keywordflow">if</span> (ymax > 0.0001) {
+<a name="l01294"></a>01294 gydim = ceil(ymax);
+<a name="l01295"></a>01295 } <span class="keywordflow">else</span> {
+<a name="l01296"></a>01296 gydim = 0.;
+<a name="l01297"></a>01297 }
+<a name="l01298"></a>01298
+<a name="l01299"></a>01299 xdim = (int)(gxdim - gxshift + .5);
+<a name="l01300"></a>01300 ydim = (int)(gydim - gyshift + .5);
+<a name="l01301"></a>01301 gd.x.start += gxshift * pix_scale*1000;
+<a name="l01302"></a>01302 gd.y.start += gyshift * pix_scale*1000;
+<a name="l01303"></a>01303 gd.x.dim += xdim;
+<a name="l01304"></a>01304 gd.y.dim += ydim;
+<a name="l01305"></a>01305
+<a name="l01306"></a>01306 <span class="comment">// cpl_msg_set_level(CPL_MSG_DEBUG);</span>
+<a name="l01307"></a>01307 <span class="comment">// cpl_msg_debug(cpl_func,"x: %f < %f, y: %f < %f",</span>
+<a name="l01308"></a>01308 <span class="comment">// xmin,xmax,ymin,ymax);</span>
+<a name="l01309"></a>01309 <span class="comment">// cpl_msg_debug(cpl_func,"gxshift: %f gxdim: %f xdim: %d, gyshift: %f gydim: %f ydim: %d",</span>
+<a name="l01310"></a>01310 <span class="comment">// gxshift, gxdim, xdim, gyshift, gydim, ydim);</span>
+<a name="l01311"></a>01311 <span class="comment">// cpl_msg_debug(cpl_func,"gd: start delta dim");</span>
+<a name="l01312"></a>01312 <span class="comment">// cpl_msg_debug(cpl_func," x: %f %f %d", gd.x.start, gd.x.delta, gd.x.dim);</span>
+<a name="l01313"></a>01313 <span class="comment">// cpl_msg_debug(cpl_func," y: %f %f %d", gd.y.start, gd.y.delta, gd.y.dim);</span>
+<a name="l01314"></a>01314 <span class="comment">// cpl_msg_debug(cpl_func," l: %f %f %d", gd.l.start, gd.l.delta, gd.l.dim);</span>
+<a name="l01315"></a>01315 <span class="comment">// cpl_msg_set_level(CPL_MSG_INFO);</span>
+<a name="l01316"></a>01316
+<a name="l01317"></a>01317 <span class="comment">//</span>
+<a name="l01318"></a>01318 <span class="comment">// reconstruct multiple detector images</span>
+<a name="l01319"></a>01319 <span class="comment">//</span>
+<a name="l01320"></a>01320 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01321"></a>01321 kmo_mr_reconstruct(frameset,
+<a name="l01322"></a>01322 arm_name_struct,
+<a name="l01323"></a>01323 arm_index+1,
+<a name="l01324"></a>01324 xshifts,
+<a name="l01325"></a>01325 yshifts,
+<a name="l01326"></a>01326 gd,
+<a name="l01327"></a>01327 gd_14x14,
+<a name="l01328"></a>01328 pix_scale,
+<a name="l01329"></a>01329 xcal_interpolation,
+<a name="l01330"></a>01330 lcorr_coeffs,
+<a name="l01331"></a>01331 &cube_combined_data,
+<a name="l01332"></a>01332 &cube_combined_noise,
+<a name="l01333"></a>01333 no_subtract,
+<a name="l01334"></a>01334 flux,
+<a name="l01335"></a>01335 background));
+<a name="l01336"></a>01336
+<a name="l01337"></a>01337 <span class="keywordflow">if</span> (lcorr_coeffs != NULL) {
+<a name="l01338"></a>01338 <span class="keywordflow">for</span> (cnt = 0; cnt < nr_frames; cnt++) {
+<a name="l01339"></a>01339 cpl_polynomial_delete(lcorr_coeffs[cnt]); lcorr_coeffs[cnt] = NULL;
+<a name="l01340"></a>01340 }
+<a name="l01341"></a>01341 cpl_free(lcorr_coeffs); lcorr_coeffs = NULL;
+<a name="l01342"></a>01342 }
+<a name="l01343"></a>01343
+<a name="l01344"></a>01344 <span class="comment">//</span>
+<a name="l01345"></a>01345 <span class="comment">// identify ifu_nr of current object name in first SCIENCE frame</span>
+<a name="l01346"></a>01346 <span class="comment">// containing this object name (e.g. first frame could contain skies only)</span>
+<a name="l01347"></a>01347 <span class="comment">//</span>
+<a name="l01348"></a>01348 ifu_nr = -1;
+<a name="l01349"></a>01349 science_frame = NULL;
+<a name="l01350"></a>01350 <span class="keywordflow">for</span> (iy = 0; iy < arm_name_struct->size; iy++) {
+<a name="l01351"></a>01351 <span class="keywordflow">for</span> (ix = 0; ix < KMOS_NR_IFUS; ix++) {
+<a name="l01352"></a>01352 <span class="keywordflow">if</span> (arm_name_struct->name_ids[ix+iy*KMOS_NR_IFUS] == arm_index+1) {
+<a name="l01353"></a>01353 <span class="keywordflow">if</span> (ifu_nr == -1) {
+<a name="l01354"></a>01354 KMO_TRY_EXIT_IF_NULL(
+<a name="l01355"></a>01355 science_frame = arm_name_struct->obj_sky_struct->table[iy].objFrame);
+<a name="l01356"></a>01356
+<a name="l01357"></a>01357 ifu_nr = ix + 1;
+<a name="l01358"></a>01358 <span class="keywordflow">break</span>;
+<a name="l01359"></a>01359 }
+<a name="l01360"></a>01360 }
+<a name="l01361"></a>01361 }
+<a name="l01362"></a>01362 <span class="keywordflow">if</span> (ifu_nr != -1) { <span class="keywordflow">break</span>; }
+<a name="l01363"></a>01363 }
+<a name="l01364"></a>01364
+<a name="l01365"></a>01365 <span class="comment">//</span>
+<a name="l01366"></a>01366 <span class="comment">// divide cube by telluric correction</span>
+<a name="l01367"></a>01367 <span class="comment">//</span>
+<a name="l01368"></a>01368 <span class="keywordflow">if</span> (has_telluric &&
+<a name="l01369"></a>01369 (arm_name_struct->sameTelluric[arm_index] > 0))
+<a name="l01370"></a>01370 {
+<a name="l01371"></a>01371 telluric_data = kmo_tweak_load_telluric(frameset, ifu_nr, FALSE, no_subtract);
+<a name="l01372"></a>01372 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01373"></a>01373 <span class="keywordflow">if</span> (telluric_data != NULL) {
+<a name="l01374"></a>01374 <span class="keywordtype">int</span> index = kmo_identify_index_desc(desc_telluric, ifu_nr, TRUE);
+<a name="l01375"></a>01375 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01376"></a>01376 <span class="keywordflow">if</span> (desc_telluric.sub_desc[index-1].valid_data == TRUE) {
+<a name="l01377"></a>01377 <span class="comment">// load noise if present</span>
+<a name="l01378"></a>01378 telluric_noise = kmo_tweak_load_telluric(frameset, ifu_nr, TRUE, no_subtract);
+<a name="l01379"></a>01379 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01380"></a>01380 } <span class="keywordflow">else</span> {
+<a name="l01381"></a>01381 <span class="keywordflow">if</span> (print_warning_once_tweak_std_noise && (cube_combined_noise != NULL)) {
+<a name="l01382"></a>01382 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"************************************************************"</span>);
+<a name="l01383"></a>01383 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* Noise cubes were calculated, but won't be divided by *"</span>);
+<a name="l01384"></a>01384 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* telluric error since it is missing. *"</span>);
+<a name="l01385"></a>01385 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* In order to get a telluric with errors, execute *"</span>);
+<a name="l01386"></a>01386 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* kmo_std_star with one of the nearest neighbour methods *"</span>);
+<a name="l01387"></a>01387 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* (set --imethod to NN, lwNN or swNN) *"</span>);
+<a name="l01388"></a>01388 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"************************************************************"</span>);
+<a name="l01389"></a>01389 print_warning_once_tweak_std_noise = FALSE;
+<a name="l01390"></a>01390 }
+<a name="l01391"></a>01391 }
+<a name="l01392"></a>01392
+<a name="l01393"></a>01393 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01394"></a>01394 kmo_arithmetic_3D_1D(
+<a name="l01395"></a>01395 cube_combined_data, telluric_data,
+<a name="l01396"></a>01396 cube_combined_noise, telluric_noise, <span class="stringliteral">"/"</span>));
+<a name="l01397"></a>01397 }
+<a name="l01398"></a>01398 kmclipm_vector_delete(telluric_data); telluric_data = NULL;
+<a name="l01399"></a>01399 kmclipm_vector_delete(telluric_noise); telluric_noise = NULL;
+<a name="l01400"></a>01400 }
+<a name="l01401"></a>01401
+<a name="l01402"></a>01402 <span class="comment">//</span>
+<a name="l01403"></a>01403 <span class="comment">// saving</span>
+<a name="l01404"></a>01404 <span class="comment">//</span>
+<a name="l01405"></a>01405 fn_cube = CUBE_MULTI;
+<a name="l01406"></a>01406 <span class="keywordflow">if</span> (!suppress_extension) {
+<a name="l01407"></a>01407 <span class="keywordtype">char</span> tmp_suffix[1024];
+<a name="l01408"></a>01408 tmp_suffix[0] = <span class="charliteral">'\0'</span>;
+<a name="l01409"></a>01409
+<a name="l01410"></a>01410 <span class="keywordflow">if</span> (arm_name_struct->telluricCnt[arm_index] == nr_frames) {
+<a name="l01411"></a>01411 strcat(tmp_suffix, <span class="stringliteral">"_telluric"</span>);
+<a name="l01412"></a>01412 }
+<a name="l01413"></a>01413 <span class="keywordflow">if</span> (has_illum_corr) {
+<a name="l01414"></a>01414 strcat(tmp_suffix, <span class="stringliteral">"_illum"</span>);
+<a name="l01415"></a>01415 }
+<a name="l01416"></a>01416 <span class="comment">// if (sky_tweak) {</span>
+<a name="l01417"></a>01417 <span class="comment">// strcat(tmp_suffix, "_skytweak");</span>
+<a name="l01418"></a>01418 <span class="comment">// }</span>
+<a name="l01419"></a>01419
+<a name="l01420"></a>01420 <span class="keywordflow">if</span> (strlen(tmp_suffix) > 0) {
+<a name="l01421"></a>01421 KMO_TRY_EXIT_IF_NULL(
+<a name="l01422"></a>01422 fn_suffix = cpl_sprintf(<span class="stringliteral">"_%s_%s"</span>, arm_name_struct->names[arm_index], tmp_suffix));
+<a name="l01423"></a>01423 } <span class="keywordflow">else</span> {
+<a name="l01424"></a>01424 KMO_TRY_EXIT_IF_NULL(
+<a name="l01425"></a>01425 fn_suffix = cpl_sprintf(<span class="stringliteral">"_%s"</span>, arm_name_struct->names[arm_index]));
+<a name="l01426"></a>01426 }
+<a name="l01427"></a>01427 } <span class="keywordflow">else</span> {
+<a name="l01428"></a>01428 KMO_TRY_EXIT_IF_NULL(
+<a name="l01429"></a>01429 fn_suffix = cpl_sprintf(<span class="stringliteral">"_%d"</span>, suppress_index++));
+<a name="l01430"></a>01430 }
+<a name="l01431"></a>01431
+<a name="l01432"></a>01432 <span class="comment">//</span>
+<a name="l01433"></a>01433 <span class="comment">// calculate WCS</span>
+<a name="l01434"></a>01434 <span class="comment">//</span>
+<a name="l01435"></a>01435 KMO_TRY_EXIT_IF_NULL(
+<a name="l01436"></a>01436 science_frame_header = kmclipm_propertylist_load(cpl_frame_get_filename(science_frame), 0));
+<a name="l01437"></a>01437
+<a name="l01438"></a>01438 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01439"></a>01439 kmo_calc_wcs_gd(science_frame_header, ref_sub_header, ifu_nr, gd));
+<a name="l01440"></a>01440
+<a name="l01441"></a>01441 cpl_propertylist_delete(science_frame_header); science_frame_header = NULL;
+<a name="l01442"></a>01442
+<a name="l01443"></a>01443 <span class="comment">//</span>
+<a name="l01444"></a>01444 <span class="comment">// save product</span>
+<a name="l01445"></a>01445 <span class="comment">//</span>
+<a name="l01446"></a>01446 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01447"></a>01447 kmo_dfs_save_main_header(frameset, fn_cube, fn_suffix,
+<a name="l01448"></a>01448 science_frame, NULL, parlist, cpl_func));
+<a name="l01449"></a>01449
+<a name="l01450"></a>01450 KMO_TRY_EXIT_IF_NULL(
+<a name="l01451"></a>01451 extname = cpl_sprintf(<span class="stringliteral">"%s.DATA"</span>, arm_name_struct->names[arm_index]));
+<a name="l01452"></a>01452 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01453"></a>01453 kmclipm_update_property_string(ref_sub_header,
+<a name="l01454"></a>01454 EXTNAME,
+<a name="l01455"></a>01455 extname,
+<a name="l01456"></a>01456 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01457"></a>01457 cpl_free(extname); extname = NULL;
+<a name="l01458"></a>01458
+<a name="l01459"></a>01459 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01460"></a>01460 kmo_dfs_save_cube(cube_combined_data, fn_cube, fn_suffix,
+<a name="l01461"></a>01461 ref_sub_header, 0./0.));
+<a name="l01462"></a>01462
+<a name="l01463"></a>01463 <span class="keywordflow">if</span> (cube_combined_noise != NULL) {
+<a name="l01464"></a>01464 KMO_TRY_EXIT_IF_NULL(
+<a name="l01465"></a>01465 extname = cpl_sprintf(<span class="stringliteral">"%s.NOISE"</span>, arm_name_struct->names[arm_index]));
+<a name="l01466"></a>01466 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01467"></a>01467 kmclipm_update_property_string(ref_sub_header,
+<a name="l01468"></a>01468 EXTNAME,
+<a name="l01469"></a>01469 extname,
+<a name="l01470"></a>01470 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01471"></a>01471 cpl_free(extname); extname = NULL;
+<a name="l01472"></a>01472
+<a name="l01473"></a>01473 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01474"></a>01474 kmo_dfs_save_cube(cube_combined_noise, fn_cube, fn_suffix,
+<a name="l01475"></a>01475 ref_sub_header, 0./0.));
+<a name="l01476"></a>01476 }
+<a name="l01477"></a>01477
+<a name="l01478"></a>01478 cpl_imagelist_delete(cube_combined_data); cube_combined_data = NULL;
+<a name="l01479"></a>01479 cpl_imagelist_delete(cube_combined_noise); cube_combined_noise = NULL;
+<a name="l01480"></a>01480 cpl_propertylist_delete(ref_sub_header); ref_sub_header = NULL;
+<a name="l01481"></a>01481 cpl_free(fn_suffix); fn_suffix = NULL;
+<a name="l01482"></a>01482 cpl_free(xshifts); xshifts = NULL;
+<a name="l01483"></a>01483 cpl_free(yshifts); yshifts = NULL;
+<a name="l01484"></a>01484 } <span class="comment">// for (arm_index = nrNames)</span>
+<a name="l01485"></a>01485
+<a name="l01486"></a>01486 kmo_print_unused_ifus(unused_ifus_after, TRUE);
+<a name="l01487"></a>01487 }
+<a name="l01488"></a>01488 KMO_CATCH
+<a name="l01489"></a>01489 {
+<a name="l01490"></a>01490 KMO_CATCH_MSG();
+<a name="l01491"></a>01491 ret_val = -1;
+<a name="l01492"></a>01492 }
+<a name="l01493"></a>01493
+<a name="l01494"></a>01494 kmo_free_fits_desc(&desc1);
+<a name="l01495"></a>01495 kmo_free_fits_desc(&desc2);
+<a name="l01496"></a>01496 kmo_free_fits_desc(&desc_telluric);
+<a name="l01497"></a>01497 cpl_vector_delete(ifus); ifus = NULL;
+<a name="l01498"></a>01498 cpl_free(mapping_mode); mapping_mode = NULL;
+<a name="l01499"></a>01499 <span class="keywordflow">if</span> (unused_ifus_before != NULL) {
+<a name="l01500"></a>01500 kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
+<a name="l01501"></a>01501 }
+<a name="l01502"></a>01502 <span class="keywordflow">if</span> (unused_ifus_after != NULL) {
+<a name="l01503"></a>01503 kmo_free_unused_ifus(unused_ifus_after); unused_ifus_after = NULL;
+<a name="l01504"></a>01504 }
+<a name="l01505"></a>01505 <span class="keywordflow">if</span> (bounds != NULL) {
+<a name="l01506"></a>01506 cpl_free(bounds); bounds = NULL;
+<a name="l01507"></a>01507 }
+<a name="l01508"></a>01508
+<a name="l01509"></a>01509 kmo_delete_armNameStruct(arm_name_struct);
+<a name="l01510"></a>01510
+<a name="l01511"></a>01511 <span class="comment">// frees for the case of errors</span>
+<a name="l01512"></a>01512 kmclipm_vector_delete(telluric_data); telluric_data = NULL;
+<a name="l01513"></a>01513 kmclipm_vector_delete(telluric_noise); telluric_noise = NULL;
+<a name="l01514"></a>01514 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l01515"></a>01515 cpl_table_delete(band_table); band_table = NULL;
+<a name="l01516"></a>01516 cpl_free(suffix); suffix = NULL;
+<a name="l01517"></a>01517 cpl_free(fn_suffix); fn_suffix = NULL;
+<a name="l01518"></a>01518 cpl_free(filter_id); filter_id = NULL;
+<a name="l01519"></a>01519
+<a name="l01520"></a>01520 <span class="keywordflow">return</span> ret_val;
+<a name="l01521"></a>01521 }
+<a name="l01522"></a>01522
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__noise__map_8c_source.html b/html/kmo__noise__map_8c_source.html
index 0da5022..3817505 100644
--- a/html/kmo__noise__map_8c_source.html
+++ b/html/kmo__noise__map_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_noise_map.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_noise_map.c,v 1.8 2013/05/21 12:13:58 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_noise_map.c,v 1.8 2013-05-21 12:13:58 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/05/21 12:13:58 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-05-21 12:13:58 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.8 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -339,7 +339,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__reconstruct_8c_source.html b/html/kmo__reconstruct_8c_source.html
index f3b57d1..3af5b93 100644
--- a/html/kmo__reconstruct_8c_source.html
+++ b/html/kmo__reconstruct_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_reconstruct.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_reconstruct.c,v 1.58 2013/07/31 10:40:28 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_reconstruct.c,v 1.61 2013/10/08 14:55:01 erw Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -81,10 +81,10 @@
<a name="l00019"></a>00019 <span class="comment"> */</span>
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
-<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/07/31 10:40:28 $</span>
-<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.58 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: erw $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/10/08 14:55:01 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.61 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -405,877 +405,884 @@
<a name="l00390"></a>00390 *input_frame_name = NULL,
<a name="l00391"></a>00391 *output_frame_name = NULL,
<a name="l00392"></a>00392 *filter_id = NULL,
-<a name="l00393"></a>00393 *filter_id_tmp = NULL;
-<a name="l00394"></a>00394 <span class="keywordtype">char</span> *keyword = NULL,
-<a name="l00395"></a>00395 *filename_cube = NULL,
-<a name="l00396"></a>00396 *filename_img = NULL,
-<a name="l00397"></a>00397 <span class="comment">// *fn_lut = NULL,</span>
-<a name="l00398"></a>00398 *suffix = NULL,
-<a name="l00399"></a>00399 *obs_suffix = NULL,
-<a name="l00400"></a>00400 *my_filter_id = NULL,
-<a name="l00401"></a>00401 *extname = NULL;
-<a name="l00402"></a>00402 cpl_image *lcal = NULL,
-<a name="l00403"></a>00403 *det_img_data[KMOS_NR_DETECTORS],
-<a name="l00404"></a>00404 *det_img_noise[KMOS_NR_DETECTORS],
-<a name="l00405"></a>00405 *tmp_img = NULL;
-<a name="l00406"></a>00406 cpl_imagelist *cube_data = NULL,
-<a name="l00407"></a>00407 *cube_noise = NULL;
-<a name="l00408"></a>00408 cpl_frame *rec_frame = NULL,
-<a name="l00409"></a>00409 *xcal_frame = NULL,
-<a name="l00410"></a>00410 *ycal_frame = NULL,
-<a name="l00411"></a>00411 *lcal_frame = NULL,
-<a name="l00412"></a>00412 *ref_spectrum_frame = NULL;
-<a name="l00413"></a>00413 cpl_propertylist *main_header = NULL,
-<a name="l00414"></a>00414 *sub_header = NULL,
-<a name="l00415"></a>00415 *sub_header_orig = NULL,
-<a name="l00416"></a>00416 *actual_sub_header = NULL,
-<a name="l00417"></a>00417 *tmp_header = NULL;
-<a name="l00418"></a>00418 cpl_table *band_table = NULL;
-<a name="l00419"></a>00419 gridDefinition gd;
-<a name="l00420"></a>00420 main_fits_desc desc1,
-<a name="l00421"></a>00421 desc2;
-<a name="l00422"></a>00422 cpl_polynomial *lcorr_coeffs = NULL;
-<a name="l00423"></a>00423
-<a name="l00424"></a>00424 <span class="keywordflow">for</span> (i = 0; i < KMOS_NR_DETECTORS; i++) {
-<a name="l00425"></a>00425 det_img_data[i] = NULL;
-<a name="l00426"></a>00426 det_img_noise[i] = NULL;
-<a name="l00427"></a>00427 }
-<a name="l00428"></a>00428
-<a name="l00429"></a>00429 KMO_TRY
-<a name="l00430"></a>00430 {
-<a name="l00431"></a>00431 kmo_init_fits_desc(&desc1);
-<a name="l00432"></a>00432 kmo_init_fits_desc(&desc2);
-<a name="l00433"></a>00433
-<a name="l00434"></a>00434 <span class="comment">// --- check input ---</span>
-<a name="l00435"></a>00435 KMO_TRY_ASSURE((parlist != NULL) &&
-<a name="l00436"></a>00436 (frameset != NULL),
-<a name="l00437"></a>00437 CPL_ERROR_NULL_INPUT,
-<a name="l00438"></a>00438 <span class="stringliteral">"Not all input data is provided!"</span>);
-<a name="l00439"></a>00439
-<a name="l00440"></a>00440 KMO_TRY_ASSURE((cpl_frameset_count_tags(frameset, DARK) == 1) ||
-<a name="l00441"></a>00441 (cpl_frameset_count_tags(frameset, FLAT_ON) == 1) ||
-<a name="l00442"></a>00442 (cpl_frameset_count_tags(frameset, ARC_ON) == 1) ||
-<a name="l00443"></a>00443 (cpl_frameset_count_tags(frameset, OBJECT) == 1) ||
-<a name="l00444"></a>00444 (cpl_frameset_count_tags(frameset, STD) == 1) ||
-<a name="l00445"></a>00445 (cpl_frameset_count_tags(frameset, SCIENCE) == 1),
-<a name="l00446"></a>00446 CPL_ERROR_NULL_INPUT,
-<a name="l00447"></a>00447 <span class="stringliteral">"A data frame (DARK, FLAT_ON, ARC_ON, OBJECT, STD or SCIENCE) must "</span>
-<a name="l00448"></a>00448 <span class="stringliteral">"be provided!"</span>);
-<a name="l00449"></a>00449
-<a name="l00450"></a>00450 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, XCAL) == 1,
-<a name="l00451"></a>00451 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00452"></a>00452 <span class="stringliteral">"XCAL frame missing in frameset!!"</span>);
-<a name="l00453"></a>00453
-<a name="l00454"></a>00454 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, YCAL) == 1,
-<a name="l00455"></a>00455 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00456"></a>00456 <span class="stringliteral">"YCAL frame missing in frameset!!"</span>);
-<a name="l00457"></a>00457
-<a name="l00458"></a>00458 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, LCAL) == 1,
-<a name="l00459"></a>00459 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00460"></a>00460 <span class="stringliteral">"LCAL frame missing in frameset!!"</span>);
-<a name="l00461"></a>00461
-<a name="l00462"></a>00462 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, WAVE_BAND) == 1,
-<a name="l00463"></a>00463 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00464"></a>00464 <span class="stringliteral">"WAVE_BAND frame missing in frameset!!"</span>);
-<a name="l00465"></a>00465
-<a name="l00466"></a>00466 KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, <span class="stringliteral">"kmo_reconstruct"</span>) == 1,
-<a name="l00467"></a>00467 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00468"></a>00468 <span class="stringliteral">"Cannot identify RAW and CALIB frames!"</span>);
-<a name="l00469"></a>00469
-<a name="l00470"></a>00470 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, OH_SPEC) == 0 ||
-<a name="l00471"></a>00471 cpl_frameset_count_tags(frameset, OH_SPEC) == 1,
-<a name="l00472"></a>00472 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00473"></a>00473 <span class="stringliteral">"Only a single reference spectrum can be provided!"</span>);
-<a name="l00474"></a>00474
-<a name="l00475"></a>00475 <span class="comment">// --- get parameters ---</span>
-<a name="l00476"></a>00476 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"--- Parameter setup for kmo_reconstruct ---"</span>);
-<a name="l00477"></a>00477
-<a name="l00478"></a>00478 KMO_TRY_EXIT_IF_NULL(
-<a name="l00479"></a>00479 imethod = kmo_dfs_get_parameter_string(parlist,
-<a name="l00480"></a>00480 <span class="stringliteral">"kmos.kmo_reconstruct.imethod"</span>));
-<a name="l00481"></a>00481
-<a name="l00482"></a>00482 KMO_TRY_ASSURE((strcmp(imethod, <span class="stringliteral">"NN"</span>) == 0) ||
-<a name="l00483"></a>00483 (strcmp(imethod, <span class="stringliteral">"lwNN"</span>) == 0) ||
-<a name="l00484"></a>00484 (strcmp(imethod, <span class="stringliteral">"swNN"</span>) == 0) ||
-<a name="l00485"></a>00485 (strcmp(imethod, <span class="stringliteral">"MS"</span>) == 0) ||
-<a name="l00486"></a>00486 (strcmp(imethod, <span class="stringliteral">"CS"</span>) == 0),
-<a name="l00487"></a>00487 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00488"></a>00488 <span class="stringliteral">"imethod must be either \"NN\", \"lwNN\", "</span>
-<a name="l00489"></a>00489 <span class="stringliteral">"\"swNN\", \"MS\" or \"CS\"!"</span>);
-<a name="l00490"></a>00490
-<a name="l00491"></a>00491 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00492"></a>00492 kmo_dfs_print_parameter_help(parlist,
-<a name="l00493"></a>00493 <span class="stringliteral">"kmos.kmo_reconstruct.imethod"</span>));
-<a name="l00494"></a>00494
-<a name="l00495"></a>00495 flux = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00496"></a>00496 <span class="stringliteral">"kmos.kmo_reconstruct.flux"</span>);
-<a name="l00497"></a>00497
-<a name="l00498"></a>00498 KMO_TRY_ASSURE((flux == 0) ||
-<a name="l00499"></a>00499 (flux == 1),
-<a name="l00500"></a>00500 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00501"></a>00501 <span class="stringliteral">"flux must be either FALSE or TRUE!"</span>);
-<a name="l00502"></a>00502
-<a name="l00503"></a>00503 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00504"></a>00504 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_reconstruct.flux"</span>));
-<a name="l00505"></a>00505
-<a name="l00506"></a>00506 detectorimage = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00507"></a>00507 <span class="stringliteral">"kmos.kmo_reconstruct.detectorimage"</span>);
-<a name="l00508"></a>00508
-<a name="l00509"></a>00509 KMO_TRY_ASSURE((detectorimage == 0) ||
-<a name="l00510"></a>00510 (detectorimage == 1),
-<a name="l00511"></a>00511 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00512"></a>00512 <span class="stringliteral">"detectorimage must be either 0 or 1 !"</span>);
-<a name="l00513"></a>00513
-<a name="l00514"></a>00514 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00515"></a>00515 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_reconstruct.detectorimage"</span>));
-<a name="l00516"></a>00516
-<a name="l00517"></a>00517 neighborhoodRange = kmo_dfs_get_parameter_double(parlist,
-<a name="l00518"></a>00518 <span class="stringliteral">"kmos.kmo_reconstruct.neighborhoodRange"</span>);
-<a name="l00519"></a>00519 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00520"></a>00520 KMO_TRY_ASSURE(neighborhoodRange > 0.0,
-<a name="l00521"></a>00521 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00522"></a>00522 <span class="stringliteral">"neighborhoodRange must be greater than 0.0"</span>);
-<a name="l00523"></a>00523 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00524"></a>00524 kmo_dfs_print_parameter_help(parlist,
-<a name="l00525"></a>00525 <span class="stringliteral">"kmos.kmo_reconstruct.neighborhoodRange"</span>));
-<a name="l00526"></a>00526
-<a name="l00527"></a>00527 kmo_band_pars_load(parlist, <span class="stringliteral">"kmos.kmo_reconstruct"</span>);
-<a name="l00528"></a>00528
-<a name="l00529"></a>00529 file_extension = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00530"></a>00530 <span class="stringliteral">"kmos.kmo_reconstruct.file_extension"</span>);
-<a name="l00531"></a>00531 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00532"></a>00532 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00533"></a>00533 kmo_dfs_print_parameter_help(parlist,
-<a name="l00534"></a>00534 <span class="stringliteral">"kmos.kmo_reconstruct.file_extension"</span>));
-<a name="l00535"></a>00535
-<a name="l00536"></a>00536 pix_scale = kmo_dfs_get_parameter_double(parlist,
-<a name="l00537"></a>00537 <span class="stringliteral">"kmos.kmo_reconstruct.pix_scale"</span>);
-<a name="l00538"></a>00538 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00539"></a>00539 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00540"></a>00540 kmo_dfs_print_parameter_help(parlist,
-<a name="l00541"></a>00541 <span class="stringliteral">"kmos.kmo_reconstruct.pix_scale"</span>));
-<a name="l00542"></a>00542 KMO_TRY_ASSURE((pix_scale >= 0.01) &&
-<a name="l00543"></a>00543 (pix_scale <= 0.4),
-<a name="l00544"></a>00544 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00545"></a>00545 <span class="stringliteral">"pix_scale must be between 0.01 and 0.4 (results in cubes "</span>
-<a name="l00546"></a>00546 <span class="stringliteral">"with 7x7 to 280x280 pixels)!"</span>);
-<a name="l00547"></a>00547
-<a name="l00548"></a>00548 dev_flip = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00549"></a>00549 <span class="stringliteral">"kmos.kmo_reconstruct.dev_flip"</span>);
-<a name="l00550"></a>00550 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00551"></a>00551 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00552"></a>00552 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_reconstruct.dev_flip"</span>));
-<a name="l00553"></a>00553 KMO_TRY_ASSURE((dev_flip == TRUE) ||
-<a name="l00554"></a>00554 (dev_flip == FALSE),
-<a name="l00555"></a>00555 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00556"></a>00556 <span class="stringliteral">"dev_flip must be TRUE or FALSE!"</span>);
-<a name="l00557"></a>00557
-<a name="l00558"></a>00558 xcal_interpolation = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00559"></a>00559 <span class="stringliteral">"kmos.kmo_reconstruct.xcal_interpolation"</span>);
-<a name="l00560"></a>00560 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00561"></a>00561 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00562"></a>00562 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_reconstruct.xcal_interpolation"</span>));
-<a name="l00563"></a>00563 KMO_TRY_ASSURE((xcal_interpolation == TRUE) ||
-<a name="l00564"></a>00564 (xcal_interpolation == FALSE),
-<a name="l00565"></a>00565 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00566"></a>00566 <span class="stringliteral">"xcal_interpolation must be TRUE or FALSE!"</span>);
-<a name="l00567"></a>00567
+<a name="l00393"></a>00393 *filter_id_tmp = NULL,
+<a name="l00394"></a>00394 *tmp_str = NULL;
+<a name="l00395"></a>00395 <span class="keywordtype">char</span> *keyword = NULL,
+<a name="l00396"></a>00396 *filename_cube = NULL,
+<a name="l00397"></a>00397 *filename_img = NULL,
+<a name="l00398"></a>00398 <span class="comment">// *fn_lut = NULL,</span>
+<a name="l00399"></a>00399 *suffix = NULL,
+<a name="l00400"></a>00400 *obs_suffix = NULL,
+<a name="l00401"></a>00401 *my_filter_id = NULL,
+<a name="l00402"></a>00402 *extname = NULL;
+<a name="l00403"></a>00403 cpl_image *lcal = NULL,
+<a name="l00404"></a>00404 *det_img_data[KMOS_NR_DETECTORS],
+<a name="l00405"></a>00405 *det_img_noise[KMOS_NR_DETECTORS],
+<a name="l00406"></a>00406 *tmp_img = NULL;
+<a name="l00407"></a>00407 cpl_imagelist *cube_data = NULL,
+<a name="l00408"></a>00408 *cube_noise = NULL;
+<a name="l00409"></a>00409 cpl_frame *rec_frame = NULL,
+<a name="l00410"></a>00410 *xcal_frame = NULL,
+<a name="l00411"></a>00411 *ycal_frame = NULL,
+<a name="l00412"></a>00412 *lcal_frame = NULL,
+<a name="l00413"></a>00413 *ref_spectrum_frame = NULL;
+<a name="l00414"></a>00414 cpl_propertylist *main_header = NULL,
+<a name="l00415"></a>00415 *sub_header = NULL,
+<a name="l00416"></a>00416 *sub_header_orig = NULL,
+<a name="l00417"></a>00417 *actual_sub_header = NULL,
+<a name="l00418"></a>00418 *tmp_header = NULL;
+<a name="l00419"></a>00419 cpl_table *band_table = NULL;
+<a name="l00420"></a>00420 gridDefinition gd;
+<a name="l00421"></a>00421 main_fits_desc desc1,
+<a name="l00422"></a>00422 desc2;
+<a name="l00423"></a>00423 cpl_polynomial *lcorr_coeffs = NULL;
+<a name="l00424"></a>00424
+<a name="l00425"></a>00425 <span class="keywordflow">for</span> (i = 0; i < KMOS_NR_DETECTORS; i++) {
+<a name="l00426"></a>00426 det_img_data[i] = NULL;
+<a name="l00427"></a>00427 det_img_noise[i] = NULL;
+<a name="l00428"></a>00428 }
+<a name="l00429"></a>00429
+<a name="l00430"></a>00430 KMO_TRY
+<a name="l00431"></a>00431 {
+<a name="l00432"></a>00432 kmo_init_fits_desc(&desc1);
+<a name="l00433"></a>00433 kmo_init_fits_desc(&desc2);
+<a name="l00434"></a>00434
+<a name="l00435"></a>00435 <span class="comment">// --- check input ---</span>
+<a name="l00436"></a>00436 KMO_TRY_ASSURE((parlist != NULL) &&
+<a name="l00437"></a>00437 (frameset != NULL),
+<a name="l00438"></a>00438 CPL_ERROR_NULL_INPUT,
+<a name="l00439"></a>00439 <span class="stringliteral">"Not all input data is provided!"</span>);
+<a name="l00440"></a>00440
+<a name="l00441"></a>00441 KMO_TRY_ASSURE((cpl_frameset_count_tags(frameset, DARK) == 1) ||
+<a name="l00442"></a>00442 (cpl_frameset_count_tags(frameset, FLAT_ON) == 1) ||
+<a name="l00443"></a>00443 (cpl_frameset_count_tags(frameset, ARC_ON) == 1) ||
+<a name="l00444"></a>00444 (cpl_frameset_count_tags(frameset, OBJECT) == 1) ||
+<a name="l00445"></a>00445 (cpl_frameset_count_tags(frameset, STD) == 1) ||
+<a name="l00446"></a>00446 (cpl_frameset_count_tags(frameset, SCIENCE) == 1),
+<a name="l00447"></a>00447 CPL_ERROR_NULL_INPUT,
+<a name="l00448"></a>00448 <span class="stringliteral">"A data frame (DARK, FLAT_ON, ARC_ON, OBJECT, STD or SCIENCE) must "</span>
+<a name="l00449"></a>00449 <span class="stringliteral">"be provided!"</span>);
+<a name="l00450"></a>00450
+<a name="l00451"></a>00451 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, XCAL) == 1,
+<a name="l00452"></a>00452 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00453"></a>00453 <span class="stringliteral">"XCAL frame missing in frameset!!"</span>);
+<a name="l00454"></a>00454
+<a name="l00455"></a>00455 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, YCAL) == 1,
+<a name="l00456"></a>00456 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00457"></a>00457 <span class="stringliteral">"YCAL frame missing in frameset!!"</span>);
+<a name="l00458"></a>00458
+<a name="l00459"></a>00459 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, LCAL) == 1,
+<a name="l00460"></a>00460 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00461"></a>00461 <span class="stringliteral">"LCAL frame missing in frameset!!"</span>);
+<a name="l00462"></a>00462
+<a name="l00463"></a>00463 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, WAVE_BAND) == 1,
+<a name="l00464"></a>00464 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00465"></a>00465 <span class="stringliteral">"WAVE_BAND frame missing in frameset!!"</span>);
+<a name="l00466"></a>00466
+<a name="l00467"></a>00467 KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, <span class="stringliteral">"kmo_reconstruct"</span>) == 1,
+<a name="l00468"></a>00468 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00469"></a>00469 <span class="stringliteral">"Cannot identify RAW and CALIB frames!"</span>);
+<a name="l00470"></a>00470
+<a name="l00471"></a>00471 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, OH_SPEC) == 0 ||
+<a name="l00472"></a>00472 cpl_frameset_count_tags(frameset, OH_SPEC) == 1,
+<a name="l00473"></a>00473 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00474"></a>00474 <span class="stringliteral">"Only a single reference spectrum can be provided!"</span>);
+<a name="l00475"></a>00475
+<a name="l00476"></a>00476 <span class="comment">// --- get parameters ---</span>
+<a name="l00477"></a>00477 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"--- Parameter setup for kmo_reconstruct ---"</span>);
+<a name="l00478"></a>00478
+<a name="l00479"></a>00479 KMO_TRY_EXIT_IF_NULL(
+<a name="l00480"></a>00480 imethod = kmo_dfs_get_parameter_string(parlist,
+<a name="l00481"></a>00481 <span class="stringliteral">"kmos.kmo_reconstruct.imethod"</span>));
+<a name="l00482"></a>00482
+<a name="l00483"></a>00483 KMO_TRY_ASSURE((strcmp(imethod, <span class="stringliteral">"NN"</span>) == 0) ||
+<a name="l00484"></a>00484 (strcmp(imethod, <span class="stringliteral">"lwNN"</span>) == 0) ||
+<a name="l00485"></a>00485 (strcmp(imethod, <span class="stringliteral">"swNN"</span>) == 0) ||
+<a name="l00486"></a>00486 (strcmp(imethod, <span class="stringliteral">"MS"</span>) == 0) ||
+<a name="l00487"></a>00487 (strcmp(imethod, <span class="stringliteral">"CS"</span>) == 0),
+<a name="l00488"></a>00488 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00489"></a>00489 <span class="stringliteral">"imethod must be either \"NN\", \"lwNN\", "</span>
+<a name="l00490"></a>00490 <span class="stringliteral">"\"swNN\", \"MS\" or \"CS\"!"</span>);
+<a name="l00491"></a>00491
+<a name="l00492"></a>00492 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00493"></a>00493 kmo_dfs_print_parameter_help(parlist,
+<a name="l00494"></a>00494 <span class="stringliteral">"kmos.kmo_reconstruct.imethod"</span>));
+<a name="l00495"></a>00495
+<a name="l00496"></a>00496 flux = kmo_dfs_get_parameter_bool(parlist,
+<a name="l00497"></a>00497 <span class="stringliteral">"kmos.kmo_reconstruct.flux"</span>);
+<a name="l00498"></a>00498
+<a name="l00499"></a>00499 KMO_TRY_ASSURE((flux == 0) ||
+<a name="l00500"></a>00500 (flux == 1),
+<a name="l00501"></a>00501 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00502"></a>00502 <span class="stringliteral">"flux must be either FALSE or TRUE!"</span>);
+<a name="l00503"></a>00503
+<a name="l00504"></a>00504 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00505"></a>00505 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_reconstruct.flux"</span>));
+<a name="l00506"></a>00506
+<a name="l00507"></a>00507 detectorimage = kmo_dfs_get_parameter_bool(parlist,
+<a name="l00508"></a>00508 <span class="stringliteral">"kmos.kmo_reconstruct.detectorimage"</span>);
+<a name="l00509"></a>00509
+<a name="l00510"></a>00510 KMO_TRY_ASSURE((detectorimage == 0) ||
+<a name="l00511"></a>00511 (detectorimage == 1),
+<a name="l00512"></a>00512 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00513"></a>00513 <span class="stringliteral">"detectorimage must be either 0 or 1 !"</span>);
+<a name="l00514"></a>00514
+<a name="l00515"></a>00515 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00516"></a>00516 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_reconstruct.detectorimage"</span>));
+<a name="l00517"></a>00517
+<a name="l00518"></a>00518 neighborhoodRange = kmo_dfs_get_parameter_double(parlist,
+<a name="l00519"></a>00519 <span class="stringliteral">"kmos.kmo_reconstruct.neighborhoodRange"</span>);
+<a name="l00520"></a>00520 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00521"></a>00521 KMO_TRY_ASSURE(neighborhoodRange > 0.0,
+<a name="l00522"></a>00522 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00523"></a>00523 <span class="stringliteral">"neighborhoodRange must be greater than 0.0"</span>);
+<a name="l00524"></a>00524 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00525"></a>00525 kmo_dfs_print_parameter_help(parlist,
+<a name="l00526"></a>00526 <span class="stringliteral">"kmos.kmo_reconstruct.neighborhoodRange"</span>));
+<a name="l00527"></a>00527
+<a name="l00528"></a>00528 kmo_band_pars_load(parlist, <span class="stringliteral">"kmos.kmo_reconstruct"</span>);
+<a name="l00529"></a>00529
+<a name="l00530"></a>00530 file_extension = kmo_dfs_get_parameter_bool(parlist,
+<a name="l00531"></a>00531 <span class="stringliteral">"kmos.kmo_reconstruct.file_extension"</span>);
+<a name="l00532"></a>00532 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00533"></a>00533 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00534"></a>00534 kmo_dfs_print_parameter_help(parlist,
+<a name="l00535"></a>00535 <span class="stringliteral">"kmos.kmo_reconstruct.file_extension"</span>));
+<a name="l00536"></a>00536
+<a name="l00537"></a>00537 pix_scale = kmo_dfs_get_parameter_double(parlist,
+<a name="l00538"></a>00538 <span class="stringliteral">"kmos.kmo_reconstruct.pix_scale"</span>);
+<a name="l00539"></a>00539 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00540"></a>00540 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00541"></a>00541 kmo_dfs_print_parameter_help(parlist,
+<a name="l00542"></a>00542 <span class="stringliteral">"kmos.kmo_reconstruct.pix_scale"</span>));
+<a name="l00543"></a>00543 KMO_TRY_ASSURE((pix_scale >= 0.01) &&
+<a name="l00544"></a>00544 (pix_scale <= 0.4),
+<a name="l00545"></a>00545 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00546"></a>00546 <span class="stringliteral">"pix_scale must be between 0.01 and 0.4 (results in cubes "</span>
+<a name="l00547"></a>00547 <span class="stringliteral">"with 7x7 to 280x280 pixels)!"</span>);
+<a name="l00548"></a>00548
+<a name="l00549"></a>00549 dev_flip = kmo_dfs_get_parameter_bool(parlist,
+<a name="l00550"></a>00550 <span class="stringliteral">"kmos.kmo_reconstruct.dev_flip"</span>);
+<a name="l00551"></a>00551 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00552"></a>00552 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00553"></a>00553 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_reconstruct.dev_flip"</span>));
+<a name="l00554"></a>00554 KMO_TRY_ASSURE((dev_flip == TRUE) ||
+<a name="l00555"></a>00555 (dev_flip == FALSE),
+<a name="l00556"></a>00556 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00557"></a>00557 <span class="stringliteral">"dev_flip must be TRUE or FALSE!"</span>);
+<a name="l00558"></a>00558
+<a name="l00559"></a>00559 xcal_interpolation = kmo_dfs_get_parameter_bool(parlist,
+<a name="l00560"></a>00560 <span class="stringliteral">"kmos.kmo_reconstruct.xcal_interpolation"</span>);
+<a name="l00561"></a>00561 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00562"></a>00562 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00563"></a>00563 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_reconstruct.xcal_interpolation"</span>));
+<a name="l00564"></a>00564 KMO_TRY_ASSURE((xcal_interpolation == TRUE) ||
+<a name="l00565"></a>00565 (xcal_interpolation == FALSE),
+<a name="l00566"></a>00566 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00567"></a>00567 <span class="stringliteral">"xcal_interpolation must be TRUE or FALSE!"</span>);
<a name="l00568"></a>00568
-<a name="l00569"></a>00569 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
-<a name="l00570"></a>00570
-<a name="l00571"></a>00571 <span class="comment">// load descriptor and header of data frame to reconstruct</span>
-<a name="l00572"></a>00572 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, DARK) == 1) {
-<a name="l00573"></a>00573 input_frame_name = DARK;
-<a name="l00574"></a>00574 output_frame_name = CUBE_DARK;
-<a name="l00575"></a>00575 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, FLAT_ON) == 1) {
-<a name="l00576"></a>00576 input_frame_name = FLAT_ON;
-<a name="l00577"></a>00577 output_frame_name = CUBE_FLAT;
-<a name="l00578"></a>00578 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, ARC_ON) == 1) {
-<a name="l00579"></a>00579 input_frame_name = ARC_ON;
-<a name="l00580"></a>00580 output_frame_name = CUBE_ARC;
-<a name="l00581"></a>00581 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, OBJECT) == 1) {
-<a name="l00582"></a>00582 input_frame_name = OBJECT;
-<a name="l00583"></a>00583 output_frame_name = CUBE_OBJECT;
-<a name="l00584"></a>00584 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, STD) == 1) {
-<a name="l00585"></a>00585 input_frame_name = STD;
-<a name="l00586"></a>00586 output_frame_name = CUBE_STD;
-<a name="l00587"></a>00587 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, SCIENCE) == 1) {
-<a name="l00588"></a>00588 input_frame_name = SCIENCE;
-<a name="l00589"></a>00589 output_frame_name = CUBE_SCIENCE;
-<a name="l00590"></a>00590 }
-<a name="l00591"></a>00591
-<a name="l00592"></a>00592 <span class="comment">// assure that filters, grating and rotation offsets match for</span>
-<a name="l00593"></a>00593 <span class="comment">// XCAL, YCAL, LCAL and for data frame to reconstruct (except DARK</span>
-<a name="l00594"></a>00594 <span class="comment">// frames)</span>
-<a name="l00595"></a>00595 <span class="comment">// check if filter_id and grating_id match for all detectors</span>
-<a name="l00596"></a>00596 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00597"></a>00597 kmo_check_frame_setup(frameset, XCAL, YCAL,
-<a name="l00598"></a>00598 TRUE, FALSE, TRUE));
-<a name="l00599"></a>00599 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00600"></a>00600 kmo_check_frame_setup(frameset, XCAL, LCAL,
-<a name="l00601"></a>00601 TRUE, FALSE, TRUE));
-<a name="l00602"></a>00602
-<a name="l00603"></a>00603 <span class="comment">// This check doesn't make sense here since OCS.ROT.NAANGLE is compared.</span>
-<a name="l00604"></a>00604 <span class="comment">// When creating the calibration files the RAW exposures needn't have been</span>
-<a name="l00605"></a>00605 <span class="comment">// provided in the same order</span>
-<a name="l00606"></a>00606 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
-<a name="l00607"></a>00607 <span class="comment">// kmo_check_cal_frames_rotangle(frameset, XCAL, YCAL));</span>
-<a name="l00608"></a>00608 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
-<a name="l00609"></a>00609 <span class="comment">// kmo_check_cal_frames_rotangle(frameset, XCAL, LCAL));</span>
-<a name="l00610"></a>00610
-<a name="l00611"></a>00611 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, DARK) != 1) {
-<a name="l00612"></a>00612
-<a name="l00613"></a>00613 <span class="comment">// check if filters, gratings and rotator offset match</span>
-<a name="l00614"></a>00614 <span class="comment">// (except for DARK frames)</span>
-<a name="l00615"></a>00615 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00616"></a>00616 kmo_check_frame_setup(frameset, XCAL, input_frame_name,
-<a name="l00617"></a>00617 TRUE, FALSE, FALSE));
-<a name="l00618"></a>00618 <span class="comment">/*</span>
-<a name="l00619"></a>00619 <span class="comment"> // check if rotator offset don't differ to much</span>
-<a name="l00620"></a>00620 <span class="comment"> cpl_frame *f1 = NULL, *f2 = NULL;</span>
-<a name="l00621"></a>00621 <span class="comment"> cpl_propertylist *h1 = NULL, *h2 = NULL;</span>
-<a name="l00622"></a>00622 <span class="comment"> char *kw = NULL;</span>
-<a name="l00623"></a>00623 <span class="comment"> double tmp_dbl1 = 0.0, tmp_dbl2 = 0.0;</span>
-<a name="l00624"></a>00624 <span class="comment"></span>
-<a name="l00625"></a>00625 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
-<a name="l00626"></a>00626 <span class="comment"> f1 = kmo_dfs_get_frame(frameset, XCAL));</span>
-<a name="l00627"></a>00627 <span class="comment"></span>
-<a name="l00628"></a>00628 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
-<a name="l00629"></a>00629 <span class="comment"> f2 = kmo_dfs_get_frame(frameset, input_frame_name));</span>
-<a name="l00630"></a>00630 <span class="comment"> h1 = kmclipm_propertylist_load(cpl_frame_get_filename(f1), 0);</span>
+<a name="l00569"></a>00569
+<a name="l00570"></a>00570 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
+<a name="l00571"></a>00571
+<a name="l00572"></a>00572 <span class="comment">// load descriptor and header of data frame to reconstruct</span>
+<a name="l00573"></a>00573 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, DARK) == 1) {
+<a name="l00574"></a>00574 input_frame_name = DARK;
+<a name="l00575"></a>00575 output_frame_name = CUBE_DARK;
+<a name="l00576"></a>00576 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, FLAT_ON) == 1) {
+<a name="l00577"></a>00577 input_frame_name = FLAT_ON;
+<a name="l00578"></a>00578 output_frame_name = CUBE_FLAT;
+<a name="l00579"></a>00579 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, ARC_ON) == 1) {
+<a name="l00580"></a>00580 input_frame_name = ARC_ON;
+<a name="l00581"></a>00581 output_frame_name = CUBE_ARC;
+<a name="l00582"></a>00582 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, OBJECT) == 1) {
+<a name="l00583"></a>00583 input_frame_name = OBJECT;
+<a name="l00584"></a>00584 output_frame_name = CUBE_OBJECT;
+<a name="l00585"></a>00585 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, STD) == 1) {
+<a name="l00586"></a>00586 input_frame_name = STD;
+<a name="l00587"></a>00587 output_frame_name = CUBE_STD;
+<a name="l00588"></a>00588 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, SCIENCE) == 1) {
+<a name="l00589"></a>00589 input_frame_name = SCIENCE;
+<a name="l00590"></a>00590 output_frame_name = CUBE_SCIENCE;
+<a name="l00591"></a>00591 }
+<a name="l00592"></a>00592
+<a name="l00593"></a>00593 <span class="comment">// assure that filters, grating and rotation offsets match for</span>
+<a name="l00594"></a>00594 <span class="comment">// XCAL, YCAL, LCAL and for data frame to reconstruct (except DARK</span>
+<a name="l00595"></a>00595 <span class="comment">// frames)</span>
+<a name="l00596"></a>00596 <span class="comment">// check if filter_id and grating_id match for all detectors</span>
+<a name="l00597"></a>00597 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00598"></a>00598 kmo_check_frame_setup(frameset, XCAL, YCAL,
+<a name="l00599"></a>00599 TRUE, FALSE, TRUE));
+<a name="l00600"></a>00600 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00601"></a>00601 kmo_check_frame_setup(frameset, XCAL, LCAL,
+<a name="l00602"></a>00602 TRUE, FALSE, TRUE));
+<a name="l00603"></a>00603
+<a name="l00604"></a>00604 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, DARK) != 1) {
+<a name="l00605"></a>00605
+<a name="l00606"></a>00606 <span class="comment">// check if filters, gratings and rotator offset match</span>
+<a name="l00607"></a>00607 <span class="comment">// (except for DARK frames)</span>
+<a name="l00608"></a>00608 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00609"></a>00609 kmo_check_frame_setup(frameset, XCAL, input_frame_name,
+<a name="l00610"></a>00610 TRUE, FALSE, FALSE));
+<a name="l00611"></a>00611 <span class="comment">/*</span>
+<a name="l00612"></a>00612 <span class="comment"> // check if rotator offset don't differ to much</span>
+<a name="l00613"></a>00613 <span class="comment"> cpl_frame *f1 = NULL, *f2 = NULL;</span>
+<a name="l00614"></a>00614 <span class="comment"> cpl_propertylist *h1 = NULL, *h2 = NULL;</span>
+<a name="l00615"></a>00615 <span class="comment"> char *kw = NULL;</span>
+<a name="l00616"></a>00616 <span class="comment"> double tmp_dbl1 = 0.0, tmp_dbl2 = 0.0;</span>
+<a name="l00617"></a>00617 <span class="comment"></span>
+<a name="l00618"></a>00618 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
+<a name="l00619"></a>00619 <span class="comment"> f1 = kmo_dfs_get_frame(frameset, XCAL));</span>
+<a name="l00620"></a>00620 <span class="comment"></span>
+<a name="l00621"></a>00621 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
+<a name="l00622"></a>00622 <span class="comment"> f2 = kmo_dfs_get_frame(frameset, input_frame_name));</span>
+<a name="l00623"></a>00623 <span class="comment"> h1 = kmclipm_propertylist_load(cpl_frame_get_filename(f1), 0);</span>
+<a name="l00624"></a>00624 <span class="comment"> if (cpl_error_get_code() != CPL_ERROR_NONE) {</span>
+<a name="l00625"></a>00625 <span class="comment"> cpl_msg_error("","File not found: %s!",</span>
+<a name="l00626"></a>00626 <span class="comment"> cpl_frame_get_filename(f1));</span>
+<a name="l00627"></a>00627 <span class="comment"> KMO_TRY_CHECK_ERROR_STATE();</span>
+<a name="l00628"></a>00628 <span class="comment"> }</span>
+<a name="l00629"></a>00629 <span class="comment"></span>
+<a name="l00630"></a>00630 <span class="comment"> h2 = kmclipm_propertylist_load(cpl_frame_get_filename(f2), 0);</span>
<a name="l00631"></a>00631 <span class="comment"> if (cpl_error_get_code() != CPL_ERROR_NONE) {</span>
<a name="l00632"></a>00632 <span class="comment"> cpl_msg_error("","File not found: %s!",</span>
-<a name="l00633"></a>00633 <span class="comment"> cpl_frame_get_filename(f1));</span>
+<a name="l00633"></a>00633 <span class="comment"> cpl_frame_get_filename(f2));</span>
<a name="l00634"></a>00634 <span class="comment"> KMO_TRY_CHECK_ERROR_STATE();</span>
<a name="l00635"></a>00635 <span class="comment"> }</span>
-<a name="l00636"></a>00636 <span class="comment"></span>
-<a name="l00637"></a>00637 <span class="comment"> h2 = kmclipm_propertylist_load(cpl_frame_get_filename(f2), 0);</span>
-<a name="l00638"></a>00638 <span class="comment"> if (cpl_error_get_code() != CPL_ERROR_NONE) {</span>
-<a name="l00639"></a>00639 <span class="comment"> cpl_msg_error("","File not found: %s!",</span>
-<a name="l00640"></a>00640 <span class="comment"> cpl_frame_get_filename(f2));</span>
-<a name="l00641"></a>00641 <span class="comment"> KMO_TRY_CHECK_ERROR_STATE();</span>
-<a name="l00642"></a>00642 <span class="comment"> }</span>
-<a name="l00643"></a>00643 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
-<a name="l00644"></a>00644 <span class="comment"> kw = cpl_sprintf("%s", ROTANGLE));</span>
-<a name="l00645"></a>00645 <span class="comment"> tmp_dbl1 = cpl_propertylist_get_double(h1, kw);</span>
-<a name="l00646"></a>00646 <span class="comment"> if (cpl_error_get_code() != CPL_ERROR_NONE) {</span>
-<a name="l00647"></a>00647 <span class="comment"> KMO_TRY_ASSURE(1 == 0,</span>
-<a name="l00648"></a>00648 <span class="comment"> CPL_ERROR_ILLEGAL_INPUT,</span>
-<a name="l00649"></a>00649 <span class="comment"> "keyword \n%s\n of frame %s is missing!",</span>
-<a name="l00650"></a>00650 <span class="comment"> keyword, XCAL);</span>
-<a name="l00651"></a>00651 <span class="comment"> }</span>
-<a name="l00652"></a>00652 <span class="comment"></span>
-<a name="l00653"></a>00653 <span class="comment"> tmp_dbl2 = cpl_propertylist_get_double(h2, kw);</span>
-<a name="l00654"></a>00654 <span class="comment"> if (cpl_error_get_code() != CPL_ERROR_NONE) {</span>
-<a name="l00655"></a>00655 <span class="comment"> KMO_TRY_ASSURE(1 == 0,</span>
-<a name="l00656"></a>00656 <span class="comment"> CPL_ERROR_ILLEGAL_INPUT,</span>
-<a name="l00657"></a>00657 <span class="comment"> "keyword \n%s\n of frame %s is missing!",</span>
-<a name="l00658"></a>00658 <span class="comment"> keyword, input_frame_name);</span>
-<a name="l00659"></a>00659 <span class="comment"> }</span>
-<a name="l00660"></a>00660 <span class="comment"></span>
-<a name="l00661"></a>00661 <span class="comment"> // strip angles below 0 deg and above 360 deg</span>
-<a name="l00662"></a>00662 <span class="comment"> kmclipm_strip_angle(&tmp_dbl1);</span>
-<a name="l00663"></a>00663 <span class="comment"> kmclipm_strip_angle(&tmp_dbl2);</span>
-<a name="l00664"></a>00664 <span class="comment"></span>
-<a name="l00665"></a>00665 <span class="comment"> if (fabs(tmp_dbl1 - tmp_dbl2) > 30.) {</span>
-<a name="l00666"></a>00666 <span class="comment"> if ((fabs(tmp_dbl1) < 0.001) && (tmp_dbl2>330) && (tmp_dbl2<360)) {</span>
-<a name="l00667"></a>00667 <span class="comment"> // singularity!</span>
-<a name="l00668"></a>00668 <span class="comment"> // we have rot=0 for XCAL and rot>330 | rot<360 for input frame</span>
-<a name="l00669"></a>00669 <span class="comment"> } else {</span>
-<a name="l00670"></a>00670 <span class="comment"> cpl_msg_warning("","The angle of the calibration files (%g deg) "</span>
-<a name="l00671"></a>00671 <span class="comment"> "and the angle of the frame to reconstruct"</span>
-<a name="l00672"></a>00672 <span class="comment"> " (%g deg) differ by %g deg! Think about using "</span>
-<a name="l00673"></a>00673 <span class="comment"> "calibration files matching better the actual "</span>
-<a name="l00674"></a>00674 <span class="comment"> "rotator offset (ESO OCS ROT NAANGLE)",</span>
-<a name="l00675"></a>00675 <span class="comment"> tmp_dbl1, tmp_dbl2,</span>
-<a name="l00676"></a>00676 <span class="comment"> fabs(tmp_dbl1 - tmp_dbl2));</span>
-<a name="l00677"></a>00677 <span class="comment"> }</span>
-<a name="l00678"></a>00678 <span class="comment"> }</span>
-<a name="l00679"></a>00679 <span class="comment"></span>
-<a name="l00680"></a>00680 <span class="comment"> cpl_propertylist_delete(h1); h1 = NULL;</span>
-<a name="l00681"></a>00681 <span class="comment"> cpl_propertylist_delete(h2); h2 = NULL;</span>
-<a name="l00682"></a>00682 <span class="comment"> cpl_free(kw); kw = NULL;</span>
-<a name="l00683"></a>00683 <span class="comment">*/</span>
-<a name="l00684"></a>00684 }
+<a name="l00636"></a>00636 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
+<a name="l00637"></a>00637 <span class="comment"> kw = cpl_sprintf("%s", ROTANGLE));</span>
+<a name="l00638"></a>00638 <span class="comment"> tmp_dbl1 = cpl_propertylist_get_double(h1, kw);</span>
+<a name="l00639"></a>00639 <span class="comment"> if (cpl_error_get_code() != CPL_ERROR_NONE) {</span>
+<a name="l00640"></a>00640 <span class="comment"> KMO_TRY_ASSURE(1 == 0,</span>
+<a name="l00641"></a>00641 <span class="comment"> CPL_ERROR_ILLEGAL_INPUT,</span>
+<a name="l00642"></a>00642 <span class="comment"> "keyword \n%s\n of frame %s is missing!",</span>
+<a name="l00643"></a>00643 <span class="comment"> keyword, XCAL);</span>
+<a name="l00644"></a>00644 <span class="comment"> }</span>
+<a name="l00645"></a>00645 <span class="comment"></span>
+<a name="l00646"></a>00646 <span class="comment"> tmp_dbl2 = cpl_propertylist_get_double(h2, kw);</span>
+<a name="l00647"></a>00647 <span class="comment"> if (cpl_error_get_code() != CPL_ERROR_NONE) {</span>
+<a name="l00648"></a>00648 <span class="comment"> KMO_TRY_ASSURE(1 == 0,</span>
+<a name="l00649"></a>00649 <span class="comment"> CPL_ERROR_ILLEGAL_INPUT,</span>
+<a name="l00650"></a>00650 <span class="comment"> "keyword \n%s\n of frame %s is missing!",</span>
+<a name="l00651"></a>00651 <span class="comment"> keyword, input_frame_name);</span>
+<a name="l00652"></a>00652 <span class="comment"> }</span>
+<a name="l00653"></a>00653 <span class="comment"></span>
+<a name="l00654"></a>00654 <span class="comment"> // strip angles below 0 deg and above 360 deg</span>
+<a name="l00655"></a>00655 <span class="comment"> kmclipm_strip_angle(&tmp_dbl1);</span>
+<a name="l00656"></a>00656 <span class="comment"> kmclipm_strip_angle(&tmp_dbl2);</span>
+<a name="l00657"></a>00657 <span class="comment"></span>
+<a name="l00658"></a>00658 <span class="comment"> if (fabs(tmp_dbl1 - tmp_dbl2) > 30.) {</span>
+<a name="l00659"></a>00659 <span class="comment"> if ((fabs(tmp_dbl1) < 0.001) && (tmp_dbl2>330) && (tmp_dbl2<360)) {</span>
+<a name="l00660"></a>00660 <span class="comment"> // singularity!</span>
+<a name="l00661"></a>00661 <span class="comment"> // we have rot=0 for XCAL and rot>330 | rot<360 for input frame</span>
+<a name="l00662"></a>00662 <span class="comment"> } else {</span>
+<a name="l00663"></a>00663 <span class="comment"> cpl_msg_warning("","The angle of the calibration files (%g deg) "</span>
+<a name="l00664"></a>00664 <span class="comment"> "and the angle of the frame to reconstruct"</span>
+<a name="l00665"></a>00665 <span class="comment"> " (%g deg) differ by %g deg! Think about using "</span>
+<a name="l00666"></a>00666 <span class="comment"> "calibration files matching better the actual "</span>
+<a name="l00667"></a>00667 <span class="comment"> "rotator offset (ESO OCS ROT NAANGLE)",</span>
+<a name="l00668"></a>00668 <span class="comment"> tmp_dbl1, tmp_dbl2,</span>
+<a name="l00669"></a>00669 <span class="comment"> fabs(tmp_dbl1 - tmp_dbl2));</span>
+<a name="l00670"></a>00670 <span class="comment"> }</span>
+<a name="l00671"></a>00671 <span class="comment"> }</span>
+<a name="l00672"></a>00672 <span class="comment"></span>
+<a name="l00673"></a>00673 <span class="comment"> cpl_propertylist_delete(h1); h1 = NULL;</span>
+<a name="l00674"></a>00674 <span class="comment"> cpl_propertylist_delete(h2); h2 = NULL;</span>
+<a name="l00675"></a>00675 <span class="comment"> cpl_free(kw); kw = NULL;</span>
+<a name="l00676"></a>00676 <span class="comment">*/</span>
+<a name="l00677"></a>00677 }
+<a name="l00678"></a>00678
+<a name="l00679"></a>00679 KMO_TRY_EXIT_IF_NULL(
+<a name="l00680"></a>00680 xcal_frame = kmo_dfs_get_frame(frameset, XCAL));
+<a name="l00681"></a>00681 KMO_TRY_EXIT_IF_NULL(
+<a name="l00682"></a>00682 rec_frame = kmo_dfs_get_frame(frameset, input_frame_name));
+<a name="l00683"></a>00683 KMO_TRY_EXIT_IF_NULL(
+<a name="l00684"></a>00684 suffix = kmo_dfs_get_suffix(rec_frame, TRUE, TRUE));
<a name="l00685"></a>00685
-<a name="l00686"></a>00686 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, OH_SPEC) != 0) {
-<a name="l00687"></a>00687 KMO_TRY_EXIT_IF_NULL(
-<a name="l00688"></a>00688 ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
-<a name="l00689"></a>00689 }
+<a name="l00686"></a>00686 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00687"></a>00687 kmo_check_frame_setup_md5_xycal(frameset));
+<a name="l00688"></a>00688 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00689"></a>00689 kmo_check_frame_setup_md5(frameset));
<a name="l00690"></a>00690
-<a name="l00691"></a>00691 KMO_TRY_EXIT_IF_NULL(
-<a name="l00692"></a>00692 xcal_frame = kmo_dfs_get_frame(frameset, XCAL));
-<a name="l00693"></a>00693 KMO_TRY_EXIT_IF_NULL(
-<a name="l00694"></a>00694 rec_frame = kmo_dfs_get_frame(frameset, input_frame_name));
+<a name="l00691"></a>00691 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Detected instrument setup: %s"</span>, suffix+1);
+<a name="l00692"></a>00692 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"(grating 1, 2 & 3, rotation angle)"</span>);
+<a name="l00693"></a>00693 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
+<a name="l00694"></a>00694
<a name="l00695"></a>00695 KMO_TRY_EXIT_IF_NULL(
-<a name="l00696"></a>00696 suffix = kmo_dfs_get_suffix(rec_frame, TRUE, TRUE));
-<a name="l00697"></a>00697
-<a name="l00698"></a>00698 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00699"></a>00699 kmo_check_frame_setup_md5_xycal(frameset));
-<a name="l00700"></a>00700 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00701"></a>00701 kmo_check_frame_setup_md5(frameset));
-<a name="l00702"></a>00702
-<a name="l00703"></a>00703 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Detected instrument setup: %s"</span>, suffix+1);
-<a name="l00704"></a>00704 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"(grating 1, 2 & 3, rotation angle)"</span>);
-<a name="l00705"></a>00705 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
-<a name="l00706"></a>00706
-<a name="l00707"></a>00707
-<a name="l00708"></a>00708 desc1 = kmo_identify_fits_header(cpl_frame_get_filename(rec_frame));
-<a name="l00709"></a>00709 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00710"></a>00710
-<a name="l00711"></a>00711 KMO_TRY_ASSURE(((desc1.nr_ext == KMOS_NR_DETECTORS) ||
-<a name="l00712"></a>00712 ((desc1.nr_ext == 2*KMOS_NR_DETECTORS))) &&
-<a name="l00713"></a>00713 (desc1.ex_badpix == FALSE) &&
-<a name="l00714"></a>00714 ((desc1.fits_type == raw_fits) ||
-<a name="l00715"></a>00715 (desc1.fits_type == f2d_fits)) &&
-<a name="l00716"></a>00716 (desc1.frame_type == detector_frame),
-<a name="l00717"></a>00717 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00718"></a>00718 <span class="stringliteral">"The frame to reconstruct isn't in the correct format!!!"</span>
-<a name="l00719"></a>00719 <span class="stringliteral">"Exactly 3 frames, or 6 with noise are expected!"</span>);
-<a name="l00720"></a>00720
-<a name="l00721"></a>00721 <span class="keywordflow">if</span> (!desc1.ex_noise) {
-<a name="l00722"></a>00722 nr_devices = desc1.nr_ext;
-<a name="l00723"></a>00723 } <span class="keywordflow">else</span> {
-<a name="l00724"></a>00724 nr_devices = desc1.nr_ext / 2;
-<a name="l00725"></a>00725 }
-<a name="l00726"></a>00726
-<a name="l00727"></a>00727 <span class="comment">// compare descriptor of XCAL and data frame to reconstruct</span>
-<a name="l00728"></a>00728 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(xcal_frame));
-<a name="l00729"></a>00729 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00730"></a>00730
-<a name="l00731"></a>00731 KMO_TRY_ASSURE((desc2.nr_ext % 3 == 0) &&
-<a name="l00732"></a>00732 (desc1.ex_badpix == desc2.ex_badpix) &&
-<a name="l00733"></a>00733 (desc1.frame_type == desc2.frame_type),
-<a name="l00734"></a>00734 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00735"></a>00735 <span class="stringliteral">"XCAL isn't in the correct format!!!"</span>);
-<a name="l00736"></a>00736
-<a name="l00737"></a>00737 kmo_free_fits_desc(&desc2);
-<a name="l00738"></a>00738
-<a name="l00739"></a>00739 <span class="comment">// compare descriptor of YCAL and data frame to reconstruct</span>
-<a name="l00740"></a>00740 kmo_init_fits_desc(&desc2);
-<a name="l00741"></a>00741
-<a name="l00742"></a>00742 KMO_TRY_EXIT_IF_NULL(
-<a name="l00743"></a>00743 ycal_frame = kmo_dfs_get_frame(frameset, YCAL));
-<a name="l00744"></a>00744
-<a name="l00745"></a>00745 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(ycal_frame));
-<a name="l00746"></a>00746 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00696"></a>00696 main_header = kmo_dfs_load_primary_header(frameset,
+<a name="l00697"></a>00697 input_frame_name));
+<a name="l00698"></a>00698
+<a name="l00699"></a>00699 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, OH_SPEC) != 0) {
+<a name="l00700"></a>00700 <span class="keywordflow">if</span> (cpl_propertylist_has(main_header, ORIGFILE)) {
+<a name="l00701"></a>00701 KMO_TRY_EXIT_IF_NULL(
+<a name="l00702"></a>00702 tmp_str = cpl_propertylist_get_string(main_header, ORIGFILE));
+<a name="l00703"></a>00703 <span class="keywordflow">if</span> (strstr(tmp_str, <span class="stringliteral">"OBS"</span>) != NULL) {
+<a name="l00704"></a>00704 <span class="comment">// we are reconstructing an OBS-frame, allow OH_SPEC correction</span>
+<a name="l00705"></a>00705 KMO_TRY_EXIT_IF_NULL(
+<a name="l00706"></a>00706 ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
+<a name="l00707"></a>00707 } <span class="keywordflow">else</span> {
+<a name="l00708"></a>00708 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"Supplied OH_SPEC is ignored since a calibration frame is being reconstructed."</span>);
+<a name="l00709"></a>00709 }
+<a name="l00710"></a>00710 } <span class="keywordflow">else</span> {
+<a name="l00711"></a>00711 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"The supplied frame %s is assumed to be a science frame. If it is a calibration frame, omit OH_SPEC from sof-file"</span>, input_frame_name);
+<a name="l00712"></a>00712 KMO_TRY_EXIT_IF_NULL(
+<a name="l00713"></a>00713 ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
+<a name="l00714"></a>00714 }
+<a name="l00715"></a>00715 }
+<a name="l00716"></a>00716
+<a name="l00717"></a>00717 desc1 = kmo_identify_fits_header(cpl_frame_get_filename(rec_frame));
+<a name="l00718"></a>00718 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00719"></a>00719
+<a name="l00720"></a>00720 KMO_TRY_ASSURE(((desc1.nr_ext == KMOS_NR_DETECTORS) ||
+<a name="l00721"></a>00721 ((desc1.nr_ext == 2*KMOS_NR_DETECTORS))) &&
+<a name="l00722"></a>00722 (desc1.ex_badpix == FALSE) &&
+<a name="l00723"></a>00723 ((desc1.fits_type == raw_fits) ||
+<a name="l00724"></a>00724 (desc1.fits_type == f2d_fits)) &&
+<a name="l00725"></a>00725 (desc1.frame_type == detector_frame),
+<a name="l00726"></a>00726 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00727"></a>00727 <span class="stringliteral">"The frame to reconstruct isn't in the correct format!!!"</span>
+<a name="l00728"></a>00728 <span class="stringliteral">"Exactly 3 frames, or 6 with noise are expected!"</span>);
+<a name="l00729"></a>00729
+<a name="l00730"></a>00730 <span class="keywordflow">if</span> (!desc1.ex_noise) {
+<a name="l00731"></a>00731 nr_devices = desc1.nr_ext;
+<a name="l00732"></a>00732 } <span class="keywordflow">else</span> {
+<a name="l00733"></a>00733 nr_devices = desc1.nr_ext / 2;
+<a name="l00734"></a>00734 }
+<a name="l00735"></a>00735
+<a name="l00736"></a>00736 <span class="comment">// compare descriptor of XCAL and data frame to reconstruct</span>
+<a name="l00737"></a>00737 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(xcal_frame));
+<a name="l00738"></a>00738 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00739"></a>00739
+<a name="l00740"></a>00740 KMO_TRY_ASSURE((desc2.nr_ext % 3 == 0) &&
+<a name="l00741"></a>00741 (desc1.ex_badpix == desc2.ex_badpix) &&
+<a name="l00742"></a>00742 (desc1.frame_type == desc2.frame_type),
+<a name="l00743"></a>00743 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00744"></a>00744 <span class="stringliteral">"XCAL isn't in the correct format!!!"</span>);
+<a name="l00745"></a>00745
+<a name="l00746"></a>00746 kmo_free_fits_desc(&desc2);
<a name="l00747"></a>00747
-<a name="l00748"></a>00748 KMO_TRY_ASSURE((desc2.nr_ext % 3 == 0) &&
-<a name="l00749"></a>00749 (desc1.ex_badpix == desc2.ex_badpix) &&
-<a name="l00750"></a>00750 (desc1.frame_type == desc2.frame_type),
-<a name="l00751"></a>00751 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00752"></a>00752 <span class="stringliteral">"YCAL isn't in the correct format!!!"</span>);
+<a name="l00748"></a>00748 <span class="comment">// compare descriptor of YCAL and data frame to reconstruct</span>
+<a name="l00749"></a>00749 kmo_init_fits_desc(&desc2);
+<a name="l00750"></a>00750
+<a name="l00751"></a>00751 KMO_TRY_EXIT_IF_NULL(
+<a name="l00752"></a>00752 ycal_frame = kmo_dfs_get_frame(frameset, YCAL));
<a name="l00753"></a>00753
-<a name="l00754"></a>00754 kmo_free_fits_desc(&desc2);
-<a name="l00755"></a>00755
-<a name="l00756"></a>00756 <span class="comment">// compare descriptor of LCAL and data frame to reconstruct</span>
-<a name="l00757"></a>00757 kmo_init_fits_desc(&desc2);
-<a name="l00758"></a>00758
-<a name="l00759"></a>00759 KMO_TRY_EXIT_IF_NULL(
-<a name="l00760"></a>00760 lcal_frame = kmo_dfs_get_frame(frameset, LCAL));
-<a name="l00761"></a>00761
-<a name="l00762"></a>00762 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(lcal_frame));
-<a name="l00763"></a>00763 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00754"></a>00754 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(ycal_frame));
+<a name="l00755"></a>00755 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00756"></a>00756
+<a name="l00757"></a>00757 KMO_TRY_ASSURE((desc2.nr_ext % 3 == 0) &&
+<a name="l00758"></a>00758 (desc1.ex_badpix == desc2.ex_badpix) &&
+<a name="l00759"></a>00759 (desc1.frame_type == desc2.frame_type),
+<a name="l00760"></a>00760 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00761"></a>00761 <span class="stringliteral">"YCAL isn't in the correct format!!!"</span>);
+<a name="l00762"></a>00762
+<a name="l00763"></a>00763 kmo_free_fits_desc(&desc2);
<a name="l00764"></a>00764
-<a name="l00765"></a>00765 KMO_TRY_ASSURE((desc2.nr_ext % 3 == 0) &&
-<a name="l00766"></a>00766 (desc1.ex_badpix == desc2.ex_badpix) &&
-<a name="l00767"></a>00767 (desc1.frame_type == desc2.frame_type),
-<a name="l00768"></a>00768 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00769"></a>00769 <span class="stringliteral">"LCAL isn't in the correct format!!!"</span>);
+<a name="l00765"></a>00765 <span class="comment">// compare descriptor of LCAL and data frame to reconstruct</span>
+<a name="l00766"></a>00766 kmo_init_fits_desc(&desc2);
+<a name="l00767"></a>00767
+<a name="l00768"></a>00768 KMO_TRY_EXIT_IF_NULL(
+<a name="l00769"></a>00769 lcal_frame = kmo_dfs_get_frame(frameset, LCAL));
<a name="l00770"></a>00770
-<a name="l00771"></a>00771 kmo_free_fits_desc(&desc2);
-<a name="l00772"></a>00772
-<a name="l00773"></a>00773 <span class="comment">//</span>
-<a name="l00774"></a>00774 <span class="comment">// --- load, update & save primary header ---</span>
-<a name="l00775"></a>00775 <span class="comment">//</span>
-<a name="l00776"></a>00776 KMO_TRY_EXIT_IF_NULL(
-<a name="l00777"></a>00777 main_header = kmo_dfs_load_primary_header(frameset,
-<a name="l00778"></a>00778 input_frame_name));
+<a name="l00771"></a>00771 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(lcal_frame));
+<a name="l00772"></a>00772 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00773"></a>00773
+<a name="l00774"></a>00774 KMO_TRY_ASSURE((desc2.nr_ext % 3 == 0) &&
+<a name="l00775"></a>00775 (desc1.ex_badpix == desc2.ex_badpix) &&
+<a name="l00776"></a>00776 (desc1.frame_type == desc2.frame_type),
+<a name="l00777"></a>00777 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00778"></a>00778 <span class="stringliteral">"LCAL isn't in the correct format!!!"</span>);
<a name="l00779"></a>00779
-<a name="l00780"></a>00780 KMO_TRY_EXIT_IF_NULL(
-<a name="l00781"></a>00781 tmp_header = kmo_dfs_load_primary_header(frameset, LCAL));
-<a name="l00782"></a>00782
-<a name="l00783"></a>00783 <span class="comment">// assert that filters have correct IDs and that all detectors of all</span>
-<a name="l00784"></a>00784 <span class="comment">// input frames have the same filter set</span>
-<a name="l00785"></a>00785 <span class="keywordflow">for</span> (i = 1; i <= nr_devices; i++) {
-<a name="l00786"></a>00786 <span class="comment">// ESO INS FILTi ID</span>
-<a name="l00787"></a>00787 KMO_TRY_EXIT_IF_NULL(
-<a name="l00788"></a>00788 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_FILTID_PREFIX, i,
-<a name="l00789"></a>00789 IFU_FILTID_POSTFIX));
-<a name="l00790"></a>00790
-<a name="l00791"></a>00791 KMO_TRY_EXIT_IF_NULL(
-<a name="l00792"></a>00792 filter_id = cpl_propertylist_get_string(tmp_header, keyword));
-<a name="l00793"></a>00793
-<a name="l00794"></a>00794 KMO_TRY_ASSURE((strcmp(filter_id, <span class="stringliteral">"IZ"</span>) == 0) ||
-<a name="l00795"></a>00795 (strcmp(filter_id, <span class="stringliteral">"YJ"</span>) == 0) ||
-<a name="l00796"></a>00796 (strcmp(filter_id, <span class="stringliteral">"H"</span>) == 0) ||
-<a name="l00797"></a>00797 (strcmp(filter_id, <span class="stringliteral">"K"</span>) == 0) ||
-<a name="l00798"></a>00798 (strcmp(filter_id, <span class="stringliteral">"HK"</span>) == 0),
-<a name="l00799"></a>00799 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00800"></a>00800 <span class="stringliteral">"Filter ID in primary header of LCAL frame must "</span>
-<a name="l00801"></a>00801 <span class="stringliteral">"be either \"IZ\", \"YJ\", \"H\", \"K\" or "</span>
-<a name="l00802"></a>00802 <span class="stringliteral">"\"HK\" !"</span>);
-<a name="l00803"></a>00803
-<a name="l00804"></a>00804 <span class="keywordflow">if</span> (strcmp(input_frame_name, DARK) != 0) {
-<a name="l00805"></a>00805 <span class="comment">// dark needn't to be taken with filter!</span>
-<a name="l00806"></a>00806
-<a name="l00807"></a>00807 KMO_TRY_EXIT_IF_NULL(
-<a name="l00808"></a>00808 filter_id_tmp = cpl_propertylist_get_string(main_header,
-<a name="l00809"></a>00809 keyword));
-<a name="l00810"></a>00810 KMO_TRY_ASSURE(strcmp(filter_id, filter_id_tmp) == 0,
-<a name="l00811"></a>00811 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00812"></a>00812 <span class="stringliteral">"Filter IDs must be the same for LCAL frame and "</span>
-<a name="l00813"></a>00813 <span class="stringliteral">"the frame to reconstruct!"</span>
-<a name="l00814"></a>00814 <span class="stringliteral">"Detector No.: %d\nLCAL: %s\n%s: %s\n"</span>,
-<a name="l00815"></a>00815 i, filter_id, input_frame_name, filter_id_tmp);
-<a name="l00816"></a>00816 }
-<a name="l00817"></a>00817 cpl_free(keyword); keyword = NULL;
-<a name="l00818"></a>00818 }
-<a name="l00819"></a>00819 KMO_TRY_EXIT_IF_NULL(
-<a name="l00820"></a>00820 my_filter_id = cpl_strdup(filter_id));
-<a name="l00821"></a>00821 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
-<a name="l00822"></a>00822
-<a name="l00823"></a>00823 obs_id = cpl_propertylist_get_int(main_header, OBS_ID);
-<a name="l00824"></a>00824 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00825"></a>00825
-<a name="l00826"></a>00826 KMO_TRY_EXIT_IF_NULL(
-<a name="l00827"></a>00827 filename_cube = cpl_sprintf(<span class="stringliteral">"%s"</span>, output_frame_name));
-<a name="l00828"></a>00828 KMO_TRY_EXIT_IF_NULL(
-<a name="l00829"></a>00829 filename_img = cpl_sprintf(<span class="stringliteral">"%s"</span>, DET_IMG_REC));
-<a name="l00830"></a>00830 <span class="keywordflow">if</span> (file_extension) {
-<a name="l00831"></a>00831 KMO_TRY_EXIT_IF_NULL(
-<a name="l00832"></a>00832 obs_suffix = cpl_sprintf(<span class="stringliteral">"%s%d"</span>, <span class="stringliteral">"_"</span>, obs_id));
-<a name="l00833"></a>00833 } <span class="keywordflow">else</span> {
-<a name="l00834"></a>00834 KMO_TRY_EXIT_IF_NULL(
-<a name="l00835"></a>00835 obs_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">""</span>));
-<a name="l00836"></a>00836 }
-<a name="l00837"></a>00837
-<a name="l00838"></a>00838 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00839"></a>00839 kmo_dfs_save_main_header(frameset, filename_cube, obs_suffix,
-<a name="l00840"></a>00840 rec_frame, NULL, parlist, cpl_func));
-<a name="l00841"></a>00841
-<a name="l00842"></a>00842 <span class="comment">// setup grid definition, wavelength start and end points will be set</span>
-<a name="l00843"></a>00843 <span class="comment">// in the detector loop</span>
-<a name="l00844"></a>00844 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00845"></a>00845 kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale));
+<a name="l00780"></a>00780 kmo_free_fits_desc(&desc2);
+<a name="l00781"></a>00781
+<a name="l00782"></a>00782 <span class="comment">//</span>
+<a name="l00783"></a>00783 <span class="comment">// --- update & save primary header ---</span>
+<a name="l00784"></a>00784 <span class="comment">//</span>
+<a name="l00785"></a>00785 KMO_TRY_EXIT_IF_NULL(
+<a name="l00786"></a>00786 tmp_header = kmo_dfs_load_primary_header(frameset, LCAL));
+<a name="l00787"></a>00787
+<a name="l00788"></a>00788 <span class="comment">// assert that filters have correct IDs and that all detectors of all</span>
+<a name="l00789"></a>00789 <span class="comment">// input frames have the same filter set</span>
+<a name="l00790"></a>00790 <span class="keywordflow">for</span> (i = 1; i <= nr_devices; i++) {
+<a name="l00791"></a>00791 <span class="comment">// ESO INS FILTi ID</span>
+<a name="l00792"></a>00792 KMO_TRY_EXIT_IF_NULL(
+<a name="l00793"></a>00793 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_FILTID_PREFIX, i,
+<a name="l00794"></a>00794 IFU_FILTID_POSTFIX));
+<a name="l00795"></a>00795
+<a name="l00796"></a>00796 KMO_TRY_EXIT_IF_NULL(
+<a name="l00797"></a>00797 filter_id = cpl_propertylist_get_string(tmp_header, keyword));
+<a name="l00798"></a>00798
+<a name="l00799"></a>00799 KMO_TRY_ASSURE((strcmp(filter_id, <span class="stringliteral">"IZ"</span>) == 0) ||
+<a name="l00800"></a>00800 (strcmp(filter_id, <span class="stringliteral">"YJ"</span>) == 0) ||
+<a name="l00801"></a>00801 (strcmp(filter_id, <span class="stringliteral">"H"</span>) == 0) ||
+<a name="l00802"></a>00802 (strcmp(filter_id, <span class="stringliteral">"K"</span>) == 0) ||
+<a name="l00803"></a>00803 (strcmp(filter_id, <span class="stringliteral">"HK"</span>) == 0),
+<a name="l00804"></a>00804 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00805"></a>00805 <span class="stringliteral">"Filter ID in primary header of LCAL frame must "</span>
+<a name="l00806"></a>00806 <span class="stringliteral">"be either \"IZ\", \"YJ\", \"H\", \"K\" or "</span>
+<a name="l00807"></a>00807 <span class="stringliteral">"\"HK\" !"</span>);
+<a name="l00808"></a>00808
+<a name="l00809"></a>00809 <span class="keywordflow">if</span> (strcmp(input_frame_name, DARK) != 0) {
+<a name="l00810"></a>00810 <span class="comment">// dark needn't to be taken with filter!</span>
+<a name="l00811"></a>00811
+<a name="l00812"></a>00812 KMO_TRY_EXIT_IF_NULL(
+<a name="l00813"></a>00813 filter_id_tmp = cpl_propertylist_get_string(main_header,
+<a name="l00814"></a>00814 keyword));
+<a name="l00815"></a>00815 KMO_TRY_ASSURE(strcmp(filter_id, filter_id_tmp) == 0,
+<a name="l00816"></a>00816 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00817"></a>00817 <span class="stringliteral">"Filter IDs must be the same for LCAL frame and "</span>
+<a name="l00818"></a>00818 <span class="stringliteral">"the frame to reconstruct!"</span>
+<a name="l00819"></a>00819 <span class="stringliteral">"Detector No.: %d\nLCAL: %s\n%s: %s\n"</span>,
+<a name="l00820"></a>00820 i, filter_id, input_frame_name, filter_id_tmp);
+<a name="l00821"></a>00821 }
+<a name="l00822"></a>00822 cpl_free(keyword); keyword = NULL;
+<a name="l00823"></a>00823 }
+<a name="l00824"></a>00824 KMO_TRY_EXIT_IF_NULL(
+<a name="l00825"></a>00825 my_filter_id = cpl_strdup(filter_id));
+<a name="l00826"></a>00826 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l00827"></a>00827
+<a name="l00828"></a>00828 obs_id = cpl_propertylist_get_int(main_header, OBS_ID);
+<a name="l00829"></a>00829 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00830"></a>00830
+<a name="l00831"></a>00831 KMO_TRY_EXIT_IF_NULL(
+<a name="l00832"></a>00832 filename_cube = cpl_sprintf(<span class="stringliteral">"%s"</span>, output_frame_name));
+<a name="l00833"></a>00833 KMO_TRY_EXIT_IF_NULL(
+<a name="l00834"></a>00834 filename_img = cpl_sprintf(<span class="stringliteral">"%s"</span>, DET_IMG_REC));
+<a name="l00835"></a>00835 <span class="keywordflow">if</span> (file_extension) {
+<a name="l00836"></a>00836 KMO_TRY_EXIT_IF_NULL(
+<a name="l00837"></a>00837 obs_suffix = cpl_sprintf(<span class="stringliteral">"%s%d"</span>, <span class="stringliteral">"_"</span>, obs_id));
+<a name="l00838"></a>00838 } <span class="keywordflow">else</span> {
+<a name="l00839"></a>00839 KMO_TRY_EXIT_IF_NULL(
+<a name="l00840"></a>00840 obs_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">""</span>));
+<a name="l00841"></a>00841 }
+<a name="l00842"></a>00842
+<a name="l00843"></a>00843 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00844"></a>00844 kmo_dfs_save_main_header(frameset, filename_cube, obs_suffix,
+<a name="l00845"></a>00845 rec_frame, NULL, parlist, cpl_func));
<a name="l00846"></a>00846
-<a name="l00847"></a>00847 KMO_TRY_EXIT_IF_NULL(
-<a name="l00848"></a>00848 tmp_header = kmo_dfs_load_primary_header(frameset, XCAL));
-<a name="l00849"></a>00849
-<a name="l00850"></a>00850 KMO_TRY_EXIT_IF_NULL(
-<a name="l00851"></a>00851 bounds = kmclipm_extract_bounds(tmp_header));
-<a name="l00852"></a>00852 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
-<a name="l00853"></a>00853
-<a name="l00854"></a>00854 <span class="keywordflow">if</span> (detectorimage == TRUE) {
-<a name="l00855"></a>00855 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00856"></a>00856 kmo_dfs_save_main_header(frameset, filename_img, obs_suffix,
-<a name="l00857"></a>00857 rec_frame, NULL, parlist, cpl_func));
-<a name="l00858"></a>00858 }
-<a name="l00859"></a>00859
-<a name="l00860"></a>00860 <span class="comment">/* loop through all detectors */</span>
-<a name="l00861"></a>00861 <span class="keywordflow">for</span> (i = 1; i <= nr_devices; i++) {
-<a name="l00862"></a>00862 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Processing detector No. %d"</span>, i);
-<a name="l00863"></a>00863
-<a name="l00864"></a>00864 <span class="comment">// load lcal</span>
-<a name="l00865"></a>00865 <span class="comment">// extract LCAL image close to ROTANGLE 0. assuming that the wavelength range</span>
-<a name="l00866"></a>00866 <span class="comment">// doesn't differ too much with different ROTANGLEs.</span>
-<a name="l00867"></a>00867 <span class="keywordtype">double</span> rotangle_found;
-<a name="l00868"></a>00868 print_cal_angle_msg_once = FALSE;
-<a name="l00869"></a>00869 KMO_TRY_EXIT_IF_NULL(
-<a name="l00870"></a>00870 lcal = kmo_dfs_load_cal_image(frameset, LCAL, i, FALSE, 0.,
-<a name="l00871"></a>00871 FALSE, NULL, &rotangle_found, -1, 0, 0));
-<a name="l00872"></a>00872 <span class="keywordflow">if</span> (i==1) {
-<a name="l00873"></a>00873 print_cal_angle_msg_once = TRUE;
-<a name="l00874"></a>00874 }
-<a name="l00875"></a>00875 <span class="keywordtype">char</span> *tmp_band_method = getenv(<span class="stringliteral">"KMO_BAND_METHOD"</span>);
-<a name="l00876"></a>00876 <span class="keywordtype">int</span> band_method = 0;
-<a name="l00877"></a>00877 <span class="keywordflow">if</span> (tmp_band_method != NULL) {
-<a name="l00878"></a>00878 band_method = atoi(tmp_band_method);
-<a name="l00879"></a>00879 }
-<a name="l00880"></a>00880
-<a name="l00881"></a>00881 KMO_TRY_EXIT_IF_NULL(
-<a name="l00882"></a>00882 band_table = kmo_dfs_load_table(frameset, WAVE_BAND, 1, FALSE));
-<a name="l00883"></a>00883
-<a name="l00884"></a>00884 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00885"></a>00885 kmclipm_setup_grid_band_lcal(&gd, lcal, my_filter_id,
-<a name="l00886"></a>00886 band_method, band_table));
-<a name="l00887"></a>00887 cpl_table_delete(band_table); band_table = NULL;
-<a name="l00888"></a>00888
-<a name="l00889"></a>00889 cpl_image_delete(lcal); lcal = NULL;
+<a name="l00847"></a>00847 <span class="comment">// setup grid definition, wavelength start and end points will be set</span>
+<a name="l00848"></a>00848 <span class="comment">// in the detector loop</span>
+<a name="l00849"></a>00849 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00850"></a>00850 kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale, 0.));
+<a name="l00851"></a>00851
+<a name="l00852"></a>00852 KMO_TRY_EXIT_IF_NULL(
+<a name="l00853"></a>00853 tmp_header = kmo_dfs_load_primary_header(frameset, XCAL));
+<a name="l00854"></a>00854
+<a name="l00855"></a>00855 KMO_TRY_EXIT_IF_NULL(
+<a name="l00856"></a>00856 bounds = kmclipm_extract_bounds(tmp_header));
+<a name="l00857"></a>00857 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l00858"></a>00858
+<a name="l00859"></a>00859 <span class="keywordflow">if</span> (detectorimage == TRUE) {
+<a name="l00860"></a>00860 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00861"></a>00861 kmo_dfs_save_main_header(frameset, filename_img, obs_suffix,
+<a name="l00862"></a>00862 rec_frame, NULL, parlist, cpl_func));
+<a name="l00863"></a>00863 }
+<a name="l00864"></a>00864
+<a name="l00865"></a>00865 <span class="comment">/* loop through all detectors */</span>
+<a name="l00866"></a>00866 <span class="keywordflow">for</span> (i = 1; i <= nr_devices; i++) {
+<a name="l00867"></a>00867 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Processing detector No. %d"</span>, i);
+<a name="l00868"></a>00868
+<a name="l00869"></a>00869 <span class="comment">// load lcal</span>
+<a name="l00870"></a>00870 <span class="comment">// extract LCAL image close to ROTANGLE 0. assuming that the wavelength range</span>
+<a name="l00871"></a>00871 <span class="comment">// doesn't differ too much with different ROTANGLEs.</span>
+<a name="l00872"></a>00872 <span class="keywordtype">double</span> rotangle_found;
+<a name="l00873"></a>00873 print_cal_angle_msg_once = FALSE;
+<a name="l00874"></a>00874 print_xcal_angle_msg_once = FALSE;
+<a name="l00875"></a>00875 KMO_TRY_EXIT_IF_NULL(
+<a name="l00876"></a>00876 lcal = kmo_dfs_load_cal_image(frameset, LCAL, i, FALSE, 0.,
+<a name="l00877"></a>00877 FALSE, NULL, &rotangle_found, -1, 0, 0));
+<a name="l00878"></a>00878 <span class="keywordflow">if</span> (i==1) {
+<a name="l00879"></a>00879 print_cal_angle_msg_once = TRUE;
+<a name="l00880"></a>00880 print_xcal_angle_msg_once = TRUE;
+<a name="l00881"></a>00881 }
+<a name="l00882"></a>00882 <span class="keywordtype">char</span> *tmp_band_method = getenv(<span class="stringliteral">"KMO_BAND_METHOD"</span>);
+<a name="l00883"></a>00883 <span class="keywordtype">int</span> band_method = 0;
+<a name="l00884"></a>00884 <span class="keywordflow">if</span> (tmp_band_method != NULL) {
+<a name="l00885"></a>00885 band_method = atoi(tmp_band_method);
+<a name="l00886"></a>00886 }
+<a name="l00887"></a>00887
+<a name="l00888"></a>00888 KMO_TRY_EXIT_IF_NULL(
+<a name="l00889"></a>00889 band_table = kmo_dfs_load_table(frameset, WAVE_BAND, 1, FALSE));
<a name="l00890"></a>00890
-<a name="l00891"></a>00891 <span class="keywordflow">if</span> (detectorimage == TRUE) {
-<a name="l00892"></a>00892 KMO_TRY_EXIT_IF_NULL(
-<a name="l00893"></a>00893 det_img_data[i-1] = cpl_image_new(gd.x.dim*gd.y.dim*KMOS_IFUS_PER_DETECTOR,
-<a name="l00894"></a>00894 gd.l.dim, CPL_TYPE_FLOAT));
-<a name="l00895"></a>00895 KMO_TRY_EXIT_IF_NULL(
-<a name="l00896"></a>00896 pdet_img_data = cpl_image_get_data_float(det_img_data[i-1]));
+<a name="l00891"></a>00891 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00892"></a>00892 kmclipm_setup_grid_band_lcal(&gd, lcal, my_filter_id,
+<a name="l00893"></a>00893 band_method, band_table));
+<a name="l00894"></a>00894 cpl_table_delete(band_table); band_table = NULL;
+<a name="l00895"></a>00895
+<a name="l00896"></a>00896 cpl_image_delete(lcal); lcal = NULL;
<a name="l00897"></a>00897
-<a name="l00898"></a>00898 KMO_TRY_EXIT_IF_NULL(
-<a name="l00899"></a>00899 det_img_noise[i-1] = cpl_image_new(gd.x.dim*gd.y.dim*KMOS_IFUS_PER_DETECTOR,
-<a name="l00900"></a>00900 gd.l.dim, CPL_TYPE_FLOAT));
-<a name="l00901"></a>00901 KMO_TRY_EXIT_IF_NULL(
-<a name="l00902"></a>00902 pdet_img_noise = cpl_image_get_data_float(det_img_noise[i-1]));
-<a name="l00903"></a>00903 }
+<a name="l00898"></a>00898 <span class="keywordflow">if</span> (detectorimage == TRUE) {
+<a name="l00899"></a>00899 KMO_TRY_EXIT_IF_NULL(
+<a name="l00900"></a>00900 det_img_data[i-1] = cpl_image_new(gd.x.dim*gd.y.dim*KMOS_IFUS_PER_DETECTOR,
+<a name="l00901"></a>00901 gd.l.dim, CPL_TYPE_FLOAT));
+<a name="l00902"></a>00902 KMO_TRY_EXIT_IF_NULL(
+<a name="l00903"></a>00903 pdet_img_data = cpl_image_get_data_float(det_img_data[i-1]));
<a name="l00904"></a>00904
-<a name="l00905"></a>00905
-<a name="l00906"></a>00906 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
-<a name="l00907"></a>00907 <span class="comment">/* update sub-header */</span>
-<a name="l00908"></a>00908 ifu_nr = (i-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
-<a name="l00909"></a>00909
-<a name="l00910"></a>00910 <span class="comment">/* load raw image and sub-header*/</span>
-<a name="l00911"></a>00911 KMO_TRY_EXIT_IF_NULL(
-<a name="l00912"></a>00912 sub_header = kmo_dfs_load_sub_header(frameset, input_frame_name,
-<a name="l00913"></a>00913 i, FALSE));
-<a name="l00914"></a>00914 KMO_TRY_EXIT_IF_NULL(
-<a name="l00915"></a>00915 sub_header_orig = cpl_propertylist_duplicate(sub_header));
+<a name="l00905"></a>00905 KMO_TRY_EXIT_IF_NULL(
+<a name="l00906"></a>00906 det_img_noise[i-1] = cpl_image_new(gd.x.dim*gd.y.dim*KMOS_IFUS_PER_DETECTOR,
+<a name="l00907"></a>00907 gd.l.dim, CPL_TYPE_FLOAT));
+<a name="l00908"></a>00908 KMO_TRY_EXIT_IF_NULL(
+<a name="l00909"></a>00909 pdet_img_noise = cpl_image_get_data_float(det_img_noise[i-1]));
+<a name="l00910"></a>00910 }
+<a name="l00911"></a>00911
+<a name="l00912"></a>00912
+<a name="l00913"></a>00913 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l00914"></a>00914 <span class="comment">/* update sub-header */</span>
+<a name="l00915"></a>00915 ifu_nr = (i-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
<a name="l00916"></a>00916
-<a name="l00917"></a>00917 <span class="comment">// check if IFU is valid according to main header keywords &</span>
-<a name="l00918"></a>00918 <span class="comment">// calibration files</span>
-<a name="l00919"></a>00919
-<a name="l00920"></a>00920 <span class="keywordflow">if</span> (getenv(<span class="stringliteral">"KMOS_RECONSTRUCT_ALL"</span>) == NULL) {
-<a name="l00921"></a>00921 KMO_TRY_EXIT_IF_NULL(
-<a name="l00922"></a>00922 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_VALID_PREFIX, ifu_nr,
-<a name="l00923"></a>00923 IFU_VALID_POSTFIX));
-<a name="l00924"></a>00924 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00925"></a>00925 cpl_propertylist_get_string(main_header, keyword);
-<a name="l00926"></a>00926 cpl_free(keyword); keyword = NULL;
-<a name="l00927"></a>00927 } <span class="keywordflow">else</span> {
-<a name="l00928"></a>00928 <span class="comment">// if KMOS_RECONSTRUCT_ALL is set all IFUs should be</span>
-<a name="l00929"></a>00929 <span class="comment">// reconstructed</span>
-<a name="l00930"></a>00930 cpl_propertylist_get_string(main_header, <span class="stringliteral">"ggg"</span>);
-<a name="l00931"></a>00931 }
-<a name="l00932"></a>00932
-<a name="l00933"></a>00933 <span class="keywordflow">if</span> ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) &&
-<a name="l00934"></a>00934 (bounds[2*(ifu_nr-1)] != -1) &&
-<a name="l00935"></a>00935 (bounds[2*(ifu_nr-1)+1] != -1))
-<a name="l00936"></a>00936 {
-<a name="l00937"></a>00937 cpl_error_reset();
-<a name="l00938"></a>00938 <span class="comment">// IFU is valid</span>
-<a name="l00939"></a>00939 actual_sub_header = sub_header;
-<a name="l00940"></a>00940
-<a name="l00941"></a>00941 <span class="comment">//</span>
-<a name="l00942"></a>00942 <span class="comment">// calc WCS & update subheader</span>
-<a name="l00943"></a>00943 <span class="comment">//</span>
-<a name="l00944"></a>00944 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00945"></a>00945 kmo_calc_wcs_gd(main_header, actual_sub_header, ifu_nr, gd));
-<a name="l00946"></a>00946
-<a name="l00947"></a>00947 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00948"></a>00948 kmclipm_update_property_int(actual_sub_header,
-<a name="l00949"></a>00949 NAXIS, 3,
-<a name="l00950"></a>00950 <span class="stringliteral">"number of data axes"</span>));
+<a name="l00917"></a>00917 <span class="comment">/* load raw image and sub-header*/</span>
+<a name="l00918"></a>00918 KMO_TRY_EXIT_IF_NULL(
+<a name="l00919"></a>00919 sub_header = kmo_dfs_load_sub_header(frameset, input_frame_name,
+<a name="l00920"></a>00920 i, FALSE));
+<a name="l00921"></a>00921 KMO_TRY_EXIT_IF_NULL(
+<a name="l00922"></a>00922 sub_header_orig = cpl_propertylist_duplicate(sub_header));
+<a name="l00923"></a>00923
+<a name="l00924"></a>00924 <span class="comment">// check if IFU is valid according to main header keywords &</span>
+<a name="l00925"></a>00925 <span class="comment">// calibration files</span>
+<a name="l00926"></a>00926
+<a name="l00927"></a>00927 <span class="keywordflow">if</span> (getenv(<span class="stringliteral">"KMOS_RECONSTRUCT_ALL"</span>) == NULL) {
+<a name="l00928"></a>00928 KMO_TRY_EXIT_IF_NULL(
+<a name="l00929"></a>00929 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_VALID_PREFIX, ifu_nr,
+<a name="l00930"></a>00930 IFU_VALID_POSTFIX));
+<a name="l00931"></a>00931 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00932"></a>00932 cpl_propertylist_get_string(main_header, keyword);
+<a name="l00933"></a>00933 cpl_free(keyword); keyword = NULL;
+<a name="l00934"></a>00934 } <span class="keywordflow">else</span> {
+<a name="l00935"></a>00935 <span class="comment">// if KMOS_RECONSTRUCT_ALL is set all IFUs should be</span>
+<a name="l00936"></a>00936 <span class="comment">// reconstructed</span>
+<a name="l00937"></a>00937 cpl_propertylist_get_string(main_header, <span class="stringliteral">"ggg"</span>);
+<a name="l00938"></a>00938 }
+<a name="l00939"></a>00939
+<a name="l00940"></a>00940 <span class="keywordflow">if</span> ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) &&
+<a name="l00941"></a>00941 (bounds[2*(ifu_nr-1)] != -1) &&
+<a name="l00942"></a>00942 (bounds[2*(ifu_nr-1)+1] != -1))
+<a name="l00943"></a>00943 {
+<a name="l00944"></a>00944 cpl_error_reset();
+<a name="l00945"></a>00945 <span class="comment">// IFU is valid</span>
+<a name="l00946"></a>00946 actual_sub_header = sub_header;
+<a name="l00947"></a>00947
+<a name="l00948"></a>00948 <span class="comment">//</span>
+<a name="l00949"></a>00949 <span class="comment">// calc WCS & update subheader</span>
+<a name="l00950"></a>00950 <span class="comment">//</span>
<a name="l00951"></a>00951 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00952"></a>00952 kmclipm_update_property_int(actual_sub_header,
-<a name="l00953"></a>00953 NAXIS1, gd.x.dim,
-<a name="l00954"></a>00954 <span class="stringliteral">"length of data axis 1"</span>));
-<a name="l00955"></a>00955 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00956"></a>00956 kmclipm_update_property_int(actual_sub_header,
-<a name="l00957"></a>00957 NAXIS2, gd.y.dim,
-<a name="l00958"></a>00958 <span class="stringliteral">"length of data axis 2"</span>));
-<a name="l00959"></a>00959 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00960"></a>00960 kmclipm_update_property_int(actual_sub_header,
-<a name="l00961"></a>00961 NAXIS3, gd.l.dim,
-<a name="l00962"></a>00962 <span class="stringliteral">"length of data axis 3"</span>));
-<a name="l00963"></a>00963
-<a name="l00964"></a>00964 <span class="comment">// reconstruct data and noise (if available)</span>
-<a name="l00965"></a>00965 <span class="comment">// if (j == 0) {</span>
-<a name="l00966"></a>00966 <span class="comment">// sat_mode_msg = FALSE;</span>
-<a name="l00967"></a>00967 <span class="comment">// } else {</span>
-<a name="l00968"></a>00968 <span class="comment">// sat_mode_msg = TRUE;</span>
-<a name="l00969"></a>00969 <span class="comment">// }</span>
-<a name="l00970"></a>00970 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00971"></a>00971 kmo_reconstruct_sci(ifu_nr,
-<a name="l00972"></a>00972 bounds[2*(ifu_nr-1)],
-<a name="l00973"></a>00973 bounds[2*(ifu_nr-1)+1],
-<a name="l00974"></a>00974 rec_frame,
-<a name="l00975"></a>00975 input_frame_name,
-<a name="l00976"></a>00976 NULL,
-<a name="l00977"></a>00977 NULL,
-<a name="l00978"></a>00978 NULL,
-<a name="l00979"></a>00979 xcal_frame,
-<a name="l00980"></a>00980 ycal_frame,
-<a name="l00981"></a>00981 lcal_frame,
-<a name="l00982"></a>00982 NULL,
-<a name="l00983"></a>00983 &gd,
-<a name="l00984"></a>00984 &cube_data,
-<a name="l00985"></a>00985 &cube_noise,
-<a name="l00986"></a>00986 flux,
-<a name="l00987"></a>00987 background,
-<a name="l00988"></a>00988 xcal_interpolation));
-<a name="l00989"></a>00989
-<a name="l00990"></a>00990 <span class="keywordflow">if</span> (ref_spectrum_frame != NULL && cube_data != NULL) {
-<a name="l00991"></a>00991 KMO_TRY_EXIT_IF_NULL(
-<a name="l00992"></a>00992 lcorr_coeffs = kmo_lcorr_get(cube_data,
-<a name="l00993"></a>00993 actual_sub_header,
-<a name="l00994"></a>00994 ref_spectrum_frame,
-<a name="l00995"></a>00995 gd,
-<a name="l00996"></a>00996 my_filter_id,
-<a name="l00997"></a>00997 ifu_nr));
-<a name="l00998"></a>00998
-<a name="l00999"></a>00999 cpl_imagelist_delete(cube_data); cube_data = NULL;
-<a name="l01000"></a>01000 <span class="keywordflow">if</span> (cube_noise != NULL) {
-<a name="l01001"></a>01001 cpl_imagelist_delete(cube_noise); cube_noise = NULL;
-<a name="l01002"></a>01002 }
-<a name="l01003"></a>01003 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01004"></a>01004 kmo_reconstruct_sci(ifu_nr,
-<a name="l01005"></a>01005 bounds[2*(ifu_nr-1)],
-<a name="l01006"></a>01006 bounds[2*(ifu_nr-1)+1],
-<a name="l01007"></a>01007 rec_frame,
-<a name="l01008"></a>01008 input_frame_name,
-<a name="l01009"></a>01009 NULL,
-<a name="l01010"></a>01010 NULL,
-<a name="l01011"></a>01011 NULL,
-<a name="l01012"></a>01012 xcal_frame,
-<a name="l01013"></a>01013 ycal_frame,
-<a name="l01014"></a>01014 lcal_frame,
-<a name="l01015"></a>01015 lcorr_coeffs,
-<a name="l01016"></a>01016 &gd,
-<a name="l01017"></a>01017 &cube_data,
-<a name="l01018"></a>01018 &cube_noise,
-<a name="l01019"></a>01019 flux,
-<a name="l01020"></a>01020 background,
-<a name="l01021"></a>01021 xcal_interpolation));
-<a name="l01022"></a>01022 <span class="comment">/*</span>
-<a name="l01023"></a>01023 <span class="comment"> // show that lambda correction improved the data cube, a second one would improve even more</span>
-<a name="l01024"></a>01024 <span class="comment"></span>
-<a name="l01025"></a>01025 <span class="comment"> cpl_bivector *obj_spectrum2, *obj_spectrum3;</span>
-<a name="l01026"></a>01026 <span class="comment"> cpl_polynomial *lcorr_coeffs2, *lcorr_coeffs3;</span>
-<a name="l01027"></a>01027 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
-<a name="l01028"></a>01028 <span class="comment"> obj_spectrum2 = kmo_lcorr_extract_spectrum(</span>
-<a name="l01029"></a>01029 <span class="comment"> cube_data, actual_sub_header, 0.8, NULL));</span>
-<a name="l01030"></a>01030 <span class="comment"></span>
-<a name="l01031"></a>01031 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
-<a name="l01032"></a>01032 <span class="comment"> lcorr_coeffs2 = kmo_lcorr_crosscorrelate_spectra(</span>
-<a name="l01033"></a>01033 <span class="comment"> obj_spectrum2, ref_spectrum, peaks, 0.002));</span>
-<a name="l01034"></a>01034 <span class="comment"></span>
-<a name="l01035"></a>01035 <span class="comment"> cpl_bivector_delete(obj_spectrum2);</span>
-<a name="l01036"></a>01036 <span class="comment"></span>
-<a name="l01037"></a>01037 <span class="comment"> coeff_dump[0] = 0;</span>
-<a name="l01038"></a>01038 <span class="comment"> for (ic=0; ic<=cpl_polynomial_get_degree(lcorr_coeffs2) && ic < max_coeffs; ic++) {</span>
-<a name="l01039"></a>01039 <span class="comment"> pows[0] = ic;</span>
-<a name="l01040"></a>01040 <span class="comment"> coeff_string = cpl_sprintf(" %*g,",</span>
-<a name="l01041"></a>01041 <span class="comment"> format_width-2, cpl_polynomial_get_coeff(lcorr_coeffs2,pows));</span>
-<a name="l01042"></a>01042 <span class="comment"> strncat(coeff_dump, coeff_string, format_width);</span>
-<a name="l01043"></a>01043 <span class="comment"> cpl_free(coeff_string);</span>
-<a name="l01044"></a>01044 <span class="comment"> double c1 = cpl_polynomial_get_coeff(lcorr_coeffs,pows);</span>
-<a name="l01045"></a>01045 <span class="comment"> double c2 = cpl_polynomial_get_coeff(lcorr_coeffs2,pows);</span>
-<a name="l01046"></a>01046 <span class="comment"> cpl_polynomial_set_coeff(lcorr_coeffs, pows, c1+c2);</span>
-<a name="l01047"></a>01047 <span class="comment"> }</span>
-<a name="l01048"></a>01048 <span class="comment"> cpl_msg_debug("","Lambda correction coeffs for ifu %d %s",ifu_nr, coeff_dump);</span>
-<a name="l01049"></a>01049 <span class="comment"> cpl_polynomial_delete(lcorr_coeffs2); lcorr_coeffs2=NULL;</span>
-<a name="l01050"></a>01050 <span class="comment"></span>
-<a name="l01051"></a>01051 <span class="comment"> cpl_imagelist_delete(cube_data); cube_data = NULL;</span>
-<a name="l01052"></a>01052 <span class="comment"> cpl_imagelist_delete(cube_noise); cube_noise = NULL;</span>
-<a name="l01053"></a>01053 <span class="comment"> KMO_TRY_EXIT_IF_ERROR(</span>
-<a name="l01054"></a>01054 <span class="comment"> kmo_reconstruct_sci(ifu_nr,</span>
-<a name="l01055"></a>01055 <span class="comment"> bounds[2*(ifu_nr-1)],</span>
-<a name="l01056"></a>01056 <span class="comment"> bounds[2*(ifu_nr-1)+1],</span>
-<a name="l01057"></a>01057 <span class="comment"> rec_frame,</span>
-<a name="l01058"></a>01058 <span class="comment"> input_frame_name,</span>
-<a name="l01059"></a>01059 <span class="comment"> NULL,</span>
-<a name="l01060"></a>01060 <span class="comment"> NULL,</span>
-<a name="l01061"></a>01061 <span class="comment"> NULL,</span>
-<a name="l01062"></a>01062 <span class="comment"> xcal_frame,</span>
-<a name="l01063"></a>01063 <span class="comment"> ycal_frame,</span>
-<a name="l01064"></a>01064 <span class="comment"> lcal_frame,</span>
-<a name="l01065"></a>01065 <span class="comment"> lcorr_coeffs,</span>
-<a name="l01066"></a>01066 <span class="comment"> &gd,</span>
-<a name="l01067"></a>01067 <span class="comment"> &cube_data,</span>
-<a name="l01068"></a>01068 <span class="comment"> &cube_noise,</span>
-<a name="l01069"></a>01069 <span class="comment"> flux,</span>
-<a name="l01070"></a>01070 <span class="comment"> background,</span>
-<a name="l01071"></a>01071 <span class="comment"> xcal_interpolation));</span>
-<a name="l01072"></a>01072 <span class="comment"></span>
-<a name="l01073"></a>01073 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
-<a name="l01074"></a>01074 <span class="comment"> obj_spectrum3 = kmo_lcorr_extract_spectrum(</span>
-<a name="l01075"></a>01075 <span class="comment"> cube_data, actual_sub_header, 0.8, NULL));</span>
-<a name="l01076"></a>01076 <span class="comment"></span>
-<a name="l01077"></a>01077 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
-<a name="l01078"></a>01078 <span class="comment"> lcorr_coeffs3 = kmo_lcorr_crosscorrelate_spectra(</span>
-<a name="l01079"></a>01079 <span class="comment"> obj_spectrum3, ref_spectrum, peaks, 0.002));</span>
-<a name="l01080"></a>01080 <span class="comment"></span>
-<a name="l01081"></a>01081 <span class="comment"> cpl_bivector_delete(obj_spectrum3);</span>
-<a name="l01082"></a>01082 <span class="comment"></span>
-<a name="l01083"></a>01083 <span class="comment"> coeff_dump[0] = 0;</span>
-<a name="l01084"></a>01084 <span class="comment"> for (ic=0; ic<=cpl_polynomial_get_degree(lcorr_coeffs3) && ic < max_coeffs; ic++) {</span>
-<a name="l01085"></a>01085 <span class="comment"> pows[0] = ic;</span>
-<a name="l01086"></a>01086 <span class="comment"> coeff_string = cpl_sprintf(" %*g,",</span>
-<a name="l01087"></a>01087 <span class="comment"> format_width-2, cpl_polynomial_get_coeff(lcorr_coeffs3,pows));</span>
-<a name="l01088"></a>01088 <span class="comment"> strncat(coeff_dump, coeff_string, format_width);</span>
-<a name="l01089"></a>01089 <span class="comment"> cpl_free(coeff_string);</span>
-<a name="l01090"></a>01090 <span class="comment"> }</span>
-<a name="l01091"></a>01091 <span class="comment"> cpl_msg_debug("","Lambda correction coeffs for iFu %d %s",ifu_nr, coeff_dump);</span>
-<a name="l01092"></a>01092 <span class="comment"> cpl_polynomial_delete(lcorr_coeffs3); lcorr_coeffs3=NULL;</span>
-<a name="l01093"></a>01093 <span class="comment">*/</span>
-<a name="l01094"></a>01094 cpl_polynomial_delete(lcorr_coeffs); lcorr_coeffs = NULL;
-<a name="l01095"></a>01095
-<a name="l01096"></a>01096 }
-<a name="l01097"></a>01097
-<a name="l01098"></a>01098 <span class="comment">// scale flux according to pixel_scale</span>
-<a name="l01099"></a>01099 KMO_TRY_EXIT_IF_NULL(
-<a name="l01100"></a>01100 tmp_img = cpl_imagelist_get(cube_data, 0));
-<a name="l01101"></a>01101 <span class="keywordtype">double</span> scaling = (cpl_image_get_size_x(tmp_img)*cpl_image_get_size_y(tmp_img)) /
-<a name="l01102"></a>01102 (KMOS_SLITLET_X*KMOS_SLITLET_Y);
-<a name="l01103"></a>01103 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01104"></a>01104 cpl_imagelist_divide_scalar(cube_data, scaling));
-<a name="l01105"></a>01105 <span class="keywordflow">if</span> (cube_noise != NULL) {
-<a name="l01106"></a>01106 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01107"></a>01107 cpl_imagelist_divide_scalar(cube_noise, scaling));
-<a name="l01108"></a>01108 }
-<a name="l01109"></a>01109 } <span class="keywordflow">else</span> {
-<a name="l01110"></a>01110 <span class="comment">// IFU is invalid</span>
-<a name="l01111"></a>01111 actual_sub_header = sub_header_orig;
-<a name="l01112"></a>01112 cpl_error_reset();
-<a name="l01113"></a>01113 } <span class="comment">// if ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) ..</span>
-<a name="l01114"></a>01114
-<a name="l01115"></a>01115 <span class="keywordflow">if</span> (detectorimage) {
-<a name="l01116"></a>01116 <span class="keywordflow">if</span> (cube_data != NULL) {
-<a name="l01117"></a>01117 <span class="keywordflow">for</span> (l = 0; l < gd.l.dim; l++) {
-<a name="l01118"></a>01118 KMO_TRY_EXIT_IF_NULL(
-<a name="l01119"></a>01119 slice = cpl_image_get_data_float(cpl_imagelist_get(cube_data, l)));
-<a name="l01120"></a>01120 <span class="keywordflow">for</span> (y = 0; y < gd.y.dim; y++) {
-<a name="l01121"></a>01121 <span class="keywordflow">for</span> (x = 0; x < gd.x.dim; x++) {
-<a name="l01122"></a>01122 <span class="keywordtype">int</span> ix = x +
-<a name="l01123"></a>01123 y * gd.x.dim +
-<a name="l01124"></a>01124 j * gd.x.dim*gd.y.dim + <span class="comment">//IFU offset</span>
-<a name="l01125"></a>01125 l * gd.x.dim*gd.y.dim*KMOS_IFUS_PER_DETECTOR;
-<a name="l01126"></a>01126 pdet_img_data[ix] = slice[x + y*gd.x.dim];
-<a name="l01127"></a>01127 }
-<a name="l01128"></a>01128 }
-<a name="l01129"></a>01129 }
-<a name="l01130"></a>01130 }
-<a name="l01131"></a>01131 <span class="keywordflow">if</span> (cube_noise != NULL) {
-<a name="l01132"></a>01132 <span class="keywordflow">if</span> (detectorimage) {
-<a name="l01133"></a>01133 detImgCube = TRUE;
-<a name="l01134"></a>01134 }
-<a name="l01135"></a>01135 <span class="keywordflow">for</span> (l = 0; l < gd.l.dim; l++) {
-<a name="l01136"></a>01136 KMO_TRY_EXIT_IF_NULL(
-<a name="l01137"></a>01137 slice = cpl_image_get_data_float(cpl_imagelist_get(cube_noise, l)));
-<a name="l01138"></a>01138 <span class="keywordflow">for</span> (y = 0; y < gd.y.dim; y++) {
-<a name="l01139"></a>01139 <span class="keywordflow">for</span> (x = 0; x < gd.x.dim; x++) {
-<a name="l01140"></a>01140 <span class="keywordtype">int</span> ix = x +
-<a name="l01141"></a>01141 y * gd.x.dim +
-<a name="l01142"></a>01142 j * gd.x.dim*gd.y.dim + <span class="comment">//IFU offset</span>
-<a name="l01143"></a>01143 l * gd.x.dim*gd.y.dim*KMOS_IFUS_PER_DETECTOR;
-<a name="l01144"></a>01144 pdet_img_noise[ix] = slice[x + y*gd.x.dim];
-<a name="l01145"></a>01145 }
-<a name="l01146"></a>01146 }
-<a name="l01147"></a>01147 }
-<a name="l01148"></a>01148 }
-<a name="l01149"></a>01149 }
-<a name="l01150"></a>01150
-<a name="l01151"></a>01151 <span class="comment">// save output</span>
-<a name="l01152"></a>01152 KMO_TRY_EXIT_IF_NULL(
-<a name="l01153"></a>01153 extname = kmo_extname_creator(ifu_frame, ifu_nr,
-<a name="l01154"></a>01154 EXT_DATA));
-<a name="l01155"></a>01155
-<a name="l01156"></a>01156 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01157"></a>01157 kmclipm_update_property_string(actual_sub_header,
-<a name="l01158"></a>01158 EXTNAME,
-<a name="l01159"></a>01159 extname,
-<a name="l01160"></a>01160 <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01161"></a>01161
-<a name="l01162"></a>01162 cpl_free(extname); extname = NULL;
-<a name="l01163"></a>01163
-<a name="l01164"></a>01164 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01165"></a>01165 kmo_dfs_save_cube(cube_data, filename_cube, obs_suffix,
-<a name="l01166"></a>01166 actual_sub_header, 0./0.));
-<a name="l01167"></a>01167
-<a name="l01168"></a>01168 <span class="keywordflow">if</span> (cube_noise != NULL) {
-<a name="l01169"></a>01169 KMO_TRY_EXIT_IF_NULL(
-<a name="l01170"></a>01170 extname = kmo_extname_creator(ifu_frame, ifu_nr,
-<a name="l01171"></a>01171 EXT_NOISE));
-<a name="l01172"></a>01172
-<a name="l01173"></a>01173 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01174"></a>01174 kmclipm_update_property_string(actual_sub_header,
-<a name="l01175"></a>01175 EXTNAME,
-<a name="l01176"></a>01176 extname,
-<a name="l01177"></a>01177 <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01178"></a>01178
-<a name="l01179"></a>01179 cpl_free(extname); extname = NULL;
-<a name="l01180"></a>01180
-<a name="l01181"></a>01181 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01182"></a>01182 kmo_dfs_save_cube(cube_noise, filename_cube, obs_suffix,
-<a name="l01183"></a>01183 actual_sub_header, 0./0.));
-<a name="l01184"></a>01184 }
+<a name="l00952"></a>00952 kmo_calc_wcs_gd(main_header, actual_sub_header, ifu_nr, gd));
+<a name="l00953"></a>00953
+<a name="l00954"></a>00954 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00955"></a>00955 kmclipm_update_property_int(actual_sub_header,
+<a name="l00956"></a>00956 NAXIS, 3,
+<a name="l00957"></a>00957 <span class="stringliteral">"number of data axes"</span>));
+<a name="l00958"></a>00958 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00959"></a>00959 kmclipm_update_property_int(actual_sub_header,
+<a name="l00960"></a>00960 NAXIS1, gd.x.dim,
+<a name="l00961"></a>00961 <span class="stringliteral">"length of data axis 1"</span>));
+<a name="l00962"></a>00962 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00963"></a>00963 kmclipm_update_property_int(actual_sub_header,
+<a name="l00964"></a>00964 NAXIS2, gd.y.dim,
+<a name="l00965"></a>00965 <span class="stringliteral">"length of data axis 2"</span>));
+<a name="l00966"></a>00966 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00967"></a>00967 kmclipm_update_property_int(actual_sub_header,
+<a name="l00968"></a>00968 NAXIS3, gd.l.dim,
+<a name="l00969"></a>00969 <span class="stringliteral">"length of data axis 3"</span>));
+<a name="l00970"></a>00970
+<a name="l00971"></a>00971 <span class="comment">// reconstruct data and noise (if available)</span>
+<a name="l00972"></a>00972 <span class="comment">// if (j == 0) {</span>
+<a name="l00973"></a>00973 <span class="comment">// sat_mode_msg = FALSE;</span>
+<a name="l00974"></a>00974 <span class="comment">// } else {</span>
+<a name="l00975"></a>00975 <span class="comment">// sat_mode_msg = TRUE;</span>
+<a name="l00976"></a>00976 <span class="comment">// }</span>
+<a name="l00977"></a>00977 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00978"></a>00978 kmo_reconstruct_sci(ifu_nr,
+<a name="l00979"></a>00979 bounds[2*(ifu_nr-1)],
+<a name="l00980"></a>00980 bounds[2*(ifu_nr-1)+1],
+<a name="l00981"></a>00981 rec_frame,
+<a name="l00982"></a>00982 input_frame_name,
+<a name="l00983"></a>00983 NULL,
+<a name="l00984"></a>00984 NULL,
+<a name="l00985"></a>00985 NULL,
+<a name="l00986"></a>00986 xcal_frame,
+<a name="l00987"></a>00987 ycal_frame,
+<a name="l00988"></a>00988 lcal_frame,
+<a name="l00989"></a>00989 NULL,
+<a name="l00990"></a>00990 &gd,
+<a name="l00991"></a>00991 &cube_data,
+<a name="l00992"></a>00992 &cube_noise,
+<a name="l00993"></a>00993 flux,
+<a name="l00994"></a>00994 background,
+<a name="l00995"></a>00995 xcal_interpolation));
+<a name="l00996"></a>00996
+<a name="l00997"></a>00997 <span class="keywordflow">if</span> (ref_spectrum_frame != NULL && cube_data != NULL) {
+<a name="l00998"></a>00998 KMO_TRY_EXIT_IF_NULL(
+<a name="l00999"></a>00999 lcorr_coeffs = kmo_lcorr_get(cube_data,
+<a name="l01000"></a>01000 actual_sub_header,
+<a name="l01001"></a>01001 ref_spectrum_frame,
+<a name="l01002"></a>01002 gd,
+<a name="l01003"></a>01003 my_filter_id,
+<a name="l01004"></a>01004 ifu_nr));
+<a name="l01005"></a>01005
+<a name="l01006"></a>01006 cpl_imagelist_delete(cube_data); cube_data = NULL;
+<a name="l01007"></a>01007 <span class="keywordflow">if</span> (cube_noise != NULL) {
+<a name="l01008"></a>01008 cpl_imagelist_delete(cube_noise); cube_noise = NULL;
+<a name="l01009"></a>01009 }
+<a name="l01010"></a>01010 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01011"></a>01011 kmo_reconstruct_sci(ifu_nr,
+<a name="l01012"></a>01012 bounds[2*(ifu_nr-1)],
+<a name="l01013"></a>01013 bounds[2*(ifu_nr-1)+1],
+<a name="l01014"></a>01014 rec_frame,
+<a name="l01015"></a>01015 input_frame_name,
+<a name="l01016"></a>01016 NULL,
+<a name="l01017"></a>01017 NULL,
+<a name="l01018"></a>01018 NULL,
+<a name="l01019"></a>01019 xcal_frame,
+<a name="l01020"></a>01020 ycal_frame,
+<a name="l01021"></a>01021 lcal_frame,
+<a name="l01022"></a>01022 lcorr_coeffs,
+<a name="l01023"></a>01023 &gd,
+<a name="l01024"></a>01024 &cube_data,
+<a name="l01025"></a>01025 &cube_noise,
+<a name="l01026"></a>01026 flux,
+<a name="l01027"></a>01027 background,
+<a name="l01028"></a>01028 xcal_interpolation));
+<a name="l01029"></a>01029 <span class="comment">/*</span>
+<a name="l01030"></a>01030 <span class="comment"> // show that lambda correction improved the data cube, a second one would improve even more</span>
+<a name="l01031"></a>01031 <span class="comment"></span>
+<a name="l01032"></a>01032 <span class="comment"> cpl_bivector *obj_spectrum2, *obj_spectrum3;</span>
+<a name="l01033"></a>01033 <span class="comment"> cpl_polynomial *lcorr_coeffs2, *lcorr_coeffs3;</span>
+<a name="l01034"></a>01034 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
+<a name="l01035"></a>01035 <span class="comment"> obj_spectrum2 = kmo_lcorr_extract_spectrum(</span>
+<a name="l01036"></a>01036 <span class="comment"> cube_data, actual_sub_header, 0.8, NULL));</span>
+<a name="l01037"></a>01037 <span class="comment"></span>
+<a name="l01038"></a>01038 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
+<a name="l01039"></a>01039 <span class="comment"> lcorr_coeffs2 = kmo_lcorr_crosscorrelate_spectra(</span>
+<a name="l01040"></a>01040 <span class="comment"> obj_spectrum2, ref_spectrum, peaks, 0.002));</span>
+<a name="l01041"></a>01041 <span class="comment"></span>
+<a name="l01042"></a>01042 <span class="comment"> cpl_bivector_delete(obj_spectrum2);</span>
+<a name="l01043"></a>01043 <span class="comment"></span>
+<a name="l01044"></a>01044 <span class="comment"> coeff_dump[0] = 0;</span>
+<a name="l01045"></a>01045 <span class="comment"> for (ic=0; ic<=cpl_polynomial_get_degree(lcorr_coeffs2) && ic < max_coeffs; ic++) {</span>
+<a name="l01046"></a>01046 <span class="comment"> pows[0] = ic;</span>
+<a name="l01047"></a>01047 <span class="comment"> coeff_string = cpl_sprintf(" %*g,",</span>
+<a name="l01048"></a>01048 <span class="comment"> format_width-2, cpl_polynomial_get_coeff(lcorr_coeffs2,pows));</span>
+<a name="l01049"></a>01049 <span class="comment"> strncat(coeff_dump, coeff_string, format_width);</span>
+<a name="l01050"></a>01050 <span class="comment"> cpl_free(coeff_string);</span>
+<a name="l01051"></a>01051 <span class="comment"> double c1 = cpl_polynomial_get_coeff(lcorr_coeffs,pows);</span>
+<a name="l01052"></a>01052 <span class="comment"> double c2 = cpl_polynomial_get_coeff(lcorr_coeffs2,pows);</span>
+<a name="l01053"></a>01053 <span class="comment"> cpl_polynomial_set_coeff(lcorr_coeffs, pows, c1+c2);</span>
+<a name="l01054"></a>01054 <span class="comment"> }</span>
+<a name="l01055"></a>01055 <span class="comment"> cpl_msg_debug("","Lambda correction coeffs for ifu %d %s",ifu_nr, coeff_dump);</span>
+<a name="l01056"></a>01056 <span class="comment"> cpl_polynomial_delete(lcorr_coeffs2); lcorr_coeffs2=NULL;</span>
+<a name="l01057"></a>01057 <span class="comment"></span>
+<a name="l01058"></a>01058 <span class="comment"> cpl_imagelist_delete(cube_data); cube_data = NULL;</span>
+<a name="l01059"></a>01059 <span class="comment"> cpl_imagelist_delete(cube_noise); cube_noise = NULL;</span>
+<a name="l01060"></a>01060 <span class="comment"> KMO_TRY_EXIT_IF_ERROR(</span>
+<a name="l01061"></a>01061 <span class="comment"> kmo_reconstruct_sci(ifu_nr,</span>
+<a name="l01062"></a>01062 <span class="comment"> bounds[2*(ifu_nr-1)],</span>
+<a name="l01063"></a>01063 <span class="comment"> bounds[2*(ifu_nr-1)+1],</span>
+<a name="l01064"></a>01064 <span class="comment"> rec_frame,</span>
+<a name="l01065"></a>01065 <span class="comment"> input_frame_name,</span>
+<a name="l01066"></a>01066 <span class="comment"> NULL,</span>
+<a name="l01067"></a>01067 <span class="comment"> NULL,</span>
+<a name="l01068"></a>01068 <span class="comment"> NULL,</span>
+<a name="l01069"></a>01069 <span class="comment"> xcal_frame,</span>
+<a name="l01070"></a>01070 <span class="comment"> ycal_frame,</span>
+<a name="l01071"></a>01071 <span class="comment"> lcal_frame,</span>
+<a name="l01072"></a>01072 <span class="comment"> lcorr_coeffs,</span>
+<a name="l01073"></a>01073 <span class="comment"> &gd,</span>
+<a name="l01074"></a>01074 <span class="comment"> &cube_data,</span>
+<a name="l01075"></a>01075 <span class="comment"> &cube_noise,</span>
+<a name="l01076"></a>01076 <span class="comment"> flux,</span>
+<a name="l01077"></a>01077 <span class="comment"> background,</span>
+<a name="l01078"></a>01078 <span class="comment"> xcal_interpolation));</span>
+<a name="l01079"></a>01079 <span class="comment"></span>
+<a name="l01080"></a>01080 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
+<a name="l01081"></a>01081 <span class="comment"> obj_spectrum3 = kmo_lcorr_extract_spectrum(</span>
+<a name="l01082"></a>01082 <span class="comment"> cube_data, actual_sub_header, 0.8, NULL));</span>
+<a name="l01083"></a>01083 <span class="comment"></span>
+<a name="l01084"></a>01084 <span class="comment"> KMO_TRY_EXIT_IF_NULL(</span>
+<a name="l01085"></a>01085 <span class="comment"> lcorr_coeffs3 = kmo_lcorr_crosscorrelate_spectra(</span>
+<a name="l01086"></a>01086 <span class="comment"> obj_spectrum3, ref_spectrum, peaks, 0.002));</span>
+<a name="l01087"></a>01087 <span class="comment"></span>
+<a name="l01088"></a>01088 <span class="comment"> cpl_bivector_delete(obj_spectrum3);</span>
+<a name="l01089"></a>01089 <span class="comment"></span>
+<a name="l01090"></a>01090 <span class="comment"> coeff_dump[0] = 0;</span>
+<a name="l01091"></a>01091 <span class="comment"> for (ic=0; ic<=cpl_polynomial_get_degree(lcorr_coeffs3) && ic < max_coeffs; ic++) {</span>
+<a name="l01092"></a>01092 <span class="comment"> pows[0] = ic;</span>
+<a name="l01093"></a>01093 <span class="comment"> coeff_string = cpl_sprintf(" %*g,",</span>
+<a name="l01094"></a>01094 <span class="comment"> format_width-2, cpl_polynomial_get_coeff(lcorr_coeffs3,pows));</span>
+<a name="l01095"></a>01095 <span class="comment"> strncat(coeff_dump, coeff_string, format_width);</span>
+<a name="l01096"></a>01096 <span class="comment"> cpl_free(coeff_string);</span>
+<a name="l01097"></a>01097 <span class="comment"> }</span>
+<a name="l01098"></a>01098 <span class="comment"> cpl_msg_debug("","Lambda correction coeffs for iFu %d %s",ifu_nr, coeff_dump);</span>
+<a name="l01099"></a>01099 <span class="comment"> cpl_polynomial_delete(lcorr_coeffs3); lcorr_coeffs3=NULL;</span>
+<a name="l01100"></a>01100 <span class="comment">*/</span>
+<a name="l01101"></a>01101 cpl_polynomial_delete(lcorr_coeffs); lcorr_coeffs = NULL;
+<a name="l01102"></a>01102
+<a name="l01103"></a>01103 }
+<a name="l01104"></a>01104
+<a name="l01105"></a>01105 <span class="comment">// scale flux according to pixel_scale</span>
+<a name="l01106"></a>01106 KMO_TRY_EXIT_IF_NULL(
+<a name="l01107"></a>01107 tmp_img = cpl_imagelist_get(cube_data, 0));
+<a name="l01108"></a>01108 <span class="keywordtype">double</span> scaling = (cpl_image_get_size_x(tmp_img)*cpl_image_get_size_y(tmp_img)) /
+<a name="l01109"></a>01109 (KMOS_SLITLET_X*KMOS_SLITLET_Y);
+<a name="l01110"></a>01110 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01111"></a>01111 cpl_imagelist_divide_scalar(cube_data, scaling));
+<a name="l01112"></a>01112 <span class="keywordflow">if</span> (cube_noise != NULL) {
+<a name="l01113"></a>01113 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01114"></a>01114 cpl_imagelist_divide_scalar(cube_noise, scaling));
+<a name="l01115"></a>01115 }
+<a name="l01116"></a>01116 } <span class="keywordflow">else</span> {
+<a name="l01117"></a>01117 <span class="comment">// IFU is invalid</span>
+<a name="l01118"></a>01118 actual_sub_header = sub_header_orig;
+<a name="l01119"></a>01119 cpl_error_reset();
+<a name="l01120"></a>01120 } <span class="comment">// if ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) ..</span>
+<a name="l01121"></a>01121
+<a name="l01122"></a>01122 <span class="keywordflow">if</span> (detectorimage) {
+<a name="l01123"></a>01123 <span class="keywordflow">if</span> (cube_data != NULL) {
+<a name="l01124"></a>01124 <span class="keywordflow">for</span> (l = 0; l < gd.l.dim; l++) {
+<a name="l01125"></a>01125 KMO_TRY_EXIT_IF_NULL(
+<a name="l01126"></a>01126 slice = cpl_image_get_data_float(cpl_imagelist_get(cube_data, l)));
+<a name="l01127"></a>01127 <span class="keywordflow">for</span> (y = 0; y < gd.y.dim; y++) {
+<a name="l01128"></a>01128 <span class="keywordflow">for</span> (x = 0; x < gd.x.dim; x++) {
+<a name="l01129"></a>01129 <span class="keywordtype">int</span> ix = x +
+<a name="l01130"></a>01130 y * gd.x.dim +
+<a name="l01131"></a>01131 j * gd.x.dim*gd.y.dim + <span class="comment">//IFU offset</span>
+<a name="l01132"></a>01132 l * gd.x.dim*gd.y.dim*KMOS_IFUS_PER_DETECTOR;
+<a name="l01133"></a>01133 pdet_img_data[ix] = slice[x + y*gd.x.dim];
+<a name="l01134"></a>01134 }
+<a name="l01135"></a>01135 }
+<a name="l01136"></a>01136 }
+<a name="l01137"></a>01137 }
+<a name="l01138"></a>01138 <span class="keywordflow">if</span> (cube_noise != NULL) {
+<a name="l01139"></a>01139 <span class="keywordflow">if</span> (detectorimage) {
+<a name="l01140"></a>01140 detImgCube = TRUE;
+<a name="l01141"></a>01141 }
+<a name="l01142"></a>01142 <span class="keywordflow">for</span> (l = 0; l < gd.l.dim; l++) {
+<a name="l01143"></a>01143 KMO_TRY_EXIT_IF_NULL(
+<a name="l01144"></a>01144 slice = cpl_image_get_data_float(cpl_imagelist_get(cube_noise, l)));
+<a name="l01145"></a>01145 <span class="keywordflow">for</span> (y = 0; y < gd.y.dim; y++) {
+<a name="l01146"></a>01146 <span class="keywordflow">for</span> (x = 0; x < gd.x.dim; x++) {
+<a name="l01147"></a>01147 <span class="keywordtype">int</span> ix = x +
+<a name="l01148"></a>01148 y * gd.x.dim +
+<a name="l01149"></a>01149 j * gd.x.dim*gd.y.dim + <span class="comment">//IFU offset</span>
+<a name="l01150"></a>01150 l * gd.x.dim*gd.y.dim*KMOS_IFUS_PER_DETECTOR;
+<a name="l01151"></a>01151 pdet_img_noise[ix] = slice[x + y*gd.x.dim];
+<a name="l01152"></a>01152 }
+<a name="l01153"></a>01153 }
+<a name="l01154"></a>01154 }
+<a name="l01155"></a>01155 }
+<a name="l01156"></a>01156 }
+<a name="l01157"></a>01157
+<a name="l01158"></a>01158 <span class="comment">// save output</span>
+<a name="l01159"></a>01159 KMO_TRY_EXIT_IF_NULL(
+<a name="l01160"></a>01160 extname = kmo_extname_creator(ifu_frame, ifu_nr,
+<a name="l01161"></a>01161 EXT_DATA));
+<a name="l01162"></a>01162
+<a name="l01163"></a>01163 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01164"></a>01164 kmclipm_update_property_string(actual_sub_header,
+<a name="l01165"></a>01165 EXTNAME,
+<a name="l01166"></a>01166 extname,
+<a name="l01167"></a>01167 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01168"></a>01168
+<a name="l01169"></a>01169 cpl_free(extname); extname = NULL;
+<a name="l01170"></a>01170
+<a name="l01171"></a>01171 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01172"></a>01172 kmo_dfs_save_cube(cube_data, filename_cube, obs_suffix,
+<a name="l01173"></a>01173 actual_sub_header, 0./0.));
+<a name="l01174"></a>01174
+<a name="l01175"></a>01175 <span class="keywordflow">if</span> (cube_noise != NULL) {
+<a name="l01176"></a>01176 KMO_TRY_EXIT_IF_NULL(
+<a name="l01177"></a>01177 extname = kmo_extname_creator(ifu_frame, ifu_nr,
+<a name="l01178"></a>01178 EXT_NOISE));
+<a name="l01179"></a>01179
+<a name="l01180"></a>01180 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01181"></a>01181 kmclipm_update_property_string(actual_sub_header,
+<a name="l01182"></a>01182 EXTNAME,
+<a name="l01183"></a>01183 extname,
+<a name="l01184"></a>01184 <span class="stringliteral">"FITS extension name"</span>));
<a name="l01185"></a>01185
-<a name="l01186"></a>01186 cpl_imagelist_delete(cube_data); cube_data = NULL;
-<a name="l01187"></a>01187 cpl_imagelist_delete(cube_noise); cube_noise = NULL;
-<a name="l01188"></a>01188 cpl_propertylist_delete(sub_header); sub_header = NULL;
-<a name="l01189"></a>01189 cpl_propertylist_delete(sub_header_orig); sub_header_orig = NULL;
-<a name="l01190"></a>01190 } <span class="comment">// for j IFUs</span>
-<a name="l01191"></a>01191
-<a name="l01192"></a>01192 <span class="keywordflow">if</span> (detectorimage) {
-<a name="l01193"></a>01193 index = kmo_identify_index(cpl_frame_get_filename(rec_frame),
-<a name="l01194"></a>01194 i, FALSE);
-<a name="l01195"></a>01195 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01196"></a>01196
-<a name="l01197"></a>01197 KMO_TRY_EXIT_IF_NULL(
-<a name="l01198"></a>01198 tmp_header = kmclipm_propertylist_load(
-<a name="l01199"></a>01199 cpl_frame_get_filename(rec_frame), index));
-<a name="l01200"></a>01200 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01201"></a>01201 kmo_save_det_img_ext(det_img_data[i-1], gd, i, filename_img,
-<a name="l01202"></a>01202 obs_suffix, tmp_header, dev_flip, FALSE));
-<a name="l01203"></a>01203 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
-<a name="l01204"></a>01204
-<a name="l01205"></a>01205 <span class="keywordflow">if</span> (detImgCube) {
-<a name="l01206"></a>01206 <span class="keywordflow">if</span> (desc1.ex_noise) {
-<a name="l01207"></a>01207 index = kmo_identify_index(cpl_frame_get_filename(rec_frame),
-<a name="l01208"></a>01208 i, TRUE);
-<a name="l01209"></a>01209 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01210"></a>01210 } <span class="keywordflow">else</span> {
-<a name="l01211"></a>01211 <span class="comment">// use same index as for data frame, since input frame</span>
-<a name="l01212"></a>01212 <span class="comment">// has just 3 extensions</span>
-<a name="l01213"></a>01213 }
-<a name="l01214"></a>01214 KMO_TRY_EXIT_IF_NULL(
-<a name="l01215"></a>01215 tmp_header = kmclipm_propertylist_load(
-<a name="l01216"></a>01216 cpl_frame_get_filename(rec_frame), index));
-<a name="l01217"></a>01217 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01218"></a>01218 kmo_save_det_img_ext(det_img_noise[i-1], gd, i, filename_img,
-<a name="l01219"></a>01219 obs_suffix, tmp_header, dev_flip, TRUE));
-<a name="l01220"></a>01220 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
-<a name="l01221"></a>01221 }
-<a name="l01222"></a>01222 }
-<a name="l01223"></a>01223
-<a name="l01224"></a>01224 <span class="comment">// free memory</span>
-<a name="l01225"></a>01225 cpl_imagelist_delete(cube_data); cube_data = NULL;
-<a name="l01226"></a>01226 cpl_imagelist_delete(cube_noise); cube_noise = NULL;
-<a name="l01227"></a>01227 cpl_propertylist_delete(sub_header); sub_header = NULL;
-<a name="l01228"></a>01228 cpl_propertylist_delete(sub_header_orig); sub_header_orig = NULL;
-<a name="l01229"></a>01229 } <span class="comment">// for i devices</span>
-<a name="l01230"></a>01230 }
-<a name="l01231"></a>01231 KMO_CATCH
-<a name="l01232"></a>01232 {
-<a name="l01233"></a>01233 KMO_CATCH_MSG();
-<a name="l01234"></a>01234 ret_val = -1;
-<a name="l01235"></a>01235 }
-<a name="l01236"></a>01236
-<a name="l01237"></a>01237 kmo_free_fits_desc(&desc1);
-<a name="l01238"></a>01238 kmo_free_fits_desc(&desc2);
-<a name="l01239"></a>01239 <span class="keywordflow">for</span> (i = 0; i < KMOS_NR_DETECTORS; i++) {
-<a name="l01240"></a>01240 cpl_image_delete(det_img_data[i]); det_img_data[i] = NULL;
-<a name="l01241"></a>01241 cpl_image_delete(det_img_noise[i]); det_img_noise[i] = NULL;
+<a name="l01186"></a>01186 cpl_free(extname); extname = NULL;
+<a name="l01187"></a>01187
+<a name="l01188"></a>01188 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01189"></a>01189 kmo_dfs_save_cube(cube_noise, filename_cube, obs_suffix,
+<a name="l01190"></a>01190 actual_sub_header, 0./0.));
+<a name="l01191"></a>01191 }
+<a name="l01192"></a>01192
+<a name="l01193"></a>01193 cpl_imagelist_delete(cube_data); cube_data = NULL;
+<a name="l01194"></a>01194 cpl_imagelist_delete(cube_noise); cube_noise = NULL;
+<a name="l01195"></a>01195 cpl_propertylist_delete(sub_header); sub_header = NULL;
+<a name="l01196"></a>01196 cpl_propertylist_delete(sub_header_orig); sub_header_orig = NULL;
+<a name="l01197"></a>01197 } <span class="comment">// for j IFUs</span>
+<a name="l01198"></a>01198
+<a name="l01199"></a>01199 <span class="keywordflow">if</span> (detectorimage) {
+<a name="l01200"></a>01200 index = kmo_identify_index(cpl_frame_get_filename(rec_frame),
+<a name="l01201"></a>01201 i, FALSE);
+<a name="l01202"></a>01202 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01203"></a>01203
+<a name="l01204"></a>01204 KMO_TRY_EXIT_IF_NULL(
+<a name="l01205"></a>01205 tmp_header = kmclipm_propertylist_load(
+<a name="l01206"></a>01206 cpl_frame_get_filename(rec_frame), index));
+<a name="l01207"></a>01207 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01208"></a>01208 kmo_save_det_img_ext(det_img_data[i-1], gd, i, filename_img,
+<a name="l01209"></a>01209 obs_suffix, tmp_header, dev_flip, FALSE));
+<a name="l01210"></a>01210 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l01211"></a>01211
+<a name="l01212"></a>01212 <span class="keywordflow">if</span> (detImgCube) {
+<a name="l01213"></a>01213 <span class="keywordflow">if</span> (desc1.ex_noise) {
+<a name="l01214"></a>01214 index = kmo_identify_index(cpl_frame_get_filename(rec_frame),
+<a name="l01215"></a>01215 i, TRUE);
+<a name="l01216"></a>01216 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01217"></a>01217 } <span class="keywordflow">else</span> {
+<a name="l01218"></a>01218 <span class="comment">// use same index as for data frame, since input frame</span>
+<a name="l01219"></a>01219 <span class="comment">// has just 3 extensions</span>
+<a name="l01220"></a>01220 }
+<a name="l01221"></a>01221 KMO_TRY_EXIT_IF_NULL(
+<a name="l01222"></a>01222 tmp_header = kmclipm_propertylist_load(
+<a name="l01223"></a>01223 cpl_frame_get_filename(rec_frame), index));
+<a name="l01224"></a>01224 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01225"></a>01225 kmo_save_det_img_ext(det_img_noise[i-1], gd, i, filename_img,
+<a name="l01226"></a>01226 obs_suffix, tmp_header, dev_flip, TRUE));
+<a name="l01227"></a>01227 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l01228"></a>01228 }
+<a name="l01229"></a>01229 }
+<a name="l01230"></a>01230
+<a name="l01231"></a>01231 <span class="comment">// free memory</span>
+<a name="l01232"></a>01232 cpl_imagelist_delete(cube_data); cube_data = NULL;
+<a name="l01233"></a>01233 cpl_imagelist_delete(cube_noise); cube_noise = NULL;
+<a name="l01234"></a>01234 cpl_propertylist_delete(sub_header); sub_header = NULL;
+<a name="l01235"></a>01235 cpl_propertylist_delete(sub_header_orig); sub_header_orig = NULL;
+<a name="l01236"></a>01236 } <span class="comment">// for i devices</span>
+<a name="l01237"></a>01237 }
+<a name="l01238"></a>01238 KMO_CATCH
+<a name="l01239"></a>01239 {
+<a name="l01240"></a>01240 KMO_CATCH_MSG();
+<a name="l01241"></a>01241 ret_val = -1;
<a name="l01242"></a>01242 }
-<a name="l01243"></a>01243 cpl_free(my_filter_id); my_filter_id = NULL;
-<a name="l01244"></a>01244 cpl_free(bounds); bounds = NULL;
-<a name="l01245"></a>01245 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l01246"></a>01246 cpl_propertylist_delete(sub_header); sub_header = NULL;
-<a name="l01247"></a>01247 cpl_propertylist_delete(sub_header_orig); sub_header_orig = NULL;
-<a name="l01248"></a>01248 cpl_imagelist_delete(cube_data); cube_data = NULL;
-<a name="l01249"></a>01249 cpl_imagelist_delete(cube_noise); cube_noise = NULL;
-<a name="l01250"></a>01250 cpl_free(obs_suffix); obs_suffix = NULL;
-<a name="l01251"></a>01251 cpl_free(suffix); suffix = NULL;
-<a name="l01252"></a>01252 cpl_free(filename_img); filename_img = NULL;
-<a name="l01253"></a>01253 cpl_free(filename_cube); filename_cube = NULL;
-<a name="l01254"></a>01254 <span class="comment">// sat_mode_msg = FALSE;</span>
-<a name="l01255"></a>01255
-<a name="l01256"></a>01256 <span class="keywordflow">return</span> ret_val;
-<a name="l01257"></a>01257 }
-<a name="l01258"></a>01258
+<a name="l01243"></a>01243
+<a name="l01244"></a>01244 kmo_free_fits_desc(&desc1);
+<a name="l01245"></a>01245 kmo_free_fits_desc(&desc2);
+<a name="l01246"></a>01246 <span class="keywordflow">for</span> (i = 0; i < KMOS_NR_DETECTORS; i++) {
+<a name="l01247"></a>01247 cpl_image_delete(det_img_data[i]); det_img_data[i] = NULL;
+<a name="l01248"></a>01248 cpl_image_delete(det_img_noise[i]); det_img_noise[i] = NULL;
+<a name="l01249"></a>01249 }
+<a name="l01250"></a>01250 cpl_free(my_filter_id); my_filter_id = NULL;
+<a name="l01251"></a>01251 cpl_free(bounds); bounds = NULL;
+<a name="l01252"></a>01252 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l01253"></a>01253 cpl_propertylist_delete(sub_header); sub_header = NULL;
+<a name="l01254"></a>01254 cpl_propertylist_delete(sub_header_orig); sub_header_orig = NULL;
+<a name="l01255"></a>01255 cpl_imagelist_delete(cube_data); cube_data = NULL;
+<a name="l01256"></a>01256 cpl_imagelist_delete(cube_noise); cube_noise = NULL;
+<a name="l01257"></a>01257 cpl_free(obs_suffix); obs_suffix = NULL;
+<a name="l01258"></a>01258 cpl_free(suffix); suffix = NULL;
+<a name="l01259"></a>01259 cpl_free(filename_img); filename_img = NULL;
+<a name="l01260"></a>01260 cpl_free(filename_cube); filename_cube = NULL;
+<a name="l01261"></a>01261 <span class="comment">// sat_mode_msg = FALSE;</span>
+<a name="l01262"></a>01262
+<a name="l01263"></a>01263 <span class="keywordflow">return</span> ret_val;
+<a name="l01264"></a>01264 }
+<a name="l01265"></a>01265
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__rotate_8c_source.html b/html/kmo__rotate_8c_source.html
index f51e1c5..bed4720 100644
--- a/html/kmo__rotate_8c_source.html
+++ b/html/kmo__rotate_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_rotate.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_rotate.c,v 1.12 2013/06/07 15:41:21 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_rotate.c,v 1.12 2013-06-07 15:41:21 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/06/07 15:41:21 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-06-07 15:41:21 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.12 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -581,7 +581,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__sci__red_8c_source.html b/html/kmo__sci__red_8c_source.html
index 7689e7f..d5f32a9 100644
--- a/html/kmo__sci__red_8c_source.html
+++ b/html/kmo__sci__red_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_sci_red.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_sci_red.c,v 1.86 2013/08/07 11:09:26 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_sci_red.c,v 1.92 2013-10-08 14:55:01 erw Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -81,10 +81,10 @@
<a name="l00019"></a>00019 <span class="comment"> */</span>
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
-<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/08/07 11:09:26 $</span>
-<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.86 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: erw $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-10-08 14:55:01 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.92 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -147,1726 +147,1726 @@
<a name="l00085"></a>00085 <span class="stringliteral">"For exposures taken with the templates KMOS_spec_obs_mapping8 and\n"</span>
<a name="l00086"></a>00086 <span class="stringliteral">"KMOS_spec_obs_mapping24 the recipe behaves a bit different: All active IFUs\n"</span>
<a name="l00087"></a>00087 <span class="stringliteral">"will be combined, regardless of the object names.\n"</span>
-<a name="l00088"></a>00088 <span class="stringliteral">"This recipe must be called after the kmo_std_star-recipe.\n"</span>
-<a name="l00089"></a>00089 <span class="stringliteral">"\n"</span>
-<a name="l00090"></a>00090 <span class="stringliteral">"BASIC PARAMETERS:\n"</span>
-<a name="l00091"></a>00091 <span class="stringliteral">"-----------------\n"</span>
-<a name="l00092"></a>00092 <span class="stringliteral">"--imethod\n"</span>
-<a name="l00093"></a>00093 <span class="stringliteral">"The interpolation method used for reconstruction.\n"</span>
-<a name="l00094"></a>00094 <span class="stringliteral">"\n"</span>
-<a name="l00095"></a>00095 <span class="stringliteral">"--smethod\n"</span>
-<a name="l00096"></a>00096 <span class="stringliteral">"The interpolation method used for shifting.\n"</span>
-<a name="l00097"></a>00097 <span class="stringliteral">"\n"</span>
-<a name="l00098"></a>00098 <span class="stringliteral">"ADVANCED PARAMETERS\n"</span>
-<a name="l00099"></a>00099 <span class="stringliteral">"-------------------\n"</span>
-<a name="l00100"></a>00100 <span class="stringliteral">"--flux\n"</span>
-<a name="l00101"></a>00101 <span class="stringliteral">"Specify if flux conservation should be applied.\n"</span>
-<a name="l00102"></a>00102 <span class="stringliteral">"\n"</span>
-<a name="l00103"></a>00103 <span class="stringliteral">"--background\n"</span>
-<a name="l00104"></a>00104 <span class="stringliteral">"Specify if background removal should be applied.\n"</span>
-<a name="l00105"></a>00105 <span class="stringliteral">"\n"</span>
-<a name="l00106"></a>00106 <span class="stringliteral">"--suppress_extension\n"</span>
-<a name="l00107"></a>00107 <span class="stringliteral">"If set to TRUE, the arbitrary filename extensions are supressed. If multiple\n"</span>
-<a name="l00108"></a>00108 <span class="stringliteral">"products with the same category are produced, they will be numered consecutively\n"</span>
-<a name="l00109"></a>00109 <span class="stringliteral">"starting from 0.\n"</span>
-<a name="l00110"></a>00110 <span class="stringliteral">"\n"</span>
-<a name="l00111"></a>00111 <span class="stringliteral">"--sky_tweak\n"</span>
-<a name="l00112"></a>00112 <span class="stringliteral">"If set to TRUE sky substraction is not done by subtracting the corresponding\n"</span>
-<a name="l00113"></a>00113 <span class="stringliteral">"detector images but subtracting a modified sky cube from the object cube.\n"</span>
-<a name="l00114"></a>00114 <span class="stringliteral">"It is not allowed that \"--sky_tweak\" and \"--no_subtract\" both are TRUE.\n"</span>
-<a name="l00115"></a>00115 <span class="stringliteral">"\n"</span>
-<a name="l00116"></a>00116 <span class="stringliteral">" Advanced reconstruction parameters\n"</span>
-<a name="l00117"></a>00117 <span class="stringliteral">" ----------------------------------\n"</span>
-<a name="l00118"></a>00118 <span class="stringliteral">"--neighborhoodRange\n"</span>
-<a name="l00119"></a>00119 <span class="stringliteral">"Defines the range to search for neighbors during reconstruction\n"</span>
-<a name="l00120"></a>00120 <span class="stringliteral">"\n"</span>
-<a name="l00121"></a>00121 <span class="stringliteral">"--b_samples\n"</span>
-<a name="l00122"></a>00122 <span class="stringliteral">"The number of samples in spectral direction for the reconstructed cube.\n"</span>
-<a name="l00123"></a>00123 <span class="stringliteral">"Ideally this number should be greater than 2048, the detector size.\n"</span>
-<a name="l00124"></a>00124 <span class="stringliteral">"\n"</span>
-<a name="l00125"></a>00125 <span class="stringliteral">"--b_start\n"</span>
-<a name="l00126"></a>00126 <span class="stringliteral">"--b_end\n"</span>
-<a name="l00127"></a>00127 <span class="stringliteral">"Used to define manually the start and end wavelength for the reconstructed\n"</span>
-<a name="l00128"></a>00128 <span class="stringliteral">"cube. By default the internally defined values are used.\n"</span>
-<a name="l00129"></a>00129 <span class="stringliteral">"\n"</span>
-<a name="l00130"></a>00130 <span class="stringliteral">"--fast_mode\n"</span>
-<a name="l00131"></a>00131 <span class="stringliteral">"If set to TRUE, the reconstructed cubes will be collapsed (using median) and\n"</span>
-<a name="l00132"></a>00132 <span class="stringliteral">"only then be shifted and combined.\n"</span>
-<a name="l00133"></a>00133 <span class="stringliteral">"\n"</span>
-<a name="l00134"></a>00134 <span class="stringliteral">"--pix_scale\n"</span>
-<a name="l00135"></a>00135 <span class="stringliteral">"Change the pixel scale [arcsec]. Default of 0.2\" results into cubes of\n"</span>
-<a name="l00136"></a>00136 <span class="stringliteral">"14x14pix, a scale of 0.1\" results into cubes of 28x28pix, etc.\n"</span>
-<a name="l00137"></a>00137 <span class="stringliteral">"\n"</span>
-<a name="l00138"></a>00138 <span class="stringliteral">" Advanced combining parameters\n"</span>
-<a name="l00139"></a>00139 <span class="stringliteral">" ----------------------------------\n"</span>
-<a name="l00140"></a>00140 <span class="stringliteral">"--edge_nan\n"</span>
-<a name="l00141"></a>00141 <span class="stringliteral">"Set borders of two sides of the cubes to NaN before combining them. This minimises\n"</span>
-<a name="l00142"></a>00142 <span class="stringliteral">"unwanted border effects when dithering.\n"</span>
-<a name="l00143"></a>00143 <span class="stringliteral">"\n"</span>
-<a name="l00144"></a>00144 <span class="stringliteral">"--no_combine\n"</span>
-<a name="l00145"></a>00145 <span class="stringliteral">"If set to TRUE, the reconstructed cubes will not be combined.\n"</span>
-<a name="l00146"></a>00146 <span class="stringliteral">"\n"</span>
-<a name="l00147"></a>00147 <span class="stringliteral">"--no_subtract\n"</span>
-<a name="l00148"></a>00148 <span class="stringliteral">"If set to TRUE, the found objects and references won't be sky subtracted. \n"</span>
-<a name="l00149"></a>00149 <span class="stringliteral">"Additionally all IFUs will be reconstructed, even the ones containing skies. \n"</span>
-<a name="l00150"></a>00150 <span class="stringliteral">"This option sets the parameter no_combine to TRUE automatically.\n"</span>
-<a name="l00151"></a>00151 <span class="stringliteral">"\n"</span>
-<a name="l00152"></a>00152 <span class="stringliteral">"--name\n"</span>
-<a name="l00153"></a>00153 <span class="stringliteral">"--ifus\n"</span>
-<a name="l00154"></a>00154 <span class="stringliteral">"Since an object can be present only once per exposure and since it can be\n"</span>
-<a name="l00155"></a>00155 <span class="stringliteral">"located in different IFUs for the existing exposures, there are two modes to\n"</span>
-<a name="l00156"></a>00156 <span class="stringliteral">"identify the objects:\n"</span>
-<a name="l00157"></a>00157 <span class="stringliteral">" * Combine by object names (default)\n"</span>
-<a name="l00158"></a>00158 <span class="stringliteral">" In this case the object name must be provided via the --name parameter. The\n"</span>
-<a name="l00159"></a>00159 <span class="stringliteral">" object name will be searched for in all primary headers of all provided\n"</span>
-<a name="l00160"></a>00160 <span class="stringliteral">" frames in the keyword ESO OCS ARMx NAME.\n"</span>
-<a name="l00161"></a>00161 <span class="stringliteral">"\n"</span>
-<a name="l00162"></a>00162 <span class="stringliteral">" * Combine by index (advanced)\n"</span>
-<a name="l00163"></a>00163 <span class="stringliteral">" In this case the --ifus parameter must be provided. The parameter must have\n"</span>
-<a name="l00164"></a>00164 <span class="stringliteral">" the same number of entries as frames are provided, e.g. \"3;1;24\" for 3\n"</span>
-<a name="l00165"></a>00165 <span class="stringliteral">" exposures. The index doesn't reference the extension in the frame but the\n"</span>
-<a name="l00166"></a>00166 <span class="stringliteral">" real index of the IFU as defined in the EXTNAME keyword.\n"</span>
-<a name="l00167"></a>00167 <span class="stringliteral">" (e.g. 'IFU.3.DATA')\n"</span>
-<a name="l00168"></a>00168 <span class="stringliteral">"\n"</span>
-<a name="l00169"></a>00169 <span class="stringliteral">"--method\n"</span>
-<a name="l00170"></a>00170 <span class="stringliteral">"There are following sources to get the shift parameters from:\n"</span>
-<a name="l00171"></a>00171 <span class="stringliteral">" * 'header' (default)\n"</span>
-<a name="l00172"></a>00172 <span class="stringliteral">" The shifts are calculated according to the WCS information stored in the\n"</span>
-<a name="l00173"></a>00173 <span class="stringliteral">" header of every IFU. The output frame will get larger, except the object is\n"</span>
-<a name="l00174"></a>00174 <span class="stringliteral">" at the exact same position for all exposures. The size of the exposures can\n"</span>
-<a name="l00175"></a>00175 <span class="stringliteral">" differ, but the orientation must be the same for all exposures.\n"</span>
+<a name="l00088"></a>00088 <span class="stringliteral">"\n"</span>
+<a name="l00089"></a>00089 <span class="stringliteral">"BASIC PARAMETERS:\n"</span>
+<a name="l00090"></a>00090 <span class="stringliteral">"-----------------\n"</span>
+<a name="l00091"></a>00091 <span class="stringliteral">"--imethod\n"</span>
+<a name="l00092"></a>00092 <span class="stringliteral">"The interpolation method used for reconstruction.\n"</span>
+<a name="l00093"></a>00093 <span class="stringliteral">"\n"</span>
+<a name="l00094"></a>00094 <span class="stringliteral">"--smethod\n"</span>
+<a name="l00095"></a>00095 <span class="stringliteral">"The interpolation method used for shifting.\n"</span>
+<a name="l00096"></a>00096 <span class="stringliteral">"\n"</span>
+<a name="l00097"></a>00097 <span class="stringliteral">"--name\n"</span>
+<a name="l00098"></a>00098 <span class="stringliteral">"--ifus\n"</span>
+<a name="l00099"></a>00099 <span class="stringliteral">"Since an object can be present only once per exposure and since it can be\n"</span>
+<a name="l00100"></a>00100 <span class="stringliteral">"located in different IFUs for the existing exposures, there are two modes to\n"</span>
+<a name="l00101"></a>00101 <span class="stringliteral">"identify the objects:\n"</span>
+<a name="l00102"></a>00102 <span class="stringliteral">" * Combine by object names (default)\n"</span>
+<a name="l00103"></a>00103 <span class="stringliteral">" In this case the object name must be provided via the --name parameter. The\n"</span>
+<a name="l00104"></a>00104 <span class="stringliteral">" object name will be searched for in all primary headers of all provided\n"</span>
+<a name="l00105"></a>00105 <span class="stringliteral">" frames in the keyword ESO OCS ARMx NAME.\n"</span>
+<a name="l00106"></a>00106 <span class="stringliteral">"\n"</span>
+<a name="l00107"></a>00107 <span class="stringliteral">" * Combine by index (advanced)\n"</span>
+<a name="l00108"></a>00108 <span class="stringliteral">" In this case the --ifus parameter must be provided. The parameter must have\n"</span>
+<a name="l00109"></a>00109 <span class="stringliteral">" the same number of entries as frames are provided, e.g. \"3;1;24\" for 3\n"</span>
+<a name="l00110"></a>00110 <span class="stringliteral">" exposures. The index doesn't reference the extension in the frame but the\n"</span>
+<a name="l00111"></a>00111 <span class="stringliteral">" real index of the IFU as defined in the EXTNAME keyword.\n"</span>
+<a name="l00112"></a>00112 <span class="stringliteral">" (e.g. 'IFU.3.DATA')\n"</span>
+<a name="l00113"></a>00113 <span class="stringliteral">"\n"</span>
+<a name="l00114"></a>00114 <span class="stringliteral">"ADVANCED PARAMETERS\n"</span>
+<a name="l00115"></a>00115 <span class="stringliteral">"-------------------\n"</span>
+<a name="l00116"></a>00116 <span class="stringliteral">"--flux\n"</span>
+<a name="l00117"></a>00117 <span class="stringliteral">"Specify if flux conservation should be applied.\n"</span>
+<a name="l00118"></a>00118 <span class="stringliteral">"\n"</span>
+<a name="l00119"></a>00119 <span class="stringliteral">"--background\n"</span>
+<a name="l00120"></a>00120 <span class="stringliteral">"Specify if background removal should be applied.\n"</span>
+<a name="l00121"></a>00121 <span class="stringliteral">"\n"</span>
+<a name="l00122"></a>00122 <span class="stringliteral">"--suppress_extension\n"</span>
+<a name="l00123"></a>00123 <span class="stringliteral">"If set to TRUE, the arbitrary filename extensions are supressed. If multiple\n"</span>
+<a name="l00124"></a>00124 <span class="stringliteral">"products with the same category are produced, they will be numered consecutively\n"</span>
+<a name="l00125"></a>00125 <span class="stringliteral">"starting from 0.\n"</span>
+<a name="l00126"></a>00126 <span class="stringliteral">"\n"</span>
+<a name="l00127"></a>00127 <span class="stringliteral">"--sky_tweak\n"</span>
+<a name="l00128"></a>00128 <span class="stringliteral">"If set to TRUE sky substraction is not done by subtracting the corresponding\n"</span>
+<a name="l00129"></a>00129 <span class="stringliteral">"detector images but subtracting a modified sky cube from the object cube.\n"</span>
+<a name="l00130"></a>00130 <span class="stringliteral">"It is not allowed that \"--sky_tweak\" and \"--no_subtract\" both are TRUE.\n"</span>
+<a name="l00131"></a>00131 <span class="stringliteral">"\n"</span>
+<a name="l00132"></a>00132 <span class="stringliteral">"--tbsub\n"</span>
+<a name="l00133"></a>00133 <span class="stringliteral">"If set to TRUE subtract the thermal background from the cube resulting from sky tweaking.\n"</span>
+<a name="l00134"></a>00134 <span class="stringliteral">"Default value is TRUE.\n"</span>
+<a name="l00135"></a>00135 <span class="stringliteral">"\n"</span>
+<a name="l00136"></a>00136 <span class="stringliteral">" Advanced reconstruction parameters\n"</span>
+<a name="l00137"></a>00137 <span class="stringliteral">" ----------------------------------\n"</span>
+<a name="l00138"></a>00138 <span class="stringliteral">"--neighborhoodRange\n"</span>
+<a name="l00139"></a>00139 <span class="stringliteral">"Defines the range to search for neighbors during reconstruction\n"</span>
+<a name="l00140"></a>00140 <span class="stringliteral">"\n"</span>
+<a name="l00141"></a>00141 <span class="stringliteral">"--b_samples\n"</span>
+<a name="l00142"></a>00142 <span class="stringliteral">"The number of samples in spectral direction for the reconstructed cube.\n"</span>
+<a name="l00143"></a>00143 <span class="stringliteral">"Ideally this number should be greater than 2048, the detector size.\n"</span>
+<a name="l00144"></a>00144 <span class="stringliteral">"\n"</span>
+<a name="l00145"></a>00145 <span class="stringliteral">"--b_start\n"</span>
+<a name="l00146"></a>00146 <span class="stringliteral">"--b_end\n"</span>
+<a name="l00147"></a>00147 <span class="stringliteral">"Used to define manually the start and end wavelength for the reconstructed\n"</span>
+<a name="l00148"></a>00148 <span class="stringliteral">"cube. By default the internally defined values are used.\n"</span>
+<a name="l00149"></a>00149 <span class="stringliteral">"\n"</span>
+<a name="l00150"></a>00150 <span class="stringliteral">"--fast_mode\n"</span>
+<a name="l00151"></a>00151 <span class="stringliteral">"If set to TRUE, the reconstructed cubes will be collapsed (using median) and\n"</span>
+<a name="l00152"></a>00152 <span class="stringliteral">"only then be shifted and combined.\n"</span>
+<a name="l00153"></a>00153 <span class="stringliteral">"\n"</span>
+<a name="l00154"></a>00154 <span class="stringliteral">"--pix_scale\n"</span>
+<a name="l00155"></a>00155 <span class="stringliteral">"Change the pixel scale [arcsec]. Default of 0.2\" results into cubes of\n"</span>
+<a name="l00156"></a>00156 <span class="stringliteral">"14x14pix, a scale of 0.1\" results into cubes of 28x28pix, etc.\n"</span>
+<a name="l00157"></a>00157 <span class="stringliteral">"\n"</span>
+<a name="l00158"></a>00158 <span class="stringliteral">"--no_subtract\n"</span>
+<a name="l00159"></a>00159 <span class="stringliteral">"If set to TRUE, the found objects and references won't be sky subtracted. \n"</span>
+<a name="l00160"></a>00160 <span class="stringliteral">"Additionally all IFUs will be reconstructed, even the ones containing skies. \n"</span>
+<a name="l00161"></a>00161 <span class="stringliteral">"This option sets the parameter no_combine to TRUE automatically.\n"</span>
+<a name="l00162"></a>00162 <span class="stringliteral">"\n"</span>
+<a name="l00163"></a>00163 <span class="stringliteral">"--xcal_interpolation\n"</span>
+<a name="l00164"></a>00164 <span class="stringliteral">"If true interpolate the pixel position in the slitlet (xcal) using the two\n"</span>
+<a name="l00165"></a>00165 <span class="stringliteral">"closest rotator angles in the calibration file. Otherwise take the values\n"</span>
+<a name="l00166"></a>00166 <span class="stringliteral">"of the closest rotator angle\n"</span>
+<a name="l00167"></a>00167 <span class="stringliteral">"\n"</span>
+<a name="l00168"></a>00168 <span class="stringliteral">"--extrapolate\n"</span>
+<a name="l00169"></a>00169 <span class="stringliteral">"By default no extrapolation is applied. This means that the intermediate\n"</span>
+<a name="l00170"></a>00170 <span class="stringliteral">"reconstructed cubes will shrink at most one pixel, which is ok for templates\n"</span>
+<a name="l00171"></a>00171 <span class="stringliteral">"like KMOS_spec_obs_nodtosky or KMOS_spec_obs_freedither. When the cubes will be\n"</span>
+<a name="l00172"></a>00172 <span class="stringliteral">"arranged as a map, a grid is likely to occur between the IFUs. Therefore extra-\n"</span>
+<a name="l00173"></a>00173 <span class="stringliteral">"polation during the shifting process can be switched on in order to get IFUs of\n"</span>
+<a name="l00174"></a>00174 <span class="stringliteral">"original size. For frames taken with mapping templates, extrapolation is\n"</span>
+<a name="l00175"></a>00175 <span class="stringliteral">"switched on automatically.\n"</span>
<a name="l00176"></a>00176 <span class="stringliteral">"\n"</span>
-<a name="l00177"></a>00177 <span class="stringliteral">" * 'none'\n"</span>
-<a name="l00178"></a>00178 <span class="stringliteral">" The cubes are directly recombined, not shifting at all. The ouput frame\n"</span>
-<a name="l00179"></a>00179 <span class="stringliteral">" will have the same dimensions as the input cubes.\n"</span>
-<a name="l00180"></a>00180 <span class="stringliteral">" If the size differs a warning will be emitted and the cubes will be aligned\n"</span>
-<a name="l00181"></a>00181 <span class="stringliteral">" to the lower left corner. If the orientation differs a warning will be\n"</span>
-<a name="l00182"></a>00182 <span class="stringliteral">" emitted, but the cubes are combined anyway.\n"</span>
-<a name="l00183"></a>00183 <span class="stringliteral">"\n"</span>
-<a name="l00184"></a>00184 <span class="stringliteral">" * 'center'\n"</span>
-<a name="l00185"></a>00185 <span class="stringliteral">" The shifts are calculated using a centering algorithm. The cube will be\n"</span>
-<a name="l00186"></a>00186 <span class="stringliteral">" collapsed and a 2D profile will be fitted to it to identify the centre.\n"</span>
-<a name="l00187"></a>00187 <span class="stringliteral">" With the parameter --fmethod the function to fit can be provided. The size\n"</span>
-<a name="l00188"></a>00188 <span class="stringliteral">" of the exposures can differ, but the orientation must be the same for all\n"</span>
-<a name="l00189"></a>00189 <span class="stringliteral">" exposures.\n"</span>
-<a name="l00190"></a>00190 <span class="stringliteral">"\n"</span>
-<a name="l00191"></a>00191 <span class="stringliteral">" * 'user'\n"</span>
-<a name="l00192"></a>00192 <span class="stringliteral">" Read the shifts from a user specified file. The path of the file must be\n"</span>
-<a name="l00193"></a>00193 <span class="stringliteral">" provided using the --filename parameter. For every exposure (except the\n"</span>
-<a name="l00194"></a>00194 <span class="stringliteral">" first one) two shift values are expected per line, they have to be separa-\n"</span>
-<a name="l00195"></a>00195 <span class="stringliteral">" ted with simple spaces. The values indicate pixel shifts and are referenced\n"</span>
-<a name="l00196"></a>00196 <span class="stringliteral">" to the first frame. The 1st value is the shift in x-direction to the left,\n"</span>
-<a name="l00197"></a>00197 <span class="stringliteral">" the 2nd the shift in y-direction upwards. The size of the exposures can\n"</span>
-<a name="l00198"></a>00198 <span class="stringliteral">" differ, but the orientation must be the same for all exposures.\n"</span>
-<a name="l00199"></a>00199 <span class="stringliteral">"\n"</span>
-<a name="l00200"></a>00200 <span class="stringliteral">"--fmethod\n"</span>
-<a name="l00201"></a>00201 <span class="stringliteral">"see --method='center'\n"</span>
-<a name="l00202"></a>00202 <span class="stringliteral">"The type of function that should be fitted spatially to the collapsed image.\n"</span>
-<a name="l00203"></a>00203 <span class="stringliteral">"This fit is used to create a mask to extract the spectrum of the object. Valid\n"</span>
-<a name="l00204"></a>00204 <span class="stringliteral">"values are 'gauss' and 'moffat'.\n"</span>
-<a name="l00205"></a>00205 <span class="stringliteral">"\n"</span>
-<a name="l00206"></a>00206 <span class="stringliteral">"--filename\n"</span>
-<a name="l00207"></a>00207 <span class="stringliteral">"see --method='user'\n"</span>
-<a name="l00208"></a>00208 <span class="stringliteral">"\n"</span>
-<a name="l00209"></a>00209 <span class="stringliteral">"--cmethod\n"</span>
-<a name="l00210"></a>00210 <span class="stringliteral">"Following methods of frame combination are available:\n"</span>
-<a name="l00211"></a>00211 <span class="stringliteral">" * 'ksigma' (Default)\n"</span>
-<a name="l00212"></a>00212 <span class="stringliteral">" An iterative sigma clipping. For each position all pixels in the spectrum\n"</span>
-<a name="l00213"></a>00213 <span class="stringliteral">" are examined. If they deviate significantly, they will be rejected according\n"</span>
-<a name="l00214"></a>00214 <span class="stringliteral">" to the conditions:\n"</span>
-<a name="l00215"></a>00215 <span class="stringliteral">" val > mean + stdev * cpos_rej\n"</span>
-<a name="l00216"></a>00216 <span class="stringliteral">" and\n"</span>
-<a name="l00217"></a>00217 <span class="stringliteral">" val < mean - stdev * cneg_rej\n"</span>
-<a name="l00218"></a>00218 <span class="stringliteral">" where --cpos_rej, --cneg_rej and --citer are the corresponding configuration\n"</span>
-<a name="l00219"></a>00219 <span class="stringliteral">" parameters. In the first iteration median and percentile level are used.\n"</span>
-<a name="l00220"></a>00220 <span class="stringliteral">"\n"</span>
-<a name="l00221"></a>00221 <span class="stringliteral">" * 'median'\n"</span>
-<a name="l00222"></a>00222 <span class="stringliteral">" At each pixel position the median is calculated.\n"</span>
-<a name="l00223"></a>00223 <span class="stringliteral">"\n"</span>
-<a name="l00224"></a>00224 <span class="stringliteral">" * 'average'\n"</span>
-<a name="l00225"></a>00225 <span class="stringliteral">" At each pixel position the average is calculated.\n"</span>
-<a name="l00226"></a>00226 <span class="stringliteral">"\n"</span>
-<a name="l00227"></a>00227 <span class="stringliteral">" * 'sum'\n"</span>
-<a name="l00228"></a>00228 <span class="stringliteral">" At each pixel position the sum is calculated.\n"</span>
-<a name="l00229"></a>00229 <span class="stringliteral">"\n"</span>
-<a name="l00230"></a>00230 <span class="stringliteral">" * 'min_max'\n"</span>
-<a name="l00231"></a>00231 <span class="stringliteral">" The specified number of minimum and maximum pixel values will be rejected.\n"</span>
-<a name="l00232"></a>00232 <span class="stringliteral">" --cmax and --cmin apply to this method.\n"</span>
-<a name="l00233"></a>00233 <span class="stringliteral">"\n"</span>
-<a name="l00234"></a>00234 <span class="stringliteral">"--cpos_rej\n"</span>
-<a name="l00235"></a>00235 <span class="stringliteral">"--cneg_rej\n"</span>
-<a name="l00236"></a>00236 <span class="stringliteral">"--citer\n"</span>
-<a name="l00237"></a>00237 <span class="stringliteral">"see --cmethod='ksigma'\n"</span>
-<a name="l00238"></a>00238 <span class="stringliteral">"\n"</span>
-<a name="l00239"></a>00239 <span class="stringliteral">"--cmax\n"</span>
-<a name="l00240"></a>00240 <span class="stringliteral">"--cmin\n"</span>
-<a name="l00241"></a>00241 <span class="stringliteral">"see --cmethod='min_max'\n"</span>
-<a name="l00242"></a>00242 <span class="stringliteral">"\n"</span>
-<a name="l00243"></a>00243 <span class="stringliteral">"--extrapolate\n"</span>
-<a name="l00244"></a>00244 <span class="stringliteral">"By default no extrapolation is applied. This means that the intermediate\n"</span>
-<a name="l00245"></a>00245 <span class="stringliteral">"reconstructed cubes will shrink at most one pixel, which is ok for templates\n"</span>
-<a name="l00246"></a>00246 <span class="stringliteral">"like KMOS_spec_obs_nodtosky or KMOS_spec_obs_freedither. When the cubes will be\n"</span>
-<a name="l00247"></a>00247 <span class="stringliteral">"arranged as a map, a grid is likely to occur between the IFUs. Therefore extra-\n"</span>
-<a name="l00248"></a>00248 <span class="stringliteral">"polation during the shifting process can be switched on in order to get IFUs of\n"</span>
-<a name="l00249"></a>00249 <span class="stringliteral">"original size. For frames taken with mapping templates, extrapolation is\n"</span>
-<a name="l00250"></a>00250 <span class="stringliteral">"switched on automatically.\n"</span>
-<a name="l00251"></a>00251 <span class="stringliteral">"\n"</span>
-<a name="l00252"></a>00252 <span class="stringliteral">"--xcal_interpolation\n"</span>
-<a name="l00253"></a>00253 <span class="stringliteral">"If true interpolate the pixel position in the slitlet (xcal) using the two\n"</span>
-<a name="l00254"></a>00254 <span class="stringliteral">"closest rotator angles in the calibration file. Otherwise take the values\n"</span>
-<a name="l00255"></a>00255 <span class="stringliteral">"of the closest rotator angle\n"</span>
-<a name="l00256"></a>00256 <span class="stringliteral">"\n"</span>
-<a name="l00257"></a>00257 <span class="stringliteral">"------------------------------------------------------------------------------\n"</span>
-<a name="l00258"></a>00258 <span class="stringliteral">" Input files:\n"</span>
+<a name="l00177"></a>00177 <span class="stringliteral">" Advanced combining parameters\n"</span>
+<a name="l00178"></a>00178 <span class="stringliteral">" ----------------------------------\n"</span>
+<a name="l00179"></a>00179 <span class="stringliteral">"--edge_nan\n"</span>
+<a name="l00180"></a>00180 <span class="stringliteral">"Set borders of two sides of the cubes to NaN before combining them. This minimises\n"</span>
+<a name="l00181"></a>00181 <span class="stringliteral">"unwanted border effects when dithering.\n"</span>
+<a name="l00182"></a>00182 <span class="stringliteral">"\n"</span>
+<a name="l00183"></a>00183 <span class="stringliteral">"--no_combine\n"</span>
+<a name="l00184"></a>00184 <span class="stringliteral">"If set to TRUE, the reconstructed cubes will not be combined.\n"</span>
+<a name="l00185"></a>00185 <span class="stringliteral">"\n"</span>
+<a name="l00186"></a>00186 <span class="stringliteral">"--method\n"</span>
+<a name="l00187"></a>00187 <span class="stringliteral">"There are following sources to get the shift parameters from:\n"</span>
+<a name="l00188"></a>00188 <span class="stringliteral">" * 'header' (default)\n"</span>
+<a name="l00189"></a>00189 <span class="stringliteral">" The shifts are calculated according to the WCS information stored in the\n"</span>
+<a name="l00190"></a>00190 <span class="stringliteral">" header of every IFU. The output frame will get larger, except the object is\n"</span>
+<a name="l00191"></a>00191 <span class="stringliteral">" at the exact same position for all exposures. The size of the exposures can\n"</span>
+<a name="l00192"></a>00192 <span class="stringliteral">" differ, but the orientation must be the same for all exposures.\n"</span>
+<a name="l00193"></a>00193 <span class="stringliteral">"\n"</span>
+<a name="l00194"></a>00194 <span class="stringliteral">" * 'none'\n"</span>
+<a name="l00195"></a>00195 <span class="stringliteral">" The cubes are directly recombined, not shifting at all. The ouput frame\n"</span>
+<a name="l00196"></a>00196 <span class="stringliteral">" will have the same dimensions as the input cubes.\n"</span>
+<a name="l00197"></a>00197 <span class="stringliteral">" If the size differs a warning will be emitted and the cubes will be aligned\n"</span>
+<a name="l00198"></a>00198 <span class="stringliteral">" to the lower left corner. If the orientation differs a warning will be\n"</span>
+<a name="l00199"></a>00199 <span class="stringliteral">" emitted, but the cubes are combined anyway.\n"</span>
+<a name="l00200"></a>00200 <span class="stringliteral">"\n"</span>
+<a name="l00201"></a>00201 <span class="stringliteral">" * 'center'\n"</span>
+<a name="l00202"></a>00202 <span class="stringliteral">" The shifts are calculated using a centering algorithm. The cube will be\n"</span>
+<a name="l00203"></a>00203 <span class="stringliteral">" collapsed and a 2D profile will be fitted to it to identify the centre.\n"</span>
+<a name="l00204"></a>00204 <span class="stringliteral">" With the parameter --fmethod the function to fit can be provided. The size\n"</span>
+<a name="l00205"></a>00205 <span class="stringliteral">" of the exposures can differ, but the orientation must be the same for all\n"</span>
+<a name="l00206"></a>00206 <span class="stringliteral">" exposures.\n"</span>
+<a name="l00207"></a>00207 <span class="stringliteral">"\n"</span>
+<a name="l00208"></a>00208 <span class="stringliteral">" * 'user'\n"</span>
+<a name="l00209"></a>00209 <span class="stringliteral">" Read the shifts from a user specified file. The path of the file must be\n"</span>
+<a name="l00210"></a>00210 <span class="stringliteral">" provided using the --filename parameter. For every exposure (except the\n"</span>
+<a name="l00211"></a>00211 <span class="stringliteral">" first one) two shift values are expected per line, they have to be separa-\n"</span>
+<a name="l00212"></a>00212 <span class="stringliteral">" ted with simple spaces. The values indicate pixel shifts and are referenced\n"</span>
+<a name="l00213"></a>00213 <span class="stringliteral">" to the first frame. The 1st value is the shift in x-direction to the left,\n"</span>
+<a name="l00214"></a>00214 <span class="stringliteral">" the 2nd the shift in y-direction upwards. The size of the exposures can\n"</span>
+<a name="l00215"></a>00215 <span class="stringliteral">" differ, but the orientation must be the same for all exposures.\n"</span>
+<a name="l00216"></a>00216 <span class="stringliteral">"\n"</span>
+<a name="l00217"></a>00217 <span class="stringliteral">"--fmethod\n"</span>
+<a name="l00218"></a>00218 <span class="stringliteral">"see --method='center'\n"</span>
+<a name="l00219"></a>00219 <span class="stringliteral">"The type of function that should be fitted spatially to the collapsed image.\n"</span>
+<a name="l00220"></a>00220 <span class="stringliteral">"This fit is used to create a mask to extract the spectrum of the object. Valid\n"</span>
+<a name="l00221"></a>00221 <span class="stringliteral">"values are 'gauss' and 'moffat'.\n"</span>
+<a name="l00222"></a>00222 <span class="stringliteral">"\n"</span>
+<a name="l00223"></a>00223 <span class="stringliteral">"--filename\n"</span>
+<a name="l00224"></a>00224 <span class="stringliteral">"see --method='user'\n"</span>
+<a name="l00225"></a>00225 <span class="stringliteral">"\n"</span>
+<a name="l00226"></a>00226 <span class="stringliteral">"--cmethod\n"</span>
+<a name="l00227"></a>00227 <span class="stringliteral">"Following methods of frame combination are available:\n"</span>
+<a name="l00228"></a>00228 <span class="stringliteral">" * 'ksigma' (Default)\n"</span>
+<a name="l00229"></a>00229 <span class="stringliteral">" An iterative sigma clipping. For each position all pixels in the spectrum\n"</span>
+<a name="l00230"></a>00230 <span class="stringliteral">" are examined. If they deviate significantly, they will be rejected according\n"</span>
+<a name="l00231"></a>00231 <span class="stringliteral">" to the conditions:\n"</span>
+<a name="l00232"></a>00232 <span class="stringliteral">" val > mean + stdev * cpos_rej\n"</span>
+<a name="l00233"></a>00233 <span class="stringliteral">" and\n"</span>
+<a name="l00234"></a>00234 <span class="stringliteral">" val < mean - stdev * cneg_rej\n"</span>
+<a name="l00235"></a>00235 <span class="stringliteral">" where --cpos_rej, --cneg_rej and --citer are the corresponding configuration\n"</span>
+<a name="l00236"></a>00236 <span class="stringliteral">" parameters. In the first iteration median and percentile level are used.\n"</span>
+<a name="l00237"></a>00237 <span class="stringliteral">"\n"</span>
+<a name="l00238"></a>00238 <span class="stringliteral">" * 'median'\n"</span>
+<a name="l00239"></a>00239 <span class="stringliteral">" At each pixel position the median is calculated.\n"</span>
+<a name="l00240"></a>00240 <span class="stringliteral">"\n"</span>
+<a name="l00241"></a>00241 <span class="stringliteral">" * 'average'\n"</span>
+<a name="l00242"></a>00242 <span class="stringliteral">" At each pixel position the average is calculated.\n"</span>
+<a name="l00243"></a>00243 <span class="stringliteral">"\n"</span>
+<a name="l00244"></a>00244 <span class="stringliteral">" * 'sum'\n"</span>
+<a name="l00245"></a>00245 <span class="stringliteral">" At each pixel position the sum is calculated.\n"</span>
+<a name="l00246"></a>00246 <span class="stringliteral">"\n"</span>
+<a name="l00247"></a>00247 <span class="stringliteral">" * 'min_max'\n"</span>
+<a name="l00248"></a>00248 <span class="stringliteral">" The specified number of minimum and maximum pixel values will be rejected.\n"</span>
+<a name="l00249"></a>00249 <span class="stringliteral">" --cmax and --cmin apply to this method.\n"</span>
+<a name="l00250"></a>00250 <span class="stringliteral">"\n"</span>
+<a name="l00251"></a>00251 <span class="stringliteral">"--cpos_rej\n"</span>
+<a name="l00252"></a>00252 <span class="stringliteral">"--cneg_rej\n"</span>
+<a name="l00253"></a>00253 <span class="stringliteral">"--citer\n"</span>
+<a name="l00254"></a>00254 <span class="stringliteral">"see --cmethod='ksigma'\n"</span>
+<a name="l00255"></a>00255 <span class="stringliteral">"\n"</span>
+<a name="l00256"></a>00256 <span class="stringliteral">"--cmax\n"</span>
+<a name="l00257"></a>00257 <span class="stringliteral">"--cmin\n"</span>
+<a name="l00258"></a>00258 <span class="stringliteral">"see --cmethod='min_max'\n"</span>
<a name="l00259"></a>00259 <span class="stringliteral">"\n"</span>
-<a name="l00260"></a>00260 <span class="stringliteral">" DO KMOS \n"</span>
-<a name="l00261"></a>00261 <span class="stringliteral">" category Type Explanation Required #Frames\n"</span>
-<a name="l00262"></a>00262 <span class="stringliteral">" -------- ----- ----------- -------- -------\n"</span>
-<a name="l00263"></a>00263 <span class="stringliteral">" SCIENCE RAW The science frames Y >=1 \n"</span>
-<a name="l00264"></a>00264 <span class="stringliteral">" XCAL F2D x calibration frame Y 1 \n"</span>
-<a name="l00265"></a>00265 <span class="stringliteral">" YCAL F2D y calibration frame Y 1 \n"</span>
-<a name="l00266"></a>00266 <span class="stringliteral">" LCAL F2D Wavelength calib. frame Y 1 \n"</span>
-<a name="l00267"></a>00267 <span class="stringliteral">" MASTER_FLAT F2D Master flat Y 1 \n"</span>
-<a name="l00268"></a>00268 <span class="stringliteral">" WAVE_BAND F2L Table with start-/end-wavelengths Y 1 \n"</span>
-<a name="l00269"></a>00269 <span class="stringliteral">" ILLUM_CORR F2I Illumination correction N 0,1 \n"</span>
-<a name="l00270"></a>00270 <span class="stringliteral">" TELLURIC F1I normalised telluric spectrum N 0,1 \n"</span>
-<a name="l00271"></a>00271 <span class="stringliteral">" OH_SPEC F1S Vector holding OH lines N 0,1 \n"</span>
-<a name="l00272"></a>00272 <span class="stringliteral">"\n"</span>
-<a name="l00273"></a>00273 <span class="stringliteral">" Output files:\n"</span>
-<a name="l00274"></a>00274 <span class="stringliteral">"\n"</span>
-<a name="l00275"></a>00275 <span class="stringliteral">" DO KMOS\n"</span>
-<a name="l00276"></a>00276 <span class="stringliteral">" category Type Explanation\n"</span>
-<a name="l00277"></a>00277 <span class="stringliteral">" -------- ----- -----------\n"</span>
-<a name="l00278"></a>00278 <span class="stringliteral">" SCI_COMBINED F3I Combined cubes with noise\n"</span>
-<a name="l00279"></a>00279 <span class="stringliteral">" SCI_RECONSTRUCTED F3I Reconstructed cube with noise\n"</span>
-<a name="l00280"></a>00280 <span class="stringliteral">"------------------------------------------------------------------------------\n"</span>
-<a name="l00281"></a>00281 <span class="stringliteral">"\n"</span>;
-<a name="l00282"></a>00282
-<a name="l00283"></a>00283 <span class="comment">/*-----------------------------------------------------------------------------</span>
-<a name="l00284"></a>00284 <span class="comment"> * Functions code</span>
-<a name="l00285"></a>00285 <span class="comment"> *----------------------------------------------------------------------------*/</span>
-<a name="l00286"></a>00286
-<a name="l00303"></a><a class="code" href="group__kmo__sci__red.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693">00303</a> <span class="keywordtype">int</span> <a class="code" href="group__kmo__arithmetic.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693" title="Build the list of available plugins, for this module.">cpl_plugin_get_info</a>(cpl_pluginlist *list)
-<a name="l00304"></a>00304 {
-<a name="l00305"></a>00305 cpl_recipe *recipe = cpl_calloc(1, <span class="keyword">sizeof</span> *recipe);
-<a name="l00306"></a>00306 cpl_plugin *plugin = &recipe->interface;
-<a name="l00307"></a>00307
-<a name="l00308"></a>00308 cpl_plugin_init(plugin,
-<a name="l00309"></a>00309 CPL_PLUGIN_API,
-<a name="l00310"></a>00310 KMOS_BINARY_VERSION,
-<a name="l00311"></a>00311 CPL_PLUGIN_TYPE_RECIPE,
-<a name="l00312"></a>00312 <span class="stringliteral">"kmo_sci_red"</span>,
-<a name="l00313"></a>00313 <span class="stringliteral">"Reconstruct and combine data frames dividing "</span>
-<a name="l00314"></a>00314 <span class="stringliteral">"illumination and telluric correction."</span>,
-<a name="l00315"></a>00315 kmo_sci_red_description,
-<a name="l00316"></a>00316 <span class="stringliteral">"Alex Agudo Berbel"</span>,
-<a name="l00317"></a>00317 <span class="stringliteral">"kmos-spark at mpe.mpg.de"</span>,
-<a name="l00318"></a>00318 kmos_get_license(),
-<a name="l00319"></a>00319 kmo_sci_red_create,
-<a name="l00320"></a>00320 kmo_sci_red_exec,
-<a name="l00321"></a>00321 kmo_sci_red_destroy);
-<a name="l00322"></a>00322
-<a name="l00323"></a>00323 cpl_pluginlist_append(list, plugin);
-<a name="l00324"></a>00324
-<a name="l00325"></a>00325 <span class="keywordflow">return</span> 0;
-<a name="l00326"></a>00326 }
+<a name="l00260"></a>00260 <span class="stringliteral">"------------------------------------------------------------------------------\n"</span>
+<a name="l00261"></a>00261 <span class="stringliteral">" Input files:\n"</span>
+<a name="l00262"></a>00262 <span class="stringliteral">"\n"</span>
+<a name="l00263"></a>00263 <span class="stringliteral">" DO KMOS \n"</span>
+<a name="l00264"></a>00264 <span class="stringliteral">" category Type Explanation Required #Frames\n"</span>
+<a name="l00265"></a>00265 <span class="stringliteral">" -------- ----- ----------- -------- -------\n"</span>
+<a name="l00266"></a>00266 <span class="stringliteral">" SCIENCE RAW The science frames Y >=1 \n"</span>
+<a name="l00267"></a>00267 <span class="stringliteral">" XCAL F2D x calibration frame Y 1 \n"</span>
+<a name="l00268"></a>00268 <span class="stringliteral">" YCAL F2D y calibration frame Y 1 \n"</span>
+<a name="l00269"></a>00269 <span class="stringliteral">" LCAL F2D Wavelength calib. frame Y 1 \n"</span>
+<a name="l00270"></a>00270 <span class="stringliteral">" WAVE_BAND F2L Table with start-/end-wavelengths Y 1 \n"</span>
+<a name="l00271"></a>00271 <span class="stringliteral">" MASTER_FLAT F2D Master flat Y 0,1 \n"</span>
+<a name="l00272"></a>00272 <span class="stringliteral">" ILLUM_CORR F2I Illumination correction N 0,1 \n"</span>
+<a name="l00273"></a>00273 <span class="stringliteral">" TELLURIC F1I normalised telluric spectrum N 0,1 \n"</span>
+<a name="l00274"></a>00274 <span class="stringliteral">" OH_SPEC F1S Vector holding OH lines N 0,1 \n"</span>
+<a name="l00275"></a>00275 <span class="stringliteral">"\n"</span>
+<a name="l00276"></a>00276 <span class="stringliteral">" Output files:\n"</span>
+<a name="l00277"></a>00277 <span class="stringliteral">"\n"</span>
+<a name="l00278"></a>00278 <span class="stringliteral">" DO KMOS\n"</span>
+<a name="l00279"></a>00279 <span class="stringliteral">" category Type Explanation\n"</span>
+<a name="l00280"></a>00280 <span class="stringliteral">" -------- ----- -----------\n"</span>
+<a name="l00281"></a>00281 <span class="stringliteral">" SCI_COMBINED F3I Combined cubes with noise\n"</span>
+<a name="l00282"></a>00282 <span class="stringliteral">" SCI_RECONSTRUCTED F3I Reconstructed cube with noise\n"</span>
+<a name="l00283"></a>00283 <span class="stringliteral">"------------------------------------------------------------------------------\n"</span>
+<a name="l00284"></a>00284 <span class="stringliteral">"\n"</span>;
+<a name="l00285"></a>00285
+<a name="l00286"></a>00286 <span class="comment">/*-----------------------------------------------------------------------------</span>
+<a name="l00287"></a>00287 <span class="comment"> * Functions code</span>
+<a name="l00288"></a>00288 <span class="comment"> *----------------------------------------------------------------------------*/</span>
+<a name="l00289"></a>00289
+<a name="l00306"></a><a class="code" href="group__kmo__sci__red.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693">00306</a> <span class="keywordtype">int</span> <a class="code" href="group__kmo__arithmetic.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693" title="Build the list of available plugins, for this module.">cpl_plugin_get_info</a>(cpl_pluginlist *list)
+<a name="l00307"></a>00307 {
+<a name="l00308"></a>00308 cpl_recipe *recipe = cpl_calloc(1, <span class="keyword">sizeof</span> *recipe);
+<a name="l00309"></a>00309 cpl_plugin *plugin = &recipe->interface;
+<a name="l00310"></a>00310
+<a name="l00311"></a>00311 cpl_plugin_init(plugin,
+<a name="l00312"></a>00312 CPL_PLUGIN_API,
+<a name="l00313"></a>00313 KMOS_BINARY_VERSION,
+<a name="l00314"></a>00314 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00315"></a>00315 <span class="stringliteral">"kmo_sci_red"</span>,
+<a name="l00316"></a>00316 <span class="stringliteral">"Reconstruct obj/sky-pairs individually and combine "</span>
+<a name="l00317"></a>00317 <span class="stringliteral">"them afterwards"</span>,
+<a name="l00318"></a>00318 kmo_sci_red_description,
+<a name="l00319"></a>00319 <span class="stringliteral">"Alex Agudo Berbel"</span>,
+<a name="l00320"></a>00320 <span class="stringliteral">"kmos-spark at mpe.mpg.de"</span>,
+<a name="l00321"></a>00321 kmos_get_license(),
+<a name="l00322"></a>00322 kmo_sci_red_create,
+<a name="l00323"></a>00323 kmo_sci_red_exec,
+<a name="l00324"></a>00324 kmo_sci_red_destroy);
+<a name="l00325"></a>00325
+<a name="l00326"></a>00326 cpl_pluginlist_append(list, plugin);
<a name="l00327"></a>00327
-<a name="l00335"></a>00335 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sci_red_create(cpl_plugin *plugin)
-<a name="l00336"></a>00336 {
-<a name="l00337"></a>00337 cpl_recipe *recipe;
-<a name="l00338"></a>00338 cpl_parameter *p;
-<a name="l00339"></a>00339
-<a name="l00340"></a>00340 <span class="comment">/* Check that the plugin is part of a valid recipe */</span>
-<a name="l00341"></a>00341 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
-<a name="l00342"></a>00342 recipe = (cpl_recipe *)plugin;
-<a name="l00343"></a>00343 <span class="keywordflow">else</span>
-<a name="l00344"></a>00344 <span class="keywordflow">return</span> -1;
-<a name="l00345"></a>00345
-<a name="l00346"></a>00346 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
-<a name="l00347"></a>00347 recipe->parameters = cpl_parameterlist_new();
+<a name="l00328"></a>00328 <span class="keywordflow">return</span> 0;
+<a name="l00329"></a>00329 }
+<a name="l00330"></a>00330
+<a name="l00338"></a>00338 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sci_red_create(cpl_plugin *plugin)
+<a name="l00339"></a>00339 {
+<a name="l00340"></a>00340 cpl_recipe *recipe;
+<a name="l00341"></a>00341 cpl_parameter *p;
+<a name="l00342"></a>00342
+<a name="l00343"></a>00343 <span class="comment">/* Check that the plugin is part of a valid recipe */</span>
+<a name="l00344"></a>00344 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00345"></a>00345 recipe = (cpl_recipe *)plugin;
+<a name="l00346"></a>00346 <span class="keywordflow">else</span>
+<a name="l00347"></a>00347 <span class="keywordflow">return</span> -1;
<a name="l00348"></a>00348
-<a name="l00349"></a>00349 <span class="comment">/* --imethod (interpolation method) */</span>
-<a name="l00350"></a>00350 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.imethod"</span>,
-<a name="l00351"></a>00351 CPL_TYPE_STRING,
-<a name="l00352"></a>00352 <span class="stringliteral">"Method to use for interpolation during reconstruction. "</span>
-<a name="l00353"></a>00353 <span class="stringliteral">"[\"NN\" (nearest neighbour), "</span>
-<a name="l00354"></a>00354 <span class="stringliteral">"\"lwNN\" (linear weighted nearest neighbor), "</span>
-<a name="l00355"></a>00355 <span class="stringliteral">"\"swNN\" (square weighted nearest neighbor), "</span>
-<a name="l00356"></a>00356 <span class="stringliteral">"\"MS\" (Modified Shepard's method)"</span>
-<a name="l00357"></a>00357 <span class="stringliteral">"\"CS\" (Cubic spline)]"</span>,
-<a name="l00358"></a>00358 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00359"></a>00359 <span class="stringliteral">"CS"</span>);
-<a name="l00360"></a>00360 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"imethod"</span>);
-<a name="l00361"></a>00361 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00362"></a>00362 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00363"></a>00363
-<a name="l00364"></a>00364 <span class="comment">/* --smethod (shift interpolation method) */</span>
-<a name="l00365"></a>00365 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.smethod"</span>,
-<a name="l00366"></a>00366 CPL_TYPE_STRING,
-<a name="l00367"></a>00367 <span class="stringliteral">"Method to use for interpolation during shifting. "</span>
-<a name="l00368"></a>00368 <span class="stringliteral">"[\"NN\" (nearest neighbour), "</span>
-<a name="l00369"></a>00369 <span class="stringliteral">"\"CS\" (Cubic spline)]"</span>,
-<a name="l00370"></a>00370 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00371"></a>00371 <span class="stringliteral">"CS"</span>);
-<a name="l00372"></a>00372 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"smethod"</span>);
-<a name="l00373"></a>00373 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00374"></a>00374 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00375"></a>00375
-<a name="l00376"></a>00376 <span class="comment">/* --method (shift method) */</span>
-<a name="l00377"></a>00377 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.method"</span>,
-<a name="l00378"></a>00378 CPL_TYPE_STRING,
-<a name="l00379"></a>00379 <span class="stringliteral">"The shifting method: "</span>
-<a name="l00380"></a>00380 <span class="stringliteral">"'none': no shifting, combined directly, "</span>
-<a name="l00381"></a>00381 <span class="stringliteral">"'header': shift according to WCS (default), "</span>
-<a name="l00382"></a>00382 <span class="stringliteral">"'center': centering algorithm, "</span>
-<a name="l00383"></a>00383 <span class="stringliteral">"'user': read shifts from file"</span>,
-<a name="l00384"></a>00384 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00385"></a>00385 <span class="stringliteral">"header"</span>);
-<a name="l00386"></a>00386 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"method"</span>);
-<a name="l00387"></a>00387 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00388"></a>00388 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00389"></a>00389
-<a name="l00390"></a>00390 <span class="comment">/* --fmethod */</span>
-<a name="l00391"></a>00391 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.fmethod"</span>,
-<a name="l00392"></a>00392 CPL_TYPE_STRING,
-<a name="l00393"></a>00393 <span class="stringliteral">"The fitting method (applies only when "</span>
-<a name="l00394"></a>00394 <span class="stringliteral">"method='center'): "</span>
-<a name="l00395"></a>00395 <span class="stringliteral">"'gauss': fit a gauss function to collapsed "</span>
-<a name="l00396"></a>00396 <span class="stringliteral">"image (default), "</span>
-<a name="l00397"></a>00397 <span class="stringliteral">"'moffat': fit a moffat function to collapsed"</span>
-<a name="l00398"></a>00398 <span class="stringliteral">" image"</span>,
-<a name="l00399"></a>00399 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00400"></a>00400 <span class="stringliteral">"gauss"</span>);
-<a name="l00401"></a>00401 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"fmethod"</span>);
-<a name="l00402"></a>00402 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00403"></a>00403 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00404"></a>00404
-<a name="l00405"></a>00405 <span class="comment">/* --name */</span>
-<a name="l00406"></a>00406 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.name"</span>,
-<a name="l00407"></a>00407 CPL_TYPE_STRING,
-<a name="l00408"></a>00408 <span class="stringliteral">"Name of the object to combine."</span>,
-<a name="l00409"></a>00409 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00410"></a>00410 <span class="stringliteral">""</span>);
-<a name="l00411"></a>00411 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"name"</span>);
-<a name="l00412"></a>00412 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00413"></a>00413 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00414"></a>00414
-<a name="l00415"></a>00415 <span class="comment">/* --ifus */</span>
-<a name="l00416"></a>00416 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.ifus"</span>,
-<a name="l00417"></a>00417 CPL_TYPE_STRING,
-<a name="l00418"></a>00418 <span class="stringliteral">"The indices of the IFUs to combine. "</span>
-<a name="l00419"></a>00419 <span class="stringliteral">"\"ifu1;ifu2;...\""</span>,
-<a name="l00420"></a>00420 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00421"></a>00421 <span class="stringliteral">""</span>);
-<a name="l00422"></a>00422 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"ifus"</span>);
-<a name="l00423"></a>00423 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00424"></a>00424 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00425"></a>00425
-<a name="l00426"></a>00426 <span class="comment">/* --pix_scale */</span>
-<a name="l00427"></a>00427 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.pix_scale"</span>,
-<a name="l00428"></a>00428 CPL_TYPE_DOUBLE,
-<a name="l00429"></a>00429 <span class="stringliteral">"Change the pixel scale [arcsec]. "</span>
-<a name="l00430"></a>00430 <span class="stringliteral">"Default of 0.2\" results into cubes of 14x14pix, "</span>
-<a name="l00431"></a>00431 <span class="stringliteral">"a scale of 0.1\" results into cubes of 28x28pix, "</span>
-<a name="l00432"></a>00432 <span class="stringliteral">"etc."</span>,
-<a name="l00433"></a>00433 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00434"></a>00434 KMOS_PIX_RESOLUTION);
-<a name="l00435"></a>00435 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"pix_scale"</span>);
-<a name="l00436"></a>00436 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00437"></a>00437 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00438"></a>00438
-<a name="l00439"></a>00439 <span class="comment">/* --suppress_extension */</span>
-<a name="l00440"></a>00440 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.suppress_extension"</span>,
-<a name="l00441"></a>00441 CPL_TYPE_BOOL,
-<a name="l00442"></a>00442 <span class="stringliteral">"Suppress arbitrary filename extension."</span>
-<a name="l00443"></a>00443 <span class="stringliteral">"(TRUE (apply) or FALSE (don't apply)"</span>,
-<a name="l00444"></a>00444 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00445"></a>00445 FALSE);
-<a name="l00446"></a>00446 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"suppress_extension"</span>);
-<a name="l00447"></a>00447 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00448"></a>00448 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00449"></a>00449
-<a name="l00450"></a>00450 <span class="comment">/* --neighborhoodRange */</span>
-<a name="l00451"></a>00451 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.neighborhoodRange"</span>,
-<a name="l00452"></a>00452 CPL_TYPE_DOUBLE,
-<a name="l00453"></a>00453 <span class="stringliteral">"Defines the range to search for neighbors "</span>
-<a name="l00454"></a>00454 <span class="stringliteral">"in pixels"</span>,
-<a name="l00455"></a>00455 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00456"></a>00456 1.001);
-<a name="l00457"></a>00457 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"neighborhoodRange"</span>);
-<a name="l00458"></a>00458 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00459"></a>00459 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00460"></a>00460
-<a name="l00461"></a>00461 <span class="comment">/* --filename */</span>
-<a name="l00462"></a>00462 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.filename"</span>,
-<a name="l00463"></a>00463 CPL_TYPE_STRING,
-<a name="l00464"></a>00464 <span class="stringliteral">"The path to the file with the shift vectors."</span>
-<a name="l00465"></a>00465 <span class="stringliteral">"(Applies only to method='user')"</span>,
-<a name="l00466"></a>00466 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00467"></a>00467 <span class="stringliteral">""</span>);
-<a name="l00468"></a>00468 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"filename"</span>);
-<a name="l00469"></a>00469 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00470"></a>00470 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00471"></a>00471
-<a name="l00472"></a>00472 <span class="comment">/* --flux */</span>
-<a name="l00473"></a>00473 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.flux"</span>,
-<a name="l00474"></a>00474 CPL_TYPE_BOOL,
-<a name="l00475"></a>00475 <span class="stringliteral">"TRUE: Apply flux conservation. FALSE: otherwise"</span>,
-<a name="l00476"></a>00476 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00477"></a>00477 FALSE);
-<a name="l00478"></a>00478 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"flux"</span>);
-<a name="l00479"></a>00479 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00480"></a>00480 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00481"></a>00481
-<a name="l00482"></a>00482 <span class="comment">/* --background */</span>
-<a name="l00483"></a>00483 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.background"</span>,
-<a name="l00484"></a>00484 CPL_TYPE_BOOL,
-<a name="l00485"></a>00485 <span class="stringliteral">"TRUE: Apply background removal. FALSE: otherwise"</span>,
-<a name="l00486"></a>00486 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00487"></a>00487 FALSE);
-<a name="l00488"></a>00488 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"background"</span>);
-<a name="l00489"></a>00489 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00490"></a>00490 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00491"></a>00491
-<a name="l00492"></a>00492 <span class="comment">/* --fast_mode */</span>
-<a name="l00493"></a>00493 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.fast_mode"</span>,
-<a name="l00494"></a>00494 CPL_TYPE_BOOL,
-<a name="l00495"></a>00495 <span class="stringliteral">"FALSE: cubes are shifted and combined,"</span>
-<a name="l00496"></a>00496 <span class="stringliteral">"TRUE: cubes are collapsed and then shifted and combined"</span>,
-<a name="l00497"></a>00497 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00498"></a>00498 FALSE);
-<a name="l00499"></a>00499 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"fast_mode"</span>);
-<a name="l00500"></a>00500 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00501"></a>00501 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00502"></a>00502
-<a name="l00503"></a>00503 <span class="comment">/* --extrapolate */</span>
-<a name="l00504"></a>00504 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.extrapolate"</span>,
-<a name="l00505"></a>00505 CPL_TYPE_BOOL,
-<a name="l00506"></a>00506 <span class="stringliteral">"Applies only to 'smethod=CS' when doing sub-"</span>
-<a name="l00507"></a>00507 <span class="stringliteral">"pixel shifts: "</span>
-<a name="l00508"></a>00508 <span class="stringliteral">"FALSE: shifted IFU will be filled with NaN's "</span>
-<a name="l00509"></a>00509 <span class="stringliteral">"at the borders,"</span>
-<a name="l00510"></a>00510 <span class="stringliteral">"TRUE: shifted IFU will be extrapolated at "</span>
-<a name="l00511"></a>00511 <span class="stringliteral">"the borders"</span>,
-<a name="l00512"></a>00512 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00513"></a>00513 FALSE);
-<a name="l00514"></a>00514 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"extrapolate"</span>);
-<a name="l00515"></a>00515 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00516"></a>00516 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00517"></a>00517
-<a name="l00518"></a>00518 <span class="comment">/* --xcal_interpolation */</span>
-<a name="l00519"></a>00519 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.xcal_interpolation"</span>,
-<a name="l00520"></a>00520 CPL_TYPE_BOOL,
-<a name="l00521"></a>00521 <span class="stringliteral">"TRUE: Interpolate xcal between rotator angles. FALSE: otherwise"</span>,
-<a name="l00522"></a>00522 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00523"></a>00523 TRUE);
-<a name="l00524"></a>00524 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"xcal_interpolation"</span>);
-<a name="l00525"></a>00525 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00526"></a>00526 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00527"></a>00527
-<a name="l00528"></a>00528 <span class="comment">/* --edge_nan */</span>
-<a name="l00529"></a>00529 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.edge_nan"</span>,
-<a name="l00530"></a>00530 CPL_TYPE_BOOL,
-<a name="l00531"></a>00531 <span class="stringliteral">"Set borders of cubes to NaN before combining them."</span>
-<a name="l00532"></a>00532 <span class="stringliteral">"(TRUE (apply) or "</span>
-<a name="l00533"></a>00533 <span class="stringliteral">"FALSE (don't apply)"</span>,
-<a name="l00534"></a>00534 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00535"></a>00535 FALSE);
-<a name="l00536"></a>00536 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"edge_nan"</span>);
-<a name="l00537"></a>00537 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00538"></a>00538 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00539"></a>00539
-<a name="l00540"></a>00540 <span class="comment">/* --no_combine */</span>
-<a name="l00541"></a>00541 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.no_combine"</span>,
-<a name="l00542"></a>00542 CPL_TYPE_BOOL,
-<a name="l00543"></a>00543 <span class="stringliteral">"Don't combine cubes after reconstruction."</span>
-<a name="l00544"></a>00544 <span class="stringliteral">"(TRUE (apply) or "</span>
-<a name="l00545"></a>00545 <span class="stringliteral">"FALSE (don't apply)"</span>,
-<a name="l00546"></a>00546 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00547"></a>00547 FALSE);
-<a name="l00548"></a>00548 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"no_combine"</span>);
-<a name="l00549"></a>00549 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00550"></a>00550 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00551"></a>00551
-<a name="l00552"></a>00552 <span class="comment">/* --no_subtract */</span>
-<a name="l00553"></a>00553 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.no_subtract"</span>,
-<a name="l00554"></a>00554 CPL_TYPE_BOOL,
-<a name="l00555"></a>00555 <span class="stringliteral">"Don't sky subtract object and references."</span>
-<a name="l00556"></a>00556 <span class="stringliteral">"(TRUE (apply) or "</span>
-<a name="l00557"></a>00557 <span class="stringliteral">"FALSE (don't apply)"</span>,
-<a name="l00558"></a>00558 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00559"></a>00559 FALSE);
-<a name="l00560"></a>00560 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"no_subtract"</span>);
-<a name="l00561"></a>00561 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00562"></a>00562 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00563"></a>00563
-<a name="l00564"></a>00564 <span class="comment">/* --sky_tweak */</span>
-<a name="l00565"></a>00565 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.sky_tweak"</span>,
-<a name="l00566"></a>00566 CPL_TYPE_BOOL,
-<a name="l00567"></a>00567 <span class="stringliteral">"Use modified sky cube for sky subtraction."</span>
-<a name="l00568"></a>00568 <span class="stringliteral">"(TRUE (apply) or "</span>
-<a name="l00569"></a>00569 <span class="stringliteral">"FALSE (don't apply)"</span>,
-<a name="l00570"></a>00570 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00571"></a>00571 FALSE);
-<a name="l00572"></a>00572 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"sky_tweak"</span>);
-<a name="l00573"></a>00573 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
-<a name="l00574"></a>00574 cpl_parameterlist_append(recipe->parameters, p);
-<a name="l00575"></a>00575
-<a name="l00576"></a>00576 <span class="comment">// add parameters for band-definition</span>
-<a name="l00577"></a>00577 kmo_band_pars_create(recipe->parameters,
-<a name="l00578"></a>00578 <span class="stringliteral">"kmos.kmo_sci_red"</span>);
-<a name="l00579"></a>00579
-<a name="l00580"></a>00580 <span class="keywordflow">return</span> kmo_combine_pars_create(recipe->parameters,
-<a name="l00581"></a>00581 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l00582"></a>00582 DEF_REJ_METHOD,
-<a name="l00583"></a>00583 FALSE);
-<a name="l00584"></a>00584 }
-<a name="l00585"></a>00585
-<a name="l00591"></a>00591 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sci_red_exec(cpl_plugin *plugin)
-<a name="l00592"></a>00592 {
-<a name="l00593"></a>00593 cpl_recipe *recipe;
+<a name="l00349"></a>00349 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00350"></a>00350 recipe->parameters = cpl_parameterlist_new();
+<a name="l00351"></a>00351
+<a name="l00352"></a>00352 <span class="comment">/* --imethod (interpolation method) */</span>
+<a name="l00353"></a>00353 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.imethod"</span>,
+<a name="l00354"></a>00354 CPL_TYPE_STRING,
+<a name="l00355"></a>00355 <span class="stringliteral">"Method to use for interpolation during reconstruction. "</span>
+<a name="l00356"></a>00356 <span class="stringliteral">"[\"NN\" (nearest neighbour), "</span>
+<a name="l00357"></a>00357 <span class="stringliteral">"\"lwNN\" (linear weighted nearest neighbor), "</span>
+<a name="l00358"></a>00358 <span class="stringliteral">"\"swNN\" (square weighted nearest neighbor), "</span>
+<a name="l00359"></a>00359 <span class="stringliteral">"\"MS\" (Modified Shepard's method)"</span>
+<a name="l00360"></a>00360 <span class="stringliteral">"\"CS\" (Cubic spline)]"</span>,
+<a name="l00361"></a>00361 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00362"></a>00362 <span class="stringliteral">"CS"</span>);
+<a name="l00363"></a>00363 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"imethod"</span>);
+<a name="l00364"></a>00364 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00365"></a>00365 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00366"></a>00366
+<a name="l00367"></a>00367 <span class="comment">/* --smethod (shift interpolation method) */</span>
+<a name="l00368"></a>00368 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.smethod"</span>,
+<a name="l00369"></a>00369 CPL_TYPE_STRING,
+<a name="l00370"></a>00370 <span class="stringliteral">"Method to use for interpolation during shifting. "</span>
+<a name="l00371"></a>00371 <span class="stringliteral">"[\"NN\" (nearest neighbour), "</span>
+<a name="l00372"></a>00372 <span class="stringliteral">"\"CS\" (Cubic spline)]"</span>,
+<a name="l00373"></a>00373 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00374"></a>00374 <span class="stringliteral">"CS"</span>);
+<a name="l00375"></a>00375 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"smethod"</span>);
+<a name="l00376"></a>00376 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00377"></a>00377 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00378"></a>00378
+<a name="l00379"></a>00379 <span class="comment">/* --method (shift method) */</span>
+<a name="l00380"></a>00380 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.method"</span>,
+<a name="l00381"></a>00381 CPL_TYPE_STRING,
+<a name="l00382"></a>00382 <span class="stringliteral">"The shifting method: "</span>
+<a name="l00383"></a>00383 <span class="stringliteral">"'none': no shifting, combined directly, "</span>
+<a name="l00384"></a>00384 <span class="stringliteral">"'header': shift according to WCS (default), "</span>
+<a name="l00385"></a>00385 <span class="stringliteral">"'center': centering algorithm, "</span>
+<a name="l00386"></a>00386 <span class="stringliteral">"'user': read shifts from file"</span>,
+<a name="l00387"></a>00387 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00388"></a>00388 <span class="stringliteral">"header"</span>);
+<a name="l00389"></a>00389 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"method"</span>);
+<a name="l00390"></a>00390 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00391"></a>00391 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00392"></a>00392
+<a name="l00393"></a>00393 <span class="comment">/* --fmethod */</span>
+<a name="l00394"></a>00394 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.fmethod"</span>,
+<a name="l00395"></a>00395 CPL_TYPE_STRING,
+<a name="l00396"></a>00396 <span class="stringliteral">"The fitting method (applies only when "</span>
+<a name="l00397"></a>00397 <span class="stringliteral">"method='center'): "</span>
+<a name="l00398"></a>00398 <span class="stringliteral">"'gauss': fit a gauss function to collapsed "</span>
+<a name="l00399"></a>00399 <span class="stringliteral">"image (default), "</span>
+<a name="l00400"></a>00400 <span class="stringliteral">"'moffat': fit a moffat function to collapsed"</span>
+<a name="l00401"></a>00401 <span class="stringliteral">" image"</span>,
+<a name="l00402"></a>00402 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00403"></a>00403 <span class="stringliteral">"gauss"</span>);
+<a name="l00404"></a>00404 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"fmethod"</span>);
+<a name="l00405"></a>00405 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00406"></a>00406 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00407"></a>00407
+<a name="l00408"></a>00408 <span class="comment">/* --name */</span>
+<a name="l00409"></a>00409 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.name"</span>,
+<a name="l00410"></a>00410 CPL_TYPE_STRING,
+<a name="l00411"></a>00411 <span class="stringliteral">"Name of the object to combine."</span>,
+<a name="l00412"></a>00412 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00413"></a>00413 <span class="stringliteral">""</span>);
+<a name="l00414"></a>00414 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"name"</span>);
+<a name="l00415"></a>00415 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00416"></a>00416 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00417"></a>00417
+<a name="l00418"></a>00418 <span class="comment">/* --ifus */</span>
+<a name="l00419"></a>00419 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.ifus"</span>,
+<a name="l00420"></a>00420 CPL_TYPE_STRING,
+<a name="l00421"></a>00421 <span class="stringliteral">"The indices of the IFUs to combine. "</span>
+<a name="l00422"></a>00422 <span class="stringliteral">"\"ifu1;ifu2;...\""</span>,
+<a name="l00423"></a>00423 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00424"></a>00424 <span class="stringliteral">""</span>);
+<a name="l00425"></a>00425 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"ifus"</span>);
+<a name="l00426"></a>00426 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00427"></a>00427 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00428"></a>00428
+<a name="l00429"></a>00429 <span class="comment">/* --pix_scale */</span>
+<a name="l00430"></a>00430 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.pix_scale"</span>,
+<a name="l00431"></a>00431 CPL_TYPE_DOUBLE,
+<a name="l00432"></a>00432 <span class="stringliteral">"Change the pixel scale [arcsec]. "</span>
+<a name="l00433"></a>00433 <span class="stringliteral">"Default of 0.2\" results into cubes of 14x14pix, "</span>
+<a name="l00434"></a>00434 <span class="stringliteral">"a scale of 0.1\" results into cubes of 28x28pix, "</span>
+<a name="l00435"></a>00435 <span class="stringliteral">"etc."</span>,
+<a name="l00436"></a>00436 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00437"></a>00437 KMOS_PIX_RESOLUTION);
+<a name="l00438"></a>00438 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"pix_scale"</span>);
+<a name="l00439"></a>00439 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00440"></a>00440 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00441"></a>00441
+<a name="l00442"></a>00442 <span class="comment">/* --suppress_extension */</span>
+<a name="l00443"></a>00443 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.suppress_extension"</span>,
+<a name="l00444"></a>00444 CPL_TYPE_BOOL,
+<a name="l00445"></a>00445 <span class="stringliteral">"Suppress arbitrary filename extension."</span>
+<a name="l00446"></a>00446 <span class="stringliteral">"(TRUE (apply) or FALSE (don't apply)"</span>,
+<a name="l00447"></a>00447 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00448"></a>00448 FALSE);
+<a name="l00449"></a>00449 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"suppress_extension"</span>);
+<a name="l00450"></a>00450 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00451"></a>00451 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00452"></a>00452
+<a name="l00453"></a>00453 <span class="comment">/* --neighborhoodRange */</span>
+<a name="l00454"></a>00454 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.neighborhoodRange"</span>,
+<a name="l00455"></a>00455 CPL_TYPE_DOUBLE,
+<a name="l00456"></a>00456 <span class="stringliteral">"Defines the range to search for neighbors "</span>
+<a name="l00457"></a>00457 <span class="stringliteral">"in pixels"</span>,
+<a name="l00458"></a>00458 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00459"></a>00459 1.001);
+<a name="l00460"></a>00460 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"neighborhoodRange"</span>);
+<a name="l00461"></a>00461 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00462"></a>00462 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00463"></a>00463
+<a name="l00464"></a>00464 <span class="comment">/* --filename */</span>
+<a name="l00465"></a>00465 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.filename"</span>,
+<a name="l00466"></a>00466 CPL_TYPE_STRING,
+<a name="l00467"></a>00467 <span class="stringliteral">"The path to the file with the shift vectors."</span>
+<a name="l00468"></a>00468 <span class="stringliteral">"(Applies only to method='user')"</span>,
+<a name="l00469"></a>00469 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00470"></a>00470 <span class="stringliteral">""</span>);
+<a name="l00471"></a>00471 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"filename"</span>);
+<a name="l00472"></a>00472 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00473"></a>00473 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00474"></a>00474
+<a name="l00475"></a>00475 <span class="comment">/* --flux */</span>
+<a name="l00476"></a>00476 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.flux"</span>,
+<a name="l00477"></a>00477 CPL_TYPE_BOOL,
+<a name="l00478"></a>00478 <span class="stringliteral">"TRUE: Apply flux conservation. FALSE: otherwise"</span>,
+<a name="l00479"></a>00479 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00480"></a>00480 FALSE);
+<a name="l00481"></a>00481 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"flux"</span>);
+<a name="l00482"></a>00482 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00483"></a>00483 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00484"></a>00484
+<a name="l00485"></a>00485 <span class="comment">/* --background */</span>
+<a name="l00486"></a>00486 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.background"</span>,
+<a name="l00487"></a>00487 CPL_TYPE_BOOL,
+<a name="l00488"></a>00488 <span class="stringliteral">"TRUE: Apply background removal. FALSE: otherwise"</span>,
+<a name="l00489"></a>00489 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00490"></a>00490 FALSE);
+<a name="l00491"></a>00491 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"background"</span>);
+<a name="l00492"></a>00492 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00493"></a>00493 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00494"></a>00494
+<a name="l00495"></a>00495 <span class="comment">/* --fast_mode */</span>
+<a name="l00496"></a>00496 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.fast_mode"</span>,
+<a name="l00497"></a>00497 CPL_TYPE_BOOL,
+<a name="l00498"></a>00498 <span class="stringliteral">"FALSE: cubes are shifted and combined,"</span>
+<a name="l00499"></a>00499 <span class="stringliteral">"TRUE: cubes are collapsed and then shifted and combined"</span>,
+<a name="l00500"></a>00500 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00501"></a>00501 FALSE);
+<a name="l00502"></a>00502 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"fast_mode"</span>);
+<a name="l00503"></a>00503 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00504"></a>00504 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00505"></a>00505
+<a name="l00506"></a>00506 <span class="comment">/* --extrapolate */</span>
+<a name="l00507"></a>00507 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.extrapolate"</span>,
+<a name="l00508"></a>00508 CPL_TYPE_BOOL,
+<a name="l00509"></a>00509 <span class="stringliteral">"Applies only to 'smethod=CS' when doing sub-"</span>
+<a name="l00510"></a>00510 <span class="stringliteral">"pixel shifts: "</span>
+<a name="l00511"></a>00511 <span class="stringliteral">"FALSE: shifted IFU will be filled with NaN's "</span>
+<a name="l00512"></a>00512 <span class="stringliteral">"at the borders,"</span>
+<a name="l00513"></a>00513 <span class="stringliteral">"TRUE: shifted IFU will be extrapolated at "</span>
+<a name="l00514"></a>00514 <span class="stringliteral">"the borders"</span>,
+<a name="l00515"></a>00515 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00516"></a>00516 FALSE);
+<a name="l00517"></a>00517 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"extrapolate"</span>);
+<a name="l00518"></a>00518 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00519"></a>00519 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00520"></a>00520
+<a name="l00521"></a>00521 <span class="comment">/* --xcal_interpolation */</span>
+<a name="l00522"></a>00522 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.xcal_interpolation"</span>,
+<a name="l00523"></a>00523 CPL_TYPE_BOOL,
+<a name="l00524"></a>00524 <span class="stringliteral">"TRUE: Interpolate xcal between rotator angles. FALSE: otherwise"</span>,
+<a name="l00525"></a>00525 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00526"></a>00526 TRUE);
+<a name="l00527"></a>00527 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"xcal_interpolation"</span>);
+<a name="l00528"></a>00528 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00529"></a>00529 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00530"></a>00530
+<a name="l00531"></a>00531 <span class="comment">/* --edge_nan */</span>
+<a name="l00532"></a>00532 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.edge_nan"</span>,
+<a name="l00533"></a>00533 CPL_TYPE_BOOL,
+<a name="l00534"></a>00534 <span class="stringliteral">"Set borders of cubes to NaN before combining them."</span>
+<a name="l00535"></a>00535 <span class="stringliteral">"(TRUE (apply) or "</span>
+<a name="l00536"></a>00536 <span class="stringliteral">"FALSE (don't apply)"</span>,
+<a name="l00537"></a>00537 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00538"></a>00538 FALSE);
+<a name="l00539"></a>00539 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"edge_nan"</span>);
+<a name="l00540"></a>00540 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00541"></a>00541 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00542"></a>00542
+<a name="l00543"></a>00543 <span class="comment">/* --no_combine */</span>
+<a name="l00544"></a>00544 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.no_combine"</span>,
+<a name="l00545"></a>00545 CPL_TYPE_BOOL,
+<a name="l00546"></a>00546 <span class="stringliteral">"Don't combine cubes after reconstruction."</span>
+<a name="l00547"></a>00547 <span class="stringliteral">"(TRUE (apply) or "</span>
+<a name="l00548"></a>00548 <span class="stringliteral">"FALSE (don't apply)"</span>,
+<a name="l00549"></a>00549 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00550"></a>00550 FALSE);
+<a name="l00551"></a>00551 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"no_combine"</span>);
+<a name="l00552"></a>00552 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00553"></a>00553 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00554"></a>00554
+<a name="l00555"></a>00555 <span class="comment">/* --no_subtract */</span>
+<a name="l00556"></a>00556 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.no_subtract"</span>,
+<a name="l00557"></a>00557 CPL_TYPE_BOOL,
+<a name="l00558"></a>00558 <span class="stringliteral">"Don't sky subtract object and references."</span>
+<a name="l00559"></a>00559 <span class="stringliteral">"(TRUE (apply) or "</span>
+<a name="l00560"></a>00560 <span class="stringliteral">"FALSE (don't apply)"</span>,
+<a name="l00561"></a>00561 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00562"></a>00562 FALSE);
+<a name="l00563"></a>00563 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"no_subtract"</span>);
+<a name="l00564"></a>00564 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00565"></a>00565 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00566"></a>00566
+<a name="l00567"></a>00567 <span class="comment">/* --sky_tweak */</span>
+<a name="l00568"></a>00568 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.sky_tweak"</span>,
+<a name="l00569"></a>00569 CPL_TYPE_BOOL,
+<a name="l00570"></a>00570 <span class="stringliteral">"Use modified sky cube for sky subtraction."</span>
+<a name="l00571"></a>00571 <span class="stringliteral">"(TRUE (apply) or "</span>
+<a name="l00572"></a>00572 <span class="stringliteral">"FALSE (don't apply)"</span>,
+<a name="l00573"></a>00573 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00574"></a>00574 FALSE);
+<a name="l00575"></a>00575 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"sky_tweak"</span>);
+<a name="l00576"></a>00576 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00577"></a>00577 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00578"></a>00578
+<a name="l00579"></a>00579 <span class="comment">/* --tbsub */</span>
+<a name="l00580"></a>00580 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sci_red.tbsub"</span>,
+<a name="l00581"></a>00581 CPL_TYPE_BOOL,
+<a name="l00582"></a>00582 <span class="stringliteral">"Subtract thermal background from input cube."</span>
+<a name="l00583"></a>00583 <span class="stringliteral">"(TRUE (apply) or "</span>
+<a name="l00584"></a>00584 <span class="stringliteral">"FALSE (don't apply)"</span>,
+<a name="l00585"></a>00585 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00586"></a>00586 TRUE);
+<a name="l00587"></a>00587 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"tbsub"</span>);
+<a name="l00588"></a>00588 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00589"></a>00589 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00590"></a>00590
+<a name="l00591"></a>00591 <span class="comment">// add parameters for band-definition</span>
+<a name="l00592"></a>00592 kmo_band_pars_create(recipe->parameters,
+<a name="l00593"></a>00593 <span class="stringliteral">"kmos.kmo_sci_red"</span>);
<a name="l00594"></a>00594
-<a name="l00595"></a>00595 <span class="comment">/* Get the recipe out of the plugin */</span>
-<a name="l00596"></a>00596 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
-<a name="l00597"></a>00597 recipe = (cpl_recipe *)plugin;
-<a name="l00598"></a>00598 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
-<a name="l00599"></a>00599
-<a name="l00600"></a>00600 <span class="keywordflow">return</span> kmo_sci_red(recipe->parameters, recipe->frames);
-<a name="l00601"></a>00601 }
-<a name="l00602"></a>00602
-<a name="l00608"></a>00608 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sci_red_destroy(cpl_plugin *plugin)
-<a name="l00609"></a>00609 {
-<a name="l00610"></a>00610 cpl_recipe *recipe;
-<a name="l00611"></a>00611
-<a name="l00612"></a>00612 <span class="comment">/* Get the recipe out of the plugin */</span>
-<a name="l00613"></a>00613 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
-<a name="l00614"></a>00614 recipe = (cpl_recipe *)plugin;
-<a name="l00615"></a>00615 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
-<a name="l00616"></a>00616
-<a name="l00617"></a>00617 cpl_parameterlist_delete(recipe->parameters);
-<a name="l00618"></a>00618 <span class="keywordflow">return</span> 0 ;
-<a name="l00619"></a>00619 }
-<a name="l00620"></a>00620
-<a name="l00621"></a>00621
-<a name="l00622"></a>00622
-<a name="l00637"></a>00637 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
-<a name="l00638"></a>00638 {
-<a name="l00639"></a>00639 <span class="keywordtype">int</span> ret_val = 0,
-<a name="l00640"></a>00640 nr_science_frames = 0,
-<a name="l00641"></a>00641 nr_reconstructed_frames = 0,
-<a name="l00642"></a>00642 has_illum_corr = 0,
-<a name="l00643"></a>00643 has_telluric = 0,
-<a name="l00644"></a>00644 telluric_ok = 0,
-<a name="l00645"></a>00645 *bounds = NULL,
-<a name="l00646"></a>00646 det_nr = 0,
-<a name="l00647"></a>00647 actual_msg_level = 0,
-<a name="l00648"></a>00648 print_once = FALSE,
-<a name="l00649"></a>00649 cube_counter_data = 0,
-<a name="l00650"></a>00650 cube_counter_noise = 0,
-<a name="l00651"></a>00651 citer = 0,
-<a name="l00652"></a>00652 cmin = 0,
-<a name="l00653"></a>00653 cmax = 0,
-<a name="l00654"></a>00654 user_defined_ifu = 0,
-<a name="l00655"></a>00655 extrapolate = 0,
-<a name="l00656"></a>00656 flux = FALSE,
-<a name="l00657"></a>00657 background = FALSE,
-<a name="l00658"></a>00658 index = 0,
-<a name="l00659"></a>00659 nr_data_alloc = 0,
-<a name="l00660"></a>00660 tmp_int = 0,
-<a name="l00661"></a>00661 fast_mode = FALSE,
-<a name="l00662"></a>00662 edge_nan = FALSE,
-<a name="l00663"></a>00663 no_combine = FALSE,
-<a name="l00664"></a>00664 no_subtract = FALSE,
-<a name="l00665"></a>00665 do_sky_subtraction = FALSE,
-<a name="l00666"></a>00666 sky_tweak = FALSE,
-<a name="l00667"></a>00667 xcal_interpolation = FALSE,
-<a name="l00668"></a>00668 suppress_extension = FALSE,
-<a name="l00669"></a>00669 suppress_index = 0,
-<a name="l00670"></a>00670 i = 0, sf = 0, jj = 0, ifu_nr = 0;
-<a name="l00671"></a>00671 <span class="keyword">const</span> <span class="keywordtype">int</span> *punused_ifus_before = NULL;
-<a name="l00672"></a>00672 <span class="keywordtype">int</span> *punused_ifus_after = NULL;
-<a name="l00673"></a>00673 <span class="keywordtype">double</span> neighborhoodRange = 1.001,
-<a name="l00674"></a>00674 cpos_rej = 0.0,
-<a name="l00675"></a>00675 cneg_rej = 0.0,
-<a name="l00676"></a>00676 pix_scale = 0.0;
-<a name="l00677"></a>00677 <span class="keywordtype">char</span> *suffix = NULL,
-<a name="l00678"></a>00678 *keyword = NULL,
-<a name="l00679"></a>00679 *extname = NULL,
-<a name="l00680"></a>00680 *fn_suffix = NULL,
-<a name="l00681"></a>00681 *mapping_mode = NULL,
-<a name="l00682"></a>00682 **split = NULL,
-<a name="l00683"></a>00683 content[256];
-<a name="l00684"></a>00684 <span class="keyword">const</span> <span class="keywordtype">char</span> *imethod = NULL,
-<a name="l00685"></a>00685 *smethod = NULL,
-<a name="l00686"></a>00686 *ifus_txt = NULL,
-<a name="l00687"></a>00687 *name = NULL,
-<a name="l00688"></a>00688 *filter_id = NULL,
-<a name="l00689"></a>00689 *tmp_str = NULL,
-<a name="l00690"></a>00690 *filename = NULL,
-<a name="l00691"></a>00691 *fn_out = NULL,
-<a name="l00692"></a>00692 *fn_obj = NULL,
-<a name="l00693"></a>00693 *fn_sky = NULL,
-<a name="l00694"></a>00694 *fn_reconstr = NULL,
-<a name="l00695"></a>00695 *comb_method = NULL,
-<a name="l00696"></a>00696 *cmethod = NULL,
-<a name="l00697"></a>00697 *fmethod = NULL;
-<a name="l00698"></a>00698 cpl_array **unused_ifus_before = NULL,
-<a name="l00699"></a>00699 **unused_ifus_after = NULL;
-<a name="l00700"></a>00700 cpl_frame *xcal_frame = NULL,
-<a name="l00701"></a>00701 *ycal_frame = NULL,
-<a name="l00702"></a>00702 *lcal_frame = NULL,
-<a name="l00703"></a>00703 *flat_frame = NULL,
-<a name="l00704"></a>00704 *illum_frame = NULL,
-<a name="l00705"></a>00705 *telluric_frame = NULL,
-<a name="l00706"></a>00706 *tmp_frame = NULL;
-<a name="l00707"></a>00707 cpl_propertylist *tmp_header = NULL,
-<a name="l00708"></a>00708 *main_header = NULL,
-<a name="l00709"></a>00709 **header_data = NULL,
-<a name="l00710"></a>00710 **header_noise = NULL;
-<a name="l00711"></a>00711 cpl_vector *ifus = NULL;
-<a name="l00712"></a>00712 kmclipm_vector *telluric_data = NULL,
-<a name="l00713"></a>00713 *telluric_noise = NULL;
-<a name="l00714"></a>00714 cpl_image **lcal = NULL,
-<a name="l00715"></a>00715 *illum_data = NULL,
-<a name="l00716"></a>00716 *illum_noise = NULL,
-<a name="l00717"></a>00717 *tmpImg = NULL;
-<a name="l00718"></a>00718 cpl_imagelist **cube_data = NULL,
-<a name="l00719"></a>00719 **cube_noise = NULL,
-<a name="l00720"></a>00720 *sky_data = NULL,
-<a name="l00721"></a>00721 *sky_noise = NULL,
-<a name="l00722"></a>00722 *combined_data = NULL,
-<a name="l00723"></a>00723 *combined_noise = NULL,
-<a name="l00724"></a>00724 *tmpCube = NULL;
-<a name="l00725"></a>00725 cpl_table *band_table = NULL;
-<a name="l00726"></a>00726 cpl_frame *sky_frame = NULL,
-<a name="l00727"></a>00727 *sky_as_object_frame = NULL,
-<a name="l00728"></a>00728 *ref_spectrum_frame = NULL;
-<a name="l00729"></a>00729 cpl_polynomial *lcorr_coeffs = NULL;
-<a name="l00730"></a>00730 main_fits_desc desc1,
-<a name="l00731"></a>00731 desc2,
-<a name="l00732"></a>00732 desc_telluric;
-<a name="l00733"></a>00733 gridDefinition gd;
-<a name="l00734"></a>00734 armNameStruct *arm_name_struct = NULL;
-<a name="l00735"></a>00735 <span class="keyword">enum</span> extrapolationType extrapol_enum = 0;
-<a name="l00736"></a>00736 <span class="keyword">enum</span> kmo_frame_type ft = 0;
-<a name="l00737"></a>00737
-<a name="l00738"></a>00738 KMO_TRY
-<a name="l00739"></a>00739 {
-<a name="l00740"></a>00740
-<a name="l00741"></a>00741 kmo_init_fits_desc(&desc1);
-<a name="l00742"></a>00742 kmo_init_fits_desc(&desc2);
-<a name="l00743"></a>00743 kmo_init_fits_desc(&desc_telluric);
-<a name="l00744"></a>00744
-<a name="l00745"></a>00745 <span class="comment">//</span>
-<a name="l00746"></a>00746 <span class="comment">// check frameset</span>
-<a name="l00747"></a>00747 <span class="comment">//</span>
-<a name="l00748"></a>00748 KMO_TRY_ASSURE((parlist != NULL) &&
-<a name="l00749"></a>00749 (frameset != NULL),
-<a name="l00750"></a>00750 CPL_ERROR_NULL_INPUT,
-<a name="l00751"></a>00751 <span class="stringliteral">"Not all input data is provided!"</span>);
+<a name="l00595"></a>00595 <span class="keywordflow">return</span> kmo_combine_pars_create(recipe->parameters,
+<a name="l00596"></a>00596 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l00597"></a>00597 DEF_REJ_METHOD,
+<a name="l00598"></a>00598 FALSE);
+<a name="l00599"></a>00599 }
+<a name="l00600"></a>00600
+<a name="l00606"></a>00606 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sci_red_exec(cpl_plugin *plugin)
+<a name="l00607"></a>00607 {
+<a name="l00608"></a>00608 cpl_recipe *recipe;
+<a name="l00609"></a>00609
+<a name="l00610"></a>00610 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00611"></a>00611 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00612"></a>00612 recipe = (cpl_recipe *)plugin;
+<a name="l00613"></a>00613 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00614"></a>00614
+<a name="l00615"></a>00615 <span class="keywordflow">return</span> kmo_sci_red(recipe->parameters, recipe->frames);
+<a name="l00616"></a>00616 }
+<a name="l00617"></a>00617
+<a name="l00623"></a>00623 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sci_red_destroy(cpl_plugin *plugin)
+<a name="l00624"></a>00624 {
+<a name="l00625"></a>00625 cpl_recipe *recipe;
+<a name="l00626"></a>00626
+<a name="l00627"></a>00627 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00628"></a>00628 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00629"></a>00629 recipe = (cpl_recipe *)plugin;
+<a name="l00630"></a>00630 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00631"></a>00631
+<a name="l00632"></a>00632 cpl_parameterlist_delete(recipe->parameters);
+<a name="l00633"></a>00633 <span class="keywordflow">return</span> 0 ;
+<a name="l00634"></a>00634 }
+<a name="l00635"></a>00635
+<a name="l00650"></a>00650 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
+<a name="l00651"></a>00651 {
+<a name="l00652"></a>00652 <span class="keywordtype">int</span> ret_val = 0,
+<a name="l00653"></a>00653 nr_science_frames = 0,
+<a name="l00654"></a>00654 nr_reconstructed_frames = 0,
+<a name="l00655"></a>00655 has_illum_corr = 0,
+<a name="l00656"></a>00656 has_master_flat = 0,
+<a name="l00657"></a>00657 has_telluric = 0,
+<a name="l00658"></a>00658 telluric_ok = 0,
+<a name="l00659"></a>00659 *bounds = NULL,
+<a name="l00660"></a>00660 det_nr = 0,
+<a name="l00661"></a>00661 actual_msg_level = 0,
+<a name="l00662"></a>00662 print_once = FALSE,
+<a name="l00663"></a>00663 cube_counter_data = 0,
+<a name="l00664"></a>00664 cube_counter_noise = 0,
+<a name="l00665"></a>00665 citer = 0,
+<a name="l00666"></a>00666 cmin = 0,
+<a name="l00667"></a>00667 cmax = 0,
+<a name="l00668"></a>00668 extrapolate = 0,
+<a name="l00669"></a>00669 flux = FALSE,
+<a name="l00670"></a>00670 background = FALSE,
+<a name="l00671"></a>00671 index = 0,
+<a name="l00672"></a>00672 nr_data_alloc = 0,
+<a name="l00673"></a>00673 tmp_int = 0,
+<a name="l00674"></a>00674 fast_mode = FALSE,
+<a name="l00675"></a>00675 edge_nan = FALSE,
+<a name="l00676"></a>00676 no_combine = FALSE,
+<a name="l00677"></a>00677 no_subtract = FALSE,
+<a name="l00678"></a>00678 do_sky_subtraction = FALSE,
+<a name="l00679"></a>00679 sky_tweak = FALSE,
+<a name="l00680"></a>00680 tbsub = TRUE,
+<a name="l00681"></a>00681 xcal_interpolation = FALSE,
+<a name="l00682"></a>00682 suppress_extension = FALSE,
+<a name="l00683"></a>00683 suppress_index = 0,
+<a name="l00684"></a>00684 i = 0,
+<a name="l00685"></a>00685 sf = 0,
+<a name="l00686"></a>00686 jj = 0,
+<a name="l00687"></a>00687 ifu_nr = 0;
+<a name="l00688"></a>00688 <span class="keywordtype">double</span> neighborhoodRange = 1.001,
+<a name="l00689"></a>00689 cpos_rej = 0.0,
+<a name="l00690"></a>00690 cneg_rej = 0.0,
+<a name="l00691"></a>00691 pix_scale = 0.0;
+<a name="l00692"></a>00692 <span class="keywordtype">char</span> *suffix = NULL,
+<a name="l00693"></a>00693 *keyword = NULL,
+<a name="l00694"></a>00694 *extname = NULL,
+<a name="l00695"></a>00695 *fn_suffix = NULL,
+<a name="l00696"></a>00696 *mapping_mode = NULL,
+<a name="l00697"></a>00697 **split = NULL,
+<a name="l00698"></a>00698 content[256];
+<a name="l00699"></a>00699 <span class="keyword">const</span> <span class="keywordtype">char</span> *imethod = NULL,
+<a name="l00700"></a>00700 *smethod = NULL,
+<a name="l00701"></a>00701 *ifus_txt = NULL,
+<a name="l00702"></a>00702 *name = NULL,
+<a name="l00703"></a>00703 *filter_id = NULL,
+<a name="l00704"></a>00704 *tmp_str = NULL,
+<a name="l00705"></a>00705 *filename = NULL,
+<a name="l00706"></a>00706 *fn_out = NULL,
+<a name="l00707"></a>00707 *fn_obj = NULL,
+<a name="l00708"></a>00708 *fn_sky = NULL,
+<a name="l00709"></a>00709 *fn_reconstr = NULL,
+<a name="l00710"></a>00710 *comb_method = NULL,
+<a name="l00711"></a>00711 *cmethod = NULL,
+<a name="l00712"></a>00712 *fmethod = NULL;
+<a name="l00713"></a>00713 cpl_array **unused_ifus_before = NULL,
+<a name="l00714"></a>00714 **unused_ifus_after = NULL;
+<a name="l00715"></a>00715 cpl_frame *xcal_frame = NULL,
+<a name="l00716"></a>00716 *ycal_frame = NULL,
+<a name="l00717"></a>00717 *lcal_frame = NULL,
+<a name="l00718"></a>00718 *flat_frame = NULL,
+<a name="l00719"></a>00719 *illum_frame = NULL,
+<a name="l00720"></a>00720 *telluric_frame = NULL,
+<a name="l00721"></a>00721 *tmp_frame = NULL;
+<a name="l00722"></a>00722 cpl_propertylist *tmp_header = NULL,
+<a name="l00723"></a>00723 *main_header = NULL,
+<a name="l00724"></a>00724 **header_data = NULL,
+<a name="l00725"></a>00725 **header_noise = NULL;
+<a name="l00726"></a>00726 cpl_vector *ifus = NULL;
+<a name="l00727"></a>00727 kmclipm_vector *telluric_data = NULL,
+<a name="l00728"></a>00728 *telluric_noise = NULL;
+<a name="l00729"></a>00729 cpl_image **lcal = NULL,
+<a name="l00730"></a>00730 *illum_data = NULL,
+<a name="l00731"></a>00731 *illum_noise = NULL,
+<a name="l00732"></a>00732 *tmpImg = NULL;
+<a name="l00733"></a>00733 cpl_imagelist **cube_data = NULL,
+<a name="l00734"></a>00734 **cube_noise = NULL,
+<a name="l00735"></a>00735 *sky_data = NULL,
+<a name="l00736"></a>00736 *sky_noise = NULL,
+<a name="l00737"></a>00737 *combined_data = NULL,
+<a name="l00738"></a>00738 *combined_noise = NULL,
+<a name="l00739"></a>00739 *tmpCube = NULL;
+<a name="l00740"></a>00740 cpl_table *band_table = NULL;
+<a name="l00741"></a>00741 cpl_frame *sky_frame = NULL,
+<a name="l00742"></a>00742 *sky_as_object_frame = NULL,
+<a name="l00743"></a>00743 *ref_spectrum_frame = NULL;
+<a name="l00744"></a>00744 cpl_polynomial *lcorr_coeffs = NULL;
+<a name="l00745"></a>00745 main_fits_desc desc1,
+<a name="l00746"></a>00746 desc2,
+<a name="l00747"></a>00747 desc_telluric;
+<a name="l00748"></a>00748 gridDefinition gd;
+<a name="l00749"></a>00749 armNameStruct *arm_name_struct = NULL;
+<a name="l00750"></a>00750 <span class="keyword">enum</span> extrapolationType extrapol_enum = 0;
+<a name="l00751"></a>00751 <span class="keyword">enum</span> kmo_frame_type ft = 0;
<a name="l00752"></a>00752
-<a name="l00753"></a>00753 nr_science_frames = cpl_frameset_count_tags(frameset, SCIENCE);
-<a name="l00754"></a>00754 KMO_TRY_ASSURE(nr_science_frames >= 1,
-<a name="l00755"></a>00755 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00756"></a>00756 <span class="stringliteral">"At least one SCIENCE frame is required!"</span>);
-<a name="l00757"></a>00757 <span class="keywordflow">if</span> (nr_science_frames == 1) {
-<a name="l00758"></a>00758 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"At least two SCIENCE frames should be provided "</span>
-<a name="l00759"></a>00759 <span class="stringliteral">"in order to apply sky subtraction!"</span>);
-<a name="l00760"></a>00760 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"All IFUs will be reconstructed regardless if "</span>
-<a name="l00761"></a>00761 <span class="stringliteral">"they contain object, reference or sky!"</span>);
-<a name="l00762"></a>00762 }
-<a name="l00763"></a>00763
-<a name="l00764"></a>00764 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, XCAL) == 1,
-<a name="l00765"></a>00765 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00766"></a>00766 <span class="stringliteral">"Exactly one XCAL frame is required!"</span>);
-<a name="l00767"></a>00767
-<a name="l00768"></a>00768 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, YCAL) == 1,
-<a name="l00769"></a>00769 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00770"></a>00770 <span class="stringliteral">"Exactly one YCAL frame is required!"</span>);
-<a name="l00771"></a>00771
-<a name="l00772"></a>00772 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, LCAL) == 1,
-<a name="l00773"></a>00773 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00774"></a>00774 <span class="stringliteral">"Exactly one LCAL frame is required!"</span>);
-<a name="l00775"></a>00775
-<a name="l00776"></a>00776 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, MASTER_FLAT) == 1,
-<a name="l00777"></a>00777 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00778"></a>00778 <span class="stringliteral">"Exactly one MASTER_FLAT frame is required!"</span>);
-<a name="l00779"></a>00779
-<a name="l00780"></a>00780 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, WAVE_BAND) == 1,
-<a name="l00781"></a>00781 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00782"></a>00782 <span class="stringliteral">"Exactly one WAVE_BAND frame is required!"</span>);
-<a name="l00783"></a>00783
-<a name="l00784"></a>00784 has_illum_corr = cpl_frameset_count_tags(frameset, ILLUM_CORR);
-<a name="l00785"></a>00785 KMO_TRY_ASSURE((has_illum_corr == 0) || (has_illum_corr == 1),
-<a name="l00786"></a>00786 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00787"></a>00787 <span class="stringliteral">"At most one ILLUM_CORR frame can be provided!"</span>);
-<a name="l00788"></a>00788
-<a name="l00789"></a>00789 has_telluric = cpl_frameset_count_tags(frameset, TELLURIC);
-<a name="l00790"></a>00790 KMO_TRY_ASSURE((has_telluric == 0) || (has_telluric == 1),
-<a name="l00791"></a>00791 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00792"></a>00792 <span class="stringliteral">"At most one TELLURIC frame can be provided!"</span>);
-<a name="l00793"></a>00793
-<a name="l00794"></a>00794 KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, <span class="stringliteral">"kmo_sci_red"</span>) == 1,
-<a name="l00795"></a>00795 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00796"></a>00796 <span class="stringliteral">"Cannot identify RAW and CALIB frames!"</span>);
-<a name="l00797"></a>00797
-<a name="l00798"></a>00798 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, OH_SPEC) == 0 ||
-<a name="l00799"></a>00799 cpl_frameset_count_tags(frameset, OH_SPEC) == 1,
-<a name="l00800"></a>00800 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00801"></a>00801 <span class="stringliteral">"Only a single reference spectrum can be provided!"</span>);
-<a name="l00802"></a>00802 <span class="comment">//</span>
-<a name="l00803"></a>00803 <span class="comment">// get parameters</span>
-<a name="l00804"></a>00804 <span class="comment">//</span>
-<a name="l00805"></a>00805 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"--- Parameter setup for kmo_sci_red ------"</span>);
-<a name="l00806"></a>00806
-<a name="l00807"></a>00807 flux = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00808"></a>00808 <span class="stringliteral">"kmos.kmo_sci_red.flux"</span>);
-<a name="l00809"></a>00809
-<a name="l00810"></a>00810 KMO_TRY_ASSURE((flux == 0) ||
-<a name="l00811"></a>00811 (flux == 1),
-<a name="l00812"></a>00812 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00813"></a>00813 <span class="stringliteral">"flux must be either FALSE or TRUE! %d"</span>, flux);
-<a name="l00814"></a>00814
-<a name="l00815"></a>00815 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00816"></a>00816 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.flux"</span>));
-<a name="l00817"></a>00817
-<a name="l00818"></a>00818 background = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00819"></a>00819 <span class="stringliteral">"kmos.kmo_sci_red.background"</span>);
-<a name="l00820"></a>00820
-<a name="l00821"></a>00821 KMO_TRY_ASSURE((background == 0) ||
-<a name="l00822"></a>00822 (background == 1),
-<a name="l00823"></a>00823 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00824"></a>00824 <span class="stringliteral">"background must be either FALSE or TRUE! %d"</span>, background);
-<a name="l00825"></a>00825
-<a name="l00826"></a>00826 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00827"></a>00827 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.background"</span>));
-<a name="l00828"></a>00828
-<a name="l00829"></a>00829 KMO_TRY_EXIT_IF_NULL(
-<a name="l00830"></a>00830 imethod = kmo_dfs_get_parameter_string(parlist,
-<a name="l00831"></a>00831 <span class="stringliteral">"kmos.kmo_sci_red.imethod"</span>));
+<a name="l00753"></a>00753 KMO_TRY
+<a name="l00754"></a>00754 {
+<a name="l00755"></a>00755 kmo_init_fits_desc(&desc1);
+<a name="l00756"></a>00756 kmo_init_fits_desc(&desc2);
+<a name="l00757"></a>00757 kmo_init_fits_desc(&desc_telluric);
+<a name="l00758"></a>00758
+<a name="l00759"></a>00759 <span class="comment">//</span>
+<a name="l00760"></a>00760 <span class="comment">// check frameset</span>
+<a name="l00761"></a>00761 <span class="comment">//</span>
+<a name="l00762"></a>00762 KMO_TRY_ASSURE((parlist != NULL) &&
+<a name="l00763"></a>00763 (frameset != NULL),
+<a name="l00764"></a>00764 CPL_ERROR_NULL_INPUT,
+<a name="l00765"></a>00765 <span class="stringliteral">"Not all input data is provided!"</span>);
+<a name="l00766"></a>00766
+<a name="l00767"></a>00767 nr_science_frames = cpl_frameset_count_tags(frameset, SCIENCE);
+<a name="l00768"></a>00768 KMO_TRY_ASSURE(nr_science_frames >= 1,
+<a name="l00769"></a>00769 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00770"></a>00770 <span class="stringliteral">"At least one SCIENCE frame is required!"</span>);
+<a name="l00771"></a>00771 <span class="keywordflow">if</span> (nr_science_frames == 1) {
+<a name="l00772"></a>00772 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"At least two SCIENCE frames should be provided "</span>
+<a name="l00773"></a>00773 <span class="stringliteral">"in order to apply sky subtraction!"</span>);
+<a name="l00774"></a>00774 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"All IFUs will be reconstructed regardless if "</span>
+<a name="l00775"></a>00775 <span class="stringliteral">"they contain object, reference or sky!"</span>);
+<a name="l00776"></a>00776 }
+<a name="l00777"></a>00777
+<a name="l00778"></a>00778 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, XCAL) == 1,
+<a name="l00779"></a>00779 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00780"></a>00780 <span class="stringliteral">"Exactly one XCAL frame is required!"</span>);
+<a name="l00781"></a>00781
+<a name="l00782"></a>00782 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, YCAL) == 1,
+<a name="l00783"></a>00783 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00784"></a>00784 <span class="stringliteral">"Exactly one YCAL frame is required!"</span>);
+<a name="l00785"></a>00785
+<a name="l00786"></a>00786 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, LCAL) == 1,
+<a name="l00787"></a>00787 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00788"></a>00788 <span class="stringliteral">"Exactly one LCAL frame is required!"</span>);
+<a name="l00789"></a>00789
+<a name="l00790"></a>00790 has_master_flat = cpl_frameset_count_tags(frameset, MASTER_FLAT);
+<a name="l00791"></a>00791 KMO_TRY_ASSURE((has_master_flat == 0) || (has_master_flat == 1),
+<a name="l00792"></a>00792 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00793"></a>00793 <span class="stringliteral">"At most one MASTER_FLAT frame can be provided!"</span>);
+<a name="l00794"></a>00794
+<a name="l00795"></a>00795 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, WAVE_BAND) == 1,
+<a name="l00796"></a>00796 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00797"></a>00797 <span class="stringliteral">"Exactly one WAVE_BAND frame is required!"</span>);
+<a name="l00798"></a>00798
+<a name="l00799"></a>00799 has_illum_corr = cpl_frameset_count_tags(frameset, ILLUM_CORR);
+<a name="l00800"></a>00800 KMO_TRY_ASSURE((has_illum_corr == 0) || (has_illum_corr == 1),
+<a name="l00801"></a>00801 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00802"></a>00802 <span class="stringliteral">"At most one ILLUM_CORR frame can be provided!"</span>);
+<a name="l00803"></a>00803
+<a name="l00804"></a>00804 has_telluric = cpl_frameset_count_tags(frameset, TELLURIC);
+<a name="l00805"></a>00805 KMO_TRY_ASSURE((has_telluric == 0) || (has_telluric == 1),
+<a name="l00806"></a>00806 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00807"></a>00807 <span class="stringliteral">"At most one TELLURIC frame can be provided!"</span>);
+<a name="l00808"></a>00808
+<a name="l00809"></a>00809 KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, <span class="stringliteral">"kmo_sci_red"</span>) == 1,
+<a name="l00810"></a>00810 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00811"></a>00811 <span class="stringliteral">"Cannot identify RAW and CALIB frames!"</span>);
+<a name="l00812"></a>00812
+<a name="l00813"></a>00813 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, OH_SPEC) == 0 ||
+<a name="l00814"></a>00814 cpl_frameset_count_tags(frameset, OH_SPEC) == 1,
+<a name="l00815"></a>00815 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00816"></a>00816 <span class="stringliteral">"Only a single reference spectrum can be provided!"</span>);
+<a name="l00817"></a>00817 <span class="comment">//</span>
+<a name="l00818"></a>00818 <span class="comment">// get parameters</span>
+<a name="l00819"></a>00819 <span class="comment">//</span>
+<a name="l00820"></a>00820 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"--- Parameter setup for kmo_sci_red ------"</span>);
+<a name="l00821"></a>00821
+<a name="l00822"></a>00822 flux = kmo_dfs_get_parameter_bool(parlist,
+<a name="l00823"></a>00823 <span class="stringliteral">"kmos.kmo_sci_red.flux"</span>);
+<a name="l00824"></a>00824
+<a name="l00825"></a>00825 KMO_TRY_ASSURE((flux == 0) ||
+<a name="l00826"></a>00826 (flux == 1),
+<a name="l00827"></a>00827 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00828"></a>00828 <span class="stringliteral">"flux must be either FALSE or TRUE! %d"</span>, flux);
+<a name="l00829"></a>00829
+<a name="l00830"></a>00830 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00831"></a>00831 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.flux"</span>));
<a name="l00832"></a>00832
-<a name="l00833"></a>00833 KMO_TRY_ASSURE((strcmp(imethod, <span class="stringliteral">"NN"</span>) == 0) ||
-<a name="l00834"></a>00834 (strcmp(imethod, <span class="stringliteral">"lwNN"</span>) == 0) ||
-<a name="l00835"></a>00835 (strcmp(imethod, <span class="stringliteral">"swNN"</span>) == 0) ||
-<a name="l00836"></a>00836 (strcmp(imethod, <span class="stringliteral">"MS"</span>) == 0) ||
-<a name="l00837"></a>00837 (strcmp(imethod, <span class="stringliteral">"CS"</span>) == 0),
+<a name="l00833"></a>00833 background = kmo_dfs_get_parameter_bool(parlist,
+<a name="l00834"></a>00834 <span class="stringliteral">"kmos.kmo_sci_red.background"</span>);
+<a name="l00835"></a>00835
+<a name="l00836"></a>00836 KMO_TRY_ASSURE((background == 0) ||
+<a name="l00837"></a>00837 (background == 1),
<a name="l00838"></a>00838 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00839"></a>00839 <span class="stringliteral">"imethod must be either \"NN\", \"lwNN\", "</span>
-<a name="l00840"></a>00840 <span class="stringliteral">"\"swNN\", \"MS\" or \"CS\"!"</span>);
-<a name="l00841"></a>00841
-<a name="l00842"></a>00842 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00843"></a>00843 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.imethod"</span>));
-<a name="l00844"></a>00844
-<a name="l00845"></a>00845 KMO_TRY_EXIT_IF_NULL(
-<a name="l00846"></a>00846 smethod = kmo_dfs_get_parameter_string(parlist,
-<a name="l00847"></a>00847 <span class="stringliteral">"kmos.kmo_sci_red.smethod"</span>));
-<a name="l00848"></a>00848
-<a name="l00849"></a>00849 KMO_TRY_ASSURE((strcmp(smethod, <span class="stringliteral">"NN"</span>) == 0) ||
-<a name="l00850"></a>00850 (strcmp(smethod, <span class="stringliteral">"CS"</span>) == 0),
-<a name="l00851"></a>00851 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00852"></a>00852 <span class="stringliteral">"smethod must be either \"NN\" or \"CS\"!"</span>);
-<a name="l00853"></a>00853
-<a name="l00854"></a>00854 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00855"></a>00855 kmo_dfs_print_parameter_help(parlist,
-<a name="l00856"></a>00856 <span class="stringliteral">"kmos.kmo_sci_red.smethod"</span>));
-<a name="l00857"></a>00857
-<a name="l00858"></a>00858 neighborhoodRange = kmo_dfs_get_parameter_double(parlist,
-<a name="l00859"></a>00859 <span class="stringliteral">"kmos.kmo_sci_red.neighborhoodRange"</span>);
-<a name="l00860"></a>00860 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00861"></a>00861
-<a name="l00862"></a>00862 KMO_TRY_ASSURE(neighborhoodRange > 0.0,
-<a name="l00863"></a>00863 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00864"></a>00864 <span class="stringliteral">"neighborhoodRange must be greater than 0.0"</span>);
-<a name="l00865"></a>00865
-<a name="l00866"></a>00866 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00867"></a>00867 kmo_dfs_print_parameter_help(parlist,
-<a name="l00868"></a>00868 <span class="stringliteral">"kmos.kmo_sci_red.neighborhoodRange"</span>));
-<a name="l00869"></a>00869
-<a name="l00870"></a>00870 KMO_TRY_EXIT_IF_NULL(
-<a name="l00871"></a>00871 comb_method = kmo_dfs_get_parameter_string(parlist,
-<a name="l00872"></a>00872 <span class="stringliteral">"kmos.kmo_sci_red.method"</span>));
-<a name="l00873"></a>00873
-<a name="l00874"></a>00874 KMO_TRY_EXIT_IF_NULL(
-<a name="l00875"></a>00875 fmethod = kmo_dfs_get_parameter_string(parlist,
-<a name="l00876"></a>00876 <span class="stringliteral">"kmos.kmo_sci_red.fmethod"</span>));
-<a name="l00877"></a>00877
-<a name="l00878"></a>00878 KMO_TRY_ASSURE((strcmp(comb_method, <span class="stringliteral">"none"</span>) == 0) ||
-<a name="l00879"></a>00879 (strcmp(comb_method, <span class="stringliteral">"header"</span>) == 0) ||
-<a name="l00880"></a>00880 (strcmp(comb_method, <span class="stringliteral">"center"</span>) == 0) ||
-<a name="l00881"></a>00881 (strcmp(comb_method, <span class="stringliteral">"user"</span>) == 0),
-<a name="l00882"></a>00882 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00883"></a>00883 <span class="stringliteral">"Following shift methods are available : 'none', "</span>
-<a name="l00884"></a>00884 <span class="stringliteral">"'header', 'center' or 'user'"</span>);
-<a name="l00885"></a>00885
-<a name="l00886"></a>00886 <span class="keywordflow">if</span> (strcmp(comb_method, <span class="stringliteral">"user"</span>) == 0) {
-<a name="l00887"></a>00887 filename = kmo_dfs_get_parameter_string(parlist,
-<a name="l00888"></a>00888 <span class="stringliteral">"kmos.kmo_sci_red.filename"</span>);
-<a name="l00889"></a>00889 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00890"></a>00890
-<a name="l00891"></a>00891 KMO_TRY_ASSURE(strcmp(filename, <span class="stringliteral">""</span>) != 0,
-<a name="l00892"></a>00892 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00893"></a>00893 <span class="stringliteral">"path of file with shift information must be "</span>
-<a name="l00894"></a>00894 <span class="stringliteral">"provided!"</span>);
-<a name="l00895"></a>00895
-<a name="l00896"></a>00896 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00897"></a>00897 kmo_dfs_print_parameter_help(parlist,
-<a name="l00898"></a>00898 <span class="stringliteral">"kmos.kmo_sci_red.filename"</span>));
-<a name="l00899"></a>00899 }
+<a name="l00839"></a>00839 <span class="stringliteral">"background must be either FALSE or TRUE! %d"</span>, background);
+<a name="l00840"></a>00840
+<a name="l00841"></a>00841 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00842"></a>00842 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.background"</span>));
+<a name="l00843"></a>00843
+<a name="l00844"></a>00844 KMO_TRY_EXIT_IF_NULL(
+<a name="l00845"></a>00845 imethod = kmo_dfs_get_parameter_string(parlist,
+<a name="l00846"></a>00846 <span class="stringliteral">"kmos.kmo_sci_red.imethod"</span>));
+<a name="l00847"></a>00847
+<a name="l00848"></a>00848 KMO_TRY_ASSURE((strcmp(imethod, <span class="stringliteral">"NN"</span>) == 0) ||
+<a name="l00849"></a>00849 (strcmp(imethod, <span class="stringliteral">"lwNN"</span>) == 0) ||
+<a name="l00850"></a>00850 (strcmp(imethod, <span class="stringliteral">"swNN"</span>) == 0) ||
+<a name="l00851"></a>00851 (strcmp(imethod, <span class="stringliteral">"MS"</span>) == 0) ||
+<a name="l00852"></a>00852 (strcmp(imethod, <span class="stringliteral">"CS"</span>) == 0),
+<a name="l00853"></a>00853 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00854"></a>00854 <span class="stringliteral">"imethod must be either \"NN\", \"lwNN\", "</span>
+<a name="l00855"></a>00855 <span class="stringliteral">"\"swNN\", \"MS\" or \"CS\"!"</span>);
+<a name="l00856"></a>00856
+<a name="l00857"></a>00857 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00858"></a>00858 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.imethod"</span>));
+<a name="l00859"></a>00859
+<a name="l00860"></a>00860 KMO_TRY_EXIT_IF_NULL(
+<a name="l00861"></a>00861 smethod = kmo_dfs_get_parameter_string(parlist,
+<a name="l00862"></a>00862 <span class="stringliteral">"kmos.kmo_sci_red.smethod"</span>));
+<a name="l00863"></a>00863
+<a name="l00864"></a>00864 KMO_TRY_ASSURE((strcmp(smethod, <span class="stringliteral">"NN"</span>) == 0) ||
+<a name="l00865"></a>00865 (strcmp(smethod, <span class="stringliteral">"CS"</span>) == 0),
+<a name="l00866"></a>00866 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00867"></a>00867 <span class="stringliteral">"smethod must be either \"NN\" or \"CS\"!"</span>);
+<a name="l00868"></a>00868
+<a name="l00869"></a>00869 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00870"></a>00870 kmo_dfs_print_parameter_help(parlist,
+<a name="l00871"></a>00871 <span class="stringliteral">"kmos.kmo_sci_red.smethod"</span>));
+<a name="l00872"></a>00872
+<a name="l00873"></a>00873 neighborhoodRange = kmo_dfs_get_parameter_double(parlist,
+<a name="l00874"></a>00874 <span class="stringliteral">"kmos.kmo_sci_red.neighborhoodRange"</span>);
+<a name="l00875"></a>00875 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00876"></a>00876
+<a name="l00877"></a>00877 KMO_TRY_ASSURE(neighborhoodRange > 0.0,
+<a name="l00878"></a>00878 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00879"></a>00879 <span class="stringliteral">"neighborhoodRange must be greater than 0.0"</span>);
+<a name="l00880"></a>00880
+<a name="l00881"></a>00881 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00882"></a>00882 kmo_dfs_print_parameter_help(parlist,
+<a name="l00883"></a>00883 <span class="stringliteral">"kmos.kmo_sci_red.neighborhoodRange"</span>));
+<a name="l00884"></a>00884
+<a name="l00885"></a>00885 KMO_TRY_EXIT_IF_NULL(
+<a name="l00886"></a>00886 comb_method = kmo_dfs_get_parameter_string(parlist,
+<a name="l00887"></a>00887 <span class="stringliteral">"kmos.kmo_sci_red.method"</span>));
+<a name="l00888"></a>00888
+<a name="l00889"></a>00889 KMO_TRY_EXIT_IF_NULL(
+<a name="l00890"></a>00890 fmethod = kmo_dfs_get_parameter_string(parlist,
+<a name="l00891"></a>00891 <span class="stringliteral">"kmos.kmo_sci_red.fmethod"</span>));
+<a name="l00892"></a>00892
+<a name="l00893"></a>00893 KMO_TRY_ASSURE((strcmp(comb_method, <span class="stringliteral">"none"</span>) == 0) ||
+<a name="l00894"></a>00894 (strcmp(comb_method, <span class="stringliteral">"header"</span>) == 0) ||
+<a name="l00895"></a>00895 (strcmp(comb_method, <span class="stringliteral">"center"</span>) == 0) ||
+<a name="l00896"></a>00896 (strcmp(comb_method, <span class="stringliteral">"user"</span>) == 0),
+<a name="l00897"></a>00897 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00898"></a>00898 <span class="stringliteral">"Following shift methods are available : 'none', "</span>
+<a name="l00899"></a>00899 <span class="stringliteral">"'header', 'center' or 'user'"</span>);
<a name="l00900"></a>00900
-<a name="l00901"></a>00901 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00902"></a>00902 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.method"</span>));
-<a name="l00903"></a>00903
-<a name="l00904"></a>00904 ifus_txt = kmo_dfs_get_parameter_string(parlist,
-<a name="l00905"></a>00905 <span class="stringliteral">"kmos.kmo_sci_red.ifus"</span>);
-<a name="l00906"></a>00906 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00907"></a>00907
-<a name="l00908"></a>00908 name = kmo_dfs_get_parameter_string(parlist, <span class="stringliteral">"kmos.kmo_sci_red.name"</span>);
-<a name="l00909"></a>00909 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00901"></a>00901 <span class="keywordflow">if</span> (strcmp(comb_method, <span class="stringliteral">"user"</span>) == 0) {
+<a name="l00902"></a>00902 filename = kmo_dfs_get_parameter_string(parlist,
+<a name="l00903"></a>00903 <span class="stringliteral">"kmos.kmo_sci_red.filename"</span>);
+<a name="l00904"></a>00904 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00905"></a>00905
+<a name="l00906"></a>00906 KMO_TRY_ASSURE(strcmp(filename, <span class="stringliteral">""</span>) != 0,
+<a name="l00907"></a>00907 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00908"></a>00908 <span class="stringliteral">"path of file with shift information must be "</span>
+<a name="l00909"></a>00909 <span class="stringliteral">"provided!"</span>);
<a name="l00910"></a>00910
-<a name="l00911"></a>00911 <span class="keywordflow">if</span> (strcmp(ifus_txt, <span class="stringliteral">""</span>) != 0) {
-<a name="l00912"></a>00912 KMO_TRY_ASSURE(strcmp(name, <span class="stringliteral">""</span>) == 0,
-<a name="l00913"></a>00913 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00914"></a>00914 <span class="stringliteral">"name parameter must be NULL if IFU indices are "</span>
-<a name="l00915"></a>00915 <span class="stringliteral">"provided!"</span>);
-<a name="l00916"></a>00916
-<a name="l00917"></a>00917 KMO_TRY_EXIT_IF_NULL(
-<a name="l00918"></a>00918 ifus = kmo_identify_values(ifus_txt));
-<a name="l00919"></a>00919
-<a name="l00920"></a>00920 KMO_TRY_ASSURE(cpl_vector_get_size(ifus) == nr_science_frames,
-<a name="l00921"></a>00921 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00922"></a>00922 <span class="stringliteral">"ifus parameter must have the same number of values "</span>
-<a name="l00923"></a>00923 <span class="stringliteral">"than frames provided (for frames just containing "</span>
-<a name="l00924"></a>00924 <span class="stringliteral">"skies insert 0)) (%lld!=%d)"</span>,
-<a name="l00925"></a>00925 cpl_vector_get_size(ifus), nr_science_frames);
-<a name="l00926"></a>00926 }
-<a name="l00927"></a>00927
-<a name="l00928"></a>00928 <span class="keywordflow">if</span> (strcmp(name, <span class="stringliteral">""</span>) != 0) {
-<a name="l00929"></a>00929 KMO_TRY_ASSURE(strcmp(ifus_txt, <span class="stringliteral">""</span>) == 0,
-<a name="l00930"></a>00930 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00931"></a>00931 <span class="stringliteral">"ifus parameter must be NULL if name is provided!"</span>);
-<a name="l00932"></a>00932 }
-<a name="l00933"></a>00933
-<a name="l00934"></a>00934 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00935"></a>00935 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.ifus"</span>));
-<a name="l00936"></a>00936
-<a name="l00937"></a>00937 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00938"></a>00938 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.name"</span>));
-<a name="l00939"></a>00939
-<a name="l00940"></a>00940 kmo_band_pars_load(parlist, <span class="stringliteral">"kmos.kmo_sci_red"</span>);
-<a name="l00941"></a>00941
-<a name="l00942"></a>00942 extrapolate = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00943"></a>00943 <span class="stringliteral">"kmos.kmo_sci_red.extrapolate"</span>);
-<a name="l00944"></a>00944 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00945"></a>00945
-<a name="l00946"></a>00946 <span class="keywordflow">if</span> (strcmp(smethod, <span class="stringliteral">"NN"</span>) == 0) {
-<a name="l00947"></a>00947 <span class="keywordflow">if</span> (extrapolate == TRUE) {
-<a name="l00948"></a>00948 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"extrapolation for smethod='NN' not available!"</span>);
-<a name="l00949"></a>00949 }
-<a name="l00950"></a>00950 extrapol_enum = NONE_NANS;
-<a name="l00951"></a>00951 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(smethod, <span class="stringliteral">"CS"</span>) == 0) {
-<a name="l00952"></a>00952 <span class="keywordflow">if</span> (extrapolate == FALSE) {
-<a name="l00953"></a>00953 extrapol_enum = NONE_NANS;
-<a name="l00954"></a>00954 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (extrapolate == TRUE) {
-<a name="l00955"></a>00955 extrapol_enum = BCS_NATURAL;
-<a name="l00956"></a>00956 } <span class="keywordflow">else</span> {
-<a name="l00957"></a>00957 KMO_TRY_ASSURE(1 == 0,
-<a name="l00958"></a>00958 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00959"></a>00959 <span class="stringliteral">"extrapolate must be either FALSE or TRUE!"</span>);
-<a name="l00960"></a>00960 }
-<a name="l00961"></a>00961 smethod = <span class="stringliteral">"BCS"</span>;
-<a name="l00962"></a>00962 } <span class="keywordflow">else</span> {
-<a name="l00963"></a>00963 KMO_TRY_ASSURE(1 == 0,
-<a name="l00964"></a>00964 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00965"></a>00965 <span class="stringliteral">"method must be either \"CS\" or \"NN\" !"</span>);
-<a name="l00966"></a>00966 }
-<a name="l00967"></a>00967 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00968"></a>00968
-<a name="l00969"></a>00969 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00970"></a>00970 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.extrapolate"</span>));
-<a name="l00971"></a>00971
-<a name="l00972"></a>00972 fast_mode = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00973"></a>00973 <span class="stringliteral">"kmos.kmo_sci_red.fast_mode"</span>);
-<a name="l00974"></a>00974 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00975"></a>00975 KMO_TRY_ASSURE((fast_mode == TRUE) ||
-<a name="l00976"></a>00976 (fast_mode == FALSE),
-<a name="l00977"></a>00977 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00978"></a>00978 <span class="stringliteral">"fast_mode must be either FALSE or TRUE!"</span>);
-<a name="l00979"></a>00979 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00980"></a>00980 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.fast_mode"</span>));
-<a name="l00981"></a>00981
-<a name="l00982"></a>00982 edge_nan = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00983"></a>00983 <span class="stringliteral">"kmos.kmo_sci_red.edge_nan"</span>);
-<a name="l00984"></a>00984 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00985"></a>00985 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00986"></a>00986 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.edge_nan"</span>));
-<a name="l00987"></a>00987
-<a name="l00988"></a>00988 KMO_TRY_ASSURE((edge_nan == TRUE) || (edge_nan == FALSE),
-<a name="l00989"></a>00989 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00990"></a>00990 <span class="stringliteral">"edge_nan must be TRUE or FALSE!"</span>);
-<a name="l00991"></a>00991
-<a name="l00992"></a>00992 no_combine = kmo_dfs_get_parameter_bool(parlist,
-<a name="l00993"></a>00993 <span class="stringliteral">"kmos.kmo_sci_red.no_combine"</span>);
-<a name="l00994"></a>00994 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00995"></a>00995
-<a name="l00996"></a>00996 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00997"></a>00997 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.no_combine"</span>));
-<a name="l00998"></a>00998
-<a name="l00999"></a>00999 KMO_TRY_ASSURE((no_combine == TRUE) || (no_combine == FALSE),
-<a name="l01000"></a>01000 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01001"></a>01001 <span class="stringliteral">"no_combine must be TRUE or FALSE!"</span>);
+<a name="l00911"></a>00911 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00912"></a>00912 kmo_dfs_print_parameter_help(parlist,
+<a name="l00913"></a>00913 <span class="stringliteral">"kmos.kmo_sci_red.filename"</span>));
+<a name="l00914"></a>00914 }
+<a name="l00915"></a>00915
+<a name="l00916"></a>00916 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00917"></a>00917 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.method"</span>));
+<a name="l00918"></a>00918
+<a name="l00919"></a>00919 ifus_txt = kmo_dfs_get_parameter_string(parlist,
+<a name="l00920"></a>00920 <span class="stringliteral">"kmos.kmo_sci_red.ifus"</span>);
+<a name="l00921"></a>00921 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00922"></a>00922
+<a name="l00923"></a>00923 name = kmo_dfs_get_parameter_string(parlist, <span class="stringliteral">"kmos.kmo_sci_red.name"</span>);
+<a name="l00924"></a>00924 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00925"></a>00925
+<a name="l00926"></a>00926 <span class="keywordflow">if</span> (strcmp(ifus_txt, <span class="stringliteral">""</span>) != 0) {
+<a name="l00927"></a>00927 KMO_TRY_ASSURE(strcmp(name, <span class="stringliteral">""</span>) == 0,
+<a name="l00928"></a>00928 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00929"></a>00929 <span class="stringliteral">"name parameter must be NULL if IFU indices are "</span>
+<a name="l00930"></a>00930 <span class="stringliteral">"provided!"</span>);
+<a name="l00931"></a>00931
+<a name="l00932"></a>00932 KMO_TRY_EXIT_IF_NULL(
+<a name="l00933"></a>00933 ifus = kmo_identify_values(ifus_txt));
+<a name="l00934"></a>00934
+<a name="l00935"></a>00935 KMO_TRY_ASSURE(cpl_vector_get_size(ifus) == nr_science_frames,
+<a name="l00936"></a>00936 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00937"></a>00937 <span class="stringliteral">"ifus parameter must have the same number of values "</span>
+<a name="l00938"></a>00938 <span class="stringliteral">"than frames provided (for frames just containing "</span>
+<a name="l00939"></a>00939 <span class="stringliteral">"skies insert 0)) (%lld!=%d)"</span>,
+<a name="l00940"></a>00940 cpl_vector_get_size(ifus), nr_science_frames);
+<a name="l00941"></a>00941 }
+<a name="l00942"></a>00942
+<a name="l00943"></a>00943 <span class="keywordflow">if</span> (strcmp(name, <span class="stringliteral">""</span>) != 0) {
+<a name="l00944"></a>00944 KMO_TRY_ASSURE(strcmp(ifus_txt, <span class="stringliteral">""</span>) == 0,
+<a name="l00945"></a>00945 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00946"></a>00946 <span class="stringliteral">"ifus parameter must be NULL if name is provided!"</span>);
+<a name="l00947"></a>00947 }
+<a name="l00948"></a>00948
+<a name="l00949"></a>00949 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00950"></a>00950 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.ifus"</span>));
+<a name="l00951"></a>00951
+<a name="l00952"></a>00952 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00953"></a>00953 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.name"</span>));
+<a name="l00954"></a>00954
+<a name="l00955"></a>00955 kmo_band_pars_load(parlist, <span class="stringliteral">"kmos.kmo_sci_red"</span>);
+<a name="l00956"></a>00956
+<a name="l00957"></a>00957 extrapolate = kmo_dfs_get_parameter_bool(parlist,
+<a name="l00958"></a>00958 <span class="stringliteral">"kmos.kmo_sci_red.extrapolate"</span>);
+<a name="l00959"></a>00959 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00960"></a>00960
+<a name="l00961"></a>00961 <span class="keywordflow">if</span> (strcmp(smethod, <span class="stringliteral">"NN"</span>) == 0) {
+<a name="l00962"></a>00962 <span class="keywordflow">if</span> (extrapolate == TRUE) {
+<a name="l00963"></a>00963 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"extrapolation for smethod='NN' not available!"</span>);
+<a name="l00964"></a>00964 }
+<a name="l00965"></a>00965 extrapol_enum = NONE_NANS;
+<a name="l00966"></a>00966 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(smethod, <span class="stringliteral">"CS"</span>) == 0) {
+<a name="l00967"></a>00967 <span class="keywordflow">if</span> (extrapolate == FALSE) {
+<a name="l00968"></a>00968 extrapol_enum = NONE_NANS;
+<a name="l00969"></a>00969 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (extrapolate == TRUE) {
+<a name="l00970"></a>00970 extrapol_enum = BCS_NATURAL;
+<a name="l00971"></a>00971 } <span class="keywordflow">else</span> {
+<a name="l00972"></a>00972 KMO_TRY_ASSURE(1 == 0,
+<a name="l00973"></a>00973 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00974"></a>00974 <span class="stringliteral">"extrapolate must be either FALSE or TRUE!"</span>);
+<a name="l00975"></a>00975 }
+<a name="l00976"></a>00976 smethod = <span class="stringliteral">"BCS"</span>;
+<a name="l00977"></a>00977 } <span class="keywordflow">else</span> {
+<a name="l00978"></a>00978 KMO_TRY_ASSURE(1 == 0,
+<a name="l00979"></a>00979 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00980"></a>00980 <span class="stringliteral">"method must be either \"CS\" or \"NN\" !"</span>);
+<a name="l00981"></a>00981 }
+<a name="l00982"></a>00982 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00983"></a>00983
+<a name="l00984"></a>00984 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00985"></a>00985 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.extrapolate"</span>));
+<a name="l00986"></a>00986
+<a name="l00987"></a>00987 fast_mode = kmo_dfs_get_parameter_bool(parlist,
+<a name="l00988"></a>00988 <span class="stringliteral">"kmos.kmo_sci_red.fast_mode"</span>);
+<a name="l00989"></a>00989 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00990"></a>00990 KMO_TRY_ASSURE((fast_mode == TRUE) ||
+<a name="l00991"></a>00991 (fast_mode == FALSE),
+<a name="l00992"></a>00992 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00993"></a>00993 <span class="stringliteral">"fast_mode must be either FALSE or TRUE!"</span>);
+<a name="l00994"></a>00994 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00995"></a>00995 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.fast_mode"</span>));
+<a name="l00996"></a>00996
+<a name="l00997"></a>00997 edge_nan = kmo_dfs_get_parameter_bool(parlist,
+<a name="l00998"></a>00998 <span class="stringliteral">"kmos.kmo_sci_red.edge_nan"</span>);
+<a name="l00999"></a>00999 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01000"></a>01000 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01001"></a>01001 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.edge_nan"</span>));
<a name="l01002"></a>01002
-<a name="l01003"></a>01003 no_subtract = kmo_dfs_get_parameter_bool(parlist,
-<a name="l01004"></a>01004 <span class="stringliteral">"kmos.kmo_sci_red.no_subtract"</span>);
-<a name="l01005"></a>01005 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01003"></a>01003 KMO_TRY_ASSURE((edge_nan == TRUE) || (edge_nan == FALSE),
+<a name="l01004"></a>01004 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01005"></a>01005 <span class="stringliteral">"edge_nan must be TRUE or FALSE!"</span>);
<a name="l01006"></a>01006
-<a name="l01007"></a>01007 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01008"></a>01008 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.no_subtract"</span>));
-<a name="l01009"></a>01009
-<a name="l01010"></a>01010 KMO_TRY_ASSURE((no_subtract == TRUE) || (no_subtract == FALSE),
-<a name="l01011"></a>01011 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01012"></a>01012 <span class="stringliteral">"no_subtract must be TRUE or FALSE!"</span>);
+<a name="l01007"></a>01007 no_combine = kmo_dfs_get_parameter_bool(parlist,
+<a name="l01008"></a>01008 <span class="stringliteral">"kmos.kmo_sci_red.no_combine"</span>);
+<a name="l01009"></a>01009 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01010"></a>01010
+<a name="l01011"></a>01011 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01012"></a>01012 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.no_combine"</span>));
<a name="l01013"></a>01013
-<a name="l01014"></a>01014 sky_tweak = kmo_dfs_get_parameter_bool(parlist,
-<a name="l01015"></a>01015 <span class="stringliteral">"kmos.kmo_sci_red.sky_tweak"</span>);
-<a name="l01016"></a>01016 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01014"></a>01014 KMO_TRY_ASSURE((no_combine == TRUE) || (no_combine == FALSE),
+<a name="l01015"></a>01015 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01016"></a>01016 <span class="stringliteral">"no_combine must be TRUE or FALSE!"</span>);
<a name="l01017"></a>01017
-<a name="l01018"></a>01018 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01019"></a>01019 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.sky_tweak"</span>));
-<a name="l01020"></a>01020
-<a name="l01021"></a>01021 KMO_TRY_ASSURE((sky_tweak == TRUE) || (sky_tweak == FALSE),
-<a name="l01022"></a>01022 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01023"></a>01023 <span class="stringliteral">"sky_tweak must be TRUE or FALSE!"</span>);
+<a name="l01018"></a>01018 no_subtract = kmo_dfs_get_parameter_bool(parlist,
+<a name="l01019"></a>01019 <span class="stringliteral">"kmos.kmo_sci_red.no_subtract"</span>);
+<a name="l01020"></a>01020 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01021"></a>01021
+<a name="l01022"></a>01022 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01023"></a>01023 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.no_subtract"</span>));
<a name="l01024"></a>01024
-<a name="l01025"></a>01025 KMO_TRY_ASSURE(!((no_subtract == TRUE) && (sky_tweak == TRUE)),
-<a name="l01026"></a>01026 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01027"></a>01027 <span class="stringliteral">"Either no_subtract or sky_tweak or both must be FALSE"</span>);
+<a name="l01025"></a>01025 KMO_TRY_ASSURE((no_subtract == TRUE) || (no_subtract == FALSE),
+<a name="l01026"></a>01026 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01027"></a>01027 <span class="stringliteral">"no_subtract must be TRUE or FALSE!"</span>);
<a name="l01028"></a>01028
-<a name="l01029"></a>01029 pix_scale = kmo_dfs_get_parameter_double(parlist,
-<a name="l01030"></a>01030 <span class="stringliteral">"kmos.kmo_sci_red.pix_scale"</span>);
+<a name="l01029"></a>01029 sky_tweak = kmo_dfs_get_parameter_bool(parlist,
+<a name="l01030"></a>01030 <span class="stringliteral">"kmos.kmo_sci_red.sky_tweak"</span>);
<a name="l01031"></a>01031 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01032"></a>01032 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01033"></a>01033 kmo_dfs_print_parameter_help(parlist,
-<a name="l01034"></a>01034 <span class="stringliteral">"kmos.kmo_sci_red.pix_scale"</span>));
-<a name="l01035"></a>01035 KMO_TRY_ASSURE((pix_scale >= 0.01) &&
-<a name="l01036"></a>01036 (pix_scale <= 0.4),
+<a name="l01032"></a>01032
+<a name="l01033"></a>01033 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01034"></a>01034 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.sky_tweak"</span>));
+<a name="l01035"></a>01035
+<a name="l01036"></a>01036 KMO_TRY_ASSURE((sky_tweak == TRUE) || (sky_tweak == FALSE),
<a name="l01037"></a>01037 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01038"></a>01038 <span class="stringliteral">"pix_scale must be between 0.01 and 0.4 (results in cubes "</span>
-<a name="l01039"></a>01039 <span class="stringliteral">"with 7x7 to 280x280 pixels)!"</span>);
-<a name="l01040"></a>01040
-<a name="l01041"></a>01041 xcal_interpolation = kmo_dfs_get_parameter_bool(parlist,
-<a name="l01042"></a>01042 <span class="stringliteral">"kmos.kmo_sci_red.xcal_interpolation"</span>);
-<a name="l01043"></a>01043 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01044"></a>01044 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01045"></a>01045 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.xcal_interpolation"</span>));
-<a name="l01046"></a>01046 KMO_TRY_ASSURE((xcal_interpolation == TRUE) ||
-<a name="l01047"></a>01047 (xcal_interpolation == FALSE),
-<a name="l01048"></a>01048 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01049"></a>01049 <span class="stringliteral">"xcal_interpolation must be TRUE or FALSE!"</span>);
-<a name="l01050"></a>01050
-<a name="l01051"></a>01051 suppress_extension = kmo_dfs_get_parameter_bool(parlist,
-<a name="l01052"></a>01052 <span class="stringliteral">"kmos.kmo_sci_red.suppress_extension"</span>);
-<a name="l01053"></a>01053 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01054"></a>01054 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01055"></a>01055 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.suppress_extension"</span>));
-<a name="l01056"></a>01056
-<a name="l01057"></a>01057 KMO_TRY_ASSURE((suppress_extension == TRUE) || (suppress_extension == FALSE),
-<a name="l01058"></a>01058 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01059"></a>01059 <span class="stringliteral">"suppress_extension must be TRUE or FALSE!"</span>);
-<a name="l01060"></a>01060
-<a name="l01061"></a>01061 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01062"></a>01062 kmo_combine_pars_load(parlist,
-<a name="l01063"></a>01063 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
-<a name="l01064"></a>01064 &cmethod,
-<a name="l01065"></a>01065 &cpos_rej,
-<a name="l01066"></a>01066 &cneg_rej,
-<a name="l01067"></a>01067 &citer,
-<a name="l01068"></a>01068 &cmin,
-<a name="l01069"></a>01069 &cmax,
-<a name="l01070"></a>01070 FALSE));
-<a name="l01071"></a>01071
-<a name="l01072"></a>01072 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
-<a name="l01073"></a>01073
-<a name="l01074"></a>01074 <span class="comment">//</span>
-<a name="l01075"></a>01075 <span class="comment">// assure that filters, grating and rotation offsets match for</span>
-<a name="l01076"></a>01076 <span class="comment">// XCAL, YCAL, LCAL and for data frame to reconstruct (except DARK</span>
-<a name="l01077"></a>01077 <span class="comment">// frames)</span>
-<a name="l01078"></a>01078 <span class="comment">//</span>
-<a name="l01079"></a>01079
-<a name="l01080"></a>01080 <span class="comment">// check if filter_id and grating_id match for all detectors</span>
-<a name="l01081"></a>01081 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01082"></a>01082 kmo_check_frameset_setup(frameset, SCIENCE, TRUE, FALSE, TRUE));
-<a name="l01083"></a>01083 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01084"></a>01084 kmo_check_frame_setup(frameset, SCIENCE, YCAL, TRUE, FALSE, TRUE));
-<a name="l01085"></a>01085 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01086"></a>01086 kmo_check_frame_setup(frameset, XCAL, YCAL, TRUE, FALSE, TRUE));
-<a name="l01087"></a>01087 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01088"></a>01088 kmo_check_frame_setup(frameset, XCAL, LCAL, TRUE, FALSE, TRUE));
-<a name="l01089"></a>01089 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
-<a name="l01090"></a>01090 <span class="comment">// kmo_check_cal_frames_rotangle(frameset, XCAL, YCAL));</span>
-<a name="l01091"></a>01091 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
-<a name="l01092"></a>01092 <span class="comment">// kmo_check_cal_frames_rotangle(frameset, XCAL, LCAL));</span>
-<a name="l01093"></a>01093 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01094"></a>01094 kmo_check_frame_setup(frameset, XCAL, MASTER_FLAT, TRUE, FALSE, TRUE));
-<a name="l01095"></a>01095 <span class="comment">// omit this check because ILLUM_CORR is band-independend</span>
-<a name="l01096"></a>01096 <span class="comment">// if (has_illum_corr) {</span>
-<a name="l01097"></a>01097 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
-<a name="l01098"></a>01098 <span class="comment">// kmo_check_frame_setup(frameset, XCAL, ILLUM_CORR,</span>
-<a name="l01099"></a>01099 <span class="comment">// TRUE, FALSE, TRUE));</span>
-<a name="l01100"></a>01100 <span class="comment">// }</span>
-<a name="l01101"></a>01101
-<a name="l01102"></a>01102 <span class="keywordflow">if</span> (has_telluric) {
-<a name="l01103"></a>01103 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01104"></a>01104 kmo_check_frame_setup(frameset, XCAL, TELLURIC,
-<a name="l01105"></a>01105 TRUE, FALSE, TRUE));
-<a name="l01106"></a>01106 }
-<a name="l01107"></a>01107
-<a name="l01108"></a>01108 <span class="comment">// check descriptors of all frames</span>
-<a name="l01109"></a>01109 KMO_TRY_EXIT_IF_NULL(
-<a name="l01110"></a>01110 xcal_frame = kmo_dfs_get_frame(frameset, XCAL));
-<a name="l01111"></a>01111
-<a name="l01112"></a>01112 desc1 = kmo_identify_fits_header(cpl_frame_get_filename(xcal_frame));
-<a name="l01113"></a>01113 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01114"></a>01114
-<a name="l01115"></a>01115 KMO_TRY_ASSURE((desc1.nr_ext % KMOS_NR_DETECTORS == 0) &&
-<a name="l01116"></a>01116 (desc1.ex_badpix == FALSE) &&
-<a name="l01117"></a>01117 (desc1.fits_type == f2d_fits) &&
-<a name="l01118"></a>01118 (desc1.frame_type == detector_frame),
-<a name="l01119"></a>01119 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01120"></a>01120 <span class="stringliteral">"XCAL isn't in the correct format!!!"</span>);
-<a name="l01121"></a>01121
-<a name="l01122"></a>01122 KMO_TRY_EXIT_IF_NULL(
-<a name="l01123"></a>01123 ycal_frame = kmo_dfs_get_frame(frameset, YCAL));
-<a name="l01124"></a>01124 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(ycal_frame));
-<a name="l01125"></a>01125 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01126"></a>01126
-<a name="l01127"></a>01127 KMO_TRY_ASSURE((desc1.nr_ext == desc2.nr_ext) &&
-<a name="l01128"></a>01128 (desc1.ex_badpix == desc2.ex_badpix) &&
-<a name="l01129"></a>01129 (desc1.fits_type == desc2.fits_type) &&
-<a name="l01130"></a>01130 (desc1.frame_type == desc2.frame_type),
-<a name="l01131"></a>01131 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01132"></a>01132 <span class="stringliteral">"YCAL isn't in the correct format!!!"</span>);
-<a name="l01133"></a>01133 kmo_free_fits_desc(&desc2);
-<a name="l01134"></a>01134 kmo_init_fits_desc(&desc2);
+<a name="l01038"></a>01038 <span class="stringliteral">"sky_tweak must be TRUE or FALSE!"</span>);
+<a name="l01039"></a>01039
+<a name="l01040"></a>01040 KMO_TRY_ASSURE(!((no_subtract == TRUE) && (sky_tweak == TRUE)),
+<a name="l01041"></a>01041 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01042"></a>01042 <span class="stringliteral">"Either no_subtract or sky_tweak or both must be FALSE"</span>);
+<a name="l01043"></a>01043
+<a name="l01044"></a>01044 tbsub = kmo_dfs_get_parameter_bool(parlist, <span class="stringliteral">"kmos.kmo_sci_red.tbsub"</span>);
+<a name="l01045"></a>01045 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01046"></a>01046
+<a name="l01047"></a>01047 pix_scale = kmo_dfs_get_parameter_double(parlist,
+<a name="l01048"></a>01048 <span class="stringliteral">"kmos.kmo_sci_red.pix_scale"</span>);
+<a name="l01049"></a>01049 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01050"></a>01050 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01051"></a>01051 kmo_dfs_print_parameter_help(parlist,
+<a name="l01052"></a>01052 <span class="stringliteral">"kmos.kmo_sci_red.pix_scale"</span>));
+<a name="l01053"></a>01053 KMO_TRY_ASSURE((pix_scale >= 0.01) &&
+<a name="l01054"></a>01054 (pix_scale <= 0.4),
+<a name="l01055"></a>01055 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01056"></a>01056 <span class="stringliteral">"pix_scale must be between 0.01 and 0.4 (results in cubes "</span>
+<a name="l01057"></a>01057 <span class="stringliteral">"with 7x7 to 280x280 pixels)!"</span>);
+<a name="l01058"></a>01058
+<a name="l01059"></a>01059 xcal_interpolation = kmo_dfs_get_parameter_bool(parlist,
+<a name="l01060"></a>01060 <span class="stringliteral">"kmos.kmo_sci_red.xcal_interpolation"</span>);
+<a name="l01061"></a>01061 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01062"></a>01062 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01063"></a>01063 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.xcal_interpolation"</span>));
+<a name="l01064"></a>01064 KMO_TRY_ASSURE((xcal_interpolation == TRUE) ||
+<a name="l01065"></a>01065 (xcal_interpolation == FALSE),
+<a name="l01066"></a>01066 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01067"></a>01067 <span class="stringliteral">"xcal_interpolation must be TRUE or FALSE!"</span>);
+<a name="l01068"></a>01068
+<a name="l01069"></a>01069 suppress_extension = kmo_dfs_get_parameter_bool(parlist,
+<a name="l01070"></a>01070 <span class="stringliteral">"kmos.kmo_sci_red.suppress_extension"</span>);
+<a name="l01071"></a>01071 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01072"></a>01072 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01073"></a>01073 kmo_dfs_print_parameter_help(parlist, <span class="stringliteral">"kmos.kmo_sci_red.suppress_extension"</span>));
+<a name="l01074"></a>01074
+<a name="l01075"></a>01075 KMO_TRY_ASSURE((suppress_extension == TRUE) || (suppress_extension == FALSE),
+<a name="l01076"></a>01076 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01077"></a>01077 <span class="stringliteral">"suppress_extension must be TRUE or FALSE!"</span>);
+<a name="l01078"></a>01078
+<a name="l01079"></a>01079 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01080"></a>01080 kmo_combine_pars_load(parlist,
+<a name="l01081"></a>01081 <span class="stringliteral">"kmos.kmo_sci_red"</span>,
+<a name="l01082"></a>01082 &cmethod,
+<a name="l01083"></a>01083 &cpos_rej,
+<a name="l01084"></a>01084 &cneg_rej,
+<a name="l01085"></a>01085 &citer,
+<a name="l01086"></a>01086 &cmin,
+<a name="l01087"></a>01087 &cmax,
+<a name="l01088"></a>01088 FALSE));
+<a name="l01089"></a>01089
+<a name="l01090"></a>01090 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
+<a name="l01091"></a>01091
+<a name="l01092"></a>01092 <span class="comment">//</span>
+<a name="l01093"></a>01093 <span class="comment">// assure that filters, grating and rotation offsets match for</span>
+<a name="l01094"></a>01094 <span class="comment">// XCAL, YCAL, LCAL and for data frame to reconstruct (except DARK</span>
+<a name="l01095"></a>01095 <span class="comment">// frames)</span>
+<a name="l01096"></a>01096 <span class="comment">//</span>
+<a name="l01097"></a>01097
+<a name="l01098"></a>01098 <span class="comment">// check if filter_id and grating_id match for all detectors</span>
+<a name="l01099"></a>01099 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01100"></a>01100 kmo_check_frameset_setup(frameset, SCIENCE, TRUE, FALSE, TRUE));
+<a name="l01101"></a>01101 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01102"></a>01102 kmo_check_frame_setup(frameset, SCIENCE, YCAL, TRUE, FALSE, TRUE));
+<a name="l01103"></a>01103 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01104"></a>01104 kmo_check_frame_setup(frameset, XCAL, YCAL, TRUE, FALSE, TRUE));
+<a name="l01105"></a>01105 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01106"></a>01106 kmo_check_frame_setup(frameset, XCAL, LCAL, TRUE, FALSE, TRUE));
+<a name="l01107"></a>01107 <span class="keywordflow">if</span> (has_master_flat) {
+<a name="l01108"></a>01108 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01109"></a>01109 kmo_check_frame_setup(frameset, XCAL, MASTER_FLAT, TRUE, FALSE, TRUE));
+<a name="l01110"></a>01110 }
+<a name="l01111"></a>01111 <span class="keywordflow">if</span> (has_telluric) {
+<a name="l01112"></a>01112 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01113"></a>01113 kmo_check_frame_setup(frameset, XCAL, TELLURIC,
+<a name="l01114"></a>01114 TRUE, FALSE, TRUE));
+<a name="l01115"></a>01115 }
+<a name="l01116"></a>01116
+<a name="l01117"></a>01117 <span class="comment">// check descriptors of all frames</span>
+<a name="l01118"></a>01118 KMO_TRY_EXIT_IF_NULL(
+<a name="l01119"></a>01119 xcal_frame = kmo_dfs_get_frame(frameset, XCAL));
+<a name="l01120"></a>01120
+<a name="l01121"></a>01121 desc1 = kmo_identify_fits_header(cpl_frame_get_filename(xcal_frame));
+<a name="l01122"></a>01122 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01123"></a>01123
+<a name="l01124"></a>01124 KMO_TRY_ASSURE((desc1.nr_ext % KMOS_NR_DETECTORS == 0) &&
+<a name="l01125"></a>01125 (desc1.ex_badpix == FALSE) &&
+<a name="l01126"></a>01126 (desc1.fits_type == f2d_fits) &&
+<a name="l01127"></a>01127 (desc1.frame_type == detector_frame),
+<a name="l01128"></a>01128 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01129"></a>01129 <span class="stringliteral">"XCAL isn't in the correct format!!!"</span>);
+<a name="l01130"></a>01130
+<a name="l01131"></a>01131 KMO_TRY_EXIT_IF_NULL(
+<a name="l01132"></a>01132 ycal_frame = kmo_dfs_get_frame(frameset, YCAL));
+<a name="l01133"></a>01133 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(ycal_frame));
+<a name="l01134"></a>01134 KMO_TRY_CHECK_ERROR_STATE();
<a name="l01135"></a>01135
-<a name="l01136"></a>01136 KMO_TRY_EXIT_IF_NULL(
-<a name="l01137"></a>01137 lcal_frame = kmo_dfs_get_frame(frameset, LCAL));
-<a name="l01138"></a>01138 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(lcal_frame));
-<a name="l01139"></a>01139 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01140"></a>01140
-<a name="l01141"></a>01141 KMO_TRY_ASSURE((desc2.nr_ext % KMOS_NR_DETECTORS == 0) &&
-<a name="l01142"></a>01142 (desc1.ex_badpix == desc2.ex_badpix) &&
-<a name="l01143"></a>01143 (desc1.fits_type == desc2.fits_type) &&
-<a name="l01144"></a>01144 (desc1.frame_type == desc2.frame_type),
-<a name="l01145"></a>01145 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01146"></a>01146 <span class="stringliteral">"LCAL isn't in the correct format!!!"</span>);
-<a name="l01147"></a>01147 kmo_free_fits_desc(&desc2);
-<a name="l01148"></a>01148 kmo_init_fits_desc(&desc2);
+<a name="l01136"></a>01136 KMO_TRY_ASSURE((desc1.nr_ext == desc2.nr_ext) &&
+<a name="l01137"></a>01137 (desc1.ex_badpix == desc2.ex_badpix) &&
+<a name="l01138"></a>01138 (desc1.fits_type == desc2.fits_type) &&
+<a name="l01139"></a>01139 (desc1.frame_type == desc2.frame_type),
+<a name="l01140"></a>01140 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01141"></a>01141 <span class="stringliteral">"YCAL isn't in the correct format!!!"</span>);
+<a name="l01142"></a>01142 kmo_free_fits_desc(&desc2);
+<a name="l01143"></a>01143 kmo_init_fits_desc(&desc2);
+<a name="l01144"></a>01144
+<a name="l01145"></a>01145 KMO_TRY_EXIT_IF_NULL(
+<a name="l01146"></a>01146 lcal_frame = kmo_dfs_get_frame(frameset, LCAL));
+<a name="l01147"></a>01147 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(lcal_frame));
+<a name="l01148"></a>01148 KMO_TRY_CHECK_ERROR_STATE();
<a name="l01149"></a>01149
-<a name="l01150"></a>01150 KMO_TRY_EXIT_IF_NULL(
-<a name="l01151"></a>01151 flat_frame = kmo_dfs_get_frame(frameset, MASTER_FLAT));
-<a name="l01152"></a>01152 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(flat_frame));
-<a name="l01153"></a>01153 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01154"></a>01154
-<a name="l01155"></a>01155 KMO_TRY_ASSURE((desc2.nr_ext % (2*KMOS_NR_DETECTORS) == 0) &&
-<a name="l01156"></a>01156 (desc1.ex_badpix == desc2.ex_badpix) &&
-<a name="l01157"></a>01157 (desc1.fits_type == desc2.fits_type) &&
-<a name="l01158"></a>01158 (desc1.frame_type == desc2.frame_type),
-<a name="l01159"></a>01159 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01160"></a>01160 <span class="stringliteral">"MASTER_FLAT isn't in the correct format!!!"</span>);
-<a name="l01161"></a>01161 kmo_free_fits_desc(&desc2);
-<a name="l01162"></a>01162 kmo_init_fits_desc(&desc2);
-<a name="l01163"></a>01163
-<a name="l01164"></a>01164 <span class="keywordflow">if</span> (has_illum_corr) {
-<a name="l01165"></a>01165 KMO_TRY_EXIT_IF_NULL(
-<a name="l01166"></a>01166 illum_frame = kmo_dfs_get_frame(frameset, ILLUM_CORR));
-<a name="l01167"></a>01167 desc2 = kmo_identify_fits_header(
-<a name="l01168"></a>01168 cpl_frame_get_filename(illum_frame));
-<a name="l01169"></a>01169 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01170"></a>01170 KMO_TRY_ASSURE(((desc2.nr_ext == 24) || (desc2.nr_ext == 48)) &&
-<a name="l01171"></a>01171 (desc2.ex_badpix == FALSE) &&
-<a name="l01172"></a>01172 (desc2.fits_type == f2i_fits) &&
-<a name="l01173"></a>01173 (desc2.frame_type == ifu_frame),
-<a name="l01174"></a>01174 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01175"></a>01175 <span class="stringliteral">"ILLUM_CORR isn't in the correct format!!!"</span>);
-<a name="l01176"></a>01176 kmo_free_fits_desc(&desc2);
-<a name="l01177"></a>01177 kmo_init_fits_desc(&desc2);
-<a name="l01178"></a>01178 }
-<a name="l01179"></a>01179
-<a name="l01180"></a>01180 <span class="keywordflow">if</span> (has_telluric) {
-<a name="l01181"></a>01181 KMO_TRY_EXIT_IF_NULL(
-<a name="l01182"></a>01182 telluric_frame = kmo_dfs_get_frame(frameset, TELLURIC));
-<a name="l01183"></a>01183 desc_telluric = kmo_identify_fits_header(
-<a name="l01184"></a>01184 cpl_frame_get_filename(telluric_frame));
-<a name="l01185"></a>01185 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01186"></a>01186 KMO_TRY_ASSURE(((desc_telluric.nr_ext == 24) || (desc_telluric.nr_ext == 48)) &&
-<a name="l01187"></a>01187 (desc_telluric.ex_badpix == FALSE) &&
-<a name="l01188"></a>01188 (desc_telluric.fits_type == f1i_fits) &&
-<a name="l01189"></a>01189 (desc_telluric.frame_type == ifu_frame),
-<a name="l01190"></a>01190 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01191"></a>01191 <span class="stringliteral">"TELLURIC isn't in the correct format!!!"</span>);
-<a name="l01192"></a>01192 }
-<a name="l01193"></a>01193
-<a name="l01194"></a>01194 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, OH_SPEC) != 0) {
-<a name="l01195"></a>01195 KMO_TRY_EXIT_IF_NULL(
-<a name="l01196"></a>01196 ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
-<a name="l01197"></a>01197 }
-<a name="l01198"></a>01198
-<a name="l01199"></a>01199 KMO_TRY_EXIT_IF_NULL(
-<a name="l01200"></a>01200 tmp_frame = kmo_dfs_get_frame(frameset, SCIENCE));
-<a name="l01201"></a>01201 <span class="keywordflow">while</span> (tmp_frame != NULL ) {
-<a name="l01202"></a>01202 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(tmp_frame));
-<a name="l01203"></a>01203 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01204"></a>01204 KMO_TRY_ASSURE((desc2.nr_ext == 3) &&
-<a name="l01205"></a>01205 (desc2.ex_badpix == FALSE) &&
-<a name="l01206"></a>01206 (desc2.fits_type == raw_fits) &&
-<a name="l01207"></a>01207 (desc2.frame_type == detector_frame),
-<a name="l01208"></a>01208 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01209"></a>01209 <span class="stringliteral">"SCIENCE isn't in the correct format!!!"</span>);
-<a name="l01210"></a>01210 kmo_free_fits_desc(&desc2);
-<a name="l01211"></a>01211 kmo_init_fits_desc(&desc2);
-<a name="l01212"></a>01212
-<a name="l01213"></a>01213 <span class="keywordflow">if</span> (mapping_mode == NULL) {
-<a name="l01214"></a>01214 KMO_TRY_EXIT_IF_NULL(
-<a name="l01215"></a>01215 tmp_header =
-<a name="l01216"></a>01216 kmclipm_propertylist_load(
-<a name="l01217"></a>01217 cpl_frame_get_filename(tmp_frame), 0));
-<a name="l01218"></a>01218 <span class="keywordflow">if</span> (cpl_propertylist_has(tmp_header, TPL_ID)) {
-<a name="l01219"></a>01219 KMO_TRY_EXIT_IF_NULL(
-<a name="l01220"></a>01220 tmp_str = cpl_propertylist_get_string(tmp_header,
-<a name="l01221"></a>01221 TPL_ID));
-<a name="l01222"></a>01222
-<a name="l01223"></a>01223 <span class="keywordflow">if</span> (strcmp(tmp_str, MAPPING8) == 0)
-<a name="l01224"></a>01224 {
-<a name="l01225"></a>01225 mapping_mode = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">"mapping8"</span>);
-<a name="l01226"></a>01226 }
-<a name="l01227"></a>01227 <span class="keywordflow">if</span> (strcmp(tmp_str, MAPPING24) == 0)
-<a name="l01228"></a>01228 {
-<a name="l01229"></a>01229 mapping_mode = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">"mapping24"</span>);
-<a name="l01230"></a>01230 }
-<a name="l01231"></a>01231 }
-<a name="l01232"></a>01232 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
-<a name="l01233"></a>01233 }
-<a name="l01234"></a>01234
-<a name="l01235"></a>01235 tmp_frame = kmo_dfs_get_frame(frameset, NULL);
-<a name="l01236"></a>01236 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01237"></a>01237 }
-<a name="l01238"></a>01238
-<a name="l01239"></a>01239 <span class="keywordflow">if</span> (mapping_mode != NULL) {
-<a name="l01240"></a>01240 <span class="comment">// we are in mapping mode</span>
-<a name="l01241"></a>01241 <span class="keywordflow">if</span> ((ifus != NULL) || (strcmp(name, <span class="stringliteral">""</span>) != 0))
-<a name="l01242"></a>01242 {
-<a name="l01243"></a>01243 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"The SCIENCE frames have been taken in one of the "</span>
-<a name="l01244"></a>01244 <span class="stringliteral">"mapping modes AND specific IFUs have been "</span>
-<a name="l01245"></a>01245 <span class="stringliteral">"specified! --> Only processing these!"</span>);
-<a name="l01246"></a>01246 } <span class="keywordflow">else</span> {
-<a name="l01247"></a>01247 <span class="keywordflow">if</span> (strcmp(smethod, <span class="stringliteral">"BCS"</span>) == 0) {
-<a name="l01248"></a>01248 extrapol_enum = BCS_NATURAL;
-<a name="l01249"></a>01249 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Detected frames taken in mapping mode. "</span>
-<a name="l01250"></a>01250 <span class="stringliteral">"Changing extrapolation mode to TRUE."</span>);
-<a name="l01251"></a>01251 }
-<a name="l01252"></a>01252 }
-<a name="l01253"></a>01253 <span class="keywordflow">if</span> (fast_mode) {
-<a name="l01254"></a>01254 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Creating map in fast_mode."</span>);
-<a name="l01255"></a>01255 }
-<a name="l01256"></a>01256 } <span class="keywordflow">else</span> {
-<a name="l01257"></a>01257 <span class="keywordflow">if</span> (fast_mode) {
-<a name="l01258"></a>01258 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"fast_mode has been selected but we aren't in "</span>
-<a name="l01259"></a>01259 <span class="stringliteral">"mapping mode. So your choice for fast_mode is ignored."</span>);
-<a name="l01260"></a>01260 }
-<a name="l01261"></a>01261 }
-<a name="l01262"></a>01262
-<a name="l01263"></a>01263 KMO_TRY_EXIT_IF_NULL(
-<a name="l01264"></a>01264 suffix = kmo_dfs_get_suffix(xcal_frame, TRUE, FALSE));
-<a name="l01265"></a>01265
-<a name="l01266"></a>01266 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01267"></a>01267 kmo_check_frame_setup_md5_xycal(frameset));
-<a name="l01268"></a>01268 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01269"></a>01269 kmo_check_frame_setup_md5(frameset));
-<a name="l01270"></a>01270 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01271"></a>01271 kmo_check_frame_setup_sampling(frameset));
+<a name="l01150"></a>01150 KMO_TRY_ASSURE((desc2.nr_ext % KMOS_NR_DETECTORS == 0) &&
+<a name="l01151"></a>01151 (desc1.ex_badpix == desc2.ex_badpix) &&
+<a name="l01152"></a>01152 (desc1.fits_type == desc2.fits_type) &&
+<a name="l01153"></a>01153 (desc1.frame_type == desc2.frame_type),
+<a name="l01154"></a>01154 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01155"></a>01155 <span class="stringliteral">"LCAL isn't in the correct format!!!"</span>);
+<a name="l01156"></a>01156 kmo_free_fits_desc(&desc2);
+<a name="l01157"></a>01157 kmo_init_fits_desc(&desc2);
+<a name="l01158"></a>01158
+<a name="l01159"></a>01159 <span class="keywordflow">if</span> (has_master_flat) {
+<a name="l01160"></a>01160 KMO_TRY_EXIT_IF_NULL(
+<a name="l01161"></a>01161 flat_frame = kmo_dfs_get_frame(frameset, MASTER_FLAT));
+<a name="l01162"></a>01162 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(flat_frame));
+<a name="l01163"></a>01163 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01164"></a>01164
+<a name="l01165"></a>01165 KMO_TRY_ASSURE((desc2.nr_ext % (2*KMOS_NR_DETECTORS) == 0) &&
+<a name="l01166"></a>01166 (desc1.ex_badpix == desc2.ex_badpix) &&
+<a name="l01167"></a>01167 (desc1.fits_type == desc2.fits_type) &&
+<a name="l01168"></a>01168 (desc1.frame_type == desc2.frame_type),
+<a name="l01169"></a>01169 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01170"></a>01170 <span class="stringliteral">"MASTER_FLAT isn't in the correct format!!!"</span>);
+<a name="l01171"></a>01171 kmo_free_fits_desc(&desc2);
+<a name="l01172"></a>01172 kmo_init_fits_desc(&desc2);
+<a name="l01173"></a>01173 }
+<a name="l01174"></a>01174
+<a name="l01175"></a>01175 <span class="keywordflow">if</span> (has_illum_corr) {
+<a name="l01176"></a>01176 KMO_TRY_EXIT_IF_NULL(
+<a name="l01177"></a>01177 illum_frame = kmo_dfs_get_frame(frameset, ILLUM_CORR));
+<a name="l01178"></a>01178 desc2 = kmo_identify_fits_header(
+<a name="l01179"></a>01179 cpl_frame_get_filename(illum_frame));
+<a name="l01180"></a>01180 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01181"></a>01181 KMO_TRY_ASSURE(((desc2.nr_ext == 24) || (desc2.nr_ext == 48)) &&
+<a name="l01182"></a>01182 (desc2.ex_badpix == FALSE) &&
+<a name="l01183"></a>01183 (desc2.fits_type == f2i_fits) &&
+<a name="l01184"></a>01184 (desc2.frame_type == ifu_frame),
+<a name="l01185"></a>01185 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01186"></a>01186 <span class="stringliteral">"ILLUM_CORR isn't in the correct format!!!"</span>);
+<a name="l01187"></a>01187 kmo_free_fits_desc(&desc2);
+<a name="l01188"></a>01188 kmo_init_fits_desc(&desc2);
+<a name="l01189"></a>01189 }
+<a name="l01190"></a>01190
+<a name="l01191"></a>01191 <span class="keywordflow">if</span> (has_telluric) {
+<a name="l01192"></a>01192 KMO_TRY_EXIT_IF_NULL(
+<a name="l01193"></a>01193 telluric_frame = kmo_dfs_get_frame(frameset, TELLURIC));
+<a name="l01194"></a>01194 desc_telluric = kmo_identify_fits_header(
+<a name="l01195"></a>01195 cpl_frame_get_filename(telluric_frame));
+<a name="l01196"></a>01196 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01197"></a>01197 KMO_TRY_ASSURE(((desc_telluric.nr_ext == 24) || (desc_telluric.nr_ext == 48)) &&
+<a name="l01198"></a>01198 (desc_telluric.ex_badpix == FALSE) &&
+<a name="l01199"></a>01199 (desc_telluric.fits_type == f1i_fits) &&
+<a name="l01200"></a>01200 (desc_telluric.frame_type == ifu_frame),
+<a name="l01201"></a>01201 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01202"></a>01202 <span class="stringliteral">"TELLURIC isn't in the correct format!!!"</span>);
+<a name="l01203"></a>01203 }
+<a name="l01204"></a>01204 kmo_free_fits_desc(&desc2);
+<a name="l01205"></a>01205
+<a name="l01206"></a>01206 KMO_TRY_EXIT_IF_NULL(
+<a name="l01207"></a>01207 tmp_frame = kmo_dfs_get_frame(frameset, SCIENCE));
+<a name="l01208"></a>01208 <span class="keywordflow">while</span> (tmp_frame != NULL ) {
+<a name="l01209"></a>01209 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(tmp_frame));
+<a name="l01210"></a>01210 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01211"></a>01211 KMO_TRY_ASSURE((desc2.nr_ext == 3) &&
+<a name="l01212"></a>01212 (desc2.ex_badpix == FALSE) &&
+<a name="l01213"></a>01213 (desc2.fits_type == raw_fits) &&
+<a name="l01214"></a>01214 (desc2.frame_type == detector_frame),
+<a name="l01215"></a>01215 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01216"></a>01216 <span class="stringliteral">"SCIENCE isn't in the correct format!!!"</span>);
+<a name="l01217"></a>01217 kmo_free_fits_desc(&desc2);
+<a name="l01218"></a>01218 kmo_init_fits_desc(&desc2);
+<a name="l01219"></a>01219
+<a name="l01220"></a>01220 <span class="keywordflow">if</span> (mapping_mode == NULL) {
+<a name="l01221"></a>01221 KMO_TRY_EXIT_IF_NULL(
+<a name="l01222"></a>01222 tmp_header =
+<a name="l01223"></a>01223 kmclipm_propertylist_load(
+<a name="l01224"></a>01224 cpl_frame_get_filename(tmp_frame), 0));
+<a name="l01225"></a>01225 <span class="keywordflow">if</span> (cpl_propertylist_has(tmp_header, TPL_ID)) {
+<a name="l01226"></a>01226 KMO_TRY_EXIT_IF_NULL(
+<a name="l01227"></a>01227 tmp_str = cpl_propertylist_get_string(tmp_header,
+<a name="l01228"></a>01228 TPL_ID));
+<a name="l01229"></a>01229
+<a name="l01230"></a>01230 <span class="keywordflow">if</span> (strcmp(tmp_str, MAPPING8) == 0)
+<a name="l01231"></a>01231 {
+<a name="l01232"></a>01232 mapping_mode = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">"mapping8"</span>);
+<a name="l01233"></a>01233 }
+<a name="l01234"></a>01234 <span class="keywordflow">if</span> (strcmp(tmp_str, MAPPING24) == 0)
+<a name="l01235"></a>01235 {
+<a name="l01236"></a>01236 mapping_mode = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">"mapping24"</span>);
+<a name="l01237"></a>01237 }
+<a name="l01238"></a>01238 }
+<a name="l01239"></a>01239 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l01240"></a>01240 }
+<a name="l01241"></a>01241
+<a name="l01242"></a>01242 tmp_frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l01243"></a>01243 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01244"></a>01244 }
+<a name="l01245"></a>01245
+<a name="l01246"></a>01246 <span class="keywordflow">if</span> (mapping_mode != NULL) {
+<a name="l01247"></a>01247 <span class="comment">// we are in mapping mode</span>
+<a name="l01248"></a>01248 <span class="keywordflow">if</span> ((ifus != NULL) || (strcmp(name, <span class="stringliteral">""</span>) != 0))
+<a name="l01249"></a>01249 {
+<a name="l01250"></a>01250 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"The SCIENCE frames have been taken in one of the "</span>
+<a name="l01251"></a>01251 <span class="stringliteral">"mapping modes AND specific IFUs have been "</span>
+<a name="l01252"></a>01252 <span class="stringliteral">"specified! --> Only processing these!"</span>);
+<a name="l01253"></a>01253 } <span class="keywordflow">else</span> {
+<a name="l01254"></a>01254 <span class="keywordflow">if</span> (strcmp(smethod, <span class="stringliteral">"BCS"</span>) == 0) {
+<a name="l01255"></a>01255 extrapol_enum = BCS_NATURAL;
+<a name="l01256"></a>01256 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Detected frames taken in mapping mode. "</span>
+<a name="l01257"></a>01257 <span class="stringliteral">"Changing extrapolation mode to TRUE."</span>);
+<a name="l01258"></a>01258 }
+<a name="l01259"></a>01259 }
+<a name="l01260"></a>01260 <span class="keywordflow">if</span> (fast_mode) {
+<a name="l01261"></a>01261 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Creating map in fast_mode."</span>);
+<a name="l01262"></a>01262 }
+<a name="l01263"></a>01263 } <span class="keywordflow">else</span> {
+<a name="l01264"></a>01264 <span class="keywordflow">if</span> (fast_mode) {
+<a name="l01265"></a>01265 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"fast_mode has been selected but we aren't in "</span>
+<a name="l01266"></a>01266 <span class="stringliteral">"mapping mode. So your choice for fast_mode is ignored."</span>);
+<a name="l01267"></a>01267 }
+<a name="l01268"></a>01268 }
+<a name="l01269"></a>01269
+<a name="l01270"></a>01270 KMO_TRY_EXIT_IF_NULL(
+<a name="l01271"></a>01271 suffix = kmo_dfs_get_suffix(xcal_frame, TRUE, FALSE));
<a name="l01272"></a>01272
-<a name="l01273"></a>01273 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Detected instrument setup: %s"</span>, suffix+1);
-<a name="l01274"></a>01274 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"(grating 1, 2 & 3)"</span>);
-<a name="l01275"></a>01275
-<a name="l01276"></a>01276 <span class="comment">//</span>
-<a name="l01277"></a>01277 <span class="comment">// check which IFUs are active for all frames</span>
-<a name="l01278"></a>01278 <span class="comment">//</span>
-<a name="l01279"></a>01279 KMO_TRY_EXIT_IF_NULL(
-<a name="l01280"></a>01280 unused_ifus_before = kmo_get_unused_ifus(frameset, 1, 1));
-<a name="l01281"></a>01281
-<a name="l01282"></a>01282 KMO_TRY_EXIT_IF_NULL(
-<a name="l01283"></a>01283 unused_ifus_after = kmo_duplicate_unused_ifus(unused_ifus_before));
-<a name="l01284"></a>01284
-<a name="l01285"></a>01285 kmo_print_unused_ifus(unused_ifus_before, FALSE);
-<a name="l01286"></a>01286
-<a name="l01287"></a>01287 <span class="comment">//</span>
-<a name="l01288"></a>01288 <span class="comment">// get bounds, setup grid, setup obj_sky-struct</span>
-<a name="l01289"></a>01289 <span class="comment">//</span>
-<a name="l01290"></a>01290
-<a name="l01291"></a>01291 <span class="comment">// get left and right bounds of IFUs</span>
-<a name="l01292"></a>01292 KMO_TRY_EXIT_IF_NULL(
-<a name="l01293"></a>01293 tmp_header = kmo_dfs_load_primary_header(frameset, XCAL));
-<a name="l01294"></a>01294 KMO_TRY_EXIT_IF_NULL(
-<a name="l01295"></a>01295 bounds = kmclipm_extract_bounds(tmp_header));
-<a name="l01296"></a>01296 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l01273"></a>01273 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01274"></a>01274 kmo_check_frame_setup_md5_xycal(frameset));
+<a name="l01275"></a>01275 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01276"></a>01276 kmo_check_frame_setup_md5(frameset));
+<a name="l01277"></a>01277 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01278"></a>01278 kmo_check_frame_setup_sampling(frameset));
+<a name="l01279"></a>01279
+<a name="l01280"></a>01280 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Detected instrument setup: %s"</span>, suffix+1);
+<a name="l01281"></a>01281 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"(grating 1, 2 & 3)"</span>);
+<a name="l01282"></a>01282
+<a name="l01283"></a>01283 <span class="comment">//</span>
+<a name="l01284"></a>01284 <span class="comment">// check which IFUs are active for all frames</span>
+<a name="l01285"></a>01285 <span class="comment">//</span>
+<a name="l01286"></a>01286 KMO_TRY_EXIT_IF_NULL(
+<a name="l01287"></a>01287 unused_ifus_before = kmo_get_unused_ifus(frameset, 1, 1));
+<a name="l01288"></a>01288
+<a name="l01289"></a>01289 KMO_TRY_EXIT_IF_NULL(
+<a name="l01290"></a>01290 unused_ifus_after = kmo_duplicate_unused_ifus(unused_ifus_before));
+<a name="l01291"></a>01291
+<a name="l01292"></a>01292 kmo_print_unused_ifus(unused_ifus_before, FALSE);
+<a name="l01293"></a>01293
+<a name="l01294"></a>01294 <span class="comment">//</span>
+<a name="l01295"></a>01295 <span class="comment">// get bounds, setup grid, setup arm_name-struct</span>
+<a name="l01296"></a>01296 <span class="comment">//</span>
<a name="l01297"></a>01297
-<a name="l01298"></a>01298 <span class="comment">// setup grid definition, wavelength start and end points will be set</span>
-<a name="l01299"></a>01299 <span class="comment">// in the detector loop</span>
-<a name="l01300"></a>01300 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01301"></a>01301 kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale));
-<a name="l01302"></a>01302
-<a name="l01303"></a>01303 <span class="comment">// get valid STD frames with objects in it and associated sky exposures and</span>
-<a name="l01304"></a>01304 <span class="comment">// get valid object names to process, either one object name across</span>
-<a name="l01305"></a>01305 <span class="comment">// several SCIENCE frames, or all object names</span>
-<a name="l01306"></a>01306 KMO_TRY_EXIT_IF_NULL(
-<a name="l01307"></a>01307 arm_name_struct = kmo_create_armNameStruct(frameset,
-<a name="l01308"></a>01308 SCIENCE,
-<a name="l01309"></a>01309 ifus,
-<a name="l01310"></a>01310 name,
-<a name="l01311"></a>01311 unused_ifus_after,
-<a name="l01312"></a>01312 bounds,
-<a name="l01313"></a>01313 mapping_mode,
-<a name="l01314"></a>01314 no_subtract));
-<a name="l01315"></a>01315 cpl_msg_set_level(CPL_MSG_DEBUG);
-<a name="l01316"></a>01316 kmo_debug_armNameStruct(frameset, arm_name_struct);
-<a name="l01317"></a>01317 cpl_msg_set_level(CPL_MSG_INFO);
-<a name="l01318"></a>01318
-<a name="l01319"></a>01319 <span class="comment">// in mapping-mode check if for all IFUs there is either no telluric at all</span>
-<a name="l01320"></a>01320 <span class="comment">// or the same number of tellurics than object names</span>
-<a name="l01321"></a>01321 <span class="keywordflow">if</span> (mapping_mode != NULL) {
-<a name="l01322"></a>01322 telluric_ok = TRUE;
-<a name="l01323"></a>01323 <span class="keywordflow">for</span> (jj = 0; jj < arm_name_struct->nrNames; jj++) {
-<a name="l01324"></a>01324 <span class="keywordflow">if</span> (!((arm_name_struct->telluricCnt[jj] == arm_name_struct->namesCnt[jj]) ||
-<a name="l01325"></a>01325 (arm_name_struct->telluricCnt[jj] == 0)))
-<a name="l01326"></a>01326 {
-<a name="l01327"></a>01327 telluric_ok = FALSE;
-<a name="l01328"></a>01328 <span class="keywordflow">break</span>;
-<a name="l01329"></a>01329 }
-<a name="l01330"></a>01330 }
-<a name="l01331"></a>01331 <span class="keywordflow">if</span> (!telluric_ok) {
-<a name="l01332"></a>01332 KMO_TRY_ASSURE(1==0,
-<a name="l01333"></a>01333 CPL_ERROR_UNSUPPORTED_MODE,
-<a name="l01334"></a>01334 <span class="stringliteral">"Mosaics need a TELLURIC frame with at least a telluric correction per detector available! "</span>
-<a name="l01335"></a>01335 <span class="stringliteral">"Omit the TELLURIC from your sof-file or choose another TELLURIC!"</span>);
+<a name="l01298"></a>01298 <span class="comment">// get left and right bounds of IFUs</span>
+<a name="l01299"></a>01299 KMO_TRY_EXIT_IF_NULL(
+<a name="l01300"></a>01300 tmp_header = kmo_dfs_load_primary_header(frameset, XCAL));
+<a name="l01301"></a>01301 KMO_TRY_EXIT_IF_NULL(
+<a name="l01302"></a>01302 bounds = kmclipm_extract_bounds(tmp_header));
+<a name="l01303"></a>01303 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l01304"></a>01304
+<a name="l01305"></a>01305 <span class="comment">// setup grid definition, wavelength start and end points will be set</span>
+<a name="l01306"></a>01306 <span class="comment">// in the detector loop</span>
+<a name="l01307"></a>01307 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01308"></a>01308 kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale, 0.));
+<a name="l01309"></a>01309
+<a name="l01310"></a>01310 <span class="comment">// get valid STD frames with objects in it and associated sky exposures and</span>
+<a name="l01311"></a>01311 <span class="comment">// get valid object names to process, either one object name across</span>
+<a name="l01312"></a>01312 <span class="comment">// several SCIENCE frames, or all object names</span>
+<a name="l01313"></a>01313 KMO_TRY_EXIT_IF_NULL(
+<a name="l01314"></a>01314 arm_name_struct = kmo_create_armNameStruct(frameset,
+<a name="l01315"></a>01315 SCIENCE,
+<a name="l01316"></a>01316 ifus,
+<a name="l01317"></a>01317 name,
+<a name="l01318"></a>01318 unused_ifus_after,
+<a name="l01319"></a>01319 bounds,
+<a name="l01320"></a>01320 mapping_mode,
+<a name="l01321"></a>01321 no_subtract));
+<a name="l01322"></a>01322
+<a name="l01323"></a>01323 kmo_print_armNameStruct(frameset, arm_name_struct);
+<a name="l01324"></a>01324
+<a name="l01325"></a>01325 <span class="comment">// in mapping-mode check if for all IFUs there is either no telluric at all</span>
+<a name="l01326"></a>01326 <span class="comment">// or the same number of tellurics than object names</span>
+<a name="l01327"></a>01327 <span class="keywordflow">if</span> ((has_telluric) && (mapping_mode != NULL)) {
+<a name="l01328"></a>01328 telluric_ok = TRUE;
+<a name="l01329"></a>01329 <span class="keywordflow">for</span> (jj = 0; jj < arm_name_struct->nrNames; jj++) {
+<a name="l01330"></a>01330 <span class="keywordflow">if</span> (!((arm_name_struct->telluricCnt[jj] == arm_name_struct->namesCnt[jj]) ||
+<a name="l01331"></a>01331 (arm_name_struct->telluricCnt[jj] == 0)))
+<a name="l01332"></a>01332 {
+<a name="l01333"></a>01333 telluric_ok = FALSE;
+<a name="l01334"></a>01334 <span class="keywordflow">break</span>;
+<a name="l01335"></a>01335 }
<a name="l01336"></a>01336 }
-<a name="l01337"></a>01337 }
-<a name="l01338"></a>01338
-<a name="l01339"></a>01339 <span class="comment">//</span>
-<a name="l01340"></a>01340 <span class="comment">// load lcal-frames</span>
-<a name="l01341"></a>01341 <span class="comment">//</span>
-<a name="l01342"></a>01342 KMO_TRY_EXIT_IF_NULL(
-<a name="l01343"></a>01343 lcal = (cpl_image**) cpl_calloc(KMOS_NR_DETECTORS, <span class="keyword">sizeof</span>(cpl_image*)));
-<a name="l01344"></a>01344 <span class="keywordflow">for</span> (i = 0; i < KMOS_NR_DETECTORS; i++) {
-<a name="l01345"></a>01345 KMO_TRY_EXIT_IF_NULL(
-<a name="l01346"></a>01346 lcal[i] = kmo_dfs_load_image(frameset, LCAL, i+1, FALSE, FALSE, NULL));
-<a name="l01347"></a>01347 }
-<a name="l01348"></a>01348
-<a name="l01349"></a>01349 nr_data_alloc = KMOS_NR_IFUS;
-<a name="l01350"></a>01350 KMO_TRY_EXIT_IF_NULL(
-<a name="l01351"></a>01351 cube_data = (cpl_imagelist**)cpl_calloc(nr_data_alloc,
-<a name="l01352"></a>01352 <span class="keyword">sizeof</span>(cpl_imagelist*)));
-<a name="l01353"></a>01353 KMO_TRY_EXIT_IF_NULL(
-<a name="l01354"></a>01354 cube_noise = (cpl_imagelist**)cpl_calloc(nr_data_alloc,
-<a name="l01355"></a>01355 <span class="keyword">sizeof</span>(cpl_imagelist*)));
+<a name="l01337"></a>01337 <span class="keywordflow">if</span> (!telluric_ok) {
+<a name="l01338"></a>01338 KMO_TRY_ASSURE(1==0,
+<a name="l01339"></a>01339 CPL_ERROR_UNSUPPORTED_MODE,
+<a name="l01340"></a>01340 <span class="stringliteral">"Mosaics need a TELLURIC frame with at least a telluric correction per detector available! "</span>
+<a name="l01341"></a>01341 <span class="stringliteral">"Omit the TELLURIC from your sof-file or choose another TELLURIC!"</span>);
+<a name="l01342"></a>01342 }
+<a name="l01343"></a>01343 }
+<a name="l01344"></a>01344
+<a name="l01345"></a>01345 <span class="comment">//</span>
+<a name="l01346"></a>01346 <span class="comment">// load lcal-frames</span>
+<a name="l01347"></a>01347 <span class="comment">//</span>
+<a name="l01348"></a>01348 KMO_TRY_EXIT_IF_NULL(
+<a name="l01349"></a>01349 lcal = (cpl_image**) cpl_calloc(KMOS_NR_DETECTORS, <span class="keyword">sizeof</span>(cpl_image*)));
+<a name="l01350"></a>01350 <span class="keywordflow">for</span> (i = 0; i < KMOS_NR_DETECTORS; i++) {
+<a name="l01351"></a>01351 KMO_TRY_EXIT_IF_NULL(
+<a name="l01352"></a>01352 lcal[i] = kmo_dfs_load_image(frameset, LCAL, i+1, FALSE, FALSE, NULL));
+<a name="l01353"></a>01353 }
+<a name="l01354"></a>01354
+<a name="l01355"></a>01355 nr_data_alloc = KMOS_NR_IFUS;
<a name="l01356"></a>01356 KMO_TRY_EXIT_IF_NULL(
-<a name="l01357"></a>01357 header_data = (cpl_propertylist**)cpl_calloc(nr_data_alloc,
-<a name="l01358"></a>01358 <span class="keyword">sizeof</span>(cpl_propertylist*)));
+<a name="l01357"></a>01357 cube_data = (cpl_imagelist**)cpl_calloc(nr_data_alloc,
+<a name="l01358"></a>01358 <span class="keyword">sizeof</span>(cpl_imagelist*)));
<a name="l01359"></a>01359 KMO_TRY_EXIT_IF_NULL(
-<a name="l01360"></a>01360 header_noise = (cpl_propertylist**)cpl_calloc(nr_data_alloc,
-<a name="l01361"></a>01361 <span class="keyword">sizeof</span>(cpl_propertylist*)));
-<a name="l01362"></a>01362
-<a name="l01363"></a>01363 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, SCIENCE) == 1) {
-<a name="l01364"></a>01364 no_combine = TRUE;
-<a name="l01365"></a>01365 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"--no_combine has been set to TRUE since there is only one SCIENCE frame!"</span>);
-<a name="l01366"></a>01366 }
-<a name="l01367"></a>01367
-<a name="l01368"></a>01368 <span class="keywordflow">if</span> (no_subtract) {
-<a name="l01369"></a>01369 no_combine = TRUE;
-<a name="l01370"></a>01370 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"--no_combine has been set to TRUE since --no_subtract has been specified by the user!"</span>);
-<a name="l01371"></a>01371 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Combining cubes would combine skies and objects which is meaningless."</span>);
-<a name="l01372"></a>01372 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"This can be done manually with the recipe kmo_combine afterwards!"</span>);
-<a name="l01373"></a>01373 }
-<a name="l01374"></a>01374
-<a name="l01375"></a>01375 <span class="comment">//</span>
-<a name="l01376"></a>01376 <span class="comment">// loop all science frames containing at least one object</span>
-<a name="l01377"></a>01377 <span class="comment">//</span>
-<a name="l01378"></a>01378 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
-<a name="l01379"></a>01379 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Reconstructing & saving cubes containing objects"</span>);
-<a name="l01380"></a>01380 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">" "</span>);
-<a name="l01381"></a>01381 <span class="keywordflow">for</span> (sf = 0; sf < arm_name_struct->size; sf++) {
-<a name="l01382"></a>01382 KMO_TRY_EXIT_IF_NULL(
-<a name="l01383"></a>01383 fn_obj = cpl_frame_get_filename(arm_name_struct->obj_sky_struct->table[sf].objFrame));
+<a name="l01360"></a>01360 cube_noise = (cpl_imagelist**)cpl_calloc(nr_data_alloc,
+<a name="l01361"></a>01361 <span class="keyword">sizeof</span>(cpl_imagelist*)));
+<a name="l01362"></a>01362 KMO_TRY_EXIT_IF_NULL(
+<a name="l01363"></a>01363 header_data = (cpl_propertylist**)cpl_calloc(nr_data_alloc,
+<a name="l01364"></a>01364 <span class="keyword">sizeof</span>(cpl_propertylist*)));
+<a name="l01365"></a>01365 KMO_TRY_EXIT_IF_NULL(
+<a name="l01366"></a>01366 header_noise = (cpl_propertylist**)cpl_calloc(nr_data_alloc,
+<a name="l01367"></a>01367 <span class="keyword">sizeof</span>(cpl_propertylist*)));
+<a name="l01368"></a>01368
+<a name="l01369"></a>01369 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, SCIENCE) == 1) {
+<a name="l01370"></a>01370 no_combine = TRUE;
+<a name="l01371"></a>01371 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"--no_combine has been set to TRUE since there is only one SCIENCE frame!"</span>);
+<a name="l01372"></a>01372 }
+<a name="l01373"></a>01373
+<a name="l01374"></a>01374 <span class="keywordflow">if</span> (no_subtract) {
+<a name="l01375"></a>01375 no_combine = TRUE;
+<a name="l01376"></a>01376 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"--no_combine has been set to TRUE since --no_subtract has been specified by the user!"</span>);
+<a name="l01377"></a>01377 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Combining cubes would combine skies and objects which is meaningless."</span>);
+<a name="l01378"></a>01378 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"This can be done manually with the recipe kmo_combine afterwards!"</span>);
+<a name="l01379"></a>01379 }
+<a name="l01380"></a>01380
+<a name="l01381"></a>01381 actual_msg_level = cpl_msg_get_level();
+<a name="l01382"></a>01382
+<a name="l01383"></a>01383 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
<a name="l01384"></a>01384
-<a name="l01385"></a>01385 KMO_TRY_EXIT_IF_NULL(
-<a name="l01386"></a>01386 main_header = kmclipm_propertylist_load(fn_obj, 0));
-<a name="l01387"></a>01387
-<a name="l01388"></a>01388 <span class="comment">// get ifu and detector number to work at</span>
-<a name="l01389"></a>01389 actual_msg_level = cpl_msg_get_level();
-<a name="l01390"></a>01390 user_defined_ifu = 0;
-<a name="l01391"></a>01391 <span class="keywordflow">if</span> ((ifus != NULL) || (strcmp(name, <span class="stringliteral">""</span>) != 0)) {
-<a name="l01392"></a>01392 <span class="keywordflow">if</span> (ifus != NULL) {
-<a name="l01393"></a>01393 <span class="comment">// user specified IFUs</span>
-<a name="l01394"></a>01394 user_defined_ifu = cpl_vector_get(ifus, sf);
-<a name="l01395"></a>01395 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01396"></a>01396
-<a name="l01397"></a>01397 <span class="keywordflow">if</span> (user_defined_ifu < 1) {
-<a name="l01398"></a>01398 user_defined_ifu = -1;
-<a name="l01399"></a>01399 }
-<a name="l01400"></a>01400 } <span class="keywordflow">else</span> {
-<a name="l01401"></a>01401 <span class="comment">// user specified an object name</span>
-<a name="l01402"></a>01402 cpl_msg_set_level(CPL_MSG_OFF);
-<a name="l01403"></a>01403 user_defined_ifu =
-<a name="l01404"></a>01404 kmo_get_index_from_ocs_name(arm_name_struct->obj_sky_struct->table[sf].objFrame,
-<a name="l01405"></a>01405 name);
-<a name="l01406"></a>01406 cpl_msg_set_level(actual_msg_level);
-<a name="l01407"></a>01407 <span class="keywordflow">if</span> (user_defined_ifu == -1) {
-<a name="l01408"></a>01408 cpl_error_reset();
-<a name="l01409"></a>01409 }
-<a name="l01410"></a>01410 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01411"></a>01411 }
-<a name="l01412"></a>01412 }
-<a name="l01413"></a>01413
-<a name="l01414"></a>01414 <span class="comment">//</span>
-<a name="l01415"></a>01415 <span class="comment">// reconstruct science frame</span>
-<a name="l01416"></a>01416 <span class="comment">//</span>
-<a name="l01417"></a>01417 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">" > processing frame: %s"</span>, fn_obj);
-<a name="l01418"></a>01418 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= KMOS_NR_IFUS; ifu_nr++)
-<a name="l01419"></a>01419 {
-<a name="l01420"></a>01420 det_nr = (ifu_nr - 1)/KMOS_IFUS_PER_DETECTOR + 1;
-<a name="l01421"></a>01421
-<a name="l01422"></a>01422 KMO_TRY_ASSURE((det_nr >= 1) &&
-<a name="l01423"></a>01423 (det_nr <= KMOS_NR_DETECTORS),
-<a name="l01424"></a>01424 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01425"></a>01425 <span class="stringliteral">"The provided ifu-numbers are incorrect! They "</span>
-<a name="l01426"></a>01426 <span class="stringliteral">"must be between 1 and %d"</span>, KMOS_NR_IFUS);
-<a name="l01427"></a>01427
-<a name="l01428"></a>01428 KMO_TRY_EXIT_IF_NULL(
-<a name="l01429"></a>01429 punused_ifus_before = cpl_array_get_data_int_const(
-<a name="l01430"></a>01430 unused_ifus_before[det_nr-1]));
-<a name="l01431"></a>01431 KMO_TRY_EXIT_IF_NULL(
-<a name="l01432"></a>01432 punused_ifus_after = cpl_array_get_data_int(
-<a name="l01433"></a>01433 unused_ifus_after[det_nr-1]));
-<a name="l01434"></a>01434
-<a name="l01435"></a>01435 <span class="comment">// get subheader data</span>
-<a name="l01436"></a>01436 KMO_TRY_EXIT_IF_NULL(
-<a name="l01437"></a>01437 header_data[ifu_nr-1] = kmclipm_propertylist_load(fn_obj,
-<a name="l01438"></a>01438 det_nr));
-<a name="l01439"></a>01439 KMO_TRY_EXIT_IF_NULL(
-<a name="l01440"></a>01440 extname = kmo_extname_creator(ifu_frame, ifu_nr,
-<a name="l01441"></a>01441 EXT_DATA));
-<a name="l01442"></a>01442 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01443"></a>01443 kmclipm_update_property_string(header_data[ifu_nr-1],
-<a name="l01444"></a>01444 EXTNAME, extname,
-<a name="l01445"></a>01445 <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01446"></a>01446 cpl_free(extname); extname = NULL;
-<a name="l01447"></a>01447
-<a name="l01448"></a>01448 <span class="comment">// Search for keyword ESO OCS ARMi NOTUSED</span>
-<a name="l01449"></a>01449 <span class="comment">// If not present (CPL_ERROR_DATA_NOT_FOUND), do nothing</span>
-<a name="l01450"></a>01450 KMO_TRY_EXIT_IF_NULL(
-<a name="l01451"></a>01451 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_VALID_PREFIX, ifu_nr,
-<a name="l01452"></a>01452 IFU_VALID_POSTFIX));
-<a name="l01453"></a>01453 tmp_str = cpl_propertylist_get_string(main_header, keyword);
-<a name="l01454"></a>01454 cpl_free(keyword); keyword = NULL;
-<a name="l01455"></a>01455
-<a name="l01456"></a>01456 <span class="keywordflow">if</span> ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) &&
-<a name="l01457"></a>01457 (bounds[2*(ifu_nr-1)] != -1) &&
-<a name="l01458"></a>01458 (bounds[2*(ifu_nr-1)+1] != -1) &&
-<a name="l01459"></a>01459 ((arm_name_struct->obj_sky_struct->table[sf].skyFrames[ifu_nr-1] != NULL) || (cpl_frameset_count_tags(frameset, SCIENCE) == 1) || no_subtract) &&
-<a name="l01460"></a>01460 (punused_ifus_before[(ifu_nr-1) % KMOS_IFUS_PER_DETECTOR] == 0) &&
-<a name="l01461"></a>01461 ((user_defined_ifu == 0) || (user_defined_ifu == ifu_nr)))
-<a name="l01462"></a>01462 {
-<a name="l01463"></a>01463 <span class="comment">// IFU is valid</span>
-<a name="l01464"></a>01464 cpl_error_reset();
-<a name="l01465"></a>01465
-<a name="l01466"></a>01466 <span class="keywordflow">if</span> ((arm_name_struct->obj_sky_struct->table[sf].skyFrames[ifu_nr-1] != NO_CORRESPONDING_SKYFRAME) &&
-<a name="l01467"></a>01467 (cpl_frameset_count_tags(frameset, SCIENCE) != 1) &&
-<a name="l01468"></a>01468 !no_subtract)
-<a name="l01469"></a>01469 {
-<a name="l01470"></a>01470 do_sky_subtraction = TRUE;
-<a name="l01471"></a>01471 <span class="keywordflow">if</span> (no_subtract) {
-<a name="l01472"></a>01472 sky_frame = NULL;
-<a name="l01473"></a>01473 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">" > Omit sky subtraction on IFU %d"</span>, ifu_nr);
-<a name="l01474"></a>01474 } <span class="keywordflow">else</span> {
-<a name="l01475"></a>01475 sky_frame = arm_name_struct->obj_sky_struct->table[sf].skyFrames[ifu_nr-1];
-<a name="l01476"></a>01476 KMO_TRY_EXIT_IF_NULL(
-<a name="l01477"></a>01477 fn_sky = cpl_frame_get_filename(sky_frame));
-<a name="l01478"></a>01478 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">" > IFU %d (with sky in frame: %s)"</span>, ifu_nr, fn_sky);
-<a name="l01479"></a>01479 }
-<a name="l01480"></a>01480 <span class="keywordflow">if</span> (sky_tweak){
-<a name="l01481"></a>01481 sky_as_object_frame = sky_frame;
-<a name="l01482"></a>01482 sky_frame = NULL;
-<a name="l01483"></a>01483 }
-<a name="l01484"></a>01484 } <span class="keywordflow">else</span> {
-<a name="l01485"></a>01485 do_sky_subtraction = FALSE;
-<a name="l01486"></a>01486 sky_frame = NULL;
-<a name="l01487"></a>01487 <span class="keywordflow">if</span> ((cpl_frameset_count_tags(frameset, SCIENCE) != 1) && (!no_subtract)) {
-<a name="l01488"></a>01488 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">" > IFU %d with no corresponding sky frame"</span>, ifu_nr);
-<a name="l01489"></a>01489 }
-<a name="l01490"></a>01490 }
-<a name="l01491"></a>01491
-<a name="l01492"></a>01492 <span class="comment">// get filter for this detector and setup grid definition</span>
-<a name="l01493"></a>01493 <span class="comment">// ESO INS FILTi ID</span>
-<a name="l01494"></a>01494 <span class="keywordtype">char</span> *tmp_band_method = getenv(<span class="stringliteral">"KMO_BAND_METHOD"</span>);
-<a name="l01495"></a>01495 <span class="keywordtype">int</span> band_method = 0;
-<a name="l01496"></a>01496 <span class="keywordflow">if</span> (tmp_band_method != NULL) {
-<a name="l01497"></a>01497 band_method = atoi(tmp_band_method);
-<a name="l01498"></a>01498 }
-<a name="l01499"></a>01499
-<a name="l01500"></a>01500 KMO_TRY_EXIT_IF_NULL(
-<a name="l01501"></a>01501 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>,
-<a name="l01502"></a>01502 IFU_FILTID_PREFIX, det_nr,
-<a name="l01503"></a>01503 IFU_FILTID_POSTFIX));
-<a name="l01504"></a>01504 KMO_TRY_EXIT_IF_NULL(
-<a name="l01505"></a>01505 filter_id = cpl_propertylist_get_string(main_header,
-<a name="l01506"></a>01506 keyword));
-<a name="l01507"></a>01507 cpl_free(keyword); keyword = NULL;
-<a name="l01508"></a>01508
-<a name="l01509"></a>01509 <span class="keywordflow">if</span> (print_once) {
-<a name="l01510"></a>01510 cpl_msg_set_level(CPL_MSG_WARNING);
-<a name="l01511"></a>01511 }
-<a name="l01512"></a>01512
-<a name="l01513"></a>01513 KMO_TRY_EXIT_IF_NULL(
-<a name="l01514"></a>01514 band_table = kmo_dfs_load_table(frameset, WAVE_BAND,
-<a name="l01515"></a>01515 1, 0));
-<a name="l01516"></a>01516 <span class="comment">// lcal just needed when band_method==1</span>
-<a name="l01517"></a>01517 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01518"></a>01518 kmclipm_setup_grid_band_lcal(&gd, lcal[det_nr-1],
-<a name="l01519"></a>01519 filter_id, band_method,
-<a name="l01520"></a>01520 band_table));
-<a name="l01521"></a>01521 cpl_table_delete(band_table); band_table = NULL;
-<a name="l01522"></a>01522
-<a name="l01523"></a>01523 print_once = TRUE;
-<a name="l01524"></a>01524 cpl_msg_set_level(actual_msg_level);
-<a name="l01525"></a>01525
-<a name="l01526"></a>01526 <span class="comment">//</span>
-<a name="l01527"></a>01527 <span class="comment">// calc WCS & update subheader</span>
-<a name="l01528"></a>01528 <span class="comment">//</span>
-<a name="l01529"></a>01529 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01530"></a>01530 kmo_calc_wcs_gd(main_header, header_data[ifu_nr-1], ifu_nr, gd));
-<a name="l01531"></a>01531
-<a name="l01532"></a>01532 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01533"></a>01533 kmclipm_update_property_int(header_data[ifu_nr-1],
-<a name="l01534"></a>01534 NAXIS, 3,
-<a name="l01535"></a>01535 <span class="stringliteral">"number of data axes"</span>));
-<a name="l01536"></a>01536 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01537"></a>01537 kmclipm_update_property_int(header_data[ifu_nr-1],
-<a name="l01538"></a>01538 NAXIS1, gd.x.dim,
-<a name="l01539"></a>01539 <span class="stringliteral">"length of data axis 1"</span>));
-<a name="l01540"></a>01540 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01541"></a>01541 kmclipm_update_property_int(header_data[ifu_nr-1],
-<a name="l01542"></a>01542 NAXIS2, gd.y.dim,
-<a name="l01543"></a>01543 <span class="stringliteral">"length of data axis 2"</span>));
-<a name="l01544"></a>01544 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01545"></a>01545 kmclipm_update_property_int(header_data[ifu_nr-1],
-<a name="l01546"></a>01546 NAXIS3, gd.l.dim,
-<a name="l01547"></a>01547 <span class="stringliteral">"length of data axis 3"</span>));
-<a name="l01548"></a>01548
-<a name="l01549"></a>01549 <span class="comment">//</span>
-<a name="l01550"></a>01550 <span class="comment">// reconstruct object</span>
-<a name="l01551"></a>01551 <span class="comment">//</span>
-<a name="l01552"></a>01552
-<a name="l01553"></a>01553 <span class="keywordflow">if</span> (ref_spectrum_frame == NULL) { <span class="comment">// no lambda correction using OH lines</span>
-<a name="l01554"></a>01554 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01555"></a>01555 kmo_reconstruct_sci(ifu_nr,
-<a name="l01556"></a>01556 bounds[2*(ifu_nr-1)],
-<a name="l01557"></a>01557 bounds[2*(ifu_nr-1)+1],
-<a name="l01558"></a>01558 arm_name_struct->obj_sky_struct->table[sf].objFrame,
-<a name="l01559"></a>01559 SCIENCE,
-<a name="l01560"></a>01560 sky_frame,
-<a name="l01561"></a>01561 SCIENCE,
-<a name="l01562"></a>01562 flat_frame,
-<a name="l01563"></a>01563 xcal_frame,
-<a name="l01564"></a>01564 ycal_frame,
-<a name="l01565"></a>01565 lcal_frame,
-<a name="l01566"></a>01566 NULL,
-<a name="l01567"></a>01567 &gd,
-<a name="l01568"></a>01568 &cube_data[ifu_nr-1],
-<a name="l01569"></a>01569 &cube_noise[ifu_nr-1],
-<a name="l01570"></a>01570 flux,
-<a name="l01571"></a>01571 background,
-<a name="l01572"></a>01572 xcal_interpolation));
-<a name="l01573"></a>01573
-<a name="l01574"></a>01574 } <span class="keywordflow">else</span> { <span class="comment">// lambda correction using OH lines</span>
-<a name="l01575"></a>01575 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01576"></a>01576 kmo_reconstruct_sci(ifu_nr,
-<a name="l01577"></a>01577 bounds[2*(ifu_nr-1)],
-<a name="l01578"></a>01578 bounds[2*(ifu_nr-1)+1],
-<a name="l01579"></a>01579 arm_name_struct->obj_sky_struct->table[sf].objFrame,
-<a name="l01580"></a>01580 SCIENCE,
-<a name="l01581"></a>01581 NULL,
-<a name="l01582"></a>01582 NULL,
-<a name="l01583"></a>01583 flat_frame,
-<a name="l01584"></a>01584 xcal_frame,
-<a name="l01585"></a>01585 ycal_frame,
-<a name="l01586"></a>01586 lcal_frame,
+<a name="l01385"></a>01385 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, OH_SPEC) != 0) {
+<a name="l01386"></a>01386 <span class="keywordtype">int</span> is_all_obs = TRUE,
+<a name="l01387"></a>01387 has_all_origfile = TRUE;
+<a name="l01388"></a>01388
+<a name="l01389"></a>01389 KMO_TRY_EXIT_IF_NULL(
+<a name="l01390"></a>01390 tmp_frame = kmo_dfs_get_frame(frameset, SCIENCE));
+<a name="l01391"></a>01391 <span class="keywordflow">while</span> (tmp_frame != NULL ) {
+<a name="l01392"></a>01392 KMO_TRY_EXIT_IF_NULL(
+<a name="l01393"></a>01393 tmp_header = kmclipm_propertylist_load(cpl_frame_get_filename(tmp_frame), 0));
+<a name="l01394"></a>01394
+<a name="l01395"></a>01395 <span class="keywordflow">if</span> (cpl_propertylist_has(tmp_header, ORIGFILE)) {
+<a name="l01396"></a>01396 KMO_TRY_EXIT_IF_NULL(
+<a name="l01397"></a>01397 tmp_str = cpl_propertylist_get_string(tmp_header, ORIGFILE));
+<a name="l01398"></a>01398 <span class="keywordflow">if</span> (strstr(tmp_str, <span class="stringliteral">"OBS"</span>) == NULL) {
+<a name="l01399"></a>01399 is_all_obs = FALSE;
+<a name="l01400"></a>01400 }
+<a name="l01401"></a>01401 } <span class="keywordflow">else</span> {
+<a name="l01402"></a>01402 has_all_origfile = FALSE;
+<a name="l01403"></a>01403 }
+<a name="l01404"></a>01404 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l01405"></a>01405 tmp_frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l01406"></a>01406 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01407"></a>01407 }
+<a name="l01408"></a>01408
+<a name="l01409"></a>01409 <span class="keywordflow">if</span> (has_all_origfile) {
+<a name="l01410"></a>01410 <span class="keywordflow">if</span> (is_all_obs) {
+<a name="l01411"></a>01411 <span class="comment">// we are reconstructing an OBS-frame, allow OH_SPEC correction</span>
+<a name="l01412"></a>01412 KMO_TRY_EXIT_IF_NULL(
+<a name="l01413"></a>01413 ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
+<a name="l01414"></a>01414 } <span class="keywordflow">else</span> {
+<a name="l01415"></a>01415 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"Supplied OH_SPEC is ignored since a calibration "</span>
+<a name="l01416"></a>01416 <span class="stringliteral">"frame is being used as SCIENCE frame."</span>);
+<a name="l01417"></a>01417 }
+<a name="l01418"></a>01418 } <span class="keywordflow">else</span> {
+<a name="l01419"></a>01419 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"The supplied SCIENCE frames are all assumed to be "</span>
+<a name="l01420"></a>01420 <span class="stringliteral">"science frames. If any of them is a calibration frame, "</span>
+<a name="l01421"></a>01421 <span class="stringliteral">"omit OH_SPEC from sof-file"</span>);
+<a name="l01422"></a>01422 KMO_TRY_EXIT_IF_NULL(
+<a name="l01423"></a>01423 ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
+<a name="l01424"></a>01424 }
+<a name="l01425"></a>01425 }
+<a name="l01426"></a>01426
+<a name="l01427"></a>01427 <span class="comment">//</span>
+<a name="l01428"></a>01428 <span class="comment">// loop all science frames containing at least one object</span>
+<a name="l01429"></a>01429 <span class="comment">//</span>
+<a name="l01430"></a>01430 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Reconstructing & saving cubes containing objects"</span>);
+<a name="l01431"></a>01431 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">" "</span>);
+<a name="l01432"></a>01432 <span class="keywordflow">for</span> (sf = 0; sf < arm_name_struct->size; sf++) {
+<a name="l01433"></a>01433 KMO_TRY_EXIT_IF_NULL(
+<a name="l01434"></a>01434 fn_obj = cpl_frame_get_filename(arm_name_struct->obj_sky_struct->table[sf].objFrame));
+<a name="l01435"></a>01435
+<a name="l01436"></a>01436 KMO_TRY_EXIT_IF_NULL(
+<a name="l01437"></a>01437 main_header = kmclipm_propertylist_load(fn_obj, 0));
+<a name="l01438"></a>01438
+<a name="l01439"></a>01439 actual_msg_level = cpl_msg_get_level();
+<a name="l01440"></a>01440
+<a name="l01441"></a>01441 <span class="comment">//</span>
+<a name="l01442"></a>01442 <span class="comment">// reconstruct science frame</span>
+<a name="l01443"></a>01443 <span class="comment">//</span>
+<a name="l01444"></a>01444 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">" > processing frame: %s"</span>, fn_obj);
+<a name="l01445"></a>01445 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= KMOS_NR_IFUS; ifu_nr++)
+<a name="l01446"></a>01446 {
+<a name="l01447"></a>01447 det_nr = (ifu_nr - 1)/KMOS_IFUS_PER_DETECTOR + 1;
+<a name="l01448"></a>01448
+<a name="l01449"></a>01449 KMO_TRY_ASSURE((det_nr >= 1) &&
+<a name="l01450"></a>01450 (det_nr <= KMOS_NR_DETECTORS),
+<a name="l01451"></a>01451 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01452"></a>01452 <span class="stringliteral">"The provided ifu-numbers are incorrect! They "</span>
+<a name="l01453"></a>01453 <span class="stringliteral">"must be between 1 and %d"</span>, KMOS_NR_IFUS);
+<a name="l01454"></a>01454
+<a name="l01455"></a>01455 <span class="comment">// get subheader data</span>
+<a name="l01456"></a>01456 KMO_TRY_EXIT_IF_NULL(
+<a name="l01457"></a>01457 header_data[ifu_nr-1] = kmclipm_propertylist_load(fn_obj,
+<a name="l01458"></a>01458 det_nr));
+<a name="l01459"></a>01459 KMO_TRY_EXIT_IF_NULL(
+<a name="l01460"></a>01460 extname = kmo_extname_creator(ifu_frame, ifu_nr,
+<a name="l01461"></a>01461 EXT_DATA));
+<a name="l01462"></a>01462 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01463"></a>01463 kmclipm_update_property_string(header_data[ifu_nr-1],
+<a name="l01464"></a>01464 EXTNAME, extname,
+<a name="l01465"></a>01465 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01466"></a>01466 cpl_free(extname); extname = NULL;
+<a name="l01467"></a>01467
+<a name="l01468"></a>01468 <span class="keywordflow">if</span> (arm_name_struct->name_ids[ifu_nr-1+sf*KMOS_NR_IFUS] >= 1) {
+<a name="l01469"></a>01469 <span class="comment">// IFU is valid</span>
+<a name="l01470"></a>01470
+<a name="l01471"></a>01471 <span class="keywordflow">if</span> ((arm_name_struct->obj_sky_struct->table[sf].skyFrames[ifu_nr-1] != NO_CORRESPONDING_SKYFRAME) &&
+<a name="l01472"></a>01472 (cpl_frameset_count_tags(frameset, SCIENCE) != 1) &&
+<a name="l01473"></a>01473 !no_subtract)
+<a name="l01474"></a>01474 {
+<a name="l01475"></a>01475 do_sky_subtraction = TRUE;
+<a name="l01476"></a>01476 <span class="keywordflow">if</span> (no_subtract) {
+<a name="l01477"></a>01477 sky_frame = NULL;
+<a name="l01478"></a>01478 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">" > Omit sky subtraction on IFU %d"</span>, ifu_nr);
+<a name="l01479"></a>01479 } <span class="keywordflow">else</span> {
+<a name="l01480"></a>01480 sky_frame = arm_name_struct->obj_sky_struct->table[sf].skyFrames[ifu_nr-1];
+<a name="l01481"></a>01481 KMO_TRY_EXIT_IF_NULL(
+<a name="l01482"></a>01482 fn_sky = cpl_frame_get_filename(sky_frame));
+<a name="l01483"></a>01483 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">" > IFU %d (with sky in frame: %s)"</span>, ifu_nr, fn_sky);
+<a name="l01484"></a>01484 }
+<a name="l01485"></a>01485 <span class="keywordflow">if</span> (sky_tweak){
+<a name="l01486"></a>01486 sky_as_object_frame = sky_frame;
+<a name="l01487"></a>01487 sky_frame = NULL;
+<a name="l01488"></a>01488 }
+<a name="l01489"></a>01489 } <span class="keywordflow">else</span> {
+<a name="l01490"></a>01490 do_sky_subtraction = FALSE;
+<a name="l01491"></a>01491 sky_frame = NULL;
+<a name="l01492"></a>01492 <span class="keywordflow">if</span> ((cpl_frameset_count_tags(frameset, SCIENCE) != 1) && (!no_subtract)) {
+<a name="l01493"></a>01493 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">" > IFU %d with no corresponding sky frame"</span>, ifu_nr);
+<a name="l01494"></a>01494 }
+<a name="l01495"></a>01495 }
+<a name="l01496"></a>01496
+<a name="l01497"></a>01497 <span class="comment">// get filter for this detector and setup grid definition</span>
+<a name="l01498"></a>01498 <span class="comment">// ESO INS FILTi ID</span>
+<a name="l01499"></a>01499 <span class="keywordtype">char</span> *tmp_band_method = getenv(<span class="stringliteral">"KMO_BAND_METHOD"</span>);
+<a name="l01500"></a>01500 <span class="keywordtype">int</span> band_method = 0;
+<a name="l01501"></a>01501 <span class="keywordflow">if</span> (tmp_band_method != NULL) {
+<a name="l01502"></a>01502 band_method = atoi(tmp_band_method);
+<a name="l01503"></a>01503 }
+<a name="l01504"></a>01504
+<a name="l01505"></a>01505 KMO_TRY_EXIT_IF_NULL(
+<a name="l01506"></a>01506 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>,
+<a name="l01507"></a>01507 IFU_FILTID_PREFIX, det_nr,
+<a name="l01508"></a>01508 IFU_FILTID_POSTFIX));
+<a name="l01509"></a>01509 KMO_TRY_EXIT_IF_NULL(
+<a name="l01510"></a>01510 filter_id = cpl_propertylist_get_string(main_header,
+<a name="l01511"></a>01511 keyword));
+<a name="l01512"></a>01512 cpl_free(keyword); keyword = NULL;
+<a name="l01513"></a>01513
+<a name="l01514"></a>01514 <span class="keywordflow">if</span> (print_once) {
+<a name="l01515"></a>01515 cpl_msg_set_level(CPL_MSG_WARNING);
+<a name="l01516"></a>01516 }
+<a name="l01517"></a>01517
+<a name="l01518"></a>01518 KMO_TRY_EXIT_IF_NULL(
+<a name="l01519"></a>01519 band_table = kmo_dfs_load_table(frameset, WAVE_BAND,
+<a name="l01520"></a>01520 1, 0));
+<a name="l01521"></a>01521 <span class="comment">// lcal just needed when band_method==1</span>
+<a name="l01522"></a>01522 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01523"></a>01523 kmclipm_setup_grid_band_lcal(&gd, lcal[det_nr-1],
+<a name="l01524"></a>01524 filter_id, band_method,
+<a name="l01525"></a>01525 band_table));
+<a name="l01526"></a>01526 cpl_table_delete(band_table); band_table = NULL;
+<a name="l01527"></a>01527
+<a name="l01528"></a>01528 print_once = TRUE;
+<a name="l01529"></a>01529 cpl_msg_set_level(actual_msg_level);
+<a name="l01530"></a>01530
+<a name="l01531"></a>01531 <span class="comment">//</span>
+<a name="l01532"></a>01532 <span class="comment">// calc WCS & update subheader</span>
+<a name="l01533"></a>01533 <span class="comment">//</span>
+<a name="l01534"></a>01534 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01535"></a>01535 kmo_calc_wcs_gd(main_header, header_data[ifu_nr-1], ifu_nr, gd));
+<a name="l01536"></a>01536
+<a name="l01537"></a>01537 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01538"></a>01538 kmclipm_update_property_int(header_data[ifu_nr-1],
+<a name="l01539"></a>01539 NAXIS, 3,
+<a name="l01540"></a>01540 <span class="stringliteral">"number of data axes"</span>));
+<a name="l01541"></a>01541 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01542"></a>01542 kmclipm_update_property_int(header_data[ifu_nr-1],
+<a name="l01543"></a>01543 NAXIS1, gd.x.dim,
+<a name="l01544"></a>01544 <span class="stringliteral">"length of data axis 1"</span>));
+<a name="l01545"></a>01545 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01546"></a>01546 kmclipm_update_property_int(header_data[ifu_nr-1],
+<a name="l01547"></a>01547 NAXIS2, gd.y.dim,
+<a name="l01548"></a>01548 <span class="stringliteral">"length of data axis 2"</span>));
+<a name="l01549"></a>01549 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01550"></a>01550 kmclipm_update_property_int(header_data[ifu_nr-1],
+<a name="l01551"></a>01551 NAXIS3, gd.l.dim,
+<a name="l01552"></a>01552 <span class="stringliteral">"length of data axis 3"</span>));
+<a name="l01553"></a>01553
+<a name="l01554"></a>01554 <span class="comment">//</span>
+<a name="l01555"></a>01555 <span class="comment">// reconstruct object</span>
+<a name="l01556"></a>01556 <span class="comment">//</span>
+<a name="l01557"></a>01557
+<a name="l01558"></a>01558 <span class="keywordflow">if</span> (ref_spectrum_frame == NULL) { <span class="comment">// no lambda correction using OH lines</span>
+<a name="l01559"></a>01559 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01560"></a>01560 kmo_reconstruct_sci(ifu_nr,
+<a name="l01561"></a>01561 bounds[2*(ifu_nr-1)],
+<a name="l01562"></a>01562 bounds[2*(ifu_nr-1)+1],
+<a name="l01563"></a>01563 arm_name_struct->obj_sky_struct->table[sf].objFrame,
+<a name="l01564"></a>01564 SCIENCE,
+<a name="l01565"></a>01565 sky_frame,
+<a name="l01566"></a>01566 SCIENCE,
+<a name="l01567"></a>01567 flat_frame,
+<a name="l01568"></a>01568 xcal_frame,
+<a name="l01569"></a>01569 ycal_frame,
+<a name="l01570"></a>01570 lcal_frame,
+<a name="l01571"></a>01571 NULL,
+<a name="l01572"></a>01572 &gd,
+<a name="l01573"></a>01573 &cube_data[ifu_nr-1],
+<a name="l01574"></a>01574 &cube_noise[ifu_nr-1],
+<a name="l01575"></a>01575 flux,
+<a name="l01576"></a>01576 background,
+<a name="l01577"></a>01577 xcal_interpolation));
+<a name="l01578"></a>01578
+<a name="l01579"></a>01579 } <span class="keywordflow">else</span> { <span class="comment">// lambda correction using OH lines</span>
+<a name="l01580"></a>01580 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01581"></a>01581 kmo_reconstruct_sci(ifu_nr,
+<a name="l01582"></a>01582 bounds[2*(ifu_nr-1)],
+<a name="l01583"></a>01583 bounds[2*(ifu_nr-1)+1],
+<a name="l01584"></a>01584 arm_name_struct->obj_sky_struct->table[sf].objFrame,
+<a name="l01585"></a>01585 SCIENCE,
+<a name="l01586"></a>01586 NULL,
<a name="l01587"></a>01587 NULL,
-<a name="l01588"></a>01588 &gd,
-<a name="l01589"></a>01589 &cube_data[ifu_nr-1],
-<a name="l01590"></a>01590 &cube_noise[ifu_nr-1],
-<a name="l01591"></a>01591 FALSE,
-<a name="l01592"></a>01592 FALSE,
-<a name="l01593"></a>01593 xcal_interpolation));
-<a name="l01594"></a>01594
-<a name="l01595"></a>01595
-<a name="l01596"></a>01596 <span class="keywordflow">if</span> (cube_data[ifu_nr-1] != NULL) {
-<a name="l01597"></a>01597 KMO_TRY_EXIT_IF_NULL(
-<a name="l01598"></a>01598 lcorr_coeffs = kmo_lcorr_get(cube_data[ifu_nr-1],
-<a name="l01599"></a>01599 header_data[ifu_nr-1],
-<a name="l01600"></a>01600 ref_spectrum_frame,
-<a name="l01601"></a>01601 gd,
-<a name="l01602"></a>01602 filter_id,
-<a name="l01603"></a>01603 ifu_nr));
-<a name="l01604"></a>01604
-<a name="l01605"></a>01605 cpl_imagelist_delete(cube_data[ifu_nr-1]); cube_data[ifu_nr-1] = NULL;
-<a name="l01606"></a>01606 <span class="keywordflow">if</span> (cube_noise[ifu_nr-1] != NULL) {
-<a name="l01607"></a>01607 cpl_imagelist_delete(cube_noise[ifu_nr-1]); cube_noise[ifu_nr-1] = NULL;
-<a name="l01608"></a>01608 }
+<a name="l01588"></a>01588 flat_frame,
+<a name="l01589"></a>01589 xcal_frame,
+<a name="l01590"></a>01590 ycal_frame,
+<a name="l01591"></a>01591 lcal_frame,
+<a name="l01592"></a>01592 NULL,
+<a name="l01593"></a>01593 &gd,
+<a name="l01594"></a>01594 &cube_data[ifu_nr-1],
+<a name="l01595"></a>01595 &cube_noise[ifu_nr-1],
+<a name="l01596"></a>01596 FALSE,
+<a name="l01597"></a>01597 FALSE,
+<a name="l01598"></a>01598 xcal_interpolation));
+<a name="l01599"></a>01599
+<a name="l01600"></a>01600
+<a name="l01601"></a>01601 <span class="keywordflow">if</span> (cube_data[ifu_nr-1] != NULL) {
+<a name="l01602"></a>01602 KMO_TRY_EXIT_IF_NULL(
+<a name="l01603"></a>01603 lcorr_coeffs = kmo_lcorr_get(cube_data[ifu_nr-1],
+<a name="l01604"></a>01604 header_data[ifu_nr-1],
+<a name="l01605"></a>01605 ref_spectrum_frame,
+<a name="l01606"></a>01606 gd,
+<a name="l01607"></a>01607 filter_id,
+<a name="l01608"></a>01608 ifu_nr));
<a name="l01609"></a>01609
-<a name="l01610"></a>01610 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01611"></a>01611 kmo_reconstruct_sci(ifu_nr,
-<a name="l01612"></a>01612 bounds[2*(ifu_nr-1)],
-<a name="l01613"></a>01613 bounds[2*(ifu_nr-1)+1],
-<a name="l01614"></a>01614 arm_name_struct->obj_sky_struct->table[sf].objFrame,
-<a name="l01615"></a>01615 SCIENCE,
-<a name="l01616"></a>01616 sky_frame,
-<a name="l01617"></a>01617 SCIENCE,
-<a name="l01618"></a>01618 flat_frame,
-<a name="l01619"></a>01619 xcal_frame,
-<a name="l01620"></a>01620 ycal_frame,
-<a name="l01621"></a>01621 lcal_frame,
-<a name="l01622"></a>01622 lcorr_coeffs,
-<a name="l01623"></a>01623 &gd,
-<a name="l01624"></a>01624 &cube_data[ifu_nr-1],
-<a name="l01625"></a>01625 &cube_noise[ifu_nr-1],
-<a name="l01626"></a>01626 flux,
-<a name="l01627"></a>01627 background,
-<a name="l01628"></a>01628 xcal_interpolation));
-<a name="l01629"></a>01629
-<a name="l01630"></a>01630 cpl_polynomial_delete(lcorr_coeffs); lcorr_coeffs = NULL;
-<a name="l01631"></a>01631 }
-<a name="l01632"></a>01632 }
-<a name="l01633"></a>01633
-<a name="l01634"></a>01634 <span class="comment">// if sky_tweak is set to TRUE reconstruct sky frame as object</span>
-<a name="l01635"></a>01635 <span class="comment">// ans use kmo_priv_sky_tweak to subtract a modified sky cube</span>
-<a name="l01636"></a>01636 <span class="keywordflow">if</span> (do_sky_subtraction && sky_tweak) {
-<a name="l01637"></a>01637 <span class="keywordflow">if</span> (ref_spectrum_frame == NULL) { <span class="comment">// no lambda correction using OH lines</span>
-<a name="l01638"></a>01638 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01639"></a>01639 kmo_reconstruct_sci(ifu_nr,
-<a name="l01640"></a>01640 bounds[2*(ifu_nr-1)],
-<a name="l01641"></a>01641 bounds[2*(ifu_nr-1)+1],
-<a name="l01642"></a>01642 sky_as_object_frame,
-<a name="l01643"></a>01643 SCIENCE,
-<a name="l01644"></a>01644 sky_frame,
-<a name="l01645"></a>01645 SCIENCE,
-<a name="l01646"></a>01646 flat_frame,
-<a name="l01647"></a>01647 xcal_frame,
-<a name="l01648"></a>01648 ycal_frame,
-<a name="l01649"></a>01649 lcal_frame,
-<a name="l01650"></a>01650 NULL,
-<a name="l01651"></a>01651 &gd,
-<a name="l01652"></a>01652 &sky_data,
-<a name="l01653"></a>01653 &sky_noise,
-<a name="l01654"></a>01654 flux,
-<a name="l01655"></a>01655 background,
-<a name="l01656"></a>01656 xcal_interpolation));
-<a name="l01657"></a>01657
-<a name="l01658"></a>01658 } <span class="keywordflow">else</span> { <span class="comment">// lambda correction using OH lines</span>
-<a name="l01659"></a>01659 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01660"></a>01660 kmo_reconstruct_sci(ifu_nr,
-<a name="l01661"></a>01661 bounds[2*(ifu_nr-1)],
-<a name="l01662"></a>01662 bounds[2*(ifu_nr-1)+1],
-<a name="l01663"></a>01663 sky_as_object_frame,
-<a name="l01664"></a>01664 SCIENCE,
-<a name="l01665"></a>01665 NULL,
-<a name="l01666"></a>01666 NULL,
-<a name="l01667"></a>01667 flat_frame,
-<a name="l01668"></a>01668 xcal_frame,
-<a name="l01669"></a>01669 ycal_frame,
-<a name="l01670"></a>01670 lcal_frame,
+<a name="l01610"></a>01610 cpl_imagelist_delete(cube_data[ifu_nr-1]); cube_data[ifu_nr-1] = NULL;
+<a name="l01611"></a>01611 <span class="keywordflow">if</span> (cube_noise[ifu_nr-1] != NULL) {
+<a name="l01612"></a>01612 cpl_imagelist_delete(cube_noise[ifu_nr-1]); cube_noise[ifu_nr-1] = NULL;
+<a name="l01613"></a>01613 }
+<a name="l01614"></a>01614
+<a name="l01615"></a>01615 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01616"></a>01616 kmo_reconstruct_sci(ifu_nr,
+<a name="l01617"></a>01617 bounds[2*(ifu_nr-1)],
+<a name="l01618"></a>01618 bounds[2*(ifu_nr-1)+1],
+<a name="l01619"></a>01619 arm_name_struct->obj_sky_struct->table[sf].objFrame,
+<a name="l01620"></a>01620 SCIENCE,
+<a name="l01621"></a>01621 sky_frame,
+<a name="l01622"></a>01622 SCIENCE,
+<a name="l01623"></a>01623 flat_frame,
+<a name="l01624"></a>01624 xcal_frame,
+<a name="l01625"></a>01625 ycal_frame,
+<a name="l01626"></a>01626 lcal_frame,
+<a name="l01627"></a>01627 lcorr_coeffs,
+<a name="l01628"></a>01628 &gd,
+<a name="l01629"></a>01629 &cube_data[ifu_nr-1],
+<a name="l01630"></a>01630 &cube_noise[ifu_nr-1],
+<a name="l01631"></a>01631 flux,
+<a name="l01632"></a>01632 background,
+<a name="l01633"></a>01633 xcal_interpolation));
+<a name="l01634"></a>01634
+<a name="l01635"></a>01635 cpl_polynomial_delete(lcorr_coeffs); lcorr_coeffs = NULL;
+<a name="l01636"></a>01636 }
+<a name="l01637"></a>01637 }
+<a name="l01638"></a>01638
+<a name="l01639"></a>01639 <span class="comment">// if sky_tweak is set to TRUE reconstruct sky frame as object</span>
+<a name="l01640"></a>01640 <span class="comment">// ans use kmo_priv_sky_tweak to subtract a modified sky cube</span>
+<a name="l01641"></a>01641 <span class="keywordflow">if</span> (do_sky_subtraction && sky_tweak) {
+<a name="l01642"></a>01642 <span class="keywordflow">if</span> (ref_spectrum_frame == NULL) { <span class="comment">// no lambda correction using OH lines</span>
+<a name="l01643"></a>01643 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01644"></a>01644 kmo_reconstruct_sci(ifu_nr,
+<a name="l01645"></a>01645 bounds[2*(ifu_nr-1)],
+<a name="l01646"></a>01646 bounds[2*(ifu_nr-1)+1],
+<a name="l01647"></a>01647 sky_as_object_frame,
+<a name="l01648"></a>01648 SCIENCE,
+<a name="l01649"></a>01649 sky_frame,
+<a name="l01650"></a>01650 SCIENCE,
+<a name="l01651"></a>01651 flat_frame,
+<a name="l01652"></a>01652 xcal_frame,
+<a name="l01653"></a>01653 ycal_frame,
+<a name="l01654"></a>01654 lcal_frame,
+<a name="l01655"></a>01655 NULL,
+<a name="l01656"></a>01656 &gd,
+<a name="l01657"></a>01657 &sky_data,
+<a name="l01658"></a>01658 &sky_noise,
+<a name="l01659"></a>01659 flux,
+<a name="l01660"></a>01660 background,
+<a name="l01661"></a>01661 xcal_interpolation));
+<a name="l01662"></a>01662
+<a name="l01663"></a>01663 } <span class="keywordflow">else</span> { <span class="comment">// lambda correction using OH lines</span>
+<a name="l01664"></a>01664 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01665"></a>01665 kmo_reconstruct_sci(ifu_nr,
+<a name="l01666"></a>01666 bounds[2*(ifu_nr-1)],
+<a name="l01667"></a>01667 bounds[2*(ifu_nr-1)+1],
+<a name="l01668"></a>01668 sky_as_object_frame,
+<a name="l01669"></a>01669 SCIENCE,
+<a name="l01670"></a>01670 NULL,
<a name="l01671"></a>01671 NULL,
-<a name="l01672"></a>01672 &gd,
-<a name="l01673"></a>01673 &sky_data,
-<a name="l01674"></a>01674 &sky_noise,
-<a name="l01675"></a>01675 FALSE,
-<a name="l01676"></a>01676 FALSE,
-<a name="l01677"></a>01677 xcal_interpolation));
-<a name="l01678"></a>01678
-<a name="l01679"></a>01679
-<a name="l01680"></a>01680 <span class="keywordflow">if</span> (sky_data != NULL) {
-<a name="l01681"></a>01681 KMO_TRY_EXIT_IF_NULL(
-<a name="l01682"></a>01682 lcorr_coeffs = kmo_lcorr_get(sky_data,
-<a name="l01683"></a>01683 header_data[ifu_nr-1],
-<a name="l01684"></a>01684 ref_spectrum_frame,
-<a name="l01685"></a>01685 gd,
-<a name="l01686"></a>01686 filter_id,
-<a name="l01687"></a>01687 ifu_nr));
-<a name="l01688"></a>01688
-<a name="l01689"></a>01689 cpl_imagelist_delete(sky_data); sky_data = NULL;
-<a name="l01690"></a>01690 <span class="keywordflow">if</span> (sky_noise != NULL) {
-<a name="l01691"></a>01691 cpl_imagelist_delete(sky_noise); sky_noise = NULL;
-<a name="l01692"></a>01692 }
+<a name="l01672"></a>01672 flat_frame,
+<a name="l01673"></a>01673 xcal_frame,
+<a name="l01674"></a>01674 ycal_frame,
+<a name="l01675"></a>01675 lcal_frame,
+<a name="l01676"></a>01676 NULL,
+<a name="l01677"></a>01677 &gd,
+<a name="l01678"></a>01678 &sky_data,
+<a name="l01679"></a>01679 &sky_noise,
+<a name="l01680"></a>01680 FALSE,
+<a name="l01681"></a>01681 FALSE,
+<a name="l01682"></a>01682 xcal_interpolation));
+<a name="l01683"></a>01683
+<a name="l01684"></a>01684
+<a name="l01685"></a>01685 <span class="keywordflow">if</span> (sky_data != NULL) {
+<a name="l01686"></a>01686 KMO_TRY_EXIT_IF_NULL(
+<a name="l01687"></a>01687 lcorr_coeffs = kmo_lcorr_get(sky_data,
+<a name="l01688"></a>01688 header_data[ifu_nr-1],
+<a name="l01689"></a>01689 ref_spectrum_frame,
+<a name="l01690"></a>01690 gd,
+<a name="l01691"></a>01691 filter_id,
+<a name="l01692"></a>01692 ifu_nr));
<a name="l01693"></a>01693
-<a name="l01694"></a>01694 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01695"></a>01695 kmo_reconstruct_sci(ifu_nr,
-<a name="l01696"></a>01696 bounds[2*(ifu_nr-1)],
-<a name="l01697"></a>01697 bounds[2*(ifu_nr-1)+1],
-<a name="l01698"></a>01698 sky_as_object_frame,
-<a name="l01699"></a>01699 SCIENCE,
-<a name="l01700"></a>01700 sky_frame,
-<a name="l01701"></a>01701 SCIENCE,
-<a name="l01702"></a>01702 flat_frame,
-<a name="l01703"></a>01703 xcal_frame,
-<a name="l01704"></a>01704 ycal_frame,
-<a name="l01705"></a>01705 lcal_frame,
-<a name="l01706"></a>01706 lcorr_coeffs,
-<a name="l01707"></a>01707 &gd,
-<a name="l01708"></a>01708 &sky_data,
-<a name="l01709"></a>01709 &sky_noise,
-<a name="l01710"></a>01710 flux,
-<a name="l01711"></a>01711 background,
-<a name="l01712"></a>01712 xcal_interpolation));
-<a name="l01713"></a>01713
-<a name="l01714"></a>01714 cpl_polynomial_delete(lcorr_coeffs); lcorr_coeffs = NULL;
-<a name="l01715"></a>01715 }
-<a name="l01716"></a>01716 }
-<a name="l01717"></a>01717
-<a name="l01718"></a>01718 cpl_imagelist *tmp_object_cube = cube_data[ifu_nr-1];
-<a name="l01719"></a>01719 KMO_TRY_EXIT_IF_NULL(
-<a name="l01720"></a>01720 cube_data[ifu_nr-1] = kmo_priv_sky_tweak (tmp_object_cube,
-<a name="l01721"></a>01721 sky_data,
-<a name="l01722"></a>01722 header_data[ifu_nr-1],
-<a name="l01723"></a>01723 .3));
-<a name="l01724"></a>01724 <span class="keywordflow">if</span> (tmp_object_cube != NULL) {
-<a name="l01725"></a>01725 cpl_imagelist_delete(tmp_object_cube); tmp_object_cube = NULL;
-<a name="l01726"></a>01726 }
-<a name="l01727"></a>01727 <span class="keywordflow">if</span> (sky_data != NULL) {
-<a name="l01728"></a>01728 cpl_imagelist_delete(sky_data); sky_data = NULL;
-<a name="l01729"></a>01729 }
-<a name="l01730"></a>01730 <span class="keywordflow">if</span> (sky_noise != NULL) {
-<a name="l01731"></a>01731 cpl_imagelist_delete(sky_noise); sky_noise = NULL;
-<a name="l01732"></a>01732 }
-<a name="l01733"></a>01733 }
-<a name="l01734"></a>01734
-<a name="l01735"></a>01735 <span class="comment">// scale flux according to pixel_scale</span>
-<a name="l01736"></a>01736 KMO_TRY_EXIT_IF_NULL(
-<a name="l01737"></a>01737 tmpImg = cpl_imagelist_get(cube_data[ifu_nr-1], 0));
-<a name="l01738"></a>01738 <span class="keywordtype">double</span> scaling = (cpl_image_get_size_x(tmpImg)*cpl_image_get_size_y(tmpImg)) /
-<a name="l01739"></a>01739 (KMOS_SLITLET_X*KMOS_SLITLET_Y);
-<a name="l01740"></a>01740 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01741"></a>01741 cpl_imagelist_divide_scalar(cube_data[ifu_nr-1], scaling));
-<a name="l01742"></a>01742 <span class="keywordflow">if</span> (cube_noise[ifu_nr-1] != NULL) {
-<a name="l01743"></a>01743 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01744"></a>01744 cpl_imagelist_divide_scalar(cube_noise[ifu_nr-1], scaling));
-<a name="l01745"></a>01745 }
-<a name="l01746"></a>01746
-<a name="l01747"></a>01747 <span class="comment">// get object name</span>
-<a name="l01748"></a>01748 KMO_TRY_EXIT_IF_NULL(
-<a name="l01749"></a>01749 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_NAME_PREFIX, ifu_nr,
-<a name="l01750"></a>01750 IFU_NAME_POSTFIX));
-<a name="l01751"></a>01751 KMO_TRY_EXIT_IF_NULL(
-<a name="l01752"></a>01752 tmp_str = cpl_propertylist_get_string(header_data[ifu_nr-1],
-<a name="l01753"></a>01753 keyword));
-<a name="l01754"></a>01754 cpl_free(keyword); keyword = NULL;
-<a name="l01755"></a>01755
-<a name="l01756"></a>01756 <span class="comment">//</span>
-<a name="l01757"></a>01757 <span class="comment">// divide cube by telluric correction</span>
-<a name="l01758"></a>01758 <span class="comment">//</span>
-<a name="l01759"></a>01759 <span class="keywordflow">if</span> (has_telluric) {
-<a name="l01760"></a>01760 <span class="comment">// check if the number of occurences of the actual object name is the</span>
-<a name="l01761"></a>01761 <span class="comment">// same as the number of found tellurics for this object (which can be on different arms)</span>
-<a name="l01762"></a>01762 telluric_ok = FALSE;
-<a name="l01763"></a>01763 <span class="keywordflow">for</span> (jj = 0; jj < arm_name_struct->nrNames; jj++) {
-<a name="l01764"></a>01764 <span class="keywordflow">if</span> ((strcmp(arm_name_struct->names[jj], tmp_str) == 0) &&
-<a name="l01765"></a>01765 (arm_name_struct->telluricCnt[jj] == arm_name_struct->namesCnt[jj]))
-<a name="l01766"></a>01766 {
-<a name="l01767"></a>01767 telluric_ok = TRUE;
-<a name="l01768"></a>01768 <span class="keywordflow">break</span>;
-<a name="l01769"></a>01769 }
-<a name="l01770"></a>01770 }
-<a name="l01771"></a>01771
-<a name="l01772"></a>01772 <span class="keywordflow">if</span> (telluric_ok) {
-<a name="l01773"></a>01773 telluric_data = kmo_tweak_load_telluric(frameset, ifu_nr, FALSE, no_subtract);
-<a name="l01774"></a>01774 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01775"></a>01775 <span class="keywordflow">if</span> (telluric_data != NULL) {
-<a name="l01776"></a>01776 index = kmo_identify_index_desc(desc_telluric, ifu_nr, TRUE);
-<a name="l01777"></a>01777 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01778"></a>01778 <span class="keywordflow">if</span> (desc_telluric.sub_desc[index-1].valid_data == TRUE) {
-<a name="l01779"></a>01779 <span class="comment">// load noise if present</span>
-<a name="l01780"></a>01780 telluric_noise = kmo_tweak_load_telluric(frameset, ifu_nr, TRUE, no_subtract);
-<a name="l01781"></a>01781 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01782"></a>01782 } <span class="keywordflow">else</span> {
-<a name="l01783"></a>01783 <span class="keywordflow">if</span> (print_warning_once_tweak_std_noise && (cube_noise[ifu_nr-1] != NULL)) {
-<a name="l01784"></a>01784 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"************************************************************"</span>);
-<a name="l01785"></a>01785 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* Noise cubes were calculated, but won't be divided by *"</span>);
-<a name="l01786"></a>01786 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* telluric error since it is missing. *"</span>);
-<a name="l01787"></a>01787 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* In order to get a telluric with errors, execute *"</span>);
-<a name="l01788"></a>01788 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* kmo_std_star with one of the nearest neighbour methods *"</span>);
-<a name="l01789"></a>01789 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* (set --imethod to NN, lwNN or swNN) *"</span>);
+<a name="l01694"></a>01694 cpl_imagelist_delete(sky_data); sky_data = NULL;
+<a name="l01695"></a>01695 <span class="keywordflow">if</span> (sky_noise != NULL) {
+<a name="l01696"></a>01696 cpl_imagelist_delete(sky_noise); sky_noise = NULL;
+<a name="l01697"></a>01697 }
+<a name="l01698"></a>01698
+<a name="l01699"></a>01699 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01700"></a>01700 kmo_reconstruct_sci(ifu_nr,
+<a name="l01701"></a>01701 bounds[2*(ifu_nr-1)],
+<a name="l01702"></a>01702 bounds[2*(ifu_nr-1)+1],
+<a name="l01703"></a>01703 sky_as_object_frame,
+<a name="l01704"></a>01704 SCIENCE,
+<a name="l01705"></a>01705 sky_frame,
+<a name="l01706"></a>01706 SCIENCE,
+<a name="l01707"></a>01707 flat_frame,
+<a name="l01708"></a>01708 xcal_frame,
+<a name="l01709"></a>01709 ycal_frame,
+<a name="l01710"></a>01710 lcal_frame,
+<a name="l01711"></a>01711 lcorr_coeffs,
+<a name="l01712"></a>01712 &gd,
+<a name="l01713"></a>01713 &sky_data,
+<a name="l01714"></a>01714 &sky_noise,
+<a name="l01715"></a>01715 flux,
+<a name="l01716"></a>01716 background,
+<a name="l01717"></a>01717 xcal_interpolation));
+<a name="l01718"></a>01718
+<a name="l01719"></a>01719 cpl_polynomial_delete(lcorr_coeffs); lcorr_coeffs = NULL;
+<a name="l01720"></a>01720 }
+<a name="l01721"></a>01721 }
+<a name="l01722"></a>01722
+<a name="l01723"></a>01723 cpl_imagelist *tmp_object_cube = cube_data[ifu_nr-1];
+<a name="l01724"></a>01724 KMO_TRY_EXIT_IF_NULL(
+<a name="l01725"></a>01725 cube_data[ifu_nr-1] = kmo_priv_sky_tweak (tmp_object_cube,
+<a name="l01726"></a>01726 sky_data,
+<a name="l01727"></a>01727 header_data[ifu_nr-1],
+<a name="l01728"></a>01728 .3, tbsub));
+<a name="l01729"></a>01729 <span class="keywordflow">if</span> (tmp_object_cube != NULL) {
+<a name="l01730"></a>01730 cpl_imagelist_delete(tmp_object_cube); tmp_object_cube = NULL;
+<a name="l01731"></a>01731 }
+<a name="l01732"></a>01732 <span class="keywordflow">if</span> (sky_data != NULL) {
+<a name="l01733"></a>01733 cpl_imagelist_delete(sky_data); sky_data = NULL;
+<a name="l01734"></a>01734 }
+<a name="l01735"></a>01735 <span class="keywordflow">if</span> (sky_noise != NULL) {
+<a name="l01736"></a>01736 cpl_imagelist_delete(sky_noise); sky_noise = NULL;
+<a name="l01737"></a>01737 }
+<a name="l01738"></a>01738 }
+<a name="l01739"></a>01739
+<a name="l01740"></a>01740 <span class="comment">// scale flux according to pixel_scale</span>
+<a name="l01741"></a>01741 KMO_TRY_EXIT_IF_NULL(
+<a name="l01742"></a>01742 tmpImg = cpl_imagelist_get(cube_data[ifu_nr-1], 0));
+<a name="l01743"></a>01743 <span class="keywordtype">double</span> scaling = (cpl_image_get_size_x(tmpImg)*cpl_image_get_size_y(tmpImg)) /
+<a name="l01744"></a>01744 (KMOS_SLITLET_X*KMOS_SLITLET_Y);
+<a name="l01745"></a>01745 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01746"></a>01746 cpl_imagelist_divide_scalar(cube_data[ifu_nr-1], scaling));
+<a name="l01747"></a>01747 <span class="keywordflow">if</span> (cube_noise[ifu_nr-1] != NULL) {
+<a name="l01748"></a>01748 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01749"></a>01749 cpl_imagelist_divide_scalar(cube_noise[ifu_nr-1], scaling));
+<a name="l01750"></a>01750 }
+<a name="l01751"></a>01751
+<a name="l01752"></a>01752 <span class="comment">// get object name</span>
+<a name="l01753"></a>01753 KMO_TRY_EXIT_IF_NULL(
+<a name="l01754"></a>01754 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_NAME_PREFIX, ifu_nr,
+<a name="l01755"></a>01755 IFU_NAME_POSTFIX));
+<a name="l01756"></a>01756 KMO_TRY_EXIT_IF_NULL(
+<a name="l01757"></a>01757 tmp_str = cpl_propertylist_get_string(header_data[ifu_nr-1],
+<a name="l01758"></a>01758 keyword));
+<a name="l01759"></a>01759 cpl_free(keyword); keyword = NULL;
+<a name="l01760"></a>01760
+<a name="l01761"></a>01761 <span class="comment">//</span>
+<a name="l01762"></a>01762 <span class="comment">// divide cube by telluric correction</span>
+<a name="l01763"></a>01763 <span class="comment">//</span>
+<a name="l01764"></a>01764 <span class="keywordflow">if</span> (has_telluric) {
+<a name="l01765"></a>01765 <span class="comment">// check if the number of occurences of the actual object name is the</span>
+<a name="l01766"></a>01766 <span class="comment">// same as the number of found tellurics for this object (which can be on different arms)</span>
+<a name="l01767"></a>01767 telluric_ok = FALSE;
+<a name="l01768"></a>01768 <span class="keywordflow">for</span> (jj = 0; jj < arm_name_struct->nrNames; jj++) {
+<a name="l01769"></a>01769 <span class="keywordflow">if</span> (((strcmp(arm_name_struct->names[jj], tmp_str) == 0) ||
+<a name="l01770"></a>01770 (strcmp(arm_name_struct->names[jj], IFUS_USER_DEFINED) == 0)) &&
+<a name="l01771"></a>01771 (arm_name_struct->telluricCnt[jj] == arm_name_struct->namesCnt[jj]))
+<a name="l01772"></a>01772 {
+<a name="l01773"></a>01773 telluric_ok = TRUE;
+<a name="l01774"></a>01774 <span class="keywordflow">break</span>;
+<a name="l01775"></a>01775 }
+<a name="l01776"></a>01776 }
+<a name="l01777"></a>01777
+<a name="l01778"></a>01778 <span class="keywordflow">if</span> (telluric_ok) {
+<a name="l01779"></a>01779 telluric_data = kmo_tweak_load_telluric(frameset, ifu_nr, FALSE, no_subtract);
+<a name="l01780"></a>01780 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01781"></a>01781 <span class="keywordflow">if</span> (telluric_data != NULL) {
+<a name="l01782"></a>01782 index = kmo_identify_index_desc(desc_telluric, ifu_nr, TRUE);
+<a name="l01783"></a>01783 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01784"></a>01784 <span class="keywordflow">if</span> (desc_telluric.sub_desc[index-1].valid_data == TRUE) {
+<a name="l01785"></a>01785 <span class="comment">// load noise if present</span>
+<a name="l01786"></a>01786 telluric_noise = kmo_tweak_load_telluric(frameset, ifu_nr, TRUE, no_subtract);
+<a name="l01787"></a>01787 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01788"></a>01788 } <span class="keywordflow">else</span> {
+<a name="l01789"></a>01789 <span class="keywordflow">if</span> (print_warning_once_tweak_std_noise && (cube_noise[ifu_nr-1] != NULL)) {
<a name="l01790"></a>01790 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"************************************************************"</span>);
-<a name="l01791"></a>01791 print_warning_once_tweak_std_noise = FALSE;
-<a name="l01792"></a>01792 }
-<a name="l01793"></a>01793 }
-<a name="l01794"></a>01794
-<a name="l01795"></a>01795 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01796"></a>01796 kmo_arithmetic_3D_1D(
-<a name="l01797"></a>01797 cube_data[ifu_nr-1], telluric_data,
-<a name="l01798"></a>01798 cube_noise[ifu_nr-1], telluric_noise, <span class="stringliteral">"/"</span>));
-<a name="l01799"></a>01799 }
-<a name="l01800"></a>01800 }
-<a name="l01801"></a>01801 }
-<a name="l01802"></a>01802
-<a name="l01803"></a>01803 <span class="comment">//</span>
-<a name="l01804"></a>01804 <span class="comment">// divide cube by illumination correction</span>
-<a name="l01805"></a>01805 <span class="comment">//</span>
-<a name="l01806"></a>01806 <span class="keywordflow">if</span> (has_illum_corr) {
-<a name="l01807"></a>01807 cpl_msg_set_level(CPL_MSG_OFF);
-<a name="l01808"></a>01808 illum_data = kmo_dfs_load_image(frameset, ILLUM_CORR,
-<a name="l01809"></a>01809 ifu_nr, FALSE, FALSE, NULL);
-<a name="l01810"></a>01810 cpl_msg_set_level(actual_msg_level);
-<a name="l01811"></a>01811 <span class="keywordflow">if</span> (cpl_error_get_code() != CPL_ERROR_NONE) {
-<a name="l01812"></a>01812 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"No illumination correction for IFU %d available! "</span>
-<a name="l01813"></a>01813 <span class="stringliteral">"Proceeding anyway."</span>, ifu_nr);
-<a name="l01814"></a>01814 cpl_error_reset();
-<a name="l01815"></a>01815 } <span class="keywordflow">else</span> {
-<a name="l01816"></a>01816 cpl_msg_set_level(CPL_MSG_OFF);
-<a name="l01817"></a>01817 illum_noise = kmo_dfs_load_image(frameset,
-<a name="l01818"></a>01818 ILLUM_CORR,
-<a name="l01819"></a>01819 ifu_nr, TRUE,
-<a name="l01820"></a>01820 FALSE, NULL);
-<a name="l01821"></a>01821 cpl_msg_set_level(actual_msg_level);
-<a name="l01822"></a>01822 <span class="keywordflow">if</span> (cpl_error_get_code() != CPL_ERROR_NONE) {
-<a name="l01823"></a>01823 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"No illumination correction for IFU %d "</span>
-<a name="l01824"></a>01824 <span class="stringliteral">"available! Proceeding anyway."</span>, ifu_nr);
-<a name="l01825"></a>01825 cpl_image_delete(illum_data); illum_data = NULL;
-<a name="l01826"></a>01826 cpl_error_reset();
-<a name="l01827"></a>01827 }
-<a name="l01828"></a>01828 }
-<a name="l01829"></a>01829
-<a name="l01830"></a>01830 <span class="keywordflow">if</span> (illum_data != NULL) {
-<a name="l01831"></a>01831 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01832"></a>01832 kmo_arithmetic_3D_2D(
-<a name="l01833"></a>01833 cube_data[ifu_nr-1], illum_data,
-<a name="l01834"></a>01834 cube_noise[ifu_nr-1], illum_noise, <span class="stringliteral">"/"</span>));
-<a name="l01835"></a>01835 cpl_image_delete(illum_data); illum_data = NULL;
-<a name="l01836"></a>01836 cpl_image_delete(illum_noise); illum_noise = NULL;
-<a name="l01837"></a>01837 }
-<a name="l01838"></a>01838 }
-<a name="l01839"></a>01839
-<a name="l01840"></a>01840 <span class="comment">// get object name and store if not already present</span>
-<a name="l01841"></a>01841 KMO_TRY_EXIT_IF_NULL(
-<a name="l01842"></a>01842 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_NAME_PREFIX, ifu_nr,
-<a name="l01843"></a>01843 IFU_NAME_POSTFIX));
-<a name="l01844"></a>01844 KMO_TRY_EXIT_IF_NULL(
-<a name="l01845"></a>01845 tmp_str = cpl_propertylist_get_string(header_data[ifu_nr-1],
-<a name="l01846"></a>01846 keyword));
-<a name="l01847"></a>01847 cpl_free(keyword); keyword = NULL;
-<a name="l01848"></a>01848
-<a name="l01849"></a>01849 kmclipm_vector_delete(telluric_data);
-<a name="l01850"></a>01850 telluric_data = NULL;
-<a name="l01851"></a>01851 kmclipm_vector_delete(telluric_noise);
-<a name="l01852"></a>01852 telluric_noise = NULL;
+<a name="l01791"></a>01791 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* Noise cubes were calculated, but won't be divided by *"</span>);
+<a name="l01792"></a>01792 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* telluric error since it is missing. *"</span>);
+<a name="l01793"></a>01793 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* In order to get a telluric with errors, execute *"</span>);
+<a name="l01794"></a>01794 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* kmo_std_star with one of the nearest neighbour methods *"</span>);
+<a name="l01795"></a>01795 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"* (set --imethod to NN, lwNN or swNN) *"</span>);
+<a name="l01796"></a>01796 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"************************************************************"</span>);
+<a name="l01797"></a>01797 print_warning_once_tweak_std_noise = FALSE;
+<a name="l01798"></a>01798 }
+<a name="l01799"></a>01799 }
+<a name="l01800"></a>01800
+<a name="l01801"></a>01801 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01802"></a>01802 kmo_arithmetic_3D_1D(
+<a name="l01803"></a>01803 cube_data[ifu_nr-1], telluric_data,
+<a name="l01804"></a>01804 cube_noise[ifu_nr-1], telluric_noise, <span class="stringliteral">"/"</span>));
+<a name="l01805"></a>01805 }
+<a name="l01806"></a>01806 }
+<a name="l01807"></a>01807 }
+<a name="l01808"></a>01808
+<a name="l01809"></a>01809 <span class="comment">//</span>
+<a name="l01810"></a>01810 <span class="comment">// divide cube by illumination correction</span>
+<a name="l01811"></a>01811 <span class="comment">//</span>
+<a name="l01812"></a>01812 <span class="keywordflow">if</span> (has_illum_corr) {
+<a name="l01813"></a>01813 illum_data = kmo_dfs_load_image(frameset, ILLUM_CORR,
+<a name="l01814"></a>01814 ifu_nr, FALSE, FALSE, NULL);
+<a name="l01815"></a>01815 <span class="keywordflow">if</span> (cpl_error_get_code() != CPL_ERROR_NONE) {
+<a name="l01816"></a>01816 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"No illumination correction for IFU %d available! "</span>
+<a name="l01817"></a>01817 <span class="stringliteral">"Proceeding anyway."</span>, ifu_nr);
+<a name="l01818"></a>01818 cpl_error_reset();
+<a name="l01819"></a>01819 } <span class="keywordflow">else</span> {
+<a name="l01820"></a>01820 illum_noise = kmo_dfs_load_image(frameset,
+<a name="l01821"></a>01821 ILLUM_CORR,
+<a name="l01822"></a>01822 ifu_nr, TRUE,
+<a name="l01823"></a>01823 FALSE, NULL);
+<a name="l01824"></a>01824 <span class="keywordflow">if</span> (cpl_error_get_code() != CPL_ERROR_NONE) {
+<a name="l01825"></a>01825 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"No illumination correction for IFU %d "</span>
+<a name="l01826"></a>01826 <span class="stringliteral">"available! Proceeding anyway."</span>, ifu_nr);
+<a name="l01827"></a>01827 cpl_image_delete(illum_data); illum_data = NULL;
+<a name="l01828"></a>01828 cpl_error_reset();
+<a name="l01829"></a>01829 }
+<a name="l01830"></a>01830 }
+<a name="l01831"></a>01831
+<a name="l01832"></a>01832 <span class="keywordflow">if</span> (illum_data != NULL) {
+<a name="l01833"></a>01833 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01834"></a>01834 kmo_arithmetic_3D_2D(
+<a name="l01835"></a>01835 cube_data[ifu_nr-1], illum_data,
+<a name="l01836"></a>01836 cube_noise[ifu_nr-1], illum_noise, <span class="stringliteral">"/"</span>));
+<a name="l01837"></a>01837 cpl_image_delete(illum_data); illum_data = NULL;
+<a name="l01838"></a>01838 cpl_image_delete(illum_noise); illum_noise = NULL;
+<a name="l01839"></a>01839 }
+<a name="l01840"></a>01840 }
+<a name="l01841"></a>01841
+<a name="l01842"></a>01842 <span class="comment">// get object name and store if not already present</span>
+<a name="l01843"></a>01843 KMO_TRY_EXIT_IF_NULL(
+<a name="l01844"></a>01844 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_NAME_PREFIX, ifu_nr,
+<a name="l01845"></a>01845 IFU_NAME_POSTFIX));
+<a name="l01846"></a>01846 KMO_TRY_EXIT_IF_NULL(
+<a name="l01847"></a>01847 tmp_str = cpl_propertylist_get_string(header_data[ifu_nr-1],
+<a name="l01848"></a>01848 keyword));
+<a name="l01849"></a>01849 cpl_free(keyword); keyword = NULL;
+<a name="l01850"></a>01850
+<a name="l01851"></a>01851 kmclipm_vector_delete(telluric_data); telluric_data = NULL;
+<a name="l01852"></a>01852 kmclipm_vector_delete(telluric_noise); telluric_noise = NULL;
<a name="l01853"></a>01853 } <span class="keywordflow">else</span> {
-<a name="l01854"></a>01854 cpl_error_reset();
+<a name="l01854"></a>01854 <span class="comment">// IFU is invalid</span>
<a name="l01855"></a>01855 }
<a name="l01856"></a>01856
<a name="l01857"></a>01857 <span class="comment">// duplicate subheader data</span>
@@ -2027,510 +2027,529 @@
<a name="l02012"></a>02012 keyword));
<a name="l02013"></a>02013 cpl_free(keyword); keyword = NULL;
<a name="l02014"></a>02014
-<a name="l02015"></a>02015 <span class="keywordflow">if</span> (strcmp(arm_name_struct->names[i], tmp_str) == 0) {
-<a name="l02016"></a>02016 <span class="comment">// found object-IFU with matching name</span>
-<a name="l02017"></a>02017 <span class="comment">// load data & subheader</span>
-<a name="l02018"></a>02018 index = kmo_identify_index(fn_reconstr, ifu_nr, FALSE);
-<a name="l02019"></a>02019 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l02020"></a>02020
-<a name="l02021"></a>02021 <span class="keywordflow">if</span> (desc1.sub_desc[index-1].valid_data) {
-<a name="l02022"></a>02022 KMO_TRY_EXIT_IF_NULL(
-<a name="l02023"></a>02023 cube_data[cube_counter_data] =
-<a name="l02024"></a>02024 kmclipm_imagelist_load(fn_reconstr,
-<a name="l02025"></a>02025 CPL_TYPE_FLOAT,
-<a name="l02026"></a>02026 index));
-<a name="l02027"></a>02027 <span class="keywordflow">if</span> (edge_nan) {
-<a name="l02028"></a>02028 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02029"></a>02029 kmo_edge_nan(cube_data[cube_counter_data], ifu_nr));
-<a name="l02030"></a>02030 }
-<a name="l02031"></a>02031
-<a name="l02032"></a>02032 KMO_TRY_EXIT_IF_NULL(
-<a name="l02033"></a>02033 header_data[cube_counter_data] =
-<a name="l02034"></a>02034 kmclipm_propertylist_load(fn_reconstr,
-<a name="l02035"></a>02035 index));
-<a name="l02036"></a>02036 cpl_propertylist_update_string(header_data[cube_counter_data],
-<a name="l02037"></a>02037 <span class="stringliteral">"ESO PRO FRNAME"</span>,
-<a name="l02038"></a>02038 fn_reconstr);
-<a name="l02039"></a>02039 cpl_propertylist_update_int(header_data[cube_counter_data],
-<a name="l02040"></a>02040 <span class="stringliteral">"ESO PRO IFUNR"</span>,
-<a name="l02041"></a>02041 index);
-<a name="l02042"></a>02042 cube_counter_data++;
-<a name="l02043"></a>02043 }
-<a name="l02044"></a>02044
-<a name="l02045"></a>02045 <span class="comment">// load noise & subheader (if existing)</span>
-<a name="l02046"></a>02046 <span class="keywordflow">if</span> (desc1.ex_noise) {
-<a name="l02047"></a>02047 index = kmo_identify_index(fn_reconstr, ifu_nr, TRUE);
-<a name="l02048"></a>02048 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l02049"></a>02049
-<a name="l02050"></a>02050 <span class="keywordflow">if</span> (desc1.sub_desc[index-1].valid_data) {
-<a name="l02051"></a>02051 KMO_TRY_EXIT_IF_NULL(
-<a name="l02052"></a>02052 cube_noise[cube_counter_noise] =
-<a name="l02053"></a>02053 kmclipm_imagelist_load(fn_reconstr,
-<a name="l02054"></a>02054 CPL_TYPE_FLOAT,
-<a name="l02055"></a>02055 index));
-<a name="l02056"></a>02056 <span class="keywordflow">if</span> (edge_nan) {
-<a name="l02057"></a>02057 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02058"></a>02058 kmo_edge_nan(cube_noise[cube_counter_noise], ifu_nr));
-<a name="l02059"></a>02059 }
-<a name="l02060"></a>02060 KMO_TRY_EXIT_IF_NULL(
-<a name="l02061"></a>02061 header_noise[cube_counter_noise] =
-<a name="l02062"></a>02062 kmclipm_propertylist_load(fn_reconstr,
-<a name="l02063"></a>02063 index));
-<a name="l02064"></a>02064 cube_counter_noise++;
-<a name="l02065"></a>02065 }
-<a name="l02066"></a>02066 }
-<a name="l02067"></a>02067 cpl_error_reset();
-<a name="l02068"></a>02068 } <span class="comment">// end if found obj</span>
-<a name="l02069"></a>02069 } <span class="comment">// end for ifu_nr</span>
-<a name="l02070"></a>02070
-<a name="l02071"></a>02071 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
-<a name="l02072"></a>02072 tmp_frame = kmo_dfs_get_frame(frameset, NULL);
-<a name="l02073"></a>02073 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l02074"></a>02074 } <span class="comment">// end while-loop RECONSTRUCTED_CUBE frames</span>
-<a name="l02075"></a>02075
-<a name="l02076"></a>02076 <span class="keywordflow">if</span> (cube_counter_data > 1) {
-<a name="l02077"></a>02077 <span class="keywordflow">if</span> (cube_counter_data == cube_counter_noise) {
-<a name="l02078"></a>02078 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02079"></a>02079 kmo_priv_combine(cube_data,
-<a name="l02080"></a>02080 cube_noise,
-<a name="l02081"></a>02081 header_data,
-<a name="l02082"></a>02082 header_noise,
-<a name="l02083"></a>02083 cube_counter_data,
-<a name="l02084"></a>02084 cube_counter_noise,
-<a name="l02085"></a>02085 arm_name_struct->names[i],
-<a name="l02086"></a>02086 <span class="stringliteral">""</span>,
-<a name="l02087"></a>02087 comb_method,
-<a name="l02088"></a>02088 smethod,
-<a name="l02089"></a>02089 fmethod,
-<a name="l02090"></a>02090 filename,
-<a name="l02091"></a>02091 cmethod,
-<a name="l02092"></a>02092 cpos_rej,
-<a name="l02093"></a>02093 cneg_rej,
-<a name="l02094"></a>02094 citer,
-<a name="l02095"></a>02095 cmin,
-<a name="l02096"></a>02096 cmax,
-<a name="l02097"></a>02097 extrapol_enum,
-<a name="l02098"></a>02098 flux,
-<a name="l02099"></a>02099 &combined_data,
-<a name="l02100"></a>02100 &combined_noise));
-<a name="l02101"></a>02101 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cube_counter_noise == 0) {
-<a name="l02102"></a>02102 <span class="comment">// if imethod == "CS"</span>
-<a name="l02103"></a>02103 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02104"></a>02104 kmo_priv_combine(cube_data,
-<a name="l02105"></a>02105 NULL,
-<a name="l02106"></a>02106 header_data,
-<a name="l02107"></a>02107 header_noise,
-<a name="l02108"></a>02108 cube_counter_data,
-<a name="l02109"></a>02109 cube_counter_noise,
-<a name="l02110"></a>02110 arm_name_struct->names[i],
-<a name="l02111"></a>02111 <span class="stringliteral">""</span>,
-<a name="l02112"></a>02112 comb_method,
-<a name="l02113"></a>02113 smethod,
-<a name="l02114"></a>02114 fmethod,
-<a name="l02115"></a>02115 filename,
-<a name="l02116"></a>02116 cmethod,
-<a name="l02117"></a>02117 cpos_rej,
-<a name="l02118"></a>02118 cneg_rej,
-<a name="l02119"></a>02119 citer,
-<a name="l02120"></a>02120 cmin,
-<a name="l02121"></a>02121 cmax,
-<a name="l02122"></a>02122 extrapol_enum,
-<a name="l02123"></a>02123 flux,
-<a name="l02124"></a>02124 &combined_data,
-<a name="l02125"></a>02125 &combined_noise));
-<a name="l02126"></a>02126 } <span class="keywordflow">else</span> {
-<a name="l02127"></a>02127 KMO_TRY_ASSURE(1 == 0,
-<a name="l02128"></a>02128 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l02129"></a>02129 <span class="stringliteral">"The number of cube-data and cube-noise "</span>
-<a name="l02130"></a>02130 <span class="stringliteral">"isn't the same (%d vs. %d)!"</span>,
-<a name="l02131"></a>02131 cube_counter_data, cube_counter_noise);
-<a name="l02132"></a>02132 }
-<a name="l02133"></a>02133 } <span class="keywordflow">else</span> {
-<a name="l02134"></a>02134 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"There is only one reconstructed cube with "</span>
-<a name="l02135"></a>02135 <span class="stringliteral">"this object! Saving it as it is."</span>);
-<a name="l02136"></a>02136 KMO_TRY_EXIT_IF_NULL(
-<a name="l02137"></a>02137 combined_data = cpl_imagelist_duplicate(cube_data[0]));
-<a name="l02138"></a>02138
-<a name="l02139"></a>02139 <span class="keywordflow">if</span> (cube_noise[0] != NULL) {
-<a name="l02140"></a>02140 KMO_TRY_EXIT_IF_NULL(
-<a name="l02141"></a>02141 combined_noise = cpl_imagelist_duplicate(cube_noise[0]));
-<a name="l02142"></a>02142 }
-<a name="l02143"></a>02143 } <span class="comment">// end if (cube_counter_data > 1)</span>
-<a name="l02144"></a>02144
-<a name="l02145"></a>02145 fn_out = COMBINED_CUBE;
-<a name="l02146"></a>02146 <span class="keywordflow">if</span> (!suppress_extension) {
-<a name="l02147"></a>02147 <span class="keywordflow">if</span> (arm_name_struct->telluricCnt[i] == arm_name_struct->namesCnt[i]) {
-<a name="l02148"></a>02148 KMO_TRY_EXIT_IF_NULL(
-<a name="l02149"></a>02149 fn_suffix = cpl_sprintf(<span class="stringliteral">"_%s"</span>, arm_name_struct->names[i]));
-<a name="l02150"></a>02150 } <span class="keywordflow">else</span> {
-<a name="l02151"></a>02151 KMO_TRY_EXIT_IF_NULL(
-<a name="l02152"></a>02152 fn_suffix = cpl_sprintf(<span class="stringliteral">"_%s_%s"</span>, arm_name_struct->names[i], <span class="stringliteral">"_no_telluric"</span>));
-<a name="l02153"></a>02153 }
-<a name="l02154"></a>02154 } <span class="keywordflow">else</span> {
-<a name="l02155"></a>02155 KMO_TRY_EXIT_IF_NULL(
-<a name="l02156"></a>02156 fn_suffix = cpl_sprintf(<span class="stringliteral">"_%d"</span>, suppress_index++));
-<a name="l02157"></a>02157 }
-<a name="l02158"></a>02158
-<a name="l02159"></a>02159 <span class="comment">// save combined cube</span>
-<a name="l02160"></a>02160 KMO_TRY_EXIT_IF_NULL(
-<a name="l02161"></a>02161 tmp_frame = kmo_dfs_get_frame(frameset, RECONSTRUCTED_CUBE));
-<a name="l02162"></a>02162 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02163"></a>02163 kmo_dfs_save_main_header(frameset, fn_out, fn_suffix,
-<a name="l02164"></a>02164 tmp_frame, NULL, parlist, cpl_func));
+<a name="l02015"></a>02015 <span class="keywordflow">if</span> ((strcmp(arm_name_struct->names[i], tmp_str) == 0) ||
+<a name="l02016"></a>02016 (strcmp(arm_name_struct->names[i], IFUS_USER_DEFINED) == 0))
+<a name="l02017"></a>02017 {
+<a name="l02018"></a>02018 <span class="comment">// found object-IFU with matching name</span>
+<a name="l02019"></a>02019 <span class="comment">// load data & subheader</span>
+<a name="l02020"></a>02020 index = kmo_identify_index(fn_reconstr, ifu_nr, FALSE);
+<a name="l02021"></a>02021 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l02022"></a>02022
+<a name="l02023"></a>02023 <span class="keywordflow">if</span> (desc1.sub_desc[index-1].valid_data) {
+<a name="l02024"></a>02024 KMO_TRY_EXIT_IF_NULL(
+<a name="l02025"></a>02025 cube_data[cube_counter_data] =
+<a name="l02026"></a>02026 kmclipm_imagelist_load(fn_reconstr,
+<a name="l02027"></a>02027 CPL_TYPE_FLOAT,
+<a name="l02028"></a>02028 index));
+<a name="l02029"></a>02029 <span class="keywordflow">if</span> (edge_nan) {
+<a name="l02030"></a>02030 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02031"></a>02031 kmo_edge_nan(cube_data[cube_counter_data], ifu_nr));
+<a name="l02032"></a>02032 }
+<a name="l02033"></a>02033
+<a name="l02034"></a>02034 KMO_TRY_EXIT_IF_NULL(
+<a name="l02035"></a>02035 header_data[cube_counter_data] =
+<a name="l02036"></a>02036 kmclipm_propertylist_load(fn_reconstr,
+<a name="l02037"></a>02037 index));
+<a name="l02038"></a>02038 cpl_propertylist_update_string(header_data[cube_counter_data],
+<a name="l02039"></a>02039 <span class="stringliteral">"ESO PRO FRNAME"</span>,
+<a name="l02040"></a>02040 fn_reconstr);
+<a name="l02041"></a>02041 cpl_propertylist_update_int(header_data[cube_counter_data],
+<a name="l02042"></a>02042 <span class="stringliteral">"ESO PRO IFUNR"</span>,
+<a name="l02043"></a>02043 index);
+<a name="l02044"></a>02044 cube_counter_data++;
+<a name="l02045"></a>02045 }
+<a name="l02046"></a>02046
+<a name="l02047"></a>02047 <span class="comment">// load noise & subheader (if existing)</span>
+<a name="l02048"></a>02048 <span class="keywordflow">if</span> (desc1.ex_noise) {
+<a name="l02049"></a>02049 index = kmo_identify_index(fn_reconstr, ifu_nr, TRUE);
+<a name="l02050"></a>02050 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l02051"></a>02051
+<a name="l02052"></a>02052 <span class="keywordflow">if</span> (desc1.sub_desc[index-1].valid_data) {
+<a name="l02053"></a>02053 KMO_TRY_EXIT_IF_NULL(
+<a name="l02054"></a>02054 cube_noise[cube_counter_noise] =
+<a name="l02055"></a>02055 kmclipm_imagelist_load(fn_reconstr,
+<a name="l02056"></a>02056 CPL_TYPE_FLOAT,
+<a name="l02057"></a>02057 index));
+<a name="l02058"></a>02058 <span class="keywordflow">if</span> (edge_nan) {
+<a name="l02059"></a>02059 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02060"></a>02060 kmo_edge_nan(cube_noise[cube_counter_noise], ifu_nr));
+<a name="l02061"></a>02061 }
+<a name="l02062"></a>02062 KMO_TRY_EXIT_IF_NULL(
+<a name="l02063"></a>02063 header_noise[cube_counter_noise] =
+<a name="l02064"></a>02064 kmclipm_propertylist_load(fn_reconstr,
+<a name="l02065"></a>02065 index));
+<a name="l02066"></a>02066 cube_counter_noise++;
+<a name="l02067"></a>02067 }
+<a name="l02068"></a>02068 }
+<a name="l02069"></a>02069 cpl_error_reset();
+<a name="l02070"></a>02070 } <span class="comment">// end if found obj</span>
+<a name="l02071"></a>02071 } <span class="comment">// end for ifu_nr</span>
+<a name="l02072"></a>02072
+<a name="l02073"></a>02073 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l02074"></a>02074 tmp_frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l02075"></a>02075 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l02076"></a>02076 } <span class="comment">// end while-loop RECONSTRUCTED_CUBE frames</span>
+<a name="l02077"></a>02077
+<a name="l02078"></a>02078 <span class="keywordflow">if</span> (cube_counter_data > 1) {
+<a name="l02079"></a>02079 <span class="keywordflow">if</span> (cube_counter_data == cube_counter_noise) {
+<a name="l02080"></a>02080 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02081"></a>02081 kmo_priv_combine(cube_data,
+<a name="l02082"></a>02082 cube_noise,
+<a name="l02083"></a>02083 header_data,
+<a name="l02084"></a>02084 header_noise,
+<a name="l02085"></a>02085 cube_counter_data,
+<a name="l02086"></a>02086 cube_counter_noise,
+<a name="l02087"></a>02087 arm_name_struct->names[i],
+<a name="l02088"></a>02088 <span class="stringliteral">""</span>,
+<a name="l02089"></a>02089 comb_method,
+<a name="l02090"></a>02090 smethod,
+<a name="l02091"></a>02091 fmethod,
+<a name="l02092"></a>02092 filename,
+<a name="l02093"></a>02093 cmethod,
+<a name="l02094"></a>02094 cpos_rej,
+<a name="l02095"></a>02095 cneg_rej,
+<a name="l02096"></a>02096 citer,
+<a name="l02097"></a>02097 cmin,
+<a name="l02098"></a>02098 cmax,
+<a name="l02099"></a>02099 extrapol_enum,
+<a name="l02100"></a>02100 flux,
+<a name="l02101"></a>02101 &combined_data,
+<a name="l02102"></a>02102 &combined_noise));
+<a name="l02103"></a>02103 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cube_counter_noise == 0) {
+<a name="l02104"></a>02104 <span class="comment">// if imethod == "CS"</span>
+<a name="l02105"></a>02105 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02106"></a>02106 kmo_priv_combine(cube_data,
+<a name="l02107"></a>02107 NULL,
+<a name="l02108"></a>02108 header_data,
+<a name="l02109"></a>02109 header_noise,
+<a name="l02110"></a>02110 cube_counter_data,
+<a name="l02111"></a>02111 cube_counter_noise,
+<a name="l02112"></a>02112 arm_name_struct->names[i],
+<a name="l02113"></a>02113 <span class="stringliteral">""</span>,
+<a name="l02114"></a>02114 comb_method,
+<a name="l02115"></a>02115 smethod,
+<a name="l02116"></a>02116 fmethod,
+<a name="l02117"></a>02117 filename,
+<a name="l02118"></a>02118 cmethod,
+<a name="l02119"></a>02119 cpos_rej,
+<a name="l02120"></a>02120 cneg_rej,
+<a name="l02121"></a>02121 citer,
+<a name="l02122"></a>02122 cmin,
+<a name="l02123"></a>02123 cmax,
+<a name="l02124"></a>02124 extrapol_enum,
+<a name="l02125"></a>02125 flux,
+<a name="l02126"></a>02126 &combined_data,
+<a name="l02127"></a>02127 &combined_noise));
+<a name="l02128"></a>02128 } <span class="keywordflow">else</span> {
+<a name="l02129"></a>02129 KMO_TRY_ASSURE(1 == 0,
+<a name="l02130"></a>02130 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l02131"></a>02131 <span class="stringliteral">"The number of cube-data and cube-noise "</span>
+<a name="l02132"></a>02132 <span class="stringliteral">"isn't the same (%d vs. %d)!"</span>,
+<a name="l02133"></a>02133 cube_counter_data, cube_counter_noise);
+<a name="l02134"></a>02134 }
+<a name="l02135"></a>02135 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cube_counter_data == 1) {
+<a name="l02136"></a>02136 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"There is only one reconstructed cube with "</span>
+<a name="l02137"></a>02137 <span class="stringliteral">"this object! Saving it as it is."</span>);
+<a name="l02138"></a>02138 KMO_TRY_EXIT_IF_NULL(
+<a name="l02139"></a>02139 combined_data = cpl_imagelist_duplicate(cube_data[0]));
+<a name="l02140"></a>02140
+<a name="l02141"></a>02141 <span class="keywordflow">if</span> (cube_noise[0] != NULL) {
+<a name="l02142"></a>02142 KMO_TRY_EXIT_IF_NULL(
+<a name="l02143"></a>02143 combined_noise = cpl_imagelist_duplicate(cube_noise[0]));
+<a name="l02144"></a>02144 }
+<a name="l02145"></a>02145 } <span class="keywordflow">else</span> {
+<a name="l02146"></a>02146 KMO_TRY_ASSURE(1==0,
+<a name="l02147"></a>02147 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l02148"></a>02148 <span class="stringliteral">"No cubes found with this object name!"</span>);
+<a name="l02149"></a>02149 } <span class="comment">// end if (cube_counter_data > 1)</span>
+<a name="l02150"></a>02150
+<a name="l02151"></a>02151 fn_out = COMBINED_CUBE;
+<a name="l02152"></a>02152 <span class="keywordflow">if</span> (!suppress_extension) {
+<a name="l02153"></a>02153 <span class="keywordtype">char</span> tmp_suffix[1024];
+<a name="l02154"></a>02154 tmp_suffix[0] = <span class="charliteral">'\0'</span>;
+<a name="l02155"></a>02155
+<a name="l02156"></a>02156 <span class="keywordflow">if</span> (arm_name_struct->telluricCnt[i] == arm_name_struct->namesCnt[i]) {
+<a name="l02157"></a>02157 strcat(tmp_suffix, <span class="stringliteral">"_telluric"</span>);
+<a name="l02158"></a>02158 }
+<a name="l02159"></a>02159 <span class="keywordflow">if</span> (has_illum_corr) {
+<a name="l02160"></a>02160 strcat(tmp_suffix, <span class="stringliteral">"_illum"</span>);
+<a name="l02161"></a>02161 }
+<a name="l02162"></a>02162 <span class="keywordflow">if</span> (sky_tweak) {
+<a name="l02163"></a>02163 strcat(tmp_suffix, <span class="stringliteral">"_skytweak"</span>);
+<a name="l02164"></a>02164 }
<a name="l02165"></a>02165
-<a name="l02166"></a>02166 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02167"></a>02167 kmo_dfs_save_cube(combined_data, fn_out, fn_suffix,
-<a name="l02168"></a>02168 header_data[0], 0./0.));
-<a name="l02169"></a>02169
-<a name="l02170"></a>02170 <span class="comment">// if (combined_noise != NULL) {</span>
-<a name="l02171"></a>02171 <span class="keywordflow">if</span> (header_noise[0] == NULL) {
-<a name="l02172"></a>02172 KMO_TRY_EXIT_IF_NULL(
-<a name="l02173"></a>02173 header_noise[0] =
-<a name="l02174"></a>02174 cpl_propertylist_duplicate(header_data[0]));
-<a name="l02175"></a>02175
-<a name="l02176"></a>02176 KMO_TRY_EXIT_IF_NULL(
-<a name="l02177"></a>02177 tmp_str = cpl_propertylist_get_string(header_data[0],
-<a name="l02178"></a>02178 EXTNAME));
-<a name="l02179"></a>02179 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02180"></a>02180 kmo_extname_extractor(tmp_str, &ft, &tmp_int, content));
-<a name="l02181"></a>02181 KMO_TRY_EXIT_IF_NULL(
-<a name="l02182"></a>02182 extname = kmo_extname_creator(ifu_frame, tmp_int,
-<a name="l02183"></a>02183 EXT_NOISE));
-<a name="l02184"></a>02184 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02185"></a>02185 kmclipm_update_property_string(header_noise[0],
-<a name="l02186"></a>02186 EXTNAME, extname,
-<a name="l02187"></a>02187 <span class="stringliteral">"FITS extension name"</span>));
-<a name="l02188"></a>02188 cpl_free(extname); extname = NULL;
-<a name="l02189"></a>02189 }
-<a name="l02190"></a>02190 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02191"></a>02191 kmo_dfs_save_cube(combined_noise, fn_out, fn_suffix,
-<a name="l02192"></a>02192 header_noise[0], 0./0.));
-<a name="l02193"></a>02193 <span class="comment">// }</span>
+<a name="l02166"></a>02166 <span class="keywordflow">if</span> (strlen(tmp_suffix) > 0) {
+<a name="l02167"></a>02167 KMO_TRY_EXIT_IF_NULL(
+<a name="l02168"></a>02168 fn_suffix = cpl_sprintf(<span class="stringliteral">"_%s_%s"</span>, arm_name_struct->names[i], tmp_suffix));
+<a name="l02169"></a>02169 } <span class="keywordflow">else</span> {
+<a name="l02170"></a>02170 KMO_TRY_EXIT_IF_NULL(
+<a name="l02171"></a>02171 fn_suffix = cpl_sprintf(<span class="stringliteral">"_%s"</span>, arm_name_struct->names[i]));
+<a name="l02172"></a>02172 }
+<a name="l02173"></a>02173 } <span class="keywordflow">else</span> {
+<a name="l02174"></a>02174 KMO_TRY_EXIT_IF_NULL(
+<a name="l02175"></a>02175 fn_suffix = cpl_sprintf(<span class="stringliteral">"_%d"</span>, suppress_index++));
+<a name="l02176"></a>02176 }
+<a name="l02177"></a>02177
+<a name="l02178"></a>02178 <span class="comment">// save combined cube</span>
+<a name="l02179"></a>02179 KMO_TRY_EXIT_IF_NULL(
+<a name="l02180"></a>02180 tmp_frame = kmo_dfs_get_frame(frameset, RECONSTRUCTED_CUBE));
+<a name="l02181"></a>02181 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02182"></a>02182 kmo_dfs_save_main_header(frameset, fn_out, fn_suffix,
+<a name="l02183"></a>02183 tmp_frame, NULL, parlist, cpl_func));
+<a name="l02184"></a>02184
+<a name="l02185"></a>02185 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02186"></a>02186 kmo_dfs_save_cube(combined_data, fn_out, fn_suffix,
+<a name="l02187"></a>02187 header_data[0], 0./0.));
+<a name="l02188"></a>02188
+<a name="l02189"></a>02189 <span class="comment">// if (combined_noise != NULL) {</span>
+<a name="l02190"></a>02190 <span class="keywordflow">if</span> (header_noise[0] == NULL) {
+<a name="l02191"></a>02191 KMO_TRY_EXIT_IF_NULL(
+<a name="l02192"></a>02192 header_noise[0] =
+<a name="l02193"></a>02193 cpl_propertylist_duplicate(header_data[0]));
<a name="l02194"></a>02194
-<a name="l02195"></a>02195 <span class="keywordflow">for</span> (jj = 0; jj < nr_data_alloc; jj++) {
-<a name="l02196"></a>02196 cpl_imagelist_delete(cube_data[jj]); cube_data[jj] = NULL;
-<a name="l02197"></a>02197 cpl_imagelist_delete(cube_noise[jj]); cube_noise[jj] = NULL;
-<a name="l02198"></a>02198 cpl_propertylist_delete(header_data[jj]); header_data[jj] = NULL;
-<a name="l02199"></a>02199 cpl_propertylist_delete(header_noise[jj]); header_noise[jj] = NULL;
-<a name="l02200"></a>02200 }
-<a name="l02201"></a>02201 cpl_free(cube_data); cube_data = NULL;
-<a name="l02202"></a>02202 cpl_free(cube_noise); cube_noise = NULL;
-<a name="l02203"></a>02203 cpl_free(header_data); header_data = NULL;
-<a name="l02204"></a>02204 cpl_free(header_noise); header_noise = NULL;
-<a name="l02205"></a>02205 cpl_free(fn_suffix); fn_suffix = NULL;
-<a name="l02206"></a>02206 cpl_imagelist_delete(combined_data); combined_data = NULL;
-<a name="l02207"></a>02207 cpl_imagelist_delete(combined_noise); combined_noise = NULL;
-<a name="l02208"></a>02208 } <span class="comment">// for i = nr_avail_obj_names</span>
-<a name="l02209"></a>02209 } <span class="keywordflow">else</span> {
-<a name="l02210"></a>02210 <span class="comment">// we are in mapping_mode</span>
-<a name="l02211"></a>02211 nr_data_alloc = nr_reconstructed_frames*KMOS_NR_IFUS;
-<a name="l02212"></a>02212 KMO_TRY_EXIT_IF_NULL(
-<a name="l02213"></a>02213 cube_data = (cpl_imagelist**)cpl_calloc(nr_data_alloc,
-<a name="l02214"></a>02214 <span class="keyword">sizeof</span>(cpl_imagelist*)));
-<a name="l02215"></a>02215 KMO_TRY_EXIT_IF_NULL(
-<a name="l02216"></a>02216 cube_noise = (cpl_imagelist**)cpl_calloc(nr_data_alloc,
-<a name="l02217"></a>02217 <span class="keyword">sizeof</span>(cpl_imagelist*)));
-<a name="l02218"></a>02218 KMO_TRY_EXIT_IF_NULL(
-<a name="l02219"></a>02219 header_data = (cpl_propertylist**)cpl_calloc( nr_data_alloc,
-<a name="l02220"></a>02220 <span class="keyword">sizeof</span>(cpl_propertylist*)));
-<a name="l02221"></a>02221 KMO_TRY_EXIT_IF_NULL(
-<a name="l02222"></a>02222 header_noise = (cpl_propertylist**)cpl_calloc(nr_data_alloc,
-<a name="l02223"></a>02223 <span class="keyword">sizeof</span>(cpl_propertylist*)));
-<a name="l02224"></a>02224
-<a name="l02225"></a>02225 cube_counter_data = 0;
-<a name="l02226"></a>02226 cube_counter_noise = 0;
-<a name="l02227"></a>02227 KMO_TRY_EXIT_IF_NULL(
-<a name="l02228"></a>02228 tmp_frame = kmo_dfs_get_frame(frameset, RECONSTRUCTED_CUBE));
-<a name="l02229"></a>02229 <span class="keywordflow">while</span> (tmp_frame != NULL ) {
-<a name="l02230"></a>02230 KMO_TRY_EXIT_IF_NULL(
-<a name="l02231"></a>02231 fn_reconstr = cpl_frame_get_filename(tmp_frame));
-<a name="l02232"></a>02232
-<a name="l02233"></a>02233 KMO_TRY_EXIT_IF_NULL(
-<a name="l02234"></a>02234 tmp_header = kmclipm_propertylist_load(fn_reconstr, 0));
-<a name="l02235"></a>02235
-<a name="l02236"></a>02236 kmo_free_fits_desc(&desc1);
-<a name="l02237"></a>02237 kmo_init_fits_desc(&desc1);
-<a name="l02238"></a>02238 desc1 = kmo_identify_fits_header(fn_reconstr);
-<a name="l02239"></a>02239 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= KMOS_NR_IFUS; ifu_nr++) {
-<a name="l02240"></a>02240 index = kmo_identify_index(fn_reconstr, ifu_nr, FALSE);
-<a name="l02241"></a>02241 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l02242"></a>02242
-<a name="l02243"></a>02243 <span class="keywordflow">if</span> (desc1.sub_desc[index-1].valid_data) {
-<a name="l02244"></a>02244 KMO_TRY_EXIT_IF_NULL(
-<a name="l02245"></a>02245 cube_data[cube_counter_data] =
-<a name="l02246"></a>02246 kmclipm_imagelist_load(fn_reconstr, CPL_TYPE_FLOAT,
-<a name="l02247"></a>02247 index));
-<a name="l02248"></a>02248 <span class="keywordflow">if</span> (edge_nan) {
-<a name="l02249"></a>02249 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02250"></a>02250 kmo_edge_nan(cube_data[cube_counter_data], ifu_nr));
-<a name="l02251"></a>02251 }
-<a name="l02252"></a>02252
-<a name="l02253"></a>02253 <span class="keywordflow">if</span> (fast_mode) {
-<a name="l02254"></a>02254 KMO_TRY_EXIT_IF_NULL(
-<a name="l02255"></a>02255 tmpImg = cpl_imagelist_collapse_median_create(cube_data[cube_counter_data]));
-<a name="l02256"></a>02256 KMO_TRY_EXIT_IF_NULL(
-<a name="l02257"></a>02257 tmpCube = cpl_imagelist_new());
-<a name="l02258"></a>02258 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02259"></a>02259 cpl_imagelist_set(tmpCube, tmpImg, 0));
-<a name="l02260"></a>02260 cpl_imagelist_delete(cube_data[cube_counter_data]);
-<a name="l02261"></a>02261 cube_data[cube_counter_data] = tmpCube;
-<a name="l02262"></a>02262 }
-<a name="l02263"></a>02263
-<a name="l02264"></a>02264 KMO_TRY_EXIT_IF_NULL(
-<a name="l02265"></a>02265 header_data[cube_counter_data] =
-<a name="l02266"></a>02266 kmclipm_propertylist_load(fn_reconstr, index));
-<a name="l02267"></a>02267 cpl_propertylist_update_string(header_data[cube_counter_data],
-<a name="l02268"></a>02268 <span class="stringliteral">"ESO PRO FRNAME"</span>,
-<a name="l02269"></a>02269 fn_reconstr);
-<a name="l02270"></a>02270 cpl_propertylist_update_int(header_data[cube_counter_data],
-<a name="l02271"></a>02271 <span class="stringliteral">"ESO PRO IFUNR"</span>,
-<a name="l02272"></a>02272 index);
-<a name="l02273"></a>02273 cube_counter_data++;
-<a name="l02274"></a>02274 }
-<a name="l02275"></a>02275
-<a name="l02276"></a>02276 <span class="comment">// load noise & subheader (if existing)</span>
-<a name="l02277"></a>02277 <span class="keywordflow">if</span> (desc1.ex_noise) {
-<a name="l02278"></a>02278 index = kmo_identify_index(fn_reconstr, ifu_nr, TRUE);
-<a name="l02279"></a>02279 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l02280"></a>02280 <span class="keywordflow">if</span> (desc1.sub_desc[index-1].valid_data) {
-<a name="l02281"></a>02281 KMO_TRY_EXIT_IF_NULL(
-<a name="l02282"></a>02282 cube_noise[cube_counter_noise] =
-<a name="l02283"></a>02283 kmclipm_imagelist_load(fn_reconstr, CPL_TYPE_FLOAT,
-<a name="l02284"></a>02284 index));
-<a name="l02285"></a>02285
-<a name="l02286"></a>02286 <span class="keywordflow">if</span> (edge_nan) {
-<a name="l02287"></a>02287 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02288"></a>02288 kmo_edge_nan(cube_noise[cube_counter_noise], ifu_nr));
-<a name="l02289"></a>02289 }
-<a name="l02290"></a>02290
-<a name="l02291"></a>02291 <span class="keywordflow">if</span> (fast_mode) {
-<a name="l02292"></a>02292 KMO_TRY_EXIT_IF_NULL(
-<a name="l02293"></a>02293 tmpImg = cpl_imagelist_collapse_median_create(cube_noise[cube_counter_noise]));
-<a name="l02294"></a>02294 KMO_TRY_EXIT_IF_NULL(
-<a name="l02295"></a>02295 tmpCube = cpl_imagelist_new());
-<a name="l02296"></a>02296 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02297"></a>02297 cpl_imagelist_set(tmpCube, tmpImg, 0));
-<a name="l02298"></a>02298 cpl_imagelist_delete(cube_noise[cube_counter_noise]);
-<a name="l02299"></a>02299 cube_noise[cube_counter_noise] = tmpCube;
-<a name="l02300"></a>02300 }
-<a name="l02301"></a>02301 KMO_TRY_EXIT_IF_NULL(
-<a name="l02302"></a>02302 header_noise[cube_counter_noise] =
-<a name="l02303"></a>02303 kmclipm_propertylist_load(fn_reconstr, index));
-<a name="l02304"></a>02304 cube_counter_noise++;
-<a name="l02305"></a>02305 }
-<a name="l02306"></a>02306 }
-<a name="l02307"></a>02307 cpl_error_reset();
-<a name="l02308"></a>02308 } <span class="comment">// end for ifu_nr</span>
+<a name="l02195"></a>02195 KMO_TRY_EXIT_IF_NULL(
+<a name="l02196"></a>02196 tmp_str = cpl_propertylist_get_string(header_data[0],
+<a name="l02197"></a>02197 EXTNAME));
+<a name="l02198"></a>02198 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02199"></a>02199 kmo_extname_extractor(tmp_str, &ft, &tmp_int, content));
+<a name="l02200"></a>02200 KMO_TRY_EXIT_IF_NULL(
+<a name="l02201"></a>02201 extname = kmo_extname_creator(ifu_frame, tmp_int,
+<a name="l02202"></a>02202 EXT_NOISE));
+<a name="l02203"></a>02203 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02204"></a>02204 kmclipm_update_property_string(header_noise[0],
+<a name="l02205"></a>02205 EXTNAME, extname,
+<a name="l02206"></a>02206 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l02207"></a>02207 cpl_free(extname); extname = NULL;
+<a name="l02208"></a>02208 }
+<a name="l02209"></a>02209 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02210"></a>02210 kmo_dfs_save_cube(combined_noise, fn_out, fn_suffix,
+<a name="l02211"></a>02211 header_noise[0], 0./0.));
+<a name="l02212"></a>02212 <span class="comment">// }</span>
+<a name="l02213"></a>02213
+<a name="l02214"></a>02214 <span class="keywordflow">for</span> (jj = 0; jj < nr_data_alloc; jj++) {
+<a name="l02215"></a>02215 cpl_imagelist_delete(cube_data[jj]); cube_data[jj] = NULL;
+<a name="l02216"></a>02216 cpl_imagelist_delete(cube_noise[jj]); cube_noise[jj] = NULL;
+<a name="l02217"></a>02217 cpl_propertylist_delete(header_data[jj]); header_data[jj] = NULL;
+<a name="l02218"></a>02218 cpl_propertylist_delete(header_noise[jj]); header_noise[jj] = NULL;
+<a name="l02219"></a>02219 }
+<a name="l02220"></a>02220 cpl_free(cube_data); cube_data = NULL;
+<a name="l02221"></a>02221 cpl_free(cube_noise); cube_noise = NULL;
+<a name="l02222"></a>02222 cpl_free(header_data); header_data = NULL;
+<a name="l02223"></a>02223 cpl_free(header_noise); header_noise = NULL;
+<a name="l02224"></a>02224 cpl_free(fn_suffix); fn_suffix = NULL;
+<a name="l02225"></a>02225 cpl_imagelist_delete(combined_data); combined_data = NULL;
+<a name="l02226"></a>02226 cpl_imagelist_delete(combined_noise); combined_noise = NULL;
+<a name="l02227"></a>02227 } <span class="comment">// for i = nr_avail_obj_names</span>
+<a name="l02228"></a>02228 } <span class="keywordflow">else</span> {
+<a name="l02229"></a>02229 <span class="comment">// we are in mapping_mode</span>
+<a name="l02230"></a>02230 nr_data_alloc = nr_reconstructed_frames*KMOS_NR_IFUS;
+<a name="l02231"></a>02231 KMO_TRY_EXIT_IF_NULL(
+<a name="l02232"></a>02232 cube_data = (cpl_imagelist**)cpl_calloc(nr_data_alloc,
+<a name="l02233"></a>02233 <span class="keyword">sizeof</span>(cpl_imagelist*)));
+<a name="l02234"></a>02234 KMO_TRY_EXIT_IF_NULL(
+<a name="l02235"></a>02235 cube_noise = (cpl_imagelist**)cpl_calloc(nr_data_alloc,
+<a name="l02236"></a>02236 <span class="keyword">sizeof</span>(cpl_imagelist*)));
+<a name="l02237"></a>02237 KMO_TRY_EXIT_IF_NULL(
+<a name="l02238"></a>02238 header_data = (cpl_propertylist**)cpl_calloc( nr_data_alloc,
+<a name="l02239"></a>02239 <span class="keyword">sizeof</span>(cpl_propertylist*)));
+<a name="l02240"></a>02240 KMO_TRY_EXIT_IF_NULL(
+<a name="l02241"></a>02241 header_noise = (cpl_propertylist**)cpl_calloc(nr_data_alloc,
+<a name="l02242"></a>02242 <span class="keyword">sizeof</span>(cpl_propertylist*)));
+<a name="l02243"></a>02243
+<a name="l02244"></a>02244 cube_counter_data = 0;
+<a name="l02245"></a>02245 cube_counter_noise = 0;
+<a name="l02246"></a>02246 KMO_TRY_EXIT_IF_NULL(
+<a name="l02247"></a>02247 tmp_frame = kmo_dfs_get_frame(frameset, RECONSTRUCTED_CUBE));
+<a name="l02248"></a>02248 <span class="keywordflow">while</span> (tmp_frame != NULL ) {
+<a name="l02249"></a>02249 KMO_TRY_EXIT_IF_NULL(
+<a name="l02250"></a>02250 fn_reconstr = cpl_frame_get_filename(tmp_frame));
+<a name="l02251"></a>02251
+<a name="l02252"></a>02252 KMO_TRY_EXIT_IF_NULL(
+<a name="l02253"></a>02253 tmp_header = kmclipm_propertylist_load(fn_reconstr, 0));
+<a name="l02254"></a>02254
+<a name="l02255"></a>02255 kmo_free_fits_desc(&desc1);
+<a name="l02256"></a>02256 kmo_init_fits_desc(&desc1);
+<a name="l02257"></a>02257 desc1 = kmo_identify_fits_header(fn_reconstr);
+<a name="l02258"></a>02258 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= KMOS_NR_IFUS; ifu_nr++) {
+<a name="l02259"></a>02259 index = kmo_identify_index(fn_reconstr, ifu_nr, FALSE);
+<a name="l02260"></a>02260 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l02261"></a>02261
+<a name="l02262"></a>02262 <span class="keywordflow">if</span> (desc1.sub_desc[index-1].valid_data) {
+<a name="l02263"></a>02263 KMO_TRY_EXIT_IF_NULL(
+<a name="l02264"></a>02264 cube_data[cube_counter_data] =
+<a name="l02265"></a>02265 kmclipm_imagelist_load(fn_reconstr, CPL_TYPE_FLOAT,
+<a name="l02266"></a>02266 index));
+<a name="l02267"></a>02267 <span class="keywordflow">if</span> (edge_nan) {
+<a name="l02268"></a>02268 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02269"></a>02269 kmo_edge_nan(cube_data[cube_counter_data], ifu_nr));
+<a name="l02270"></a>02270 }
+<a name="l02271"></a>02271
+<a name="l02272"></a>02272 <span class="keywordflow">if</span> (fast_mode) {
+<a name="l02273"></a>02273 KMO_TRY_EXIT_IF_NULL(
+<a name="l02274"></a>02274 tmpImg = cpl_imagelist_collapse_median_create(cube_data[cube_counter_data]));
+<a name="l02275"></a>02275 KMO_TRY_EXIT_IF_NULL(
+<a name="l02276"></a>02276 tmpCube = cpl_imagelist_new());
+<a name="l02277"></a>02277 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02278"></a>02278 cpl_imagelist_set(tmpCube, tmpImg, 0));
+<a name="l02279"></a>02279 cpl_imagelist_delete(cube_data[cube_counter_data]);
+<a name="l02280"></a>02280 cube_data[cube_counter_data] = tmpCube;
+<a name="l02281"></a>02281 }
+<a name="l02282"></a>02282
+<a name="l02283"></a>02283 KMO_TRY_EXIT_IF_NULL(
+<a name="l02284"></a>02284 header_data[cube_counter_data] =
+<a name="l02285"></a>02285 kmclipm_propertylist_load(fn_reconstr, index));
+<a name="l02286"></a>02286 cpl_propertylist_update_string(header_data[cube_counter_data],
+<a name="l02287"></a>02287 <span class="stringliteral">"ESO PRO FRNAME"</span>,
+<a name="l02288"></a>02288 fn_reconstr);
+<a name="l02289"></a>02289 cpl_propertylist_update_int(header_data[cube_counter_data],
+<a name="l02290"></a>02290 <span class="stringliteral">"ESO PRO IFUNR"</span>,
+<a name="l02291"></a>02291 index);
+<a name="l02292"></a>02292 cube_counter_data++;
+<a name="l02293"></a>02293 }
+<a name="l02294"></a>02294
+<a name="l02295"></a>02295 <span class="comment">// load noise & subheader (if existing)</span>
+<a name="l02296"></a>02296 <span class="keywordflow">if</span> (desc1.ex_noise) {
+<a name="l02297"></a>02297 index = kmo_identify_index(fn_reconstr, ifu_nr, TRUE);
+<a name="l02298"></a>02298 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l02299"></a>02299 <span class="keywordflow">if</span> (desc1.sub_desc[index-1].valid_data) {
+<a name="l02300"></a>02300 KMO_TRY_EXIT_IF_NULL(
+<a name="l02301"></a>02301 cube_noise[cube_counter_noise] =
+<a name="l02302"></a>02302 kmclipm_imagelist_load(fn_reconstr, CPL_TYPE_FLOAT,
+<a name="l02303"></a>02303 index));
+<a name="l02304"></a>02304
+<a name="l02305"></a>02305 <span class="keywordflow">if</span> (edge_nan) {
+<a name="l02306"></a>02306 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02307"></a>02307 kmo_edge_nan(cube_noise[cube_counter_noise], ifu_nr));
+<a name="l02308"></a>02308 }
<a name="l02309"></a>02309
-<a name="l02310"></a>02310 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
-<a name="l02311"></a>02311 tmp_frame = kmo_dfs_get_frame(frameset, NULL);
-<a name="l02312"></a>02312 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l02313"></a>02313 } <span class="comment">// end while-loop RECONSTRUCTED_CUBE frames</span>
-<a name="l02314"></a>02314
-<a name="l02315"></a>02315 <span class="keywordflow">if</span> (cube_counter_data > 1) {
-<a name="l02316"></a>02316 <span class="keywordflow">if</span> (cube_counter_data == cube_counter_noise) {
-<a name="l02317"></a>02317 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02318"></a>02318 kmo_priv_combine(cube_data,
-<a name="l02319"></a>02319 cube_noise,
-<a name="l02320"></a>02320 header_data,
-<a name="l02321"></a>02321 header_noise,
-<a name="l02322"></a>02322 cube_counter_data,
-<a name="l02323"></a>02323 cube_counter_noise,
-<a name="l02324"></a>02324 mapping_mode,
-<a name="l02325"></a>02325 <span class="stringliteral">""</span>,
-<a name="l02326"></a>02326 comb_method,
-<a name="l02327"></a>02327 smethod,
-<a name="l02328"></a>02328 fmethod,
-<a name="l02329"></a>02329 filename,
-<a name="l02330"></a>02330 cmethod,
-<a name="l02331"></a>02331 cpos_rej,
-<a name="l02332"></a>02332 cneg_rej,
-<a name="l02333"></a>02333 citer,
-<a name="l02334"></a>02334 cmin,
-<a name="l02335"></a>02335 cmax,
-<a name="l02336"></a>02336 extrapol_enum,
-<a name="l02337"></a>02337 flux,
-<a name="l02338"></a>02338 &combined_data,
-<a name="l02339"></a>02339 &combined_noise));
-<a name="l02340"></a>02340 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cube_counter_noise == 0) {
-<a name="l02341"></a>02341 <span class="comment">// if imethod == "CS"</span>
-<a name="l02342"></a>02342 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02343"></a>02343 kmo_priv_combine(cube_data,
-<a name="l02344"></a>02344 NULL,
-<a name="l02345"></a>02345 header_data,
-<a name="l02346"></a>02346 header_noise,
-<a name="l02347"></a>02347 cube_counter_data,
-<a name="l02348"></a>02348 cube_counter_noise,
-<a name="l02349"></a>02349 mapping_mode,
-<a name="l02350"></a>02350 <span class="stringliteral">""</span>,
-<a name="l02351"></a>02351 comb_method,
-<a name="l02352"></a>02352 smethod,
-<a name="l02353"></a>02353 fmethod,
-<a name="l02354"></a>02354 filename,
-<a name="l02355"></a>02355 cmethod,
-<a name="l02356"></a>02356 cpos_rej,
-<a name="l02357"></a>02357 cneg_rej,
-<a name="l02358"></a>02358 citer,
-<a name="l02359"></a>02359 cmin,
-<a name="l02360"></a>02360 cmax,
-<a name="l02361"></a>02361 extrapol_enum,
-<a name="l02362"></a>02362 flux,
-<a name="l02363"></a>02363 &combined_data,
-<a name="l02364"></a>02364 &combined_noise));
-<a name="l02365"></a>02365 } <span class="keywordflow">else</span> {
-<a name="l02366"></a>02366 KMO_TRY_ASSURE(1 == 0,
-<a name="l02367"></a>02367 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l02368"></a>02368 <span class="stringliteral">"The number of cube-data and cube-noise "</span>
-<a name="l02369"></a>02369 <span class="stringliteral">"isn't the same (%d vs. %d)!"</span>,
-<a name="l02370"></a>02370 cube_counter_data, cube_counter_noise);
-<a name="l02371"></a>02371 }
-<a name="l02372"></a>02372 } <span class="keywordflow">else</span> {
-<a name="l02373"></a>02373 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"There is only one reconstructed cube! "</span>
-<a name="l02374"></a>02374 <span class="stringliteral">"Saving it as it is."</span>);
-<a name="l02375"></a>02375 KMO_TRY_EXIT_IF_NULL(
-<a name="l02376"></a>02376 combined_data = cpl_imagelist_duplicate(cube_data[0]));
-<a name="l02377"></a>02377
-<a name="l02378"></a>02378 <span class="keywordflow">if</span> (cube_noise[0] != NULL) {
-<a name="l02379"></a>02379 KMO_TRY_EXIT_IF_NULL(
-<a name="l02380"></a>02380 combined_noise = cpl_imagelist_duplicate(cube_noise[0]));
-<a name="l02381"></a>02381 }
-<a name="l02382"></a>02382 }
-<a name="l02383"></a>02383
-<a name="l02384"></a>02384 fn_out = COMBINED_CUBE;
-<a name="l02385"></a>02385 KMO_TRY_EXIT_IF_NULL(
-<a name="l02386"></a>02386 fn_suffix = cpl_sprintf(<span class="stringliteral">"_%s"</span>, mapping_mode));
-<a name="l02387"></a>02387
-<a name="l02388"></a>02388 <span class="comment">// save combined cube</span>
-<a name="l02389"></a>02389 KMO_TRY_EXIT_IF_NULL(
-<a name="l02390"></a>02390 tmp_frame = kmo_dfs_get_frame(frameset, RECONSTRUCTED_CUBE));
-<a name="l02391"></a>02391 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02392"></a>02392 kmo_dfs_save_main_header(frameset, fn_out, fn_suffix, tmp_frame,
-<a name="l02393"></a>02393 NULL, parlist, cpl_func));
-<a name="l02394"></a>02394
-<a name="l02395"></a>02395 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02396"></a>02396 kmo_dfs_save_cube(combined_data, fn_out, fn_suffix,
-<a name="l02397"></a>02397 header_data[0], 0./0.));
-<a name="l02398"></a>02398
-<a name="l02399"></a>02399 <span class="comment">// if (combined_noise != NULL) {</span>
-<a name="l02400"></a>02400 <span class="keywordflow">if</span> (header_noise[0] == NULL) {
-<a name="l02401"></a>02401 KMO_TRY_EXIT_IF_NULL(
-<a name="l02402"></a>02402 header_noise[0] =
-<a name="l02403"></a>02403 cpl_propertylist_duplicate(header_data[0]));
-<a name="l02404"></a>02404
-<a name="l02405"></a>02405 KMO_TRY_EXIT_IF_NULL(
-<a name="l02406"></a>02406 tmp_str = cpl_propertylist_get_string(header_data[0],
-<a name="l02407"></a>02407 EXTNAME));
-<a name="l02408"></a>02408 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02409"></a>02409 kmo_extname_extractor(tmp_str, &ft, &tmp_int, content));
-<a name="l02410"></a>02410 KMO_TRY_EXIT_IF_NULL(
-<a name="l02411"></a>02411 extname = kmo_extname_creator(ifu_frame, tmp_int,
-<a name="l02412"></a>02412 EXT_NOISE));
-<a name="l02413"></a>02413 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02414"></a>02414 kmclipm_update_property_string(header_noise[0],
-<a name="l02415"></a>02415 EXTNAME, extname,
-<a name="l02416"></a>02416 <span class="stringliteral">"FITS extension name"</span>));
-<a name="l02417"></a>02417 cpl_free(extname); extname = NULL;
-<a name="l02418"></a>02418 }
-<a name="l02419"></a>02419 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02420"></a>02420 kmo_dfs_save_cube(combined_noise, fn_out, fn_suffix,
-<a name="l02421"></a>02421 header_noise[0], 0./0.));
-<a name="l02422"></a>02422 <span class="comment">// }</span>
+<a name="l02310"></a>02310 <span class="keywordflow">if</span> (fast_mode) {
+<a name="l02311"></a>02311 KMO_TRY_EXIT_IF_NULL(
+<a name="l02312"></a>02312 tmpImg = cpl_imagelist_collapse_median_create(cube_noise[cube_counter_noise]));
+<a name="l02313"></a>02313 KMO_TRY_EXIT_IF_NULL(
+<a name="l02314"></a>02314 tmpCube = cpl_imagelist_new());
+<a name="l02315"></a>02315 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02316"></a>02316 cpl_imagelist_set(tmpCube, tmpImg, 0));
+<a name="l02317"></a>02317 cpl_imagelist_delete(cube_noise[cube_counter_noise]);
+<a name="l02318"></a>02318 cube_noise[cube_counter_noise] = tmpCube;
+<a name="l02319"></a>02319 }
+<a name="l02320"></a>02320 KMO_TRY_EXIT_IF_NULL(
+<a name="l02321"></a>02321 header_noise[cube_counter_noise] =
+<a name="l02322"></a>02322 kmclipm_propertylist_load(fn_reconstr, index));
+<a name="l02323"></a>02323 cube_counter_noise++;
+<a name="l02324"></a>02324 }
+<a name="l02325"></a>02325 }
+<a name="l02326"></a>02326 cpl_error_reset();
+<a name="l02327"></a>02327 } <span class="comment">// end for ifu_nr</span>
+<a name="l02328"></a>02328
+<a name="l02329"></a>02329 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l02330"></a>02330 tmp_frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l02331"></a>02331 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l02332"></a>02332 } <span class="comment">// end while-loop RECONSTRUCTED_CUBE frames</span>
+<a name="l02333"></a>02333
+<a name="l02334"></a>02334 <span class="keywordflow">if</span> (cube_counter_data > 1) {
+<a name="l02335"></a>02335 <span class="keywordflow">if</span> (cube_counter_data == cube_counter_noise) {
+<a name="l02336"></a>02336 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02337"></a>02337 kmo_priv_combine(cube_data,
+<a name="l02338"></a>02338 cube_noise,
+<a name="l02339"></a>02339 header_data,
+<a name="l02340"></a>02340 header_noise,
+<a name="l02341"></a>02341 cube_counter_data,
+<a name="l02342"></a>02342 cube_counter_noise,
+<a name="l02343"></a>02343 mapping_mode,
+<a name="l02344"></a>02344 <span class="stringliteral">""</span>,
+<a name="l02345"></a>02345 comb_method,
+<a name="l02346"></a>02346 smethod,
+<a name="l02347"></a>02347 fmethod,
+<a name="l02348"></a>02348 filename,
+<a name="l02349"></a>02349 cmethod,
+<a name="l02350"></a>02350 cpos_rej,
+<a name="l02351"></a>02351 cneg_rej,
+<a name="l02352"></a>02352 citer,
+<a name="l02353"></a>02353 cmin,
+<a name="l02354"></a>02354 cmax,
+<a name="l02355"></a>02355 extrapol_enum,
+<a name="l02356"></a>02356 flux,
+<a name="l02357"></a>02357 &combined_data,
+<a name="l02358"></a>02358 &combined_noise));
+<a name="l02359"></a>02359 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cube_counter_noise == 0) {
+<a name="l02360"></a>02360 <span class="comment">// if imethod == "CS"</span>
+<a name="l02361"></a>02361 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02362"></a>02362 kmo_priv_combine(cube_data,
+<a name="l02363"></a>02363 NULL,
+<a name="l02364"></a>02364 header_data,
+<a name="l02365"></a>02365 header_noise,
+<a name="l02366"></a>02366 cube_counter_data,
+<a name="l02367"></a>02367 cube_counter_noise,
+<a name="l02368"></a>02368 mapping_mode,
+<a name="l02369"></a>02369 <span class="stringliteral">""</span>,
+<a name="l02370"></a>02370 comb_method,
+<a name="l02371"></a>02371 smethod,
+<a name="l02372"></a>02372 fmethod,
+<a name="l02373"></a>02373 filename,
+<a name="l02374"></a>02374 cmethod,
+<a name="l02375"></a>02375 cpos_rej,
+<a name="l02376"></a>02376 cneg_rej,
+<a name="l02377"></a>02377 citer,
+<a name="l02378"></a>02378 cmin,
+<a name="l02379"></a>02379 cmax,
+<a name="l02380"></a>02380 extrapol_enum,
+<a name="l02381"></a>02381 flux,
+<a name="l02382"></a>02382 &combined_data,
+<a name="l02383"></a>02383 &combined_noise));
+<a name="l02384"></a>02384 } <span class="keywordflow">else</span> {
+<a name="l02385"></a>02385 KMO_TRY_ASSURE(1 == 0,
+<a name="l02386"></a>02386 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l02387"></a>02387 <span class="stringliteral">"The number of cube-data and cube-noise "</span>
+<a name="l02388"></a>02388 <span class="stringliteral">"isn't the same (%d vs. %d)!"</span>,
+<a name="l02389"></a>02389 cube_counter_data, cube_counter_noise);
+<a name="l02390"></a>02390 }
+<a name="l02391"></a>02391 } <span class="keywordflow">else</span> {
+<a name="l02392"></a>02392 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"There is only one reconstructed cube! "</span>
+<a name="l02393"></a>02393 <span class="stringliteral">"Saving it as it is."</span>);
+<a name="l02394"></a>02394 KMO_TRY_EXIT_IF_NULL(
+<a name="l02395"></a>02395 combined_data = cpl_imagelist_duplicate(cube_data[0]));
+<a name="l02396"></a>02396
+<a name="l02397"></a>02397 <span class="keywordflow">if</span> (cube_noise[0] != NULL) {
+<a name="l02398"></a>02398 KMO_TRY_EXIT_IF_NULL(
+<a name="l02399"></a>02399 combined_noise = cpl_imagelist_duplicate(cube_noise[0]));
+<a name="l02400"></a>02400 }
+<a name="l02401"></a>02401 }
+<a name="l02402"></a>02402
+<a name="l02403"></a>02403 fn_out = COMBINED_CUBE;
+<a name="l02404"></a>02404 KMO_TRY_EXIT_IF_NULL(
+<a name="l02405"></a>02405 fn_suffix = cpl_sprintf(<span class="stringliteral">"_%s"</span>, mapping_mode));
+<a name="l02406"></a>02406
+<a name="l02407"></a>02407 <span class="comment">// save combined cube</span>
+<a name="l02408"></a>02408 KMO_TRY_EXIT_IF_NULL(
+<a name="l02409"></a>02409 tmp_frame = kmo_dfs_get_frame(frameset, RECONSTRUCTED_CUBE));
+<a name="l02410"></a>02410 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02411"></a>02411 kmo_dfs_save_main_header(frameset, fn_out, fn_suffix, tmp_frame,
+<a name="l02412"></a>02412 NULL, parlist, cpl_func));
+<a name="l02413"></a>02413
+<a name="l02414"></a>02414 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02415"></a>02415 kmo_dfs_save_cube(combined_data, fn_out, fn_suffix,
+<a name="l02416"></a>02416 header_data[0], 0./0.));
+<a name="l02417"></a>02417
+<a name="l02418"></a>02418 <span class="comment">// if (combined_noise != NULL) {</span>
+<a name="l02419"></a>02419 <span class="keywordflow">if</span> (header_noise[0] == NULL) {
+<a name="l02420"></a>02420 KMO_TRY_EXIT_IF_NULL(
+<a name="l02421"></a>02421 header_noise[0] =
+<a name="l02422"></a>02422 cpl_propertylist_duplicate(header_data[0]));
<a name="l02423"></a>02423
-<a name="l02424"></a>02424 <span class="keywordflow">for</span> (i = 0; i < nr_data_alloc; i++) {
-<a name="l02425"></a>02425 cpl_imagelist_delete(cube_data[i]); cube_data[i] = NULL;
-<a name="l02426"></a>02426 cpl_imagelist_delete(cube_noise[i]); cube_noise[i] = NULL;
-<a name="l02427"></a>02427 cpl_propertylist_delete(header_data[i]); header_data[i] = NULL;
-<a name="l02428"></a>02428 cpl_propertylist_delete(header_noise[i]); header_noise[i] = NULL;
-<a name="l02429"></a>02429 }
-<a name="l02430"></a>02430 cpl_free(cube_data); cube_data = NULL;
-<a name="l02431"></a>02431 cpl_free(cube_noise); cube_noise = NULL;
-<a name="l02432"></a>02432 cpl_free(header_data); header_data = NULL;
-<a name="l02433"></a>02433 cpl_free(header_noise); header_noise = NULL;
-<a name="l02434"></a>02434 cpl_free(fn_suffix); fn_suffix = NULL;
-<a name="l02435"></a>02435 cpl_imagelist_delete(combined_data); combined_data = NULL;
-<a name="l02436"></a>02436 cpl_imagelist_delete(combined_noise); combined_noise = NULL;
-<a name="l02437"></a>02437 } <span class="comment">// if mapping_mode</span>
-<a name="l02438"></a>02438 } <span class="keywordflow">else</span> {
-<a name="l02439"></a>02439 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"NOT combining reconstructed objects (--no_combine is set)"</span>);
-<a name="l02440"></a>02440 } <span class="comment">// if (!no_combine)</span>
-<a name="l02441"></a>02441
-<a name="l02442"></a>02442 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
-<a name="l02443"></a>02443 }
-<a name="l02444"></a>02444 KMO_CATCH
-<a name="l02445"></a>02445 {
-<a name="l02446"></a>02446 KMO_CATCH_MSG();
-<a name="l02447"></a>02447 ret_val = -1;
-<a name="l02448"></a>02448 }
-<a name="l02449"></a>02449
-<a name="l02450"></a>02450 <span class="keywordflow">if</span> (cube_data != NULL) {
-<a name="l02451"></a>02451 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= nr_data_alloc; ifu_nr++) {
-<a name="l02452"></a>02452 cpl_imagelist_delete(cube_data[ifu_nr-1]); cube_data[ifu_nr-1] = NULL;
-<a name="l02453"></a>02453 }
-<a name="l02454"></a>02454 }
-<a name="l02455"></a>02455 cpl_free(cube_data); cube_data = NULL;
-<a name="l02456"></a>02456 <span class="keywordflow">if</span> (cube_noise != NULL) {
-<a name="l02457"></a>02457 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= nr_data_alloc; ifu_nr++) {
-<a name="l02458"></a>02458 cpl_imagelist_delete(cube_noise[ifu_nr-1]); cube_noise[ifu_nr-1] = NULL;
-<a name="l02459"></a>02459 }
-<a name="l02460"></a>02460 }
-<a name="l02461"></a>02461 cpl_free(cube_noise); cube_noise = NULL;
-<a name="l02462"></a>02462 <span class="keywordflow">if</span> (header_data != NULL) {
-<a name="l02463"></a>02463 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= nr_data_alloc; ifu_nr++) {
-<a name="l02464"></a>02464 cpl_propertylist_delete(header_data[ifu_nr-1]); header_data[ifu_nr-1] = NULL;
-<a name="l02465"></a>02465 }
-<a name="l02466"></a>02466 }
-<a name="l02467"></a>02467 cpl_free(header_data); header_data = NULL;
-<a name="l02468"></a>02468 <span class="keywordflow">if</span> (header_noise != NULL) {
-<a name="l02469"></a>02469 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= nr_data_alloc; ifu_nr++) {
-<a name="l02470"></a>02470 cpl_propertylist_delete(header_noise[ifu_nr-1]); header_noise[ifu_nr-1] = NULL;
-<a name="l02471"></a>02471 }
-<a name="l02472"></a>02472 }
-<a name="l02473"></a>02473 cpl_free(header_noise); header_noise = NULL;
-<a name="l02474"></a>02474
-<a name="l02475"></a>02475
-<a name="l02476"></a>02476 kmo_free_fits_desc(&desc1);
-<a name="l02477"></a>02477 kmo_free_fits_desc(&desc2);
-<a name="l02478"></a>02478 kmo_free_fits_desc(&desc_telluric);
-<a name="l02479"></a>02479
-<a name="l02480"></a>02480 cpl_vector_delete(ifus); ifus = NULL;
-<a name="l02481"></a>02481 cpl_free(mapping_mode); mapping_mode = NULL;
-<a name="l02482"></a>02482 <span class="keywordflow">if</span> (unused_ifus_before != NULL) {
-<a name="l02483"></a>02483 kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
-<a name="l02484"></a>02484 }
-<a name="l02485"></a>02485 <span class="keywordflow">if</span> (unused_ifus_after != NULL) {
-<a name="l02486"></a>02486 kmo_free_unused_ifus(unused_ifus_after); unused_ifus_after = NULL;
-<a name="l02487"></a>02487 }
-<a name="l02488"></a>02488 <span class="keywordflow">if</span> (bounds != NULL) {
-<a name="l02489"></a>02489 cpl_free(bounds); bounds = NULL;
-<a name="l02490"></a>02490 }
-<a name="l02491"></a>02491
-<a name="l02492"></a>02492 <span class="comment">// frees for the case of errors</span>
-<a name="l02493"></a>02493 kmclipm_vector_delete(telluric_data); telluric_data = NULL;
-<a name="l02494"></a>02494 kmclipm_vector_delete(telluric_noise); telluric_noise = NULL;
-<a name="l02495"></a>02495 cpl_image_delete(illum_data); illum_data = NULL;
-<a name="l02496"></a>02496 cpl_image_delete(illum_noise); illum_noise = NULL;
-<a name="l02497"></a>02497 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
-<a name="l02498"></a>02498 cpl_table_delete(band_table); band_table = NULL;
-<a name="l02499"></a>02499 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l02500"></a>02500 <span class="keywordflow">if</span> (lcal != NULL) {
-<a name="l02501"></a>02501 <span class="keywordflow">for</span> (i = 0; i < KMOS_NR_DETECTORS; i++) {
-<a name="l02502"></a>02502 cpl_image_delete(lcal[i]);
-<a name="l02503"></a>02503 }
-<a name="l02504"></a>02504 }
-<a name="l02505"></a>02505 cpl_free(lcal); lcal = NULL;
-<a name="l02506"></a>02506 cpl_free(fn_suffix); fn_suffix = NULL;
-<a name="l02507"></a>02507 cpl_free(suffix); suffix = NULL;
-<a name="l02508"></a>02508
-<a name="l02509"></a>02509 kmo_delete_armNameStruct(arm_name_struct);
+<a name="l02424"></a>02424 KMO_TRY_EXIT_IF_NULL(
+<a name="l02425"></a>02425 tmp_str = cpl_propertylist_get_string(header_data[0],
+<a name="l02426"></a>02426 EXTNAME));
+<a name="l02427"></a>02427 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02428"></a>02428 kmo_extname_extractor(tmp_str, &ft, &tmp_int, content));
+<a name="l02429"></a>02429 KMO_TRY_EXIT_IF_NULL(
+<a name="l02430"></a>02430 extname = kmo_extname_creator(ifu_frame, tmp_int,
+<a name="l02431"></a>02431 EXT_NOISE));
+<a name="l02432"></a>02432 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02433"></a>02433 kmclipm_update_property_string(header_noise[0],
+<a name="l02434"></a>02434 EXTNAME, extname,
+<a name="l02435"></a>02435 <span class="stringliteral">"FITS extension name"</span>));
+<a name="l02436"></a>02436 cpl_free(extname); extname = NULL;
+<a name="l02437"></a>02437 }
+<a name="l02438"></a>02438 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02439"></a>02439 kmo_dfs_save_cube(combined_noise, fn_out, fn_suffix,
+<a name="l02440"></a>02440 header_noise[0], 0./0.));
+<a name="l02441"></a>02441 <span class="comment">// }</span>
+<a name="l02442"></a>02442
+<a name="l02443"></a>02443 <span class="keywordflow">for</span> (i = 0; i < nr_data_alloc; i++) {
+<a name="l02444"></a>02444 cpl_imagelist_delete(cube_data[i]); cube_data[i] = NULL;
+<a name="l02445"></a>02445 cpl_imagelist_delete(cube_noise[i]); cube_noise[i] = NULL;
+<a name="l02446"></a>02446 cpl_propertylist_delete(header_data[i]); header_data[i] = NULL;
+<a name="l02447"></a>02447 cpl_propertylist_delete(header_noise[i]); header_noise[i] = NULL;
+<a name="l02448"></a>02448 }
+<a name="l02449"></a>02449 cpl_free(cube_data); cube_data = NULL;
+<a name="l02450"></a>02450 cpl_free(cube_noise); cube_noise = NULL;
+<a name="l02451"></a>02451 cpl_free(header_data); header_data = NULL;
+<a name="l02452"></a>02452 cpl_free(header_noise); header_noise = NULL;
+<a name="l02453"></a>02453 cpl_free(fn_suffix); fn_suffix = NULL;
+<a name="l02454"></a>02454 cpl_imagelist_delete(combined_data); combined_data = NULL;
+<a name="l02455"></a>02455 cpl_imagelist_delete(combined_noise); combined_noise = NULL;
+<a name="l02456"></a>02456 } <span class="comment">// if mapping_mode</span>
+<a name="l02457"></a>02457 } <span class="keywordflow">else</span> {
+<a name="l02458"></a>02458 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"NOT combining reconstructed objects (--no_combine is set)"</span>);
+<a name="l02459"></a>02459 } <span class="comment">// if (!no_combine)</span>
+<a name="l02460"></a>02460
+<a name="l02461"></a>02461 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"-------------------------------------------"</span>);
+<a name="l02462"></a>02462 }
+<a name="l02463"></a>02463 KMO_CATCH
+<a name="l02464"></a>02464 {
+<a name="l02465"></a>02465 KMO_CATCH_MSG();
+<a name="l02466"></a>02466 ret_val = -1;
+<a name="l02467"></a>02467 }
+<a name="l02468"></a>02468
+<a name="l02469"></a>02469 <span class="keywordflow">if</span> (cube_data != NULL) {
+<a name="l02470"></a>02470 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= nr_data_alloc; ifu_nr++) {
+<a name="l02471"></a>02471 cpl_imagelist_delete(cube_data[ifu_nr-1]); cube_data[ifu_nr-1] = NULL;
+<a name="l02472"></a>02472 }
+<a name="l02473"></a>02473 }
+<a name="l02474"></a>02474 cpl_free(cube_data); cube_data = NULL;
+<a name="l02475"></a>02475 <span class="keywordflow">if</span> (cube_noise != NULL) {
+<a name="l02476"></a>02476 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= nr_data_alloc; ifu_nr++) {
+<a name="l02477"></a>02477 cpl_imagelist_delete(cube_noise[ifu_nr-1]); cube_noise[ifu_nr-1] = NULL;
+<a name="l02478"></a>02478 }
+<a name="l02479"></a>02479 }
+<a name="l02480"></a>02480 cpl_free(cube_noise); cube_noise = NULL;
+<a name="l02481"></a>02481 <span class="keywordflow">if</span> (header_data != NULL) {
+<a name="l02482"></a>02482 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= nr_data_alloc; ifu_nr++) {
+<a name="l02483"></a>02483 cpl_propertylist_delete(header_data[ifu_nr-1]); header_data[ifu_nr-1] = NULL;
+<a name="l02484"></a>02484 }
+<a name="l02485"></a>02485 }
+<a name="l02486"></a>02486 cpl_free(header_data); header_data = NULL;
+<a name="l02487"></a>02487 <span class="keywordflow">if</span> (header_noise != NULL) {
+<a name="l02488"></a>02488 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= nr_data_alloc; ifu_nr++) {
+<a name="l02489"></a>02489 cpl_propertylist_delete(header_noise[ifu_nr-1]); header_noise[ifu_nr-1] = NULL;
+<a name="l02490"></a>02490 }
+<a name="l02491"></a>02491 }
+<a name="l02492"></a>02492 cpl_free(header_noise); header_noise = NULL;
+<a name="l02493"></a>02493
+<a name="l02494"></a>02494
+<a name="l02495"></a>02495 kmo_free_fits_desc(&desc1);
+<a name="l02496"></a>02496 kmo_free_fits_desc(&desc2);
+<a name="l02497"></a>02497 kmo_free_fits_desc(&desc_telluric);
+<a name="l02498"></a>02498
+<a name="l02499"></a>02499 cpl_vector_delete(ifus); ifus = NULL;
+<a name="l02500"></a>02500 cpl_free(mapping_mode); mapping_mode = NULL;
+<a name="l02501"></a>02501 <span class="keywordflow">if</span> (unused_ifus_before != NULL) {
+<a name="l02502"></a>02502 kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
+<a name="l02503"></a>02503 }
+<a name="l02504"></a>02504 <span class="keywordflow">if</span> (unused_ifus_after != NULL) {
+<a name="l02505"></a>02505 kmo_free_unused_ifus(unused_ifus_after); unused_ifus_after = NULL;
+<a name="l02506"></a>02506 }
+<a name="l02507"></a>02507 <span class="keywordflow">if</span> (bounds != NULL) {
+<a name="l02508"></a>02508 cpl_free(bounds); bounds = NULL;
+<a name="l02509"></a>02509 }
<a name="l02510"></a>02510
-<a name="l02511"></a>02511 <span class="keywordflow">return</span> ret_val;
-<a name="l02512"></a>02512 }
-<a name="l02513"></a>02513
+<a name="l02511"></a>02511 <span class="comment">// frees for the case of errors</span>
+<a name="l02512"></a>02512 kmclipm_vector_delete(telluric_data); telluric_data = NULL;
+<a name="l02513"></a>02513 kmclipm_vector_delete(telluric_noise); telluric_noise = NULL;
+<a name="l02514"></a>02514 cpl_image_delete(illum_data); illum_data = NULL;
+<a name="l02515"></a>02515 cpl_image_delete(illum_noise); illum_noise = NULL;
+<a name="l02516"></a>02516 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l02517"></a>02517 cpl_table_delete(band_table); band_table = NULL;
+<a name="l02518"></a>02518 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l02519"></a>02519 <span class="keywordflow">if</span> (lcal != NULL) {
+<a name="l02520"></a>02520 <span class="keywordflow">for</span> (i = 0; i < KMOS_NR_DETECTORS; i++) {
+<a name="l02521"></a>02521 cpl_image_delete(lcal[i]);
+<a name="l02522"></a>02522 }
+<a name="l02523"></a>02523 }
+<a name="l02524"></a>02524 cpl_free(lcal); lcal = NULL;
+<a name="l02525"></a>02525 cpl_free(fn_suffix); fn_suffix = NULL;
+<a name="l02526"></a>02526 cpl_free(suffix); suffix = NULL;
+<a name="l02527"></a>02527
+<a name="l02528"></a>02528 kmo_delete_armNameStruct(arm_name_struct);
+<a name="l02529"></a>02529
+<a name="l02530"></a>02530 <span class="keywordflow">return</span> ret_val;
+<a name="l02531"></a>02531 }
+<a name="l02532"></a>02532
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__shift_8c_source.html b/html/kmo__shift_8c_source.html
index 88eccdc..2909896 100644
--- a/html/kmo__shift_8c_source.html
+++ b/html/kmo__shift_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_shift.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_shift.c,v 1.14 2013/06/07 15:41:21 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_shift.c,v 1.14 2013-06-07 15:41:21 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/06/07 15:41:21 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-06-07 15:41:21 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.14 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -618,7 +618,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__sky__mask_8c_source.html b/html/kmo__sky__mask_8c_source.html
index 555e996..1904d0d 100644
--- a/html/kmo__sky__mask_8c_source.html
+++ b/html/kmo__sky__mask_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_sky_mask.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_sky_mask.c,v 1.9 2013/08/02 15:46:38 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_sky_mask.c,v 1.9 2013-08-02 15:46:38 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/08/02 15:46:38 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-08-02 15:46:38 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.9 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -477,7 +477,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__sky__tweak_8c_source.html b/html/kmo__sky__tweak_8c_source.html
index 78762cb..e3274c1 100644
--- a/html/kmo__sky__tweak_8c_source.html
+++ b/html/kmo__sky__tweak_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_sky_tweak.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_sky_tweak.c,v 1.3 2013/08/02 16:22:44 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_sky_tweak.c,v 1.4 2013-09-13 09:10:28 erw Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -81,10 +81,10 @@
<a name="l00019"></a>00019 <span class="comment"> */</span>
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
-<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/08/02 16:22:44 $</span>
-<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.3 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: erw $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-09-13 09:10:28 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.4 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -112,267 +112,287 @@
<a name="l00050"></a>00050 <span class="keyword">static</span> <span class="keywordtype">char</span> kmo_sky_tweak_description[] =
<a name="l00051"></a>00051 <span class="stringliteral">" This recipes is an advanced tool to remove OH sky lines.\n"</span>
<a name="l00052"></a>00052 <span class="stringliteral">"\n"</span>
-<a name="l00053"></a>00053 <span class="stringliteral">"NO PARAMETERS\n"</span>
-<a name="l00054"></a>00054 <span class="stringliteral">"\n"</span>
-<a name="l00055"></a>00055 <span class="stringliteral">"-------------------------------------------------------------------------------\n"</span>
-<a name="l00056"></a>00056 <span class="stringliteral">" Input files:\n"</span>
-<a name="l00057"></a>00057 <span class="stringliteral">"\n"</span>
-<a name="l00058"></a>00058 <span class="stringliteral">" DO KMOS \n"</span>
-<a name="l00059"></a>00059 <span class="stringliteral">" category Type Explanation Required #Frames\n"</span>
-<a name="l00060"></a>00060 <span class="stringliteral">" -------- ----- ----------- -------- -------\n"</span>
-<a name="l00061"></a>00061 <span class="stringliteral">" CUBE_OBJECT F3I object cubes Y >=1 \n"</span>
-<a name="l00062"></a>00062 <span class="stringliteral">" CUBE_SKY F3I sky cube Y 1 \n"</span>
-<a name="l00063"></a>00063 <span class="stringliteral">"\n"</span>
-<a name="l00064"></a>00064 <span class="stringliteral">" Output files:\n"</span>
-<a name="l00065"></a>00065 <span class="stringliteral">"\n"</span>
-<a name="l00066"></a>00066 <span class="stringliteral">" DO KMOS\n"</span>
-<a name="l00067"></a>00067 <span class="stringliteral">" category Type Explanation\n"</span>
-<a name="l00068"></a>00068 <span class="stringliteral">" -------- ----- -----------\n"</span>
-<a name="l00069"></a>00069 <span class="stringliteral">" OBJECT_S F3I Corrected object cubes\n"</span>
-<a name="l00070"></a>00070 <span class="stringliteral">"-------------------------------------------------------------------------------\n"</span>
-<a name="l00071"></a>00071 <span class="stringliteral">"\n"</span>;
-<a name="l00072"></a>00072
-<a name="l00089"></a><a class="code" href="group__kmo__sky__tweak.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693">00089</a> <span class="keywordtype">int</span> <a class="code" href="group__kmo__arithmetic.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693" title="Build the list of available plugins, for this module.">cpl_plugin_get_info</a>(cpl_pluginlist *list)
-<a name="l00090"></a>00090 {
-<a name="l00091"></a>00091 cpl_recipe *recipe = cpl_calloc(1, <span class="keyword">sizeof</span> *recipe);
-<a name="l00092"></a>00092 cpl_plugin *plugin = &recipe->interface;
-<a name="l00093"></a>00093
-<a name="l00094"></a>00094 cpl_plugin_init(plugin,
-<a name="l00095"></a>00095 CPL_PLUGIN_API,
-<a name="l00096"></a>00096 KMOS_BINARY_VERSION,
-<a name="l00097"></a>00097 CPL_PLUGIN_TYPE_RECIPE,
-<a name="l00098"></a>00098 <span class="stringliteral">"kmo_sky_tweak"</span>,
-<a name="l00099"></a>00099 <span class="stringliteral">"Removal of OH sky lines"</span>,
-<a name="l00100"></a>00100 kmo_sky_tweak_description,
-<a name="l00101"></a>00101 <span class="stringliteral">"Erich Wiezorrek"</span>,
-<a name="l00102"></a>00102 <span class="stringliteral">"kmos-spark at mpe.mpg.de"</span>,
-<a name="l00103"></a>00103 kmos_get_license(),
-<a name="l00104"></a>00104 kmo_sky_tweak_create,
-<a name="l00105"></a>00105 kmo_sky_tweak_exec,
-<a name="l00106"></a>00106 kmo_sky_tweak_destroy);
-<a name="l00107"></a>00107
-<a name="l00108"></a>00108 cpl_pluginlist_append(list, plugin);
-<a name="l00109"></a>00109
-<a name="l00110"></a>00110 <span class="keywordflow">return</span> 0;
-<a name="l00111"></a>00111 }
-<a name="l00112"></a>00112
-<a name="l00120"></a>00120 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sky_tweak_create(cpl_plugin *plugin)
-<a name="l00121"></a>00121 {
-<a name="l00122"></a>00122 cpl_recipe *recipe;
-<a name="l00123"></a>00123 <span class="comment">// cpl_parameter *p;</span>
-<a name="l00124"></a>00124
-<a name="l00125"></a>00125 <span class="comment">/* Check that the plugin is part of a valid recipe */</span>
-<a name="l00126"></a>00126 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
-<a name="l00127"></a>00127 recipe = (cpl_recipe *)plugin;
-<a name="l00128"></a>00128 <span class="keywordflow">else</span>
-<a name="l00129"></a>00129 <span class="keywordflow">return</span> -1;
-<a name="l00130"></a>00130
-<a name="l00131"></a>00131 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
-<a name="l00132"></a>00132 recipe->parameters = cpl_parameterlist_new();
-<a name="l00133"></a>00133
-<a name="l00134"></a>00134 <span class="comment">/* Fill the parameters list */</span>
-<a name="l00135"></a>00135
-<a name="l00136"></a>00136 <span class="keywordflow">return</span> 0;
+<a name="l00053"></a>00053 <span class="stringliteral">"BASIC PARAMETERS:\n"</span>
+<a name="l00054"></a>00054 <span class="stringliteral">"-----------------\n"</span>
+<a name="l00055"></a>00055 <span class="stringliteral">"--tbsub\n"</span>
+<a name="l00056"></a>00056 <span class="stringliteral">"If set to TRUE subtract the thermal background from the input cube.\n"</span>
+<a name="l00057"></a>00057 <span class="stringliteral">"Default value is TRUE.\n"</span>
+<a name="l00058"></a>00058 <span class="stringliteral">"\n"</span>
+<a name="l00059"></a>00059 <span class="stringliteral">"-------------------------------------------------------------------------------\n"</span>
+<a name="l00060"></a>00060 <span class="stringliteral">" Input files:\n"</span>
+<a name="l00061"></a>00061 <span class="stringliteral">"\n"</span>
+<a name="l00062"></a>00062 <span class="stringliteral">" DO KMOS \n"</span>
+<a name="l00063"></a>00063 <span class="stringliteral">" category Type Explanation Required #Frames\n"</span>
+<a name="l00064"></a>00064 <span class="stringliteral">" -------- ----- ----------- -------- -------\n"</span>
+<a name="l00065"></a>00065 <span class="stringliteral">" CUBE_OBJECT F3I object cubes Y >=1 \n"</span>
+<a name="l00066"></a>00066 <span class="stringliteral">" CUBE_SKY F3I sky cube Y 1 \n"</span>
+<a name="l00067"></a>00067 <span class="stringliteral">"\n"</span>
+<a name="l00068"></a>00068 <span class="stringliteral">" Output files:\n"</span>
+<a name="l00069"></a>00069 <span class="stringliteral">"\n"</span>
+<a name="l00070"></a>00070 <span class="stringliteral">" DO KMOS\n"</span>
+<a name="l00071"></a>00071 <span class="stringliteral">" category Type Explanation\n"</span>
+<a name="l00072"></a>00072 <span class="stringliteral">" -------- ----- -----------\n"</span>
+<a name="l00073"></a>00073 <span class="stringliteral">" OBJECT_S F3I Corrected object cubes\n"</span>
+<a name="l00074"></a>00074 <span class="stringliteral">"-------------------------------------------------------------------------------\n"</span>
+<a name="l00075"></a>00075 <span class="stringliteral">"\n"</span>;
+<a name="l00076"></a>00076
+<a name="l00093"></a><a class="code" href="group__kmo__sky__tweak.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693">00093</a> <span class="keywordtype">int</span> <a class="code" href="group__kmo__arithmetic.html#ga31d1fccd4cd15b1c1f3c5edc8cb18693" title="Build the list of available plugins, for this module.">cpl_plugin_get_info</a>(cpl_pluginlist *list)
+<a name="l00094"></a>00094 {
+<a name="l00095"></a>00095 cpl_recipe *recipe = cpl_calloc(1, <span class="keyword">sizeof</span> *recipe);
+<a name="l00096"></a>00096 cpl_plugin *plugin = &recipe->interface;
+<a name="l00097"></a>00097
+<a name="l00098"></a>00098 cpl_plugin_init(plugin,
+<a name="l00099"></a>00099 CPL_PLUGIN_API,
+<a name="l00100"></a>00100 KMOS_BINARY_VERSION,
+<a name="l00101"></a>00101 CPL_PLUGIN_TYPE_RECIPE,
+<a name="l00102"></a>00102 <span class="stringliteral">"kmo_sky_tweak"</span>,
+<a name="l00103"></a>00103 <span class="stringliteral">"Removal of OH sky lines"</span>,
+<a name="l00104"></a>00104 kmo_sky_tweak_description,
+<a name="l00105"></a>00105 <span class="stringliteral">"Erich Wiezorrek"</span>,
+<a name="l00106"></a>00106 <span class="stringliteral">"kmos-spark at mpe.mpg.de"</span>,
+<a name="l00107"></a>00107 kmos_get_license(),
+<a name="l00108"></a>00108 kmo_sky_tweak_create,
+<a name="l00109"></a>00109 kmo_sky_tweak_exec,
+<a name="l00110"></a>00110 kmo_sky_tweak_destroy);
+<a name="l00111"></a>00111
+<a name="l00112"></a>00112 cpl_pluginlist_append(list, plugin);
+<a name="l00113"></a>00113
+<a name="l00114"></a>00114 <span class="keywordflow">return</span> 0;
+<a name="l00115"></a>00115 }
+<a name="l00116"></a>00116
+<a name="l00124"></a>00124 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sky_tweak_create(cpl_plugin *plugin)
+<a name="l00125"></a>00125 {
+<a name="l00126"></a>00126 cpl_recipe *recipe;
+<a name="l00127"></a>00127 cpl_parameter *p;
+<a name="l00128"></a>00128
+<a name="l00129"></a>00129 <span class="comment">/* Check that the plugin is part of a valid recipe */</span>
+<a name="l00130"></a>00130 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00131"></a>00131 recipe = (cpl_recipe *)plugin;
+<a name="l00132"></a>00132 <span class="keywordflow">else</span>
+<a name="l00133"></a>00133 <span class="keywordflow">return</span> -1;
+<a name="l00134"></a>00134
+<a name="l00135"></a>00135 <span class="comment">/* Create the parameters list in the cpl_recipe object */</span>
+<a name="l00136"></a>00136 recipe->parameters = cpl_parameterlist_new();
<a name="l00137"></a>00137
-<a name="l00138"></a>00138 }
+<a name="l00138"></a>00138 <span class="comment">/* Fill the parameters list */</span>
<a name="l00139"></a>00139
-<a name="l00145"></a>00145 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sky_tweak_exec(cpl_plugin *plugin)
-<a name="l00146"></a>00146 {
-<a name="l00147"></a>00147 cpl_recipe *recipe;
-<a name="l00148"></a>00148
-<a name="l00149"></a>00149 <span class="comment">/* Get the recipe out of the plugin */</span>
-<a name="l00150"></a>00150 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
-<a name="l00151"></a>00151 recipe = (cpl_recipe *)plugin;
-<a name="l00152"></a>00152 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00140"></a>00140 <span class="comment">/* --tbsub */</span>
+<a name="l00141"></a>00141 p = cpl_parameter_new_value(<span class="stringliteral">"kmos.kmo_sky_tweak.tbsub"</span>,
+<a name="l00142"></a>00142 CPL_TYPE_BOOL,
+<a name="l00143"></a>00143 <span class="stringliteral">"Subtract thermal background from input cube."</span>
+<a name="l00144"></a>00144 <span class="stringliteral">"(TRUE (apply) or "</span>
+<a name="l00145"></a>00145 <span class="stringliteral">"FALSE (don't apply)"</span>,
+<a name="l00146"></a>00146 <span class="stringliteral">"kmos.kmo_sky_tweak"</span>,
+<a name="l00147"></a>00147 TRUE);
+<a name="l00148"></a>00148 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, <span class="stringliteral">"tbsub"</span>);
+<a name="l00149"></a>00149 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+<a name="l00150"></a>00150 cpl_parameterlist_append(recipe->parameters, p);
+<a name="l00151"></a>00151
+<a name="l00152"></a>00152 <span class="keywordflow">return</span> 0;
<a name="l00153"></a>00153
-<a name="l00154"></a>00154 <span class="keywordflow">return</span> kmo_sky_tweak(recipe->parameters, recipe->frames);
-<a name="l00155"></a>00155 }
-<a name="l00156"></a>00156
-<a name="l00162"></a>00162 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sky_tweak_destroy(cpl_plugin *plugin)
-<a name="l00163"></a>00163 {
-<a name="l00164"></a>00164 cpl_recipe *recipe;
-<a name="l00165"></a>00165
-<a name="l00166"></a>00166 <span class="comment">/* Get the recipe out of the plugin */</span>
-<a name="l00167"></a>00167 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
-<a name="l00168"></a>00168 recipe = (cpl_recipe *)plugin;
-<a name="l00169"></a>00169 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
-<a name="l00170"></a>00170
-<a name="l00171"></a>00171 cpl_parameterlist_delete(recipe->parameters);
-<a name="l00172"></a>00172 <span class="keywordflow">return</span> 0 ;
-<a name="l00173"></a>00173 }
-<a name="l00174"></a>00174
-<a name="l00189"></a>00189 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sky_tweak(cpl_parameterlist *parlist, cpl_frameset *frameset)
-<a name="l00190"></a>00190 {
-<a name="l00191"></a>00191 <span class="keywordtype">int</span> ret_val = 0;
-<a name="l00192"></a>00192
-<a name="l00193"></a>00193 <span class="keywordtype">int</span> ox = 0,
-<a name="l00194"></a>00194 nr_object_frames = 0,
-<a name="l00195"></a>00195 nr_obj_devices = 0,
-<a name="l00196"></a>00196 nr_sky_devices = 0,
-<a name="l00197"></a>00197 ifu_nr = 0,
-<a name="l00198"></a>00198 index = 0;
-<a name="l00199"></a>00199 <span class="keyword">const</span> <span class="keywordtype">char</span> *obj_fn = NULL,
-<a name="l00200"></a>00200 *sky_fn = NULL;
-<a name="l00201"></a>00201
-<a name="l00202"></a>00202 cpl_frame **object_frames = NULL,
-<a name="l00203"></a>00203 *object_frame = NULL,
-<a name="l00204"></a>00204 *sky_frame = NULL;
-<a name="l00205"></a>00205 cpl_imagelist *obj_data = NULL<span class="comment">/*,</span>
-<a name="l00206"></a>00206 <span class="comment"> *obj_noise = NULL*/</span>,
-<a name="l00207"></a>00207 *sky_data = NULL,
-<a name="l00208"></a>00208 *tweaked_data = NULL<span class="comment">/*,</span>
-<a name="l00209"></a>00209 <span class="comment"> *tweaked_noise = NULL*/</span>;
-<a name="l00210"></a>00210 cpl_propertylist *main_header = NULL,
-<a name="l00211"></a>00211 *sub_header = NULL;
-<a name="l00212"></a>00212 main_fits_desc obj_fits_desc,
-<a name="l00213"></a>00213 sky_fits_desc;
-<a name="l00214"></a>00214
-<a name="l00215"></a>00215 KMO_TRY
-<a name="l00216"></a>00216 {
-<a name="l00217"></a>00217 <span class="comment">//</span>
-<a name="l00218"></a>00218 <span class="comment">// check frameset</span>
-<a name="l00219"></a>00219 <span class="comment">//</span>
-<a name="l00220"></a>00220 KMO_TRY_ASSURE((parlist != NULL) &&
-<a name="l00221"></a>00221 (frameset != NULL),
-<a name="l00222"></a>00222 CPL_ERROR_NULL_INPUT,
-<a name="l00223"></a>00223 <span class="stringliteral">"Not all input data is provided!"</span>);
-<a name="l00224"></a>00224
-<a name="l00225"></a>00225 KMO_TRY_ASSURE(! ((cpl_frameset_count_tags(frameset, CUBE_OBJECT) == 0) &&
-<a name="l00226"></a>00226 (cpl_frameset_count_tags(frameset, CUBE_SKY) == 0) ),
-<a name="l00227"></a>00227 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00228"></a>00228 <span class="stringliteral">"CUBE_OBJECT or CUBE_SKY frames missing in "</span>
-<a name="l00229"></a>00229 <span class="stringliteral">"frameset!!"</span>);
-<a name="l00230"></a>00230
-<a name="l00231"></a>00231 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, CUBE_SKY) == 1,
-<a name="l00232"></a>00232 CPL_ERROR_FILE_NOT_FOUND,
-<a name="l00233"></a>00233 <span class="stringliteral">"Exactly one CUBE_SKY frame is expected in frameset!"</span>);
-<a name="l00234"></a>00234
-<a name="l00235"></a>00235 KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, <span class="stringliteral">"kmo_sky_tweak"</span>) == 1,
-<a name="l00236"></a>00236 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00237"></a>00237 <span class="stringliteral">"Cannot identify RAW and CALIB frames!"</span>);
-<a name="l00238"></a>00238
-<a name="l00239"></a>00239
-<a name="l00240"></a>00240 nr_object_frames = cpl_frameset_count_tags(frameset, CUBE_OBJECT);
-<a name="l00241"></a>00241 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00242"></a>00242
-<a name="l00243"></a>00243 KMO_TRY_EXIT_IF_NULL(
-<a name="l00244"></a>00244 object_frames = cpl_malloc(nr_object_frames * <span class="keyword">sizeof</span>(cpl_frame*)));
-<a name="l00245"></a>00245
-<a name="l00246"></a>00246 <span class="keywordflow">for</span> (ox=0; ox<nr_object_frames; ox++) {
-<a name="l00247"></a>00247 <span class="keywordflow">if</span> (ox == 0) {
-<a name="l00248"></a>00248 KMO_TRY_EXIT_IF_NULL(
-<a name="l00249"></a>00249 object_frames[ox] = cpl_frameset_find(frameset, CUBE_OBJECT));
-<a name="l00250"></a>00250 } <span class="keywordflow">else</span> {
-<a name="l00251"></a>00251 KMO_TRY_EXIT_IF_NULL(
-<a name="l00252"></a>00252 object_frames[ox] = cpl_frameset_find(frameset, NULL));
-<a name="l00253"></a>00253 }
-<a name="l00254"></a>00254 obj_fits_desc = kmo_identify_fits_header(
-<a name="l00255"></a>00255 cpl_frame_get_filename(object_frames[ox]));
-<a name="l00256"></a>00256 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"Provided object fits file doesn't seem to be "</span>
-<a name="l00257"></a>00257 <span class="stringliteral">"in KMOS-format!"</span>);
-<a name="l00258"></a>00258 KMO_TRY_ASSURE(obj_fits_desc.fits_type == f3i_fits,
-<a name="l00259"></a>00259 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00260"></a>00260 <span class="stringliteral">"Provided object fits file hasn't correct data type "</span>
-<a name="l00261"></a>00261 <span class="stringliteral">"(KMOSTYPE must be F3I)!"</span>);
-<a name="l00262"></a>00262 kmo_free_fits_desc(&obj_fits_desc);
-<a name="l00263"></a>00263
-<a name="l00264"></a>00264 }
-<a name="l00265"></a>00265
-<a name="l00266"></a>00266 KMO_TRY_EXIT_IF_NULL(
-<a name="l00267"></a>00267 sky_frame = cpl_frameset_find(frameset, CUBE_SKY));
-<a name="l00268"></a>00268 sky_fits_desc = kmo_identify_fits_header(
-<a name="l00269"></a>00269 cpl_frame_get_filename(sky_frame));
-<a name="l00270"></a>00270 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"Provided sky fits file doesn't seem to be "</span>
-<a name="l00271"></a>00271 <span class="stringliteral">"in KMOS-format!"</span>);
-<a name="l00272"></a>00272 KMO_TRY_ASSURE(sky_fits_desc.fits_type == f3i_fits,
-<a name="l00273"></a>00273 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00274"></a>00274 <span class="stringliteral">"Provided sky fits file hasn't correct data type "</span>
-<a name="l00275"></a>00275 <span class="stringliteral">"(KMOSTYPE must be F3I)!"</span>);
-<a name="l00276"></a>00276 <span class="keywordflow">if</span> (sky_fits_desc.ex_noise == TRUE) {
-<a name="l00277"></a>00277 nr_sky_devices = sky_fits_desc.nr_ext / 2;
-<a name="l00278"></a>00278 } <span class="keywordflow">else</span> {
-<a name="l00279"></a>00279 nr_sky_devices = sky_fits_desc.nr_ext;
-<a name="l00280"></a>00280 }
-<a name="l00281"></a>00281 KMO_TRY_EXIT_IF_NULL(
-<a name="l00282"></a>00282 sky_fn = cpl_frame_get_filename(sky_frame));
-<a name="l00283"></a>00283
-<a name="l00284"></a>00284 <span class="keywordflow">for</span> (ox=0; ox<nr_object_frames; ox++) {
-<a name="l00285"></a>00285 printf(<span class="stringliteral">"ox: %d\n"</span>,ox);
-<a name="l00286"></a>00286 object_frame = object_frames[ox];
-<a name="l00287"></a>00287 obj_fits_desc = kmo_identify_fits_header(cpl_frame_get_filename(object_frame));
-<a name="l00288"></a>00288 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"Provided object fits file doesn't seem to be "</span>
-<a name="l00289"></a>00289 <span class="stringliteral">"in KMOS-format!"</span>);
-<a name="l00290"></a>00290 <span class="keywordflow">if</span> (obj_fits_desc.ex_noise == TRUE) {
-<a name="l00291"></a>00291 nr_obj_devices = obj_fits_desc.nr_ext / 2;
-<a name="l00292"></a>00292 } <span class="keywordflow">else</span> {
-<a name="l00293"></a>00293 nr_obj_devices = obj_fits_desc.nr_ext;
-<a name="l00294"></a>00294 }
-<a name="l00295"></a>00295 KMO_TRY_ASSURE((nr_sky_devices == nr_obj_devices) || (nr_sky_devices == 1),
-<a name="l00296"></a>00296 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l00297"></a>00297 <span class="stringliteral">"Number of extensions for the SKY frame must be either 1"</span>
-<a name="l00298"></a>00298 <span class="stringliteral">" or the same as for OBJECT frame"</span>);
-<a name="l00299"></a>00299
-<a name="l00300"></a>00300 KMO_TRY_EXIT_IF_NULL(
-<a name="l00301"></a>00301 obj_fn = cpl_frame_get_filename(object_frame));
+<a name="l00154"></a>00154 }
+<a name="l00155"></a>00155
+<a name="l00161"></a>00161 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sky_tweak_exec(cpl_plugin *plugin)
+<a name="l00162"></a>00162 {
+<a name="l00163"></a>00163 cpl_recipe *recipe;
+<a name="l00164"></a>00164
+<a name="l00165"></a>00165 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00166"></a>00166 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00167"></a>00167 recipe = (cpl_recipe *)plugin;
+<a name="l00168"></a>00168 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00169"></a>00169
+<a name="l00170"></a>00170 <span class="keywordflow">return</span> kmo_sky_tweak(recipe->parameters, recipe->frames);
+<a name="l00171"></a>00171 }
+<a name="l00172"></a>00172
+<a name="l00178"></a>00178 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sky_tweak_destroy(cpl_plugin *plugin)
+<a name="l00179"></a>00179 {
+<a name="l00180"></a>00180 cpl_recipe *recipe;
+<a name="l00181"></a>00181
+<a name="l00182"></a>00182 <span class="comment">/* Get the recipe out of the plugin */</span>
+<a name="l00183"></a>00183 <span class="keywordflow">if</span> (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
+<a name="l00184"></a>00184 recipe = (cpl_recipe *)plugin;
+<a name="l00185"></a>00185 <span class="keywordflow">else</span> <span class="keywordflow">return</span> -1 ;
+<a name="l00186"></a>00186
+<a name="l00187"></a>00187 cpl_parameterlist_delete(recipe->parameters);
+<a name="l00188"></a>00188 <span class="keywordflow">return</span> 0 ;
+<a name="l00189"></a>00189 }
+<a name="l00190"></a>00190
+<a name="l00205"></a>00205 <span class="keyword">static</span> <span class="keywordtype">int</span> kmo_sky_tweak(cpl_parameterlist *parlist, cpl_frameset *frameset)
+<a name="l00206"></a>00206 {
+<a name="l00207"></a>00207 <span class="keywordtype">int</span> ret_val = 0;
+<a name="l00208"></a>00208
+<a name="l00209"></a>00209 <span class="keywordtype">int</span> ox = 0,
+<a name="l00210"></a>00210 nr_object_frames = 0,
+<a name="l00211"></a>00211 nr_obj_devices = 0,
+<a name="l00212"></a>00212 nr_sky_devices = 0,
+<a name="l00213"></a>00213 ifu_nr = 0,
+<a name="l00214"></a>00214 index = 0,
+<a name="l00215"></a>00215 tbsub = TRUE;
+<a name="l00216"></a>00216 <span class="keyword">const</span> <span class="keywordtype">char</span> *obj_fn = NULL,
+<a name="l00217"></a>00217 *sky_fn = NULL;
+<a name="l00218"></a>00218
+<a name="l00219"></a>00219 cpl_frame **object_frames = NULL,
+<a name="l00220"></a>00220 *object_frame = NULL,
+<a name="l00221"></a>00221 *sky_frame = NULL;
+<a name="l00222"></a>00222 cpl_imagelist *obj_data = NULL<span class="comment">/*,</span>
+<a name="l00223"></a>00223 <span class="comment"> *obj_noise = NULL*/</span>,
+<a name="l00224"></a>00224 *sky_data = NULL,
+<a name="l00225"></a>00225 *tweaked_data = NULL<span class="comment">/*,</span>
+<a name="l00226"></a>00226 <span class="comment"> *tweaked_noise = NULL*/</span>;
+<a name="l00227"></a>00227 cpl_propertylist *main_header = NULL,
+<a name="l00228"></a>00228 *sub_header = NULL;
+<a name="l00229"></a>00229 main_fits_desc obj_fits_desc,
+<a name="l00230"></a>00230 sky_fits_desc;
+<a name="l00231"></a>00231
+<a name="l00232"></a>00232 KMO_TRY
+<a name="l00233"></a>00233 {
+<a name="l00234"></a>00234 <span class="comment">//</span>
+<a name="l00235"></a>00235 <span class="comment">// check frameset</span>
+<a name="l00236"></a>00236 <span class="comment">//</span>
+<a name="l00237"></a>00237 KMO_TRY_ASSURE((parlist != NULL) &&
+<a name="l00238"></a>00238 (frameset != NULL),
+<a name="l00239"></a>00239 CPL_ERROR_NULL_INPUT,
+<a name="l00240"></a>00240 <span class="stringliteral">"Not all input data is provided!"</span>);
+<a name="l00241"></a>00241
+<a name="l00242"></a>00242 KMO_TRY_ASSURE(! ((cpl_frameset_count_tags(frameset, CUBE_OBJECT) == 0) &&
+<a name="l00243"></a>00243 (cpl_frameset_count_tags(frameset, CUBE_SKY) == 0) ),
+<a name="l00244"></a>00244 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00245"></a>00245 <span class="stringliteral">"CUBE_OBJECT or CUBE_SKY frames missing in "</span>
+<a name="l00246"></a>00246 <span class="stringliteral">"frameset!!"</span>);
+<a name="l00247"></a>00247
+<a name="l00248"></a>00248 KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, CUBE_SKY) == 1,
+<a name="l00249"></a>00249 CPL_ERROR_FILE_NOT_FOUND,
+<a name="l00250"></a>00250 <span class="stringliteral">"Exactly one CUBE_SKY frame is expected in frameset!"</span>);
+<a name="l00251"></a>00251
+<a name="l00252"></a>00252 KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, <span class="stringliteral">"kmo_sky_tweak"</span>) == 1,
+<a name="l00253"></a>00253 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00254"></a>00254 <span class="stringliteral">"Cannot identify RAW and CALIB frames!"</span>);
+<a name="l00255"></a>00255
+<a name="l00256"></a>00256 tbsub = kmo_dfs_get_parameter_bool(parlist, <span class="stringliteral">"kmos.kmo_sky_tweak.tbsub"</span>);
+<a name="l00257"></a>00257 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00258"></a>00258
+<a name="l00259"></a>00259 nr_object_frames = cpl_frameset_count_tags(frameset, CUBE_OBJECT);
+<a name="l00260"></a>00260 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00261"></a>00261
+<a name="l00262"></a>00262 KMO_TRY_EXIT_IF_NULL(
+<a name="l00263"></a>00263 object_frames = cpl_malloc(nr_object_frames * <span class="keyword">sizeof</span>(cpl_frame*)));
+<a name="l00264"></a>00264
+<a name="l00265"></a>00265 <span class="keywordflow">for</span> (ox=0; ox<nr_object_frames; ox++) {
+<a name="l00266"></a>00266 <span class="keywordflow">if</span> (ox == 0) {
+<a name="l00267"></a>00267 KMO_TRY_EXIT_IF_NULL(
+<a name="l00268"></a>00268 object_frames[ox] = cpl_frameset_find(frameset, CUBE_OBJECT));
+<a name="l00269"></a>00269 } <span class="keywordflow">else</span> {
+<a name="l00270"></a>00270 KMO_TRY_EXIT_IF_NULL(
+<a name="l00271"></a>00271 object_frames[ox] = cpl_frameset_find(frameset, NULL));
+<a name="l00272"></a>00272 }
+<a name="l00273"></a>00273 obj_fits_desc = kmo_identify_fits_header(
+<a name="l00274"></a>00274 cpl_frame_get_filename(object_frames[ox]));
+<a name="l00275"></a>00275 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"Provided object fits file doesn't seem to be "</span>
+<a name="l00276"></a>00276 <span class="stringliteral">"in KMOS-format!"</span>);
+<a name="l00277"></a>00277 KMO_TRY_ASSURE(obj_fits_desc.fits_type == f3i_fits,
+<a name="l00278"></a>00278 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00279"></a>00279 <span class="stringliteral">"Provided object fits file hasn't correct data type "</span>
+<a name="l00280"></a>00280 <span class="stringliteral">"(KMOSTYPE must be F3I)!"</span>);
+<a name="l00281"></a>00281 kmo_free_fits_desc(&obj_fits_desc);
+<a name="l00282"></a>00282
+<a name="l00283"></a>00283 }
+<a name="l00284"></a>00284
+<a name="l00285"></a>00285 KMO_TRY_EXIT_IF_NULL(
+<a name="l00286"></a>00286 sky_frame = cpl_frameset_find(frameset, CUBE_SKY));
+<a name="l00287"></a>00287 sky_fits_desc = kmo_identify_fits_header(
+<a name="l00288"></a>00288 cpl_frame_get_filename(sky_frame));
+<a name="l00289"></a>00289 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"Provided sky fits file doesn't seem to be "</span>
+<a name="l00290"></a>00290 <span class="stringliteral">"in KMOS-format!"</span>);
+<a name="l00291"></a>00291 KMO_TRY_ASSURE(sky_fits_desc.fits_type == f3i_fits,
+<a name="l00292"></a>00292 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00293"></a>00293 <span class="stringliteral">"Provided sky fits file hasn't correct data type "</span>
+<a name="l00294"></a>00294 <span class="stringliteral">"(KMOSTYPE must be F3I)!"</span>);
+<a name="l00295"></a>00295 <span class="keywordflow">if</span> (sky_fits_desc.ex_noise == TRUE) {
+<a name="l00296"></a>00296 nr_sky_devices = sky_fits_desc.nr_ext / 2;
+<a name="l00297"></a>00297 } <span class="keywordflow">else</span> {
+<a name="l00298"></a>00298 nr_sky_devices = sky_fits_desc.nr_ext;
+<a name="l00299"></a>00299 }
+<a name="l00300"></a>00300 KMO_TRY_EXIT_IF_NULL(
+<a name="l00301"></a>00301 sky_fn = cpl_frame_get_filename(sky_frame));
<a name="l00302"></a>00302
-<a name="l00303"></a>00303 KMO_TRY_EXIT_IF_NULL(
-<a name="l00304"></a>00304 main_header = kmclipm_propertylist_load(obj_fn, 0));
-<a name="l00305"></a>00305
-<a name="l00306"></a>00306 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00307"></a>00307 kmo_dfs_save_main_header(frameset, SKY_TWEAK, <span class="stringliteral">""</span>,
-<a name="l00308"></a>00308 object_frame,
-<a name="l00309"></a>00309 main_header, parlist, cpl_func));
-<a name="l00310"></a>00310
-<a name="l00311"></a>00311
-<a name="l00312"></a>00312 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= nr_obj_devices; ifu_nr++) {
-<a name="l00313"></a>00313 printf(<span class="stringliteral">"ifu_nr: %d\n"</span>, ifu_nr);
-<a name="l00314"></a>00314 <span class="keywordflow">if</span> (nr_sky_devices == nr_obj_devices) {
-<a name="l00315"></a>00315 index = kmo_identify_index(sky_fn, ifu_nr, FALSE);
-<a name="l00316"></a>00316 } <span class="keywordflow">else</span> {
-<a name="l00317"></a>00317 index = kmo_identify_index(sky_fn, 1, FALSE);
-<a name="l00318"></a>00318 }
-<a name="l00319"></a>00319 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00320"></a>00320 KMO_TRY_EXIT_IF_NULL(
-<a name="l00321"></a>00321 sky_data = kmclipm_imagelist_load(sky_fn, CPL_TYPE_FLOAT, index));
-<a name="l00322"></a>00322
-<a name="l00323"></a>00323 index = kmo_identify_index(obj_fn, ifu_nr, FALSE);
-<a name="l00324"></a>00324 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l00325"></a>00325 KMO_TRY_EXIT_IF_NULL(
-<a name="l00326"></a>00326 sub_header = kmclipm_propertylist_load(obj_fn, index));
-<a name="l00327"></a>00327 KMO_TRY_EXIT_IF_NULL(
-<a name="l00328"></a>00328 obj_data = kmclipm_imagelist_load(obj_fn, CPL_TYPE_FLOAT, index));
-<a name="l00329"></a>00329 <span class="comment">// index = kmo_identify_index(obj_fn, ifu_nr, TRUE);</span>
-<a name="l00330"></a>00330 <span class="comment">// KMO_TRY_CHECK_ERROR_STATE();</span>
-<a name="l00331"></a>00331 <span class="comment">// KMO_TRY_EXIT_IF_NULL(</span>
-<a name="l00332"></a>00332 <span class="comment">// obj_noise = kmclipm_imagelist_load(obj_fn, CPL_TYPE_FLOAT, index));</span>
-<a name="l00333"></a>00333
-<a name="l00334"></a>00334 KMO_TRY_EXIT_IF_NULL(
-<a name="l00335"></a>00335 tweaked_data = kmo_priv_sky_tweak (obj_data, sky_data, sub_header, .3));
-<a name="l00336"></a>00336
-<a name="l00337"></a>00337 KMO_TRY_EXIT_IF_ERROR(
-<a name="l00338"></a>00338 kmo_dfs_save_cube(tweaked_data, SKY_TWEAK, <span class="stringliteral">""</span>, sub_header, 0./0.));
-<a name="l00339"></a>00339 }
-<a name="l00340"></a>00340
-<a name="l00341"></a>00341 kmo_free_fits_desc(&obj_fits_desc);
-<a name="l00342"></a>00342
-<a name="l00343"></a>00343 }
-<a name="l00344"></a>00344 kmo_free_fits_desc(&sky_fits_desc);
-<a name="l00345"></a>00345 }
-<a name="l00346"></a>00346 KMO_CATCH
-<a name="l00347"></a>00347 {
-<a name="l00348"></a>00348 KMO_CATCH_MSG();
-<a name="l00349"></a>00349 ret_val = -1;
-<a name="l00350"></a>00350 }
-<a name="l00351"></a>00351
+<a name="l00303"></a>00303 <span class="keywordflow">for</span> (ox=0; ox<nr_object_frames; ox++) {
+<a name="l00304"></a>00304 printf(<span class="stringliteral">"ox: %d\n"</span>,ox);
+<a name="l00305"></a>00305 object_frame = object_frames[ox];
+<a name="l00306"></a>00306 obj_fits_desc = kmo_identify_fits_header(cpl_frame_get_filename(object_frame));
+<a name="l00307"></a>00307 KMO_TRY_CHECK_ERROR_STATE_MSG(<span class="stringliteral">"Provided object fits file doesn't seem to be "</span>
+<a name="l00308"></a>00308 <span class="stringliteral">"in KMOS-format!"</span>);
+<a name="l00309"></a>00309 <span class="keywordflow">if</span> (obj_fits_desc.ex_noise == TRUE) {
+<a name="l00310"></a>00310 nr_obj_devices = obj_fits_desc.nr_ext / 2;
+<a name="l00311"></a>00311 } <span class="keywordflow">else</span> {
+<a name="l00312"></a>00312 nr_obj_devices = obj_fits_desc.nr_ext;
+<a name="l00313"></a>00313 }
+<a name="l00314"></a>00314 KMO_TRY_ASSURE((nr_sky_devices == nr_obj_devices) || (nr_sky_devices == 1),
+<a name="l00315"></a>00315 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l00316"></a>00316 <span class="stringliteral">"Number of extensions for the SKY frame must be either 1"</span>
+<a name="l00317"></a>00317 <span class="stringliteral">" or the same as for OBJECT frame"</span>);
+<a name="l00318"></a>00318
+<a name="l00319"></a>00319 KMO_TRY_EXIT_IF_NULL(
+<a name="l00320"></a>00320 obj_fn = cpl_frame_get_filename(object_frame));
+<a name="l00321"></a>00321
+<a name="l00322"></a>00322 KMO_TRY_EXIT_IF_NULL(
+<a name="l00323"></a>00323 main_header = kmclipm_propertylist_load(obj_fn, 0));
+<a name="l00324"></a>00324
+<a name="l00325"></a>00325 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00326"></a>00326 kmo_dfs_save_main_header(frameset, SKY_TWEAK, <span class="stringliteral">""</span>,
+<a name="l00327"></a>00327 object_frame,
+<a name="l00328"></a>00328 main_header, parlist, cpl_func));
+<a name="l00329"></a>00329
+<a name="l00330"></a>00330
+<a name="l00331"></a>00331 <span class="keywordflow">for</span> (ifu_nr = 1; ifu_nr <= nr_obj_devices; ifu_nr++) {
+<a name="l00332"></a>00332 printf(<span class="stringliteral">"ifu_nr: %d\n"</span>, ifu_nr);
+<a name="l00333"></a>00333 <span class="keywordflow">if</span> (nr_sky_devices == nr_obj_devices) {
+<a name="l00334"></a>00334 index = kmo_identify_index(sky_fn, ifu_nr, FALSE);
+<a name="l00335"></a>00335 } <span class="keywordflow">else</span> {
+<a name="l00336"></a>00336 index = kmo_identify_index(sky_fn, 1, FALSE);
+<a name="l00337"></a>00337 }
+<a name="l00338"></a>00338 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00339"></a>00339 KMO_TRY_EXIT_IF_NULL(
+<a name="l00340"></a>00340 sky_data = kmclipm_imagelist_load(sky_fn, CPL_TYPE_FLOAT, index));
+<a name="l00341"></a>00341
+<a name="l00342"></a>00342 index = kmo_identify_index(obj_fn, ifu_nr, FALSE);
+<a name="l00343"></a>00343 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l00344"></a>00344 KMO_TRY_EXIT_IF_NULL(
+<a name="l00345"></a>00345 sub_header = kmclipm_propertylist_load(obj_fn, index));
+<a name="l00346"></a>00346 KMO_TRY_EXIT_IF_NULL(
+<a name="l00347"></a>00347 obj_data = kmclipm_imagelist_load(obj_fn, CPL_TYPE_FLOAT, index));
+<a name="l00348"></a>00348 <span class="comment">// index = kmo_identify_index(obj_fn, ifu_nr, TRUE);</span>
+<a name="l00349"></a>00349 <span class="comment">// KMO_TRY_CHECK_ERROR_STATE();</span>
+<a name="l00350"></a>00350 <span class="comment">// KMO_TRY_EXIT_IF_NULL(</span>
+<a name="l00351"></a>00351 <span class="comment">// obj_noise = kmclipm_imagelist_load(obj_fn, CPL_TYPE_FLOAT, index));</span>
<a name="l00352"></a>00352
-<a name="l00353"></a>00353 <span class="keywordflow">return</span> ret_val;
-<a name="l00354"></a>00354 }
-<a name="l00355"></a>00355
+<a name="l00353"></a>00353 KMO_TRY_EXIT_IF_NULL(
+<a name="l00354"></a>00354 tweaked_data = kmo_priv_sky_tweak (obj_data, sky_data,
+<a name="l00355"></a>00355 sub_header, .3, tbsub));
+<a name="l00356"></a>00356
+<a name="l00357"></a>00357 KMO_TRY_EXIT_IF_ERROR(
+<a name="l00358"></a>00358 kmo_dfs_save_cube(tweaked_data, SKY_TWEAK, <span class="stringliteral">""</span>, sub_header, 0./0.));
+<a name="l00359"></a>00359 }
+<a name="l00360"></a>00360
+<a name="l00361"></a>00361 kmo_free_fits_desc(&obj_fits_desc);
+<a name="l00362"></a>00362
+<a name="l00363"></a>00363 }
+<a name="l00364"></a>00364 kmo_free_fits_desc(&sky_fits_desc);
+<a name="l00365"></a>00365 }
+<a name="l00366"></a>00366 KMO_CATCH
+<a name="l00367"></a>00367 {
+<a name="l00368"></a>00368 KMO_CATCH_MSG();
+<a name="l00369"></a>00369 ret_val = -1;
+<a name="l00370"></a>00370 }
+<a name="l00371"></a>00371
+<a name="l00372"></a>00372
+<a name="l00373"></a>00373 <span class="keywordflow">return</span> ret_val;
+<a name="l00374"></a>00374 }
+<a name="l00375"></a>00375
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__stats_8c_source.html b/html/kmo__stats_8c_source.html
index 35185e5..651ea73 100644
--- a/html/kmo__stats_8c_source.html
+++ b/html/kmo__stats_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_stats.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_stats.c,v 1.16 2013/05/24 13:35:28 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_stats.c,v 1.16 2013-05-24 13:35:28 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/05/24 13:35:28 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-05-24 13:35:28 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.16 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -960,7 +960,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__std__star_8c_source.html b/html/kmo__std__star_8c_source.html
index 36e059a..b85795e 100644
--- a/html/kmo__std__star_8c_source.html
+++ b/html/kmo__std__star_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_std_star.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_std_star.c,v 1.75 2013/08/02 18:03:53 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_std_star.c,v 1.79 2013/10/08 14:55:01 erw Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -81,10 +81,10 @@
<a name="l00019"></a>00019 <span class="comment"> */</span>
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
-<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/08/02 18:03:53 $</span>
-<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.75 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00022"></a>00022 <span class="comment"> * $Author: erw $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/10/08 14:55:01 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.79 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -1137,1099 +1137,1097 @@
<a name="l01122"></a>01122 kmo_check_frame_setup(frameset, XCAL, MASTER_FLAT, TRUE, FALSE, TRUE));
<a name="l01123"></a>01123 KMO_TRY_EXIT_IF_ERROR(
<a name="l01124"></a>01124 kmo_check_frame_setup(frameset, XCAL, STD, FALSE, FALSE, TRUE));
-<a name="l01125"></a>01125 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
-<a name="l01126"></a>01126 <span class="comment">// kmo_check_cal_frames_rotangle(frameset, XCAL, YCAL));</span>
-<a name="l01127"></a>01127 <span class="comment">// KMO_TRY_EXIT_IF_ERROR(</span>
-<a name="l01128"></a>01128 <span class="comment">// kmo_check_cal_frames_rotangle(frameset, XCAL, LCAL));</span>
-<a name="l01129"></a>01129
-<a name="l01130"></a>01130 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, ILLUM_CORR) == 1) {
-<a name="l01131"></a>01131 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01132"></a>01132 kmo_check_frame_setup(frameset, XCAL, ILLUM_CORR, TRUE, FALSE, FALSE));
-<a name="l01133"></a>01133 }
+<a name="l01125"></a>01125
+<a name="l01126"></a>01126 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, ILLUM_CORR) == 1) {
+<a name="l01127"></a>01127 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01128"></a>01128 kmo_check_frame_setup(frameset, XCAL, ILLUM_CORR, TRUE, FALSE, FALSE));
+<a name="l01129"></a>01129 }
+<a name="l01130"></a>01130
+<a name="l01131"></a>01131 <span class="comment">// check descriptors of all frames</span>
+<a name="l01132"></a>01132 KMO_TRY_EXIT_IF_NULL(
+<a name="l01133"></a>01133 xcal_frame = kmo_dfs_get_frame(frameset, XCAL));
<a name="l01134"></a>01134
-<a name="l01135"></a>01135 <span class="comment">// check descriptors of all frames</span>
-<a name="l01136"></a>01136 KMO_TRY_EXIT_IF_NULL(
-<a name="l01137"></a>01137 xcal_frame = kmo_dfs_get_frame(frameset, XCAL));
-<a name="l01138"></a>01138
-<a name="l01139"></a>01139 desc1 = kmo_identify_fits_header(cpl_frame_get_filename(xcal_frame));
-<a name="l01140"></a>01140 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01141"></a>01141
-<a name="l01142"></a>01142 KMO_TRY_ASSURE((desc1.nr_ext % 3 == 0) &&
-<a name="l01143"></a>01143 (desc1.ex_badpix == FALSE) &&
-<a name="l01144"></a>01144 (desc1.fits_type == f2d_fits) &&
-<a name="l01145"></a>01145 (desc1.frame_type == detector_frame),
-<a name="l01146"></a>01146 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01147"></a>01147 <span class="stringliteral">"XCAL isn't in the correct format!!!"</span>);
-<a name="l01148"></a>01148
-<a name="l01149"></a>01149 KMO_TRY_EXIT_IF_NULL(
-<a name="l01150"></a>01150 ycal_frame = kmo_dfs_get_frame(frameset, YCAL));
-<a name="l01151"></a>01151 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(ycal_frame));
-<a name="l01152"></a>01152 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01153"></a>01153
-<a name="l01154"></a>01154 KMO_TRY_ASSURE((desc1.nr_ext == desc2.nr_ext) &&
-<a name="l01155"></a>01155 (desc1.ex_badpix == desc2.ex_badpix) &&
-<a name="l01156"></a>01156 (desc1.fits_type == desc2.fits_type) &&
-<a name="l01157"></a>01157 (desc1.frame_type == desc2.frame_type),
-<a name="l01158"></a>01158 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01159"></a>01159 <span class="stringliteral">"YCAL isn't in the correct format!!!"</span>);
-<a name="l01160"></a>01160 kmo_free_fits_desc(&desc2);
-<a name="l01161"></a>01161 kmo_init_fits_desc(&desc2);
-<a name="l01162"></a>01162
-<a name="l01163"></a>01163 KMO_TRY_EXIT_IF_NULL(
-<a name="l01164"></a>01164 lcal_frame = kmo_dfs_get_frame(frameset, LCAL));
-<a name="l01165"></a>01165 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(lcal_frame));
-<a name="l01166"></a>01166 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01167"></a>01167
-<a name="l01168"></a>01168 KMO_TRY_ASSURE((desc1.nr_ext == desc2.nr_ext) &&
-<a name="l01169"></a>01169 (desc1.ex_badpix == desc2.ex_badpix) &&
-<a name="l01170"></a>01170 (desc1.fits_type == desc2.fits_type) &&
-<a name="l01171"></a>01171 (desc1.frame_type == desc2.frame_type),
-<a name="l01172"></a>01172 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01173"></a>01173 <span class="stringliteral">"YCAL isn't in the correct format!!!"</span>);
-<a name="l01174"></a>01174 kmo_free_fits_desc(&desc2);
-<a name="l01175"></a>01175 kmo_init_fits_desc(&desc2);
-<a name="l01176"></a>01176
-<a name="l01177"></a>01177 KMO_TRY_EXIT_IF_NULL(
-<a name="l01178"></a>01178 flat_frame = kmo_dfs_get_frame(frameset, MASTER_FLAT));
-<a name="l01179"></a>01179 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(flat_frame));
-<a name="l01180"></a>01180 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01181"></a>01181
-<a name="l01182"></a>01182 KMO_TRY_ASSURE((desc2.nr_ext % 6 == 0) &&
-<a name="l01183"></a>01183 (desc1.ex_badpix == desc2.ex_badpix) &&
-<a name="l01184"></a>01184 (desc1.fits_type == desc2.fits_type) &&
-<a name="l01185"></a>01185 (desc1.frame_type == desc2.frame_type),
-<a name="l01186"></a>01186 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01187"></a>01187 <span class="stringliteral">"MASTER_FLAT isn't in the correct format!!!"</span>);
-<a name="l01188"></a>01188 kmo_free_fits_desc(&desc2);
-<a name="l01189"></a>01189 kmo_init_fits_desc(&desc2);
-<a name="l01190"></a>01190
-<a name="l01191"></a>01191 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, ILLUM_CORR) == 1) {
-<a name="l01192"></a>01192 KMO_TRY_EXIT_IF_NULL(
-<a name="l01193"></a>01193 illum_frame = kmo_dfs_get_frame(frameset, ILLUM_CORR));
-<a name="l01194"></a>01194 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(illum_frame));
-<a name="l01195"></a>01195 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01196"></a>01196 KMO_TRY_ASSURE(((desc2.nr_ext == 24) || (desc2.nr_ext == 48)) &&
-<a name="l01197"></a>01197 (desc2.ex_badpix == FALSE) &&
-<a name="l01198"></a>01198 (desc2.fits_type == f2i_fits) &&
-<a name="l01199"></a>01199 (desc2.frame_type == ifu_frame),
-<a name="l01200"></a>01200 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01201"></a>01201 <span class="stringliteral">"ILLUM_CORR isn't in the correct format!!!"</span>);
-<a name="l01202"></a>01202 kmo_free_fits_desc(&desc2);
-<a name="l01203"></a>01203 kmo_init_fits_desc(&desc2);
-<a name="l01204"></a>01204 }
-<a name="l01205"></a>01205
-<a name="l01206"></a>01206 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, SPEC_TYPE_LOOKUP) == 1) {
-<a name="l01207"></a>01207 KMO_TRY_EXIT_IF_NULL(
-<a name="l01208"></a>01208 tmp_frame = kmo_dfs_get_frame(frameset, SPEC_TYPE_LOOKUP));
-<a name="l01209"></a>01209 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(tmp_frame));
-<a name="l01210"></a>01210 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01211"></a>01211 KMO_TRY_ASSURE((desc2.nr_ext == 1) &&
-<a name="l01212"></a>01212 (desc2.ex_badpix == FALSE) &&
-<a name="l01213"></a>01213 (desc2.fits_type == f2l_fits) &&
-<a name="l01214"></a>01214 (desc2.frame_type == list_frame),
-<a name="l01215"></a>01215 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01216"></a>01216 <span class="stringliteral">"SPEC_TYPE_LOOKUP isn't in the correct format!!!"</span>);
-<a name="l01217"></a>01217 kmo_free_fits_desc(&desc2);
-<a name="l01218"></a>01218 kmo_init_fits_desc(&desc2);
-<a name="l01219"></a>01219 }
-<a name="l01220"></a>01220
-<a name="l01221"></a>01221 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, SOLAR_SPEC) == 1) {
-<a name="l01222"></a>01222 KMO_TRY_EXIT_IF_NULL(
-<a name="l01223"></a>01223 tmp_frame = kmo_dfs_get_frame(frameset, SOLAR_SPEC));
-<a name="l01224"></a>01224 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(tmp_frame));
-<a name="l01225"></a>01225 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01226"></a>01226 KMO_TRY_ASSURE((desc2.nr_ext == 1) &&
-<a name="l01227"></a>01227 (desc2.ex_badpix == FALSE) &&
-<a name="l01228"></a>01228 (desc2.fits_type == f1s_fits) &&
-<a name="l01229"></a>01229 (desc2.frame_type == spectrum_frame),
-<a name="l01230"></a>01230 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01231"></a>01231 <span class="stringliteral">"SOLAR_SPEC isn't in the correct format!!!"</span>);
-<a name="l01232"></a>01232 kmo_free_fits_desc(&desc2);
-<a name="l01233"></a>01233 kmo_init_fits_desc(&desc2);
-<a name="l01234"></a>01234 }
-<a name="l01235"></a>01235
-<a name="l01236"></a>01236 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, ATMOS_MODEL) == 1) {
-<a name="l01237"></a>01237 KMO_TRY_EXIT_IF_NULL(
-<a name="l01238"></a>01238 tmp_frame = kmo_dfs_get_frame(frameset, ATMOS_MODEL));
-<a name="l01239"></a>01239 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(tmp_frame));
-<a name="l01240"></a>01240 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01241"></a>01241 KMO_TRY_ASSURE((desc2.nr_ext == 1) &&
-<a name="l01242"></a>01242 (desc2.ex_badpix == FALSE) &&
-<a name="l01243"></a>01243 (desc2.fits_type == f1s_fits) &&
-<a name="l01244"></a>01244 (desc2.frame_type == spectrum_frame),
-<a name="l01245"></a>01245 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01246"></a>01246 <span class="stringliteral">"ATMOS_MODEL isn't in the correct format!!!"</span>);
-<a name="l01247"></a>01247 kmo_free_fits_desc(&desc2);
-<a name="l01248"></a>01248 kmo_init_fits_desc(&desc2);
-<a name="l01249"></a>01249 }
-<a name="l01250"></a>01250
-<a name="l01251"></a>01251 KMO_TRY_EXIT_IF_NULL(
-<a name="l01252"></a>01252 tmp_frame = kmo_dfs_get_frame(frameset, STD));
-<a name="l01253"></a>01253 <span class="keywordflow">while</span> (tmp_frame != NULL ) {
-<a name="l01254"></a>01254 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(tmp_frame));
-<a name="l01255"></a>01255 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01256"></a>01256 KMO_TRY_ASSURE((desc2.nr_ext == 3) &&
-<a name="l01257"></a>01257 (desc2.ex_badpix == FALSE) &&
-<a name="l01258"></a>01258 (desc2.fits_type == raw_fits) &&
-<a name="l01259"></a>01259 (desc2.frame_type == detector_frame),
-<a name="l01260"></a>01260 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01261"></a>01261 <span class="stringliteral">"STD isn't in the correct format!!!"</span>);
-<a name="l01262"></a>01262 nr_devices = desc2.nr_ext;
-<a name="l01263"></a>01263 kmo_free_fits_desc(&desc2);
-<a name="l01264"></a>01264 kmo_init_fits_desc(&desc2);
-<a name="l01265"></a>01265
-<a name="l01266"></a>01266 tmp_frame = kmo_dfs_get_frame(frameset, NULL);
-<a name="l01267"></a>01267 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01268"></a>01268 }
-<a name="l01269"></a>01269 KMO_TRY_EXIT_IF_NULL(
-<a name="l01270"></a>01270 tmp_frame = kmo_dfs_get_frame(frameset, STD));
-<a name="l01271"></a>01271 KMO_TRY_EXIT_IF_NULL(
-<a name="l01272"></a>01272 suffix = kmo_dfs_get_suffix(tmp_frame, TRUE, FALSE));
-<a name="l01273"></a>01273
-<a name="l01274"></a>01274 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01275"></a>01275 kmo_check_frame_setup_md5_xycal(frameset));
-<a name="l01276"></a>01276 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01277"></a>01277 kmo_check_frame_setup_md5(frameset));
-<a name="l01278"></a>01278
-<a name="l01279"></a>01279 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Detected instrument setup: %s"</span>, suffix+1);
-<a name="l01280"></a>01280 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"(grating 1, 2 & 3)"</span>);
+<a name="l01135"></a>01135 desc1 = kmo_identify_fits_header(cpl_frame_get_filename(xcal_frame));
+<a name="l01136"></a>01136 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01137"></a>01137
+<a name="l01138"></a>01138 KMO_TRY_ASSURE((desc1.nr_ext % 3 == 0) &&
+<a name="l01139"></a>01139 (desc1.ex_badpix == FALSE) &&
+<a name="l01140"></a>01140 (desc1.fits_type == f2d_fits) &&
+<a name="l01141"></a>01141 (desc1.frame_type == detector_frame),
+<a name="l01142"></a>01142 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01143"></a>01143 <span class="stringliteral">"XCAL isn't in the correct format!!!"</span>);
+<a name="l01144"></a>01144
+<a name="l01145"></a>01145 KMO_TRY_EXIT_IF_NULL(
+<a name="l01146"></a>01146 ycal_frame = kmo_dfs_get_frame(frameset, YCAL));
+<a name="l01147"></a>01147 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(ycal_frame));
+<a name="l01148"></a>01148 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01149"></a>01149
+<a name="l01150"></a>01150 KMO_TRY_ASSURE((desc1.nr_ext == desc2.nr_ext) &&
+<a name="l01151"></a>01151 (desc1.ex_badpix == desc2.ex_badpix) &&
+<a name="l01152"></a>01152 (desc1.fits_type == desc2.fits_type) &&
+<a name="l01153"></a>01153 (desc1.frame_type == desc2.frame_type),
+<a name="l01154"></a>01154 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01155"></a>01155 <span class="stringliteral">"YCAL isn't in the correct format!!!"</span>);
+<a name="l01156"></a>01156 kmo_free_fits_desc(&desc2);
+<a name="l01157"></a>01157 kmo_init_fits_desc(&desc2);
+<a name="l01158"></a>01158
+<a name="l01159"></a>01159 KMO_TRY_EXIT_IF_NULL(
+<a name="l01160"></a>01160 lcal_frame = kmo_dfs_get_frame(frameset, LCAL));
+<a name="l01161"></a>01161 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(lcal_frame));
+<a name="l01162"></a>01162 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01163"></a>01163
+<a name="l01164"></a>01164 KMO_TRY_ASSURE((desc1.nr_ext == desc2.nr_ext) &&
+<a name="l01165"></a>01165 (desc1.ex_badpix == desc2.ex_badpix) &&
+<a name="l01166"></a>01166 (desc1.fits_type == desc2.fits_type) &&
+<a name="l01167"></a>01167 (desc1.frame_type == desc2.frame_type),
+<a name="l01168"></a>01168 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01169"></a>01169 <span class="stringliteral">"YCAL isn't in the correct format!!!"</span>);
+<a name="l01170"></a>01170 kmo_free_fits_desc(&desc2);
+<a name="l01171"></a>01171 kmo_init_fits_desc(&desc2);
+<a name="l01172"></a>01172
+<a name="l01173"></a>01173 KMO_TRY_EXIT_IF_NULL(
+<a name="l01174"></a>01174 flat_frame = kmo_dfs_get_frame(frameset, MASTER_FLAT));
+<a name="l01175"></a>01175 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(flat_frame));
+<a name="l01176"></a>01176 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01177"></a>01177
+<a name="l01178"></a>01178 KMO_TRY_ASSURE((desc2.nr_ext % 6 == 0) &&
+<a name="l01179"></a>01179 (desc1.ex_badpix == desc2.ex_badpix) &&
+<a name="l01180"></a>01180 (desc1.fits_type == desc2.fits_type) &&
+<a name="l01181"></a>01181 (desc1.frame_type == desc2.frame_type),
+<a name="l01182"></a>01182 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01183"></a>01183 <span class="stringliteral">"MASTER_FLAT isn't in the correct format!!!"</span>);
+<a name="l01184"></a>01184 kmo_free_fits_desc(&desc2);
+<a name="l01185"></a>01185 kmo_init_fits_desc(&desc2);
+<a name="l01186"></a>01186
+<a name="l01187"></a>01187 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, ILLUM_CORR) == 1) {
+<a name="l01188"></a>01188 KMO_TRY_EXIT_IF_NULL(
+<a name="l01189"></a>01189 illum_frame = kmo_dfs_get_frame(frameset, ILLUM_CORR));
+<a name="l01190"></a>01190 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(illum_frame));
+<a name="l01191"></a>01191 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01192"></a>01192 KMO_TRY_ASSURE(((desc2.nr_ext == 24) || (desc2.nr_ext == 48)) &&
+<a name="l01193"></a>01193 (desc2.ex_badpix == FALSE) &&
+<a name="l01194"></a>01194 (desc2.fits_type == f2i_fits) &&
+<a name="l01195"></a>01195 (desc2.frame_type == ifu_frame),
+<a name="l01196"></a>01196 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01197"></a>01197 <span class="stringliteral">"ILLUM_CORR isn't in the correct format!!!"</span>);
+<a name="l01198"></a>01198 kmo_free_fits_desc(&desc2);
+<a name="l01199"></a>01199 kmo_init_fits_desc(&desc2);
+<a name="l01200"></a>01200 }
+<a name="l01201"></a>01201
+<a name="l01202"></a>01202 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, SPEC_TYPE_LOOKUP) == 1) {
+<a name="l01203"></a>01203 KMO_TRY_EXIT_IF_NULL(
+<a name="l01204"></a>01204 tmp_frame = kmo_dfs_get_frame(frameset, SPEC_TYPE_LOOKUP));
+<a name="l01205"></a>01205 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(tmp_frame));
+<a name="l01206"></a>01206 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01207"></a>01207 KMO_TRY_ASSURE((desc2.nr_ext == 1) &&
+<a name="l01208"></a>01208 (desc2.ex_badpix == FALSE) &&
+<a name="l01209"></a>01209 (desc2.fits_type == f2l_fits) &&
+<a name="l01210"></a>01210 (desc2.frame_type == list_frame),
+<a name="l01211"></a>01211 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01212"></a>01212 <span class="stringliteral">"SPEC_TYPE_LOOKUP isn't in the correct format!!!"</span>);
+<a name="l01213"></a>01213 kmo_free_fits_desc(&desc2);
+<a name="l01214"></a>01214 kmo_init_fits_desc(&desc2);
+<a name="l01215"></a>01215 }
+<a name="l01216"></a>01216
+<a name="l01217"></a>01217 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, SOLAR_SPEC) == 1) {
+<a name="l01218"></a>01218 KMO_TRY_EXIT_IF_NULL(
+<a name="l01219"></a>01219 tmp_frame = kmo_dfs_get_frame(frameset, SOLAR_SPEC));
+<a name="l01220"></a>01220 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(tmp_frame));
+<a name="l01221"></a>01221 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01222"></a>01222 KMO_TRY_ASSURE((desc2.nr_ext == 1) &&
+<a name="l01223"></a>01223 (desc2.ex_badpix == FALSE) &&
+<a name="l01224"></a>01224 (desc2.fits_type == f1s_fits) &&
+<a name="l01225"></a>01225 (desc2.frame_type == spectrum_frame),
+<a name="l01226"></a>01226 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01227"></a>01227 <span class="stringliteral">"SOLAR_SPEC isn't in the correct format!!!"</span>);
+<a name="l01228"></a>01228 kmo_free_fits_desc(&desc2);
+<a name="l01229"></a>01229 kmo_init_fits_desc(&desc2);
+<a name="l01230"></a>01230 }
+<a name="l01231"></a>01231
+<a name="l01232"></a>01232 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, ATMOS_MODEL) == 1) {
+<a name="l01233"></a>01233 KMO_TRY_EXIT_IF_NULL(
+<a name="l01234"></a>01234 tmp_frame = kmo_dfs_get_frame(frameset, ATMOS_MODEL));
+<a name="l01235"></a>01235 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(tmp_frame));
+<a name="l01236"></a>01236 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01237"></a>01237 KMO_TRY_ASSURE((desc2.nr_ext == 1) &&
+<a name="l01238"></a>01238 (desc2.ex_badpix == FALSE) &&
+<a name="l01239"></a>01239 (desc2.fits_type == f1s_fits) &&
+<a name="l01240"></a>01240 (desc2.frame_type == spectrum_frame),
+<a name="l01241"></a>01241 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01242"></a>01242 <span class="stringliteral">"ATMOS_MODEL isn't in the correct format!!!"</span>);
+<a name="l01243"></a>01243 kmo_free_fits_desc(&desc2);
+<a name="l01244"></a>01244 kmo_init_fits_desc(&desc2);
+<a name="l01245"></a>01245 }
+<a name="l01246"></a>01246
+<a name="l01247"></a>01247 KMO_TRY_EXIT_IF_NULL(
+<a name="l01248"></a>01248 tmp_frame = kmo_dfs_get_frame(frameset, STD));
+<a name="l01249"></a>01249 <span class="keywordflow">while</span> (tmp_frame != NULL ) {
+<a name="l01250"></a>01250 desc2 = kmo_identify_fits_header(cpl_frame_get_filename(tmp_frame));
+<a name="l01251"></a>01251 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01252"></a>01252 KMO_TRY_ASSURE((desc2.nr_ext == 3) &&
+<a name="l01253"></a>01253 (desc2.ex_badpix == FALSE) &&
+<a name="l01254"></a>01254 (desc2.fits_type == raw_fits) &&
+<a name="l01255"></a>01255 (desc2.frame_type == detector_frame),
+<a name="l01256"></a>01256 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01257"></a>01257 <span class="stringliteral">"STD isn't in the correct format!!!"</span>);
+<a name="l01258"></a>01258 nr_devices = desc2.nr_ext;
+<a name="l01259"></a>01259 kmo_free_fits_desc(&desc2);
+<a name="l01260"></a>01260 kmo_init_fits_desc(&desc2);
+<a name="l01261"></a>01261
+<a name="l01262"></a>01262 tmp_frame = kmo_dfs_get_frame(frameset, NULL);
+<a name="l01263"></a>01263 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01264"></a>01264 }
+<a name="l01265"></a>01265 KMO_TRY_EXIT_IF_NULL(
+<a name="l01266"></a>01266 tmp_frame = kmo_dfs_get_frame(frameset, STD));
+<a name="l01267"></a>01267 KMO_TRY_EXIT_IF_NULL(
+<a name="l01268"></a>01268 suffix = kmo_dfs_get_suffix(tmp_frame, TRUE, FALSE));
+<a name="l01269"></a>01269
+<a name="l01270"></a>01270 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01271"></a>01271 kmo_check_frame_setup_md5_xycal(frameset));
+<a name="l01272"></a>01272 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01273"></a>01273 kmo_check_frame_setup_md5(frameset));
+<a name="l01274"></a>01274
+<a name="l01275"></a>01275 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"Detected instrument setup: %s"</span>, suffix+1);
+<a name="l01276"></a>01276 cpl_msg_info(<span class="stringliteral">""</span>, <span class="stringliteral">"(grating 1, 2 & 3)"</span>);
+<a name="l01277"></a>01277
+<a name="l01278"></a>01278 <span class="comment">// check which IFUs are active for all frames</span>
+<a name="l01279"></a>01279 KMO_TRY_EXIT_IF_NULL(
+<a name="l01280"></a>01280 unused_ifus_before = kmo_get_unused_ifus(frameset, 0, 0));
<a name="l01281"></a>01281
-<a name="l01282"></a>01282 <span class="comment">// check which IFUs are active for all frames</span>
-<a name="l01283"></a>01283 KMO_TRY_EXIT_IF_NULL(
-<a name="l01284"></a>01284 unused_ifus_before = kmo_get_unused_ifus(frameset, 0, 0));
-<a name="l01285"></a>01285
-<a name="l01286"></a>01286 KMO_TRY_EXIT_IF_NULL(
-<a name="l01287"></a>01287 unused_ifus_after = kmo_duplicate_unused_ifus(unused_ifus_before));
+<a name="l01282"></a>01282 KMO_TRY_EXIT_IF_NULL(
+<a name="l01283"></a>01283 unused_ifus_after = kmo_duplicate_unused_ifus(unused_ifus_before));
+<a name="l01284"></a>01284
+<a name="l01285"></a>01285 kmo_print_unused_ifus(unused_ifus_before, FALSE);
+<a name="l01286"></a>01286
+<a name="l01287"></a>01287 <span class="comment">/* --- load data --- */</span>
<a name="l01288"></a>01288
-<a name="l01289"></a>01289 kmo_print_unused_ifus(unused_ifus_before, FALSE);
-<a name="l01290"></a>01290
-<a name="l01291"></a>01291 <span class="comment">/* --- load data --- */</span>
-<a name="l01292"></a>01292
-<a name="l01293"></a>01293 <span class="keywordflow">if</span> ((cpl_frameset_count_tags(frameset, SPEC_TYPE_LOOKUP) == 1) &&
-<a name="l01294"></a>01294 ((strlen(spec_class) > 0) || (strlen(lum_class) > 0)))
-<a name="l01295"></a>01295 {
-<a name="l01296"></a>01296 <span class="comment">// get star temperature out of SPEC_TYPE_LOOKUP table</span>
-<a name="l01297"></a>01297 KMO_TRY_EXIT_IF_NULL(
-<a name="l01298"></a>01298 spec_type_LUT = kmo_dfs_load_table(frameset, SPEC_TYPE_LOOKUP, 1, 0));
-<a name="l01299"></a>01299 star_temperature = kmo_get_temperature(spec_type_LUT, spec_class, lum_class);
-<a name="l01300"></a>01300 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01301"></a>01301 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, SPEC_TYPE_LOOKUP) != 1) {
-<a name="l01302"></a>01302 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"No SPEC_TYPE_LOOKUP was provided! Can't divide blackbody."</span>);
-<a name="l01303"></a>01303 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((strlen(spec_class) == 0) || (strlen(lum_class) == 0)) {
-<a name="l01304"></a>01304 <span class="comment">// cpl_msg_warning("","No startype was provided! Can't "</span>
-<a name="l01305"></a>01305 <span class="comment">// "divide blackbody.");</span>
-<a name="l01306"></a>01306 }
-<a name="l01307"></a>01307
-<a name="l01308"></a>01308 <span class="comment">// allocate intermediate memory</span>
-<a name="l01309"></a>01309 KMO_TRY_EXIT_IF_NULL(
-<a name="l01310"></a>01310 stored_telluric_data = (cpl_vector**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01311"></a>01311 <span class="keyword">sizeof</span>(cpl_vector*)));
-<a name="l01312"></a>01312 KMO_TRY_EXIT_IF_NULL(
-<a name="l01313"></a>01313 stored_telluric_noise = (cpl_vector**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01314"></a>01314 <span class="keyword">sizeof</span>(cpl_vector*)));
-<a name="l01315"></a>01315 KMO_TRY_EXIT_IF_NULL(
-<a name="l01316"></a>01316 stored_starspec_data = (cpl_vector**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01317"></a>01317 <span class="keyword">sizeof</span>(cpl_vector*)));
-<a name="l01318"></a>01318 KMO_TRY_EXIT_IF_NULL(
-<a name="l01319"></a>01319 stored_starspec_noise = (cpl_vector**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01320"></a>01320 <span class="keyword">sizeof</span>(cpl_vector*)));
-<a name="l01321"></a>01321 KMO_TRY_EXIT_IF_NULL(
-<a name="l01322"></a>01322 stored_psf_data = (cpl_image**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01323"></a>01323 <span class="keyword">sizeof</span>(cpl_image*)));
-<a name="l01324"></a>01324 KMO_TRY_EXIT_IF_NULL(
-<a name="l01325"></a>01325 stored_mask = (cpl_image**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01326"></a>01326 <span class="keyword">sizeof</span>(cpl_image*)));
-<a name="l01327"></a>01327 KMO_TRY_EXIT_IF_NULL(
-<a name="l01328"></a>01328 stored_data_cube = (cpl_imagelist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01329"></a>01329 <span class="keyword">sizeof</span>(cpl_imagelist*)));
-<a name="l01330"></a>01330 KMO_TRY_EXIT_IF_NULL(
-<a name="l01331"></a>01331 stored_noise_cube = (cpl_imagelist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01332"></a>01332 <span class="keyword">sizeof</span>(cpl_imagelist*)));
-<a name="l01333"></a>01333 KMO_TRY_EXIT_IF_NULL(
-<a name="l01334"></a>01334 stored_qc_throughput = (<span class="keywordtype">double</span>*)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01335"></a>01335 <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>)));
-<a name="l01336"></a>01336 KMO_TRY_EXIT_IF_NULL(
-<a name="l01337"></a>01337 stored_sub_psf_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01338"></a>01338 <span class="keyword">sizeof</span>(cpl_propertylist*)));
-<a name="l01339"></a>01339 KMO_TRY_EXIT_IF_NULL(
-<a name="l01340"></a>01340 stored_sub_tel_data_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01341"></a>01341 <span class="keyword">sizeof</span>(cpl_propertylist*)));
-<a name="l01342"></a>01342 KMO_TRY_EXIT_IF_NULL(
-<a name="l01343"></a>01343 stored_sub_tel_noise_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01344"></a>01344 <span class="keyword">sizeof</span>(cpl_propertylist*)));
-<a name="l01345"></a>01345
-<a name="l01346"></a>01346 <span class="keywordflow">if</span> (save_cubes) {
-<a name="l01347"></a>01347 KMO_TRY_EXIT_IF_NULL(
-<a name="l01348"></a>01348 stored_sub_cube_data_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01349"></a>01349 <span class="keyword">sizeof</span>(cpl_propertylist*)));
-<a name="l01350"></a>01350 KMO_TRY_EXIT_IF_NULL(
-<a name="l01351"></a>01351 stored_sub_cube_noise_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
-<a name="l01352"></a>01352 <span class="keyword">sizeof</span>(cpl_propertylist*)));
-<a name="l01353"></a>01353 }
-<a name="l01354"></a>01354
-<a name="l01355"></a>01355 <span class="comment">// get bounds</span>
-<a name="l01356"></a>01356 KMO_TRY_EXIT_IF_NULL(
-<a name="l01357"></a>01357 tmp_header = kmo_dfs_load_primary_header(frameset, XCAL));
-<a name="l01358"></a>01358 KMO_TRY_EXIT_IF_NULL(
-<a name="l01359"></a>01359 bounds = kmclipm_extract_bounds(tmp_header));
-<a name="l01360"></a>01360 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
-<a name="l01361"></a>01361
-<a name="l01362"></a>01362 <span class="comment">// setup grid definition, wavelength start and end points will be set</span>
-<a name="l01363"></a>01363 <span class="comment">// in the detector loop</span>
-<a name="l01364"></a>01364 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01365"></a>01365 kmclipm_setup_grid(&gd, imethod, neighborhoodRange, KMOS_PIX_RESOLUTION));
-<a name="l01366"></a>01366
-<a name="l01367"></a>01367 <span class="comment">// get valid STD frames with objects in it and associated sky exposures</span>
-<a name="l01368"></a>01368 KMO_TRY_EXIT_IF_NULL(
-<a name="l01369"></a>01369 obj_sky_struct = kmo_create_objSkyStruct(frameset_std, STD, FALSE));
-<a name="l01370"></a>01370 kmo_debug_objSkyStruct(frameset, obj_sky_struct);
-<a name="l01371"></a>01371
-<a name="l01372"></a>01372 <span class="comment">// loop the object-sky pairs</span>
-<a name="l01373"></a>01373 <span class="keywordflow">if</span> (obj_sky_struct->size == 0) {
-<a name="l01374"></a>01374 cpl_msg_warning(cpl_func,<span class="stringliteral">"Not a single frame contains an object"</span>);
-<a name="l01375"></a>01375 } <span class="keywordflow">else</span> {
-<a name="l01376"></a>01376 strcpy(filename_telluric, TELLURIC);
-<a name="l01377"></a>01377 strcpy(filename_starspec, STAR_SPEC);
-<a name="l01378"></a>01378 strcpy(filename_psf, STD_IMAGE);
-<a name="l01379"></a>01379 strcpy(filename_mask, STD_MASK);
-<a name="l01380"></a>01380 strcpy(filename_cubes, STD_CUBE);
+<a name="l01289"></a>01289 <span class="keywordflow">if</span> ((cpl_frameset_count_tags(frameset, SPEC_TYPE_LOOKUP) == 1) &&
+<a name="l01290"></a>01290 ((strlen(spec_class) > 0) || (strlen(lum_class) > 0)))
+<a name="l01291"></a>01291 {
+<a name="l01292"></a>01292 <span class="comment">// get star temperature out of SPEC_TYPE_LOOKUP table</span>
+<a name="l01293"></a>01293 KMO_TRY_EXIT_IF_NULL(
+<a name="l01294"></a>01294 spec_type_LUT = kmo_dfs_load_table(frameset, SPEC_TYPE_LOOKUP, 1, 0));
+<a name="l01295"></a>01295 star_temperature = kmo_get_temperature(spec_type_LUT, spec_class, lum_class);
+<a name="l01296"></a>01296 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01297"></a>01297 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, SPEC_TYPE_LOOKUP) != 1) {
+<a name="l01298"></a>01298 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"No SPEC_TYPE_LOOKUP was provided! Can't divide blackbody."</span>);
+<a name="l01299"></a>01299 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((strlen(spec_class) == 0) || (strlen(lum_class) == 0)) {
+<a name="l01300"></a>01300 <span class="comment">// cpl_msg_warning("","No startype was provided! Can't "</span>
+<a name="l01301"></a>01301 <span class="comment">// "divide blackbody.");</span>
+<a name="l01302"></a>01302 }
+<a name="l01303"></a>01303
+<a name="l01304"></a>01304 <span class="comment">// allocate intermediate memory</span>
+<a name="l01305"></a>01305 KMO_TRY_EXIT_IF_NULL(
+<a name="l01306"></a>01306 stored_telluric_data = (cpl_vector**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01307"></a>01307 <span class="keyword">sizeof</span>(cpl_vector*)));
+<a name="l01308"></a>01308 KMO_TRY_EXIT_IF_NULL(
+<a name="l01309"></a>01309 stored_telluric_noise = (cpl_vector**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01310"></a>01310 <span class="keyword">sizeof</span>(cpl_vector*)));
+<a name="l01311"></a>01311 KMO_TRY_EXIT_IF_NULL(
+<a name="l01312"></a>01312 stored_starspec_data = (cpl_vector**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01313"></a>01313 <span class="keyword">sizeof</span>(cpl_vector*)));
+<a name="l01314"></a>01314 KMO_TRY_EXIT_IF_NULL(
+<a name="l01315"></a>01315 stored_starspec_noise = (cpl_vector**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01316"></a>01316 <span class="keyword">sizeof</span>(cpl_vector*)));
+<a name="l01317"></a>01317 KMO_TRY_EXIT_IF_NULL(
+<a name="l01318"></a>01318 stored_psf_data = (cpl_image**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01319"></a>01319 <span class="keyword">sizeof</span>(cpl_image*)));
+<a name="l01320"></a>01320 KMO_TRY_EXIT_IF_NULL(
+<a name="l01321"></a>01321 stored_mask = (cpl_image**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01322"></a>01322 <span class="keyword">sizeof</span>(cpl_image*)));
+<a name="l01323"></a>01323 KMO_TRY_EXIT_IF_NULL(
+<a name="l01324"></a>01324 stored_data_cube = (cpl_imagelist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01325"></a>01325 <span class="keyword">sizeof</span>(cpl_imagelist*)));
+<a name="l01326"></a>01326 KMO_TRY_EXIT_IF_NULL(
+<a name="l01327"></a>01327 stored_noise_cube = (cpl_imagelist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01328"></a>01328 <span class="keyword">sizeof</span>(cpl_imagelist*)));
+<a name="l01329"></a>01329 KMO_TRY_EXIT_IF_NULL(
+<a name="l01330"></a>01330 stored_qc_throughput = (<span class="keywordtype">double</span>*)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01331"></a>01331 <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>)));
+<a name="l01332"></a>01332 KMO_TRY_EXIT_IF_NULL(
+<a name="l01333"></a>01333 stored_sub_psf_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01334"></a>01334 <span class="keyword">sizeof</span>(cpl_propertylist*)));
+<a name="l01335"></a>01335 KMO_TRY_EXIT_IF_NULL(
+<a name="l01336"></a>01336 stored_sub_tel_data_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01337"></a>01337 <span class="keyword">sizeof</span>(cpl_propertylist*)));
+<a name="l01338"></a>01338 KMO_TRY_EXIT_IF_NULL(
+<a name="l01339"></a>01339 stored_sub_tel_noise_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01340"></a>01340 <span class="keyword">sizeof</span>(cpl_propertylist*)));
+<a name="l01341"></a>01341
+<a name="l01342"></a>01342 <span class="keywordflow">if</span> (save_cubes) {
+<a name="l01343"></a>01343 KMO_TRY_EXIT_IF_NULL(
+<a name="l01344"></a>01344 stored_sub_cube_data_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01345"></a>01345 <span class="keyword">sizeof</span>(cpl_propertylist*)));
+<a name="l01346"></a>01346 KMO_TRY_EXIT_IF_NULL(
+<a name="l01347"></a>01347 stored_sub_cube_noise_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+<a name="l01348"></a>01348 <span class="keyword">sizeof</span>(cpl_propertylist*)));
+<a name="l01349"></a>01349 }
+<a name="l01350"></a>01350
+<a name="l01351"></a>01351 <span class="comment">// get bounds</span>
+<a name="l01352"></a>01352 KMO_TRY_EXIT_IF_NULL(
+<a name="l01353"></a>01353 tmp_header = kmo_dfs_load_primary_header(frameset, XCAL));
+<a name="l01354"></a>01354 KMO_TRY_EXIT_IF_NULL(
+<a name="l01355"></a>01355 bounds = kmclipm_extract_bounds(tmp_header));
+<a name="l01356"></a>01356 cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+<a name="l01357"></a>01357
+<a name="l01358"></a>01358 <span class="comment">// setup grid definition, wavelength start and end points will be set</span>
+<a name="l01359"></a>01359 <span class="comment">// in the detector loop</span>
+<a name="l01360"></a>01360 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01361"></a>01361 kmclipm_setup_grid(&gd, imethod, neighborhoodRange, KMOS_PIX_RESOLUTION, 0.));
+<a name="l01362"></a>01362
+<a name="l01363"></a>01363 <span class="comment">// get valid STD frames with objects in it and associated sky exposures</span>
+<a name="l01364"></a>01364 KMO_TRY_EXIT_IF_NULL(
+<a name="l01365"></a>01365 obj_sky_struct = kmo_create_objSkyStruct(frameset_std, STD, FALSE));
+<a name="l01366"></a>01366 kmo_print_objSkyStruct(obj_sky_struct);
+<a name="l01367"></a>01367
+<a name="l01368"></a>01368 <span class="comment">// loop the object-sky pairs</span>
+<a name="l01369"></a>01369 <span class="keywordflow">if</span> (obj_sky_struct->size == 0) {
+<a name="l01370"></a>01370 cpl_msg_warning(cpl_func,<span class="stringliteral">"Not a single frame contains an object"</span>);
+<a name="l01371"></a>01371 } <span class="keywordflow">else</span> {
+<a name="l01372"></a>01372 strcpy(filename_telluric, TELLURIC);
+<a name="l01373"></a>01373 strcpy(filename_starspec, STAR_SPEC);
+<a name="l01374"></a>01374 strcpy(filename_psf, STD_IMAGE);
+<a name="l01375"></a>01375 strcpy(filename_mask, STD_MASK);
+<a name="l01376"></a>01376 strcpy(filename_cubes, STD_CUBE);
+<a name="l01377"></a>01377
+<a name="l01378"></a>01378 obj_frame = obj_sky_struct->table[nr_exp].objFrame;
+<a name="l01379"></a>01379 KMO_TRY_EXIT_IF_NULL(
+<a name="l01380"></a>01380 main_header_tel = kmclipm_propertylist_load(cpl_frame_get_filename(obj_frame), 0));
<a name="l01381"></a>01381
-<a name="l01382"></a>01382 obj_frame = obj_sky_struct->table[nr_exp].objFrame;
-<a name="l01383"></a>01383 KMO_TRY_EXIT_IF_NULL(
-<a name="l01384"></a>01384 main_header_tel = kmclipm_propertylist_load(cpl_frame_get_filename(obj_frame), 0));
-<a name="l01385"></a>01385
-<a name="l01386"></a>01386 exptime = cpl_propertylist_get_double(main_header_tel, EXPTIME);
-<a name="l01387"></a>01387 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01388"></a>01388
-<a name="l01389"></a>01389 <span class="comment">// load, process & store frames</span>
-<a name="l01390"></a>01390
-<a name="l01391"></a>01391 <span class="keywordflow">for</span> (i = 1; i <= nr_devices; i++) {
-<a name="l01392"></a>01392 <span class="comment">// extract LCAL image close to ROTANGLE 0. assuming that the wavelength range</span>
-<a name="l01393"></a>01393 <span class="comment">// doesn't differ too much with different ROTANGLEs.</span>
-<a name="l01394"></a>01394 print_cal_angle_msg_once = FALSE;
-<a name="l01395"></a>01395 <span class="keywordtype">double</span> rotangle_found;
-<a name="l01396"></a>01396 KMO_TRY_EXIT_IF_NULL(
-<a name="l01397"></a>01397 lcal = kmo_dfs_load_cal_image(frameset, LCAL, i, FALSE, 0., FALSE, NULL,
-<a name="l01398"></a>01398 &rotangle_found, -1, 0, 0));
-<a name="l01399"></a>01399 <span class="keywordflow">if</span> (i==1) {
-<a name="l01400"></a>01400 print_cal_angle_msg_once = TRUE;
-<a name="l01401"></a>01401 }
-<a name="l01402"></a>01402 <span class="keywordflow">if</span> (tmp_band_method != NULL) {
-<a name="l01403"></a>01403 band_method = atoi(tmp_band_method);
-<a name="l01404"></a>01404 }
-<a name="l01405"></a>01405
-<a name="l01406"></a>01406 <span class="comment">// get filter for this detector</span>
-<a name="l01407"></a>01407 <span class="comment">// ESO INS FILTi ID</span>
-<a name="l01408"></a>01408 KMO_TRY_EXIT_IF_NULL(
-<a name="l01409"></a>01409 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_FILTID_PREFIX, i, IFU_FILTID_POSTFIX));
-<a name="l01410"></a>01410 filter_id = cpl_propertylist_get_string(main_header_tel, keyword);
-<a name="l01411"></a>01411 cpl_free(keyword); keyword = NULL;
-<a name="l01412"></a>01412
-<a name="l01413"></a>01413 KMO_TRY_EXIT_IF_NULL(
-<a name="l01414"></a>01414 band_table = kmo_dfs_load_table(frameset, WAVE_BAND, 1, 0));
-<a name="l01415"></a>01415 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01416"></a>01416 kmclipm_setup_grid_band_lcal(&gd, lcal, filter_id,
-<a name="l01417"></a>01417 band_method, band_table));
-<a name="l01418"></a>01418 cpl_image_delete(lcal); lcal = NULL;
-<a name="l01419"></a>01419 cpl_table_delete(band_table); band_table = NULL;
-<a name="l01420"></a>01420
-<a name="l01421"></a>01421 <span class="comment">// load sub_header of original F2D image</span>
-<a name="l01422"></a>01422 KMO_TRY_EXIT_IF_NULL(
-<a name="l01423"></a>01423 sub_header_orig = kmclipm_propertylist_load( cpl_frame_get_filename(obj_frame), i));
-<a name="l01424"></a>01424
-<a name="l01425"></a>01425 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
-<a name="l01426"></a>01426 ifu_nr = (i-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
-<a name="l01427"></a>01427 <span class="comment">// check if IFU is valid according to main header keywords &</span>
-<a name="l01428"></a>01428 <span class="comment">// calibration files</span>
-<a name="l01429"></a>01429 <span class="comment">// AND check if there is a sky frame available for this IFU</span>
-<a name="l01430"></a>01430 kmo_collapse_objSkyStruct(obj_sky_struct, ifu_nr,
-<a name="l01431"></a>01431 &obj_frame, &sky_frame);
-<a name="l01432"></a>01432
-<a name="l01433"></a>01433 KMO_TRY_EXIT_IF_NULL(
-<a name="l01434"></a>01434 punused_ifus = cpl_array_get_data_int_const(unused_ifus_after[i-1]));
-<a name="l01435"></a>01435
-<a name="l01436"></a>01436 <span class="comment">// Search for keyword ESO OCS ARMi NOTUSED</span>
-<a name="l01437"></a>01437 <span class="comment">// If not present (CPL_ERROR_DATA_NOT_FOUND) we will eventually</span>
-<a name="l01438"></a>01438 <span class="comment">// process standard star</span>
-<a name="l01439"></a>01439 KMO_TRY_EXIT_IF_NULL(
-<a name="l01440"></a>01440 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_VALID_PREFIX, ifu_nr, IFU_VALID_POSTFIX));
-<a name="l01441"></a>01441 tmp_str = cpl_propertylist_get_string(main_header_tel, keyword);
-<a name="l01442"></a>01442 cpl_free(keyword); keyword = NULL;
-<a name="l01443"></a>01443
-<a name="l01444"></a>01444 <span class="keywordflow">if</span> ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) &&
-<a name="l01445"></a>01445 (bounds[2*(ifu_nr-1)] != -1) &&
-<a name="l01446"></a>01446 (bounds[2*(ifu_nr-1)+1] != -1) &&
-<a name="l01447"></a>01447 (sky_frame != NULL) &&
-<a name="l01448"></a>01448 (punused_ifus[j] == 0))
-<a name="l01449"></a>01449 {
-<a name="l01450"></a>01450 cpl_error_reset();
-<a name="l01451"></a>01451 <span class="comment">// IFU is valid</span>
-<a name="l01452"></a>01452
-<a name="l01453"></a>01453 <span class="keywordflow">if</span> (sky_frame != NO_CORRESPONDING_SKYFRAME) {
-<a name="l01454"></a>01454 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Processing standard star in IFU %d "</span>
-<a name="l01455"></a>01455 <span class="stringliteral">"(obj: %s, sky: %s)"</span>, ifu_nr,
-<a name="l01456"></a>01456 cpl_frame_get_filename(obj_frame),
-<a name="l01457"></a>01457 cpl_frame_get_filename(sky_frame));
-<a name="l01458"></a>01458 } <span class="keywordflow">else</span> {
-<a name="l01459"></a>01459 sky_frame = NULL;
-<a name="l01460"></a>01460 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"Processing standard star in IFU %d "</span>
-<a name="l01461"></a>01461 <span class="stringliteral">"(obj: %s, no corresponding sky frame"</span>,
-<a name="l01462"></a>01462 ifu_nr, cpl_frame_get_filename(obj_frame));
-<a name="l01463"></a>01463 }
+<a name="l01382"></a>01382 exptime = cpl_propertylist_get_double(main_header_tel, EXPTIME);
+<a name="l01383"></a>01383 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01384"></a>01384
+<a name="l01385"></a>01385 <span class="comment">// load, process & store frames</span>
+<a name="l01386"></a>01386
+<a name="l01387"></a>01387 <span class="keywordflow">for</span> (i = 1; i <= nr_devices; i++) {
+<a name="l01388"></a>01388 <span class="comment">// extract LCAL image close to ROTANGLE 0. assuming that the wavelength range</span>
+<a name="l01389"></a>01389 <span class="comment">// doesn't differ too much with different ROTANGLEs.</span>
+<a name="l01390"></a>01390 print_cal_angle_msg_once = FALSE;
+<a name="l01391"></a>01391 print_xcal_angle_msg_once = FALSE;
+<a name="l01392"></a>01392 <span class="keywordtype">double</span> rotangle_found;
+<a name="l01393"></a>01393 KMO_TRY_EXIT_IF_NULL(
+<a name="l01394"></a>01394 lcal = kmo_dfs_load_cal_image(frameset, LCAL, i, FALSE, 0., FALSE, NULL,
+<a name="l01395"></a>01395 &rotangle_found, -1, 0, 0));
+<a name="l01396"></a>01396 <span class="keywordflow">if</span> (i==1) {
+<a name="l01397"></a>01397 print_cal_angle_msg_once = TRUE;
+<a name="l01398"></a>01398 print_xcal_angle_msg_once = TRUE;
+<a name="l01399"></a>01399 }
+<a name="l01400"></a>01400 <span class="keywordflow">if</span> (tmp_band_method != NULL) {
+<a name="l01401"></a>01401 band_method = atoi(tmp_band_method);
+<a name="l01402"></a>01402 }
+<a name="l01403"></a>01403
+<a name="l01404"></a>01404 <span class="comment">// get filter for this detector</span>
+<a name="l01405"></a>01405 <span class="comment">// ESO INS FILTi ID</span>
+<a name="l01406"></a>01406 KMO_TRY_EXIT_IF_NULL(
+<a name="l01407"></a>01407 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_FILTID_PREFIX, i, IFU_FILTID_POSTFIX));
+<a name="l01408"></a>01408 filter_id = cpl_propertylist_get_string(main_header_tel, keyword);
+<a name="l01409"></a>01409 cpl_free(keyword); keyword = NULL;
+<a name="l01410"></a>01410
+<a name="l01411"></a>01411 KMO_TRY_EXIT_IF_NULL(
+<a name="l01412"></a>01412 band_table = kmo_dfs_load_table(frameset, WAVE_BAND, 1, 0));
+<a name="l01413"></a>01413 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01414"></a>01414 kmclipm_setup_grid_band_lcal(&gd, lcal, filter_id,
+<a name="l01415"></a>01415 band_method, band_table));
+<a name="l01416"></a>01416 cpl_image_delete(lcal); lcal = NULL;
+<a name="l01417"></a>01417 cpl_table_delete(band_table); band_table = NULL;
+<a name="l01418"></a>01418
+<a name="l01419"></a>01419 <span class="comment">// load sub_header of original F2D image</span>
+<a name="l01420"></a>01420 KMO_TRY_EXIT_IF_NULL(
+<a name="l01421"></a>01421 sub_header_orig = kmclipm_propertylist_load( cpl_frame_get_filename(obj_frame), i));
+<a name="l01422"></a>01422
+<a name="l01423"></a>01423 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l01424"></a>01424 ifu_nr = (i-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
+<a name="l01425"></a>01425 <span class="comment">// check if IFU is valid according to main header keywords &</span>
+<a name="l01426"></a>01426 <span class="comment">// calibration files</span>
+<a name="l01427"></a>01427 <span class="comment">// AND check if there is a sky frame available for this IFU</span>
+<a name="l01428"></a>01428 kmo_collapse_objSkyStruct(obj_sky_struct, ifu_nr,
+<a name="l01429"></a>01429 &obj_frame, &sky_frame);
+<a name="l01430"></a>01430
+<a name="l01431"></a>01431 KMO_TRY_EXIT_IF_NULL(
+<a name="l01432"></a>01432 punused_ifus = cpl_array_get_data_int_const(unused_ifus_after[i-1]));
+<a name="l01433"></a>01433
+<a name="l01434"></a>01434 <span class="comment">// Search for keyword ESO OCS ARMi NOTUSED</span>
+<a name="l01435"></a>01435 <span class="comment">// If not present (CPL_ERROR_DATA_NOT_FOUND) we will eventually</span>
+<a name="l01436"></a>01436 <span class="comment">// process standard star</span>
+<a name="l01437"></a>01437 KMO_TRY_EXIT_IF_NULL(
+<a name="l01438"></a>01438 keyword = cpl_sprintf(<span class="stringliteral">"%s%d%s"</span>, IFU_VALID_PREFIX, ifu_nr, IFU_VALID_POSTFIX));
+<a name="l01439"></a>01439 tmp_str = cpl_propertylist_get_string(main_header_tel, keyword);
+<a name="l01440"></a>01440 cpl_free(keyword); keyword = NULL;
+<a name="l01441"></a>01441
+<a name="l01442"></a>01442 <span class="keywordflow">if</span> ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) &&
+<a name="l01443"></a>01443 (bounds[2*(ifu_nr-1)] != -1) &&
+<a name="l01444"></a>01444 (bounds[2*(ifu_nr-1)+1] != -1) &&
+<a name="l01445"></a>01445 (sky_frame != NULL) &&
+<a name="l01446"></a>01446 (punused_ifus[j] == 0))
+<a name="l01447"></a>01447 {
+<a name="l01448"></a>01448 cpl_error_reset();
+<a name="l01449"></a>01449 <span class="comment">// IFU is valid</span>
+<a name="l01450"></a>01450
+<a name="l01451"></a>01451 <span class="keywordflow">if</span> (sky_frame != NO_CORRESPONDING_SKYFRAME) {
+<a name="l01452"></a>01452 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Processing standard star in IFU %d "</span>
+<a name="l01453"></a>01453 <span class="stringliteral">"(obj: %s, sky: %s)"</span>, ifu_nr,
+<a name="l01454"></a>01454 cpl_frame_get_filename(obj_frame),
+<a name="l01455"></a>01455 cpl_frame_get_filename(sky_frame));
+<a name="l01456"></a>01456 } <span class="keywordflow">else</span> {
+<a name="l01457"></a>01457 sky_frame = NULL;
+<a name="l01458"></a>01458 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"Processing standard star in IFU %d "</span>
+<a name="l01459"></a>01459 <span class="stringliteral">"(obj: %s, no corresponding sky frame"</span>,
+<a name="l01460"></a>01460 ifu_nr, cpl_frame_get_filename(obj_frame));
+<a name="l01461"></a>01461 }
+<a name="l01462"></a>01462
+<a name="l01463"></a>01463 nr_std_stars++;
<a name="l01464"></a>01464
-<a name="l01465"></a>01465 nr_std_stars++;
-<a name="l01466"></a>01466
-<a name="l01467"></a>01467 <span class="keywordtype">char</span> *ggg = cpl_sprintf(<span class="stringliteral">"%s%d"</span>, PRO_STD, ifu_nr);
-<a name="l01468"></a>01468 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01469"></a>01469 cpl_propertylist_update_int(main_header_tel, ggg, 1));
-<a name="l01470"></a>01470 cpl_free(ggg); ggg = NULL;
-<a name="l01471"></a>01471
-<a name="l01472"></a>01472 <span class="comment">// calculate WCS and make copies of sub_header</span>
-<a name="l01473"></a>01473 KMO_TRY_EXIT_IF_NULL(
-<a name="l01474"></a>01474 tmp_sub_header = cpl_propertylist_duplicate(sub_header_orig));
-<a name="l01475"></a>01475 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01476"></a>01476 kmo_calc_wcs_gd(main_header_tel, tmp_sub_header, ifu_nr, gd));
-<a name="l01477"></a>01477 KMO_TRY_EXIT_IF_NULL(
-<a name="l01478"></a>01478 stored_sub_tel_data_headers[ifu_nr-1] =
-<a name="l01479"></a>01479 cpl_propertylist_duplicate(tmp_sub_header));
-<a name="l01480"></a>01480 KMO_TRY_EXIT_IF_NULL(
-<a name="l01481"></a>01481 stored_sub_psf_headers[ifu_nr-1] =
-<a name="l01482"></a>01482 cpl_propertylist_duplicate(tmp_sub_header));
-<a name="l01483"></a>01483 <span class="keywordflow">if</span> (save_cubes) {
-<a name="l01484"></a>01484 KMO_TRY_EXIT_IF_NULL(
-<a name="l01485"></a>01485 stored_sub_cube_data_headers[ifu_nr-1] =
-<a name="l01486"></a>01486 cpl_propertylist_duplicate(tmp_sub_header));
-<a name="l01487"></a>01487 }
-<a name="l01488"></a>01488 cpl_propertylist_delete(tmp_sub_header);
-<a name="l01489"></a>01489 tmp_sub_header = NULL;
-<a name="l01490"></a>01490
+<a name="l01465"></a>01465 <span class="keywordtype">char</span> *ggg = cpl_sprintf(<span class="stringliteral">"%s%d"</span>, PRO_STD, ifu_nr);
+<a name="l01466"></a>01466 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01467"></a>01467 cpl_propertylist_update_int(main_header_tel, ggg, 1));
+<a name="l01468"></a>01468 cpl_free(ggg); ggg = NULL;
+<a name="l01469"></a>01469
+<a name="l01470"></a>01470 <span class="comment">// calculate WCS and make copies of sub_header</span>
+<a name="l01471"></a>01471 KMO_TRY_EXIT_IF_NULL(
+<a name="l01472"></a>01472 tmp_sub_header = cpl_propertylist_duplicate(sub_header_orig));
+<a name="l01473"></a>01473 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01474"></a>01474 kmo_calc_wcs_gd(main_header_tel, tmp_sub_header, ifu_nr, gd));
+<a name="l01475"></a>01475 KMO_TRY_EXIT_IF_NULL(
+<a name="l01476"></a>01476 stored_sub_tel_data_headers[ifu_nr-1] =
+<a name="l01477"></a>01477 cpl_propertylist_duplicate(tmp_sub_header));
+<a name="l01478"></a>01478 KMO_TRY_EXIT_IF_NULL(
+<a name="l01479"></a>01479 stored_sub_psf_headers[ifu_nr-1] =
+<a name="l01480"></a>01480 cpl_propertylist_duplicate(tmp_sub_header));
+<a name="l01481"></a>01481 <span class="keywordflow">if</span> (save_cubes) {
+<a name="l01482"></a>01482 KMO_TRY_EXIT_IF_NULL(
+<a name="l01483"></a>01483 stored_sub_cube_data_headers[ifu_nr-1] =
+<a name="l01484"></a>01484 cpl_propertylist_duplicate(tmp_sub_header));
+<a name="l01485"></a>01485 }
+<a name="l01486"></a>01486 cpl_propertylist_delete(tmp_sub_header);
+<a name="l01487"></a>01487 tmp_sub_header = NULL;
+<a name="l01488"></a>01488
+<a name="l01489"></a>01489 <span class="comment">//</span>
+<a name="l01490"></a>01490 <span class="comment">// adjust telluric-headers: copy CRPIX3 to CRPIX1,</span>
<a name="l01491"></a>01491 <span class="comment">//</span>
-<a name="l01492"></a>01492 <span class="comment">// adjust telluric-headers: copy CRPIX3 to CRPIX1,</span>
-<a name="l01493"></a>01493 <span class="comment">//</span>
-<a name="l01494"></a>01494 cpl_propertylist_update_double(stored_sub_tel_data_headers[ifu_nr-1], CRVAL1,
-<a name="l01495"></a>01495 cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CRVAL3));
-<a name="l01496"></a>01496 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CRVAL2);
-<a name="l01497"></a>01497 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CRVAL3);
-<a name="l01498"></a>01498 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01499"></a>01499
-<a name="l01500"></a>01500 <span class="comment">// CRPIX</span>
-<a name="l01501"></a>01501 cpl_propertylist_update_double(stored_sub_tel_data_headers[ifu_nr-1], CRPIX1,
-<a name="l01502"></a>01502 cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CRPIX3));
-<a name="l01503"></a>01503 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CRPIX2);
-<a name="l01504"></a>01504 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CRPIX3);
-<a name="l01505"></a>01505 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01506"></a>01506
-<a name="l01507"></a>01507 <span class="comment">// CDELT</span>
-<a name="l01508"></a>01508 cdelt3 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CDELT3);
-<a name="l01509"></a>01509 cpl_propertylist_update_double(stored_sub_tel_data_headers[ifu_nr-1], CDELT1,
-<a name="l01510"></a>01510 cdelt3);
-<a name="l01511"></a>01511 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CDELT2);
-<a name="l01512"></a>01512 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CDELT3);
-<a name="l01513"></a>01513 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01514"></a>01514
-<a name="l01515"></a>01515 <span class="comment">// CTYPE</span>
-<a name="l01516"></a>01516 cpl_propertylist_update_string(stored_sub_tel_data_headers[ifu_nr-1], CTYPE1,
-<a name="l01517"></a>01517 cpl_propertylist_get_string(stored_sub_tel_data_headers[ifu_nr-1], CTYPE3));
-<a name="l01518"></a>01518 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CTYPE2);
-<a name="l01519"></a>01519 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CTYPE3);
-<a name="l01520"></a>01520 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01521"></a>01521
-<a name="l01522"></a>01522 <span class="comment">// CUNIT</span>
-<a name="l01523"></a>01523 cpl_propertylist_update_string(stored_sub_tel_data_headers[ifu_nr-1], CUNIT1,
-<a name="l01524"></a>01524 cpl_propertylist_get_string(stored_sub_tel_data_headers[ifu_nr-1], CUNIT3));
-<a name="l01525"></a>01525 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CUNIT2);
-<a name="l01526"></a>01526 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CUNIT3);
-<a name="l01527"></a>01527
-<a name="l01528"></a>01528 <span class="comment">// CDx_x</span>
-<a name="l01529"></a>01529 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD1_1);
-<a name="l01530"></a>01530 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD1_2);
-<a name="l01531"></a>01531 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD1_3);
-<a name="l01532"></a>01532 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD2_1);
-<a name="l01533"></a>01533 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD2_2);
-<a name="l01534"></a>01534 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD2_3);
-<a name="l01535"></a>01535 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD3_1);
-<a name="l01536"></a>01536 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD3_2);
-<a name="l01537"></a>01537 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD3_3);
-<a name="l01538"></a>01538 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01539"></a>01539
+<a name="l01492"></a>01492 cpl_propertylist_update_double(stored_sub_tel_data_headers[ifu_nr-1], CRVAL1,
+<a name="l01493"></a>01493 cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CRVAL3));
+<a name="l01494"></a>01494 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CRVAL2);
+<a name="l01495"></a>01495 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CRVAL3);
+<a name="l01496"></a>01496 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01497"></a>01497
+<a name="l01498"></a>01498 <span class="comment">// CRPIX</span>
+<a name="l01499"></a>01499 cpl_propertylist_update_double(stored_sub_tel_data_headers[ifu_nr-1], CRPIX1,
+<a name="l01500"></a>01500 cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CRPIX3));
+<a name="l01501"></a>01501 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CRPIX2);
+<a name="l01502"></a>01502 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CRPIX3);
+<a name="l01503"></a>01503 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01504"></a>01504
+<a name="l01505"></a>01505 <span class="comment">// CDELT</span>
+<a name="l01506"></a>01506 cdelt3 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CDELT3);
+<a name="l01507"></a>01507 cpl_propertylist_update_double(stored_sub_tel_data_headers[ifu_nr-1], CDELT1,
+<a name="l01508"></a>01508 cdelt3);
+<a name="l01509"></a>01509 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CDELT2);
+<a name="l01510"></a>01510 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CDELT3);
+<a name="l01511"></a>01511 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01512"></a>01512
+<a name="l01513"></a>01513 <span class="comment">// CTYPE</span>
+<a name="l01514"></a>01514 cpl_propertylist_update_string(stored_sub_tel_data_headers[ifu_nr-1], CTYPE1,
+<a name="l01515"></a>01515 cpl_propertylist_get_string(stored_sub_tel_data_headers[ifu_nr-1], CTYPE3));
+<a name="l01516"></a>01516 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CTYPE2);
+<a name="l01517"></a>01517 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CTYPE3);
+<a name="l01518"></a>01518 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01519"></a>01519
+<a name="l01520"></a>01520 <span class="comment">// CUNIT</span>
+<a name="l01521"></a>01521 cpl_propertylist_update_string(stored_sub_tel_data_headers[ifu_nr-1], CUNIT1,
+<a name="l01522"></a>01522 cpl_propertylist_get_string(stored_sub_tel_data_headers[ifu_nr-1], CUNIT3));
+<a name="l01523"></a>01523 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CUNIT2);
+<a name="l01524"></a>01524 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CUNIT3);
+<a name="l01525"></a>01525
+<a name="l01526"></a>01526 <span class="comment">// CDx_x</span>
+<a name="l01527"></a>01527 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD1_1);
+<a name="l01528"></a>01528 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD1_2);
+<a name="l01529"></a>01529 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD1_3);
+<a name="l01530"></a>01530 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD2_1);
+<a name="l01531"></a>01531 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD2_2);
+<a name="l01532"></a>01532 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD2_3);
+<a name="l01533"></a>01533 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD3_1);
+<a name="l01534"></a>01534 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD3_2);
+<a name="l01535"></a>01535 cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CD3_3);
+<a name="l01536"></a>01536 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01537"></a>01537
+<a name="l01538"></a>01538 <span class="comment">//</span>
+<a name="l01539"></a>01539 <span class="comment">// adjust psf-headers: delete CRPIX3 etc.</span>
<a name="l01540"></a>01540 <span class="comment">//</span>
-<a name="l01541"></a>01541 <span class="comment">// adjust psf-headers: delete CRPIX3 etc.</span>
-<a name="l01542"></a>01542 <span class="comment">//</span>
-<a name="l01543"></a>01543 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CRPIX3);
-<a name="l01544"></a>01544 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CRPIX3);
-<a name="l01545"></a>01545 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CDELT3);
-<a name="l01546"></a>01546 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CRVAL3);
-<a name="l01547"></a>01547 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CTYPE3);
-<a name="l01548"></a>01548 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CUNIT3);
-<a name="l01549"></a>01549 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CD1_3);
-<a name="l01550"></a>01550 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CD2_3);
-<a name="l01551"></a>01551 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CD3_1);
-<a name="l01552"></a>01552 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CD3_2);
-<a name="l01553"></a>01553 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CD3_3);
-<a name="l01554"></a>01554 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01555"></a>01555
-<a name="l01556"></a>01556 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01557"></a>01557 kmo_reconstruct_sci(ifu_nr,
-<a name="l01558"></a>01558 bounds[2*(ifu_nr-1)],
-<a name="l01559"></a>01559 bounds[2*(ifu_nr-1)+1],
-<a name="l01560"></a>01560 obj_frame,
+<a name="l01541"></a>01541 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CRPIX3);
+<a name="l01542"></a>01542 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CRPIX3);
+<a name="l01543"></a>01543 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CDELT3);
+<a name="l01544"></a>01544 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CRVAL3);
+<a name="l01545"></a>01545 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CTYPE3);
+<a name="l01546"></a>01546 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CUNIT3);
+<a name="l01547"></a>01547 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CD1_3);
+<a name="l01548"></a>01548 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CD2_3);
+<a name="l01549"></a>01549 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CD3_1);
+<a name="l01550"></a>01550 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CD3_2);
+<a name="l01551"></a>01551 cpl_propertylist_erase(stored_sub_psf_headers[ifu_nr-1], CD3_3);
+<a name="l01552"></a>01552 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01553"></a>01553
+<a name="l01554"></a>01554 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01555"></a>01555 kmo_reconstruct_sci(ifu_nr,
+<a name="l01556"></a>01556 bounds[2*(ifu_nr-1)],
+<a name="l01557"></a>01557 bounds[2*(ifu_nr-1)+1],
+<a name="l01558"></a>01558 obj_frame,
+<a name="l01559"></a>01559 STD,
+<a name="l01560"></a>01560 sky_frame,
<a name="l01561"></a>01561 STD,
-<a name="l01562"></a>01562 sky_frame,
-<a name="l01563"></a>01563 STD,
-<a name="l01564"></a>01564 flat_frame,
-<a name="l01565"></a>01565 xcal_frame,
-<a name="l01566"></a>01566 ycal_frame,
-<a name="l01567"></a>01567 lcal_frame,
-<a name="l01568"></a>01568 NULL,
-<a name="l01569"></a>01569 &gd,
-<a name="l01570"></a>01570 &stored_data_cube[ifu_nr-1],
-<a name="l01571"></a>01571 &stored_noise_cube[ifu_nr-1],
-<a name="l01572"></a>01572 flux,
-<a name="l01573"></a>01573 background,
-<a name="l01574"></a>01574 xcal_interpolation));
-<a name="l01575"></a>01575
-<a name="l01576"></a>01576 <span class="comment">// divide illumination correction from the data_cube</span>
-<a name="l01577"></a>01577 <span class="comment">// (illumination noise will be very small versus</span>
-<a name="l01578"></a>01578 <span class="comment">// noise_cube, so it is skipped here)</span>
-<a name="l01579"></a>01579 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, ILLUM_CORR) == 1) {
-<a name="l01580"></a>01580 KMO_TRY_EXIT_IF_NULL(
-<a name="l01581"></a>01581 illum_corr = kmo_dfs_load_image_frame(illum_frame, ifu_nr,
-<a name="l01582"></a>01582 FALSE, FALSE, NULL));
-<a name="l01583"></a>01583 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01584"></a>01584 cpl_imagelist_divide_image(stored_data_cube[ifu_nr-1], illum_corr));
-<a name="l01585"></a>01585 cpl_image_delete(illum_corr); illum_corr = NULL;
-<a name="l01586"></a>01586 }
-<a name="l01587"></a>01587
-<a name="l01588"></a>01588 <span class="comment">// calculate QC_STD_TRACE</span>
-<a name="l01589"></a>01589 <span class="comment">// (the distance of the PSF to the centre)</span>
-<a name="l01590"></a>01590 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01591"></a>01591 kmo_calculate_std_trace(stored_data_cube[ifu_nr-1], fmethod, &std_trace));
-<a name="l01592"></a>01592
-<a name="l01593"></a>01593 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01594"></a>01594 kmclipm_update_property_double(stored_sub_psf_headers[ifu_nr-1],
-<a name="l01595"></a>01595 QC_STD_TRACE, std_trace,
-<a name="l01596"></a>01596 <span class="stringliteral">"[pix] distance of PSF and centre of IFU"</span>));
-<a name="l01597"></a>01597
-<a name="l01598"></a>01598 KMO_TRY_EXIT_IF_NULL(
-<a name="l01599"></a>01599 identified_slices = cpl_vector_new(cpl_imagelist_get_size(stored_data_cube[ifu_nr-1])));
-<a name="l01600"></a>01600 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01601"></a>01601 cpl_vector_fill(identified_slices, 1.0));
-<a name="l01602"></a>01602
-<a name="l01603"></a>01603 <span class="comment">// collapse cube and get PSF image</span>
-<a name="l01604"></a>01604 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01605"></a>01605 kmclipm_make_image(stored_data_cube[ifu_nr-1], NULL,
-<a name="l01606"></a>01606 &stored_psf_data[ifu_nr-1], NULL,
-<a name="l01607"></a>01607 identified_slices,
-<a name="l01608"></a>01608 cmethod,
-<a name="l01609"></a>01609 cpos_rej, cneg_rej, citer,
-<a name="l01610"></a>01610 cmax, cmin));
-<a name="l01611"></a>01611 cpl_vector_delete(identified_slices);
-<a name="l01612"></a>01612 identified_slices= NULL;
-<a name="l01613"></a>01613
-<a name="l01614"></a>01614 <span class="comment">// fit a 2D profile to get a mask and fwhm in x and y,</span>
-<a name="l01615"></a>01615 KMO_TRY_EXIT_IF_NULL(
-<a name="l01616"></a>01616 tmp_vec = kmo_fit_profile_2D(stored_psf_data[ifu_nr-1],
-<a name="l01617"></a>01617 NULL,
-<a name="l01618"></a>01618 fmethod,
-<a name="l01619"></a>01619 &stored_mask[ifu_nr-1],
-<a name="l01620"></a>01620 &pl_psf));
-<a name="l01621"></a>01621
-<a name="l01622"></a>01622 <span class="comment">// normalise mask to 1 and clip values below 0.5</span>
-<a name="l01623"></a>01623 cpl_image_divide_scalar(stored_mask[ifu_nr-1], cpl_image_get_max(stored_mask[ifu_nr-1]));
-<a name="l01624"></a>01624 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01625"></a>01625
-<a name="l01626"></a>01626 <span class="keywordtype">int</span> dummy=0;
-<a name="l01627"></a>01627 <span class="keywordflow">for</span> (gx = 1; gx <= cpl_image_get_size_x(stored_mask[ifu_nr-1]); gx++) {
-<a name="l01628"></a>01628 <span class="keywordflow">for</span> (gy = 1; gy <= cpl_image_get_size_y(stored_mask[ifu_nr-1]); gy++) {
-<a name="l01629"></a>01629 <span class="keywordflow">if</span> (cpl_image_get(stored_mask[ifu_nr-1], gx, gy, &dummy) < 0.5) {
-<a name="l01630"></a>01630 cpl_image_set(stored_mask[ifu_nr-1], gx, gy, 0.);
-<a name="l01631"></a>01631 } <span class="keywordflow">else</span> {
-<a name="l01632"></a>01632 cpl_image_set(stored_mask[ifu_nr-1], gx, gy, 1.);
-<a name="l01633"></a>01633 }
-<a name="l01634"></a>01634 }
-<a name="l01635"></a>01635 }
-<a name="l01636"></a>01636 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01637"></a>01637
-<a name="l01638"></a>01638 <span class="comment">// update subheader with fit parameters</span>
-<a name="l01639"></a>01639 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01640"></a>01640 cpl_propertylist_append(stored_sub_tel_data_headers[ifu_nr-1], pl_psf));
-<a name="l01641"></a>01641 cpl_propertylist_delete(pl_psf); pl_psf = NULL;
-<a name="l01642"></a>01642
-<a name="l01643"></a>01643 <span class="comment">// store QC_SPAT_RES (RMS of fwhm_x and fwhm_y)</span>
-<a name="l01644"></a>01644 <span class="keywordtype">double</span> factor_fwhm = 2*sqrt(2*log(2));
-<a name="l01645"></a>01645 <span class="keywordtype">double</span> spat_res = pow(cpl_vector_get(tmp_vec, 4) * factor_fwhm, 2);
-<a name="l01646"></a>01646 spat_res += pow(cpl_vector_get(tmp_vec, 5) * factor_fwhm, 2);
-<a name="l01647"></a>01647 spat_res /= 2;
-<a name="l01648"></a>01648 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01649"></a>01649 kmclipm_update_property_double(stored_sub_psf_headers[ifu_nr-1],
-<a name="l01650"></a>01650 QC_SPAT_RES,
-<a name="l01651"></a>01651 sqrt(spat_res)*KMOS_PIX_RESOLUTION,
-<a name="l01652"></a>01652 <span class="stringliteral">"[arcsec] mean fwhm resolution of PSF"</span>));
-<a name="l01653"></a>01653 cpl_vector_delete(tmp_vec); tmp_vec = NULL;
-<a name="l01654"></a>01654
-<a name="l01655"></a>01655 <span class="comment">// extract spectrum in masked area</span>
-<a name="l01656"></a>01656 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01657"></a>01657 kmo_priv_extract_spec(stored_data_cube[ifu_nr-1],
-<a name="l01658"></a>01658 stored_noise_cube[ifu_nr-1],
-<a name="l01659"></a>01659 stored_mask[ifu_nr-1],
-<a name="l01660"></a>01660 &tmp_spec_data,
-<a name="l01661"></a>01661 &tmp_spec_noise));
-<a name="l01662"></a>01662
-<a name="l01663"></a>01663 <span class="comment">// store to save to disk later on</span>
-<a name="l01664"></a>01664 stored_starspec_data[ifu_nr-1] = cpl_vector_duplicate(tmp_spec_data);
-<a name="l01665"></a>01665 <span class="keywordflow">if</span> (tmp_spec_noise != NULL) {
-<a name="l01666"></a>01666 stored_starspec_noise[ifu_nr-1] = cpl_vector_duplicate(tmp_spec_noise);
-<a name="l01667"></a>01667 }
-<a name="l01668"></a>01668 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01669"></a>01669
-<a name="l01670"></a>01670 <span class="comment">// if magnitude is provided</span>
-<a name="l01671"></a>01671 <span class="comment">// calculate zeropoint and throughput</span>
-<a name="l01672"></a>01672 <span class="keywordflow">if</span> (has_magnitude) {
-<a name="l01673"></a>01673 <span class="comment">// extract spectrum of whole are for QC THRUHput and ZEROPOINT</span>
-<a name="l01674"></a>01674 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01675"></a>01675 kmo_priv_extract_spec(stored_data_cube[ifu_nr-1],
-<a name="l01676"></a>01676 NULL,
-<a name="l01677"></a>01677 NULL,
-<a name="l01678"></a>01678 &spec_qc,
-<a name="l01679"></a>01679 NULL));
-<a name="l01680"></a>01680
-<a name="l01681"></a>01681 <span class="comment">// multiply spectrum with area of IFU (196) to get the sum</span>
-<a name="l01682"></a>01682 <span class="keyword">const</span> cpl_image *tmp_img = cpl_imagelist_get(stored_data_cube[ifu_nr-1], 0);
-<a name="l01683"></a>01683 <span class="keywordtype">int</span> tmpx = cpl_image_get_size_x(tmp_img),
-<a name="l01684"></a>01684 tmpy = cpl_image_get_size_x(tmp_img);
-<a name="l01685"></a>01685 cpl_vector_multiply_scalar(spec_qc, tmpx*tmpy);
-<a name="l01686"></a>01686 }
-<a name="l01687"></a>01687
-<a name="l01688"></a>01688 <span class="comment">// calculate abscissa of output spectrum</span>
-<a name="l01689"></a>01689 KMO_TRY_EXIT_IF_NULL(
-<a name="l01690"></a>01690 lambda_x = kmo_create_lambda_vec(gd.l.dim, 1,
-<a name="l01691"></a>01691 gd.l.start,
-<a name="l01692"></a>01692 gd.l.delta));
+<a name="l01562"></a>01562 flat_frame,
+<a name="l01563"></a>01563 xcal_frame,
+<a name="l01564"></a>01564 ycal_frame,
+<a name="l01565"></a>01565 lcal_frame,
+<a name="l01566"></a>01566 NULL,
+<a name="l01567"></a>01567 &gd,
+<a name="l01568"></a>01568 &stored_data_cube[ifu_nr-1],
+<a name="l01569"></a>01569 &stored_noise_cube[ifu_nr-1],
+<a name="l01570"></a>01570 flux,
+<a name="l01571"></a>01571 background,
+<a name="l01572"></a>01572 xcal_interpolation));
+<a name="l01573"></a>01573
+<a name="l01574"></a>01574 <span class="comment">// divide illumination correction from the data_cube</span>
+<a name="l01575"></a>01575 <span class="comment">// (illumination noise will be very small versus</span>
+<a name="l01576"></a>01576 <span class="comment">// noise_cube, so it is skipped here)</span>
+<a name="l01577"></a>01577 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, ILLUM_CORR) == 1) {
+<a name="l01578"></a>01578 KMO_TRY_EXIT_IF_NULL(
+<a name="l01579"></a>01579 illum_corr = kmo_dfs_load_image_frame(illum_frame, ifu_nr,
+<a name="l01580"></a>01580 FALSE, FALSE, NULL));
+<a name="l01581"></a>01581 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01582"></a>01582 cpl_imagelist_divide_image(stored_data_cube[ifu_nr-1], illum_corr));
+<a name="l01583"></a>01583 cpl_image_delete(illum_corr); illum_corr = NULL;
+<a name="l01584"></a>01584 }
+<a name="l01585"></a>01585
+<a name="l01586"></a>01586 <span class="comment">// calculate QC_STD_TRACE</span>
+<a name="l01587"></a>01587 <span class="comment">// (the distance of the PSF to the centre)</span>
+<a name="l01588"></a>01588 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01589"></a>01589 kmo_calculate_std_trace(stored_data_cube[ifu_nr-1], fmethod, &std_trace));
+<a name="l01590"></a>01590
+<a name="l01591"></a>01591 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01592"></a>01592 kmclipm_update_property_double(stored_sub_psf_headers[ifu_nr-1],
+<a name="l01593"></a>01593 QC_STD_TRACE, std_trace,
+<a name="l01594"></a>01594 <span class="stringliteral">"[pix] distance of PSF and centre of IFU"</span>));
+<a name="l01595"></a>01595
+<a name="l01596"></a>01596 KMO_TRY_EXIT_IF_NULL(
+<a name="l01597"></a>01597 identified_slices = cpl_vector_new(cpl_imagelist_get_size(stored_data_cube[ifu_nr-1])));
+<a name="l01598"></a>01598 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01599"></a>01599 cpl_vector_fill(identified_slices, 1.0));
+<a name="l01600"></a>01600
+<a name="l01601"></a>01601 <span class="comment">// collapse cube and get PSF image</span>
+<a name="l01602"></a>01602 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01603"></a>01603 kmclipm_make_image(stored_data_cube[ifu_nr-1], NULL,
+<a name="l01604"></a>01604 &stored_psf_data[ifu_nr-1], NULL,
+<a name="l01605"></a>01605 identified_slices,
+<a name="l01606"></a>01606 cmethod,
+<a name="l01607"></a>01607 cpos_rej, cneg_rej, citer,
+<a name="l01608"></a>01608 cmax, cmin));
+<a name="l01609"></a>01609 cpl_vector_delete(identified_slices);
+<a name="l01610"></a>01610 identified_slices= NULL;
+<a name="l01611"></a>01611
+<a name="l01612"></a>01612 <span class="comment">// fit a 2D profile to get a mask and fwhm in x and y,</span>
+<a name="l01613"></a>01613 KMO_TRY_EXIT_IF_NULL(
+<a name="l01614"></a>01614 tmp_vec = kmo_fit_profile_2D(stored_psf_data[ifu_nr-1],
+<a name="l01615"></a>01615 NULL,
+<a name="l01616"></a>01616 fmethod,
+<a name="l01617"></a>01617 &stored_mask[ifu_nr-1],
+<a name="l01618"></a>01618 &pl_psf));
+<a name="l01619"></a>01619
+<a name="l01620"></a>01620 <span class="comment">// normalise mask to 1 and clip values below 0.5</span>
+<a name="l01621"></a>01621 cpl_image_divide_scalar(stored_mask[ifu_nr-1], cpl_image_get_max(stored_mask[ifu_nr-1]));
+<a name="l01622"></a>01622 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01623"></a>01623
+<a name="l01624"></a>01624 <span class="keywordtype">int</span> dummy=0;
+<a name="l01625"></a>01625 <span class="keywordflow">for</span> (gx = 1; gx <= cpl_image_get_size_x(stored_mask[ifu_nr-1]); gx++) {
+<a name="l01626"></a>01626 <span class="keywordflow">for</span> (gy = 1; gy <= cpl_image_get_size_y(stored_mask[ifu_nr-1]); gy++) {
+<a name="l01627"></a>01627 <span class="keywordflow">if</span> (cpl_image_get(stored_mask[ifu_nr-1], gx, gy, &dummy) < 0.5) {
+<a name="l01628"></a>01628 cpl_image_set(stored_mask[ifu_nr-1], gx, gy, 0.);
+<a name="l01629"></a>01629 } <span class="keywordflow">else</span> {
+<a name="l01630"></a>01630 cpl_image_set(stored_mask[ifu_nr-1], gx, gy, 1.);
+<a name="l01631"></a>01631 }
+<a name="l01632"></a>01632 }
+<a name="l01633"></a>01633 }
+<a name="l01634"></a>01634 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01635"></a>01635
+<a name="l01636"></a>01636 <span class="comment">// update subheader with fit parameters</span>
+<a name="l01637"></a>01637 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01638"></a>01638 cpl_propertylist_append(stored_sub_tel_data_headers[ifu_nr-1], pl_psf));
+<a name="l01639"></a>01639 cpl_propertylist_delete(pl_psf); pl_psf = NULL;
+<a name="l01640"></a>01640
+<a name="l01641"></a>01641 <span class="comment">// store QC_SPAT_RES (RMS of fwhm_x and fwhm_y)</span>
+<a name="l01642"></a>01642 <span class="keywordtype">double</span> factor_fwhm = 2*sqrt(2*log(2));
+<a name="l01643"></a>01643 <span class="keywordtype">double</span> spat_res = pow(cpl_vector_get(tmp_vec, 4) * factor_fwhm, 2);
+<a name="l01644"></a>01644 spat_res += pow(cpl_vector_get(tmp_vec, 5) * factor_fwhm, 2);
+<a name="l01645"></a>01645 spat_res /= 2;
+<a name="l01646"></a>01646 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01647"></a>01647 kmclipm_update_property_double(stored_sub_psf_headers[ifu_nr-1],
+<a name="l01648"></a>01648 QC_SPAT_RES,
+<a name="l01649"></a>01649 sqrt(spat_res)*KMOS_PIX_RESOLUTION,
+<a name="l01650"></a>01650 <span class="stringliteral">"[arcsec] mean fwhm resolution of PSF"</span>));
+<a name="l01651"></a>01651 cpl_vector_delete(tmp_vec); tmp_vec = NULL;
+<a name="l01652"></a>01652
+<a name="l01653"></a>01653 <span class="comment">// extract spectrum in masked area</span>
+<a name="l01654"></a>01654 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01655"></a>01655 kmo_priv_extract_spec(stored_data_cube[ifu_nr-1],
+<a name="l01656"></a>01656 stored_noise_cube[ifu_nr-1],
+<a name="l01657"></a>01657 stored_mask[ifu_nr-1],
+<a name="l01658"></a>01658 &tmp_spec_data,
+<a name="l01659"></a>01659 &tmp_spec_noise));
+<a name="l01660"></a>01660
+<a name="l01661"></a>01661 <span class="comment">// store to save to disk later on</span>
+<a name="l01662"></a>01662 stored_starspec_data[ifu_nr-1] = cpl_vector_duplicate(tmp_spec_data);
+<a name="l01663"></a>01663 <span class="keywordflow">if</span> (tmp_spec_noise != NULL) {
+<a name="l01664"></a>01664 stored_starspec_noise[ifu_nr-1] = cpl_vector_duplicate(tmp_spec_noise);
+<a name="l01665"></a>01665 }
+<a name="l01666"></a>01666 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01667"></a>01667
+<a name="l01668"></a>01668 <span class="comment">// if magnitude is provided</span>
+<a name="l01669"></a>01669 <span class="comment">// calculate zeropoint and throughput</span>
+<a name="l01670"></a>01670 <span class="keywordflow">if</span> (has_magnitude) {
+<a name="l01671"></a>01671 <span class="comment">// extract spectrum of whole are for QC THRUHput and ZEROPOINT</span>
+<a name="l01672"></a>01672 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01673"></a>01673 kmo_priv_extract_spec(stored_data_cube[ifu_nr-1],
+<a name="l01674"></a>01674 NULL,
+<a name="l01675"></a>01675 NULL,
+<a name="l01676"></a>01676 &spec_qc,
+<a name="l01677"></a>01677 NULL));
+<a name="l01678"></a>01678
+<a name="l01679"></a>01679 <span class="comment">// multiply spectrum with area of IFU (196) to get the sum</span>
+<a name="l01680"></a>01680 <span class="keyword">const</span> cpl_image *tmp_img = cpl_imagelist_get(stored_data_cube[ifu_nr-1], 0);
+<a name="l01681"></a>01681 <span class="keywordtype">int</span> tmpx = cpl_image_get_size_x(tmp_img),
+<a name="l01682"></a>01682 tmpy = cpl_image_get_size_x(tmp_img);
+<a name="l01683"></a>01683 cpl_vector_multiply_scalar(spec_qc, tmpx*tmpy);
+<a name="l01684"></a>01684 }
+<a name="l01685"></a>01685
+<a name="l01686"></a>01686 <span class="comment">// calculate abscissa of output spectrum</span>
+<a name="l01687"></a>01687 KMO_TRY_EXIT_IF_NULL(
+<a name="l01688"></a>01688 lambda_x = kmo_create_lambda_vec(gd.l.dim, 1,
+<a name="l01689"></a>01689 gd.l.start,
+<a name="l01690"></a>01690 gd.l.delta));
+<a name="l01691"></a>01691 <span class="comment">//</span>
+<a name="l01692"></a>01692 <span class="comment">// spectrum correction</span>
<a name="l01693"></a>01693 <span class="comment">//</span>
-<a name="l01694"></a>01694 <span class="comment">// spectrum correction</span>
-<a name="l01695"></a>01695 <span class="comment">//</span>
-<a name="l01696"></a>01696 <span class="keywordflow">if</span> ((strcmp(star_type, <span class="stringliteral">"O"</span>) == 0) ||
-<a name="l01697"></a>01697 (strcmp(star_type, <span class="stringliteral">"B"</span>) == 0) ||
-<a name="l01698"></a>01698 (strcmp(star_type, <span class="stringliteral">"A"</span>) == 0) ||
-<a name="l01699"></a>01699 (strcmp(star_type, <span class="stringliteral">"F"</span>) == 0))
-<a name="l01700"></a>01700 {
-<a name="l01701"></a>01701 <span class="comment">// we have a OBAF star</span>
-<a name="l01702"></a>01702
-<a name="l01703"></a>01703 <span class="comment">// if ATMOS_MODEL is present, lines will be removed</span>
-<a name="l01704"></a>01704 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, ATMOS_MODEL) == 1) {
-<a name="l01705"></a>01705 <span class="comment">// interpolate ATMOS_MODEL to same scale as data</span>
-<a name="l01706"></a>01706 KMO_TRY_EXIT_IF_NULL(
-<a name="l01707"></a>01707 tmp_frame = kmo_dfs_get_frame(frameset, ATMOS_MODEL));
-<a name="l01708"></a>01708
-<a name="l01709"></a>01709 KMO_TRY_EXIT_IF_NULL(
-<a name="l01710"></a>01710 atmos_model = kmo_interpolate_vector_wcs(tmp_frame, lambda_x));
-<a name="l01711"></a>01711 cpl_vector *tmp_spec_data_orig = NULL;
-<a name="l01712"></a>01712 <span class="keywordtype">int</span> plot_it = 0;
-<a name="l01713"></a>01713 <span class="keywordflow">if</span> (plot_it) {
-<a name="l01714"></a>01714 <span class="comment">// store original spectrum</span>
-<a name="l01715"></a>01715 KMO_TRY_EXIT_IF_NULL(
-<a name="l01716"></a>01716 tmp_spec_data_orig = cpl_vector_duplicate(tmp_spec_data));
-<a name="l01717"></a>01717 }
-<a name="l01718"></a>01718 <span class="comment">// remove band-specific lines</span>
-<a name="l01719"></a>01719 <span class="keywordflow">if</span> (strcmp(filter_id, <span class="stringliteral">"H"</span>) == 0) {
-<a name="l01720"></a>01720 <span class="keywordflow">for</span> (l = 0; l < nr_lines_h; l++) {
-<a name="l01721"></a>01721 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01722"></a>01722 kmo_remove_line(tmp_spec_data, lambda_x, atmos_model, lines_center_h[l], lines_width_h[l]));
-<a name="l01723"></a>01723 }
-<a name="l01724"></a>01724 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter_id, <span class="stringliteral">"HK"</span>) == 0) {
-<a name="l01725"></a>01725 <span class="keywordflow">for</span> (l = 0; l < nr_lines_hk; l++) {
-<a name="l01726"></a>01726 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01727"></a>01727 kmo_remove_line(tmp_spec_data, lambda_x, atmos_model, lines_center_hk[l], lines_width_hk[l]));
-<a name="l01728"></a>01728 }
-<a name="l01729"></a>01729 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter_id, <span class="stringliteral">"K"</span>) == 0) {
-<a name="l01730"></a>01730 <span class="keywordflow">for</span> (l = 0; l < nr_lines_k; l++) {
-<a name="l01731"></a>01731 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01732"></a>01732 kmo_remove_line(tmp_spec_data, lambda_x, atmos_model, lines_center_k[l], lines_width_k[l]));
-<a name="l01733"></a>01733 }
-<a name="l01734"></a>01734 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter_id, <span class="stringliteral">"IZ"</span>) == 0) {
-<a name="l01735"></a>01735 <span class="keywordflow">for</span> (l = 0; l < nr_lines_iz; l++) {
-<a name="l01736"></a>01736 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01737"></a>01737 kmo_remove_line(tmp_spec_data, lambda_x, atmos_model, lines_center_iz[l], lines_width_iz[l]));
-<a name="l01738"></a>01738 }
-<a name="l01739"></a>01739 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter_id, <span class="stringliteral">"YJ"</span>) == 0) {
-<a name="l01740"></a>01740 <span class="keywordflow">for</span> (l = 0; l < nr_lines_yj; l++) {
-<a name="l01741"></a>01741 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01742"></a>01742 kmo_remove_line(tmp_spec_data, lambda_x, atmos_model, lines_center_yj[l], lines_width_yj[l]));
-<a name="l01743"></a>01743 }
-<a name="l01744"></a>01744 }
-<a name="l01745"></a>01745 <span class="keywordflow">if</span> (plot_it) {
-<a name="l01746"></a>01746 cpl_vector *tmp_spec_data_atmo = NULL;
-<a name="l01747"></a>01747 cpl_vector *tmp_spec_data_new = NULL;
+<a name="l01694"></a>01694 <span class="keywordflow">if</span> ((strcmp(star_type, <span class="stringliteral">"O"</span>) == 0) ||
+<a name="l01695"></a>01695 (strcmp(star_type, <span class="stringliteral">"B"</span>) == 0) ||
+<a name="l01696"></a>01696 (strcmp(star_type, <span class="stringliteral">"A"</span>) == 0) ||
+<a name="l01697"></a>01697 (strcmp(star_type, <span class="stringliteral">"F"</span>) == 0))
+<a name="l01698"></a>01698 {
+<a name="l01699"></a>01699 <span class="comment">// we have a OBAF star</span>
+<a name="l01700"></a>01700
+<a name="l01701"></a>01701 <span class="comment">// if ATMOS_MODEL is present, lines will be removed</span>
+<a name="l01702"></a>01702 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, ATMOS_MODEL) == 1) {
+<a name="l01703"></a>01703 <span class="comment">// interpolate ATMOS_MODEL to same scale as data</span>
+<a name="l01704"></a>01704 KMO_TRY_EXIT_IF_NULL(
+<a name="l01705"></a>01705 tmp_frame = kmo_dfs_get_frame(frameset, ATMOS_MODEL));
+<a name="l01706"></a>01706
+<a name="l01707"></a>01707 KMO_TRY_EXIT_IF_NULL(
+<a name="l01708"></a>01708 atmos_model = kmo_interpolate_vector_wcs(tmp_frame, lambda_x));
+<a name="l01709"></a>01709 cpl_vector *tmp_spec_data_orig = NULL;
+<a name="l01710"></a>01710 <span class="keywordtype">int</span> plot_it = 0;
+<a name="l01711"></a>01711 <span class="keywordflow">if</span> (plot_it) {
+<a name="l01712"></a>01712 <span class="comment">// store original spectrum</span>
+<a name="l01713"></a>01713 KMO_TRY_EXIT_IF_NULL(
+<a name="l01714"></a>01714 tmp_spec_data_orig = cpl_vector_duplicate(tmp_spec_data));
+<a name="l01715"></a>01715 }
+<a name="l01716"></a>01716 <span class="comment">// remove band-specific lines</span>
+<a name="l01717"></a>01717 <span class="keywordflow">if</span> (strcmp(filter_id, <span class="stringliteral">"H"</span>) == 0) {
+<a name="l01718"></a>01718 <span class="keywordflow">for</span> (l = 0; l < nr_lines_h; l++) {
+<a name="l01719"></a>01719 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01720"></a>01720 kmo_remove_line(tmp_spec_data, lambda_x, atmos_model, lines_center_h[l], lines_width_h[l]));
+<a name="l01721"></a>01721 }
+<a name="l01722"></a>01722 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter_id, <span class="stringliteral">"HK"</span>) == 0) {
+<a name="l01723"></a>01723 <span class="keywordflow">for</span> (l = 0; l < nr_lines_hk; l++) {
+<a name="l01724"></a>01724 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01725"></a>01725 kmo_remove_line(tmp_spec_data, lambda_x, atmos_model, lines_center_hk[l], lines_width_hk[l]));
+<a name="l01726"></a>01726 }
+<a name="l01727"></a>01727 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter_id, <span class="stringliteral">"K"</span>) == 0) {
+<a name="l01728"></a>01728 <span class="keywordflow">for</span> (l = 0; l < nr_lines_k; l++) {
+<a name="l01729"></a>01729 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01730"></a>01730 kmo_remove_line(tmp_spec_data, lambda_x, atmos_model, lines_center_k[l], lines_width_k[l]));
+<a name="l01731"></a>01731 }
+<a name="l01732"></a>01732 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter_id, <span class="stringliteral">"IZ"</span>) == 0) {
+<a name="l01733"></a>01733 <span class="keywordflow">for</span> (l = 0; l < nr_lines_iz; l++) {
+<a name="l01734"></a>01734 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01735"></a>01735 kmo_remove_line(tmp_spec_data, lambda_x, atmos_model, lines_center_iz[l], lines_width_iz[l]));
+<a name="l01736"></a>01736 }
+<a name="l01737"></a>01737 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(filter_id, <span class="stringliteral">"YJ"</span>) == 0) {
+<a name="l01738"></a>01738 <span class="keywordflow">for</span> (l = 0; l < nr_lines_yj; l++) {
+<a name="l01739"></a>01739 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01740"></a>01740 kmo_remove_line(tmp_spec_data, lambda_x, atmos_model, lines_center_yj[l], lines_width_yj[l]));
+<a name="l01741"></a>01741 }
+<a name="l01742"></a>01742 }
+<a name="l01743"></a>01743 <span class="keywordflow">if</span> (plot_it) {
+<a name="l01744"></a>01744 cpl_vector *tmp_spec_data_atmo = NULL;
+<a name="l01745"></a>01745 cpl_vector *tmp_spec_data_new = NULL;
+<a name="l01746"></a>01746 KMO_TRY_EXIT_IF_NULL(
+<a name="l01747"></a>01747 tmp_spec_data_atmo = cpl_vector_duplicate(tmp_spec_data_orig));
<a name="l01748"></a>01748 KMO_TRY_EXIT_IF_NULL(
-<a name="l01749"></a>01749 tmp_spec_data_atmo = cpl_vector_duplicate(tmp_spec_data_orig));
-<a name="l01750"></a>01750 KMO_TRY_EXIT_IF_NULL(
-<a name="l01751"></a>01751 tmp_spec_data_new = cpl_vector_duplicate(tmp_spec_data));
-<a name="l01752"></a>01752 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01753"></a>01753 cpl_vector_divide(tmp_spec_data_atmo, atmos_model));
-<a name="l01754"></a>01754
-<a name="l01755"></a>01755 <span class="keywordtype">char</span> *sss = cpl_sprintf(<span class="stringliteral">"atmo_div_%s.fits"</span>, filter_id);
-<a name="l01756"></a>01756 <span class="keywordflow">if</span> (i == 1) {
-<a name="l01757"></a>01757 cpl_vector_save(tmp_spec_data_atmo, sss, CPL_BPP_IEEE_DOUBLE, stored_sub_tel_data_headers[ifu_nr-1], CPL_IO_CREATE);
-<a name="l01758"></a>01758 } <span class="keywordflow">else</span> {
-<a name="l01759"></a>01759 cpl_vector_save(tmp_spec_data_atmo, sss, CPL_BPP_IEEE_DOUBLE, stored_sub_tel_data_headers[ifu_nr-1], CPL_IO_EXTEND);
-<a name="l01760"></a>01760 }
-<a name="l01761"></a>01761
-<a name="l01762"></a>01762 cpl_vector *med_vec = cpl_vector_duplicate(tmp_spec_data_orig);
-<a name="l01763"></a>01763 <span class="keywordtype">double</span> median = cpl_vector_get_median(med_vec);
-<a name="l01764"></a>01764 cpl_vector_delete(med_vec);
-<a name="l01765"></a>01765 <span class="keywordtype">int</span> ii = 0;
-<a name="l01766"></a>01766 <span class="keywordflow">for</span> (ii = 0; ii < cpl_vector_get_size(tmp_spec_data_orig); ii++) {
-<a name="l01767"></a>01767 <span class="keywordflow">if</span> (cpl_vector_get(tmp_spec_data_orig, ii) < median/8)
-<a name="l01768"></a>01768 cpl_vector_set(tmp_spec_data_orig, ii, 0);
-<a name="l01769"></a>01769 <span class="keywordflow">if</span> (cpl_vector_get(tmp_spec_data_atmo, ii) < median/8)
-<a name="l01770"></a>01770 cpl_vector_set(tmp_spec_data_atmo, ii, 0);
-<a name="l01771"></a>01771 <span class="keywordflow">if</span> (cpl_vector_get(tmp_spec_data_new, ii) < median/8)
-<a name="l01772"></a>01772 cpl_vector_set(tmp_spec_data_new, ii, 0);
-<a name="l01773"></a>01773
-<a name="l01774"></a>01774 <span class="keywordflow">if</span> (cpl_vector_get(tmp_spec_data_orig, ii) > 3*median)
-<a name="l01775"></a>01775 cpl_vector_set(tmp_spec_data_orig, ii, 3*median);
-<a name="l01776"></a>01776 <span class="keywordflow">if</span> (cpl_vector_get(tmp_spec_data_atmo, ii) > 3*median)
-<a name="l01777"></a>01777 cpl_vector_set(tmp_spec_data_atmo, ii, 3*median);
-<a name="l01778"></a>01778 <span class="keywordflow">if</span> (cpl_vector_get(tmp_spec_data_new, ii) > 3*median)
-<a name="l01779"></a>01779 cpl_vector_set(tmp_spec_data_new, ii, 3*median);
-<a name="l01780"></a>01780 }
-<a name="l01781"></a>01781
-<a name="l01782"></a>01782 <span class="keywordtype">double</span> *pspec_dup = cpl_vector_get_data(tmp_spec_data_atmo);
-<a name="l01783"></a>01783 <span class="keywordflow">for</span> (ii = 0; ii < cpl_vector_get_size(tmp_spec_data_atmo); ii++) {
-<a name="l01784"></a>01784 <span class="keywordflow">if</span> (kmclipm_is_nan_or_inf(pspec_dup[ii])) {
-<a name="l01785"></a>01785 pspec_dup[ii] = 0.;
-<a name="l01786"></a>01786 }
-<a name="l01787"></a>01787 }
-<a name="l01788"></a>01788
-<a name="l01789"></a>01789 cpl_bivector *plots[3];
-<a name="l01790"></a>01790 plots[0] = cpl_bivector_wrap_vectors((cpl_vector*)lambda_x, tmp_spec_data_orig);
-<a name="l01791"></a>01791 plots[1] = cpl_bivector_wrap_vectors((cpl_vector*)lambda_x, tmp_spec_data_atmo);
-<a name="l01792"></a>01792 plots[2] = cpl_bivector_wrap_vectors((cpl_vector*)lambda_x, tmp_spec_data_new);
-<a name="l01793"></a>01793 <span class="keywordtype">char</span> *options[3] = {<span class="stringliteral">"w l t 'original'"</span>,
-<a name="l01794"></a>01794 <span class="stringliteral">"w l t 'atmo divided'"</span>,
-<a name="l01795"></a>01795 <span class="stringliteral">"w l t 'lines removed'"</span>};
-<a name="l01796"></a>01796 sss = cpl_sprintf(<span class="stringliteral">"set title '%s-band line removal (DET #%d)';"</span>, filter_id, i);
-<a name="l01797"></a>01797 cpl_plot_bivectors(sss,
-<a name="l01798"></a>01798 (<span class="keyword">const</span> <span class="keywordtype">char</span>**)options, <span class="stringliteral">""</span>, (<span class="keyword">const</span> cpl_bivector**)plots, 3);
-<a name="l01799"></a>01799 <span class="comment">// cpl_plot_bivectors("set title 'Spectrum with lines removed'; set xrange [2.14:2.19];",</span>
-<a name="l01800"></a>01800 <span class="comment">// (const char**)options, "", (const cpl_bivector**)plots, 2);</span>
-<a name="l01801"></a>01801 cpl_bivector_unwrap_vectors(plots[0]);
-<a name="l01802"></a>01802 cpl_bivector_unwrap_vectors(plots[1]);
-<a name="l01803"></a>01803 cpl_bivector_unwrap_vectors(plots[2]);
-<a name="l01804"></a>01804 cpl_free(sss); sss = NULL;
-<a name="l01805"></a>01805 cpl_vector_delete(tmp_spec_data_orig); tmp_spec_data_orig = NULL;
-<a name="l01806"></a>01806 cpl_vector_delete(tmp_spec_data_atmo); tmp_spec_data_atmo = NULL;
-<a name="l01807"></a>01807 cpl_vector_delete(tmp_spec_data_new); tmp_spec_data_new = NULL;
-<a name="l01808"></a>01808 }
-<a name="l01809"></a>01809 cpl_vector_delete(atmos_model); atmos_model = NULL;
-<a name="l01810"></a>01810 } <span class="keywordflow">else</span> {
-<a name="l01811"></a>01811 <span class="keywordflow">if</span> (line_warning == FALSE) {
-<a name="l01812"></a>01812 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"No atmospheric model (ATMOS_MODEL) provided! "</span>
-<a name="l01813"></a>01813 <span class="stringliteral">"Won't remove any lines."</span>);
-<a name="l01814"></a>01814 line_warning = TRUE;
-<a name="l01815"></a>01815 }
-<a name="l01816"></a>01816 }
-<a name="l01817"></a>01817 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(star_type, <span class="stringliteral">"G"</span>) == 0) {
-<a name="l01818"></a>01818 <span class="comment">// we have a G star</span>
-<a name="l01819"></a>01819 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, SOLAR_SPEC) == 1) {
-<a name="l01820"></a>01820 <span class="comment">// interpolate SOLAR_SPEC to same scale as data</span>
-<a name="l01821"></a>01821 <span class="comment">// and divide it</span>
-<a name="l01822"></a>01822 KMO_TRY_EXIT_IF_NULL(
-<a name="l01823"></a>01823 tmp_frame = kmo_dfs_get_frame(frameset, SOLAR_SPEC));
-<a name="l01824"></a>01824
-<a name="l01825"></a>01825 <span class="comment">// check if SOLAR_SPEC is the filter_id-one</span>
+<a name="l01749"></a>01749 tmp_spec_data_new = cpl_vector_duplicate(tmp_spec_data));
+<a name="l01750"></a>01750 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01751"></a>01751 cpl_vector_divide(tmp_spec_data_atmo, atmos_model));
+<a name="l01752"></a>01752
+<a name="l01753"></a>01753 <span class="keywordtype">char</span> *sss = cpl_sprintf(<span class="stringliteral">"atmo_div_%s.fits"</span>, filter_id);
+<a name="l01754"></a>01754 <span class="keywordflow">if</span> (i == 1) {
+<a name="l01755"></a>01755 cpl_vector_save(tmp_spec_data_atmo, sss, CPL_BPP_IEEE_DOUBLE, stored_sub_tel_data_headers[ifu_nr-1], CPL_IO_CREATE);
+<a name="l01756"></a>01756 } <span class="keywordflow">else</span> {
+<a name="l01757"></a>01757 cpl_vector_save(tmp_spec_data_atmo, sss, CPL_BPP_IEEE_DOUBLE, stored_sub_tel_data_headers[ifu_nr-1], CPL_IO_EXTEND);
+<a name="l01758"></a>01758 }
+<a name="l01759"></a>01759
+<a name="l01760"></a>01760 cpl_vector *med_vec = cpl_vector_duplicate(tmp_spec_data_orig);
+<a name="l01761"></a>01761 <span class="keywordtype">double</span> median = cpl_vector_get_median(med_vec);
+<a name="l01762"></a>01762 cpl_vector_delete(med_vec);
+<a name="l01763"></a>01763 <span class="keywordtype">int</span> ii = 0;
+<a name="l01764"></a>01764 <span class="keywordflow">for</span> (ii = 0; ii < cpl_vector_get_size(tmp_spec_data_orig); ii++) {
+<a name="l01765"></a>01765 <span class="keywordflow">if</span> (cpl_vector_get(tmp_spec_data_orig, ii) < median/8)
+<a name="l01766"></a>01766 cpl_vector_set(tmp_spec_data_orig, ii, 0);
+<a name="l01767"></a>01767 <span class="keywordflow">if</span> (cpl_vector_get(tmp_spec_data_atmo, ii) < median/8)
+<a name="l01768"></a>01768 cpl_vector_set(tmp_spec_data_atmo, ii, 0);
+<a name="l01769"></a>01769 <span class="keywordflow">if</span> (cpl_vector_get(tmp_spec_data_new, ii) < median/8)
+<a name="l01770"></a>01770 cpl_vector_set(tmp_spec_data_new, ii, 0);
+<a name="l01771"></a>01771
+<a name="l01772"></a>01772 <span class="keywordflow">if</span> (cpl_vector_get(tmp_spec_data_orig, ii) > 3*median)
+<a name="l01773"></a>01773 cpl_vector_set(tmp_spec_data_orig, ii, 3*median);
+<a name="l01774"></a>01774 <span class="keywordflow">if</span> (cpl_vector_get(tmp_spec_data_atmo, ii) > 3*median)
+<a name="l01775"></a>01775 cpl_vector_set(tmp_spec_data_atmo, ii, 3*median);
+<a name="l01776"></a>01776 <span class="keywordflow">if</span> (cpl_vector_get(tmp_spec_data_new, ii) > 3*median)
+<a name="l01777"></a>01777 cpl_vector_set(tmp_spec_data_new, ii, 3*median);
+<a name="l01778"></a>01778 }
+<a name="l01779"></a>01779
+<a name="l01780"></a>01780 <span class="keywordtype">double</span> *pspec_dup = cpl_vector_get_data(tmp_spec_data_atmo);
+<a name="l01781"></a>01781 <span class="keywordflow">for</span> (ii = 0; ii < cpl_vector_get_size(tmp_spec_data_atmo); ii++) {
+<a name="l01782"></a>01782 <span class="keywordflow">if</span> (kmclipm_is_nan_or_inf(pspec_dup[ii])) {
+<a name="l01783"></a>01783 pspec_dup[ii] = 0.;
+<a name="l01784"></a>01784 }
+<a name="l01785"></a>01785 }
+<a name="l01786"></a>01786
+<a name="l01787"></a>01787 cpl_bivector *plots[3];
+<a name="l01788"></a>01788 plots[0] = cpl_bivector_wrap_vectors((cpl_vector*)lambda_x, tmp_spec_data_orig);
+<a name="l01789"></a>01789 plots[1] = cpl_bivector_wrap_vectors((cpl_vector*)lambda_x, tmp_spec_data_atmo);
+<a name="l01790"></a>01790 plots[2] = cpl_bivector_wrap_vectors((cpl_vector*)lambda_x, tmp_spec_data_new);
+<a name="l01791"></a>01791 <span class="keywordtype">char</span> *options[3] = {<span class="stringliteral">"w l t 'original'"</span>,
+<a name="l01792"></a>01792 <span class="stringliteral">"w l t 'atmo divided'"</span>,
+<a name="l01793"></a>01793 <span class="stringliteral">"w l t 'lines removed'"</span>};
+<a name="l01794"></a>01794 sss = cpl_sprintf(<span class="stringliteral">"set title '%s-band line removal (DET #%d)';"</span>, filter_id, i);
+<a name="l01795"></a>01795 cpl_plot_bivectors(sss,
+<a name="l01796"></a>01796 (<span class="keyword">const</span> <span class="keywordtype">char</span>**)options, <span class="stringliteral">""</span>, (<span class="keyword">const</span> cpl_bivector**)plots, 3);
+<a name="l01797"></a>01797 <span class="comment">// cpl_plot_bivectors("set title 'Spectrum with lines removed'; set xrange [2.14:2.19];",</span>
+<a name="l01798"></a>01798 <span class="comment">// (const char**)options, "", (const cpl_bivector**)plots, 2);</span>
+<a name="l01799"></a>01799 cpl_bivector_unwrap_vectors(plots[0]);
+<a name="l01800"></a>01800 cpl_bivector_unwrap_vectors(plots[1]);
+<a name="l01801"></a>01801 cpl_bivector_unwrap_vectors(plots[2]);
+<a name="l01802"></a>01802 cpl_free(sss); sss = NULL;
+<a name="l01803"></a>01803 cpl_vector_delete(tmp_spec_data_orig); tmp_spec_data_orig = NULL;
+<a name="l01804"></a>01804 cpl_vector_delete(tmp_spec_data_atmo); tmp_spec_data_atmo = NULL;
+<a name="l01805"></a>01805 cpl_vector_delete(tmp_spec_data_new); tmp_spec_data_new = NULL;
+<a name="l01806"></a>01806 }
+<a name="l01807"></a>01807 cpl_vector_delete(atmos_model); atmos_model = NULL;
+<a name="l01808"></a>01808 } <span class="keywordflow">else</span> {
+<a name="l01809"></a>01809 <span class="keywordflow">if</span> (line_warning == FALSE) {
+<a name="l01810"></a>01810 cpl_msg_warning(<span class="stringliteral">""</span>, <span class="stringliteral">"No atmospheric model (ATMOS_MODEL) provided! "</span>
+<a name="l01811"></a>01811 <span class="stringliteral">"Won't remove any lines."</span>);
+<a name="l01812"></a>01812 line_warning = TRUE;
+<a name="l01813"></a>01813 }
+<a name="l01814"></a>01814 }
+<a name="l01815"></a>01815 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(star_type, <span class="stringliteral">"G"</span>) == 0) {
+<a name="l01816"></a>01816 <span class="comment">// we have a G star</span>
+<a name="l01817"></a>01817 <span class="keywordflow">if</span> (cpl_frameset_count_tags(frameset, SOLAR_SPEC) == 1) {
+<a name="l01818"></a>01818 <span class="comment">// interpolate SOLAR_SPEC to same scale as data</span>
+<a name="l01819"></a>01819 <span class="comment">// and divide it</span>
+<a name="l01820"></a>01820 KMO_TRY_EXIT_IF_NULL(
+<a name="l01821"></a>01821 tmp_frame = kmo_dfs_get_frame(frameset, SOLAR_SPEC));
+<a name="l01822"></a>01822
+<a name="l01823"></a>01823 <span class="comment">// check if SOLAR_SPEC is the filter_id-one</span>
+<a name="l01824"></a>01824 KMO_TRY_EXIT_IF_NULL(
+<a name="l01825"></a>01825 tmp_sub_header = kmclipm_propertylist_load(cpl_frame_get_filename(tmp_frame), 0));
<a name="l01826"></a>01826 KMO_TRY_EXIT_IF_NULL(
-<a name="l01827"></a>01827 tmp_sub_header = kmclipm_propertylist_load(cpl_frame_get_filename(tmp_frame), 0));
-<a name="l01828"></a>01828 KMO_TRY_EXIT_IF_NULL(
-<a name="l01829"></a>01829 tmp_str = cpl_propertylist_get_string(tmp_sub_header, FILT_ID));
-<a name="l01830"></a>01830 KMO_TRY_ASSURE(strcmp(filter_id, tmp_str) == 0,
-<a name="l01831"></a>01831 CPL_ERROR_ILLEGAL_INPUT,
-<a name="l01832"></a>01832 <span class="stringliteral">"SOLAR_SPEC model must have primary "</span>
-<a name="l01833"></a>01833 <span class="stringliteral">"keyword '%s' equal '%s'!!!"</span>,
-<a name="l01834"></a>01834 FILT_ID, filter_id);
-<a name="l01835"></a>01835 cpl_propertylist_delete(tmp_sub_header); tmp_sub_header = NULL;
-<a name="l01836"></a>01836
-<a name="l01837"></a>01837 KMO_TRY_EXIT_IF_NULL(
-<a name="l01838"></a>01838 solar_spec = kmo_interpolate_vector_wcs(tmp_frame, lambda_x));
-<a name="l01839"></a>01839
-<a name="l01840"></a>01840 <span class="comment">// values are set to zero if solar_spec isn't</span>
-<a name="l01841"></a>01841 <span class="comment">// overlapping wavelength range of star apectrum</span>
-<a name="l01842"></a>01842 <span class="comment">// completely</span>
-<a name="l01843"></a>01843 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01844"></a>01844 cpl_vector_divide(tmp_spec_data, solar_spec));
-<a name="l01845"></a>01845 cpl_vector_delete(solar_spec); solar_spec = NULL;
-<a name="l01846"></a>01846 } <span class="keywordflow">else</span> {
-<a name="l01847"></a>01847 <span class="keywordflow">if</span> (print_warning_once == TRUE) {
-<a name="l01848"></a>01848 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"No solar spectrum (SOLAR_SPEC) provided! "</span>
-<a name="l01849"></a>01849 <span class="stringliteral">"Can't divide it from extracted "</span>
-<a name="l01850"></a>01850 <span class="stringliteral">"standard star spectrum!"</span>);
-<a name="l01851"></a>01851 print_warning_once = FALSE;
-<a name="l01852"></a>01852 }
-<a name="l01853"></a>01853 }
-<a name="l01854"></a>01854 } <span class="keywordflow">else</span> {
-<a name="l01855"></a>01855 <span class="comment">// cpl_msg_warning("","No startype was provided! Can't"</span>
-<a name="l01856"></a>01856 <span class="comment">// " divide solar spectrum for G stars "</span>
-<a name="l01857"></a>01857 <span class="comment">// "or fit a profile to atmospheric "</span>
-<a name="l01858"></a>01858 <span class="comment">// "transmission for OBAF stars.");</span>
-<a name="l01859"></a>01859 }
-<a name="l01860"></a>01860
-<a name="l01861"></a>01861 <span class="keywordflow">if</span> (star_temperature > 0.0) {
-<a name="l01862"></a>01862 <span class="comment">// divide blackbody from tmp_spec_data</span>
-<a name="l01863"></a>01863 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01864"></a>01864 kmo_divide_blackbody(tmp_spec_data, lambda_x, star_temperature));
-<a name="l01865"></a>01865 }
+<a name="l01827"></a>01827 tmp_str = cpl_propertylist_get_string(tmp_sub_header, FILT_ID));
+<a name="l01828"></a>01828 KMO_TRY_ASSURE(strcmp(filter_id, tmp_str) == 0,
+<a name="l01829"></a>01829 CPL_ERROR_ILLEGAL_INPUT,
+<a name="l01830"></a>01830 <span class="stringliteral">"SOLAR_SPEC model must have primary "</span>
+<a name="l01831"></a>01831 <span class="stringliteral">"keyword '%s' equal '%s'!!!"</span>,
+<a name="l01832"></a>01832 FILT_ID, filter_id);
+<a name="l01833"></a>01833 cpl_propertylist_delete(tmp_sub_header); tmp_sub_header = NULL;
+<a name="l01834"></a>01834
+<a name="l01835"></a>01835 KMO_TRY_EXIT_IF_NULL(
+<a name="l01836"></a>01836 solar_spec = kmo_interpolate_vector_wcs(tmp_frame, lambda_x));
+<a name="l01837"></a>01837
+<a name="l01838"></a>01838 <span class="comment">// values are set to zero if solar_spec isn't</span>
+<a name="l01839"></a>01839 <span class="comment">// overlapping wavelength range of star apectrum</span>
+<a name="l01840"></a>01840 <span class="comment">// completely</span>
+<a name="l01841"></a>01841 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01842"></a>01842 cpl_vector_divide(tmp_spec_data, solar_spec));
+<a name="l01843"></a>01843 cpl_vector_delete(solar_spec); solar_spec = NULL;
+<a name="l01844"></a>01844 } <span class="keywordflow">else</span> {
+<a name="l01845"></a>01845 <span class="keywordflow">if</span> (print_warning_once == TRUE) {
+<a name="l01846"></a>01846 cpl_msg_warning(<span class="stringliteral">""</span>,<span class="stringliteral">"No solar spectrum (SOLAR_SPEC) provided! "</span>
+<a name="l01847"></a>01847 <span class="stringliteral">"Can't divide it from extracted "</span>
+<a name="l01848"></a>01848 <span class="stringliteral">"standard star spectrum!"</span>);
+<a name="l01849"></a>01849 print_warning_once = FALSE;
+<a name="l01850"></a>01850 }
+<a name="l01851"></a>01851 }
+<a name="l01852"></a>01852 } <span class="keywordflow">else</span> {
+<a name="l01853"></a>01853 <span class="comment">// cpl_msg_warning("","No startype was provided! Can't"</span>
+<a name="l01854"></a>01854 <span class="comment">// " divide solar spectrum for G stars "</span>
+<a name="l01855"></a>01855 <span class="comment">// "or fit a profile to atmospheric "</span>
+<a name="l01856"></a>01856 <span class="comment">// "transmission for OBAF stars.");</span>
+<a name="l01857"></a>01857 }
+<a name="l01858"></a>01858
+<a name="l01859"></a>01859 <span class="keywordflow">if</span> (star_temperature > 0.0) {
+<a name="l01860"></a>01860 <span class="comment">// divide blackbody from tmp_spec_data</span>
+<a name="l01861"></a>01861 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01862"></a>01862 kmo_divide_blackbody(tmp_spec_data, lambda_x, star_temperature));
+<a name="l01863"></a>01863 }
+<a name="l01864"></a>01864
+<a name="l01865"></a>01865 cpl_vector_delete(lambda_x); lambda_x = NULL;
<a name="l01866"></a>01866
-<a name="l01867"></a>01867 cpl_vector_delete(lambda_x); lambda_x = NULL;
-<a name="l01868"></a>01868
-<a name="l01869"></a>01869 <span class="comment">// normalise telluric and its noise</span>
-<a name="l01870"></a>01870 <span class="comment">// mean is taken in lambda defined range</span>
-<a name="l01871"></a>01871 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01872"></a>01872 kmo_calc_band_mean(stored_sub_tel_data_headers[ifu_nr-1],
-<a name="l01873"></a>01873 filter_id,
-<a name="l01874"></a>01874 tmp_spec_data,
-<a name="l01875"></a>01875 tmp_spec_noise,
-<a name="l01876"></a>01876 &mean_data,
-<a name="l01877"></a>01877 &mean_noise));
-<a name="l01878"></a>01878
-<a name="l01879"></a>01879 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01880"></a>01880 cpl_vector_divide_scalar(tmp_spec_data, mean_data));
-<a name="l01881"></a>01881
-<a name="l01882"></a>01882 <span class="keywordflow">if</span> (tmp_spec_noise != NULL) {
-<a name="l01883"></a>01883 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01884"></a>01884 cpl_vector_divide_scalar(tmp_spec_noise, mean_noise));
-<a name="l01885"></a>01885
-<a name="l01886"></a>01886 <span class="comment">// set noise spectrum also to zero when solar_spec is too short</span>
+<a name="l01867"></a>01867 <span class="comment">// normalise telluric and its noise</span>
+<a name="l01868"></a>01868 <span class="comment">// mean is taken in lambda defined range</span>
+<a name="l01869"></a>01869 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01870"></a>01870 kmo_calc_band_mean(stored_sub_tel_data_headers[ifu_nr-1],
+<a name="l01871"></a>01871 filter_id,
+<a name="l01872"></a>01872 tmp_spec_data,
+<a name="l01873"></a>01873 tmp_spec_noise,
+<a name="l01874"></a>01874 &mean_data,
+<a name="l01875"></a>01875 &mean_noise));
+<a name="l01876"></a>01876
+<a name="l01877"></a>01877 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01878"></a>01878 cpl_vector_divide_scalar(tmp_spec_data, mean_data));
+<a name="l01879"></a>01879
+<a name="l01880"></a>01880 <span class="keywordflow">if</span> (tmp_spec_noise != NULL) {
+<a name="l01881"></a>01881 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01882"></a>01882 cpl_vector_divide_scalar(tmp_spec_noise, mean_noise));
+<a name="l01883"></a>01883
+<a name="l01884"></a>01884 <span class="comment">// set noise spectrum also to zero when solar_spec is too short</span>
+<a name="l01885"></a>01885 KMO_TRY_EXIT_IF_NULL(
+<a name="l01886"></a>01886 ptmp_spec_data = cpl_vector_get_data_const(tmp_spec_data));
<a name="l01887"></a>01887 KMO_TRY_EXIT_IF_NULL(
-<a name="l01888"></a>01888 ptmp_spec_data = cpl_vector_get_data_const(tmp_spec_data));
-<a name="l01889"></a>01889 KMO_TRY_EXIT_IF_NULL(
-<a name="l01890"></a>01890 ptmp_spec_noise = cpl_vector_get_data(tmp_spec_noise));
-<a name="l01891"></a>01891 <span class="keywordflow">for</span> (k = 0; k < cpl_vector_get_size(tmp_spec_data); k++) {
-<a name="l01892"></a>01892 <span class="keywordflow">if</span> (ptmp_spec_data[k] == 0.0) {
-<a name="l01893"></a>01893 ptmp_spec_noise[k] = 0.0;
-<a name="l01894"></a>01894 }
-<a name="l01895"></a>01895 }
-<a name="l01896"></a>01896 }
-<a name="l01897"></a>01897 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01898"></a>01898
-<a name="l01899"></a>01899 <span class="comment">// store telluric & error spectrum</span>
-<a name="l01900"></a>01900 stored_telluric_data[ifu_nr-1] = tmp_spec_data;
-<a name="l01901"></a>01901 stored_telluric_noise[ifu_nr-1] = tmp_spec_noise;
-<a name="l01902"></a>01902
-<a name="l01903"></a>01903 <span class="comment">// if magnitude is provided</span>
-<a name="l01904"></a>01904 <span class="comment">// calculate zeropoint and throughput</span>
-<a name="l01905"></a>01905 <span class="keywordflow">if</span> (has_magnitude) {
-<a name="l01906"></a>01906 <span class="comment">// calculate QC THROUGHPUT</span>
-<a name="l01907"></a>01907 crpix1 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CRPIX1);
-<a name="l01908"></a>01908 crval1 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CRVAL1);
-<a name="l01909"></a>01909 cdelt1 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CDELT1);
-<a name="l01910"></a>01910 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01911"></a>01911
-<a name="l01912"></a>01912 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01913"></a>01913 kmo_calc_counts(spec_qc, filter_id,
-<a name="l01914"></a>01914 crpix1, crval1, cdelt1,
-<a name="l01915"></a>01915 &counts1, &counts2));
-<a name="l01916"></a>01916 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01917"></a>01917
-<a name="l01918"></a>01918 counts1 /= exptime;
-<a name="l01919"></a>01919 counts2 /= exptime;
-<a name="l01920"></a>01920
-<a name="l01921"></a>01921 stored_qc_throughput[ifu_nr-1] =
-<a name="l01922"></a>01922 kmo_calc_throughput(magnitude1, magnitude2, counts1, counts2,
-<a name="l01923"></a>01923 cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], GAIN),
-<a name="l01924"></a>01924 filter_id);
-<a name="l01925"></a>01925 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01926"></a>01926
-<a name="l01927"></a>01927 <span class="keywordflow">if</span> (kmclipm_is_nan_or_inf(stored_qc_throughput[ifu_nr-1])) {
-<a name="l01928"></a>01928 stored_qc_throughput[ifu_nr-1] = -1;
-<a name="l01929"></a>01929 }
-<a name="l01930"></a>01930 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01931"></a>01931 kmclipm_update_property_double(stored_sub_tel_data_headers[ifu_nr-1],
-<a name="l01932"></a>01932 QC_THROUGHPUT,
-<a name="l01933"></a>01933 stored_qc_throughput[ifu_nr-1],
-<a name="l01934"></a>01934 <span class="stringliteral">"[] IFU throughput"</span>));
-<a name="l01935"></a>01935
-<a name="l01936"></a>01936 <span class="comment">// calculate QC ZEROPOINT</span>
-<a name="l01937"></a>01937 zeropoint = kmo_calc_zeropoint(magnitude1, magnitude2, counts1, counts2, cdelt3, filter_id);
-<a name="l01938"></a>01938 <span class="keywordflow">if</span> (kmclipm_is_nan_or_inf(zeropoint)) {
-<a name="l01939"></a>01939 zeropoint = -1;
-<a name="l01940"></a>01940 }
-<a name="l01941"></a>01941 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l01942"></a>01942
-<a name="l01943"></a>01943 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01944"></a>01944 kmclipm_update_property_double(stored_sub_tel_data_headers[ifu_nr-1],
-<a name="l01945"></a>01945 QC_ZEROPOINT,
-<a name="l01946"></a>01946 zeropoint,
-<a name="l01947"></a>01947 <span class="stringliteral">"[mag] IFU zeropoint"</span>));
-<a name="l01948"></a>01948 }
-<a name="l01949"></a>01949 cpl_vector_delete(spec_qc);spec_qc = NULL;
-<a name="l01950"></a>01950 } <span class="keywordflow">else</span> {
-<a name="l01951"></a>01951 cpl_error_reset();
-<a name="l01952"></a>01952 <span class="comment">// IFU is invalid</span>
-<a name="l01953"></a>01953 KMO_TRY_EXIT_IF_NULL(
-<a name="l01954"></a>01954 stored_sub_tel_data_headers[ifu_nr-1] =
-<a name="l01955"></a>01955 cpl_propertylist_duplicate(sub_header_orig));
-<a name="l01956"></a>01956 KMO_TRY_EXIT_IF_NULL(
-<a name="l01957"></a>01957 stored_sub_tel_noise_headers[ifu_nr-1] =
-<a name="l01958"></a>01958 cpl_propertylist_duplicate(sub_header_orig));
-<a name="l01959"></a>01959 KMO_TRY_EXIT_IF_NULL(
-<a name="l01960"></a>01960 stored_sub_psf_headers[ifu_nr-1] =
-<a name="l01961"></a>01961 cpl_propertylist_duplicate(sub_header_orig));
-<a name="l01962"></a>01962 <span class="keywordflow">if</span> (save_cubes) {
-<a name="l01963"></a>01963 KMO_TRY_EXIT_IF_NULL(
-<a name="l01964"></a>01964 stored_sub_cube_data_headers[ifu_nr-1] =
-<a name="l01965"></a>01965 cpl_propertylist_duplicate(sub_header_orig));
-<a name="l01966"></a>01966 KMO_TRY_EXIT_IF_NULL(
-<a name="l01967"></a>01967 stored_sub_cube_noise_headers[ifu_nr-1] =
-<a name="l01968"></a>01968 cpl_propertylist_duplicate(sub_header_orig));
-<a name="l01969"></a>01969 }
-<a name="l01970"></a>01970 }
-<a name="l01971"></a>01971
-<a name="l01972"></a>01972 <span class="comment">// create EXTNAME keyword as DATA</span>
-<a name="l01973"></a>01973 KMO_TRY_EXIT_IF_NULL(
-<a name="l01974"></a>01974 extname = kmo_extname_creator(ifu_frame, ifu_nr, EXT_DATA));
-<a name="l01975"></a>01975 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01976"></a>01976 kmclipm_update_property_string(stored_sub_tel_data_headers[ifu_nr-1],
-<a name="l01977"></a>01977 EXTNAME, extname, <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01978"></a>01978 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01979"></a>01979 kmclipm_update_property_string(stored_sub_psf_headers[ifu_nr-1],
-<a name="l01980"></a>01980 EXTNAME, extname, <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01981"></a>01981 <span class="keywordflow">if</span> (save_cubes) {
-<a name="l01982"></a>01982 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01983"></a>01983 kmclipm_update_property_string(stored_sub_cube_data_headers[ifu_nr-1],
-<a name="l01984"></a>01984 EXTNAME, extname, <span class="stringliteral">"FITS extension name"</span>));
-<a name="l01985"></a>01985 }
-<a name="l01986"></a>01986 cpl_free(extname); extname = NULL;
-<a name="l01987"></a>01987
-<a name="l01988"></a>01988 <span class="comment">// create EXTNAME keyword as NOISE</span>
-<a name="l01989"></a>01989 <span class="keywordflow">if</span> (stored_sub_tel_noise_headers[ifu_nr-1] == NULL) {
-<a name="l01990"></a>01990 KMO_TRY_EXIT_IF_NULL(
-<a name="l01991"></a>01991 stored_sub_tel_noise_headers[ifu_nr-1] =
-<a name="l01992"></a>01992 cpl_propertylist_duplicate(
-<a name="l01993"></a>01993 stored_sub_tel_data_headers[ifu_nr-1]));
-<a name="l01994"></a>01994 }
-<a name="l01995"></a>01995 KMO_TRY_EXIT_IF_NULL(
-<a name="l01996"></a>01996 extname = kmo_extname_creator(ifu_frame, ifu_nr, EXT_NOISE));
-<a name="l01997"></a>01997 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01998"></a>01998 kmclipm_update_property_string(stored_sub_tel_noise_headers[ifu_nr-1],
-<a name="l01999"></a>01999 EXTNAME, extname, <span class="stringliteral">"FITS extension name"</span>));
-<a name="l02000"></a>02000 <span class="keywordflow">if</span> (save_cubes) {
-<a name="l02001"></a>02001 KMO_TRY_EXIT_IF_NULL(
-<a name="l02002"></a>02002 stored_sub_cube_noise_headers[ifu_nr-1] =
-<a name="l02003"></a>02003 cpl_propertylist_duplicate(
-<a name="l02004"></a>02004 stored_sub_cube_data_headers[ifu_nr-1]));
-<a name="l02005"></a>02005 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02006"></a>02006 kmclipm_update_property_string(stored_sub_cube_noise_headers[ifu_nr-1],
-<a name="l02007"></a>02007 EXTNAME, extname, <span class="stringliteral">"FITS extension name"</span>));
-<a name="l02008"></a>02008 }
-<a name="l02009"></a>02009 cpl_free(extname); extname = NULL;
-<a name="l02010"></a>02010 } <span class="comment">// for j ifus (load, process & store)</span>
-<a name="l02011"></a>02011 cpl_propertylist_delete(sub_header_orig); sub_header_orig = NULL;
-<a name="l02012"></a>02012 } <span class="comment">// for i detectors (load, process & store)</span>
-<a name="l02013"></a>02013 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l02014"></a>02014
-<a name="l02015"></a>02015 <span class="comment">// write QC parameter: nr of std stars</span>
-<a name="l02016"></a>02016 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02017"></a>02017 kmclipm_update_property_int(main_header_tel, QC_NR_STD_STARS,
-<a name="l02018"></a>02018 nr_std_stars, <span class="stringliteral">"[] Nr. of std stars"</span>));
-<a name="l02019"></a>02019
-<a name="l02020"></a>02020 <span class="comment">// update which IFUs are not used</span>
-<a name="l02021"></a>02021 kmo_print_unused_ifus(unused_ifus_after, TRUE);
-<a name="l02022"></a>02022
-<a name="l02023"></a>02023 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02024"></a>02024 kmo_set_unused_ifus(unused_ifus_after, main_header_tel, <span class="stringliteral">"kmo_std_star"</span>));
-<a name="l02025"></a>02025
-<a name="l02026"></a>02026 KMO_TRY_EXIT_IF_NULL(
-<a name="l02027"></a>02027 main_header_psf = cpl_propertylist_duplicate(main_header_tel));
-<a name="l02028"></a>02028
-<a name="l02029"></a>02029 <span class="keywordflow">if</span> (has_magnitude) {
-<a name="l02030"></a>02030 <span class="comment">// calculate QC THROUGHPUT MEAN and QC THROUGHPUT SDV</span>
-<a name="l02031"></a>02031 <span class="comment">// and update main header</span>
-<a name="l02032"></a>02032 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02033"></a>02033 kmo_calc_mean_throughput(stored_qc_throughput,
-<a name="l02034"></a>02034 nr_devices * KMOS_IFUS_PER_DETECTOR,
-<a name="l02035"></a>02035 &throughput_mean,
-<a name="l02036"></a>02036 &throughput_sdv));
-<a name="l02037"></a>02037 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02038"></a>02038 kmclipm_update_property_double(main_header_tel, QC_THROUGHPUT_MEAN,
-<a name="l02039"></a>02039 throughput_mean, <span class="stringliteral">"[] mean throughput for all detectors"</span>));
-<a name="l02040"></a>02040 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02041"></a>02041 kmclipm_update_property_double(main_header_tel, QC_THROUGHPUT_SDV,
-<a name="l02042"></a>02042 throughput_sdv, <span class="stringliteral">"[] stdev throughput for all detectors"</span>));
-<a name="l02043"></a>02043 }
-<a name="l02044"></a>02044 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l02045"></a>02045
+<a name="l01888"></a>01888 ptmp_spec_noise = cpl_vector_get_data(tmp_spec_noise));
+<a name="l01889"></a>01889 <span class="keywordflow">for</span> (k = 0; k < cpl_vector_get_size(tmp_spec_data); k++) {
+<a name="l01890"></a>01890 <span class="keywordflow">if</span> (ptmp_spec_data[k] == 0.0) {
+<a name="l01891"></a>01891 ptmp_spec_noise[k] = 0.0;
+<a name="l01892"></a>01892 }
+<a name="l01893"></a>01893 }
+<a name="l01894"></a>01894 }
+<a name="l01895"></a>01895 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01896"></a>01896
+<a name="l01897"></a>01897 <span class="comment">// store telluric & error spectrum</span>
+<a name="l01898"></a>01898 stored_telluric_data[ifu_nr-1] = tmp_spec_data;
+<a name="l01899"></a>01899 stored_telluric_noise[ifu_nr-1] = tmp_spec_noise;
+<a name="l01900"></a>01900
+<a name="l01901"></a>01901 <span class="comment">// if magnitude is provided</span>
+<a name="l01902"></a>01902 <span class="comment">// calculate zeropoint and throughput</span>
+<a name="l01903"></a>01903 <span class="keywordflow">if</span> (has_magnitude) {
+<a name="l01904"></a>01904 <span class="comment">// calculate QC THROUGHPUT</span>
+<a name="l01905"></a>01905 crpix1 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CRPIX1);
+<a name="l01906"></a>01906 crval1 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CRVAL1);
+<a name="l01907"></a>01907 cdelt1 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CDELT1);
+<a name="l01908"></a>01908 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01909"></a>01909
+<a name="l01910"></a>01910 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01911"></a>01911 kmo_calc_counts(spec_qc, filter_id,
+<a name="l01912"></a>01912 crpix1, crval1, cdelt1,
+<a name="l01913"></a>01913 &counts1, &counts2));
+<a name="l01914"></a>01914 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01915"></a>01915
+<a name="l01916"></a>01916 counts1 /= exptime;
+<a name="l01917"></a>01917 counts2 /= exptime;
+<a name="l01918"></a>01918
+<a name="l01919"></a>01919 stored_qc_throughput[ifu_nr-1] =
+<a name="l01920"></a>01920 kmo_calc_throughput(magnitude1, magnitude2, counts1, counts2,
+<a name="l01921"></a>01921 cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], GAIN),
+<a name="l01922"></a>01922 filter_id);
+<a name="l01923"></a>01923 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01924"></a>01924
+<a name="l01925"></a>01925 <span class="keywordflow">if</span> (kmclipm_is_nan_or_inf(stored_qc_throughput[ifu_nr-1])) {
+<a name="l01926"></a>01926 stored_qc_throughput[ifu_nr-1] = -1;
+<a name="l01927"></a>01927 }
+<a name="l01928"></a>01928 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01929"></a>01929 kmclipm_update_property_double(stored_sub_tel_data_headers[ifu_nr-1],
+<a name="l01930"></a>01930 QC_THROUGHPUT,
+<a name="l01931"></a>01931 stored_qc_throughput[ifu_nr-1],
+<a name="l01932"></a>01932 <span class="stringliteral">"[] IFU throughput"</span>));
+<a name="l01933"></a>01933
+<a name="l01934"></a>01934 <span class="comment">// calculate QC ZEROPOINT</span>
+<a name="l01935"></a>01935 zeropoint = kmo_calc_zeropoint(magnitude1, magnitude2, counts1, counts2, cdelt3, filter_id);
+<a name="l01936"></a>01936 <span class="keywordflow">if</span> (kmclipm_is_nan_or_inf(zeropoint)) {
+<a name="l01937"></a>01937 zeropoint = -1;
+<a name="l01938"></a>01938 }
+<a name="l01939"></a>01939 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l01940"></a>01940
+<a name="l01941"></a>01941 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01942"></a>01942 kmclipm_update_property_double(stored_sub_tel_data_headers[ifu_nr-1],
+<a name="l01943"></a>01943 QC_ZEROPOINT,
+<a name="l01944"></a>01944 zeropoint,
+<a name="l01945"></a>01945 <span class="stringliteral">"[mag] IFU zeropoint"</span>));
+<a name="l01946"></a>01946 }
+<a name="l01947"></a>01947 cpl_vector_delete(spec_qc);spec_qc = NULL;
+<a name="l01948"></a>01948 } <span class="keywordflow">else</span> {
+<a name="l01949"></a>01949 cpl_error_reset();
+<a name="l01950"></a>01950 <span class="comment">// IFU is invalid</span>
+<a name="l01951"></a>01951 KMO_TRY_EXIT_IF_NULL(
+<a name="l01952"></a>01952 stored_sub_tel_data_headers[ifu_nr-1] =
+<a name="l01953"></a>01953 cpl_propertylist_duplicate(sub_header_orig));
+<a name="l01954"></a>01954 KMO_TRY_EXIT_IF_NULL(
+<a name="l01955"></a>01955 stored_sub_tel_noise_headers[ifu_nr-1] =
+<a name="l01956"></a>01956 cpl_propertylist_duplicate(sub_header_orig));
+<a name="l01957"></a>01957 KMO_TRY_EXIT_IF_NULL(
+<a name="l01958"></a>01958 stored_sub_psf_headers[ifu_nr-1] =
+<a name="l01959"></a>01959 cpl_propertylist_duplicate(sub_header_orig));
+<a name="l01960"></a>01960 <span class="keywordflow">if</span> (save_cubes) {
+<a name="l01961"></a>01961 KMO_TRY_EXIT_IF_NULL(
+<a name="l01962"></a>01962 stored_sub_cube_data_headers[ifu_nr-1] =
+<a name="l01963"></a>01963 cpl_propertylist_duplicate(sub_header_orig));
+<a name="l01964"></a>01964 KMO_TRY_EXIT_IF_NULL(
+<a name="l01965"></a>01965 stored_sub_cube_noise_headers[ifu_nr-1] =
+<a name="l01966"></a>01966 cpl_propertylist_duplicate(sub_header_orig));
+<a name="l01967"></a>01967 }
+<a name="l01968"></a>01968 }
+<a name="l01969"></a>01969
+<a name="l01970"></a>01970 <span class="comment">// create EXTNAME keyword as DATA</span>
+<a name="l01971"></a>01971 KMO_TRY_EXIT_IF_NULL(
+<a name="l01972"></a>01972 extname = kmo_extname_creator(ifu_frame, ifu_nr, EXT_DATA));
+<a name="l01973"></a>01973 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01974"></a>01974 kmclipm_update_property_string(stored_sub_tel_data_headers[ifu_nr-1],
+<a name="l01975"></a>01975 EXTNAME, extname, <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01976"></a>01976 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01977"></a>01977 kmclipm_update_property_string(stored_sub_psf_headers[ifu_nr-1],
+<a name="l01978"></a>01978 EXTNAME, extname, <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01979"></a>01979 <span class="keywordflow">if</span> (save_cubes) {
+<a name="l01980"></a>01980 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01981"></a>01981 kmclipm_update_property_string(stored_sub_cube_data_headers[ifu_nr-1],
+<a name="l01982"></a>01982 EXTNAME, extname, <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01983"></a>01983 }
+<a name="l01984"></a>01984 cpl_free(extname); extname = NULL;
+<a name="l01985"></a>01985
+<a name="l01986"></a>01986 <span class="comment">// create EXTNAME keyword as NOISE</span>
+<a name="l01987"></a>01987 <span class="keywordflow">if</span> (stored_sub_tel_noise_headers[ifu_nr-1] == NULL) {
+<a name="l01988"></a>01988 KMO_TRY_EXIT_IF_NULL(
+<a name="l01989"></a>01989 stored_sub_tel_noise_headers[ifu_nr-1] =
+<a name="l01990"></a>01990 cpl_propertylist_duplicate(
+<a name="l01991"></a>01991 stored_sub_tel_data_headers[ifu_nr-1]));
+<a name="l01992"></a>01992 }
+<a name="l01993"></a>01993 KMO_TRY_EXIT_IF_NULL(
+<a name="l01994"></a>01994 extname = kmo_extname_creator(ifu_frame, ifu_nr, EXT_NOISE));
+<a name="l01995"></a>01995 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01996"></a>01996 kmclipm_update_property_string(stored_sub_tel_noise_headers[ifu_nr-1],
+<a name="l01997"></a>01997 EXTNAME, extname, <span class="stringliteral">"FITS extension name"</span>));
+<a name="l01998"></a>01998 <span class="keywordflow">if</span> (save_cubes) {
+<a name="l01999"></a>01999 KMO_TRY_EXIT_IF_NULL(
+<a name="l02000"></a>02000 stored_sub_cube_noise_headers[ifu_nr-1] =
+<a name="l02001"></a>02001 cpl_propertylist_duplicate(
+<a name="l02002"></a>02002 stored_sub_cube_data_headers[ifu_nr-1]));
+<a name="l02003"></a>02003 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02004"></a>02004 kmclipm_update_property_string(stored_sub_cube_noise_headers[ifu_nr-1],
+<a name="l02005"></a>02005 EXTNAME, extname, <span class="stringliteral">"FITS extension name"</span>));
+<a name="l02006"></a>02006 }
+<a name="l02007"></a>02007 cpl_free(extname); extname = NULL;
+<a name="l02008"></a>02008 } <span class="comment">// for j ifus (load, process & store)</span>
+<a name="l02009"></a>02009 cpl_propertylist_delete(sub_header_orig); sub_header_orig = NULL;
+<a name="l02010"></a>02010 } <span class="comment">// for i detectors (load, process & store)</span>
+<a name="l02011"></a>02011 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l02012"></a>02012
+<a name="l02013"></a>02013 <span class="comment">// write QC parameter: nr of std stars</span>
+<a name="l02014"></a>02014 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02015"></a>02015 kmclipm_update_property_int(main_header_tel, QC_NR_STD_STARS,
+<a name="l02016"></a>02016 nr_std_stars, <span class="stringliteral">"[] Nr. of std stars"</span>));
+<a name="l02017"></a>02017
+<a name="l02018"></a>02018 <span class="comment">// update which IFUs are not used</span>
+<a name="l02019"></a>02019 kmo_print_unused_ifus(unused_ifus_after, TRUE);
+<a name="l02020"></a>02020
+<a name="l02021"></a>02021 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02022"></a>02022 kmo_set_unused_ifus(unused_ifus_after, main_header_tel, <span class="stringliteral">"kmo_std_star"</span>));
+<a name="l02023"></a>02023
+<a name="l02024"></a>02024 KMO_TRY_EXIT_IF_NULL(
+<a name="l02025"></a>02025 main_header_psf = cpl_propertylist_duplicate(main_header_tel));
+<a name="l02026"></a>02026
+<a name="l02027"></a>02027 <span class="keywordflow">if</span> (has_magnitude) {
+<a name="l02028"></a>02028 <span class="comment">// calculate QC THROUGHPUT MEAN and QC THROUGHPUT SDV</span>
+<a name="l02029"></a>02029 <span class="comment">// and update main header</span>
+<a name="l02030"></a>02030 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02031"></a>02031 kmo_calc_mean_throughput(stored_qc_throughput,
+<a name="l02032"></a>02032 nr_devices * KMOS_IFUS_PER_DETECTOR,
+<a name="l02033"></a>02033 &throughput_mean,
+<a name="l02034"></a>02034 &throughput_sdv));
+<a name="l02035"></a>02035 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02036"></a>02036 kmclipm_update_property_double(main_header_tel, QC_THROUGHPUT_MEAN,
+<a name="l02037"></a>02037 throughput_mean, <span class="stringliteral">"[] mean throughput for all detectors"</span>));
+<a name="l02038"></a>02038 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02039"></a>02039 kmclipm_update_property_double(main_header_tel, QC_THROUGHPUT_SDV,
+<a name="l02040"></a>02040 throughput_sdv, <span class="stringliteral">"[] stdev throughput for all detectors"</span>));
+<a name="l02041"></a>02041 }
+<a name="l02042"></a>02042 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l02043"></a>02043
+<a name="l02044"></a>02044 <span class="comment">//</span>
+<a name="l02045"></a>02045 <span class="comment">// save output data</span>
<a name="l02046"></a>02046 <span class="comment">//</span>
-<a name="l02047"></a>02047 <span class="comment">// save output data</span>
-<a name="l02048"></a>02048 <span class="comment">//</span>
-<a name="l02049"></a>02049 <span class="keywordflow">if</span> (!suppress_extension) {
-<a name="l02050"></a>02050 KMO_TRY_EXIT_IF_NULL(
-<a name="l02051"></a>02051 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, suffix));
-<a name="l02052"></a>02052 } <span class="keywordflow">else</span> {
-<a name="l02053"></a>02053 KMO_TRY_EXIT_IF_NULL(
-<a name="l02054"></a>02054 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">""</span>));
-<a name="l02055"></a>02055 }
-<a name="l02056"></a>02056
-<a name="l02057"></a>02057 <span class="comment">// save primary extension</span>
-<a name="l02058"></a>02058 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Saving STD exposure No. %d"</span>, nr_exp+1);
-<a name="l02059"></a>02059 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02060"></a>02060 kmo_dfs_save_main_header(frameset, filename_telluric, fn_suffix,
-<a name="l02061"></a>02061 obj_frame, main_header_tel, parlist,
-<a name="l02062"></a>02062 cpl_func));
-<a name="l02063"></a>02063 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02064"></a>02064 kmo_dfs_save_main_header(frameset, filename_starspec, fn_suffix,
-<a name="l02065"></a>02065 obj_frame, main_header_tel, parlist,
-<a name="l02066"></a>02066 cpl_func));
-<a name="l02067"></a>02067 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02068"></a>02068 kmo_dfs_save_main_header(frameset, filename_mask, fn_suffix,
-<a name="l02069"></a>02069 obj_frame, main_header_psf, parlist,
-<a name="l02070"></a>02070 cpl_func));
-<a name="l02071"></a>02071 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02072"></a>02072 kmo_dfs_save_main_header(frameset, filename_psf, fn_suffix,
-<a name="l02073"></a>02073 obj_frame, main_header_psf, parlist,
-<a name="l02074"></a>02074 cpl_func));
-<a name="l02075"></a>02075 <span class="keywordflow">if</span> (save_cubes) {
-<a name="l02076"></a>02076 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02077"></a>02077 kmo_dfs_save_main_header(frameset, filename_cubes, fn_suffix,
-<a name="l02078"></a>02078 obj_frame, main_header_psf, parlist,
-<a name="l02079"></a>02079 cpl_func));
-<a name="l02080"></a>02080 }
-<a name="l02081"></a>02081
-<a name="l02082"></a>02082 <span class="comment">// save stored frames</span>
-<a name="l02083"></a>02083 <span class="keywordflow">for</span> (i = 1; i <= nr_devices; i++) {
-<a name="l02084"></a>02084 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
-<a name="l02085"></a>02085 ifu_nr = (i-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
-<a name="l02086"></a>02086
-<a name="l02087"></a>02087 <span class="comment">// save telluric-vector</span>
-<a name="l02088"></a>02088 kmclipm_vector *ddd = NULL;
-<a name="l02089"></a>02089 <span class="keywordflow">if</span> (stored_telluric_data[ifu_nr-1] != NULL)
-<a name="l02090"></a>02090 ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_telluric_data[ifu_nr-1]));
-<a name="l02091"></a>02091 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02092"></a>02092 kmo_dfs_save_vector(ddd, filename_telluric, fn_suffix,
-<a name="l02093"></a>02093 stored_sub_tel_data_headers[ifu_nr-1],
-<a name="l02094"></a>02094 0./0.));
-<a name="l02095"></a>02095 kmclipm_vector_delete(ddd); ddd =NULL;
-<a name="l02096"></a>02096
-<a name="l02097"></a>02097 <span class="keywordflow">if</span> (stored_telluric_noise[ifu_nr-1] != NULL)
-<a name="l02098"></a>02098 ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_telluric_noise[ifu_nr-1]));
-<a name="l02099"></a>02099 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02100"></a>02100 kmo_dfs_save_vector(ddd, filename_telluric, fn_suffix,
-<a name="l02101"></a>02101 stored_sub_tel_noise_headers[ifu_nr-1],
-<a name="l02102"></a>02102 0./0.));
-<a name="l02103"></a>02103 kmclipm_vector_delete(ddd); ddd =NULL;
-<a name="l02104"></a>02104
-<a name="l02105"></a>02105 <span class="comment">// save star_spec-vector</span>
-<a name="l02106"></a>02106 <span class="keywordflow">if</span> (stored_starspec_data[ifu_nr-1] != NULL)
-<a name="l02107"></a>02107 ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_starspec_data[ifu_nr-1]));
-<a name="l02108"></a>02108 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02109"></a>02109 kmo_dfs_save_vector(ddd, filename_starspec, fn_suffix,
-<a name="l02110"></a>02110 stored_sub_tel_data_headers[ifu_nr-1],
-<a name="l02111"></a>02111 0./0.));
-<a name="l02112"></a>02112 kmclipm_vector_delete(ddd); ddd =NULL;
-<a name="l02113"></a>02113
-<a name="l02114"></a>02114 <span class="keywordflow">if</span> (stored_starspec_noise[ifu_nr-1] != NULL)
-<a name="l02115"></a>02115 ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_starspec_noise[ifu_nr-1]));
-<a name="l02116"></a>02116 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02117"></a>02117 kmo_dfs_save_vector(ddd, filename_starspec, fn_suffix,
-<a name="l02118"></a>02118 stored_sub_tel_noise_headers[ifu_nr-1],
-<a name="l02119"></a>02119 0./0.));
-<a name="l02120"></a>02120 kmclipm_vector_delete(ddd); ddd =NULL;
-<a name="l02121"></a>02121
-<a name="l02122"></a>02122 <span class="comment">// save psf-image</span>
-<a name="l02123"></a>02123 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02124"></a>02124 kmo_dfs_save_image(stored_psf_data[ifu_nr-1],
-<a name="l02125"></a>02125 filename_psf, fn_suffix,
-<a name="l02126"></a>02126 stored_sub_psf_headers[ifu_nr-1],
-<a name="l02127"></a>02127 0./0.));
-<a name="l02128"></a>02128
-<a name="l02129"></a>02129 <span class="comment">// save mask-image</span>
-<a name="l02130"></a>02130 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02131"></a>02131 kmo_dfs_save_image(stored_mask[ifu_nr-1],
-<a name="l02132"></a>02132 filename_mask, fn_suffix,
-<a name="l02133"></a>02133 stored_sub_psf_headers[ifu_nr-1],
-<a name="l02134"></a>02134 0./0.));
-<a name="l02135"></a>02135 <span class="comment">// save reonstructed cubes</span>
-<a name="l02136"></a>02136 <span class="keywordflow">if</span> (save_cubes) {
-<a name="l02137"></a>02137 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02138"></a>02138 kmo_dfs_save_cube(stored_data_cube[ifu_nr-1],
-<a name="l02139"></a>02139 filename_cubes, fn_suffix,
-<a name="l02140"></a>02140 stored_sub_cube_data_headers[ifu_nr-1],
-<a name="l02141"></a>02141 0./0.));
-<a name="l02142"></a>02142 KMO_TRY_EXIT_IF_ERROR(
-<a name="l02143"></a>02143 kmo_dfs_save_cube(stored_noise_cube[ifu_nr-1],
-<a name="l02144"></a>02144 filename_cubes, fn_suffix,
-<a name="l02145"></a>02145 stored_sub_cube_noise_headers[ifu_nr-1],
-<a name="l02146"></a>02146 0./0.));
-<a name="l02147"></a>02147 }
-<a name="l02148"></a>02148 } <span class="comment">// for j ifus (save stored)</span>
-<a name="l02149"></a>02149 } <span class="comment">// for i detectors (save stored)</span>
-<a name="l02150"></a>02150 KMO_TRY_CHECK_ERROR_STATE();
-<a name="l02151"></a>02151 } <span class="comment">// if (frameCnt == 0)</span>
-<a name="l02152"></a>02152 }
-<a name="l02153"></a>02153 KMO_CATCH
-<a name="l02154"></a>02154 {
-<a name="l02155"></a>02155 KMO_CATCH_MSG();
-<a name="l02156"></a>02156 ret_val = -1;
-<a name="l02157"></a>02157 }
-<a name="l02158"></a>02158
-<a name="l02159"></a>02159 kmo_delete_objSkyStruct(obj_sky_struct);
-<a name="l02160"></a>02160 kmo_free_fits_desc(&desc1);
-<a name="l02161"></a>02161 kmo_free_fits_desc(&desc2);
-<a name="l02162"></a>02162 kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
-<a name="l02163"></a>02163 kmo_free_unused_ifus(unused_ifus_after); unused_ifus_after = NULL;
-<a name="l02164"></a>02164 cpl_free(bounds); bounds = NULL;
-<a name="l02165"></a>02165 cpl_propertylist_delete(main_header_tel); main_header_tel = NULL;
-<a name="l02166"></a>02166 cpl_propertylist_delete(main_header_psf); main_header_psf = NULL;
-<a name="l02167"></a>02167 cpl_vector_delete(atmos_model); atmos_model = NULL;
-<a name="l02168"></a>02168 cpl_vector_delete(solar_spec); solar_spec = NULL;
-<a name="l02169"></a>02169 cpl_table_delete(spec_type_LUT); spec_type_LUT = NULL;
-<a name="l02170"></a>02170 cpl_vector_delete(identified_slices); identified_slices = NULL;
-<a name="l02171"></a>02171 cpl_propertylist_delete(sub_header_orig); sub_header_orig = NULL;
-<a name="l02172"></a>02172 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
-<a name="l02173"></a>02173 cpl_vector_delete(stored_telluric_data[i]); stored_telluric_data[i] = NULL;
-<a name="l02174"></a>02174 cpl_vector_delete(stored_telluric_noise[i]); stored_telluric_noise[i] = NULL;
-<a name="l02175"></a>02175 cpl_vector_delete(stored_starspec_data[i]); stored_starspec_data[i] = NULL;
-<a name="l02176"></a>02176 cpl_vector_delete(stored_starspec_noise[i]); stored_starspec_noise[i] = NULL;
-<a name="l02177"></a>02177 cpl_image_delete(stored_psf_data[i]); stored_psf_data[i] = NULL;
-<a name="l02178"></a>02178 cpl_propertylist_delete(stored_sub_tel_data_headers[i]); stored_sub_tel_data_headers[i] = NULL;
-<a name="l02179"></a>02179 cpl_propertylist_delete(stored_sub_tel_noise_headers[i]); stored_sub_tel_noise_headers[i] = NULL;
-<a name="l02180"></a>02180 <span class="keywordflow">if</span> (save_cubes) {
-<a name="l02181"></a>02181 cpl_propertylist_delete(stored_sub_cube_data_headers[i]); stored_sub_cube_data_headers[i] = NULL;
-<a name="l02182"></a>02182 cpl_propertylist_delete(stored_sub_cube_noise_headers[i]); stored_sub_cube_noise_headers[i] = NULL;
-<a name="l02183"></a>02183 }
-<a name="l02184"></a>02184 cpl_propertylist_delete(stored_sub_psf_headers[i]); stored_sub_psf_headers[i] = NULL;
-<a name="l02185"></a>02185 cpl_image_delete(stored_mask[i]); stored_mask[i] = NULL;
-<a name="l02186"></a>02186 cpl_imagelist_delete(stored_data_cube[i]); stored_data_cube[i] = NULL;
-<a name="l02187"></a>02187 cpl_imagelist_delete(stored_noise_cube[i]); stored_noise_cube[i] = NULL;
-<a name="l02188"></a>02188 }
-<a name="l02189"></a>02189 cpl_free(stored_telluric_data); stored_telluric_data = NULL;
-<a name="l02190"></a>02190 cpl_free(stored_telluric_noise); stored_telluric_noise = NULL;
-<a name="l02191"></a>02191 cpl_free(stored_starspec_data); stored_starspec_data = NULL;
-<a name="l02192"></a>02192 cpl_free(stored_starspec_noise); stored_starspec_noise = NULL;
-<a name="l02193"></a>02193 cpl_free(stored_psf_data); stored_psf_data = NULL;
-<a name="l02194"></a>02194 cpl_free(stored_sub_tel_data_headers); stored_sub_tel_data_headers = NULL;
-<a name="l02195"></a>02195 cpl_free(stored_sub_tel_noise_headers); stored_sub_tel_noise_headers = NULL;
-<a name="l02196"></a>02196 <span class="keywordflow">if</span> (save_cubes) {
-<a name="l02197"></a>02197 cpl_free(stored_sub_cube_data_headers); stored_sub_cube_data_headers = NULL;
-<a name="l02198"></a>02198 cpl_free(stored_sub_cube_noise_headers); stored_sub_cube_noise_headers = NULL;
-<a name="l02199"></a>02199 }
-<a name="l02200"></a>02200 cpl_free(stored_sub_psf_headers); stored_sub_psf_headers = NULL;
-<a name="l02201"></a>02201 cpl_free(stored_qc_throughput); stored_qc_throughput = NULL;
-<a name="l02202"></a>02202 cpl_free(suffix); suffix = NULL;
-<a name="l02203"></a>02203 cpl_free(fn_suffix); fn_suffix = NULL;
-<a name="l02204"></a>02204 cpl_free(stored_mask); stored_mask = NULL;
-<a name="l02205"></a>02205 cpl_free(stored_data_cube); stored_data_cube = NULL;
-<a name="l02206"></a>02206 cpl_free(stored_noise_cube); stored_noise_cube = NULL;
-<a name="l02207"></a>02207 cpl_free(grat_id); grat_id = NULL;
-<a name="l02208"></a>02208 cpl_frameset_delete(frameset_std); frameset_std = NULL;
-<a name="l02209"></a>02209
-<a name="l02210"></a>02210 <span class="keywordflow">return</span> ret_val;
-<a name="l02211"></a>02211 }
-<a name="l02212"></a>02212
+<a name="l02047"></a>02047 <span class="keywordflow">if</span> (!suppress_extension) {
+<a name="l02048"></a>02048 KMO_TRY_EXIT_IF_NULL(
+<a name="l02049"></a>02049 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, suffix));
+<a name="l02050"></a>02050 } <span class="keywordflow">else</span> {
+<a name="l02051"></a>02051 KMO_TRY_EXIT_IF_NULL(
+<a name="l02052"></a>02052 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">""</span>));
+<a name="l02053"></a>02053 }
+<a name="l02054"></a>02054
+<a name="l02055"></a>02055 <span class="comment">// save primary extension</span>
+<a name="l02056"></a>02056 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Saving STD exposure No. %d"</span>, nr_exp+1);
+<a name="l02057"></a>02057 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02058"></a>02058 kmo_dfs_save_main_header(frameset, filename_telluric, fn_suffix,
+<a name="l02059"></a>02059 obj_frame, main_header_tel, parlist,
+<a name="l02060"></a>02060 cpl_func));
+<a name="l02061"></a>02061 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02062"></a>02062 kmo_dfs_save_main_header(frameset, filename_starspec, fn_suffix,
+<a name="l02063"></a>02063 obj_frame, main_header_tel, parlist,
+<a name="l02064"></a>02064 cpl_func));
+<a name="l02065"></a>02065 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02066"></a>02066 kmo_dfs_save_main_header(frameset, filename_mask, fn_suffix,
+<a name="l02067"></a>02067 obj_frame, main_header_psf, parlist,
+<a name="l02068"></a>02068 cpl_func));
+<a name="l02069"></a>02069 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02070"></a>02070 kmo_dfs_save_main_header(frameset, filename_psf, fn_suffix,
+<a name="l02071"></a>02071 obj_frame, main_header_psf, parlist,
+<a name="l02072"></a>02072 cpl_func));
+<a name="l02073"></a>02073 <span class="keywordflow">if</span> (save_cubes) {
+<a name="l02074"></a>02074 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02075"></a>02075 kmo_dfs_save_main_header(frameset, filename_cubes, fn_suffix,
+<a name="l02076"></a>02076 obj_frame, main_header_psf, parlist,
+<a name="l02077"></a>02077 cpl_func));
+<a name="l02078"></a>02078 }
+<a name="l02079"></a>02079
+<a name="l02080"></a>02080 <span class="comment">// save stored frames</span>
+<a name="l02081"></a>02081 <span class="keywordflow">for</span> (i = 1; i <= nr_devices; i++) {
+<a name="l02082"></a>02082 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l02083"></a>02083 ifu_nr = (i-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
+<a name="l02084"></a>02084
+<a name="l02085"></a>02085 <span class="comment">// save telluric-vector</span>
+<a name="l02086"></a>02086 kmclipm_vector *ddd = NULL;
+<a name="l02087"></a>02087 <span class="keywordflow">if</span> (stored_telluric_data[ifu_nr-1] != NULL)
+<a name="l02088"></a>02088 ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_telluric_data[ifu_nr-1]));
+<a name="l02089"></a>02089 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02090"></a>02090 kmo_dfs_save_vector(ddd, filename_telluric, fn_suffix,
+<a name="l02091"></a>02091 stored_sub_tel_data_headers[ifu_nr-1],
+<a name="l02092"></a>02092 0./0.));
+<a name="l02093"></a>02093 kmclipm_vector_delete(ddd); ddd =NULL;
+<a name="l02094"></a>02094
+<a name="l02095"></a>02095 <span class="keywordflow">if</span> (stored_telluric_noise[ifu_nr-1] != NULL)
+<a name="l02096"></a>02096 ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_telluric_noise[ifu_nr-1]));
+<a name="l02097"></a>02097 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02098"></a>02098 kmo_dfs_save_vector(ddd, filename_telluric, fn_suffix,
+<a name="l02099"></a>02099 stored_sub_tel_noise_headers[ifu_nr-1],
+<a name="l02100"></a>02100 0./0.));
+<a name="l02101"></a>02101 kmclipm_vector_delete(ddd); ddd =NULL;
+<a name="l02102"></a>02102
+<a name="l02103"></a>02103 <span class="comment">// save star_spec-vector</span>
+<a name="l02104"></a>02104 <span class="keywordflow">if</span> (stored_starspec_data[ifu_nr-1] != NULL)
+<a name="l02105"></a>02105 ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_starspec_data[ifu_nr-1]));
+<a name="l02106"></a>02106 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02107"></a>02107 kmo_dfs_save_vector(ddd, filename_starspec, fn_suffix,
+<a name="l02108"></a>02108 stored_sub_tel_data_headers[ifu_nr-1],
+<a name="l02109"></a>02109 0./0.));
+<a name="l02110"></a>02110 kmclipm_vector_delete(ddd); ddd =NULL;
+<a name="l02111"></a>02111
+<a name="l02112"></a>02112 <span class="keywordflow">if</span> (stored_starspec_noise[ifu_nr-1] != NULL)
+<a name="l02113"></a>02113 ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_starspec_noise[ifu_nr-1]));
+<a name="l02114"></a>02114 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02115"></a>02115 kmo_dfs_save_vector(ddd, filename_starspec, fn_suffix,
+<a name="l02116"></a>02116 stored_sub_tel_noise_headers[ifu_nr-1],
+<a name="l02117"></a>02117 0./0.));
+<a name="l02118"></a>02118 kmclipm_vector_delete(ddd); ddd =NULL;
+<a name="l02119"></a>02119
+<a name="l02120"></a>02120 <span class="comment">// save psf-image</span>
+<a name="l02121"></a>02121 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02122"></a>02122 kmo_dfs_save_image(stored_psf_data[ifu_nr-1],
+<a name="l02123"></a>02123 filename_psf, fn_suffix,
+<a name="l02124"></a>02124 stored_sub_psf_headers[ifu_nr-1],
+<a name="l02125"></a>02125 0./0.));
+<a name="l02126"></a>02126
+<a name="l02127"></a>02127 <span class="comment">// save mask-image</span>
+<a name="l02128"></a>02128 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02129"></a>02129 kmo_dfs_save_image(stored_mask[ifu_nr-1],
+<a name="l02130"></a>02130 filename_mask, fn_suffix,
+<a name="l02131"></a>02131 stored_sub_psf_headers[ifu_nr-1],
+<a name="l02132"></a>02132 0./0.));
+<a name="l02133"></a>02133 <span class="comment">// save reonstructed cubes</span>
+<a name="l02134"></a>02134 <span class="keywordflow">if</span> (save_cubes) {
+<a name="l02135"></a>02135 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02136"></a>02136 kmo_dfs_save_cube(stored_data_cube[ifu_nr-1],
+<a name="l02137"></a>02137 filename_cubes, fn_suffix,
+<a name="l02138"></a>02138 stored_sub_cube_data_headers[ifu_nr-1],
+<a name="l02139"></a>02139 0./0.));
+<a name="l02140"></a>02140 KMO_TRY_EXIT_IF_ERROR(
+<a name="l02141"></a>02141 kmo_dfs_save_cube(stored_noise_cube[ifu_nr-1],
+<a name="l02142"></a>02142 filename_cubes, fn_suffix,
+<a name="l02143"></a>02143 stored_sub_cube_noise_headers[ifu_nr-1],
+<a name="l02144"></a>02144 0./0.));
+<a name="l02145"></a>02145 }
+<a name="l02146"></a>02146 } <span class="comment">// for j ifus (save stored)</span>
+<a name="l02147"></a>02147 } <span class="comment">// for i detectors (save stored)</span>
+<a name="l02148"></a>02148 KMO_TRY_CHECK_ERROR_STATE();
+<a name="l02149"></a>02149 } <span class="comment">// if (frameCnt == 0)</span>
+<a name="l02150"></a>02150 }
+<a name="l02151"></a>02151 KMO_CATCH
+<a name="l02152"></a>02152 {
+<a name="l02153"></a>02153 KMO_CATCH_MSG();
+<a name="l02154"></a>02154 ret_val = -1;
+<a name="l02155"></a>02155 }
+<a name="l02156"></a>02156
+<a name="l02157"></a>02157 kmo_delete_objSkyStruct(obj_sky_struct);
+<a name="l02158"></a>02158 kmo_free_fits_desc(&desc1);
+<a name="l02159"></a>02159 kmo_free_fits_desc(&desc2);
+<a name="l02160"></a>02160 kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
+<a name="l02161"></a>02161 kmo_free_unused_ifus(unused_ifus_after); unused_ifus_after = NULL;
+<a name="l02162"></a>02162 cpl_free(bounds); bounds = NULL;
+<a name="l02163"></a>02163 cpl_propertylist_delete(main_header_tel); main_header_tel = NULL;
+<a name="l02164"></a>02164 cpl_propertylist_delete(main_header_psf); main_header_psf = NULL;
+<a name="l02165"></a>02165 cpl_vector_delete(atmos_model); atmos_model = NULL;
+<a name="l02166"></a>02166 cpl_vector_delete(solar_spec); solar_spec = NULL;
+<a name="l02167"></a>02167 cpl_table_delete(spec_type_LUT); spec_type_LUT = NULL;
+<a name="l02168"></a>02168 cpl_vector_delete(identified_slices); identified_slices = NULL;
+<a name="l02169"></a>02169 cpl_propertylist_delete(sub_header_orig); sub_header_orig = NULL;
+<a name="l02170"></a>02170 <span class="keywordflow">for</span> (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
+<a name="l02171"></a>02171 cpl_vector_delete(stored_telluric_data[i]); stored_telluric_data[i] = NULL;
+<a name="l02172"></a>02172 cpl_vector_delete(stored_telluric_noise[i]); stored_telluric_noise[i] = NULL;
+<a name="l02173"></a>02173 cpl_vector_delete(stored_starspec_data[i]); stored_starspec_data[i] = NULL;
+<a name="l02174"></a>02174 cpl_vector_delete(stored_starspec_noise[i]); stored_starspec_noise[i] = NULL;
+<a name="l02175"></a>02175 cpl_image_delete(stored_psf_data[i]); stored_psf_data[i] = NULL;
+<a name="l02176"></a>02176 cpl_propertylist_delete(stored_sub_tel_data_headers[i]); stored_sub_tel_data_headers[i] = NULL;
+<a name="l02177"></a>02177 cpl_propertylist_delete(stored_sub_tel_noise_headers[i]); stored_sub_tel_noise_headers[i] = NULL;
+<a name="l02178"></a>02178 <span class="keywordflow">if</span> (save_cubes) {
+<a name="l02179"></a>02179 cpl_propertylist_delete(stored_sub_cube_data_headers[i]); stored_sub_cube_data_headers[i] = NULL;
+<a name="l02180"></a>02180 cpl_propertylist_delete(stored_sub_cube_noise_headers[i]); stored_sub_cube_noise_headers[i] = NULL;
+<a name="l02181"></a>02181 }
+<a name="l02182"></a>02182 cpl_propertylist_delete(stored_sub_psf_headers[i]); stored_sub_psf_headers[i] = NULL;
+<a name="l02183"></a>02183 cpl_image_delete(stored_mask[i]); stored_mask[i] = NULL;
+<a name="l02184"></a>02184 cpl_imagelist_delete(stored_data_cube[i]); stored_data_cube[i] = NULL;
+<a name="l02185"></a>02185 cpl_imagelist_delete(stored_noise_cube[i]); stored_noise_cube[i] = NULL;
+<a name="l02186"></a>02186 }
+<a name="l02187"></a>02187 cpl_free(stored_telluric_data); stored_telluric_data = NULL;
+<a name="l02188"></a>02188 cpl_free(stored_telluric_noise); stored_telluric_noise = NULL;
+<a name="l02189"></a>02189 cpl_free(stored_starspec_data); stored_starspec_data = NULL;
+<a name="l02190"></a>02190 cpl_free(stored_starspec_noise); stored_starspec_noise = NULL;
+<a name="l02191"></a>02191 cpl_free(stored_psf_data); stored_psf_data = NULL;
+<a name="l02192"></a>02192 cpl_free(stored_sub_tel_data_headers); stored_sub_tel_data_headers = NULL;
+<a name="l02193"></a>02193 cpl_free(stored_sub_tel_noise_headers); stored_sub_tel_noise_headers = NULL;
+<a name="l02194"></a>02194 <span class="keywordflow">if</span> (save_cubes) {
+<a name="l02195"></a>02195 cpl_free(stored_sub_cube_data_headers); stored_sub_cube_data_headers = NULL;
+<a name="l02196"></a>02196 cpl_free(stored_sub_cube_noise_headers); stored_sub_cube_noise_headers = NULL;
+<a name="l02197"></a>02197 }
+<a name="l02198"></a>02198 cpl_free(stored_sub_psf_headers); stored_sub_psf_headers = NULL;
+<a name="l02199"></a>02199 cpl_free(stored_qc_throughput); stored_qc_throughput = NULL;
+<a name="l02200"></a>02200 cpl_free(suffix); suffix = NULL;
+<a name="l02201"></a>02201 cpl_free(fn_suffix); fn_suffix = NULL;
+<a name="l02202"></a>02202 cpl_free(stored_mask); stored_mask = NULL;
+<a name="l02203"></a>02203 cpl_free(stored_data_cube); stored_data_cube = NULL;
+<a name="l02204"></a>02204 cpl_free(stored_noise_cube); stored_noise_cube = NULL;
+<a name="l02205"></a>02205 cpl_free(grat_id); grat_id = NULL;
+<a name="l02206"></a>02206 cpl_frameset_delete(frameset_std); frameset_std = NULL;
+<a name="l02207"></a>02207
+<a name="l02208"></a>02208 <span class="keywordflow">return</span> ret_val;
+<a name="l02209"></a>02209 }
+<a name="l02210"></a>02210
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/kmo__wave__cal_8c_source.html b/html/kmo__wave__cal_8c_source.html
index 1c22086..b44fce4 100644
--- a/html/kmo__wave__cal_8c_source.html
+++ b/html/kmo__wave__cal_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">kmo_wave_cal.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_wave_cal.c,v 1.53 2013/08/07 14:40:46 aagudo Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: kmo_wave_cal.c,v 1.54 2013-09-17 08:54:03 aagudo Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: aagudo $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/08/07 14:40:46 $</span>
-<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.53 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-09-17 08:54:03 $</span>
+<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.54 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -1168,159 +1168,160 @@
<a name="l01153"></a>01153 cpl_propertylist_erase(stored_sub_headers_lcal[sx], CDELT1);
<a name="l01154"></a>01154 cpl_propertylist_erase(stored_sub_headers_lcal[sx], CDELT2);
<a name="l01155"></a>01155
-<a name="l01156"></a>01156 cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX1);
-<a name="l01157"></a>01157 cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX2);
-<a name="l01158"></a>01158 <span class="keywordflow">if</span> (cpl_propertylist_has(stored_sub_headers_lcal[sx], CRPIX1)) {
-<a name="l01159"></a>01159 cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX1);
-<a name="l01160"></a>01160 }
-<a name="l01161"></a>01161 <span class="keywordflow">if</span> (cpl_propertylist_has(stored_sub_headers_lcal[sx], CRPIX2)) {
-<a name="l01162"></a>01162 cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX2);
-<a name="l01163"></a>01163 }
-<a name="l01164"></a>01164
-<a name="l01165"></a>01165 <span class="comment">// free memory</span>
-<a name="l01166"></a>01166 cpl_image_delete(det_lamp_on); det_lamp_on = NULL;
-<a name="l01167"></a>01167 cpl_image_delete(det_lamp_on_copy); det_lamp_on_copy = NULL;
-<a name="l01168"></a>01168 cpl_image_delete(det_lamp_off); det_lamp_off = NULL;
-<a name="l01169"></a>01169 cpl_image_delete(bad_pix_mask); bad_pix_mask = NULL;
-<a name="l01170"></a>01170 cpl_image_delete(xcal); xcal = NULL;
-<a name="l01171"></a>01171 cpl_image_delete(ycal); ycal = NULL;
-<a name="l01172"></a>01172
-<a name="l01173"></a>01173 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
-<a name="l01174"></a>01174 cpl_table_delete(edge_table[i-1][j]); edge_table[i-1][j] = NULL;
-<a name="l01175"></a>01175 }
-<a name="l01176"></a>01176 } <span class="comment">// for i devices</span>
-<a name="l01177"></a>01177 } <span class="comment">// for a angles</span>
-<a name="l01178"></a>01178
-<a name="l01179"></a>01179 <span class="keywordflow">if</span> (line_estimate_method == 2) {
-<a name="l01180"></a>01180 cpl_table_delete(reflines); reflines = NULL;
-<a name="l01181"></a>01181 }
-<a name="l01182"></a>01182 <span class="comment">// ###########################################################################</span>
-<a name="l01183"></a>01183 <span class="comment">// ### QC parameters & saving</span>
-<a name="l01184"></a>01184 <span class="comment">// ###########################################################################</span>
-<a name="l01185"></a>01185 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Saving data..."</span>);
-<a name="l01186"></a>01186
-<a name="l01187"></a>01187 <span class="comment">//</span>
-<a name="l01188"></a>01188 <span class="comment">// ------------ load, update & save primary header ------------</span>
-<a name="l01189"></a>01189 <span class="comment">//</span>
-<a name="l01190"></a>01190 <span class="keywordflow">if</span> (!suppress_extension) {
-<a name="l01191"></a>01191 KMO_TRY_EXIT_IF_NULL(
-<a name="l01192"></a>01192 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, suffix));
-<a name="l01193"></a>01193 } <span class="keywordflow">else</span> {
-<a name="l01194"></a>01194 KMO_TRY_EXIT_IF_NULL(
-<a name="l01195"></a>01195 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">""</span>));
-<a name="l01196"></a>01196 }
-<a name="l01197"></a>01197
-<a name="l01198"></a>01198 <span class="comment">// update which IFUs are not used</span>
-<a name="l01199"></a>01199 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01200"></a>01200 kmo_set_unused_ifus(unused_ifus_after, main_header,
-<a name="l01201"></a>01201 <span class="stringliteral">"kmo_wave_cal"</span>));
-<a name="l01202"></a>01202
-<a name="l01203"></a>01203 KMO_TRY_EXIT_IF_NULL(
-<a name="l01204"></a>01204 frame = kmo_dfs_get_frame(frameset, ARC_ON));
-<a name="l01205"></a>01205
-<a name="l01206"></a>01206 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01207"></a>01207 kmo_dfs_save_main_header(frameset, filename_lcal, fn_suffix, frame,
-<a name="l01208"></a>01208 main_header, parlist, cpl_func));
-<a name="l01209"></a>01209
-<a name="l01210"></a>01210 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01211"></a>01211 kmo_dfs_save_main_header(frameset, filename_det_img, fn_suffix, frame,
-<a name="l01212"></a>01212 main_header, parlist, cpl_func));
-<a name="l01213"></a>01213
-<a name="l01214"></a>01214 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l01215"></a>01215
-<a name="l01216"></a>01216 <span class="comment">//</span>
-<a name="l01217"></a>01217 <span class="comment">// --- save sub-frames ---</span>
-<a name="l01218"></a>01218 <span class="comment">//</span>
-<a name="l01219"></a>01219 <span class="keywordflow">for</span> (a = 0; a < nr_angles; a++) {
-<a name="l01220"></a>01220 <span class="keywordflow">for</span> (i = 1; i <= nr_devices; i++) {
-<a name="l01221"></a>01221 <span class="keywordtype">int</span> sx = a * nr_devices + (i - 1);
-<a name="l01222"></a>01222 <span class="comment">// save lcal-frame</span>
-<a name="l01223"></a>01223 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01224"></a>01224 kmo_dfs_save_image(stored_lcal[sx], filename_lcal, fn_suffix,
-<a name="l01225"></a>01225 stored_sub_headers_lcal[sx], 0./0.));
-<a name="l01226"></a>01226
-<a name="l01227"></a>01227 <span class="comment">// save detector image</span>
-<a name="l01228"></a>01228 KMO_TRY_EXIT_IF_ERROR(
-<a name="l01229"></a>01229 kmo_dfs_save_image(stored_det_img[sx], filename_det_img, fn_suffix,
-<a name="l01230"></a>01230 stored_sub_headers_det_img[sx], 0./0.));
-<a name="l01231"></a>01231 } <span class="comment">// for i = nr_devices</span>
-<a name="l01232"></a>01232 } <span class="comment">// for a angles</span>
-<a name="l01233"></a>01233
-<a name="l01234"></a>01234 <span class="comment">// print which IFUs are not used</span>
-<a name="l01235"></a>01235 kmo_print_unused_ifus(unused_ifus_after, TRUE);
-<a name="l01236"></a>01236 }
-<a name="l01237"></a>01237 KMO_CATCH
-<a name="l01238"></a>01238 {
-<a name="l01239"></a>01239 KMO_CATCH_MSG();
-<a name="l01240"></a>01240 ret_val = -1;
-<a name="l01241"></a>01241 }
-<a name="l01242"></a>01242
-<a name="l01243"></a>01243 <span class="keywordflow">if</span> (last_env != NULL) {
-<a name="l01244"></a>01244 setenv(<span class="stringliteral">"KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE"</span>,last_env,1);
-<a name="l01245"></a>01245 } <span class="keywordflow">else</span> {
-<a name="l01246"></a>01246 unsetenv(<span class="stringliteral">"KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE"</span>);
-<a name="l01247"></a>01247 }
-<a name="l01248"></a>01248
-<a name="l01249"></a>01249 kmo_free_fits_desc(&desc1);
-<a name="l01250"></a>01250 kmo_free_fits_desc(&desc2);
-<a name="l01251"></a>01251 <span class="keywordflow">if</span> (unused_ifus_before != NULL) {
-<a name="l01252"></a>01252 kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
-<a name="l01253"></a>01253 }
-<a name="l01254"></a>01254 <span class="keywordflow">if</span> (unused_ifus_after != NULL) {
-<a name="l01255"></a>01255 kmo_free_unused_ifus(unused_ifus_after); unused_ifus_after = NULL;
-<a name="l01256"></a>01256 }
-<a name="l01257"></a>01257 cpl_propertylist_delete(main_header); main_header = NULL;
-<a name="l01258"></a>01258 cpl_image_delete(det_lamp_on); det_lamp_on = NULL;
-<a name="l01259"></a>01259 cpl_image_delete(det_lamp_off); det_lamp_off = NULL;
-<a name="l01260"></a>01260 cpl_image_delete(bad_pix_mask); bad_pix_mask = NULL;
-<a name="l01261"></a>01261 cpl_table_delete(arclines); arclines = NULL;
-<a name="l01262"></a>01262 cpl_table_delete(reflines); reflines = NULL;
-<a name="l01263"></a>01263 cpl_free(stored_qc_arc_sat); stored_qc_arc_sat = NULL;
-<a name="l01264"></a>01264 cpl_free(stored_qc_ar_eff); stored_qc_ar_eff = NULL;
-<a name="l01265"></a>01265 cpl_free(stored_qc_ne_eff); stored_qc_ne_eff = NULL;
-<a name="l01266"></a>01266 <span class="keywordflow">for</span> (i = 0; i < nr_devices * nr_angles; i++) {
-<a name="l01267"></a>01267 cpl_image_delete(stored_lcal[i]); stored_lcal[i] = NULL;
-<a name="l01268"></a>01268 cpl_image_delete(stored_det_img[i]); stored_det_img[i] = NULL;
-<a name="l01269"></a>01269 cpl_propertylist_delete(stored_sub_headers_lcal[i]);
-<a name="l01270"></a>01270 stored_sub_headers_lcal[i] = NULL;
-<a name="l01271"></a>01271 cpl_propertylist_delete(stored_sub_headers_det_img[i]);
-<a name="l01272"></a>01272 stored_sub_headers_det_img[i] = NULL;
-<a name="l01273"></a>01273 }
-<a name="l01274"></a>01274 <span class="keywordflow">for</span> (i = 0; i < nr_angles; i++) {
-<a name="l01275"></a>01275 cpl_frameset_delete(angle_frameset[i]); angle_frameset[i] = NULL;
-<a name="l01276"></a>01276 }
-<a name="l01277"></a>01277 <span class="keywordflow">if</span> (filter_ids != NULL) {
-<a name="l01278"></a>01278 <span class="keywordflow">for</span> (i = 0; i < nr_devices; i++) {
-<a name="l01279"></a>01279 cpl_free(filter_ids[i]); filter_ids[i] = NULL;
-<a name="l01280"></a>01280
-<a name="l01281"></a>01281 }
-<a name="l01282"></a>01282 cpl_free(filter_ids); filter_ids = NULL;
-<a name="l01283"></a>01283 }
-<a name="l01284"></a>01284 <span class="keywordflow">if</span> (edge_table != NULL) {
-<a name="l01285"></a>01285 <span class="keywordflow">for</span> (i = 0; i < nr_devices; i++) {
-<a name="l01286"></a>01286 cpl_free(edge_table[i]); edge_table[i] = NULL;
-<a name="l01287"></a>01287 }
-<a name="l01288"></a>01288 cpl_free(edge_table); edge_table = NULL;
-<a name="l01289"></a>01289 }
-<a name="l01290"></a>01290
-<a name="l01291"></a>01291 cpl_free(angle_frameset); angle_frameset = NULL;
-<a name="l01292"></a>01292 cpl_free(stored_lcal); stored_lcal = NULL;
-<a name="l01293"></a>01293 cpl_free(stored_det_img); stored_det_img = NULL;
-<a name="l01294"></a>01294 cpl_free(stored_sub_headers_lcal); stored_sub_headers_lcal = NULL;
-<a name="l01295"></a>01295 cpl_free(stored_sub_headers_det_img); stored_sub_headers_det_img = NULL;
-<a name="l01296"></a>01296 cpl_free(readmode); readmode = NULL;
-<a name="l01297"></a>01297 cpl_bivector_delete(lines); lines = NULL;
-<a name="l01298"></a>01298 cpl_free(suffix); suffix = NULL;
-<a name="l01299"></a>01299 cpl_free(fn_suffix); fn_suffix = NULL;
-<a name="l01300"></a>01300
-<a name="l01301"></a>01301 <span class="keywordflow">return</span> ret_val;
-<a name="l01302"></a>01302 }
-<a name="l01303"></a>01303
+<a name="l01156"></a>01156 <span class="comment">// leave keywords in for proper fitsverify output</span>
+<a name="l01157"></a>01157 <span class="comment">// cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX1);</span>
+<a name="l01158"></a>01158 <span class="comment">// cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX2);</span>
+<a name="l01159"></a>01159 <span class="comment">// if (cpl_propertylist_has(stored_sub_headers_lcal[sx], CRPIX1)) {</span>
+<a name="l01160"></a>01160 <span class="comment">// cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX1);</span>
+<a name="l01161"></a>01161 <span class="comment">// }</span>
+<a name="l01162"></a>01162 <span class="comment">// if (cpl_propertylist_has(stored_sub_headers_lcal[sx], CRPIX2)) {</span>
+<a name="l01163"></a>01163 <span class="comment">// cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX2);</span>
+<a name="l01164"></a>01164 <span class="comment">// }</span>
+<a name="l01165"></a>01165
+<a name="l01166"></a>01166 <span class="comment">// free memory</span>
+<a name="l01167"></a>01167 cpl_image_delete(det_lamp_on); det_lamp_on = NULL;
+<a name="l01168"></a>01168 cpl_image_delete(det_lamp_on_copy); det_lamp_on_copy = NULL;
+<a name="l01169"></a>01169 cpl_image_delete(det_lamp_off); det_lamp_off = NULL;
+<a name="l01170"></a>01170 cpl_image_delete(bad_pix_mask); bad_pix_mask = NULL;
+<a name="l01171"></a>01171 cpl_image_delete(xcal); xcal = NULL;
+<a name="l01172"></a>01172 cpl_image_delete(ycal); ycal = NULL;
+<a name="l01173"></a>01173
+<a name="l01174"></a>01174 <span class="keywordflow">for</span> (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+<a name="l01175"></a>01175 cpl_table_delete(edge_table[i-1][j]); edge_table[i-1][j] = NULL;
+<a name="l01176"></a>01176 }
+<a name="l01177"></a>01177 } <span class="comment">// for i devices</span>
+<a name="l01178"></a>01178 } <span class="comment">// for a angles</span>
+<a name="l01179"></a>01179
+<a name="l01180"></a>01180 <span class="keywordflow">if</span> (line_estimate_method == 2) {
+<a name="l01181"></a>01181 cpl_table_delete(reflines); reflines = NULL;
+<a name="l01182"></a>01182 }
+<a name="l01183"></a>01183 <span class="comment">// ###########################################################################</span>
+<a name="l01184"></a>01184 <span class="comment">// ### QC parameters & saving</span>
+<a name="l01185"></a>01185 <span class="comment">// ###########################################################################</span>
+<a name="l01186"></a>01186 cpl_msg_info(<span class="stringliteral">""</span>,<span class="stringliteral">"Saving data..."</span>);
+<a name="l01187"></a>01187
+<a name="l01188"></a>01188 <span class="comment">//</span>
+<a name="l01189"></a>01189 <span class="comment">// ------------ load, update & save primary header ------------</span>
+<a name="l01190"></a>01190 <span class="comment">//</span>
+<a name="l01191"></a>01191 <span class="keywordflow">if</span> (!suppress_extension) {
+<a name="l01192"></a>01192 KMO_TRY_EXIT_IF_NULL(
+<a name="l01193"></a>01193 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, suffix));
+<a name="l01194"></a>01194 } <span class="keywordflow">else</span> {
+<a name="l01195"></a>01195 KMO_TRY_EXIT_IF_NULL(
+<a name="l01196"></a>01196 fn_suffix = cpl_sprintf(<span class="stringliteral">"%s"</span>, <span class="stringliteral">""</span>));
+<a name="l01197"></a>01197 }
+<a name="l01198"></a>01198
+<a name="l01199"></a>01199 <span class="comment">// update which IFUs are not used</span>
+<a name="l01200"></a>01200 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01201"></a>01201 kmo_set_unused_ifus(unused_ifus_after, main_header,
+<a name="l01202"></a>01202 <span class="stringliteral">"kmo_wave_cal"</span>));
+<a name="l01203"></a>01203
+<a name="l01204"></a>01204 KMO_TRY_EXIT_IF_NULL(
+<a name="l01205"></a>01205 frame = kmo_dfs_get_frame(frameset, ARC_ON));
+<a name="l01206"></a>01206
+<a name="l01207"></a>01207 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01208"></a>01208 kmo_dfs_save_main_header(frameset, filename_lcal, fn_suffix, frame,
+<a name="l01209"></a>01209 main_header, parlist, cpl_func));
+<a name="l01210"></a>01210
+<a name="l01211"></a>01211 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01212"></a>01212 kmo_dfs_save_main_header(frameset, filename_det_img, fn_suffix, frame,
+<a name="l01213"></a>01213 main_header, parlist, cpl_func));
+<a name="l01214"></a>01214
+<a name="l01215"></a>01215 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l01216"></a>01216
+<a name="l01217"></a>01217 <span class="comment">//</span>
+<a name="l01218"></a>01218 <span class="comment">// --- save sub-frames ---</span>
+<a name="l01219"></a>01219 <span class="comment">//</span>
+<a name="l01220"></a>01220 <span class="keywordflow">for</span> (a = 0; a < nr_angles; a++) {
+<a name="l01221"></a>01221 <span class="keywordflow">for</span> (i = 1; i <= nr_devices; i++) {
+<a name="l01222"></a>01222 <span class="keywordtype">int</span> sx = a * nr_devices + (i - 1);
+<a name="l01223"></a>01223 <span class="comment">// save lcal-frame</span>
+<a name="l01224"></a>01224 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01225"></a>01225 kmo_dfs_save_image(stored_lcal[sx], filename_lcal, fn_suffix,
+<a name="l01226"></a>01226 stored_sub_headers_lcal[sx], 0./0.));
+<a name="l01227"></a>01227
+<a name="l01228"></a>01228 <span class="comment">// save detector image</span>
+<a name="l01229"></a>01229 KMO_TRY_EXIT_IF_ERROR(
+<a name="l01230"></a>01230 kmo_dfs_save_image(stored_det_img[sx], filename_det_img, fn_suffix,
+<a name="l01231"></a>01231 stored_sub_headers_det_img[sx], 0./0.));
+<a name="l01232"></a>01232 } <span class="comment">// for i = nr_devices</span>
+<a name="l01233"></a>01233 } <span class="comment">// for a angles</span>
+<a name="l01234"></a>01234
+<a name="l01235"></a>01235 <span class="comment">// print which IFUs are not used</span>
+<a name="l01236"></a>01236 kmo_print_unused_ifus(unused_ifus_after, TRUE);
+<a name="l01237"></a>01237 }
+<a name="l01238"></a>01238 KMO_CATCH
+<a name="l01239"></a>01239 {
+<a name="l01240"></a>01240 KMO_CATCH_MSG();
+<a name="l01241"></a>01241 ret_val = -1;
+<a name="l01242"></a>01242 }
+<a name="l01243"></a>01243
+<a name="l01244"></a>01244 <span class="keywordflow">if</span> (last_env != NULL) {
+<a name="l01245"></a>01245 setenv(<span class="stringliteral">"KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE"</span>,last_env,1);
+<a name="l01246"></a>01246 } <span class="keywordflow">else</span> {
+<a name="l01247"></a>01247 unsetenv(<span class="stringliteral">"KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE"</span>);
+<a name="l01248"></a>01248 }
+<a name="l01249"></a>01249
+<a name="l01250"></a>01250 kmo_free_fits_desc(&desc1);
+<a name="l01251"></a>01251 kmo_free_fits_desc(&desc2);
+<a name="l01252"></a>01252 <span class="keywordflow">if</span> (unused_ifus_before != NULL) {
+<a name="l01253"></a>01253 kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
+<a name="l01254"></a>01254 }
+<a name="l01255"></a>01255 <span class="keywordflow">if</span> (unused_ifus_after != NULL) {
+<a name="l01256"></a>01256 kmo_free_unused_ifus(unused_ifus_after); unused_ifus_after = NULL;
+<a name="l01257"></a>01257 }
+<a name="l01258"></a>01258 cpl_propertylist_delete(main_header); main_header = NULL;
+<a name="l01259"></a>01259 cpl_image_delete(det_lamp_on); det_lamp_on = NULL;
+<a name="l01260"></a>01260 cpl_image_delete(det_lamp_off); det_lamp_off = NULL;
+<a name="l01261"></a>01261 cpl_image_delete(bad_pix_mask); bad_pix_mask = NULL;
+<a name="l01262"></a>01262 cpl_table_delete(arclines); arclines = NULL;
+<a name="l01263"></a>01263 cpl_table_delete(reflines); reflines = NULL;
+<a name="l01264"></a>01264 cpl_free(stored_qc_arc_sat); stored_qc_arc_sat = NULL;
+<a name="l01265"></a>01265 cpl_free(stored_qc_ar_eff); stored_qc_ar_eff = NULL;
+<a name="l01266"></a>01266 cpl_free(stored_qc_ne_eff); stored_qc_ne_eff = NULL;
+<a name="l01267"></a>01267 <span class="keywordflow">for</span> (i = 0; i < nr_devices * nr_angles; i++) {
+<a name="l01268"></a>01268 cpl_image_delete(stored_lcal[i]); stored_lcal[i] = NULL;
+<a name="l01269"></a>01269 cpl_image_delete(stored_det_img[i]); stored_det_img[i] = NULL;
+<a name="l01270"></a>01270 cpl_propertylist_delete(stored_sub_headers_lcal[i]);
+<a name="l01271"></a>01271 stored_sub_headers_lcal[i] = NULL;
+<a name="l01272"></a>01272 cpl_propertylist_delete(stored_sub_headers_det_img[i]);
+<a name="l01273"></a>01273 stored_sub_headers_det_img[i] = NULL;
+<a name="l01274"></a>01274 }
+<a name="l01275"></a>01275 <span class="keywordflow">for</span> (i = 0; i < nr_angles; i++) {
+<a name="l01276"></a>01276 cpl_frameset_delete(angle_frameset[i]); angle_frameset[i] = NULL;
+<a name="l01277"></a>01277 }
+<a name="l01278"></a>01278 <span class="keywordflow">if</span> (filter_ids != NULL) {
+<a name="l01279"></a>01279 <span class="keywordflow">for</span> (i = 0; i < nr_devices; i++) {
+<a name="l01280"></a>01280 cpl_free(filter_ids[i]); filter_ids[i] = NULL;
+<a name="l01281"></a>01281
+<a name="l01282"></a>01282 }
+<a name="l01283"></a>01283 cpl_free(filter_ids); filter_ids = NULL;
+<a name="l01284"></a>01284 }
+<a name="l01285"></a>01285 <span class="keywordflow">if</span> (edge_table != NULL) {
+<a name="l01286"></a>01286 <span class="keywordflow">for</span> (i = 0; i < nr_devices; i++) {
+<a name="l01287"></a>01287 cpl_free(edge_table[i]); edge_table[i] = NULL;
+<a name="l01288"></a>01288 }
+<a name="l01289"></a>01289 cpl_free(edge_table); edge_table = NULL;
+<a name="l01290"></a>01290 }
+<a name="l01291"></a>01291
+<a name="l01292"></a>01292 cpl_free(angle_frameset); angle_frameset = NULL;
+<a name="l01293"></a>01293 cpl_free(stored_lcal); stored_lcal = NULL;
+<a name="l01294"></a>01294 cpl_free(stored_det_img); stored_det_img = NULL;
+<a name="l01295"></a>01295 cpl_free(stored_sub_headers_lcal); stored_sub_headers_lcal = NULL;
+<a name="l01296"></a>01296 cpl_free(stored_sub_headers_det_img); stored_sub_headers_det_img = NULL;
+<a name="l01297"></a>01297 cpl_free(readmode); readmode = NULL;
+<a name="l01298"></a>01298 cpl_bivector_delete(lines); lines = NULL;
+<a name="l01299"></a>01299 cpl_free(suffix); suffix = NULL;
+<a name="l01300"></a>01300 cpl_free(fn_suffix); fn_suffix = NULL;
+<a name="l01301"></a>01301
+<a name="l01302"></a>01302 <span class="keywordflow">return</span> ret_val;
+<a name="l01303"></a>01303 }
+<a name="l01304"></a>01304
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/modules.html b/html/modules.html
index 8618a77..13f1b88 100644
--- a/html/modules.html
+++ b/html/modules.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -63,8 +63,9 @@
<li><a class="el" href="group__kmo__fits__strip.html">kmo_fits_strip Create noise map.</a></li>
<li><a class="el" href="group__kmo__flat.html">kmo_flat Create master flatfield frame and badpixel map</a></li>
<li><a class="el" href="group__kmo__illumination.html">kmo_illumination Create a calibration frame to correct spatial non-uniformity of flatfield</a></li>
+<li><a class="el" href="group__kmo__illumination__flat.html">kmo_illumination_flat Create a calibration frame to correct spatial non-uniformity of flatfield</a></li>
<li><a class="el" href="group__kmo__make__image.html">kmo_make_image Collapse a cube to create a spatial</a></li>
-<li><a class="el" href="group__kmo__multi__reconstruct.html">kmo_multi_reconstruct Combine cubes</a></li>
+<li><a class="el" href="group__kmo__multi__reconstruct.html">kmo_multi_reconstruct Reconstruct and combine</a></li>
<li><a class="el" href="group__kmo__noise__map.html">kmo_noise_map Create noise map.</a></li>
<li><a class="el" href="group__kmo__reconstruct.html">kmo_reconstruct Performs the cube reconstruction</a></li>
<li><a class="el" href="group__kmo__rotate.html">kmo_rotate Rotate a cube spatially</a></li>
@@ -80,7 +81,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/html/yves__kmo__flat_8c_source.html b/html/yves__kmo__flat_8c_source.html
index ca92627..e239f3a 100644
--- a/html/yves__kmo__flat_8c_source.html
+++ b/html/yves__kmo__flat_8c_source.html
@@ -23,7 +23,7 @@
<td style="padding-left: 0.5em;">
<div id="projectname">KMOS Pipeline Reference Manual
- <span id="projectnumber">1.2.4</span>
+ <span id="projectnumber">1.2.6</span>
</div>
</td>
@@ -51,7 +51,7 @@
</div>
<div id="nav-path" class="navpath">
<ul>
- <li class="navelem"><a class="el" href="dir_a86dc504884ba10769fa325b50ed7308.html">recipes</a> </li>
+ <li class="navelem"><a class="el" href="dir_cf7033f5228c85e1a96cc09a6a6f109b.html">recipes</a> </li>
</ul>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="title">yves_kmo_flat.c</div> </div>
</div><!--header-->
<div class="contents">
-<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: yves_kmo_flat.c,v 1.4 2013/01/27 03:07:33 yjung Exp $</span>
+<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: yves_kmo_flat.c,v 1.4 2013-01-27 03:07:33 yjung Exp $</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of the KMOS Pipeline</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002,2003 European Southern Observatory</span>
@@ -82,9 +82,9 @@
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * $Author: yjung $</span>
-<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013/01/27 03:07:33 $</span>
+<a name="l00023"></a>00023 <span class="comment"> * $Date: 2013-01-27 03:07:33 $</span>
<a name="l00024"></a>00024 <span class="comment"> * $Revision: 1.4 $</span>
-<a name="l00025"></a>00025 <span class="comment"> * $Name: kmosp_v1_2_4__20130807 $</span>
+<a name="l00025"></a>00025 <span class="comment"> * $Name: not supported by cvs2svn $</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
@@ -1192,7 +1192,7 @@
<hr class="footer"/><address class="footer"><small>
-Generated on Mon Sep 16 2013 14:58:51 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
+Generated on Fri Nov 8 2013 11:35:36 for KMOS Pipeline Reference Manual by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
diff --git a/irplib/irplib_calib.c b/irplib/irplib_calib.c
index 830903a..00ade1d 100644
--- a/irplib/irplib_calib.c
+++ b/irplib/irplib_calib.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_calib.c,v 1.19 2013/03/01 10:26:22 llundin Exp $
+/* $Id: irplib_calib.c,v 1.19 2013-03-01 10:26:22 llundin Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2013/03/01 10:26:22 $
+ * $Date: 2013-03-01 10:26:22 $
* $Revision: 1.19 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_calib.h b/irplib/irplib_calib.h
index a35433c..e889751 100644
--- a/irplib/irplib_calib.h
+++ b/irplib/irplib_calib.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_calib.h,v 1.8 2007/02/12 10:34:51 amodigli Exp $
+/* $Id: irplib_calib.h,v 1.8 2007-02-12 10:34:51 amodigli Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: amodigli $
- * $Date: 2007/02/12 10:34:51 $
+ * $Date: 2007-02-12 10:34:51 $
* $Revision: 1.8 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_CALIB_H
diff --git a/irplib/irplib_cat.c b/irplib/irplib_cat.c
index 60f007b..16e6a32 100644
--- a/irplib/irplib_cat.c
+++ b/irplib/irplib_cat.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_cat.c,v 1.10 2009/12/01 12:34:25 cgarcia Exp $
+/* $Id: irplib_cat.c,v 1.10 2009-12-01 12:34:25 cgarcia Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: cgarcia $
- * $Date: 2009/12/01 12:34:25 $
+ * $Date: 2009-12-01 12:34:25 $
* $Revision: 1.10 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_cat.h b/irplib/irplib_cat.h
index 91c25a6..314aef6 100644
--- a/irplib/irplib_cat.h
+++ b/irplib/irplib_cat.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_cat.h,v 1.5 2009/12/16 14:49:52 cgarcia Exp $
+/* $Id: irplib_cat.h,v 1.5 2009-12-16 14:49:52 cgarcia Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: cgarcia $
- * $Date: 2009/12/16 14:49:52 $
+ * $Date: 2009-12-16 14:49:52 $
* $Revision: 1.5 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_CAT_H
diff --git a/irplib/irplib_distortion.c b/irplib/irplib_distortion.c
index f364aeb..02a53dc 100644
--- a/irplib/irplib_distortion.c
+++ b/irplib/irplib_distortion.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_distortion.c,v 1.52 2013/01/29 08:43:33 jtaylor Exp $
+/* $Id: irplib_distortion.c,v 1.52 2013-01-29 08:43:33 jtaylor Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/01/29 08:43:33 $
+ * $Date: 2013-01-29 08:43:33 $
* $Revision: 1.52 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_distortion.h b/irplib/irplib_distortion.h
index f144a14..69076dd 100644
--- a/irplib/irplib_distortion.h
+++ b/irplib/irplib_distortion.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_distortion.h,v 1.6 2013/01/29 08:43:33 jtaylor Exp $
+/* $Id: irplib_distortion.h,v 1.6 2013-01-29 08:43:33 jtaylor Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/01/29 08:43:33 $
+ * $Date: 2013-01-29 08:43:33 $
* $Revision: 1.6 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_DISTORTION_H
diff --git a/irplib/irplib_flat.c b/irplib/irplib_flat.c
index ab339b8..4b83bc8 100644
--- a/irplib/irplib_flat.c
+++ b/irplib/irplib_flat.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_flat.c,v 1.15 2007/08/07 12:15:41 llundin Exp $
+/* $Id: irplib_flat.c,v 1.15 2007-08-07 12:15:41 llundin Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2007/08/07 12:15:41 $
+ * $Date: 2007-08-07 12:15:41 $
* $Revision: 1.15 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_flat.h b/irplib/irplib_flat.h
index 3649e0f..bc8c450 100644
--- a/irplib/irplib_flat.h
+++ b/irplib/irplib_flat.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_flat.h,v 1.4 2005/09/15 11:47:16 llundin Exp $
+/* $Id: irplib_flat.h,v 1.4 2005-09-15 11:47:16 llundin Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2005/09/15 11:47:16 $
+ * $Date: 2005-09-15 11:47:16 $
* $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_FLAT_H
diff --git a/irplib/irplib_framelist.c b/irplib/irplib_framelist.c
index 0c40f2e..fb0c2b4 100644
--- a/irplib/irplib_framelist.c
+++ b/irplib/irplib_framelist.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_framelist.c,v 1.30 2013/02/27 16:05:13 jtaylor Exp $
+/* $Id: irplib_framelist.c,v 1.30 2013-02-27 16:05:13 jtaylor Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/02/27 16:05:13 $
+ * $Date: 2013-02-27 16:05:13 $
* $Revision: 1.30 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
diff --git a/irplib/irplib_framelist.h b/irplib/irplib_framelist.h
index 0cfb8c1..b61ad0b 100644
--- a/irplib/irplib_framelist.h
+++ b/irplib/irplib_framelist.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_framelist.h,v 1.8 2008/11/20 10:24:47 llundin Exp $
+/* $Id: irplib_framelist.h,v 1.8 2008-11-20 10:24:47 llundin Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2008/11/20 10:24:47 $
+ * $Date: 2008-11-20 10:24:47 $
* $Revision: 1.8 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_FRAMELIST_H
diff --git a/irplib/irplib_hist.c b/irplib/irplib_hist.c
index 98ab03d..1f480df 100644
--- a/irplib/irplib_hist.c
+++ b/irplib/irplib_hist.c
@@ -21,10 +21,10 @@
/*
* $Author: jtaylor $
- * $Id: irplib_hist.c,v 1.8 2013/07/04 12:10:12 jtaylor Exp $
- * $Date: 2013/07/04 12:10:12 $
+ * $Id: irplib_hist.c,v 1.8 2013-07-04 12:10:12 jtaylor Exp $
+ * $Date: 2013-07-04 12:10:12 $
* $Revision: 1.8 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_hist.h b/irplib/irplib_hist.h
index ef57f5b..08c7d00 100644
--- a/irplib/irplib_hist.h
+++ b/irplib/irplib_hist.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_hist.h,v 1.3 2007/09/07 14:23:50 lbilbao Exp $
+/* $Id: irplib_hist.h,v 1.3 2007-09-07 14:23:50 lbilbao Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002, 2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: lbilbao $
- * $Date: 2007/09/07 14:23:50 $
+ * $Date: 2007-09-07 14:23:50 $
* $Revision: 1.3 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_HIST_H
diff --git a/irplib/irplib_ksigma_clip.c b/irplib/irplib_ksigma_clip.c
index 2131ab0..8fd696d 100644
--- a/irplib/irplib_ksigma_clip.c
+++ b/irplib/irplib_ksigma_clip.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_ksigma_clip.c,v 1.1 2011/11/02 13:18:28 amodigli Exp $
+/* $Id: irplib_ksigma_clip.c,v 1.1 2011-11-02 13:18:28 amodigli Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002, 2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: amodigli $
- * $Date: 2011/11/02 13:18:28 $
+ * $Date: 2011-11-02 13:18:28 $
* $Revision: 1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_ksigma_clip.h b/irplib/irplib_ksigma_clip.h
index 1efd8fd..c7e8107 100644
--- a/irplib/irplib_ksigma_clip.h
+++ b/irplib/irplib_ksigma_clip.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_ksigma_clip.h,v 1.1 2011/11/02 13:18:28 amodigli Exp $
+/* $Id: irplib_ksigma_clip.h,v 1.1 2011-11-02 13:18:28 amodigli Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002, 2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: amodigli $
- * $Date: 2011/11/02 13:18:28 $
+ * $Date: 2011-11-02 13:18:28 $
* $Revision: 1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_KSIGMA_CLIP_H
diff --git a/irplib/irplib_ksigma_clip_body.h b/irplib/irplib_ksigma_clip_body.h
index 86d99ee..f196fb9 100644
--- a/irplib/irplib_ksigma_clip_body.h
+++ b/irplib/irplib_ksigma_clip_body.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_ksigma_clip_body.h,v 1.1 2011/11/02 13:18:28 amodigli Exp $
+/* $Id: irplib_ksigma_clip_body.h,v 1.1 2011-11-02 13:18:28 amodigli Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: amodigli $
- * $Date: 2011/11/02 13:18:28 $
+ * $Date: 2011-11-02 13:18:28 $
* $Revision: 1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#define TYPE_ADD(a) CONCAT2X(a, CPL_TYPE)
diff --git a/irplib/irplib_match_cats.c b/irplib/irplib_match_cats.c
index 74391e1..da84b9e 100644
--- a/irplib/irplib_match_cats.c
+++ b/irplib/irplib_match_cats.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_match_cats.c,v 1.10 2009/12/18 10:44:48 cgarcia Exp $
+/* $Id: irplib_match_cats.c,v 1.10 2009-12-18 10:44:48 cgarcia Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: cgarcia $
- * $Date: 2009/12/18 10:44:48 $
+ * $Date: 2009-12-18 10:44:48 $
* $Revision: 1.10 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_match_cats.h b/irplib/irplib_match_cats.h
index 59ab247..40f587d 100644
--- a/irplib/irplib_match_cats.h
+++ b/irplib/irplib_match_cats.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_match_cats.h,v 1.5 2009/12/18 10:44:48 cgarcia Exp $
+/* $Id: irplib_match_cats.h,v 1.5 2009-12-18 10:44:48 cgarcia Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: cgarcia $
- * $Date: 2009/12/18 10:44:48 $
+ * $Date: 2009-12-18 10:44:48 $
* $Revision: 1.5 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_MATCH_CATS_H
diff --git a/irplib/irplib_mkmaster.c b/irplib/irplib_mkmaster.c
index dc6888a..237bb46 100644
--- a/irplib/irplib_mkmaster.c
+++ b/irplib/irplib_mkmaster.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_mkmaster.c,v 1.6 2013/02/27 16:00:51 jtaylor Exp $
+/* $Id: irplib_mkmaster.c,v 1.6 2013-02-27 16:00:51 jtaylor Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/02/27 16:00:51 $
+ * $Date: 2013-02-27 16:00:51 $
* $Revision: 1.6 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_mkmaster.h b/irplib/irplib_mkmaster.h
index b38bf35..edc8743 100644
--- a/irplib/irplib_mkmaster.h
+++ b/irplib/irplib_mkmaster.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_mkmaster.h,v 1.3 2011/11/02 13:17:25 amodigli Exp $
+/* $Id: irplib_mkmaster.h,v 1.3 2011-11-02 13:17:25 amodigli Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: amodigli $
- * $Date: 2011/11/02 13:17:25 $
+ * $Date: 2011-11-02 13:17:25 $
* $Revision: 1.3 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_MKMASTER_H
diff --git a/irplib/irplib_oddeven.c b/irplib/irplib_oddeven.c
index 659d652..82933d2 100644
--- a/irplib/irplib_oddeven.c
+++ b/irplib/irplib_oddeven.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_oddeven.c,v 1.9 2012/01/12 11:50:41 llundin Exp $
+/* $Id: irplib_oddeven.c,v 1.9 2012-01-12 11:50:41 llundin Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2012/01/12 11:50:41 $
+ * $Date: 2012-01-12 11:50:41 $
* $Revision: 1.9 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_oddeven.h b/irplib/irplib_oddeven.h
index 2dbdc76..4dc1b51 100644
--- a/irplib/irplib_oddeven.h
+++ b/irplib/irplib_oddeven.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_oddeven.h,v 1.4 2006/10/06 20:46:04 yjung Exp $
+/* $Id: irplib_oddeven.h,v 1.4 2006-10-06 20:46:04 yjung Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2006/10/06 20:46:04 $
+ * $Date: 2006-10-06 20:46:04 $
* $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_ODDEVEN_H
diff --git a/irplib/irplib_plugin.c b/irplib/irplib_plugin.c
index bf3582f..17428b3 100644
--- a/irplib/irplib_plugin.c
+++ b/irplib/irplib_plugin.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_plugin.c,v 1.39 2012/02/03 14:19:06 llundin Exp $
+/* $Id: irplib_plugin.c,v 1.40 2013-08-22 17:44:56 cgarcia Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -19,10 +19,10 @@
*/
/*
- * $Author: llundin $
- * $Date: 2012/02/03 14:19:06 $
- * $Revision: 1.39 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Author: cgarcia $
+ * $Date: 2013-08-22 17:44:56 $
+ * $Revision: 1.40 $
+ * $Name: not supported by cvs2svn $
*/
/*-----------------------------------------------------------------------------
@@ -1023,13 +1023,16 @@ static void recipe_frameset_load(cpl_frameset * set, const char *name)
/* Loop over all the lines in the set-of-frames file */
for (line_number = 0; fgets(line, LINE_LEN_MAX - 1, fp); line_number++) {
+ char scan_fmt[50];
cpl_frame_group grp;
cpl_frame * frame;
int n;
if (line[0] == '#') continue;
- n = sscanf(line, "%s %s %s", path, tag, group);
+ snprintf(scan_fmt, 49, "%%%ds %%%ds %%%ds", LINE_LEN_MAX - 1,
+ LINE_LEN_MAX - 1, LINE_LEN_MAX - 1);
+ n = sscanf(line, scan_fmt, path, tag, group);
if (n < 1) {
cpl_msg_warning(cpl_func, "Spurious line no. %d in %s: %s",
diff --git a/irplib/irplib_plugin.h b/irplib/irplib_plugin.h
index 6405d89..f99cc01 100644
--- a/irplib/irplib_plugin.h
+++ b/irplib/irplib_plugin.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_plugin.h,v 1.23 2012/01/11 08:03:37 llundin Exp $
+/* $Id: irplib_plugin.h,v 1.23 2012-01-11 08:03:37 llundin Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2012/01/11 08:03:37 $
+ * $Date: 2012-01-11 08:03:37 $
* $Revision: 1.23 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_PLUGIN_H
diff --git a/irplib/irplib_polynomial.c b/irplib/irplib_polynomial.c
index 1c22960..1bd1ace 100644
--- a/irplib/irplib_polynomial.c
+++ b/irplib/irplib_polynomial.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_polynomial.c,v 1.35 2013/01/29 08:43:33 jtaylor Exp $
+/* $Id: irplib_polynomial.c,v 1.35 2013-01-29 08:43:33 jtaylor Exp $
*
* This file is part of the ESO Common Pipeline Library
* Copyright (C) 2001-2004 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/01/29 08:43:33 $
+ * $Date: 2013-01-29 08:43:33 $
* $Revision: 1.35 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_polynomial.h b/irplib/irplib_polynomial.h
index d6e74ea..fa0c16d 100644
--- a/irplib/irplib_polynomial.h
+++ b/irplib/irplib_polynomial.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_polynomial.h,v 1.10 2013/01/29 08:43:33 jtaylor Exp $
+/* $Id: irplib_polynomial.h,v 1.10 2013-01-29 08:43:33 jtaylor Exp $
*
* This file is part of the ESO Common Pipeline Library
* Copyright (C) 2007 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/01/29 08:43:33 $
+ * $Date: 2013-01-29 08:43:33 $
* $Revision: 1.10 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_POLYNOMIAL_H
diff --git a/irplib/irplib_ppm.c b/irplib/irplib_ppm.c
index caf45bd..74e9fd6 100644
--- a/irplib/irplib_ppm.c
+++ b/irplib/irplib_ppm.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_ppm.c,v 1.31 2012/06/11 07:24:09 llundin Exp $
+/* $Id: irplib_ppm.c,v 1.31 2012-06-11 07:24:09 llundin Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2012/06/11 07:24:09 $
+ * $Date: 2012-06-11 07:24:09 $
* $Revision: 1.31 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_ppm.h b/irplib/irplib_ppm.h
index ecda50b..5639665 100644
--- a/irplib/irplib_ppm.h
+++ b/irplib/irplib_ppm.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_ppm.h,v 1.5 2007/07/23 09:27:07 yjung Exp $
+/* $Id: irplib_ppm.h,v 1.5 2007-07-23 09:27:07 yjung Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2007/07/23 09:27:07 $
+ * $Date: 2007-07-23 09:27:07 $
* $Revision: 1.5 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_PPM_H
diff --git a/irplib/irplib_slitpos.c b/irplib/irplib_slitpos.c
index 8b5d48b..346a02a 100644
--- a/irplib/irplib_slitpos.c
+++ b/irplib/irplib_slitpos.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_slitpos.c,v 1.31 2013/07/04 12:10:12 jtaylor Exp $
+/* $Id: irplib_slitpos.c,v 1.31 2013-07-04 12:10:12 jtaylor Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/07/04 12:10:12 $
+ * $Date: 2013-07-04 12:10:12 $
* $Revision: 1.31 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_slitpos.h b/irplib/irplib_slitpos.h
index 0d8f223..5b124fe 100644
--- a/irplib/irplib_slitpos.h
+++ b/irplib/irplib_slitpos.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_slitpos.h,v 1.6 2006/11/29 13:22:59 yjung Exp $
+/* $Id: irplib_slitpos.h,v 1.6 2006-11-29 13:22:59 yjung Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2006/11/29 13:22:59 $
+ * $Date: 2006-11-29 13:22:59 $
* $Revision: 1.6 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_SLITPOS_H
diff --git a/irplib/irplib_spectrum.c b/irplib/irplib_spectrum.c
index fc3b061..1174ddd 100644
--- a/irplib/irplib_spectrum.c
+++ b/irplib/irplib_spectrum.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_spectrum.c,v 1.29 2012/01/12 11:50:41 llundin Exp $
+/* $Id: irplib_spectrum.c,v 1.29 2012-01-12 11:50:41 llundin Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2012/01/12 11:50:41 $
+ * $Date: 2012-01-12 11:50:41 $
* $Revision: 1.29 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_spectrum.h b/irplib/irplib_spectrum.h
index 72d6568..00fca96 100644
--- a/irplib/irplib_spectrum.h
+++ b/irplib/irplib_spectrum.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_spectrum.h,v 1.7 2009/07/30 12:38:37 yjung Exp $
+/* $Id: irplib_spectrum.h,v 1.7 2009-07-30 12:38:37 yjung Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2009/07/30 12:38:37 $
+ * $Date: 2009-07-30 12:38:37 $
* $Revision: 1.7 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_SPECTRUM_H
diff --git a/irplib/irplib_stdstar.c b/irplib/irplib_stdstar.c
index debcab7..71b1fa9 100644
--- a/irplib/irplib_stdstar.c
+++ b/irplib/irplib_stdstar.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_stdstar.c,v 1.45 2013/03/01 10:27:07 llundin Exp $
+/* $Id: irplib_stdstar.c,v 1.45 2013-03-01 10:27:07 llundin Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2013/03/01 10:27:07 $
+ * $Date: 2013-03-01 10:27:07 $
* $Revision: 1.45 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_stdstar.h b/irplib/irplib_stdstar.h
index f18220a..9657d34 100644
--- a/irplib/irplib_stdstar.h
+++ b/irplib/irplib_stdstar.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_stdstar.h,v 1.16 2013/02/27 10:37:52 llundin Exp $
+/* $Id: irplib_stdstar.h,v 1.16 2013-02-27 10:37:52 llundin Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2013/02/27 10:37:52 $
+ * $Date: 2013-02-27 10:37:52 $
* $Revision: 1.16 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_STDSTAR_H
diff --git a/irplib/irplib_strehl.c b/irplib/irplib_strehl.c
index 8f1f467..4e58397 100644
--- a/irplib/irplib_strehl.c
+++ b/irplib/irplib_strehl.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_strehl.c,v 1.43 2009/11/18 21:37:48 llundin Exp $
+/* $Id: irplib_strehl.c,v 1.43 2009-11-18 21:37:48 llundin Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2009/11/18 21:37:48 $
+ * $Date: 2009-11-18 21:37:48 $
* $Revision: 1.43 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_strehl.h b/irplib/irplib_strehl.h
index b474c68..4acce38 100644
--- a/irplib/irplib_strehl.h
+++ b/irplib/irplib_strehl.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_strehl.h,v 1.12 2009/06/29 14:32:53 kmirny Exp $
+/* $Id: irplib_strehl.h,v 1.12 2009-06-29 14:32:53 kmirny Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: kmirny $
- * $Date: 2009/06/29 14:32:53 $
+ * $Date: 2009-06-29 14:32:53 $
* $Revision: 1.12 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_STREHL_H
diff --git a/irplib/irplib_utils.c b/irplib/irplib_utils.c
index 3f411b4..2b13ab7 100644
--- a/irplib/irplib_utils.c
+++ b/irplib/irplib_utils.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_utils.c,v 1.85 2013/07/04 12:10:55 jtaylor Exp $
+/* $Id: irplib_utils.c,v 1.85 2013-07-04 12:10:55 jtaylor Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/07/04 12:10:55 $
+ * $Date: 2013-07-04 12:10:55 $
* $Revision: 1.85 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_utils.h b/irplib/irplib_utils.h
index e06beff..7f7caa8 100644
--- a/irplib/irplib_utils.h
+++ b/irplib/irplib_utils.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_utils.h,v 1.59 2013/03/15 09:06:06 jtaylor Exp $
+/* $Id: irplib_utils.h,v 1.60 2013-08-21 14:55:14 cgarcia Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -19,11 +19,11 @@
*/
/*
- * $Author: jtaylor $
- * $Date: 2013/03/15 09:06:06 $
- * $Revision: 1.59 $
- * $Name: kmosp_v1_2_4__20130807 $
- * $Log: irplib_utils.h,v $
+ * $Author: cgarcia $
+ * $Date: 2013-08-21 14:55:14 $
+ * $Revision: 1.60 $
+ * $Name: not supported by cvs2svn $
+ * $Log: not supported by cvs2svn $
* Revision 1.59 2013/03/15 09:06:06 jtaylor
* add irplib_aligned_{[mc]alloc,free}
*
@@ -67,7 +67,7 @@
-----------------------------------------------------------------------------*/
#include <cpl.h>
-
+#include <math.h>
#include <stdarg.h>
/*-----------------------------------------------------------------------------
diff --git a/irplib/irplib_wavecal.c b/irplib/irplib_wavecal.c
index c827661..fe4b5b6 100644
--- a/irplib/irplib_wavecal.c
+++ b/irplib/irplib_wavecal.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_wavecal.c,v 1.52 2012/08/03 21:05:32 llundin Exp $
+/* $Id: irplib_wavecal.c,v 1.52 2012-08-03 21:05:32 llundin Exp $
*
* This file is part of the IRPLIB Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2012/08/03 21:05:32 $
+ * $Date: 2012-08-03 21:05:32 $
* $Revision: 1.52 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_wavecal.h b/irplib/irplib_wavecal.h
index e7ffbbd..9ec1ed5 100644
--- a/irplib/irplib_wavecal.h
+++ b/irplib/irplib_wavecal.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_wavecal.h,v 1.18 2012/08/03 21:05:33 llundin Exp $
+/* $Id: irplib_wavecal.h,v 1.18 2012-08-03 21:05:33 llundin Exp $
*
* This file is part of the IRPLIB Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2012/08/03 21:05:33 $
+ * $Date: 2012-08-03 21:05:33 $
* $Revision: 1.18 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_WAVECAL_H
diff --git a/irplib/irplib_wavecal_impl.h b/irplib/irplib_wavecal_impl.h
index 1620690..ee99093 100644
--- a/irplib/irplib_wavecal_impl.h
+++ b/irplib/irplib_wavecal_impl.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_wavecal_impl.h,v 1.7 2012/08/03 21:05:34 llundin Exp $
+/* $Id: irplib_wavecal_impl.h,v 1.7 2012-08-03 21:05:34 llundin Exp $
*
* This file is part of the IRPLIB Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2012/08/03 21:05:34 $
+ * $Date: 2012-08-03 21:05:34 $
* $Revision: 1.7 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_WAVECAL_IMPL_H
diff --git a/irplib/irplib_wcs.c b/irplib/irplib_wcs.c
index 95e7ee2..51ae836 100644
--- a/irplib/irplib_wcs.c
+++ b/irplib/irplib_wcs.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_wcs.c,v 1.8 2010/10/07 14:10:55 llundin Exp $
+/* $Id: irplib_wcs.c,v 1.8 2010-10-07 14:10:55 llundin Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2010/10/07 14:10:55 $
+ * $Date: 2010-10-07 14:10:55 $
* $Revision: 1.8 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_wcs.h b/irplib/irplib_wcs.h
index e5099b2..cc5c45c 100644
--- a/irplib/irplib_wcs.h
+++ b/irplib/irplib_wcs.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_wcs.h,v 1.7 2010/10/07 14:10:55 llundin Exp $
+/* $Id: irplib_wcs.h,v 1.7 2010-10-07 14:10:55 llundin Exp $
*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: llundin $
- * $Date: 2010/10/07 14:10:55 $
+ * $Date: 2010-10-07 14:10:55 $
* $Revision: 1.7 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_WCS_H
diff --git a/irplib/irplib_wlxcorr.c b/irplib/irplib_wlxcorr.c
index 3f0a1c0..eeb5ea1 100644
--- a/irplib/irplib_wlxcorr.c
+++ b/irplib/irplib_wlxcorr.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_wlxcorr.c,v 1.58 2013/01/29 08:43:33 jtaylor Exp $
+/* $Id: irplib_wlxcorr.c,v 1.58 2013-01-29 08:43:33 jtaylor Exp $
*
* This file is part of the IRPLIB package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/01/29 08:43:33 $
+ * $Date: 2013-01-29 08:43:33 $
* $Revision: 1.58 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/irplib/irplib_wlxcorr.h b/irplib/irplib_wlxcorr.h
index a0908c6..467f599 100644
--- a/irplib/irplib_wlxcorr.h
+++ b/irplib/irplib_wlxcorr.h
@@ -1,4 +1,4 @@
-/* $Id: irplib_wlxcorr.h,v 1.22 2013/01/29 08:43:33 jtaylor Exp $
+/* $Id: irplib_wlxcorr.h,v 1.22 2013-01-29 08:43:33 jtaylor Exp $
*
* This file is part of the IRPLIB package
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/01/29 08:43:33 $
+ * $Date: 2013-01-29 08:43:33 $
* $Revision: 1.22 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef IRPLIB_WLXCORR_H
diff --git a/irplib/tests/irplib_cat-test.c b/irplib/tests/irplib_cat-test.c
index d8994ea..dba945b 100644
--- a/irplib/tests/irplib_cat-test.c
+++ b/irplib/tests/irplib_cat-test.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_cat-test.c,v 1.10 2013/01/29 08:43:33 jtaylor Exp $
+/* $Id: irplib_cat-test.c,v 1.10 2013-01-29 08:43:33 jtaylor Exp $
*
* This file is part of the ESO Common Pipeline Library
* Copyright (C) 2001-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/01/29 08:43:33 $
+ * $Date: 2013-01-29 08:43:33 $
* $Revision: 1.10 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
/*-----------------------------------------------------------------------------
diff --git a/irplib/tests/irplib_polynomial-test.c b/irplib/tests/irplib_polynomial-test.c
index 37d2828..33a50c9 100644
--- a/irplib/tests/irplib_polynomial-test.c
+++ b/irplib/tests/irplib_polynomial-test.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_polynomial-test.c,v 1.37 2013/01/29 08:43:33 jtaylor Exp $
+/* $Id: irplib_polynomial-test.c,v 1.37 2013-01-29 08:43:33 jtaylor Exp $
*
* This file is part of the ESO Common Pipeline Library
* Copyright (C) 2001-2004 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/01/29 08:43:33 $
+ * $Date: 2013-01-29 08:43:33 $
* $Revision: 1.37 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
/*-----------------------------------------------------------------------------
diff --git a/irplib/tests/irplib_wcs-test.c b/irplib/tests/irplib_wcs-test.c
index 5daa654..2b6e19b 100644
--- a/irplib/tests/irplib_wcs-test.c
+++ b/irplib/tests/irplib_wcs-test.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_wcs-test.c,v 1.9 2013/01/29 08:43:33 jtaylor Exp $
+/* $Id: irplib_wcs-test.c,v 1.9 2013-01-29 08:43:33 jtaylor Exp $
*
* This file is part of the ESO Common Pipeline Library
* Copyright (C) 2001-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/01/29 08:43:33 $
+ * $Date: 2013-01-29 08:43:33 $
* $Revision: 1.9 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
/*-----------------------------------------------------------------------------
diff --git a/irplib/tests/irplib_wlxcorr-test.c b/irplib/tests/irplib_wlxcorr-test.c
index 3ade981..767121a 100644
--- a/irplib/tests/irplib_wlxcorr-test.c
+++ b/irplib/tests/irplib_wlxcorr-test.c
@@ -1,4 +1,4 @@
-/* $Id: irplib_wlxcorr-test.c,v 1.16 2013/01/29 08:43:33 jtaylor Exp $
+/* $Id: irplib_wlxcorr-test.c,v 1.16 2013-01-29 08:43:33 jtaylor Exp $
*
* This file is part of the ESO Common Pipeline Library
* Copyright (C) 2001-2004 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: jtaylor $
- * $Date: 2013/01/29 08:43:33 $
+ * $Date: 2013-01-29 08:43:33 $
* $Revision: 1.16 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
/*-----------------------------------------------------------------------------
diff --git a/kmclipm/include/kmclipm_compatibility_cpl.h b/kmclipm/include/kmclipm_compatibility_cpl.h
index 1ec8007..47e6004 100644
--- a/kmclipm/include/kmclipm_compatibility_cpl.h
+++ b/kmclipm/include/kmclipm_compatibility_cpl.h
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_compatibility_cpl.h,v 1.1.1.1 2012/01/18 09:32:30 yjung Exp $"
+ * "@(#) $Id: kmclipm_compatibility_cpl.h,v 1.1.1.1 2012-01-18 09:32:30 yjung Exp $"
*
* Define the compatible CPL version
*
diff --git a/kmclipm/include/kmclipm_constants.h b/kmclipm/include/kmclipm_constants.h
index a6a64f8..10b6b06 100644
--- a/kmclipm/include/kmclipm_constants.h
+++ b/kmclipm/include/kmclipm_constants.h
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_constants.h,v 1.16 2013/08/02 08:08:08 aagudo Exp $"
+ * "@(#) $Id: kmclipm_constants.h,v 1.18 2013-10-08 11:11:00 aagudo Exp $"
*
* Simple accessor functions to global variables.
*
@@ -84,6 +84,9 @@ extern "C" {
/** @brief tolerance in degrees of rotator offsets between frames when calibrating */
#define KMOS_ROT_OFF_TOL_CAL 1.
+/** @brief Estimated gap width between slitlets of IFUs */
+#define KMOS_GAP_WIDTH 4
+
/*----------------------------------------------------------------------------
* FITS - standard keywords
*--------------------------------------------------------------------------*/
@@ -134,6 +137,7 @@ extern "C" {
/*------------------------------------------------------------------------------
* KMOS - specific keywords
*----------------------------------------------------------------------------*/
+#define ORIGFILE "ORIGFILE"
#define DATE_OBS "DATE-OBS"
#define GAIN "ESO DET CHIP GAIN"
#define RON "ESO DET CHIP RON"
diff --git a/kmclipm/include/kmclipm_functions.h b/kmclipm/include/kmclipm_functions.h
index 06cc52d..6cd8f7c 100644
--- a/kmclipm/include/kmclipm_functions.h
+++ b/kmclipm/include/kmclipm_functions.h
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_functions.h,v 1.21 2013/07/31 10:29:31 aagudo Exp $"
+ * "@(#) $Id: kmclipm_functions.h,v 1.23 2013-10-08 14:55:01 erw Exp $"
*
* Functions that are implemented as recipes. They are also useedd in KMOS
* data reduction pipeline.
@@ -137,6 +137,8 @@ typedef struct {
/* method */
enum reconstructMethod method;
neighborHoodStruct neighborHood;
+ float rot_na_angle; /* rotator angle relative to nasmyth */
+ float rot_off_angle; /* rotator offset angle */
} gridDefinition;
/** @brief Contains all return values for any of the three
@@ -259,7 +261,8 @@ cpl_error_code kmclipm_setup_grid(
gridDefinition *gd,
const char *method,
double neighborhoodRange,
- double pixel_scale);
+ double pixel_scale,
+ double rot_angle);
cpl_error_code kmclipm_setup_grid_band_lcal(
gridDefinition *gd,
diff --git a/kmclipm/include/kmclipm_math.h b/kmclipm/include/kmclipm_math.h
index ad94a15..0c48536 100644
--- a/kmclipm/include/kmclipm_math.h
+++ b/kmclipm/include/kmclipm_math.h
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_math.h,v 1.2 2012/03/15 11:37:30 aagudo Exp $"
+ * "@(#) $Id: kmclipm_math.h,v 1.2 2012-03-15 11:37:30 aagudo Exp $"
*
* Simple accessor functions to global variables.
*
diff --git a/kmclipm/include/kmclipm_priv_constants.h b/kmclipm/include/kmclipm_priv_constants.h
index cc9beff..c8f603e 100644
--- a/kmclipm/include/kmclipm_priv_constants.h
+++ b/kmclipm/include/kmclipm_priv_constants.h
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_priv_constants.h,v 1.1.1.1 2012/01/18 09:32:30 yjung Exp $"
+ * "@(#) $Id: kmclipm_priv_constants.h,v 1.1.1.1 2012-01-18 09:32:30 yjung Exp $"
*
* Simple accessor functions to global variables.
*
diff --git a/kmclipm/include/kmclipm_priv_error.h b/kmclipm/include/kmclipm_priv_error.h
index 3f1810b..0c8e90e 100644
--- a/kmclipm/include/kmclipm_priv_error.h
+++ b/kmclipm/include/kmclipm_priv_error.h
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_priv_error.h,v 1.4 2013/06/14 13:33:35 aagudo Exp $"
+ * "@(#) $Id: kmclipm_priv_error.h,v 1.4 2013-06-14 13:33:35 aagudo Exp $"
*
* PRIVATE functions for kmclipm internal error handling, requires CPL 4.0
*
diff --git a/kmclipm/include/kmclipm_priv_functions.h b/kmclipm/include/kmclipm_priv_functions.h
index 26099b9..049b5b8 100644
--- a/kmclipm/include/kmclipm_priv_functions.h
+++ b/kmclipm/include/kmclipm_priv_functions.h
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_priv_functions.h,v 1.4 2012/10/02 14:40:03 aagudo Exp $"
+ * "@(#) $Id: kmclipm_priv_functions.h,v 1.4 2012-10-02 14:40:03 aagudo Exp $"
*
* Functions that are implemented as recipes. They are also useedd in KMOS
* data reduction pipeline.
diff --git a/kmclipm/include/kmclipm_priv_reconstruct.h b/kmclipm/include/kmclipm_priv_reconstruct.h
index e8a4f9b..1f08ae5 100644
--- a/kmclipm/include/kmclipm_priv_reconstruct.h
+++ b/kmclipm/include/kmclipm_priv_reconstruct.h
@@ -1,7 +1,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_priv_reconstruct.h,v 1.8 2013/05/07 08:23:38 aagudo Exp $"
+ * "@(#) $Id: kmclipm_priv_reconstruct.h,v 1.10 2013-10-08 14:55:01 erw Exp $"
*
* Functions that are implemented as recipes. They are also useedd in KMOS
* data reduction pipeline.
@@ -120,7 +120,8 @@ cpl_error_code kmclipm_priv_setup_grid(
gridDefinition *gd,
const enum reconstructMethod method,
double neighborhoodRange,
- double pixel_scale);
+ double pixel_scale,
+ double rot_angle);
neighbors*** kmclipm_priv_find_neighbors(
const gridDefinition gd,
@@ -132,12 +133,10 @@ void kmclipm_priv_cleanup_neighborlist(
void kmclipm_priv_reconstruct_nnlut_reset_tables();
-void kmclipm_priv_delete_alien_ifu_cal_data(
+cpl_error_code kmclipm_priv_delete_alien_ifu_cal_data(
int ifu,
- int xSize,
- int ySize,
- float *xcal_data,
- float *ycal_data,
- float *lcal_data);
+ cpl_image* xcal,
+ cpl_image* ycal,
+ cpl_image* lcal);
#endif /* KMCLIPM_PRIV_RECONSTRUCT_H */
diff --git a/kmclipm/include/kmclipm_priv_splines.h b/kmclipm/include/kmclipm_priv_splines.h
index 550d186..1f7e3ee 100644
--- a/kmclipm/include/kmclipm_priv_splines.h
+++ b/kmclipm/include/kmclipm_priv_splines.h
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_priv_splines.h,v 1.4 2013/07/29 18:08:45 aagudo Exp $"
+ * "@(#) $Id: kmclipm_priv_splines.h,v 1.4 2013-07-29 18:08:45 aagudo Exp $"
*
* Functions that are implemented as recipes. They are also useedd in KMOS
* data reduction pipeline.
diff --git a/kmclipm/include/kmclipm_vector.h b/kmclipm/include/kmclipm_vector.h
index af784b5..de701f2 100644
--- a/kmclipm/include/kmclipm_vector.h
+++ b/kmclipm/include/kmclipm_vector.h
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_vector.h,v 1.3 2013/05/17 15:53:08 aagudo Exp $"
+ * "@(#) $Id: kmclipm_vector.h,v 1.3 2013-05-17 15:53:08 aagudo Exp $"
*
* Functions that are implemented as recipes. They are also useedd in KMOS
* data reduction pipeline.
diff --git a/kmclipm/src/kmclipm_functions.c b/kmclipm/src/kmclipm_functions.c
index 9dd2e5d..00ad0d4 100644
--- a/kmclipm/src/kmclipm_functions.c
+++ b/kmclipm/src/kmclipm_functions.c
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_functions.c,v 1.86 2013/08/07 14:36:29 aagudo Exp $"
+ * "@(#) $Id: kmclipm_functions.c,v 1.91 2013-10-08 14:55:01 erw Exp $"
*
* Functions that are implemented as recipes. They are also useedd in KMOS
* data reduction pipeline.
@@ -391,7 +391,7 @@ cpl_error_code kmclipm_gaussfit_2d(const cpl_image *img, double *fitted_pars)
/**
@brief Reconstructs a 3D image cube from raw 2D image data of a single IFU.
- @param ifu The IFU number.
+ @param ifu_nr The IFU number.
@param ifu_raw The raw 2D image data of a single IFU
(from kmclipm_split_frame() ).
@param ifu_noise The raw 2D noise data of a single IFU
@@ -425,7 +425,7 @@ cpl_error_code kmclipm_gaussfit_2d(const cpl_image *img, double *fitted_pars)
the flux from the 2D frame into the 3D cube if requested.The errors are
propagated into a new noise cube if the input noise map is provided.
*/
-cpl_imagelist* kmclipm_reconstruct(const int ifu,
+cpl_imagelist* kmclipm_reconstruct(const int ifu_nr,
cpl_image *ifu_raw,
const cpl_image *ifu_noise,
cpl_image *ifu_xcal,
@@ -438,48 +438,92 @@ cpl_imagelist* kmclipm_reconstruct(const int ifu,
const cpl_vector *calAngles,
cpl_imagelist **noise_cube_ptr)
{
- cpl_imagelist *cube = NULL;
- cpl_imagelist *noise_cube = NULL;
-
- float *image_data_in = NULL;
- const float *noise_data_in = NULL;
+ int reject_bad_pixels = 1,
+ failedCnt1 = 0,
+ failedCnt2 = 0,
+ badPixelCnt = 0,
+ zeroPixelCnt = 0,
+ ix = 0,
+ iy = 0,
+ xSize = 0,
+ ySize = 0;
+ float *xcal_data = NULL,
+ *ycal_data = NULL,
+ *lcal_data = NULL,
+ *image_data_in = NULL,
+ bad_pixel_value = 0.0;
+ const float *noise_data_in = NULL;
+ const char *environment_variable = "KMO_RECONSTRUCT_BADPIXEL_VALUE";
+ cpl_imagelist *cube = NULL,
+ *noise_cube = NULL;
+ cpl_binary *bpm_data = NULL;
/*
-cpl_image_save (ifu_raw, "/home/erw/kmos/ifu_raw_In_reconstruct.fits",
- CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT);
-cpl_image_save (ifu_xcal, "/home/erw/kmos/ifu_xcal_In_reconstruct.fits",
- CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT);
-cpl_image_save (ifu_ycal, "/home/erw/kmos/ifu_ycal_In_reconstruct.fits",
- CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT);
-cpl_image_save (ifu_lcal, "/home/erw/kmos/ifu_lcal_In_reconstruct.fits",
- CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT);
+cpl_image_save (ifu_raw, "ifu_raw_In_reconstruct.fits", CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT);
+cpl_image_save (ifu_xcal, "ifu_xcal_In_reconstruct.fits", CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT);
+cpl_image_save (ifu_ycal, "ifu_ycal_In_reconstruct.fits", CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT);
+cpl_image_save (ifu_lcal, "ifu_lcal_In_reconstruct.fits", CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT);
*/
KMCLIPM_TRY
{
/* check inputs */
KMCLIPM_TRY_CHECK_AUTOMSG(((ifu_raw != NULL) &&
- (ifu_xcal != NULL) &&
- (ifu_ycal != NULL) &&
- (ifu_lcal != NULL) ),
- CPL_ERROR_NULL_INPUT);
+ (ifu_xcal != NULL) &&
+ (ifu_ycal != NULL) &&
+ (ifu_lcal != NULL)),
+ CPL_ERROR_NULL_INPUT);
KMCLIPM_TRY_EXIT_IFN(
- image_data_in = cpl_image_get_data_float(ifu_raw));
+ image_data_in = cpl_image_get_data_float(ifu_raw));
if (ifu_noise == NULL) {
noise_data_in = NULL;
} else {
KMCLIPM_TRY_EXIT_IFN(
noise_data_in = cpl_image_get_data_float_const(ifu_noise));
}
+/*
+cpl_image_save(ifu_xcal, "xcal_data.fits", CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+cpl_image_save(ifu_ycal, "ycal_data.fits", CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+cpl_image_save(ifu_lcal, "lcal_data.fits", CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+*/
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_priv_delete_alien_ifu_cal_data(ifu_nr, ifu_xcal, ifu_ycal, ifu_lcal));
+/*
+cpl_image_save(ifu_xcal, "xcal_data_after.fits", CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+cpl_image_save(ifu_ycal, "ycal_data_after.fits", CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+cpl_image_save(ifu_lcal, "lcal_data_after.fits", CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+*/
- float *xcal_data = NULL,
- *ycal_data = NULL,
- *lcal_data = NULL;
/*
- for detector 1 and 2 (IFUs 1-16) the x and y cal images are swapped
- */
-/* if (ifu >= 17 ) { */
+ * handling of rejected pixels
+ * default is to set the value of rejected pixels to NAN
+ * with the environment variable KMO_RECONSTRUCT_BADPIXEL_VALUE it can
+ * be set to any float value
+ */
+ KMCLIPM_TRY_EXIT_IFN(
+ bpm_data = cpl_mask_get_data(cpl_image_get_bpm(ifu_raw)));
+
+ if (getenv(environment_variable) != NULL) {
+ reject_bad_pixels = 0;
+ bad_pixel_value = atof(getenv(environment_variable));
+ cpl_msg_info(cpl_func, "bad pixel rejection is turned off, bad pixel are set to %f",
+ bad_pixel_value);
+ }
+
+ xSize = cpl_image_get_size_x(ifu_raw);
+ ySize = cpl_image_get_size_y(ifu_raw);
+ KMCLIPM_TRY_CHECK_ERROR_STATE();
+
+ /*
+ * for detector 1 and 2 (IFUs 1-16) the x and y cal images are swapped
+ * !!
+ * !! there shall be no swap because the slitlets are stacked differently on detector 3
+ * !! image (N-S instead of E-W) but xcal still contains x-positions and ycal contains
+ * !! the y-positions
+ * !!
+ */
+/* if (ifu_nr >= 17 ) { */
KMCLIPM_TRY_EXIT_IFN(
xcal_data = cpl_image_get_data_float(ifu_xcal));
KMCLIPM_TRY_EXIT_IFN(
@@ -492,37 +536,8 @@ cpl_image_save (ifu_lcal, "/home/erw/kmos/ifu_lcal_In_reconstruct.fits",
}
*/
KMCLIPM_TRY_EXIT_IFN(
- lcal_data = cpl_image_get_data_float(ifu_lcal));
- int xSize = cpl_image_get_size_x (ifu_raw);
- int ySize = cpl_image_get_size_y (ifu_raw);
- KMCLIPM_TRY_CHECK_ERROR_STATE();
-
- kmclipm_priv_delete_alien_ifu_cal_data(ifu, xSize, ySize, xcal_data,
- ycal_data, lcal_data);
+ lcal_data = cpl_image_get_data_float(ifu_lcal));
-/*
- handling of rejected pixels
- default is to set the value of rejected pixels to NAN
- with the environment variable KMO_RECONSTRUCT_BADPIXEL_VALUE it can be set to any float value*
-*/
- cpl_binary *bpm_data = NULL;
- KMCLIPM_TRY_EXIT_IFN(
- bpm_data = cpl_mask_get_data(cpl_image_get_bpm(ifu_raw)));
-
- int reject_bad_pixels = 1;
- float bad_pixel_value = 0.0;
- const char * environment_variable = "KMO_RECONSTRUCT_BADPIXEL_VALUE";
- if (getenv(environment_variable) != NULL) {
- reject_bad_pixels = 0;
- bad_pixel_value = atof(getenv(environment_variable));
- cpl_msg_info(cpl_func, "bad pixel rejection is turned off, bad pixel are set to %f",
- bad_pixel_value);
- }
- int failedCnt1 = 0;
- int failedCnt2 = 0;
- int badPixelCnt = 0;
- int zeroPixelCnt = 0;
- int ix, iy;
for (iy=0; iy < ySize; iy++) {
for (ix=0; ix < xSize; ix++) {
int idx = ix + iy * xSize;
@@ -546,34 +561,34 @@ cpl_image_save (ifu_lcal, "/home/erw/kmos/ifu_lcal_In_reconstruct.fits",
}
cpl_msg_debug(cpl_func,
"For IFU %d found %d (%d in gaps) rejected pixels, %d (%d in gaps) zero pixels",
- ifu, badPixelCnt-failedCnt1, failedCnt1, zeroPixelCnt-failedCnt2, failedCnt2);
+ ifu_nr, badPixelCnt-failedCnt1, failedCnt1, zeroPixelCnt-failedCnt2, failedCnt2);
-/*gd.method=SQUARE_WEIGHTED_NEAREST_NEIGHBOR;*/
+ /*gd.method=SQUARE_WEIGHTED_NEAREST_NEIGHBOR;*/
if (gd.method == CUBIC_SPLINE) {
-
- cube = kmclipm_priv_reconstruct_cubicspline(ifu, xSize, ySize,
- xcal_data, ycal_data, lcal_data, image_data_in, gd);
-
+ cube = kmclipm_priv_reconstruct_cubicspline(ifu_nr, xSize, ySize,
+ xcal_data, ycal_data, lcal_data,
+ image_data_in, gd);
}
- else if (gd.method == NEAREST_NEIGHBOR ||
- gd.method == LINEAR_WEIGHTED_NEAREST_NEIGHBOR ||
- gd.method == SQUARE_WEIGHTED_NEAREST_NEIGHBOR ||
- gd.method == MODIFIED_SHEPARDS_METHOD ||
- gd.method == QUADRATIC_INTERPOLATION) {
+ else if ((gd.method == NEAREST_NEIGHBOR) ||
+ (gd.method == LINEAR_WEIGHTED_NEAREST_NEIGHBOR) ||
+ (gd.method == SQUARE_WEIGHTED_NEAREST_NEIGHBOR) ||
+ (gd.method == MODIFIED_SHEPARDS_METHOD) ||
+ (gd.method == QUADRATIC_INTERPOLATION)) {
KMCLIPM_TRY_CHECK_AUTOMSG(timestamp != NULL,
CPL_ERROR_NULL_INPUT);
- cube = kmclipm_priv_reconstruct_nearestneighbor(ifu, xSize, ySize,
- xcal_data, ycal_data, lcal_data, image_data_in,
- noise_data_in, gd, lut_path, lut_valid,
- timestamp, calAngles, &noise_cube);
+ cube = kmclipm_priv_reconstruct_nearestneighbor(ifu_nr, xSize, ySize,
+ xcal_data, ycal_data, lcal_data,
+ image_data_in, noise_data_in,
+ gd, lut_path, lut_valid, timestamp,
+ calAngles, &noise_cube);
}
-/* *noise_cube = cube;*/
/* Error check: returned pointer can be non-zero, but contain a
* imagelist with zero images. In this case CPL_ERROR_ILLEGAL_OUTPUT
- * is thrown */
+ * is thrown
+ */
if (cpl_imagelist_get_size(cube) == 0) {
cpl_error_set("kmclipm_reconstruct", CPL_ERROR_ILLEGAL_OUTPUT);
KMCLIPM_TRY_CHECK_ERROR_STATE();
@@ -585,7 +600,7 @@ cpl_image_save (ifu_lcal, "/home/erw/kmos/ifu_lcal_In_reconstruct.fits",
}
/*
if (cube != NULL) {
- char * fileName = cpl_sprintf("/home/erw/kmos/cubex_%2.2d.fits", ifu);
+ char* fileName = cpl_sprintf("cubex_%2.2d.fits", ifu_nr);
cpl_imagelist_save(cube, fileName, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
cpl_free(fileName); filename = NULL;
}
@@ -2246,7 +2261,8 @@ cpl_error_code kmclipm_combine_frames(const cpl_imagelist *data,
cpl_error_code kmclipm_setup_grid(gridDefinition *gd,
const char *method,
double neighborhoodRange,
- double pixel_scale)
+ double pixel_scale,
+ double rot_angle)
{
cpl_error_code ret_error = CPL_ERROR_NONE;
@@ -2286,7 +2302,8 @@ cpl_error_code kmclipm_setup_grid(gridDefinition *gd,
kmclipm_priv_setup_grid(gd,
method_enum,
neighborhoodRange,
- pixel_scale));
+ pixel_scale,
+ rot_angle));
}
KMCLIPM_CATCH
@@ -3150,6 +3167,25 @@ cpl_propertylist* kmclipm_propertylist_load(const char *filename, int position)
KMCLIPM_TRY_CHECK_ERROR_STATE();
cpl_propertylist_erase(header, "DATASUM");
KMCLIPM_TRY_CHECK_ERROR_STATE();
+
+ /* replace any wrong CRTYPEi with CTYPEi */
+ if (cpl_propertylist_has(header, "CRTYPE1")) {
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_update_property_string(header,
+ CTYPE1,
+ cpl_propertylist_get_string(header, "CRTYPE1"),
+ cpl_propertylist_get_comment(header, "CRTYPE1")));
+ cpl_propertylist_erase(header, "CRTYPE1");
+ }
+ if (cpl_propertylist_has(header, "CRTYPE2")) {
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_update_property_string(header,
+ CTYPE2,
+ cpl_propertylist_get_string(header, "CRTYPE2"),
+ cpl_propertylist_get_comment(header, "CRTYPE2")));
+ cpl_propertylist_erase(header, "CRTYPE2");
+ }
+
}
KMCLIPM_CATCH
{
@@ -4258,7 +4294,7 @@ cpl_error_code kmclipm_reject_nan(cpl_image *img)
Checks if either LUT file or LUT stored in memory is OK to use
@param filename LUT filename
- @param ifu IFU number (1..24)
+ @param ifu_nr IFU number (1..24)
@param gd grid definition
@param cal_time_stamp calibration file time stamp array
@@ -4266,12 +4302,12 @@ cpl_error_code kmclipm_reject_nan(cpl_image *img)
*/
int kmclipm_reconstruct_check_lut (const char *filename,
- const int ifu,
+ const int ifu_nr,
const gridDefinition gd,
const cpl_array *cal_timestamp,
const cpl_vector *calAngles) {
- return kmclipm_priv_reconstruct_check_lut (filename, ifu, gd, cal_timestamp, calAngles);
+ return kmclipm_priv_reconstruct_check_lut (filename, ifu_nr, gd, cal_timestamp, calAngles);
}
/**
diff --git a/kmclipm/src/kmclipm_math.c b/kmclipm/src/kmclipm_math.c
index d780640..777a2b7 100644
--- a/kmclipm/src/kmclipm_math.c
+++ b/kmclipm/src/kmclipm_math.c
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_math.c,v 1.5 2013/04/23 07:40:04 aagudo Exp $"
+ * "@(#) $Id: kmclipm_math.c,v 1.5 2013-04-23 07:40:04 aagudo Exp $"
*
* Functions that are implemented as recipes. They are also useedd in KMOS
* data reduction pipeline.
diff --git a/kmclipm/src/kmclipm_priv_constants.c b/kmclipm/src/kmclipm_priv_constants.c
index bddddeb..6aa6cfc 100644
--- a/kmclipm/src/kmclipm_priv_constants.c
+++ b/kmclipm/src/kmclipm_priv_constants.c
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_priv_constants.c,v 1.6 2012/09/30 22:35:46 aagudo Exp $"
+ * "@(#) $Id: kmclipm_priv_constants.c,v 1.6 2012-09-30 22:35:46 aagudo Exp $"
*
* Simple accessor functions to global variables.
*
diff --git a/kmclipm/src/kmclipm_priv_error.c b/kmclipm/src/kmclipm_priv_error.c
index 794c026..c39bf4a 100644
--- a/kmclipm/src/kmclipm_priv_error.c
+++ b/kmclipm/src/kmclipm_priv_error.c
@@ -1,7 +1,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_priv_error.c,v 1.1.1.1 2012/01/18 09:32:30 yjung Exp $"
+ * "@(#) $Id: kmclipm_priv_error.c,v 1.1.1.1 2012-01-18 09:32:30 yjung Exp $"
*
* PRIVATE macros/functions for kmclipm internal error handling
*
diff --git a/kmclipm/src/kmclipm_priv_functions.c b/kmclipm/src/kmclipm_priv_functions.c
index 05134a5..2be95ee 100644
--- a/kmclipm/src/kmclipm_priv_functions.c
+++ b/kmclipm/src/kmclipm_priv_functions.c
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_priv_functions.c,v 1.13 2013/02/05 15:50:31 erw Exp $"
+ * "@(#) $Id: kmclipm_priv_functions.c,v 1.13 2013-02-05 15:50:31 erw Exp $"
*
* Functions that are implemented as recipes. They are also useedd in KMOS
* data reduction pipeline.
diff --git a/kmclipm/src/kmclipm_priv_reconstruct.c b/kmclipm/src/kmclipm_priv_reconstruct.c
index 653fa5c..7e68224 100644
--- a/kmclipm/src/kmclipm_priv_reconstruct.c
+++ b/kmclipm/src/kmclipm_priv_reconstruct.c
@@ -1,7 +1,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_priv_reconstruct.c,v 1.43 2013/07/25 10:31:18 aagudo Exp $"
+ * "@(#) $Id: kmclipm_priv_reconstruct.c,v 1.48 2013-10-08 14:55:01 erw Exp $"
*
*
* who when what
@@ -56,7 +56,7 @@ typedef struct {
float l;
} neighbor;
-const char *cur_fileheader = "KMCLIPM_RECONSTRUCT_NN_LUT V006\n";
+const char *cur_fileheader = "KMCLIPM_RECONSTRUCT_NN_LUT V007\n";
/*const unsigned int single_timestamp_len = 19;
const unsigned int single_timestamp_dim = 19 + 1;
const unsigned int timestamp_rec_len = 3*19;
@@ -75,9 +75,9 @@ enum nn_lut_mode_type nn_lut_mode = LUT_MODE_FILE;
long nn_lut_timestamp_pos, nn_lut_calangle_pos, nn_lut_offset_pos;
gridDefinition empty_grid_definition = {{0,0.,0.}, {0,0.,0.}, {0,0.,0.},
- 0., NEAREST_NEIGHBOR, {0,PIXEL,N_CUBE}};
+ 0., NEAREST_NEIGHBOR, {0,PIXEL,N_CUBE}, 0., 0.};
gridDefinition nn_lut_grid_definition = {{0,0.,0.}, {0,0.,0.}, {0,0.,0.},
- 0., NEAREST_NEIGHBOR, {0,PIXEL,N_CUBE}};
+ 0., NEAREST_NEIGHBOR, {0,PIXEL,N_CUBE}, 0., 0.};
const double cal_angles_reset_values[3] = {8888.1, -8888.2, 8888.3};
double nn_lut_cal_angles[KMOS_NR_IFUS][3];
char nn_lut_timestamps [KMOS_NR_IFUS] [TIMESTAMP_REC_DIM] = {
@@ -170,6 +170,8 @@ void kmclipm_priv_copy_gridDefinition (gridDefinition src, gridDefinition *dest)
dest->neighborHood.distance = src.neighborHood.distance;
dest->neighborHood.scale = src.neighborHood.scale;
dest->neighborHood.type = src.neighborHood.type;
+ dest->rot_na_angle = src.rot_na_angle;
+ dest->rot_off_angle = src.rot_off_angle;
}
@@ -243,9 +245,9 @@ void kmclipm_priv_reconstruct_nnlut_reset_tables() {
}
}
-void kmclipm_priv_reconstruct_nnlut_reset_ifu (int ifu) {
+void kmclipm_priv_reconstruct_nnlut_reset_ifu (int ifu_nr) {
- int ix = ifu - 1;
+ int ix = ifu_nr - 1;
strcpy(&nn_lut_timestamps[ix][0], error_timestamp);
nn_lut_offsets[ix] = 0;
if (nn_luts[ix] != NULL) {
@@ -480,7 +482,7 @@ FILE *kmclipm_priv_reconstruct_nnlut_create(
*/
cpl_array* kmclipm_priv_reconstruct_nnlut_get_timestamp(
const char *filename,
- const int ifu,
+ const int ifu_nr,
const gridDefinition gd)
{
cpl_array *timestamp = NULL;
@@ -536,13 +538,13 @@ cpl_array* kmclipm_priv_reconstruct_nnlut_get_timestamp(
kmclipm_priv_reconstruct_nnlut_reset_tables();
kmclipm_priv_copy_gridDefinition(gd, &nn_lut_grid_definition);
}
- strcpy(timestamp_rec, &nn_lut_timestamps[ifu-1][0]);
+ strcpy(timestamp_rec, &nn_lut_timestamps[ifu_nr-1][0]);
} else if (nn_lut_mode == LUT_MODE_MEMORY) {
if (! gd_check) {
kmclipm_priv_reconstruct_nnlut_reset_tables();
kmclipm_priv_copy_gridDefinition(gd, &nn_lut_grid_definition);
}
- strcpy(timestamp_rec, &nn_lut_timestamps[ifu-1][0]);
+ strcpy(timestamp_rec, &nn_lut_timestamps[ifu_nr-1][0]);
} else if (nn_lut_mode == LUT_MODE_FILE) {
if (! gd_check) {
kmclipm_priv_reconstruct_nnlut_reset_tables();
@@ -558,7 +560,7 @@ cpl_array* kmclipm_priv_reconstruct_nnlut_get_timestamp(
fclose(fd);
}
}
- strcpy(timestamp_rec, &nn_lut_timestamps[ifu-1][0]);
+ strcpy(timestamp_rec, &nn_lut_timestamps[ifu_nr-1][0]);
} else if (nn_lut_mode == LUT_MODE_BOTH) {
if (! gd_check) {
kmclipm_priv_reconstruct_nnlut_reset_tables();
@@ -574,7 +576,7 @@ cpl_array* kmclipm_priv_reconstruct_nnlut_get_timestamp(
fclose(fd);
}
}
- strcpy(timestamp_rec, &nn_lut_timestamps[ifu-1][0]);
+ strcpy(timestamp_rec, &nn_lut_timestamps[ifu_nr-1][0]);
}
/* filename of lut to be checked
@@ -585,7 +587,7 @@ cpl_array* kmclipm_priv_reconstruct_nnlut_get_timestamp(
* 2: file created, 3: file creation failed
* time stamps returned for this IFU
*/
- cpl_msg_debug(cpl_func,"%s, %d, %d, %d, %d, %s", filename, ifu, nn_lut_mode,
+ cpl_msg_debug(cpl_func,"%s, %d, %d, %d, %d, %s", filename, ifu_nr, nn_lut_mode,
gd_check, file_open_check, timestamp_rec);
single_ts[SINGLE_TIMESTAMP_DIM-1] = '\0';
timestamp = cpl_array_new(3,CPL_TYPE_STRING);
@@ -601,7 +603,7 @@ cpl_array* kmclipm_priv_reconstruct_nnlut_get_timestamp(
*/
neighbors *** kmclipm_priv_reconstruct_nnlut_read_file(
const char *filename,
- const int ifu,
+ const int ifu_nr,
const gridDefinition gd)
{
neighbors ***nb = NULL;
@@ -620,7 +622,7 @@ neighbors *** kmclipm_priv_reconstruct_nnlut_read_file(
return NULL;
}
- fseek(fd, nn_lut_offsets[ifu-1], SEEK_SET);
+ fseek(fd, nn_lut_offsets[ifu_nr-1], SEEK_SET);
int xidx, yidx, lidx;
KMCLIPM_TRY_EXIT_IFN(
@@ -686,7 +688,7 @@ neighbors *** kmclipm_priv_reconstruct_nnlut_read_file(
}
if (error_encountered) {
- cpl_msg_debug(cpl_func, "Could not read LUT for IFU %d", ifu);
+ cpl_msg_debug(cpl_func, "Could not read LUT for IFU %d", ifu_nr);
return NULL;
} else {
return nb;
@@ -706,7 +708,7 @@ neighbors *** kmclipm_priv_reconstruct_nnlut_read_file(
*/
void kmclipm_priv_reconstruct_nnlut_write_file(
const char *filename,
- const int ifu,
+ const int ifu_nr,
const gridDefinition gd,
neighbors ***nb,
const char timestamp_rec[],
@@ -724,7 +726,7 @@ void kmclipm_priv_reconstruct_nnlut_write_file(
{
fd = kmclipm_priv_reconstruct_nnlut_open (filename, gd);
- if (fd == NULL || (nn_lut_offsets[ifu-1] != 0)) {
+ if (fd == NULL || (nn_lut_offsets[ifu_nr-1] != 0)) {
kmclipm_priv_reconstruct_nnlut_reset_tables();
fd = kmclipm_priv_reconstruct_nnlut_create(filename, gd);
if (fd == NULL) {
@@ -755,7 +757,7 @@ void kmclipm_priv_reconstruct_nnlut_write_file(
if (cnt != expected_cnt) {
cpl_msg_debug(cpl_func,
"Could not write LUT for ifu %d, errno = %d (%s)",
- ifu, errno, strerror(errno));
+ ifu_nr, errno, strerror(errno));
}
expected_cnt = nb[xidx][yidx][lidx].no_neighbors;
if (expected_cnt != 0) {
@@ -763,32 +765,32 @@ void kmclipm_priv_reconstruct_nnlut_write_file(
if (cnt != expected_cnt) {
cpl_msg_debug(cpl_func,
"Could not write LUT for ifu %d, errno = %d (%s)",
- ifu, errno, strerror(errno));
+ ifu_nr, errno, strerror(errno));
}
cnt = fwrite(nb[xidx][yidx][lidx].distance, sizeof(float), expected_cnt,fd);
if (cnt != expected_cnt) {
cpl_msg_debug(cpl_func,
"Could not write LUT for ifu %d, errno = %d (%s)",
- ifu, errno, strerror(errno));
+ ifu_nr, errno, strerror(errno));
}
if (gd.method == QUADRATIC_INTERPOLATION) {
cnt = fwrite(nb[xidx][yidx][lidx].x, sizeof(float), expected_cnt,fd);
if (cnt != expected_cnt) {
cpl_msg_debug(cpl_func,
"Could not write LUT for ifu %d, errno = %d (%s)",
- ifu, errno, strerror(errno));
+ ifu_nr, errno, strerror(errno));
}
cnt = fwrite(nb[xidx][yidx][lidx].y, sizeof(float), expected_cnt,fd);
if (cnt != expected_cnt) {
cpl_msg_debug(cpl_func,
"Could not write LUT for ifu %d, errno = %d (%s)",
- ifu, errno, strerror(errno));
+ ifu_nr, errno, strerror(errno));
}
cnt = fwrite(nb[xidx][yidx][lidx].l, sizeof(float), expected_cnt,fd);
if (cnt != expected_cnt) {
cpl_msg_debug(cpl_func,
"Could not write LUT for ifu %d, errno = %d (%s)",
- ifu, errno, strerror(errno));
+ ifu_nr, errno, strerror(errno));
}
}
}
@@ -796,12 +798,12 @@ void kmclipm_priv_reconstruct_nnlut_write_file(
}
}
- strcpy(&nn_lut_timestamps[ifu-1][0],timestamp_rec);
+ strcpy(&nn_lut_timestamps[ifu_nr-1][0],timestamp_rec);
int ix;
for (ix=0; ix<3; ix++) {
- nn_lut_cal_angles[ifu-1][ix] = cpl_vector_get(calAngles,ix);
+ nn_lut_cal_angles[ifu_nr-1][ix] = cpl_vector_get(calAngles,ix);
}
- nn_lut_offsets[ifu-1] = eof_pos;
+ nn_lut_offsets[ifu_nr-1] = eof_pos;
pos = fseek(fd, nn_lut_timestamp_pos, SEEK_SET);
if (pos == -1) {
@@ -855,28 +857,36 @@ void kmclipm_priv_reconstruct_nnlut_write_file(
neighbors *** kmclipm_priv_reconstruct_nnlut_read (
const char *filename,
- const int ifu,
+ const int ifu_nr,
const gridDefinition gd)
{
cpl_msg_debug(cpl_func,"called kmclipm_priv_reconstruct_nnlut_read");
neighbors ***nb = NULL;
+
+ if (ifu_nr < 0) {
+ /* shortcut for kmo_multi_reconstruct
+ * (should in fact never reach this since LUT-mode has been set to NONE)
+ */
+ return nb;
+ }
+
if (nn_lut_mode == LUT_MODE_NONE) {
} else if (nn_lut_mode == LUT_MODE_MEMORY) {
- nb = nn_luts[ifu-1];
+ nb = nn_luts[ifu_nr-1];
} else if (nn_lut_mode == LUT_MODE_FILE) {
- nb = kmclipm_priv_reconstruct_nnlut_read_file(filename, ifu, gd);
+ nb = kmclipm_priv_reconstruct_nnlut_read_file(filename, ifu_nr, gd);
} else if (nn_lut_mode == LUT_MODE_BOTH) {
- if (nn_luts[ifu-1] == NULL) {
- nn_luts[ifu-1] = kmclipm_priv_reconstruct_nnlut_read_file(filename, ifu, gd);
+ if (nn_luts[ifu_nr-1] == NULL) {
+ nn_luts[ifu_nr-1] = kmclipm_priv_reconstruct_nnlut_read_file(filename, ifu_nr, gd);
}
- nb = nn_luts[ifu-1];
+ nb = nn_luts[ifu_nr-1];
}
return nb;
}
void kmclipm_priv_reconstruct_nnlut_write (
const char *filename,
- const int ifu,
+ const int ifu_nr,
const gridDefinition gd,
neighbors ***nb,
const cpl_array *timestamp,
@@ -887,6 +897,12 @@ void kmclipm_priv_reconstruct_nnlut_write (
cpl_msg_debug(cpl_func,"called kmclipm_priv_reconstruct_nnlut_write");
KMCLIPM_TRY
{
+ if (ifu_nr < 0) {
+ /* shortcut for kmo_multi_reconstruct
+ * (should in fact never reach this since LUT-mode has been set to NONE)
+ */
+ return;
+ }
KMCLIPM_TRY_CHECK_AUTOMSG(timestamp != NULL,
CPL_ERROR_NULL_INPUT);
KMCLIPM_TRY_CHECK_AUTOMSG(cpl_array_get_size(timestamp) == 3,
@@ -911,15 +927,15 @@ void kmclipm_priv_reconstruct_nnlut_write (
if (nn_lut_mode == LUT_MODE_NONE) {
} else if (nn_lut_mode == LUT_MODE_MEMORY) {
- nn_luts[ifu-1] = nb;
- strcpy(&nn_lut_timestamps[ifu-1][0],timestamp_rec);
+ nn_luts[ifu_nr-1] = nb;
+ strcpy(&nn_lut_timestamps[ifu_nr-1][0],timestamp_rec);
} else if (nn_lut_mode == LUT_MODE_FILE) {
- kmclipm_priv_reconstruct_nnlut_write_file(filename, ifu, gd, nb,timestamp_rec,
+ kmclipm_priv_reconstruct_nnlut_write_file(filename, ifu_nr, gd, nb,timestamp_rec,
calAngles);
} else if (nn_lut_mode == LUT_MODE_BOTH) {
- kmclipm_priv_reconstruct_nnlut_write_file(filename, ifu, gd, nb, timestamp_rec,
+ kmclipm_priv_reconstruct_nnlut_write_file(filename, ifu_nr, gd, nb, timestamp_rec,
calAngles);
- nn_luts[ifu-1] = nb;
+ nn_luts[ifu_nr-1] = nb;
}
}
KMCLIPM_CATCH
@@ -931,7 +947,7 @@ void kmclipm_priv_reconstruct_nnlut_write (
* Check whether LUT is valid
*/
int kmclipm_priv_reconstruct_check_lut (const char *filename,
- const int ifu,
+ const int ifu_nr,
const gridDefinition gd,
const cpl_array *cal_timestamp,
const cpl_vector *calAngles) {
@@ -949,6 +965,13 @@ int kmclipm_priv_reconstruct_check_lut (const char *filename,
const char *fc_cond = "";
const char *fs_cond = "";
+ if (ifu_nr < 0) {
+ /* shortcut for kmo_multi_reconstruct */
+ nn_lut_mode = LUT_MODE_NONE;
+ kmclipm_priv_reconstruct_nnlut_reset_tables();
+ return final_lut_check;
+ }
+
if ( ! (gd.method == NEAREST_NEIGHBOR ||
gd.method == LINEAR_WEIGHTED_NEAREST_NEIGHBOR ||
gd.method == SQUARE_WEIGHTED_NEAREST_NEIGHBOR ||
@@ -1003,7 +1026,7 @@ int kmclipm_priv_reconstruct_check_lut (const char *filename,
final_lut_check = 0;
} else if (nn_lut_mode == LUT_MODE_MEMORY) {
gd_check = kmclipm_priv_compare_gridDefinition(gd, nn_lut_grid_definition);
- angle_check = kmclipm_priv_compare_calAngles(calAngles, &nn_lut_cal_angles[ifu-1][0]);
+ angle_check = kmclipm_priv_compare_calAngles(calAngles, &nn_lut_cal_angles[ifu_nr-1][0]);
if (! gd_check) {
mc_cond="mem_gd_check_failed";
kmclipm_priv_reconstruct_nnlut_reset_tables();
@@ -1012,14 +1035,14 @@ int kmclipm_priv_reconstruct_check_lut (const char *filename,
} else if (! angle_check) {
mc_cond="mem_angle_check_failed";
kmclipm_priv_reconstruct_nnlut_reset_tables();
- kmclipm_priv_copy_calAngles(calAngles, &nn_lut_cal_angles[ifu-1][0]);
+ kmclipm_priv_copy_calAngles(calAngles, &nn_lut_cal_angles[ifu_nr-1][0]);
final_lut_check = 0;
} else {
- strcpy(timestamp_rec, &nn_lut_timestamps[ifu-1][0]);
+ strcpy(timestamp_rec, &nn_lut_timestamps[ifu_nr-1][0]);
if (! kmclipm_priv_compare_timestamps(timestamp_rec, cal_timestamp)) {
mc_cond="mem_ts_check_failed";
- kmclipm_priv_reconstruct_nnlut_reset_ifu(ifu);
+ kmclipm_priv_reconstruct_nnlut_reset_ifu(ifu_nr);
final_lut_check = 0;
} else {
mc_cond="mem_check_OK";
@@ -1051,16 +1074,16 @@ int kmclipm_priv_reconstruct_check_lut (const char *filename,
}
} else {
final_lut_check = 1;
- strcpy(timestamp_rec, &nn_lut_timestamps[ifu-1][0]);
+ strcpy(timestamp_rec, &nn_lut_timestamps[ifu_nr-1][0]);
if (! kmclipm_priv_compare_timestamps(timestamp_rec, cal_timestamp)) {
fc_cond="file_ts_check_failed";
final_lut_check = 0;
- } else if (! kmclipm_priv_compare_calAngles(calAngles, &nn_lut_cal_angles[ifu-1][0])) {
+ } else if (! kmclipm_priv_compare_calAngles(calAngles, &nn_lut_cal_angles[ifu_nr-1][0])) {
fc_cond="file_angle_check_failed";
final_lut_check = 0;
}
if (final_lut_check == 0) {
- if (nn_lut_offsets[ifu-1] != 0) {
+ if (nn_lut_offsets[ifu_nr-1] != 0) {
/* there is already a wrong entry for this IFU in the file, create a new file */
fs_cond="lut_not_empty_error";
fd = kmclipm_priv_reconstruct_nnlut_create(filename, gd);
@@ -1075,16 +1098,16 @@ int kmclipm_priv_reconstruct_check_lut (const char *filename,
fd = NULL;
}
}
- kmclipm_priv_reconstruct_nnlut_reset_ifu(ifu);
+ kmclipm_priv_reconstruct_nnlut_reset_ifu(ifu_nr);
} else {
fc_cond="file_check_OK";
}
}
} else if (nn_lut_mode == LUT_MODE_BOTH) {
- strcpy(timestamp_rec, &nn_lut_timestamps[ifu-1][0]);
+ strcpy(timestamp_rec, &nn_lut_timestamps[ifu_nr-1][0]);
/* check if grid definition and time stamp in memory */
int gd_check = kmclipm_priv_compare_gridDefinition(gd, nn_lut_grid_definition);
- int angle_check = kmclipm_priv_compare_calAngles(calAngles, &nn_lut_cal_angles[ifu-1][0]);
+ int angle_check = kmclipm_priv_compare_calAngles(calAngles, &nn_lut_cal_angles[ifu_nr-1][0]);
int ts_check = kmclipm_priv_compare_timestamps(timestamp_rec, cal_timestamp);
if (! gd_check) {
mc_cond="mem_gd_check_failed";
@@ -1093,10 +1116,10 @@ int kmclipm_priv_reconstruct_check_lut (const char *filename,
} else if (! angle_check) {
mc_cond="mem_ts_check_failed";
kmclipm_priv_reconstruct_nnlut_reset_tables();
- kmclipm_priv_copy_calAngles(calAngles, &nn_lut_cal_angles[ifu-1][0]);
+ kmclipm_priv_copy_calAngles(calAngles, &nn_lut_cal_angles[ifu_nr-1][0]);
} else if (! ts_check) {
mc_cond="mem_ts_check_failed";
- kmclipm_priv_reconstruct_nnlut_reset_ifu(ifu);
+ kmclipm_priv_reconstruct_nnlut_reset_ifu(ifu_nr);
}
if ((! gd_check) || (! angle_check) || (! ts_check)) {
/* if grid definition or cal ROT angle check or time stamp failed try to open existing LUT file */
@@ -1125,16 +1148,16 @@ int kmclipm_priv_reconstruct_check_lut (const char *filename,
}
} else {
final_lut_check = 1;
- strcpy(timestamp_rec, &nn_lut_timestamps[ifu-1][0]);
+ strcpy(timestamp_rec, &nn_lut_timestamps[ifu_nr-1][0]);
if (! kmclipm_priv_compare_timestamps(timestamp_rec, cal_timestamp)) {
fc_cond="file_ts_check_failed";
final_lut_check = 0;
- } else if (! kmclipm_priv_compare_calAngles(calAngles, &nn_lut_cal_angles[ifu-1][0])) {
+ } else if (! kmclipm_priv_compare_calAngles(calAngles, &nn_lut_cal_angles[ifu_nr-1][0])) {
fc_cond="file_angle_check_failed";
final_lut_check = 0;
}
if (final_lut_check == 0) {
- if (nn_lut_offsets[ifu-1] != 0) {
+ if (nn_lut_offsets[ifu_nr-1] != 0) {
/*there is already a wrong entry for this IFU in the file, create a new file */
fs_cond="lut_not_empty_error";
fd = kmclipm_priv_reconstruct_nnlut_create(filename, gd);
@@ -1149,7 +1172,7 @@ int kmclipm_priv_reconstruct_check_lut (const char *filename,
fd = NULL;
}
}
- kmclipm_priv_reconstruct_nnlut_reset_ifu(ifu);
+ kmclipm_priv_reconstruct_nnlut_reset_ifu(ifu_nr);
} else {
fc_cond="file_check_OK";
}
@@ -1165,20 +1188,20 @@ int kmclipm_priv_reconstruct_check_lut (const char *filename,
if (nn_lut_mode == LUT_MODE_NONE) {
cpl_msg_debug(cpl_func,
"Mode: %s, IFU: %d, cond: %s, %s, %s, status: %d" ,
- mode, ifu, mc_cond, fc_cond, fs_cond, final_lut_check);
+ mode, ifu_nr, mc_cond, fc_cond, fs_cond, final_lut_check);
} else if (nn_lut_mode == LUT_MODE_MEMORY) {
cpl_msg_debug(cpl_func,
"Mode: %s, IFU: %d, cond: %s, %s, %s, status: %d, LUT in mem: %lX" ,
- mode, ifu, mc_cond, fc_cond, fs_cond, final_lut_check, (unsigned long int) nn_luts[ifu-1]);
+ mode, ifu_nr, mc_cond, fc_cond, fs_cond, final_lut_check, (unsigned long int) nn_luts[ifu_nr-1]);
} else if (nn_lut_mode == LUT_MODE_FILE) {
cpl_msg_debug(cpl_func,
"Mode: %s, IFU: %d, LUT: %s, cond: %s, %s, %s, status: %d" ,
- mode, ifu, filename, mc_cond, fc_cond, fs_cond, final_lut_check);
+ mode, ifu_nr, filename, mc_cond, fc_cond, fs_cond, final_lut_check);
} else if (nn_lut_mode == LUT_MODE_BOTH) {
cpl_msg_debug(cpl_func,
"Mode: %s, IFU: %d, LUT: %s, cond: %s, %s, %s, status: %d, LUT in mem: %lX" ,
- mode, ifu, filename, mc_cond, fc_cond, fs_cond, final_lut_check, (unsigned long int) nn_luts[ifu-1]);
+ mode, ifu_nr, filename, mc_cond, fc_cond, fs_cond, final_lut_check, (unsigned long int) nn_luts[ifu_nr-1]);
}
if (fd != NULL) {
@@ -1285,16 +1308,10 @@ neighbors ***kmclipm_priv_find_neighbors(const gridDefinition gd, const samples
lPixelDist = 0.;
if (gd.neighborHood.scale == PIXEL) {
- /* xPixelDist = (int) lroundf(gd.neighborHood.distance); */
xPixelDist = gd.neighborHood.distance;
yPixelDist = xPixelDist;
lPixelDist = xPixelDist;
} else {
- /*
- xPixelDist = (int) lroundf(gd.neighborHood.distance/gd.x.delta);
- yPixelDist = (int) lroundf(gd.neighborHood.distance/gd.y.delta);
- lPixelDist = (int) lroundf(gd.neighborHood.distance/gd.l.delta * gd.lamdaDistanceScale);
- */
xPixelDist = gd.neighborHood.distance/gd.x.delta;
yPixelDist = gd.neighborHood.distance/gd.y.delta;
lPixelDist = gd.neighborHood.distance/gd.l.delta * gd.lamdaDistanceScale;
@@ -1503,7 +1520,7 @@ void kmclipm_priv_cleanup_neighborlist(neighbors *** nb, gridDefinition gd) {
}
cpl_imagelist *kmclipm_priv_reconstruct_nearestneighbor (
- int ifu,
+ int ifu_nr,
int xSize,
int ySize,
const float *xcal_data,
@@ -1615,7 +1632,7 @@ cpl_imagelist *kmclipm_priv_reconstruct_nearestneighbor (
cpl_msg_debug("-x-",
"For IFU %d %d valid samples of %d samples are found, "
"%d dead samples, %d \"error\" samples",
- ifu, validSampleCnt, xSize*ySize, deadCnt, errFound);
+ ifu_nr, validSampleCnt, xSize*ySize, deadCnt, errFound);
#if KMCLIPM_GET_INSTALLED_CPL_VERSION >= 5
cpl_msg_debug("-x-",
"Loading \"samples\" arrays took %.3f seconds of CPU-time",
@@ -1704,10 +1721,10 @@ cpl_imagelist *kmclipm_priv_reconstruct_nearestneighbor (
#endif
if (! lut_valid) {
nb = (neighbors ***) kmclipm_priv_find_neighbors (gd, &sampleList);
- kmclipm_priv_reconstruct_nnlut_write(lut_path, ifu, gd,
+ kmclipm_priv_reconstruct_nnlut_write(lut_path, ifu_nr, gd,
(neighbors ***) nb, timestamp, calAngles);
} else {
- nb = kmclipm_priv_reconstruct_nnlut_read(lut_path, ifu, gd);
+ nb = kmclipm_priv_reconstruct_nnlut_read(lut_path, ifu_nr, gd);
if (nb == NULL) {
cpl_msg_error(cpl_func,
"Error reading LUT file for reconstruction, please "
@@ -1958,13 +1975,13 @@ cpl_imagelist *kmclipm_priv_reconstruct_nearestneighbor (
lstart=0;
lstop=2459;
int ldim=lstop-lstart+1;
- if (ifu==2 && xidx==6 && yidx==8 && lidx==lstart) {
+ if (ifu_nr==2 && xidx==6 && yidx==8 && lidx==lstart) {
fprintf(stderr,
"n_neighbors=indgen(%d)*0.\n"
"distance=dindgen(%d,30)*0.\n"
"value=dindgen(%d,30)*0.\n", ldim,ldim,ldim);
}
- if (ifu==2 && xidx==6 && yidx==8 && (lidx>=lstart && lidx<=lstop)) {
+ if (ifu_nr==2 && xidx==6 && yidx==8 && (lidx>=lstart && lidx<=lstop)) {
int idl_ix = lidx-lstart;
printf ("lidx: %d, n: %d", lidx, cnt);
fprintf(stderr,"n_neighbors[%d]=%d\n",idl_ix, cnt);
@@ -2049,7 +2066,7 @@ cpl_imagelist *kmclipm_priv_reconstruct_nearestneighbor (
}
}
cpl_msg_debug(component, "IFU %d: max value of input image: %f, of the output image: %f",
- ifu, imax, omax);
+ ifu_nr, imax, omax);
if (sampleList.no_samples != 0 ) {
if (! lut_valid) {
@@ -2078,11 +2095,11 @@ static int yPos2index(float yPos) {
return (yPos+1400.)/200;
}
-static void writeImageSinglePrec (const char* fname, int ifu, int xdim, int ydim,
+static void writeImageSinglePrec (const char* fname, int ifu_nr, int xdim, int ydim,
const float *data) {
const int debug = 1; /* set debug to "1" to enable writing of images */
if (debug) {
- char *filename = cpl_sprintf("%s-%2.2d.fits", fname, ifu);
+ char *filename = cpl_sprintf("%s-%2.2d.fits", fname, ifu_nr);
cpl_image *image = cpl_image_wrap_float(xdim, ydim, (float *) data);
#if KMCLIPM_GET_INSTALLED_CPL_VERSION >= 5
cpl_image_save(image, filename, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
@@ -2094,11 +2111,11 @@ static void writeImageSinglePrec (const char* fname, int ifu, int xdim, int ydim
}
}
-static void writeImageDoublePrec (const char* fname, int ifu, int xdim, int ydim,
+static void writeImageDoublePrec (const char* fname, int ifu_nr, int xdim, int ydim,
const double *data) {
const int debug = 1; /* set debug to "1" to enable writing of images */
if (debug) {
- char *filename = cpl_sprintf("%s-%2.2d.fits", fname, ifu);
+ char *filename = cpl_sprintf("%s-%2.2d.fits", fname, ifu_nr);
cpl_image *image = cpl_image_wrap_double(xdim, ydim, (double *) data);
#if KMCLIPM_GET_INSTALLED_CPL_VERSION >= 5
cpl_image_save(image, filename, CPL_BPP_IEEE_DOUBLE, NULL, CPL_IO_CREATE);
@@ -2111,7 +2128,7 @@ static void writeImageDoublePrec (const char* fname, int ifu, int xdim, int ydim
}
cpl_imagelist *kmclipm_priv_reconstruct_cubicspline (
- int ifu,
+ int ifu_nr,
int xSize,
int ySize,
const float *xcal_data,
@@ -2142,18 +2159,27 @@ cpl_imagelist *kmclipm_priv_reconstruct_cubicspline (
double* tmpVals = NULL;
if (debug) {
- writeImageSinglePrec("xcal", ifu, xSize, ySize, xcal_data);
- writeImageSinglePrec("ycal", ifu, xSize, ySize, ycal_data);
- writeImageSinglePrec("lcal", ifu, xSize, ySize, lcal_data);
- writeImageSinglePrec("image", ifu, xSize, ySize, image);
+ writeImageSinglePrec("xcal", ifu_nr, xSize, ySize, xcal_data);
+ writeImageSinglePrec("ycal", ifu_nr, xSize, ySize, ycal_data);
+ writeImageSinglePrec("lcal", ifu_nr, xSize, ySize, lcal_data);
+ writeImageSinglePrec("image", ifu_nr, xSize, ySize, image);
}
KMCLIPM_TRY
{
+ if (ifu_nr < 0) {
+ /* security-check for kmo_multi_reconstruct
+ * CS is not yet allowed!
+ */
+ cpl_msg_error(cpl_func, "CS is not yet allowed for kmo_multi_reconstruct!");
+ KMCLIPM_TRY_CHECK_AUTOMSG(1 == 0,
+ CPL_ERROR_ILLEGAL_INPUT);
+ }
+
float* xcali = NULL;
float* ycali = NULL;
float* lcali = (float*)lcal_data;
- if (ifu < 17) { /* for detector 1 and 2 the xcal holds the slitlet positions and
+ if (ifu_nr < 17) { /* for detector 1 and 2 the xcal holds the slitlet positions and
the ycal the pixel positions within the slitlet */
xcali = (float*)ycal_data;
ycali = (float*)xcal_data;
@@ -2231,7 +2257,7 @@ cpl_imagelist *kmclipm_priv_reconstruct_cubicspline (
/*
cpl_msg_debug(component,
"found %d valid pixels for ifu %d, slitlet %d, row %d",
- slitletPtr, ifu, yPos2index(yPrev), rx);
+ slitletPtr, ifu_nr, yPos2index(yPrev), rx);
*/
if (slitletPtr > 3) { /* minimum of 4 valid pixels is requested */
for (kx=0; kx<slitletPtr; kx++) {
@@ -2333,21 +2359,21 @@ cpl_imagelist *kmclipm_priv_reconstruct_cubicspline (
cpl_msg_debug(component,
"didn't find expected number of slitlets, found %d, "
"expected %d, ifu %d, row %d",
- slitletCounter,nSlitlets, ifu, rx);
+ slitletCounter,nSlitlets, ifu_nr, rx);
}
if (slitletCounter > nSlitlets) {
cpl_msg_error(component,
"didn't find expected number of slitlets, found %d, "
"expected %d, ifu %d, row %d",
- slitletCounter,nSlitlets, ifu, rx);
+ slitletCounter,nSlitlets, ifu_nr, rx);
}
*/
}
if (debug) {
- writeImageDoublePrec("xcalx", ifu, nSlitlets * gd.x.dim, ySize, xcalx);
- writeImageDoublePrec("ycalx", ifu, nSlitlets * gd.x.dim, ySize, ycalx);
- writeImageDoublePrec("lcalx", ifu, nSlitlets * gd.x.dim, ySize, lcalx);
- writeImageDoublePrec("rvalx", ifu, nSlitlets * gd.x.dim, ySize, rvalx);
+ writeImageDoublePrec("xcalx", ifu_nr, nSlitlets * gd.x.dim, ySize, xcalx);
+ writeImageDoublePrec("ycalx", ifu_nr, nSlitlets * gd.x.dim, ySize, ycalx);
+ writeImageDoublePrec("lcalx", ifu_nr, nSlitlets * gd.x.dim, ySize, lcalx);
+ writeImageDoublePrec("rvalx", ifu_nr, nSlitlets * gd.x.dim, ySize, rvalx);
cpl_free(xcalx); xcalx = NULL;
}
@@ -2490,9 +2516,9 @@ cpl_imagelist *kmclipm_priv_reconstruct_cubicspline (
cpl_free(rvalx); rvalx = NULL;
}
if (debug) {
- writeImageDoublePrec("ycaly", ifu, gd.y.dim * gd.x.dim, ySize, ycaly);
- writeImageDoublePrec("lcaly", ifu, gd.y.dim * gd.x.dim, ySize, lcaly);
- writeImageDoublePrec("rvaly", ifu, gd.y.dim * gd.x.dim, ySize, rvaly);
+ writeImageDoublePrec("ycaly", ifu_nr, gd.y.dim * gd.x.dim, ySize, ycaly);
+ writeImageDoublePrec("lcaly", ifu_nr, gd.y.dim * gd.x.dim, ySize, lcaly);
+ writeImageDoublePrec("rvaly", ifu_nr, gd.y.dim * gd.x.dim, ySize, rvaly);
}
cpl_free(ycaly); ycaly = NULL;
@@ -2549,7 +2575,7 @@ cpl_imagelist *kmclipm_priv_reconstruct_cubicspline (
for (kx=1; kx<ptrCtr; kx++) {
if (lvals[kx] < lvals[kx-1]) {
cpl_msg_debug(component, "OOPS: IFU %d index %d {%f %f %f}",
- ifu, kx, lvals[kx-1], lvals[kx], lvals[kx+1]);
+ ifu_nr, kx, lvals[kx-1], lvals[kx], lvals[kx+1]);
}
}
*/
@@ -2628,7 +2654,7 @@ cpl_imagelist *kmclipm_priv_reconstruct_cubicspline (
cpl_msg_debug(component,
"CS: IFU %d: min/max value of input image: %f / %f, of "
"the output image: %f / %f",
- ifu, imin, imax, omin, omax);
+ ifu_nr, imin, imax, omin, omax);
cpl_free(lcaly); lcaly = NULL;
cpl_free(rvaly); rvaly = NULL;
@@ -2637,8 +2663,8 @@ cpl_imagelist *kmclipm_priv_reconstruct_cubicspline (
cpl_free(rvals); rvals = NULL;
if (debug) {
- writeImageDoublePrec("rvall", ifu, gd.y.dim * gd.x.dim, gd.l.dim, rvall);
- writeImageDoublePrec("lcall", ifu, gd.y.dim * gd.x.dim, gd.l.dim, lcall);
+ writeImageDoublePrec("rvall", ifu_nr, gd.y.dim * gd.x.dim, gd.l.dim, rvall);
+ writeImageDoublePrec("lcall", ifu_nr, gd.y.dim * gd.x.dim, gd.l.dim, lcall);
cpl_free(lcall); lcall = NULL;
}
@@ -2653,7 +2679,7 @@ cpl_imagelist *kmclipm_priv_reconstruct_cubicspline (
KMCLIPM_TRY_EXIT_IFN(
image_data_out = cpl_image_get_data_float(image_out));
- if (ifu < 17) { /* swap x and y axis for detectors 1 and 2 */
+ if (ifu_nr < 17) { /* swap x and y axis for detectors 1 and 2 */
for (yidx=0; yidx<gd.y.dim; yidx++) {
for (xidx=0; xidx<gd.x.dim; xidx++) {
image_data_out[xidx + yidx*gd.x.dim] =
@@ -2704,7 +2730,8 @@ cpl_imagelist *kmclipm_priv_reconstruct_cubicspline (
cpl_error_code kmclipm_priv_setup_grid(gridDefinition *gd,
const enum reconstructMethod method,
double neighborhoodRange,
- double pixel_scale)
+ double pixel_scale,
+ double rot_angle)
{
cpl_error_code ret_error = CPL_ERROR_NONE;
@@ -2729,6 +2756,9 @@ cpl_error_code kmclipm_priv_setup_grid(gridDefinition *gd,
gd->neighborHood.scale = PIXEL;
gd->neighborHood.type = N_CUBE;
gd->method = method;
+ gd->rot_na_angle = 0.0;
+ gd->rot_off_angle = rot_angle;
+
/* adapt pixel range if desired */
if (fabs(pixel_scale*1000-KMOS_PIXEL_RESOLUTION) > 0.001) {
@@ -2767,6 +2797,40 @@ cpl_error_code kmclipm_priv_setup_grid(gridDefinition *gd,
gd->y.start=-(KMOS_SLITLET_Y*KMOS_PIXEL_RESOLUTION - gd->y.delta)/2;
gd->y.dim = pixNewY;
}
+
+ if (abs(rot_angle) > 1.0) {
+ float x[4];
+ float y[4];
+ x[0]= gd->x.start; y[0]= gd->y.start;
+ x[1]= gd->x.start + gd->x.dim * gd->x.delta; y[1]= gd->y.start;
+ x[2]= gd->x.start + gd->x.dim * gd->x.delta; y[2]= gd->y.start + gd->y.dim * gd->y.delta;
+ x[3]= gd->x.start; ; y[2]= gd->y.start + gd->y.dim * gd->y.delta;
+ int i;
+ float tol = 0.1; /* tolerance to increase grid; it allows max/min to extend
+ the grid by tol*grid.delta */
+ float angle = rot_angle * CPL_MATH_PI / 180;
+ float cos_a = cosf(angle);
+ float sin_a = sinf(angle);
+ float tmpx, tmpy;
+ for (i=0; i<3; i++) {
+ tmpx = x[i] * cos_a - y[i] * sin_a;
+ tmpy = x[i] * sin_a + y[i] * cos_a;
+ x[i] = tmpx;
+ y[i] = tmpy;
+ }
+ float min, max, end;
+ max= fmaxf( fmaxf(x[0],x[1]), fmaxf(x[2],x[3]) );
+ min= fminf( fminf(x[0],x[1]), fminf(x[2],x[3]) );
+ gd->x.start = (floorf((min+tol+gd->x.delta/2.)/gd->x.delta)-.5) * gd->x.delta;
+ end = (ceilf ((max-tol-gd->x.delta/2.)/gd->x.delta)+.5) * gd->x.delta;
+ gd->x.dim = ((int) (end - gd->x.start) / gd->x.delta + .5) + 1;
+ max= fmaxf( fmaxf(y[0],y[1]), fmaxf(y[2],y[3]) );
+ min= fminf( fminf(y[0],y[1]), fminf(y[2],y[3]) );
+ gd->y.start = (floorf((min+tol+gd->y.delta/2.)/gd->y.delta)-.5) * gd->y.delta;
+ end = (ceilf ((max-tol-gd->y.delta/2.)/gd->y.delta)+.5) * gd->y.delta;
+ gd->y.dim = ((int) (end - gd->y.start) / gd->y.delta + .5) + 1;
+
+ }
}
KMCLIPM_CATCH
{
@@ -2785,62 +2849,119 @@ cpl_error_code kmclipm_priv_setup_grid(gridDefinition *gd,
argument or holding a NAN is set to zero.
In addition, the decimal part of the YCAL data is deleted, only the integer part is returned.
- @param ifu IFU number (1...24)
- @param xSize size of x dimension
- @param ySize size of y dimension
+ @param ifu_nr IFU number (1...24)
@param *xcal_data pointer to xcal image for this IFU
@param *ycal_data pointer to ycal image for this IFU
@param *lcal_data pointer to lcal image for this IFU
@return nothing
*/
-void kmclipm_priv_delete_alien_ifu_cal_data(int ifu,
- int xSize,
- int ySize,
- float *xcal_data,
- float *ycal_data,
- float *lcal_data) {
-
- int ix = 0, iy = 0, idx = 0;
- int ifu_of_device = 0;
- int ifu_idx = 0;
- float test = 0.;
-
- ifu_of_device = ifu % KMOS_IFUS_PER_DETECTOR;
- if (ifu_of_device == 0) {
- ifu_of_device = 8;
- }
- for (iy=0; iy < ySize; iy++) {
- for (ix=0; ix < xSize; ix++) {
- idx = ix + iy * xSize;
- if (ycal_data[idx] == 0.0) {
- continue;
- }
- /*
- * Make sure x/y/l-cal images are checked against NANs
- * because the position of NANs might not match if different CAL observations were used
+cpl_error_code kmclipm_priv_delete_alien_ifu_cal_data(int ifu_nr,
+ cpl_image *xcal,
+ cpl_image *ycal,
+ cpl_image *lcal)
+{
+
+ int ix = 0,
+ iy = 0,
+ idx = 0,
+ nx = 0,
+ ny = 0,
+ ifu_of_device = 0,
+ ifu_idx = 0;
+ float test = 0.,
+ *pxcal = NULL,
+ *pycal = NULL,
+ *plcal = NULL;
+ cpl_error_code ret_error = CPL_ERROR_NONE;
+
+ KMCLIPM_TRY
+ {
+ /* Check inputs */
+ KMCLIPM_TRY_CHECK((xcal != NULL) &&
+ (ycal != NULL) &&
+ (lcal != NULL),
+ CPL_ERROR_NULL_INPUT,
+ NULL,
+ "Not all input data is provided!");
+
+ if (ifu_nr < 0) {
+ /* shortcut for kmo_multi_reconstruct
+ * (is already done in kmo_mr_reconstruct())
*/
- if ( (kmclipm_is_nan_or_inf(ycal_data[idx]) == 1) ||
- (kmclipm_is_nan_or_inf(xcal_data[idx]) == 1) ||
- (kmclipm_is_nan_or_inf(lcal_data[idx]) == 1) ) {
- xcal_data[idx] = 0.0;
- ycal_data[idx] = 0.0;
- lcal_data[idx] = 0.0;
- } else {
- test = fabsf(ycal_data[idx]) + 0.01; /* ensure proper rounding */
+ return ret_error;
+ }
- ifu_idx = (int) ((test-(int)test) * 10); /* get first decimal */
- if (ifu_idx != ifu_of_device) {
- xcal_data[idx] = 0.0;
- ycal_data[idx] = 0.0;
- lcal_data[idx] = 0.0;
+ nx = cpl_image_get_size_x(xcal);
+ ny = cpl_image_get_size_y(xcal);
+ KMCLIPM_TRY_CHECK_ERROR_STATE();
+
+ KMCLIPM_TRY_CHECK((nx == cpl_image_get_size_x(ycal)) &&
+ (nx == cpl_image_get_size_x(lcal)) &&
+ (ny == cpl_image_get_size_y(ycal)) &&
+ (ny == cpl_image_get_size_y(lcal)),
+ CPL_ERROR_ILLEGAL_INPUT,
+ NULL,
+ "xcal, ycal & lcal don't have the same size!");
+
+ ifu_of_device = ifu_nr % KMOS_IFUS_PER_DETECTOR;
+ if (ifu_of_device == 0) {
+ ifu_of_device = 8;
+ }
+
+ KMCLIPM_TRY_EXIT_IFN(
+ pxcal = cpl_image_get_data_float(xcal));
+ KMCLIPM_TRY_EXIT_IFN(
+ pycal = cpl_image_get_data_float(ycal));
+ KMCLIPM_TRY_EXIT_IFN(
+ plcal = cpl_image_get_data_float(lcal));
+
+ for (iy = 0; iy < ny; iy++) {
+ for (ix = 0; ix < nx; ix++) {
+ idx = ix+iy*nx;
+ if (pycal[idx] == 0.0) {
+ continue;
+ }
+
+ /*
+ * Make sure x/y/l-cal images are checked against NANs
+ * because the position of NANs might not match if different CAL observations were used
+ */
+ if ((kmclipm_is_nan_or_inf(pycal[idx]) == 1) ||
+ (kmclipm_is_nan_or_inf(pxcal[idx]) == 1) ||
+ (kmclipm_is_nan_or_inf(plcal[idx]) == 1))
+ {
+ pxcal[idx] = 0.0;
+ pycal[idx] = 0.0;
+ plcal[idx] = 0.0;
+ cpl_image_reject(xcal, ix+1, iy+1);
+ cpl_image_reject(ycal, ix+1, iy+1);
+ cpl_image_reject(lcal, ix+1, iy+1);
} else {
- ycal_data[idx] = (int)(ycal_data[idx]);
+ test = fabsf(pycal[idx]) + 0.01; /* ensure proper rounding */
+ ifu_idx = (int) ((test-(int)test) * 10); /* get first decimal */
+
+ if (ifu_idx != ifu_of_device) {
+ pxcal[idx] = 0.0;
+ pycal[idx] = 0.0;
+ plcal[idx] = 0.0;
+ cpl_image_reject(xcal, ix+1, iy+1);
+ cpl_image_reject(ycal, ix+1, iy+1);
+ cpl_image_reject(lcal, ix+1, iy+1);
+ } else {
+ pycal[idx] = (int)(pycal[idx]);
+ pxcal[idx] = (int)(pxcal[idx]);
+ }
}
}
}
}
+ KMCLIPM_CATCH
+ {
+ ret_error = cpl_error_get_code();
+ }
+ return ret_error;
}
/** @} */
diff --git a/kmclipm/src/kmclipm_priv_splines.c b/kmclipm/src/kmclipm_priv_splines.c
index 37bfec7..3917f02 100644
--- a/kmclipm/src/kmclipm_priv_splines.c
+++ b/kmclipm/src/kmclipm_priv_splines.c
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_priv_splines.c,v 1.17 2013/07/29 18:08:45 aagudo Exp $"
+ * "@(#) $Id: kmclipm_priv_splines.c,v 1.19 2013-10-09 12:19:49 aagudo Exp $"
*
* Functions that are implemented as recipes. They are also useedd in KMOS
* data reduction pipeline.
@@ -29,6 +29,7 @@
#include <config.h>
#endif
+#define _ISOC99_SOURCE
/*------------------------------------------------------------------------------
* Includes
@@ -46,7 +47,7 @@
#include "kmclipm_priv_error.h"
double polynomial_interpolation (double xi[], double yi[], int n, double x, double *dy);
-void hunt_for_index(double xx[], unsigned long n, double x, unsigned int *jlo);
+int hunt_for_index(double xx[], unsigned long n, double x, unsigned int *jlo);
void report_error(const char *func, cpl_error_code code, const char *msg);
/*------------------------------------------------------------------------------
@@ -956,9 +957,15 @@ double *polynomial_irreg_reg(
if (order >= nin) {
old_order = order;
order = nin - 1;
- cpl_msg_warning(__func__,
- "too few data points for %dth order polynomial interpolation, order decreased to %d",
- old_order, order);
+
+ if (order > 0) {
+ cpl_msg_warning(__func__,
+ "too few data points for %dth order polynomial interpolation, order decreased to %d",
+ old_order, order);
+ } else {
+ cpl_msg_error(__func__,
+ "Only one valid data point! Can't do cubic spline here!");
+ }
/*
report_error(__func__, CPL_ERROR_ILLEGAL_INPUT,
"at least \"order + 1\" data points are needed as input");
@@ -966,17 +973,25 @@ double *polynomial_irreg_reg(
}
yout = vector(nout);
- polydim = order + 1;
- for (ix=0; ix<nout; ix++) {
- x = xo0 + ix * dxo;
- cx = nin/2;
- hunt_for_index(xi, nin, x, &cx);
- cx = imin( imax(cx-(polydim-1)/2,0), nin-polydim);
- yout[ix] = polynomial_interpolation(&xi[cx], &yi[cx], polydim, x, &error);
+ if (order > 0) {
+ polydim = order + 1;
+ for (ix=0; ix<nout; ix++) {
+ x = xo0 + ix * dxo;
+ cx = nin/2;
+ if (hunt_for_index(xi, nin, x, &cx)) {
+ cx = imin( imax(cx-(polydim-1)/2,0), nin-polydim);
+ yout[ix] = polynomial_interpolation(&xi[cx], &yi[cx], polydim, x, &error);
+ } else {
+ yout[ix] = NAN;
+ }
+ }
+ } else {
+ for (ix=0; ix<nout; ix++) {
+ yout[ix] = NAN;
+ }
}
return yout;
-
}
double *polynomial_irreg_reg_nonans(
@@ -1031,9 +1046,15 @@ double *polynomial_irreg_irreg(
if (order >= nin) {
old_order = order;
order = nin - 1;
- cpl_msg_warning(__func__,
- "too few data points for %dth order polynomial interpolation, order decreased to %d",
- old_order, order);
+
+ if (order > 0) {
+ cpl_msg_warning(__func__,
+ "too few data points for %dth order polynomial interpolation, order decreased to %d",
+ old_order, order);
+ } else {
+ cpl_msg_error(__func__,
+ "Only one valid data point! Can't do cubic spline here!");
+ }
/*
report_error(__func__, CPL_ERROR_ILLEGAL_INPUT,
"at least \"order + 1\" data points are needed as input");
@@ -1041,17 +1062,25 @@ double *polynomial_irreg_irreg(
}
yout = vector(nout);
- polydim = order + 1;
- for (ix=0; ix<nout; ix++) {
- x = xo[ix];
- cx = nin/2;
- hunt_for_index(xi, nin, x, &cx);
- cx = imin( imax(cx-(polydim-1)/2,0), nin-polydim);
- yout[ix] = polynomial_interpolation(&xi[cx], &yi[cx], polydim, x, &error);
+ if (order > 0) {
+ polydim = order + 1;
+ for (ix=0; ix<nout; ix++) {
+ x = xo[ix];
+ cx = nin/2;
+ if (hunt_for_index(xi, nin, x, &cx)) {
+ cx = imin( imax(cx-(polydim-1)/2,0), nin-polydim);
+ yout[ix] = polynomial_interpolation(&xi[cx], &yi[cx], polydim, x, &error);
+ } else {
+ yout[ix] = NAN;
+ }
+ }
+ } else {
+ for (ix=0; ix<nout; ix++) {
+ yout[ix] = NAN;
+ }
}
return yout;
-
}
double *polynomial_irreg_irreg_nonans(
@@ -1134,7 +1163,7 @@ double polynomial_interpolation (double xi[], double yi[], int n,
@param jlo xxx
@return xxx
*/
-void hunt_for_index(double xx[], unsigned long n, double x, unsigned int *jlo)
+int hunt_for_index(double xx[], unsigned long n, double x, unsigned int *jlo)
{
unsigned long jm = 0, jhi = 0, inc = 0;
int ascnd = 0;
@@ -1146,7 +1175,7 @@ void hunt_for_index(double xx[], unsigned long n, double x, unsigned int *jlo)
} else {
inc=1;
if ((x >= xx[*jlo]) == ascnd) {
- if (*jlo == (n-1)) return;
+ if (*jlo == (n-1)) return TRUE;
jhi=(*jlo)+1;
while ((x >= xx[jhi]) == ascnd) {
*jlo=jhi;
@@ -1160,7 +1189,7 @@ void hunt_for_index(double xx[], unsigned long n, double x, unsigned int *jlo)
} else {
if (*jlo == 0) {
*jlo=0;
- return;
+ return TRUE;
}
jhi=(*jlo)--;
while ((x < xx[*jlo]) == ascnd) {
@@ -1175,12 +1204,16 @@ void hunt_for_index(double xx[], unsigned long n, double x, unsigned int *jlo)
}
}
while (jhi-(*jlo) != 1) {
+ if ((jhi == 0) && (jhi == *jlo) && (jhi == jm)) {
+ return FALSE;
+ }
jm=(jhi+(*jlo)) >> 1;
if ((x > xx[jm]) == ascnd)
*jlo=jm;
else
jhi=jm;
}
+ return TRUE;
}
/*erwdoc*/
@@ -1190,7 +1223,7 @@ void hunt_for_index(double xx[], unsigned long n, double x, unsigned int *jlo)
@return xxx
*/
double *vector(int n) {
- return (double *) cpl_malloc((size_t) ((n)*sizeof(double)));
+ return (double *) cpl_calloc((size_t)n, (size_t)sizeof(double));
}
/*erwdoc*/
@@ -1200,7 +1233,7 @@ double *vector(int n) {
@return xxx
*/
double **blank_matrix(int nrow) {
- double ** matrix = (double **) cpl_malloc((size_t)((nrow)*sizeof(double*)));
+ double ** matrix = (double **) cpl_calloc((size_t)nrow, (size_t)sizeof(double*));
return matrix;
}
diff --git a/kmclipm/src/kmclipm_vector.c b/kmclipm/src/kmclipm_vector.c
index a018602..39786b6 100644
--- a/kmclipm/src/kmclipm_vector.c
+++ b/kmclipm/src/kmclipm_vector.c
@@ -2,7 +2,7 @@
/*********************************************************************
* E.S.O. - VLT project
*
- * "@(#) $Id: kmclipm_vector.c,v 1.12 2013/07/31 10:35:34 aagudo Exp $"
+ * "@(#) $Id: kmclipm_vector.c,v 1.12 2013-07-31 10:35:34 aagudo Exp $"
*
* Functions that are implemented as recipes. They are also useedd in KMOS
* data reduction pipeline.
diff --git a/kmos/kmo_constants.h b/kmos/kmo_constants.h
index dfa0ea6..e79607b 100644
--- a/kmos/kmo_constants.h
+++ b/kmos/kmo_constants.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_constants.h,v 1.4 2013/01/11 15:06:26 aagudo Exp $
+/* $Id: kmo_constants.h,v 1.5 2013-09-12 14:37:53 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/01/11 15:06:26 $
- * $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-09-12 14:37:53 $
+ * $Revision: 1.5 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_CONSTANTS_H
@@ -165,6 +165,8 @@
#define NR_BANDS 5
#define BANDS "H","K","HK","IZ","YJ"
+#define IFUS_USER_DEFINED "user_defined_IFUs"
+
/** @} */
#endif /* KMO_CONSTANTS_H */
diff --git a/kmos/kmo_cpl_extensions.c b/kmos/kmo_cpl_extensions.c
index c9fad48..ad1bd3d 100644
--- a/kmos/kmo_cpl_extensions.c
+++ b/kmos/kmo_cpl_extensions.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_cpl_extensions.c,v 1.8 2013/06/17 07:52:26 aagudo Exp $
+/* $Id: kmo_cpl_extensions.c,v 1.8 2013-06-17 07:52:26 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 07:52:26 $
+ * $Date: 2013-06-17 07:52:26 $
* $Revision: 1.8 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/kmo_cpl_extensions.h b/kmos/kmo_cpl_extensions.h
index 2a955f3..704652c 100644
--- a/kmos/kmo_cpl_extensions.h
+++ b/kmos/kmo_cpl_extensions.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_cpl_extensions.h,v 1.4 2013/03/27 10:58:56 aagudo Exp $
+/* $Id: kmo_cpl_extensions.h,v 1.4 2013-03-27 10:58:56 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/03/27 10:58:56 $
+ * $Date: 2013-03-27 10:58:56 $
* $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_CPL_EXTENSIONS_H
diff --git a/kmos/kmo_debug.c b/kmos/kmo_debug.c
index 624af89..2a98abc 100644
--- a/kmos/kmo_debug.c
+++ b/kmos/kmo_debug.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_debug.c,v 1.5 2013/06/17 07:52:26 aagudo Exp $
+/* $Id: kmo_debug.c,v 1.5 2013-06-17 07:52:26 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 07:52:26 $
+ * $Date: 2013-06-17 07:52:26 $
* $Revision: 1.5 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/kmo_debug.h b/kmos/kmo_debug.h
index 65f83c4..de09d50 100644
--- a/kmos/kmo_debug.h
+++ b/kmos/kmo_debug.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_debug.h,v 1.5 2013/07/04 08:07:34 aagudo Exp $
+/* $Id: kmo_debug.h,v 1.5 2013-07-04 08:07:34 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/07/04 08:07:34 $
+ * $Date: 2013-07-04 08:07:34 $
* $Revision: 1.5 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_DEBUG_H
diff --git a/kmos/kmo_dfs.c b/kmos/kmo_dfs.c
index fe97c2f..9fce773 100644
--- a/kmos/kmo_dfs.c
+++ b/kmos/kmo_dfs.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_dfs.c,v 1.44 2013/07/31 10:37:18 aagudo Exp $
+/* $Id: kmo_dfs.c,v 1.48 2013/10/21 13:44:53 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/07/31 10:37:18 $
- * $Revision: 1.44 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013/10/21 13:44:53 $
+ * $Revision: 1.48 $
+ * $Name: $
*/
#ifdef HAVE_CONFIG_H
@@ -56,6 +56,10 @@
int override_err_msg = FALSE;
int print_cal_angle_msg_once = TRUE;
int print_xcal_angle_msg_once = TRUE;
+int cal_load_had_xcal = FALSE;
+int cal_load_had_ycal = FALSE;
+double cal_load_first_angle = -1.0;
+double cal_load_second_angle = -1.0;
//int sat_mode_msg = FALSE;
//int sat_mode_last_device_nr = -1;
@@ -82,6 +86,29 @@ const char *strlower(char *s)
/**
@brief
+ Remove problematic characters from string
+
+ @param str The string to clean
+*/
+void kmo_clean_string(char *str)
+{
+ char *s = NULL,
+ *d = NULL;
+
+ for (s=d=str; (*d=*s); d+=(*s++!='['));
+ for (s=d=str; (*d=*s); d+=(*s++!=']'));
+// for (s=d=str; (*d=*s); d+=(*s++!='{'));
+// for (s=d=str; (*d=*s); d+=(*s++!='}'));
+// for (s=d=str; (*d=*s); d+=(*s++!=':'));
+// for (s=d=str; (*d=*s); d+=(*s++!=';'));
+// for (s=d=str; (*d=*s); d+=(*s++!='*'));
+// for (s=d=str; (*d=*s); d+=(*s++!='/'));
+// for (s=d=str; (*d=*s); d+=(*s++!='|'));
+// for (s=d=str; (*d=*s); d+=(*s++!='\\'));
+}
+
+/**
+ @brief
Fetching a frame of a certain category or of a certain position.
@param frameset The input set-of-frames
@@ -811,6 +838,7 @@ cpl_image* kmo_dfs_load_cal_image_frame(cpl_frame *frame,
itmp = 0,
ix = 0,
iy = 0;
+ const char *tag = NULL;
KMO_TRY
{
@@ -822,15 +850,27 @@ cpl_image* kmo_dfs_load_cal_image_frame(cpl_frame *frame,
CPL_ERROR_ILLEGAL_INPUT,
"device number is negative!");
+ KMO_TRY_EXIT_IF_NULL(
+ tag = cpl_frame_get_tag(frame));
+
+ if (strcmp(tag, XCAL) == 0) {
+ cal_load_had_xcal = TRUE;
+ }
+ if (strcmp(tag, YCAL) == 0) {
+ cal_load_had_ycal = TRUE;
+ }
+
if (!override_err_msg) {
KMO_TRY_EXIT_IF_NULL(
img = kmclipm_cal_image_load(cpl_frame_get_filename(frame),
CPL_TYPE_FLOAT, 0, device, noise,
angle, angle_found, &secondClosestAngle));
+ cal_load_first_angle = *angle_found;
} else {
img = kmclipm_cal_image_load(cpl_frame_get_filename(frame),
CPL_TYPE_FLOAT, 0, device, noise,
angle, angle_found, &secondClosestAngle);
+ cal_load_first_angle = *angle_found;
cpl_error_reset();
}
@@ -857,6 +897,8 @@ cpl_image* kmo_dfs_load_cal_image_frame(cpl_frame *frame,
ifu_nr = -1;
} else {
// apply xcal-interpolation
+ cal_load_second_angle = secondClosestAngle;
+
if (!override_err_msg) {
KMO_TRY_EXIT_IF_NULL(
img2 = kmclipm_cal_image_load(cpl_frame_get_filename(frame),
@@ -939,25 +981,35 @@ cpl_image* kmo_dfs_load_cal_image_frame(cpl_frame *frame,
} // end if delta_angle > 35 deg
} // end if (ifu_nr > 0)
- if (ifu_nr > 0) {
- if (print_xcal_angle_msg_once) {
- cpl_msg_info("", "Loaded XCAL frame with interpolated angles between %ddeg and %ddeg (input: %ddeg)",
- (int)(*angle_found), (int)secondClosestAngle, (int)angle);
- print_xcal_angle_msg_once = FALSE;
- }
- } else {
- if (print_cal_angle_msg_once) {
- if (kmclipm_diff_angle(*angle_found, angle) > 35.) { // 30deg is in fact max.diff
- cpl_msg_warning("","************************************************************");
- cpl_msg_warning("","* Input angle and closest calibration angle differ more *");
- cpl_msg_warning("","* than 35deg (%d and %d)! *", (int)angle, (int)(*angle_found));
- cpl_msg_warning("","* *");
- cpl_msg_warning("","* Please consider using better suited calibration frames! *");
- cpl_msg_warning("","************************************************************");
+ if (cal_load_had_xcal && cal_load_had_ycal) {
+ if (cal_load_second_angle > 0) {
+ if (print_xcal_angle_msg_once) {
+ if (cal_load_second_angle < cal_load_first_angle) {
+ double ttt = cal_load_second_angle;
+ cal_load_second_angle = cal_load_first_angle;
+ cal_load_first_angle = ttt;
+ }
+ cpl_msg_info("", "Loaded calibration frames with interpolated angles between %ddeg and %ddeg (input: %ddeg)",
+ (int)cal_load_first_angle, (int)cal_load_second_angle, (int)angle);
+ print_xcal_angle_msg_once = FALSE;
+ }
+ } else {
+ if (print_cal_angle_msg_once) {
+ if (kmclipm_diff_angle(*angle_found, angle) > 35.) { // 30deg is in fact max.diff
+ cpl_msg_warning("","************************************************************");
+ cpl_msg_warning("","* Input angle and closest calibration angle differ more *");
+ cpl_msg_warning("","* than 35deg (%d and %d)! *", (int)angle, (int)rint(*angle_found));
+ cpl_msg_warning("","* *");
+ cpl_msg_warning("","* Please consider using better suited calibration frames! *");
+ cpl_msg_warning("","************************************************************");
+ }
+ print_cal_angle_msg_once = FALSE;
+ }
+ if (print_xcal_angle_msg_once) {
+ cpl_msg_info("", "Loading all calibration frames with angle %ddeg (input: %ddeg)",
+ (int)rint(*angle_found), (int)angle);
+ print_xcal_angle_msg_once = FALSE;
}
- cpl_msg_info("", "Loading all calibration frames with angle %ddeg (input: %ddeg)",
- (int)(*angle_found), (int)angle);
- print_cal_angle_msg_once = FALSE;
}
}
}
@@ -1391,15 +1443,12 @@ char* kmo_dfs_get_suffix(const cpl_frame *frame,
Saving a propertylist as (empty) header.
@param frameset The input set-of-frames (to be upgraded)
- @param category The category of the image to save (is also name of file)
+ @param filename The filename of the image to save
@param suffix The filter/grating-suffix to append to filename.
@param frame The frame to inherit the header from.
- @param extend TRUE if propertylist goes to the primary header,
- FALSE if it goes to a subheader
- @param parlist The recipe parameter list
+ @param header Heaqder to append
+ @param parlist The parlist
@param recipename The name of the recipe
- @param version The version of the pipeline
- @param path The path, where the file should be stored
@return CPL_ERROR_NONE in case of success.
@@ -1410,7 +1459,7 @@ char* kmo_dfs_get_suffix(const cpl_frame *frame,
look to the main recipe code.
The output file name will be derived from the specified
- category by lowercasing it and by appending the suffix ".fits".
+ filename by lowercasing it and by appending the suffix ".fits".
The new image is properly logged in the input set-of-frames
in case of success.
@@ -1421,30 +1470,37 @@ char* kmo_dfs_get_suffix(const cpl_frame *frame,
where the failure occurred is also reported.
*/
cpl_error_code kmo_dfs_save_main_header(cpl_frameset *frameset,
- const char *category,
+ const char *filename,
const char *suffix,
const cpl_frame *frame,
const cpl_propertylist *header,
const cpl_parameterlist *parlist,
const char *recipename)
{
- char *filename = NULL;
- cpl_error_code ret_error = CPL_ERROR_NONE;
- cpl_propertylist *tmp_header = NULL;
+ char *filenameAll = NULL,
+ *clean_suffix = NULL;
+ cpl_error_code ret_error = CPL_ERROR_NONE;
+ cpl_propertylist *tmp_header = NULL;
KMO_TRY
{
KMO_TRY_ASSURE((frameset != NULL) &&
- (category != NULL) &&
+ (filename != NULL) &&
(suffix != NULL) &&
(parlist != NULL) &&
(recipename != NULL),
CPL_ERROR_NULL_INPUT,
"Not all input data is provided!");
+ // remove unwanted characters from suffix
+ KMO_TRY_EXIT_IF_NULL(
+ clean_suffix = cpl_sprintf("%s", suffix));
+
+ kmo_clean_string(clean_suffix);
+
// setup path
KMO_TRY_EXIT_IF_NULL(
- filename = kmo_dfs_create_filename("", category, suffix));
+ filenameAll = kmo_dfs_create_filename("", filename, clean_suffix));
// add PRO.CATG keyword
if (header == NULL) {
@@ -1457,7 +1513,7 @@ cpl_error_code kmo_dfs_save_main_header(cpl_frameset *frameset,
KMO_TRY_EXIT_IF_ERROR(
cpl_propertylist_update_string(tmp_header, CPL_DFS_PRO_CATG,
- category));
+ filename));
KMO_TRY_EXIT_IF_ERROR(
cpl_propertylist_update_string(tmp_header, INSTRUMENT,
@@ -1473,7 +1529,7 @@ cpl_error_code kmo_dfs_save_main_header(cpl_frameset *frameset,
tmp_header,
NULL,
VERSION,
- filename));
+ filenameAll));
cpl_propertylist_delete(tmp_header); tmp_header = NULL;
}
@@ -1483,7 +1539,8 @@ cpl_error_code kmo_dfs_save_main_header(cpl_frameset *frameset,
ret_error = cpl_error_get_code();
}
- cpl_free(filename); filename = NULL;
+ cpl_free(filenameAll); filenameAll = NULL;
+ cpl_free(clean_suffix); clean_suffix = NULL;
return ret_error;
}
@@ -1519,8 +1576,9 @@ cpl_error_code kmo_dfs_save_sub_header(const char *category,
const char *suffix,
const cpl_propertylist *header)
{
- char *filename = NULL;
- cpl_error_code ret_error = CPL_ERROR_NONE;
+ char *filename = NULL,
+ *clean_suffix = NULL;
+ cpl_error_code ret_error = CPL_ERROR_NONE;
KMO_TRY
{
@@ -1530,9 +1588,15 @@ cpl_error_code kmo_dfs_save_sub_header(const char *category,
CPL_ERROR_NULL_INPUT,
"Not all input data is provided!");
+ // remove unwanted characters from suffix
+ KMO_TRY_EXIT_IF_NULL(
+ clean_suffix = cpl_sprintf("%s", suffix));
+
+ kmo_clean_string(clean_suffix);
+
// setup path
KMO_TRY_EXIT_IF_NULL(
- filename = kmo_dfs_create_filename("", category, suffix));
+ filename = kmo_dfs_create_filename("", category, clean_suffix));
KMO_TRY_EXIT_IF_ERROR(
cpl_propertylist_save(header, filename, CPL_IO_EXTEND));
@@ -1544,6 +1608,7 @@ cpl_error_code kmo_dfs_save_sub_header(const char *category,
}
cpl_free(filename); filename = NULL;
+ cpl_free(clean_suffix); clean_suffix = NULL;
return ret_error;
}
@@ -1587,8 +1652,9 @@ cpl_error_code kmo_dfs_save_vector(kmclipm_vector *vec,
cpl_propertylist *header,
double rej_val)
{
- char *filename = NULL;
- cpl_error_code ret_error = CPL_ERROR_NONE;
+ char *filename = NULL,
+ *clean_suffix = NULL;
+ cpl_error_code ret_error = CPL_ERROR_NONE;
KMO_TRY
{
@@ -1597,9 +1663,15 @@ cpl_error_code kmo_dfs_save_vector(kmclipm_vector *vec,
CPL_ERROR_NULL_INPUT,
"Not all input data is provided!");
+ // remove unwanted characters from suffix
+ KMO_TRY_EXIT_IF_NULL(
+ clean_suffix = cpl_sprintf("%s", suffix));
+
+ kmo_clean_string(clean_suffix);
+
// setup path
KMO_TRY_EXIT_IF_NULL(
- filename = kmo_dfs_create_filename("", category, suffix));
+ filename = kmo_dfs_create_filename("", category, clean_suffix));
// save either subsequent empty header or data (CPL_IO_EXTEND)
if (vec == NULL) {
@@ -1620,6 +1692,7 @@ cpl_error_code kmo_dfs_save_vector(kmclipm_vector *vec,
}
cpl_free(filename); filename = NULL;
+ cpl_free(clean_suffix); clean_suffix = NULL;
return ret_error;
}
@@ -1663,8 +1736,9 @@ cpl_error_code kmo_dfs_save_image(cpl_image *image,
cpl_propertylist *header,
double rej_val)
{
- char *filename = NULL;
- cpl_error_code ret_error = CPL_ERROR_NONE;
+ char *filename = NULL,
+ *clean_suffix = NULL;
+ cpl_error_code ret_error = CPL_ERROR_NONE;
KMO_TRY
{
@@ -1673,9 +1747,15 @@ cpl_error_code kmo_dfs_save_image(cpl_image *image,
CPL_ERROR_NULL_INPUT,
"Not all input data is provided!");
+ // remove unwanted characters from suffix
+ KMO_TRY_EXIT_IF_NULL(
+ clean_suffix = cpl_sprintf("%s", suffix));
+
+ kmo_clean_string(clean_suffix);
+
// setup path
KMO_TRY_EXIT_IF_NULL(
- filename = kmo_dfs_create_filename("", category, suffix));
+ filename = kmo_dfs_create_filename("", category, clean_suffix));
// save either subsequent empty header or data (CPL_IO_EXTEND)
if (image == NULL) {
@@ -1696,6 +1776,7 @@ cpl_error_code kmo_dfs_save_image(cpl_image *image,
}
cpl_free(filename); filename = NULL;
+ cpl_free(clean_suffix); clean_suffix = NULL;
return ret_error;
}
@@ -1739,8 +1820,9 @@ cpl_error_code kmo_dfs_save_cube(cpl_imagelist *imglist,
cpl_propertylist *header,
double rej_val)
{
- char *filename = NULL;
- cpl_error_code ret_error = CPL_ERROR_NONE;
+ char *filename = NULL,
+ *clean_suffix = NULL;
+ cpl_error_code ret_error = CPL_ERROR_NONE;
KMO_TRY
{
@@ -1749,9 +1831,15 @@ cpl_error_code kmo_dfs_save_cube(cpl_imagelist *imglist,
CPL_ERROR_NULL_INPUT,
"Not all input data is provided!");
+ // remove unwanted characters from suffix
+ KMO_TRY_EXIT_IF_NULL(
+ clean_suffix = cpl_sprintf("%s", suffix));
+
+ kmo_clean_string(clean_suffix);
+
// setup path
KMO_TRY_EXIT_IF_NULL(
- filename = kmo_dfs_create_filename("", category, suffix));
+ filename = kmo_dfs_create_filename("", category, clean_suffix));
// save either subsequent empty header or data (CPL_IO_EXTEND)
if (imglist == NULL) {
@@ -1772,6 +1860,7 @@ cpl_error_code kmo_dfs_save_cube(cpl_imagelist *imglist,
}
cpl_free(filename); filename = NULL;
+ cpl_free(clean_suffix); clean_suffix = NULL;
return ret_error;
}
@@ -1811,8 +1900,9 @@ cpl_error_code kmo_dfs_save_table(cpl_table *table,
const char *suffix,
cpl_propertylist *header)
{
- char *filename = NULL;
- cpl_error_code ret_error = CPL_ERROR_NONE;
+ char *filename = NULL,
+ *clean_suffix = NULL;
+ cpl_error_code ret_error = CPL_ERROR_NONE;
KMO_TRY
{
@@ -1821,9 +1911,15 @@ cpl_error_code kmo_dfs_save_table(cpl_table *table,
CPL_ERROR_NULL_INPUT,
"Not all input data is provided!");
+ // remove unwanted characters from suffix
+ KMO_TRY_EXIT_IF_NULL(
+ clean_suffix = cpl_sprintf("%s", suffix));
+
+ kmo_clean_string(clean_suffix);
+
// setup path
KMO_TRY_EXIT_IF_NULL(
- filename = kmo_dfs_create_filename("", category, suffix));
+ filename = kmo_dfs_create_filename("", category, clean_suffix));
// save either subsequent empty header or data (CPL_IO_EXTEND)
if (table == NULL) {
@@ -1843,6 +1939,7 @@ cpl_error_code kmo_dfs_save_table(cpl_table *table,
}
cpl_free(filename); filename = NULL;
+ cpl_free(clean_suffix); clean_suffix = NULL;
return ret_error;
}
@@ -2306,6 +2403,11 @@ cpl_error_code kmo_extname_extractor(const char *extname,
KMO_TRY_EXIT_IF_NULL(
split_values = kmo_strsplit(extname, ".", &size));
+ if (strcmp(split_values[0], "LIST_IFU") == 0) {
+ strcpy(split_values[0], EXT_LIST);
+ size = 1;
+ }
+
// Extract
switch (size) {
case 1:
@@ -3241,6 +3343,7 @@ int kmo_dfs_set_groups(cpl_frameset *frameset, const char *recipe_name)
!strcmp(tag, REF_LINES) ||
!strcmp(tag, MASTER_DARK) ||
!strcmp(tag, ILLUM_CORR) ||
+ !strcmp(tag, ILLUM_CORR_FLAT) ||
!strcmp(tag, SOLAR_SPEC) ||
!strcmp(tag, ATMOS_MODEL) ||
!strcmp(tag, SPEC_TYPE_LOOKUP) ||
diff --git a/kmos/kmo_dfs.h b/kmos/kmo_dfs.h
index a3a2f7e..4745efd 100644
--- a/kmos/kmo_dfs.h
+++ b/kmos/kmo_dfs.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_dfs.h,v 1.33 2013/07/31 10:37:18 aagudo Exp $
+/* $Id: kmo_dfs.h,v 1.35 2013/10/21 13:44:54 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/07/31 10:37:18 $
- * $Revision: 1.33 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013/10/21 13:44:54 $
+ * $Revision: 1.35 $
+ * $Name: $
*/
#ifndef KMOS_DFS_H
@@ -85,6 +85,9 @@
#define FLAT_SKY "FLAT_SKY" // RAW
#define ILLUM_CORR "ILLUM_CORR" // CALIB
#define SKYFLAT_EDGE "SKYFLAT_EDGE" // CALIB
+// kmo_illumination_flat
+#define FLAT_SKY_FLAT "FLAT_SKY_FLAT" // RAW
+#define ILLUM_CORR_FLAT "ILLUM_CORR" // CALIB
// kmo_std_star
#define STD "STD" // RAW
#define ATMOS_MODEL "ATMOS_MODEL" // CALIB
@@ -253,17 +256,24 @@
extern int override_err_msg;
extern int print_cal_angle_msg_once;
extern int print_xcal_angle_msg_once;
+extern int cal_load_had_xcal;
+extern int cal_load_had_ycal;
+extern double cal_load_first_angle;
+extern double cal_load_second_angle;
+
//extern int sat_mode_msg;
//extern int sat_mode_last_device_nr;
-const char *strlower(char *s);
+const char* strlower(char *s);
+
+void kmo_clean_string(char *str);
-cpl_error_code kmo_extname_extractor(const char *extname,
+cpl_error_code kmo_extname_extractor(const char *extname,
enum kmo_frame_type *type,
int *id,
char *content);
-char* kmo_extname_creator(enum kmo_frame_type type,
+char* kmo_extname_creator(enum kmo_frame_type type,
int device_nr,
const char *content);
diff --git a/kmos/kmo_error.h b/kmos/kmo_error.h
index e7fd03e..d2924e6 100644
--- a/kmos/kmo_error.h
+++ b/kmos/kmo_error.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_error.h,v 1.1.1.1 2012/01/18 09:31:59 yjung Exp $
+/* $Id: kmo_error.h,v 1.1.1.1 2012-01-18 09:31:59 yjung Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2012/01/18 09:31:59 $
+ * $Date: 2012-01-18 09:31:59 $
* $Revision: 1.1.1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
/**
diff --git a/kmos/kmo_functions.c b/kmos/kmo_functions.c
index e290d8d..0cf953e 100644
--- a/kmos/kmo_functions.c
+++ b/kmos/kmo_functions.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_functions.c,v 1.34 2013/08/07 14:38:08 aagudo Exp $
+/* $Id: kmo_functions.c,v 1.41 2013-10-09 12:16:10 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/07 14:38:08 $
- * $Revision: 1.34 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-09 12:16:10 $
+ * $Revision: 1.41 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -52,6 +52,7 @@
#include <cpl.h>
#include "kmclipm_constants.h"
#include "kmclipm_vector.h"
+#include "kmclipm_priv_reconstruct.h"
#include <kmo_constants.h>
#include <kmo_error.h>
@@ -112,12 +113,13 @@ int compareObjSkyFrameTableStructs (const void *a, const void *b)
int getIndexObjSkyStruct(const objSkyStruct *obj_sky_struct, const char *strToFind) {
int i = 0;
- while (TRUE) {
+ while (TRUE && (i < obj_sky_struct->sizeIndexStruct)) {
if (strcmp(obj_sky_struct->indexStruct[i].filename, strToFind) == 0) {
return obj_sky_struct->indexStruct[i].index;
}
i++;
}
+ return -1;
}
/**
@@ -128,12 +130,10 @@ int getIndexObjSkyStruct(const objSkyStruct *obj_sky_struct, const char *strToFi
@param objSkyStruct The objSkyStruct to print
*/
-void kmo_debug_objSkyStruct(cpl_frameset *frameset,
- const objSkyStruct *obj_sky_struct)
+void kmo_print_objSkyStruct(const objSkyStruct *obj_sky_struct)
{
int i = 0,
- s = 0,
- nr_tags = 0;
+ s = 0;
const char *objFilename = NULL,
*skyFilename = NULL,
*tag = NULL,
@@ -159,28 +159,28 @@ void kmo_debug_objSkyStruct(cpl_frameset *frameset,
KMO_TRY_EXIT_IF_NULL(
tag = cpl_frame_get_tag(obj_sky_struct->table[0].objFrame));
- nr_tags = cpl_frameset_count_tags(frameset, tag);
- cpl_msg_debug("", "----------------------------------------------------------------------------------");
- cpl_msg_debug("", "Frames tagged as: %s", tag);
- cpl_msg_debug("", " ");
- cpl_msg_debug("", "index: filename:");
+ cpl_msg_info("", "-----------------------------------------------------------------------------------");
+ cpl_msg_info("", "Object/sky associations of frames tagged as: %s", tag);
+ cpl_msg_info("", " ");
+ cpl_msg_info("", "index: filename:");
- for (i = 0; i < nr_tags; i++) {
- cpl_msg_debug("", "%3d: %s", indexStruct[i].index, indexStruct[i].filename);
+ for (i = 0; i < obj_sky_struct->sizeIndexStruct; i++) {
+ cpl_msg_info("", "#%3d: %s", indexStruct[i].index, indexStruct[i].filename);
}
- cpl_msg_debug("", "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ");
- cpl_msg_debug("", "IFU # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24");
- cpl_msg_debug("", " ----------------------------------------------------------------------");
+ cpl_msg_info("", "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -");
+ cpl_msg_info("", "IFU 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24");
+ cpl_msg_info("", " ----------------------------------------------------------------------");
for (i = 0; i < obj_sky_struct->size; i++) {
- sprintf(outStrType, " type: ");
- sprintf(outStrFileId, " file ID:");
+// sprintf(outStrType, " type: ");
+ sprintf(outStrType, " type:");
+ sprintf(outStrFileId, " sky in #:");
if (obj_sky_table[i].objFrame != NULL) {
KMO_TRY_EXIT_IF_NULL(
objFilename = cpl_frame_get_filename(obj_sky_table[i].objFrame));
KMO_TRY_EXIT_IF_NULL(
pl = kmclipm_propertylist_load(objFilename, 0));
- cpl_msg_debug("", "Obj (#%2d): %s", getIndexObjSkyStruct(obj_sky_struct, objFilename), objFilename);
+ cpl_msg_info("", "frame #%3d: %s", getIndexObjSkyStruct(obj_sky_struct, objFilename), objFilename);
for (s = 0; s < KMOS_NR_IFUS; s++) {
// get associated File ID
@@ -207,12 +207,12 @@ void kmo_debug_objSkyStruct(cpl_frameset *frameset,
strcat(outStrType, tmpStr);
}
- cpl_msg_debug("", "%s", outStrType);
- cpl_msg_debug("", "%s", outStrFileId);
+ cpl_msg_info("", "%s", outStrType);
+ cpl_msg_info("", "%s", outStrFileId);
cpl_propertylist_delete(pl); pl = NULL;
}
}
- cpl_msg_debug("", "----------------------------------------------------------------------------------");
+ cpl_msg_info("", "-----------------------------------------------------------------------------------");
}
KMO_CATCH
{
@@ -246,8 +246,7 @@ objSkyStruct* kmo_create_objSkyStruct(cpl_frameset *frameset,
atLeastOneObjectFound = 0,
nr_tags = 0,
i = 0,
- ifu_nr = 0/*,
- det_nr = 0*/;
+ ifu_nr = 0;
char *subseconds = NULL,
*keywordType = NULL;
const char *timestamp = NULL,
@@ -285,7 +284,8 @@ objSkyStruct* kmo_create_objSkyStruct(cpl_frameset *frameset,
"No frames of category %s found!",frameType);
// initialize time structure variables like local time zone
- mktime(&tm);
+ timegm(&tm); // replaced mktime() with timegm() because of daylight-saving
+ // issue resulting in wrong sorting!
KMO_TRY_EXIT_IF_NULL(
tmpFrameTable = cpl_calloc(frameCnt, sizeof(tmpFrameTableStruct)));
@@ -314,16 +314,14 @@ objSkyStruct* kmo_create_objSkyStruct(cpl_frameset *frameset,
"can't interpret DATE-OBS fits keyword in "
"%s input frame", frameType);
- ts = mktime(&tm);
-// ts = 1000000 * mktime(&tm);
-// ts = ts + 100 * atoi(subseconds);
+ ts = timegm(&tm); // replaced mktime() with timegm() because of daylight-saving
+ // issue resulting in wrong sorting!
tmpFrameTable[cnt].ts =ts;
tmpFrameTable[cnt].frame = frame;
atLeastOneObjectFound = 0;
for (ix = 0; ix < KMOS_NR_IFUS; ix++) {
ifu_nr = ix+1;
-// det_nr = (ifu_nr - 1)/KMOS_IFUS_PER_DETECTOR + 1;
KMO_TRY_EXIT_IF_NULL(
keywordType = cpl_sprintf("%s%d%s",
@@ -437,6 +435,7 @@ objSkyStruct* kmo_create_objSkyStruct(cpl_frameset *frameset,
KMO_TRY_EXIT_IF_NULL(
obj_sky_struct->indexStruct = (objSkyIndexStruct*)cpl_calloc(nr_tags, sizeof(objSkyIndexStruct)));
+ obj_sky_struct->sizeIndexStruct = nr_tags;
KMO_TRY_EXIT_IF_NULL(
frame = cpl_frameset_find(frameset, tag));
@@ -543,7 +542,7 @@ void kmo_delete_objSkyStruct(objSkyStruct *obj_sky_struct)
@param armNameStruct The armNameStruct to print
*/
-void kmo_debug_armNameStruct(cpl_frameset *frameset, armNameStruct *arm_name_struct)
+void kmo_print_armNameStruct(cpl_frameset *frameset, armNameStruct *arm_name_struct)
{
int ix = 0,
iy = 0,
@@ -560,43 +559,50 @@ void kmo_debug_armNameStruct(cpl_frameset *frameset, armNameStruct *arm_name_str
has_telluric = cpl_frameset_count_tags(frameset, TELLURIC);
- kmo_debug_objSkyStruct(frameset, arm_name_struct->obj_sky_struct);
+ kmo_print_objSkyStruct(arm_name_struct->obj_sky_struct);
- cpl_msg_debug("", "IFU-arm names to process");
- cpl_msg_debug("", " ");
- cpl_msg_debug("", "index: object names assigned to arms");
+ cpl_msg_info("", "Object ID/IFU associations to process");
+ cpl_msg_info("", " ");
+ cpl_msg_info("", "index: object IDs assigned to arms");
for (iy = 0; iy < arm_name_struct->nrNames; iy++) {
if (has_telluric) {
- cpl_msg_debug("", "%3d: %s (%d occurences with %d telluric hits)",
- iy+1, arm_name_struct->names[iy], arm_name_struct->namesCnt[iy], arm_name_struct->telluricCnt[iy]);
+ char *my_bool = NULL;
+ if (arm_name_struct->sameTelluric[iy] > 0) {
+ my_bool = cpl_sprintf("TRUE");
+ } else {
+ my_bool = cpl_sprintf("FALSE");
+ }
+ cpl_msg_info("", "%3d: %s (%d occurences with %d telluric hits on same telluric-IFU: %s)",
+ iy+1, arm_name_struct->names[iy], arm_name_struct->namesCnt[iy], arm_name_struct->telluricCnt[iy], my_bool);
+ cpl_free(my_bool); my_bool = NULL;
} else {
- cpl_msg_debug("", "%3d: %s (%d occurences)",
+ cpl_msg_info("", "%3d: %s (%d occurences)",
iy+1, arm_name_struct->names[iy], arm_name_struct->namesCnt[iy]);
}
}
- cpl_msg_debug("", "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ");
- cpl_msg_debug("", "IFU # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24");
- cpl_msg_debug("", " ----------------------------------------------------------------------");
+ cpl_msg_info("", "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -");
+ cpl_msg_info("", "IFU 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24");
+ cpl_msg_info("", " ----------------------------------------------------------------------");
for (iy = 0; iy < arm_name_struct->size; iy++) {
if ((arm_name_struct->obj_sky_struct != NULL) &&
(arm_name_struct->obj_sky_struct->table != NULL) &&
(arm_name_struct->obj_sky_struct->table[iy].objFrame != NULL)) {
KMO_TRY_EXIT_IF_NULL(
objFilename = cpl_frame_get_filename(arm_name_struct->obj_sky_struct->table[iy].objFrame));
- cpl_msg_debug("", "Obj (#%2d): %s", getIndexObjSkyStruct(arm_name_struct->obj_sky_struct, objFilename), objFilename);
- sprintf(outStrNameID, " name ID:");
+ cpl_msg_info("", "frame #%3d: %s", getIndexObjSkyStruct(arm_name_struct->obj_sky_struct, objFilename), objFilename);
+ sprintf(outStrNameID, " name ID:");
for (ix = 0; ix < KMOS_NR_IFUS; ix++) {
- if (arm_name_struct->ifu_ids[ix+iy*KMOS_NR_IFUS] == 0) {
+ if (arm_name_struct->name_ids[ix+iy*KMOS_NR_IFUS] == 0) {
sprintf(tmpStr, " .");
} else {
- sprintf(tmpStr, "%3d", arm_name_struct->ifu_ids[ix+iy*KMOS_NR_IFUS]);
+ sprintf(tmpStr, "%3d", arm_name_struct->name_ids[ix+iy*KMOS_NR_IFUS]);
}
strcat(outStrNameID, tmpStr);
}
- cpl_msg_debug("", "%s", outStrNameID);
+ cpl_msg_info("", "%s", outStrNameID);
}
}
- cpl_msg_debug("", "----------------------------------------------------------------------------------");
+ cpl_msg_info("", "-----------------------------------------------------------------------------------");
}
KMO_CATCH
{
@@ -676,9 +682,11 @@ armNameStruct* kmo_create_armNameStruct(cpl_frameset *frameset,
KMO_TRY_EXIT_IF_NULL(
arm_name_struct->namesCnt = cpl_calloc(arm_name_struct->size*KMOS_NR_IFUS, sizeof(int)));
KMO_TRY_EXIT_IF_NULL(
- arm_name_struct->ifu_ids = cpl_calloc(arm_name_struct->size*KMOS_NR_IFUS, sizeof(int)));
+ arm_name_struct->name_ids = cpl_calloc(arm_name_struct->size*KMOS_NR_IFUS, sizeof(int)));
KMO_TRY_EXIT_IF_NULL(
arm_name_struct->telluricCnt = cpl_calloc(arm_name_struct->size*KMOS_NR_IFUS, sizeof(int)));
+ KMO_TRY_EXIT_IF_NULL(
+ arm_name_struct->sameTelluric = cpl_calloc(arm_name_struct->size*KMOS_NR_IFUS, sizeof(int)));
for (iy = 0; iy < arm_name_struct->size; iy++) {
KMO_TRY_EXIT_IF_NULL(
@@ -760,7 +768,7 @@ armNameStruct* kmo_create_armNameStruct(cpl_frameset *frameset,
if (ifus != NULL) {
if (cntArmName == 0) {
KMO_TRY_EXIT_IF_NULL(
- arm_name_struct->names[cntArmName++] = cpl_sprintf("IFUs are user defined"));
+ arm_name_struct->names[cntArmName++] = cpl_sprintf(IFUS_USER_DEFINED));
}
} else {
if (cntArmName == 0) {
@@ -768,16 +776,21 @@ armNameStruct* kmo_create_armNameStruct(cpl_frameset *frameset,
arm_name_struct->names[cntArmName++] = cpl_sprintf("%s", name));
}
}
- arm_name_struct->ifu_ids[user_defined_ifu-1 + iy*KMOS_NR_IFUS] = 1;
+ arm_name_struct->name_ids[user_defined_ifu-1 + iy*KMOS_NR_IFUS] = 1;
arm_name_struct->namesCnt[cntArmName-1]++;
if (has_telluric && (ifu_nr_telluric != -1)) {
arm_name_struct->telluricCnt[cntArmName-1]++;
+ if (arm_name_struct->sameTelluric[cntArmName-1] == 0) {
+ arm_name_struct->sameTelluric[cntArmName-1] = ifu_nr_telluric;
+ } else if (arm_name_struct->sameTelluric[cntArmName-1] != ifu_nr_telluric) {
+ arm_name_struct->sameTelluric[cntArmName-1] = -1;
+ }
}
}
} else {
// IFU is invalid
if (punused_ifus[(user_defined_ifu-1) % KMOS_IFUS_PER_DETECTOR] == 0) {
- punused_ifus[(user_defined_ifu-1) % KMOS_IFUS_PER_DETECTOR] = 2;
+// punused_ifus[(user_defined_ifu-1) % KMOS_IFUS_PER_DETECTOR] = 2;
}
}
}
@@ -843,17 +856,27 @@ armNameStruct* kmo_create_armNameStruct(cpl_frameset *frameset,
// add new object name
KMO_TRY_EXIT_IF_NULL(
arm_name_struct->names[cntArmName++] = cpl_sprintf("%s", tmpName));
- arm_name_struct->ifu_ids[ix + iy*KMOS_NR_IFUS] = cntArmName;
+ arm_name_struct->name_ids[ix + iy*KMOS_NR_IFUS] = cntArmName;
arm_name_struct->namesCnt[cntArmName-1]++;
if (has_telluric && (ifu_nr_telluric != -1)) {
arm_name_struct->telluricCnt[cntArmName-1]++;
+ if (arm_name_struct->sameTelluric[cntArmName-1] == 0) {
+ arm_name_struct->sameTelluric[cntArmName-1] = ifu_nr_telluric;
+ } else if (arm_name_struct->sameTelluric[cntArmName-1] != ifu_nr_telluric) {
+ arm_name_struct->sameTelluric[cntArmName-1] = -1;
+ }
}
} else {
// already existing object name, just set ID
- arm_name_struct->ifu_ids[ix + iy*KMOS_NR_IFUS] = i+1;
+ arm_name_struct->name_ids[ix + iy*KMOS_NR_IFUS] = i+1;
arm_name_struct->namesCnt[i]++;
if (has_telluric && (ifu_nr_telluric != -1)) {
arm_name_struct->telluricCnt[i]++;
+ if (arm_name_struct->sameTelluric[i] == 0) {
+ arm_name_struct->sameTelluric[i] = ifu_nr_telluric;
+ } else if (arm_name_struct->sameTelluric[i] != ifu_nr_telluric) {
+ arm_name_struct->sameTelluric[i] = -1;
+ }
}
}
}
@@ -863,23 +886,24 @@ armNameStruct* kmo_create_armNameStruct(cpl_frameset *frameset,
KMO_TRY_EXIT_IF_NULL(
arm_name_struct->names[cntArmName++] = cpl_sprintf("%s", mapping_mode));
}
- arm_name_struct->ifu_ids[ix + iy*KMOS_NR_IFUS] = cntArmName;
+ arm_name_struct->name_ids[ix + iy*KMOS_NR_IFUS] = cntArmName;
arm_name_struct->namesCnt[cntArmName-1]++;
if (has_telluric && (ifu_nr_telluric != -1)) {
arm_name_struct->telluricCnt[cntArmName-1]++;
+ arm_name_struct->sameTelluric[cntArmName-1] = -1;
}
}
}
} else {
// IFU is invalid
if (punused_ifus[(ifu_nr-1) % KMOS_IFUS_PER_DETECTOR] == 0) {
- punused_ifus[(ifu_nr-1) % KMOS_IFUS_PER_DETECTOR] = 2;
+// punused_ifus[(ifu_nr-1) % KMOS_IFUS_PER_DETECTOR] = 2;
}
}
} else {
// IFU is invalid
if (punused_ifus[(ifu_nr-1) % KMOS_IFUS_PER_DETECTOR] == 0) {
- punused_ifus[(ifu_nr-1) % KMOS_IFUS_PER_DETECTOR] = 2;
+// punused_ifus[(ifu_nr-1) % KMOS_IFUS_PER_DETECTOR] = 2;
}
}
cpl_free(keywordValid); keywordValid = NULL;
@@ -919,7 +943,8 @@ void kmo_delete_armNameStruct(armNameStruct *arm_name_struct)
cpl_free(arm_name_struct->names); arm_name_struct->names = NULL;
cpl_free(arm_name_struct->namesCnt); arm_name_struct->namesCnt = NULL;
cpl_free(arm_name_struct->telluricCnt); arm_name_struct->telluricCnt = NULL;
- cpl_free(arm_name_struct->ifu_ids); arm_name_struct->ifu_ids = NULL;
+ cpl_free(arm_name_struct->sameTelluric); arm_name_struct->sameTelluric = NULL;
+ cpl_free(arm_name_struct->name_ids); arm_name_struct->name_ids = NULL;
}
kmo_delete_objSkyStruct((objSkyStruct*)arm_name_struct->obj_sky_struct);
@@ -998,26 +1023,29 @@ cpl_array* kmo_get_timestamps(cpl_frame* xcalFrame,
return calTimestamp;
}
-cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
- int lowBound,
- int highBound,
- cpl_image *objDetImage_data,
- cpl_image *objDetImage_noise,
- cpl_image *skyDetImage_data,
- cpl_image *skyDetImage_noise,
- cpl_image *flatDetImage_data,
- cpl_image *flatDetImage_noise,
- cpl_image *xcalDetImage,
- cpl_image *ycalDetImage,
- cpl_image *lcalDetImage,
- gridDefinition *gd,
- cpl_array *calTimestamp,
- cpl_vector *calAngles,
- const char *lutFilename,
- cpl_imagelist **dataCube,
- cpl_imagelist **noiseCube,
- int flux,
- int background)
+cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
+ int lowBound,
+ int highBound,
+ cpl_image *objDetImage_data,
+ cpl_image *objDetImage_noise,
+ cpl_image *skyDetImage_data,
+ cpl_image *skyDetImage_noise,
+ cpl_image *flatDetImage_data,
+ cpl_image *flatDetImage_noise,
+ cpl_image *xcalDetImage,
+ cpl_image *ycalDetImage,
+ cpl_image *lcalDetImage,
+ const gridDefinition *gd,
+ cpl_array *calTimestamp,
+ cpl_vector *calAngles,
+ const char *lutFilename,
+ cpl_imagelist **dataCube,
+ cpl_imagelist **noiseCube,
+ int flux,
+ int background,
+ double *ret_flux_in,
+ double *ret_flux_out,
+ double *ret_background)
{
cpl_error_code retVal = CPL_ERROR_NONE;
cpl_image *objIfuImage_data = NULL,
@@ -1055,7 +1083,7 @@ cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
xSize = 0,
ySize = 0,
process_noise = TRUE,
- tmp_ifu_nr = ifu_nr,
+ tmp_ifu_nr = 0,
mode_sigma = 1000,
ix = 0,
lx = 0,
@@ -1095,9 +1123,7 @@ cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
KMO_TRY_ASSURE(lowBound < highBound,
CPL_ERROR_ILLEGAL_INPUT,
"low bound of IFU slot must be smaller than high bound");
- KMO_TRY_ASSURE((ifu_nr >= 0) && (ifu_nr <= KMOS_NR_IFUS),
- CPL_ERROR_ILLEGAL_INPUT,
- "ifu_nr must be 1 - 24");
+
KMO_TRY_ASSURE((flux == 0) ||
(flux == 1),
@@ -1291,6 +1317,7 @@ cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
//
lutTimestamp_valid = kmclipm_reconstruct_check_lut (lutFilename, ifu_nr,
*gd, calTimestamp, calAngles);
+
//
// construct and load bad pixel mask
// a pixel is rejected if it is masked in either object or sky image
@@ -1301,16 +1328,13 @@ cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
cpl_mask_or(bpm, cpl_image_get_bpm(skyIfuImage_data)));
KMO_TRY_EXIT_IF_ERROR(
cpl_image_reject_from_mask(ifuImage_data, bpm));
-// printf("IFU %2.2d, number of rejected pixel: %d or %d -> %d\n", ifu_nr,
-// cpl_mask_count(cpl_image_get_bpm(objIfuImage_data)),
-// cpl_mask_count(cpl_image_get_bpm(skyIfuImage_data)),
-// cpl_mask_count(bpm));
//
- // calculate mode, background, flux on input image
+ // calculate flux on input image
//
- if ((flux == TRUE) || (background == TRUE)) {
- while (tmp_ifu_nr > KMOS_IFUS_PER_DETECTOR) {
+ if ((flux == TRUE) || (ret_flux_in != NULL)) {
+ tmp_ifu_nr = ifu_nr;
+ while ( !(tmp_ifu_nr < 1) && (tmp_ifu_nr > KMOS_IFUS_PER_DETECTOR)) {
tmp_ifu_nr -= KMOS_IFUS_PER_DETECTOR;
}
@@ -1318,21 +1342,25 @@ cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
xcal_mask = kmo_calc_mode_for_flux_image(ifuImage_data,
xcalIfuImage,
tmp_ifu_nr,
- &mode,
&mode_noise));
- if (flux == TRUE) {
- flux_in = kmo_calc_flux_in(ifuImage_data, xcal_mask);
- KMO_TRY_CHECK_ERROR_STATE();
+ flux_in = kmo_calc_flux_in(ifuImage_data, xcal_mask);
+ KMO_TRY_CHECK_ERROR_STATE();
+ cpl_msg_debug("", ">>>>>>>>>>>>>> flux in: %g\n", flux_in);
- if (isnan(mode_noise) || flux_in < mode_sigma*mode_noise) {
- flux_in = 0./0.;
- cpl_msg_warning("","Flux in < %d*noise", mode_sigma);
- }
+ if (isnan(mode_noise) || flux_in < mode_sigma*mode_noise) {
+ flux_in = 0./0.;
+ cpl_msg_warning("","Flux in < %d*noise", mode_sigma);
+ }
+
+ if (ret_flux_in != NULL) {
+ *ret_flux_in = flux_in;
}
cpl_image_delete(xcal_mask); xcal_mask = NULL;
- } // if ((flux == TRUE) || (background == TRUE))
+ } // if (flux == TRUE)
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_rotate_x_y_cal(0.F, ifu_nr, /*gd, */xcalIfuImage, ycalIfuImage, lcalIfuImage));
//
// reconstruct now
//
@@ -1390,31 +1418,45 @@ cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
//
// calculate mode, background, flux on output cube
//
- if ((flux == TRUE) || (background == TRUE)) {
+ if ((flux == TRUE) || (ret_flux_out != NULL) ||
+ (background == TRUE) || (ret_background != NULL))
+ {
KMO_TRY_EXIT_IF_ERROR(
kmo_calc_mode_for_flux_cube(*dataCube, &mode, &mode_noise));
- if (background == TRUE) {
- cpl_imagelist_subtract_scalar(*dataCube, mode);
+ if ((background == TRUE) || (ret_background != NULL)) {
+ if (ret_background != NULL) {
+ // just return background-value without applying it
+ *ret_background = mode;
+ } else {
+ // applying background-value
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_imagelist_subtract_scalar(*dataCube, mode));
+ }
}
- if (flux == TRUE) {
+ if ((flux == TRUE) || (ret_flux_out != NULL)) {
flux_out = kmo_imagelist_get_flux(*dataCube);
KMO_TRY_CHECK_ERROR_STATE();
+ cpl_msg_debug("", ">>>>>>>>>>>>>> flux out: %g\n", flux_out);
if (isnan(mode_noise) || flux_out < mode_sigma*mode_noise) {
flux_out = 0./0.;
cpl_msg_warning("","Flux out < %d*noise", mode_sigma);
}
- }
- } // if ((flux == TRUE) || (background == TRUE))
- if (flux == TRUE) {
- if (!isnan(flux_in) && !isnan(flux_out)) {
- KMO_TRY_EXIT_IF_ERROR(
- cpl_imagelist_multiply_scalar(*dataCube, flux_in / flux_out));
+ if (ret_flux_out != NULL) {
+ // just return flux-values without applying them
+ *ret_flux_out = flux_out;
+ } else {
+ // apply flux-values
+ if (!isnan(flux_in) && !isnan(flux_out)) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_imagelist_multiply_scalar(*dataCube, flux_in / flux_out));
+ }
+ }
}
- }
+ } // if ((flux == TRUE) || (background == TRUE))
} KMO_CATCH {
KMO_CATCH_MSG();
cpl_imagelist_delete(*dataCube); *dataCube = NULL;
@@ -1443,9 +1485,9 @@ cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
/**
@brief ...
- Nan/Inf values are noe rejected already here.
+ Nan/Inf values are now rejected already here.
*/
-cpl_error_code kmo_reconstruct_sci(int ifu_nr,
+cpl_error_code kmo_reconstruct_sci(int ifu_nr,
int lowBound,
int highBound,
cpl_frame *objectFrame,
@@ -1457,7 +1499,7 @@ cpl_error_code kmo_reconstruct_sci(int ifu_nr,
cpl_frame *ycalFrame,
cpl_frame *lcalFrame,
cpl_polynomial *lcorrection,
- gridDefinition *gd,
+ const gridDefinition *gd,
cpl_imagelist **dataCubePtr,
cpl_imagelist **noiseCubePtr,
int flux,
@@ -1525,8 +1567,8 @@ cpl_error_code kmo_reconstruct_sci(int ifu_nr,
CPL_ERROR_ILLEGAL_INPUT, "high bound of IFU slot must be positive");
KMO_TRY_ASSURE((lowBound < highBound),
CPL_ERROR_ILLEGAL_INPUT, "low bound of IFU slot must be smaller than high bound");
- KMO_TRY_ASSURE((ifu_nr >= 0) && (ifu_nr <= KMOS_NR_IFUS),
- CPL_ERROR_ILLEGAL_INPUT, "ifu_nr must be 1 - 24");
+// KMO_TRY_ASSURE((ifu_nr >= 0) && (ifu_nr <= KMOS_NR_IFUS),
+// CPL_ERROR_ILLEGAL_INPUT, "ifu_nr must be 1 - 24");
KMO_TRY_ASSURE((flux == 0) ||
(flux == 1),
@@ -1717,19 +1759,20 @@ cpl_error_code kmo_reconstruct_sci(int ifu_nr,
sat_mode, NULL,
&rotangle_found, -1, 0, 0));
} else {
- // flat not provided: fill a dummy frame with ones
+ // flat not provided: fill a dummy frame with ones (noise with zeros)
KMO_TRY_EXIT_IF_NULL(
flatfieldDetImage = cpl_image_multiply_scalar_create(
- objectDetImage, 0.0));
- KMO_TRY_EXIT_IF_ERROR(
- cpl_image_add_scalar(flatfieldDetImage, 1.0));
-
+ objectDetImage, 0.0));
if (desc.ex_noise ||
(!desc.ex_noise && (desc.fits_type == raw_fits)))
{
KMO_TRY_EXIT_IF_NULL(
- flatfieldNoiseDetImage = cpl_image_duplicate(skyDetImage));
+ flatfieldNoiseDetImage = cpl_image_duplicate(flatfieldDetImage));
}
+
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_image_add_scalar(flatfieldDetImage, 1.0));
+
}
KMO_TRY_EXIT_IF_NULL(
@@ -1795,25 +1838,28 @@ cpl_error_code kmo_reconstruct_sci(int ifu_nr,
//
KMO_TRY_EXIT_IF_ERROR(
kmo_reconstruct_sci_image(ifu_nr,
- lowBound,
- highBound,
- objectDetImage,
- objectNoiseDetImage,
- skyDetImage,
- skyNoiseDetImage,
- flatfieldDetImage,
- flatfieldNoiseDetImage,
- xcalDetImage,
- ycalDetImage,
- lcalDetImage,
- gd,
- calTimestamp,
- calAngles,
- lutFilename,
- dataCubePtr,
- noiseCubePtr,
- flux,
- background));
+ lowBound,
+ highBound,
+ objectDetImage,
+ objectNoiseDetImage,
+ skyDetImage,
+ skyNoiseDetImage,
+ flatfieldDetImage,
+ flatfieldNoiseDetImage,
+ xcalDetImage,
+ ycalDetImage,
+ lcalDetImage,
+ gd,
+ calTimestamp,
+ calAngles,
+ lutFilename,
+ dataCubePtr,
+ noiseCubePtr,
+ flux,
+ background,
+ NULL,
+ NULL,
+ NULL));
KMO_TRY_CHECK_ERROR_STATE();
}
KMO_CATCH
@@ -1856,7 +1902,6 @@ cpl_error_code kmo_reconstruct_sci(int ifu_nr,
cpl_image* kmo_calc_mode_for_flux_image(const cpl_image *data,
const cpl_image *xcal,
int ifu_nr,
- double *mode,
double *noise)
{
cpl_image *mask = NULL;
@@ -1888,10 +1933,7 @@ cpl_image* kmo_calc_mode_for_flux_image(const cpl_image *data,
tmp_noise = 0./0.;
}
- // set return values
- if (mode != NULL) {
- *mode = tmp_mode;
- }
+ // set return value
if (noise != NULL) {
*noise = tmp_noise;
}
@@ -1900,9 +1942,7 @@ cpl_image* kmo_calc_mode_for_flux_image(const cpl_image *data,
{
KMO_CATCH_MSG();
mask = NULL;
- if (mode != NULL) {
- *mode = 0.;
- }
+
if (noise != NULL) {
*noise = 0.;
}
@@ -1965,4 +2005,95 @@ cpl_error_code kmo_calc_mode_for_flux_cube(const cpl_imagelist *data,
return ret_err;
}
+cpl_error_code kmo_rotate_x_y_cal (const float rot_ang, const int ifu_nr, /*const gridDefinition *gd,*/
+ cpl_image *xcal, cpl_image *ycal, cpl_image *lcal) {
+
+ cpl_error_code return_code = CPL_ERROR_NONE;
+ cpl_size ix = 0,
+ nx = 0,
+ ny = 0,
+ size = 0;
+ const cpl_mask *xmask = NULL;
+ const cpl_binary *pxmask = NULL;
+ int ifu_of_device = 0;
+ float ifu_dec = 0.,
+ angle = 0.,
+ cos_a = 0.,
+ sin_a = 0.,
+ new_x = 0.,
+ new_y = 0.,
+ *pxcal = NULL,
+ *pycal = NULL;
+
+ if (fabs(rot_ang) < 1.0) {
+ return return_code;
+ }
+
+ KMO_TRY {
+ KMO_TRY_ASSURE((xcal != NULL) &&
+ (ycal != NULL) &&
+ (lcal != NULL),
+ CPL_ERROR_NULL_INPUT,
+ "Not all input data is provided!");
+
+ nx = cpl_image_get_size_x(xcal);
+ ny = cpl_image_get_size_y(xcal);
+ size = nx * ny;
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ KMO_TRY_ASSURE((nx == cpl_image_get_size_x(ycal)) &&
+ (ny == cpl_image_get_size_y(ycal)),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "xcal and ycal don't have the same size!");
+
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_priv_delete_alien_ifu_cal_data(ifu_nr, xcal, ycal, lcal));
+
+ KMO_TRY_EXIT_IF_NULL(
+ pxcal = cpl_image_get_data_float(xcal));
+ KMO_TRY_EXIT_IF_NULL(
+ pycal = cpl_image_get_data_float(ycal));
+ KMO_TRY_EXIT_IF_NULL(
+ xmask = cpl_image_get_bpm_const(xcal));
+ KMO_TRY_EXIT_IF_NULL(
+ pxmask = cpl_mask_get_data_const(xmask));
+
+ angle = rot_ang * CPL_MATH_PI / 180;
+ cos_a = cosf(angle);
+ sin_a = sinf(angle);
+ ifu_of_device = ifu_nr % KMOS_IFUS_PER_DETECTOR;
+ if (ifu_of_device == 0) {
+ ifu_of_device = 8;
+ }
+ ifu_dec = 0.1f * ifu_of_device;
+
+ for (ix = 0; ix < size; ix++) {
+ if (!pxmask[ix]) {
+ /* conterclockwise */
+ new_x = pxcal[ix] * cos_a - pycal[ix] * sin_a;
+ new_y = pxcal[ix] * sin_a + pycal[ix] * cos_a;
+ /* clockwise
+ new_x = pxcal[ix] * cos_a + pycal[ix] * sin_a;
+ new_y = -pxcal[ix] * sin_a + pycal[ix] * cos_a;
+ */
+ if (new_x < 0 ) {
+ pxcal[ix] = rintf(new_x) - ifu_dec;
+ } else {
+ pxcal[ix] = rintf(new_x) + ifu_dec;
+ }
+ if (new_y < 0 ) {
+ pycal[ix] = rintf(new_y) - ifu_dec;
+ } else {
+ pycal[ix] = rintf(new_y) + ifu_dec;
+ }
+ }
+ }
+
+ }
+ KMO_CATCH {
+ KMO_CATCH_MSG();
+ }
+
+ return return_code;
+}
/** @} */
diff --git a/kmos/kmo_functions.h b/kmos/kmo_functions.h
index ef0f460..b2473ad 100644
--- a/kmos/kmo_functions.h
+++ b/kmos/kmo_functions.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_functions.h,v 1.13 2013/08/02 18:04:27 aagudo Exp $
+/* $Id: kmo_functions.h,v 1.18 2013-10-09 12:16:10 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/02 18:04:27 $
- * $Revision: 1.13 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-09 12:16:10 $
+ * $Revision: 1.18 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_FUNCTIONS_H
@@ -36,33 +36,37 @@
#include "kmclipm_functions.h"
#include "kmclipm_constants.h"
+#define NO_CORRESPONDING_SKYFRAME ((cpl_frame* ) -1)
+
typedef struct {
- cpl_frame *objFrame; // pointer to frame containing objects
- cpl_frame *skyFrames[KMOS_NR_IFUS]; // array of pointers to according sky frames
+ cpl_frame *objFrame; // pointer to frame containing objects
+ cpl_frame *skyFrames[KMOS_NR_IFUS]; // array of pointers to according sky frames
} objSkyTable;
-typedef struct { // just for connecting frame filenames to entries in objSkyStruct
- const char *filename;
- int index;
+typedef struct { // just for connecting frame filenames to entries in objSkyStruct
+ const char *filename;
+ int index;
} objSkyIndexStruct;
typedef struct {
- int size; // number of frames with objects in it
- objSkyTable *table; // array of objSkyTables
- objSkyIndexStruct *indexStruct;
+ int size; // number of frames with objects in it
+ objSkyTable *table; // array of objSkyTables size: size
+ int sizeIndexStruct;
+ objSkyIndexStruct *indexStruct; // size: sizeIndexStruct
} objSkyStruct;
-#define NO_CORRESPONDING_SKYFRAME ((cpl_frame* ) -1)
-
typedef struct {
- int size; // number of frames with objects in it
- // (same as objSkyStruct->size)
- int nrNames; // number of object names
- char **names; // array of object names
- int *namesCnt; // array with number of object name occurences
- int *ifu_ids; // array with IFU IDs of object names
- int *telluricCnt; // array with number of telluric occurences
- objSkyStruct *obj_sky_struct; // pointer to structure with obj/sky-associations
+ int size; // number of frames with objects in it (same as objSkyStruct->size)
+ int nrNames; // number of object names
+
+ objSkyStruct *obj_sky_struct; // pointer to structure with obj/sky-associations, size: [1]
+
+ char **names; // array of object names size: [nrNames]
+ int *namesCnt; // array with number of object name occurences size: [nrNames]
+ int *telluricCnt; // array with number of telluric occurences size: [nrNames]
+ int *sameTelluric; // array with boolean if same telluric for all IFUs size: [nrNames]
+ int *name_ids; // array with IDs of object names size: [size*KMOS_NR_IFUS]
+ // 0: no object available, 1: 1st object ID etc.
} armNameStruct;
@@ -72,8 +76,7 @@ typedef struct {
extern int print_warning_once;
-void kmo_debug_objSkyStruct(cpl_frameset *frameset,
- const objSkyStruct *obj_sky_struct);
+void kmo_print_objSkyStruct(const objSkyStruct *obj_sky_struct);
objSkyStruct* kmo_create_objSkyStruct(
cpl_frameset *frameset,
@@ -89,7 +92,7 @@ void kmo_collapse_objSkyStruct(
void kmo_delete_objSkyStruct(
objSkyStruct *obj_sky_struct);
-void kmo_debug_armNameStruct(
+void kmo_print_armNameStruct(
cpl_frameset *frameset,
armNameStruct *arm_name_struct);
@@ -111,8 +114,7 @@ cpl_array* kmo_get_timestamps(
cpl_frame* ycalFrame,
cpl_frame* lcalFrame);
-cpl_error_code kmo_reconstruct_sci_image(
- int ifu_nr,
+cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
int lowBound,
int highBound,
cpl_image *objectDataDetImage,
@@ -124,17 +126,19 @@ cpl_error_code kmo_reconstruct_sci_image(
cpl_image *xcalDetImage,
cpl_image *ycalDetImage,
cpl_image *lcalDetImage,
- gridDefinition *gd,
+ const gridDefinition *gd,
cpl_array *calTimestamp,
cpl_vector *calAngles,
const char *lutFilename,
cpl_imagelist **dataCube,
cpl_imagelist **noiseCube,
int flux,
- int background);
+ int background,
+ double *ret_flux_in,
+ double *ret_flux_out,
+ double *ret_background);
-cpl_error_code kmo_reconstruct_sci(
- int ifu_nr,
+cpl_error_code kmo_reconstruct_sci(int ifu_nr,
int lowBound,
int highBound,
cpl_frame *objectFrame,
@@ -146,7 +150,7 @@ cpl_error_code kmo_reconstruct_sci(
cpl_frame *ycalFrame,
cpl_frame *lcalFrame,
cpl_polynomial *lcorrection,
- gridDefinition *gd,
+ const gridDefinition *gd,
cpl_imagelist **dataCubePtr,
cpl_imagelist **noiseCubePtr,
int flux,
@@ -157,7 +161,6 @@ cpl_image *kmo_calc_mode_for_flux_image(
const cpl_image *data,
const cpl_image *xcal,
int ifu_nr,
- double *mode,
double *noise);
cpl_error_code kmo_calc_mode_for_flux_cube(
@@ -165,4 +168,12 @@ cpl_error_code kmo_calc_mode_for_flux_cube(
double *mode,
double *noise);
+cpl_error_code kmo_rotate_x_y_cal (
+ const float rot_ang,
+ const int ifu_nr,
+// const gridDefinition *gd,
+ cpl_image *xcal,
+ cpl_image *ycal,
+ cpl_image *lcal);
+
#endif
diff --git a/kmos/kmo_priv_arithmetic.c b/kmos/kmo_priv_arithmetic.c
index 56037e9..5f664db 100644
--- a/kmos/kmo_priv_arithmetic.c
+++ b/kmos/kmo_priv_arithmetic.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_arithmetic.c,v 1.4 2013/06/17 07:52:26 aagudo Exp $
+/* $Id: kmo_priv_arithmetic.c,v 1.4 2013-06-17 07:52:26 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 07:52:26 $
+ * $Date: 2013-06-17 07:52:26 $
* $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/kmo_priv_arithmetic.h b/kmos/kmo_priv_arithmetic.h
index 1a851e2..dbd94ac 100644
--- a/kmos/kmo_priv_arithmetic.h
+++ b/kmos/kmo_priv_arithmetic.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_arithmetic.h,v 1.3 2012/05/16 10:53:32 aagudo Exp $
+/* $Id: kmo_priv_arithmetic.h,v 1.3 2012-05-16 10:53:32 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2012/05/16 10:53:32 $
+ * $Date: 2012-05-16 10:53:32 $
* $Revision: 1.3 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_ARITHMETIC_H
diff --git a/kmos/kmo_priv_combine.c b/kmos/kmo_priv_combine.c
index 0ba4b9b..e2dbeb2 100644
--- a/kmos/kmo_priv_combine.c
+++ b/kmos/kmo_priv_combine.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_combine.c,v 1.20 2013/08/02 08:10:33 aagudo Exp $
+/* $Id: kmo_priv_combine.c,v 1.23 2013-09-17 08:54:45 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/02 08:10:33 $
- * $Revision: 1.20 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-09-17 08:54:45 $
+ * $Revision: 1.23 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -282,81 +282,86 @@ cpl_error_code kmo_priv_combine(cpl_imagelist **cube_data,
cpl_imagelist **cube_combined_data,
cpl_imagelist **cube_combined_noise)
{
- cpl_error_code err = CPL_ERROR_NONE;
-
- int nz = 0,
- ix = 0,
- iy = 0,
- nx = 0,
- ny = 0,
- nx_new = 0,
- ny_new = 0,
- once = FALSE,
- border = 0,
- tmp_int = 0,
- y_min = 0,
- x_min = 0,
- y_max = 0,
- x_max = 0,
- nr_identified = 0,
- ifunr = 0,
- i = 0,
- iz = 0;
- double cd1_1 = 0.0,
- cd1_2 = 0.0,
- ang1 = 0.0,
- ang2 = 0.0,
- *pxshifts = NULL,
- *pyshifts = NULL,
- *pxtmp_shifts = NULL,
- *pytmp_shifts = NULL,
- *ptmp_data_vec = NULL,
- *ptmp_noise_vec = NULL,
- stdev = 0.0,
- tol = 0.00001,
- *pidentified = NULL,
- xref = 0.0,
- yref = 0.0,
- stderr = 0.0;
-
- char *ext_name = NULL;
-
- const char *fn_shifts = "shifts_applied.txt",
- *frname = NULL;
- cpl_image *img_data_tmp = NULL,
- *img_noise_tmp = NULL,
- *tmp_img = NULL,
- *tmp_img2 = NULL,
- **data_cur_img_list = NULL,
- **noise_cur_img_list= NULL;
-
- cpl_vector *tmp_data_vec = NULL,
- *tmp_noise_vec = NULL,
- *identified = NULL,
- *fit_pars = NULL;
-
- cpl_bivector *shifts = NULL,
- *tmp_shifts = NULL;
-
- cpl_wcs *wcs_ref = NULL,
- *wcs = NULL;
-
- cpl_matrix *phys_ref = NULL,
- *world = NULL,
- *phys = NULL;
-
- cpl_array *status = NULL;
-
- float *pimg_data_tmp = NULL,
- *pimg_noise_tmp = NULL,
- *p = NULL;
-
- enum combine_status combStatus = combine_ok;
-
- FILE *fid = NULL;
+ cpl_error_code err = CPL_ERROR_NONE;
+ int nz = 0,
+ ix = 0,
+ iy = 0,
+ nx = 0,
+ ny = 0,
+ nx_new = 0,
+ ny_new = 0,
+ once = FALSE,
+ border = 0,
+ tmp_int = 0,
+ y_min = 0,
+ x_min = 0,
+ y_max = 0,
+ x_max = 0,
+ nr_identified = 0,
+ ifunr = 0,
+ i = 0,
+ iz = 0;
+ double cd1_1 = 0.0,
+ cd1_2 = 0.0,
+ ang1 = 0.0,
+ ang2 = 0.0,
+ *pxshifts = NULL,
+ *pyshifts = NULL,
+ *pxtmp_shifts = NULL,
+ *pytmp_shifts = NULL,
+ *ptmp_data_vec = NULL,
+ *ptmp_noise_vec = NULL,
+ stdev = 0.0,
+ tol = 0.00001,
+ *pidentified = NULL,
+ xref = 0.0,
+ yref = 0.0,
+ stderr = 0.0;
+ char *ext_name = NULL,
+ *fn_shifts = NULL;
+ const char *frname = NULL;
+ cpl_image *img_data_tmp = NULL,
+ *img_noise_tmp = NULL,
+ *tmp_img = NULL,
+ *tmp_img2 = NULL,
+ **data_cur_img_list = NULL,
+ **noise_cur_img_list = NULL;
+ cpl_vector *tmp_data_vec = NULL,
+ *tmp_noise_vec = NULL,
+ *identified = NULL,
+ *fit_pars = NULL;
+ cpl_bivector *shifts = NULL,
+ *tmp_shifts = NULL;
+ cpl_wcs *wcs_ref = NULL,
+ *wcs = NULL;
+ cpl_matrix *phys_ref = NULL,
+ *world = NULL,
+ *phys = NULL;
+ cpl_array *status = NULL;
+ float *pimg_data_tmp = NULL,
+ *pimg_noise_tmp = NULL,
+ *p = NULL;
+ FILE *fid = NULL;
+ enum combine_status combStatus = combine_ok;
KMO_TRY
{
+ if (name != NULL) {
+ // remove unwanted characters from suffix
+ char *clean_suffix = NULL;
+ KMO_TRY_EXIT_IF_NULL(
+ clean_suffix = cpl_sprintf("%s", name));
+
+ kmo_clean_string(clean_suffix);
+
+ KMO_TRY_EXIT_IF_NULL(
+ fn_shifts = cpl_sprintf("shifts_applied_%s.txt", clean_suffix));
+
+ cpl_free(clean_suffix); clean_suffix = NULL;
+ } else {
+ KMO_TRY_EXIT_IF_NULL(
+ fn_shifts = cpl_sprintf("shifts_applied.txt"));
+ }
// omit repeating warnings about "The number of identified slices is one!
// Applying --cmethod='average' instead of 'ksigma'."
// This happens severeal times, where the cubes to combine don't overlap
@@ -1042,30 +1047,30 @@ kmclipm_vector_delete(kvn); kvn = NULL;
KMO_TRY_EXIT_IF_ERROR(
kmclipm_update_property_double(header_data[0],
- "CRPIX1",
- cpl_propertylist_get_double(header_data[0], CRPIX1)
+ CRPIX1,
+ cpl_propertylist_get_double(header_data[0], CRPIX1)
+ pxshifts[0],
"[pix] Reference pixel in x"));
KMO_TRY_EXIT_IF_ERROR(
kmclipm_update_property_double(header_data[0],
- "CRPIX2",
- cpl_propertylist_get_double(header_data[0], CRPIX2)
+ CRPIX2,
+ cpl_propertylist_get_double(header_data[0], CRPIX2)
+ pyshifts[0],
"[pix] Reference pixel in y"));
if (header_noise != NULL) {
KMO_TRY_EXIT_IF_ERROR(
kmclipm_update_property_double(header_noise[0],
- "CRPIX1",
- cpl_propertylist_get_double(header_noise[0], CRPIX1)
+ CRPIX1,
+ cpl_propertylist_get_double(header_noise[0], CRPIX1)
+ pxshifts[0],
"[pix] Reference pixel in x"));
KMO_TRY_EXIT_IF_ERROR(
kmclipm_update_property_double(header_noise[0],
- "CRPIX2",
- cpl_propertylist_get_double(header_noise[0], CRPIX2)
+ CRPIX2,
+ cpl_propertylist_get_double(header_noise[0], CRPIX2)
+ pyshifts[0],
"[pix] Reference pixel in y"));
}
@@ -1092,6 +1097,7 @@ kmclipm_vector_delete(kvn); kvn = NULL;
cpl_bivector_delete(shifts); shifts = NULL;
cpl_vector_delete(identified); identified = NULL;
cpl_vector_delete(fit_pars); fit_pars = NULL;
+ cpl_free(fn_shifts); fn_shifts = NULL;
if (data_cur_img_list != NULL) {
for (i = 0; i < data_counter; i++) {
diff --git a/kmos/kmo_priv_combine.h b/kmos/kmo_priv_combine.h
index 38aa7f2..36629a4 100644
--- a/kmos/kmo_priv_combine.h
+++ b/kmos/kmo_priv_combine.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_combine.h,v 1.7 2013/03/28 11:04:15 aagudo Exp $
+/* $Id: kmo_priv_combine.h,v 1.7 2013-03-28 11:04:15 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/03/28 11:04:15 $
+ * $Date: 2013-03-28 11:04:15 $
* $Revision: 1.7 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_COMBINE_H
diff --git a/kmos/kmo_priv_copy.c b/kmos/kmo_priv_copy.c
index 0c35e01..13cbcbd 100644
--- a/kmos/kmo_priv_copy.c
+++ b/kmos/kmo_priv_copy.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_copy.c,v 1.2 2012/12/07 12:58:44 aagudo Exp $
+/* $Id: kmo_priv_copy.c,v 1.2 2012-12-07 12:58:44 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2012/12/07 12:58:44 $
+ * $Date: 2012-12-07 12:58:44 $
* $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/kmo_priv_copy.h b/kmos/kmo_priv_copy.h
index 7e10209..7869388 100644
--- a/kmos/kmo_priv_copy.h
+++ b/kmos/kmo_priv_copy.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_copy.h,v 1.1.1.1 2012/01/18 09:31:59 yjung Exp $
+/* $Id: kmo_priv_copy.h,v 1.1.1.1 2012-01-18 09:31:59 yjung Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2012/01/18 09:31:59 $
+ * $Date: 2012-01-18 09:31:59 $
* $Revision: 1.1.1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_COPY_H
diff --git a/kmos/kmo_priv_dark.c b/kmos/kmo_priv_dark.c
index c1f0b24..8caf805 100644
--- a/kmos/kmo_priv_dark.c
+++ b/kmos/kmo_priv_dark.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_dark.c,v 1.4 2013/06/17 07:52:26 aagudo Exp $
+/* $Id: kmo_priv_dark.c,v 1.4 2013-06-17 07:52:26 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 07:52:26 $
+ * $Date: 2013-06-17 07:52:26 $
* $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/kmo_priv_dark.h b/kmos/kmo_priv_dark.h
index f032724..cf10642 100644
--- a/kmos/kmo_priv_dark.h
+++ b/kmos/kmo_priv_dark.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_dark.h,v 1.1.1.1 2012/01/18 09:31:59 yjung Exp $
+/* $Id: kmo_priv_dark.h,v 1.1.1.1 2012-01-18 09:31:59 yjung Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2012/01/18 09:31:59 $
+ * $Date: 2012-01-18 09:31:59 $
* $Revision: 1.1.1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_DARK_H
diff --git a/kmos/kmo_priv_extract_spec.c b/kmos/kmo_priv_extract_spec.c
index 846b77a..15434d7 100644
--- a/kmos/kmo_priv_extract_spec.c
+++ b/kmos/kmo_priv_extract_spec.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_extract_spec.c,v 1.7 2013/03/12 14:55:37 erw Exp $
+/* $Id: kmo_priv_extract_spec.c,v 1.7 2013-03-12 14:55:37 erw Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: erw $
- * $Date: 2013/03/12 14:55:37 $
+ * $Date: 2013-03-12 14:55:37 $
* $Revision: 1.7 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/kmo_priv_extract_spec.h b/kmos/kmo_priv_extract_spec.h
index a6dc003..7dbf758 100644
--- a/kmos/kmo_priv_extract_spec.h
+++ b/kmos/kmo_priv_extract_spec.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_extract_spec.h,v 1.2 2013/01/11 08:12:24 aagudo Exp $
+/* $Id: kmo_priv_extract_spec.h,v 1.2 2013-01-11 08:12:24 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/01/11 08:12:24 $
+ * $Date: 2013-01-11 08:12:24 $
* $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_EXTRACT_SPEC_H
diff --git a/kmos/kmo_priv_fit_profile.c b/kmos/kmo_priv_fit_profile.c
index 3291b28..48d9943 100644
--- a/kmos/kmo_priv_fit_profile.c
+++ b/kmos/kmo_priv_fit_profile.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_fit_profile.c,v 1.5 2013/04/10 12:11:33 aagudo Exp $
+/* $Id: kmo_priv_fit_profile.c,v 1.5 2013-04-10 12:11:33 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/04/10 12:11:33 $
+ * $Date: 2013-04-10 12:11:33 $
* $Revision: 1.5 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#include <math.h>
diff --git a/kmos/kmo_priv_fit_profile.h b/kmos/kmo_priv_fit_profile.h
index 14f5572..81fad59 100644
--- a/kmos/kmo_priv_fit_profile.h
+++ b/kmos/kmo_priv_fit_profile.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_fit_profile.h,v 1.1.1.1 2012/01/18 09:31:59 yjung Exp $
+/* $Id: kmo_priv_fit_profile.h,v 1.1.1.1 2012-01-18 09:31:59 yjung Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2012/01/18 09:31:59 $
+ * $Date: 2012-01-18 09:31:59 $
* $Revision: 1.1.1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_FIT_PROFILE_H
diff --git a/kmos/kmo_priv_fits_check.c b/kmos/kmo_priv_fits_check.c
index cb96c45..643671b 100644
--- a/kmos/kmo_priv_fits_check.c
+++ b/kmos/kmo_priv_fits_check.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_fits_check.c,v 1.6 2013/08/02 08:11:37 aagudo Exp $
+/* $Id: kmo_priv_fits_check.c,v 1.6 2013-08-02 08:11:37 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/02 08:11:37 $
+ * $Date: 2013-08-02 08:11:37 $
* $Revision: 1.6 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#include <string.h>
diff --git a/kmos/kmo_priv_fits_check.h b/kmos/kmo_priv_fits_check.h
index 8b0beff..51721b0 100644
--- a/kmos/kmo_priv_fits_check.h
+++ b/kmos/kmo_priv_fits_check.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_fits_check.h,v 1.1.1.1 2012/01/18 09:31:59 yjung Exp $
+/* $Id: kmo_priv_fits_check.h,v 1.1.1.1 2012-01-18 09:31:59 yjung Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2012/01/18 09:31:59 $
+ * $Date: 2012-01-18 09:31:59 $
* $Revision: 1.1.1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_FITS_CHECK_H
diff --git a/kmos/kmo_priv_fits_stack.c b/kmos/kmo_priv_fits_stack.c
index 861fede..1230110 100644
--- a/kmos/kmo_priv_fits_stack.c
+++ b/kmos/kmo_priv_fits_stack.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_fits_stack.c,v 1.17 2013/06/17 11:32:05 aagudo Exp $
+/* $Id: kmo_priv_fits_stack.c,v 1.17 2013-06-17 11:32:05 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 11:32:05 $
+ * $Date: 2013-06-17 11:32:05 $
* $Revision: 1.17 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#include <math.h>
diff --git a/kmos/kmo_priv_fits_stack.h b/kmos/kmo_priv_fits_stack.h
index 7d25d1e..98e67f0 100644
--- a/kmos/kmo_priv_fits_stack.h
+++ b/kmos/kmo_priv_fits_stack.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_fits_stack.h,v 1.1.1.1 2012/01/18 09:31:59 yjung Exp $
+/* $Id: kmo_priv_fits_stack.h,v 1.1.1.1 2012-01-18 09:31:59 yjung Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2012/01/18 09:31:59 $
+ * $Date: 2012-01-18 09:31:59 $
* $Revision: 1.1.1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_FITS_STACK_H
diff --git a/kmos/kmo_priv_flat.c b/kmos/kmo_priv_flat.c
index a7de589..8c27f9b 100644
--- a/kmos/kmo_priv_flat.c
+++ b/kmos/kmo_priv_flat.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_flat.c,v 1.26 2013/08/07 14:37:16 aagudo Exp $
+/* $Id: kmo_priv_flat.c,v 1.34 2013-10-11 08:00:26 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/07 14:37:16 $
- * $Revision: 1.26 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-11 08:00:26 $
+ * $Revision: 1.34 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -33,8 +33,6 @@
* Includes
*----------------------------------------------------------------------------*/
-//int xxxdebugonce = 1;
-
#include <sys/stat.h>
#include <math.h>
#include <string.h>
@@ -51,6 +49,8 @@
#include "kmo_cpl_extensions.h"
#include "kmo_debug.h"
+double slit_tol = 2.0;
+
/*----------------------------------------------------------------------------*/
/**
@defgroup kmos_priv_flat Helper functions for kmo_flat
@@ -143,6 +143,7 @@ cpl_image* kmo_create_bad_pix_flat_thresh(const cpl_image* data,
nx = cpl_image_get_size_x(data);
ny = cpl_image_get_size_y(data);
+ KMO_TRY_CHECK_ERROR_STATE();
// figure out the minimum level
tmp_img = cpl_image_collapse_window_create(data,
@@ -151,9 +152,10 @@ cpl_image* kmo_create_bad_pix_flat_thresh(const cpl_image* data,
nx-KMOS_BADPIX_BORDER,
ny-KMOS_BADPIX_BORDER,
1);
- cpl_image_divide_scalar(tmp_img, KMOS_DETECTOR_SIZE-2*KMOS_BADPIX_BORDER);
+ cpl_image_divide_scalar(tmp_img, nx-2*KMOS_BADPIX_BORDER);
min_level = cpl_image_get_median(tmp_img)/20; // 5%
cpl_image_delete(tmp_img); tmp_img = NULL;
+ KMO_TRY_CHECK_ERROR_STATE();
// create internal preliminary badpixel_flat, based on badpixel_dark
// already present in data
@@ -180,16 +182,17 @@ cpl_image* kmo_create_bad_pix_flat_thresh(const cpl_image* data,
// calculate threshold-level,
// set everything as bad below
for (i = KMOS_BADPIX_BORDER+1;
- i <= KMOS_DETECTOR_SIZE-KMOS_BADPIX_BORDER-slice_height+1;
+ i <= nx-KMOS_BADPIX_BORDER-slice_height+1;
i += slice_height)
{
tmp_img = cpl_image_collapse_window_create(data,
KMOS_BADPIX_BORDER+1,
i,
- KMOS_DETECTOR_SIZE-KMOS_BADPIX_BORDER,
+ nx-KMOS_BADPIX_BORDER,
i+slice_height-1,
1);
- cpl_image_divide_scalar(tmp_img, KMOS_DETECTOR_SIZE-2*KMOS_BADPIX_BORDER);
+ cpl_image_divide_scalar(tmp_img, nx-2*KMOS_BADPIX_BORDER);
+ KMO_TRY_CHECK_ERROR_STATE();
// this is our badpix threshold level
level = cpl_image_get_median(tmp_img)*thresh;
@@ -201,8 +204,8 @@ cpl_image* kmo_create_bad_pix_flat_thresh(const cpl_image* data,
}
cpl_image_delete(tmp_img); tmp_img = NULL;
- cpl_msg_debug(cpl_func, "y: %d, level: %g", i, level);
- for (ix = KMOS_BADPIX_BORDER; ix < KMOS_DETECTOR_SIZE-KMOS_BADPIX_BORDER; ix++) {
+// cpl_msg_debug(cpl_func, "y: %d, level: %g", i, level);
+ for (ix = KMOS_BADPIX_BORDER; ix < nx-KMOS_BADPIX_BORDER; ix++) {
for (iy = i-1; iy <= i+slice_height-2; iy++) {
if ((ptmp_bad_pix_mask[ix+iy*nx] == 1.) &&
(pdata[ix+iy*nx] < level))
@@ -241,7 +244,7 @@ cpl_image* kmo_create_bad_pix_flat_thresh(const cpl_image* data,
}
}
}
-
+ KMO_TRY_CHECK_ERROR_STATE();
}
KMO_CATCH
{
@@ -254,362 +257,884 @@ cpl_image* kmo_create_bad_pix_flat_thresh(const cpl_image* data,
return bad_pix_mask;
}
-
/**
- @deprecated Use kmo_create_bad_pix_flat() instead. (This method was to prone
- to level variations across flatfield exposure)
+ @brief
+ Returns the index to the first non-rejected element
+
+ @param vec The vector to examine
+ @param from left TRUE if the vector should be examioned from the left,
+ FALSE otherwise
+ @return
+ The found index
+*/
+int kmo_find_first_non_rejected(const kmclipm_vector *vec,
+ int from_left)
+{
+ int index = -1,
+ size = 0,
+ i = 0;
+
+ KMO_TRY
+ {
+ size = kmclipm_vector_get_size(vec);
+
+ if (from_left) {
+ i = 0;
+ while ((i < size) && (kmclipm_vector_is_rejected(vec, i))) {
+ i++;
+ }
+ if (i < size) {
+ index = i;
+ }
+ } else {
+ i = size-1;
+ while ((i >= 0) && (kmclipm_vector_is_rejected(vec, i))) {
+ i--;
+ }
+ if (i >= 0) {
+ index = i;
+ }
+ }
+ }
+ KMO_CATCH
+ {
+ KMO_CATCH_MSG();
+ index = -1;
+ }
+ return index;
+}
+
+/**
@brief
- Calculate the bad pixel mask from flat frames using global histogram.
+ Validate the number of slitlet edges
- @param data Image to be examined.
- @param surrounding_pixels Number of surrounding pixels. Between 0 and 8.
- Default is 6.
+ @param nr_edges The number of found edges
+ @param cut_left TRUE if the leftmost slitlet is cut halfways
+ @param cut_right TRUE if the rightmost slitlet is cut halfways
@return
- The calculated bad pixel mask.
+ TRUE if valid, FALSE otherwise
+*/
+int kmo_validate_nr_edges(int nr_edges,
+ int cut_left,
+ int cut_right)
+{
+ int ret = FALSE;
+
+ if (!cut_left && !cut_right) {
+ // normal case
+ switch(nr_edges) {
+ case 28:
+ case 56:
+ case 84:
+ case 112:
+ case 140:
+ case 168:
+ case 196:
+ case 224:
+ ret = TRUE;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (cut_left && cut_right) {
+ // first AND last slitlet cut halfways
+ switch(nr_edges) {
+ case 24:
+ case 52:
+ case 80:
+ case 108:
+ case 136:
+ case 164:
+ case 192:
+ case 220:
+ ret = TRUE;
+ break;
+ default:
+ break;
+ }
+ } else {
+ // first OR last slitlet cut halfways
+ switch(nr_edges) {
+ case 26:
+ case 54:
+ case 82:
+ case 110:
+ case 138:
+ case 166:
+ case 194:
+ case 222:
+ ret = TRUE;
+ break;
+ default:
+ break;
+ }
+ }
- First the threshold level for badpixel calculation is determined as follows:
- The image is sorted into a vector, the lower 5% and upper 10% are cut off,
- then the data is resampled (with a factor 1000) in order to omit outliers
- and to reduce calculation time. At the end the position of the maximum slope
- is determined. This would be the perfect threshold level.
- From this level we just take a value of 10% to narrow the gaps, which are
- later on calculated precisely using the parameters of the fitted edges
- (see @li kmo_calc_spec_frames()). Here it is important to get the correct
- badpixel areas at the top and bottom of the detector frames. So we know
- where a slitlet begins and ends in spectral direction.
+ return ret;
+}
- Then all pixels are examined by how many bad pixels they are
- surrounded (8 surrounding pixels) of. If this number is at least the same as
- @c surrounding_pixels, then this pixel is also marked as bad.
+/**
+ @brief
+ Calculate threshold for flat frame.
- The internal badpixel mask is set as well here.
+ @param midline The cut across the middle of the detector image.
+ @param thresh estimate The initial threshold estimate.
+ @param t_value (Output) Contains the number of detected edges at
+ different threshold levels
+ @param t_level (Output) Contains the threshold level at
+ different threshold levels
+ @param t_pos (Output) Contains the index to t_value and t_level
+ used to determine the retuned value
+
+ @return
+ A robust threshold value
+
+ Taking a simple histogram of the @c midline isn't sufficient, since the
+ detector image can be vignetted, therefore some of the slitlets can lie
+ below the estimated threshold. <br>
+ Here we additionally count the number of detected slitlets edges. If this
+ number isn't a multiple of expected IFU-slitlet-edges, we lower the threshold
+ and count again. At the end the most reasonable value is returned.
Possible cpl_error_code set in this function:
- @li CPL_ERROR_NULL_INPUT if @c data or @c badpix_thresh is NULL.
- @li CPL_ERROR_ILLEGAL_INPUT if any of the values is less than zero.
+ @li CPL_ERROR_NULL_INPUT if @c midline is NULL.
*/
-cpl_image* kmo_create_bad_pix_flat(const cpl_image* data,
- int surrounding_pixels)
+kmclipm_vector* kmo_analize_slitedges(const kmclipm_vector *midline,
+ double thresh_estimate,
+ kmclipm_vector **t_value,
+ kmclipm_vector **t_level,
+ int *t_pos)
{
- int nx = 0,
- ny = 0,
- k = 0,
- max_pos = 0,
- sampling_factor = 1000,
- i = 0,
- j = 0,
- ix = 0,
- iy = 0;
-
- float *pbad_pix_mask = NULL,
- *ptmp_badpix = NULL;
-
- const float *pdata = NULL;
-
- double max_slope = 0.0,
- slope = 0.0,
- percent = 0.0,
- *ptmp_vec = NULL,
- *pimg_sorted_cut = NULL,
- *pimg_sorted_cut_short = NULL,
- thresh = 0.0;
-
- cpl_image *bad_pix_mask = NULL,
- *tmp_badpix = NULL;
-
- cpl_vector *img_sorted = NULL,
- *tmp_vec = NULL,
- *img_sorted_cut = NULL,
- *img_sorted_cut_short = NULL;
+ int t_cnt = 20,
+ start = 0,
+ stop = 0,
+ last_start = 0,
+ last_stop = 0,
+ is_rej = 0,
+ t = 0,
+ last = 0;
+ double t_delta = 0.7*thresh_estimate/t_cnt,
+ thresh_final = 0.0,
+ val = 0.0,
+ last_val = 0.0;
+ kmclipm_vector *pos = NULL;
KMO_TRY
{
- KMO_TRY_ASSURE(data != NULL,
+ KMO_TRY_ASSURE((midline != NULL) &&
+ (t_value != NULL) &&
+ (t_level != NULL) &&
+ (t_pos != NULL),
CPL_ERROR_NULL_INPUT,
- "No input data is provided!");
+ "Not all input data is provided!");
- KMO_TRY_ASSURE((surrounding_pixels >= 0) &&
- (surrounding_pixels <= 8),
- CPL_ERROR_ILLEGAL_INPUT,
- "surrounding_pixels must be between 0 and 8!");
+ // init
+ // t_level: holds the threshold level
+ // t_value: holds the detected number of edges
+ KMO_TRY_EXIT_IF_NULL(
+ *t_level = kmclipm_vector_new(t_cnt));
+ KMO_TRY_EXIT_IF_NULL(
+ *t_value = kmclipm_vector_new(t_cnt));
+ *t_pos = 0;
- nx = cpl_image_get_size_x(data);
- ny = cpl_image_get_size_y(data);
+ // fill vectors with threshold levels and number of edges (NOE)
+ for (t = 0; t < t_cnt; t++) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_vector_set(*t_level, t, thresh_estimate));
- // calculate threshold level for badpixel calculation:
- // image is sorted into a vector, the lower 5% and upper 10% are cut off,
- // the data is resampled in (median of 1000 values each) then the
- // position of the maximum slope is determined
+ pos = kmo_get_slitedges(midline, thresh_estimate);
+ if (pos == NULL) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_vector_reject(*t_value, t));
+ cpl_error_reset();
+ } else {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_vector_set(*t_value, t, kmclipm_vector_get_size(pos)));
+ }
+ kmclipm_vector_delete(pos); pos = NULL;
+ KMO_TRY_CHECK_ERROR_STATE();
- // sort data
- KMO_TRY_EXIT_IF_NULL(
- img_sorted = kmo_image_sort(data));
+ thresh_estimate -= t_delta;
+ }
+ KMO_TRY_CHECK_ERROR_STATE();
- // cut off upper and lower pixels
- percent = cpl_vector_get_size(img_sorted)*0.05;
+ // invalidate all levels with non-matching NOE (due to outliers)
+ // valid values: 28,56,84,112,140,168,196,224 edges for 1 to 8 IFUs
+ for (t = 0; t < t_cnt; t++) {
+ if (!kmo_validate_nr_edges(
+ (int)(kmclipm_vector_get(*t_value, t, &is_rej)+.5),
+ FALSE, FALSE))
+ {
+ kmclipm_vector_reject(*t_value, t);
+ kmclipm_vector_reject(*t_level, t);
+ }
+ }
- KMO_TRY_EXIT_IF_NULL(
- img_sorted_cut = cpl_vector_extract(img_sorted, (int)percent,
- (int)(cpl_vector_get_size(img_sorted)-2*percent), 1));
+ // all rejected or all rejected but one, exit
+ if (kmclipm_vector_count_rejected(*t_value)+1 >= kmclipm_vector_get_size(*t_value)) {
+ *t_pos = -1;
+ thresh_final = -1;
+ kmclipm_vector_delete(*t_value); *t_value = NULL;
+ kmclipm_vector_delete(*t_level); *t_level = NULL;
+ } else {
+ // find the biggest range of equal values
+ last_start = -1;
+ last_stop = -1;
+ start = -1;
+ last = -1;
+ stop = -1;
+
+ for (t = 0; t < t_cnt; t++) {
+ val = kmclipm_vector_get(*t_value, t, &is_rej);
+ if (!is_rej) {
+ if (start == -1) {
+ // found 1st value in range
+ start = t;
+ stop = t;
+ last_val = val;
+ } else {
+ if ((t == last+1) && (fabs(val-last_val) < 0.1)) {
+ // we are still in continouus range
+ } else {
+ // we are already over continouus range
+ // store start/last
+ if ((last_start == -1) && (last_stop == -1)) {
+ // 1st range, just store it
+ last_start = start;
+ last_stop = last;
+ start = t;
+ stop = t;
+ last_val = val;
+ } else {
+ // subsequent range, compare it with stored range
+ if (last_stop-last_start+1 > t-start+1) {
+ // stored range is still larger
+ } else {
+ // subsequent range is larger, keep this one
+ // if equal take as well this one (at lower threshold level)
+ last_start = start;
+ last_stop = last;
+ start = t;
+ stop = t;
+ last_val = val;
+ }
+ }
+ }
+ }
+ last = t;
+ } else {
+ stop = last;
+ }
+ } // end for(t)
+ if (!is_rej) {
+ stop = last;
+ }
+ KMO_TRY_CHECK_ERROR_STATE();
- KMO_TRY_EXIT_IF_NULL(
- pimg_sorted_cut = cpl_vector_get_data(img_sorted_cut));
+ // last comparison
+ if ((last_start == -1) && (last_stop == -1)) {
+ // 1st range, just store it
+ last_start = start;
+ last_stop = last;
+ } else {
+ // subsequent range, compare it with stored range
+ if (last_stop-last_start+1 > stop-start+1) {
+ // stored range is still larger
+ } else {
+ // subsequent range is larger, keep this one
+ // if equal take as well this one (at lower threshold level)
+ last_start = start;
+ last_stop = stop;
+ }
+ }
- if (nx*ny < KMOS_DETECTOR_SIZE*KMOS_DETECTOR_SIZE) {
- // this is only for test cases999
- // testing is done with small images (4x4 pixels)
- sampling_factor = 1;
- }
+ // this is our desired threshold
+ *t_pos = last_start+(last_stop-last_start)/2;
- // resample using median
- KMO_TRY_EXIT_IF_NULL(
- img_sorted_cut_short = cpl_vector_new(
- cpl_vector_get_size(img_sorted_cut) /
- sampling_factor));
+ thresh_final = kmclipm_vector_get(*t_level, *t_pos, &is_rej);
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ KMO_TRY_EXIT_IF_NULL(
+ pos = kmo_get_slitedges(midline, thresh_final));
+ //
+ // check for cut slitlets at beginning/end
+ // if both cut, reject pos-vector
+ //
+ double *ppos = NULL;
+ int cut_first = FALSE,
+ cut_last = FALSE,
+ size = kmclipm_vector_get_size(pos);
+ KMO_TRY_EXIT_IF_NULL(
+ ppos = cpl_vector_get_data(pos->data));
+
+ if (ppos[1]-ppos[0] < (KMOS_SLITLET_X+KMOS_GAP_WIDTH)/2) {
+ cut_first = TRUE;
+ }
+ if (ppos[size-1]-ppos[size-2] < (KMOS_SLITLET_X+KMOS_GAP_WIDTH)/2) {
+ cut_last = TRUE;
+ }
+ if (cut_first && cut_last) {
+ *t_pos = -1;
+ thresh_final = -1;
+ kmclipm_vector_delete(pos); pos = NULL;
+ kmclipm_vector_delete(*t_value); *t_value = NULL;
+ kmclipm_vector_delete(*t_level); *t_level = NULL;
+ }
+ } // end if (#rejected==size)
+ }
+ KMO_CATCH
+ {
+ KMO_CATCH_MSG();
+ kmclipm_vector_delete(pos); pos = NULL;
+ kmclipm_vector_delete(*t_value); *t_value = NULL;
+ kmclipm_vector_delete(*t_level); *t_level = NULL;
+ }
+
+ return pos;
+}
+
+/**
+ @brief
+ Advanced identification of slitlet-edges with thresholding.
+
+ @param midline The cut across the middle of the detector image.
+ @param thresh The threshold to apply.
+ @param cut_first (Output) FALSE if first edge belongs to slitlet,
+ TRUE otherwise
+ @param cut_last (Output) FALSE if first edge belongs to slitlet,
+ TRUE otherwise
+
+ @return
+ A vector containing the positions of the edges.
+
+ Unifies kmo_calc_thresh() and kmo_get_slitedges() for the case that with
+ standard processing the number of detected edges wasn't a multiple of 28.
+
+ Possible cpl_error_code set in this function:
+ @li CPL_ERROR_NULL_INPUT if @c midline is NULL.
+*/
+kmclipm_vector* kmo_analize_slitedges_advanced(kmclipm_vector *midline,
+ double thresh,
+ int *cut_first,
+ int *cut_last)
+{
+ kmclipm_vector *pos = NULL,
+ *km_slits = NULL,
+ *km_gaps = NULL;
+ cpl_vector *pos_valid = NULL,
+ *slits = NULL,
+ *gaps = NULL;
+ double *ppos = NULL,
+ stddev = 0.,
+ mean = 0.,
+ median_gaps = 0.,
+ median_slits = 0.,
+ mean_slits = 0.,
+ mean_gaps = 0.,
+ tmp_slit_val = 0.,
+ tmp_gap_val = 0.;
+ int size = 0,
+ size_slits = 0,
+ i = 0,
+ is_rej_slit = 0,
+ is_rej_gap = 0;
+
+ KMO_TRY
+ {
+ KMO_TRY_ASSURE((midline != NULL) &&
+ (cut_first != NULL) &&
+ (cut_last != NULL),
+ CPL_ERROR_NULL_INPUT,
+ "Not all input data is provided!");
+
+ *cut_first = FALSE;
+ *cut_last = FALSE;
+
+ //
+ // get edge positions
+ //
KMO_TRY_EXIT_IF_NULL(
- pimg_sorted_cut_short = cpl_vector_get_data(img_sorted_cut_short));
+ pos = kmo_get_slitedges(midline, thresh));
+ //
+ // check for cut slitlets at beginning/end (left and right side of detector)
+ // and reject them
+ //
KMO_TRY_EXIT_IF_NULL(
- tmp_vec = cpl_vector_new(sampling_factor));
+ ppos = cpl_vector_get_data(pos->data));
+ size = kmclipm_vector_get_size(pos);
+ if (ppos[1]-ppos[0] < (KMOS_SLITLET_X+KMOS_GAP_WIDTH)/2) {
+ *cut_first = TRUE;
+ kmclipm_vector_reject(pos, 0);
+ }
+ if (ppos[size-1]-ppos[size-2] < (KMOS_SLITLET_X+KMOS_GAP_WIDTH)/2) {
+ *cut_last = TRUE;
+ kmclipm_vector_reject(pos, size-1);
+ }
+
+ //
+ // get intermediate vectors with slit-widths and gap-widths
+ //
KMO_TRY_EXIT_IF_NULL(
- ptmp_vec = cpl_vector_get_data(tmp_vec));
+ pos_valid = kmclipm_vector_create_non_rejected(pos));
- k = 0;
- for (i = 0;
- i+sampling_factor-1 < cpl_vector_get_size(img_sorted_cut);
- i += sampling_factor)
- {
- for (j = 0; j < sampling_factor; j++){
- ptmp_vec[j]=pimg_sorted_cut[i+j];
+ if (cpl_vector_get_size(pos_valid) < 2*KMOS_SLITLET_Y) {
+ kmclipm_vector_delete(pos); pos = NULL;
+ }
+
+ if (pos != NULL) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_get_slit_gap(pos_valid, &slits, &gaps));
+
+ //
+ // calculate medians and averages on slits/gaps after rejection
+ //
+ KMO_TRY_EXIT_IF_NULL(
+ km_slits = kmclipm_vector_create(slits));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_reject_deviant(km_slits, DEF_POS_REJ_THRES, DEF_NEG_REJ_THRES, &stddev, &mean));
+ median_slits = kmclipm_vector_get_median(km_slits, KMCLIPM_ARITHMETIC);
+ mean_slits = kmclipm_vector_get_mean(km_slits);
+
+ // gaps is one shorter than slits, add one element at end and reject it
+ KMO_TRY_ASSURE(cpl_vector_get_size(slits) == cpl_vector_get_size(gaps)+1,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Number of slitlets should be equal number of gaps +1 (%d and %d)",
+ (int)cpl_vector_get_size(slits), (int)cpl_vector_get_size(gaps));
+ KMO_TRY_EXIT_IF_NULL(
+ km_gaps = kmclipm_vector_new(cpl_vector_get_size(slits)));
+ for (i = 0; i < cpl_vector_get_size(gaps); i++) {
+ kmclipm_vector_set(km_gaps, i, cpl_vector_get(gaps, i));
}
+ cpl_vector_delete(gaps); gaps = NULL;
+ kmclipm_vector_reject(km_gaps, kmclipm_vector_get_size(km_gaps)-1);
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_reject_deviant(km_gaps, DEF_POS_REJ_THRES, DEF_NEG_REJ_THRES, &stddev, &mean));
+ median_gaps = kmclipm_vector_get_median(km_gaps, KMCLIPM_ARITHMETIC);
+ mean_gaps = kmclipm_vector_get_mean(km_gaps);
- pimg_sorted_cut_short[k++] = cpl_vector_get_median(tmp_vec);
- }
+ KMO_TRY_CHECK_ERROR_STATE();
- // find max slope
- for (i = 0; i < cpl_vector_get_size(img_sorted_cut_short)-1; i++) {
- slope = pimg_sorted_cut_short[i+1]-pimg_sorted_cut_short[i];
- if (slope > max_slope) {
- max_slope = slope;
- max_pos = i;
+ //
+ // check if the sum of the medians of gaps and slitlets are
+ // in the range 16-20 (14+/-1 and 4+/-1)
+ //
+ if ((median_gaps+median_slits > KMOS_SLITLET_X+KMOS_GAP_WIDTH+2) ||
+ (median_gaps+median_slits < KMOS_SLITLET_X+KMOS_GAP_WIDTH-2))
+ {
+ // image too noisy --> arbitrary slitlet width and gap width
+ kmclipm_vector_delete(pos); pos = NULL;
}
}
- // get value at max_pos with steepest slope and return this value
- // (in kmo_calc_curvature() this value will be halved)
- thresh = pimg_sorted_cut_short[max_pos];
+ if (pos != NULL) {
+ KMO_TRY_ASSURE(kmclipm_vector_count_non_rejected(pos)%2 == 0,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "The number of detected edges should be modulo 2! But is %d",
+ kmclipm_vector_count_non_rejected(pos));
+ KMO_TRY_ASSURE(median_slits > (KMOS_SLITLET_X+KMOS_GAP_WIDTH)/2,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Median of slitwidth should be larger than %d!",
+ (KMOS_SLITLET_X+KMOS_GAP_WIDTH)/2);
+ KMO_TRY_ASSURE(median_gaps < (KMOS_SLITLET_X+KMOS_GAP_WIDTH)/2,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Median of gapwidth should be smaller than %d!",
+ (KMOS_SLITLET_X+KMOS_GAP_WIDTH)/2);
- // for preliminary badpix calculation take 10% of this value
- thresh *= 0.1;
+ //
+ // analyze slits, ensure: mean(slits)+1 > val> mean(slits)-1
+ // deviating values are rejected
+ //
+ size_slits = (size-(*cut_first)-(*cut_last))/2;
+ for (i = 0; i < size_slits; i++) {
+ tmp_slit_val = kmclipm_vector_get(km_slits, i, &is_rej_slit);
+ tmp_gap_val = kmclipm_vector_get(km_gaps, i, &is_rej_gap);
+
+ if (!is_rej_slit && !is_rej_gap) {
+ if (((mean_slits+slit_tol < tmp_slit_val) || (mean_slits-slit_tol > tmp_slit_val)) ||
+ ((mean_gaps+slit_tol < tmp_gap_val) || (mean_gaps-slit_tol > tmp_gap_val)))
+ {
+ kmclipm_vector_reject(pos, 2*i+(*cut_first));
+ kmclipm_vector_reject(pos, 2*i+(*cut_first)+1);
+ }
+ } else {
+ // gap vector can have less entries
+ if (!is_rej_slit) {
+ if ((mean_slits+slit_tol < tmp_slit_val) || (mean_slits-slit_tol > tmp_slit_val)) {
+ kmclipm_vector_reject(pos, 2*i+(*cut_first));
+ kmclipm_vector_reject(pos, 2*i+(*cut_first)+1);
+ }
+ }
- cpl_msg_debug(cpl_func,"Badpix thresh: %g", thresh);
+ if (!is_rej_gap) {
+ if ((mean_gaps+slit_tol < tmp_gap_val) || (mean_gaps-slit_tol > tmp_gap_val)) {
+ kmclipm_vector_reject(pos, 2*i+(*cut_first));
+ kmclipm_vector_reject(pos, 2*i+(*cut_first)+1);
+ }
+ }
+ }
+ }
+ }
+ }
+ KMO_CATCH
+ {
+ KMO_CATCH_MSG();
+ kmclipm_vector_delete(pos); pos = NULL;
+ }
- KMO_TRY_CHECK_ERROR_STATE();
+ cpl_vector_delete(pos_valid); pos_valid = NULL;
+ kmclipm_vector_delete(km_slits); km_slits = NULL;
+ kmclipm_vector_delete(km_gaps); km_gaps = NULL;
+ return pos;
+}
+
+cpl_array** kmo_analize_ifu_edges(kmclipm_vector *pos,
+ cpl_array *ifu_inactive,
+ int cut_first,
+ int cut_last,
+ int nx)
+{
+ int i = 0,
+ ind1 = 0,
+ ind2 = 0,
+ size = 0,
+ has_large_step = FALSE,
+ nr_ifu = 0,
+ ifu_width = 0,
+ estimated_ifu_width = 0,
+ ifu_center = 0,
+ invalidate_all = FALSE;
+ double mean_gap = 0.,
+ *ppos_valid = NULL,
+ *ppos_cut = NULL;
+ cpl_vector *pos_valid = NULL,
+ *pos_cut = NULL,
+ *gaps = NULL;
+ cpl_array **array = NULL;
+
+ KMO_TRY
+ {
+ // allocate array of cpl_arrays to return and initialize to zero
KMO_TRY_EXIT_IF_NULL(
- tmp_badpix = cpl_image_new(nx, ny, CPL_TYPE_FLOAT));
- KMO_TRY_EXIT_IF_NULL(
- ptmp_badpix = cpl_image_get_data_float(tmp_badpix));
+ array = (cpl_array**)cpl_malloc(KMOS_IFUS_PER_DETECTOR * sizeof(cpl_array*)));
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ array[i] = NULL;
+ }
+
+ if (pos == NULL) {
+ // invalidate all IFUs
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ if (cpl_array_get_int(ifu_inactive, i, NULL) == 0) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_array_set_int(ifu_inactive, i, 2));
+ }
+ }
+ KMO_TRY_CHECK_ERROR_STATE();
+ return array;
+ }
KMO_TRY_EXIT_IF_NULL(
- pdata = cpl_image_get_data_float_const(data));
+ pos_valid = kmclipm_vector_create_non_rejected(pos));
+ size = cpl_vector_get_size(pos_valid);
+ KMO_TRY_CHECK_ERROR_STATE();
- // set all pixels as bad where the value is smaller than the threshold
- // (only where the pixels are marked as good in dark_badpix)
- for (iy = 0; iy < ny; iy++) {
- for (ix = 0; ix < nx; ix++) {
- if (cpl_image_is_rejected(data, ix+1, iy+1) ||
- (pdata[ix+iy*nx] < thresh))
- {
- ptmp_badpix[ix+iy*nx] = 0.0;
- cpl_image_reject(tmp_badpix, ix+1, iy+1);
+ //
+ // check for cut slitlets (halfways cut or dropped of the detector)
+ // either completely out of zoom or shifted extremly left or right
+ //
+ if (kmo_validate_nr_edges(size, cut_first, cut_last)) {
+ // either one or two slitlets cut halfways
+ if (cut_first) {
+ // just first AND last slitlets are cut halfways
+ int fi = kmo_find_first_non_rejected(pos, TRUE);
+ for (i = fi; i < fi+26; i++) {
+ kmclipm_vector_reject(pos, i);
+ }
+ cut_first = FALSE;
+ }
+ if (cut_last) {
+ int fi = kmo_find_first_non_rejected(pos, FALSE);
+ for (i = fi; i > fi-26; i--) {
+ kmclipm_vector_reject(pos, i);
+ }
+ cut_last = FALSE;
+ }
+
+ cpl_vector_delete(pos_valid); pos_valid = NULL;
+ KMO_TRY_EXIT_IF_NULL(
+ pos_valid = kmclipm_vector_create_non_rejected(pos));
+ size = cpl_vector_get_size(pos_valid);
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ if (!kmo_validate_nr_edges(size, cut_first, cut_last)) {
+ cpl_msg_warning("","First and/or last slitlet had been cut off. "
+ "After omitting these slitlets, still an invalid "
+ "number of slitlets are counted (number of valid "
+ "edges found: %d edges)", size);
+ invalidate_all = TRUE;
+ }
+ } else {
+ KMO_TRY_EXIT_IF_NULL(
+ ppos_valid = cpl_vector_get_data(pos_valid));
+
+ if ((ppos_valid[0] < 25) && (ppos_valid[size-1] > nx-25)) {
+ // OUT OF ZOOM
+ cpl_msg_warning("","Out of zoom! At least one slitlet is completely off the "
+ "detector, can't detect on which side. So invalidating all "
+ "IFUs on this detector now (number of valid edges found: %d edges)", size);
+ invalidate_all = TRUE;
+ } else {
+ // BIG RIGHT/LEFT SHIFT
+ if (ppos_valid[0] > nx-ppos_valid[size-1]) {
+ // whole detector shifted to the right, omitting slitlets on right side
+ // until nr. slitlets is modulo 28
+ while(size%(2*KMOS_SLITLET_Y) != 0) {
+ int fi = kmo_find_first_non_rejected(pos, FALSE);
+ kmclipm_vector_reject(pos, fi);
+ size = kmclipm_vector_count_non_rejected(pos);
+ }
+ cut_first = FALSE;
+ cut_last = FALSE;
} else {
- ptmp_badpix[ix+iy*nx] = 1.0;
+ // whole detector shifted to the left, omitting slitlets on left side
+ // until nr. slitlets is modulo 28
+ while(size%(2*KMOS_SLITLET_Y) != 0) {
+ int fi = kmo_find_first_non_rejected(pos, TRUE);
+ kmclipm_vector_reject(pos, fi);
+ size = kmclipm_vector_count_non_rejected(pos);
+ }
+ cut_first = FALSE;
+ cut_last = FALSE;
+ }
+
+ cpl_vector_delete(pos_valid); pos_valid = NULL;
+ KMO_TRY_EXIT_IF_NULL(
+ pos_valid = kmclipm_vector_create_non_rejected(pos));
+ size = cpl_vector_get_size(pos_valid);
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ if (!kmo_validate_nr_edges(size, cut_first, cut_last)) {
+ cpl_msg_warning("","Slitlets have a large shift on detector, "
+ "some of them have been omitted. But still wrong "
+ "number of slitlets (number of valid edges found: %d edges)", size);
+ invalidate_all = TRUE;
}
}
}
- KMO_TRY_EXIT_IF_NULL(
- bad_pix_mask = cpl_image_duplicate(tmp_badpix));
- KMO_TRY_EXIT_IF_NULL(
- pbad_pix_mask = cpl_image_get_data_float(bad_pix_mask));
+ if (!invalidate_all) {
+ if (size < 2*KMOS_SLITLET_Y) {
+ // invalidate all IFUs (less than 28 valid edges)
+ invalidate_all = TRUE;
+ }
+ KMO_TRY_CHECK_ERROR_STATE();
+ }
- // set pixels as bad where at least the given number of surrounding
- // pixels are bad
- // and where it is either NaN, +/-Inf
- for (iy = 1; iy < ny - 1; iy++) {
- for (ix = 1; ix < nx - 1; ix++) {
- if ((8 - surrounding_pixels) >=
- (ptmp_badpix[ix-1+iy*nx] + ptmp_badpix[ix+1+iy*nx] +
- ptmp_badpix[ix-1+(iy-1)*nx] + ptmp_badpix[ix+(iy-1)*nx] +
- ptmp_badpix[ix+1+(iy-1)*nx] + ptmp_badpix[ix-1+(iy+1)*nx] +
- ptmp_badpix[ix+(iy+1)*nx] + ptmp_badpix[ix+1+(iy+1)*nx]))
- {
- pbad_pix_mask[ix+iy*nx] = 0.0;
- cpl_image_reject(bad_pix_mask, ix+1, iy+1);
+ if (invalidate_all) {
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ if (cpl_array_get_int(ifu_inactive, i, NULL) == 0) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_array_set_int(ifu_inactive, i, 2));
}
+ }
+ KMO_TRY_CHECK_ERROR_STATE();
+ cpl_vector_delete(pos_valid); pos_valid = NULL;
+ return array;
+ }
- // paranoia check
- if (kmclipm_is_nan_or_inf(pdata[ix+iy*nx])) {
- pbad_pix_mask[ix+iy*nx] = 0.0;
- cpl_image_reject(bad_pix_mask, ix+1, iy+1);
+ //
+ // check slitlet edges in packets of 28 for integrity
+ //
+ ind1 = 0;
+ ind2 = 2*KMOS_SLITLET_Y-1;
+ while (ind2 < cpl_vector_get_size(pos_valid))
+ {
+ KMO_TRY_EXIT_IF_NULL(
+ pos_cut = cpl_vector_extract(pos_valid, ind1, ind2, 1));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_get_slit_gap(pos_cut, NULL, &gaps));
+
+ // check if there is a large step in the gaps (e.g. from vignetting)
+ mean_gap = cpl_vector_get_mean(gaps);
+ for (i = 0; i < cpl_vector_get_size(gaps); i++) {
+ if ((mean_gap+slit_tol < cpl_vector_get(gaps, i)) || (mean_gap-slit_tol > cpl_vector_get(gaps, i))) {
+ has_large_step = ind1;
+ break;
}
}
+
+ if (!has_large_step) {
+ // check IFU width
+ ifu_width = (int)(cpl_vector_get(pos_cut, 2*KMOS_SLITLET_Y-1) -
+ cpl_vector_get(pos_cut, 0) + 1);
+ estimated_ifu_width = (int)rint(KMOS_SLITLET_Y*KMOS_SLITLET_X + (KMOS_SLITLET_Y-1)*KMOS_GAP_WIDTH); //248
+ if ((ifu_width > estimated_ifu_width+10) || (ifu_width < estimated_ifu_width-10)) {
+ KMO_TRY_ASSURE(1==0,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "HOUSTON, WE HAVE A PROBLEM! "
+ "(ifu width: estimated: %d, actual: %d)", estimated_ifu_width, ifu_width);
+ } else {
+ // check which IFU these edges belong to
+ ifu_center = cpl_vector_get(pos_cut, cpl_vector_get_size(pos_cut)/2);
+ if ((ifu_center >= 20) && (ifu_center <= 270)) {
+ nr_ifu = 1;
+ } else if((ifu_center >= 271) && (ifu_center <= 521)) {
+ nr_ifu = 2;
+ } else if((ifu_center >= 522) && (ifu_center <= 772)) {
+ nr_ifu = 3;
+ } else if((ifu_center >= 773) && (ifu_center <= 1023)) {
+ nr_ifu = 4;
+ } else if((ifu_center >= 1024) && (ifu_center <= 1274)) {
+ nr_ifu = 5;
+ } else if((ifu_center >= 1275) && (ifu_center <= 1525)) {
+ nr_ifu = 6;
+ } else if((ifu_center >= 1526) && (ifu_center <= 1776)) {
+ nr_ifu = 7;
+ } else if((ifu_center >= 1777) && (ifu_center <= 2027)) {
+ nr_ifu = 8;
+ } else {
+ KMO_TRY_ASSURE(1==0,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "HOUSTON, WE HAVE A PROBLEM! "
+ "(ifu-center not at expected position: %d)", ifu_center);
+ }
+
+ if (cpl_array_get_int(ifu_inactive, nr_ifu-1, NULL) == 1) {
+ // IFU has been set inactive. dismiss found edges and continue
+ } else {
+ // fill array
+ KMO_TRY_EXIT_IF_NULL(
+ array[nr_ifu-1] = cpl_array_new(2*KMOS_SLITLET_Y, CPL_TYPE_INT));
+ KMO_TRY_EXIT_IF_NULL(
+ ppos_cut = cpl_vector_get_data(pos_cut));
+ for (i = 0; i < 2*KMOS_SLITLET_Y; i++) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_array_set_int(array[nr_ifu-1], i, ppos_cut[i]));
+ }
+ }
+ }
+ } else {
+ KMO_TRY_ASSURE(1==0,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "HOUSTON, WE HAVE A PROBLEM! (large gap somwhere "
+ "between pixel %d and %d in x-direction)",
+ has_large_step, has_large_step+2*KMOS_SLITLET_Y);
+ }
+
+ cpl_vector_delete(pos_cut); pos_cut = NULL;
+ cpl_vector_delete(gaps); gaps = NULL;
+
+ ind1 += 2*KMOS_SLITLET_Y;
+ ind2 += 2*KMOS_SLITLET_Y;
}
}
KMO_CATCH
{
KMO_CATCH_MSG();
- cpl_image_delete(bad_pix_mask); bad_pix_mask = NULL;
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ cpl_array_delete(array[i]); array[i] = NULL;
+ }
+ cpl_free(array); array = NULL;
+ cpl_vector_delete(gaps); gaps = NULL;
+ cpl_vector_delete(pos_cut); pos_cut = NULL;
}
- cpl_image_delete(tmp_badpix); tmp_badpix = NULL;
- cpl_vector_delete(img_sorted); img_sorted = NULL;
- cpl_vector_delete(img_sorted_cut); img_sorted_cut = NULL;
- cpl_vector_delete(img_sorted_cut_short); img_sorted_cut_short = NULL;
- cpl_vector_delete(tmp_vec); tmp_vec = NULL;
+ cpl_vector_delete(pos_valid); pos_valid = NULL;
- return bad_pix_mask;
+ return array;
}
/**
@brief
- Calculate threshold for flat frame.
+ Checks if gaps are uniform (starting from left).
- @param thresh estimate The initial threshold estimate.
- @param midline The cut across the middle of the detector image.
+ @param pos The vector obtaining all edge positions
+ @param start The start index of 1st edge (slitlet, not gap)
@return
- A robust threshold value
+ TRUE or FALSE
- Taking a simple histogram of the @c midline isn't sufficient, since the
- detector image can be vignetted, therefore some of the slitlets can lie
- below the estimated threshold. <br>
- Here we additionally count the number of detected slitlets edges. If this
- number isn't a multiple of expected IFU-slitlet-edges, we lower the threshold
- and count again. At the end the most reasonable value is returned.
+ Unifies kmo_calc_thresh() and kmo_get_slitedges() for the case that with
+ standard processing the number of detected edges wasn't a multiple of 28.
Possible cpl_error_code set in this function:
-
@li CPL_ERROR_NULL_INPUT if @c midline is NULL.
*/
-double kmo_calc_thresh(double thresh_estimate, kmclipm_vector *midline)
-{
- int t_cnt = 20,
- start = 0,
- stop = 0,
- inrange = FALSE,
- last_start = 0,
- last_stop = 0,
- is_rej = 0,
- t = 0;
- double t_delta = 0.7*thresh_estimate/t_cnt,
- thresh_final = 0.0,
- median = 0.0,
- val = 0.0;
-
- kmclipm_vector *t_level = NULL,
- *t_value = NULL,
- *pos = NULL;
+cpl_error_code kmo_get_slit_gap(const cpl_vector *pos,
+ cpl_vector **slits,
+ cpl_vector **gaps)
+{
+ cpl_error_code ret = CPL_ERROR_NONE;
+ int size = 0,
+ i = 0,
+ j = 0;
+ double *pslits = NULL,
+ *pgaps = NULL;
+ const double *ppos = NULL;
KMO_TRY
{
- KMO_TRY_ASSURE(midline != NULL,
+ KMO_TRY_ASSURE(pos != NULL,
CPL_ERROR_NULL_INPUT,
- "Not all input data is provided!");
-
- // t_level: holds the threshold level
- // t_value: holds the detected number of edges
- t_level = kmclipm_vector_new(t_cnt);
- t_value = kmclipm_vector_new(t_cnt);
- for (t = 0; t < t_cnt; t++) {
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_vector_set(t_level, t, thresh_estimate));
+ "Not all input data is provided!");
- pos = kmo_get_slitedges(midline, thresh_estimate);
-//printf("est: %g, pos: %d\n", thresh_estimate, kmclipm_vector_get_size(pos));
- if (pos == NULL) {
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_vector_reject(t_value, t));
- cpl_error_reset();
- } else {
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_vector_set(t_value, t, kmclipm_vector_get_size(pos)));
- }
- kmclipm_vector_delete(pos); pos = NULL;
- KMO_TRY_CHECK_ERROR_STATE();
+ KMO_TRY_EXIT_IF_NULL(
+ ppos = cpl_vector_get_data_const(pos));
- thresh_estimate -= t_delta;
- }
- KMO_TRY_CHECK_ERROR_STATE();
+ size = cpl_vector_get_size(pos);
- // calculate median
- median = kmclipm_vector_get_median(t_value, KMCLIPM_STATISTICAL);
- KMO_TRY_CHECK_ERROR_STATE();
+ if (slits != NULL) {
+ KMO_TRY_EXIT_IF_NULL(
+ *slits = cpl_vector_new(size/2));
+ KMO_TRY_EXIT_IF_NULL(
+ pslits = cpl_vector_get_data(*slits));
+ }
+ if (gaps != NULL) {
+ KMO_TRY_EXIT_IF_NULL(
+ *gaps = cpl_vector_new(size/2-1));
+ KMO_TRY_EXIT_IF_NULL(
+ pgaps = cpl_vector_get_data(*gaps));
+ }
- // find the biggest range of values equal median,
- // there we take the middle position and calculate there the edge positions
- for (t = 0; t < t_cnt; t++) {
- val = kmclipm_vector_get(t_value, t, &is_rej);
- if (!is_rej) {
- if (fabs(val-median) < 0.0001) { /* val == median */
- if (inrange == FALSE) {
- start = t;
- inrange = TRUE;
- } else {
- stop = t;
- }
+ //
+ // fill slit- and gap-vector
+ //
+ for (i = 0; i <= size-2; i += 2) {
+ if (slits != NULL) {
+ pslits[j] = ppos[i+1]-ppos[i];
+ }
+ if (gaps != NULL) {
+ if (i+2 < size-1) {
+ pgaps[j] = ppos[i+2]-ppos[i+1];
} else {
- inrange = FALSE;
- if ((last_start!=0) && (last_stop!=0)) {
- // another range of this value
- if (stop-start > last_stop-last_start) {
- // new range longer than old one
- last_start = start;
- last_stop = stop;
- }
- } else {
- // first range of this value, check if there are other ranges
- last_start = start;
- last_stop = stop;
- }
+ // last entry can be ignored
+// kmclipm_vector_reject(*gaps, j);
}
}
+ j++;
}
- KMO_TRY_CHECK_ERROR_STATE();
-
- if (((last_start == 0) && (last_stop == 0)) ||
- (stop-start > last_stop-last_start))
- {
- last_start = start;
- last_stop = stop;
- }
-
- thresh_final = kmclipm_vector_get(t_level,
- last_start+(last_stop-last_start)/2,
- &is_rej);
- KMO_TRY_CHECK_ERROR_STATE();
-
- KMO_TRY_ASSURE(is_rej != 1,
- CPL_ERROR_ILLEGAL_OUTPUT,
- "The identified threshold for counting slitlet edges !"
- "has been marked as bad!");
}
KMO_CATCH
{
KMO_CATCH_MSG();
- thresh_final = -1.0;
+ ret = cpl_error_get_code();
+ if (slits != NULL) {
+ cpl_vector_delete(*slits); *slits = NULL;
+ }
+ if (gaps != NULL) {
+ cpl_vector_delete(*gaps); *gaps = NULL;
+ }
}
- kmclipm_vector_delete(t_level); t_level = NULL;
- kmclipm_vector_delete(t_value); t_value = NULL;
-
- return thresh_final;
+ return ret;
}
void kmo_count_pos_from_left(kmclipm_vector **pos, int *nr_slitedges,
@@ -662,87 +1187,97 @@ void kmo_count_pos_from_right(kmclipm_vector **pos, int *nr_slitedges,
@brief
Analyzes combined flat frames.
- @param data Image to be examined.
- @param badpix The peliminary flat badpixel mask.
- @param count_from_left (Output)
- 1: when leftmost slitlet is valid and
- not cutoff. It therefore can be used for
- counting through the IFUs.
- 0: when rightmost slitlet is valid and
- not cutoff. It therefore can be used for
- counting through the IFUs.
- -1: in case of error
- @param slitlet_count_index (Output)
- 0: default
- 1: when the leftmost and the rightmost slitlet
- are cut off a little bit the IFUs are still
- valid, but just the first and last slitlets
- are invalid
- -1: in case of error
+ @param data Image to be examined.
+ @param badpix The peliminary flat badpixel mask.
+ @param ifu_id The array containing the flags for activity or inactivity
+ of the IFUs (0: active, 1: inactive from ICS, 2: inactive
+ from DR pipeline).
+ Must be of size 8.
@return
- A vector containing the positions of all detected edges.
- A NULL pointer if no edge has been detected
+ An array of cpl_arrays. The array has size 8 (for each IFU).
+ Each cpl_array has size of 28, a value for each slitlet edge. Elements
+ of the cpl_array are set invalid if a slitlet is cut of.
+ If an IFU is deactivated the cpl_array is NULL.
+
+ First a line profile [midline] across the detector image is created (median
+ of the centre 40 pixels in y-direction).
+ Then a preliminary treshold is calculated applying ksigma-rejection. The threshold
+ is used to detect a rough estimate of the edge-positions.
+ Then the edge-profile is analized, assuming that the IFUs are constantly
+ illuminated and not cut-off. The number of edges is expected to be a multiple
+ of 28. If this is the case, the edge-positions are sorted into the array to
+ be returned.
+ If above expectation isn't met, the edge-positions are analyzed again under
+ the suspicion that slitlets have been cut of on the left/right side of the
+ detector or that vignetting occured (meaning that there are IFUs with less
+ than 28 edges).
+
+At most one slitlet can be cut off
+
- First a line profile across the detector image is created (median of the
- centre 40 pixels in y-direction). Then the treshold is calculated applying
- ksigma-rejection. The threshold is used to detect a rough estimate of the
- edges. The number of edges and the shape of the line profile give enough
- information to eliminate any cut-off slitlets or to indicate on which side
- of the detector any slitlets are missing (if any).
+The number of edges and the
+ shape of the line profile give enough information to eliminate any cut-off
+ slitlets or to indicate on which side of the detector any slitlets are missing (if any).
Possible cpl_error_code set in this function:
@li CPL_ERROR_NULL_INPUT if any of the input data is NULL.
@li CPL_ERROR_ILLEGAL_INPUT if any of the values is less than zero.
*/
-kmclipm_vector* kmo_analyze_flat(const cpl_image* data,
- const cpl_image* badpix,
- int *count_from_left,
- int *slitlet_count_index)
+cpl_array** kmo_analyze_flat(const cpl_image* data,
+ const cpl_image* badpix,
+ cpl_array *ifu_inactive)
{
- int ny = 0,
- lo = 0,
- hi = 0,
- tmp_int = 0,
- nr_slitedges = 0,
- pos_left = 0,
- pos_right = 0,
- i = 0,
- line_profile_height = 20,
- vignetting_pos = 0;
- double thresh = 0.0,
- tmp_stddev = 0.0,
- tmp_stderr = 0.0,
- *pmidline_cut = NULL;
- cpl_vector *tmp_vec = NULL;
- kmclipm_vector *midline = NULL,
- *midline_cut = NULL,
- *pos = NULL,
- *kv_tmp_vec = NULL;
- cpl_image *tmp_data = NULL;
- enum combine_status status = combine_ok;
+ int nx = 0,
+ ny = 0,
+ lo = 0,
+ hi = 0,
+ tmp_int = 0,
+ line_profile_height = 20,
+ dbg_pos = 0,
+ cut_first = FALSE,
+ cut_last = FALSE,
+ i = 0;
+ double thresh = 0.0,
+ tmp_stddev = 0.0,
+ tmp_stderr = 0.0;
+ kmclipm_vector *midline = NULL,
+ *pos = NULL,
+ *dbg_level = NULL,
+ *dbg_value = NULL;
+ cpl_image *tmp_data = NULL;
+ cpl_array **array = NULL;
+ enum combine_status status = combine_ok;
KMO_TRY
{
- KMO_TRY_ASSURE(data != NULL,
+ KMO_TRY_ASSURE((data != NULL) &&
+ (badpix != NULL) &&
+ (ifu_inactive != NULL),
CPL_ERROR_NULL_INPUT,
"Not all input data is provided!");
+ nx = cpl_image_get_size_x(data);
ny = cpl_image_get_size_y(data);
+ KMO_TRY_CHECK_ERROR_STATE();
+ //
// create horizontal line profile across middle of data frame
// (sum of rows 1004-1044)
- try_again:
- if (ny > 2*line_profile_height) {
- lo = ny / 2.0 - line_profile_height;
- hi = ny / 2.0 + line_profile_height;
- if (line_profile_height == 0) {
- lo = 0;
- hi = ny-1;
+ //
+ int ok = FALSE;
+ while (!ok) {
+ if (ny > 2*line_profile_height) {
+ lo = ny / 2.0 - line_profile_height;
+ hi = ny / 2.0 + line_profile_height;
+ if (line_profile_height == 0) {
+ lo = 0;
+ hi = ny-1;
+ }
+ ok = TRUE;
+ } else {
+ line_profile_height -= 10;
}
- } else {
- line_profile_height -= 10;
- goto try_again;
}
KMO_TRY_EXIT_IF_NULL(
@@ -752,259 +1287,105 @@ kmclipm_vector* kmo_analyze_flat(const cpl_image* data,
midline = kmo_create_line_profile(tmp_data, lo, hi));
cpl_image_delete(tmp_data); tmp_data = NULL;
- KMO_TRY_EXIT_IF_NULL(
- midline_cut = kmclipm_vector_extract(midline,
- KMOS_BADPIX_BORDER,
- kmclipm_vector_get_size(midline)-1-KMOS_BADPIX_BORDER));
- kmclipm_vector_delete(midline); midline = NULL;
-
- // calculate threshold for the midline
- thresh = kmclipm_combine_vector(midline_cut, NULL,
- "average", DEF_POS_REJ_THRES, DEF_NEG_REJ_THRES,
- DEF_ITERATIONS,
- DEF_NR_MAX_REJ,
- DEF_NR_MIN_REJ,
- &tmp_int, &tmp_stddev, &tmp_stderr,
- -1,
- &status);
+ //
+ // threshold calculation for edge profile across detector
+ //
+ // calculate preliminary threshold value of the profile
+ thresh = kmclipm_combine_vector(midline, NULL, "average",
+ DEF_POS_REJ_THRES, DEF_NEG_REJ_THRES,
+ DEF_ITERATIONS, DEF_NR_MAX_REJ, DEF_NR_MIN_REJ,
+ &tmp_int, &tmp_stddev, &tmp_stderr, -1, &status);
KMO_TRY_ASSURE(status == combine_ok,
CPL_ERROR_ILLEGAL_INPUT,
"No valid threshold could be calculated!");
-//printf("pre-thresh: %g\n", thresh);
- //// old method:
- //// subtract 25% of averaged value (in order to be able to detect
- //// vignetted IFUs)
- // thresh -= thresh*0.25;
-
- // new method:
- // check where is a continuous area of same slitlet edge amount,
- // in the middle of largest area take the thresh
- thresh = kmo_calc_thresh(thresh, midline_cut);
-//printf(">>>>> thresh: %g\n", thresh);
+ //
+ // get slitlet edges the standard way, assuming all slitlets are well shaped
+ //
+ pos = kmo_analize_slitedges(midline, thresh,
+ &dbg_value, &dbg_level, &dbg_pos);
KMO_TRY_CHECK_ERROR_STATE();
-//char *ddd = NULL;
-//ddd = cpl_sprintf("midline_cut_data_%d.fits", xxxdebugonce);
-//cpl_vector_save(midline_cut->data, ddd, CPL_BPP_IEEE_FLOAT, NULL,CPL_IO_DEFAULT);
-//cpl_free(ddd); ddd = NULL;
-//cpl_vector_save(midline_cut->mask, "midline_cut_mask.fits", CPL_BPP_IEEE_FLOAT, NULL,CPL_IO_DEFAULT);
- // get edge positions
- pos = kmo_get_slitedges(midline_cut, thresh);
- if (pos == NULL) {
- kmclipm_vector_delete(midline_cut); midline_cut = NULL;
- return NULL;
- }
-// else {
-//ddd = cpl_sprintf("pos_data_%d.fits", xxxdebugonce);
-//cpl_vector_save(pos->data, ddd, CPL_BPP_IEEE_FLOAT, NULL,CPL_IO_DEFAULT);
-//cpl_free(ddd); ddd = NULL;
-//cpl_vector_save(pos->mask, "pos_mask.fits", CPL_BPP_IEEE_FLOAT, NULL,CPL_IO_DEFAULT);
-// }
- nr_slitedges = kmclipm_vector_get_size(pos);
-//xxxdebugonce++;
-
- // add in again bad pixel border
- kmclipm_vector_add_scalar(pos, KMOS_BADPIX_BORDER);
-
- if ((nr_slitedges > 224) || (nr_slitedges < 14)) {
- line_profile_height -= 10;
- if (line_profile_height <= 10) {
- KMO_TRY_ASSURE(1 == 0,
- CPL_ERROR_ILLEGAL_INPUT,
- "Couldn't calculate a proper line profile "
- "across the detector (too strong rotation? "
- "data too noisy?). %d slitlet edges were "
- "detected, max. 224 (8 IFUs*14slitlets*2) "
- "are expected! (Threshold at %g)",
- nr_slitedges, thresh);
- }
- kmclipm_vector_delete(midline_cut); midline_cut = NULL;
- kmclipm_vector_delete(pos); pos = NULL;
- goto try_again;
- }
-//int ggg = kmclipm_vector_count_rejected(midline_cut);
-//if (ggg > 1) {
-// printf(">>> kmo_analyze_flat(): midline_cut has rejected values! (%d)", ggg);
-//}
-
- // check if there is any vignetting in the slitlets
- // this can be seen if in pos the difference of two neighbor values are bigger than 14
- // (we check here for values larger than 30)
- // can only detect one vignetted IFU with some slitlets above threshold,
- // if all slitlets are below threshold, it is anyway ignored
- for (i = 0; i< kmclipm_vector_get_size(pos)-1; i++) {
- double val_left = kmclipm_vector_get(pos, i, NULL);
- double val_right = kmclipm_vector_get(pos, i+1, NULL);
- if (val_right-val_left > 30) {
- // if one or more complete IFU are missing
- double diff = val_right-val_left;
- if ((fabs(diff-256) < 10) || // 1 IFU missing: 14*14+13*4+4+4 (gap at beginning and end), tolerance of 10pix
- (fabs(diff-508) < 10) || // 2 IFUs missing: 256+14*14+13*4+4 (gap at end), tolerance of 10pix
- (fabs(diff-760) < 10) || // 3 IFUs missing: 256+252+252
- (fabs(diff-1012) < 10) || // 4 IFUs missing: etc...
- (fabs(diff-1264) < 10) || // 5 IFUs missing
- (fabs(diff-1516) < 10)) // 6 IFUs missing
- {
- // do nothing, whole IFUs missing, no vignetting
- } else {
- if (vignetting_pos == 0) {
- vignetting_pos = i;
- } else {
- cpl_msg_warning("", "There seem to be several vignetted IFUs!");
- cpl_msg_warning("", "First at x=%d", vignetting_pos);
- cpl_msg_warning("", "Next at x=%d", i);
- }
- }
- }
- }
-//printf(">>>>>>>>>> Vignetting= %d\n", vignetting_pos);
- tmp_vec = kmclipm_vector_create_non_rejected(midline_cut);
- kmclipm_vector_delete(midline_cut); midline_cut = NULL;
- KMO_TRY_EXIT_IF_NULL(
- pmidline_cut = cpl_vector_get_data(tmp_vec));
-
- tmp_int = cpl_vector_get_size(tmp_vec)-1;
- switch (nr_slitedges) {
- // KMOS_IFUS_PER_DETECTOR*KMOS_SLITLET_Y*2 = 224
- // this is the number of slitlet edges we expect
-
- case 224:
- // All IFU slitlets are on the detector
- *count_from_left = TRUE;
- *slitlet_count_index = 0;
- break;
- case 223:
- if ((pmidline_cut[0] > thresh) ||
- (pmidline_cut[1] > thresh) ||
- (pmidline_cut[3] > thresh))
- {
- // the slitlet on the left is cut off (checking 3 pixels
- // because one pixel could be accidentially below thresh)
- // omit left slitlet
- KMO_TRY_EXIT_IF_NULL(
- kv_tmp_vec = kmclipm_vector_extract(pos, 1, nr_slitedges-1));
- kmclipm_vector_delete(pos); pos = NULL;
- pos = kv_tmp_vec;
- nr_slitedges--;
- *count_from_left = FALSE;
- *slitlet_count_index = 0;
- } else if ((pmidline_cut[tmp_int] > thresh) ||
- (pmidline_cut[tmp_int-1] > thresh) ||
- (pmidline_cut[tmp_int-2] > thresh))
- {
- // the slitlet on the right is cut off (checking 3 pixels
- // because one pixel could be accidentially below thresh)
- // omit right slitlet
- KMO_TRY_EXIT_IF_NULL(
- kv_tmp_vec = kmclipm_vector_extract(pos, 0, nr_slitedges-2));
+ if (pos != NULL) {
+ cpl_msg_severity msg_level = cpl_msg_get_level();
+ cpl_msg_set_level(CPL_MSG_OFF);
+ array = kmo_analize_ifu_edges(pos, ifu_inactive, FALSE, FALSE, nx);
+ cpl_msg_set_level(msg_level);
+ if (array == NULL) {
kmclipm_vector_delete(pos); pos = NULL;
- pos = kv_tmp_vec;
- nr_slitedges--;
- *count_from_left = TRUE;
- *slitlet_count_index = 0;
- } else {
- KMO_TRY_ASSURE(1 == 0,
- CPL_ERROR_ILLEGAL_INPUT,
- "The combined flat frame has %d slitlet edges, "
- "One edge is missing, which one? left/right?",
- nr_slitedges);
+ cpl_error_reset();
}
- break;
+ }
+ if (pos == NULL) {
+ // slitlets malformed, check for slit/gap-width etc, reject these edges
+ // threshold is halved
+ pos = kmo_analize_slitedges_advanced(midline, thresh/2, &cut_first, &cut_last);
+ KMO_TRY_CHECK_ERROR_STATE();
- case 222:
- // There are 222 slitlet edges
- if (((pmidline_cut[0] > thresh) ||
- (pmidline_cut[1] > thresh) ||
- (pmidline_cut[3] > thresh)) &&
- ((pmidline_cut[tmp_int] > thresh) ||
- (pmidline_cut[tmp_int-1] > thresh) ||
- (pmidline_cut[tmp_int-2] > thresh)))
- {
- // Left and right slitlet are cut a little bit
- // omit left and right slitlet
- KMO_TRY_EXIT_IF_NULL(
- kv_tmp_vec = kmclipm_vector_extract(pos, 1, nr_slitedges-2));
- kmclipm_vector_delete(pos); pos = NULL;
- pos = kv_tmp_vec;
- nr_slitedges -= 2;
- *count_from_left = TRUE;
- *slitlet_count_index = 1;
- break; // exit switch-clause
- }
- // 222 slitlet edges, left and right aren't cut off,
- // proceed in default-clause
- default:
- // Count from left and right how many pixels are below threshold.
- // The side with more pixels will be used as reference to assign
- // the slitlets to IFUs, the other side has some slitlets missing
-
- // come from left
- pos_left = 0;
- while (pmidline_cut[pos_left] < thresh) {
- pos_left++;
+ if (pos != NULL) {
+ cpl_msg_severity msg_level = cpl_msg_get_level();
+ cpl_msg_set_level(CPL_MSG_OFF);
+ array = kmo_analize_ifu_edges(pos, ifu_inactive, cut_first, cut_last, nx);
+ cpl_msg_set_level(msg_level);
+ if (array == NULL) {
+ kmclipm_vector_delete(pos); pos = NULL;
+ cpl_error_reset();
+ }
}
- // come from right
- i = tmp_int;
- pos_right = 0;
- while (pmidline_cut[i] < thresh) {
- pos_right++;
- i--;
- }
+ if (pos == NULL) {
+ // try again with threshold of 3/4
+ pos = kmo_analize_slitedges_advanced(midline, thresh*3./4., &cut_first, &cut_last);
+ KMO_TRY_CHECK_ERROR_STATE();
- // check if at least one position is larger than 5 pixels. This way
- // we are absolutely sure that this isn't just a gap which by
- // accident just lies at the border of our midline. In this
- // case we can't say on which side of the detecor slitlets are
- // missing
- if (((pos_left < 6) && (pos_right < 6)) ||
- (pos_left == pos_right)){
- KMO_TRY_ASSURE(1 == 0,
- CPL_ERROR_ILLEGAL_INPUT,
- "We have %d slitlet edges, there are slitlets "
- "off the detector and it can't be determined "
- "on which side they are missing!",
- nr_slitedges);
+ if (pos != NULL) {
+ array = kmo_analize_ifu_edges(pos, ifu_inactive, cut_first, cut_last, nx);
+ }
}
+ }
- if (pos_left > pos_right) {
- if ((vignetting_pos != 0) && (vignetting_pos < 4*14*2)) {
- // a IFU is vignetted at left side, count anyway from right side
- kmo_count_pos_from_right(&pos, &nr_slitedges, count_from_left, slitlet_count_index);
- } else {
- // frame shifted to the right, slitlets missing or cut off on right side
- kmo_count_pos_from_left(&pos, &nr_slitedges, count_from_left, slitlet_count_index);
+ if (array != NULL) {
+ // snyc array and ifu_inactive
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ if ((array[i] == NULL) &&
+ (cpl_array_get_int(ifu_inactive, i, NULL) == 0)) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_array_set_int(ifu_inactive, i, 2));
}
- } else {
- if ((vignetting_pos != 0) && (vignetting_pos > 4*14*2)) {
- // a IFU is vignetted at right side, count anyway from left side
- kmo_count_pos_from_left(&pos, &nr_slitedges, count_from_left, slitlet_count_index);
- } else {
- // frame shifted to the left, slitlets missing or cut off on left side
- kmo_count_pos_from_right(&pos, &nr_slitedges, count_from_left, slitlet_count_index);
+ if ((array[i] != NULL) &&
+ (cpl_array_get_int(ifu_inactive, i, NULL) == 1)) {
+ cpl_array_delete(array[i]); array[i] = NULL;
}
}
- break;
+ } else {
+ // couldn't detect any edges, deactivate all IFUs if this hasn't be done already
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ if (cpl_array_get_int(ifu_inactive, i, NULL) == 0) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_array_set_int(ifu_inactive, i, 2));
+ }
+ }
+ KMO_TRY_EXIT_IF_NULL(
+ array = (cpl_array**)cpl_malloc(KMOS_IFUS_PER_DETECTOR * sizeof(cpl_array*)));
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ array[i] = NULL;
+ }
}
-
-KMO_TRY_ASSURE(nr_slitedges % 2 == 0,
- CPL_ERROR_ILLEGAL_OUTPUT,
- "Grrrrrrr! nr_slitedges should be even!!!");
+ KMO_TRY_CHECK_ERROR_STATE();
}
KMO_CATCH
{
KMO_CATCH_MSG();
kmclipm_vector_delete(pos); pos = NULL;
- *count_from_left = -1;
- *slitlet_count_index = -1;
}
- kmclipm_vector_delete(midline_cut); midline_cut = NULL;
- cpl_vector_delete(tmp_vec); tmp_vec = NULL;
+ kmclipm_vector_delete(midline); midline = NULL;
+ kmclipm_vector_delete(dbg_level); dbg_level = NULL;
+ kmclipm_vector_delete(dbg_value); dbg_value = NULL;
+ kmclipm_vector_delete(pos); pos = NULL;
- return pos;
+ return array;
}
/**
@@ -1021,7 +1402,7 @@ KMO_TRY_ASSURE(nr_slitedges % 2 == 0,
1: for inactive IFUs (from ICS)
2: for inactive IFUs (from KMOS pipeline)
@param badpixel_mask The corresponding preliminary bad pixel
- mask, created with @li kmo_create_bad_pix_flat().
+ mask, created with @li kmo_create_bad_pix_flat_thresh().
@param detector_nr The detector number the frames belong to.
@param slitlet_ids (Output) The IDs of the fitted edges and their
corresponding IFUs
@@ -1093,10 +1474,9 @@ cpl_error_code kmo_calc_edgepars(const cpl_image *combined_data,
// edge positions
//
KMO_TRY_EXIT_IF_NULL(
- pos = kmos_get_valid_edge_pos(combined_data,
- badpixel_mask,
- ifu_inactive,
- detector_nr));
+ pos = kmo_analyze_flat(combined_data,
+ badpixel_mask,
+ ifu_inactive));
// check if at least one IFU is active, if yes: proceed
for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
@@ -1260,13 +1640,13 @@ kmclipm_vector *dummyyrow = kmclipm_vector_create(cut_yrow);
// don't display error here, will be catched afterwards
// KMO_CATCH_MSG();
ret_error = cpl_error_get_code();
- if (edgepars != NULL) {
+ if ((edgepars != NULL) && (*edgepars != NULL)) {
for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
cpl_matrix_delete((*edgepars)[i]); (*edgepars)[i] = NULL;
}
cpl_free(*edgepars); *edgepars = NULL;
}
- if (slitlet_ids != NULL) {
+ if ((slitlet_ids != NULL) && (*slitlet_ids != NULL)) {
for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
cpl_vector_delete((*slitlet_ids)[i]); (*slitlet_ids)[i] = NULL;
}
@@ -1307,11 +1687,11 @@ kmclipm_vector *dummyyrow = kmclipm_vector_create(cut_yrow);
1: for inactive IFUs (from ICS)
2: for inactive IFUs (from KMOS pipeline)
@param badpixel_mask (Input) The corresponding preliminary bad pixel
- mask, created with @li kmo_create_bad_pix_flat().
+ mask, created with @li kmo_create_bad_pix_flat_thresh().
(Output) The final updated badpixel mask.
@param detector_nr The detector number the frames belong to.
@param badpix_thresh The threshold used for badpixel calculation in
- @li kmo_create_bad_pix_flat().
+ @li kmo_create_bad_pix_flat_thresh().
@param xcal (Output) The x calibration frame. Because of the
orientation of the IFUs xcal and ycal are ordered
individually on these two frames, they can be
@@ -1725,279 +2105,6 @@ cpl_error_code kmo_normalize_slitlet(cpl_vector *data,
/**
@brief
- Validates found edge positions regarding IFU activity defined in the
- header keywords.
-
- It is assumed that if an IFUs is identified as valid, there will be 24
- edges, except for the last IFU (count_from_left == 1) or for the first IFU
- (count_from_left == 0) where some slitlets can be cut off.
-
-
- @param data The combined flatfield frame.
- @param badpix The preliminary flat badpixel frame.
- @param ifu_id The array containing the flags for activity or inactivity
- of the IFUs (0: active, 1: inactive from ICS, 2: inactive
- from DR pipeline).
- Must be of size 8.
- @param det_nr The detector idetifier.
-
- @return
- An array of cpl_arrays. The array has size 8 (for each IFU).
- Each cpl_array has size of 28, a value for each slitlet edge. Elements
- of the cpl_array are set invalid if a slitlet is cut of.
- If an IFU is deactivated the cpl_array is NULL.
-
- This function is used in kmo_calc_spec_curv().
-
- Possible cpl_error_code set in this function:
-
- @li CPL_ERROR_NULL_INPUT if any input data is NULL.
- @li CPL_ERROR_ILLEGAL_INPUT if @c isn't of size 8.
-*/
-cpl_array** kmos_get_valid_edge_pos(const cpl_image* data,
- const cpl_image* badpix,
- cpl_array *ifu_id,
- int det_nr)
-{
- int count_from_left = 0,
- count_index = 0,
- ifu_delta = 235,
- ifu_start = ifu_delta,
- cnt_pos = 0,
- i = 0, j = 0, tmp_int = 0;
- const int *pifu_id = NULL;
- kmclipm_vector *pos = NULL;
- cpl_vector *tmp_pos = NULL;
- double *ppos = NULL,
- mindiff = 210,
- maxdiff = 290;
- cpl_array **ret = NULL;
-
- KMO_TRY
- {
- KMO_TRY_ASSURE((data != NULL) &&
- (badpix != NULL) &&
- (ifu_id != NULL),
- CPL_ERROR_NULL_INPUT,
- "Not all input data is provided!");
-
- KMO_TRY_ASSURE(cpl_array_get_size(ifu_id) == KMOS_IFUS_PER_DETECTOR,
- CPL_ERROR_ILLEGAL_INPUT,
- "Array 'ifu_id' must be of size 8!");
-
- // allocate array of cpl_arrays to return and initialize to zero
- KMO_TRY_EXIT_IF_NULL(
- ret = (cpl_array**)cpl_malloc(KMOS_IFUS_PER_DETECTOR *
- sizeof(cpl_array*)));
- for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
- ret[i] = NULL;
- }
-
- // extract edges at midline
- pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index);
- if (pos == NULL) {
- // invalidate all IFUs
- for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
- KMO_TRY_EXIT_IF_ERROR(
- cpl_array_set_int(ifu_id, i, 2));
- }
- KMO_TRY_CHECK_ERROR_STATE();
- return ret;
- }
- KMO_TRY_CHECK_ERROR_STATE();
-
- // check if extracted edges match the ifu_id-array
- // if not: remove any pos-values if IFU is marked inactive and mark
- // any active IFU as inactive if there are no pos-values
- KMO_TRY_EXIT_IF_NULL(
- tmp_pos = kmclipm_vector_create_non_rejected(pos));
- KMO_TRY_EXIT_IF_NULL(
- ppos = cpl_vector_get_data(tmp_pos));
-
- KMO_TRY_EXIT_IF_NULL(
- pifu_id = cpl_array_get_data_int_const(ifu_id));
-
- if (count_from_left == 1) {
- ifu_start = ifu_delta;
- cnt_pos = 0;
- } else {
- ifu_start = KMOS_DETECTOR_SIZE - ifu_delta;
- cnt_pos = cpl_vector_get_size(tmp_pos)-1;
- }
- for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
- if (count_from_left == 1) {
- // count from left
- if (pifu_id[i] == 0) {
- // IFU is marked active, check if it really is active
- // check if according pos-values are present
- if ((cnt_pos >= cpl_vector_get_size(tmp_pos)) ||
- (ppos[cnt_pos] > ifu_start))
- {
- // edge positions missing for this IFU, set it inactive
- KMO_TRY_EXIT_IF_ERROR(
- cpl_array_set_int(ifu_id, i, 2));
- cpl_msg_warning(cpl_func,
- "IFU %d is valid according to header "
- "keywords, but no slitlets have been "
- "found: deactivate IFU now.",
- (det_nr-1)*KMOS_IFUS_PER_DETECTOR + i+1);
- } else {
- // all right, create cpl_array fill in slitlet edges
- KMO_TRY_EXIT_IF_NULL(
- ret[i] = cpl_array_new(2*KMOS_SLITLET_Y,
- CPL_TYPE_INT));
- int j = 0;
- if (count_index == 1) {
- // special case that first and last slitlet
- // are cut off, invalidate 1st & 2nd
- // cpl_array-elements (1st & 2nd edge)
- KMO_TRY_EXIT_IF_ERROR(
- cpl_array_set_invalid(ret[i], 0));
- KMO_TRY_EXIT_IF_ERROR(
- cpl_array_set_invalid(ret[i], 1));
- j = 2;
- count_index = 0;
- }
- for (; j < 2*KMOS_SLITLET_Y; j++) {
- if (cnt_pos < cpl_vector_get_size(tmp_pos)) {
- // valid edge copy to cpl_array
- KMO_TRY_EXIT_IF_ERROR(
- cpl_array_set_int(ret[i], j, ppos[cnt_pos++]));
- } else {
- // we reached the detector border, slitlets are
- // cut off, invalidate according cpl_array-elements
- KMO_TRY_EXIT_IF_ERROR(
- cpl_array_set_invalid(ret[i], j));
- }
- }
-
- // check if difference of start and end value is between 210 and 290
- // (normally 244, theoretically 14*14+13*4=248)
- double diff = cpl_array_get(ret[i], 2*KMOS_SLITLET_Y-1, &tmp_int) -
- cpl_array_get(ret[i], 0, &tmp_int);
- if ((diff < mindiff) || (diff > maxdiff)) {
- // edge positions wrong for this IFU, set it inactive
- if (cpl_array_get_int(ifu_id, i, &tmp_int) == 0) {
- KMO_TRY_EXIT_IF_ERROR(
- cpl_array_set_int(ifu_id, i, 2));
- cpl_msg_warning(cpl_func,
- "IFU %d is valid according to header "
- "keywords, but no slitlets have been "
- "found: deactivate IFU now.",
- (det_nr-1)*KMOS_IFUS_PER_DETECTOR + i+1);
- cpl_array_delete(ret[i]); ret[i] = NULL;
- } else if (cpl_array_get_int(ifu_id, i, &tmp_int) == 1) {
- cpl_array_delete(ret[i]); ret[i] = NULL;
- }
- }
- }
- } else {
- if ((cnt_pos >= cpl_vector_get_size(tmp_pos)) ||
- (ppos[cnt_pos] < ifu_start))
- {
- cnt_pos += KMOS_SLITLET_Y *2;
- cpl_msg_warning(cpl_func,
- "IFU %d is invalid according to "
- "header keywords, but edges have been"
- " found: omit these slitlets anyway.",
- (det_nr-1)*KMOS_IFUS_PER_DETECTOR + i+1);
- }
- }
- ifu_start += ifu_delta;
- } else {
- // count from right
- if (pifu_id[KMOS_IFUS_PER_DETECTOR-1-i] == 0) {
- // IFU is marked active, check if it really is active
- // check if according pos-values are present
-
- if ((cnt_pos < 0) || (ppos[cnt_pos] < ifu_start)) {
- // edge positions missing for this IFU, set it inactive
- KMO_TRY_EXIT_IF_ERROR(
- cpl_array_set_int(ifu_id, KMOS_IFUS_PER_DETECTOR-1-i, 2));
- cpl_msg_warning(cpl_func,
- "IFU %d is valid according to header "
- "keywords, but no slitlets have been "
- "found: deactivate IFU now.",
- (det_nr-1)*KMOS_IFUS_PER_DETECTOR + KMOS_IFUS_PER_DETECTOR-i);
- } else {
- // all right, create cpl_array fill in slitlet edges
- KMO_TRY_EXIT_IF_NULL(
- ret[KMOS_IFUS_PER_DETECTOR-1-i] = cpl_array_new(2*KMOS_SLITLET_Y,
- CPL_TYPE_INT));
-
- for (j = 2*KMOS_SLITLET_Y-1; j >= 0; j--) {
- if (cnt_pos >= 0) {
- // valid edge copy to cpl_array
- KMO_TRY_EXIT_IF_ERROR(
- cpl_array_set_int(ret[KMOS_IFUS_PER_DETECTOR-1-i], j, ppos[cnt_pos--]));
- } else {
- // we reached the detector border, slitlets are
- // cut off, invalidate according cpl_array-elements
- KMO_TRY_EXIT_IF_ERROR(
- cpl_array_set_invalid(ret[KMOS_IFUS_PER_DETECTOR-1-i], j));
- }
- }
-
- // check if difference of start and end value is between 210 and 290
- // (normally 244, theoretically 14*14+13*4=248)
- double leftpos = cpl_array_get(ret[KMOS_IFUS_PER_DETECTOR-1-i], 2*KMOS_SLITLET_Y-1, &tmp_int);
- double rightpos = cpl_array_get(ret[KMOS_IFUS_PER_DETECTOR-1-i], 0, &tmp_int);
- double diff = leftpos - rightpos;
- if ((diff < mindiff) || (diff > maxdiff)) {
- // edge positions wrong for this IFU, set it inactive
- if (cpl_array_get_int(ifu_id, KMOS_IFUS_PER_DETECTOR-1-i, &tmp_int) == 0) {
- KMO_TRY_EXIT_IF_ERROR(
- cpl_array_set_int(ifu_id, KMOS_IFUS_PER_DETECTOR-1-i, 2));
- cpl_msg_warning(cpl_func,
- "IFU %d is valid according to header "
- "keywords, but no slitlets have been "
- "found: deactivate IFU now.",
- (det_nr-1)*KMOS_IFUS_PER_DETECTOR + KMOS_IFUS_PER_DETECTOR-i);
- cpl_array_delete(ret[KMOS_IFUS_PER_DETECTOR-1-i]);
- ret[KMOS_IFUS_PER_DETECTOR-1-i] = NULL;
- } else if (cpl_array_get_int(ifu_id, KMOS_IFUS_PER_DETECTOR-1-i, &tmp_int) == 1) {
- cpl_array_delete(ret[KMOS_IFUS_PER_DETECTOR-1-i]);
- ret[KMOS_IFUS_PER_DETECTOR-1-i] = NULL;
- }
- }
-
- }
- } else {
- if ((cnt_pos < 0) || (ppos[cnt_pos] > ifu_start)) {
- cnt_pos -= KMOS_SLITLET_Y *2;
- cpl_msg_warning(cpl_func,
- "IFU %d is invalid according to "
- "header keywords, but edges have been"
- " found: omit these slitlets anyway.",
- (det_nr-1)*KMOS_IFUS_PER_DETECTOR + KMOS_IFUS_PER_DETECTOR-i);
- }
- }
- ifu_start -= ifu_delta;
- }
- }
- }
- KMO_CATCH
- {
- KMO_CATCH_MSG();
- if (ret != NULL) {
- for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
- cpl_array_delete(ret[i]); ret[i] = NULL;
- }
- cpl_free(ret); ret = NULL;
- }
- }
-
- cpl_vector_delete(tmp_pos); tmp_pos = NULL;
- kmclipm_vector_delete(pos); pos = NULL;
-
- return ret;
-}
-
-/**
- @brief
Iterative fitting of a polynomial with rejection
@param x The x data to fit.
@@ -3445,7 +3552,6 @@ cpl_table** kmo_edgepars_to_table(cpl_vector **slitlet_ids,
return tbl;
}
-/*erwdoc*/
/**
@brief
Detect outlyers in the polynomial coefficients and correct by setting them back to a fit
@@ -4156,7 +4262,7 @@ int* kmo_split_frame(const cpl_image *xcal)
@li CPL_ERROR_ILLEGAL_INPUT if @c threshold is <= 0.
*/
kmclipm_vector* kmo_get_slitedges(const kmclipm_vector *midline,
- double threshold)
+ double threshold)
{
kmclipm_vector *pos = NULL,
*pos_final = NULL,
@@ -4170,7 +4276,8 @@ kmclipm_vector* kmo_get_slitedges(const kmclipm_vector *midline,
j = 0,
i = 0,
nr_max_edges = 500,
- tmp_int = 0;
+ tmp_int = 0,
+ no_msg = FALSE;
KMO_TRY
{
@@ -4182,6 +4289,7 @@ kmclipm_vector* kmo_get_slitedges(const kmclipm_vector *midline,
if (fabs(threshold) < 0.001) {
return NULL;
}
+
// test if all IFUs are deactivated (image uniform noise)
// problem: a valid threshold is provided and lots of edges will be
// found
@@ -4203,10 +4311,7 @@ kmclipm_vector* kmo_get_slitedges(const kmclipm_vector *midline,
KMO_TRY_EXIT_IF_NULL(
pmidline_copy = cpl_vector_get_data(midline_copy->data));
-//int ggg = kmclipm_vector_count_rejected(midline_copy);
-//if (ggg > 1) {
-// printf(">>> kmo_get_slitedges(): midline_copy has rejected values! (%d)", ggg);
-//}
+
KMO_TRY_EXIT_IF_NULL(
pos = kmclipm_vector_new(nr_max_edges));
@@ -4218,16 +4323,17 @@ kmclipm_vector* kmo_get_slitedges(const kmclipm_vector *midline,
// check if midline is below or above threshold at the very beginning
// --> does the line begin with an ascending or descending edge?
- if (pmidline_copy[0] <= threshold) {
+ if (pmidline_copy[KMOS_BADPIX_BORDER] <= threshold) {
side = 0;
} else {
side = 1;
}
// extract edges
- last_pos = 0;
+ last_pos = KMOS_BADPIX_BORDER;
j = 0;
- while (kmclipm_vector_get_max(midline_copy, NULL) > threshold)
+ while ((kmclipm_vector_get_max(midline_copy, NULL) > threshold) &&
+ (i < nx-KMOS_BADPIX_BORDER))
{
if (!side) {
// left ramp (ascending)
@@ -4251,7 +4357,7 @@ kmclipm_vector* kmo_get_slitedges(const kmclipm_vector *midline,
}
}
- if (i >= nx) {
+ if (i >= nx-KMOS_BADPIX_BORDER) {
ppos[j] = -1;
break;
}
@@ -4266,10 +4372,9 @@ kmclipm_vector* kmo_get_slitedges(const kmclipm_vector *midline,
j++;
if (j == nr_max_edges) {
- KMO_TRY_ASSURE(1 == 0,
- CPL_ERROR_ILLEGAL_INPUT,
- "Data seems to be to noisy! "
- "Detected to much edges!");
+ cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT);
+ no_msg = TRUE;
+ KMO_TRY_CHECK_ERROR_STATE();
}
}
@@ -4283,7 +4388,9 @@ kmclipm_vector* kmo_get_slitedges(const kmclipm_vector *midline,
}
KMO_CATCH
{
- KMO_CATCH_MSG();
+ if (!no_msg) {
+ KMO_CATCH_MSG();
+ }
kmclipm_vector_delete(pos_final); pos_final = NULL;
}
@@ -4350,9 +4457,15 @@ kmclipm_vector* kmo_create_line_profile(const cpl_image* data,
for (j = lo; j <= hi; j++) {
kmclipm_vector_set(tmp_vec, k++, pdata[i+j*nx]);
}
- kmclipm_vector_set(profile, i,
- kmclipm_vector_get_median(tmp_vec,
- KMCLIPM_ARITHMETIC));
+
+ if ((i < KMOS_BADPIX_BORDER) || (i >= nx-KMOS_BADPIX_BORDER)) {
+ // set bad pixel border to 0
+ kmclipm_vector_set(profile, i, 0);
+ kmclipm_vector_reject(profile, i);
+ } else {
+ kmclipm_vector_set(profile, i,
+ kmclipm_vector_get_median(tmp_vec, KMCLIPM_ARITHMETIC));
+ }
KMO_TRY_CHECK_ERROR_STATE();
}
}
diff --git a/kmos/kmo_priv_flat.h b/kmos/kmo_priv_flat.h
index 1cf1e3f..5f9a4ed 100644
--- a/kmos/kmo_priv_flat.h
+++ b/kmos/kmo_priv_flat.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_flat.h,v 1.6 2013/07/29 18:06:56 aagudo Exp $
+/* $Id: kmo_priv_flat.h,v 1.9 2013-10-10 11:14:39 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/07/29 18:06:56 $
- * $Revision: 1.6 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-10 11:14:39 $
+ * $Revision: 1.9 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_FLAT_H
@@ -35,28 +35,53 @@
#include <cpl.h>
#include "kmclipm_vector.h"
-//extern int xxxdebugonce;
+extern double slit_tol;
+
/*------------------------------------------------------------------------------
* Prototypes
*----------------------------------------------------------------------------*/
-cpl_image* kmo_create_bad_pix_flat_thresh(const cpl_image* data,
+cpl_image* kmo_create_bad_pix_flat_thresh(
+ const cpl_image* data,
int surrounding_pixels,
int badpix_thresh);
-// deprecated
-cpl_image* kmo_create_bad_pix_flat(const cpl_image* data,
- int surrounding_pixels);
+int kmo_find_first_non_rejected(
+ const kmclipm_vector *vec,
+ int from_left);
+
+int kmo_validate_nr_edges(
+ int nr_edges,
+ int cut_left,
+ int cut_right);
+
+kmclipm_vector* kmo_analize_slitedges(
+ const kmclipm_vector *midline,
+ double thresh_estimate,
+ kmclipm_vector **t_value,
+ kmclipm_vector **t_level,
+ int *t_pos);
-double kmo_calc_thresh(
+kmclipm_vector* kmo_analize_slitedges_advanced(
+ kmclipm_vector *midline,
double thresh_estimate,
- kmclipm_vector *midline);
+ int *cut_first,
+ int *cut_last);
-kmclipm_vector* kmo_analyze_flat(
+cpl_array** kmo_analize_ifu_edges(kmclipm_vector *pos,
+ cpl_array *ifu_inactive,
+ int cut_first,
+ int cut_last,
+ int nx);
+
+cpl_error_code kmo_get_slit_gap(const cpl_vector *pos,
+ cpl_vector **slits,
+ cpl_vector **gaps);
+
+cpl_array** kmo_analyze_flat(
const cpl_image* data,
const cpl_image* badpix,
- int *count_from_left,
- int *count_index);
+ cpl_array *ifu_inactive);
cpl_error_code kmo_calc_edgepars(
const cpl_image *combined_data,
@@ -82,13 +107,8 @@ cpl_error_code kmo_calc_curvature(
double *slitmaxdev,
cpl_table ***edgepars);
-cpl_array** kmos_get_valid_edge_pos(
- const cpl_image* data,
- const cpl_image* badpix,
- cpl_array *id,
- int det_nr);
-
-cpl_vector* kmo_polyfit_edge(const kmclipm_vector *x,
+cpl_vector* kmo_polyfit_edge(
+ const kmclipm_vector *x,
const kmclipm_vector *y,
int fit_order);
@@ -109,7 +129,8 @@ cpl_error_code kmo_calc_calib_frames(
cpl_image *xcal,
cpl_image *ycal);
-cpl_error_code kmo_normalize_slitlet(cpl_vector *data,
+cpl_error_code kmo_normalize_slitlet(
+ cpl_vector *data,
int start_index,
int end_index);
diff --git a/kmos/kmo_priv_functions.c b/kmos/kmo_priv_functions.c
index 6c328bd..eba8e96 100644
--- a/kmos/kmo_priv_functions.c
+++ b/kmos/kmo_priv_functions.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_functions.c,v 1.15 2013/08/02 08:21:41 aagudo Exp $
+/* $Id: kmo_priv_functions.c,v 1.16 2013-08-09 09:01:21 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/02 08:21:41 $
- * $Revision: 1.15 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-08-09 09:01:21 $
+ * $Revision: 1.16 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -2144,111 +2144,6 @@ cpl_error_code kmo_check_frame_setup_sampling(cpl_frameset *frameset)
return ret_error;
}
-///**
-//@brief
-// Checks rotator-angles for cal-files.
-
-//Since this check has been dropped in kmo_priv_compare_frame_setup() this
-//function has been added.
-
-//@param frameset The frameset
-//@param frame_type1 The type of the 1st frame to examine (e.g. FLAT)
-//@param frame_type2 The type of the 2nd frame to examine (e.g. DARK)
-
-//@return error code
-//Possible cpl_error_code set in this function:
-// CPL_ERROR_ILLEGAL_INPUT if any of the keywords don't match.
-// CPL_ERROR_NULL_INPUT if @code frameset or @code frame_type is empty
-//*/
-//cpl_error_code kmo_check_cal_frames_rotangle(cpl_frameset *frameset,
-// const char *frame_type1,
-// const char *frame_type2)
-//{
-// cpl_error_code ret_error = CPL_ERROR_NONE;
-
-// cpl_frame *frame1 = NULL,
-// *frame2 = NULL;
-
-// double tmp_dbl1 = 0.0,
-// tmp_dbl2 = 0.0,
-// rot_tol = 0.5;
-
-// char *keyword = NULL;
-
-// cpl_propertylist *main_header1 = NULL,
-// *main_header2 = NULL;
-
-// KMO_TRY
-// {
-// KMO_TRY_ASSURE((frameset != NULL) &&
-// (frame_type1 != NULL) &&
-// (frame_type2 != NULL),
-// CPL_ERROR_NULL_INPUT,
-// "Not all input data is provided!");
-
-// // get frames
-// KMO_TRY_EXIT_IF_NULL(
-// frame1 = kmo_dfs_get_frame(frameset, frame_type1));
-
-// KMO_TRY_EXIT_IF_NULL(
-// frame2 = kmo_dfs_get_frame(frameset, frame_type2));
-
-// // get headers
-// main_header1 = kmclipm_propertylist_load(cpl_frame_get_filename(frame1), 0);
-// if (cpl_error_get_code() != CPL_ERROR_NONE) {
-// cpl_msg_error("","File not found: %s!",
-// cpl_frame_get_filename(frame1));
-// KMO_TRY_CHECK_ERROR_STATE();
-// }
-
-// main_header2 = kmclipm_propertylist_load(cpl_frame_get_filename(frame2), 0);
-// if (cpl_error_get_code() != CPL_ERROR_NONE) {
-// cpl_msg_error("","File not found: %s!",
-// cpl_frame_get_filename(frame2));
-// KMO_TRY_CHECK_ERROR_STATE();
-// }
-
-// // compare rotator offset
-// KMO_TRY_EXIT_IF_NULL(
-// keyword = cpl_sprintf("%s", ROTANGLE));
-// tmp_dbl1 = cpl_propertylist_get_double(main_header1, keyword);
-// if (cpl_error_get_code() != CPL_ERROR_NONE) {
-// KMO_TRY_ASSURE(1 == 0,
-// CPL_ERROR_ILLEGAL_INPUT,
-// "keyword \n%s\n of frame %s is missing!",
-// keyword, frame_type1);
-// }
-
-// tmp_dbl2 = cpl_propertylist_get_double(main_header2, keyword);
-// if (cpl_error_get_code() != CPL_ERROR_NONE) {
-// KMO_TRY_ASSURE(1 == 0,
-// CPL_ERROR_ILLEGAL_INPUT,
-// "keyword \n%s\n of frame %s is missing!",
-// keyword, frame_type2);
-// }
-// cpl_free(keyword); keyword = NULL;
-
-// // strip angles below 0 deg and above 360 deg
-// kmclipm_strip_angle(&tmp_dbl1);
-// kmclipm_strip_angle(&tmp_dbl2);
-
-// KMO_TRY_ASSURE(fabs(tmp_dbl1 - tmp_dbl2) <= rot_tol,
-// CPL_ERROR_ILLEGAL_INPUT,
-// "Rotation of frames %s and %s don't match!",
-// frame_type1, frame_type2);
-// }
-// KMO_CATCH
-// {
-// KMO_CATCH_MSG();
-// ret_error = cpl_error_get_code();
-// }
-
-// cpl_propertylist_delete(main_header1); main_header1 = NULL;
-// cpl_propertylist_delete(main_header2); main_header2 = NULL;
-
-// return ret_error;
-//}
-
/**
@brief
Tweak loading of TELLURIC vector
diff --git a/kmos/kmo_priv_functions.h b/kmos/kmo_priv_functions.h
index d927bd2..cad2281 100644
--- a/kmos/kmo_priv_functions.h
+++ b/kmos/kmo_priv_functions.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_functions.h,v 1.10 2013/08/02 08:22:30 aagudo Exp $
+/* $Id: kmo_priv_functions.h,v 1.11 2013-08-09 09:01:20 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/02 08:22:30 $
- * $Revision: 1.10 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-08-09 09:01:20 $
+ * $Revision: 1.11 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_FUNCTIONS_H
@@ -129,11 +129,6 @@ const char* kmo_get_pro_keyword_val(
cpl_error_code kmo_check_frame_setup_sampling(
cpl_frameset *frameset);
-//cpl_error_code kmo_check_cal_frames_rotangle(
-// cpl_frameset *frameset,
-// const char *frame_type1,
-// const char *frame_type2);
-
kmclipm_vector* kmo_tweak_load_telluric(cpl_frameset *frameset,
int ifu_nr,
int is_noise,
diff --git a/kmos/kmo_priv_lcorr.c b/kmos/kmo_priv_lcorr.c
index 9a269c5..70cefb3 100644
--- a/kmos/kmo_priv_lcorr.c
+++ b/kmos/kmo_priv_lcorr.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_lcorr.c,v 1.15 2013/08/02 08:15:49 aagudo Exp $
+/* $Id: kmo_priv_lcorr.c,v 1.16 2013-09-16 13:40:02 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/02 08:15:49 $
- * $Revision: 1.15 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-09-16 13:40:02 $
+ * $Revision: 1.16 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -80,7 +80,7 @@ int print_info_once_oh_ref = TRUE;
cpl_polynomial *kmo_lcorr_get(const cpl_imagelist *cube,
const cpl_propertylist *header,
const cpl_frame *ref_spectrum_frame,
- gridDefinition gd,
+ const gridDefinition gd,
const char *filter_id,
int ifu_id)
{
diff --git a/kmos/kmo_priv_lcorr.h b/kmos/kmo_priv_lcorr.h
index a8d1dad..5696472 100644
--- a/kmos/kmo_priv_lcorr.h
+++ b/kmos/kmo_priv_lcorr.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_lcorr.h,v 1.7 2013/08/02 08:15:49 aagudo Exp $
+/* $Id: kmo_priv_lcorr.h,v 1.8 2013-09-16 13:40:02 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/02 08:15:49 $
- * $Revision: 1.7 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-09-16 13:40:02 $
+ * $Revision: 1.8 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_LCORR_H
@@ -47,7 +47,7 @@ extern int print_info_once_oh_ref;
cpl_polynomial *kmo_lcorr_get(const cpl_imagelist *cube,
const cpl_propertylist *header,
const cpl_frame *ref_spectrum_frame,
- gridDefinition gd,
+ const gridDefinition gd,
const char *filter_id,
int ifu_id);
diff --git a/kmos/kmo_priv_make_image.c b/kmos/kmo_priv_make_image.c
index 9a59b6e..3f3f685 100644
--- a/kmos/kmo_priv_make_image.c
+++ b/kmos/kmo_priv_make_image.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_make_image.c,v 1.1.1.1 2012/01/18 09:31:59 yjung Exp $
+/* $Id: kmo_priv_make_image.c,v 1.1.1.1 2012-01-18 09:31:59 yjung Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2012/01/18 09:31:59 $
+ * $Date: 2012-01-18 09:31:59 $
* $Revision: 1.1.1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/kmo_priv_make_image.h b/kmos/kmo_priv_make_image.h
index b5d9e58..17558ec 100644
--- a/kmos/kmo_priv_make_image.h
+++ b/kmos/kmo_priv_make_image.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_make_image.h,v 1.1.1.1 2012/01/18 09:31:59 yjung Exp $
+/* $Id: kmo_priv_make_image.h,v 1.1.1.1 2012-01-18 09:31:59 yjung Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2012/01/18 09:31:59 $
+ * $Date: 2012-01-18 09:31:59 $
* $Revision: 1.1.1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_MAKE_IMAGE_H
diff --git a/kmos/kmo_priv_multi_reconstruct.c b/kmos/kmo_priv_multi_reconstruct.c
index 796cb99..9c74988 100644
--- a/kmos/kmo_priv_multi_reconstruct.c
+++ b/kmos/kmo_priv_multi_reconstruct.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_multi_reconstruct.c,v 1.28 2013/08/02 09:38:57 aagudo Exp $
+/* $Id: kmo_priv_multi_reconstruct.c,v 1.31 2013-09-17 12:12:36 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/02 09:38:57 $
- * $Revision: 1.28 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-09-17 12:12:36 $
+ * $Revision: 1.31 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -45,18 +45,23 @@
#endif
#include <cpl.h>
+
#include "kmclipm_constants.h"
+#include "kmclipm_math.h"
#include "kmclipm_functions.h"
+#include "kmclipm_priv_reconstruct.h"
+#include "kmo_priv_reconstruct.h"
+#include "kmo_priv_multi_reconstruct.h"
+#include "kmo_functions.h"
+#include "kmo_priv_functions.h"
#include "kmo_dfs.h"
#include "kmo_error.h"
-#include "kmo_functions.h"
-#include "kmo_priv_multi_reconstruct.h"
+
#include "kmo_priv_fit_profile.h"
#include "kmo_priv_shift.h"
#include "kmo_priv_noise_map.h"
-
/*----------------------------------------------------------------------------*/
/**
@defgroup kmos_priv_multi_reconstruct Helper functions for recipe kmo_multi_reconstruct.
@@ -76,124 +81,57 @@ double kmo_mr_get_rot_angle(cpl_frame *frame)
KMO_TRY
{
KMO_TRY_EXIT_IF_NULL(
- header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
+ header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
KMO_TRY_EXIT_IF_ERROR(
- rot_angle = cpl_propertylist_get_double(header, ROTANGLE));
- cpl_propertylist_delete(header);
+ rot_angle = cpl_propertylist_get_double(header, ROTANGLE));
+
kmclipm_strip_angle(&rot_angle);
- }KMO_CATCH
- {
+ } KMO_CATCH {
KMO_CATCH_MSG();
}
+
+ cpl_propertylist_delete(header); header = NULL;
+
return rot_angle;
}
-///**
-//
-//*/
-//cpl_frame* kmo_mr_get_closest_cal_frame(cpl_frameset *frameset,
-// const char *category,
-// const double rot_angle)
-//{
-// cpl_frame *best_match = NULL;
-// cpl_propertylist *header;
-// cpl_frame *frame;
-// double angle;
-// double min;
-// double test;
-// double rot_angle_dup = rot_angle;
-//
-// KMO_TRY
-// {
-// min = 360.;
-// KMO_TRY_EXIT_IF_NULL(
-// frame = cpl_frameset_find(frameset, category));
-//
-// do {
-// KMO_TRY_EXIT_IF_NULL(
-// header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
-// angle = cpl_propertylist_get_double(header, ROTANGLE);
-// KMO_TRY_CHECK_ERROR_STATE();
-// kmclipm_strip_angle(&angle);
-// kmclipm_strip_angle(&rot_angle_dup);
-// test = abs(angle-rot_angle_dup);
-// if (min > test) {
-// min = test;
-// best_match = frame;
-// }
-// test = abs(angle-rot_angle_dup+360.);
-// if (min > test) {
-// min = test;
-// best_match = frame;
-// }
-// } while ((frame = cpl_frameset_find(frameset,NULL)) != NULL);
-//
-// }KMO_CATCH
-// {
-// KMO_CATCH_MSG();
-// }
-// if (header != NULL) {cpl_propertylist_delete(header);}
-// return best_match;
-//}
-
/**
*/
-cpl_error_code kmo_mr_create_datacubes (
- cpl_frameset *frameset,
- cpl_frameset *exposures,
- int *ifus,
- const char *imethod,
- double neighborhoodRange,
- cpl_imagelist ***dataCubeListPtr,
- double pix_scale)
+cpl_imagelist** kmo_mr_create_datacubes(armNameStruct *arm_name_struct,
+ int arm_id,
+ cpl_frameset *frameset,
+ const gridDefinition gd,
+ int xcal_interpolation)
{
- cpl_error_code error= CPL_ERROR_NONE;
- cpl_imagelist *cube_data = NULL,
- *cube_noise = NULL,
- **data_cube_list = NULL;
- cpl_frame *exposure_frame = NULL,
- *xcal_frame = NULL,
- *ycal_frame = NULL,
- *lcal_frame = NULL;
- cpl_image *lcal = NULL;
- cpl_propertylist *xcal_header = NULL,
- *tmp_header = NULL;
- cpl_table *band_table = NULL;
- int ifu_nr,
- *bounds = NULL,
- flux = 0,
- background = 0,
- nr_exposures;
- const char *input_frame_name = OBJECT,
- *filter_id = NULL,
- *filter_keyword = "ESO INS FILT1 ID";
- gridDefinition gd;
+ cpl_imagelist *cube_data = NULL,
+ *cube_noise = NULL,
+ **ret_cube_list = NULL;
+ cpl_frame *xcal_frame = NULL,
+ *ycal_frame = NULL,
+ *lcal_frame = NULL;
+ cpl_propertylist *main_header = NULL;
+ int ix = 0,
+ iy = 0,
+ ifu_nr = 0,
+ nr_frames = 0,
+ cnt = 0,
+ *bounds = NULL;
KMO_TRY
{
-// sat_mode_msg = TRUE;
- nr_exposures = cpl_frameset_get_size(exposures);
+ //
+ // check inputs
+ //
+ KMO_TRY_ASSURE((frameset != NULL) ||
+ (arm_name_struct != NULL),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Some inputs are NULL!");
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale));
- KMO_TRY_EXIT_IF_NULL(
- lcal = kmo_dfs_load_image(frameset, LCAL, 1, FALSE, FALSE, NULL));
- KMO_TRY_EXIT_IF_NULL(
- tmp_header = kmo_dfs_load_primary_header(frameset, LCAL));
- KMO_TRY_EXIT_IF_NULL(
- band_table = kmo_dfs_load_table(frameset, WAVE_BAND, 1, 0));
- KMO_TRY_EXIT_IF_NULL(
- filter_id = cpl_propertylist_get_string(tmp_header, filter_keyword));
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_setup_grid_band_lcal(&gd, lcal, filter_id, 0, band_table));
- cpl_image_delete(lcal); lcal = NULL;
- cpl_propertylist_delete(tmp_header);
- cpl_table_delete(band_table); band_table = NULL;
+ nr_frames = arm_name_struct->namesCnt[arm_id-1];
KMO_TRY_EXIT_IF_NULL(
- data_cube_list = cpl_malloc(nr_exposures * sizeof(cpl_imagelist*)));
-
+ ret_cube_list = cpl_calloc(nr_frames, sizeof(cpl_imagelist*)));
KMO_TRY_EXIT_IF_NULL(
xcal_frame = kmo_dfs_get_frame(frameset, XCAL));
@@ -202,103 +140,323 @@ cpl_error_code kmo_mr_create_datacubes (
KMO_TRY_EXIT_IF_NULL(
lcal_frame = kmo_dfs_get_frame(frameset, LCAL));
+ // get left and right bounds of IFUs
KMO_TRY_EXIT_IF_NULL(
- xcal_header = kmclipm_propertylist_load(cpl_frame_get_filename(xcal_frame), 0));
+ main_header = kmo_dfs_load_primary_header(frameset, XCAL));
KMO_TRY_EXIT_IF_NULL(
- bounds = kmclipm_extract_bounds(xcal_header));
- cpl_propertylist_delete(xcal_header);
+ bounds = kmclipm_extract_bounds(main_header));
+ cpl_propertylist_delete(main_header); main_header = NULL;
+
+ for (iy = 0; iy < arm_name_struct->size; iy++) {
+ for (ix = 0; ix < KMOS_NR_IFUS; ix++) {
+ ifu_nr = ix+1;
+ if (arm_name_struct->name_ids[ix+iy*KMOS_NR_IFUS] == arm_id) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_reconstruct_sci(ifu_nr,
+ bounds[2*(ifu_nr-1)],
+ bounds[2*(ifu_nr-1)+1],
+ arm_name_struct->obj_sky_struct->table[iy].objFrame,
+ SCIENCE,
+ NULL,
+ NULL,
+ NULL,
+ xcal_frame,
+ ycal_frame,
+ lcal_frame,
+ NULL,
+ &gd,
+ &cube_data,
+ &cube_noise,
+ FALSE,
+ FALSE,
+ xcal_interpolation));
+
+ ret_cube_list[cnt] = cube_data;
+ cpl_imagelist_delete(cube_noise); cube_noise = NULL;
+ cnt++;
+ }
+ } // for (ix)
+ } // for (iy)
+ } KMO_CATCH {
+ KMO_CATCH_MSG();
+ cnt = 0;
+ for (cnt = 0; cnt < nr_frames; cnt++) {
+ cpl_imagelist_delete(ret_cube_list[cnt]); ret_cube_list[cnt] = NULL;
+ }
+ cpl_free(ret_cube_list); ret_cube_list = NULL;
+ }
- int i = 0;
- for (i = 0; i < nr_exposures; i++) {
- ifu_nr = ifus[i];
+ cpl_free(bounds); bounds = NULL;
-#if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(6, 3, 0)
- KMO_TRY_EXIT_IF_NULL(
- exposure_frame = cpl_frameset_get_position(exposures, i));
-#else
- KMO_TRY_EXIT_IF_NULL(
- exposure_frame = cpl_frameset_get_frame(exposures, i));
-#endif
- KMO_TRY_EXIT_IF_ERROR(
- kmo_reconstruct_sci(ifu_nr,
- bounds[2*(ifu_nr-1)],
- bounds[2*(ifu_nr-1)+1],
- exposure_frame,
- input_frame_name,
- NULL,
- NULL,
- NULL,
- xcal_frame,
- ycal_frame,
- lcal_frame,
- NULL,
- &gd,
- &cube_data,
- &cube_noise,
- flux,
- background,
- 0));
- cpl_imagelist_delete(cube_noise);
- cpl_free(bounds);
- data_cube_list[i] = cube_data;
- }
+ return ret_cube_list;
+}
+
+/**
- *dataCubeListPtr = data_cube_list;
+*/
+cpl_propertylist** kmo_mr_get_headers(armNameStruct *arm_name_struct,
+ int arm_id,
+ cpl_frameset *frameset,
+ const gridDefinition gd)
+{
+ int ix = 0,
+ iy = 0,
+ cnt = 0,
+ ifu_nr = 0,
+ det_nr = 0,
+ nr_frames = 0;
+ cpl_propertylist *main_header = 0,
+ **ret_sub_headers = NULL;
+ const char *fn_obj = NULL;
+ KMO_TRY
+ {
+ //
+ // check inputs
+ //
+ KMO_TRY_ASSURE((frameset != NULL) ||
+ (arm_name_struct != NULL),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Some inputs are NULL!");
+
+ nr_frames = arm_name_struct->namesCnt[arm_id-1];
+
+ KMO_TRY_EXIT_IF_NULL(
+ ret_sub_headers = cpl_calloc(nr_frames, sizeof(cpl_propertylist*)));
+
+ //
+ // extract sub-headers for each exposures, calculate WCS
+ //
+ for (iy = 0; iy < arm_name_struct->size; iy++) {
+ KMO_TRY_EXIT_IF_NULL(
+ fn_obj = cpl_frame_get_filename(arm_name_struct->obj_sky_struct->table[iy].objFrame));
+ KMO_TRY_EXIT_IF_NULL(
+ main_header = kmclipm_propertylist_load(fn_obj, 0));
+
+ for (ix = 0; ix < KMOS_NR_IFUS; ix++) {
+ ifu_nr = ix + 1;
+ det_nr = (ifu_nr - 1)/KMOS_IFUS_PER_DETECTOR + 1;
+
+ if (arm_name_struct->name_ids[ix+iy*KMOS_NR_IFUS] == arm_id) {
+ KMO_TRY_EXIT_IF_NULL(
+ ret_sub_headers[cnt] = kmclipm_propertylist_load(fn_obj, det_nr));
+
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_update_property_int(ret_sub_headers[cnt],
+ NAXIS, 3, "number of data axes"));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_update_property_int(ret_sub_headers[cnt],
+ NAXIS1, gd.x.dim, "length of data axis 1"));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_update_property_int(ret_sub_headers[cnt],
+ NAXIS2, gd.y.dim, "length of data axis 2"));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_update_property_int(ret_sub_headers[cnt],
+ NAXIS3, gd.l.dim, "length of data axis 3"));
+
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_calc_wcs_gd(main_header, ret_sub_headers[cnt], ifu_nr, gd));
+
+ cnt++;
+ }
+ } // for (ix)
+ cpl_propertylist_delete(main_header); main_header = NULL;
+ } // for (iy)
} KMO_CATCH {
KMO_CATCH_MSG();
- error = cpl_error_get_code();
+ cnt = 0;
+ for (cnt = 0; cnt < nr_frames; cnt++) {
+ cpl_propertylist_delete(ret_sub_headers[cnt]); ret_sub_headers[cnt] = NULL;
+ }
+ cpl_free(ret_sub_headers); ret_sub_headers = NULL;
}
-// sat_mode_msg = FALSE;
-
- return error;
+ return ret_sub_headers;
}
-/**
+/**
+ @brief
+ Calculate shift offsets for all objects.
+
+ @param arm_name_struct
+ @param nr_science_frames
+ @param gd
+ @param method Shift method (none, center, header, file)
+ @param imethod
+ @param neighborhoodRange
+ @param filename Filename for user-defined shifts
+ @param frameset
+ @param fmethod
+ @param cmethod
+ @param cpos_rej
+ @param cneg_rej
+ @param citer
+ @param cmin
+ @param cmax
+ @param unused_ifus
+ @param pix_scale
+ @param no_subtract
+ @param user_defined_ifu
+ @param dev_cal
+ @param xshifts (Output) Has to be deallocated again
+ @param yshifts (Output) Has to be deallocated again
+
+ @return
+ a three dimensional array ([x][y][z] as defined in the grid definition) of neighbor lists
+
+ Possible cpl_error_code set in this function:
+
+ @li CPL_ERROR_NULL_INPUT if @c sampleList or is NULL.
+ @li CPL_ERROR_ILLEGAL_INPUT if the size of @c vec and @c index_vec isn't
+ the same or if @c nr_min or @c nr_max are
+ negative.
*/
-cpl_error_code kmo_mr_get_offsets (
- const int nr_exposures,
- const char *smethod,
- const char *imethod,
- double neighborhoodRange,
- const char *filename,
- cpl_frameset *frameset,
- cpl_frameset *exposures,
- int *ifus,
- const cpl_propertylist **header_data,
- const char *fmethod,
- const char *cmethod,
- double cpos_rej,
- double cneg_rej,
- int citer,
- int cmin,
- int cmax,
- double pix_scale,
- double *xshifts,
- double *yshifts)
+cpl_error_code kmo_mr_get_offsets(armNameStruct *arm_name_struct,
+ int arm_id,
+ const char *method,
+ const char *imethod,
+ const char *filename,
+ cpl_frameset *frameset,
+ cpl_imagelist **data_cube_list,
+ cpl_propertylist **sub_headers,
+ const char *fmethod,
+ const char *cmethod,
+ double cpos_rej,
+ double cneg_rej,
+ int citer,
+ int cmin,
+ int cmax,
+ int dev_cal,
+ char *mapping_mode,
+ double **xshifts,
+ double **yshifts)
{
- cpl_error_code error= CPL_ERROR_NONE;
- double *pxshifts = NULL,
- *pyshifts = NULL,
- xref,
- yref;
- cpl_matrix *phys_ref = NULL,
- *world = NULL,
- *phys = NULL;
- cpl_wcs *wcs_ref = NULL,
- *wcs = NULL;
- cpl_array *status = NULL;
- cpl_bivector *shifts = NULL;
- cpl_vector *identified = NULL,
- *fit_pars = NULL;
- cpl_imagelist **data_cube_list = NULL;
- cpl_image *tmp_img = NULL,
- *tmp_img2 = NULL;
+ cpl_error_code error = CPL_ERROR_NONE;
+ double *pxshifts = NULL,
+ *pyshifts = NULL,
+ xref = 0.,
+ yref = 0.,
+ cd1_1 = 0.0,
+ cd1_2 = 0.0,
+ ang1 = 0.0,
+ ang2 = 0.0;
+ int ix = 0,
+ iy = 0,
+ ifu_nr = 0,
+ nr_frames = 0,
+ cnt = 0,
+ *exposure_ifus = NULL;
+ const char **exposure_filename = NULL;
+ const char *fn_obj = NULL;
+ cpl_matrix *phys_ref = NULL,
+ *world = NULL,
+ *phys = NULL;
+ cpl_wcs *wcs_ref = NULL,
+ *wcs = NULL;
+ cpl_array *status = NULL;
+ cpl_bivector *shifts = NULL;
+ cpl_vector *identified = NULL,
+ *fit_pars = NULL;
+ cpl_image *tmp_img = NULL,
+ *tmp_img2 = NULL;
KMO_TRY
{
- if (strcmp(smethod, "header") == 0) {
+ //
+ // check inputs
+ //
+ KMO_TRY_ASSURE((xshifts != NULL) ||
+ (yshifts != NULL) ||
+ (method != NULL) ||
+ (imethod != NULL) ||
+ (frameset != NULL) ||
+ (arm_name_struct != NULL) ||
+ (fmethod != NULL) ||
+ (cmethod != NULL) ||
+ (xshifts != NULL) ||
+ (yshifts != NULL) ||
+ (sub_headers != NULL),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Some inputs are NULL!");
+
+ nr_frames = arm_name_struct->namesCnt[arm_id-1];
+
+ //
+ // allocate arrays
+ //
+ KMO_TRY_EXIT_IF_NULL(
+ *xshifts = cpl_calloc(nr_frames, sizeof(double)));
+ KMO_TRY_EXIT_IF_NULL(
+ *yshifts = cpl_calloc(nr_frames, sizeof(double)));
+ KMO_TRY_EXIT_IF_NULL(
+ exposure_filename = cpl_calloc(nr_frames, sizeof(char *)));
+ KMO_TRY_EXIT_IF_NULL(
+ exposure_ifus = cpl_calloc(nr_frames, sizeof(int)));
+
+ //
+ // extract sub-headers for each exposures, calculate WCS
+ //
+ for (iy = 0; iy < arm_name_struct->size; iy++) {
+ KMO_TRY_EXIT_IF_NULL(
+ fn_obj = cpl_frame_get_filename(arm_name_struct->obj_sky_struct->table[iy].objFrame));
+
+ for (ix = 0; ix < KMOS_NR_IFUS; ix++) {
+ ifu_nr = ix + 1;
+
+ if (arm_name_struct->name_ids[ix+iy*KMOS_NR_IFUS] == arm_id) {
+ exposure_ifus[cnt] = ifu_nr;
+ KMO_TRY_EXIT_IF_NULL(
+ exposure_filename[cnt] = fn_obj);
+
+ cnt++;
+ }
+ } // for (ix)
+ } // for (iy)
+
+ //
+ // check rotation angle
+ //
+ if (dev_cal == FALSE) {
+ cd1_1 = kmo_dfs_get_property_double(sub_headers[0], CD1_1);
+ cd1_2 = kmo_dfs_get_property_double(sub_headers[0], CD1_2);
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ ang1 = atan(cd1_2/cd1_1)*180/CPL_MATH_PI;
+
+ for (cnt = 1; cnt < nr_frames; cnt++) {
+ cd1_1 = kmo_dfs_get_property_double(sub_headers[cnt], CD1_1);
+ cd1_2 = kmo_dfs_get_property_double(sub_headers[cnt], CD1_2);
+ KMO_TRY_CHECK_ERROR_STATE();
+ ang2 = atan(cd1_2/cd1_1)*180/CPL_MATH_PI;
+
+ if (strcmp(method, "none") != 0) {
+ // center, header, user
+ KMO_TRY_ASSURE(fabs(ang1-ang2) <= 0.5,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Orientation of IFU %d in %s (%.1fdeg) "
+ "and IFU %d in %s (%.1fdeg) differ! "
+ "Align the orientation of this cube with "
+ "kmo_rotate before applying this recipe.",
+ exposure_ifus[0], exposure_filename[0], ang1,
+ exposure_ifus[cnt], exposure_filename[cnt], ang2);
+ } else {
+ // none
+ if (fabs(ang1-ang2) > 0.5) {
+ cpl_msg_warning("",
+ "Orientation of IFU %d in %s (%.1fdeg) "
+ "and IFU %d in %s (%.1fdeg) differ! "
+ "Processing anyway.",
+ exposure_ifus[0], exposure_filename[0], ang1,
+ exposure_ifus[cnt], exposure_filename[cnt], ang2);
+ }
+ }
+ }
+ }
+
+ //
+ // some preliminaries on shift vectors
+ //
+ if (strcmp(method, "header") == 0) {
// fill shift vector
phys_ref = cpl_matrix_new (1, 3);
cpl_matrix_set(phys_ref, 0, 0, 1); // lower left corner
@@ -306,35 +464,32 @@ cpl_error_code kmo_mr_get_offsets (
cpl_matrix_set(phys_ref, 0, 2, 1);
KMO_TRY_EXIT_IF_NULL(
- wcs_ref =
- cpl_wcs_new_from_propertylist(header_data[0]));
+ wcs_ref = cpl_wcs_new_from_propertylist(sub_headers[0]));
KMO_TRY_EXIT_IF_ERROR(
- cpl_wcs_convert(wcs_ref, phys_ref, &world, &status,
- CPL_WCS_PHYS2WORLD));
+ cpl_wcs_convert(wcs_ref, phys_ref, &world, &status, CPL_WCS_PHYS2WORLD));
cpl_matrix_delete(phys_ref); phys_ref = NULL;
cpl_array_delete(status); status = NULL;
- } else if (strcmp(smethod, "user") == 0) {
+ } else if (strcmp(method, "user") == 0) {
KMO_TRY_EXIT_IF_NULL(
shifts = cpl_bivector_read(filename));
- KMO_TRY_ASSURE(nr_exposures - 1 == cpl_bivector_get_size(shifts),
+ KMO_TRY_ASSURE(nr_frames - 1 == cpl_bivector_get_size(shifts),
CPL_ERROR_ILLEGAL_INPUT,
"Number of identified frames in sof-file (%d) "
"with identified objects doesn't "
"match the number of pairs shift values in "
"provided file (%lld)! For n pairs of shift "
"values, n+1 frames are expected.",
- nr_exposures, cpl_bivector_get_size(shifts));
+ nr_frames, cpl_bivector_get_size(shifts));
KMO_TRY_EXIT_IF_NULL(
pxshifts = cpl_bivector_get_x_data(shifts));
KMO_TRY_EXIT_IF_NULL(
pyshifts = cpl_bivector_get_y_data(shifts));
- } else if (strcmp(smethod, "center") == 0) {
- KMO_TRY_EXIT_IF_ERROR(
- kmo_mr_create_datacubes(frameset, exposures, ifus, imethod,
- neighborhoodRange,
- &data_cube_list, pix_scale));
+ } else if (strcmp(method, "center") == 0) {
+ KMO_TRY_ASSURE(data_cube_list != NULL,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Some inputs are NULL!");
KMO_TRY_EXIT_IF_NULL(
identified = cpl_vector_new(cpl_imagelist_get_size(data_cube_list[0])));
@@ -356,50 +511,47 @@ cpl_error_code kmo_mr_get_offsets (
cmin));
KMO_TRY_EXIT_IF_NULL(
- fit_pars = kmo_fit_profile_2D(tmp_img,
- NULL,
- fmethod,
- &tmp_img2,
- NULL));
+ fit_pars = kmo_fit_profile_2D(tmp_img, NULL, fmethod, &tmp_img2, NULL));
+
xref = cpl_vector_get(fit_pars, 2);
yref = cpl_vector_get(fit_pars, 3);
KMO_TRY_CHECK_ERROR_STATE();
+
cpl_image_delete(tmp_img); tmp_img = NULL;
cpl_image_delete(tmp_img2); tmp_img2 = NULL;
cpl_vector_delete(fit_pars); fit_pars = NULL;
- cpl_imagelist_delete(data_cube_list[0]);
}
- xshifts[0] = 0.0;
- yshifts[0] = 0.0;
- int i = 0;
- for (i = 1; i < nr_exposures; i++) {
- if (strcmp(smethod, "none") == 0) {
- xshifts[i] = 0.0;
- yshifts[i] = 0.0;
- } else if (strcmp(smethod, "user") == 0) {
- xshifts[i] = pxshifts[i-1];
- yshifts[i] = pyshifts[i-1];
- } else if (strcmp(smethod, "header") == 0) {
+ //
+ // fill shift vectors
+ //
+ (*xshifts)[0] = 0.0;
+ (*yshifts)[0] = 0.0;
+ for (cnt = 1; cnt < nr_frames; cnt++) {
+ if (strcmp(method, "none") == 0) {
+ (*xshifts)[cnt] = 0.0;
+ (*yshifts)[cnt] = 0.0;
+ } else if (strcmp(method, "user") == 0) {
+ (*xshifts)[cnt] = pxshifts[cnt-1];
+ (*yshifts)[cnt] = pyshifts[cnt-1];
+ } else if (strcmp(method, "header") == 0) {
KMO_TRY_EXIT_IF_NULL(
- wcs =
- cpl_wcs_new_from_propertylist(header_data[i]));
+ wcs = cpl_wcs_new_from_propertylist(sub_headers[cnt]));
KMO_TRY_EXIT_IF_ERROR(
- cpl_wcs_convert(wcs, world, &phys , &status,
- CPL_WCS_WORLD2PHYS));
+ cpl_wcs_convert(wcs, world, &phys , &status, CPL_WCS_WORLD2PHYS));
cpl_array_delete(status); status = NULL;
- xshifts[i] = cpl_matrix_get(phys, 0, 0) - 1;
- yshifts[i] = -1 * (cpl_matrix_get(phys, 0, 1) - 1);
- cpl_wcs_delete(wcs);
- cpl_matrix_delete(phys);
- } else if (strcmp(smethod, "center") == 0) {
+ (*xshifts)[cnt] = cpl_matrix_get(phys, 0, 0) - 1;
+ (*yshifts)[cnt] = -1 * (cpl_matrix_get(phys, 0, 1) - 1);
+ cpl_wcs_delete(wcs); wcs = NULL;
+ cpl_matrix_delete(phys); phys = NULL;
+ } else if (strcmp(method, "center") == 0) {
KMO_TRY_EXIT_IF_ERROR(
cpl_vector_fill(identified, 1.0));
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_make_image(data_cube_list[i],
+ kmclipm_make_image(data_cube_list[cnt],
NULL,
&tmp_img,
NULL,
@@ -412,151 +564,215 @@ cpl_error_code kmo_mr_get_offsets (
cmin));
KMO_TRY_EXIT_IF_NULL(
- fit_pars = kmo_fit_profile_2D(tmp_img,
- NULL,
- fmethod,
- &tmp_img2,
- NULL));
+ fit_pars = kmo_fit_profile_2D(tmp_img, NULL, fmethod, &tmp_img2, NULL));
double x2 = cpl_vector_get(fit_pars, 2);
double y2 = cpl_vector_get(fit_pars, 3);
KMO_TRY_CHECK_ERROR_STATE();
- xshifts[i] = x2 - xref;
- yshifts[i] = yref - y2;
+ (*xshifts)[cnt] = x2 - xref;
+ (*yshifts)[cnt] = yref - y2;
cpl_image_delete(tmp_img); tmp_img = NULL;
cpl_image_delete(tmp_img2); tmp_img2 = NULL;
cpl_vector_delete(fit_pars); fit_pars = NULL;
- cpl_imagelist_delete(data_cube_list[i]);
+ }
+ }
+
+ //
+ // print info
+ //
+ cpl_msg_info("","Processing object name: '%s'", arm_name_struct->names[arm_id-1]);
+ for (cnt = 0; cnt < nr_frames; cnt++) {
+ cpl_msg_info(""," [%s, IFU %2d] x: %20.9g\t y: %20.9g",
+ exposure_filename[cnt], exposure_ifus[cnt], (*xshifts)[cnt], (*yshifts)[cnt]);
+ if (mapping_mode == NULL) {
+ if (!(((*xshifts)[cnt] < KMOS_SLITLET_X) && ((*xshifts)[cnt] > -KMOS_SLITLET_X))) {
+ cpl_msg_warning(""," X-shift for this IFU is larger than 14 pix!");
+ }
+ if (!(((*yshifts)[cnt] < KMOS_SLITLET_Y) && ((*yshifts)[cnt] > -KMOS_SLITLET_Y))) {
+ cpl_msg_warning(""," Y-shift for this IFU is larger than 14 pix!");
+ }
}
}
} KMO_CATCH {
KMO_CATCH_MSG();
+
error = cpl_error_get_code();
+
+ cpl_free(*xshifts); *xshifts = NULL;
+ cpl_free(*yshifts); *yshifts = NULL;
}
- if (shifts != NULL) { cpl_bivector_delete(shifts); }
- if (wcs_ref != NULL) { cpl_wcs_delete(wcs_ref); }
- if (world != NULL) { cpl_matrix_delete(world); }
- if (data_cube_list != NULL) {cpl_free(data_cube_list);}
- if (identified != NULL) {cpl_vector_delete(identified);}
- return error;
-}
+ if (exposure_ifus != NULL) { cpl_free(exposure_ifus); exposure_ifus = NULL; }
+ if (exposure_filename != NULL) { cpl_free(exposure_filename); exposure_filename = NULL; }
+ if (shifts != NULL) { cpl_bivector_delete(shifts); }
+ if (wcs_ref != NULL) { cpl_wcs_delete(wcs_ref); }
+ if (world != NULL) { cpl_matrix_delete(world); }
+ if (identified != NULL) { cpl_vector_delete(identified); }
+ return error;
+}
/**
*/
cpl_error_code kmo_mr_load_super_image(int ix,
- cpl_image *superImg,
- cpl_image *tmpImg,
- int *image_offsets,
- int ifu_nr,
- int *bounds,
- char *name)
+ cpl_image *superImg,
+ cpl_image *origImg,
+ int *image_offsets,
+ int ifu_nr,
+ int *bounds)
{
- cpl_error_code err = CPL_ERROR_NONE;
- cpl_image *tmp = NULL;
- int ysize;
- int left;
- int right;
+ cpl_error_code err = CPL_ERROR_NONE;
+ cpl_image *extractImg = NULL;
+ int ysize = 0,
+ left = 0,
+ right = 0;
+
KMO_TRY
{
- ysize = cpl_image_get_size_y(superImg);
+ KMO_TRY_ASSURE((superImg != NULL) &&
+ (origImg != NULL),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Some inputs are NULL!");
+
left = bounds[2*(ifu_nr-1)];
right = bounds[2*(ifu_nr-1)+1];
+ ysize = cpl_image_get_size_y(superImg);
+
KMO_TRY_EXIT_IF_NULL(
- tmp = cpl_image_extract(tmpImg, left, 1, right, ysize));
-// printf("kmo_mr_load_super_image: %d -> %d (%d / %d) (%d / %d) (%d / %d) %d, %d, %d, %d\n",
-// ix,image_offsets[ix],
-// cpl_image_get_size_x(superImg),
-// cpl_image_get_size_y(superImg),
-// cpl_image_get_size_x(tmpImg),
-// cpl_image_get_size_y(tmpImg),
-// cpl_image_get_size_x(tmp),
-// cpl_image_get_size_y(tmp),
-// left, 1, right, ysize);
- KMO_TRY_EXIT_IF_ERROR(
- cpl_image_copy(superImg, tmp, image_offsets[ix]+1, 1));
- char *fname = cpl_sprintf("%s-%d.fits",name,ix);
-// cpl_image_save(tmp,fname,CPL_BPP_IEEE_FLOAT,NULL,CPL_IO_CREATE);
- cpl_free(fname);
+ extractImg = cpl_image_extract(origImg, left, 1, right, ysize));
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_image_copy(superImg, extractImg, image_offsets[ix]+1, 1));
}
KMO_CATCH
{
KMO_CATCH_MSG();
err = cpl_error_get_code();
}
- if (tmp != NULL) {
- cpl_image_delete(tmp);
+
+ if (extractImg != NULL) {
+ cpl_image_delete(extractImg);
}
+
return err;
}
/**
*/
-cpl_error_code kmo_priv_multi_reconstruct(
- cpl_frameset *frameset,
- cpl_frameset *exposures,
- int *ifus,
- double *xshifts,
- double *yshifts,
- gridDefinition gd,
- cpl_imagelist **cube_combined_data,
- cpl_imagelist **cube_combined_noise,
- double pix_scale)
+cpl_error_code kmo_mr_reconstruct(cpl_frameset *frameset,
+ armNameStruct *arm_name_struct,
+ int arm_id,
+ double *xshifts,
+ double *yshifts,
+ const gridDefinition gd,
+ const gridDefinition gd_orig,
+ double pix_scale,
+ int xcal_interpolation,
+ cpl_polynomial **lcorr_coeffs,
+ cpl_imagelist **cube_combined_data,
+ cpl_imagelist **cube_combined_noise,
+ int no_subtract,
+ int flux,
+ int background)
{
cpl_error_code err = CPL_ERROR_NONE;
- int nr_exposures = 0,
- ifu_nr = 0,
- device_nr = 0,
+ int ifu_nr = 0,
index = 0,
*bounds = NULL,
*image_offsets = NULL,
image_size = 0,
- ndsamples = 0;
- double exposure_rotangle = 0.,
+ ndsamples = 0,
+ ySize = 0,
+ slit_size = 0,
+ det_nr = 0,
+ ix = 0,
+ iy = 0,
+ nr_frames = 0,
+ i = 0,
+ cnt = 0,
+ print_warning_once_tweak_std_noise = TRUE,
+ mode_sigma = 1000;
+ float *plcalImg = NULL;
+ double rotangle = 0.,
rotangle_found_x = 0.,
rotangle_found_y = 0.,
rotangle_found_l = 0.,
- objectGain = 0.,
- objectReadnoise = 0.;
- cpl_frame *exposure_frame = NULL,
+ rotangle_found_f = 0.,
+ gain = 0.,
+ readnoise = 0.,
+ pixel_resolution = pix_scale,
+ flux_in = 0.,
+ flux_out = 0.,
+ background_val = 0.;
+ cpl_frame *obj_frame = NULL,
+ *sky_frame = NULL,
*xcal_frame = NULL,
*ycal_frame = NULL,
- *lcal_frame = NULL;
+ *lcal_frame = NULL,
+ *flat_frame = NULL,
+ *telluric_frame = NULL,
+ *tmp_frame = NULL;
cpl_propertylist *xcal_header = NULL,
- *objectSubheader = NULL,
- *main_header = NULL;
+ *tmp_subHeader = NULL,
+ *main_headerObj = NULL,
+ *main_headerSky = NULL;
cpl_image *img = NULL,
- *detImg = NULL,
- *noiseImg = NULL,
+ *objImg = NULL,
+ *objImgNoise = NULL,
+ *skyImg = NULL,
+ *skyImgNoise = NULL,
*xcalImg = NULL,
*ycalImg = NULL,
*lcalImg = NULL,
- *super_detImg = NULL,
- *super_noiseImg = NULL,
+ *flatImg = NULL,
+ *flatImgNoise = NULL,
+ *super_objImg = NULL,
+ *super_objImgNoise = NULL,
*super_xcalImg = NULL,
*super_ycalImg = NULL,
*super_lcalImg = NULL,
- *skyDetImage = NULL,
- *skyNoiseDetImage = NULL,
- *flatfieldDetImage = NULL,
- *flatfieldNoiseDetImage = NULL;
+ *super_flatImg = NULL,
+ *super_flatImgNoise = NULL,
+ *super_skyImg = NULL,
+ *super_skyImgNoise = NULL,
+ *illum_data = NULL,
+ *illum_noise = NULL;
char *last_env = NULL;
- const char *readmode = NULL;
+ const char *readmode = NULL,
+ *fn_obj = NULL,
+ *fn_sky = NULL;
cpl_array *timestamp = NULL;
- cpl_vector *calAngles = NULL;
+ cpl_vector *calAngles = NULL;
+ kmclipm_vector *telluric_data = NULL,
+ *telluric_noise = NULL;
+ main_fits_desc desc_telluric;
+ cpl_size lsize = 0;
+
+int print_illum_once = TRUE,
+ print_telluric_once = TRUE;
KMO_TRY
{
+ // number of matching objects
+ nr_frames = arm_name_struct->namesCnt[arm_id-1];
+
+ if (lcorr_coeffs != NULL) {
+ for (cnt = 0; cnt < nr_frames; cnt++) {
+ KMO_TRY_ASSURE(lcorr_coeffs[cnt] != NULL,
+ CPL_ERROR_NULL_INPUT,
+ "lambda correction for obj #%d is NULL!", cnt+1);
+ KMO_TRY_ASSURE(cpl_polynomial_get_dimension(lcorr_coeffs[cnt]) == 1,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "lambda correction polynomial must be a univariate polynomial");
+ }
+ }
- nr_exposures = cpl_frameset_get_size(exposures);
KMO_TRY_EXIT_IF_NULL(
- image_offsets = cpl_malloc(nr_exposures * sizeof(int*)));
+ image_offsets = cpl_calloc(nr_frames, sizeof(int*)));
image_offsets[0] = 0;
// search nearest xcal frame, retrieve bounds and set offsets for complete image
@@ -566,256 +782,570 @@ cpl_error_code kmo_priv_multi_reconstruct(
bounds = kmclipm_extract_bounds(xcal_header));
cpl_propertylist_delete(xcal_header); xcal_header= NULL;
- int i = 0;
- for (i = 0; i < nr_exposures; i++) {
- ifu_nr = ifus[i];
-
- int slit_size = bounds[2*(ifu_nr-1)+1] - bounds[2*(ifu_nr-1)] + 1;
-
- if ((i+1) < nr_exposures) {
- image_offsets[i+1] = image_offsets[i] + slit_size;
+ //
+ // determine size of "super"-image
+ //
+ cnt = 0;
+ for (iy = 0; iy < arm_name_struct->size; iy++) {
+ for (ix = 0; ix < KMOS_NR_IFUS; ix++) {
+ ifu_nr = ix + 1;
+ if (arm_name_struct->name_ids[ix+iy*KMOS_NR_IFUS] == arm_id) {
+ slit_size = bounds[2*(ifu_nr-1)+1] - bounds[2*(ifu_nr-1)] + 1;
+
+ if (cnt+1 < nr_frames) {
+ image_offsets[cnt+1] = image_offsets[cnt] + slit_size;
+ }
+ image_size += slit_size;
+ cnt++;
+ }
}
- image_size += slit_size;
}
- // create complete "super" images
+ //
+ // create "super" images
+ //
#if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(6, 3, 0)
KMO_TRY_EXIT_IF_NULL(
- exposure_frame = cpl_frameset_get_position(exposures, 0));
+ tmp_frame = cpl_frameset_get_position(frameset, 0));
#else
KMO_TRY_EXIT_IF_NULL(
- exposure_frame = cpl_frameset_get_frame(exposures, 0));
+ tmp_frame = cpl_frameset_get_frame(frameset, 0));
#endif
KMO_TRY_EXIT_IF_NULL(
- img = kmo_dfs_load_image_frame(exposure_frame, 1 , 0, TRUE, NULL));
- int ySize = cpl_image_get_size_y(img); //just take last frame
+ img = kmo_dfs_load_image_frame(tmp_frame, 1 , 0, TRUE, NULL));
+
+ // determine y-size from just last frame
+ ySize = cpl_image_get_size_y(img);
cpl_type imgType = cpl_image_get_type(img);
- cpl_image_delete(img);
+ cpl_image_delete(img); img = NULL;
+
+ KMO_TRY_EXIT_IF_NULL(
+ super_objImg = cpl_image_new(image_size, ySize, imgType));
KMO_TRY_EXIT_IF_NULL(
- super_detImg = cpl_image_new(image_size, ySize, imgType));
+ super_objImgNoise = cpl_image_new(image_size, ySize, imgType));
KMO_TRY_EXIT_IF_NULL(
- super_noiseImg = cpl_image_new(image_size, ySize, imgType));
- KMO_TRY_EXIT_IF_NULL(
- super_xcalImg = cpl_image_new(image_size, ySize, imgType));
+ super_skyImg = cpl_image_new(image_size, ySize, imgType));
KMO_TRY_EXIT_IF_NULL(
- super_ycalImg = cpl_image_new(image_size, ySize, imgType));
+ super_skyImgNoise = cpl_image_new(image_size, ySize, imgType));
KMO_TRY_EXIT_IF_NULL(
- super_lcalImg = cpl_image_new(image_size, ySize, imgType));
+ super_xcalImg = cpl_image_new(image_size, ySize, imgType));
+ KMO_TRY_EXIT_IF_NULL(
+ super_ycalImg = cpl_image_new(image_size, ySize, imgType));
+ KMO_TRY_EXIT_IF_NULL(
+ super_lcalImg = cpl_image_new(image_size, ySize, imgType));
+ KMO_TRY_EXIT_IF_NULL(
+ super_flatImg = cpl_image_new(image_size, ySize, imgType));
+ KMO_TRY_EXIT_IF_NULL(
+ super_flatImgNoise = cpl_image_new(image_size, ySize, imgType));
+ //
// fill super images with IFU strips of exposure frames and corresponding cal frames
+ //
KMO_TRY_EXIT_IF_NULL(
xcal_frame = kmo_dfs_get_frame(frameset, XCAL));
KMO_TRY_EXIT_IF_NULL(
ycal_frame = kmo_dfs_get_frame(frameset, YCAL));
KMO_TRY_EXIT_IF_NULL(
lcal_frame = kmo_dfs_get_frame(frameset, LCAL));
-
- for (i = 0; i < nr_exposures; i++) {
- ifu_nr = ifus[i];
- device_nr = ((ifu_nr -1) / KMOS_IFUS_PER_DETECTOR) + 1;
-
-#if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(6, 3, 0)
+ if (cpl_frameset_count_tags(frameset, MASTER_FLAT) == 1) {
KMO_TRY_EXIT_IF_NULL(
- exposure_frame = cpl_frameset_get_position(exposures, i));
-#else
+ flat_frame = kmo_dfs_get_frame(frameset, MASTER_FLAT));
+ }
+ if (cpl_frameset_count_tags(frameset, TELLURIC) == 1) {
KMO_TRY_EXIT_IF_NULL(
- exposure_frame = cpl_frameset_get_frame(exposures, i));
-#endif
- exposure_rotangle = kmo_mr_get_rot_angle(exposure_frame);
- index = kmo_identify_index(cpl_frame_get_filename(exposure_frame),
- device_nr, FALSE);
- KMO_TRY_CHECK_ERROR_STATE();
+ telluric_frame = kmo_dfs_get_frame(frameset, TELLURIC));
+ }
- KMO_TRY_EXIT_IF_NULL(
- objectSubheader = kmclipm_propertylist_load(
- cpl_frame_get_filename(exposure_frame),
- index));
+ // make sure no reconstruction lookup table (LUT) is used
+ // therefore lutFilename and timestamp are not used either --> supply dummy values
+ if (getenv("KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE") != NULL) {
+ last_env = getenv("KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE");
+ }
+ setenv("KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE","NONE",1);
+ char lutFilename[] = "aLutFileIsNotExpectedToBeUsedForMultiReconstruct";
+ timestamp = cpl_array_new(3,CPL_TYPE_STRING);
+ char defaultTime[] = "1970-01-01T00:00:00";
- KMO_TRY_EXIT_IF_NULL(
- detImg = kmo_dfs_load_image_frame(exposure_frame, device_nr, 0, TRUE, NULL));
+ for (i = 0; i < 3; i++) {
+ cpl_array_set_string(timestamp, i, defaultTime);
+ }
- KMO_TRY_EXIT_IF_NULL(
- main_header = kmclipm_propertylist_load(
- cpl_frame_get_filename(exposure_frame), 0));
- readmode = cpl_propertylist_get_string(main_header, READMODE);
- KMO_TRY_CHECK_ERROR_STATE("ESO DET READ CURNAME keyword in main "
- "header missing!");
-
- objectGain = kmo_dfs_get_property_double(objectSubheader, GAIN);
- KMO_TRY_CHECK_ERROR_STATE_MSG("ESO DET CHIP GAIN keyword in fits-header"
- " is missing!");
-
- if (strcmp(readmode, "Nondest") == 0) {
- // NDR: non-destructive readout mode
- ndsamples = cpl_propertylist_get_int(main_header, NDSAMPLES);
- KMO_TRY_CHECK_ERROR_STATE("ESO DET READ NDSAMPLES keyword in main "
- "header missing!");
-
- objectReadnoise = kmo_calc_readnoise_ndr(ndsamples);
- KMO_TRY_CHECK_ERROR_STATE();
- } else {
- // normal readout mode
- objectReadnoise = kmo_dfs_get_property_double(objectSubheader, RON);
- KMO_TRY_CHECK_ERROR_STATE_MSG("ESO DET CHIP RON keyword in fits-header"
- " is missing!");
- }
- KMO_TRY_EXIT_IF_NULL(
- noiseImg = kmo_calc_noise_map(detImg, objectGain, objectReadnoise));
+ cnt = 0;
+ for (iy = 0; iy < arm_name_struct->size; iy++) {
+ obj_frame = arm_name_struct->obj_sky_struct->table[iy].objFrame;
- cpl_propertylist_delete(main_header); main_header = NULL;
- cpl_propertylist_delete(objectSubheader); objectSubheader = NULL;
-
-// if (xcal_interpolation) {
-// if (ifu_nr < 17) {
-// KMO_TRY_EXIT_IF_NULL(
-// xcalDetImage = kmo_dfs_load_cal_image_frame(xcalFrame, device_nr, 0, rotangle,
-// FALSE, NULL, &rotangle_found_x, -1, 0, 0));
-// KMO_TRY_EXIT_IF_NULL(
-// ycalDetImage = kmo_dfs_load_cal_image_frame(ycalFrame, device_nr, 0, rotangle,
-// FALSE, NULL, &rotangle_found_y, ifu_nr, lowBound, highBound));
-// } else {
-// KMO_TRY_EXIT_IF_NULL(
-// xcalDetImage = kmo_dfs_load_cal_image_frame(xcalFrame, device_nr, 0, rotangle,
-// FALSE, NULL, &rotangle_found_x, ifu_nr, lowBound, highBound));
-// KMO_TRY_EXIT_IF_NULL(
-// ycalDetImage = kmo_dfs_load_cal_image_frame(ycalFrame, device_nr, 0, rotangle,
-// FALSE, NULL, &rotangle_found_y, -1, 0, 0));
-// }
-// } else {
- KMO_TRY_EXIT_IF_NULL(
- xcalImg = kmo_dfs_load_cal_image_frame(xcal_frame,
- device_nr, 0,
- exposure_rotangle,
- FALSE, NULL,
- &rotangle_found_x,
- -1, 0, 0));
- KMO_TRY_EXIT_IF_NULL(
- ycalImg = kmo_dfs_load_cal_image_frame(ycal_frame,
- device_nr, 0,
- exposure_rotangle,
- FALSE, NULL,
- &rotangle_found_y,
- -1, 0, 0));
-// } // if (xcal_interpolation)
KMO_TRY_EXIT_IF_NULL(
- lcalImg = kmo_dfs_load_cal_image_frame(lcal_frame,
- device_nr, 0,
- exposure_rotangle,
- FALSE, NULL,
- &rotangle_found_l,
- -1, 0, 0));
- float *pimg;
- int nx,
- ny,
- ix,
- iy;
+ fn_obj = cpl_frame_get_filename(obj_frame));
KMO_TRY_EXIT_IF_NULL(
- pimg = cpl_image_get_data(lcalImg));
- nx = cpl_image_get_size_x(lcalImg);
- ny = cpl_image_get_size_y(lcalImg);
- for (iy = 0; iy < ny; iy++) {
- for (ix = 0; ix < nx; ix++) {
- if (pimg[ix+iy*nx] == 0.0) {
- cpl_image_reject(xcalImg, ix+1, iy+1);
- cpl_image_reject(ycalImg, ix+1, iy+1);
- cpl_image_reject(lcalImg, ix+1, iy+1);
+ main_headerObj = kmclipm_propertylist_load(fn_obj, 0));
+
+ for (ix = 0; ix < KMOS_NR_IFUS; ix++) {
+ ifu_nr = ix + 1;
+ det_nr = (ifu_nr - 1)/KMOS_IFUS_PER_DETECTOR + 1;
+
+ if (arm_name_struct->name_ids[ix+iy*KMOS_NR_IFUS] == arm_id) {
+ //
+ // load obj-frame and generate objNoise
+ //
+ index = kmo_identify_index(fn_obj, det_nr, FALSE);
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_subHeader = kmclipm_propertylist_load(fn_obj, index));
+
+
+ readmode = cpl_propertylist_get_string(main_headerObj, READMODE);
+ KMO_TRY_CHECK_ERROR_STATE("ESO DET READ CURNAME keyword in main "
+ "header missing!");
+ if (strcmp(readmode, "Nondest") == 0) {
+ // NDR: non-destructive readout mode
+ ndsamples = cpl_propertylist_get_int(main_headerObj, NDSAMPLES);
+ KMO_TRY_CHECK_ERROR_STATE("ESO DET READ NDSAMPLES keyword in main "
+ "header missing!");
+
+ readnoise = kmo_calc_readnoise_ndr(ndsamples);
+ KMO_TRY_CHECK_ERROR_STATE();
+ } else {
+ // normal readout mode
+ readnoise = kmo_dfs_get_property_double(tmp_subHeader, RON);
+ KMO_TRY_CHECK_ERROR_STATE_MSG("ESO DET CHIP RON keyword in fits-header"
+ " is missing!");
}
- }
- }
- double tmp;
- double pixel_resolution = pix_scale;
- int tmp_int = 0;
- tmp_int = (int)(xshifts[i] * pixel_resolution);
- tmp = -tmp_int;
- KMO_TRY_EXIT_IF_ERROR(
- cpl_image_add_scalar(xcalImg, tmp));
- tmp_int = (int)(yshifts[i] * pixel_resolution);
- tmp = tmp_int;
- KMO_TRY_EXIT_IF_ERROR(
- cpl_image_add_scalar(ycalImg, tmp));
+ gain = kmo_dfs_get_property_double(tmp_subHeader, GAIN);
+ KMO_TRY_CHECK_ERROR_STATE_MSG("ESO DET CHIP GAIN keyword in fits-header"
+ " is missing!");
+
+ KMO_TRY_EXIT_IF_NULL(
+ objImg = kmo_dfs_load_image_frame(obj_frame, det_nr, 0, TRUE, NULL));
+
+ KMO_TRY_EXIT_IF_NULL(
+ objImgNoise = kmo_calc_noise_map(objImg, gain, readnoise));
+
+ cpl_propertylist_delete(tmp_subHeader); tmp_subHeader = NULL;
+
+ //
+ // load sky-frame if present and generate skyNoise, else create sky with zeros
+ //
+ sky_frame = arm_name_struct->obj_sky_struct->table[iy].skyFrames[ifu_nr-1];
+ if ((sky_frame != NO_CORRESPONDING_SKYFRAME) &&
+ (cpl_frameset_count_tags(frameset, SCIENCE) != 1) &&
+ !no_subtract)
+ {
+ KMO_TRY_EXIT_IF_NULL(
+ fn_sky = cpl_frame_get_filename(sky_frame));
+
+ KMO_TRY_EXIT_IF_NULL(
+ main_headerSky = kmclipm_propertylist_load(fn_sky, 0));
+
+ index = kmo_identify_index(fn_sky, det_nr, 0);
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_subHeader = kmclipm_propertylist_load(fn_sky, index));
+
+ readmode = cpl_propertylist_get_string(main_headerSky, READMODE);
+ KMO_TRY_CHECK_ERROR_STATE("ESO DET READ CURNAME keyword in main "
+ "header missing!");
+ if (strcmp(readmode, "Nondest") == 0) {
+ // NDR: non-destructive readout mode
+ ndsamples = cpl_propertylist_get_int(main_headerSky, NDSAMPLES);
+ KMO_TRY_CHECK_ERROR_STATE("ESO DET READ NDSAMPLES keyword in main "
+ "header missing!");
+
+ readnoise = kmo_calc_readnoise_ndr(ndsamples);
+ KMO_TRY_CHECK_ERROR_STATE();
+ } else {
+ // normal readout mode
+ readnoise = kmo_dfs_get_property_double(tmp_subHeader, RON);
+ KMO_TRY_CHECK_ERROR_STATE_MSG("ESO DET CHIP RON keyword in "
+ "fits-header is missing!");
+ }
+
+ gain = kmo_dfs_get_property_double(tmp_subHeader, GAIN);
+ KMO_TRY_CHECK_ERROR_STATE_MSG("ESO DET CHIP GAIN keyword in "
+ "fits-header is missing!");
+
+ KMO_TRY_EXIT_IF_NULL(
+ skyImg = kmo_dfs_load_image_frame(sky_frame, det_nr, 0, TRUE, NULL));
+
+ KMO_TRY_EXIT_IF_NULL(
+ skyImgNoise = kmo_calc_noise_map(skyImg, gain, readnoise));
+
+ cpl_propertylist_delete(main_headerSky); main_headerSky = NULL;
+ cpl_propertylist_delete(tmp_subHeader); tmp_subHeader = NULL;
+
+// if (!print_once) {
+ cpl_msg_info("", " Sky in frame: %s on IFU %2d)", fn_sky, ifu_nr);
+// print_once = TRUE;
+// }
+ } else {
+ // sky not provided: fill a dummy frame with zeros
+ KMO_TRY_EXIT_IF_NULL(
+ skyImg = cpl_image_multiply_scalar_create(objImg, 0.0));
+ KMO_TRY_EXIT_IF_NULL(
+ skyImgNoise = cpl_image_duplicate(skyImg));
+ if ((cpl_frameset_count_tags(frameset, SCIENCE) != 1) && (!no_subtract)) {
+// if (!print_once) {
+ cpl_msg_warning("", " No corresponding sky frame for IFU %2d", ifu_nr);
+// print_once = TRUE;
+// }
+ }
+ }
- KMO_TRY_EXIT_IF_ERROR(
- kmo_mr_load_super_image(i, super_detImg, detImg, image_offsets, ifu_nr, bounds, "detImg"));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_mr_load_super_image(i, super_noiseImg, noiseImg, image_offsets, ifu_nr, bounds, "noiseImg"));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_mr_load_super_image(i, super_xcalImg, xcalImg, image_offsets, ifu_nr, bounds, "xcalImg"));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_mr_load_super_image(i, super_ycalImg, ycalImg, image_offsets, ifu_nr, bounds, "ycalImg"));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_mr_load_super_image(i, super_lcalImg, lcalImg, image_offsets, ifu_nr, bounds, "lcalImg"));
+ //
+ // load calibration frames
+ //
+ rotangle = kmo_mr_get_rot_angle(obj_frame);
+
+ if (xcal_interpolation) {
+ int x_lowBound = 0, x_highBound = 0, x_ifu_nr = -1,
+ y_lowBound = 0, y_highBound = 0, y_ifu_nr = -1;
+
+ if (ifu_nr < 17) {
+ y_lowBound = bounds[2*(ifu_nr-1)];
+ y_highBound = bounds[2*(ifu_nr-1)+1];
+ y_ifu_nr = ifu_nr;
+
+ KMO_TRY_EXIT_IF_NULL(
+ ycalImg = kmo_dfs_load_cal_image_frame(ycal_frame, det_nr, FALSE, rotangle,
+ FALSE, NULL, &rotangle_found_y,
+ y_ifu_nr, y_lowBound, y_highBound));
+ KMO_TRY_EXIT_IF_NULL(
+ xcalImg = kmo_dfs_load_cal_image_frame(xcal_frame, det_nr, FALSE, rotangle,
+ FALSE, NULL, &rotangle_found_x,
+ -1, 0, 0));
+ } else {
+ x_lowBound = bounds[2*(ifu_nr-1)];
+ x_highBound = bounds[2*(ifu_nr-1)+1];
+ x_ifu_nr = ifu_nr;
+
+ KMO_TRY_EXIT_IF_NULL(
+ xcalImg = kmo_dfs_load_cal_image_frame(xcal_frame, det_nr, FALSE, rotangle,
+ FALSE, NULL, &rotangle_found_x,
+ x_ifu_nr, x_lowBound, x_highBound));
+ KMO_TRY_EXIT_IF_NULL(
+ ycalImg = kmo_dfs_load_cal_image_frame(ycal_frame, det_nr, FALSE, rotangle,
+ FALSE, NULL, &rotangle_found_y,
+ -1, 0, 0));
+ }
+ } else {
+ // the calls to kmo_dfs_load_cal_image_frame() are in the if-statement just to
+ // get the info/warning-mesage in the right order!
+ KMO_TRY_EXIT_IF_NULL(
+ xcalImg = kmo_dfs_load_cal_image_frame(xcal_frame, det_nr, FALSE, rotangle,
+ FALSE, NULL, &rotangle_found_x,
+ -1, 0, 0));
+ KMO_TRY_EXIT_IF_NULL(
+ ycalImg = kmo_dfs_load_cal_image_frame(ycal_frame, det_nr, FALSE, rotangle,
+ FALSE, NULL, &rotangle_found_y,
+ -1, 0, 0));
+ }
+
+ KMO_TRY_EXIT_IF_NULL(
+ lcalImg = kmo_dfs_load_cal_image_frame(lcal_frame, det_nr, FALSE, rotangle,
+ FALSE, NULL, &rotangle_found_l, -1, 0, 0));
+ if (flat_frame != NULL) {
+ KMO_TRY_EXIT_IF_NULL(
+ flatImg = kmo_dfs_load_cal_image_frame(flat_frame, det_nr, FALSE, rotangle,
+ FALSE, NULL, &rotangle_found_f, -1, 0, 0));
+ KMO_TRY_EXIT_IF_NULL(
+ flatImgNoise = kmo_dfs_load_cal_image_frame(flat_frame, det_nr, TRUE, rotangle,
+ FALSE, NULL, &rotangle_found_f, -1, 0, 0));
+ } else {
+ // flat not provided: fill a dummy frame with ones (noise with zeros)
+ KMO_TRY_EXIT_IF_NULL(
+ flatImg = cpl_image_multiply_scalar_create(objImg, 0.0));
+ KMO_TRY_EXIT_IF_NULL(
+ flatImgNoise = cpl_image_duplicate(flatImg));
+
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_image_add_scalar(flatImg, 1.0));
+ }
+
+ if (cnt == 0) {
+ KMO_TRY_EXIT_IF_NULL(
+ calAngles = cpl_vector_new(3));
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_set(calAngles, 0, rotangle_found_x));
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_set(calAngles, 1, rotangle_found_y));
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_set(calAngles, 2, rotangle_found_l));
+ }
+
+ //
+ // apply the lambda correction polynomial if supplied as argument
+ //
+ if (lcorr_coeffs != NULL) {
+ KMO_TRY_EXIT_IF_NULL(
+ plcalImg = cpl_image_get_data_float(lcalImg));
+
+ lsize = cpl_image_get_size_x(lcalImg) * cpl_image_get_size_y(lcalImg);
+
+ for (i = 0; i < lsize; i++) {
+ if (plcalImg[i] != 0.0) {
+ plcalImg[i] -= (float) cpl_polynomial_eval_1d(lcorr_coeffs[cnt],
+ plcalImg[i], NULL);
+ }
+ }
+ }
+
+ //
+ // calc flux
+ //
+ if (flux || background) {
+ cpl_imagelist *tmpCube = NULL;
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_reconstruct_sci_image(ifu_nr,
+ bounds[2*(ifu_nr-1)],
+ bounds[2*(ifu_nr-1)+1],
+ objImg,
+ objImgNoise,
+ skyImg,
+ skyImgNoise,
+ flatImg,
+ flatImgNoise,
+ xcalImg,
+ ycalImg,
+ lcalImg,
+ &gd_orig,
+ timestamp,
+ calAngles,
+ lutFilename,
+ &tmpCube,
+ NULL,
+ FALSE,
+ FALSE,
+ &flux_in,
+ &flux_out,
+ &background_val));
+ cpl_imagelist_delete(tmpCube); tmpCube = NULL;
+
+ if (background) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_image_subtract_scalar(objImg, background_val));
+ }
+
+ if (flux) {
+ if (isnan(flux_in) || isnan(flux_out)) {
+ KMO_TRY_ASSURE(1==0,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "At least one of the calculated fluxes is invalid. "
+ "(Flux in < %d*noise)\nPlease start the recipe again without "
+ "flux compensation!", mode_sigma);
+
+ }
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_image_multiply_scalar(objImg, flux_in / flux_out));
+ }
+ }
+
+ //
+ // apply illumination correction
+ //
+ if (cpl_frameset_count_tags(frameset, ILLUM_CORR) == 1)
+ {
+ illum_data = kmo_dfs_load_image(frameset, ILLUM_CORR,
+ ifu_nr, FALSE, FALSE, NULL);
+ if (cpl_error_get_code() != CPL_ERROR_NONE) {
+ cpl_msg_warning("", "No illumination correction for IFU %d available! "
+ "Proceeding anyway.", ifu_nr);
+ cpl_error_reset();
+ } else {
+ illum_noise = kmo_dfs_load_image(frameset, ILLUM_CORR,
+ ifu_nr, TRUE, FALSE, NULL);
+ if (cpl_error_get_code() != CPL_ERROR_NONE) {
+ cpl_msg_warning("", "No illumination correction for IFU %d "
+ "available! Proceeding anyway.", ifu_nr);
+ cpl_image_delete(illum_data); illum_data = NULL;
+ cpl_error_reset();
+ }
+ }
+
+ if (illum_data != NULL) {
+//
+// !!! TO DO !!!
+//
+// project illum_data/noise (F2I) back into RAW format
+// divide from objImg
+
+if (print_illum_once) {
+ print_illum_once = FALSE;
+ cpl_msg_warning("","*******************************************************");
+ cpl_msg_warning("","*******************************************************");
+ cpl_msg_warning("","*** ***");
+ cpl_msg_warning("","*** ILLUM_CORR not implemented yet ! ***");
+ cpl_msg_warning("","*** ***");
+ cpl_msg_warning("","*** The ILLUM_CORR (F2D) has to be mapped back ***");
+ cpl_msg_warning("","*** to RAW format before reconstruction ***");
+ cpl_msg_warning("","*** ***");
+ cpl_msg_warning("","*******************************************************");
+ cpl_msg_warning("","*******************************************************");
+}
+ }
+ cpl_image_delete(illum_data); illum_data = NULL;
+ cpl_image_delete(illum_noise); illum_noise = NULL;
+ } // end if (has_illum_corr)
+
+ //
+ // apply telluric correction
+ //
+ if ((cpl_frameset_count_tags(frameset, TELLURIC) == 1) &&
+ !(arm_name_struct->sameTelluric[arm_id-1] > 0))
+ {
+ telluric_data = kmo_tweak_load_telluric(frameset, ifu_nr, FALSE, no_subtract);
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ if (telluric_data != NULL) {
+ kmo_init_fits_desc(&desc_telluric);
+ desc_telluric = kmo_identify_fits_header(cpl_frame_get_filename(telluric_frame));
+ index = kmo_identify_index_desc(desc_telluric, ifu_nr, TRUE);
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ if (desc_telluric.sub_desc[index-1].valid_data == TRUE) {
+ // load noise if present
+ telluric_noise = kmo_tweak_load_telluric(frameset, ifu_nr, TRUE, no_subtract);
+ KMO_TRY_CHECK_ERROR_STATE();
+ } else {
+ if (print_warning_once_tweak_std_noise && (cube_combined_noise != NULL)) {
+ cpl_msg_warning("","************************************************************");
+ cpl_msg_warning("","* Noise cubes were calculated, but won't be divided by *");
+ cpl_msg_warning("","* telluric error since it is missing. *");
+ cpl_msg_warning("","* In order to get a telluric with errors, execute *");
+ cpl_msg_warning("","* kmo_std_star with one of the nearest neighbour methods *");
+ cpl_msg_warning("","* (set --imethod to NN, lwNN or swNN) *");
+ cpl_msg_warning("","************************************************************");
+ print_warning_once_tweak_std_noise = FALSE;
+ }
+ }
+ kmo_free_fits_desc(&desc_telluric);
+//
+// !!! TO DO !!!
+//
+// project telluric_data/noise (F1I) back into RAW format
+// divide from objImg
+
+if (print_telluric_once) {
+ print_telluric_once = FALSE;
+ cpl_msg_warning("","#######################################################");
+ cpl_msg_warning("","#######################################################");
+ cpl_msg_warning("","### ###");
+ cpl_msg_warning("","### TELLURIC not implemented yet ! ###");
+ cpl_msg_warning("","### ###");
+ cpl_msg_warning("","### If IFUs with different tellurics have to be ###");
+ cpl_msg_warning("","### divided, then telluric has to be mapped back ###");
+ cpl_msg_warning("","### to RAW format before reconstruction ###");
+ cpl_msg_warning("","### ###");
+ cpl_msg_warning("","#######################################################");
+ cpl_msg_warning("","#######################################################");
+}
+ }
+ kmclipm_vector_delete(telluric_data); telluric_data = NULL;
+ kmclipm_vector_delete(telluric_noise); telluric_noise = NULL;
+ } // end if (has_telluric)
+
+ //
+ // add in shifts
+ //
+ // x-shift
+ double dbg_dbl = -(int)rint(xshifts[cnt] * pixel_resolution*1000);
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_image_add_scalar(xcalImg, dbg_dbl));
+ // y-shift
+ dbg_dbl = (int)rint(yshifts[cnt] * pixel_resolution*1000);
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_image_add_scalar(ycalImg, dbg_dbl));
+
+ //
+ // remove alien IFUs of XCAL before putting it into the superImage
+ //
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_priv_delete_alien_ifu_cal_data(ifu_nr,
+ xcalImg,
+ ycalImg,
+ lcalImg));
+ //
+ // put in new IFU index, counting linearly from 1
+ // (preparational if once CS (resp. spline-fit) will be implemented one day)
+ //
+ KMO_TRY_EXIT_IF_NULL(
+ xcalImg = kmo_new_xcal_index(cnt+1, xcalImg));
+
+ //
+ // create "super"-images
+ //
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_mr_load_super_image(cnt, super_objImg, objImg, image_offsets, ifu_nr, bounds));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_mr_load_super_image(cnt, super_objImgNoise, objImgNoise, image_offsets, ifu_nr, bounds));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_mr_load_super_image(cnt, super_skyImg, skyImg, image_offsets, ifu_nr, bounds));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_mr_load_super_image(cnt, super_skyImgNoise, skyImgNoise, image_offsets, ifu_nr, bounds));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_mr_load_super_image(cnt, super_xcalImg, xcalImg, image_offsets, ifu_nr, bounds));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_mr_load_super_image(cnt, super_ycalImg, ycalImg, image_offsets, ifu_nr, bounds));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_mr_load_super_image(cnt, super_lcalImg, lcalImg, image_offsets, ifu_nr, bounds));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_mr_load_super_image(cnt, super_flatImg, flatImg, image_offsets, ifu_nr, bounds));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_mr_load_super_image(cnt, super_flatImgNoise, flatImgNoise, image_offsets, ifu_nr, bounds));
+
+ cpl_image_delete(objImg); objImg = NULL;
+ cpl_image_delete(objImgNoise); objImgNoise = NULL;
+ cpl_image_delete(skyImg); skyImg = NULL;
+ cpl_image_delete(skyImgNoise); skyImgNoise = NULL;
+ cpl_image_delete(xcalImg); xcalImg = NULL;
+ cpl_image_delete(ycalImg); ycalImg = NULL;
+ cpl_image_delete(lcalImg); lcalImg = NULL;
+ cpl_image_delete(flatImg); flatImg = NULL;
+ cpl_image_delete(flatImgNoise); flatImgNoise = NULL;
+ cnt++;
+ } // for (valid ifu)
+ } // for (ix)
+ cpl_propertylist_delete(main_headerObj); main_headerObj = NULL;
+ } // for (iy)
- cpl_image_delete(noiseImg);
- cpl_image_delete(detImg);
- cpl_image_delete(xcalImg);
- cpl_image_delete(ycalImg);
- cpl_image_delete(lcalImg);
- }
cpl_free(image_offsets); image_offsets = NULL;
cpl_free(bounds); bounds = NULL;
+ KMO_TRY_CHECK_ERROR_STATE();
+
+// cpl_image_save(super_objImg,"superObj.fits",CPL_BPP_IEEE_FLOAT,NULL,CPL_IO_CREATE);
+// cpl_image_save(super_skyImg,"superSky.fits",CPL_BPP_IEEE_FLOAT,NULL,CPL_IO_CREATE);
// cpl_image_save(super_xcalImg,"superX.fits",CPL_BPP_IEEE_FLOAT,NULL,CPL_IO_CREATE);
// cpl_image_save(super_ycalImg,"superY.fits",CPL_BPP_IEEE_FLOAT,NULL,CPL_IO_CREATE);
// cpl_image_save(super_lcalImg,"superL.fits",CPL_BPP_IEEE_FLOAT,NULL,CPL_IO_CREATE);
- KMO_TRY_CHECK_ERROR_STATE();
+
//
// finally call reconstruct function
//
-
- // make sure no reconstruction lookup table (LUT) is used
- // therefore lutFilename and timestamp are not used either --> supply dummy values
- if (getenv("KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE") != NULL) {
- last_env = getenv("KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE");
- }
- setenv("KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE","NONE",1);
- char lutFilename[] = "aLutFileIsNotExpectedToBeUsedForMultiReconstruct";
- timestamp = cpl_array_new(3,CPL_TYPE_STRING);
-// char defaultTime[] = "1970-01-01T00:00:001970-01-01T00:00:001970-01-01T00:00:00";
- calAngles = cpl_vector_new(3);
- char defaultTime[] = "1970-01-01T00:00:00";
- int ix = 0;
- for (ix = 0; ix < 3; ix++) {
- cpl_array_set_string(timestamp, ix, defaultTime);
- }
-
- // sky not provided: fill a dummy frame with zeros
- KMO_TRY_EXIT_IF_NULL(
- skyDetImage = cpl_image_multiply_scalar_create(
- super_detImg, 0.0));
- KMO_TRY_EXIT_IF_NULL(
- skyNoiseDetImage = cpl_image_duplicate(skyDetImage));
- // flat not provided: fill a dummy frame with ones
- KMO_TRY_EXIT_IF_NULL(
- flatfieldDetImage = cpl_image_multiply_scalar_create(
- super_detImg, 0.0));
- KMO_TRY_EXIT_IF_ERROR(
- cpl_image_add_scalar(flatfieldDetImage, 1.0));
- KMO_TRY_EXIT_IF_NULL(
- flatfieldNoiseDetImage = cpl_image_duplicate(skyDetImage));
-
- int flux = 0;
- int background = 0;
KMO_TRY_EXIT_IF_ERROR(
- kmo_reconstruct_sci_image(ifu_nr,
- (int) 1,
- cpl_image_get_size_x(super_detImg),
- super_detImg,
- super_noiseImg,
- skyDetImage,
- skyNoiseDetImage,
- flatfieldDetImage,
- flatfieldNoiseDetImage,
- super_xcalImg,
- super_ycalImg,
- super_lcalImg,
- &gd,
- timestamp,
- calAngles,
- lutFilename,
- cube_combined_data,
- cube_combined_noise,
- flux,
- background));
+ kmo_reconstruct_sci_image(-1,
+ 1,
+ cpl_image_get_size_x(super_objImg),
+ super_objImg,
+ super_objImgNoise,
+ super_skyImg,
+ super_skyImgNoise,
+ super_flatImg,
+ super_flatImgNoise,
+ super_xcalImg,
+ super_ycalImg,
+ super_lcalImg,
+ &gd,
+ timestamp,
+ calAngles,
+ lutFilename,
+ cube_combined_data,
+ cube_combined_noise,
+ FALSE,
+ FALSE,
+ NULL,
+ NULL,
+ NULL));
KMO_TRY_CHECK_ERROR_STATE();
}
KMO_CATCH
@@ -823,24 +1353,75 @@ cpl_error_code kmo_priv_multi_reconstruct(
KMO_CATCH_MSG();
err = cpl_error_get_code();
}
+
if (last_env != NULL) {
- setenv("KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE",last_env,1);
+ setenv("KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE", last_env, 1);
} else {
unsetenv("KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE");
}
- if (timestamp != NULL) {cpl_array_delete(timestamp);}
- if (calAngles != NULL) {cpl_vector_delete(calAngles);}
- if (super_detImg != NULL) {cpl_image_delete(super_detImg);}
- if (super_noiseImg != NULL) {cpl_image_delete(super_noiseImg);}
- if (skyDetImage != NULL) {cpl_image_delete(skyDetImage);}
- if (skyNoiseDetImage != NULL) {cpl_image_delete(skyNoiseDetImage);}
- if (flatfieldDetImage != NULL) {cpl_image_delete(flatfieldDetImage);}
- if (flatfieldNoiseDetImage != NULL) {cpl_image_delete(flatfieldNoiseDetImage);}
- if (super_xcalImg != NULL) {cpl_image_delete(super_xcalImg);}
- if (super_ycalImg != NULL) {cpl_image_delete(super_ycalImg);}
- if (super_lcalImg != NULL) {cpl_image_delete(super_lcalImg);}
+
+ if (timestamp != NULL) { cpl_array_delete(timestamp); }
+ if (calAngles != NULL) { cpl_vector_delete(calAngles); }
+ if (super_objImg != NULL) { cpl_image_delete(super_objImg); }
+ if (super_objImgNoise != NULL) { cpl_image_delete(super_objImgNoise); }
+ if (super_skyImg != NULL) { cpl_image_delete(super_skyImg); }
+ if (super_skyImgNoise != NULL) { cpl_image_delete(super_skyImgNoise); }
+ if (super_xcalImg != NULL) { cpl_image_delete(super_xcalImg); }
+ if (super_ycalImg != NULL) { cpl_image_delete(super_ycalImg); }
+ if (super_lcalImg != NULL) { cpl_image_delete(super_lcalImg); }
+ if (super_flatImg != NULL) { cpl_image_delete(super_flatImg); }
+ if (super_flatImgNoise != NULL) { cpl_image_delete(super_flatImgNoise); }
return err;
}
+
+cpl_image* kmo_new_xcal_index(int new_ifu_nr,
+ cpl_image* xcalImg)
+{
+ float *pxcalImg = NULL,
+ new_index = 0;
+ int ix = 0,
+ iy = 0,
+ nx = 0,
+ ny = 0;
+
+ KMO_TRY
+ {
+ KMO_TRY_EXIT_IF_NULL(
+ pxcalImg = cpl_image_get_data_float(xcalImg));
+
+ if ((new_ifu_nr > 0) && (new_ifu_nr < 10)) {
+ new_index = new_ifu_nr/10.;
+ } else if ((new_ifu_nr >= 10) && (new_ifu_nr < 100)) {
+ new_index = new_ifu_nr/100.;
+ }
+
+ nx = cpl_image_get_size_x(xcalImg);
+ ny = cpl_image_get_size_y(xcalImg);
+
+ for (ix = 0; ix < nx; ix++) {
+ for (iy = 0; iy < ny; iy++) {
+ if ((fabs(pxcalImg[ix+iy*nx]) > 0.0001) && !kmclipm_is_nan_or_inf(pxcalImg[ix+iy*nx])) {
+ // remove old index
+ pxcalImg[ix+iy*nx] = (int)(pxcalImg[ix+iy*nx]);
+
+ // add in new index
+ if (pxcalImg[ix+iy*nx] >= 0.0) {
+ pxcalImg[ix+iy*nx] += new_index;
+ } else {
+ pxcalImg[ix+iy*nx] = pxcalImg[ix+iy*nx]-new_index;
+ }
+ }
+ }
+ }
+ }
+ KMO_CATCH
+ {
+ KMO_CATCH_MSG();
+ }
+
+ return xcalImg;
+}
+
/** @{ */
diff --git a/kmos/kmo_priv_multi_reconstruct.h b/kmos/kmo_priv_multi_reconstruct.h
index 2002acd..f4addbd 100644
--- a/kmos/kmo_priv_multi_reconstruct.h
+++ b/kmos/kmo_priv_multi_reconstruct.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_multi_reconstruct.h,v 1.11 2013/08/02 09:38:57 aagudo Exp $
+/* $Id: kmo_priv_multi_reconstruct.h,v 1.13 2013-09-16 13:40:02 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/02 09:38:57 $
- * $Revision: 1.11 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-09-16 13:40:02 $
+ * $Revision: 1.13 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_MULTI_RECONSTRUCT_H
@@ -34,54 +34,73 @@
#include <cpl.h>
+#include "kmo_functions.h"
+
/*------------------------------------------------------------------------------
* Prototypes
*----------------------------------------------------------------------------*/
-cpl_error_code kmo_mr_get_offsets (const int nr_exposures,
- const char *smethod,
- const char *imethod,
- double neighborhoodRange,
- const char *filename,
- cpl_frameset *frameset,
- cpl_frameset *exposures,
- int *ifus,
- const cpl_propertylist **header_data,
- const char *fmethod,
- const char *cmethod,
- double cpos_rej,
- double cneg_rej,
- int citer,
- int cmin,
- int cmax,
- double pix_scale,
- double *xshifts,
- double *yshifts);
+double kmo_mr_get_rot_angle(
+ cpl_frame *frame);
+
+cpl_imagelist** kmo_mr_create_datacubes(armNameStruct *arm_name_struct,
+ int arm_id,
+ cpl_frameset *frameset,
+ const gridDefinition gd,
+ int xcal_interpolation);
+
+cpl_propertylist** kmo_mr_get_headers(armNameStruct *arm_name_struct,
+ int arm_id,
+ cpl_frameset *frameset,
+ const gridDefinition gd);
-double kmo_mr_get_rot_angle(
- cpl_frame *frame);
+cpl_error_code kmo_mr_get_offsets(
+ armNameStruct *arm_name_struct,
+ int arm_id,
+ const char *smethod,
+ const char *imethod,
+ const char *filename,
+ cpl_frameset *frameset,
+ cpl_imagelist **data_cube_list,
+ cpl_propertylist **sub_headers,
+ const char *fmethod,
+ const char *cmethod,
+ double cpos_rej,
+ double cneg_rej,
+ int citer,
+ int cmin,
+ int cmax,
+ int dev_cal,
+ char *mapping_mode,
+ double **xshifts,
+ double **yshifts);
-//cpl_frame* kmo_mr_get_closest_cal_frame(
-// cpl_frameset *frameset,
-// const char *category,
-// const double rot_angle);
+cpl_error_code kmo_mr_load_super_image(
+ int ix,
+ cpl_image *superImg,
+ cpl_image *tmpImg,
+ int *image_offsets,
+ int ifu_nr,
+ int *bounds);
-cpl_error_code kmo_mr_load_super_image(int ix,
- cpl_image *superImg,
- cpl_image *tmpImg,
- int *image_offsets,
- int ifu_nr,
- int *bounds,
- char *name);
+cpl_error_code kmo_mr_reconstruct(cpl_frameset *frameset,
+ armNameStruct *arm_name_struct,
+ int arm_id,
+ double *xshifts,
+ double *yshifts,
+ const gridDefinition gd,
+ const gridDefinition gd_orig,
+ double pix_scale,
+ int xcal_interpolation,
+ cpl_polynomial **lcorr_coeffs,
+ cpl_imagelist **cube_combined_data,
+ cpl_imagelist **cube_combined_noise,
+ int no_subtract,
+ int flux,
+ int background);
-cpl_error_code kmo_priv_multi_reconstruct(cpl_frameset *frameset,
- cpl_frameset *exposures,
- int *ifus,
- double *xshifts,
- double *yshifts,
- gridDefinition gd,
- cpl_imagelist **cube_combined_data,
- cpl_imagelist **cube_combined_noise,
- double pix_scale);
+cpl_image* kmo_new_xcal_index(
+ int new_ifu_nr,
+ cpl_image* xcalImg);
#endif
diff --git a/kmos/kmo_priv_noise_map.c b/kmos/kmo_priv_noise_map.c
index b05d6bb..f0dfd1a 100644
--- a/kmos/kmo_priv_noise_map.c
+++ b/kmos/kmo_priv_noise_map.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_noise_map.c,v 1.3 2013/06/17 07:52:26 aagudo Exp $
+/* $Id: kmo_priv_noise_map.c,v 1.3 2013-06-17 07:52:26 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 07:52:26 $
+ * $Date: 2013-06-17 07:52:26 $
* $Revision: 1.3 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/kmo_priv_noise_map.h b/kmos/kmo_priv_noise_map.h
index 05593e5..8c3bea0 100644
--- a/kmos/kmo_priv_noise_map.h
+++ b/kmos/kmo_priv_noise_map.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_noise_map.h,v 1.2 2013/01/23 08:12:01 aagudo Exp $
+/* $Id: kmo_priv_noise_map.h,v 1.2 2013-01-23 08:12:01 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/01/23 08:12:01 $
+ * $Date: 2013-01-23 08:12:01 $
* $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_NOISE_MAP_H
diff --git a/kmos/kmo_priv_reconstruct.c b/kmos/kmo_priv_reconstruct.c
index e134b77..a8a33ab 100644
--- a/kmos/kmo_priv_reconstruct.c
+++ b/kmos/kmo_priv_reconstruct.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_reconstruct.c,v 1.24 2013/06/17 07:52:26 aagudo Exp $
+/* $Id: kmo_priv_reconstruct.c,v 1.25 2013-09-12 14:42:03 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 07:52:26 $
- * $Revision: 1.24 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-09-12 14:42:03 $
+ * $Revision: 1.25 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -37,6 +37,7 @@
#include <cpl.h>
#include "kmclipm_constants.h"
+#include "kmclipm_math.h"
#include <kmo_constants.h>
#include <kmo_cpl_extensions.h>
@@ -95,7 +96,7 @@ cpl_image *kmo_create_mask_from_xcal(const cpl_image *xcal,
ny = cpl_image_get_size_y(xcal);
KMO_TRY_CHECK_ERROR_STATE();
- KMO_TRY_ASSURE((ifu_id >= 1) &&
+ KMO_TRY_ASSURE(//(ifu_id >= 1) &&
(ifu_id <= KMOS_IFUS_PER_DETECTOR),
CPL_ERROR_ILLEGAL_INPUT,
"ifu_id must be between 1 and 8!");
@@ -112,11 +113,17 @@ cpl_image *kmo_create_mask_from_xcal(const cpl_image *xcal,
int i = 0;
for (i = 0; i < nx*ny; i++) {
- // calculate actual IFU number
- tmp_dbl = (fabs(pxcal[i])-fabs((int)pxcal[i]))*10;
- actual_ifu = (int)(tmp_dbl + .5);
- if (actual_ifu == ifu_id) {
- pmask[i] = 1.;
+ if (ifu_id < 0) {
+ if ((fabs(pxcal[i]) > 0.001) && !kmclipm_is_nan_or_inf(pxcal[i])) {
+ pmask[i] = 1.;
+ }
+ } else {
+ // calculate actual IFU number
+ tmp_dbl = (fabs(pxcal[i])-fabs((int)pxcal[i]))*10;
+ actual_ifu = (int)(tmp_dbl + .5);
+ if (actual_ifu == ifu_id) {
+ pmask[i] = 1.;
+ }
}
}
}
diff --git a/kmos/kmo_priv_reconstruct.h b/kmos/kmo_priv_reconstruct.h
index 2ae01e1..804b719 100644
--- a/kmos/kmo_priv_reconstruct.h
+++ b/kmos/kmo_priv_reconstruct.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_reconstruct.h,v 1.8 2013/05/17 15:59:45 aagudo Exp $
+/* $Id: kmo_priv_reconstruct.h,v 1.8 2013-05-17 15:59:45 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/17 15:59:45 $
+ * $Date: 2013-05-17 15:59:45 $
* $Revision: 1.8 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_RECONSTRUCT_H
diff --git a/kmos/kmo_priv_rotate.c b/kmos/kmo_priv_rotate.c
index 00dac6f..62863e1 100644
--- a/kmos/kmo_priv_rotate.c
+++ b/kmos/kmo_priv_rotate.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_rotate.c,v 1.7 2013/06/17 12:58:47 aagudo Exp $
+/* $Id: kmo_priv_rotate.c,v 1.7 2013-06-17 12:58:47 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 12:58:47 $
+ * $Date: 2013-06-17 12:58:47 $
* $Revision: 1.7 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/kmo_priv_rotate.h b/kmos/kmo_priv_rotate.h
index e504bc2..d0bb338 100644
--- a/kmos/kmo_priv_rotate.h
+++ b/kmos/kmo_priv_rotate.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_rotate.h,v 1.1.1.1 2012/01/18 09:31:59 yjung Exp $
+/* $Id: kmo_priv_rotate.h,v 1.1.1.1 2012-01-18 09:31:59 yjung Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2012/01/18 09:31:59 $
+ * $Date: 2012-01-18 09:31:59 $
* $Revision: 1.1.1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_ROTATE_H
diff --git a/kmos/kmo_priv_shift.c b/kmos/kmo_priv_shift.c
index 6b07f8f..7ddab9f 100644
--- a/kmos/kmo_priv_shift.c
+++ b/kmos/kmo_priv_shift.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_shift.c,v 1.7 2013/06/17 08:01:40 aagudo Exp $
+/* $Id: kmo_priv_shift.c,v 1.7 2013-06-17 08:01:40 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 08:01:40 $
+ * $Date: 2013-06-17 08:01:40 $
* $Revision: 1.7 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/kmo_priv_shift.h b/kmos/kmo_priv_shift.h
index 80940fa..c563419 100644
--- a/kmos/kmo_priv_shift.h
+++ b/kmos/kmo_priv_shift.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_shift.h,v 1.2 2012/02/27 09:48:01 aagudo Exp $
+/* $Id: kmo_priv_shift.h,v 1.2 2012-02-27 09:48:01 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2012/02/27 09:48:01 $
+ * $Date: 2012-02-27 09:48:01 $
* $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_SHIFT_H
diff --git a/kmos/kmo_priv_sky_mask.c b/kmos/kmo_priv_sky_mask.c
index 73d06b9..5ce8c63 100644
--- a/kmos/kmo_priv_sky_mask.c
+++ b/kmos/kmo_priv_sky_mask.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_sky_mask.c,v 1.2 2012/06/01 10:38:34 aagudo Exp $
+/* $Id: kmo_priv_sky_mask.c,v 1.2 2012-06-01 10:38:34 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2012/06/01 10:38:34 $
+ * $Date: 2012-06-01 10:38:34 $
* $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/kmo_priv_sky_mask.h b/kmos/kmo_priv_sky_mask.h
index 1505343..ca25065 100644
--- a/kmos/kmo_priv_sky_mask.h
+++ b/kmos/kmo_priv_sky_mask.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_sky_mask.h,v 1.1.1.1 2012/01/18 09:31:59 yjung Exp $
+/* $Id: kmo_priv_sky_mask.h,v 1.1.1.1 2012-01-18 09:31:59 yjung Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: yjung $
- * $Date: 2012/01/18 09:31:59 $
+ * $Date: 2012-01-18 09:31:59 $
* $Revision: 1.1.1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_SKY_MASK_H
diff --git a/kmos/kmo_priv_sky_tweak.c b/kmos/kmo_priv_sky_tweak.c
index e407d3f..3b0ccf3 100644
--- a/kmos/kmo_priv_sky_tweak.c
+++ b/kmos/kmo_priv_sky_tweak.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_sky_tweak.c,v 1.9 2013/07/31 14:30:18 erw Exp $
+/* $Id: kmo_priv_sky_tweak.c,v 1.12 2013-09-13 09:10:28 erw Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: erw $
- * $Date: 2013/07/31 14:30:18 $
- * $Revision: 1.9 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-09-13 09:10:28 $
+ * $Revision: 1.12 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -434,7 +434,7 @@ double get_average_disregarding_outliers (const cpl_vector *vdata) {
avg = cpl_vector_get_mean(tmpv4);
}
KMO_CATCH {
-
+ KMO_CATCH_MSG();
}
if (tmpv4 != NULL) { cpl_vector_unwrap(tmpv4); }
if (tmpv3 != NULL) { cpl_vector_delete(tmpv3); }
@@ -615,6 +615,7 @@ cpl_error_code kmo_priv_sky_tweak_get_spectra(const cpl_imagelist *object,
}
}
KMO_CATCH {
+ KMO_CATCH_MSG();
}
if (vo != NULL) { cpl_free(vo); }
@@ -625,8 +626,11 @@ cpl_error_code kmo_priv_sky_tweak_get_spectra(const cpl_imagelist *object,
return err;
}
-cpl_bivector* kmo_priv_sky_tweak_correct_vibrational_trans (cpl_bivector *obj_spectrum,
- cpl_bivector *sky_spectrum/*, int line_full_width*/){
+cpl_bivector* kmo_priv_sky_tweak_correct_vibrational_trans(
+ cpl_bivector *obj_spectrum,
+ cpl_bivector *sky_spectrum
+ /*, int line_full_width*/)
+{
cpl_bivector *result = NULL;
@@ -787,7 +791,7 @@ cpl_bivector* kmo_priv_sky_tweak_correct_vibrational_trans (cpl_bivector *obj_sp
for (i=0; i<cpl_vector_get_size(tmp4_v); i++) {
if (tmp4_d[i] > 0.) {
if (first_cont_region == -1) {
- continue; //regions have to start with continium
+ continue; //regions have to start with continuum
}
previous_line_region++;
} else {
@@ -805,6 +809,16 @@ cpl_bivector* kmo_priv_sky_tweak_correct_vibrational_trans (cpl_bivector *obj_sp
strcat(dbg_message, tmp_dbg_message);
cpl_free(tmp_dbg_message); tmp_dbg_message = NULL;
+ if (line_region_size == 0) {
+ tmp_dbg_message = cpl_sprintf(
+ ", either no line region found or a single which is not surrounded by continuum");
+ strcat(dbg_message, tmp_dbg_message);
+ cpl_free(tmp_dbg_message); tmp_dbg_message = NULL;
+ cpl_msg_debug(__func__, "%s", dbg_message);
+ dbg_message[0] = '\0';
+ continue;
+ }
+
// allocate arrays to hold concatenated line and continuum regions
KMO_TRY_EXIT_IF_NULL(
@@ -1029,6 +1043,7 @@ cpl_bivector* kmo_priv_sky_tweak_correct_vibrational_trans (cpl_bivector *obj_sp
}
KMO_CATCH {
+ KMO_CATCH_MSG();
}
if (tmp1_l_v != NULL) { cpl_vector_delete(tmp1_l_v); }
if (tmp1_o_v != NULL) { cpl_vector_delete(tmp1_o_v); }
@@ -1038,7 +1053,7 @@ cpl_bivector* kmo_priv_sky_tweak_correct_vibrational_trans (cpl_bivector *obj_sp
}
cpl_imagelist* kmo_priv_sky_tweak (cpl_imagelist *object, cpl_imagelist *sky,
- const cpl_propertylist *header, float min_frac) {
+ const cpl_propertylist *header, float min_frac, int tbsub) {
cpl_imagelist *result = NULL;
@@ -1138,13 +1153,16 @@ cpl_imagelist* kmo_priv_sky_tweak (cpl_imagelist *object, cpl_imagelist *sky,
cpl_imagelist_get(modified_sky,ix)
));
KMO_TRY_CHECK_ERROR_STATE();
+
// subtract thermal background from new object cube as well
- KMO_TRY_EXIT_IF_ERROR(
- cpl_image_subtract_scalar(
- cpl_imagelist_get(result, ix),
- cpl_vector_get(cpl_bivector_get_y_const(thermal_background), kx)
- ));
- KMO_TRY_CHECK_ERROR_STATE();
+ if (tbsub) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_image_subtract_scalar(
+ cpl_imagelist_get(result, ix),
+ cpl_vector_get(cpl_bivector_get_y_const(thermal_background), kx)
+ ));
+ KMO_TRY_CHECK_ERROR_STATE();
+ }
kx++;
}
diff --git a/kmos/kmo_priv_sky_tweak.h b/kmos/kmo_priv_sky_tweak.h
index 0e404f8..f763169 100644
--- a/kmos/kmo_priv_sky_tweak.h
+++ b/kmos/kmo_priv_sky_tweak.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_sky_tweak.h,v 1.1 2013/07/19 11:31:58 erw Exp $
+/* $Id: kmo_priv_sky_tweak.h,v 1.3 2013-09-13 09:10:28 erw Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: erw $
- * $Date: 2013/07/19 11:31:58 $
- * $Revision: 1.1 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-09-13 09:10:28 $
+ * $Revision: 1.3 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_SKY_TWEAK_H
@@ -42,19 +42,37 @@
* Prototypes
*----------------------------------------------------------------------------*/
-void amoeba(double **p, double y[], int ndim, double ftol,
- double (*funk)(double []), int *nfunk);
-cpl_bivector* kmo_get_thermal_background(cpl_bivector* spectrum, int remove_it);
+void amoeba(double **p,
+ double y[],
+ int ndim,
+ double ftol,
+ double (*funk)(double []),
+ int *nfunk);
-cpl_error_code kmo_priv_sky_tweak_get_spectra(const cpl_imagelist *object,
- const cpl_imagelist *sky,
- const cpl_vector *lambda,
- const cpl_image *mask,
- const int no_nans,
- cpl_bivector **obj_spectrum_ptr,
- cpl_bivector **sky_spectrum_ptr);
+cpl_bivector* kmo_get_thermal_background(
+ cpl_bivector* spectrum,
+ int remove_it);
+
+cpl_error_code kmo_priv_sky_tweak_get_spectra(
+ const cpl_imagelist *object,
+ const cpl_imagelist *sky,
+ const cpl_vector *lambda,
+ const cpl_image *mask,
+ const int no_nans,
+ cpl_bivector **obj_spectrum_ptr,
+ cpl_bivector **sky_spectrum_ptr);
+
+cpl_imagelist * kmo_priv_sky_tweak(
+ cpl_imagelist *object,
+ cpl_imagelist *sky,
+ const cpl_propertylist *header,
+ float min_frac,
+ int tbsub);
+
+cpl_bivector* kmo_priv_sky_tweak_correct_vibrational_trans(
+ cpl_bivector *obj_spectrum,
+ cpl_bivector *sky_spectrum
+ /*, int line_full_width*/);
-cpl_imagelist * kmo_priv_sky_tweak (cpl_imagelist *object, cpl_imagelist *sky,
- const cpl_propertylist *header, float min_frac);
#endif
diff --git a/kmos/kmo_priv_stats.c b/kmos/kmo_priv_stats.c
index cd7c2d3..c11ae75 100644
--- a/kmos/kmo_priv_stats.c
+++ b/kmos/kmo_priv_stats.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_stats.c,v 1.7 2013/06/17 07:52:26 aagudo Exp $
+/* $Id: kmo_priv_stats.c,v 1.7 2013-06-17 07:52:26 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 07:52:26 $
+ * $Date: 2013-06-17 07:52:26 $
* $Revision: 1.7 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/kmo_priv_stats.h b/kmos/kmo_priv_stats.h
index e2562c4..1164e43 100644
--- a/kmos/kmo_priv_stats.h
+++ b/kmos/kmo_priv_stats.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_stats.h,v 1.3 2012/06/29 10:26:44 aagudo Exp $
+/* $Id: kmo_priv_stats.h,v 1.3 2012-06-29 10:26:44 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2012/06/29 10:26:44 $
+ * $Date: 2012-06-29 10:26:44 $
* $Revision: 1.3 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_STATS_H
diff --git a/kmos/kmo_priv_std_star.c b/kmos/kmo_priv_std_star.c
index d7f9e7b..6600304 100644
--- a/kmos/kmo_priv_std_star.c
+++ b/kmos/kmo_priv_std_star.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_std_star.c,v 1.28 2013/07/29 18:10:08 aagudo Exp $
+/* $Id: kmo_priv_std_star.c,v 1.28 2013-07-29 18:10:08 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/07/29 18:10:08 $
+ * $Date: 2013-07-29 18:10:08 $
* $Revision: 1.28 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/kmo_priv_std_star.h b/kmos/kmo_priv_std_star.h
index b68a0fd..47e9e45 100644
--- a/kmos/kmo_priv_std_star.h
+++ b/kmos/kmo_priv_std_star.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_std_star.h,v 1.12 2013/07/29 18:10:08 aagudo Exp $
+/* $Id: kmo_priv_std_star.h,v 1.12 2013-07-29 18:10:08 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/07/29 18:10:08 $
+ * $Date: 2013-07-29 18:10:08 $
* $Revision: 1.12 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_STD_STAR_H
diff --git a/kmos/kmo_priv_wave_cal.c b/kmos/kmo_priv_wave_cal.c
index 0841996..464f531 100644
--- a/kmos/kmo_priv_wave_cal.c
+++ b/kmos/kmo_priv_wave_cal.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_wave_cal.c,v 1.46 2013/08/07 14:40:04 aagudo Exp $
+/* $Id: kmo_priv_wave_cal.c,v 1.48 2013-10-08 14:55:01 erw Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -19,10 +19,10 @@
*/
/*
- * $Author: aagudo $
- * $Date: 2013/08/07 14:40:04 $
- * $Revision: 1.46 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Author: erw $
+ * $Date: 2013-10-08 14:55:01 $
+ * $Revision: 1.48 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -5047,7 +5047,7 @@ cpl_image* kmo_reconstructed_arc_image(cpl_frameset *frameset,
imethod = reconstr_method;
}
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_setup_grid(&gd, imethod, neighborhoodRange, KMOS_PIX_RESOLUTION));
+ kmclipm_setup_grid(&gd, imethod, neighborhoodRange, KMOS_PIX_RESOLUTION, 0.));
char *tmp_band_method = getenv("KMO_BAND_METHOD");
int band_method = 0;
@@ -5162,7 +5162,10 @@ cpl_image* kmo_reconstructed_arc_image(cpl_frameset *frameset,
&data_cube,
NULL,
FALSE,
- FALSE));
+ FALSE,
+ NULL,
+ NULL,
+ NULL));
// create detector image
for (lz = 0; lz < gd.l.dim; lz++) {
diff --git a/kmos/kmo_priv_wave_cal.h b/kmos/kmo_priv_wave_cal.h
index 464539f..72a1019 100644
--- a/kmos/kmo_priv_wave_cal.h
+++ b/kmos/kmo_priv_wave_cal.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_wave_cal.h,v 1.8 2013/08/07 14:39:15 aagudo Exp $
+/* $Id: kmo_priv_wave_cal.h,v 1.8 2013-08-07 14:39:15 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/07 14:39:15 $
+ * $Date: 2013-08-07 14:39:15 $
* $Revision: 1.8 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_PRIV_WAVE_CAL_H
diff --git a/kmos/kmo_test_create_data.c b/kmos/kmo_test_create_data.c
index 5030940..ce6e35e 100644
--- a/kmos/kmo_test_create_data.c
+++ b/kmos/kmo_test_create_data.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_test_create_data.c,v 1.10 2013/02/28 10:10:23 aagudo Exp $
+/* $Id: kmo_test_create_data.c,v 1.10 2013-02-28 10:10:23 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -32,10 +32,10 @@
/*
* $Author: aagudo $
- * $Date: 2013/02/28 10:10:23 $,
+ * $Date: 2013-02-28 10:10:23 $,
""
* $Revision: 1.10 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#include <stdio.h>
diff --git a/kmos/kmo_test_create_data.h b/kmos/kmo_test_create_data.h
index 770c7bc..e867a28 100644
--- a/kmos/kmo_test_create_data.h
+++ b/kmos/kmo_test_create_data.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_test_create_data.h,v 1.4 2012/11/09 12:58:37 aagudo Exp $
+/* $Id: kmo_test_create_data.h,v 1.4 2012-11-09 12:58:37 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -32,9 +32,9 @@
/*
* $Author: aagudo $
- * $Date: 2012/11/09 12:58:37 $
+ * $Date: 2012-11-09 12:58:37 $
* $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_TEST_CREATE_DATA_H
diff --git a/kmos/kmo_utils.c b/kmos/kmo_utils.c
index d12c7e2..9e37144 100644
--- a/kmos/kmo_utils.c
+++ b/kmos/kmo_utils.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_utils.c,v 1.26 2013/07/29 17:45:38 aagudo Exp $
+/* $Id: kmo_utils.c,v 1.29 2013-10-21 13:44:54 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/07/29 17:45:38 $
- * $Revision: 1.26 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-21 13:44:54 $
+ * $Revision: 1.29 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -830,7 +830,7 @@ main_fits_desc kmo_identify_fits_header(const char *filename)
arr_naxis2[i] = cpl_propertylist_get_int(sub_header,
NAXIS2);
- KMO_TRY_ASSURE(strcmp(extname, EXT_LIST) == 0,
+ KMO_TRY_ASSURE(strstr(extname, EXT_LIST) != NULL,
CPL_ERROR_ILLEGAL_INPUT,
"EXTNAME keyword should contain 'LIST'");
} else {
@@ -1000,8 +1000,8 @@ main_fits_desc kmo_identify_fits_header(const char *filename)
if (desc.fits_type == f2d_fits) {
KMO_TRY_ASSURE((desc.nr_ext % KMOS_NR_DETECTORS == 0),
CPL_ERROR_ILLEGAL_INPUT,
- "F2D must have 3 * x extensions (plus "
- "primary one)!");
+ "%s: F2D must have 3 * x extensions (plus "
+ "primary one)!", filename);
}
// fill sub_desc
@@ -1738,6 +1738,7 @@ cpl_array** kmo_get_unused_ifus(const cpl_frameset *frameset,
LCAL,
FLAT_SKY,
ILLUM_CORR,
+ ILLUM_CORR_FLAT,
STD,
TELLURIC,
/*STD_IMAGE,
@@ -1768,7 +1769,7 @@ cpl_array** kmo_get_unused_ifus(const cpl_frameset *frameset,
};
cpl_array** ret = NULL;
cpl_propertylist *header = NULL;
- int nr_cat = 29,
+ int nr_cat = 30,
ifu_nr = 0,
tmp_int = 0,
i = 0,
@@ -1800,7 +1801,8 @@ cpl_array** kmo_get_unused_ifus(const cpl_frameset *frameset,
// loop all categories to check
for (i_cat = 0; i_cat < nr_cat; i_cat++) {
if (!((use_telluric && (strcmp(cat_check[i_cat], TELLURIC)==0)) ||
- (use_illum && (strcmp(cat_check[i_cat], ILLUM_CORR)==0))))
+ (use_illum && (strcmp(cat_check[i_cat], ILLUM_CORR)==0)) ||
+ (use_illum && (strcmp(cat_check[i_cat], ILLUM_CORR_FLAT)==0))))
{
header = kmo_dfs_load_primary_header((cpl_frameset*)frameset,
cat_check[i_cat]);
diff --git a/kmos/kmo_utils.h b/kmos/kmo_utils.h
index c3200ff..aaf30bf 100644
--- a/kmos/kmo_utils.h
+++ b/kmos/kmo_utils.h
@@ -1,4 +1,4 @@
-/* $Id: kmo_utils.h,v 1.2 2012/09/11 10:20:58 aagudo Exp $
+/* $Id: kmo_utils.h,v 1.2 2012-09-11 10:20:58 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2012/09/11 10:20:58 $
+ * $Date: 2012-09-11 10:20:58 $
* $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifndef KMOS_UTILS_H
diff --git a/kmos/tests/kmo_cpl_extensions-test.c b/kmos/tests/kmo_cpl_extensions-test.c
index 0117217..c483e04 100644
--- a/kmos/tests/kmo_cpl_extensions-test.c
+++ b/kmos/tests/kmo_cpl_extensions-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_cpl_extensions-test.c,v 1.4 2013/05/23 14:35:57 aagudo Exp $
+/* $Id: kmo_cpl_extensions-test.c,v 1.5 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/23 14:35:57 $
- * $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.5 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -448,7 +448,7 @@ void test_kmo_imagelist_divide()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
// ---------------------- missing in CPL -----------------------------------
test_kmo_image_histogram();
diff --git a/kmos/tests/kmo_debug-test.c b/kmos/tests/kmo_debug-test.c
index f819be0..b963a97 100644
--- a/kmos/tests/kmo_debug-test.c
+++ b/kmos/tests/kmo_debug-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_debug-test.c,v 1.2 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_debug-test.c,v 1.3 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.3 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -204,7 +204,7 @@ void test_kmo_plot_image()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_debug_header();
test_kmo_debug_frameset();
diff --git a/kmos/tests/kmo_dfs-test.c b/kmos/tests/kmo_dfs-test.c
index aa0f4c7..965bca7 100644
--- a/kmos/tests/kmo_dfs-test.c
+++ b/kmos/tests/kmo_dfs-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_dfs-test.c,v 1.11 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_dfs-test.c,v 1.12 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.11 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.12 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -1202,7 +1202,7 @@ void test_kmo_check_lamp()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_strlower();
test_kmo_extname_extractor();
diff --git a/kmos/tests/kmo_functions-test.c b/kmos/tests/kmo_functions-test.c
index 147a50a..5b3fa03 100644
--- a/kmos/tests/kmo_functions-test.c
+++ b/kmos/tests/kmo_functions-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_functions-test.c,v 1.3 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_functions-test.c,v 1.4 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.3 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.4 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -52,7 +52,7 @@ void test_kmo_reconstruct_sci()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_reconstruct_sci();
diff --git a/kmos/tests/kmo_priv_arithmetic-test.c b/kmos/tests/kmo_priv_arithmetic-test.c
index 95d470a..35c2475 100644
--- a/kmos/tests/kmo_priv_arithmetic-test.c
+++ b/kmos/tests/kmo_priv_arithmetic-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_arithmetic-test.c,v 1.4 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_arithmetic-test.c,v 1.5 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.5 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -462,7 +462,7 @@ void test_kmo_arithmetic_3D_scalar_noise()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_arithmetic_1D_1D();
test_kmo_arithmetic_1D_scalar();
diff --git a/kmos/tests/kmo_priv_combine-test.c b/kmos/tests/kmo_priv_combine-test.c
index 714d852..35d21ed 100644
--- a/kmos/tests/kmo_priv_combine-test.c
+++ b/kmos/tests/kmo_priv_combine-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_combine-test.c,v 1.6 2013/06/17 07:52:26 aagudo Exp $
+/* $Id: kmo_priv_combine-test.c,v 1.7 2013-10-08 11:19:14 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 07:52:26 $
- * $Revision: 1.6 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:19:14 $
+ * $Revision: 1.7 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -420,7 +420,7 @@ void test_kmo_priv_combine()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_align_subpix();
test_kmo_priv_combine();
diff --git a/kmos/tests/kmo_priv_copy-test.c b/kmos/tests/kmo_priv_copy-test.c
index 7d9c296..ac50fc9 100644
--- a/kmos/tests/kmo_priv_copy-test.c
+++ b/kmos/tests/kmo_priv_copy-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_copy-test.c,v 1.3 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_copy-test.c,v 1.4 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.3 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.4 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -648,7 +648,7 @@ void test_kmo_copy_cube_F3I()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_copy_scalar_F1I();
test_kmo_copy_scalar_F2I();
diff --git a/kmos/tests/kmo_priv_dark-test.c b/kmos/tests/kmo_priv_dark-test.c
index 4d0da3d..d2bdbcf 100644
--- a/kmos/tests/kmo_priv_dark-test.c
+++ b/kmos/tests/kmo_priv_dark-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_dark-test.c,v 1.2 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_dark-test.c,v 1.3 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.3 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -165,7 +165,7 @@ void test_kmo_add_bad_pix_border()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_create_bad_pix_dark();
test_kmo_add_bad_pix_border();
diff --git a/kmos/tests/kmo_priv_extract_spec-test.c b/kmos/tests/kmo_priv_extract_spec-test.c
index 25c832e..169d8fb 100644
--- a/kmos/tests/kmo_priv_extract_spec-test.c
+++ b/kmos/tests/kmo_priv_extract_spec-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_extract_spec-test.c,v 1.3 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_extract_spec-test.c,v 1.4 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.3 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.4 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -176,7 +176,7 @@ void test_kmo_priv_update_header()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_priv_extract_spec();
test_kmo_priv_update_header();
diff --git a/kmos/tests/kmo_priv_fit_profile-test.c b/kmos/tests/kmo_priv_fit_profile-test.c
index 764ef3f..766f204 100644
--- a/kmos/tests/kmo_priv_fit_profile-test.c
+++ b/kmos/tests/kmo_priv_fit_profile-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_fit_profile-test.c,v 1.2 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_fit_profile-test.c,v 1.3 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.3 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -683,7 +683,7 @@ void test_kmo_priv_moffat2d_fncd()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
// 1D
test_kmo_fit_profile_1D();
diff --git a/kmos/tests/kmo_priv_fits_check-test.c b/kmos/tests/kmo_priv_fits_check-test.c
index 93d5dd4..e67eddc 100644
--- a/kmos/tests/kmo_priv_fits_check-test.c
+++ b/kmos/tests/kmo_priv_fits_check-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_fits_check-test.c,v 1.2 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_fits_check-test.c,v 1.3 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.3 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -171,7 +171,7 @@ void test_kmo_fits_check_print_info()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_fits_check_print_header();
test_kmo_fits_check_print_vector();
diff --git a/kmos/tests/kmo_priv_fits_stack-test.c b/kmos/tests/kmo_priv_fits_stack-test.c
index a116860..bc1f7cd 100644
--- a/kmos/tests/kmo_priv_fits_stack-test.c
+++ b/kmos/tests/kmo_priv_fits_stack-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_fits_stack-test.c,v 1.2 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_fits_stack-test.c,v 1.3 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.3 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -443,7 +443,7 @@ void test_kmo_priv_check_dimensions()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_priv_fits_stack();
test_kmo_priv_check_dimensions();
diff --git a/kmos/tests/kmo_priv_flat-test.c b/kmos/tests/kmo_priv_flat-test.c
index 0fa47e2..107845e 100644
--- a/kmos/tests/kmo_priv_flat-test.c
+++ b/kmos/tests/kmo_priv_flat-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_flat-test.c,v 1.11 2013/07/29 18:06:56 aagudo Exp $
+/* $Id: kmo_priv_flat-test.c,v 1.15 2013-10-11 07:59:36 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/07/29 18:06:56 $
- * $Revision: 1.11 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-11 07:59:36 $
+ * $Revision: 1.15 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -48,53 +48,50 @@
*/
/**
- @brief test for kmo_create_bad_pix_flat()
+ @brief test for kmo_create_bad_pix_flat_thresh()
*/
-void test_kmo_create_bad_pix_flat()
+void test_kmo_create_bad_pix_flat_thresh()
{
cpl_image *img1 = NULL,
*img2 = NULL;
float tol = 0.01;
kmo_test_verbose_off();
- cpl_test_null(kmo_create_bad_pix_flat(NULL, -1));
+ cpl_test_null(kmo_create_bad_pix_flat_thresh(NULL, -1, 25));
cpl_test_error(CPL_ERROR_NULL_INPUT);
- img1 = cpl_image_new(4, 4, CPL_TYPE_FLOAT);
- cpl_image_set(img1, 1, 1, 1000.0);
- cpl_image_set(img1, 2, 1, 1000.0);
- cpl_image_set(img1, 3, 1, 2.0);
- cpl_image_set(img1, 4, 1, 2.0);
- cpl_image_set(img1, 1, 2, 1000.0);
- cpl_image_set(img1, 2, 2, 1000.0);
- cpl_image_set(img1, 3, 2, 1000.0);
- cpl_image_set(img1, 4, 2, 2.0);
- cpl_image_set(img1, 1, 3, 1000.0);
- cpl_image_set(img1, 2, 3, 2.0);
- cpl_image_set(img1, 3, 3, 2.0);
- cpl_image_set(img1, 4, 3, 2.0);
- cpl_image_set(img1, 1, 4, 1000.0);
- cpl_image_set(img1, 2, 4, 1000.0);
- cpl_image_set(img1, 3, 4, 1000.0);
- cpl_image_set(img1, 4, 4, 1000.0);
-
- cpl_test_null(kmo_create_bad_pix_flat(img1, -1));
+ img1 = cpl_image_new(12, 12, CPL_TYPE_FLOAT);
+ cpl_image_set(img1, 5, 5, 1000.0);
+ cpl_image_set(img1, 6, 5, 1000.0);
+ cpl_image_set(img1, 7, 5, 2.0);
+ cpl_image_set(img1, 8, 5, 2.0);
+ cpl_image_set(img1, 5, 6, 1000.0);
+ cpl_image_set(img1, 6, 6, 1000.0);
+ cpl_image_set(img1, 7, 6, 1000.0);
+ cpl_image_set(img1, 8, 6, 2.0);
+ cpl_image_set(img1, 5, 7, 1000.0);
+ cpl_image_set(img1, 6, 7, 2.0);
+ cpl_image_set(img1, 7, 7, 2.0);
+ cpl_image_set(img1, 8, 7, 2.0);
+ cpl_image_set(img1, 5, 8, 1000.0);
+ cpl_image_set(img1, 6, 8, 1000.0);
+ cpl_image_set(img1, 7, 8, 1000.0);
+ cpl_image_set(img1, 8, 8, 1000.0);
+
+ cpl_test_null(kmo_create_bad_pix_flat_thresh(img1, -1, 25));
cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
kmo_test_verbose_on();
- cpl_test_nonnull(img2 = kmo_create_bad_pix_flat(img1, 6));
+ cpl_test_nonnull(img2 = kmo_create_bad_pix_flat_thresh(img1, 6, 25));
cpl_test_abs(cpl_image_get_mean(img2), 1, tol);
cpl_test_eq(cpl_image_count_rejected(img2), 0);
-// cpl_test_abs(cpl_image_get_mean(img2), 2, thresh);
cpl_image_delete(img2);
cpl_test_error(CPL_ERROR_NONE);
cpl_image_reject(img1, 2, 2);
- cpl_test_nonnull(img2 = kmo_create_bad_pix_flat(img1, 6));
-//cpl_image_save(img2, "imgout.fits", CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+ cpl_test_nonnull(img2 = kmo_create_bad_pix_flat_thresh(img1, 6, 25));
cpl_test_abs(cpl_image_get_mean(img2), 1, tol);
cpl_test_eq(cpl_image_count_rejected(img2), 1);
-// cpl_test_abs(cpl_image_get_mean(img2), 2, thresh);
cpl_image_delete(img2);
cpl_test_error(CPL_ERROR_NONE);
@@ -103,512 +100,240 @@ void test_kmo_create_bad_pix_flat()
}
/**
- @brief test for kmo_calc_thresh()
+ @brief test for kmo_polyfit_edge()
*/
-void test_kmo_calc_thresh()
+void test_kmo_polyfit_edge()
{
kmo_test_verbose_off();
- cpl_test_abs(-1.0, kmo_calc_thresh(0, NULL), 0.01);
+ cpl_test_null(kmo_polyfit_edge(NULL, NULL, 3));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ kmclipm_vector *x = kmclipm_vector_load("ref_data/cut_yrow.fits", 0);
+ cpl_test_null(kmo_polyfit_edge(x, NULL, 3));
cpl_test_error(CPL_ERROR_NULL_INPUT);
- kmo_test_verbose_on();
- kmclipm_vector *midline = kmclipm_vector_load("ref_data/midline_cut.fits", 0);
- cpl_test_abs(835.687, kmo_calc_thresh(1106.87, midline), 0.01);
+ kmclipm_vector *y = kmclipm_vector_load("ref_data/cut_edge.fits", 0);
+
+ cpl_vector *f = NULL;
+ cpl_test_nonnull(f = kmo_polyfit_edge(x, y, 3));
+ cpl_test_abs(502.18, cpl_vector_get_mean(f), 0.01);
cpl_test_error(CPL_ERROR_NONE);
- kmclipm_vector_delete(midline);
+ kmclipm_vector_delete(x);
+ kmclipm_vector_delete(y);
+ cpl_vector_delete(f);
}
/**
- @brief test for kmo_analyze_flat()
+ @brief test for kmo_edge_trace()
*/
-void test_kmo_analyze_flat()
+void test_kmo_edge_trace()
{
- cpl_image *data = NULL,
- *badpix = NULL;
- kmclipm_vector *pos = NULL;
- int count_from_left = 0,
- count_index = 0,
- rej = 0;
-
- //
- // invalid tests
- //
kmo_test_verbose_off();
+ kmo_edge_trace(NULL, NULL, NULL, -1, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
- // invalid test (out of zoom)
- {
- data = kmclipm_image_load("ref_data/out_of_zoom.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
-
- cpl_test_null(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
-
- cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
-
- cpl_test_eq(count_from_left, -1);
- cpl_test_eq(count_index, -1);
-
- kmclipm_vector_delete(pos); pos = NULL;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
-
- // valid test (strong rotation, midline of size 2)
- {
- data = kmclipm_image_load("ref_data/strong_rotation_2high.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
-
- cpl_test_nonnull(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_eq(count_from_left, 1);
- cpl_test_eq(count_index, 0);
- cpl_test_eq(kmclipm_vector_get_size(pos), 224);
-
- kmclipm_vector_delete(pos); pos = NULL;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+ cpl_image *data = kmclipm_image_load("ref_data/well_formed_ifus.fits",
+ CPL_TYPE_FLOAT, 0, 0);
+ kmo_edge_trace(data, NULL, NULL, -1, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
- // invalid test (all_noise)
- {
- data = kmclipm_image_load("ref_data/noise_img.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+ kmclipm_vector *ddd = kmclipm_vector_load("ref_data/yrow.fits", 0);
+cpl_vector *yrow = kmclipm_vector_create_non_rejected(ddd);
+kmclipm_vector_delete(ddd);
+ kmo_edge_trace(data, yrow, NULL, -1, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
- cpl_test_null(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
- cpl_test_eq(count_from_left, -1);
- cpl_test_eq(count_index, -1);
+ cpl_vector *edge = NULL;
+ kmo_edge_trace(data, yrow, &edge, -1, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+ edge = cpl_vector_new(22);
+ kmo_edge_trace(data, yrow, &edge, -1, -1);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ kmo_edge_trace(data, yrow, &edge, 1, -1);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
kmo_test_verbose_on();
- //
- // valid tests
- //
-
- // valid test (all_zero)
- {
- count_from_left = 0; count_index = 0;
- data = cpl_image_new(2048, 201, CPL_TYPE_FLOAT);
- kmo_image_fill(data, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
-
- cpl_test_null(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(count_from_left, 0);
- cpl_test_eq(count_index, 0);
-
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
-
- // valid test (shift_right_one_slitlet_cut)
- {
- data = kmclipm_image_load("ref_data/shift_right_one_slitlet_cut.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+ kmo_edge_trace(data, yrow, &edge, 2008, 1);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2008.8, cpl_vector_get_mean(edge), 0.01);
- cpl_test_nonnull(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(count_from_left, 1);
- cpl_test_eq(count_index, 0);
- cpl_test_eq(kmclipm_vector_get_size(pos), 222);
- cpl_test_eq(kmclipm_vector_get(pos, 0, &rej), 64);
- cpl_test_eq(0, rej);
- cpl_test_eq(kmclipm_vector_get(pos, 221, &rej), 2034);
- cpl_test_eq(0, rej);
-
- kmclipm_vector_delete(pos); pos = NULL;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+ cpl_image_delete(data);
+ cpl_vector_delete(edge);
+ cpl_vector_delete(yrow);
+}
- // valid test (shift_left_one_slitlet_cut)
- {
- data = kmclipm_image_load("ref_data/shift_left_one_slitlet_cut.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
- cpl_test_nonnull(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(count_from_left, 0);
- cpl_test_eq(count_index, 0);
- cpl_test_eq(kmclipm_vector_get_size(pos), 222);
- cpl_test_eq(kmclipm_vector_get(pos, 0, &rej), 18);
- cpl_test_eq(kmclipm_vector_get(pos, 221, &rej), 1987);
-
- kmclipm_vector_delete(pos); pos = NULL;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+/**
+ @brief test for kmo_calc_calib_frames()
+*/
+void test_kmo_calc_calib_frames()
+{
+ kmo_test_verbose_off();
+ kmo_calc_calib_frames(NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
- // valid test (shift_right_slitlets_cut)
- {
- data = kmclipm_image_load("ref_data/shift_right_slitlets_cut.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
- cpl_test_nonnull(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(count_from_left, 1);
- cpl_test_eq(count_index, 0);
- cpl_test_eq(kmclipm_vector_get_size(pos), 216);
- cpl_test_eq(kmclipm_vector_get(pos, 0, &rej), 117);
- cpl_test_eq(kmclipm_vector_get(pos, 215, &rej), 2033);
-
- kmclipm_vector_delete(pos); pos = NULL;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
+ int n = 8, m = 14;
+ cpl_vector **slit_ids = (cpl_vector**)cpl_malloc(n*sizeof(cpl_vector*));
+ int i = 0, j = 0;
+ for (i = 0; i < n; i++) {
+ slit_ids[i] = cpl_vector_new(2*m);
+ for (j = 0; j < m; j++) {
+ cpl_vector_set(slit_ids[i], 2*j, j+1);
+ cpl_vector_set(slit_ids[i], 2*j+1, j+1);
+ }
}
+ kmo_calc_calib_frames(slit_ids, NULL, 0, NULL, NULL, NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
- // valid test (shift_left_slitlets_cut)
- {
- data = kmclipm_image_load("ref_data/shift_left_slitlets_cut.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
- cpl_test_nonnull(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(count_from_left, 0);
- cpl_test_eq(count_index, 0);
- cpl_test_eq(kmclipm_vector_get_size(pos), 216);
- cpl_test_eq(kmclipm_vector_get(pos, 0, &rej), 15);
- cpl_test_eq(kmclipm_vector_get(pos, 215, &rej), 1931);
-
- kmclipm_vector_delete(pos); pos = NULL;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
+ FILE *fp = fopen("ref_data/edgepars_matrix.bin","rb");
+ cpl_matrix **edgepars = (cpl_matrix**)cpl_malloc(n*sizeof(cpl_matrix*));
+ for (i = 0; i < n; i++) {
+ edgepars[i] = cpl_matrix_new(2*m, 4);
+ double *ddd = cpl_matrix_get_data(edgepars[i]);
+ fread(ddd, sizeof(double), 4*2*m, fp);
}
+ fclose(fp);
+ kmo_calc_calib_frames(slit_ids, edgepars, 0, NULL, NULL, NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
- // valid test (cut_left_right)
- {
- data = kmclipm_image_load("ref_data/cut_left_right.fits",
- CPL_TYPE_FLOAT, 0, 0);
- cpl_image_delete(badpix); badpix = NULL;
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
-
- cpl_test_nonnull(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(count_from_left, 1);
- cpl_test_eq(count_index, 1);
- cpl_test_eq(kmclipm_vector_get_size(pos), 220);
- cpl_test_eq(kmclipm_vector_get(pos, 0, &rej), 15);
- cpl_test_eq(kmclipm_vector_get(pos, 219, &rej), 1967);
-
- kmclipm_vector_delete(pos); pos = NULL;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+ cpl_image *data = kmclipm_image_load("ref_data/well_formed_ifus.fits",
+ CPL_TYPE_FLOAT, 0, 0);
+ kmo_calc_calib_frames(slit_ids, edgepars, 0, data, NULL, NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
- // valid test (shift_right_one_slitlet_cut_IFU2_missing)
- {
- data = kmclipm_image_load("ref_data/shift_right_one_slitlet_cut_IFU2_missing.fits",
- CPL_TYPE_FLOAT, 0, 0);
- cpl_image_delete(badpix); badpix = NULL;
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
- cpl_test_nonnull(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(count_from_left, 1);
- cpl_test_eq(count_index, 0);
- cpl_test_eq(kmclipm_vector_get_size(pos), 194);
- cpl_test_eq(kmclipm_vector_get(pos, 0, &rej), 64);
- cpl_test_eq(kmclipm_vector_get(pos, 193, &rej), 2034);
-
- kmclipm_vector_delete(pos); pos = NULL;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+ cpl_image *noise = cpl_image_duplicate(data);
+ cpl_image_fill_noise_uniform(noise, 0.0, 1.0);
+ kmo_calc_calib_frames(slit_ids, edgepars, 0, data, noise, NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
- // valid test (shift_right_one_slitlet_cut_IFU1_missing)
- {
- data = kmclipm_image_load("ref_data/shift_right_one_slitlet_cut_IFU1_missing.fits",
- CPL_TYPE_FLOAT, 0, 0);
- cpl_image_delete(badpix); badpix = NULL;
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
- cpl_test_nonnull(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(count_from_left, 1);
- cpl_test_eq(count_index, 0);
- cpl_test_eq(kmclipm_vector_get_size(pos), 194);
- cpl_test_eq(kmclipm_vector_get(pos, 0, &rej), 313);
- cpl_test_eq(kmclipm_vector_get(pos, 193, &rej), 2034);
-
- kmclipm_vector_delete(pos); pos = NULL;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+ cpl_image *bad = cpl_image_duplicate(data);
+ kmo_image_fill(bad, 1.0);
+ kmo_calc_calib_frames(slit_ids, edgepars, 0, data, noise, bad, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
- // valid test with 224 slitlet edges
- {
- data = kmclipm_image_load("ref_data/well_formed_ifus.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
- cpl_test_nonnull(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(count_from_left, 1);
- cpl_test_eq(count_index, 0);
- cpl_test_eq(kmclipm_vector_get_size(pos), 224);
-
- // check positions of IFU 1
- cpl_test_eq(kmclipm_vector_get(pos, 0, &rej), 21);
- cpl_test_eq(kmclipm_vector_get(pos, 1, &rej), 33);
- cpl_test_eq(kmclipm_vector_get(pos, 2, &rej), 39);
- cpl_test_eq(kmclipm_vector_get(pos, 3, &rej), 50);
- cpl_test_eq(kmclipm_vector_get(pos, 4, &rej), 56);
- cpl_test_eq(kmclipm_vector_get(pos, 5, &rej), 68);
- cpl_test_eq(kmclipm_vector_get(pos, 6, &rej), 74);
- cpl_test_eq(kmclipm_vector_get(pos, 7, &rej), 86);
- cpl_test_eq(kmclipm_vector_get(pos, 8, &rej), 92);
- cpl_test_eq(kmclipm_vector_get(pos, 9, &rej), 104);
- cpl_test_eq(kmclipm_vector_get(pos, 10, &rej), 110);
- cpl_test_eq(kmclipm_vector_get(pos, 11, &rej), 122);
- cpl_test_eq(kmclipm_vector_get(pos, 12, &rej), 128);
- cpl_test_eq(kmclipm_vector_get(pos, 13, &rej), 139);
- cpl_test_eq(kmclipm_vector_get(pos, 14, &rej), 145);
- cpl_test_eq(kmclipm_vector_get(pos, 15, &rej), 157);
- cpl_test_eq(kmclipm_vector_get(pos, 16, &rej), 163);
- cpl_test_eq(kmclipm_vector_get(pos, 17, &rej), 175);
- cpl_test_eq(kmclipm_vector_get(pos, 18, &rej), 181);
- cpl_test_eq(kmclipm_vector_get(pos, 19, &rej), 193);
- cpl_test_eq(kmclipm_vector_get(pos, 20, &rej), 199);
- cpl_test_eq(kmclipm_vector_get(pos, 21, &rej), 211);
- cpl_test_eq(kmclipm_vector_get(pos, 22, &rej), 217);
- cpl_test_eq(kmclipm_vector_get(pos, 23, &rej), 228);
- cpl_test_eq(kmclipm_vector_get(pos, 24, &rej), 234);
- cpl_test_eq(kmclipm_vector_get(pos, 25, &rej), 246);
- cpl_test_eq(kmclipm_vector_get(pos, 26, &rej), 252);
- cpl_test_eq(kmclipm_vector_get(pos, 27, &rej), 264);
- cpl_test_eq(kmclipm_vector_get(pos, 28, &rej), 270);
-
- // check positions of IFU 8
- cpl_test_eq(kmclipm_vector_get(pos, 195, &rej), 1759);
- cpl_test_eq(kmclipm_vector_get(pos, 196, &rej), 1765);
- cpl_test_eq(kmclipm_vector_get(pos, 197, &rej), 1777);
- cpl_test_eq(kmclipm_vector_get(pos, 198, &rej), 1783);
- cpl_test_eq(kmclipm_vector_get(pos, 199, &rej), 1795);
- cpl_test_eq(kmclipm_vector_get(pos, 200, &rej), 1801);
- cpl_test_eq(kmclipm_vector_get(pos, 201, &rej), 1813);
- cpl_test_eq(kmclipm_vector_get(pos, 202, &rej), 1818);
- cpl_test_eq(kmclipm_vector_get(pos, 203, &rej), 1830);
- cpl_test_eq(kmclipm_vector_get(pos, 204, &rej), 1836);
- cpl_test_eq(kmclipm_vector_get(pos, 205, &rej), 1848);
- cpl_test_eq(kmclipm_vector_get(pos, 206, &rej), 1854);
- cpl_test_eq(kmclipm_vector_get(pos, 207, &rej), 1866);
- cpl_test_eq(kmclipm_vector_get(pos, 208, &rej), 1872);
- cpl_test_eq(kmclipm_vector_get(pos, 209, &rej), 1884);
- cpl_test_eq(kmclipm_vector_get(pos, 210, &rej), 1890);
- cpl_test_eq(kmclipm_vector_get(pos, 211, &rej), 1902);
- cpl_test_eq(kmclipm_vector_get(pos, 212, &rej), 1907);
- cpl_test_eq(kmclipm_vector_get(pos, 213, &rej), 1919);
- cpl_test_eq(kmclipm_vector_get(pos, 214, &rej), 1925);
- cpl_test_eq(kmclipm_vector_get(pos, 215, &rej), 1937);
- cpl_test_eq(kmclipm_vector_get(pos, 216, &rej), 1943);
- cpl_test_eq(kmclipm_vector_get(pos, 217, &rej), 1955);
- cpl_test_eq(kmclipm_vector_get(pos, 218, &rej), 1961);
- cpl_test_eq(kmclipm_vector_get(pos, 219, &rej), 1973);
- cpl_test_eq(kmclipm_vector_get(pos, 220, &rej), 1979);
- cpl_test_eq(kmclipm_vector_get(pos, 221, &rej), 1991);
- cpl_test_eq(kmclipm_vector_get(pos, 222, &rej), 1996);
- cpl_test_eq(kmclipm_vector_get(pos, 223, &rej), 2008);
-
- kmclipm_vector_delete(pos); pos = NULL;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+ cpl_image *xcal = cpl_image_duplicate(data);
+ kmo_image_fill(xcal, 0.0);
+ kmo_calc_calib_frames(slit_ids, edgepars, 0, data, noise, bad, xcal, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
- // valid test (strong rotation, midline of 40)
- {
- data = kmclipm_image_load("ref_data/strong_rotation_40high.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
- cpl_test_nonnull(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(count_from_left, 1);
- cpl_test_eq(count_index, 0);
- cpl_test_eq(kmclipm_vector_get_size(pos), 224);
- cpl_test_eq(kmclipm_vector_get(pos, 0, &rej), 17);
- cpl_test_eq(kmclipm_vector_get(pos, 223, &rej), 2012);
-
- kmclipm_vector_delete(pos); pos = NULL;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+ cpl_image *ycal = cpl_image_duplicate(data);
+ kmo_image_fill(ycal, 0.0);
+ kmo_calc_calib_frames(slit_ids, edgepars, 0, data, noise, bad, xcal, ycal);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ kmo_test_verbose_on();
- // valid test (strong rotation, midline of 100)
- {
- cpl_image_delete(badpix); badpix = NULL;
- data = kmclipm_image_load("ref_data/strong_rotation_100high.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
- cpl_test_nonnull(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(count_from_left, 1);
- cpl_test_eq(count_index, 0);
- cpl_test_eq(kmclipm_vector_get_size(pos), 224);
- cpl_test_eq(kmclipm_vector_get(pos, 0, &rej), 17);
- cpl_test_eq(kmclipm_vector_get(pos, 223, &rej), 2012);
-
- kmclipm_vector_delete(pos); pos = NULL;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+ kmo_calc_calib_frames(slit_ids, edgepars, 1, data, noise, bad, xcal, ycal);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(0.616954, cpl_image_get_mean(xcal), 0.1);
+ cpl_test_abs(0.72347, cpl_image_get_mean(ycal), 0.1);
+ cpl_test_abs(10371.3, cpl_image_get_mean(data), 0.1);
+ cpl_test_abs(0.52, cpl_image_get_mean(noise), 0.1);
+ cpl_test_abs(1, cpl_image_get_mean(bad), 0.1);
- // valid test (real_data)
- {
- data = kmclipm_image_load("ref_data/real_data1.fits",
- CPL_TYPE_FLOAT, 0, 0);
- cpl_image_delete(badpix); badpix = NULL;
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
- cpl_test_nonnull(pos = kmo_analyze_flat(data,
- badpix,
- &count_from_left,
- &count_index));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(count_from_left, 0);
- cpl_test_eq(count_index, 0);
- cpl_test_eq(kmclipm_vector_get_size(pos), 196);
- cpl_test_eq(kmclipm_vector_get(pos, 0, &rej), 21);
- cpl_test_eq(kmclipm_vector_get(pos, 195, &rej), 1779);
- kmclipm_vector_delete(pos); pos = NULL;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
+ cpl_image_delete(xcal);
+ cpl_image_delete(ycal);
+ cpl_image_delete(bad);
+ for (i = 0; i < n; i++) {
+ cpl_vector_delete(slit_ids[i]);
+ cpl_matrix_delete(edgepars[i]);
}
+ cpl_free(slit_ids);
+ cpl_free(edgepars);
+ cpl_image_delete(data);
+ cpl_image_delete(noise);
}
/**
- @brief test for kmo_calc_curvature()
+ @brief test for kmo_curvature_qc()
*/
-void test_kmo_calc_curvature()
+void test_kmo_curvature_qc()
{
kmo_test_verbose_off();
- kmo_calc_curvature(NULL, NULL, NULL, NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ kmo_curvature_qc(NULL, NULL, NULL, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- cpl_image *data = kmclipm_image_load("ref_data/well_formed_ifus.fits",
- CPL_TYPE_FLOAT, 0, 0);
- kmo_calc_curvature(data, NULL, NULL, NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ int n = 8, m = 14;
+ FILE *fp = fopen("ref_data/edgepars_matrix.bin","rb");
+ cpl_matrix **edgepars = (cpl_matrix**)cpl_malloc(n*sizeof(cpl_matrix*));
+ int i = 0;
+ for (i = 0; i < n; i++) {
+ edgepars[i] = cpl_matrix_new(2*m, 4);
+ double *ddd = cpl_matrix_get_data(edgepars[i]);
+ fread(ddd, sizeof(double), 4*2*m, fp);
+ }
+ fclose(fp);
+ kmo_curvature_qc(edgepars, NULL, NULL, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- cpl_image *noise = cpl_image_duplicate(data);
- cpl_image_fill_noise_uniform(noise, 0.0, 1.0);
- kmo_calc_curvature(data, noise, NULL, NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ double gapmean = -1, gapsdv = -1, gapmaxdev = -1, slitmean = -1, slitsdv = -1, slitmaxdev = -1;
+ kmo_curvature_qc(edgepars, &gapmean, NULL, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- cpl_array* ifu = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifu, 0);
- kmo_calc_curvature(data, noise, ifu, NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ kmo_curvature_qc(edgepars, &gapmean, &gapsdv, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- cpl_image *bad = cpl_image_duplicate(data);
- kmo_image_fill(bad, 1.0);
- kmo_calc_curvature(data, noise, ifu, bad, 0, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ kmo_curvature_qc(edgepars, &gapmean, &gapsdv, &gapmaxdev, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- cpl_image *xcal = NULL, *ycal = NULL;
- kmo_calc_curvature(data, noise, ifu, bad, 0, &xcal, &ycal,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ kmo_curvature_qc(edgepars, &gapmean, &gapsdv, &gapmaxdev, &slitmean, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- double gapmean, gapsdv, gapmaxdev, slitmean, slitsdv, slitmaxdev;
- kmo_calc_curvature(data, noise, ifu, bad, 0, &xcal, &ycal, &gapmean, &gapsdv,
- &gapmaxdev, &slitmean, &slitsdv, &slitmaxdev, NULL);
+ kmo_curvature_qc(edgepars, &gapmean, &gapsdv, &gapmaxdev, &slitmean, &slitsdv, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- cpl_table **edge_par = NULL;
- kmo_calc_curvature(data, noise, ifu, bad, 0, &xcal, &ycal, &gapmean, &gapsdv,
- &gapmaxdev, &slitmean, &slitsdv, &slitmaxdev, &edge_par);
- cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
-
kmo_test_verbose_on();
-
- cpl_test_abs(7997.86, cpl_image_get_mean(data), 0.01);
- cpl_test_abs(0.500227, cpl_image_get_mean(noise), 0.1);
- cpl_test_abs(1, cpl_image_get_mean(bad), 0.01);
- kmo_calc_curvature(data, noise, ifu, bad, 1, &xcal, &ycal, &gapmean, &gapsdv,
- &gapmaxdev, &slitmean, &slitsdv, &slitmaxdev, &edge_par);
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_abs(0.739485, cpl_image_get_mean(xcal), 0.01*6);
- cpl_test_abs(0.463688, cpl_image_get_mean(ycal), 0.01*16);
- cpl_test_abs(10373.4, cpl_image_get_mean(data), 0.01*20);
- cpl_test_abs(0.504425, cpl_image_get_mean(noise), 0.1);
- cpl_test_abs(1, cpl_image_get_mean(bad), 0.01);
+ kmo_curvature_qc(edgepars, &gapmean, &gapsdv, &gapmaxdev, &slitmean, &slitsdv, &slitmaxdev);
cpl_test_abs(4.90468, gapmean, 0.01);
cpl_test_abs(0.130222, gapsdv, 0.01);
- cpl_test_abs(0.342252, gapmaxdev, 0.01*2);
+ cpl_test_abs(0.342574, gapmaxdev, 0.01);
cpl_test_abs(12.8883, slitmean, 0.01);
cpl_test_abs(0.131986, slitsdv, 0.01);
- cpl_test_abs(0.40414, slitmaxdev, 0.01);
+ cpl_test_abs(0.403824, slitmaxdev, 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
- double checksum = 0;
- checksum += cpl_table_get_column_mean(edge_par[0], "ID");
- checksum += cpl_table_get_column_mean(edge_par[0], "A0");
- checksum += cpl_table_get_column_mean(edge_par[0], "A1");
- checksum += cpl_table_get_column_mean(edge_par[0], "A2");
- checksum += cpl_table_get_column_mean(edge_par[0], "A3");
+ for (i = 0; i < n; i++) {
+ cpl_matrix_delete(edgepars[i]);
+ }
+ cpl_free(edgepars);
+}
+
+/**
+ @brief test for kmo_edgepars_to_table()
+*/
+void test_kmo_edgepars_to_table()
+{
+ kmo_test_verbose_off();
+ cpl_test_null(kmo_edgepars_to_table(NULL, NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ int n = 8, m = 14;
+ cpl_vector **slit_ids = (cpl_vector**)cpl_malloc(n*sizeof(cpl_vector*));
+ int i = 0, j = 0;
+ for (i = 0; i < n; i++) {
+ slit_ids[i] = cpl_vector_new(2*m);
+ for (j = 0; j < m; j++) {
+ cpl_vector_set(slit_ids[i], 2*j, j+1);
+ cpl_vector_set(slit_ids[i], 2*j+1, j+1);
+ }
+ }
+ cpl_test_null(kmo_edgepars_to_table(slit_ids, NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ kmo_test_verbose_on();
+
+ FILE *fp = fopen("ref_data/edgepars_matrix.bin","rb");
+ cpl_matrix **edgepars = (cpl_matrix**)cpl_malloc(n*sizeof(cpl_matrix*));
+ for (i = 0; i < n; i++) {
+ edgepars[i] = cpl_matrix_new(2*m, 4);
+ double *ddd = cpl_matrix_get_data(edgepars[i]);
+ fread(ddd, sizeof(double), 4*2*m, fp);
+ }
+ fclose(fp);
+ cpl_table **edge_par = NULL;
+ cpl_test_nonnull(edge_par = kmo_edgepars_to_table(slit_ids, edgepars));
+ cpl_test_error(CPL_ERROR_NONE);
+ double checksum = 0;
+ checksum += cpl_table_get_column_mean(edge_par[0], "ID");
+ checksum += cpl_table_get_column_mean(edge_par[0], "A0");
+ checksum += cpl_table_get_column_mean(edge_par[0], "A1");
+ checksum += cpl_table_get_column_mean(edge_par[0], "A2");
+ checksum += cpl_table_get_column_mean(edge_par[0], "A3");
checksum += cpl_table_get_column_mean(edge_par[1], "ID");
checksum += cpl_table_get_column_mean(edge_par[1], "A0");
checksum += cpl_table_get_column_mean(edge_par[1], "A1");
@@ -644,1892 +369,1499 @@ void test_kmo_calc_curvature()
checksum += cpl_table_get_column_mean(edge_par[7], "A1");
checksum += cpl_table_get_column_mean(edge_par[7], "A2");
checksum += cpl_table_get_column_mean(edge_par[7], "A3");
-// cpl_test_abs(8177.27, checksum, 0.01);
- cpl_test_abs(8177.24, checksum, 0.01*2);
+ cpl_test_abs(8177.27, checksum, 0.01);
- int i = 0;
for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
cpl_table_delete(edge_par[i]); edge_par[i] = NULL;
}
cpl_free(edge_par);
- cpl_image_delete(xcal);
- cpl_image_delete(ycal);
- cpl_array_delete(ifu);
- cpl_image_delete(bad);
- cpl_image_delete(data);
- cpl_image_delete(noise);
+ for (i = 0; i < n; i++) {
+ cpl_vector_delete(slit_ids[i]);
+ cpl_matrix_delete(edgepars[i]);
+ }
+ cpl_free(slit_ids);
+ cpl_free(edgepars);
}
/**
- @brief test for kmos_get_valid_edge_pos()
+ @brief test for kmo_flat_interpolate_edge_parameters()
*/
-void test_kmos_get_valid_edge_pos()
+void test_kmo_flat_interpolate_edge_parameters()
{
- cpl_image *data = NULL,
- *badpix = NULL;
- cpl_array **pos = NULL;
- cpl_array *ifus = NULL;
-
- //
- // invalid tests
- //
- kmo_test_verbose_off();
-
- // invalid test (out of zoom)
- {
- data = kmclipm_image_load("ref_data/out_of_zoom.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+ double checksum = 0;
+ int n = 8, m = 14;
+ FILE *fp = fopen("ref_data/edgepars_matrix.bin","rb");
+ cpl_matrix **edgepars = (cpl_matrix**)cpl_malloc(n*sizeof(cpl_matrix*));
+ int i = 0;
+ for (i = 0; i < n; i++) {
+ edgepars[i] = cpl_matrix_new(2*m, 4);
+ double *ddd = cpl_matrix_get_data(edgepars[i]);
+ fread(ddd, sizeof(double), 4*2*m, fp);
- // in : 0 0 0 0 0 0 0 0
- // out: 0 0 0 0 0 0 0 0
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_null(pos = kmos_get_valid_edge_pos(data, badpix, ifus, 1));
- cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_array_delete(ifus);
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
+ checksum += cpl_matrix_get_mean(edgepars[i]);
}
+ fclose(fp);
- // invalid test (all_noise)
- {
- data = kmclipm_image_load("ref_data/noise_img.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+ cpl_test_abs(2029.32, checksum, 0.01);
+ kmo_flat_interpolate_edge_parameters(edgepars, 4.0, 1, 1, 1);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2029.32, checksum, 0.01);
- // in : 0 0 0 0 0 0 0 0
- // out: 2 2 2 2 2 2 2 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_null(pos = kmos_get_valid_edge_pos(data, badpix, ifus, 1));
- cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_array_delete(ifus);
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
+ for (i = 0; i < n; i++) {
+ cpl_matrix_delete(edgepars[i]);
}
+ cpl_free(edgepars);
+}
- //
- // valid tests
- //
-
- // valid test (all_zero)
- {
- data = cpl_image_new(2048, 201, CPL_TYPE_FLOAT);
- kmo_image_fill(data, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+/**
+ @brief test for kmo_chebyshev_coefficients()
+*/
+void test_kmo_chebyshev_coefficients()
+{
+ double in[4] = {1764.78, -0.00416616, 4.09266e-05, -1.74782e-07},
+ out[4];
+ kmo_chebyshev_coefficients(in, out, 4, 1);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(1764.78, out[0], 0.01);
+ cpl_test_abs(-0.00416629, out[1], 1e-5);
+ cpl_test_abs(2.04633e-05, out[2], 1e-7);
+ cpl_test_abs(-4.36956e-08, out[3], 1e-10);
+}
- // in : 0 0 0 0 0 0 0 0
- // out: 2 2 2 2 2 2 2 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_null(pos[0]);
- cpl_test_null(pos[1]);
- cpl_test_null(pos[2]);
- cpl_test_null(pos[3]);
- cpl_test_null(pos[4]);
- cpl_test_null(pos[5]);
- cpl_test_null(pos[6]);
- cpl_test_null(pos[7]);
- int i = 0;
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_array_delete(ifus);
- cpl_free(pos); pos = NULL;
-
- // in : 0 0 0 1 0 0 0 0
- // out: 2 2 2 2 2 2 2 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 3, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_null(pos[0]);
- cpl_test_null(pos[1]);
- cpl_test_null(pos[2]);
- cpl_test_null(pos[3]);
- cpl_test_null(pos[4]);
- cpl_test_null(pos[5]);
- cpl_test_null(pos[6]);
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
+/**
+ @brief test for kmo_split_frame()
+*/
+void test_kmo_split_frame()
+{
+ cpl_image *xcal = NULL;
+ int *bounds = NULL;
- cpl_array_delete(ifus);
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+ /* --- invalid tests --- */
+ kmo_test_verbose_off();
+ cpl_test_null(bounds = kmo_split_frame(NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
- // valid test (shift_right_one_slitlet_cut)
- {
- data = kmclipm_image_load("ref_data/shift_right_one_slitlet_cut.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+ xcal = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
+ cpl_test_null(bounds = kmo_split_frame(xcal));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_image_delete(xcal); xcal = NULL;
+ kmo_test_verbose_on();
- // in : 0 0 0 0 0 0 0 0
- // out: 0 0 0 0 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 0);
- cpl_test_eq(cpl_array_get_int(pos[0], 0, NULL), 64);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 307);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 313);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 556);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 562);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 805);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 811);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 1055);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 1061);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1304);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1310);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1553);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1559);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1802);
- cpl_test_null(pos[7]);
- int i = 0;
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 1 0 0 0 0 0 0 0
- // out: 1 0 0 0 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 0, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_null(pos[0]);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 313);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 556);
- // ...
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 0 1 0 0 0 0 0 0
- // out: 0 1 0 0 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 1, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 0);
- cpl_test_eq(cpl_array_get_int(pos[0], 0, NULL), 64);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 307);
- cpl_test_null(pos[1]);
- // ...
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
+ /* --- valid tests --- */
+ xcal = cpl_image_new(KMOS_DETECTOR_SIZE, KMOS_DETECTOR_SIZE, CPL_TYPE_FLOAT);
+ cpl_image_multiply_scalar(xcal, 0.0);
+ int ix = 0, iy = 0;
+ for (ix = 1; ix <= KMOS_DETECTOR_SIZE; ix++) {
+ for (iy = 1; iy <= KMOS_DETECTOR_SIZE; iy++) {
+ if (!((ix==3) && (iy==1)) &&
+ !((ix==4) && (iy==1)) &&
+ !((ix==5) && (iy==1)) &&
+ !((ix==6) && (iy==1)) &&
+ !((ix==5) && (iy==5)) &&
+ !((ix==6) && (iy==5)) &&
+ !((ix==7) && (iy==5)) &&
+ !((ix==8) && (iy==5)))
+ {
+ cpl_image_reject(xcal, ix, iy);
+ }
}
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
}
+ cpl_image_set(xcal, 3, 1, 1.1);
+ cpl_image_set(xcal, 4, 1, 2.1);
+ cpl_image_set(xcal, 5, 1, 3.1);
+ cpl_image_set(xcal, 6, 1, 4.1);
+ cpl_image_set(xcal, 5, 5, 1.4);
+ cpl_image_set(xcal, 6, 5, 2.4);
+ cpl_image_set(xcal, 7, 5, 3.4);
+ cpl_image_set(xcal, 8, 5, 4.4);
- // valid test (shift_right_slitlets_cut)
- {
- data = kmclipm_image_load("ref_data/shift_right_slitlets_cut.fits",
- CPL_TYPE_FLOAT, 0, 0);
-
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+ cpl_test_nonnull(bounds = kmo_split_frame(xcal));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(2, bounds[0]);
+ cpl_test_eq(5, bounds[1]);
+ cpl_test_eq(-1, bounds[2]);
+ cpl_test_eq(-1, bounds[3]);
+ cpl_test_eq(-1, bounds[4]);
+ cpl_test_eq(-1, bounds[5]);
+ cpl_test_eq(4, bounds[6]);
+ cpl_test_eq(7, bounds[7]);
+ cpl_test_eq(-1, bounds[8]);
+ cpl_test_eq(-1, bounds[9]);
+ cpl_test_eq(-1, bounds[10]);
+ cpl_test_eq(-1, bounds[11]);
+ cpl_test_eq(-1, bounds[12]);
+ cpl_test_eq(-1, bounds[13]);
+ cpl_test_eq(-1, bounds[14]);
+ cpl_test_eq(-1, bounds[15]);
- // in : 0 0 0 0 0 0 0 0
- // out: 0 0 0 0 0 0 0 0
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 0);
- cpl_test_eq(cpl_array_get_int(pos[0], 0, NULL), 117);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 360);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 366);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 609);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 615);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 858);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 864);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 1108);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 1114);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1357);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1363);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1606);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1612);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1855);
- cpl_test_null(pos[7]);
- int i = 0;
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 1 0 0 0 0 0 0 1
- // out: 1 0 0 0 0 0 0 1
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 0, 1);
- cpl_array_set_int(ifus, 7, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 1);
-
- cpl_test_null(pos[0]);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 366);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 609);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 615);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 858);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 864);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 1108);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 1114);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1357);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1363);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1606);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1612);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1855);
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
+ cpl_image_delete(xcal); xcal = NULL;
+ cpl_free(bounds);
+}
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+/**
+ @brief test for kmo_imagelist_get_saturated()
+*/
+void test_kmo_imagelist_get_saturated()
+{
+ cpl_imagelist *list = NULL;
+ cpl_image *img = NULL;
- // valid test (shift_right_one_slitlet_cut_IFU1_missing)
- {
- data = kmclipm_image_load("ref_data/shift_right_one_slitlet_cut_IFU1_missing.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+ /* --- invalid tests --- */
+ kmo_test_verbose_off();
+ cpl_test_eq(-1, kmo_imagelist_get_saturated(NULL, -1.0, -1.0));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ list = cpl_imagelist_new();
+ cpl_test_eq(-1, kmo_imagelist_get_saturated(list, -1.0, -1.0));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_test_eq(-1, kmo_imagelist_get_saturated(list, 1000, -1.0));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ kmo_test_verbose_on();
- // in : 1 0 0 0 0 0 0 0
- // out: 1 0 0 0 0 0 0 0
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 0, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_null(pos[0]);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 313);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 556);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 562);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 806);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 811);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 1055);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 1060);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1304);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1310);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1553);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1559);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1802);
- cpl_test_null(pos[7]);
- int i = 0;
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 1 0 1 0 0 0 0 0
- // out: 1 0 1 0 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 0, 1);
- cpl_array_set_int(ifus, 2, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_null(pos[0]);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 313);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 556);
- cpl_test_null(pos[2]);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 811);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 1055);
- // ...
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 0 0 0 0 0 0 0 0
- // out: 2 0 0 0 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_null(pos[0]);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 313);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 556);
- // ...
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 0 0 0 1 0 0 0 0
- // out: 2 0 0 1 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 3, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_null(pos[0]);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 313);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 556);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 562);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 806);
- cpl_test_null(pos[3]);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 1060);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1304);
- // ...
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
+ /* --- valid tests --- */
+ img = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
+ cpl_image_set(img, 1, 1, 10000);
+ cpl_image_set(img, 1, 2, 10000);
+ cpl_image_set(img, 2, 1, 10000);
+ cpl_image_set(img, 2, 2, 1);
+ cpl_imagelist_set(list, img, 0);
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- cpl_array_delete(ifus);
- }
+ img = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
+ cpl_image_set(img, 1, 1, 10000);
+ cpl_image_set(img, 1, 2, 10000);
+ cpl_image_set(img, 2, 1, 1);
+ cpl_image_set(img, 2, 2, 1);
+ cpl_imagelist_set(list, img, 1);
- // valid test (shift_right_one_slitlet_cut_IFU2_missing)
- {
- data = kmclipm_image_load("ref_data/shift_right_one_slitlet_cut_IFU2_missing.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+ img = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
+ cpl_image_set(img, 1, 1, 10000);
+ cpl_image_set(img, 1, 2, 1);
+ cpl_image_set(img, 2, 1, 1);
+ cpl_image_set(img, 2, 2, 1);
+ cpl_imagelist_set(list, img, 2);
- // in : 0 1 0 0 0 0 0 0
- // out: 0 1 0 0 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 1, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 0);
- cpl_test_eq(cpl_array_get_int(pos[0], 0, NULL), 64);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 307);
- cpl_test_null(pos[1]);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 562);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 806);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 811);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 1055);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 1060);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1304);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1310);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1553);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1559);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1802);
- cpl_test_null(pos[7]);
- int i = 0;
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 0 0 0 0 0 0 0 0
- // out: 0 2 0 0 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 0);
- cpl_test_eq(cpl_array_get_int(pos[0], 0, NULL), 64);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 307);
- cpl_test_null(pos[1]);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 562);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 806);
- // ...
- cpl_test_null(pos[7]);
- cpl_array_delete(ifus);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
-
- // in : 1 1 0 0 0 0 0 0
- // out: 1 1 0 0 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 0, 1);
- cpl_array_set_int(ifus, 1, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_null(pos[0]);
- cpl_test_null(pos[1]);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 562);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 806);
- // ...
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 0 1 0 1 0 0 0 0
- // out: 0 1 0 1 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 1, 1);
- cpl_array_set_int(ifus, 3, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 0);
- cpl_test_eq(cpl_array_get_int(pos[0], 0, NULL), 64);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 307);
- cpl_test_null(pos[1]);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 562);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 806);
- cpl_test_null(pos[3]);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 1060);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1304);
- // ...
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 0 0 0 1 0 0 0 0
- // out: 0 2 0 1 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 3, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 0);
- cpl_test_eq(cpl_array_get_int(pos[0], 0, NULL), 64);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 307);
- cpl_test_null(pos[1]);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 562);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 806);
- cpl_test_null(pos[3]);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 1060);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1304);
- // ...
- cpl_test_null(pos[7]);
- cpl_array_delete(ifus);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
+ cpl_test_eq(2, kmo_imagelist_get_saturated(list, 1000, 2));
+ cpl_test_error(CPL_ERROR_NONE);
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+ cpl_imagelist_delete(list);
+}
- // valid test with 224 slitlet edges
- {
- data = kmclipm_image_load("ref_data/well_formed_ifus.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+/**
+ @brief test for kmo_create_line_profile()
+*/
+void test_kmo_create_line_profile()
+{
+ kmo_test_verbose_off();
+ cpl_test_null(kmo_create_line_profile(NULL, -1, -1));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
- // in : 0 0 0 0 0 0 0 0
- // out: 0 0 0 0 0 0 0 0
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 0);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 0);
- cpl_test_eq(cpl_array_get_int(pos[0], 0, NULL), 21);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 264);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 270);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 513);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 519);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 762);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 768);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 1012);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 1018);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1261);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1267);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1510);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1516);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1759);
- cpl_test_eq(cpl_array_count_invalid(pos[7]), 0);
- cpl_test_eq(cpl_array_get_int(pos[7], 0, NULL), 1765);
- cpl_test_eq(cpl_array_get_int(pos[7], 27, NULL), 2008);
- int i = 0;
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 0 0 0 0 0 0 0 1
- // out: 0 0 0 0 0 0 0 1
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 7, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 1);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 0);
- cpl_test_eq(cpl_array_get_int(pos[0], 0, NULL), 21);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 264);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 270);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 513);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 519);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 762);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 768);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 1012);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 1018);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1261);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1267);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1510);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1516);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1759);
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
+ cpl_image *profile = kmclipm_image_load ("ref_data/line_prof.fits", CPL_TYPE_FLOAT, 0, 0);
+ cpl_test_null(kmo_create_line_profile(profile, 10, 5));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ kmo_test_verbose_on();
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- cpl_array_delete(ifus);
- }
+ kmclipm_vector *midline = NULL;
+ cpl_test_nonnull(midline = kmo_create_line_profile(profile, 80, 120));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(1106.87, kmclipm_vector_get_mean(midline), 0.01);
+ cpl_test_eq(1, kmclipm_vector_is_rejected(midline, 0));
+ cpl_test_eq(1, kmclipm_vector_is_rejected(midline, 1));
+ cpl_test_eq(1, kmclipm_vector_is_rejected(midline, 2));
+ cpl_test_eq(1, kmclipm_vector_is_rejected(midline, 3));
+ cpl_test_eq(0, kmclipm_vector_is_rejected(midline, 4));
+ cpl_test_eq(0, kmclipm_vector_is_rejected(midline, 2043));
+ cpl_test_eq(1, kmclipm_vector_is_rejected(midline, 2044));
+ cpl_test_eq(1, kmclipm_vector_is_rejected(midline, 2045));
+ cpl_test_eq(1, kmclipm_vector_is_rejected(midline, 2046));
+ cpl_test_eq(1, kmclipm_vector_is_rejected(midline, 2047));
- // valid test (strong rotation, midline of 100)
- {
- data = kmclipm_image_load("ref_data/strong_rotation_100high.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+ kmclipm_vector_delete(midline);
+ cpl_image_delete(profile);
+}
- // in : 0 0 0 0 0 0 0 0
- // out: 0 0 0 0 0 0 0 0
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 0);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 0);
- cpl_test_eq(cpl_array_get_int(pos[0], 0, NULL), 17);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 261);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 267);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 511);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 517);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 761);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 767);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 1011);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 1017);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1261);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1267);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1511);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1517);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1762);
- cpl_test_eq(cpl_array_count_invalid(pos[7]), 0);
- cpl_test_eq(cpl_array_get_int(pos[7], 0, NULL), 1768);
- cpl_test_eq(cpl_array_get_int(pos[7], 27, NULL), 2012);
- int i = 0;
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
+/**
+ @brief test for kmo_get_slitedges()
+*/
+void test_kmo_get_slitedges()
+{
+ kmclipm_vector *pos, *midline;
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- cpl_array_delete(ifus);
- }
+ kmo_test_verbose_off();
+ cpl_test_null(kmo_get_slitedges(NULL, 0));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ kmo_test_verbose_on();
- // valid test (cut_left_right)
- {
- data = kmclipm_image_load("ref_data/cut_left_right.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+ midline = kmclipm_vector_load("ref_data/midline.fits", 0);
+ cpl_test_nonnull(pos = kmo_get_slitedges(midline, 1106.87));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(881.8, kmclipm_vector_get_mean(pos), 0.1);
+ kmclipm_vector_delete(midline);
+ kmclipm_vector_delete(pos);
- // in : 0 0 0 0 0 0 0 0
- // out: 0 0 0 0 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 2);
- cpl_test_eq(cpl_array_get_int(pos[0], 2, NULL), 15);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 240);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 246);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 489);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 495);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 738);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 744);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 988);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 994);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1237);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1243);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1486);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1492);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1735);
- cpl_test_null(pos[7]);
- int i = 0;
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
+ midline = kmclipm_vector_load("ref_data/midline_sv1_blank.fits", 0);
+ cpl_test_nonnull(pos = kmo_get_slitedges(midline, 200));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(696.5, kmclipm_vector_get_mean(pos), 0.1);
+ kmclipm_vector_delete(midline);
+ kmclipm_vector_delete(pos);
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+ midline = kmclipm_vector_load("ref_data/midline_sv2.fits", 0);
+ kmclipm_vector_reject(midline, 0);
+ kmclipm_vector_reject(midline, 1);
+ kmclipm_vector_reject(midline, 2);
+ kmclipm_vector_reject(midline, 3);
+ kmclipm_vector_reject(midline, 2044);
+ kmclipm_vector_reject(midline, 2045);
+ kmclipm_vector_reject(midline, 2046);
+ kmclipm_vector_reject(midline, 2047);
+ cpl_test_nonnull(pos = kmo_get_slitedges(midline, 5500));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(1015.4, kmclipm_vector_get_mean(pos), 0.1);
+ cpl_test_eq(226, kmclipm_vector_get_size(pos));
+ kmclipm_vector_delete(midline);
+ kmclipm_vector_delete(pos);
- // valid test (shift_left_one_slitlet_cut)
- {
- data = kmclipm_image_load("ref_data/shift_left_one_slitlet_cut.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+ midline = kmclipm_vector_load("ref_data/midline_sv2.fits", 0);
+ kmclipm_vector_reject(midline, 0);
+ kmclipm_vector_reject(midline, 1);
+ kmclipm_vector_reject(midline, 2);
+ kmclipm_vector_reject(midline, 3);
+ kmclipm_vector_reject(midline, 2044);
+ kmclipm_vector_reject(midline, 2045);
+ kmclipm_vector_reject(midline, 2046);
+ kmclipm_vector_reject(midline, 2047);
+ cpl_test_nonnull(pos = kmo_get_slitedges(midline, 4000));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(1015.0, kmclipm_vector_get_mean(pos), 0.1);
+ cpl_test_eq(224, kmclipm_vector_get_size(pos));
+ kmclipm_vector_delete(midline);
+ kmclipm_vector_delete(pos);
- // in : 0 0 0 0 0 0 0 0
- // out: 0 0 0 0 0 0 0 0
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 0);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 2);
- cpl_test_eq(cpl_array_get_int(pos[0], 2, NULL), 18);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 243);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 249);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 492);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 498);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 741);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 747);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 991);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 997);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1240);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1246);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1489);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1495);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1738);
- cpl_test_eq(cpl_array_count_invalid(pos[7]), 0);
- cpl_test_eq(cpl_array_get_int(pos[7], 0, NULL), 1744);
- cpl_test_eq(cpl_array_get_int(pos[7], 27, NULL), 1987);
- int i = 0;
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 0 1 0 0 0 0 0 0
- // out: 0 1 0 0 0 0 0 0
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 1, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 0);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 2);
- cpl_test_eq(cpl_array_get_int(pos[0], 2, NULL), 18);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 243);
- cpl_test_null(pos[1]);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 498);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 741);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 747);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 991);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 997);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1240);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1246);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1489);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1495);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1738);
- cpl_test_eq(cpl_array_count_invalid(pos[7]), 0);
- cpl_test_eq(cpl_array_get_int(pos[7], 0, NULL), 1744);
- cpl_test_eq(cpl_array_get_int(pos[7], 27, NULL), 1987);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 1 0 0 0 0 0 0 0
- // out: 1 0 0 0 0 0 0 0
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 0, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 0);
-
- cpl_test_null(pos[0]);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 249);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 492);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 498);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 741);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 747);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 991);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 997);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1240);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1246);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1489);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1495);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1738);
- cpl_test_eq(cpl_array_count_invalid(pos[7]), 0);
- cpl_test_eq(cpl_array_get_int(pos[7], 0, NULL), 1744);
- cpl_test_eq(cpl_array_get_int(pos[7], 27, NULL), 1987);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- }
+ midline = kmclipm_vector_load("ref_data/midline_sv2_gap_first.fits", 0);
+ kmclipm_vector_reject(midline, 0);
+ kmclipm_vector_reject(midline, 1);
+ kmclipm_vector_reject(midline, 2);
+ kmclipm_vector_reject(midline, 3);
+ kmclipm_vector_reject(midline, 2044);
+ kmclipm_vector_reject(midline, 2045);
+ kmclipm_vector_reject(midline, 2046);
+ kmclipm_vector_reject(midline, 2047);
+ cpl_test_nonnull(pos = kmo_get_slitedges(midline, 4000));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(1019.6, kmclipm_vector_get_mean(pos), 0.1);
+ cpl_test_eq(223, kmclipm_vector_get_size(pos));
+ kmclipm_vector_delete(midline);
+ kmclipm_vector_delete(pos);
- // valid test (shift_left_slitlets_cut)
- {
- data = kmclipm_image_load("ref_data/shift_left_slitlets_cut.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
+ midline = kmclipm_vector_load("ref_data/midline_sv2_gap_last.fits", 0);
+ kmclipm_vector_reject(midline, 0);
+ kmclipm_vector_reject(midline, 1);
+ kmclipm_vector_reject(midline, 2);
+ kmclipm_vector_reject(midline, 3);
+ kmclipm_vector_reject(midline, 2044);
+ kmclipm_vector_reject(midline, 2045);
+ kmclipm_vector_reject(midline, 2046);
+ kmclipm_vector_reject(midline, 2047);
+ cpl_test_nonnull(pos = kmo_get_slitedges(midline, 4000));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(1010.6, kmclipm_vector_get_mean(pos), 0.1);
+ cpl_test_eq(223, kmclipm_vector_get_size(pos));
+ kmclipm_vector_delete(midline);
+ kmclipm_vector_delete(pos);
- // in : 0 0 0 0 0 0 0 0
- // out: 2 0 0 0 0 0 0 0
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 0);
-
- cpl_test_null(pos[0]);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 193);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 436);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 442);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 685);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 691);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 935);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 941);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1184);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1190);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1433);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1439);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1682);
- cpl_test_eq(cpl_array_count_invalid(pos[7]), 0);
- cpl_test_eq(cpl_array_get_int(pos[7], 0, NULL), 1688);
- cpl_test_eq(cpl_array_get_int(pos[7], 27, NULL), 1931);
- int i = 0;
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 0 0 0 0 0 0 0 1
- // out: 2 0 0 0 0 0 0 1
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 7, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 1);
-
- cpl_test_null(pos[0]);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 193);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 436);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 442);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 685);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 691);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 935);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 941);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1184);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1190);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1433);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1439);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1682);
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 1 0 0 0 0 0 0 1
- // out: 1 0 0 0 0 0 0 1
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 0, 1);
- cpl_array_set_int(ifus, 7, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 1);
-
- cpl_test_null(pos[0]);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 193);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 436);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 442);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 685);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 691);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 935);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 941);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1184);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1190);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1433);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1439);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1682);
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 1 1 1 0 1 1 1 1
- // out: 1 1 1 0 1 1 1 1
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 0, 1);
- cpl_array_set_int(ifus, 1, 1);
- cpl_array_set_int(ifus, 2, 1);
- cpl_array_set_int(ifus, 4, 1);
- cpl_array_set_int(ifus, 5, 1);
- cpl_array_set_int(ifus, 6, 1);
- cpl_array_set_int(ifus, 7, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 1);
-
- cpl_test_null(pos[0]);
- cpl_test_null(pos[1]);
- cpl_test_null(pos[2]);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 691);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 935);
- cpl_test_null(pos[4]);
- cpl_test_null(pos[5]);
- cpl_test_null(pos[6]);
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
+ midline = kmclipm_vector_load("ref_data/midline_sv2_gap_first_last.fits", 0);
+ kmclipm_vector_reject(midline, 0);
+ kmclipm_vector_reject(midline, 1);
+ kmclipm_vector_reject(midline, 2);
+ kmclipm_vector_reject(midline, 3);
+ kmclipm_vector_reject(midline, 2044);
+ kmclipm_vector_reject(midline, 2045);
+ kmclipm_vector_reject(midline, 2046);
+ kmclipm_vector_reject(midline, 2047);
+ cpl_test_nonnull(pos = kmo_get_slitedges(midline, 4000));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(1015, kmclipm_vector_get_mean(pos), 0.1);
+ cpl_test_eq(222, kmclipm_vector_get_size(pos));
+ kmclipm_vector_delete(midline);
+ kmclipm_vector_delete(pos);
+}
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
- cpl_array_delete(ifus);
- }
+/**
+ @brief test for kmo_analize_slitedges()
+*/
+void test_kmo_analize_slitedges()
+{
+ kmclipm_vector *midline = NULL,
+ *t_value = NULL,
+ *t_level = NULL,
+ *pos = NULL;
+ int t_pos = 0;
- // valid test (shift_left_one_slitlet_cut_IFU1_8_missing)
{
- data = kmclipm_image_load("ref_data/shift_left_one_slitlet_cut_IFU1_8_missing.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
-
- // in : 1 0 0 0 0 0 0 1
- // out: 1 0 0 0 0 0 0 1
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 0, 1);
- cpl_array_set_int(ifus, 7, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 1);
-
- cpl_test_null(pos[0]);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 249);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 492);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 498);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 742);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 747);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 991);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 996);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1240);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1246);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1489);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1495);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1738);
- cpl_test_null(pos[7]);
- int i = 0;
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 0 0 0 0 0 0 0 0
- // out: 2 0 0 0 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_null(pos[0]);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 249);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 492);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 498);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 742);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 747);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 991);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 996);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1240);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1246);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1489);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1495);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1738);
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 1 0 1 0 0 0 0 0
- // out: 1 0 1 0 0 0 0 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 0, 1);
- cpl_array_set_int(ifus, 2, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_null(pos[0]);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 249);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 492);
- cpl_test_null(pos[2]);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 747);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 991);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 996);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1240);
- cpl_test_eq(cpl_array_count_invalid(pos[5]), 0);
- cpl_test_eq(cpl_array_get_int(pos[5], 0, NULL), 1246);
- cpl_test_eq(cpl_array_get_int(pos[5], 27, NULL), 1489);
- cpl_test_eq(cpl_array_count_invalid(pos[6]), 0);
- cpl_test_eq(cpl_array_get_int(pos[6], 0, NULL), 1495);
- cpl_test_eq(cpl_array_get_int(pos[6], 27, NULL), 1738);
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
+ // blank, noisy, no slitlets
+ midline = kmclipm_vector_load("ref_data/midline_sv1_blank.fits", 0);
+ // estimated threshold, arbitrary edges due to noise
+ cpl_test_null(pos = kmo_analize_slitedges(midline, 173,
+ &t_value, &t_level, &t_pos));
+ // too low & too high threshold, no edges
+ cpl_test_null(pos = kmo_analize_slitedges(midline, 100,
+ &t_value, &t_level, &t_pos));
+ cpl_test_null(pos = kmo_analize_slitedges(midline, 5000,
+ &t_value, &t_level, &t_pos));
+ kmclipm_vector_delete(midline);
}
-
- // valid test (shift_left_one_slitlet_cut_IFU6_7_missing)
{
- data = kmclipm_image_load("ref_data/shift_left_one_slitlet_cut_IFU6_7_missing.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
-
- // in : 0 0 0 0 0 1 1 0
- // out: 0 0 0 0 0 1 1 0
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 5, 1);
- cpl_array_set_int(ifus, 6, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 0);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 2);
- cpl_test_eq(cpl_array_get_int(pos[0], 2, NULL), 17);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 243);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 249);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 492);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 498);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 742);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 747);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 991);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 996);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1240);
- cpl_test_null(pos[5]);
- cpl_test_null(pos[6]);
- cpl_test_eq(cpl_array_count_invalid(pos[7]), 0);
- cpl_test_eq(cpl_array_get_int(pos[7], 0, NULL), 1744);
- cpl_test_eq(cpl_array_get_int(pos[7], 27, NULL), 1987);
- int i = 0;
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 0 0 0 0 0 0 0 0
- // out: 0 0 0 0 0 2 2 0
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 0);
-
- cpl_test_eq(cpl_array_count_invalid(pos[0]), 2);
- cpl_test_eq(cpl_array_get_int(pos[0], 2, NULL), 17);
- cpl_test_eq(cpl_array_get_int(pos[0], 27, NULL), 243);
- cpl_test_eq(cpl_array_count_invalid(pos[1]), 0);
- cpl_test_eq(cpl_array_get_int(pos[1], 0, NULL), 249);
- cpl_test_eq(cpl_array_get_int(pos[1], 27, NULL), 492);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 498);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 742);
- cpl_test_eq(cpl_array_count_invalid(pos[3]), 0);
- cpl_test_eq(cpl_array_get_int(pos[3], 0, NULL), 747);
- cpl_test_eq(cpl_array_get_int(pos[3], 27, NULL), 991);
- cpl_test_eq(cpl_array_count_invalid(pos[4]), 0);
- cpl_test_eq(cpl_array_get_int(pos[4], 0, NULL), 996);
- cpl_test_eq(cpl_array_get_int(pos[4], 27, NULL), 1240);
- cpl_test_null(pos[5]);
- cpl_test_null(pos[6]);
- cpl_test_eq(cpl_array_count_invalid(pos[7]), 0);
- cpl_test_eq(cpl_array_get_int(pos[7], 0, NULL), 1744);
- cpl_test_eq(cpl_array_get_int(pos[7], 27, NULL), 1987);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
+ // first: gap, last: slit
+ midline = kmclipm_vector_load("ref_data/midline_sv2_gap_first.fits", 0);
+ cpl_test_null(pos = kmo_analize_slitedges(midline, 173,
+ &t_value, &t_level, &t_pos));
+ kmclipm_vector_delete(midline);
}
-
- // valid test (shift_left_one_slitlet_cut_IFU3_present)
{
- data = kmclipm_image_load("ref_data/shift_left_one_slitlet_cut_IFU3_present.fits",
- CPL_TYPE_FLOAT, 0, 0);
- badpix = cpl_image_duplicate(data);
- kmo_image_fill(badpix, 1);
-
- // in : 1 1 0 1 1 1 1 1
- // out: 1 1 0 1 1 1 1 1
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
- cpl_array_set_int(ifus, 0, 1);
- cpl_array_set_int(ifus, 1, 1);
- cpl_array_set_int(ifus, 3, 1);
- cpl_array_set_int(ifus, 4, 1);
- cpl_array_set_int(ifus, 5, 1);
- cpl_array_set_int(ifus, 6, 1);
- cpl_array_set_int(ifus, 7, 1);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 1);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 1);
-
- cpl_test_null(pos[0]);
- cpl_test_null(pos[1]);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 498);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 742);
- cpl_test_null(pos[3]);
- cpl_test_null(pos[4]);
- cpl_test_null(pos[5]);
- cpl_test_null(pos[6]);
- cpl_test_null(pos[7]);
- int i = 0;
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
-
- // in : 0 0 0 0 0 0 0 0
- // out: 2 2 0 2 2 2 2 2
- ifus = cpl_array_new(8, CPL_TYPE_INT);
- kmo_array_fill_int(ifus, 0);
-
- cpl_test_nonnull(pos = kmos_get_valid_edge_pos(data,
- badpix,
- ifus, 1));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(cpl_array_get_int(ifus, 0, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 1, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 2, NULL), 0);
- cpl_test_eq(cpl_array_get_int(ifus, 3, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 4, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 5, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 6, NULL), 2);
- cpl_test_eq(cpl_array_get_int(ifus, 7, NULL), 2);
-
- cpl_test_null(pos[0]);
- cpl_test_null(pos[1]);
- cpl_test_eq(cpl_array_count_invalid(pos[2]), 0);
- cpl_test_eq(cpl_array_get_int(pos[2], 0, NULL), 498);
- cpl_test_eq(cpl_array_get_int(pos[2], 27, NULL), 742);
- cpl_test_null(pos[3]);
- cpl_test_null(pos[4]);
- cpl_test_null(pos[5]);
- cpl_test_null(pos[6]);
- cpl_test_null(pos[7]);
- for (i = 0; i < 8; i++) {
- cpl_array_delete(pos[i]); pos[i] = NULL;
- }
- cpl_free(pos); pos = NULL;
- cpl_array_delete(ifus);
- cpl_image_delete(data); data = NULL;
- cpl_image_delete(badpix); badpix = NULL;
+ // first: slit, last: gap
+ midline = kmclipm_vector_load("ref_data/midline_sv2_gap_last.fits", 0);
+ cpl_test_null(pos = kmo_analize_slitedges(midline, 173,
+ &t_value, &t_level, &t_pos));
+ kmclipm_vector_delete(midline);
+ }
+ {
+ // first: gap, last: gap
+ midline = kmclipm_vector_load("ref_data/midline_sv2_gap_first_last.fits", 0);
+ cpl_test_null(pos = kmo_analize_slitedges(midline, 173,
+ &t_value, &t_level, &t_pos));
+ kmclipm_vector_delete(midline);
+ }
+ {
+ // first: slit, last: slit (normal case)
+ midline = kmclipm_vector_load("ref_data/midline_sv2.fits", 0);
+ cpl_test_nonnull(pos = kmo_analize_slitedges(midline, 5500,
+ &t_value, &t_level, &t_pos));
+ cpl_test_abs(1015.0, kmclipm_vector_get_mean(pos), 0.1);
+ cpl_test_eq(224, kmclipm_vector_count_non_rejected(pos));
+ cpl_test_eq(224, kmclipm_vector_get_size(pos));
+ cpl_test_eq(0, kmclipm_vector_is_rejected(pos, 0));
+ cpl_test_eq(0, kmclipm_vector_is_rejected(pos, kmclipm_vector_get_size(pos)-1));
+ kmclipm_vector_delete(t_value);
+ kmclipm_vector_delete(t_level);
+ kmclipm_vector_delete(pos);
+ kmclipm_vector_delete(midline);
}
-
- kmo_test_verbose_on();
}
/**
- @brief test for kmo_polyfit_edge()
+ @brief test for kmo_analize_slitedges_advanced()
*/
-void test_kmo_polyfit_edge()
+void test_kmo_analize_slitedges_advanced()
{
- kmo_test_verbose_off();
- cpl_test_null(kmo_polyfit_edge(NULL, NULL, 3));
- cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- kmclipm_vector *x = kmclipm_vector_load("ref_data/cut_yrow.fits", 0);
- cpl_test_null(kmo_polyfit_edge(x, NULL, 3));
- cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- kmclipm_vector *y = kmclipm_vector_load("ref_data/cut_edge.fits", 0);
+ kmclipm_vector *midline = NULL,
+ *pos = NULL;
+ int cut_first = 0,
+ cut_last = 0;
- cpl_vector *f = NULL;
- cpl_test_nonnull(f = kmo_polyfit_edge(x, y, 3));
- cpl_test_abs(502.18, cpl_vector_get_mean(f), 0.01);
- cpl_test_error(CPL_ERROR_NONE);
-
- kmclipm_vector_delete(x);
- kmclipm_vector_delete(y);
- cpl_vector_delete(f);
+ {
+ // blank, noisy, no slitlets
+ midline = kmclipm_vector_load("ref_data/midline_sv1_blank.fits", 0);
+ // estimated threshold, arbitrary edges due to noise
+ cpl_test_null(pos = kmo_analize_slitedges_advanced(midline, 173, &cut_first, &cut_last));
+ // too low & too high threshold, no edges
+ cpl_test_null(pos = kmo_analize_slitedges_advanced(midline, 100, &cut_first, &cut_last));
+ cpl_test_null(pos = kmo_analize_slitedges_advanced(midline, 5000, &cut_first, &cut_last));
+ kmclipm_vector_delete(midline);
+ }
+ {
+ // first: slit, last: slit (normal case)
+ midline = kmclipm_vector_load("ref_data/midline_sv2.fits", 0);
+ cpl_test_nonnull(pos = kmo_analize_slitedges_advanced(midline, 5500, &cut_first, &cut_last));
+ cpl_test_abs(1014.8, kmclipm_vector_get_mean(pos), 0.1);
+ cpl_test_eq(220, kmclipm_vector_count_non_rejected(pos));
+ cpl_test_eq(226, kmclipm_vector_get_size(pos));
+ cpl_test_eq(0, kmclipm_vector_is_rejected(pos, 0));
+ cpl_test_eq(0, kmclipm_vector_is_rejected(pos, kmclipm_vector_get_size(pos)-1));
+ kmclipm_vector_delete(pos);
+ kmclipm_vector_delete(midline);
+ }
+ {
+ // first: gap, last: slit
+ midline = kmclipm_vector_load("ref_data/midline_sv2_gap_first.fits", 0);
+ cpl_test_nonnull(pos = kmo_analize_slitedges_advanced(midline, 5500, &cut_first, &cut_last));
+ cpl_test_abs(1023.9, kmclipm_vector_get_mean(pos), 0.1);
+ cpl_test_eq(218, kmclipm_vector_count_non_rejected(pos));
+ cpl_test_eq(225, kmclipm_vector_get_size(pos));
+ cpl_test_eq(1, kmclipm_vector_is_rejected(pos, 0));
+ cpl_test_eq(0, kmclipm_vector_is_rejected(pos, kmclipm_vector_get_size(pos)-1));
+ kmclipm_vector_delete(pos);
+ kmclipm_vector_delete(midline);
+ }
+ {
+ // first: slit, last: gap
+ midline = kmclipm_vector_load("ref_data/midline_sv2_gap_last.fits", 0);
+ cpl_test_nonnull(pos = kmo_analize_slitedges_advanced(midline, 5500, &cut_first, &cut_last));
+ cpl_test_abs(1005.6, kmclipm_vector_get_mean(pos), 0.1);
+ cpl_test_eq(218, kmclipm_vector_count_non_rejected(pos));
+ cpl_test_eq(225, kmclipm_vector_get_size(pos));
+ cpl_test_eq(0, kmclipm_vector_is_rejected(pos, 0));
+ cpl_test_eq(1, kmclipm_vector_is_rejected(pos, kmclipm_vector_get_size(pos)-1));
+ kmclipm_vector_delete(pos);
+ kmclipm_vector_delete(midline);
+ }
+ {
+ // first: gap, last: gap
+ midline = kmclipm_vector_load("ref_data/midline_sv2_gap_first_last.fits", 0);
+ cpl_test_nonnull(pos = kmo_analize_slitedges_advanced(midline, 5500, &cut_first, &cut_last));
+ cpl_test_abs(1014.75, kmclipm_vector_get_mean(pos), 0.1);
+ cpl_test_eq(216, kmclipm_vector_count_non_rejected(pos));
+ cpl_test_eq(224, kmclipm_vector_get_size(pos));
+ cpl_test_eq(1, kmclipm_vector_is_rejected(pos, 0));
+ cpl_test_eq(1, kmclipm_vector_is_rejected(pos, kmclipm_vector_get_size(pos)-1));
+ kmclipm_vector_delete(pos);
+ kmclipm_vector_delete(midline);
+ }
}
/**
- @brief test for kmo_edge_trace()
+ @brief test for kmo_analyze_flat()
*/
-void test_kmo_edge_trace()
+void test_kmo_analyze_flat()
{
- kmo_test_verbose_off();
- kmo_edge_trace(NULL, NULL, NULL, -1, -1);
- cpl_test_error(CPL_ERROR_NULL_INPUT);
+ int i;
+ cpl_image *data,
+ *badpix;
+ cpl_array **array,
+ *ifu_inactive; // 0: active
+ // 1: inactive ICS
+ // 2: inactive pipeline
- cpl_image *data = kmclipm_image_load("ref_data/well_formed_ifus.fits",
- CPL_TYPE_FLOAT, 0, 0);
- kmo_edge_trace(data, NULL, NULL, -1, -1);
- cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- kmclipm_vector *ddd = kmclipm_vector_load("ref_data/yrow.fits", 0);
-cpl_vector *yrow = kmclipm_vector_create_non_rejected(ddd);
-kmclipm_vector_delete(ddd);
- kmo_edge_trace(data, yrow, NULL, -1, -1);
- cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- cpl_vector *edge = NULL;
- kmo_edge_trace(data, yrow, &edge, -1, -1);
- cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- edge = cpl_vector_new(22);
- kmo_edge_trace(data, yrow, &edge, -1, -1);
- cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ {
+ //
+ // test with blank images
+ //
+
+ //
+ // all_blank.fits
+ //
+ data = kmclipm_image_load("ref_data/all_blank.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_null(array[0]);
+ cpl_test_null(array[1]);
+ cpl_test_null(array[2]);
+ cpl_test_null(array[3]);
+ cpl_test_null(array[4]);
+ cpl_test_null(array[5]);
+ cpl_test_null(array[6]);
+ cpl_test_null(array[7]);
+ // ifus out : 2 2 2 2 2 2 2 2
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ cpl_free(array);
+
+ //
+ // noise_img.fits
+ //
+ data = kmclipm_image_load("ref_data/noise_img.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_null(array[0]);
+ cpl_test_null(array[1]);
+ cpl_test_null(array[2]);
+ cpl_test_null(array[3]);
+ cpl_test_null(array[4]);
+ cpl_test_null(array[5]);
+ cpl_test_null(array[6]);
+ cpl_test_null(array[7]);
+ // ifus out : 2 2 2 2 2 2 2 2
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ cpl_free(array);
+
+ //
+ // flat_det_sv1_blank.fits
+ //
+ data = kmclipm_image_load("ref_data/flat_det_sv1_blank.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 1 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_array_set_int(ifu_inactive, 1, 1);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_null(array[0]);
+ cpl_test_null(array[1]);
+ cpl_test_null(array[2]);
+ cpl_test_null(array[3]);
+ cpl_test_null(array[4]);
+ cpl_test_null(array[5]);
+ cpl_test_null(array[6]);
+ cpl_test_null(array[7]);
+ // ifus out : 2 1 2 2 2 2 2 2
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(1, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ cpl_free(array);
+ }
- kmo_edge_trace(data, yrow, &edge, 1, -1);
- cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
- kmo_test_verbose_on();
+ {
+ //
+ // test with IFU7 vignetted, IFU8 blank
+ //
+ data = kmclipm_image_load("ref_data/flat_det_sv1.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(148.1, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_abs(395.1, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(643.1, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(890.1, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1138.5, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1386.7, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1634.6, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_null(array[7]);
+ // ifus out : 0 0 0 0 0 0 0 2
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
- kmo_edge_trace(data, yrow, &edge, 2008, 1);
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_abs(2008.8, cpl_vector_get_mean(edge), 0.01);
+ {
+ //
+ // test with IFU5 vignetted
+ //
+ data = kmclipm_image_load("ref_data/flat_det_sv2.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(136.4, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_abs(386.9, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(638.2, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(888.5, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1140.5, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1391.8, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1643.3, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_abs(1894.7, cpl_array_get_mean(array[7]), 0.1);
+ // ifus out : 0 0 0 0 0 0 0 0
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+
+ // ifu_inactive in : 0 1 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_array_set_int(ifu_inactive, 1, 1);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(136.4, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_null(array[1]);
+ cpl_test_abs(638.2, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(888.5, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1140.5, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1391.8, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1643.3, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_abs(1894.7, cpl_array_get_mean(array[7]), 0.1);
+ // ifus out : 0 1 0 0 0 0 0 0
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(1, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ //
+ // test with IFU5 vignetted, IFU 2 blackened out
+ //
+ data = kmclipm_image_load("ref_data/flat_det_sv2_ifu2_black.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 1 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_array_set_int(ifu_inactive, 2, 1);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(136.4, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_null(array[1]);
+ cpl_test_null(array[2]);
+ cpl_test_abs(888.5, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1140.5, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1391.8, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1643.3, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_abs(1894.7, cpl_array_get_mean(array[7]), 0.1);
+ // ifus out : 0 2 1 0 0 0 0 0
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(1, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ //
+ // test with IFU5 vignetted, IFU 1 blackened out
+ //
+ data = kmclipm_image_load("ref_data/flat_det_sv2_ifu1_black.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 1 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_array_set_int(ifu_inactive, 2, 1);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_null(array[0]);
+ cpl_test_abs(386.9, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_null(array[2]);
+ cpl_test_abs(888.5, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1140.5, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1391.8, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1643.3, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_abs(1894.7, cpl_array_get_mean(array[7]), 0.1);
+ // ifus out : 2 0 1 0 0 0 0 0
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(1, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ //
+ // test with IFU5 vignetted, IFU 8 blackened out
+ //
+ data = kmclipm_image_load("ref_data/flat_det_sv2_ifu8_black.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 1 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_array_set_int(ifu_inactive, 2, 1);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(136.4, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_abs(386.9, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_null(array[2]);
+ cpl_test_abs(888.5, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1140.5, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1391.8, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1643.3, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_null(array[7]);
+ // ifus out : 0 0 1 0 0 0 0 2
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(1, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ //
+ // test with IFU5 vignetted, IFU 2,3 blackened out
+ //
+ data = kmclipm_image_load("ref_data/flat_det_sv2_ifu2_3_black.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 1 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_array_set_int(ifu_inactive, 3, 1);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(136.4, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_null(array[1]);
+ cpl_test_null(array[2]);
+ cpl_test_null(array[3]);
+ cpl_test_abs(1140.5, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1391.8, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1643.3, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_abs(1894.7, cpl_array_get_mean(array[7]), 0.1);
+ // ifus out : 0 2 2 1 0 0 0 0
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(1, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ //
+ // test with IFU5 vignetted, IFU 1,8 blackened out
+ //
+ data = kmclipm_image_load("ref_data/flat_det_sv2_ifu1_8_black.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 1 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_array_set_int(ifu_inactive, 3, 1);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_null(array[0]);
+ cpl_test_abs(386.9, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(638.2, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_null(array[3]);
+ cpl_test_abs(1140.5, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1391.8, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1643.3, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_null(array[7]);
+ // ifus out : 2 0 0 1 0 0 0 2
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(1, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ //
+ // test with IFU5 vignetted, IFU 1,2,3,4,6,7,8 blackened out
+ //
+ data = kmclipm_image_load("ref_data/flat_det_sv2_ifu1_2_3_4_6_7_8_black.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 1 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_array_set_int(ifu_inactive, 3, 1);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_null(array[0]);
+ cpl_test_null(array[1]);
+ cpl_test_null(array[2]);
+ cpl_test_null(array[3]);
+ cpl_test_abs(1140.4, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_null(array[5]);
+ cpl_test_null(array[6]);
+ cpl_test_null(array[7]);
+ // ifus out : 2 2 2 1 0 2 2 2
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(1, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ //
+ // test with IFU3 vignetted
+ //
+ data = kmclipm_image_load("ref_data/flat_det_sv2_2.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(136.6, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_abs(387.1, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_null(array[2]);
+ cpl_test_abs(889.1, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1140.9, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1392.5, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1643.9, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_abs(1895.5, cpl_array_get_mean(array[7]), 0.1);
+ // ifus out : 0 0 2 0 0 0 0 0
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ //
+ // test with cut_left_right
+ //
+ data = kmclipm_image_load("ref_data/cut_left_right_222edges.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_null(array[0]);
+ cpl_test_abs(367.6, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(616.8, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(866.0, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1115.2, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1364.4, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1613.5, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_null(array[7]);
+ // ifus out : 2 0 0 0 0 0 0 2
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ //
+ // test with cut_left_right, 166 slitlets --> all deactivated
+ //
+ data = kmclipm_image_load("ref_data/cut_left_right_220edges.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ kmo_test_verbose_off();
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ kmo_test_verbose_on();
+ cpl_test_null(array[0]);
+ cpl_test_null(array[1]);
+ cpl_test_null(array[2]);
+ cpl_test_null(array[3]);
+ cpl_test_null(array[4]);
+ cpl_test_null(array[5]);
+ cpl_test_null(array[6]);
+ cpl_test_null(array[7]);
+ // ifus out : 2 2 2 2 2 2 2 2
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+
+ //
+ // test with cut_left_right, 214 slitlets --> all deactivated
+ //
+ data = kmclipm_image_load("ref_data/out_of_zoom.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ kmo_test_verbose_off();
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ kmo_test_verbose_on();
+ cpl_test_null(array[0]);
+ cpl_test_null(array[1]);
+ cpl_test_null(array[2]);
+ cpl_test_null(array[3]);
+ cpl_test_null(array[4]);
+ cpl_test_null(array[5]);
+ cpl_test_null(array[6]);
+ cpl_test_null(array[7]);
+ // ifus out : 2 2 2 2 2 2 2 2
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ //
+ // test with shift left one slitlet cut, 196 slitlets
+ //
+ data = kmclipm_image_load("ref_data/shift_left_one_slitlet_cut.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ kmo_test_verbose_off();
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ kmo_test_verbose_on();
+ cpl_test_null(array[0]);
+ cpl_test_abs(370.6, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(619.8, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(869.0, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1118.2, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1367.4, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1616.5, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_abs(1865.7, cpl_array_get_mean(array[7]), 0.1);
+ // ifus out : 2 0 0 0 0 0 0 0
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+
+ data = kmclipm_image_load("ref_data/shift_left_one_slitlet_cut_IFU1_8_missing.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 1 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_array_set_int(ifu_inactive, 6, 1);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_null(array[0]);
+ cpl_test_abs(370.6, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(619.8, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(869.0, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1118.2, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1367.4, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_null(array[6]);
+ cpl_test_null(array[7]);
+ // ifus out : 2 0 0 0 0 0 1 2
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(1, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+
+ data = kmclipm_image_load("ref_data/shift_left_one_slitlet_cut_IFU3_present.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_null(array[0]);
+ cpl_test_null(array[1]);
+ cpl_test_abs(619.8, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_null(array[3]);
+ cpl_test_null(array[4]);
+ cpl_test_null(array[5]);
+ cpl_test_null(array[6]);
+ cpl_test_null(array[7]);
+ // ifus out : 2 2 0 2 2 2 2 2
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+
+ data = kmclipm_image_load("ref_data/shift_left_one_slitlet_cut_IFU6_7_missing.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_null(array[0]);
+ cpl_test_abs(370.6, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(619.8, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(869.0, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1118.2, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_null(array[5]);
+ cpl_test_null(array[6]);
+ cpl_test_abs(1865.7, cpl_array_get_mean(array[7]), 0.1);
+ // ifus out : 2 0 0 0 0 2 2 0
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ //
+ // test with shift right one slitlet cut, 196 slitlets
+ //
+ data = kmclipm_image_load("ref_data/shift_right_one_slitlet_cut.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
- cpl_image_delete(data);
- cpl_vector_delete(edge);
- cpl_vector_delete(yrow);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(185.4, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_abs(434.6, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(683.8, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(933.0, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1182.2, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1431.4, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1680.5, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_null(array[7]);
+ // ifus out : 0 0 0 0 0 0 0 2
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+
+ data = kmclipm_image_load("ref_data/shift_right_one_slitlet_cut_IFU1_missing.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ kmo_test_verbose_off();
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ kmo_test_verbose_on();
+ cpl_test_null(array[0]);
+ cpl_test_abs(434.6, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(683.8, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(933.0, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1182.2, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1431.4, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1680.5, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_null(array[7]);
+ // ifus out : 2 0 0 0 0 0 0 2
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+
+ data = kmclipm_image_load("ref_data/shift_right_one_slitlet_cut_IFU2_missing.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(185.4, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_null(array[1]);
+ cpl_test_abs(683.8, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(933.0, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1182.2, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1431.4, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1680.5, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_null(array[7]);
+ // ifus out : 0 2 0 0 0 0 0 2
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ //
+ // test with large shifts, slitlets cut on one side
+ //
+ data = kmclipm_image_load("ref_data/shift_right_slitlets_cut.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(238.4, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_abs(487.6, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(736.8, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(986.0, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1235.2, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1484.4, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1733.5, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_null(array[7]);
+ // ifus out : 0 0 0 0 0 0 0 2
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+
+ data = kmclipm_image_load("ref_data/shift_left_slitlets_cut.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_null(array[0]);
+ cpl_test_abs(314.6, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(563.8, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(813.0, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1062.2, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1311.4, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1560.5, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_abs(1809.6, cpl_array_get_mean(array[7]), 0.1);
+ // ifus out : 2 0 0 0 0 0 0 0
+ cpl_test_eq(2, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ // valid test (strong rotation, midline of 100)
+ data = kmclipm_image_load("ref_data/strong_rotation_100high.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(138.7, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_abs(388.8, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(638.9, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(889.1, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1139.3, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1389.4, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1639.5, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_abs(1889.7, cpl_array_get_mean(array[7]), 0.1);
+ // ifus out : 0 0 0 0 0 0 0 0
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+
+ // valid test (strong rotation, midline of size 2)
+ data = kmclipm_image_load("ref_data/strong_rotation_2high.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(138.7, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_abs(388.8, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(638.9, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(889.1, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1139.3, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1389.4, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1639.5, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_abs(1889.7, cpl_array_get_mean(array[7]), 0.1);
+ // ifus out : 0 0 0 0 0 0 0 0
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+
+ // valid test (strong rotation, midline of 40)
+ data = kmclipm_image_load("ref_data/strong_rotation_40high.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(138.7, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_abs(388.8, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(638.9, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(889.1, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1139.3, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1389.4, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1639.5, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_abs(1889.7, cpl_array_get_mean(array[7]), 0.1);
+ // ifus out : 0 0 0 0 0 0 0 0
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
+ {
+ // valid test with 224 slitlet edges
+ data = kmclipm_image_load("ref_data/well_formed_ifus.fits", CPL_TYPE_FLOAT, 0, 0);
+ badpix = cpl_image_duplicate(data);
+ kmo_image_fill(badpix, 1);
+ // ifu_inactive in : 0 0 0 0 0 0 0 0
+ ifu_inactive = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu_inactive, 0);
+ cpl_test_nonnull(array = kmo_analyze_flat(data, badpix, ifu_inactive));
+ cpl_test_abs(142.4, cpl_array_get_mean(array[0]), 0.1);
+ cpl_test_abs(391.6, cpl_array_get_mean(array[1]), 0.1);
+ cpl_test_abs(640.8, cpl_array_get_mean(array[2]), 0.1);
+ cpl_test_abs(890.0, cpl_array_get_mean(array[3]), 0.1);
+ cpl_test_abs(1139.1, cpl_array_get_mean(array[4]), 0.1);
+ cpl_test_abs(1388.3, cpl_array_get_mean(array[5]), 0.1);
+ cpl_test_abs(1637.5, cpl_array_get_mean(array[6]), 0.1);
+ cpl_test_abs(1886.7, cpl_array_get_mean(array[7]), 0.1);
+ // ifus out : 0 0 0 0 0 0 0 0
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 0, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 1, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 2, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 3, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 4, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 5, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 6, NULL));
+ cpl_test_eq(0, cpl_array_get_int(ifu_inactive, 7, NULL));
+ cpl_image_delete(data);
+ cpl_image_delete(badpix);
+ cpl_array_delete(ifu_inactive);
+ for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
+ cpl_free(array);
+ }
}
/**
- @brief test for kmo_calc_calib_frames()
+ @brief test for kmo_calc_curvature()
*/
-void test_kmo_calc_calib_frames()
+void test_kmo_calc_curvature()
{
kmo_test_verbose_off();
- kmo_calc_calib_frames(NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL);
- cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- int n = 8, m = 14;
- cpl_vector **slit_ids = (cpl_vector**)cpl_malloc(n*sizeof(cpl_vector*));
- int i = 0, j = 0;
- for (i = 0; i < n; i++) {
- slit_ids[i] = cpl_vector_new(2*m);
- for (j = 0; j < m; j++) {
- cpl_vector_set(slit_ids[i], 2*j, j+1);
- cpl_vector_set(slit_ids[i], 2*j+1, j+1);
- }
- }
- kmo_calc_calib_frames(slit_ids, NULL, 0, NULL, NULL, NULL, NULL, NULL);
- cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- FILE *fp = fopen("ref_data/edgepars_matrix.bin","rb");
- cpl_matrix **edgepars = (cpl_matrix**)cpl_malloc(n*sizeof(cpl_matrix*));
- for (i = 0; i < n; i++) {
- edgepars[i] = cpl_matrix_new(2*m, 4);
- double *ddd = cpl_matrix_get_data(edgepars[i]);
- fread(ddd, sizeof(double), 4*2*m, fp);
- }
- fclose(fp);
- kmo_calc_calib_frames(slit_ids, edgepars, 0, NULL, NULL, NULL, NULL, NULL);
+ kmo_calc_curvature(NULL, NULL, NULL, NULL, 0, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
cpl_image *data = kmclipm_image_load("ref_data/well_formed_ifus.fits",
CPL_TYPE_FLOAT, 0, 0);
- kmo_calc_calib_frames(slit_ids, edgepars, 0, data, NULL, NULL, NULL, NULL);
+ kmo_calc_curvature(data, NULL, NULL, NULL, 0, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
cpl_image *noise = cpl_image_duplicate(data);
cpl_image_fill_noise_uniform(noise, 0.0, 1.0);
- kmo_calc_calib_frames(slit_ids, edgepars, 0, data, noise, NULL, NULL, NULL);
- cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- cpl_image *bad = cpl_image_duplicate(data);
- kmo_image_fill(bad, 1.0);
- kmo_calc_calib_frames(slit_ids, edgepars, 0, data, noise, bad, NULL, NULL);
- cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- cpl_image *xcal = cpl_image_duplicate(data);
- kmo_image_fill(xcal, 0.0);
- kmo_calc_calib_frames(slit_ids, edgepars, 0, data, noise, bad, xcal, NULL);
+ kmo_calc_curvature(data, noise, NULL, NULL, 0, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- cpl_image *ycal = cpl_image_duplicate(data);
- kmo_image_fill(ycal, 0.0);
- kmo_calc_calib_frames(slit_ids, edgepars, 0, data, noise, bad, xcal, ycal);
- cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
- kmo_test_verbose_on();
-
- kmo_calc_calib_frames(slit_ids, edgepars, 1, data, noise, bad, xcal, ycal);
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_abs(0.616954, cpl_image_get_mean(xcal), 0.01);
- cpl_test_abs(0.72347, cpl_image_get_mean(ycal), 0.01);
- cpl_test_abs(10371.3, cpl_image_get_mean(data), 0.01);
- cpl_test_abs(0.504425, cpl_image_get_mean(noise), 0.01);
- cpl_test_abs(1, cpl_image_get_mean(bad), 0.01);
-
- cpl_image_delete(xcal);
- cpl_image_delete(ycal);
- cpl_image_delete(bad);
- for (i = 0; i < n; i++) {
- cpl_vector_delete(slit_ids[i]);
- cpl_matrix_delete(edgepars[i]);
- }
- cpl_free(slit_ids);
- cpl_free(edgepars);
- cpl_image_delete(data);
- cpl_image_delete(noise);
-}
-
-/**
- @brief test for kmo_curvature_qc()
-*/
-void test_kmo_curvature_qc()
-{
- kmo_test_verbose_off();
- kmo_curvature_qc(NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ cpl_array* ifu = cpl_array_new(8, CPL_TYPE_INT);
+ kmo_array_fill_int(ifu, 0);
+ kmo_calc_curvature(data, noise, ifu, NULL, 0, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- int n = 8, m = 14;
- FILE *fp = fopen("ref_data/edgepars_matrix.bin","rb");
- cpl_matrix **edgepars = (cpl_matrix**)cpl_malloc(n*sizeof(cpl_matrix*));
- int i = 0;
- for (i = 0; i < n; i++) {
- edgepars[i] = cpl_matrix_new(2*m, 4);
- double *ddd = cpl_matrix_get_data(edgepars[i]);
- fread(ddd, sizeof(double), 4*2*m, fp);
- }
- fclose(fp);
- kmo_curvature_qc(edgepars, NULL, NULL, NULL, NULL, NULL, NULL);
+ cpl_image *bad = cpl_image_duplicate(data);
+ kmo_image_fill(bad, 1.0);
+ kmo_calc_curvature(data, noise, ifu, bad, 0, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- double gapmean = -1, gapsdv = -1, gapmaxdev = -1, slitmean = -1, slitsdv = -1, slitmaxdev = -1;
- kmo_curvature_qc(edgepars, &gapmean, NULL, NULL, NULL, NULL, NULL);
- cpl_test_error(CPL_ERROR_NULL_INPUT);
- kmo_curvature_qc(edgepars, &gapmean, &gapsdv, NULL, NULL, NULL, NULL);
- cpl_test_error(CPL_ERROR_NULL_INPUT);
- kmo_curvature_qc(edgepars, &gapmean, &gapsdv, &gapmaxdev, NULL, NULL, NULL);
- cpl_test_error(CPL_ERROR_NULL_INPUT);
- kmo_curvature_qc(edgepars, &gapmean, &gapsdv, &gapmaxdev, &slitmean, NULL, NULL);
- cpl_test_error(CPL_ERROR_NULL_INPUT);
- kmo_curvature_qc(edgepars, &gapmean, &gapsdv, &gapmaxdev, &slitmean, &slitsdv, NULL);
+ cpl_image *xcal = NULL, *ycal = NULL;
+ kmo_calc_curvature(data, noise, ifu, bad, 0, &xcal, &ycal,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- kmo_test_verbose_on();
- kmo_curvature_qc(edgepars, &gapmean, &gapsdv, &gapmaxdev, &slitmean, &slitsdv, &slitmaxdev);
- cpl_test_abs(4.90468, gapmean, 0.01);
- cpl_test_abs(0.130222, gapsdv, 0.01);
- cpl_test_abs(0.342574, gapmaxdev, 0.01);
- cpl_test_abs(12.8883, slitmean, 0.01);
- cpl_test_abs(0.131986, slitsdv, 0.01);
- cpl_test_abs(0.403824, slitmaxdev, 0.01);
- cpl_test_error(CPL_ERROR_NONE);
-
- for (i = 0; i < n; i++) {
- cpl_matrix_delete(edgepars[i]);
- }
- cpl_free(edgepars);
-}
-/**
- @brief test for kmo_edgepars_to_table()
-*/
-void test_kmo_edgepars_to_table()
-{
- kmo_test_verbose_off();
- cpl_test_null(kmo_edgepars_to_table(NULL, NULL));
+ double gapmean, gapsdv, gapmaxdev, slitmean, slitsdv, slitmaxdev;
+ kmo_calc_curvature(data, noise, ifu, bad, 0, &xcal, &ycal, &gapmean, &gapsdv,
+ &gapmaxdev, &slitmean, &slitsdv, &slitmaxdev, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- int n = 8, m = 14;
- cpl_vector **slit_ids = (cpl_vector**)cpl_malloc(n*sizeof(cpl_vector*));
- int i = 0, j = 0;
- for (i = 0; i < n; i++) {
- slit_ids[i] = cpl_vector_new(2*m);
- for (j = 0; j < m; j++) {
- cpl_vector_set(slit_ids[i], 2*j, j+1);
- cpl_vector_set(slit_ids[i], 2*j+1, j+1);
- }
- }
- cpl_test_null(kmo_edgepars_to_table(slit_ids, NULL));
- cpl_test_error(CPL_ERROR_NULL_INPUT);
+ cpl_table **edge_par = NULL;
+ kmo_calc_curvature(data, noise, ifu, bad, 0, &xcal, &ycal, &gapmean, &gapsdv,
+ &gapmaxdev, &slitmean, &slitsdv, &slitmaxdev, &edge_par);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
kmo_test_verbose_on();
- FILE *fp = fopen("ref_data/edgepars_matrix.bin","rb");
- cpl_matrix **edgepars = (cpl_matrix**)cpl_malloc(n*sizeof(cpl_matrix*));
- for (i = 0; i < n; i++) {
- edgepars[i] = cpl_matrix_new(2*m, 4);
- double *ddd = cpl_matrix_get_data(edgepars[i]);
- fread(ddd, sizeof(double), 4*2*m, fp);
- }
- fclose(fp);
- cpl_table **edge_par = NULL;
- cpl_test_nonnull(edge_par = kmo_edgepars_to_table(slit_ids, edgepars));
+ cpl_test_abs(7997.86, cpl_image_get_mean(data), 0.01);
+ cpl_test_abs(0.500227, cpl_image_get_mean(noise), 0.1);
+ cpl_test_abs(1, cpl_image_get_mean(bad), 0.01);
+ kmo_calc_curvature(data, noise, ifu, bad, 1, &xcal, &ycal, &gapmean, &gapsdv,
+ &gapmaxdev, &slitmean, &slitsdv, &slitmaxdev, &edge_par);
cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(0.739485, cpl_image_get_mean(xcal), 0.01*6);
+ cpl_test_abs(0.463688, cpl_image_get_mean(ycal), 0.01*16);
+ cpl_test_abs(10373.4, cpl_image_get_mean(data), 0.01*20);
+ cpl_test_abs(0.504425, cpl_image_get_mean(noise), 0.1);
+ cpl_test_abs(1, cpl_image_get_mean(bad), 0.01);
+ cpl_test_abs(4.90468, gapmean, 0.01);
+ cpl_test_abs(0.130222, gapsdv, 0.01);
+ cpl_test_abs(0.342252, gapmaxdev, 0.01*2);
+ cpl_test_abs(12.8883, slitmean, 0.01);
+ cpl_test_abs(0.131986, slitsdv, 0.01);
+ cpl_test_abs(0.40414, slitmaxdev, 0.01);
+
double checksum = 0;
checksum += cpl_table_get_column_mean(edge_par[0], "ID");
checksum += cpl_table_get_column_mean(edge_par[0], "A0");
@@ -2571,223 +1903,20 @@ void test_kmo_edgepars_to_table()
checksum += cpl_table_get_column_mean(edge_par[7], "A1");
checksum += cpl_table_get_column_mean(edge_par[7], "A2");
checksum += cpl_table_get_column_mean(edge_par[7], "A3");
- cpl_test_abs(8177.27, checksum, 0.01);
+// cpl_test_abs(8177.27, checksum, 0.01);
+ cpl_test_abs(8177.24, checksum, 0.01*2);
+ int i = 0;
for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
cpl_table_delete(edge_par[i]); edge_par[i] = NULL;
}
cpl_free(edge_par);
- for (i = 0; i < n; i++) {
- cpl_vector_delete(slit_ids[i]);
- cpl_matrix_delete(edgepars[i]);
- }
- cpl_free(slit_ids);
- cpl_free(edgepars);
-}
-
-/**
- @brief test for kmo_flat_interpolate_edge_parameters()
-*/
-void test_kmo_flat_interpolate_edge_parameters()
-{
- double checksum = 0;
- int n = 8, m = 14;
- FILE *fp = fopen("ref_data/edgepars_matrix.bin","rb");
- cpl_matrix **edgepars = (cpl_matrix**)cpl_malloc(n*sizeof(cpl_matrix*));
- int i = 0;
- for (i = 0; i < n; i++) {
- edgepars[i] = cpl_matrix_new(2*m, 4);
- double *ddd = cpl_matrix_get_data(edgepars[i]);
- fread(ddd, sizeof(double), 4*2*m, fp);
-
- checksum += cpl_matrix_get_mean(edgepars[i]);
- }
- fclose(fp);
-
- cpl_test_abs(2029.32, checksum, 0.01);
- kmo_flat_interpolate_edge_parameters(edgepars, 4.0, 1, 1, 1);
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_abs(2029.32, checksum, 0.01);
-
- for (i = 0; i < n; i++) {
- cpl_matrix_delete(edgepars[i]);
- }
- cpl_free(edgepars);
-}
-
-/**
- @brief test for kmo_chebyshev_coefficients()
-*/
-void test_kmo_chebyshev_coefficients()
-{
- double in[4] = {1764.78, -0.00416616, 4.09266e-05, -1.74782e-07},
- out[4];
- kmo_chebyshev_coefficients(in, out, 4, 1);
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_abs(1764.78, out[0], 0.01);
- cpl_test_abs(-0.00416629, out[1], 1e-5);
- cpl_test_abs(2.04633e-05, out[2], 1e-7);
- cpl_test_abs(-4.36956e-08, out[3], 1e-10);
-}
-
-/**
- @brief test for kmo_split_frame()
-*/
-void test_kmo_split_frame()
-{
- cpl_image *xcal = NULL;
- int *bounds = NULL;
-
- /* --- invalid tests --- */
- kmo_test_verbose_off();
- cpl_test_null(bounds = kmo_split_frame(NULL));
- cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- xcal = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
- cpl_test_null(bounds = kmo_split_frame(xcal));
- cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
- cpl_image_delete(xcal); xcal = NULL;
- kmo_test_verbose_on();
-
- /* --- valid tests --- */
- xcal = cpl_image_new(KMOS_DETECTOR_SIZE, KMOS_DETECTOR_SIZE, CPL_TYPE_FLOAT);
- cpl_image_multiply_scalar(xcal, 0.0);
- int ix = 0, iy = 0;
- for (ix = 1; ix <= KMOS_DETECTOR_SIZE; ix++) {
- for (iy = 1; iy <= KMOS_DETECTOR_SIZE; iy++) {
- if (!((ix==3) && (iy==1)) &&
- !((ix==4) && (iy==1)) &&
- !((ix==5) && (iy==1)) &&
- !((ix==6) && (iy==1)) &&
- !((ix==5) && (iy==5)) &&
- !((ix==6) && (iy==5)) &&
- !((ix==7) && (iy==5)) &&
- !((ix==8) && (iy==5)))
- {
- cpl_image_reject(xcal, ix, iy);
- }
- }
- }
- cpl_image_set(xcal, 3, 1, 1.1);
- cpl_image_set(xcal, 4, 1, 2.1);
- cpl_image_set(xcal, 5, 1, 3.1);
- cpl_image_set(xcal, 6, 1, 4.1);
- cpl_image_set(xcal, 5, 5, 1.4);
- cpl_image_set(xcal, 6, 5, 2.4);
- cpl_image_set(xcal, 7, 5, 3.4);
- cpl_image_set(xcal, 8, 5, 4.4);
-
- cpl_test_nonnull(bounds = kmo_split_frame(xcal));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_eq(2, bounds[0]);
- cpl_test_eq(5, bounds[1]);
- cpl_test_eq(-1, bounds[2]);
- cpl_test_eq(-1, bounds[3]);
- cpl_test_eq(-1, bounds[4]);
- cpl_test_eq(-1, bounds[5]);
- cpl_test_eq(4, bounds[6]);
- cpl_test_eq(7, bounds[7]);
- cpl_test_eq(-1, bounds[8]);
- cpl_test_eq(-1, bounds[9]);
- cpl_test_eq(-1, bounds[10]);
- cpl_test_eq(-1, bounds[11]);
- cpl_test_eq(-1, bounds[12]);
- cpl_test_eq(-1, bounds[13]);
- cpl_test_eq(-1, bounds[14]);
- cpl_test_eq(-1, bounds[15]);
-
- cpl_image_delete(xcal); xcal = NULL;
- cpl_free(bounds);
-}
-
-/**
- @brief test for kmo_get_slitedges()
-*/
-void test_kmo_get_slitedges()
-{
- kmo_test_verbose_off();
- cpl_test_null(kmo_get_slitedges(NULL, 0));
- cpl_test_error(CPL_ERROR_NULL_INPUT);
- kmo_test_verbose_on();
-
- kmclipm_vector *pos = NULL,
- *midline = kmclipm_vector_load("ref_data/midline_cut.fits", 0);
- cpl_test_nonnull(pos = kmo_get_slitedges(midline, 1106.87));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_abs(881.818, kmclipm_vector_get_mean(pos), 0.01);
-
- kmclipm_vector_delete(midline);
- kmclipm_vector_delete(pos);
-}
-
-/**
- @brief test for kmo_create_line_profile()
-*/
-void test_kmo_create_line_profile()
-{
- kmo_test_verbose_off();
- cpl_test_null(kmo_create_line_profile(NULL, -1, -1));
- cpl_test_error(CPL_ERROR_NULL_INPUT);
-
- cpl_image *profile = kmclipm_image_load ("ref_data/line_prof.fits", CPL_TYPE_FLOAT, 0, 0);
- cpl_test_null(kmo_create_line_profile(profile, 10, 5));
- cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
- kmo_test_verbose_on();
-
- kmclipm_vector *midline = NULL;
- cpl_test_nonnull(midline = kmo_create_line_profile(profile, 80, 120));
- cpl_test_error(CPL_ERROR_NONE);
- cpl_test_abs(1102.3, kmclipm_vector_get_mean(midline), 0.01);
-
- kmclipm_vector_delete(midline);
- cpl_image_delete(profile);
-}
-
-/**
- @brief test for kmo_imagelist_get_saturated()
-*/
-static void test_kmo_imagelist_get_saturated()
-{
- cpl_imagelist *list = NULL;
- cpl_image *img = NULL;
-
- /* --- invalid tests --- */
- kmo_test_verbose_off();
- cpl_test_eq(-1, kmo_imagelist_get_saturated(NULL, -1.0, -1.0));
- cpl_test_error(CPL_ERROR_NULL_INPUT);
- list = cpl_imagelist_new();
- cpl_test_eq(-1, kmo_imagelist_get_saturated(list, -1.0, -1.0));
- cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
- cpl_test_eq(-1, kmo_imagelist_get_saturated(list, 1000, -1.0));
- cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
- kmo_test_verbose_on();
-
- /* --- valid tests --- */
- img = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
- cpl_image_set(img, 1, 1, 10000);
- cpl_image_set(img, 1, 2, 10000);
- cpl_image_set(img, 2, 1, 10000);
- cpl_image_set(img, 2, 2, 1);
- cpl_imagelist_set(list, img, 0);
-
- img = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
- cpl_image_set(img, 1, 1, 10000);
- cpl_image_set(img, 1, 2, 10000);
- cpl_image_set(img, 2, 1, 1);
- cpl_image_set(img, 2, 2, 1);
- cpl_imagelist_set(list, img, 1);
-
- img = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
- cpl_image_set(img, 1, 1, 10000);
- cpl_image_set(img, 1, 2, 1);
- cpl_image_set(img, 2, 1, 1);
- cpl_image_set(img, 2, 2, 1);
- cpl_imagelist_set(list, img, 2);
-
- cpl_test_eq(2, kmo_imagelist_get_saturated(list, 1000, 2));
- cpl_test_error(CPL_ERROR_NONE);
-
- cpl_imagelist_delete(list);
+ cpl_image_delete(xcal);
+ cpl_image_delete(ycal);
+ cpl_array_delete(ifu);
+ cpl_image_delete(bad);
+ cpl_image_delete(data);
+ cpl_image_delete(noise);
}
/**
@@ -2795,24 +1924,25 @@ static void test_kmo_imagelist_get_saturated()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- test_kmo_create_bad_pix_flat();
- test_kmo_calc_thresh();
- test_kmo_analyze_flat();
- test_kmo_calc_curvature();
- test_kmos_get_valid_edge_pos();
+ test_kmo_create_bad_pix_flat_thresh();
+ test_kmo_calc_calib_frames();
test_kmo_polyfit_edge();
test_kmo_edge_trace();
- test_kmo_calc_calib_frames();
test_kmo_curvature_qc();
test_kmo_edgepars_to_table();
test_kmo_flat_interpolate_edge_parameters();
test_kmo_chebyshev_coefficients();
test_kmo_split_frame();
- test_kmo_get_slitedges();
- test_kmo_create_line_profile();
test_kmo_imagelist_get_saturated();
+ test_kmo_create_line_profile();
+ test_kmo_get_slitedges();
+ test_kmo_analize_slitedges();
+ test_kmo_analize_slitedges_advanced();
+ test_kmo_analyze_flat();
+ //test_kmo_calc_edge_pars(); // missing
+ test_kmo_calc_curvature();
return cpl_test_end(0);
}
diff --git a/kmos/tests/kmo_priv_functions-test.c b/kmos/tests/kmo_priv_functions-test.c
index e101ac0..2868e92 100644
--- a/kmos/tests/kmo_priv_functions-test.c
+++ b/kmos/tests/kmo_priv_functions-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_functions-test.c,v 1.7 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_functions-test.c,v 1.8 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.7 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.8 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -639,7 +639,7 @@ void test_kmo_priv_compare_frameset_setup()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_create_lambda_vec();
test_kmo_is_in_range();
diff --git a/kmos/tests/kmo_priv_lcorr-test.c b/kmos/tests/kmo_priv_lcorr-test.c
index 832e25a..0e1f932 100644
--- a/kmos/tests/kmo_priv_lcorr-test.c
+++ b/kmos/tests/kmo_priv_lcorr-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_lcorr-test.c,v 1.8 2013/07/04 08:24:49 erw Exp $
+/* $Id: kmo_priv_lcorr-test.c,v 1.8 2013-07-04 08:24:49 erw Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: erw $
- * $Date: 2013/07/04 08:24:49 $
+ * $Date: 2013-07-04 08:24:49 $
* $Revision: 1.8 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/kmos/tests/kmo_priv_make_image-test.c b/kmos/tests/kmo_priv_make_image-test.c
index 9499a90..afad3a2 100644
--- a/kmos/tests/kmo_priv_make_image-test.c
+++ b/kmos/tests/kmo_priv_make_image-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_make_image-test.c,v 1.2 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_make_image-test.c,v 1.3 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.3 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -126,7 +126,7 @@ void test_kmo_priv_is_below_threshold()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_identify_slices_with_oh();
test_kmo_priv_is_below_threshold();
diff --git a/kmos/tests/kmo_priv_noise_map-test.c b/kmos/tests/kmo_priv_noise_map-test.c
index 74728be..ccfd429 100644
--- a/kmos/tests/kmo_priv_noise_map-test.c
+++ b/kmos/tests/kmo_priv_noise_map-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_noise_map-test.c,v 1.2 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_noise_map-test.c,v 1.3 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.3 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -83,7 +83,7 @@ void test_kmo_calc_noise_map()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_calc_noise_map();
diff --git a/kmos/tests/kmo_priv_reconstruct-test.c b/kmos/tests/kmo_priv_reconstruct-test.c
index 2a73e45..448bb50 100644
--- a/kmos/tests/kmo_priv_reconstruct-test.c
+++ b/kmos/tests/kmo_priv_reconstruct-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_reconstruct-test.c,v 1.7 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_reconstruct-test.c,v 1.8 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.7 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.8 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -178,7 +178,7 @@ void test_kmo_save_det_img_ext()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_calc_flux_in();
test_kmo_calc_wcs_gd();
diff --git a/kmos/tests/kmo_priv_rotate-test.c b/kmos/tests/kmo_priv_rotate-test.c
index cc48407..bd78df8 100644
--- a/kmos/tests/kmo_priv_rotate-test.c
+++ b/kmos/tests/kmo_priv_rotate-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_rotate-test.c,v 1.5 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_rotate-test.c,v 1.6 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.5 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.6 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -251,7 +251,7 @@ void test_kmo_priv_rotate()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_priv_rotate();
diff --git a/kmos/tests/kmo_priv_shift-test.c b/kmos/tests/kmo_priv_shift-test.c
index 426749e..cdcd993 100644
--- a/kmos/tests/kmo_priv_shift-test.c
+++ b/kmos/tests/kmo_priv_shift-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_shift-test.c,v 1.4 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_shift-test.c,v 1.5 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.5 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -300,7 +300,7 @@ void test_kmo_priv_shift()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_priv_shift();
diff --git a/kmos/tests/kmo_priv_sky_mask-test.c b/kmos/tests/kmo_priv_sky_mask-test.c
index c4f80f9..2f09381 100644
--- a/kmos/tests/kmo_priv_sky_mask-test.c
+++ b/kmos/tests/kmo_priv_sky_mask-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_sky_mask-test.c,v 1.2 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_sky_mask-test.c,v 1.3 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.3 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -137,7 +137,7 @@ void test_kmo_calc_sky_mask()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_calc_sky_mask();
diff --git a/kmos/tests/kmo_priv_sky_tweak-test.c b/kmos/tests/kmo_priv_sky_tweak-test.c
index ce9dc47..a098f48 100644
--- a/kmos/tests/kmo_priv_sky_tweak-test.c
+++ b/kmos/tests/kmo_priv_sky_tweak-test.c
@@ -1,10 +1,10 @@
-/* $Id: kmo_priv_sky_tweak-test.c,v 1.2 2013/08/02 08:14:20 aagudo Exp $
+/* $Id: kmo_priv_sky_tweak-test.c,v 1.4 2013-09-13 09:10:28 erw Exp $
*
- * $Author: aagudo $
- * $Date: 2013/08/02 08:14:20 $
- * $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Author: erw $
+ * $Date: 2013-09-13 09:10:28 $
+ * $Revision: 1.4 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -151,6 +151,7 @@ void test_kmo_priv_sky_tweak_get_spectra (cpl_imagelist *obj, cpl_imagelist *sky
error = kmo_priv_sky_tweak_get_spectra(obj, sky, lambda, mask, 1,
&obj_spectrum, &sky_spectrum);
+ cpl_test_eq(error, CPL_ERROR_NONE);
cpl_image_delete(mask);
cpl_bivector_delete(obj_spectrum);
cpl_bivector_delete(sky_spectrum);
@@ -167,14 +168,15 @@ void test_kmo_priv_sky_tweak_correct_vibrational_trans (cpl_imagelist *obj, cpl_
cpl_image *mask = NULL;
float min_frac = .3;
- int line_full_width = 8;
+// int line_full_width = 8;
mask = kmo_lcorr_create_object_mask(obj, min_frac, NULL, NULL);
error = kmo_priv_sky_tweak_get_spectra(obj, sky, lambda, mask, 1,
&obj_spectrum, &sky_spectrum);
+ cpl_test_eq(error, CPL_ERROR_NONE);
vscales = kmo_priv_sky_tweak_correct_vibrational_trans (
- obj_spectrum, sky_spectrum, line_full_width);
+ obj_spectrum, sky_spectrum/*, line_full_width*/);
cpl_image_delete(mask);
cpl_bivector_delete(obj_spectrum);
@@ -186,8 +188,9 @@ void test_kmo_priv_sky_tweak(cpl_imagelist *object, cpl_imagelist *sky, cpl_prop
cpl_imagelist *result = NULL;
float min_frac = .3;
+ int tbsub = 1;
- result = kmo_priv_sky_tweak(object, sky, header, min_frac);
+ result = kmo_priv_sky_tweak(object, sky, header, min_frac, tbsub);
if (result != NULL) { cpl_imagelist_delete(result); }
}
diff --git a/kmos/tests/kmo_priv_stats-test.c b/kmos/tests/kmo_priv_stats-test.c
index 1b46821..33abfa3 100644
--- a/kmos/tests/kmo_priv_stats-test.c
+++ b/kmos/tests/kmo_priv_stats-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_stats-test.c,v 1.5 2013/05/23 14:37:10 aagudo Exp $
+/* $Id: kmo_priv_stats-test.c,v 1.6 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/23 14:37:10 $
- * $Revision: 1.5 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.6 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -751,7 +751,7 @@ void test_kmo_calc_remaining()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_calc_stats_cube();
test_kmo_calc_stats_img();
diff --git a/kmos/tests/kmo_priv_std_star-test.c b/kmos/tests/kmo_priv_std_star-test.c
index 42ff898..eed56b4 100644
--- a/kmos/tests/kmo_priv_std_star-test.c
+++ b/kmos/tests/kmo_priv_std_star-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_std_star-test.c,v 1.9 2013/06/17 07:52:26 aagudo Exp $
+/* $Id: kmo_priv_std_star-test.c,v 1.10 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 07:52:26 $
- * $Revision: 1.9 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.10 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -414,7 +414,7 @@ void test_kmo_calculate_std_trace()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmo_get_spec_type();
test_kmo_get_temperature();
diff --git a/kmos/tests/kmo_priv_wave_cal-test.c b/kmos/tests/kmo_priv_wave_cal-test.c
index 84e3915..78c6cd6 100644
--- a/kmos/tests/kmo_priv_wave_cal-test.c
+++ b/kmos/tests/kmo_priv_wave_cal-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_priv_wave_cal-test.c,v 1.3 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_priv_wave_cal-test.c,v 1.4 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.3 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.4 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -100,7 +100,7 @@ void test_kmo_calc_fitted_slitlet_edge()
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
// test_kmo_calc_wave_calib();
// test_kmo_extract_initial_trace();
diff --git a/kmos/tests/kmo_utils-test.c b/kmos/tests/kmo_utils-test.c
index 1fce490..4eabec1 100644
--- a/kmos/tests/kmo_utils-test.c
+++ b/kmos/tests/kmo_utils-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_utils-test.c,v 1.6 2013/06/17 07:52:26 aagudo Exp $
+/* $Id: kmo_utils-test.c,v 1.7 2013-10-08 11:18:19 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2007-2008 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 07:52:26 $
- * $Revision: 1.6 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:19 $
+ * $Revision: 1.7 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -840,7 +840,7 @@ void test_kmo_strupper()
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
test_kmos_get_license();
test_kmo_cut_endings();
diff --git a/recipes/Makefile.am b/recipes/Makefile.am
index 2d5b5fd..b4f9de5 100644
--- a/recipes/Makefile.am
+++ b/recipes/Makefile.am
@@ -49,6 +49,7 @@ plugin_LTLIBRARIES = kmo_arithmetic.la \
kmo_fits_strip.la \
kmo_flat.la \
kmo_illumination.la \
+ kmo_illumination_flat.la \
kmo_make_image.la \
kmo_multi_reconstruct.la \
kmo_noise_map.la \
@@ -163,6 +164,11 @@ kmo_illumination_la_LIBADD = $(LIBKMOS)
kmo_illumination_la_LDFLAGS = -module -avoid-version
kmo_illumination_la_DEPENDENCIES = $(LIBKMOS)
+kmo_illumination_flat_la_SOURCES = kmo_illumination_flat.c
+kmo_illumination_flat_la_LIBADD = $(LIBKMOS)
+kmo_illumination_flat_la_LDFLAGS = -module -avoid-version
+kmo_illumination_flat_la_DEPENDENCIES = $(LIBKMOS)
+
kmo_dev_setup_la_SOURCES = kmo_dev_setup.c
kmo_dev_setup_la_LIBADD = $(LIBKMOS)
kmo_dev_setup_la_LDFLAGS = -module -avoid-version
diff --git a/recipes/Makefile.in b/recipes/Makefile.in
index c305de0..d257708 100644
--- a/recipes/Makefile.in
+++ b/recipes/Makefile.in
@@ -145,6 +145,12 @@ kmo_illumination_la_OBJECTS = $(am_kmo_illumination_la_OBJECTS)
kmo_illumination_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_illumination_la_LDFLAGS) $(LDFLAGS) -o $@
+am_kmo_illumination_flat_la_OBJECTS = kmo_illumination_flat.lo
+kmo_illumination_flat_la_OBJECTS = \
+ $(am_kmo_illumination_flat_la_OBJECTS)
+kmo_illumination_flat_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(kmo_illumination_flat_la_LDFLAGS) $(LDFLAGS) -o $@
am_kmo_make_image_la_OBJECTS = kmo_make_image.lo
kmo_make_image_la_OBJECTS = $(am_kmo_make_image_la_OBJECTS)
kmo_make_image_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -225,6 +231,7 @@ SOURCES = $(kmo_arithmetic_la_SOURCES) $(kmo_combine_la_SOURCES) \
$(kmo_fit_profile_la_SOURCES) $(kmo_fits_check_la_SOURCES) \
$(kmo_fits_stack_la_SOURCES) $(kmo_fits_strip_la_SOURCES) \
$(kmo_flat_la_SOURCES) $(kmo_illumination_la_SOURCES) \
+ $(kmo_illumination_flat_la_SOURCES) \
$(kmo_make_image_la_SOURCES) \
$(kmo_multi_reconstruct_la_SOURCES) \
$(kmo_noise_map_la_SOURCES) $(kmo_reconstruct_la_SOURCES) \
@@ -238,6 +245,7 @@ DIST_SOURCES = $(kmo_arithmetic_la_SOURCES) $(kmo_combine_la_SOURCES) \
$(kmo_fit_profile_la_SOURCES) $(kmo_fits_check_la_SOURCES) \
$(kmo_fits_stack_la_SOURCES) $(kmo_fits_strip_la_SOURCES) \
$(kmo_flat_la_SOURCES) $(kmo_illumination_la_SOURCES) \
+ $(kmo_illumination_flat_la_SOURCES) \
$(kmo_make_image_la_SOURCES) \
$(kmo_multi_reconstruct_la_SOURCES) \
$(kmo_noise_map_la_SOURCES) $(kmo_reconstruct_la_SOURCES) \
@@ -462,6 +470,7 @@ plugin_LTLIBRARIES = kmo_arithmetic.la \
kmo_fits_strip.la \
kmo_flat.la \
kmo_illumination.la \
+ kmo_illumination_flat.la \
kmo_make_image.la \
kmo_multi_reconstruct.la \
kmo_noise_map.la \
@@ -556,6 +565,10 @@ kmo_illumination_la_SOURCES = kmo_illumination.c
kmo_illumination_la_LIBADD = $(LIBKMOS)
kmo_illumination_la_LDFLAGS = -module -avoid-version
kmo_illumination_la_DEPENDENCIES = $(LIBKMOS)
+kmo_illumination_flat_la_SOURCES = kmo_illumination_flat.c
+kmo_illumination_flat_la_LIBADD = $(LIBKMOS)
+kmo_illumination_flat_la_LDFLAGS = -module -avoid-version
+kmo_illumination_flat_la_DEPENDENCIES = $(LIBKMOS)
kmo_dev_setup_la_SOURCES = kmo_dev_setup.c
kmo_dev_setup_la_LIBADD = $(LIBKMOS)
kmo_dev_setup_la_LDFLAGS = -module -avoid-version
@@ -661,6 +674,8 @@ kmo_flat.la: $(kmo_flat_la_OBJECTS) $(kmo_flat_la_DEPENDENCIES) $(EXTRA_kmo_flat
$(kmo_flat_la_LINK) -rpath $(plugindir) $(kmo_flat_la_OBJECTS) $(kmo_flat_la_LIBADD) $(LIBS)
kmo_illumination.la: $(kmo_illumination_la_OBJECTS) $(kmo_illumination_la_DEPENDENCIES) $(EXTRA_kmo_illumination_la_DEPENDENCIES)
$(kmo_illumination_la_LINK) -rpath $(plugindir) $(kmo_illumination_la_OBJECTS) $(kmo_illumination_la_LIBADD) $(LIBS)
+kmo_illumination_flat.la: $(kmo_illumination_flat_la_OBJECTS) $(kmo_illumination_flat_la_DEPENDENCIES) $(EXTRA_kmo_illumination_flat_la_DEPENDENCIES)
+ $(kmo_illumination_flat_la_LINK) -rpath $(plugindir) $(kmo_illumination_flat_la_OBJECTS) $(kmo_illumination_flat_la_LIBADD) $(LIBS)
kmo_make_image.la: $(kmo_make_image_la_OBJECTS) $(kmo_make_image_la_DEPENDENCIES) $(EXTRA_kmo_make_image_la_DEPENDENCIES)
$(kmo_make_image_la_LINK) -rpath $(plugindir) $(kmo_make_image_la_OBJECTS) $(kmo_make_image_la_LIBADD) $(LIBS)
kmo_multi_reconstruct.la: $(kmo_multi_reconstruct_la_OBJECTS) $(kmo_multi_reconstruct_la_DEPENDENCIES) $(EXTRA_kmo_multi_reconstruct_la_DEPENDENCIES)
@@ -704,6 +719,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_fits_strip.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_flat.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_illumination.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_illumination_flat.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_make_image.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_multi_reconstruct.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_noise_map.Plo at am__quote@
diff --git a/recipes/kmo_arithmetic.c b/recipes/kmo_arithmetic.c
index 76167d7..4565f00 100644
--- a/recipes/kmo_arithmetic.c
+++ b/recipes/kmo_arithmetic.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_arithmetic.c,v 1.14 2013/06/07 15:41:19 aagudo Exp $
+/* $Id: kmo_arithmetic.c,v 1.15 2013-09-05 12:24:58 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/07 15:41:19 $
- * $Revision: 1.14 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-09-05 12:24:58 $
+ * $Revision: 1.15 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -586,9 +586,10 @@ static int kmo_arithmetic(cpl_parameterlist *parlist, cpl_frameset *frameset)
op));
}
- KMO_TRY_EXIT_IF_ERROR(
- kmo_update_sub_keywords(sub_header_data, FALSE, FALSE,
- detector_frame, i));
+// keep EXTNAME from op1 (e.g. CHIP1.INT1 instead of creating DET.1.DATA)
+// KMO_TRY_EXIT_IF_ERROR(
+// kmo_update_sub_keywords(sub_header_data, FALSE, FALSE,
+// detector_frame, i));
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_save_image(op1_2d, fn_out, "",
diff --git a/recipes/kmo_combine.c b/recipes/kmo_combine.c
index e966dbb..835acef 100644
--- a/recipes/kmo_combine.c
+++ b/recipes/kmo_combine.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_combine.c,v 1.32 2013/06/27 13:10:21 aagudo Exp $
+/* $Id: kmo_combine.c,v 1.32 2013-06-27 13:10:21 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/27 13:10:21 $
+ * $Date: 2013-06-27 13:10:21 $
* $Revision: 1.32 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_copy.c b/recipes/kmo_copy.c
index ecb0869..ddf950c 100644
--- a/recipes/kmo_copy.c
+++ b/recipes/kmo_copy.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_copy.c,v 1.12 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_copy.c,v 1.12 2013-05-21 12:13:58 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
+ * $Date: 2013-05-21 12:13:58 $
* $Revision: 1.12 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_dark.c b/recipes/kmo_dark.c
index a4548d2..802f4f7 100644
--- a/recipes/kmo_dark.c
+++ b/recipes/kmo_dark.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_dark.c,v 1.21 2013/07/02 09:37:22 aagudo Exp $
+/* $Id: kmo_dark.c,v 1.21 2013-07-02 09:37:22 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/07/02 09:37:22 $
+ * $Date: 2013-07-02 09:37:22 $
* $Revision: 1.21 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_dev_setup.c b/recipes/kmo_dev_setup.c
index 24285ac..9021c52 100644
--- a/recipes/kmo_dev_setup.c
+++ b/recipes/kmo_dev_setup.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_dev_setup.c,v 1.10 2013/06/18 07:56:47 aagudo Exp $
+/* $Id: kmo_dev_setup.c,v 1.10 2013-06-18 07:56:47 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/18 07:56:47 $
+ * $Date: 2013-06-18 07:56:47 $
* $Revision: 1.10 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_extract_spec.c b/recipes/kmo_extract_spec.c
index c48b1de..3da7824 100644
--- a/recipes/kmo_extract_spec.c
+++ b/recipes/kmo_extract_spec.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_extract_spec.c,v 1.15 2013/06/07 15:41:20 aagudo Exp $
+/* $Id: kmo_extract_spec.c,v 1.15 2013-06-07 15:41:20 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/07 15:41:20 $
+ * $Date: 2013-06-07 15:41:20 $
* $Revision: 1.15 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_fit_profile.c b/recipes/kmo_fit_profile.c
index a54d662..6d14a79 100644
--- a/recipes/kmo_fit_profile.c
+++ b/recipes/kmo_fit_profile.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_fit_profile.c,v 1.10 2013/06/07 15:41:21 aagudo Exp $
+/* $Id: kmo_fit_profile.c,v 1.10 2013-06-07 15:41:21 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/07 15:41:21 $
+ * $Date: 2013-06-07 15:41:21 $
* $Revision: 1.10 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_fits_check.c b/recipes/kmo_fits_check.c
index f94dfc4..ac462eb 100644
--- a/recipes/kmo_fits_check.c
+++ b/recipes/kmo_fits_check.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_fits_check.c,v 1.7 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_fits_check.c,v 1.7 2013-05-21 12:13:58 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
+ * $Date: 2013-05-21 12:13:58 $
* $Revision: 1.7 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_fits_stack.c b/recipes/kmo_fits_stack.c
index 84cb2e0..8a5608b 100644
--- a/recipes/kmo_fits_stack.c
+++ b/recipes/kmo_fits_stack.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_fits_stack.c,v 1.8 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_fits_stack.c,v 1.8 2013-05-21 12:13:58 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
+ * $Date: 2013-05-21 12:13:58 $
* $Revision: 1.8 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_fits_strip.c b/recipes/kmo_fits_strip.c
index fd4c3e9..d6495b5 100644
--- a/recipes/kmo_fits_strip.c
+++ b/recipes/kmo_fits_strip.c
@@ -22,7 +22,7 @@
* $Author: aagudo $
* $Date: 2013/08/02 09:09:54 $
* $Revision: 1.14 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: $
*/
#ifdef HAVE_CONFIG_H
@@ -699,6 +699,7 @@ static int kmo_fits_strip(cpl_parameterlist *parlist, cpl_frameset *frameset)
desc.frame_type,
actDetNr));
print_cal_angle_msg_once = FALSE;
+ print_xcal_angle_msg_once = FALSE;
KMO_TRY_EXIT_IF_NULL(
img = kmo_dfs_load_cal_image(frameset, "0",
i+1, n, angle,
diff --git a/recipes/kmo_flat.c b/recipes/kmo_flat.c
index e2cc1da..16b413e 100644
--- a/recipes/kmo_flat.c
+++ b/recipes/kmo_flat.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_flat.c,v 1.46 2013/07/05 09:19:41 aagudo Exp $
+/* $Id: kmo_flat.c,v 1.49 2013-09-20 13:10:47 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/07/05 09:19:41 $
- * $Revision: 1.46 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-09-20 13:10:47 $
+ * $Revision: 1.49 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -945,7 +945,7 @@ static int kmo_flat(cpl_parameterlist *parlist, cpl_frameset *frameset)
//
for (a = 0; a < nr_angles; a++) {
- cpl_msg_info("","Processing rotator angle %d -> %d degree", a,rotang_found[a]);
+ cpl_msg_info("","Processing rotator angle %d -> %d degree", a, rotang_found[a]);
for (i = 1; i <= nr_devices; i++) {
cpl_msg_info("","Processing detector No. %d", i);
@@ -1400,8 +1400,9 @@ static int kmo_flat(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_EXIT_IF_NULL(
sub_header = kmo_dfs_load_sub_header(frameset, FLAT_ON, i,
FALSE));
- cpl_propertylist_erase(sub_header, CRPIX1);
- cpl_propertylist_erase(sub_header, CRPIX2);
+// leave keywords in for proper fitsverify output
+// cpl_propertylist_erase(sub_header, CRPIX1);
+// cpl_propertylist_erase(sub_header, CRPIX2);
KMO_TRY_EXIT_IF_ERROR(
kmclipm_update_property_double(sub_header,CAL_ROTANGLE,
@@ -1410,7 +1411,7 @@ static int kmo_flat(cpl_parameterlist *parlist, cpl_frameset *frameset)
// AA: commented this out: not needed for the moment. Additionally there were only
// 34 values saved instead of 48?!?
-// And sometimes the keyword was named IFU-2_L insted of IFU2_L ?!?
+// And sometimes the keyword was named IFU-2_L instead of IFU2_L ?!?
// // write BOUNDS as well into subheaders
// if (i == 1) {
// for (ii = 0; ii < nr_devices; ii++) {
@@ -1579,30 +1580,42 @@ static int kmo_flat(cpl_parameterlist *parlist, cpl_frameset *frameset)
fn_suffix, sub_header, 0./0.));
// save edge_pars-frame
- KMO_TRY_EXIT_IF_NULL(
- extname = kmo_extname_creator(list_frame, i, EXT_DATA));
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_string(sub_header, EXTNAME,
- extname,
- "FITS extension name"));
cpl_free(extname); extname = NULL;
for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+ KMO_TRY_EXIT_IF_NULL(
+ extname = cpl_sprintf("%s_IFU.%d_ANGLE.%d",
+ EXT_LIST,
+ j+1+(i-1)*KMOS_IFUS_PER_DETECTOR,
+ rotang_found[a]));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_update_property_string(sub_header, EXTNAME,
+ extname,
+ "FITS extension name"));
+ cpl_free(extname); extname = NULL;
+
KMO_TRY_EXIT_IF_ERROR(
kmclipm_update_property_int(sub_header, CAL_IFU_NR,
j+1+(i-1)*KMOS_IFUS_PER_DETECTOR,
"IFU Number {1..24}"));
// save edge-parameters as product
- if (spec_found[sx] != CPL_ERROR_DATA_NOT_FOUND) {
- if (edge_table[sx][j] != NULL) {
- KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_table(edge_table[sx][j], filename_edge, fn_suffix, sub_header));
- } else {
- KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_table(NULL, filename_edge, fn_suffix, sub_header));
- }
+ if ((spec_found[sx] != CPL_ERROR_DATA_NOT_FOUND) && (edge_table[sx][j] != NULL)) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_table(edge_table[sx][j], filename_edge, fn_suffix, sub_header));
} else {
+ cpl_propertylist_erase(sub_header, CRVAL1);
+ cpl_propertylist_erase(sub_header, CRVAL2);
+ cpl_propertylist_erase(sub_header, CD1_1);
+ cpl_propertylist_erase(sub_header, CD1_2);
+ cpl_propertylist_erase(sub_header, CD2_1);
+ cpl_propertylist_erase(sub_header, CD2_2);
+ cpl_propertylist_erase(sub_header, CRPIX1);
+ cpl_propertylist_erase(sub_header, CRPIX2);
+ cpl_propertylist_erase(sub_header, CTYPE1);
+ cpl_propertylist_erase(sub_header, CTYPE2);
+ KMO_TRY_CHECK_ERROR_STATE();
+
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_save_table(NULL, filename_edge, fn_suffix, sub_header));
}
diff --git a/recipes/kmo_illumination.c b/recipes/kmo_illumination.c
index c5ac897..a0cbce8 100644
--- a/recipes/kmo_illumination.c
+++ b/recipes/kmo_illumination.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_illumination.c,v 1.58 2013/07/25 09:45:32 aagudo Exp $
+/* $Id: kmo_illumination.c,v 1.65 2013-10-21 13:44:54 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/07/25 09:45:32 $
- * $Revision: 1.58 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-21 13:44:54 $
+ * $Revision: 1.65 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -69,6 +69,8 @@ static char kmo_illumination_description[] =
"generates the spectral calibration frame needed in this recipe. As input at\n"
"least a sky, a master dark, a master flat and the spatial and spectral cali-\n"
"bration frames are required.\n"
+"The created product, the illumination correction, can be used as input for\n"
+"kmo_std_star and kmo_sci_red.\n"
"\n"
"BASIC PARAMETERS:\n"
"-----------------\n"
@@ -245,9 +247,9 @@ static int kmo_illumination_create(cpl_plugin *plugin)
CPL_TYPE_STRING,
"Method to use for interpolation: "
"[\"NN\" (nearest neighbour), "
- "\"lwNN\" (linear weighted nearest neighbor),"
- "\"swNN\" (square weighted nearest neighbor)"
- "\"MS\" (Modified Shepard's method)"
+ "\"lwNN\" (linear weighted nearest neighbor), "
+ "\"swNN\" (square weighted nearest neighbor), "
+ "\"MS\" (Modified Shepard's method), "
"\"CS\" (Cubic spline)]",
"kmos.kmo_illumination",
"CS");
@@ -258,7 +260,7 @@ static int kmo_illumination_create(cpl_plugin *plugin)
/* --neighborhoodRange */
p = cpl_parameter_new_value("kmos.kmo_illumination.neighborhoodRange",
CPL_TYPE_DOUBLE,
- "Defines the range to search for neighbors."
+ "Defines the range to search for neighbors. "
"in pixels",
"kmos.kmo_illumination",
1.001);
@@ -269,8 +271,8 @@ static int kmo_illumination_create(cpl_plugin *plugin)
/* --range */
p = cpl_parameter_new_value("kmos.kmo_illumination.range",
CPL_TYPE_STRING,
- "The spectral ranges to combine when collapsing"
- "the reconstructed cubes. e.g."
+ "The spectral ranges to combine when collapsing "
+ "the reconstructed cubes. e.g. "
"\"x1_start,x1_end;x2_start,x2_end\" (microns)",
"kmos.kmo_illumination",
"");
@@ -315,7 +317,7 @@ static int kmo_illumination_create(cpl_plugin *plugin)
/* --suppress_extension */
p = cpl_parameter_new_value("kmos.kmo_illumination.suppress_extension",
CPL_TYPE_BOOL,
- "Suppress arbitrary filename extension."
+ "Suppress arbitrary filename extension. "
"(TRUE (apply) or FALSE (don't apply)",
"kmos.kmo_illumination",
FALSE);
@@ -886,7 +888,7 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_ASSURE((abs(rotangle - tmp_rotangle) < 10.0) ||
(abs(rotangle - tmp_rotangle) > 360.-10.) ,
CPL_ERROR_ILLEGAL_INPUT,
- "OCS ROT NAANGLE of sky flat frames differ to much: %f %f",
+ "OCS ROT NAANGLE of sky flat frames differ too much: %f %f",
rotangle, tmp_rotangle);
}
cpl_propertylist_delete(main_header); main_header = NULL;
@@ -1049,7 +1051,7 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
CPL_ERROR_ILLEGAL_INPUT,
"We really shouldn't get here...");
}
- cpl_msg_info("", "Spectral range to collapse has been set to %s um for this band.", ranges_txt);
+ cpl_msg_info("", "Spectral range to collapse has been set to [%s] um for this band.", ranges_txt);
ranges = kmo_identify_ranges(ranges_txt);
KMO_TRY_CHECK_ERROR_STATE();
}
@@ -1057,7 +1059,7 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
// setup grid definition, wavelength start and end points will be set
// in the detector loop
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_setup_grid(&gd, method, neighborhoodRange, pix_scale));
+ kmclipm_setup_grid(&gd, method, neighborhoodRange, pix_scale, 0.));
// create filename for LUT
KMO_TRY_EXIT_IF_NULL(
@@ -1467,7 +1469,10 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
&cube_data,
&cube_noise,
flux,
- background));
+ background,
+ NULL,
+ NULL,
+ NULL));
KMO_TRY_CHECK_ERROR_STATE();
} else {
// IFU is invalid
@@ -1542,28 +1547,28 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
unused_ifus_after[det_nr-1]));
if (punused_ifus[j] == 0) {
if (stored_sub_data_headers[ifu_nr-1] != NULL) {
- // IFU is valid
- ifu_crpix = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
- CRPIX3);
- KMO_TRY_CHECK_ERROR_STATE_MSG(
- "CRPIX3 keyword in FITS-header is missing!");
-
- ifu_crval = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
- CRVAL3);
- KMO_TRY_CHECK_ERROR_STATE_MSG(
- "CRVAL3 keyword in FITS-header is missing!");
-
- ifu_cdelt = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
- CDELT3);
- KMO_TRY_CHECK_ERROR_STATE_MSG(
- "CDELT3 keyword in FITS-header is missing!");
+ // IFU is valid
+ ifu_crpix = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
+ CRPIX3);
+ KMO_TRY_CHECK_ERROR_STATE_MSG(
+ "CRPIX3 keyword in FITS-header is missing!");
+
+ ifu_crval = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
+ CRVAL3);
+ KMO_TRY_CHECK_ERROR_STATE_MSG(
+ "CRVAL3 keyword in FITS-header is missing!");
+
+ ifu_cdelt = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
+ CDELT3);
+ KMO_TRY_CHECK_ERROR_STATE_MSG(
+ "CDELT3 keyword in FITS-header is missing!");
- KMO_TRY_EXIT_IF_NULL(
- identified_slices = kmo_identify_slices(ranges,
- ifu_crpix,
- ifu_crval,
- ifu_cdelt,
- gd.l.dim));
+ KMO_TRY_EXIT_IF_NULL(
+ identified_slices = kmo_identify_slices(ranges,
+ ifu_crpix,
+ ifu_crval,
+ ifu_cdelt,
+ gd.l.dim));
}/* else {
KMO_TRY_EXIT_IF_NULL(
identified_slices = cpl_vector_new(gd.l.dim));
@@ -1587,57 +1592,64 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
}
}
- // normalise all IFUs as a group.
+ // normalise all IFUs of a detector as a group.
// Calculate mean of each IFU, add up and divide by number of successful
// averaged IFUs.
// Then divide all valid IFUs with mean value
- cnt = 0;
- for (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
- if (stored_data_images[i] != NULL) {
- KMO_TRY_ASSURE(cpl_image_count_rejected(stored_data_images[i]) <
- cpl_image_get_size_x(stored_data_images[i])*
- cpl_image_get_size_y(stored_data_images[i]),
- CPL_ERROR_ILLEGAL_INPUT,
- "The collapsed, dark-subtracted image contains "
- "only invalid values! Probably the provided "
- "FLAT_SKY frames are exactly the same as the "
- "frames used for MASTER_DARK calculation.");
-
- mean_data += cpl_image_get_mean(stored_data_images[i]);
- KMO_TRY_CHECK_ERROR_STATE();
- cnt++;
- }
-
- }
- mean_data /= cnt;
-
- if (mean_data != 0.0) {
- for (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
- if (stored_data_images[i] != NULL) {
- KMO_TRY_EXIT_IF_ERROR(
- cpl_image_divide_scalar(stored_data_images[i],
- mean_data));
+ int jj;
+ for (jj = 0; jj < nr_devices; jj++) {
+ cnt = 0;
+ mean_data = 0;
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ ifu_nr = jj*KMOS_IFUS_PER_DETECTOR + i;
+ if (stored_data_images[ifu_nr] != NULL) {
+ KMO_TRY_ASSURE(cpl_image_count_rejected(stored_data_images[ifu_nr]) <
+ cpl_image_get_size_x(stored_data_images[ifu_nr])*
+ cpl_image_get_size_y(stored_data_images[ifu_nr]),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "The collapsed, dark-subtracted image contains "
+ "only invalid values! Probably the provided "
+ "FLAT_SKY frames are exactly the same as the "
+ "frames used for MASTER_DARK calculation.");
+
+ mean_data += cpl_image_get_mean(stored_data_images[ifu_nr]);
+ KMO_TRY_CHECK_ERROR_STATE();
+ cnt++;
}
+
}
- } else {
- cpl_msg_warning(cpl_func, "Data couldn't be normalised "
- "(mean = 0.0)!");
- }
+ mean_data /= cnt;
- if (process_noise) {
if (mean_data != 0.0) {
- for (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
- if (stored_noise_images[i] != NULL) {
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ ifu_nr = jj*KMOS_IFUS_PER_DETECTOR + i;
+ if (stored_data_images[ifu_nr] != NULL) {
KMO_TRY_EXIT_IF_ERROR(
- cpl_image_divide_scalar(stored_noise_images[i],
+ cpl_image_divide_scalar(stored_data_images[ifu_nr],
mean_data));
}
}
} else {
- cpl_msg_warning(cpl_func, "Noise couldn't be normalised "
+ cpl_msg_warning(cpl_func, "Data couldn't be normalised "
"(mean = 0.0)!");
}
- }
+
+ if (process_noise) {
+ if (mean_data != 0.0) {
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ ifu_nr = jj*KMOS_IFUS_PER_DETECTOR + i;
+ if (stored_noise_images[ifu_nr] != NULL) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_image_divide_scalar(stored_noise_images[ifu_nr],
+ mean_data));
+ }
+ }
+ } else {
+ cpl_msg_warning(cpl_func, "Noise couldn't be normalised "
+ "(mean = 0.0)!");
+ }
+ }
+ } // end for(jj)
// calculate qc parameters on normalised data
qc_spat_unif = 0.0;
@@ -1702,9 +1714,11 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
kmo_dfs_save_main_header(frameset, ILLUM_CORR, fn_suffix, frame,
main_header, parlist, cpl_func));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_main_header(frameset, SKYFLAT_EDGE, fn_suffix, frame,
- main_header, parlist, cpl_func));
+ if (has_flat_edge) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_main_header(frameset, SKYFLAT_EDGE, fn_suffix, frame,
+ main_header, parlist, cpl_func));
+ }
for (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
KMO_TRY_EXIT_IF_ERROR(
diff --git a/recipes/kmo_illumination.c b/recipes/kmo_illumination_flat.c
similarity index 51%
copy from recipes/kmo_illumination.c
copy to recipes/kmo_illumination_flat.c
index c5ac897..4c80244 100644
--- a/recipes/kmo_illumination.c
+++ b/recipes/kmo_illumination_flat.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_illumination.c,v 1.58 2013/07/25 09:45:32 aagudo Exp $
+/* $Id: kmo_illumination_flat.c,v 1.1 2013/10/21 13:44:55 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/07/25 09:45:32 $
- * $Revision: 1.58 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013/10/21 13:44:55 $
+ * $Revision: 1.1 $
+ * $Name: $
*/
#ifdef HAVE_CONFIG_H
@@ -54,42 +54,36 @@
* Functions prototypes
*----------------------------------------------------------------------------*/
-static int kmo_illumination_create(cpl_plugin *);
-static int kmo_illumination_exec(cpl_plugin *);
-static int kmo_illumination_destroy(cpl_plugin *);
-static int kmo_illumination(cpl_parameterlist *, cpl_frameset *);
+static int kmo_illumination_flat_create(cpl_plugin *);
+static int kmo_illumination_flat_exec(cpl_plugin *);
+static int kmo_illumination_flat_destroy(cpl_plugin *);
+static int kmo_illumination_flat(cpl_parameterlist *, cpl_frameset *);
/*-----------------------------------------------------------------------------
* Static variables
*----------------------------------------------------------------------------*/
-static char kmo_illumination_description[] =
+static char kmo_illumination_flat_description[] =
"This recipe creates the spatial non-uniformity calibration frame needed for\n"
"all three detectors. It must be called after the kmo_wave_cal-recipe, which\n"
"generates the spectral calibration frame needed in this recipe. As input at\n"
-"least a sky, a master dark, a master flat and the spatial and spectral cali-\n"
-"bration frames are required.\n"
+"least a flatfield frame is required.\n"
+"Contrary to kmo_illumination it doesn't use flat sky frames but rather the\n"
+"flatfield frames from the internal flat lamp. This recipe can be used if no\n"
+"acceptable flat sky frames are available.\n"
+"The created product, the illumination correction, can be used as input for\n"
+"kmo_std_star and kmo_sci_red.\n"
"\n"
"BASIC PARAMETERS:\n"
"-----------------\n"
"--imethod\n"
"The interpolation method used for reconstruction.\n"
"\n"
-"--range\n"
-"The spectral ranges to combine when collapsing the reconstructed cubes. e.g.\n"
-"\"x1_start,x1_end;x2_start,x2_end\" (microns)\n"
-"\n"
"ADVANCED PARAMETERS\n"
"-------------------\n"
"--flux\n"
"Specify if flux conservation should be applied.\n"
"\n"
-"--add-all\n"
-"By default the first FLAT_SKY frame is omitted, since in the\n"
-"KMOS_spec_cal_skyflat template this is an acquisition frame to estimate the\n"
-"needed exposure time for the subsequent FLAT_SKY frames. If anyway all frames\n"
-"should be considered, set this parameter to TRUE.\n"
-"\n"
"--neighborhoodRange\n"
"Defines the range to search for neighbors during reconstruction\n"
"\n"
@@ -151,25 +145,19 @@ static char kmo_illumination_description[] =
" DO KMOS \n"
" category Type Explanation Required #Frames\n"
" -------- ----- ----------- -------- -------\n"
-" FLAT_SKY F2D Sky exposures Y 1-n \n"
+" FLAT_SKY_FLAT F2D Flatlamp-on exposures Y 1-n \n"
" (at least 3 frames recommended) \n"
-" MASTER_DARK F2D Master dark Y 1 \n"
-" MASTER_FLAT F2D Master flat Y 1 \n"
" XCAL F2D x calibration frame Y 1 \n"
" YCAL F2D y calibration frame Y 1 \n"
" LCAL F2D Wavelength calib. frame Y 1 \n"
" WAVE_BAND F2L Table with start-/end-wavelengths Y 1 \n"
-" FLAT_EDGE F2L Table with fitted slitlet edges N 0,1 \n"
"\n"
" Output files:\n"
"\n"
" DO KMOS\n"
" category Type Explanation\n"
" -------- ----- -----------\n"
-" ILLUM_CORR F2I Illumination calibration frame \n"
-" If FLAT_EDGE is provided: \n"
-" SKYFLAT_EDGE F2L Frame containing parameters of fitted \n"
-" slitlets of all IFUs of all detectors\n"
+" ILLUM_CORR F2I Illumination calibration frame \n"
"-------------------------------------------------------------------------------\n"
"\n";
@@ -178,7 +166,7 @@ static char kmo_illumination_description[] =
*----------------------------------------------------------------------------*/
/**
- * @defgroup kmo_illumination kmo_illumination Create a calibration frame to correct spatial non-uniformity of flatfield
+ * @defgroup kmo_illumination_flat kmo_illumination_flat Create a calibration frame to correct spatial non-uniformity of flatfield
*
* See recipe description for details.
*/
@@ -202,16 +190,15 @@ int cpl_plugin_get_info(cpl_pluginlist *list)
CPL_PLUGIN_API,
KMOS_BINARY_VERSION,
CPL_PLUGIN_TYPE_RECIPE,
- "kmo_illumination",
- "Create a calibration frame to correct spatial "
- "non-uniformity of flatfield.",
- kmo_illumination_description,
+ "kmo_illumination_flat",
+ "Alternative to kmo_illumination based on flatfield frames.",
+ kmo_illumination_flat_description,
"Alex Agudo Berbel",
"kmos-spark at mpe.mpg.de",
kmos_get_license(),
- kmo_illumination_create,
- kmo_illumination_exec,
- kmo_illumination_destroy);
+ kmo_illumination_flat_create,
+ kmo_illumination_flat_exec,
+ kmo_illumination_flat_destroy);
cpl_pluginlist_append(list, plugin);
@@ -225,7 +212,7 @@ int cpl_plugin_get_info(cpl_pluginlist *list)
Defining the command-line/configuration parameters for the recipe.
*/
-static int kmo_illumination_create(cpl_plugin *plugin)
+static int kmo_illumination_flat_create(cpl_plugin *plugin)
{
cpl_recipe *recipe;
cpl_parameter *p;
@@ -241,83 +228,60 @@ static int kmo_illumination_create(cpl_plugin *plugin)
/* Fill the parameters list */
/* --imethod */
- p = cpl_parameter_new_value("kmos.kmo_illumination.imethod",
+ p = cpl_parameter_new_value("kmos.kmo_illumination_flat.imethod",
CPL_TYPE_STRING,
"Method to use for interpolation: "
"[\"NN\" (nearest neighbour), "
- "\"lwNN\" (linear weighted nearest neighbor),"
- "\"swNN\" (square weighted nearest neighbor)"
- "\"MS\" (Modified Shepard's method)"
+ "\"lwNN\" (linear weighted nearest neighbor), "
+ "\"swNN\" (square weighted nearest neighbor), "
+ "\"MS\" (Modified Shepard's method), "
"\"CS\" (Cubic spline)]",
- "kmos.kmo_illumination",
+ "kmos.kmo_illumination_flat",
"CS");
cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "imethod");
cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
cpl_parameterlist_append(recipe->parameters, p);
/* --neighborhoodRange */
- p = cpl_parameter_new_value("kmos.kmo_illumination.neighborhoodRange",
+ p = cpl_parameter_new_value("kmos.kmo_illumination_flat.neighborhoodRange",
CPL_TYPE_DOUBLE,
- "Defines the range to search for neighbors."
+ "Defines the range to search for neighbors. "
"in pixels",
- "kmos.kmo_illumination",
+ "kmos.kmo_illumination_flat",
1.001);
cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "neighborhoodRange");
cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
cpl_parameterlist_append(recipe->parameters, p);
- /* --range */
- p = cpl_parameter_new_value("kmos.kmo_illumination.range",
- CPL_TYPE_STRING,
- "The spectral ranges to combine when collapsing"
- "the reconstructed cubes. e.g."
- "\"x1_start,x1_end;x2_start,x2_end\" (microns)",
- "kmos.kmo_illumination",
- "");
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "range");
- cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
- cpl_parameterlist_append(recipe->parameters, p);
-
/* --flux */
- p = cpl_parameter_new_value("kmos.kmo_illumination.flux",
+ p = cpl_parameter_new_value("kmos.kmo_illumination_flat.flux",
CPL_TYPE_BOOL,
"TRUE: Apply flux conservation. FALSE: otherwise",
- "kmos.kmo_illumination",
+ "kmos.kmo_illumination_flat",
FALSE);
cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "flux");
cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
cpl_parameterlist_append(recipe->parameters, p);
- /* --add-all */
- p = cpl_parameter_new_value("kmos.kmo_illumination.add-all",
- CPL_TYPE_BOOL,
- "FALSE: omit 1st FLAT_SKY frame (acquisition), "
- "TRUE: don't perform any checks, add them all",
- "kmos.kmo_illumination",
- FALSE);
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "add-all");
- cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
- cpl_parameterlist_append(recipe->parameters, p);
-
/* --pix_scale */
- p = cpl_parameter_new_value("kmos.kmo_illumination.pix_scale",
+ p = cpl_parameter_new_value("kmos.kmo_illumination_flat.pix_scale",
CPL_TYPE_DOUBLE,
"Change the pixel scale [arcsec]. "
"Default of 0.2\" results into cubes of 14x14pix, "
"a scale of 0.1\" results into cubes of 28x28pix, "
"etc.",
- "kmos.kmo_illumination",
+ "kmos.kmo_illumination_flat",
KMOS_PIX_RESOLUTION);
cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "pix_scale");
cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
cpl_parameterlist_append(recipe->parameters, p);
/* --suppress_extension */
- p = cpl_parameter_new_value("kmos.kmo_illumination.suppress_extension",
+ p = cpl_parameter_new_value("kmos.kmo_illumination_flat.suppress_extension",
CPL_TYPE_BOOL,
- "Suppress arbitrary filename extension."
+ "Suppress arbitrary filename extension. "
"(TRUE (apply) or FALSE (don't apply)",
- "kmos.kmo_illumination",
+ "kmos.kmo_illumination_flat",
FALSE);
cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "suppress_extension");
cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
@@ -325,11 +289,11 @@ static int kmo_illumination_create(cpl_plugin *plugin)
// add parameters for band-definition
kmo_band_pars_create(recipe->parameters,
- "kmos.kmo_illumination");
+ "kmos.kmo_illumination_flat");
// add parameters for combining
return kmo_combine_pars_create(recipe->parameters,
- "kmos.kmo_illumination",
+ "kmos.kmo_illumination_flat",
DEF_REJ_METHOD,
FALSE);
}
@@ -339,7 +303,7 @@ static int kmo_illumination_create(cpl_plugin *plugin)
@param plugin the plugin
@return 0 if everything is ok
*/
-static int kmo_illumination_exec(cpl_plugin *plugin)
+static int kmo_illumination_flat_exec(cpl_plugin *plugin)
{
cpl_recipe *recipe;
@@ -348,7 +312,7 @@ static int kmo_illumination_exec(cpl_plugin *plugin)
recipe = (cpl_recipe *)plugin;
else return -1;
- return kmo_illumination(recipe->parameters, recipe->frames);
+ return kmo_illumination_flat(recipe->parameters, recipe->frames);
}
/**
@@ -356,7 +320,7 @@ static int kmo_illumination_exec(cpl_plugin *plugin)
@param plugin the plugin
@return 0 if everything is ok
*/
-static int kmo_illumination_destroy(cpl_plugin *plugin)
+static int kmo_illumination_flat_destroy(cpl_plugin *plugin)
{
cpl_recipe *recipe;
@@ -383,14 +347,13 @@ static int kmo_illumination_destroy(cpl_plugin *plugin)
@li CPL_ERROR_INCOMPATIBLE_INPUT if the dimensions of the two operands
do not match
*/
-static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
+static int kmo_illumination_flat(cpl_parameterlist *parlist, cpl_frameset *frameset)
{
int ret_val = 0,
nr_devices = 0,
ifu_nr = 0,
nx = 0,
ny = 0,
- process_noise = FALSE,
cmax = 0,
cmin = 0,
citer = 0,
@@ -400,23 +363,21 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
qc_max_nonunif_id = 0,
flux = FALSE,
background = FALSE,
- add_all_sky = FALSE,
- same_exptime = TRUE,
suppress_extension = FALSE,
- has_flat_edge = FALSE,
- i = 0, j = 0, x = 0, y = 0, ix = 0, iy = 0, det_nr = 0, edgeNr = 0;
+ mhalf = 3, //width of median filter is mhalf*2 + 1
+ boxsize = 0,
+ i = 0, j = 0, ix = 0, iy = 0, det_nr = 0,
+ firstx = 0, lastx = 0, firsty = 0, lasty = 0,
+ xmin = 0, xmax = 0, ymin = 0, ymax = 0;
const int *punused_ifus = NULL;
- float *pbad_pix_mask = NULL;
+ float *pbad_pix_mask = NULL,
+ *pdata = NULL,
+ *pnoise = NULL;
double exptime = 0.,
- exptime1 = 0.,
- exptime2 = 0.,
cpos_rej = 0.0,
cneg_rej = 0.0,
neighborhoodRange = 1.001,
mean_data = 0.0,
- ifu_crpix = 0.0,
- ifu_crval = 0.0,
- ifu_cdelt = 0.0,
qc_spat_unif = 0.0,
qc_max_dev = 0.0,
qc_max_nonunif = 0.0,
@@ -431,12 +392,13 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
*suffix = NULL,
*fn_suffix = NULL,
*extname = NULL,
- *filter = NULL;
+ *filter = NULL,
+ content[256];
const char *method = NULL,
*cmethod = NULL,
*filter_id_l = NULL,
*filter_id = NULL,
- *ranges_txt = NULL;
+ *tmp_str = NULL;
cpl_array *calTimestamp = NULL,
**unused_ifus_before = NULL,
**unused_ifus_after = NULL;
@@ -444,14 +406,10 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
*xcalFrame = NULL,
*ycalFrame = NULL,
*lcalFrame = NULL;
- cpl_frameset *frameset_sky = NULL;
cpl_image *img_in = NULL,
*img_dark = NULL,
- *img_dark_noise = NULL,
*img_flat = NULL,
- *img_flat_noise = NULL,
*combined_data = NULL,
- *combined_noise = NULL,
*xcal = NULL,
*ycal = NULL,
*lcal = NULL,
@@ -459,40 +417,28 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
*data_ifu = NULL,
*noise_ifu = NULL,
**stored_data_images = NULL,
- **stored_noise_images = NULL;
+ **stored_noise_images = NULL,
+ *tmp_img = NULL;
cpl_imagelist *cube_data = NULL,
- *cube_noise = NULL,
*detector_in = NULL,
- **stored_data_cubes = NULL,
- **stored_noise_cubes = NULL;
- cpl_matrix **edgepars = NULL;
+ **stored_data_cubes = NULL;
cpl_propertylist *main_header = NULL,
*tmp_header = NULL,
*sub_header = NULL,
- **stored_sub_data_headers = NULL,
- **stored_sub_noise_headers = NULL;
- cpl_table *band_table = NULL,
- ***edge_table_sky = NULL,
- **edge_table_flat = NULL;
- cpl_vector *ranges = NULL,
- *identified_slices = NULL,
- *calAngles = NULL,
- **slitlet_ids = NULL,
- *shift_vec = NULL,
- *edge_vec = NULL;
+ **stored_sub_headers = NULL;
+ cpl_table *band_table = NULL;
+ cpl_vector *identified_slices = NULL,
+ *calAngles = NULL;
main_fits_desc desc_sky,
- desc_dark,
- desc_flat,
desc_xcal,
desc_ycal,
desc_lcal;
gridDefinition gd;
+ enum kmo_frame_type fr_type;
KMO_TRY
{
kmo_init_fits_desc(&desc_sky);
- kmo_init_fits_desc(&desc_dark);
- kmo_init_fits_desc(&desc_flat);
kmo_init_fits_desc(&desc_xcal);
kmo_init_fits_desc(&desc_ycal);
kmo_init_fits_desc(&desc_lcal);
@@ -503,23 +449,15 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
CPL_ERROR_NULL_INPUT,
"Not all input data is provided!");
- KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, FLAT_SKY) >= 1,
+ KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, FLAT_SKY_FLAT) >= 1,
CPL_ERROR_ILLEGAL_INPUT,
- "One or more FLAT_SKY frames are required!");
+ "One or more FLAT_SKY_FLAT frames are required!");
- if (cpl_frameset_count_tags(frameset, FLAT_SKY) < 3) {
+ if (cpl_frameset_count_tags(frameset, FLAT_SKY_FLAT) < 3) {
cpl_msg_warning(cpl_func, "It is recommended to provide at least "
- "3 FLAT_SKY frames!");
+ "3 FLAT_SKY_FLAT frames!");
}
- KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, MASTER_DARK) == 1,
- CPL_ERROR_ILLEGAL_INPUT,
- "Exactly one MASTER_DARK frame is required!");
-
- KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, MASTER_FLAT) == 1,
- CPL_ERROR_ILLEGAL_INPUT,
- "Exactly one MASTER_FLAT frame is required!");
-
KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, XCAL) == 1,
CPL_ERROR_ILLEGAL_INPUT,
"Exactly one XCAL frame is required!");
@@ -536,23 +474,15 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
CPL_ERROR_ILLEGAL_INPUT,
"Exactly one WAVE_BAND frame is required!");
- KMO_TRY_ASSURE((cpl_frameset_count_tags(frameset, FLAT_EDGE) == 1) ||
- (cpl_frameset_count_tags(frameset, FLAT_EDGE) == 0),
- CPL_ERROR_ILLEGAL_INPUT,
- "Exactly one FLAT_EDGE frame is required!");
-
- has_flat_edge = cpl_frameset_count_tags(frameset, FLAT_EDGE);
-
- KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, "kmo_illumination") == 1,
+ KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, "kmo_illumination_flat") == 1,
CPL_ERROR_ILLEGAL_INPUT,
"Cannot identify RAW and CALIB frames!");
/* --- get parameters --- */
- cpl_msg_info("", "--- Parameter setup for kmo_illumination ---");
+ cpl_msg_info("", "--- Parameter setup for kmo_illumination_flat ---");
KMO_TRY_EXIT_IF_NULL(
- method = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_illumination.imethod"));
+ method = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_illumination_flat.imethod"));
KMO_TRY_ASSURE((strcmp(method, "NN") == 0) ||
(strcmp(method, "lwNN") == 0) ||
@@ -564,106 +494,61 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
"\"swNN\", \"MS\" or \"CS\"!");
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_illumination.imethod"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_illumination_flat.imethod"));
- neighborhoodRange = kmo_dfs_get_parameter_double(parlist,
- "kmos.kmo_illumination.neighborhoodRange");
+ neighborhoodRange = kmo_dfs_get_parameter_double(parlist, "kmos.kmo_illumination_flat.neighborhoodRange");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_ASSURE(neighborhoodRange > 0.0,
- CPL_ERROR_ILLEGAL_INPUT,
- "neighborhoodRange must be greater than 0.0");
-
- KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_illumination.neighborhoodRange"));
-
- ranges_txt = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_illumination.range");
- KMO_TRY_CHECK_ERROR_STATE();
-
- KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist, "kmos.kmo_illumination.range"));
-
- ranges = kmo_identify_ranges(ranges_txt);
- KMO_TRY_CHECK_ERROR_STATE();
-
- flux = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_illumination.flux");
-
- KMO_TRY_ASSURE((flux == 0) ||
- (flux == 1),
CPL_ERROR_ILLEGAL_INPUT,
- "flux must be either FALSE or TRUE!");
+ "neighborhoodRange must be greater than 0.0");
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist, "kmos.kmo_illumination.flux"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_illumination_flat.neighborhoodRange"));
- add_all_sky = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_illumination.add-all");
-
- KMO_TRY_ASSURE((add_all_sky == 0) ||
- (add_all_sky == 1),
+ flux = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_illumination_flat.flux");
+ KMO_TRY_ASSURE((flux == 0) || (flux == 1),
CPL_ERROR_ILLEGAL_INPUT,
- "add_all must be either FALSE or TRUE!");
-
+ "flux must be either FALSE or TRUE!");
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist, "kmos.kmo_illumination.add-all"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_illumination_flat.flux"));
- pix_scale = kmo_dfs_get_parameter_double(parlist,
- "kmos.kmo_illumination.pix_scale");
+ pix_scale = kmo_dfs_get_parameter_double(parlist, "kmos.kmo_illumination_flat.pix_scale");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_illumination.pix_scale"));
- KMO_TRY_ASSURE((pix_scale >= 0.01) &&
- (pix_scale <= 0.4),
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_illumination_flat.pix_scale"));
+ KMO_TRY_ASSURE((pix_scale >= 0.01) && (pix_scale <= 0.4),
CPL_ERROR_ILLEGAL_INPUT,
"pix_scale must be between 0.01 and 0.4 (results in cubes "
"with 7x7 to 280x280 pixels)!");
- suppress_extension = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_illumination.suppress_extension");
+ suppress_extension = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_illumination_flat.suppress_extension");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist, "kmos.kmo_illumination.suppress_extension"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_illumination_flat.suppress_extension"));
KMO_TRY_ASSURE((suppress_extension == TRUE) || (suppress_extension == FALSE),
CPL_ERROR_ILLEGAL_INPUT,
"suppress_extension must be TRUE or FALSE!");
- kmo_band_pars_load(parlist, "kmos.kmo_illumination");
+ kmo_band_pars_load(parlist, "kmos.kmo_illumination_flat");
KMO_TRY_EXIT_IF_ERROR(
- kmo_combine_pars_load(parlist,
- "kmos.kmo_illumination",
- &cmethod,
- &cpos_rej,
- &cneg_rej,
- &citer,
- &cmin,
- &cmax,
- FALSE));
+ kmo_combine_pars_load(parlist, "kmos.kmo_illumination_flat",
+ &cmethod, &cpos_rej, &cneg_rej,
+ &citer, &cmin, &cmax, FALSE));
cpl_msg_info("", "-------------------------------------------");
// check if filter_id, grating_id and rotator offset match for all
// detectors
KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frameset_setup(frameset, FLAT_SKY,
- TRUE, FALSE, TRUE));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frame_setup(frameset, FLAT_SKY, XCAL,
- TRUE, FALSE, TRUE));
+ kmo_check_frameset_setup(frameset, FLAT_SKY_FLAT, TRUE, FALSE, TRUE));
KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frame_setup(frameset, XCAL, YCAL,
- TRUE, FALSE, TRUE));
+ kmo_check_frame_setup(frameset, FLAT_SKY_FLAT, XCAL, TRUE, FALSE, TRUE));
KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frame_setup(frameset, XCAL, LCAL,
- TRUE, FALSE, TRUE));
+ kmo_check_frame_setup(frameset, XCAL, YCAL, TRUE, FALSE, TRUE));
KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frame_setup(frameset, XCAL, MASTER_FLAT,
- TRUE, FALSE, TRUE));
+ kmo_check_frame_setup(frameset, XCAL, LCAL, TRUE, FALSE, TRUE));
KMO_TRY_EXIT_IF_NULL(
frame = kmo_dfs_get_frame(frameset, XCAL));
@@ -687,35 +572,6 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
kmo_print_unused_ifus(unused_ifus_before, FALSE);
- // load desc for MASTER_DARK and check
- KMO_TRY_EXIT_IF_NULL(
- frame = kmo_dfs_get_frame(frameset, MASTER_DARK));
- desc_dark = kmo_identify_fits_header(
- cpl_frame_get_filename(frame));
- KMO_TRY_CHECK_ERROR_STATE_MSG("MASTER_DARK frame doesn't seem to "
- "be in KMOS-format!");
- KMO_TRY_ASSURE((desc_dark.nr_ext == 2*KMOS_NR_DETECTORS) &&
- (desc_dark.ex_badpix == FALSE) &&
- (desc_dark.fits_type == f2d_fits) &&
- (desc_dark.frame_type == detector_frame),
- CPL_ERROR_ILLEGAL_INPUT,
- "MASTER_DARK isn't in the correct format!!!");
- nx = desc_dark.naxis1;
- ny = desc_dark.naxis2;
-
- // load desc for MASTER_FLAT and check
- KMO_TRY_EXIT_IF_NULL(
- frame = kmo_dfs_get_frame(frameset, MASTER_FLAT));
- desc_flat = kmo_identify_fits_header(cpl_frame_get_filename(frame));
- KMO_TRY_CHECK_ERROR_STATE_MSG("MASTER_FLAT frame doesn't seem to "
- "be in KMOS-format!");
- KMO_TRY_ASSURE((desc_flat.nr_ext % (2*KMOS_NR_DETECTORS) == 0) &&
- (desc_flat.ex_badpix == FALSE) &&
- (desc_flat.fits_type == f2d_fits) &&
- (desc_flat.frame_type == detector_frame),
- CPL_ERROR_ILLEGAL_INPUT,
- "MASTER_FLAT isn't in the correct format!!!");
-
// load desc for XCAL and check
KMO_TRY_EXIT_IF_NULL(
xcalFrame = kmo_dfs_get_frame(frameset, XCAL));
@@ -728,13 +584,8 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
(desc_xcal.frame_type == detector_frame),
CPL_ERROR_ILLEGAL_INPUT,
"XCAL isn't in the correct format!!!");
- KMO_TRY_ASSURE((desc_xcal.naxis1 == nx) &&
- (desc_xcal.naxis2 == ny),
- CPL_ERROR_ILLEGAL_INPUT,
- "MASTER_DARK and XCAL frame haven't same dimensions! "
- "(x,y): (%d,%d) vs (%d,%d)",
- nx, ny, desc_xcal.naxis1, desc_xcal.naxis2);
-
+ nx = desc_xcal.naxis1;
+ ny = desc_xcal.naxis2;
nr_devices = desc_xcal.nr_ext;
// load desc for YCAL and check
@@ -752,7 +603,7 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_ASSURE((desc_ycal.naxis1 == desc_xcal.naxis1) &&
(desc_ycal.naxis2 == desc_xcal.naxis2),
CPL_ERROR_ILLEGAL_INPUT,
- "MASTER_DARK and YCAL frame haven't same dimensions! "
+ "XCAL and YCAL frame haven't same dimensions! "
"(x,y): (%d,%d) vs (%d,%d)",
nx, ny, desc_ycal.naxis1, desc_ycal.naxis2);
@@ -770,16 +621,16 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_ASSURE((desc_lcal.naxis1 == desc_xcal.naxis1) &&
(desc_lcal.naxis2 == desc_xcal.naxis2),
CPL_ERROR_ILLEGAL_INPUT,
- "MASTER_DARK and LCAL frame haven't same dimensions! "
+ "XCAL and LCAL frame haven't same dimensions! "
"(x,y): (%d,%d) vs (%d,%d)",
nx, ny, desc_lcal.naxis1, desc_lcal.naxis2);
KMO_TRY_EXIT_IF_NULL(
tmp_header = kmo_dfs_load_primary_header(frameset, LCAL));
- // load desc for FLAT_SKY and check
+ // load desc for FLAT_SKY_FLAT and check
nr_devices = KMOS_NR_DETECTORS;
KMO_TRY_EXIT_IF_NULL(
- frame = kmo_dfs_get_frame(frameset, FLAT_SKY));
+ frame = kmo_dfs_get_frame(frameset, FLAT_SKY_FLAT));
KMO_TRY_EXIT_IF_NULL(
main_header = kmclipm_propertylist_load(
@@ -787,6 +638,9 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
rotangle = cpl_propertylist_get_double(main_header, ROTANGLE);
KMO_TRY_CHECK_ERROR_STATE_MSG("Cannot retrieve ROTANGLE FITS keyword from sky frame!");
kmclipm_strip_angle(&rotangle);
+ exptime = cpl_propertylist_get_double(main_header, EXPTIME);
+ KMO_TRY_CHECK_ERROR_STATE("EXPTIME keyword in main header "
+ "missing!");
cpl_propertylist_delete(main_header); main_header = NULL;
cnt = 1;
@@ -797,31 +651,27 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
desc_sky = kmo_identify_fits_header(
cpl_frame_get_filename(frame));
- KMO_TRY_CHECK_ERROR_STATE_MSG("FLAT_SKY frame doesn't seem to "
+ KMO_TRY_CHECK_ERROR_STATE_MSG("FLAT_SKY_FLAT frame doesn't seem to "
"be in KMOS-format!");
KMO_TRY_ASSURE((desc_sky.nr_ext == 3) &&
(desc_sky.ex_badpix == FALSE) &&
(desc_sky.fits_type == raw_fits) &&
(desc_sky.frame_type == detector_frame),
CPL_ERROR_ILLEGAL_INPUT,
- "FLAT_SKY isn't in the correct format!!!");
- KMO_TRY_ASSURE((desc_sky.naxis1 == nx) &&
- (desc_sky.naxis2 == ny) &&
- (desc_sky.nr_ext == nr_devices),
- CPL_ERROR_ILLEGAL_INPUT,
- "MASTER_DARK and FLAT_SKY (no. %d) frame haven't "
- "same dimensions! (x,y): (%d,%d) vs (%d,%d)",
- cnt, nx, ny, desc_flat.naxis1, desc_flat.naxis2);
+ "FLAT_SKY_FLAT isn't in the correct format!!!");
kmo_free_fits_desc(&desc_sky);
kmo_init_fits_desc(&desc_sky);
KMO_TRY_ASSURE(
(kmo_check_lamp(main_header, INS_LAMP1_ST) == FALSE) &&
- (kmo_check_lamp(main_header, INS_LAMP2_ST) == FALSE) &&
- (kmo_check_lamp(main_header, INS_LAMP3_ST) == FALSE) &&
- (kmo_check_lamp(main_header, INS_LAMP4_ST) == FALSE),
+ (kmo_check_lamp(main_header, INS_LAMP2_ST) == FALSE),
CPL_ERROR_ILLEGAL_INPUT,
- "All lamps must be switched off for the FLAT_SKY frames!");
+ "Arc lamps must be switched off!");
+
+ KMO_TRY_ASSURE(cpl_propertylist_get_double(main_header, EXPTIME) == exptime,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "EXPTIME isn't the same for all frames: (is %g and %g).",
+ cpl_propertylist_get_double(main_header, EXPTIME), exptime);
// assert that filters have correct IDs and that all detectors of
// all input frames have the same filter set
@@ -847,7 +697,7 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_ASSURE(strcmp(filter_id, filter_id_l) == 0,
CPL_ERROR_ILLEGAL_INPUT,
- "Filter IDs must be the same for FLAT_SKY frame"
+ "Filter IDs must be the same for FLAT_SKY_FLAT frame"
" and lcal frame!"
"Detector No.: %d\n%s: %s\nLCAL: %s\n",
i, cpl_frame_get_filename(frame),
@@ -874,7 +724,7 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_ASSURE(strcmp(filter_id, filter_id_l) == 0,
CPL_ERROR_ILLEGAL_INPUT,
- "Grating IDs must be the same for FLAT_SKY frame"
+ "Grating IDs must be the same for FLAT_SKY_FLAT frame"
" and lcal frame!"
"Detector No.: %d\n%s: %s\nLCAL: %s\n",
i, cpl_frame_get_filename(frame),
@@ -886,12 +736,12 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_ASSURE((abs(rotangle - tmp_rotangle) < 10.0) ||
(abs(rotangle - tmp_rotangle) > 360.-10.) ,
CPL_ERROR_ILLEGAL_INPUT,
- "OCS ROT NAANGLE of sky flat frames differ to much: %f %f",
+ "OCS ROT NAANGLE of sky flat frames differ too much: %f %f",
rotangle, tmp_rotangle);
}
cpl_propertylist_delete(main_header); main_header = NULL;
- // get next FLAT_SKY frame
+ // get next FLAT_SKY_FLAT frame
frame = kmo_dfs_get_frame(frameset, NULL);
KMO_TRY_CHECK_ERROR_STATE();
cnt++;
@@ -899,19 +749,7 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_propertylist_delete(tmp_header); tmp_header = NULL;
- //
- // noise will be propagated when:
- // MASTER_DARK and MASTER_FLAT have noise extensions and if at least
- // 2 FLAT_SKY frames are provided.
- // Otherwise noise will be ignored.
- //
- if (desc_dark.ex_noise &&
- desc_flat.ex_noise &&
- (cpl_frameset_count_tags(frameset, FLAT_SKY) >= 2)) {
- process_noise = TRUE;
- }
-
- if (cpl_frameset_count_tags(frameset, FLAT_SKY) == 1) {
+ if (cpl_frameset_count_tags(frameset, FLAT_SKY_FLAT) == 1) {
cpl_msg_warning(cpl_func, "cmethod is changed to 'average' "
"since there is only one input frame! (The output "
"file won't have any noise extensions)");
@@ -919,145 +757,20 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
cmethod = "average";
}
- //
- // Check whether 1st FLAT_SKY should be omitted
- //
- KMO_TRY_EXIT_IF_NULL(
- frameset_sky = cpl_frameset_new());
-
- if (add_all_sky) {
- // just add all FLAT_SKY frames without check
- frame = kmo_dfs_get_frame(frameset, FLAT_SKY);
- while (frame != NULL) {
- KMO_TRY_EXIT_IF_ERROR(
- cpl_frameset_insert(frameset_sky, cpl_frame_duplicate(frame)));
- frame = kmo_dfs_get_frame(frameset, NULL);
- }
- cpl_msg_info("", "Add all FLAT_SKY without checking for acquisition frame.");
- } else {
- // check if 1st FLAT_SKY has different exposure time and whether to omit it
- KMO_TRY_EXIT_IF_NULL(
- frame = kmo_dfs_get_frame(frameset, FLAT_SKY));
-
- if (cpl_frameset_count_tags(frameset, FLAT_SKY) == 1) {
- // just one FLAT_SKY, always add
- KMO_TRY_EXIT_IF_ERROR(
- cpl_frameset_insert(frameset_sky, cpl_frame_duplicate(frame)));
- KMO_TRY_CHECK_ERROR_STATE();
- } else {
- // several FLAT_SKY frames, check exptime
-
- // get exptime 1
- KMO_TRY_EXIT_IF_NULL(
- main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
- exptime1 = cpl_propertylist_get_double(main_header, EXPTIME);
- KMO_TRY_CHECK_ERROR_STATE();
- cpl_propertylist_delete(main_header); main_header = NULL;
-
- // get exptime 2
- frame = kmo_dfs_get_frame(frameset, NULL);
- KMO_TRY_EXIT_IF_NULL(
- main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
- exptime2 = cpl_propertylist_get_double(main_header, EXPTIME);
- KMO_TRY_CHECK_ERROR_STATE();
- cpl_propertylist_delete(main_header); main_header = NULL;
-
- // loop remaining frames
- same_exptime = TRUE;
- frame = kmo_dfs_get_frame(frameset, NULL);
- while (same_exptime && (frame != NULL)) {
- KMO_TRY_EXIT_IF_NULL(
- main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
- exptime = cpl_propertylist_get_double(main_header, EXPTIME);
- KMO_TRY_CHECK_ERROR_STATE();
- cpl_propertylist_delete(main_header); main_header = NULL;
- if (fabs(exptime-exptime2) > 0.01) {
- // not same
- same_exptime = FALSE;
- }
- frame = kmo_dfs_get_frame(frameset, NULL);
- }
-
- if (same_exptime) {
- // frame [2,n] have same exptime, add them
- frame = kmo_dfs_get_frame(frameset, FLAT_SKY);
- KMO_TRY_EXIT_IF_NULL(
- main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
- exptime = cpl_propertylist_get_double(main_header, EXPTIME);
- KMO_TRY_CHECK_ERROR_STATE();
- cpl_propertylist_delete(main_header); main_header = NULL;
- cpl_msg_info("", "Omit FLAT_SKY: %s with EXPTIME of %g sec (acquisition), other frame(s) have EXPTIME of %g sec", cpl_frame_get_filename(frame), exptime, exptime2);
- frame = kmo_dfs_get_frame(frameset, NULL);
- while (frame != NULL) {
- KMO_TRY_EXIT_IF_ERROR(
- cpl_frameset_insert(frameset_sky, cpl_frame_duplicate(frame)));
- frame = kmo_dfs_get_frame(frameset, NULL);
- }
- if (fabs(exptime1-exptime2) < 0.01) {
- cpl_msg_warning("", "The 1st FLAT_SKY has the same exposure time as the following ones. "
- "It has anyway been omitted since we assume it is an acquisition frame. "
- "If you want to add it anyway call this recipe with the --add-all parameter");
- }
- } else {
- cpl_msg_error("", "The exposure times of the FLAT_SKY frames don't match!");
- cpl_msg_error("", "We assume that the 1st frame is an acquisition frame and would be omitted.");
- cpl_msg_error("", "The following frames should have the same exposure time if they originate from the same template.");
- cpl_msg_error("", "If you want to reduce them anyway call this recipe with the --add-all parameter");
- frame = kmo_dfs_get_frame(frameset, FLAT_SKY);
- while (frame != NULL) {
- KMO_TRY_EXIT_IF_NULL(
- main_header = kmclipm_propertylist_load(cpl_frame_get_filename(frame), 0));
- exptime = cpl_propertylist_get_double(main_header, EXPTIME);
- KMO_TRY_CHECK_ERROR_STATE();
- cpl_propertylist_delete(main_header); main_header = NULL;
- cpl_msg_error("", "FLAT_SKY: %s, EXPTIME: %g", cpl_frame_get_filename(frame), exptime);
- frame = kmo_dfs_get_frame(frameset, NULL);
- }
- cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT);
- KMO_TRY_CHECK_ERROR_STATE();
- }
- }
- }
-
KMO_TRY_EXIT_IF_NULL(
- frame = kmo_dfs_get_frame(frameset_sky, FLAT_SKY));
+ frame = kmo_dfs_get_frame(frameset, FLAT_SKY_FLAT));
KMO_TRY_EXIT_IF_NULL(
- main_header = kmo_dfs_load_primary_header(frameset_sky, FLAT_SKY));
+ main_header = kmo_dfs_load_primary_header(frameset, FLAT_SKY_FLAT));
KMO_TRY_EXIT_IF_NULL(
keyword = cpl_sprintf("%s%d%s", IFU_GRATID_PREFIX, 1, IFU_GRATID_POSTFIX));
KMO_TRY_EXIT_IF_NULL(
filter = cpl_sprintf("%s", cpl_propertylist_get_string(main_header, keyword)));
cpl_free(keyword); keyword = NULL;
- //
- // set default band-specific ranges for collapsing
- //
- if (ranges == NULL) {
- if (strcmp(filter, "IZ") == 0) {
- ranges_txt = "0.81,1.05";
- } else if (strcmp(filter, "YJ") == 0) {
- ranges_txt = "1.025,1.3";
- } else if (strcmp(filter, "H") == 0) {
- ranges_txt = "1.5,1.7";
- } else if (strcmp(filter, "K") == 0) {
- ranges_txt = "2.1,2.35";
- } else if (strcmp(filter, "HK") == 0) {
- ranges_txt = "1.5,1.7;2.1,2.35";
-// ranges_txt = "1.5,1.7";
- } else {
- KMO_TRY_ASSURE(1 == 0,
- CPL_ERROR_ILLEGAL_INPUT,
- "We really shouldn't get here...");
- }
- cpl_msg_info("", "Spectral range to collapse has been set to %s um for this band.", ranges_txt);
- ranges = kmo_identify_ranges(ranges_txt);
- KMO_TRY_CHECK_ERROR_STATE();
- }
-
// setup grid definition, wavelength start and end points will be set
// in the detector loop
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_setup_grid(&gd, method, neighborhoodRange, pix_scale));
+ kmclipm_setup_grid(&gd, method, neighborhoodRange, pix_scale, 0.));
// create filename for LUT
KMO_TRY_EXIT_IF_NULL(
@@ -1080,26 +793,14 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
stored_data_cubes = (cpl_imagelist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
sizeof(cpl_imagelist*)));
KMO_TRY_EXIT_IF_NULL(
- stored_noise_cubes = (cpl_imagelist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
- sizeof(cpl_imagelist*)));
- KMO_TRY_EXIT_IF_NULL(
stored_data_images = (cpl_image**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
sizeof(cpl_image*)));
KMO_TRY_EXIT_IF_NULL(
stored_noise_images = (cpl_image**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
sizeof(cpl_image*)));
KMO_TRY_EXIT_IF_NULL(
- stored_sub_data_headers = (cpl_propertylist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
- sizeof(cpl_propertylist*)));
- KMO_TRY_EXIT_IF_NULL(
- stored_sub_noise_headers = (cpl_propertylist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
- sizeof(cpl_propertylist*)));
- KMO_TRY_EXIT_IF_NULL(
- edge_table_sky = (cpl_table***)cpl_calloc(KMOS_NR_DETECTORS,
- sizeof(cpl_table**)));
- KMO_TRY_EXIT_IF_NULL(
- edge_table_flat = (cpl_table**)cpl_calloc(KMOS_IFUS_PER_DETECTOR,
- sizeof(cpl_table*)));
+ stored_sub_headers = (cpl_propertylist**)cpl_calloc(nr_devices * KMOS_IFUS_PER_DETECTOR,
+ sizeof(cpl_propertylist*)));
KMO_TRY_EXIT_IF_NULL(
calAngles = cpl_vector_new(3));
@@ -1112,17 +813,17 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_EXIT_IF_NULL(
detector_in = cpl_imagelist_new());
- // load data of det_nr of all FLAT_SKY frames into an imagelist
+ // load data of det_nr of all FLAT_SKY_FLAT frames into an imagelist
KMO_TRY_EXIT_IF_NULL(
- img_in = kmo_dfs_load_image(frameset_sky, FLAT_SKY, det_nr, FALSE, TRUE, NULL));
+ img_in = kmo_dfs_load_image(frameset, FLAT_SKY_FLAT, det_nr, FALSE, TRUE, NULL));
cnt = 0;
while (img_in != NULL) {
cpl_imagelist_set(detector_in, img_in, cnt);
KMO_TRY_CHECK_ERROR_STATE();
- /* load same extension of next FLAT_SKY frame*/
- img_in = kmo_dfs_load_image(frameset_sky, NULL, det_nr, FALSE, TRUE, NULL);
+ /* load same extension of next FLAT_SKY_FLAT frame*/
+ img_in = kmo_dfs_load_image(frameset, NULL, det_nr, FALSE, TRUE, NULL);
KMO_TRY_CHECK_ERROR_STATE();
cnt++;
@@ -1134,34 +835,33 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
// combine imagelist (data only) and create noise (stdev of data)
cpl_msg_info("","Combining frames...");
- if (process_noise) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_combine_frames(detector_in,
+ NULL,
+ NULL,
+ cmethod,
+ cpos_rej,
+ cneg_rej,
+ citer,
+ cmax,
+ cmin,
+ &combined_data,
+ NULL,
+ -1.0));
+
+ if (img_dark == NULL) {
+ KMO_TRY_EXIT_IF_NULL(
+ img_dark = cpl_image_duplicate(combined_data));
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_combine_frames(detector_in,
- NULL,
- NULL,
- cmethod,
- cpos_rej,
- cneg_rej,
- citer,
- cmax,
- cmin,
- &combined_data,
- &combined_noise,
- -1.0));
- } else {
+ cpl_image_multiply_scalar(img_dark, 0));
+ }
+
+ if (img_flat == NULL) {
+ KMO_TRY_EXIT_IF_NULL(
+ img_flat = cpl_image_duplicate(combined_data));
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_combine_frames(detector_in,
- NULL,
- NULL,
- cmethod,
- cpos_rej,
- cneg_rej,
- citer,
- cmax,
- cmin,
- &combined_data,
- NULL,
- -1.0));
+ cpl_image_multiply_scalar(img_flat, 0));
+ cpl_image_add_scalar(img_flat, 1);
}
if (kmclipm_omit_warning_one_slice > 10) {
@@ -1198,197 +898,21 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_EXIT_IF_NULL(
pbad_pix_mask = cpl_image_get_data_float(bad_pix_mask));
- for (x = 0; x < nx; x++) {
- for (y = 0; y < ny; y++) {
- if (isnan(pbad_pix_mask[x+nx*y])) {
- pbad_pix_mask[x+nx*y] = 0.;
+ for (ix = 0; ix < nx; ix++) {
+ for (iy = 0; iy < ny; iy++) {
+ if (isnan(pbad_pix_mask[ix+nx*iy])) {
+ pbad_pix_mask[ix+nx*iy] = 0.;
} else {
- pbad_pix_mask[x+nx*y] = 1.;
+ pbad_pix_mask[ix+nx*iy] = 1.;
}
}
}
KMO_TRY_CHECK_ERROR_STATE();
//
- // calculate SKYFLAT_EDGE
- //
- if (has_flat_edge) {
- // get edge-edgepars from FLAT_SKY
- KMO_TRY_EXIT_IF_ERROR(
- kmo_calc_edgepars(combined_data,
- unused_ifus_after[det_nr-1],
- bad_pix_mask,
- det_nr,
- &slitlet_ids,
- &edgepars));
- KMO_TRY_CHECK_ERROR_STATE();
-
- // copy edgepars to table for saving later on
- KMO_TRY_EXIT_IF_NULL(
- edge_table_sky[det_nr-1] = kmo_edgepars_to_table(slitlet_ids, edgepars));
-
- if (edgepars != NULL) {
- for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
- cpl_matrix_delete(edgepars[i]); edgepars[i] = NULL;
- }
- cpl_free(edgepars); edgepars = NULL;
- }
- if (slitlet_ids != NULL) {
- for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
- cpl_vector_delete(slitlet_ids[i]); slitlet_ids[i] = NULL;
- }
- cpl_free(slitlet_ids); slitlet_ids = NULL;
- }
- KMO_TRY_CHECK_ERROR_STATE();
-
- //
- // correlate FLAT_EDGE and SKYFLAT_EDGE
- //
-
- // load flat_edge from MASTER_FLAT
- KMO_TRY_EXIT_IF_NULL(
- frame = kmo_dfs_get_frame(frameset, FLAT_EDGE));
- for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
- ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
-
- KMO_TRY_EXIT_IF_NULL(
- punused_ifus = cpl_array_get_data_int_const(unused_ifus_after[det_nr-1]));
- if (punused_ifus[j] == 0) {
- KMO_TRY_EXIT_IF_NULL(
- edge_table_flat[j] = kmclipm_cal_table_load(cpl_frame_get_filename(frame),
- ifu_nr, rotangle, 0, &tmp_rotangle));
- }
- }
-
- //
- // calculate shift value
- //
-
- KMO_TRY_EXIT_IF_NULL(
- shift_vec = cpl_vector_new(KMOS_IFUS_PER_DETECTOR));
- KMO_TRY_EXIT_IF_NULL(
- edge_vec = cpl_vector_new(2*KMOS_SLITLET_X));
-
- // get shift values for each IFU by comparing all edge parameters,
- // rejecting and applying median
- int row = 1024; // middle of frame
- for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
- ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
- for (edgeNr = 0; edgeNr < 2*KMOS_SLITLET_X; edgeNr++) {
- if (edge_table_flat[j] != NULL) {
- double flatval = kmo_calc_fitted_slitlet_edge(edge_table_flat[j], edgeNr, row);
- double skyval = kmo_calc_fitted_slitlet_edge(edge_table_sky[det_nr-1][j], edgeNr, row);
- cpl_vector_set(edge_vec, edgeNr, flatval-skyval);
- }
- }
-
- // reject deviating edge-differences
- kmclipm_vector *kv = NULL;
- KMO_TRY_EXIT_IF_NULL(
- kv = kmclipm_vector_create(cpl_vector_duplicate(edge_vec)));
- kmclipm_reject_deviant(kv, 3, 3, NULL, NULL);
-
- // set shift value for each IFU
- cpl_vector_set(shift_vec, j, kmclipm_vector_get_median(kv, KMCLIPM_ARITHMETIC));
- kmclipm_vector_delete(kv); kv = NULL;
- }
- cpl_vector_delete(edge_vec); edge_vec = NULL;
- KMO_TRY_CHECK_ERROR_STATE();
-
- for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
- cpl_table_delete(edge_table_flat[j]);
- edge_table_flat[j] = NULL;
- }
-
- // take median of all IFU-shift-values
- double shift_val = -cpl_vector_get_median(shift_vec);
- cpl_vector_delete(shift_vec); shift_vec = NULL;
-
- cpl_msg_info("", "Shift detector %d by %g pixels.", det_nr, shift_val);
-
- int xdim = cpl_image_get_size_x(combined_data),
- ydim = cpl_image_get_size_y(combined_data);
- double *array_in = cpl_calloc(xdim, sizeof(double)),
- *array_out = NULL;
- float *pcombined_data = cpl_image_get_data_float(combined_data),
- *pcombined_noise = NULL;
- // float *tmpArray = cpl_calloc(xdim, sizeof(float));
- if (process_noise) {
- pcombined_noise = cpl_image_get_data_float(combined_noise);
- }
-
- for (iy = 0; iy < ydim; iy++) {
- // cubic spline
- for (ix = 0; ix < xdim; ix++) {
- array_in[ix] = pcombined_data[ix+iy*xdim];
- }
- array_out = cubicspline_reg_reg(xdim, 0., 1., array_in,
- xdim, shift_val, 1.0,
- NATURAL);
- for (ix = 0; ix < xdim; ix++) {
- pcombined_data[ix+iy*xdim] = array_out[ix];
- }
- cpl_free(array_out);
-
- // // linear
- // for (ix = 1; ix < xdim; ix++) {
- // tmpArray[ix-1] = (pcombined_data[ix+iy*xdim]-pcombined_data[(ix-1)+iy*xdim])*shift_val +
- // pcombined_data[(ix-1)+iy*xdim];
- // }
- // for (ix = 1; ix < xdim; ix++) {
- // pcombined_data[ix+iy*xdim] = tmpArray[ix];
- // }
-
- if (process_noise) {
- // cubic spline
- for (ix = 0; ix < xdim; ix++) {
- array_in[ix] = pcombined_noise[ix+iy*xdim];
- }
- array_out = cubicspline_reg_reg(xdim, 0., 1., array_in,
- xdim, shift_val, 1.0,
- NATURAL);
- for (ix = 0; ix < xdim; ix++) {
- pcombined_noise[ix+iy*xdim] = array_out[ix];
- }
- cpl_free(array_out);
-
- // // linear
- // for (ix = 1; ix < xdim; ix++) {
- // tmpArray[ix-1] = (pcombined_noise[ix+iy*xdim]-pcombined_noise[(ix-1)+iy*xdim])*shift_val +
- // pcombined_noise[(ix-1)+iy*xdim];
- // }
- // for (ix = 1; ix < xdim; ix++) {
- // pcombined_noise[ix+iy*xdim] = tmpArray[ix];
- // }
- }
- }
- cpl_free(array_in); array_in = NULL;
- }
- //
// reconstruct
//
- // load MASTER_DARK and MASTER_FLAT
- KMO_TRY_EXIT_IF_NULL(
- img_dark = kmo_dfs_load_image(frameset, MASTER_DARK,
- det_nr, FALSE, FALSE, NULL));
-
- if (process_noise) {
- KMO_TRY_EXIT_IF_NULL(
- img_dark_noise = kmo_dfs_load_image(frameset, MASTER_DARK,
- det_nr, TRUE, FALSE, NULL));
- }
-
- KMO_TRY_EXIT_IF_NULL(
- img_flat = kmo_dfs_load_cal_image(frameset, MASTER_FLAT, det_nr, FALSE,
- rotangle, FALSE, NULL,
- &rotangle_found, -1, 0, 0));
-
- if (process_noise) {
- KMO_TRY_EXIT_IF_NULL(
- img_flat_noise = kmo_dfs_load_cal_image(frameset, MASTER_FLAT, det_nr, TRUE,
- rotangle, FALSE, NULL,
- &rotangle_found, -1, 0, 0));
- }
+ print_warning_once_reconstruct = FALSE;
char *tmp_band_method = getenv("KMO_BAND_METHOD");
int band_method = 0;
@@ -1412,13 +936,13 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_table_delete(band_table); band_table = NULL;
cpl_msg_info("","Reconstructing cubes...");
- for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
// update sub-header
- ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
+ ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + i + 1;
// load raw image and sub-header
KMO_TRY_EXIT_IF_NULL(
- sub_header = kmo_dfs_load_sub_header(frameset_sky, FLAT_SKY,
+ sub_header = kmo_dfs_load_sub_header(frameset, FLAT_SKY_FLAT,
det_nr, FALSE));
KMO_TRY_EXIT_IF_NULL(
@@ -1431,13 +955,15 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
keyword = cpl_sprintf("%s%d%s", IFU_VALID_PREFIX, ifu_nr,
IFU_VALID_POSTFIX));
KMO_TRY_CHECK_ERROR_STATE();
- ranges_txt = cpl_propertylist_get_string(main_header, keyword);
+
+ // just to see if keyword exists
+ cpl_propertylist_get_string(main_header, keyword);
cpl_free(keyword); keyword = NULL;
if ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) &&
(bounds[2*(ifu_nr-1)] != -1) &&
(bounds[2*(ifu_nr-1)+1] != -1) &&
- (punused_ifus[j] == 0))
+ (punused_ifus[i] == 0))
{
// IFU is valid
cpl_error_reset();
@@ -1452,11 +978,11 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
bounds[2*(ifu_nr-1)],
bounds[2*(ifu_nr-1)+1],
combined_data,
- combined_noise,
+ NULL,
img_dark,
- img_dark_noise,
+ NULL,
img_flat,
- img_flat_noise,
+ NULL,
xcal,
ycal,
lcal,
@@ -1465,9 +991,12 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
calAngles,
fn_lut,
&cube_data,
- &cube_noise,
+ NULL,
flux,
- background));
+ background,
+ NULL,
+ NULL,
+ NULL));
KMO_TRY_CHECK_ERROR_STATE();
} else {
// IFU is invalid
@@ -1487,157 +1016,181 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
// store cube and sub header into array for later
stored_data_cubes[ifu_nr - 1] = cube_data;
- stored_sub_data_headers[ifu_nr - 1] = sub_header;
+ stored_sub_headers[ifu_nr - 1] = sub_header;
- if (process_noise) {
- KMO_TRY_EXIT_IF_NULL(
- sub_header = cpl_propertylist_duplicate(
- stored_sub_data_headers[ifu_nr - 1]));
- KMO_TRY_EXIT_IF_NULL(
- extname = kmo_extname_creator(ifu_frame, ifu_nr,
- EXT_NOISE));
-
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_string(sub_header,
- EXTNAME,
- extname,
- "FITS extension name"));
-
- cpl_free(extname); extname = NULL;
-
- stored_noise_cubes[ifu_nr - 1] = cube_noise;
- stored_sub_noise_headers[ifu_nr - 1] = sub_header;
- }
cpl_image_delete(data_ifu); data_ifu = NULL;
cpl_image_delete(noise_ifu); noise_ifu = NULL;
cube_data = NULL;
- cube_noise = NULL;
- } // for j IFUs
+ } // for i IFUs
// free memory
cpl_image_delete(combined_data); combined_data = NULL;
- cpl_image_delete(combined_noise); combined_noise = NULL;
cpl_image_delete(xcal); xcal = NULL;
cpl_image_delete(ycal); ycal = NULL;
cpl_image_delete(lcal); lcal = NULL;
- cpl_image_delete(img_dark); img_dark = NULL;
- cpl_image_delete(img_flat); img_flat = NULL;
cpl_image_delete(bad_pix_mask); bad_pix_mask = NULL;
- if (process_noise) {
- cpl_image_delete(img_dark_noise); img_dark_noise = NULL;
- cpl_image_delete(img_flat_noise); img_flat_noise = NULL;
- }
} // for nr_devices
- cpl_free(edge_table_flat); edge_table_flat = NULL;
+ cpl_image_delete(img_dark); img_dark = NULL;
+ cpl_image_delete(img_flat); img_flat = NULL;
- // collapse cubes using rejection
- cpl_msg_info("","Collapsing cubes...");
- for (det_nr = 1; det_nr <= nr_devices; det_nr++) {
- for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
- ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
+ //
+ // collapse cubes using rejection and apply median filtering
+ //
+ KMO_TRY_EXIT_IF_NULL(
+ identified_slices = cpl_vector_new(gd.l.dim));
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_fill(identified_slices, 1));
+ cpl_msg_info("","Collapsing cubes...");
+ for (j = 0; j < nr_devices; j++) {
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ ifu_nr = j*KMOS_IFUS_PER_DETECTOR + i;
KMO_TRY_EXIT_IF_NULL(
punused_ifus = cpl_array_get_data_int_const(
- unused_ifus_after[det_nr-1]));
- if (punused_ifus[j] == 0) {
- if (stored_sub_data_headers[ifu_nr-1] != NULL) {
- // IFU is valid
- ifu_crpix = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
- CRPIX3);
- KMO_TRY_CHECK_ERROR_STATE_MSG(
- "CRPIX3 keyword in FITS-header is missing!");
+ unused_ifus_after[j]));
+ if (punused_ifus[i] == 0) {
+ if (stored_data_cubes[ifu_nr] != NULL) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_make_image(stored_data_cubes[ifu_nr],
+ NULL,
+ &stored_data_images[ifu_nr],
+ &stored_noise_images[ifu_nr],
+ identified_slices,
+ cmethod, cpos_rej, cneg_rej,
+ citer, cmax, cmin));
+ }
- ifu_crval = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
- CRVAL3);
- KMO_TRY_CHECK_ERROR_STATE_MSG(
- "CRVAL3 keyword in FITS-header is missing!");
+ //
+ // apply median smoothing
+ //
- ifu_cdelt = cpl_propertylist_get_double(stored_sub_data_headers[ifu_nr-1],
- CDELT3);
- KMO_TRY_CHECK_ERROR_STATE_MSG(
- "CDELT3 keyword in FITS-header is missing!");
+ // taking care of edges (IFUs 1-16 top/bottom, IFUs 17-24 left/right)
+ if (ifu_nr+1 <= 2*KMOS_IFUS_PER_DETECTOR) {
+ firstx = 0;
+ lastx = 13;
+ firsty = 1;
+ lasty = 12;
+ } else {
+ firstx = 1;
+ lastx= 12;
+ firsty = 0;
+ lasty = 13;
+ }
KMO_TRY_EXIT_IF_NULL(
- identified_slices = kmo_identify_slices(ranges,
- ifu_crpix,
- ifu_crval,
- ifu_cdelt,
- gd.l.dim));
- }/* else {
- KMO_TRY_EXIT_IF_NULL(
- identified_slices = cpl_vector_new(gd.l.dim));
- cpl_vector_fill(identified_slices, 1.);
- }*/
+ tmp_img = cpl_image_duplicate(stored_data_images[ifu_nr]));
+ KMO_TRY_EXIT_IF_NULL(
+ pdata = cpl_image_get_data_float(tmp_img));
+ KMO_TRY_EXIT_IF_NULL(
+ pnoise = cpl_image_get_data_float(stored_noise_images[ifu_nr]));
+ nx = cpl_image_get_size_x(tmp_img);
+ ny = cpl_image_get_size_y(tmp_img);
+ KMO_TRY_CHECK_ERROR_STATE();
- if (stored_data_cubes[ifu_nr-1] != NULL) {
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_make_image(stored_data_cubes[ifu_nr-1],
- stored_noise_cubes[ifu_nr-1],
- &stored_data_images[ifu_nr-1],
- &stored_noise_images[ifu_nr-1],
- identified_slices,
- cmethod, cpos_rej, cneg_rej,
- citer, cmax, cmin));
+ // median filtering
+ for (ix = 0; ix < nx; ix++) {
+ for (iy = 0; iy < ny; iy++) {
+ if (ix-mhalf > firstx) { xmin = ix-mhalf; } else { xmin = firstx; }
+ if (ix+mhalf < lastx) { xmax = ix+mhalf; } else { xmax = lastx; }
+ if (iy-mhalf > firsty) { ymin = iy-mhalf; } else { ymin = firsty; }
+ if (iy+mhalf < lasty) { ymax = iy+mhalf; } else { ymax = lasty; }
+
+ pdata[ix+nx*iy] = cpl_image_get_median_window(
+ stored_data_images[ifu_nr],
+ xmin+1, ymin+1, xmax+1, ymax+1);
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ if (stored_noise_images[ifu_nr] != NULL) {
+ boxsize = (xmax-xmin+1)*(ymax-ymin+1);
+ pnoise[ix+nx*iy] /= boxsize; //sqrt(boxsize*boxsize)
+ }
+
+ }
}
- cpl_vector_delete(identified_slices); identified_slices = NULL;
+
+ // replace images
+ cpl_image_delete(stored_data_images[ifu_nr]);
+ stored_data_images[ifu_nr] = tmp_img;
} else {
// IFU is invalid
}
- }
- }
+ } // end for (i) ifu_nr
+ } // end for (j) det_nr
+ cpl_vector_delete(identified_slices); identified_slices = NULL;
- // normalise all IFUs as a group.
+ // normalise all IFUs of a detector as a group.
// Calculate mean of each IFU, add up and divide by number of successful
// averaged IFUs.
// Then divide all valid IFUs with mean value
- cnt = 0;
- for (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
- if (stored_data_images[i] != NULL) {
- KMO_TRY_ASSURE(cpl_image_count_rejected(stored_data_images[i]) <
- cpl_image_get_size_x(stored_data_images[i])*
- cpl_image_get_size_y(stored_data_images[i]),
- CPL_ERROR_ILLEGAL_INPUT,
- "The collapsed, dark-subtracted image contains "
- "only invalid values! Probably the provided "
- "FLAT_SKY frames are exactly the same as the "
- "frames used for MASTER_DARK calculation.");
-
- mean_data += cpl_image_get_mean(stored_data_images[i]);
- KMO_TRY_CHECK_ERROR_STATE();
- cnt++;
- }
-
- }
- mean_data /= cnt;
-
- if (mean_data != 0.0) {
- for (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
- if (stored_data_images[i] != NULL) {
- KMO_TRY_EXIT_IF_ERROR(
- cpl_image_divide_scalar(stored_data_images[i],
- mean_data));
+ for (j = 0; j < nr_devices; j++) {
+ cnt = 0;
+ mean_data = 0;
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ ifu_nr = j*KMOS_IFUS_PER_DETECTOR + i;
+ if (stored_data_images[ifu_nr] != NULL) {
+ KMO_TRY_ASSURE(cpl_image_count_rejected(stored_data_images[ifu_nr]) <
+ cpl_image_get_size_x(stored_data_images[ifu_nr])*
+ cpl_image_get_size_y(stored_data_images[ifu_nr]),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "The collapsed image contains only invalid values!");
+ mean_data += cpl_image_get_mean(stored_data_images[ifu_nr]);
+ KMO_TRY_CHECK_ERROR_STATE();
+ cnt++;
}
- }
- } else {
- cpl_msg_warning(cpl_func, "Data couldn't be normalised "
- "(mean = 0.0)!");
- }
- if (process_noise) {
+ } // end for (i) ifu_nr
+ mean_data /= cnt;
if (mean_data != 0.0) {
- for (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
- if (stored_noise_images[i] != NULL) {
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ ifu_nr = j*KMOS_IFUS_PER_DETECTOR + i;
+ if (stored_data_images[ifu_nr] != NULL) {
KMO_TRY_EXIT_IF_ERROR(
- cpl_image_divide_scalar(stored_noise_images[i],
- mean_data));
+ cpl_image_divide_scalar(stored_data_images[ifu_nr], mean_data));
}
- }
+ if (stored_noise_images[ifu_nr] != NULL) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_image_divide_scalar(stored_noise_images[ifu_nr], mean_data));
+ }
+ } // end for (i) ifu_nr
} else {
- cpl_msg_warning(cpl_func, "Noise couldn't be normalised "
- "(mean = 0.0)!");
+ cpl_msg_warning(cpl_func, "Data couldn't be normalised (mean = 0.0)!");
}
- }
+ } // end for (j) det_nr
+
+ //
+ // invert data and noise
+ //
+ double old_val = 0.,
+ new_val = 0.;
+ for (j = 0; j < nr_devices; j++) {
+ cnt = 0;
+ mean_data = 0;
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ ifu_nr = j*KMOS_IFUS_PER_DETECTOR + i;
+ if (stored_data_images[ifu_nr] != NULL) {
+ // invert data
+ KMO_TRY_EXIT_IF_NULL(
+ pdata = cpl_image_get_data_float(stored_data_images[ifu_nr]));
+ if (stored_noise_images[ifu_nr] != NULL) {
+ KMO_TRY_EXIT_IF_NULL(
+ pnoise = cpl_image_get_data_float(stored_noise_images[ifu_nr]));
+ }
+ for (ix = 0; ix < nx; ix++) {
+ for (iy = 0; iy < ny; iy++) {
+ old_val = pdata[ix+nx*iy];
+ pdata[ix+nx*iy] = 1. / pdata[ix+nx*iy];
+ if (stored_noise_images[ifu_nr] != NULL) {
+ new_val = pdata[ix+nx*iy];
+ pnoise[ix+nx*iy] = sqrt(pow(new_val, 2) *
+ pow(pnoise[ix+nx*iy], 2) /
+ pow(old_val, 2));
+ }
+ }
+ }
+ }
+ } // end for (i) ifu_nr
+ } // end for (j) det_nr
// calculate qc parameters on normalised data
qc_spat_unif = 0.0;
@@ -1671,7 +1224,7 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_EXIT_IF_ERROR(
kmo_set_unused_ifus(unused_ifus_after, main_header,
- "kmo_illumination"));
+ "kmo_illumination_flat"));
cpl_msg_info("","Saving data...");
@@ -1699,45 +1252,29 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
fn_suffix = cpl_sprintf("%s", ""));
}
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_main_header(frameset, ILLUM_CORR, fn_suffix, frame,
- main_header, parlist, cpl_func));
-
- KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_main_header(frameset, SKYFLAT_EDGE, fn_suffix, frame,
+ kmo_dfs_save_main_header(frameset, ILLUM_CORR_FLAT, fn_suffix, frame,
main_header, parlist, cpl_func));
for (i = 0; i < nr_devices * KMOS_IFUS_PER_DETECTOR; i++) {
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_image(stored_data_images[i], ILLUM_CORR, fn_suffix,
- stored_sub_data_headers[i], 0./0.));
+ kmo_dfs_save_image(stored_data_images[i], ILLUM_CORR_FLAT, fn_suffix,
+ stored_sub_headers[i], 0./0.));
- if (process_noise) {
- KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_image(stored_noise_images[i], ILLUM_CORR,
- fn_suffix, stored_sub_noise_headers[i], 0./0.));
- }
- }
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_str = cpl_propertylist_get_string(stored_sub_headers[i], EXTNAME));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_extname_extractor(tmp_str, &fr_type, &ifu_nr, content));
+ KMO_TRY_EXIT_IF_NULL(
+ extname = kmo_extname_creator(ifu_frame, ifu_nr,
+ EXT_NOISE));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_update_property_string(stored_sub_headers[i], EXTNAME,
+ extname, "FITS extension name"));
+ cpl_free(extname); extname = NULL;
- for (det_nr = 1; det_nr <= nr_devices; det_nr++) {
- for (ifu_nr = 0; ifu_nr < KMOS_IFUS_PER_DETECTOR; ifu_nr++) {
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_int(stored_sub_data_headers[(det_nr-1)*KMOS_IFUS_PER_DETECTOR+ifu_nr],
- CAL_IFU_NR,
- ifu_nr+1+(det_nr-1)*KMOS_IFUS_PER_DETECTOR,
- "IFU Number {1..24}"));
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_double(
- stored_sub_data_headers[(det_nr-1)*KMOS_IFUS_PER_DETECTOR+ifu_nr],
- CAL_ROTANGLE,
- rotangle_found,
- "[deg] Rotator relative to nasmyth"));
- if (has_flat_edge) {
- // save edge-parameters as product
- KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_table(edge_table_sky[det_nr-1][ifu_nr], SKYFLAT_EDGE, fn_suffix,
- stored_sub_data_headers[(det_nr-1)*KMOS_IFUS_PER_DETECTOR+ifu_nr]));
- }
- }
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_image(stored_noise_images[i], ILLUM_CORR_FLAT,
+ fn_suffix, stored_sub_headers[i], 0./0.));
}
}
KMO_CATCH
@@ -1746,20 +1283,15 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
ret_val = -1;
}
kmo_free_fits_desc(&desc_sky);
- kmo_free_fits_desc(&desc_dark);
- kmo_free_fits_desc(&desc_flat);
kmo_free_fits_desc(&desc_xcal);
kmo_free_fits_desc(&desc_ycal);
kmo_free_fits_desc(&desc_lcal);
cpl_image_delete(combined_data); combined_data = NULL;
- cpl_image_delete(combined_noise); combined_noise = NULL;
cpl_image_delete(xcal); xcal = NULL;
cpl_image_delete(ycal); ycal = NULL;
cpl_image_delete(lcal); lcal = NULL;
cpl_image_delete(img_dark); img_dark = NULL;
- cpl_image_delete(img_dark_noise); img_dark_noise = NULL;
cpl_image_delete(img_flat); img_flat = NULL;
- cpl_image_delete(img_flat_noise); img_flat_noise = NULL;
cpl_array_delete(calTimestamp); calTimestamp = NULL;
cpl_free(bounds); bounds = NULL;
kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
@@ -1767,8 +1299,6 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_free(fn_lut); fn_lut = NULL;
cpl_free(suffix); suffix = NULL;
cpl_free(fn_suffix); fn_suffix = NULL;
- cpl_frameset_delete(frameset_sky); frameset_sky = NULL;
- cpl_vector_delete(ranges); ranges = NULL;
cpl_free(filter); filter = NULL;
if (calAngles != NULL) {
cpl_vector_delete(calAngles); calAngles = NULL;
@@ -1779,10 +1309,6 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_imagelist_delete(stored_data_cubes[i]);
stored_data_cubes[i] = NULL;
}
- if (stored_noise_cubes != NULL) {
- cpl_imagelist_delete(stored_noise_cubes[i]);
- stored_noise_cubes[i] = NULL;
- }
if (stored_data_images != NULL) {
cpl_image_delete(stored_data_images[i]);
stored_data_images[i] = NULL;
@@ -1791,40 +1317,15 @@ static int kmo_illumination(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_image_delete(stored_noise_images[i]);
stored_noise_images[i] = NULL;
}
- if (stored_sub_data_headers != NULL) {
- cpl_propertylist_delete(stored_sub_data_headers[i]);
- stored_sub_data_headers[i] = NULL;
- }
- if (stored_sub_noise_headers != NULL) {
- cpl_propertylist_delete(stored_sub_noise_headers[i]);
- stored_sub_noise_headers[i] = NULL;
+ if (stored_sub_headers != NULL) {
+ cpl_propertylist_delete(stored_sub_headers[i]);
+ stored_sub_headers[i] = NULL;
}
}
cpl_free(stored_data_cubes); stored_data_cubes = NULL;
- cpl_free(stored_noise_cubes); stored_noise_cubes = NULL;
cpl_free(stored_data_images); stored_data_images = NULL;
cpl_free(stored_noise_images); stored_noise_images = NULL;
- cpl_free(stored_sub_data_headers); stored_sub_data_headers = NULL;
- cpl_free(stored_sub_noise_headers); stored_sub_noise_headers = NULL;
- if (edge_table_sky != NULL) {
- for (i = 0; i < KMOS_NR_DETECTORS; i++) {
- if (edge_table_sky[i] != NULL) {
- for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
- cpl_table_delete(edge_table_sky[i][j]);
- edge_table_sky[i][j] = NULL;
- }
- cpl_free(edge_table_sky[i]); edge_table_sky[i] = NULL;
- }
- }
- cpl_free(edge_table_sky); edge_table_sky = NULL;
- }
- if (edge_table_flat != NULL) {
- for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
- cpl_table_delete(edge_table_flat[j]);
- edge_table_flat[j] = NULL;
- }
- cpl_free(edge_table_flat); edge_table_flat = NULL;
- }
+ cpl_free(stored_sub_headers); stored_sub_headers = NULL;
return ret_val;
}
diff --git a/recipes/kmo_make_image.c b/recipes/kmo_make_image.c
index 118d36d..48bbe8d 100644
--- a/recipes/kmo_make_image.c
+++ b/recipes/kmo_make_image.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_make_image.c,v 1.16 2013/06/07 13:37:26 aagudo Exp $
+/* $Id: kmo_make_image.c,v 1.16 2013-06-07 13:37:26 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/07 13:37:26 $
+ * $Date: 2013-06-07 13:37:26 $
* $Revision: 1.16 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_multi_reconstruct.c b/recipes/kmo_multi_reconstruct.c
index 000c495..c3b1a46 100644
--- a/recipes/kmo_multi_reconstruct.c
+++ b/recipes/kmo_multi_reconstruct.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_multi_reconstruct.c,v 1.46 2013/08/02 09:38:57 aagudo Exp $
+/* $Id: kmo_multi_reconstruct.c,v 1.55 2013-10-08 14:55:01 erw Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -19,54 +19,78 @@
*/
/*
- * $Author: aagudo $
- * $Date: 2013/08/02 09:38:57 $
- * $Revision: 1.46 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Author: erw $
+ * $Date: 2013-10-08 14:55:01 $
+ * $Revision: 1.55 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+/*-----------------------------------------------------------------------------
+ * Includes
+ *----------------------------------------------------------------------------*/
#include <string.h>
#include <math.h>
#include <cpl.h>
-#include <cpl_wcs.h>
+#include "kmclipm_constants.h"
+#include "kmclipm_functions.h"
#include "kmo_debug.h"
+#include "kmo_constants.h"
+#include "kmo_cpl_extensions.h"
+#include "kmo_priv_lcorr.h"
#include "kmo_utils.h"
-#include "kmo_dfs.h"
#include "kmo_error.h"
+#include "kmo_dfs.h"
+#include "kmo_functions.h"
+#include "kmo_priv_arithmetic.h"
+#include "kmo_priv_combine.h"
#include "kmo_priv_functions.h"
-#include "kmo_cpl_extensions.h"
-#include "kmo_constants.h"
-#include "kmo_priv_multi_reconstruct.h"
#include "kmo_priv_reconstruct.h"
+#include "kmo_priv_multi_reconstruct.h"
+
+/*-----------------------------------------------------------------------------
+ * Types
+ *-----------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ * Functions prototypes
+ *----------------------------------------------------------------------------*/
static int kmo_multi_reconstruct_create(cpl_plugin *);
static int kmo_multi_reconstruct_exec(cpl_plugin *);
static int kmo_multi_reconstruct_destroy(cpl_plugin *);
static int kmo_multi_reconstruct(cpl_parameterlist *, cpl_frameset *);
+/*-----------------------------------------------------------------------------
+ * Static variables
+ *----------------------------------------------------------------------------*/
+
static char kmo_multi_reconstruct_description[] =
-"This recipe shifts several exposures of an object and combines them. The diffe-\n"
-"rent methods to match the exposures are described below (--method parameter).\n"
-"The output cube is larger than the input cubes, according to the shifts to be\n"
-"applied. Additionally a border of NaN values is added. The WCS is the same as\n"
-"for the first exposure.\n"
-"For each spatial/spectral pixel a new value will be calculated (according the\n"
-"--cmethod parameter) and written into the output cube.\n"
-"Only exposures with equal orientation regarding the WCS can be combined (except\n"
-"-–method=”none”), north must point to the same direction. It is recommended to\n"
-"apply any rotation possibly after combining.\n"
-"The default mapping mode is done via the --name parameter, where the name of\n"
-"the object has to be provided. The recipe searches in all input data cubes IFUs\n"
-"pointing to that object.\n"
+"Ideally at least two data frames have to be provided since we need for each IFU\n"
+"pointing to an object as well a sky frame for the same IFU.\n"
+"If an OH spectrum is given in the SOF file the lambda axis will be corrected\n"
+"using the OH lines as reference.\n"
+"All IFUs with the same object name will be reconstructed and combined in one step\n"
+"Telluric correction is only supported if the objects have been observed with\n"
+"the same IFU on all exposures (dithering).\n"
+"The number of created files depends on the number of objects of different name.\n"
+"If the user just wants to combine a certain object, the parameters --name or\n"
+"--ifus can be used.\n"
+"\n"
+"Exposures taken with the templates KMOS_spec_obs_mapping8 and\n"
+"KMOS_spec_obs_mapping24 can't be processed with this recipe! Use kmo_sci_red\n"
+"instead.\n"
"\n"
"BASIC PARAMETERS:\n"
"-----------------\n"
+"--imethod\n"
+"The interpolation method used for reconstruction.\n"
+"\n"
"--name\n"
"--ifus\n"
"Since an object can be present only once per exposure and since it can be\n"
@@ -74,88 +98,99 @@ static char kmo_multi_reconstruct_description[] =
"identify the objects:\n"
" * Combine by object names (default)\n"
" In this case the object name must be provided via the --name parameter. The\n"
-" object name will be searched for in all primary headers of all provided frames\n"
-" in the keyword ESO OCS ARMx NAME.\n"
+" object name will be searched for in all primary headers of all provided\n"
+" frames in the keyword ESO OCS ARMx NAME.\n"
"\n"
" * Combine by index (advanced)\n"
" In this case the --ifus parameter must be provided. The parameter must have\n"
-" the same number of entries as frames are provided, e.g. \"3;1;24\" for 3 expo-\n"
-" sures. The index doesn't reference the extension in the frame but the real\n"
-" index of the IFU as defined in the EXTNAME keyword (e.g. 'IFU.3.DATA').\n"
-"\n"
-"--imethod\n"
-"Method to use for interpolation.\n"
-"\n"
-"--method\n"
-"There are following sources to get the shift parameters from:\n"
-" * 'none' (default)\n"
-" The cubes are directly recombined, not shifting at all. The ouput frame will\n"
-" have the same dimensions as the input cubes.\n"
-" If the size differs a warning will be emitted and the cubes will be aligned\n"
-" to the lower left corner. If the orientation differs a warning will be emit-\n"
-" ted, but the cubes are combined anyway.\n"
-"\n"
-" * 'header'\n"
-" The shifts are calculated according to the WCS information stored in the\n"
-" header of every IFU. The output frame will get larger, except the object is\n"
-" at the exact same position for all exposures. The size of the exposures can\n"
-" differ, but the orientation must be the same for all exposures.\n"
-"\n"
-" * 'user'\n"
-" Read the shifts from a user specified file. The path of the file must be pro-\n"
-" vided using the --filename parameter. For every exposure (except the first one)\n"
-" two shift values are expected per line, they have to be separated with simple\n"
-" spaces. The values indicate pixel shifts and are referenced to the first\n"
-" frame. The 1st value is the shift in x-direction to the left, the 2nd the\n"
-" shift in y-direction upwards. The size of the exposures can differ, but the\n"
-" orientation must be the same for all exposures.\n"
-"\n"
-" * 'center'\n"
-" The shifts are calculated using a centering algorithm. The detector exposures\""
-" will be reconstructed and the resulting data cubes will be collapsed to an image.\n"
-" A 2D profile of the image will be fitted to it to identify the centre. With \n"
-" the parameter --fmethod the function to fit can be provided. The size of the\n"
-" exposures can differ, but the orientation must be the same for all exposures.\n"
+" the same number of entries as frames are provided, e.g. \"3;1;24\" for 3\n"
+" exposures. The index doesn't reference the extension in the frame but the\n"
+" real index of the IFU as defined in the EXTNAME keyword.\n"
+" (e.g. 'IFU.3.DATA')\n"
"\n"
"ADVANCED PARAMETERS\n"
"-------------------\n"
-"--size\n"
-"Spatial size of the output cube.\n"
+"--flux\n"
+"Specify if flux conservation should be applied.\n"
+"\n"
+"--background\n"
+"Specify if background removal should be applied.\n"
"\n"
"--suppress_extension\n"
"If set to TRUE, the arbitrary filename extensions are supressed. If multiple\n"
"products with the same category are produced, they will be numered consecutively\n"
"starting from 0.\n"
"\n"
-"--fmethod\n"
-"see --method='center'\n"
-"The type of function that should be fitted spatially to the collapsed image.\n"
-"This fit is used to create a mask to extract the spectrum of the object. Valid\n"
-"values are 'gauss' and 'moffat'.\n"
-"\n"
-"--filename\n"
-"see --method='user'\n"
-"\n"
" Advanced reconstruction parameters\n"
" ----------------------------------\n"
-"--pix_scale\n"
-"Change the pixel scale [arcsec]. Default of 0.2\" results into cubes of\n"
-"14x14pix, a scale of 0.1\" results into cubes of 28x28pix, etc.\n"
-"\n"
"--neighborhoodRange\n"
"Defines the range to search for neighbors during reconstruction\n"
"\n"
"--b_samples\n"
-"The number of samples in spectral direction for the reconstructed cube. Ideal-\n"
-"ly this number should be greater than 2048, the detector size.\n"
+"The number of samples in spectral direction for the reconstructed cube.\n"
+"Ideally this number should be greater than 2048, the detector size.\n"
"\n"
"--b_start\n"
"--b_end\n"
"Used to define manually the start and end wavelength for the reconstructed\n"
"cube. By default the internally defined values are used.\n"
"\n"
+"--pix_scale\n"
+"Change the pixel scale [arcsec]. Default of 0.2\" results into cubes of\n"
+"14x14pix, a scale of 0.1\" results into cubes of 28x28pix, etc.\n"
+"\n"
+"--no_subtract\n"
+"If set to TRUE, the found objects and references won't be sky subtracted. \n"
+"Additionally all IFUs will be reconstructed, even the ones containing skies. \n"
+"This option sets the parameter no_combine to TRUE automatically.\n"
+"\n"
+"--xcal_interpolation\n"
+"If true interpolate the pixel position in the slitlet (xcal) using the two\n"
+"closest rotator angles in the calibration file. Otherwise take the values\n"
+"of the closest rotator angle\n"
+"\n"
" Advanced combining parameters\n"
" ----------------------------------\n"
+"--method\n"
+"There are following sources to get the shift parameters from:\n"
+" * 'header' (default)\n"
+" The shifts are calculated according to the WCS information stored in the\n"
+" header of every IFU. The output frame will get larger, except the object is\n"
+" at the exact same position for all exposures. The size of the exposures can\n"
+" differ, but the orientation must be the same for all exposures.\n"
+"\n"
+" * 'none'\n"
+" The cubes are directly recombined, not shifting at all. The ouput frame\n"
+" will have the same dimensions as the input cubes.\n"
+" If the size differs a warning will be emitted and the cubes will be aligned\n"
+" to the lower left corner. If the orientation differs a warning will be\n"
+" emitted, but the cubes are combined anyway.\n"
+"\n"
+" * 'center'\n"
+" The shifts are calculated using a centering algorithm. The cube will be\n"
+" collapsed and a 2D profile will be fitted to it to identify the centre.\n"
+" With the parameter --fmethod the function to fit can be provided. The size\n"
+" of the exposures can differ, but the orientation must be the same for all\n"
+" exposures.\n"
+"\n"
+" * 'user'\n"
+" Read the shifts from a user specified file. The path of the file must be\n"
+" provided using the --filename parameter. For every exposure (except the\n"
+" first one) two shift values are expected per line, they have to be separa-\n"
+" ted with simple spaces. The values indicate pixel shifts and are referenced\n"
+" to the first frame. The 1st value is the shift in x-direction to the left,\n"
+" the 2nd the shift in y-direction upwards. The size of the exposures can\n"
+" differ, but the orientation must be the same for all exposures.\n"
+"\n"
+"--fmethod\n"
+"see --method='center'\n"
+"The type of function that should be fitted spatially to the collapsed image.\n"
+"This fit is used to create a mask to extract the spectrum of the object. Valid\n"
+"values are 'gauss' and 'moffat'.\n"
+"\n"
+"--filename\n"
+"see --method='user'\n"
+"\n"
"--cmethod\n"
"Following methods of frame combination are available:\n"
" * 'ksigma' (Default)\n"
@@ -190,29 +225,37 @@ static char kmo_multi_reconstruct_description[] =
"--cmin\n"
"see --cmethod='min_max'\n"
"\n"
-"-------------------------------------------------------------------------------\n"
+"------------------------------------------------------------------------------\n"
" Input files:\n"
"\n"
-" DO DO KMOS \n"
-" category group Type Explanation Required #Frames\n"
-" -------- ----- ----- ----------- -------- -------\n"
-" SCIENCE RAW The science frames Y >=2 \n"
-" XCAL F2D x calibration frame Y 1 \n"
-" YCAL F2D y calibration frame Y 1 \n"
-" LCAL F2D Wavelength calib. frame Y 1 \n"
-" WAVE_BAND F2L Table with start-/end-wavelengths Y 1 \n"
+" DO KMOS \n"
+" category Type Explanation Required #Frames\n"
+" -------- ----- ----------- -------- -------\n"
+" SCIENCE RAW The science frames Y >=1 \n"
+" XCAL F2D x calibration frame Y 1 \n"
+" YCAL F2D y calibration frame Y 1 \n"
+" LCAL F2D Wavelength calib. frame Y 1 \n"
+" MASTER_FLAT F2D Master flat Y 0,1 \n"
+" WAVE_BAND F2L Table with start-/end-wavelengths Y 1 \n"
+" TELLURIC F1I normalised telluric spectrum N 0,1 \n"
+" OH_SPEC F1S Vector holding OH lines N 0,1 \n"
"\n"
" Output files:\n"
"\n"
" DO KMOS\n"
" category Type Explanation\n"
" -------- ----- -----------\n"
-" CUBE_MULTI_<name/ifu> F3I Combined data cube\n"
-"-------------------------------------------------------------------------------\n"
+" CUBE_MULTI F3I Combined cubes with noise\n"
+"------------------------------------------------------------------------------\n"
"\n";
+/*-----------------------------------------------------------------------------
+ * Functions code
+ *----------------------------------------------------------------------------*/
+
/**
- * @defgroup kmo_multi_reconstruct kmo_multi_reconstruct Combine cubes
+ * @defgroup kmo_multi_reconstruct kmo_multi_reconstruct Reconstruct and combine
+ * data frames dividing illumination and telluric correction
*
* See recipe description for details.
*/
@@ -226,7 +269,7 @@ static char kmo_multi_reconstruct_description[] =
Create the recipe instance and make it available to the application using the
interface. This function is exported.
-*/
+ */
int cpl_plugin_get_info(cpl_pluginlist *list)
{
cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
@@ -237,7 +280,7 @@ int cpl_plugin_get_info(cpl_pluginlist *list)
KMOS_BINARY_VERSION,
CPL_PLUGIN_TYPE_RECIPE,
"kmo_multi_reconstruct",
- "Reconstruct and combine cubes in one processing step",
+ "Reconstruct and combine obj/sky-pairs in one step.",
kmo_multi_reconstruct_description,
"Alex Agudo Berbel",
"kmos-spark at mpe.mpg.de",
@@ -257,7 +300,7 @@ int cpl_plugin_get_info(cpl_pluginlist *list)
@return 0 if everything is ok
Defining the command-line/configuration parameters for the recipe.
-*/
+ */
static int kmo_multi_reconstruct_create(cpl_plugin *plugin)
{
cpl_recipe *recipe;
@@ -272,12 +315,10 @@ static int kmo_multi_reconstruct_create(cpl_plugin *plugin)
/* Create the parameters list in the cpl_recipe object */
recipe->parameters = cpl_parameterlist_new();
- /* Fill the parameters list */
-
/* --imethod (interpolation method) */
p = cpl_parameter_new_value("kmos.kmo_multi_reconstruct.imethod",
CPL_TYPE_STRING,
- "Method to use for interpolation. "
+ "Method to use for interpolation during reconstruction. "
"[\"NN\" (nearest neighbour), "
"\"lwNN\" (linear weighted nearest neighbor), "
"\"swNN\" (square weighted nearest neighbor), "
@@ -292,9 +333,8 @@ static int kmo_multi_reconstruct_create(cpl_plugin *plugin)
p = cpl_parameter_new_value("kmos.kmo_multi_reconstruct.method",
CPL_TYPE_STRING,
"The shifting method: "
- "'none': no shifting, combined directly "
- "(default), "
- "'header': shift according to WCS, "
+ "'none': no shifting, combined directly, "
+ "'header': shift according to WCS (default), "
"'center': centering algorithm, "
"'user': read shifts from file",
"kmos.kmo_multi_reconstruct",
@@ -312,7 +352,7 @@ static int kmo_multi_reconstruct_create(cpl_plugin *plugin)
"image (default), "
"'moffat': fit a moffat function to collapsed"
" image",
- "kmos.kmo_combine",
+ "kmos.kmo_multi_reconstruct",
"gauss");
cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "fmethod");
cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
@@ -366,7 +406,7 @@ static int kmo_multi_reconstruct_create(cpl_plugin *plugin)
/* --neighborhoodRange */
p = cpl_parameter_new_value("kmos.kmo_multi_reconstruct.neighborhoodRange",
CPL_TYPE_DOUBLE,
- "Defines the range to search for neighbors. "
+ "Defines the range to search for neighbors "
"in pixels",
"kmos.kmo_multi_reconstruct",
1.001);
@@ -385,6 +425,48 @@ static int kmo_multi_reconstruct_create(cpl_plugin *plugin)
cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
cpl_parameterlist_append(recipe->parameters, p);
+ /* --flux */
+ p = cpl_parameter_new_value("kmos.kmo_multi_reconstruct.flux",
+ CPL_TYPE_BOOL,
+ "TRUE: Apply flux conservation. FALSE: otherwise",
+ "kmos.kmo_multi_reconstruct",
+ FALSE);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "flux");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
+ /* --background */
+ p = cpl_parameter_new_value("kmos.kmo_multi_reconstruct.background",
+ CPL_TYPE_BOOL,
+ "TRUE: Apply background removal. FALSE: otherwise",
+ "kmos.kmo_multi_reconstruct",
+ FALSE);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "background");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
+ /* --xcal_interpolation */
+ p = cpl_parameter_new_value("kmos.kmo_multi_reconstruct.xcal_interpolation",
+ CPL_TYPE_BOOL,
+ "TRUE: Interpolate xcal between rotator angles. FALSE: otherwise",
+ "kmos.kmo_multi_reconstruct",
+ TRUE);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "xcal_interpolation");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
+ /* --no_subtract */
+ p = cpl_parameter_new_value("kmos.kmo_multi_reconstruct.no_subtract",
+ CPL_TYPE_BOOL,
+ "Don't sky subtract object and references."
+ "(TRUE (apply) or "
+ "FALSE (don't apply)",
+ "kmos.kmo_multi_reconstruct",
+ FALSE);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "no_subtract");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
/* --dev_cal */
p = cpl_parameter_new_value("kmos.kmo_multi_reconstruct.dev_cal",
CPL_TYPE_BOOL,
@@ -398,16 +480,6 @@ static int kmo_multi_reconstruct_create(cpl_plugin *plugin)
cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
cpl_parameterlist_append(recipe->parameters, p);
- /* --size */
- p = cpl_parameter_new_value("kmos.kmo_multi_reconstruct.size",
- CPL_TYPE_STRING,
- "Spatial size of the output cube.",
- "kmos.kmo_multi_reconstruct",
- "max");
- cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "size");
- cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
- cpl_parameterlist_append(recipe->parameters, p);
-
// add parameters for band-definition
kmo_band_pars_create(recipe->parameters,
"kmos.kmo_multi_reconstruct");
@@ -422,7 +494,7 @@ static int kmo_multi_reconstruct_create(cpl_plugin *plugin)
@brief Execute the plugin instance given by the interface
@param plugin the plugin
@return 0 if everything is ok
-*/
+ */
static int kmo_multi_reconstruct_exec(cpl_plugin *plugin)
{
cpl_recipe *recipe;
@@ -439,7 +511,7 @@ static int kmo_multi_reconstruct_exec(cpl_plugin *plugin)
@brief Destroy what has been created by the 'create' function
@param plugin the plugin
@return 0 if everything is ok
-*/
+ */
static int kmo_multi_reconstruct_destroy(cpl_plugin *plugin)
{
cpl_recipe *recipe;
@@ -464,77 +536,101 @@ static int kmo_multi_reconstruct_destroy(cpl_plugin *plugin)
@li CPL_ERROR_ILLEGAL_INPUT if operator not valid,
if first operand not 3d or
if second operand not valid
- @li CPL_ERROR_INCOMPATIBLE_INPUT if the dimensions of the two operands do
- not match
-*/
+ @li CPL_ERROR_INCOMPATIBLE_INPUT if the dimensions of the two operands
+ do not match
+ */
static int kmo_multi_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frameset)
{
- const char *method = NULL,
- *cmethod = NULL,
- *fmethod = NULL,
- *imethod = NULL,
- *filename = NULL,
- *ifus_txt = NULL,
- *name = NULL,
- *size = NULL,
- *filter_id = NULL;
- char *tmp_str = NULL,
- *filename_output_cube = NULL,
- *extname = NULL,
- *keyword = NULL,
- *suffix = NULL,
- *tmp_ocs = NULL,
- **exposure_filename = NULL,
- **exposure_objectname = NULL;
- int ret_val = 0,
- device_nr = 0,
- citer = 0,
- cmin = 0,
- cmax = 0,
- nr_alloc = 0,
- suppress_extension = FALSE,
- i = 0,
- *exposure_ifus = NULL,
- nr_science_frames = 0,
- dev_cal = 0;
- double neighborhoodRange = 1.001,
- cpos_rej = 0.0,
- cneg_rej = 0.0,
- pix_scale = 0.0,
- *xshifts = NULL,
- *yshifts = NULL,
- cd1_1 = 0.0,
- cd1_2 = 0.0,
- ang1 = 0.0,
- ang2 = 0.0,
- exposure_rotangle = 0.0,
- rotangle_found = 0.0;
- cpl_imagelist **data_cube_list = NULL,
- **noise_cube_list = NULL,
- *cube_combined_data = NULL,
- *cube_combined_noise = NULL;
- cpl_vector *ifus = NULL;
- cpl_propertylist *pl = NULL,
- *main_header = NULL,
- *ref_main_header = NULL,
- *ref_sub_header = NULL,
- *tmp_header = NULL,
- **header_data = NULL,
- **data_header_list = NULL,
- **noise_header_list = NULL;
- cpl_frame *frame = NULL,
- *lcal_frame = NULL,
- **empty_frames = NULL,
- *tmp_frame = NULL,
- *ref_frame = NULL;
- cpl_table *band_table = NULL;
- cpl_image *lcalImg = NULL;
- cpl_frameset *exposures = NULL;
- main_fits_desc desc;
- gridDefinition gd;
+ int ret_val = 0,
+ nr_science_frames = 0,
+ has_illum_corr = 0,
+ has_master_flat = 0,
+ has_telluric = 0,
+ *bounds = NULL,
+ citer = 0,
+ cmin = 0,
+ cmax = 0,
+ flux = FALSE,
+ background = FALSE,
+ no_subtract = FALSE,
+ xcal_interpolation = FALSE,
+ suppress_extension = FALSE,
+ dev_cal = 0,
+ cnt = 0,
+ arm_index = 0,
+ suppress_index = 0,
+ xdim = 0,
+ ydim = 0,
+ iy = 0,
+ ix = 0,
+ ifu_nr = 0,
+ nr_frames = 0;
+ double xmin = DBL_MAX,
+ xmax = -DBL_MAX,
+ ymin = DBL_MAX,
+ ymax = -DBL_MAX,
+ gxshift = 0.,
+ gyshift = 0.,
+ gxdim = 0.,
+ gydim = 0.,
+ neighborhoodRange = 1.001,
+ cpos_rej = 0.0,
+ cneg_rej = 0.0,
+ pix_scale = 0.0,
+ *xshifts = NULL,
+ *yshifts = NULL;
+ char *suffix = NULL,
+ *mapping_mode = NULL,
+ *fn_cube = NULL,
+ *fn_suffix = NULL,
+ *filter_id = NULL,
+ *extname = NULL;
+ const char *imethod = NULL,
+ *ifus_txt = NULL,
+ *name = NULL,
+ *tmp_str = NULL,
+ *filename = NULL,
+ *comb_method = NULL,
+ *cmethod = NULL,
+ *fmethod = NULL,
+ *filter_keyword = "ESO INS FILT1 ID";
+ cpl_array **unused_ifus_before = NULL,
+ **unused_ifus_after = NULL;
+ cpl_frame *xcal_frame = NULL,
+ *ycal_frame = NULL,
+ *lcal_frame = NULL,
+ *flat_frame = NULL,
+ *illum_frame = NULL,
+ *telluric_frame = NULL,
+ *science_frame = NULL,
+ *ref_spectrum_frame = NULL;
+ cpl_propertylist *tmp_header = NULL,
+ *ref_sub_header = NULL,
+ *science_frame_header = NULL,
+ **sub_headers = NULL;
+ cpl_vector *ifus = NULL;
+ cpl_table *band_table = NULL;
+
+ cpl_polynomial **lcorr_coeffs = NULL;
+ cpl_imagelist *cube_combined_data = NULL,
+ *cube_combined_noise = NULL,
+ **pre_data_cube_list = NULL;
+ kmclipm_vector *telluric_data = NULL,
+ *telluric_noise = NULL;
+ main_fits_desc desc1,
+ desc2,
+ desc_telluric;
+ gridDefinition gd,
+ gd_14x14;
+ armNameStruct *arm_name_struct = NULL;
KMO_TRY
{
+
+ kmo_init_fits_desc(&desc1);
+ kmo_init_fits_desc(&desc2);
+ kmo_init_fits_desc(&desc_telluric);
+
//
// check frameset
//
@@ -543,62 +639,79 @@ static int kmo_multi_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frame
CPL_ERROR_NULL_INPUT,
"Not all input data is provided!");
- KMO_TRY_ASSURE(! ((cpl_frameset_count_tags(frameset, XCAL) == 0) &&
- (cpl_frameset_count_tags(frameset, YCAL) == 0) &&
- (cpl_frameset_count_tags(frameset, LCAL) == 0) &&
- (cpl_frameset_count_tags(frameset, WAVE_BAND) == 0)),
- CPL_ERROR_FILE_NOT_FOUND,
- "XCAL, YCAL, LCAL or WAVE_BAND frames missing in "
- "frameset!!");
+ nr_science_frames = cpl_frameset_count_tags(frameset, SCIENCE);
+ KMO_TRY_ASSURE(nr_science_frames >= 1,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "At least one SCIENCE frame is required!");
+ if (nr_science_frames == 1) {
+ cpl_msg_warning("", "At least two SCIENCE frames should be provided "
+ "in order to apply sky subtraction!");
+ cpl_msg_warning("", "All IFUs will be reconstructed regardless if "
+ "they contain object, reference or sky!");
+ }
KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, XCAL) == 1,
CPL_ERROR_FILE_NOT_FOUND,
- "Exactly one XCAL frame is expected in frameset!");
+ "Exactly one XCAL frame is required!");
KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, YCAL) == 1,
CPL_ERROR_FILE_NOT_FOUND,
- "Exactly one YCAL frame is expected in frameset!");
+ "Exactly one YCAL frame is required!");
KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, LCAL) == 1,
CPL_ERROR_FILE_NOT_FOUND,
- "Exactly one LCAL frame is expected in frameset!");
+ "Exactly one LCAL frame is required!");
+
+ has_master_flat = cpl_frameset_count_tags(frameset, MASTER_FLAT);
+ KMO_TRY_ASSURE((has_master_flat == 0) || (has_master_flat == 1),
+ CPL_ERROR_FILE_NOT_FOUND,
+ "At most one MASTER_FLAT frame can be provided!");
KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, WAVE_BAND) == 1,
CPL_ERROR_FILE_NOT_FOUND,
- "Exactly one WAVE_BAND frame is expected in frameset!");
+ "Exactly one WAVE_BAND frame is required!");
- // assert that at least two SCIENCE frames are available and create
- // intermediate frameset just with these science frames
- nr_science_frames = cpl_frameset_count_tags(frameset, SCIENCE);
- KMO_TRY_CHECK_ERROR_STATE();
+ has_illum_corr = cpl_frameset_count_tags(frameset, ILLUM_CORR);
+ KMO_TRY_ASSURE((has_illum_corr == 0) || (has_illum_corr == 1),
+ CPL_ERROR_FILE_NOT_FOUND,
+ "At most one ILLUM_CORR frame can be provided!");
- KMO_TRY_ASSURE(nr_science_frames > 1,
- CPL_ERROR_ILLEGAL_INPUT,
- "At least two SCIENCE frames must be provided to combine!");
+ has_telluric = cpl_frameset_count_tags(frameset, TELLURIC);
+ KMO_TRY_ASSURE((has_telluric == 0) || (has_telluric == 1),
+ CPL_ERROR_FILE_NOT_FOUND,
+ "At most one TELLURIC frame can be provided!");
KMO_TRY_ASSURE(kmo_dfs_set_groups(frameset, "kmo_multi_reconstruct") == 1,
CPL_ERROR_ILLEGAL_INPUT,
"Cannot identify RAW and CALIB frames!");
- KMO_TRY_EXIT_IF_NULL(
- exposures = cpl_frameset_new());
- KMO_TRY_EXIT_IF_NULL(
- tmp_frame = kmo_dfs_get_frame(frameset, SCIENCE));
-
- for (i = 0; i < nr_science_frames; i++) {
- KMO_TRY_EXIT_IF_ERROR(
- cpl_frameset_insert(exposures, cpl_frame_duplicate(tmp_frame)));
- KMO_TRY_CHECK_ERROR_STATE();
+ KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, OH_SPEC) == 0 ||
+ cpl_frameset_count_tags(frameset, OH_SPEC) == 1,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Only a single reference spectrum can be provided!");
+ //
+ // get parameters
+ //
+ cpl_msg_info("", "--- Parameter setup for kmo_multi_reconstruct ------");
- tmp_frame = kmo_dfs_get_frame(frameset, NULL);
- }
+ flux = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_multi_reconstruct.flux");
+ KMO_TRY_ASSURE((flux == 0) ||
+ (flux == 1),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "flux must be either FALSE or TRUE! %d", flux);
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.flux"));
- cpl_msg_info("", "--- Parameter setup for kmo_multi_reconstruct -------");
+ background = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_multi_reconstruct.background");
+ KMO_TRY_ASSURE((background == 0) ||
+ (background == 1),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "background must be either FALSE or TRUE! %d", background);
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.background"));
KMO_TRY_EXIT_IF_NULL(
- imethod = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_multi_reconstruct.imethod"));
-
+ imethod = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_multi_reconstruct.imethod"));
KMO_TRY_ASSURE((strcmp(imethod, "NN") == 0) ||
(strcmp(imethod, "lwNN") == 0) ||
(strcmp(imethod, "swNN") == 0) ||
@@ -606,87 +719,46 @@ static int kmo_multi_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frame
CPL_ERROR_ILLEGAL_INPUT,
"imethod must be either \"NN\", \"lwNN\", "
"\"swNN\" or \"MS\"!");
-
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_multi_reconstruct.imethod"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.imethod"));
- pix_scale = kmo_dfs_get_parameter_double(parlist,
- "kmos.kmo_multi_reconstruct.pix_scale");
+ neighborhoodRange = kmo_dfs_get_parameter_double(parlist, "kmos.kmo_multi_reconstruct.neighborhoodRange");
KMO_TRY_CHECK_ERROR_STATE();
- KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_multi_reconstruct.pix_scale"));
- KMO_TRY_ASSURE((pix_scale >= 0.01) &&
- (pix_scale <= 0.4),
- CPL_ERROR_ILLEGAL_INPUT,
- "pix_scale must be between 0.01 and 0.4 (results in cubes "
- "with 7x7 to 280x280 pixels)!");
-
- neighborhoodRange = kmo_dfs_get_parameter_double(parlist,
- "kmos.kmo_multi_reconstruct.neighborhoodRange");
- KMO_TRY_CHECK_ERROR_STATE();
-
KMO_TRY_ASSURE(neighborhoodRange > 0.0,
CPL_ERROR_ILLEGAL_INPUT,
"neighborhoodRange must be greater than 0.0");
-
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_multi_reconstruct.neighborhoodRange"));
-
- KMO_TRY_EXIT_IF_NULL(
- size = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_multi_reconstruct.size"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.neighborhoodRange"));
KMO_TRY_EXIT_IF_NULL(
- method = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_multi_reconstruct.method"));
-
+ comb_method = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_multi_reconstruct.method"));
KMO_TRY_EXIT_IF_NULL(
- fmethod = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_multi_reconstruct.fmethod"));
-
- KMO_TRY_ASSURE((strcmp(size, "max") == 0) ||
- (strcmp(size, "std") == 0),
- CPL_ERROR_ILLEGAL_INPUT,
- "Following output cube size specifications are available: "
- "'std' or 'max'");
-
-
- KMO_TRY_ASSURE((strcmp(method, "none") == 0) ||
- (strcmp(method, "header") == 0) ||
- (strcmp(method, "center") == 0) ||
- (strcmp(method, "user") == 0),
+ fmethod = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_multi_reconstruct.fmethod"));
+ KMO_TRY_ASSURE((strcmp(comb_method, "none") == 0) ||
+ (strcmp(comb_method, "header") == 0) ||
+ (strcmp(comb_method, "center") == 0) ||
+ (strcmp(comb_method, "user") == 0),
CPL_ERROR_ILLEGAL_INPUT,
"Following shift methods are available : 'none', "
"'header', 'center' or 'user'");
- if (strcmp(method, "user") == 0) {
- filename = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_multi_reconstruct.filename");
+ if (strcmp(comb_method, "user") == 0) {
+ filename = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_multi_reconstruct.filename");
KMO_TRY_CHECK_ERROR_STATE();
-
KMO_TRY_ASSURE(strcmp(filename, "") != 0,
CPL_ERROR_ILLEGAL_INPUT,
"path of file with shift information must be "
"provided!");
-
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_multi_reconstruct.filename"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.filename"));
}
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_multi_reconstruct.method"));
-
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.method"));
ifus_txt = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_multi_reconstruct.ifus");
+ "kmos.kmo_multi_reconstruct.ifus");
KMO_TRY_CHECK_ERROR_STATE();
-
- name = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_multi_reconstruct.name");
+ name = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_multi_reconstruct.name");
KMO_TRY_CHECK_ERROR_STATE();
if (strcmp(ifus_txt, "") != 0) {
@@ -701,15 +773,9 @@ static int kmo_multi_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frame
KMO_TRY_ASSURE(cpl_vector_get_size(ifus) == nr_science_frames,
CPL_ERROR_ILLEGAL_INPUT,
"ifus parameter must have the same number of values "
- "than frames provided ) (%lld!=%d)",
+ "than frames provided (for frames just containing "
+ "skies insert 0)) (%lld=%d)",
cpl_vector_get_size(ifus), nr_science_frames);
-
- for (i = 0; i < nr_science_frames; i++) {
- KMO_TRY_ASSURE((cpl_vector_get(ifus, i) > 0.5 &&
- cpl_vector_get(ifus, i) < 24.5 ),
- CPL_ERROR_ILLEGAL_INPUT,
- "IFU numbers must be in the range 1..24");
- }
}
if (strcmp(name, "") != 0) {
@@ -718,40 +784,55 @@ static int kmo_multi_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frame
"ifus parameter must be NULL if name is provided!");
}
- KMO_TRY_ASSURE((strcmp(name, "") != 0) || (strcmp(ifus_txt, "") != 0),
- CPL_ERROR_ILLEGAL_INPUT,
- "Either the name of the object or the numbers of the "
- "IFUs to combine must be provided (--name or --ifus "
- "parameters)");
-
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_multi_reconstruct.ifus"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.ifus"));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.name"));
+ kmo_band_pars_load(parlist, "kmos.kmo_multi_reconstruct");
+
+ no_subtract = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_multi_reconstruct.no_subtract");
+ KMO_TRY_CHECK_ERROR_STATE();
+ KMO_TRY_ASSURE((no_subtract == TRUE) || (no_subtract == FALSE),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "no_subtract must be TRUE or FALSE!");
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_multi_reconstruct.name"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.no_subtract"));
+ pix_scale = kmo_dfs_get_parameter_double(parlist, "kmos.kmo_multi_reconstruct.pix_scale");
+ KMO_TRY_CHECK_ERROR_STATE();
+ KMO_TRY_ASSURE((pix_scale >= 0.01) &&
+ (pix_scale <= 0.4),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "pix_scale must be between 0.01 and 0.4 (results in cubes "
+ "with 7x7 to 280x280 pixels)!");
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.pix_scale"));
- suppress_extension = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_multi_reconstruct.suppress_extension");
+ xcal_interpolation = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_multi_reconstruct.xcal_interpolation");
KMO_TRY_CHECK_ERROR_STATE();
+ KMO_TRY_ASSURE((xcal_interpolation == TRUE) ||
+ (xcal_interpolation == FALSE),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "xcal_interpolation must be TRUE or FALSE!");
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.suppress_extension"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.xcal_interpolation"));
+ suppress_extension = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_multi_reconstruct.suppress_extension");
+ KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_ASSURE((suppress_extension == TRUE) || (suppress_extension == FALSE),
CPL_ERROR_ILLEGAL_INPUT,
"suppress_extension must be TRUE or FALSE!");
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.suppress_extension"));
- dev_cal = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_multi_reconstruct.dev_cal");
- KMO_TRY_CHECK_ERROR_STATE();
- KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.dev_cal"));
-
- KMO_TRY_ASSURE((dev_cal == TRUE) || (dev_cal == FALSE),
- CPL_ERROR_ILLEGAL_INPUT,
- "dev_cal must be TRUE or FALSE!");
+ dev_cal = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_multi_reconstruct.dev_cal");
+ KMO_TRY_CHECK_ERROR_STATE();
+ KMO_TRY_ASSURE((dev_cal == TRUE) || (dev_cal == FALSE),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "dev_cal must be TRUE or FALSE!");
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.dev_cal"));
KMO_TRY_EXIT_IF_ERROR(
kmo_combine_pars_load(parlist,
@@ -764,321 +845,443 @@ static int kmo_multi_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frame
&cmax,
FALSE));
- kmo_band_pars_load(parlist, "kmos.kmo_multi_reconstruct");
-
cpl_msg_info("", "-------------------------------------------");
- KMO_TRY_EXIT_IF_NULL(
- tmp_frame = kmo_dfs_get_frame(frameset, SCIENCE));
-
- KMO_TRY_EXIT_IF_NULL(
- suffix = kmo_dfs_get_suffix(tmp_frame, TRUE, FALSE));
-
- KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frame_setup_md5_xycal(frameset));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frame_setup_md5(frameset));
-
- cpl_msg_info("", "Detected instrument setup: %s", suffix+1);
- cpl_msg_info("", "(grating 1, 2 & 3)");
- cpl_msg_info("", "-------------------------------------------");
+ //
+ // assure that filters, grating and rotation offsets match for
+ // XCAL, YCAL, LCAL and for data frame to reconstruct (except DARK
+ // frames)
+ //
- // assure that filters and grating match for
- // XCAL, YCAL, LCAL and for data frames to reconstruct
- KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frameset_setup(frameset, XCAL, TRUE, FALSE, FALSE));
+ // check if filter_id and grating_id match for all detectors
KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frameset_setup(frameset, YCAL, TRUE, FALSE, FALSE));
+ kmo_check_frameset_setup(frameset, SCIENCE, TRUE, FALSE, TRUE));
KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frameset_setup(frameset, LCAL, TRUE, FALSE, FALSE));
+ kmo_check_frame_setup(frameset, SCIENCE, YCAL, TRUE, FALSE, TRUE));
KMO_TRY_EXIT_IF_ERROR(
kmo_check_frame_setup(frameset, XCAL, YCAL, TRUE, FALSE, TRUE));
KMO_TRY_EXIT_IF_ERROR(
kmo_check_frame_setup(frameset, XCAL, LCAL, TRUE, FALSE, TRUE));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frameset_setup(frameset, SCIENCE, TRUE, FALSE, FALSE));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frame_setup(frameset, XCAL, SCIENCE, TRUE, FALSE, TRUE));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frame_setup_md5_xycal(frameset));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frame_setup_md5(frameset));
-
-// KMO_TRY_EXIT_IF_ERROR(
-// kmo_check_cal_frames_rotangle(frameset, XCAL, YCAL));
-// KMO_TRY_EXIT_IF_ERROR(
-// kmo_check_cal_frames_rotangle(frameset, XCAL, LCAL));
+ if (has_master_flat) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_check_frame_setup(frameset, XCAL, MASTER_FLAT, TRUE, FALSE, TRUE));
+ }
+ if (has_telluric) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_check_frame_setup(frameset, XCAL, TELLURIC,
+ TRUE, FALSE, TRUE));
+ }
- nr_alloc = nr_science_frames;
- KMO_TRY_EXIT_IF_NULL(
- exposure_filename = cpl_malloc(nr_alloc * sizeof(char *)));
+ // check descriptors of all frames
KMO_TRY_EXIT_IF_NULL(
- exposure_objectname = cpl_malloc(nr_alloc * sizeof(char *)));
+ xcal_frame = kmo_dfs_get_frame(frameset, XCAL));
+
+ desc1 = kmo_identify_fits_header(cpl_frame_get_filename(xcal_frame));
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ KMO_TRY_ASSURE((desc1.nr_ext % KMOS_NR_DETECTORS == 0) &&
+ (desc1.ex_badpix == FALSE) &&
+ (desc1.fits_type == f2d_fits) &&
+ (desc1.frame_type == detector_frame),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "XCAL isn't in the correct format!!!");
+
KMO_TRY_EXIT_IF_NULL(
- exposure_ifus = cpl_malloc(nr_alloc * sizeof(int)));
+ ycal_frame = kmo_dfs_get_frame(frameset, YCAL));
+ desc2 = kmo_identify_fits_header(cpl_frame_get_filename(ycal_frame));
+ KMO_TRY_CHECK_ERROR_STATE();
- // check exposure frames
- for (i = 0; i < nr_science_frames; i++) {
- KMO_TRY_EXIT_IF_NULL(
- tmp_str = cpl_sprintf("%d", i));
+ KMO_TRY_ASSURE((desc1.nr_ext == desc2.nr_ext) &&
+ (desc1.ex_badpix == desc2.ex_badpix) &&
+ (desc1.fits_type == desc2.fits_type) &&
+ (desc1.frame_type == desc2.frame_type),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "YCAL isn't in the correct format!!!");
+ kmo_free_fits_desc(&desc2);
+ kmo_init_fits_desc(&desc2);
- KMO_TRY_EXIT_IF_NULL(
- frame = kmo_dfs_get_frame(exposures, tmp_str));
- cpl_free(tmp_str);
+ KMO_TRY_EXIT_IF_NULL(
+ lcal_frame = kmo_dfs_get_frame(frameset, LCAL));
+ desc2 = kmo_identify_fits_header(cpl_frame_get_filename(lcal_frame));
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ KMO_TRY_ASSURE((desc2.nr_ext % KMOS_NR_DETECTORS == 0) &&
+ (desc1.ex_badpix == desc2.ex_badpix) &&
+ (desc1.fits_type == desc2.fits_type) &&
+ (desc1.frame_type == desc2.frame_type),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "LCAL isn't in the correct format!!!");
+ kmo_free_fits_desc(&desc2);
+ kmo_init_fits_desc(&desc2);
+ if (has_master_flat) {
KMO_TRY_EXIT_IF_NULL(
- exposure_filename[i] = (char*)cpl_frame_get_filename(frame));
+ flat_frame = kmo_dfs_get_frame(frameset, MASTER_FLAT));
+ desc2 = kmo_identify_fits_header(cpl_frame_get_filename(flat_frame));
+ KMO_TRY_CHECK_ERROR_STATE();
- kmo_init_fits_desc(&desc);
+ KMO_TRY_ASSURE((desc2.nr_ext % (2*KMOS_NR_DETECTORS) == 0) &&
+ (desc1.ex_badpix == desc2.ex_badpix) &&
+ (desc1.fits_type == desc2.fits_type) &&
+ (desc1.frame_type == desc2.frame_type),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "MASTER_FLAT isn't in the correct format!!!");
+ kmo_free_fits_desc(&desc2);
+ kmo_init_fits_desc(&desc2);
+ }
- desc = kmo_identify_fits_header(exposure_filename[i]);
- KMO_TRY_CHECK_ERROR_STATE_MSG("Provided fits file doesn't seem to "
- "be in KMOS-format!");
+ if (has_illum_corr) {
+ KMO_TRY_EXIT_IF_NULL(
+ illum_frame = kmo_dfs_get_frame(frameset, ILLUM_CORR));
+ desc2 = kmo_identify_fits_header(
+ cpl_frame_get_filename(illum_frame));
+ KMO_TRY_CHECK_ERROR_STATE();
+ KMO_TRY_ASSURE(((desc2.nr_ext == 24) || (desc2.nr_ext == 48)) &&
+ (desc2.ex_badpix == FALSE) &&
+ (desc2.fits_type == f2i_fits) &&
+ (desc2.frame_type == ifu_frame),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "ILLUM_CORR isn't in the correct format!!!");
+ kmo_free_fits_desc(&desc2);
+ kmo_init_fits_desc(&desc2);
+ }
- KMO_TRY_ASSURE(((desc.nr_ext == KMOS_NR_DETECTORS) ||
- ((desc.nr_ext == 2*KMOS_NR_DETECTORS))) &&
- (desc.ex_badpix == FALSE) &&
- ((desc.fits_type == raw_fits) ||
- (desc.fits_type == f2d_fits)) &&
- (desc.frame_type == detector_frame),
+ if (has_telluric) {
+ KMO_TRY_EXIT_IF_NULL(
+ telluric_frame = kmo_dfs_get_frame(frameset, TELLURIC));
+ desc_telluric = kmo_identify_fits_header(
+ cpl_frame_get_filename(telluric_frame));
+ KMO_TRY_CHECK_ERROR_STATE();
+ KMO_TRY_ASSURE(((desc_telluric.nr_ext == 24) || (desc_telluric.nr_ext == 48)) &&
+ (desc_telluric.ex_badpix == FALSE) &&
+ (desc_telluric.fits_type == f1i_fits) &&
+ (desc_telluric.frame_type == ifu_frame),
CPL_ERROR_ILLEGAL_INPUT,
- "The frame to reconstruct isn't in the correct "
- "format!!!");
- kmo_free_fits_desc(&desc);
+ "TELLURIC isn't in the correct format!!!");
}
- // select IFU for each exposure
KMO_TRY_EXIT_IF_NULL(
- empty_frames = cpl_malloc(nr_alloc * sizeof(cpl_frame *)));
- int found=0;
- for (i = 0; i < nr_science_frames; i++) {
- empty_frames[i] = NULL;
- if (strcmp(ifus_txt, "") != 0) { //IFU selected by user given list
- found = 1;
-// const char *tmpString;
- exposure_ifus[i] = (int) (cpl_vector_get(ifus, i) + 0.1);
- KMO_TRY_EXIT_IF_NULL(
- pl = kmclipm_propertylist_load(exposure_filename[i], 0));
- KMO_TRY_EXIT_IF_NULL(
- tmp_ocs = cpl_sprintf("%s%d%s", IFU_NAME_PREFIX,
- exposure_ifus[i], IFU_NAME_POSTFIX));
- if (cpl_propertylist_has(pl, tmp_ocs)) {
- tmp_str = (char*)cpl_propertylist_get_string(pl, tmp_ocs);
- } else {
- tmp_str = "";
- }
- KMO_TRY_EXIT_IF_NULL(
- exposure_objectname[i] = cpl_sprintf("%s", tmp_str));
- cpl_free(tmp_ocs);
- cpl_propertylist_delete(pl); pl = NULL;
- } else { //IFU selected by user given object name
- exposure_objectname[i] = (char*)name;
- KMO_TRY_EXIT_IF_NULL(
- tmp_str = cpl_sprintf("%d", i));
+ science_frame = kmo_dfs_get_frame(frameset, SCIENCE));
+ while (science_frame != NULL ) {
+ desc2 = kmo_identify_fits_header(cpl_frame_get_filename(science_frame));
+ KMO_TRY_CHECK_ERROR_STATE();
+ KMO_TRY_ASSURE((desc2.nr_ext == 3) &&
+ (desc2.ex_badpix == FALSE) &&
+ (desc2.fits_type == raw_fits) &&
+ (desc2.frame_type == detector_frame),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "SCIENCE isn't in the correct format!!!");
+ kmo_free_fits_desc(&desc2);
+ kmo_init_fits_desc(&desc2);
+ if (mapping_mode == NULL) {
KMO_TRY_EXIT_IF_NULL(
- frame = kmo_dfs_get_frame(exposures, tmp_str));
- cpl_free(tmp_str);
+ tmp_header =
+ kmclipm_propertylist_load(
+ cpl_frame_get_filename(science_frame), 0));
+ if (cpl_propertylist_has(tmp_header, TPL_ID)) {
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_str = cpl_propertylist_get_string(tmp_header,
+ TPL_ID));
+ if (strcmp(tmp_str, MAPPING8) == 0)
+ {
+ mapping_mode = cpl_sprintf("%s", "mapping8");
+ }
+ if (strcmp(tmp_str, MAPPING24) == 0)
+ {
+ mapping_mode = cpl_sprintf("%s", "mapping24");
+ }
+ }
- KMO_TRY_CHECK_ERROR_STATE();
- int this_ifu = kmo_get_index_from_ocs_name(frame, name);
- KMO_TRY_CHECK_ERROR_STATE();
- if (this_ifu > 0) {
- found = 1;
- exposure_ifus[i] = this_ifu;
- } else {
- empty_frames[i] = frame;
- exposure_ifus[i] = -1;
- cpl_msg_warning("",
- "Could not find any IFU with an object "
- "named '%s' in file %s",
- name, exposure_filename[i]);
+ // when mapping-mode should be supported, remove this if-statement...
+ if (mapping_mode != NULL) {
+ cpl_msg_error("", "*******************************************************");
+ cpl_msg_error("", "*******************************************************");
+ cpl_msg_error("", "*** ***");
+ cpl_msg_error("", "*** The provided SCIENCE frames have been produced ***");
+ cpl_msg_error("", "*** with template %s ***", tmp_str);
+ cpl_msg_error("", "*** ***");
+ cpl_msg_error("", "*** kmo_multi_reconstruct doesn't support yet this ***");
+ cpl_msg_error("", "*** observation mode. Please use recipe kmo_sci_red ***");
+ cpl_msg_error("", "*** instead! ***");
+ cpl_msg_error("", "*** ***");
+ cpl_msg_error("", "*******************************************************");
+ cpl_msg_error("", "*******************************************************");
+ KMO_TRY_ASSURE(1==0,
+ CPL_ERROR_ILLEGAL_INPUT,
+ " ");
}
+
+ cpl_propertylist_delete(tmp_header); tmp_header = NULL;
}
+
+ science_frame = kmo_dfs_get_frame(frameset, NULL);
KMO_TRY_CHECK_ERROR_STATE();
}
- if (! found) {
- cpl_msg_error("",
- "Could not find any IFU with an object named '%s' in "
- "any input file", name);
- KMO_TRY_EXIT_WITH_ERROR(CPL_ERROR_ILLEGAL_INPUT);
- }
- int j = 0;
- for (i = 0; i < nr_alloc; i++) {
- if (empty_frames[i] != NULL) {
- KMO_TRY_EXIT_IF_ERROR(
- cpl_frameset_erase_frame(exposures, empty_frames[i]));
- nr_science_frames--;
- exposure_ifus[j] = exposure_ifus[i];
- } else {
- exposure_ifus[j] = exposure_ifus[i];
- j++;
- }
+
+ if ((mapping_mode != NULL) && ((ifus != NULL) || (strcmp(name, "") != 0))) {
+ cpl_msg_warning("","The SCIENCE frames have been taken in one of the "
+ "mapping modes AND specific IFUs have been "
+ "specified! --> Only processing these!");
}
- for (i = 0; i < nr_science_frames; i++) {
- KMO_TRY_EXIT_IF_NULL(
- tmp_str = cpl_sprintf("%d", i));
- KMO_TRY_EXIT_IF_NULL(
- frame = kmo_dfs_get_frame(exposures, tmp_str));
- cpl_free(tmp_str);
+ KMO_TRY_EXIT_IF_NULL(
+ suffix = kmo_dfs_get_suffix(xcal_frame, TRUE, FALSE));
- KMO_TRY_EXIT_IF_NULL(
- exposure_filename[i] = (char*)cpl_frame_get_filename(frame));
- }
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_check_frame_setup_md5_xycal(frameset));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_check_frame_setup_md5(frameset));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_check_frame_setup_sampling(frameset));
- cpl_free(empty_frames); empty_frames = NULL;
+ cpl_msg_info("", "Detected instrument setup: %s", suffix+1);
+ cpl_msg_info("", "(grating 1, 2 & 3)");
+ cpl_msg_info("", "-------------------------------------------");
+ cpl_free(suffix); suffix = NULL;
- // get reference header, subheader and set grid definition
- device_nr = ((exposure_ifus[0] -1) / KMOS_IFUS_PER_DETECTOR) + 1;
+ if (cpl_frameset_count_tags(frameset, OH_SPEC) != 0) {
+ int is_all_obs = TRUE,
+ has_all_origfile = TRUE;
+ cpl_frame *tmp_frame = NULL;
- KMO_TRY_EXIT_IF_NULL(
- ref_main_header = kmclipm_propertylist_load(exposure_filename[0],0));
- KMO_TRY_EXIT_IF_NULL(
- ref_frame = cpl_frameset_get_first(exposures));
- KMO_TRY_EXIT_IF_NULL(
- ref_sub_header = kmclipm_propertylist_load(exposure_filename[0],
- device_nr));
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale));
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_frame = kmo_dfs_get_frame(frameset, SCIENCE));
+ while (tmp_frame != NULL ) {
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_header = kmclipm_propertylist_load(cpl_frame_get_filename(tmp_frame), 0));
- exposure_rotangle = kmo_mr_get_rot_angle(kmo_dfs_get_frame(exposures, "0"));
+ if (cpl_propertylist_has(tmp_header, ORIGFILE)) {
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_str = cpl_propertylist_get_string(tmp_header, ORIGFILE));
+ if (strstr(tmp_str, "OBS") == NULL) {
+ is_all_obs = FALSE;
+ }
+ } else {
+ has_all_origfile = FALSE;
+ }
+ cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+ tmp_frame = kmo_dfs_get_frame(frameset, NULL);
+ KMO_TRY_CHECK_ERROR_STATE();
+ }
- KMO_TRY_EXIT_IF_NULL(
- lcal_frame = kmo_dfs_get_frame(frameset, LCAL));
+ if (has_all_origfile) {
+ if (is_all_obs) {
+ // we are reconstructing an OBS-frame, allow OH_SPEC correction
+ KMO_TRY_EXIT_IF_NULL(
+ ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
+ } else {
+ cpl_msg_warning("", "Supplied OH_SPEC is ignored since a calibration "
+ "frame is being used as SCIENCE frame.");
+ }
+ } else {
+ cpl_msg_warning("", "The supplied SCIENCE frames are all assumed to be "
+ "science frames. If any of them is a calibration frame, "
+ "omit OH_SPEC from sof-file");
+ KMO_TRY_EXIT_IF_NULL(
+ ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
+ }
+ }
+ //
+ // check which IFUs are active for all frames
+ //
KMO_TRY_EXIT_IF_NULL(
- lcalImg = kmo_dfs_load_cal_image_frame(lcal_frame,
- 1, 0, exposure_rotangle,
- FALSE, NULL,
- &rotangle_found, -1, 0, 0));
+ unused_ifus_before = kmo_get_unused_ifus(frameset, 1, 1));
KMO_TRY_EXIT_IF_NULL(
- tmp_header = kmo_dfs_load_primary_header(frameset, LCAL));
+ unused_ifus_after = kmo_duplicate_unused_ifus(unused_ifus_before));
+
+ kmo_print_unused_ifus(unused_ifus_before, FALSE);
+ //
+ // get bounds, setup grid, setup arm_name-struct
+ //
+
+ // get left and right bounds of IFUs
KMO_TRY_EXIT_IF_NULL(
- keyword = cpl_sprintf("%s%d%s", IFU_FILTID_PREFIX, device_nr,
- IFU_FILTID_POSTFIX));
+ tmp_header = kmo_dfs_load_primary_header(frameset, XCAL));
KMO_TRY_EXIT_IF_NULL(
- filter_id = cpl_propertylist_get_string(tmp_header, keyword));
+ bounds = kmclipm_extract_bounds(tmp_header));
+ cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+
+ // setup grid definition, wavelength start and end points will be set
+ // in the detector loop
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale, 0.));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_setup_grid(&gd_14x14, imethod, neighborhoodRange, pix_scale, 0.));
- int band_method = 0;
KMO_TRY_EXIT_IF_NULL(
band_table = kmo_dfs_load_table(frameset, WAVE_BAND, 1, 0));
-
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_header = kmo_dfs_load_primary_header(frameset, LCAL));
+ KMO_TRY_EXIT_IF_NULL(
+ filter_id = cpl_sprintf("%s", cpl_propertylist_get_string(tmp_header, filter_keyword)));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_setup_grid_band_lcal(&gd, NULL, filter_id, 0, band_table));
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_setup_grid_band_lcal(&gd, lcalImg, filter_id,
- band_method, band_table));
- cpl_image_delete(lcalImg); lcalImg = NULL;
+ kmclipm_setup_grid_band_lcal(&gd_14x14, NULL, filter_id, 0, band_table));
cpl_propertylist_delete(tmp_header); tmp_header = NULL;
- cpl_free(keyword); keyword = NULL;
cpl_table_delete(band_table); band_table = NULL;
- //extract sub-headers for each exposures, calculate WCS
+ //
+ // get valid object names to process, either one object name across
+ // several SCIENCE frames, or all object names
+ //
KMO_TRY_EXIT_IF_NULL(
- header_data = cpl_malloc(nr_science_frames*sizeof(cpl_propertylist*)));
- for (i = 0; i < nr_science_frames; i++) {
- device_nr = ((exposure_ifus[0] -1) / KMOS_IFUS_PER_DETECTOR) + 1;
- KMO_TRY_EXIT_IF_NULL(
- header_data[i] = kmclipm_propertylist_load(exposure_filename[i],
- device_nr));
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_int(header_data[i],"NAXIS", 3,""));
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_int(header_data[i],"NAXIS1",gd.x.dim,""));
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_int(header_data[i],"NAXIS2",gd.y.dim,""));
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_int(header_data[i],"NAXIS3",gd.l.dim,""));
- cpl_propertylist *tmpHeader;
- KMO_TRY_EXIT_IF_NULL(
- tmpHeader = kmclipm_propertylist_load(exposure_filename[i],0));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_calc_wcs_gd(tmpHeader, header_data[i], exposure_ifus[i], gd));
- cpl_propertylist_delete(tmpHeader);
- }
-
- // check rotation angle
- if (dev_cal == FALSE) {
- cd1_1 = kmo_dfs_get_property_double(header_data[0], CD1_1);
- cd1_2 = kmo_dfs_get_property_double(header_data[0], CD1_2);
- KMO_TRY_CHECK_ERROR_STATE();
- ang1 = atan(cd1_2/cd1_1)*180/CPL_MATH_PI;
- for (i = 1; i < nr_science_frames; i++) {
- cd1_1 = kmo_dfs_get_property_double(header_data[i], CD1_1);
- cd1_2 = kmo_dfs_get_property_double(header_data[i], CD1_2);
- KMO_TRY_CHECK_ERROR_STATE();
- ang2 = atan(cd1_2/cd1_1)*180/CPL_MATH_PI;
+ arm_name_struct = kmo_create_armNameStruct(frameset,
+ SCIENCE,
+ ifus,
+ name,
+ unused_ifus_after,
+ bounds,
+ mapping_mode,
+ no_subtract));
+ cpl_free(bounds); bounds = NULL;
+
+ kmo_print_armNameStruct(frameset, arm_name_struct);
- if (strcmp(method, "none") != 0) {
- // center, header, user
- KMO_TRY_ASSURE(fabs(ang1-ang2) <= 0.5,
- CPL_ERROR_ILLEGAL_INPUT,
- "Orientation of cube 1 (%gdeg) and cube %d "
- "(%gdeg) differ! "
- "Align the orientation of this cube with "
- "kmo_rotate before applying this recipe.",
- ang1, i+1, ang2);
- } else {
- // none
- if (fabs(ang1-ang2) > 0.5) {
- cpl_msg_warning("",
- "Orientation of cube 1 (%gdeg) and cube %d "
- "(%gdeg) differ! Processing anyway.",
- ang1, i+1, ang2);
- }
+ //
+ // check availability of tellurics for the different IFUs used
+ //
+ if (has_telluric && (mapping_mode != NULL)) {
+ // in mapping-mode check if for all IFUs there is either no telluric at all
+ // or the same number of tellurics than object names
+ int telluric_ok = TRUE;
+ for (cnt = 0; cnt < arm_name_struct->nrNames; cnt++) {
+ if (!((arm_name_struct->telluricCnt[cnt] == arm_name_struct->namesCnt[cnt]) ||
+ (arm_name_struct->telluricCnt[cnt] == 0)))
+ {
+ telluric_ok = FALSE;
+ break;
}
}
- }
-
- // set x/y shifts
- KMO_TRY_EXIT_IF_NULL(
- xshifts = cpl_malloc(nr_science_frames * sizeof(double)));
- KMO_TRY_EXIT_IF_NULL(
- yshifts = cpl_malloc(nr_science_frames * sizeof(double)));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_mr_get_offsets(nr_science_frames, method, imethod, neighborhoodRange,
- filename, frameset, exposures, exposure_ifus,
- (const cpl_propertylist**)header_data,
- fmethod,
- cmethod,
- cpos_rej,
- cneg_rej,
- citer,
- cmin,
- cmax,
- pix_scale,
- xshifts, yshifts));
-
- for (i = 0; i < nr_science_frames; i++) {
- printf("exposure %d: filename %s, selected IFU %d, object name "
- "\"%s\", xshift %f, yshift %f\n", i, exposure_filename[i],
- exposure_ifus[i], exposure_objectname[i], xshifts[i], yshifts[i]);
+ if (!telluric_ok) {
+ KMO_TRY_ASSURE(1==0,
+ CPL_ERROR_UNSUPPORTED_MODE,
+ "Mosaics need a TELLURIC frame with at least a telluric correction per detector available! "
+ "Omit the TELLURIC from your sof-file or choose another TELLURIC!");
+ }
}
//
- // set spatial part of the grid
+ // loop over all object names
+ // (for mapping template only once,)
+ // (when ifus or name is set as well only once)
//
-// size = "max";
- if (strcmp(size, "max") == 0) {
- double xmin=0, xmax=0, ymin=0, ymax=0;
- double gxshift, gyshift, gxdim, gydim;
- double pixel_resolution = pix_scale;
- int xdim, ydim;
-
- for (i = 0; i < nr_science_frames; i++) {
- if (xmin > xshifts[i]) { xmin = xshifts[i]; }
- if (xmax < xshifts[i]) { xmax = xshifts[i]; }
- if (ymin > yshifts[i]) { ymin = yshifts[i]; }
- if (ymax < yshifts[i]) { ymax = yshifts[i]; }
+ for (arm_index = 0; arm_index < arm_name_struct->nrNames; arm_index++) {
+
+ nr_frames = arm_name_struct->namesCnt[arm_index];
+
+ KMO_TRY_EXIT_IF_NULL(
+ sub_headers = kmo_mr_get_headers(arm_name_struct,
+ arm_index+1,
+ frameset,
+ gd_14x14));
+
+ if ((strcmp(comb_method, "center") == 0) ||
+ (ref_spectrum_frame != NULL))
+ {
+ //
+ // reconstruct preliminary cubes
+ //
+ KMO_TRY_EXIT_IF_NULL(
+ pre_data_cube_list = kmo_mr_create_datacubes(arm_name_struct,
+ arm_index+1,
+ frameset,
+ gd_14x14,
+ xcal_interpolation));
+ //
+ // calculate lambda-correction coefficients
+ //
+ if (ref_spectrum_frame != NULL) {
+ KMO_TRY_EXIT_IF_NULL(
+ lcorr_coeffs = cpl_calloc(nr_frames, sizeof(cpl_polynomial*)));
+
+ cnt = 0;
+ for (iy = 0; iy < arm_name_struct->size; iy++) {
+ for (ix = 0; ix < KMOS_NR_IFUS; ix++) {
+ ifu_nr = ix + 1;
+ if (arm_name_struct->name_ids[ix+iy*KMOS_NR_IFUS] == arm_index+1) {
+ KMO_TRY_EXIT_IF_NULL(
+ lcorr_coeffs[cnt] = kmo_lcorr_get(pre_data_cube_list[cnt],
+ sub_headers[cnt],
+ ref_spectrum_frame,
+ gd_14x14,
+ filter_id,
+ ifu_nr));
+ cnt++;
+ }
+ }
+ }
+ } // end if (lcorr)
+ } // end if (center, lcorr)
+
+ //
+ // calculate offsets
+ //
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_mr_get_offsets(arm_name_struct,
+ arm_index+1,
+ comb_method,
+ imethod,
+ filename,
+ frameset,
+ pre_data_cube_list,
+ sub_headers,
+ fmethod,
+ cmethod,
+ cpos_rej,
+ cneg_rej,
+ citer,
+ cmin,
+ cmax,
+ dev_cal,
+ mapping_mode,
+ &xshifts,
+ &yshifts));
+
+ KMO_TRY_EXIT_IF_NULL(
+ ref_sub_header = cpl_propertylist_duplicate(sub_headers[0]));
+
+ for (cnt = 0; cnt < nr_frames; cnt++) {
+ cpl_propertylist_delete(sub_headers[cnt]); sub_headers[cnt] = NULL;
+ }
+ cpl_free(sub_headers); sub_headers = NULL;
+
+ if (pre_data_cube_list != NULL) {
+ for (cnt = 0; cnt < nr_frames; cnt++) {
+ cpl_imagelist_delete(pre_data_cube_list[cnt]);
+ }
+ cpl_free(pre_data_cube_list); pre_data_cube_list = NULL;
}
+
+ //
+ // set spatial part of the grid
+ //
+ for (cnt = 0; cnt < nr_frames; cnt++) {
+ if (xmin > xshifts[cnt]) {
+ xmin = xshifts[cnt];
+ }
+ if (xmax < xshifts[cnt]) {
+ xmax = xshifts[cnt];
+ }
+ if (ymin > yshifts[cnt]) {
+ ymin = yshifts[cnt];
+ }
+ if (ymax < yshifts[cnt]) {
+ ymax = yshifts[cnt];
+ }
+ }
+
if (xmax > 0.0001) {
- gxshift = - ceil(xmax);
+ gxshift = -rint(xmax); //(int)xmax; // gxshift = - ceil(xmax);
} else {
gxshift = 0.;
}
if (ymin < -0.0001) {
- gyshift = floor(ymin);
+ gyshift = rint(ymin); //(int)ymin; // gyshift = floor(ymin);
} else {
gyshift = 0.;
}
@@ -1093,95 +1296,194 @@ static int kmo_multi_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frame
gydim = 0.;
}
- xdim = (int) (gxdim - gxshift + .5);
- ydim = (int) (gydim - gyshift + .5);
- gd.x.start += gxshift * pixel_resolution;
- gd.y.start += gyshift * pixel_resolution;
+ xdim = (int)(gxdim - gxshift + .5);
+ ydim = (int)(gydim - gyshift + .5);
+ gd.x.start += gxshift * pix_scale*1000;
+ gd.y.start += gyshift * pix_scale*1000;
gd.x.dim += xdim;
gd.y.dim += ydim;
-// printf("X: %f < %f Y: %f < %f \n",xmin,xmax,ymin,ymax);
-// printf("gxshift: %f gxdim: %f xdim: %d gyshift: %f gydim: %f ydim: %d \n",
-// gxshift, gxdim, xdim, gyshift, gydim, ydim);
-// printf("GD: %f %d %f %d\n", gd.x.start, gd.x.dim, gd.y.start, gd.y.dim);
- }
- //
- // reconstruct multiple detector images
- //
+// cpl_msg_set_level(CPL_MSG_DEBUG);
+// cpl_msg_debug(cpl_func,"x: %f < %f, y: %f < %f",
+// xmin,xmax,ymin,ymax);
+// cpl_msg_debug(cpl_func,"gxshift: %f gxdim: %f xdim: %d, gyshift: %f gydim: %f ydim: %d",
+// gxshift, gxdim, xdim, gyshift, gydim, ydim);
+// cpl_msg_debug(cpl_func,"gd: start delta dim");
+// cpl_msg_debug(cpl_func," x: %f %f %d", gd.x.start, gd.x.delta, gd.x.dim);
+// cpl_msg_debug(cpl_func," y: %f %f %d", gd.y.start, gd.y.delta, gd.y.dim);
+// cpl_msg_debug(cpl_func," l: %f %f %d", gd.l.start, gd.l.delta, gd.l.dim);
+// cpl_msg_set_level(CPL_MSG_INFO);
+
+ //
+ // reconstruct multiple detector images
+ //
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_mr_reconstruct(frameset,
+ arm_name_struct,
+ arm_index+1,
+ xshifts,
+ yshifts,
+ gd,
+ gd_14x14,
+ pix_scale,
+ xcal_interpolation,
+ lcorr_coeffs,
+ &cube_combined_data,
+ &cube_combined_noise,
+ no_subtract,
+ flux,
+ background));
+
+ if (lcorr_coeffs != NULL) {
+ for (cnt = 0; cnt < nr_frames; cnt++) {
+ cpl_polynomial_delete(lcorr_coeffs[cnt]); lcorr_coeffs[cnt] = NULL;
+ }
+ cpl_free(lcorr_coeffs); lcorr_coeffs = NULL;
+ }
-// printf("GD: %f %f %d %f %f %d %f %f %d\n",
-// gd.x.start, gd.x.delta, gd.x.dim,
-// gd.y.start, gd.y.delta, gd.y.dim,
-// gd.l.start, gd.l.delta, gd.l.dim);
+ //
+ // identify ifu_nr of current object name in first SCIENCE frame
+ // containing this object name (e.g. first frame could contain skies only)
+ //
+ ifu_nr = -1;
+ science_frame = NULL;
+ for (iy = 0; iy < arm_name_struct->size; iy++) {
+ for (ix = 0; ix < KMOS_NR_IFUS; ix++) {
+ if (arm_name_struct->name_ids[ix+iy*KMOS_NR_IFUS] == arm_index+1) {
+ if (ifu_nr == -1) {
+ KMO_TRY_EXIT_IF_NULL(
+ science_frame = arm_name_struct->obj_sky_struct->table[iy].objFrame);
+
+ ifu_nr = ix + 1;
+ break;
+ }
+ }
+ }
+ if (ifu_nr != -1) { break; }
+ }
- KMO_TRY_EXIT_IF_ERROR(
- kmo_priv_multi_reconstruct(frameset,
- exposures,
- exposure_ifus,
- xshifts,
- yshifts,
- gd,
- &cube_combined_data,
- &cube_combined_noise,
- pix_scale));
-
- if (!suppress_extension) {
- // setup output category COMBINE + ESO PRO CATG
- if (strcmp(ifus_txt, "") != 0) { //IFU selected by user given list
- KMO_TRY_EXIT_IF_NULL(
- tmp_str = cpl_sprintf("IFU"));
+ //
+ // divide cube by telluric correction
+ //
+ if (has_telluric &&
+ (arm_name_struct->sameTelluric[arm_index] > 0))
+ {
+ telluric_data = kmo_tweak_load_telluric(frameset, ifu_nr, FALSE, no_subtract);
+ KMO_TRY_CHECK_ERROR_STATE();
+ if (telluric_data != NULL) {
+ int index = kmo_identify_index_desc(desc_telluric, ifu_nr, TRUE);
+ KMO_TRY_CHECK_ERROR_STATE();
+ if (desc_telluric.sub_desc[index-1].valid_data == TRUE) {
+ // load noise if present
+ telluric_noise = kmo_tweak_load_telluric(frameset, ifu_nr, TRUE, no_subtract);
+ KMO_TRY_CHECK_ERROR_STATE();
+ } else {
+ if (print_warning_once_tweak_std_noise && (cube_combined_noise != NULL)) {
+ cpl_msg_warning("","************************************************************");
+ cpl_msg_warning("","* Noise cubes were calculated, but won't be divided by *");
+ cpl_msg_warning("","* telluric error since it is missing. *");
+ cpl_msg_warning("","* In order to get a telluric with errors, execute *");
+ cpl_msg_warning("","* kmo_std_star with one of the nearest neighbour methods *");
+ cpl_msg_warning("","* (set --imethod to NN, lwNN or swNN) *");
+ cpl_msg_warning("","************************************************************");
+ print_warning_once_tweak_std_noise = FALSE;
+ }
+ }
+
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_arithmetic_3D_1D(
+ cube_combined_data, telluric_data,
+ cube_combined_noise, telluric_noise, "/"));
+ }
+ kmclipm_vector_delete(telluric_data); telluric_data = NULL;
+ kmclipm_vector_delete(telluric_noise); telluric_noise = NULL;
+ }
+
+ //
+ // saving
+ //
+ fn_cube = CUBE_MULTI;
+ if (!suppress_extension) {
+ char tmp_suffix[1024];
+ tmp_suffix[0] = '\0';
+
+ if (arm_name_struct->telluricCnt[arm_index] == nr_frames) {
+ strcat(tmp_suffix, "_telluric");
+ }
+ if (has_illum_corr) {
+ strcat(tmp_suffix, "_illum");
+ }
+// if (sky_tweak) {
+// strcat(tmp_suffix, "_skytweak");
+// }
+
+ if (strlen(tmp_suffix) > 0) {
+ KMO_TRY_EXIT_IF_NULL(
+ fn_suffix = cpl_sprintf("_%s_%s", arm_name_struct->names[arm_index], tmp_suffix));
+ } else {
+ KMO_TRY_EXIT_IF_NULL(
+ fn_suffix = cpl_sprintf("_%s", arm_name_struct->names[arm_index]));
+ }
} else {
KMO_TRY_EXIT_IF_NULL(
- tmp_str = cpl_sprintf("%s", name));
+ fn_suffix = cpl_sprintf("_%d", suppress_index++));
}
+ //
+ // calculate WCS
+ //
KMO_TRY_EXIT_IF_NULL(
- filename_output_cube = cpl_sprintf("%s_%s", CUBE_MULTI, tmp_str));
- cpl_free(tmp_str); tmp_str = NULL;
- } else {
- KMO_TRY_EXIT_IF_NULL(
- filename_output_cube = cpl_sprintf("%s", CUBE_MULTI));
- }
-
- KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_main_header(frameset, filename_output_cube, "",
- ref_frame, NULL, parlist, cpl_func));
- // save output
- KMO_TRY_EXIT_IF_NULL(
- extname = kmo_extname_creator(ifu_frame, exposure_ifus[0],
- EXT_DATA));
+ science_frame_header = kmclipm_propertylist_load(cpl_frame_get_filename(science_frame), 0));
- // calculate WCS
- KMO_TRY_EXIT_IF_ERROR(
- kmo_calc_wcs_gd(ref_main_header, ref_sub_header, exposure_ifus[0], gd));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_calc_wcs_gd(science_frame_header, ref_sub_header, ifu_nr, gd));
- KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_string(ref_sub_header,
- EXTNAME,
- extname,
- "FITS extension name"));
- cpl_free(extname); extname = NULL;
+ cpl_propertylist_delete(science_frame_header); science_frame_header = NULL;
- KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_cube(cube_combined_data, filename_output_cube,
- "", ref_sub_header, 0./0.));
+ //
+ // save product
+ //
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_main_header(frameset, fn_cube, fn_suffix,
+ science_frame, NULL, parlist, cpl_func));
- if (cube_combined_noise != NULL) {
KMO_TRY_EXIT_IF_NULL(
- extname = kmo_extname_creator(ifu_frame, exposure_ifus[0],
- EXT_NOISE));
-
+ extname = cpl_sprintf("%s.DATA", arm_name_struct->names[arm_index]));
KMO_TRY_EXIT_IF_ERROR(
kmclipm_update_property_string(ref_sub_header,
- EXTNAME,
- extname,
- "FITS extension name"));
+ EXTNAME,
+ extname,
+ "FITS extension name"));
cpl_free(extname); extname = NULL;
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_cube(cube_combined_noise, filename_output_cube,
- "", ref_sub_header, 0./0.));
- }
+ kmo_dfs_save_cube(cube_combined_data, fn_cube, fn_suffix,
+ ref_sub_header, 0./0.));
+
+ if (cube_combined_noise != NULL) {
+ KMO_TRY_EXIT_IF_NULL(
+ extname = cpl_sprintf("%s.NOISE", arm_name_struct->names[arm_index]));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_update_property_string(ref_sub_header,
+ EXTNAME,
+ extname,
+ "FITS extension name"));
+ cpl_free(extname); extname = NULL;
+
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_cube(cube_combined_noise, fn_cube, fn_suffix,
+ ref_sub_header, 0./0.));
+ }
+
+ cpl_imagelist_delete(cube_combined_data); cube_combined_data = NULL;
+ cpl_imagelist_delete(cube_combined_noise); cube_combined_noise = NULL;
+ cpl_propertylist_delete(ref_sub_header); ref_sub_header = NULL;
+ cpl_free(fn_suffix); fn_suffix = NULL;
+ cpl_free(xshifts); xshifts = NULL;
+ cpl_free(yshifts); yshifts = NULL;
+ } // for (arm_index = nrNames)
+
+ kmo_print_unused_ifus(unused_ifus_after, TRUE);
}
KMO_CATCH
{
@@ -1189,63 +1491,31 @@ static int kmo_multi_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frame
ret_val = -1;
}
- cpl_free(suffix); suffix = NULL;
- cpl_free(filename_output_cube); filename_output_cube = NULL;
- cpl_propertylist_delete(main_header); main_header = NULL;
+ kmo_free_fits_desc(&desc1);
+ kmo_free_fits_desc(&desc2);
+ kmo_free_fits_desc(&desc_telluric);
cpl_vector_delete(ifus); ifus = NULL;
- cpl_imagelist_delete(cube_combined_data); cube_combined_data = NULL;
- cpl_imagelist_delete(cube_combined_noise); cube_combined_noise = NULL;
- if (exposures != NULL) {cpl_frameset_delete(exposures);}
- if (exposure_filename != NULL) {cpl_free(exposure_filename);}
- if ((ifus_txt != NULL) && (strcmp(ifus_txt, "") != 0)) { //IFU selected by user given list
- for (i = 0; i < nr_alloc; i++) {
- cpl_free(exposure_objectname[i]);
- }
- }
- if (exposure_objectname != NULL) {cpl_free(exposure_objectname);}
- if (exposure_ifus != NULL) {cpl_free(exposure_ifus);}
- if (ref_main_header != NULL) {cpl_propertylist_delete(ref_main_header);}
- if (ref_sub_header != NULL) {cpl_propertylist_delete(ref_sub_header);}
- if (xshifts != NULL) {cpl_free(xshifts);}
- if (yshifts != NULL) {cpl_free(yshifts);}
-
- if (data_cube_list != NULL) {
- for (i = 0; i < nr_science_frames; i++) {
- cpl_imagelist_delete(data_cube_list[i]); data_cube_list[i] = NULL;
- }
- cpl_free(data_cube_list); data_cube_list = NULL;
+ cpl_free(mapping_mode); mapping_mode = NULL;
+ if (unused_ifus_before != NULL) {
+ kmo_free_unused_ifus(unused_ifus_before); unused_ifus_before = NULL;
}
-
- if (noise_cube_list != NULL) {
- for (i = 0; i < nr_science_frames; i++) {
- cpl_imagelist_delete(noise_cube_list[i]); noise_cube_list[i] = NULL;
- }
- cpl_free(noise_cube_list); noise_cube_list = NULL;
+ if (unused_ifus_after != NULL) {
+ kmo_free_unused_ifus(unused_ifus_after); unused_ifus_after = NULL;
}
-
- if (data_header_list != NULL) {
- for (i = 0; i < nr_science_frames; i++) {
- cpl_propertylist_delete(data_header_list[i]);
- data_header_list[i] = NULL;
- }
- cpl_free(data_header_list); data_header_list = NULL;
+ if (bounds != NULL) {
+ cpl_free(bounds); bounds = NULL;
}
- if (noise_header_list != NULL) {
- for (i = 0; i < nr_science_frames; i++) {
- cpl_propertylist_delete(noise_header_list[i]);
- noise_header_list[i] = NULL;
- }
- cpl_free(noise_header_list); noise_header_list = NULL;
- }
+ kmo_delete_armNameStruct(arm_name_struct);
- if (header_data != NULL) {
- for (i = 0; i < nr_science_frames; i++) {
- cpl_propertylist_delete(header_data[i]);
- header_data[i] = NULL;
- }
- cpl_free(header_data); header_data = NULL;
- }
+ // frees for the case of errors
+ kmclipm_vector_delete(telluric_data); telluric_data = NULL;
+ kmclipm_vector_delete(telluric_noise); telluric_noise = NULL;
+ cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+ cpl_table_delete(band_table); band_table = NULL;
+ cpl_free(suffix); suffix = NULL;
+ cpl_free(fn_suffix); fn_suffix = NULL;
+ cpl_free(filter_id); filter_id = NULL;
return ret_val;
}
diff --git a/recipes/kmo_noise_map.c b/recipes/kmo_noise_map.c
index 789b2af..178ba2a 100644
--- a/recipes/kmo_noise_map.c
+++ b/recipes/kmo_noise_map.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_noise_map.c,v 1.8 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_noise_map.c,v 1.8 2013-05-21 12:13:58 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
+ * $Date: 2013-05-21 12:13:58 $
* $Revision: 1.8 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_reconstruct.c b/recipes/kmo_reconstruct.c
index 80d6b47..5ed50ef 100644
--- a/recipes/kmo_reconstruct.c
+++ b/recipes/kmo_reconstruct.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_reconstruct.c,v 1.58 2013/07/31 10:40:28 aagudo Exp $
+/* $Id: kmo_reconstruct.c,v 1.61 2013/10/08 14:55:01 erw Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -19,10 +19,10 @@
*/
/*
- * $Author: aagudo $
- * $Date: 2013/07/31 10:40:28 $
- * $Revision: 1.58 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Author: erw $
+ * $Date: 2013/10/08 14:55:01 $
+ * $Revision: 1.61 $
+ * $Name: $
*/
#ifdef HAVE_CONFIG_H
@@ -390,7 +390,8 @@ static int kmo_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frameset)
*input_frame_name = NULL,
*output_frame_name = NULL,
*filter_id = NULL,
- *filter_id_tmp = NULL;
+ *filter_id_tmp = NULL,
+ *tmp_str = NULL;
char *keyword = NULL,
*filename_cube = NULL,
*filename_img = NULL,
@@ -600,14 +601,6 @@ static int kmo_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frameset)
kmo_check_frame_setup(frameset, XCAL, LCAL,
TRUE, FALSE, TRUE));
-// This check doesn't make sense here since OCS.ROT.NAANGLE is compared.
-// When creating the calibration files the RAW exposures needn't have been
-// provided in the same order
-// KMO_TRY_EXIT_IF_ERROR(
-// kmo_check_cal_frames_rotangle(frameset, XCAL, YCAL));
-// KMO_TRY_EXIT_IF_ERROR(
-// kmo_check_cal_frames_rotangle(frameset, XCAL, LCAL));
-
if (cpl_frameset_count_tags(frameset, DARK) != 1) {
// check if filters, gratings and rotator offset match
@@ -683,11 +676,6 @@ static int kmo_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frameset)
*/
}
- if (cpl_frameset_count_tags(frameset, OH_SPEC) != 0) {
- KMO_TRY_EXIT_IF_NULL(
- ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
- }
-
KMO_TRY_EXIT_IF_NULL(
xcal_frame = kmo_dfs_get_frame(frameset, XCAL));
KMO_TRY_EXIT_IF_NULL(
@@ -704,6 +692,27 @@ static int kmo_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_msg_info("", "(grating 1, 2 & 3, rotation angle)");
cpl_msg_info("", "-------------------------------------------");
+ KMO_TRY_EXIT_IF_NULL(
+ main_header = kmo_dfs_load_primary_header(frameset,
+ input_frame_name));
+
+ if (cpl_frameset_count_tags(frameset, OH_SPEC) != 0) {
+ if (cpl_propertylist_has(main_header, ORIGFILE)) {
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_str = cpl_propertylist_get_string(main_header, ORIGFILE));
+ if (strstr(tmp_str, "OBS") != NULL) {
+ // we are reconstructing an OBS-frame, allow OH_SPEC correction
+ KMO_TRY_EXIT_IF_NULL(
+ ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
+ } else {
+ cpl_msg_warning("", "Supplied OH_SPEC is ignored since a calibration frame is being reconstructed.");
+ }
+ } else {
+ cpl_msg_warning("", "The supplied frame %s is assumed to be a science frame. If it is a calibration frame, omit OH_SPEC from sof-file", input_frame_name);
+ KMO_TRY_EXIT_IF_NULL(
+ ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
+ }
+ }
desc1 = kmo_identify_fits_header(cpl_frame_get_filename(rec_frame));
KMO_TRY_CHECK_ERROR_STATE();
@@ -771,13 +780,9 @@ static int kmo_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frameset)
kmo_free_fits_desc(&desc2);
//
- // --- load, update & save primary header ---
+ // --- update & save primary header ---
//
KMO_TRY_EXIT_IF_NULL(
- main_header = kmo_dfs_load_primary_header(frameset,
- input_frame_name));
-
- KMO_TRY_EXIT_IF_NULL(
tmp_header = kmo_dfs_load_primary_header(frameset, LCAL));
// assert that filters have correct IDs and that all detectors of all
@@ -842,7 +847,7 @@ static int kmo_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frameset)
// setup grid definition, wavelength start and end points will be set
// in the detector loop
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale));
+ kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale, 0.));
KMO_TRY_EXIT_IF_NULL(
tmp_header = kmo_dfs_load_primary_header(frameset, XCAL));
@@ -866,11 +871,13 @@ static int kmo_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frameset)
// doesn't differ too much with different ROTANGLEs.
double rotangle_found;
print_cal_angle_msg_once = FALSE;
+ print_xcal_angle_msg_once = FALSE;
KMO_TRY_EXIT_IF_NULL(
lcal = kmo_dfs_load_cal_image(frameset, LCAL, i, FALSE, 0.,
FALSE, NULL, &rotangle_found, -1, 0, 0));
if (i==1) {
print_cal_angle_msg_once = TRUE;
+ print_xcal_angle_msg_once = TRUE;
}
char *tmp_band_method = getenv("KMO_BAND_METHOD");
int band_method = 0;
diff --git a/recipes/kmo_rotate.c b/recipes/kmo_rotate.c
index 67641f9..c5ff192 100644
--- a/recipes/kmo_rotate.c
+++ b/recipes/kmo_rotate.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_rotate.c,v 1.12 2013/06/07 15:41:21 aagudo Exp $
+/* $Id: kmo_rotate.c,v 1.12 2013-06-07 15:41:21 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/07 15:41:21 $
+ * $Date: 2013-06-07 15:41:21 $
* $Revision: 1.12 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_sci_red.c b/recipes/kmo_sci_red.c
index ce5a772..8082af8 100644
--- a/recipes/kmo_sci_red.c
+++ b/recipes/kmo_sci_red.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_sci_red.c,v 1.86 2013/08/07 11:09:26 aagudo Exp $
+/* $Id: kmo_sci_red.c,v 1.92 2013-10-08 14:55:01 erw Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -19,10 +19,10 @@
*/
/*
- * $Author: aagudo $
- * $Date: 2013/08/07 11:09:26 $
- * $Revision: 1.86 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Author: erw $
+ * $Date: 2013-10-08 14:55:01 $
+ * $Revision: 1.92 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -85,7 +85,6 @@ static char kmo_sci_red_description[] =
"For exposures taken with the templates KMOS_spec_obs_mapping8 and\n"
"KMOS_spec_obs_mapping24 the recipe behaves a bit different: All active IFUs\n"
"will be combined, regardless of the object names.\n"
-"This recipe must be called after the kmo_std_star-recipe.\n"
"\n"
"BASIC PARAMETERS:\n"
"-----------------\n"
@@ -95,6 +94,23 @@ static char kmo_sci_red_description[] =
"--smethod\n"
"The interpolation method used for shifting.\n"
"\n"
+"--name\n"
+"--ifus\n"
+"Since an object can be present only once per exposure and since it can be\n"
+"located in different IFUs for the existing exposures, there are two modes to\n"
+"identify the objects:\n"
+" * Combine by object names (default)\n"
+" In this case the object name must be provided via the --name parameter. The\n"
+" object name will be searched for in all primary headers of all provided\n"
+" frames in the keyword ESO OCS ARMx NAME.\n"
+"\n"
+" * Combine by index (advanced)\n"
+" In this case the --ifus parameter must be provided. The parameter must have\n"
+" the same number of entries as frames are provided, e.g. \"3;1;24\" for 3\n"
+" exposures. The index doesn't reference the extension in the frame but the\n"
+" real index of the IFU as defined in the EXTNAME keyword.\n"
+" (e.g. 'IFU.3.DATA')\n"
+"\n"
"ADVANCED PARAMETERS\n"
"-------------------\n"
"--flux\n"
@@ -113,6 +129,10 @@ static char kmo_sci_red_description[] =
"detector images but subtracting a modified sky cube from the object cube.\n"
"It is not allowed that \"--sky_tweak\" and \"--no_subtract\" both are TRUE.\n"
"\n"
+"--tbsub\n"
+"If set to TRUE subtract the thermal background from the cube resulting from sky tweaking.\n"
+"Default value is TRUE.\n"
+"\n"
" Advanced reconstruction parameters\n"
" ----------------------------------\n"
"--neighborhoodRange\n"
@@ -135,6 +155,25 @@ static char kmo_sci_red_description[] =
"Change the pixel scale [arcsec]. Default of 0.2\" results into cubes of\n"
"14x14pix, a scale of 0.1\" results into cubes of 28x28pix, etc.\n"
"\n"
+"--no_subtract\n"
+"If set to TRUE, the found objects and references won't be sky subtracted. \n"
+"Additionally all IFUs will be reconstructed, even the ones containing skies. \n"
+"This option sets the parameter no_combine to TRUE automatically.\n"
+"\n"
+"--xcal_interpolation\n"
+"If true interpolate the pixel position in the slitlet (xcal) using the two\n"
+"closest rotator angles in the calibration file. Otherwise take the values\n"
+"of the closest rotator angle\n"
+"\n"
+"--extrapolate\n"
+"By default no extrapolation is applied. This means that the intermediate\n"
+"reconstructed cubes will shrink at most one pixel, which is ok for templates\n"
+"like KMOS_spec_obs_nodtosky or KMOS_spec_obs_freedither. When the cubes will be\n"
+"arranged as a map, a grid is likely to occur between the IFUs. Therefore extra-\n"
+"polation during the shifting process can be switched on in order to get IFUs of\n"
+"original size. For frames taken with mapping templates, extrapolation is\n"
+"switched on automatically.\n"
+"\n"
" Advanced combining parameters\n"
" ----------------------------------\n"
"--edge_nan\n"
@@ -144,28 +183,6 @@ static char kmo_sci_red_description[] =
"--no_combine\n"
"If set to TRUE, the reconstructed cubes will not be combined.\n"
"\n"
-"--no_subtract\n"
-"If set to TRUE, the found objects and references won't be sky subtracted. \n"
-"Additionally all IFUs will be reconstructed, even the ones containing skies. \n"
-"This option sets the parameter no_combine to TRUE automatically.\n"
-"\n"
-"--name\n"
-"--ifus\n"
-"Since an object can be present only once per exposure and since it can be\n"
-"located in different IFUs for the existing exposures, there are two modes to\n"
-"identify the objects:\n"
-" * Combine by object names (default)\n"
-" In this case the object name must be provided via the --name parameter. The\n"
-" object name will be searched for in all primary headers of all provided\n"
-" frames in the keyword ESO OCS ARMx NAME.\n"
-"\n"
-" * Combine by index (advanced)\n"
-" In this case the --ifus parameter must be provided. The parameter must have\n"
-" the same number of entries as frames are provided, e.g. \"3;1;24\" for 3\n"
-" exposures. The index doesn't reference the extension in the frame but the\n"
-" real index of the IFU as defined in the EXTNAME keyword.\n"
-" (e.g. 'IFU.3.DATA')\n"
-"\n"
"--method\n"
"There are following sources to get the shift parameters from:\n"
" * 'header' (default)\n"
@@ -240,20 +257,6 @@ static char kmo_sci_red_description[] =
"--cmin\n"
"see --cmethod='min_max'\n"
"\n"
-"--extrapolate\n"
-"By default no extrapolation is applied. This means that the intermediate\n"
-"reconstructed cubes will shrink at most one pixel, which is ok for templates\n"
-"like KMOS_spec_obs_nodtosky or KMOS_spec_obs_freedither. When the cubes will be\n"
-"arranged as a map, a grid is likely to occur between the IFUs. Therefore extra-\n"
-"polation during the shifting process can be switched on in order to get IFUs of\n"
-"original size. For frames taken with mapping templates, extrapolation is\n"
-"switched on automatically.\n"
-"\n"
-"--xcal_interpolation\n"
-"If true interpolate the pixel position in the slitlet (xcal) using the two\n"
-"closest rotator angles in the calibration file. Otherwise take the values\n"
-"of the closest rotator angle\n"
-"\n"
"------------------------------------------------------------------------------\n"
" Input files:\n"
"\n"
@@ -264,8 +267,8 @@ static char kmo_sci_red_description[] =
" XCAL F2D x calibration frame Y 1 \n"
" YCAL F2D y calibration frame Y 1 \n"
" LCAL F2D Wavelength calib. frame Y 1 \n"
-" MASTER_FLAT F2D Master flat Y 1 \n"
" WAVE_BAND F2L Table with start-/end-wavelengths Y 1 \n"
+" MASTER_FLAT F2D Master flat Y 0,1 \n"
" ILLUM_CORR F2I Illumination correction N 0,1 \n"
" TELLURIC F1I normalised telluric spectrum N 0,1 \n"
" OH_SPEC F1S Vector holding OH lines N 0,1 \n"
@@ -310,8 +313,8 @@ int cpl_plugin_get_info(cpl_pluginlist *list)
KMOS_BINARY_VERSION,
CPL_PLUGIN_TYPE_RECIPE,
"kmo_sci_red",
- "Reconstruct and combine data frames dividing "
- "illumination and telluric correction.",
+ "Reconstruct obj/sky-pairs individually and combine "
+ "them afterwards",
kmo_sci_red_description,
"Alex Agudo Berbel",
"kmos-spark at mpe.mpg.de",
@@ -573,6 +576,18 @@ static int kmo_sci_red_create(cpl_plugin *plugin)
cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
cpl_parameterlist_append(recipe->parameters, p);
+ /* --tbsub */
+ p = cpl_parameter_new_value("kmos.kmo_sci_red.tbsub",
+ CPL_TYPE_BOOL,
+ "Subtract thermal background from input cube."
+ "(TRUE (apply) or "
+ "FALSE (don't apply)",
+ "kmos.kmo_sci_red",
+ TRUE);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "tbsub");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
// add parameters for band-definition
kmo_band_pars_create(recipe->parameters,
"kmos.kmo_sci_red");
@@ -618,8 +633,6 @@ static int kmo_sci_red_destroy(cpl_plugin *plugin)
return 0 ;
}
-
-
/**
@brief Interpret the command line options and execute the data processing
@param parlist the parameters list
@@ -636,108 +649,109 @@ static int kmo_sci_red_destroy(cpl_plugin *plugin)
*/
static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
{
- int ret_val = 0,
- nr_science_frames = 0,
- nr_reconstructed_frames = 0,
- has_illum_corr = 0,
- has_telluric = 0,
- telluric_ok = 0,
- *bounds = NULL,
- det_nr = 0,
- actual_msg_level = 0,
- print_once = FALSE,
- cube_counter_data = 0,
- cube_counter_noise = 0,
- citer = 0,
- cmin = 0,
- cmax = 0,
- user_defined_ifu = 0,
- extrapolate = 0,
- flux = FALSE,
- background = FALSE,
- index = 0,
- nr_data_alloc = 0,
- tmp_int = 0,
- fast_mode = FALSE,
- edge_nan = FALSE,
- no_combine = FALSE,
- no_subtract = FALSE,
- do_sky_subtraction = FALSE,
- sky_tweak = FALSE,
- xcal_interpolation = FALSE,
- suppress_extension = FALSE,
- suppress_index = 0,
- i = 0, sf = 0, jj = 0, ifu_nr = 0;
- const int *punused_ifus_before = NULL;
- int *punused_ifus_after = NULL;
- double neighborhoodRange = 1.001,
- cpos_rej = 0.0,
- cneg_rej = 0.0,
- pix_scale = 0.0;
- char *suffix = NULL,
- *keyword = NULL,
- *extname = NULL,
- *fn_suffix = NULL,
- *mapping_mode = NULL,
- **split = NULL,
+ int ret_val = 0,
+ nr_science_frames = 0,
+ nr_reconstructed_frames = 0,
+ has_illum_corr = 0,
+ has_master_flat = 0,
+ has_telluric = 0,
+ telluric_ok = 0,
+ *bounds = NULL,
+ det_nr = 0,
+ actual_msg_level = 0,
+ print_once = FALSE,
+ cube_counter_data = 0,
+ cube_counter_noise = 0,
+ citer = 0,
+ cmin = 0,
+ cmax = 0,
+ extrapolate = 0,
+ flux = FALSE,
+ background = FALSE,
+ index = 0,
+ nr_data_alloc = 0,
+ tmp_int = 0,
+ fast_mode = FALSE,
+ edge_nan = FALSE,
+ no_combine = FALSE,
+ no_subtract = FALSE,
+ do_sky_subtraction = FALSE,
+ sky_tweak = FALSE,
+ tbsub = TRUE,
+ xcal_interpolation = FALSE,
+ suppress_extension = FALSE,
+ suppress_index = 0,
+ i = 0,
+ sf = 0,
+ jj = 0,
+ ifu_nr = 0;
+ double neighborhoodRange = 1.001,
+ cpos_rej = 0.0,
+ cneg_rej = 0.0,
+ pix_scale = 0.0;
+ char *suffix = NULL,
+ *keyword = NULL,
+ *extname = NULL,
+ *fn_suffix = NULL,
+ *mapping_mode = NULL,
+ **split = NULL,
content[256];
- const char *imethod = NULL,
- *smethod = NULL,
- *ifus_txt = NULL,
- *name = NULL,
- *filter_id = NULL,
- *tmp_str = NULL,
- *filename = NULL,
- *fn_out = NULL,
- *fn_obj = NULL,
- *fn_sky = NULL,
- *fn_reconstr = NULL,
- *comb_method = NULL,
- *cmethod = NULL,
- *fmethod = NULL;
- cpl_array **unused_ifus_before = NULL,
- **unused_ifus_after = NULL;
- cpl_frame *xcal_frame = NULL,
- *ycal_frame = NULL,
- *lcal_frame = NULL,
- *flat_frame = NULL,
- *illum_frame = NULL,
- *telluric_frame = NULL,
- *tmp_frame = NULL;
- cpl_propertylist *tmp_header = NULL,
- *main_header = NULL,
- **header_data = NULL,
- **header_noise = NULL;
- cpl_vector *ifus = NULL;
- kmclipm_vector *telluric_data = NULL,
- *telluric_noise = NULL;
- cpl_image **lcal = NULL,
- *illum_data = NULL,
- *illum_noise = NULL,
- *tmpImg = NULL;
- cpl_imagelist **cube_data = NULL,
- **cube_noise = NULL,
- *sky_data = NULL,
- *sky_noise = NULL,
- *combined_data = NULL,
- *combined_noise = NULL,
- *tmpCube = NULL;
- cpl_table *band_table = NULL;
- cpl_frame *sky_frame = NULL,
- *sky_as_object_frame = NULL,
- *ref_spectrum_frame = NULL;
- cpl_polynomial *lcorr_coeffs = NULL;
+ const char *imethod = NULL,
+ *smethod = NULL,
+ *ifus_txt = NULL,
+ *name = NULL,
+ *filter_id = NULL,
+ *tmp_str = NULL,
+ *filename = NULL,
+ *fn_out = NULL,
+ *fn_obj = NULL,
+ *fn_sky = NULL,
+ *fn_reconstr = NULL,
+ *comb_method = NULL,
+ *cmethod = NULL,
+ *fmethod = NULL;
+ cpl_array **unused_ifus_before = NULL,
+ **unused_ifus_after = NULL;
+ cpl_frame *xcal_frame = NULL,
+ *ycal_frame = NULL,
+ *lcal_frame = NULL,
+ *flat_frame = NULL,
+ *illum_frame = NULL,
+ *telluric_frame = NULL,
+ *tmp_frame = NULL;
+ cpl_propertylist *tmp_header = NULL,
+ *main_header = NULL,
+ **header_data = NULL,
+ **header_noise = NULL;
+ cpl_vector *ifus = NULL;
+ kmclipm_vector *telluric_data = NULL,
+ *telluric_noise = NULL;
+ cpl_image **lcal = NULL,
+ *illum_data = NULL,
+ *illum_noise = NULL,
+ *tmpImg = NULL;
+ cpl_imagelist **cube_data = NULL,
+ **cube_noise = NULL,
+ *sky_data = NULL,
+ *sky_noise = NULL,
+ *combined_data = NULL,
+ *combined_noise = NULL,
+ *tmpCube = NULL;
+ cpl_table *band_table = NULL;
+ cpl_frame *sky_frame = NULL,
+ *sky_as_object_frame = NULL,
+ *ref_spectrum_frame = NULL;
+ cpl_polynomial *lcorr_coeffs = NULL;
main_fits_desc desc1,
desc2,
desc_telluric;
gridDefinition gd;
- armNameStruct *arm_name_struct = NULL;
- enum extrapolationType extrapol_enum = 0;
- enum kmo_frame_type ft = 0;
+ armNameStruct *arm_name_struct = NULL;
+ enum extrapolationType extrapol_enum = 0;
+ enum kmo_frame_type ft = 0;
KMO_TRY
{
-
kmo_init_fits_desc(&desc1);
kmo_init_fits_desc(&desc2);
kmo_init_fits_desc(&desc_telluric);
@@ -773,9 +787,10 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
CPL_ERROR_FILE_NOT_FOUND,
"Exactly one LCAL frame is required!");
- KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, MASTER_FLAT) == 1,
+ has_master_flat = cpl_frameset_count_tags(frameset, MASTER_FLAT);
+ KMO_TRY_ASSURE((has_master_flat == 0) || (has_master_flat == 1),
CPL_ERROR_FILE_NOT_FOUND,
- "Exactly one MASTER_FLAT frame is required!");
+ "At most one MASTER_FLAT frame can be provided!");
KMO_TRY_ASSURE(cpl_frameset_count_tags(frameset, WAVE_BAND) == 1,
CPL_ERROR_FILE_NOT_FOUND,
@@ -1026,6 +1041,9 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
CPL_ERROR_ILLEGAL_INPUT,
"Either no_subtract or sky_tweak or both must be FALSE");
+ tbsub = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_sci_red.tbsub");
+ KMO_TRY_CHECK_ERROR_STATE();
+
pix_scale = kmo_dfs_get_parameter_double(parlist,
"kmos.kmo_sci_red.pix_scale");
KMO_TRY_CHECK_ERROR_STATE();
@@ -1086,19 +1104,10 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
kmo_check_frame_setup(frameset, XCAL, YCAL, TRUE, FALSE, TRUE));
KMO_TRY_EXIT_IF_ERROR(
kmo_check_frame_setup(frameset, XCAL, LCAL, TRUE, FALSE, TRUE));
-// KMO_TRY_EXIT_IF_ERROR(
-// kmo_check_cal_frames_rotangle(frameset, XCAL, YCAL));
-// KMO_TRY_EXIT_IF_ERROR(
-// kmo_check_cal_frames_rotangle(frameset, XCAL, LCAL));
- KMO_TRY_EXIT_IF_ERROR(
- kmo_check_frame_setup(frameset, XCAL, MASTER_FLAT, TRUE, FALSE, TRUE));
-// omit this check because ILLUM_CORR is band-independend
-// if (has_illum_corr) {
-// KMO_TRY_EXIT_IF_ERROR(
-// kmo_check_frame_setup(frameset, XCAL, ILLUM_CORR,
-// TRUE, FALSE, TRUE));
-// }
-
+ if (has_master_flat) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_check_frame_setup(frameset, XCAL, MASTER_FLAT, TRUE, FALSE, TRUE));
+ }
if (has_telluric) {
KMO_TRY_EXIT_IF_ERROR(
kmo_check_frame_setup(frameset, XCAL, TELLURIC,
@@ -1147,19 +1156,21 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
kmo_free_fits_desc(&desc2);
kmo_init_fits_desc(&desc2);
- KMO_TRY_EXIT_IF_NULL(
- flat_frame = kmo_dfs_get_frame(frameset, MASTER_FLAT));
- desc2 = kmo_identify_fits_header(cpl_frame_get_filename(flat_frame));
- KMO_TRY_CHECK_ERROR_STATE();
+ if (has_master_flat) {
+ KMO_TRY_EXIT_IF_NULL(
+ flat_frame = kmo_dfs_get_frame(frameset, MASTER_FLAT));
+ desc2 = kmo_identify_fits_header(cpl_frame_get_filename(flat_frame));
+ KMO_TRY_CHECK_ERROR_STATE();
- KMO_TRY_ASSURE((desc2.nr_ext % (2*KMOS_NR_DETECTORS) == 0) &&
- (desc1.ex_badpix == desc2.ex_badpix) &&
- (desc1.fits_type == desc2.fits_type) &&
- (desc1.frame_type == desc2.frame_type),
- CPL_ERROR_ILLEGAL_INPUT,
- "MASTER_FLAT isn't in the correct format!!!");
- kmo_free_fits_desc(&desc2);
- kmo_init_fits_desc(&desc2);
+ KMO_TRY_ASSURE((desc2.nr_ext % (2*KMOS_NR_DETECTORS) == 0) &&
+ (desc1.ex_badpix == desc2.ex_badpix) &&
+ (desc1.fits_type == desc2.fits_type) &&
+ (desc1.frame_type == desc2.frame_type),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "MASTER_FLAT isn't in the correct format!!!");
+ kmo_free_fits_desc(&desc2);
+ kmo_init_fits_desc(&desc2);
+ }
if (has_illum_corr) {
KMO_TRY_EXIT_IF_NULL(
@@ -1190,11 +1201,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
CPL_ERROR_ILLEGAL_INPUT,
"TELLURIC isn't in the correct format!!!");
}
-
- if (cpl_frameset_count_tags(frameset, OH_SPEC) != 0) {
- KMO_TRY_EXIT_IF_NULL(
- ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
- }
+ kmo_free_fits_desc(&desc2);
KMO_TRY_EXIT_IF_NULL(
tmp_frame = kmo_dfs_get_frame(frameset, SCIENCE));
@@ -1285,7 +1292,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
kmo_print_unused_ifus(unused_ifus_before, FALSE);
//
- // get bounds, setup grid, setup obj_sky-struct
+ // get bounds, setup grid, setup arm_name-struct
//
// get left and right bounds of IFUs
@@ -1298,7 +1305,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
// setup grid definition, wavelength start and end points will be set
// in the detector loop
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale));
+ kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale, 0.));
// get valid STD frames with objects in it and associated sky exposures and
// get valid object names to process, either one object name across
@@ -1312,13 +1319,12 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
bounds,
mapping_mode,
no_subtract));
-cpl_msg_set_level(CPL_MSG_DEBUG);
- kmo_debug_armNameStruct(frameset, arm_name_struct);
-cpl_msg_set_level(CPL_MSG_INFO);
+
+ kmo_print_armNameStruct(frameset, arm_name_struct);
// in mapping-mode check if for all IFUs there is either no telluric at all
// or the same number of tellurics than object names
- if (mapping_mode != NULL) {
+ if ((has_telluric) && (mapping_mode != NULL)) {
telluric_ok = TRUE;
for (jj = 0; jj < arm_name_struct->nrNames; jj++) {
if (!((arm_name_struct->telluricCnt[jj] == arm_name_struct->namesCnt[jj]) ||
@@ -1372,10 +1378,55 @@ cpl_msg_set_level(CPL_MSG_INFO);
cpl_msg_info("", "This can be done manually with the recipe kmo_combine afterwards!");
}
+ actual_msg_level = cpl_msg_get_level();
+
+ cpl_msg_info("", "-------------------------------------------");
+
+ if (cpl_frameset_count_tags(frameset, OH_SPEC) != 0) {
+ int is_all_obs = TRUE,
+ has_all_origfile = TRUE;
+
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_frame = kmo_dfs_get_frame(frameset, SCIENCE));
+ while (tmp_frame != NULL ) {
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_header = kmclipm_propertylist_load(cpl_frame_get_filename(tmp_frame), 0));
+
+ if (cpl_propertylist_has(tmp_header, ORIGFILE)) {
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_str = cpl_propertylist_get_string(tmp_header, ORIGFILE));
+ if (strstr(tmp_str, "OBS") == NULL) {
+ is_all_obs = FALSE;
+ }
+ } else {
+ has_all_origfile = FALSE;
+ }
+ cpl_propertylist_delete(tmp_header); tmp_header = NULL;
+ tmp_frame = kmo_dfs_get_frame(frameset, NULL);
+ KMO_TRY_CHECK_ERROR_STATE();
+ }
+
+ if (has_all_origfile) {
+ if (is_all_obs) {
+ // we are reconstructing an OBS-frame, allow OH_SPEC correction
+ KMO_TRY_EXIT_IF_NULL(
+ ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
+ } else {
+ cpl_msg_warning("", "Supplied OH_SPEC is ignored since a calibration "
+ "frame is being used as SCIENCE frame.");
+ }
+ } else {
+ cpl_msg_warning("", "The supplied SCIENCE frames are all assumed to be "
+ "science frames. If any of them is a calibration frame, "
+ "omit OH_SPEC from sof-file");
+ KMO_TRY_EXIT_IF_NULL(
+ ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC));
+ }
+ }
+
//
// loop all science frames containing at least one object
//
- cpl_msg_info("", "-------------------------------------------");
cpl_msg_info("", "Reconstructing & saving cubes containing objects");
cpl_msg_info("", " ");
for (sf = 0; sf < arm_name_struct->size; sf++) {
@@ -1385,31 +1436,7 @@ cpl_msg_set_level(CPL_MSG_INFO);
KMO_TRY_EXIT_IF_NULL(
main_header = kmclipm_propertylist_load(fn_obj, 0));
- // get ifu and detector number to work at
actual_msg_level = cpl_msg_get_level();
- user_defined_ifu = 0;
- if ((ifus != NULL) || (strcmp(name, "") != 0)) {
- if (ifus != NULL) {
- // user specified IFUs
- user_defined_ifu = cpl_vector_get(ifus, sf);
- KMO_TRY_CHECK_ERROR_STATE();
-
- if (user_defined_ifu < 1) {
- user_defined_ifu = -1;
- }
- } else {
- // user specified an object name
- cpl_msg_set_level(CPL_MSG_OFF);
- user_defined_ifu =
- kmo_get_index_from_ocs_name(arm_name_struct->obj_sky_struct->table[sf].objFrame,
- name);
- cpl_msg_set_level(actual_msg_level);
- if (user_defined_ifu == -1) {
- cpl_error_reset();
- }
- KMO_TRY_CHECK_ERROR_STATE();
- }
- }
//
// reconstruct science frame
@@ -1425,13 +1452,6 @@ cpl_msg_set_level(CPL_MSG_INFO);
"The provided ifu-numbers are incorrect! They "
"must be between 1 and %d", KMOS_NR_IFUS);
- KMO_TRY_EXIT_IF_NULL(
- punused_ifus_before = cpl_array_get_data_int_const(
- unused_ifus_before[det_nr-1]));
- KMO_TRY_EXIT_IF_NULL(
- punused_ifus_after = cpl_array_get_data_int(
- unused_ifus_after[det_nr-1]));
-
// get subheader data
KMO_TRY_EXIT_IF_NULL(
header_data[ifu_nr-1] = kmclipm_propertylist_load(fn_obj,
@@ -1445,23 +1465,8 @@ cpl_msg_set_level(CPL_MSG_INFO);
"FITS extension name"));
cpl_free(extname); extname = NULL;
- // Search for keyword ESO OCS ARMi NOTUSED
- // If not present (CPL_ERROR_DATA_NOT_FOUND), do nothing
- KMO_TRY_EXIT_IF_NULL(
- keyword = cpl_sprintf("%s%d%s", IFU_VALID_PREFIX, ifu_nr,
- IFU_VALID_POSTFIX));
- tmp_str = cpl_propertylist_get_string(main_header, keyword);
- cpl_free(keyword); keyword = NULL;
-
- if ((cpl_error_get_code() == CPL_ERROR_DATA_NOT_FOUND) &&
- (bounds[2*(ifu_nr-1)] != -1) &&
- (bounds[2*(ifu_nr-1)+1] != -1) &&
- ((arm_name_struct->obj_sky_struct->table[sf].skyFrames[ifu_nr-1] != NULL) || (cpl_frameset_count_tags(frameset, SCIENCE) == 1) || no_subtract) &&
- (punused_ifus_before[(ifu_nr-1) % KMOS_IFUS_PER_DETECTOR] == 0) &&
- ((user_defined_ifu == 0) || (user_defined_ifu == ifu_nr)))
- {
+ if (arm_name_struct->name_ids[ifu_nr-1+sf*KMOS_NR_IFUS] >= 1) {
// IFU is valid
- cpl_error_reset();
if ((arm_name_struct->obj_sky_struct->table[sf].skyFrames[ifu_nr-1] != NO_CORRESPONDING_SKYFRAME) &&
(cpl_frameset_count_tags(frameset, SCIENCE) != 1) &&
@@ -1609,23 +1614,23 @@ cpl_msg_set_level(CPL_MSG_INFO);
KMO_TRY_EXIT_IF_ERROR(
kmo_reconstruct_sci(ifu_nr,
- bounds[2*(ifu_nr-1)],
- bounds[2*(ifu_nr-1)+1],
- arm_name_struct->obj_sky_struct->table[sf].objFrame,
- SCIENCE,
- sky_frame,
- SCIENCE,
- flat_frame,
- xcal_frame,
- ycal_frame,
- lcal_frame,
- lcorr_coeffs,
- &gd,
- &cube_data[ifu_nr-1],
- &cube_noise[ifu_nr-1],
- flux,
- background,
- xcal_interpolation));
+ bounds[2*(ifu_nr-1)],
+ bounds[2*(ifu_nr-1)+1],
+ arm_name_struct->obj_sky_struct->table[sf].objFrame,
+ SCIENCE,
+ sky_frame,
+ SCIENCE,
+ flat_frame,
+ xcal_frame,
+ ycal_frame,
+ lcal_frame,
+ lcorr_coeffs,
+ &gd,
+ &cube_data[ifu_nr-1],
+ &cube_noise[ifu_nr-1],
+ flux,
+ background,
+ xcal_interpolation));
cpl_polynomial_delete(lcorr_coeffs); lcorr_coeffs = NULL;
}
@@ -1693,23 +1698,23 @@ cpl_msg_set_level(CPL_MSG_INFO);
KMO_TRY_EXIT_IF_ERROR(
kmo_reconstruct_sci(ifu_nr,
- bounds[2*(ifu_nr-1)],
- bounds[2*(ifu_nr-1)+1],
- sky_as_object_frame,
- SCIENCE,
- sky_frame,
- SCIENCE,
- flat_frame,
- xcal_frame,
- ycal_frame,
- lcal_frame,
- lcorr_coeffs,
- &gd,
- &sky_data,
- &sky_noise,
- flux,
- background,
- xcal_interpolation));
+ bounds[2*(ifu_nr-1)],
+ bounds[2*(ifu_nr-1)+1],
+ sky_as_object_frame,
+ SCIENCE,
+ sky_frame,
+ SCIENCE,
+ flat_frame,
+ xcal_frame,
+ ycal_frame,
+ lcal_frame,
+ lcorr_coeffs,
+ &gd,
+ &sky_data,
+ &sky_noise,
+ flux,
+ background,
+ xcal_interpolation));
cpl_polynomial_delete(lcorr_coeffs); lcorr_coeffs = NULL;
}
@@ -1720,7 +1725,7 @@ cpl_msg_set_level(CPL_MSG_INFO);
cube_data[ifu_nr-1] = kmo_priv_sky_tweak (tmp_object_cube,
sky_data,
header_data[ifu_nr-1],
- .3));
+ .3, tbsub));
if (tmp_object_cube != NULL) {
cpl_imagelist_delete(tmp_object_cube); tmp_object_cube = NULL;
}
@@ -1761,7 +1766,8 @@ cpl_msg_set_level(CPL_MSG_INFO);
// same as the number of found tellurics for this object (which can be on different arms)
telluric_ok = FALSE;
for (jj = 0; jj < arm_name_struct->nrNames; jj++) {
- if ((strcmp(arm_name_struct->names[jj], tmp_str) == 0) &&
+ if (((strcmp(arm_name_struct->names[jj], tmp_str) == 0) ||
+ (strcmp(arm_name_struct->names[jj], IFUS_USER_DEFINED) == 0)) &&
(arm_name_struct->telluricCnt[jj] == arm_name_struct->namesCnt[jj]))
{
telluric_ok = TRUE;
@@ -1804,21 +1810,17 @@ cpl_msg_set_level(CPL_MSG_INFO);
// divide cube by illumination correction
//
if (has_illum_corr) {
- cpl_msg_set_level(CPL_MSG_OFF);
illum_data = kmo_dfs_load_image(frameset, ILLUM_CORR,
ifu_nr, FALSE, FALSE, NULL);
- cpl_msg_set_level(actual_msg_level);
if (cpl_error_get_code() != CPL_ERROR_NONE) {
cpl_msg_warning("","No illumination correction for IFU %d available! "
"Proceeding anyway.", ifu_nr);
cpl_error_reset();
} else {
- cpl_msg_set_level(CPL_MSG_OFF);
illum_noise = kmo_dfs_load_image(frameset,
ILLUM_CORR,
ifu_nr, TRUE,
FALSE, NULL);
- cpl_msg_set_level(actual_msg_level);
if (cpl_error_get_code() != CPL_ERROR_NONE) {
cpl_msg_warning("","No illumination correction for IFU %d "
"available! Proceeding anyway.", ifu_nr);
@@ -1846,12 +1848,10 @@ cpl_msg_set_level(CPL_MSG_INFO);
keyword));
cpl_free(keyword); keyword = NULL;
- kmclipm_vector_delete(telluric_data);
- telluric_data = NULL;
- kmclipm_vector_delete(telluric_noise);
- telluric_noise = NULL;
+ kmclipm_vector_delete(telluric_data); telluric_data = NULL;
+ kmclipm_vector_delete(telluric_noise); telluric_noise = NULL;
} else {
- cpl_error_reset();
+ // IFU is invalid
}
// duplicate subheader data
@@ -2012,7 +2012,9 @@ cpl_msg_set_level(CPL_MSG_INFO);
keyword));
cpl_free(keyword); keyword = NULL;
- if (strcmp(arm_name_struct->names[i], tmp_str) == 0) {
+ if ((strcmp(arm_name_struct->names[i], tmp_str) == 0) ||
+ (strcmp(arm_name_struct->names[i], IFUS_USER_DEFINED) == 0))
+ {
// found object-IFU with matching name
// load data & subheader
index = kmo_identify_index(fn_reconstr, ifu_nr, FALSE);
@@ -2130,7 +2132,7 @@ cpl_msg_set_level(CPL_MSG_INFO);
"isn't the same (%d vs. %d)!",
cube_counter_data, cube_counter_noise);
}
- } else {
+ } else if (cube_counter_data == 1) {
cpl_msg_warning("", "There is only one reconstructed cube with "
"this object! Saving it as it is.");
KMO_TRY_EXIT_IF_NULL(
@@ -2140,16 +2142,33 @@ cpl_msg_set_level(CPL_MSG_INFO);
KMO_TRY_EXIT_IF_NULL(
combined_noise = cpl_imagelist_duplicate(cube_noise[0]));
}
+ } else {
+ KMO_TRY_ASSURE(1==0,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "No cubes found with this object name!");
} // end if (cube_counter_data > 1)
fn_out = COMBINED_CUBE;
if (!suppress_extension) {
+ char tmp_suffix[1024];
+ tmp_suffix[0] = '\0';
+
if (arm_name_struct->telluricCnt[i] == arm_name_struct->namesCnt[i]) {
+ strcat(tmp_suffix, "_telluric");
+ }
+ if (has_illum_corr) {
+ strcat(tmp_suffix, "_illum");
+ }
+ if (sky_tweak) {
+ strcat(tmp_suffix, "_skytweak");
+ }
+
+ if (strlen(tmp_suffix) > 0) {
KMO_TRY_EXIT_IF_NULL(
- fn_suffix = cpl_sprintf("_%s", arm_name_struct->names[i]));
+ fn_suffix = cpl_sprintf("_%s_%s", arm_name_struct->names[i], tmp_suffix));
} else {
KMO_TRY_EXIT_IF_NULL(
- fn_suffix = cpl_sprintf("_%s_%s", arm_name_struct->names[i], "_no_telluric"));
+ fn_suffix = cpl_sprintf("_%s", arm_name_struct->names[i]));
}
} else {
KMO_TRY_EXIT_IF_NULL(
diff --git a/recipes/kmo_shift.c b/recipes/kmo_shift.c
index 61ffaba..de5a94d 100644
--- a/recipes/kmo_shift.c
+++ b/recipes/kmo_shift.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_shift.c,v 1.14 2013/06/07 15:41:21 aagudo Exp $
+/* $Id: kmo_shift.c,v 1.14 2013-06-07 15:41:21 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/07 15:41:21 $
+ * $Date: 2013-06-07 15:41:21 $
* $Revision: 1.14 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_sky_mask.c b/recipes/kmo_sky_mask.c
index 1d6b5bf..cf32e2e 100644
--- a/recipes/kmo_sky_mask.c
+++ b/recipes/kmo_sky_mask.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_sky_mask.c,v 1.9 2013/08/02 15:46:38 aagudo Exp $
+/* $Id: kmo_sky_mask.c,v 1.9 2013-08-02 15:46:38 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/02 15:46:38 $
+ * $Date: 2013-08-02 15:46:38 $
* $Revision: 1.9 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_sky_tweak.c b/recipes/kmo_sky_tweak.c
index 7ed607b..5a406e7 100644
--- a/recipes/kmo_sky_tweak.c
+++ b/recipes/kmo_sky_tweak.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_sky_tweak.c,v 1.3 2013/08/02 16:22:44 aagudo Exp $
+/* $Id: kmo_sky_tweak.c,v 1.4 2013-09-13 09:10:28 erw Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -19,10 +19,10 @@
*/
/*
- * $Author: aagudo $
- * $Date: 2013/08/02 16:22:44 $
- * $Revision: 1.3 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Author: erw $
+ * $Date: 2013-09-13 09:10:28 $
+ * $Revision: 1.4 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -50,7 +50,11 @@ static int kmo_sky_tweak(cpl_parameterlist *, cpl_frameset *);
static char kmo_sky_tweak_description[] =
" This recipes is an advanced tool to remove OH sky lines.\n"
"\n"
-"NO PARAMETERS\n"
+"BASIC PARAMETERS:\n"
+"-----------------\n"
+"--tbsub\n"
+"If set to TRUE subtract the thermal background from the input cube.\n"
+"Default value is TRUE.\n"
"\n"
"-------------------------------------------------------------------------------\n"
" Input files:\n"
@@ -120,7 +124,7 @@ int cpl_plugin_get_info(cpl_pluginlist *list)
static int kmo_sky_tweak_create(cpl_plugin *plugin)
{
cpl_recipe *recipe;
-// cpl_parameter *p;
+ cpl_parameter *p;
/* Check that the plugin is part of a valid recipe */
if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
@@ -133,6 +137,18 @@ static int kmo_sky_tweak_create(cpl_plugin *plugin)
/* Fill the parameters list */
+ /* --tbsub */
+ p = cpl_parameter_new_value("kmos.kmo_sky_tweak.tbsub",
+ CPL_TYPE_BOOL,
+ "Subtract thermal background from input cube."
+ "(TRUE (apply) or "
+ "FALSE (don't apply)",
+ "kmos.kmo_sky_tweak",
+ TRUE);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "tbsub");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
return 0;
}
@@ -195,7 +211,8 @@ static int kmo_sky_tweak(cpl_parameterlist *parlist, cpl_frameset *frameset)
nr_obj_devices = 0,
nr_sky_devices = 0,
ifu_nr = 0,
- index = 0;
+ index = 0,
+ tbsub = TRUE;
const char *obj_fn = NULL,
*sky_fn = NULL;
@@ -236,6 +253,8 @@ static int kmo_sky_tweak(cpl_parameterlist *parlist, cpl_frameset *frameset)
CPL_ERROR_ILLEGAL_INPUT,
"Cannot identify RAW and CALIB frames!");
+ tbsub = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_sky_tweak.tbsub");
+ KMO_TRY_CHECK_ERROR_STATE();
nr_object_frames = cpl_frameset_count_tags(frameset, CUBE_OBJECT);
KMO_TRY_CHECK_ERROR_STATE();
@@ -332,7 +351,8 @@ static int kmo_sky_tweak(cpl_parameterlist *parlist, cpl_frameset *frameset)
// obj_noise = kmclipm_imagelist_load(obj_fn, CPL_TYPE_FLOAT, index));
KMO_TRY_EXIT_IF_NULL(
- tweaked_data = kmo_priv_sky_tweak (obj_data, sky_data, sub_header, .3));
+ tweaked_data = kmo_priv_sky_tweak (obj_data, sky_data,
+ sub_header, .3, tbsub));
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_save_cube(tweaked_data, SKY_TWEAK, "", sub_header, 0./0.));
diff --git a/recipes/kmo_stats.c b/recipes/kmo_stats.c
index 48dee3f..7c3ded3 100644
--- a/recipes/kmo_stats.c
+++ b/recipes/kmo_stats.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_stats.c,v 1.16 2013/05/24 13:35:28 aagudo Exp $
+/* $Id: kmo_stats.c,v 1.16 2013-05-24 13:35:28 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/24 13:35:28 $
+ * $Date: 2013-05-24 13:35:28 $
* $Revision: 1.16 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
diff --git a/recipes/kmo_std_star.c b/recipes/kmo_std_star.c
index 819f3fc..a050506 100644
--- a/recipes/kmo_std_star.c
+++ b/recipes/kmo_std_star.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_std_star.c,v 1.75 2013/08/02 18:03:53 aagudo Exp $
+/* $Id: kmo_std_star.c,v 1.79 2013/10/08 14:55:01 erw Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -19,10 +19,10 @@
*/
/*
- * $Author: aagudo $
- * $Date: 2013/08/02 18:03:53 $
- * $Revision: 1.75 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Author: erw $
+ * $Date: 2013/10/08 14:55:01 $
+ * $Revision: 1.79 $
+ * $Name: $
*/
#ifdef HAVE_CONFIG_H
@@ -1122,10 +1122,6 @@ KMO_TRY_CHECK_ERROR_STATE();
kmo_check_frame_setup(frameset, XCAL, MASTER_FLAT, TRUE, FALSE, TRUE));
KMO_TRY_EXIT_IF_ERROR(
kmo_check_frame_setup(frameset, XCAL, STD, FALSE, FALSE, TRUE));
-// KMO_TRY_EXIT_IF_ERROR(
-// kmo_check_cal_frames_rotangle(frameset, XCAL, YCAL));
-// KMO_TRY_EXIT_IF_ERROR(
-// kmo_check_cal_frames_rotangle(frameset, XCAL, LCAL));
if (cpl_frameset_count_tags(frameset, ILLUM_CORR) == 1) {
KMO_TRY_EXIT_IF_ERROR(
@@ -1362,12 +1358,12 @@ KMO_TRY_CHECK_ERROR_STATE();
// setup grid definition, wavelength start and end points will be set
// in the detector loop
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_setup_grid(&gd, imethod, neighborhoodRange, KMOS_PIX_RESOLUTION));
+ kmclipm_setup_grid(&gd, imethod, neighborhoodRange, KMOS_PIX_RESOLUTION, 0.));
// get valid STD frames with objects in it and associated sky exposures
KMO_TRY_EXIT_IF_NULL(
obj_sky_struct = kmo_create_objSkyStruct(frameset_std, STD, FALSE));
- kmo_debug_objSkyStruct(frameset, obj_sky_struct);
+ kmo_print_objSkyStruct(obj_sky_struct);
// loop the object-sky pairs
if (obj_sky_struct->size == 0) {
@@ -1392,12 +1388,14 @@ KMO_TRY_CHECK_ERROR_STATE();
// extract LCAL image close to ROTANGLE 0. assuming that the wavelength range
// doesn't differ too much with different ROTANGLEs.
print_cal_angle_msg_once = FALSE;
+ print_xcal_angle_msg_once = FALSE;
double rotangle_found;
KMO_TRY_EXIT_IF_NULL(
lcal = kmo_dfs_load_cal_image(frameset, LCAL, i, FALSE, 0., FALSE, NULL,
&rotangle_found, -1, 0, 0));
if (i==1) {
print_cal_angle_msg_once = TRUE;
+ print_xcal_angle_msg_once = TRUE;
}
if (tmp_band_method != NULL) {
band_method = atoi(tmp_band_method);
diff --git a/recipes/kmo_wave_cal.c b/recipes/kmo_wave_cal.c
index b06e3bf..a5ea729 100644
--- a/recipes/kmo_wave_cal.c
+++ b/recipes/kmo_wave_cal.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_wave_cal.c,v 1.53 2013/08/07 14:40:46 aagudo Exp $
+/* $Id: kmo_wave_cal.c,v 1.54 2013-09-17 08:54:03 aagudo Exp $
*
* This file is part of the KMOS Pipeline
* Copyright (C) 2002,2003 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/07 14:40:46 $
- * $Revision: 1.53 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-09-17 08:54:03 $
+ * $Revision: 1.54 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -1153,14 +1153,15 @@ static int kmo_wave_cal(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_propertylist_erase(stored_sub_headers_lcal[sx], CDELT1);
cpl_propertylist_erase(stored_sub_headers_lcal[sx], CDELT2);
- cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX1);
- cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX2);
- if (cpl_propertylist_has(stored_sub_headers_lcal[sx], CRPIX1)) {
- cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX1);
- }
- if (cpl_propertylist_has(stored_sub_headers_lcal[sx], CRPIX2)) {
- cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX2);
- }
+// leave keywords in for proper fitsverify output
+// cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX1);
+// cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX2);
+// if (cpl_propertylist_has(stored_sub_headers_lcal[sx], CRPIX1)) {
+// cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX1);
+// }
+// if (cpl_propertylist_has(stored_sub_headers_lcal[sx], CRPIX2)) {
+// cpl_propertylist_erase(stored_sub_headers_lcal[sx], CRPIX2);
+// }
// free memory
cpl_image_delete(det_lamp_on); det_lamp_on = NULL;
diff --git a/recipes/tests/Makefile.am b/recipes/tests/Makefile.am
index 1aea0c5..2d8a858 100644
--- a/recipes/tests/Makefile.am
+++ b/recipes/tests/Makefile.am
@@ -55,6 +55,7 @@ check_PROGRAMS = kmo_arithmetic-test \
kmo_wave_cal-test \
kmo_reconstruct-test \
kmo_illumination-test \
+ kmo_illumination_flat-test \
kmo_std_star-test \
kmo_sci_red-test \
kmo_multi_reconstruct-test \
@@ -138,6 +139,10 @@ kmo_illumination_test_SOURCES = kmo_illumination-test.c
kmo_illumination_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_illumination_test_LDADD = $(LDADD)
+kmo_illumination_flat_test_SOURCES = kmo_illumination_flat-test.c
+kmo_illumination_flat_test_LDFLAGS = $(CPL_LDFLAGS)
+kmo_illumination_flat_test_LDADD = $(LDADD)
+
kmo_std_star_test_SOURCES = kmo_std_star-test.c
kmo_std_star_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_std_star_test_LDADD = $(LDADD)
diff --git a/recipes/tests/Makefile.in b/recipes/tests/Makefile.in
index e255fa1..1d98774 100644
--- a/recipes/tests/Makefile.in
+++ b/recipes/tests/Makefile.in
@@ -44,8 +44,8 @@ check_PROGRAMS = kmo_arithmetic-test$(EXEEXT) \
kmo_stats-test$(EXEEXT) kmo_dark-test$(EXEEXT) \
kmo_flat-test$(EXEEXT) kmo_wave_cal-test$(EXEEXT) \
kmo_reconstruct-test$(EXEEXT) kmo_illumination-test$(EXEEXT) \
- kmo_std_star-test$(EXEEXT) kmo_sci_red-test$(EXEEXT) \
- kmo_multi_reconstruct-test$(EXEEXT) \
+ kmo_illumination_flat-test$(EXEEXT) kmo_std_star-test$(EXEEXT) \
+ kmo_sci_red-test$(EXEEXT) kmo_multi_reconstruct-test$(EXEEXT) \
kmo_fits_strip-test$(EXEEXT) leak_check-test$(EXEEXT)
subdir = recipes/tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
@@ -141,6 +141,15 @@ kmo_illumination_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_illumination_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_illumination_test_LDFLAGS) $(LDFLAGS) -o $@
+am_kmo_illumination_flat_test_OBJECTS = \
+ kmo_illumination_flat-test.$(OBJEXT)
+kmo_illumination_flat_test_OBJECTS = \
+ $(am_kmo_illumination_flat_test_OBJECTS)
+kmo_illumination_flat_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
+kmo_illumination_flat_test_LINK = $(LIBTOOL) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(kmo_illumination_flat_test_LDFLAGS) \
+ $(LDFLAGS) -o $@
am_kmo_make_image_test_OBJECTS = kmo_make_image-test.$(OBJEXT)
kmo_make_image_test_OBJECTS = $(am_kmo_make_image_test_OBJECTS)
kmo_make_image_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
@@ -235,6 +244,7 @@ SOURCES = $(kmo_arithmetic_test_SOURCES) $(kmo_combine_test_SOURCES) \
$(kmo_fit_profile_test_SOURCES) $(kmo_fits_check_test_SOURCES) \
$(kmo_fits_stack_test_SOURCES) $(kmo_fits_strip_test_SOURCES) \
$(kmo_flat_test_SOURCES) $(kmo_illumination_test_SOURCES) \
+ $(kmo_illumination_flat_test_SOURCES) \
$(kmo_make_image_test_SOURCES) \
$(kmo_multi_reconstruct_test_SOURCES) \
$(kmo_noise_map_test_SOURCES) $(kmo_reconstruct_test_SOURCES) \
@@ -249,6 +259,7 @@ DIST_SOURCES = $(kmo_arithmetic_test_SOURCES) \
$(kmo_fit_profile_test_SOURCES) $(kmo_fits_check_test_SOURCES) \
$(kmo_fits_stack_test_SOURCES) $(kmo_fits_strip_test_SOURCES) \
$(kmo_flat_test_SOURCES) $(kmo_illumination_test_SOURCES) \
+ $(kmo_illumination_flat_test_SOURCES) \
$(kmo_make_image_test_SOURCES) \
$(kmo_multi_reconstruct_test_SOURCES) \
$(kmo_noise_map_test_SOURCES) $(kmo_reconstruct_test_SOURCES) \
@@ -517,6 +528,9 @@ kmo_reconstruct_test_LDADD = $(LDADD)
kmo_illumination_test_SOURCES = kmo_illumination-test.c
kmo_illumination_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_illumination_test_LDADD = $(LDADD)
+kmo_illumination_flat_test_SOURCES = kmo_illumination_flat-test.c
+kmo_illumination_flat_test_LDFLAGS = $(CPL_LDFLAGS)
+kmo_illumination_flat_test_LDADD = $(LDADD)
kmo_std_star_test_SOURCES = kmo_std_star-test.c
kmo_std_star_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_std_star_test_LDADD = $(LDADD)
@@ -619,6 +633,9 @@ kmo_flat-test$(EXEEXT): $(kmo_flat_test_OBJECTS) $(kmo_flat_test_DEPENDENCIES) $
kmo_illumination-test$(EXEEXT): $(kmo_illumination_test_OBJECTS) $(kmo_illumination_test_DEPENDENCIES) $(EXTRA_kmo_illumination_test_DEPENDENCIES)
@rm -f kmo_illumination-test$(EXEEXT)
$(kmo_illumination_test_LINK) $(kmo_illumination_test_OBJECTS) $(kmo_illumination_test_LDADD) $(LIBS)
+kmo_illumination_flat-test$(EXEEXT): $(kmo_illumination_flat_test_OBJECTS) $(kmo_illumination_flat_test_DEPENDENCIES) $(EXTRA_kmo_illumination_flat_test_DEPENDENCIES)
+ @rm -f kmo_illumination_flat-test$(EXEEXT)
+ $(kmo_illumination_flat_test_LINK) $(kmo_illumination_flat_test_OBJECTS) $(kmo_illumination_flat_test_LDADD) $(LIBS)
kmo_make_image-test$(EXEEXT): $(kmo_make_image_test_OBJECTS) $(kmo_make_image_test_DEPENDENCIES) $(EXTRA_kmo_make_image_test_DEPENDENCIES)
@rm -f kmo_make_image-test$(EXEEXT)
$(kmo_make_image_test_LINK) $(kmo_make_image_test_OBJECTS) $(kmo_make_image_test_LDADD) $(LIBS)
@@ -674,6 +691,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_fits_strip-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_flat-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_illumination-test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_illumination_flat-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_make_image-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_multi_reconstruct-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_noise_map-test.Po at am__quote@
diff --git a/recipes/tests/kmo_arithmetic-test.c b/recipes/tests/kmo_arithmetic-test.c
index c86162d..8b26fd1 100644
--- a/recipes/tests/kmo_arithmetic-test.c
+++ b/recipes/tests/kmo_arithmetic-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_arithmetic-test.c,v 1.6 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_arithmetic-test.c,v 1.7 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.6 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.7 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -263,7 +263,7 @@ int main(int argc, char *argv[])
op1_file[256],
op2_file[256];
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_combine-test.c b/recipes/tests/kmo_combine-test.c
index f68681a..c02f869 100644
--- a/recipes/tests/kmo_combine-test.c
+++ b/recipes/tests/kmo_combine-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_combine-test.c,v 1.8 2013/06/18 08:27:09 aagudo Exp $
+/* $Id: kmo_combine-test.c,v 1.9 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/18 08:27:09 $
- * $Revision: 1.8 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.9 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -633,7 +633,7 @@ int main(int argc, char *argv[])
FILE *fh;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_copy-test.c b/recipes/tests/kmo_copy-test.c
index 0d9b55f..604c0c1 100644
--- a/recipes/tests/kmo_copy-test.c
+++ b/recipes/tests/kmo_copy-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_copy-test.c,v 1.3 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_copy-test.c,v 1.4 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.3 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.4 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -231,7 +231,7 @@ int main(int argc, char *argv[])
char test_path[256],
in_file[256];
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_dark-test.c b/recipes/tests/kmo_dark-test.c
index cce2b91..36f81c0 100644
--- a/recipes/tests/kmo_dark-test.c
+++ b/recipes/tests/kmo_dark-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_dark-test.c,v 1.9 2013/06/17 07:52:26 aagudo Exp $
+/* $Id: kmo_dark-test.c,v 1.10 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 07:52:26 $
- * $Revision: 1.9 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.10 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -296,7 +296,7 @@ int main(int argc, char *argv[])
ron_median = 0.0,
dark_cur = 0.0;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_dev_setup-test.c b/recipes/tests/kmo_dev_setup-test.c
index 41df5f0..544e34b 100644
--- a/recipes/tests/kmo_dev_setup-test.c
+++ b/recipes/tests/kmo_dev_setup-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_dev_setup-test.c,v 1.4 2013/06/18 07:56:47 aagudo Exp $
+/* $Id: kmo_dev_setup-test.c,v 1.5 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/18 07:56:47 $
- * $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.5 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
cpl_propertylist *h = NULL;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_extract_spec-test.c b/recipes/tests/kmo_extract_spec-test.c
index 8d28fea..1576943 100644
--- a/recipes/tests/kmo_extract_spec-test.c
+++ b/recipes/tests/kmo_extract_spec-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_extract_spec-test.c,v 1.9 2013/05/24 13:35:28 aagudo Exp $
+/* $Id: kmo_extract_spec-test.c,v 1.10 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/24 13:35:28 $
- * $Revision: 1.9 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.10 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -337,7 +337,7 @@ int main(int argc, char *argv[])
cpl_propertylist *h = NULL;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_fit_profile-test.c b/recipes/tests/kmo_fit_profile-test.c
index 63a0858..f6f8247 100644
--- a/recipes/tests/kmo_fit_profile-test.c
+++ b/recipes/tests/kmo_fit_profile-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_fit_profile-test.c,v 1.4 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_fit_profile-test.c,v 1.5 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.5 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -521,7 +521,7 @@ int main(int argc, char *argv[])
cpl_propertylist *h = NULL;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_fits_check-test.c b/recipes/tests/kmo_fits_check-test.c
index 6e5af6a..6678dd0 100644
--- a/recipes/tests/kmo_fits_check-test.c
+++ b/recipes/tests/kmo_fits_check-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_fits_check-test.c,v 1.3 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_fits_check-test.c,v 1.4 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.3 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.4 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -68,7 +68,7 @@ static void test_fits_check(const char *option, int ret_val)
*/
int main()
{
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- run the tests ----- */
FILE *fd = fopen("log_kmo_fits_check.txt", "w");
diff --git a/recipes/tests/kmo_fits_stack-test.c b/recipes/tests/kmo_fits_stack-test.c
index 29601f8..9783614 100644
--- a/recipes/tests/kmo_fits_stack-test.c
+++ b/recipes/tests/kmo_fits_stack-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_fits_stack-test.c,v 1.3 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_fits_stack-test.c,v 1.4 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.3 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.4 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -187,7 +187,7 @@ int main(int argc, char *argv[])
cpl_propertylist *prl = NULL;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_fits_strip-test.c b/recipes/tests/kmo_fits_strip-test.c
index 17fdcbd..589a279 100644
--- a/recipes/tests/kmo_fits_strip-test.c
+++ b/recipes/tests/kmo_fits_strip-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_fits_strip-test.c,v 1.4 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_fits_strip-test.c,v 1.6 2013-10-09 10:44:55 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-09 10:44:55 $
+ * $Revision: 1.6 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -69,7 +69,7 @@ int main()
{
double tol = 0.01;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- run the tests ----- */
FILE *fd = fopen("log_kmo_fits_strip.txt", "w");
@@ -81,7 +81,7 @@ int main()
cpl_test_abs(kmo_test_esorex_data("strip", 1), 26.9946, tol);
test_fits_strip("--empty", "telluric_KKK.fits", 0);
- cpl_test_abs(kmo_test_esorex_data("strip", 1), 8.47981, tol);
+ cpl_test_abs(kmo_test_esorex_data("strip", 1), 11.6164, tol);
test_fits_strip("--angle=0", "master_flat_KKK.fits", 0);
cpl_test_abs(kmo_test_esorex_data("strip", 1), 3.00054, tol);
diff --git a/recipes/tests/kmo_flat-test.c b/recipes/tests/kmo_flat-test.c
index 608e9c3..f42a759 100644
--- a/recipes/tests/kmo_flat-test.c
+++ b/recipes/tests/kmo_flat-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_flat-test.c,v 1.11 2013/06/17 07:52:26 aagudo Exp $
+/* $Id: kmo_flat-test.c,v 1.12 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/17 07:52:26 $
- * $Revision: 1.11 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.12 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -475,7 +475,7 @@ int main(int argc, char *argv[])
cpl_propertylist *h = NULL;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_illumination-test.c b/recipes/tests/kmo_illumination-test.c
index 6a39122..0e107ba 100644
--- a/recipes/tests/kmo_illumination-test.c
+++ b/recipes/tests/kmo_illumination-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_illumination-test.c,v 1.16 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_illumination-test.c,v 1.17 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.16 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.17 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
cpl_propertylist *h = NULL;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_illumination-test.c b/recipes/tests/kmo_illumination_flat-test.c
similarity index 70%
copy from recipes/tests/kmo_illumination-test.c
copy to recipes/tests/kmo_illumination_flat-test.c
index 6a39122..1c9fd03 100644
--- a/recipes/tests/kmo_illumination-test.c
+++ b/recipes/tests/kmo_illumination_flat-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_illumination-test.c,v 1.16 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_illumination_flat-test.c,v 1.1 2013-10-21 13:44:55 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.16 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-21 13:44:55 $
+ * $Revision: 1.1 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -37,24 +37,24 @@
#include "kmo_dfs.h"
#include "kmo_test_create_data.h"
-const char *path_recipe = "kmo_illumination/";
+const char *path_recipe = "kmo_illumination_flat/";
-const char *valid_files[] = {"sky_123.fits",
- "sky_231.fits",
- "sky_312.fits"};
+const char *valid_files[] = {"flat_on_123.fits",
+ "flat_on_231.fits",
+ "flat_on_312.fits"};
/**
- @defgroup kmo_illumination kmo_illumination unit tests
+ @defgroup kmo_illumination_flat kmo_illumination_flat unit tests
*/
/**
- @brief Test of kmo_illumination recipe.
+ @brief Test of kmo_illumination_flat recipe.
@param argc the number of parameters
@param argv the parameter list
- Call @c kmo_illumination-test @c --generate when only the test data for this
+ Call @c kmo_illumination_flat-test @c --generate when only the test data for this
recipe should be generated.
- Call @c kmo_illumination-test @c --no-gen when only the tests should be
+ Call @c kmo_illumination_flat-test @c --no-gen when only the tests should be
executed and no data should be generated.
*/
int main(int argc, char *argv[])
@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
cpl_propertylist *h = NULL;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
kmo_test_create_pipeline_data();
}
- cpl_msg_info(cpl_func, "Testing kmo_illumination with real "
+ cpl_msg_info(cpl_func, "Testing kmo_illumination_flat with real "
"pipeline data.");
sprintf(test_path, "%s%s", test_global_path_test_data, "pipeline/");
@@ -92,7 +92,7 @@ int main(int argc, char *argv[])
if ((argc == 5) && (strcmp(argv[1], "xxx") != 0)) {
}
- FILE *fd = fopen("log_kmo_illumination.txt", "w");
+ FILE *fd = fopen("log_kmo_illumination_flat.txt", "w");
fprintf(fd, "%s\n", " ");
fclose(fd);
@@ -107,11 +107,9 @@ int main(int argc, char *argv[])
// create sof-file
FILE *fh = fopen(sof_path, "w");
fprintf (fh,
- "%s FLAT_SKY\n"
- "%s FLAT_SKY\n"
- "%s FLAT_SKY\n"
- "master_dark.fits MASTER_DARK\n"
- "master_flat_KKK.fits MASTER_FLAT\n"
+ "%s FLAT_SKY_FLAT\n"
+ "%s FLAT_SKY_FLAT\n"
+ "%s FLAT_SKY_FLAT\n"
"xcal_KKK.fits XCAL\n"
"ycal_KKK.fits YCAL\n"
"lcal_KKK.fits LCAL\n"
@@ -121,18 +119,18 @@ int main(int argc, char *argv[])
// create esorex-command
sprintf(esorex_command,
- "esorex --suppress-prefix=TRUE kmo_illumination "
- "--add-all --imethod=NN --b_start=1.948 --b_end=2.351 %s", sof_path);
+ "esorex --suppress-prefix=TRUE kmo_illumination_flat "
+ "--imethod=NN --b_start=1.948 --b_end=2.351 %s", sof_path);
kmo_get_pipe_command(esorex_command,
- "log_kmo_illumination.txt", sof_path, TRUE);
+ "log_kmo_illumination_flat.txt", sof_path, TRUE);
// execute esorex-command
cpl_test_eq(0, system(esorex_command));
// checking output
strcpy(file_path, "illum_corr_KKK");
- cpl_test_abs(kmo_test_esorex_data(file_path, 1), 24.7136, tol);
+ cpl_test_abs(kmo_test_esorex_data(file_path, 1), 87.0973, tol);
strcat(file_path, ".fits");
h = kmclipm_propertylist_load(file_path, 0);
@@ -141,7 +139,7 @@ int main(int argc, char *argv[])
cpl_test_abs(cpl_propertylist_get_double(h, QC_SPAT_MAX_DEV),
0.00448508 , tol);
cpl_test_abs(cpl_propertylist_get_double(h, QC_SPAT_MAX_NONUNIF),
- 0.0332622, tol);
+ 0.00131134, tol);
cpl_propertylist_delete(h); h = NULL;
return cpl_test_end(0);
diff --git a/recipes/tests/kmo_make_image-test.c b/recipes/tests/kmo_make_image-test.c
index 61097c4..979fc14 100644
--- a/recipes/tests/kmo_make_image-test.c
+++ b/recipes/tests/kmo_make_image-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_make_image-test.c,v 1.6 2013/06/07 13:39:21 aagudo Exp $
+/* $Id: kmo_make_image-test.c,v 1.7 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/07 13:39:21 $
- * $Revision: 1.6 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.7 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -246,7 +246,7 @@ int main(int argc, char *argv[])
const char *sof_path = "oh.sof";
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_multi_reconstruct-test.c b/recipes/tests/kmo_multi_reconstruct-test.c
index 1c94d64..99cf021 100644
--- a/recipes/tests/kmo_multi_reconstruct-test.c
+++ b/recipes/tests/kmo_multi_reconstruct-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_multi_reconstruct-test.c,v 1.10 2013/08/02 14:55:13 aagudo Exp $
+/* $Id: kmo_multi_reconstruct-test.c,v 1.12 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/02 14:55:13 $
- * $Revision: 1.10 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.12 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -61,6 +61,7 @@ static void test_multi_reconstruct(const char *path1, const char *path2, int ret
fprintf (fh,
"%s SCIENCE\n"
"%s SCIENCE\n"
+ "master_flat_KKK.fits MASTER_FLAT\n"
"xcal_KKK.fits XCAL\n"
"ycal_KKK.fits YCAL\n"
"lcal_KKK.fits LCAL\n"
@@ -105,7 +106,7 @@ int main(int argc, char *argv[])
op_file1[256],
op_file2[256];
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
@@ -140,10 +141,10 @@ int main(int argc, char *argv[])
kmo_test_cat_strings(op_file2, test_path, valid_files[1]);
test_multi_reconstruct(op_file1, op_file2, 0);
- strcpy(file_path, "cube_multi_fdf_086");
- if (fabs(kmo_test_esorex_data(file_path, 1)-7995.85) < tol) {
+ strcpy(file_path, "cube_multi_FDF_086");
+ if (fabs(kmo_test_esorex_data(file_path, 1)-291.216) < tol) {
// Linux
- cpl_test_abs(kmo_test_esorex_data(file_path, 1), 7995.85, tol);
+ cpl_test_abs(kmo_test_esorex_data(file_path, 1), 291.216, tol);
} else {
// Mac
cpl_test_abs(kmo_test_esorex_data(file_path, 1), 8132.22, tol);
diff --git a/recipes/tests/kmo_noise_map-test.c b/recipes/tests/kmo_noise_map-test.c
index 7c06619..1122ffa 100644
--- a/recipes/tests/kmo_noise_map-test.c
+++ b/recipes/tests/kmo_noise_map-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_noise_map-test.c,v 1.4 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_noise_map-test.c,v 1.5 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.5 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -146,7 +146,7 @@ int main(int argc, char *argv[])
char test_path[256],
file[256];
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_reconstruct-test.c b/recipes/tests/kmo_reconstruct-test.c
index 0f6419b..c12cf5a 100644
--- a/recipes/tests/kmo_reconstruct-test.c
+++ b/recipes/tests/kmo_reconstruct-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_reconstruct-test.c,v 1.11 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_reconstruct-test.c,v 1.12 2013-10-08 11:19:14 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.11 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:19:14 $
+ * $Revision: 1.12 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
char test_path[256],
op_file[256];
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_rotate-test.c b/recipes/tests/kmo_rotate-test.c
index dc66825..78b9716 100644
--- a/recipes/tests/kmo_rotate-test.c
+++ b/recipes/tests/kmo_rotate-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_rotate-test.c,v 1.7 2013/06/07 15:51:37 aagudo Exp $
+/* $Id: kmo_rotate-test.c,v 1.8 2013-10-08 11:18:56 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/06/07 15:51:37 $
- * $Revision: 1.7 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:56 $
+ * $Revision: 1.8 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -288,7 +288,7 @@ int main(int argc, char *argv[])
int tmp_int;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_sci_red-test.c b/recipes/tests/kmo_sci_red-test.c
index 8149ca7..cc87e0b 100644
--- a/recipes/tests/kmo_sci_red-test.c
+++ b/recipes/tests/kmo_sci_red-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_sci_red-test.c,v 1.13 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_sci_red-test.c,v 1.15 2013-10-08 11:18:57 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.13 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:57 $
+ * $Revision: 1.15 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -108,7 +108,7 @@ int main(int argc, char *argv[])
op_file1[256],
op_file2[256];
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
@@ -145,7 +145,7 @@ int main(int argc, char *argv[])
strcpy(file_path, "sci_reconstructed_science_obj_123");
cpl_test_abs(kmo_test_esorex_data(file_path, 1), 1.44976e+08, tol*1.6e9);
- strcpy(file_path, "sci_combined_AAA");
+ strcpy(file_path, "sci_combined_AAA__telluric_illum");
if (fabs(kmo_test_esorex_data(file_path, 1) - 256.167) < tol*1e4) {
// Linux
cpl_test_abs(kmo_test_esorex_data(file_path, 1), 256.167, tol*1e4);
@@ -153,11 +153,11 @@ int main(int argc, char *argv[])
// Mac
cpl_test_abs(kmo_test_esorex_data(file_path, 1), 12200.1, tol*1e4);
}
- strcpy(file_path, "sci_combined_BBB");
+ strcpy(file_path, "sci_combined_BBB__telluric_illum");
cpl_test_abs(kmo_test_esorex_data(file_path, 1), 24788.7, tol*1e8);
- strcpy(file_path, "sci_combined_CCC");
+ strcpy(file_path, "sci_combined_CCC__telluric_illum");
cpl_test_abs(kmo_test_esorex_data(file_path, 1), 33555.5, tol*1e8);
- strcpy(file_path, "sci_combined_DDD");
+ strcpy(file_path, "sci_combined_DDD__telluric_illum");
if (fabs(kmo_test_esorex_data(file_path, 1) - 511.939) < tol*1e4) {
// Linux
cpl_test_abs(kmo_test_esorex_data(file_path, 1), 511.939, tol*1e4);
@@ -165,9 +165,9 @@ int main(int argc, char *argv[])
// Mac
cpl_test_abs(kmo_test_esorex_data(file_path, 1), 41467.9, tol*1e4);
}
- strcpy(file_path, "sci_combined_FDF_070");
+ strcpy(file_path, "sci_combined_FDF_070__telluric_illum");
cpl_test_abs(kmo_test_esorex_data(file_path, 1), 24788.7, tol*1e8);
- strcpy(file_path, "sci_combined_FDF_086");
+ strcpy(file_path, "sci_combined_FDF_086__telluric_illum");
if (fabs(kmo_test_esorex_data(file_path, 1) - 255.589) < tol*1e4) {
// Linux
cpl_test_abs(kmo_test_esorex_data(file_path, 1), 255.589, tol*1e4);
diff --git a/recipes/tests/kmo_shift-test.c b/recipes/tests/kmo_shift-test.c
index 670e6c5..8b04e48 100644
--- a/recipes/tests/kmo_shift-test.c
+++ b/recipes/tests/kmo_shift-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_shift-test.c,v 1.6 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_shift-test.c,v 1.7 2013-10-08 11:18:57 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.6 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:57 $
+ * $Revision: 1.7 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -289,7 +289,7 @@ int main(int argc, char *argv[])
int tmp_int;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_sky_mask-test.c b/recipes/tests/kmo_sky_mask-test.c
index 72f4a78..6d92201 100644
--- a/recipes/tests/kmo_sky_mask-test.c
+++ b/recipes/tests/kmo_sky_mask-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_sky_mask-test.c,v 1.4 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_sky_mask-test.c,v 1.5 2013-10-08 11:18:57 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.4 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:57 $
+ * $Revision: 1.5 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -169,7 +169,7 @@ int main(int argc, char *argv[])
char test_path[256],
op1_file[256];
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_stats-test.c b/recipes/tests/kmo_stats-test.c
index 583bc10..f07178e 100644
--- a/recipes/tests/kmo_stats-test.c
+++ b/recipes/tests/kmo_stats-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_stats-test.c,v 1.8 2013/05/24 13:35:28 aagudo Exp $
+/* $Id: kmo_stats-test.c,v 1.9 2013-10-08 11:18:57 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/24 13:35:28 $
- * $Revision: 1.8 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:57 $
+ * $Revision: 1.9 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -286,7 +286,7 @@ int main(int argc, char *argv[])
op1_file[256],
op2_file[256];
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/kmo_std_star-test.c b/recipes/tests/kmo_std_star-test.c
index 4790c54..ea35f93 100644
--- a/recipes/tests/kmo_std_star-test.c
+++ b/recipes/tests/kmo_std_star-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_std_star-test.c,v 1.25 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: kmo_std_star-test.c,v 1.28 2013-10-21 13:44:55 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.25 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-21 13:44:55 $
+ * $Revision: 1.28 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -129,7 +129,7 @@ int main(int argc, char *argv[])
cpl_propertylist *h = NULL;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
@@ -169,7 +169,7 @@ int main(int argc, char *argv[])
// check std_image_KKK.fits
strcpy(file_path, "std_image_KKK");
- cpl_test_abs(kmo_test_esorex_data(file_path, 1), 11092.9, tol*10500);
+ cpl_test_abs(kmo_test_esorex_data(file_path, 1), 10943.4, tol*10500);
strcat(file_path, ".fits");
h = kmclipm_propertylist_load(file_path, 0);
@@ -185,7 +185,7 @@ int main(int argc, char *argv[])
h = kmclipm_propertylist_load(file_path, 2);
cpl_test_abs(cpl_propertylist_get_double(h, QC_SPAT_RES), 0.544499, tol);
- cpl_test_abs(cpl_propertylist_get_double(h, QC_STD_TRACE), 0.921169, tol);
+ cpl_test_abs(cpl_propertylist_get_double(h, QC_STD_TRACE), 0.906642, tol);
cpl_test_eq(cpl_propertylist_has(h, QC_NR_STD_STARS), 0);
cpl_test_eq(cpl_propertylist_has(h, QC_THROUGHPUT_SDV), 0);
cpl_test_eq(cpl_propertylist_has(h, QC_THROUGHPUT_MEAN), 0);
@@ -196,7 +196,7 @@ int main(int argc, char *argv[])
// check telluric_KKK.fits
strcpy(file_path, "telluric_KKK");
- cpl_test_abs(kmo_test_esorex_data(file_path, 1), 8.47981, .3);
+ cpl_test_abs(kmo_test_esorex_data(file_path, 1), 11.6164, .3);
strcat(file_path, ".fits");
h = kmclipm_propertylist_load(file_path, 0);
diff --git a/recipes/tests/kmo_wave_cal-test.c b/recipes/tests/kmo_wave_cal-test.c
index 3c30e53..cf090bf 100644
--- a/recipes/tests/kmo_wave_cal-test.c
+++ b/recipes/tests/kmo_wave_cal-test.c
@@ -1,4 +1,4 @@
-/* $Id: kmo_wave_cal-test.c,v 1.21 2013/08/07 15:30:22 aagudo Exp $
+/* $Id: kmo_wave_cal-test.c,v 1.22 2013-10-08 11:18:57 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/08/07 15:30:22 $
- * $Revision: 1.21 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:57 $
+ * $Revision: 1.22 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -119,7 +119,7 @@ int main(int argc, char *argv[])
cpl_propertylist *h = NULL;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
diff --git a/recipes/tests/leak_check-test.c b/recipes/tests/leak_check-test.c
index aa38c15..ff153fb 100644
--- a/recipes/tests/leak_check-test.c
+++ b/recipes/tests/leak_check-test.c
@@ -1,4 +1,4 @@
-/* $Id: leak_check-test.c,v 1.2 2013/05/21 12:13:58 aagudo Exp $
+/* $Id: leak_check-test.c,v 1.3 2013-10-08 11:18:57 aagudo Exp $
*
* This file is part of the KMOS Library
* Copyright (C) 2002-2006 European Southern Observatory
@@ -20,9 +20,9 @@
/*
* $Author: aagudo $
- * $Date: 2013/05/21 12:13:58 $
- * $Revision: 1.2 $
- * $Name: kmosp_v1_2_4__20130807 $
+ * $Date: 2013-10-08 11:18:57 $
+ * $Revision: 1.3 $
+ * $Name: not supported by cvs2svn $
*/
#ifdef HAVE_CONFIG_H
@@ -49,7 +49,7 @@ int main()
{
int ret = 0;
- cpl_test_init("Alex Agudo Berbel <kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
// run bash-script to examine all generated log_*.txt files in
// kmosp/recipes/tests
diff --git a/reflex/kmo_wave_cal.py b/reflex/kmo_wave_cal.py
index 159ab26..1c8cf9f 100755
--- a/reflex/kmo_wave_cal.py
+++ b/reflex/kmo_wave_cal.py
@@ -12,22 +12,6 @@ except ImportError:
import_success = False
print "Error importing modules pyfits, wx, matplotlib, numpy"
-class ImageDisplayLocal(pipeline_display.ImageDisplay):
- def setZAutoLimits(self, image, bpmimage):
- """This method specifies computes optimal values for limits of the image
- values (z variable). It uses a sigma clipping, with a clipping of
- 2 sigma, to get a better estimate of the deviation. It should be
- called before the display method()"""
- if bpmimage is not None:
- image_bpm = image[bpmimage==0]
- self.avg=numpy.median(image_bpm)
- self.dev=2*image_bpm[numpy.abs(image_bpm-self.avg)<2*image_bpm.std()].std()
- else:
- self.avg=numpy.median(image[numpy.isfinite(image)])
- self.dev=2*image[numpy.abs(image-self.avg)<2*image[numpy.isfinite(image)].std()].std()
- self.z_min = self.avg-self.dev
- self.z_max = self.avg+self.dev
-
class ScatterDisplayLocal(pipeline_display.ScatterDisplay):
def setErrorBar(self, subplot, x, y, error):
subplot.errorbar(x, y, yerr=error, fmt='-o')
@@ -170,8 +154,7 @@ class DataPlotterManager(object):
# Setup the image display
for i in range(18):
- # ImageDisplayLocal fixes setZAutoLimits bug regarding NaN support
- imgdisp = ImageDisplayLocal()
+ imgdisp = pipeline_display.ImageDisplay()
# Title gives the Detector number at the top of the column
if i == 0:
title = "Detector 1"
diff --git a/reflex/kmos.xml.in b/reflex/kmos.xml.in
index ae106a9..4359765 100644
--- a/reflex/kmos.xml.in
+++ b/reflex/kmos.xml.in
@@ -2,7 +2,7 @@
<!DOCTYPE entity PUBLIC "-//UC Berkeley//DTD MoML 1//EN"
"http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd">
<entity name="kmos" class="org.kepler.moml.CompositeClassEntity">
- <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:43289:64:21">
+ <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:46342:8:182">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.kepler.moml.CompositeClassEntity">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
@@ -34,11 +34,11 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
-<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
-<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
-<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
@@ -83,11 +83,11 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
-<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
-<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
-<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
@@ -132,11 +132,11 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
-<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
-<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
-<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
@@ -155,7 +155,7 @@
<property name="_renderFirst" class="ptolemy.kernel.util.SingletonAttribute">
</property>
</property>
- <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="8.1.devel">
+ <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="9.1.devel">
</property>
<property name="ROOT_DATA_DIR" class="ptolemy.data.expr.FileParameter" value="ROOT_DATA_PATH_TO_REPLACE/">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
@@ -394,7 +394,7 @@
<property name="allowDirectories" class="ptolemy.data.expr.Parameter" value="true">
</property>
</property>
- <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={456, 58, 1833, 1155}, maximized=false}">
+ <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={87, 1, 1833, 1155}, maximized=false}">
</property>
<property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[1523, 1005]">
</property>
@@ -493,11 +493,11 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
-<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
-<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
-<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
@@ -607,11 +607,11 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
-<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
-<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
-<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
@@ -976,13 +976,13 @@
<property name="_location" class="ptolemy.kernel.util.Location" value="[745.0, 275.0]">
</property>
</property>
- <property name="END_PRODUCT_SUBDIR" class="ptolemy.data.expr.StringParameter" value="2013-09-05T18:00:25/KMOS.2013-06-30T23:48:06.049_tpl">
+ <property name="END_PRODUCTS_SUBDIR" class="ptolemy.data.expr.StringParameter" value="2013-10-29T11:50:16/KMOS.2013-06-30T23:48:06.049_tpl">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>StringParameter specifies a persistent string. </p>
<p>Change the name of the StringParameter to better identify the specified value (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the StringParameter using the $NAME syntax (e.g. $Parameter).
</p></configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:421:1">
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:46342:9:1">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.StringParameter">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1185:1">
@@ -1009,8 +1009,10 @@
</property>
<property name="_location" class="ptolemy.kernel.util.Location" value="[485.0, 1190.0]">
</property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:421:1">
+ </property>
</property>
- <property name="GLOBAL_TIMESTAMP" class="ptolemy.data.expr.StringParameter" value="2013-09-05T18:00:25">
+ <property name="GLOBAL_TIMESTAMP" class="ptolemy.data.expr.StringParameter" value="2013-10-29T11:50:16">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
@@ -1119,11 +1121,11 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
-<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
-<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
-<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
@@ -1211,11 +1213,11 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
-<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
-<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
-<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
@@ -1335,15 +1337,15 @@
</property>
<property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[1145.0, 460.0]">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="1145.0, 460.0">
</property>
<property name="lineWidth" class="ptolemy.data.expr.Parameter" value="5">
</property>
<property name="lineColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
</property>
- <property name="width" class="ptolemy.data.expr.Parameter" value="182.0">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="225.0">
</property>
- <property name="height" class="ptolemy.data.expr.Parameter" value="143.0">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="145.0">
</property>
<property name="centered" class="ptolemy.data.expr.Parameter" value="false">
</property>
@@ -1356,15 +1358,15 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
-<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
-<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
-<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:275:2">
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:46342:16:1">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.RectangleAttribute">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1197:1">
@@ -1374,7 +1376,7 @@
</property>
<property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:434:1:urn:lsid:kepler-project.org/ns/:14094:56:1:urn:lsid:kepler-project.org/ns/:21155:113:2:urn:lsid:kepler-project.org/ns/:29452:71:2">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:434:1:urn:lsid:kepler-project.org/ns/:14094:56:1:urn:lsid:kepler-project.org/ns/:21155:113:2:urn:lsid:kepler-project.org/ns/:29452:71:2:urn:lsid:kepler-project.org/ns/:31617:275:2">
</property>
</property>
<property name="Annotation39" class="ptolemy.vergil.kernel.attributes.TextAttribute">
@@ -1434,8 +1436,8 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Gang Zhou</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
<p> The dynamic dataflow (DDF) domain is a superset of the synchronous
dataflow(SDF) and Boolean dataflow(BDF) domains. In the SDF domain,
an actor consumes and produces a fixed number of tokens per firing.
This static information makes possible compile-time scheduling. In the
DDF domain, there are few [...]
-<property name="prop:iterations" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify the number of times a workflow is iterated. By default, this parameter is set to "0". Note that "0" does not mean "no iterations." Rather, "0" means that the workflow will iterate forever. Values greater than zero specify the actual number of times the director should execute the entire workflow. </configure></property>
<property name="prop:maximumReceiverCapacity" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A Parameter representing the maximum capacity of each receiver controlled by this director. This is an integer that defaults to 0, which means the queue in each receiver is unbounded. To specify bounded queues, set this to a positive integer. </configure></property>
+<property name="prop:iterations" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify the number of times a workflow is iterated. By default, this parameter is set to "0". Note that "0" does not mean "no iterations." Rather, "0" means that the workflow will iterate forever. Values greater than zero specify the actual number of times the director should execute the entire workflow. </configure></property>
<property name="prop:runUntilDeadlockInOneIteration" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A parameter indicating whether one iteration consists of repeated basic iterations until deadlock. If this parameter is true, the model will be executed until deadlock in one iteration. The default value is a BooleanToken with the value false. It cannot be set to true if this director is at the top level.</configure></property>
</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:director:5:1">
</property>
@@ -1541,12 +1543,12 @@
</property>
<property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[1165.0, 485.0]">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[1180.0, 490.0]">
</property>
<property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:436:1:urn:lsid:kepler-project.org/ns/:21155:114:1">
</property>
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:436:1:urn:lsid:kepler-project.org/ns/:12776:4:415:urn:lsid:kepler-project.org/ns/:12776:55:75:urn:lsid:kepler-project.org/ns/:12776:59:142:urn:lsid:kepler-project.org/ns/:12776:68:228:urn:lsid:kepler-project.org/ns/:12776:84:51:urn:lsid:kepler-project.org/ns/:2745:31:9:urn:lsid:kepler-project.org/ns/:2745:32:214:urn:lsid:kepler-project.org/ns/:2745:45:122:urn:lsid:kepl [...]
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:436:1:urn:lsid:kepler-project.org/ns/:12776:4:415:urn:lsid:kepler-project.org/ns/:12776:55:75:urn:lsid:kepler-project.org/ns/:12776:59:142:urn:lsid:kepler-project.org/ns/:12776:68:228:urn:lsid:kepler-project.org/ns/:12776:84:51:urn:lsid:kepler-project.org/ns/:2745:31:9:urn:lsid:kepler-project.org/ns/:2745:32:214:urn:lsid:kepler-project.org/ns/:2745:45:122:urn:lsid:kepl [...]
</property>
<property name="CALIB_DATA_DIR" class="ptolemy.data.expr.FileParameter" value="CALIB_DATA_PATH_TO_REPLACE/kmos- at VERSION@/">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
@@ -2021,11 +2023,11 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
-<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
-<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
-<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
@@ -2182,11 +2184,11 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
-<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
-<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
-<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
@@ -2267,11 +2269,11 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
-<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
-<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
-<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
@@ -2326,12 +2328,12 @@
</property>
<property name="class (parameter)" class="ptolemy.data.expr.StringParameter" value="">
</property>
- <property name="semanticType41 (parameter)" class="ptolemy.data.expr.StringParameter" value="">
- </property>
<property name="in (port)" class="ptolemy.kernel.util.StringAttribute" value="The input data">
</property>
<property name="sof rejected (port)" class="ptolemy.kernel.util.StringAttribute" value="The rejected SoF">
</property>
+ <property name="semanticType41 (parameter)" class="ptolemy.data.expr.StringParameter" value="">
+ </property>
<property name="entityId (parameter)" class="ptolemy.data.expr.StringParameter" value="">
</property>
</property>
@@ -2488,8 +2490,8 @@
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofSplitter takes a set of files as input and split it into smaller sets based on the purpose. This smaller sets can then be sent to e.g. a RecipeExecuter</configure></property>
<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sof</configure></property>
-<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sofs</configure></property>
<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups generated</configure></property>
+<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sofs</configure></property>
<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
@@ -2534,8 +2536,8 @@
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofAccumulator is meant to be used together with the SofSplitter: it puts back together in a single set of files the tokens generated by the PurposeSerializer (and usually processed by the RecipeExecuter)</configure></property>
<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
-<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sof</configure></property>
<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups to collect</configure></property>
+<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sof</configure></property>
<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
@@ -2557,11 +2559,15 @@
<property name="multiport"/>
<property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
</port>
<port name="#groups" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
</property>
</port>
@@ -2575,6 +2581,17 @@
<entity name="kmo_dark_1" class="org.eso.RecipeExecuter">
<property name="_location" class="ptolemy.kernel.util.Location" value="[360.0, 45.0]">
</property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </port>
</entity>
<relation name="relation2" class="ptolemy.actor.TypedIORelation">
</relation>
@@ -2732,8 +2749,8 @@
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofSplitter takes a set of files as input and split it into smaller sets based on the purpose. This smaller sets can then be sent to e.g. a RecipeExecuter</configure></property>
<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sof</configure></property>
-<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups generated</configure></property>
<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sofs</configure></property>
+<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups generated</configure></property>
<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
@@ -2780,8 +2797,8 @@
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofAccumulator is meant to be used together with the SofSplitter: it puts back together in a single set of files the tokens generated by the PurposeSerializer (and usually processed by the RecipeExecuter)</configure></property>
<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
-<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups to collect</configure></property>
<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sof</configure></property>
+<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups to collect</configure></property>
<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
@@ -2805,9 +2822,13 @@
<property name="multiport"/>
<property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
</port>
<port name="#groups" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
</property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
@@ -2823,6 +2844,17 @@
<entity name="kmo_flat_1" class="org.eso.RecipeExecuter">
<property name="_location" class="ptolemy.kernel.util.Location" value="[360.0, 95.0]">
</property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </port>
</entity>
<relation name="relation2" class="ptolemy.actor.TypedIORelation">
</relation>
@@ -2891,6 +2923,17 @@
</property>
<property name="_location" class="ptolemy.kernel.util.Location" value="[250.0, -75.0]">
</property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </port>
</entity>
<entity name="SofSplitter2" class="org.eso.SofSplitter">
<property name="Group purposes" class="ptolemy.data.expr.Parameter" value="true">
@@ -2901,8 +2944,8 @@
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofSplitter takes a set of files as input and split it into smaller sets, grouping them by purpose. Files with universal purpose are attached to every subset. This smaller sets can then be sent to e.g. a RecipeExecuter. Please refer to the user manual for more information.</configure></property>
<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sof</configure></property>
-<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sofs</configure></property>
<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups generated</configure></property>
+<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sofs</configure></property>
<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
@@ -2947,8 +2990,8 @@
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofAccumulator is meant to be used together with the SofSplitter: it puts back together in a single set of files the tokens generated by the SofSplitter (and usually processed by the RecipeExecuter)</configure></property>
<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
-<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sof</configure></property>
<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups to collect</configure></property>
+<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sof</configure></property>
<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
@@ -2970,11 +3013,15 @@
<property name="multiport"/>
<property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
</port>
<port name="#groups" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
</property>
</port>
@@ -3006,61 +3053,6 @@
<link port="SofAccumulator2.#groups" relation="relation2"/>
<link port="SofAccumulator2.sof out" relation="relation3"/>
</entity>
- <entity name="DataFilter" class="org.eso.DataFilter">
- <property name="Mode" class="ptolemy.data.expr.StringParameter" value="Select">
- </property>
- <property name="FITS Viewer" class="ptolemy.data.expr.StringParameter" value="$FITS_VIEWER">
- </property>
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The DataFilter displays all the files in a given SoF and allows the user to view their header, view them in an external application, select or deselect only some of them and then continue or pause the workflow.</configure></property>
-<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input SoF</configure></property>
-<property name="port:sof rejected" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The rejected SoF</configure></property>
-<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The selected SoF</configure></property>
-<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:FITS Viewer" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The application used to inspect FITS files</configure></property>
-<property name="prop:Mode" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>Skip: automatically select all files and don't show any window;</p><p>Display: select all the files and allow the user only to view them;</p><p>Select: standard mode.</p></configure></property>
-<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:483:6">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.DataFilter">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
- </property>
- </property>
- <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[1155.0, 750.0]">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:901:1:urn:lsid:kepler-project.org/ns/:29452:75:2">
- </property>
- <port name="sof in" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="multiport"/>
- <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
- </property>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
- </property>
- </port>
- <port name="sof out" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="multiport"/>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
- </property>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
- </property>
- </port>
- <port name="sof rejected" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
- </property>
- <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
- </property>
- </port>
- </entity>
<entity name="SofCombiner4" class="org.eso.SofCombiner">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
@@ -3107,66 +3099,10 @@
</property>
</port>
</entity>
- <entity name="ProductRenamer" class="ptolemy.actor.lib.python.PythonScript">
- <property name="script" class="ptolemy.kernel.util.StringAttribute" value="import os
import shutil
from ptolemy.data import StringToken, IntToken
from ptolemy.data.expr import Parameter
from org.eso.util import JSONTools
from nom.tam.fits import Fits
from ptolemy.kernel.util import IllegalActionException
import org.apache.log4j
class Main :
"ProductRenamer"
def fire(self) :
#Get the logger
l [...]
- </property>
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Renames recipe products based on FITS keywords</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure> This actor moves (or copies or links) its input sof to a final product directory based on some FITS keywords.
Usually, it should be connected to the output of the recipes that produce final products. If the recipe produces more products that are not relevant to rename, an output filter can be put in the recipe.</configure></property>
-<property name="port:sof_out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The final list of files produced</configure></property>
-<property name="port:sof_in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The files to be copied/moved or linked</configure></property>
-<property name="prop:RenameKeywords" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The list of keywords used to create the new name. This is actually a string of comma separated values, each containing either the name of keyword or a constant string value. For instance, a valid value would be DATE,'-',HIERARCH.ESO.DPR.CATG</configure></property>
-<property name="prop:OutputExistsMode" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>This parameter defines the behaviour in case the output files already exists: it can be "append_version" (create a new file with a running index suffix), "overwrite" (replace the existing file), "stop" (stop the workflow)</configure></property>
-<property name="prop:script" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:FinalProductDirectory" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The directory where the files are going to be copied/linked or renamed. It is usually set to END_PRODUCTS_DIR</configure></property>
-<property name="prop:SubDir" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>If it is not empty, a subdirectory will be created with this string. The value can contain backslashes (and intermediate directories will be created). It will usually be END_PROD_SUBDIR, created somewhere in the workflow</configure></property>
-<property name="prop:CopyMode" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>There are several options: "copy", "move" or "link".</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:29452:79:5">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.python.PythonScript">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
- </property>
- </property>
- <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
- </property>
- <property name="_editorFactory" class="ptolemy.vergil.toolbox.TextEditorConfigureFactory">
- <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="script">
- </property>
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[1155.0, 910.0]">
- </property>
- <property name="RenameKeywords" class="ptolemy.data.expr.StringParameter" value="HIERARCH.ESO.OBS.NAME,'_',HIERARCH.ESO.PRO.CATG">
- </property>
- <property name="FinalProductDirectory" class="ptolemy.data.expr.StringParameter" value="$END_PRODUCTS_DIR">
- </property>
- <property name="SubDir" class="ptolemy.data.expr.StringParameter" value="$END_PRODUCT_SUBDIR">
- </property>
- <property name="CopyMode" class="ptolemy.data.expr.StringParameter" value="copy">
- </property>
- <property name="OutputExistsMode" class="ptolemy.data.expr.StringParameter" value="append_version">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:910:1">
- </property>
- <port name="sof_in" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
- </property>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
- </property>
- </port>
- <port name="sof_out" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="multiport"/>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
- </property>
- </port>
- </entity>
<entity name="WAVE_CAL" class="ptolemy.actor.TypedCompositeActor">
<property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="8.1.devel">
</property>
- <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:43289:40:241">
+ <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:46309:10:2">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.TypedCompositeActor">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:449:1">
@@ -3185,9 +3121,9 @@
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>A Composite actor is an aggregation of actors. It may have a local director that is responsible for executing the contained actors. A Composite actor with a local director is called an opaque actor. Composite actors do not require a local director. Composite actors with no local director "inherit" the director from the containing workflow and are called non-opaque.</ [...]
</property> <property name="_location" class="ptolemy.kernel.util.Location" value="[215.0, 850.0]">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:15314:197:41:urn:lsid:kepler-project.org/ns/:21155:64:67:urn:lsid:kepler-project.org/ns/:29452:30:11:urn:lsid:kepler-project.org/ns/:21155:427:153">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:15314:197:41:urn:lsid:kepler-project.org/ns/:21155:64:67:urn:lsid:kepler-project.org/ns/:29452:30:11:urn:lsid:kepler-project.org/ns/:21155:427:153:urn:lsid:kepler-project.org/ns/:43289:40:241">
</property>
- <property name="EnableInteractivity" class="ptolemy.data.expr.StringParameter" value="false">
+ <property name="EnableInteractivity" class="ptolemy.data.expr.StringParameter" value="true">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
@@ -3475,11 +3411,11 @@
<property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:421:1">
</property>
</property>
- <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={327, 103, 1384, 583}, maximized=false}">
+ <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={327, 103, 1384, 614}, maximized=false}">
</property>
<property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[1074, 464]">
</property>
- <property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="1.0">
+ <property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="0.8">
</property>
<property name="_vergilCenter" class="ptolemy.data.expr.ExpertParameter" value="{537.0, 232.0}">
</property>
@@ -3504,8 +3440,8 @@
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofSplitter takes a set of files as input and split it into smaller sets based on the purpose. This smaller sets can then be sent to e.g. a RecipeExecuter</configure></property>
<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sof</configure></property>
-<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sofs</configure></property>
<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups generated</configure></property>
+<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sofs</configure></property>
<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
@@ -3564,6 +3500,8 @@
<port name="sof in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="multiport"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
</property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
@@ -3571,6 +3509,8 @@
</port>
<port name="sop in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
</property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
@@ -3601,10 +3541,10 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The RecipeLooper is an actor designed to allow multiple execution of the same recipe on the same data with different parameters in order to optimize the data reduction.
At the begininning of an iteration it accepts input tokens from the sof in and sop in ports and sends them to the output ports, then it reads tokens from the sof loop and sop loop ports until the token on the iteration [...]
-<property name="port:sof loop" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The loop input sof</configure></property>
<property name="port:iteration complete" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The signal to terminate the current iteration</configure></property>
-<property name="port:sop in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sop</configure></property>
+<property name="port:sof loop" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The loop input sof</configure></property>
<property name="port:sop loop" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The loop input sop</configure></property>
+<property name="port:sop in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sop</configure></property>
<property name="port:sop out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The output sop</configure></property>
<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sof</configure></property>
<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The output sof</configure></property>
@@ -3626,11 +3566,15 @@
<port name="sof in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="multiport"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
</port>
<port name="sop in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
</port>
@@ -3638,6 +3582,8 @@
<property name="input"/>
<property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
</property>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
</port>
@@ -3645,11 +3591,15 @@
<property name="input"/>
<property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
</property>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
</port>
<port name="sop loop" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
</property>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
</port>
@@ -3701,12 +3651,6 @@
</property>
<property name="Disable logging" class="ptolemy.data.expr.Parameter" value="false">
</property>
- <property name="Clear Products Dir" class="ptolemy.data.expr.StringParameter" value="Never">
- </property>
- <property name="Clear Logs Dir" class="ptolemy.data.expr.StringParameter" value="Never">
- </property>
- <property name="Clear Bookkeeping Dir" class="ptolemy.data.expr.StringParameter" value="Never">
- </property>
<property name="Products Dir" class="ptolemy.data.expr.FileParameter" value="$TMP_PRODUCTS_DIR">
<property name="allowFiles" class="ptolemy.data.expr.Parameter" value="false">
</property>
@@ -3725,6 +3669,12 @@
<property name="allowDirectories" class="ptolemy.data.expr.Parameter" value="true">
</property>
</property>
+ <property name="Clear Products Dir" class="ptolemy.data.expr.StringParameter" value="Never">
+ </property>
+ <property name="Clear Logs Dir" class="ptolemy.data.expr.StringParameter" value="Never">
+ </property>
+ <property name="Clear Bookkeeping Dir" class="ptolemy.data.expr.StringParameter" value="Never">
+ </property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>This actor executes a Python script</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
@@ -3856,10 +3806,6 @@
</property>
</port>
<entity name="InitPredictParam" class="ptolemy.actor.lib.StringConst">
- <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
- </property>
- <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
- </property>
<property name="value" class="ptolemy.data.expr.Parameter" value="kmo_wave_cal:order=$order
kmo_wave_cal:dev_flip=$dev_flip
kmo_wave_cal:dev_disp=$dev_disp
kmo_wave_cal:suppress_extension=$suppress_extension
kmo_wave_cal:b_samples=$b_samples
kmo_wave_cal:b_start=$b_start
kmo_wave_cal:b_end=$b_end">
<property name="style" class="ptolemy.actor.gui.style.TextStyle">
<property name="height" class="ptolemy.data.expr.Parameter" value="10">
@@ -3868,6 +3814,10 @@
</property>
</property>
</property>
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
@@ -3958,8 +3908,8 @@
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofAccumulator is meant to be used together with the SofSplitter: it puts back together in a single set of files the tokens generated by the PurposeSerializer (and usually processed by the RecipeExecuter)</configure></property>
<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
-<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups to collect</configure></property>
<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sof</configure></property>
+<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups to collect</configure></property>
<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
@@ -3983,9 +3933,13 @@
<property name="multiport"/>
<property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
</port>
<port name="#groups" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
</port>
@@ -3997,12 +3951,12 @@
</port>
</entity>
<entity name="String Constant" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="$EnableInteractivity">
+ </property>
<property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
</property>
<property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
</property>
- <property name="value" class="ptolemy.data.expr.Parameter" value="$EnableInteractivity">
- </property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
@@ -4153,8 +4107,8 @@
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofSplitter takes a set of files as input and split it into smaller sets based on the purpose. This smaller sets can then be sent to e.g. a RecipeExecuter</configure></property>
<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sof</configure></property>
-<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups generated</configure></property>
<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sofs</configure></property>
+<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups generated</configure></property>
<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
@@ -4201,8 +4155,8 @@
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofAccumulator is meant to be used together with the SofSplitter: it puts back together in a single set of files the tokens generated by the PurposeSerializer (and usually processed by the RecipeExecuter)</configure></property>
<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
-<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups to collect</configure></property>
<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sof</configure></property>
+<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups to collect</configure></property>
<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
@@ -4226,9 +4180,13 @@
<property name="multiport"/>
<property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
</port>
<port name="#groups" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
</property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
@@ -4244,6 +4202,17 @@
<entity name="kmo_illumination_1" class="org.eso.RecipeExecuter">
<property name="_location" class="ptolemy.kernel.util.Location" value="[365.0, 100.0]">
</property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </port>
</entity>
<relation name="relation2" class="ptolemy.actor.TypedIORelation">
</relation>
@@ -4371,7 +4340,7 @@
<display name="Initialise"/>
<property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="7.0.2">
</property>
- <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:29452:63:3">
+ <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:46342:26:5">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.TypedCompositeActor">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:449:1">
@@ -4390,6 +4359,24 @@
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>A Composite actor is an aggregation of actors. It may have a local director that is responsible for executing the contained actors. A Composite actor with a local director is called an opaque actor. Composite actors do not require a local director. Composite actors with no local director "inherit" the director from the containing workflow and are called non-opaque.</ [...]
</property> <property name="_location" class="ptolemy.kernel.util.Location" value="[-520.0, 700.0]">
</property>
+ <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={156, 133, 1603, 963}, maximized=false}">
+ </property>
+ <property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[1657, 1009]">
+ </property>
+ <property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="0.6681514476615">
+ </property>
+ <property name="_vergilCenter" class="ptolemy.data.expr.ExpertParameter" value="{740.9883333333332, 743.9433333333333}">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="description" class="ptolemy.kernel.util.StringAttribute" value="<p>A Composite actor is an aggregation of actors. It may have a local director that is responsible for executing the contained actors. A Composite actor with a local director is called an opaque actor. Composite actors do not require a local director. Composite actors with no local director "inherit" the director from the containing workflow and are called non-opaque.</p>
 [...]
+ </property>
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Yuhong Xiong">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:14094:70:17:urn:lsid:kepler-project.org/ns/:15314:48:9:urn:lsid:kepler-project.org/ns/:21155:108:26:urn:lsid:kepler-project.org/ns/:29452:63:3">
+ </property>
<property name="Annotation" class="ptolemy.vergil.kernel.attributes.TextAttribute">
<property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
@@ -4434,73 +4421,48 @@
</property>
<property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{510.0, 585.0}">
- </property>
- </property>
- <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={-140, 104, 1965, 1156}, maximized=false}">
- </property>
- <property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[1657, 1009]">
- </property>
- <property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="0.6681514476615">
- </property>
- <property name="_vergilCenter" class="ptolemy.data.expr.ExpertParameter" value="{740.9883333333332, 743.9433333333333}">
- </property>
- <property name="" class="ptolemy.vergil.basic.DocAttribute">
- <property name="description" class="ptolemy.kernel.util.StringAttribute" value="<p>A Composite actor is an aggregation of actors. It may have a local director that is responsible for executing the contained actors. A Composite actor with a local director is called an opaque actor. Composite actors do not require a local director. Composite actors with no local director "inherit" the director from the containing workflow and are called non-opaque.</p>
 [...]
- </property>
- <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Yuhong Xiong">
- </property>
- <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{686.1733333333523, 776.311666666679}">
</property>
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:14094:70:17:urn:lsid:kepler-project.org/ns/:15314:48:9:urn:lsid:kepler-project.org/ns/:21155:108:26">
- </property>
- <port name="raw_data_dir" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{1455.0, 415.0}">
- </property>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
- </property>
- </port>
- <entity name="String Constant" class="ptolemy.actor.lib.StringConst">
- <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="1">
+ <property name="DDF Director" class="ptolemy.domains.ddf.kernel.DDFDirector">
+ <property name="iterations" class="ptolemy.data.expr.Parameter" value="0">
</property>
- <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ <property name="maximumReceiverCapacity" class="ptolemy.data.expr.Parameter" value="0">
</property>
- <property name="value" class="ptolemy.data.expr.Parameter" value="if [ "$EraseDirs" = "TRUE" ]; then echo "Deleting files"; rm -rf $BOOKKEEPING_DIR/*; rm -rf $LOGS_DIR/*; rm -rf $TMP_PRODUCTS_DIR/* ; else echo "Will not delete files"; fi">
+ <property name="runUntilDeadlockInOneIteration" class="ptolemy.data.expr.Parameter" value="true">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Gang Zhou</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
-<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
-<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
-<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
-<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:107:1">
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
<p> The dynamic dataflow (DDF) domain is a superset of the synchronous
dataflow(SDF) and Boolean dataflow(BDF) domains. In the SDF domain,
an actor consumes and produces a fixed number of tokens per firing.
This static information makes possible compile-time scheduling. In the
DDF domain, there are few [...]
+<property name="prop:iterations" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify the number of times a workflow is iterated. By default, this parameter is set to "0". Note that "0" does not mean "no iterations." Rather, "0" means that the workflow will iterate forever. Values greater than zero specify the actual number of times the director should execute the entire workflow. </configure></property>
+<property name="prop:maximumReceiverCapacity" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A Parameter representing the maximum capacity of each receiver controlled by this director. This is an integer that defaults to 0, which means the queue in each receiver is unbounded. To specify bounded queues, set this to a positive integer. </configure></property>
+<property name="prop:runUntilDeadlockInOneIteration" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A parameter indicating whether one iteration consists of repeated basic iterations until deadlock. If this parameter is true, the model will be executed until deadlock in one iteration. The default value is a BooleanToken with the value false. It cannot be set to true if this director is at the top level.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31989:107:1">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.domains.ddf.kernel.DDFDirector">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:directorclass:5:1">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Director">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Director">
</property>
- <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
- <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
- </property>
- <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
- </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{401.1733333333523, 466.311666666679}">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{725.0, 710.0}">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:director:5:1">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1">
+ </property>
+ <port name="raw_data_dir" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[1380.0, 580.0]">
</property>
- </entity>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
+ </port>
<entity name="Variable Setter" class="ptolemy.actor.lib.SetVariable">
- <property name="variableName" class="ptolemy.kernel.util.StringAttribute" value="END_PRODUCT_SUBDIR">
+ <property name="variableName" class="ptolemy.kernel.util.StringAttribute" value="GLOBAL_TIMESTAMP">
</property>
<property name="delayed" class="ptolemy.data.expr.Parameter" value="false">
</property>
@@ -4509,7 +4471,7 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee, Steve Neuendorffer, Jerome Blanc</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
Set the value of a variable. The result may occur at two different times, depending on the value of the delayed parameter.
If delayed is true, then the change to the value of the variable is implemented in a change request, and consequently will not take hold until the end of the current toplevel iteration. This helps ensure that users of value of the variable will see changes t [...]
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:268:1">
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:47:1">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.SetVariable">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:886:1">
@@ -4519,7 +4481,7 @@
</property>
<property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#LocalInput">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{920.0, 400.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{696.1733333333523, 571.311666666679}">
</property>
<property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
@@ -4527,85 +4489,29 @@
</property>
<port name="output" class="ptolemy.actor.TypedIOPort">
<property name="output"/>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ <property name="_expertMode" class="ptolemy.kernel.util.SingletonAttribute">
</property>
</port>
</entity>
- <entity name="String Constant2" class="ptolemy.actor.lib.StringConst">
- <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="1">
- </property>
- <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
- </property>
- <property name="value" class="ptolemy.data.expr.Parameter" value="$CALIB_DATA_DIR">
- </property>
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
-<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
-<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
-<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
-<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:14094:71:2">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
- </property>
- </property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
- </property>
- <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
- <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
- </property>
- <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
- </property>
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{1200.0, 420.0}">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1">
- </property>
- </entity>
- <entity name="String Accumulator" class="org.resurgence.actor.StringAccumulator">
- <property name="Substring separator" class="ptolemy.data.expr.Parameter" value="""">
- </property>
+ <entity name="Elements To Array" class="ptolemy.actor.lib.ElementsToArray">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>
The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p></configure></property>
-<property name="port:whole" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the full string.</configure></property>
-<property name="port:parts" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts substrings.</configure></property>
-<property name="prop:Substring separator" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The characters used to separate the elements in the output string. By default, the value is "".</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:113:1">
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
<p>The ElementsToArray actor reads individual elements via its input port and outputs an array consisting of those elements.</p>
<p>The actor accepts input elements of any one type (int, double, etc.). The type must be consistent. Each time the actor fires, it reads one token from each channel of the input port and outputs a corresponding array.</p>&# [...]
+<property name="port:input" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts tokens of any one type. The type must be consistent.</configure></property>
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts an assembled array. The type of the array elements matches that of the input.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:32:1">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.StringAccumulator">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1117:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.ElementsToArray">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:908:1">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{755.0, 400.0}">
- </property>
- <property name="" class="ptolemy.vergil.basic.DocAttribute">
- <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Wibke Sudholt">
- </property>
- <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
- </property>
- <property name="Substring separator (parameter)" class="ptolemy.data.expr.StringParameter" value="The characters used to separate the elements in the output string. By default, the value is "".">
- </property>
- <property name="parts (port)" class="ptolemy.kernel.util.StringAttribute" value="A multiport that accepts substrings.">
- </property>
- <property name="whole (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the full string.">
- </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#ArrayActor">
</property>
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#DataArrayOperation">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:292:1">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1171.1733333333523, 561.311666666679}">
</property>
</entity>
<entity name="Time Stamp" class="org.sdm.spa.Timestamp">
@@ -4629,7 +4535,7 @@
</property>
<property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#LocalInput">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{455.0, 330.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{546.1733333333523, 581.311666666679}">
</property>
<property name="" class="ptolemy.vergil.basic.DocAttribute">
<property name="author" class="ptolemy.kernel.util.StringAttribute" value="Ilkay Altintas">
@@ -4646,41 +4552,77 @@
<property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
</entity>
- <entity name="Variable Setter2" class="ptolemy.actor.lib.SetVariable">
- <property name="variableName" class="ptolemy.kernel.util.StringAttribute" value="GLOBAL_TIMESTAMP">
+ <entity name="String Constant" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="if [ "x$EraseDirs" = "xtrue" ]; then echo "Deleting files"; rm -rf $BOOKKEEPING_DIR/*; rm -rf $LOGS_DIR/*; rm -rf $TMP_PRODUCTS_DIR/* ; else echo "Will not delete files"; fi">
</property>
- <property name="delayed" class="ptolemy.data.expr.Parameter" value="false">
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee, Steve Neuendorffer, Jerome Blanc</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
Set the value of a variable. The result may occur at two different times, depending on the value of the delayed parameter.
If delayed is true, then the change to the value of the variable is implemented in a change request, and consequently will not take hold until the end of the current toplevel iteration. This helps ensure that users of value of the variable will see changes t [...]
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:47:1">
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:204:1">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.SetVariable">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:886:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Variable">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#LocalInput">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{580.0, 330.0}">
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
+ </property>
</property>
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{851.1733333333523, 896.311666666679}">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:10:1">
+ </entity>
+ <entity name="String Constant2" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="$RAWDATA_DIR">
</property>
- <port name="output" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="_expertMode" class="ptolemy.kernel.util.SingletonAttribute">
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:204:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
</property>
- </port>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
+ </property>
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1011.1733333333523, 521.311666666679}">
+ </property>
</entity>
<entity name="DirectoryEraser" class="ptolemy.actor.lib.Exec">
- <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="1">
- </property>
<property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
</property>
<property name="command" class="ptolemy.actor.parameters.PortParameter" value="sh">
@@ -4695,6 +4637,8 @@
</property>
<property name="waitForProcess" class="ptolemy.data.expr.Parameter" value="true">
</property>
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Xiaojun Liu, Edward A. Lee, Steve Neuendorffer</configure></property>
@@ -4722,15 +4666,13 @@
</property>
<property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#UnixCommand">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{145.0, 400.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{321.1733333333523, 591.311666666679}">
</property>
<property name="" class="ptolemy.vergil.basic.DocAttribute">
<property name="author" class="ptolemy.kernel.util.StringAttribute" value="Xiaojun Liu, Edward A. Lee, Steve Neuendorffer">
</property>
<property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
- <property name="firingCountLimit (parameter)" class="ptolemy.data.expr.StringParameter" value="If a positive integer, then it is the maximum number of times to execute the actor.">
- </property>
<property name="directory (parameter)" class="ptolemy.data.expr.StringParameter" value="The directory in which to execute the command. The default value of this parameter $CWD, which represents the user's current working or home directory. ">
</property>
<property name="environment (parameter)" class="ptolemy.data.expr.StringParameter" value="An array of records that name an environment variable and a value:
{{name = "NAME1", value = "value1"}...}
Where NAME1 is the name of the environment variable, and value1 is the value.
For example, {{name = "PTII", value = "c:/ptII"}} would set the value of the PTII to c:/ptII.
If the parameter is set to {{name= [...]
@@ -4741,6 +4683,8 @@
</property>
<property name="waitForProcess (parameter)" class="ptolemy.data.expr.StringParameter" value="If true, then actor will wait until subprocess completes.">
</property>
+ <property name="firingCountLimit (parameter)" class="ptolemy.data.expr.StringParameter" value="If a positive integer, then it is the maximum number of times to execute the actor.">
+ </property>
<property name="output (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts data generated by the executed command, output as a string after the command has finished executing. If the command generates no data on standard out, then the empty string (a string of length zero) is generated. ">
</property>
<property name="trigger (port)" class="ptolemy.kernel.util.StringAttribute" value="If connected, a token must be available on this port before actor will execute.">
@@ -4781,51 +4725,12 @@
</port>
</entity>
<entity name="String Constant3" class="ptolemy.actor.lib.StringConst">
- <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
- </property>
- <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
- </property>
- <property name="value" class="ptolemy.data.expr.Parameter" value="1">
- </property>
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
-<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
-<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
-<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
-<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:233:1">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
- </property>
- </property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
- </property>
- <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
- <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
- </property>
- <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
- </property>
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{560.0, 495.0}">
- </property>
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1:urn:lsid:kepler-project.org/ns/:15314:114:1">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="$CALIB_DATA_DIR">
</property>
- </entity>
- <entity name="String Constant4" class="ptolemy.actor.lib.StringConst">
<property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="1">
</property>
<property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
</property>
- <property name="value" class="ptolemy.data.expr.Parameter" value="$RAWDATA_DIR">
- </property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
@@ -4835,7 +4740,7 @@
<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:204:1">
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:14094:71:2">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
@@ -4851,33 +4756,20 @@
<property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
</property>
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{1190.0, 315.0}">
- </property>
- </entity>
- <entity name="Elements To Array" class="ptolemy.actor.lib.ElementsToArray">
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
<p>The ElementsToArray actor reads individual elements via its input port and outputs an array consisting of those elements.</p>
<p>The actor accepts input elements of any one type (int, double, etc.). The type must be consistent. Each time the actor fires, it reads one token from each channel of the input port and outputs a corresponding array.</p>&# [...]
-<property name="port:input" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts tokens of any one type. The type must be consistent.</configure></property>
-<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts an assembled array. The type of the array elements matches that of the input.</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:32:1">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.ElementsToArray">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:908:1">
- </property>
- </property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#ArrayActor">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#DataArrayOperation">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{1021.1733333333523, 656.311666666679}">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{1315.0, 395.0}">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1">
</property>
</entity>
+ <relation name="relation" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
<relation name="relation2" class="ptolemy.actor.TypedIORelation">
<property name="width" class="ptolemy.data.expr.Parameter" value="1">
</property>
+ <vertex name="vertex1" value="{851.1733333333523, 586.311666666679}">
+ </vertex>
</relation>
<relation name="relation3" class="ptolemy.actor.TypedIORelation">
<property name="width" class="ptolemy.data.expr.Parameter" value="1">
@@ -4894,53 +4786,24 @@
<relation name="relation6" class="ptolemy.actor.TypedIORelation">
<property name="width" class="ptolemy.data.expr.Parameter" value="1">
</property>
- <vertex name="vertex1" value="[345.0, 355.0]">
- </vertex>
</relation>
<relation name="relation7" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
- </property>
- </relation>
- <relation name="relation9" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
- </property>
- <vertex name="vertex1" value="[970.0, 370.0]">
- </vertex>
- </relation>
- <relation name="relation" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
- </property>
- </relation>
- <relation name="relation8" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
- </property>
- </relation>
- <relation name="relation10" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
- </property>
</relation>
- <link port="raw_data_dir" relation="relation"/>
- <link port="String Constant.output" relation="relation3"/>
- <link port="Variable Setter.input" relation="relation4"/>
- <link port="Variable Setter.output" relation="relation9"/>
- <link port="String Constant2.output" relation="relation10"/>
- <link port="String Constant2.trigger" relation="relation9"/>
- <link port="String Accumulator.parts" relation="relation5"/>
- <link port="String Accumulator.parts" relation="relation7"/>
- <link port="String Accumulator.whole" relation="relation4"/>
- <link port="Time Stamp.output" relation="relation2"/>
+ <link port="raw_data_dir" relation="relation7"/>
+ <link port="Variable Setter.input" relation="relation3"/>
+ <link port="Variable Setter.output" relation="relation2"/>
+ <link port="Elements To Array.input" relation="relation"/>
+ <link port="Elements To Array.input" relation="relation4"/>
+ <link port="Elements To Array.output" relation="relation7"/>
+ <link port="Time Stamp.output" relation="relation3"/>
<link port="Time Stamp.trigger" relation="relation6"/>
- <link port="Variable Setter2.input" relation="relation2"/>
- <link port="Variable Setter2.output" relation="relation5"/>
+ <link port="String Constant.output" relation="relation5"/>
+ <link port="String Constant2.output" relation="relation"/>
+ <link port="String Constant2.trigger" relation="relation2"/>
<link port="DirectoryEraser.output" relation="relation6"/>
- <link port="DirectoryEraser.input" relation="relation3"/>
- <link port="String Constant3.output" relation="relation7"/>
- <link port="String Constant3.trigger" relation="relation6"/>
- <link port="String Constant4.output" relation="relation8"/>
- <link port="String Constant4.trigger" relation="relation9"/>
- <link port="Elements To Array.input" relation="relation8"/>
- <link port="Elements To Array.input" relation="relation10"/>
- <link port="Elements To Array.output" relation="relation"/>
+ <link port="DirectoryEraser.input" relation="relation5"/>
+ <link port="String Constant3.output" relation="relation4"/>
+ <link port="String Constant3.trigger" relation="relation2"/>
</entity>
<entity name="Data Set Selection" class="ptolemy.actor.TypedCompositeActor">
<property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="8.1.devel">
@@ -4967,8 +4830,6 @@
<property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:31989:70:2">
</property>
<property name="DDF Director" class="ptolemy.domains.ddf.kernel.DDFDirector">
- <property name="timeResolution" class="ptolemy.actor.parameters.SharedParameter" value="1E-10">
- </property>
<property name="iterations" class="ptolemy.data.expr.Parameter" value="0">
</property>
<property name="maximumReceiverCapacity" class="ptolemy.data.expr.Parameter" value="0">
@@ -4980,8 +4841,8 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Gang Zhou</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
<p> The dynamic dataflow (DDF) domain is a superset of the synchronous
dataflow(SDF) and Boolean dataflow(BDF) domains. In the SDF domain,
an actor consumes and produces a fixed number of tokens per firing.
This static information makes possible compile-time scheduling. In the
DDF domain, there are few [...]
-<property name="prop:maximumReceiverCapacity" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A Parameter representing the maximum capacity of each receiver controlled by this director. This is an integer that defaults to 0, which means the queue in each receiver is unbounded. To specify bounded queues, set this to a positive integer. </configure></property>
<property name="prop:iterations" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify the number of times a workflow is iterated. By default, this parameter is set to "0". Note that "0" does not mean "no iterations." Rather, "0" means that the workflow will iterate forever. Values greater than zero specify the actual number of times the director should execute the entire workflow. </configure></property>
+<property name="prop:maximumReceiverCapacity" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A Parameter representing the maximum capacity of each receiver controlled by this director. This is an integer that defaults to 0, which means the queue in each receiver is unbounded. To specify bounded queues, set this to a positive integer. </configure></property>
<property name="prop:runUntilDeadlockInOneIteration" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A parameter indicating whether one iteration consists of repeated basic iterations until deadlock. If this parameter is true, the model will be executed until deadlock in one iteration. The default value is a BooleanToken with the value false. It cannot be set to true if this director is at the top level.</configure></property>
</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:99:1">
</property>
@@ -5020,10 +4881,10 @@
</port>
<entity name="DataSetChooser" class="org.eso.DataSetChooser">
<display name="Data Set Chooser"/>
- <property name="Mode" class="ptolemy.data.expr.StringParameter" value="Select">
- </property>
<property name="FITS Viewer" class="ptolemy.data.expr.StringParameter" value="$FITS_VIEWER">
</property>
+ <property name="Mode" class="ptolemy.data.expr.StringParameter" value="Select">
+ </property>
<property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:78:3">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.DataSetChooser">
@@ -5037,10 +4898,10 @@
</property>
<property name="version" class="ptolemy.kernel.util.StringAttribute" value="1.0">
</property>
- <property name="Mode (parameter)" class="ptolemy.data.expr.StringParameter" value="<p>Skip: automatically select all files and don't show any window;</p><p>Display: select all the files and allow the user only to view them;</p><p>Select: standard mode.</p>">
- </property>
<property name="FITS Viewer (parameter)" class="ptolemy.data.expr.StringParameter" value="The application used to inspect FITS files">
</property>
+ <property name="Mode (parameter)" class="ptolemy.data.expr.StringParameter" value="<p>Skip: automatically select all files and don't show any window;</p><p>Display: select all the files and allow the user only to view them;</p><p>Select: standard mode.</p>">
+ </property>
<property name="class (parameter)" class="ptolemy.data.expr.StringParameter" value="">
</property>
<property name="semanticType41 (parameter)" class="ptolemy.data.expr.StringParameter" value="">
@@ -5145,7 +5006,7 @@
<entity name="Initialise Current Dataset" class="ptolemy.actor.TypedCompositeActor">
<property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="7.0.2">
</property>
- <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31989:31:7">
+ <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:46342:38:12">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.TypedCompositeActor">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:449:1">
@@ -5164,7 +5025,7 @@
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>A Composite actor is an aggregation of actors. It may have a local director that is responsible for executing the contained actors. A Composite actor with a local director is called an opaque actor. Composite actors do not require a local director. Composite actors with no local director "inherit" the director from the containing workflow and are called non-opaque.</ [...]
</property> <property name="_location" class="ptolemy.kernel.util.Location" value="[-520.0, 1015.0]">
</property>
- <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={99, 99, 1321, 810}, maximized=false}">
+ <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={-228, 141, 1321, 809}, maximized=false}">
</property>
<property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[1011, 659]">
</property>
@@ -5180,39 +5041,7 @@
<property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:12776:22:11:urn:lsid:kepler-project.org/ns/:2745:94:5:urn:lsid:kepler-project.org/ns/:13757:119:12:urn:lsid:kepler-project.org/ns/:14094:9:50:urn:lsid:kepler-project.org/ns/:15314:21:358:urn:lsid:kepler-project.org/ns/:25158:32:9">
- </property>
- <property name="DDF Director" class="ptolemy.domains.ddf.kernel.DDFDirector">
- <property name="timeResolution" class="ptolemy.actor.parameters.SharedParameter" value="1E-10">
- </property>
- <property name="iterations" class="ptolemy.data.expr.Parameter" value="0">
- </property>
- <property name="maximumReceiverCapacity" class="ptolemy.data.expr.Parameter" value="0">
- </property>
- <property name="runUntilDeadlockInOneIteration" class="ptolemy.data.expr.Parameter" value="false">
- </property>
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Gang Zhou</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
<p> The dynamic dataflow (DDF) domain is a superset of the synchronous
dataflow(SDF) and Boolean dataflow(BDF) domains. In the SDF domain,
an actor consumes and produces a fixed number of tokens per firing.
This static information makes possible compile-time scheduling. In the
DDF domain, there are few [...]
-<property name="prop:iterations" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify the number of times a workflow is iterated. By default, this parameter is set to "0". Note that "0" does not mean "no iterations." Rather, "0" means that the workflow will iterate forever. Values greater than zero specify the actual number of times the director should execute the entire workflow. </configure></property>
-<property name="prop:maximumReceiverCapacity" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A Parameter representing the maximum capacity of each receiver controlled by this director. This is an integer that defaults to 0, which means the queue in each receiver is unbounded. To specify bounded queues, set this to a positive integer. </configure></property>
-<property name="prop:runUntilDeadlockInOneIteration" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A parameter indicating whether one iteration consists of repeated basic iterations until deadlock. If this parameter is true, the model will be executed until deadlock in one iteration. The default value is a BooleanToken with the value false. It cannot be set to true if this director is at the top level.</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:88:4">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.domains.ddf.kernel.DDFDirector">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:directorclass:5:1">
- </property>
- </property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Director">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Director">
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{740.0, 95.0}">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:director:5:1">
- </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:12776:22:11:urn:lsid:kepler-project.org/ns/:2745:94:5:urn:lsid:kepler-project.org/ns/:13757:119:12:urn:lsid:kepler-project.org/ns/:14094:9:50:urn:lsid:kepler-project.org/ns/:15314:21:358:urn:lsid:kepler-project.org/ns/:25158:32:9:urn:lsid:kepler-project.org/ns/:31989:31:7">
</property>
<property name="Annotation" class="ptolemy.vergil.kernel.attributes.TextAttribute">
<property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
@@ -5258,7 +5087,7 @@
</property>
<property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{895.0, 105.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[780.0, 455.0]">
</property>
<property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:436:1:urn:lsid:kepler-project.org/ns/:13757:121:3">
</property>
@@ -5268,7 +5097,7 @@
</property>
<property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{885.0, 85.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[775.0, 435.0]">
</property>
<property name="lineWidth" class="ptolemy.data.expr.Parameter" value="5">
</property>
@@ -5289,11 +5118,11 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
-<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
-<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
-<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
+<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
+<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
@@ -5310,56 +5139,39 @@
<property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:434:1">
</property>
</property>
- <property name="Rectangle2" class="ptolemy.vergil.kernel.attributes.RectangleAttribute">
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
- </property>
- <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{885.0, 85.0}">
- </property>
- <property name="lineWidth" class="ptolemy.data.expr.Parameter" value="5">
- </property>
- <property name="lineColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
- </property>
- <property name="width" class="ptolemy.data.expr.Parameter" value="319.0">
- </property>
- <property name="height" class="ptolemy.data.expr.Parameter" value="72.0">
- </property>
- <property name="centered" class="ptolemy.data.expr.Parameter" value="false">
+ <property name="DDF Director" class="ptolemy.domains.ddf.kernel.DDFDirector">
+ <property name="iterations" class="ptolemy.data.expr.Parameter" value="0">
</property>
- <property name="fillColor" class="ptolemy.actor.gui.ColorAttribute" value="none">
+ <property name="maximumReceiverCapacity" class="ptolemy.data.expr.Parameter" value="0">
</property>
- <property name="rounding" class="ptolemy.data.expr.Parameter" value="20">
+ <property name="runUntilDeadlockInOneIteration" class="ptolemy.data.expr.Parameter" value="false">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Gang Zhou</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Rectangle attribute renders a rectangle on the Workflow canvas. Single-click the rectangle to drag the resize handles and adjust the shape's size, or double-click the rectangle to customize its height, width, line width, color, and fill color.</p></configure></property>
-<property name="prop:lineWidth" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line width. The value is a double that defaults to 1.0.</configure></property>
-<property name="prop:height" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical extent. The value is a double that defaults to 100.0.</configure></property>
-<property name="prop:dashArray" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify a dash-pattern for dashed or dotted lines. The value consists of an array of doubles that specify the length of the alternating solid and transparent segments. An empty value indicates that the line should not be dashed (the default).</configure></property>
-<property name="prop:centered" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner.</configure></property>
-<property name="prop:rounding" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding.</configure></property>
-<property name="prop:width" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal extent. The value is a double that defaults to 100.0.</configure></property>
-<property name="prop:lineColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The line color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
-<property name="prop:fillColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The fill color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. By default, the value is "none."</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:13757:120:5">
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
<p> The dynamic dataflow (DDF) domain is a superset of the synchronous
dataflow(SDF) and Boolean dataflow(BDF) domains. In the SDF domain,
an actor consumes and produces a fixed number of tokens per firing.
This static information makes possible compile-time scheduling. In the
DDF domain, there are few [...]
+<property name="prop:maximumReceiverCapacity" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A Parameter representing the maximum capacity of each receiver controlled by this director. This is an integer that defaults to 0, which means the queue in each receiver is unbounded. To specify bounded queues, set this to a positive integer. </configure></property>
+<property name="prop:iterations" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify the number of times a workflow is iterated. By default, this parameter is set to "0". Note that "0" does not mean "no iterations." Rather, "0" means that the workflow will iterate forever. Values greater than zero specify the actual number of times the director should execute the entire workflow. </configure></property>
+<property name="prop:runUntilDeadlockInOneIteration" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A parameter indicating whether one iteration consists of repeated basic iterations until deadlock. If this parameter is true, the model will be executed until deadlock in one iteration. The default value is a BooleanToken with the value false. It cannot be set to true if this director is at the top level.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:88:4">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.RectangleAttribute">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1197:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.domains.ddf.kernel.DDFDirector">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:directorclass:5:1">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DecorativeActor">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Director">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Director">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:434:1">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{616.1613420338138, 453.28467297825915}">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:director:5:1">
</property>
</property>
<port name="current_dataset" class="ptolemy.actor.TypedIOPort">
<property name="output"/>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{815.0, 360.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[850.0, 695.0]">
</property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
@@ -5368,7 +5180,7 @@
</port>
<port name="dataset_in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{120.0, 360.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[60.0, 695.0]">
</property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
@@ -5377,44 +5189,16 @@
</port>
<port name="dataset" class="ptolemy.actor.TypedIOPort">
<property name="output"/>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{365.0, 660.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[300.0, 1080.0]">
</property>
</port>
- <entity name="2" class="org.resurgence.actor.StringAccumulator">
- <property name="Substring separator" class="ptolemy.data.expr.Parameter" value="""">
- </property>
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>
The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p></configure></property>
-<property name="port:whole" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the full string.</configure></property>
-<property name="port:parts" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts substrings.</configure></property>
-<property name="prop:Substring separator" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The characters used to separate the elements in the output string. By default, the value is "".</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:79:4">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.StringAccumulator">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1117:1">
- </property>
- </property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{672.57806, 257.69272}">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:292:1:urn:lsid:kepler-project.org/ns/:13757:392:4">
- </property>
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
- </property>
- </entity>
<entity name="String Constant" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="$N_SELECTED_DATASETS :">
+ </property>
<property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
</property>
<property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
</property>
- <property name="value" class="ptolemy.data.expr.Parameter" value="$GLOBAL_TIMESTAMP">
- </property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
@@ -5424,9 +5208,7 @@
<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:13757:393:3">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+</property> <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
</property>
</property>
@@ -5440,62 +5222,120 @@
<property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
</property>
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{460.0, 525.0}">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1:urn:lsid:kepler-project.org/ns/:14094:13:2">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{308.73940203381375, 630.9773929782591}">
</property>
<property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
<port name="trigger" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
</port>
</entity>
- <entity name="Counter" class="ptolemy.actor.lib.Counter">
+ <entity name="String Accumulator" class="org.resurgence.actor.StringAccumulator">
+ <property name="Substring separator" class="ptolemy.data.expr.Parameter" value=""/"">
+ </property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Steve Neuendorffer</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Counter actor increments or decrements an internal counter, depending on its inputs. The actor outputs the counter value as an integer.</p>
<p>Each time the actor fires, it adjusts its internal counter (incrementing or decrementing the count) based on the input. Whenever a token is received from the increment input, the internal counter is incremented. Wh [...]
-<property name="port:increment" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An input port used to increment the counter. The port accepts tokens of any type. </configure></property>
-<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the counter value.</configure></property>
-<property name="port:decrement" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An input port used to decrement the counter. The port accepts tokens of any type.</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:80:2">
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>
The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p></configure></property>
+<property name="port:whole" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the full string.</configure></property>
+<property name="port:parts" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts substrings.</configure></property>
+<property name="prop:Substring separator" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The characters used to separate the elements in the output string. By default, the value is "".</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31989:93:2">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.Counter">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:947:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.StringAccumulator">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1117:1">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#IterativeMathOperationActor">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
</property>
<property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{422.57806, 142.69272}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{511.16134203381375, 993.2846729782591}">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:72:1">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:292:1">
</property>
- <property name="" class="ptolemy.vergil.basic.DocAttribute">
- <property name="description" class="ptolemy.kernel.util.StringAttribute" value="<p>The Counter actor increments or decrements an internal counter, depending on its inputs. The actor outputs the counter value as an integer.</p>
<p>Each time the actor fires, it adjusts its internal counter (incrementing or decrementing the count) based on the input. Whenever a token is received from the increment input, the internal counter is incremented. Wheneve [...]
- </property>
- <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Steve Neuendorffer">
- </property>
- <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
- </property>
- <property name="increment (port)" class="ptolemy.kernel.util.StringAttribute" value="An input port used to increment the counter. The port accepts tokens of any type. ">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </entity>
+ <entity name="2" class="org.resurgence.actor.StringAccumulator">
+ <property name="Substring separator" class="ptolemy.data.expr.Parameter" value=""/"">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>
The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p></configure></property>
+<property name="port:whole" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the full string.</configure></property>
+<property name="port:parts" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts substrings.</configure></property>
+<property name="prop:Substring separator" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The characters used to separate the elements in the output string. By default, the value is "".</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:90:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.StringAccumulator">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1117:1">
</property>
- <property name="decrement (port)" class="ptolemy.kernel.util.StringAttribute" value="An input port used to decrement the counter. The port accepts tokens of any type.">
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{376.16134203381375, 903.2846729782591}">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:292:1:urn:lsid:kepler-project.org/ns/:13757:392:4">
+ </property>
+ <port name="parts" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
</property>
- <property name="output (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the counter value.">
+ </port>
+ </entity>
+ <entity name="String Constant2" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="$GLOBAL_TIMESTAMP">
+ </property>
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:13757:393:3">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
</property>
</property>
- <port name="decrement" class="ptolemy.actor.TypedIOPort">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
+ </property>
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{266.16134203381375, 878.2846729782591}">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1:urn:lsid:kepler-project.org/ns/:14094:13:2">
+ </property>
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <port name="trigger" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
+ <property name="multiport"/>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
- <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
- </property>
</port>
</entity>
<entity name="CurrentDataSet" class="org.eso.CurrentDataSet">
@@ -5507,7 +5347,7 @@
</property>
<property name="semanticType" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{420.0, 340.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{296.16134203381375, 698.2846729782591}">
</property>
<property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList">
</property>
@@ -5522,13 +5362,102 @@
</property>
</port>
</entity>
- <entity name="String Constant2" class="ptolemy.actor.lib.StringConst">
- <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
+ <entity name="Directory Maker" class="org.resurgence.actor.DirectoryMaker">
+ <property name="Directory name" class="ptolemy.actor.parameters.PortParameter" value="/home/yjung/P_kmos/reflex//OUT/2013-10-29T11:50:16/KMOS.2013-06-30T23:48:06.049_tpl">
</property>
- <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The DirectoryMaker actor creates a new local directory and outputs its path.</p>
<p>The name of the new directory is specified with the directoryName parameter.</p></configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time.</configure></property>
+<property name="port:path" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the new directory path.</configure></property>
+<property name="prop:Directory name" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The name and path of the new directory. See FileParameter for more information about specifying paths.</configure></property>
+</property> <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.DirectoryMaker">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1111:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#FileSystemActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#FileSystem">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{691.1613420338138, 993.2846729782591}">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="description" class="ptolemy.kernel.util.StringAttribute" value="<p>The DirectoryMaker actor creates a new local directory and outputs its path.</p>
<p>The name of the new directory is specified with the directoryName parameter.</p>">
+ </property>
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Wibke Sudholt">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="trigger (port)" class="ptolemy.kernel.util.StringAttribute" value="A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time.">
+ </property>
+ <property name="path (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the new directory path.">
+ </property>
+ <property name="Directory name (parameter)" class="ptolemy.data.expr.StringParameter" value="The name and path of the new directory. See FileParameter for more information about specifying paths.">
+ </property>
+ </property>
+ <property name="requiredFiringsPerIteration" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <port name="trigger" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="Counter" class="ptolemy.actor.lib.Counter">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Steve Neuendorffer</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Counter actor increments or decrements an internal counter, depending on its inputs. The actor outputs the counter value as an integer.</p>
<p>Each time the actor fires, it adjusts its internal counter (incrementing or decrementing the count) based on the input. Whenever a token is received from the increment input, the internal counter is incremented. Wh [...]
+<property name="port:increment" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An input port used to increment the counter. The port accepts tokens of any type. </configure></property>
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the counter value.</configure></property>
+<property name="port:decrement" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An input port used to decrement the counter. The port accepts tokens of any type.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:80:2">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.Counter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:947:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#IterativeMathOperationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{298.73940203381375, 500.97739297825916}">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:72:1">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="description" class="ptolemy.kernel.util.StringAttribute" value="<p>The Counter actor increments or decrements an internal counter, depending on its inputs. The actor outputs the counter value as an integer.</p>
<p>Each time the actor fires, it adjusts its internal counter (incrementing or decrementing the count) based on the input. Whenever a token is received from the increment input, the internal counter is incremented. Wheneve [...]
+ </property>
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Steve Neuendorffer">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="increment (port)" class="ptolemy.kernel.util.StringAttribute" value="An input port used to increment the counter. The port accepts tokens of any type. ">
+ </property>
+ <property name="decrement (port)" class="ptolemy.kernel.util.StringAttribute" value="An input port used to decrement the counter. The port accepts tokens of any type.">
+ </property>
+ <property name="output (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the counter value.">
+ </property>
</property>
+ <port name="decrement" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="String Constant3" class="ptolemy.actor.lib.StringConst">
<property name="value" class="ptolemy.data.expr.Parameter" value=" out of ">
</property>
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
@@ -5552,7 +5481,7 @@
<property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
</property>
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{447.57806, 207.69272}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{323.73940203381375, 565.9773929782591}">
</property>
<property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
@@ -5563,13 +5492,13 @@
</property>
</port>
</entity>
- <entity name="String Constant3" class="ptolemy.actor.lib.StringConst">
+ <entity name="String Constant4" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="$END_PRODUCTS_DIR">
+ </property>
<property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
</property>
<property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
</property>
- <property name="value" class="ptolemy.data.expr.Parameter" value="processing dataset ">
- </property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
@@ -5579,7 +5508,9 @@
<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
-</property> <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31989:92:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
</property>
</property>
@@ -5593,62 +5524,61 @@
<property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
</property>
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{477.57806, 97.69272}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{561.1613420338138, 903.2846729782591}">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1:urn:lsid:kepler-project.org/ns/:14094:13:2:urn:lsid:kepler-project.org/ns/:13757:393:3">
</property>
<property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
<port name="trigger" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
</port>
</entity>
- <entity name="Display" class="ptolemy.actor.lib.gui.Display">
- <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={17, 461, 510, 388}, maximized=false}">
- </property>
- <property name="_paneSize" class="ptolemy.actor.gui.SizeAttribute" value="[508, 342]">
- </property>
- <property name="rowsDisplayed" class="ptolemy.data.expr.Parameter" value="10">
- </property>
- <property name="columnsDisplayed" class="ptolemy.data.expr.Parameter" value="40">
- </property>
- <property name="suppressBlankLines" class="ptolemy.data.expr.Parameter" value="true">
+ <entity name="Variable Setter" class="ptolemy.actor.lib.SetVariable">
+ <property name="variableName" class="ptolemy.kernel.util.StringAttribute" value="END_PRODUCTS_SUBDIR">
</property>
- <property name="title" class="ptolemy.data.expr.StringParameter" value="Current DataSet">
+ <property name="delayed" class="ptolemy.data.expr.Parameter" value="false">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Yuhong Xiong, Edward A. Lee</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee, Steve Neuendorffer, Jerome Blanc</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Display actor reads tokens of any type via its input multiport, and displays each token on a separate line in a text display window.</p>
<p>Specify the size of the text display window with the rowsDisplayed and columnsDisplayed parameters. Simply resizing the window onscreen does not persistently change the size when the workflow is saved, closed, and the [...]
-<property name="port:input" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts tokens of any type.</configure></property>
-<property name="prop:suppressBlankLines" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether the actor should display blank lines (the default) or suppress them.</configure></property>
-<property name="prop:rowsDisplayed" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical size of the display, in rows. The value is an integer that defaults to 10.</configure></property>
-<property name="prop:columnsDisplayed" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal size of the display, in columns. The value is an integer that defaults to 40.</configure></property>
-<property name="prop:title" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The title of the text display window. If specified, the value will appear in the title bar of the text display window.</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:83:2">
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
Set the value of a variable. The result may occur at two different times, depending on the value of the delayed parameter.
If delayed is true, then the change to the value of the variable is implemented in a change request, and consequently will not take hold until the end of the current toplevel iteration. This helps ensure that users of value of the variable will see changes t [...]
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:89:6">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.gui.Display">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:883:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.SetVariable">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:886:1">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#TextualOutputActor">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Variable">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#TextualOutput">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#LocalInput">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{775.0, 255.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{511.16134203381375, 813.2846729782591}">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:7:1">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:10:1:urn:lsid:kepler-project.org/ns/:13757:404:3">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="description" class="ptolemy.kernel.util.StringAttribute" value="
Set the value of a variable. The result may occur at two different times, depending on the value of the delayed parameter.
If delayed is true, then the change to the value of the variable is implemented in a change request, and consequently will not take hold until the end of the current toplevel iteration. This helps ensure that users of value of the variable will see changes to the [...]
+ </property>
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Edward Lee, Steve Neuendorffer, Jerome Blanc">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
</property>
</entity>
- <entity name="String Constant4" class="ptolemy.actor.lib.StringConst">
+ <entity name="String Constant5" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="Processing data set ">
+ </property>
<property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
</property>
<property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
</property>
- <property name="value" class="ptolemy.data.expr.Parameter" value="$N_SELECTED_DATASETS :">
- </property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
@@ -5672,7 +5602,7 @@
<property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
</property>
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{432.57806, 272.69272}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{353.73940203381375, 455.97739297825916}">
</property>
<property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
@@ -5684,7 +5614,7 @@
</port>
</entity>
<entity name="3" class="org.resurgence.actor.StringAccumulator">
- <property name="Substring separator" class="ptolemy.data.expr.Parameter" value=""/"">
+ <property name="Substring separator" class="ptolemy.data.expr.Parameter" value="""">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
@@ -5694,7 +5624,7 @@
<property name="port:whole" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the full string.</configure></property>
<property name="port:parts" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts substrings.</configure></property>
<property name="prop:Substring separator" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The characters used to separate the elements in the output string. By default, the value is "".</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:90:1">
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:79:4">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.StringAccumulator">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1117:1">
@@ -5704,95 +5634,50 @@
</property>
<property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{560.0, 535.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{548.7394020338138, 615.9773929782591}">
</property>
<property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:292:1:urn:lsid:kepler-project.org/ns/:13757:392:4">
</property>
- <port name="parts" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="multiport"/>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
- </property>
- </port>
- </entity>
- <entity name="Variable Setter" class="ptolemy.actor.lib.SetVariable">
- <property name="variableName" class="ptolemy.kernel.util.StringAttribute" value="END_PRODUCT_SUBDIR">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
- <property name="delayed" class="ptolemy.data.expr.Parameter" value="false">
+ </entity>
+ <entity name="Display" class="ptolemy.actor.lib.gui.Display">
+ <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={1367, 140, 510, 392}, maximized=false}">
</property>
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee, Steve Neuendorffer, Jerome Blanc</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
Set the value of a variable. The result may occur at two different times, depending on the value of the delayed parameter.
If delayed is true, then the change to the value of the variable is implemented in a change request, and consequently will not take hold until the end of the current toplevel iteration. This helps ensure that users of value of the variable will see changes t [...]
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:89:6">
+ <property name="_paneSize" class="ptolemy.actor.gui.SizeAttribute" value="[508, 346]">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.SetVariable">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:886:1">
- </property>
+ <property name="rowsDisplayed" class="ptolemy.data.expr.Parameter" value="10">
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Variable">
+ <property name="columnsDisplayed" class="ptolemy.data.expr.Parameter" value="40">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#LocalInput">
+ <property name="suppressBlankLines" class="ptolemy.data.expr.Parameter" value="true">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{690.0, 535.0}">
- </property>
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:10:1:urn:lsid:kepler-project.org/ns/:13757:404:3">
- </property>
- <property name="" class="ptolemy.vergil.basic.DocAttribute">
- <property name="description" class="ptolemy.kernel.util.StringAttribute" value="
Set the value of a variable. The result may occur at two different times, depending on the value of the delayed parameter.
If delayed is true, then the change to the value of the variable is implemented in a change request, and consequently will not take hold until the end of the current toplevel iteration. This helps ensure that users of value of the variable will see changes to the [...]
- </property>
- <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Edward Lee, Steve Neuendorffer, Jerome Blanc">
- </property>
- <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
- </property>
- </property>
- </entity>
- <entity name="Directory Maker" class="org.resurgence.actor.DirectoryMaker">
- <property name="Directory name" class="ptolemy.actor.parameters.PortParameter" value="">
+ <property name="title" class="ptolemy.data.expr.StringParameter" value="Current DataSet">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Yuhong Xiong, Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The DirectoryMaker actor creates a new local directory and outputs its path.</p>
<p>The name of the new directory is specified with the directoryName parameter.</p></configure></property>
-<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time.</configure></property>
-<property name="port:path" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the new directory path.</configure></property>
-<property name="prop:Directory name" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The name and path of the new directory. See FileParameter for more information about specifying paths.</configure></property>
-</property> <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.DirectoryMaker">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1111:1">
- </property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Display actor reads tokens of any type via its input multiport, and displays each token on a separate line in a text display window.</p>
<p>Specify the size of the text display window with the rowsDisplayed and columnsDisplayed parameters. Simply resizing the window onscreen does not persistently change the size when the workflow is saved, closed, and the [...]
+<property name="port:input" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts tokens of any type.</configure></property>
+<property name="prop:suppressBlankLines" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether the actor should display blank lines (the default) or suppress them.</configure></property>
+<property name="prop:rowsDisplayed" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical size of the display, in rows. The value is an integer that defaults to 10.</configure></property>
+<property name="prop:columnsDisplayed" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal size of the display, in columns. The value is an integer that defaults to 40.</configure></property>
+<property name="prop:title" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The title of the text display window. If specified, the value will appear in the title bar of the text display window.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:83:2">
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#FileSystemActor">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.gui.Display">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:883:1">
+ </property>
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#FileSystem">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#TextualOutputActor">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{780.0, 535.0}">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#TextualOutput">
</property>
- <property name="" class="ptolemy.vergil.basic.DocAttribute">
- <property name="description" class="ptolemy.kernel.util.StringAttribute" value="<p>The DirectoryMaker actor creates a new local directory and outputs its path.</p>
<p>The name of the new directory is specified with the directoryName parameter.</p>">
- </property>
- <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Wibke Sudholt">
- </property>
- <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
- </property>
- <property name="trigger (port)" class="ptolemy.kernel.util.StringAttribute" value="A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time.">
- </property>
- <property name="path (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the new directory path.">
- </property>
- <property name="Directory name (parameter)" class="ptolemy.data.expr.StringParameter" value="The name and path of the new directory. See FileParameter for more information about specifying paths.">
- </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{651.1613420338138, 613.2846729782591}">
</property>
- <property name="requiredFiringsPerIteration" class="ptolemy.data.expr.Parameter" value="1">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:7:1">
</property>
- <port name="trigger" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="multiport"/>
- <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
- </property>
- </port>
</entity>
<relation name="relation" class="ptolemy.actor.TypedIORelation">
<property name="width" class="ptolemy.data.expr.Parameter" value="1">
@@ -5813,6 +5698,8 @@
<relation name="relation5" class="ptolemy.actor.TypedIORelation">
<property name="width" class="ptolemy.data.expr.Parameter" value="1">
</property>
+ <vertex name="vertex1" value="{441.16134203381375, 903.2846729782591}">
+ </vertex>
</relation>
<relation name="relation6" class="ptolemy.actor.TypedIORelation">
<property name="width" class="ptolemy.data.expr.Parameter" value="1">
@@ -5821,13 +5708,11 @@
<relation name="relation7" class="ptolemy.actor.TypedIORelation">
<property name="width" class="ptolemy.data.expr.Parameter" value="1">
</property>
- <vertex name="vertex1" value="[560.0, 330.0]">
- </vertex>
</relation>
<relation name="relation8" class="ptolemy.actor.TypedIORelation">
<property name="width" class="ptolemy.data.expr.Parameter" value="1">
</property>
- <vertex name="vertex1" value="[250.0, 330.0]">
+ <vertex name="vertex1" value="[125.0, 695.0]">
</vertex>
</relation>
<relation name="relation9" class="ptolemy.actor.TypedIORelation">
@@ -5837,40 +5722,51 @@
<relation name="relation10" class="ptolemy.actor.TypedIORelation">
<property name="width" class="ptolemy.data.expr.Parameter" value="1">
</property>
+ <vertex name="vertex1" value="{436.16134203381375, 688.2846729782591}">
+ </vertex>
</relation>
- <link port="current_dataset" relation="relation7"/>
+ <relation name="relation11" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <link port="current_dataset" relation="relation10"/>
<link port="dataset_in" relation="relation8"/>
<link port="dataset" relation="relation8"/>
- <link port="2.parts" relation="relation2"/>
- <link port="2.parts" relation="relation9"/>
- <link port="2.parts" relation="relation3"/>
- <link port="2.parts" relation="relation"/>
- <link port="2.parts" relation="relation7"/>
- <link port="2.whole" relation="relation6"/>
- <link port="String Constant.output" relation="relation5"/>
+ <link port="String Constant.output" relation="relation2"/>
<link port="String Constant.trigger" relation="relation8"/>
- <link port="Counter.increment" relation="relation8"/>
- <link port="Counter.output" relation="relation9"/>
- <link port="CurrentDataSet.in" relation="relation8"/>
- <link port="CurrentDataSet.dataset name" relation="relation7"/>
- <link port="String Constant2.output" relation="relation3"/>
+ <link port="String Accumulator.parts" relation="relation3"/>
+ <link port="String Accumulator.parts" relation="relation5"/>
+ <link port="String Accumulator.whole" relation="relation9"/>
+ <link port="2.parts" relation="relation11"/>
+ <link port="2.parts" relation="relation10"/>
+ <link port="2.whole" relation="relation5"/>
+ <link port="String Constant2.output" relation="relation11"/>
<link port="String Constant2.trigger" relation="relation8"/>
- <link port="String Constant3.output" relation="relation2"/>
+ <link port="CurrentDataSet.in" relation="relation8"/>
+ <link port="CurrentDataSet.dataset name" relation="relation10"/>
+ <link port="Directory Maker.Directory name" relation="relation9"/>
+ <link port="Counter.increment" relation="relation8"/>
+ <link port="Counter.output" relation="relation4"/>
+ <link port="String Constant3.output" relation="relation6"/>
<link port="String Constant3.trigger" relation="relation8"/>
- <link port="Display.input" relation="relation6"/>
- <link port="String Constant4.output" relation="relation"/>
- <link port="String Constant4.trigger" relation="relation8"/>
- <link port="3.parts" relation="relation5"/>
+ <link port="String Constant4.output" relation="relation3"/>
+ <link port="String Constant4.trigger" relation="relation5"/>
+ <link port="Variable Setter.input" relation="relation5"/>
+ <link port="String Constant5.output" relation="relation7"/>
+ <link port="String Constant5.trigger" relation="relation8"/>
<link port="3.parts" relation="relation7"/>
- <link port="3.whole" relation="relation10"/>
- <link port="Variable Setter.input" relation="relation10"/>
- <link port="Variable Setter.output" relation="relation4"/>
- <link port="Directory Maker.Directory name" relation="relation4"/>
+ <link port="3.parts" relation="relation4"/>
+ <link port="3.parts" relation="relation6"/>
+ <link port="3.parts" relation="relation2"/>
+ <link port="3.parts" relation="relation10"/>
+ <link port="3.whole" relation="relation"/>
+ <link port="Display.input" relation="relation"/>
</entity>
- <entity name="Close DataSet" class="ptolemy.actor.TypedCompositeActor">
- <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="7.0.2">
+ <entity name="STANDARD_STAR" class="ptolemy.actor.TypedCompositeActor">
+ <display name="STANDARD_STAR
(TELLURIC)"/>
+ <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="8.1.devel">
</property>
- <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:492:1">
+ <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:427:41">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.TypedCompositeActor">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:449:1">
@@ -5887,754 +5783,722 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Yuhong Xiong</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>A Composite actor is an aggregation of actors. It may have a local director that is responsible for executing the contained actors. A Composite actor with a local director is called an opaque actor. Composite actors do not require a local director. Composite actors with no local director "inherit" the director from the containing workflow and are called non-opaque.</ [...]
-</property> <property name="_location" class="ptolemy.kernel.util.Location" value="[1195.0, 1090.0]">
- </property>
- <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={22, 86, 1302, 809}, maximized=false}">
- </property>
- <property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[988, 658]">
- </property>
- <property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="1.3678500665865">
- </property>
- <property name="_vergilCenter" class="ptolemy.data.expr.ExpertParameter" value="{1315.1506933890578, 786.5234375}">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:15314:107:61:urn:lsid:kepler-project.org/ns/:25158:63:2">
+</property> <property name="_location" class="ptolemy.kernel.util.Location" value="[685.0, 980.0]">
</property>
- <property name="Annotation" class="ptolemy.vergil.kernel.attributes.TextAttribute">
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
- </property>
- <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
- </property>
- <property name="textSize" class="ptolemy.data.expr.Parameter" value="14">
- </property>
- <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 0.0, 1.0, 1.0}">
- </property>
- <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
- </property>
- <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
- </property>
- <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
- </property>
- <property name="text" class="ptolemy.kernel.util.StringAttribute" value="This subworkflow modifies the END_PRODUCT_SUBDIR variable,
increasing one number each a data set is run">
- <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
- <property name="height" class="ptolemy.data.expr.Parameter" value="20">
- </property>
- <property name="width" class="ptolemy.data.expr.Parameter" value="80">
- </property>
- </property>
- </property>
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
-<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
-<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
-<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
-<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
-<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
-<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:436:1">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
- </property>
- </property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{165.0, 590.0}">
- </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:15314:197:41:urn:lsid:kepler-project.org/ns/:21155:64:67:urn:lsid:kepler-project.org/ns/:29452:30:11">
</property>
- <port name="current_dataset" class="ptolemy.actor.TypedIOPort">
+ <port name="sof_in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{195.0, 215.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{65.0, 165.0}">
</property>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
</property>
</port>
- <port name="final_files" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{15.0, 415.0}">
- </property>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ <port name="sof_out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{675.0, 175.0}">
</property>
</port>
- <entity name="String Constant" class="ptolemy.actor.lib.StringConst">
- <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
- </property>
- <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
- </property>
- <property name="value" class="ptolemy.data.expr.Parameter" value="README">
- </property>
+ <entity name="SofSplitter" class="org.eso.SofSplitter">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
-<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
-<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
-<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
-<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:123:3">
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofSplitter takes a set of files as input and split it into smaller sets based on the purpose. This smaller sets can then be sent to e.g. a RecipeExecuter</configure></property>
+<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sof</configure></property>
+<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sofs</configure></property>
+<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups generated</configure></property>
+<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:198:2">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofSplitter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ <property name="semanticType" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
</property>
- <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
- <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
- </property>
- <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
- </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{160.0, 140.0}">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{740.0, 545.0}">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org/ns/:12925:5:1">
</property>
<property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1">
- </property>
- <port name="trigger" class="ptolemy.actor.TypedIOPort">
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </port>
+ <port name="#groups" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
</port>
</entity>
- <entity name="Display Current Dataset" class="ptolemy.actor.lib.gui.Display">
- <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={271, 477, 1329, 200}, maximized=false}">
- </property>
- <property name="_paneSize" class="ptolemy.actor.gui.SizeAttribute" value="[1323, 153]">
- </property>
- <property name="rowsDisplayed" class="ptolemy.data.expr.Parameter" value="10">
- </property>
- <property name="columnsDisplayed" class="ptolemy.data.expr.Parameter" value="120">
- </property>
- <property name="suppressBlankLines" class="ptolemy.data.expr.Parameter" value="false">
- </property>
- <property name="title" class="ptolemy.data.expr.StringParameter" value="Current Dataset">
+ <entity name="SofAccumulator" class="org.eso.SofAccumulator">
+ <property name="same dataset" class="ptolemy.data.expr.Parameter" value="true">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Yuhong Xiong, Edward A. Lee</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Display actor reads tokens of any type via its input multiport, and displays each token on a separate line in a text display window.</p>
<p>Specify the size of the text display window with the rowsDisplayed and columnsDisplayed parameters. Simply resizing the window onscreen does not persistently change the size when the workflow is saved, closed, and the [...]
-<property name="port:input" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts tokens of any type.</configure></property>
-<property name="prop:suppressBlankLines" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether the actor should display blank lines (the default) or suppress them.</configure></property>
-<property name="prop:rowsDisplayed" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical size of the display, in rows. The value is an integer that defaults to 10.</configure></property>
-<property name="prop:columnsDisplayed" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal size of the display, in columns. The value is an integer that defaults to 40.</configure></property>
-<property name="prop:title" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The title of the text display window. If specified, the value will appear in the title bar of the text display window.</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:17547:3:12">
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofAccumulator is meant to be used together with the SofSplitter: it puts back together in a single set of files the tokens generated by the PurposeSerializer (and usually processed by the RecipeExecuter)</configure></property>
+<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
+<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sof</configure></property>
+<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups to collect</configure></property>
+<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:same dataset" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>If true the SofAccumulator throws an error if the input tokens do not belong all to the same dataset</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:199:2">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.gui.Display">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:883:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofAccumulator">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#TextualOutputActor">
+ <property name="semanticType" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#TextualOutput">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{565.0, 150.0}">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{805.0, 180.0}">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org/ns/:12925:7:1">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:7:1:urn:lsid:kepler-project.org/ns/:13643:22:2">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
- <property name="" class="ptolemy.vergil.basic.DocAttribute">
- <property name="description" class="ptolemy.kernel.util.StringAttribute" value="<p>The Display actor reads tokens of any type via its input multiport, and displays each token on a separate line in a text display window.</p>
<p>Specify the size of the text display window with the rowsDisplayed and columnsDisplayed parameters. Simply resizing the window onscreen does not persistently change the size when the workflow is saved, closed, and then re- [...]
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
- <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Yuhong Xiong, Edward A. Lee">
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="0">
</property>
- <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </port>
+ <port name="#groups" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
</property>
- <property name="rowsDisplayed (parameter)" class="ptolemy.data.expr.StringParameter" value="The vertical size of the display, in rows. The value is an integer that defaults to 10.">
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
</property>
- <property name="columnsDisplayed (parameter)" class="ptolemy.data.expr.StringParameter" value="The horizontal size of the display, in columns. The value is an integer that defaults to 40.">
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
- <property name="suppressBlankLines (parameter)" class="ptolemy.data.expr.StringParameter" value="Specify whether the actor should display blank lines (the default) or suppress them.">
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
- <property name="title (parameter)" class="ptolemy.data.expr.StringParameter" value="The title of the text display window. If specified, the value will appear in the title bar of the text display window.">
+ </port>
+ </entity>
+ <entity name="kmo_std_star_1" class="org.eso.RecipeExecuter">
+ <property name="Recipe Failure Mode" class="ptolemy.data.expr.StringParameter" value="Continue">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[345.0, 120.0]">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
</property>
- <property name="input (port)" class="ptolemy.kernel.util.StringAttribute" value="A multiport that accepts tokens of any type.">
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
</property>
- </property>
+ </port>
</entity>
- <entity name="String Constant2" class="ptolemy.actor.lib.StringConst">
- <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
+ <relation name="relation2" class="ptolemy.actor.TypedIORelation">
+ </relation>
+ <relation name="relation4" class="ptolemy.actor.TypedIORelation">
+ </relation>
+ <relation name="relation5" class="ptolemy.actor.TypedIORelation">
+ </relation>
+ <relation name="relation3" class="ptolemy.actor.TypedIORelation">
+ <vertex name="vertex1" value="[245.0, 140.0]">
+ </vertex>
+ </relation>
+ <relation name="relation" class="ptolemy.actor.TypedIORelation">
+ </relation>
+ <link port="sof_in" relation="relation4"/>
+ <link port="sof_out" relation="relation5"/>
+ <link port="SofSplitter.sof in" relation="relation4"/>
+ <link port="SofSplitter.sof out" relation="relation3"/>
+ <link port="SofSplitter.#groups" relation="relation2"/>
+ <link port="SofAccumulator.sof in" relation="relation"/>
+ <link port="SofAccumulator.#groups" relation="relation2"/>
+ <link port="SofAccumulator.sof out" relation="relation5"/>
+ <link port="kmo_std_star_1.sof in" relation="relation3"/>
+ <link port="kmo_std_star_1.sof out" relation="relation"/>
+ </entity>
+ <entity name="SofCombiner5" class="org.eso.SofCombiner">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofCombiner takes as input a number of set of files and combines them into one set of files that contains only the files whose purposes are present in all the input tokens. With this respect empty tokens are ignored and files with universal purpose are always collected</configure></property>
+<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
+<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The combined sof</configure></property>
+<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:430:103">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofCombiner">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
- <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+ <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[155.0, 825.0]">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:908:1">
+ </property>
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
- <property name="value" class="ptolemy.data.expr.Parameter" value="$END_PRODUCTS_DIR">
+ </port>
+ <port name="sof in opt" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
-<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
-<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
-<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
-<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:121:3">
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
- </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ </port>
+ </entity>
+ <entity name="SofCombiner7" class="org.eso.SofCombiner">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofCombiner takes as input a number of set of files and combines them into one set of files that contains only the files whose purposes are present in all the input tokens. With this respect empty tokens are ignored and files with universal purpose are always collected</configure></property>
+<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
+<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The combined sof</configure></property>
+<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:490:3">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofCombiner">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
- <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
- <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
- </property>
- <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
- </property>
+ </property>
+ <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[370.0, 790.0]">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:908:1">
+ </property>
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{735.0, 445.0}">
+ </port>
+ <port name="sof in opt" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1">
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
- <port name="trigger" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
- </property>
- </port>
- </entity>
- <entity name="String Constant3" class="ptolemy.actor.lib.StringConst">
- <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
+ </port>
+ </entity>
+ <entity name="CompositeActor" class="ptolemy.actor.TypedCompositeActor">
+ <display name="Collapse datacube"/>
+ <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="8.1.devel">
+ </property>
+ <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:679:95">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.TypedCompositeActor">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:449:1">
</property>
- <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Actor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#GeneralPurpose">
+ </property>
+ <property name="semanticType22" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Workflow">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Yuhong Xiong</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>A Composite actor is an aggregation of actors. It may have a local director that is responsible for executing the contained actors. A Composite actor with a local director is called an opaque actor. Composite actors do not require a local director. Composite actors with no local director "inherit" the director from the containing workflow and are called non-opaque.</ [...]
+</property> <property name="_location" class="ptolemy.kernel.util.Location" value="[1025.0, 695.0]">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:21155:635:86:urn:lsid:kepler-project.org/ns/:31617:248:133">
+ </property>
+ <property name="DDF Director" class="ptolemy.domains.ddf.kernel.DDFDirector">
+ <property name="iterations" class="ptolemy.data.expr.Parameter" value="0">
</property>
- <property name="value" class="ptolemy.data.expr.Parameter" value=" Dataset has been reduced and saved in ">
+ <property name="maximumReceiverCapacity" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+ <property name="runUntilDeadlockInOneIteration" class="ptolemy.data.expr.Parameter" value="true">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Gang Zhou</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
-<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
-<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
-<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
-<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:17547:19:3">
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
<p> The dynamic dataflow (DDF) domain is a superset of the synchronous
dataflow(SDF) and Boolean dataflow(BDF) domains. In the SDF domain,
an actor consumes and produces a fixed number of tokens per firing.
This static information makes possible compile-time scheduling. In the
DDF domain, there are few [...]
+<property name="prop:maximumReceiverCapacity" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A Parameter representing the maximum capacity of each receiver controlled by this director. This is an integer that defaults to 0, which means the queue in each receiver is unbounded. To specify bounded queues, set this to a positive integer. </configure></property>
+<property name="prop:iterations" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify the number of times a workflow is iterated. By default, this parameter is set to "0". Note that "0" does not mean "no iterations." Rather, "0" means that the workflow will iterate forever. Values greater than zero specify the actual number of times the director should execute the entire workflow. </configure></property>
+<property name="prop:runUntilDeadlockInOneIteration" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A parameter indicating whether one iteration consists of repeated basic iterations until deadlock. If this parameter is true, the model will be executed until deadlock in one iteration. The default value is a BooleanToken with the value false. It cannot be set to true if this director is at the top level.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:262:1">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.domains.ddf.kernel.DDFDirector">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:directorclass:5:1">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Director">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Director">
</property>
- <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
- <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
- </property>
- <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
- </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[-275.0, 640.0]">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{265.0, 365.0}">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:director:5:1">
</property>
+ </property>
+ <property name="Annotation" class="ptolemy.vergil.kernel.attributes.TextAttribute">
<property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1:urn:lsid:kepler-project.org/ns/:13643:21:2">
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
</property>
- <port name="trigger" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.007843138,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="NOTE: There are two actors in this workflow that fix bugs in other actors.
They should be removed once those bugs have been fixed!!!!
The two actors are:
The "give purpose number" actor fixes a problem with the SOF splitter.
The "Change CATG" actor fixes a problem with the make_image recipe.">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
</property>
- </port>
- </entity>
- <entity name="Final directory path" class="org.resurgence.actor.StringAccumulator">
- <property name="Substring separator" class="ptolemy.data.expr.Parameter" value=""/"">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>
The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p></configure></property>
-<property name="port:whole" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the full string.</configure></property>
-<property name="port:parts" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts substrings.</configure></property>
-<property name="prop:Substring separator" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The characters used to separate the elements in the output string. By default, the value is "".</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:17547:25:2">
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:277:6">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.StringAccumulator">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1117:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{380.0, 455.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[-110.0, 575.0]">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:292:1">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:436:1:urn:lsid:kepler-project.org/ns/:13757:278:7:urn:lsid:kepler-project.org/ns/:15166:196:1:urn:lsid:kepler-project.org/ns/:13757:433:1:urn:lsid:kepler-project.org/ns/:28993:48:7">
</property>
- </entity>
- <entity name="Write README" class="org.geon.FileWrite">
- <property name="fileName" class="ptolemy.actor.parameters.FilePortParameter" value="System.out">
+ </property>
+ <port name="output" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
</property>
- <property name="append" class="ptolemy.data.expr.Parameter" value="true">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[665.0, 975.0]">
</property>
- <property name="confirmOverwrite" class="ptolemy.data.expr.Parameter" value="false">
+ </port>
+ <port name="SOF_SCI_RED" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
</property>
- <property name="alwaysFlush" class="ptolemy.data.expr.Parameter" value="false">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[-305.0, 835.0]">
</property>
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>No author given</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FileWriter actor reads a string and writes it to a file. The actor outputs the file path of the generated file.</p>
<p>Specify a destination file path with the fileName parameter. If the specified file does not exist, then the actor will create it. If the file already exists, then the actor will ask for permission to overwrite it (unless the append param [...]
-<property name="port:input" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An input port that receives a string to write to a file.</configure></property>
-<property name="port:url" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the file name of the generated file.</configure></property>
-<property name="prop:append" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether to append the input string to an existing, specified file. By default, the actor will overwrite any preexisting file.</configure></property>
-<property name="prop:confirmOverwrite" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether the actor should confirm before overwriting an existing file. By default, the actor will not ask for confirmation.</configure></property>
-<property name="prop:fileName" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The name of the file to which to write. See FileParameter for more information about specifying file names. </configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:118:5">
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.geon.FileWrite">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1003:1">
- </property>
+ </port>
+ <port name="sci_combined" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#WriterOutputActor">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[-305.0, 970.0]">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#LocalOutput">
+ </port>
+ <entity name="Change CATG" class="ptolemy.actor.lib.python.PythonScript">
+ <property name="script" class="ptolemy.kernel.util.StringAttribute" value="from ptolemy.data import StringToken
from org.eso.util import JSONTools
from ptolemy.kernel.util import IllegalActionException
import java.util.regex.Pattern as Pattern;
class Main :
"Catg Changer"
def fire(self) :
#Read input files
input = self.sof_in.get(0)
string = input.stringValue()
#Creat [...]
+ <property name="style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="10">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="30">
+ </property>
+ </property>
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{890.0, 390.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[-115.0, 955.0]">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:144:1">
+ <property name="Replacements" class="ptolemy.data.expr.StringParameter" value="SCI_COMBINED:MAKE_IMG_DATA">
</property>
- <property name="" class="ptolemy.vergil.basic.DocAttribute">
- <property name="description" class="ptolemy.kernel.util.StringAttribute" value="<p>The FileWriter actor reads a string and writes it to a file. The actor outputs the file path of the generated file.</p>
<p>Specify a destination file path with the fileName parameter. If the specified file does not exist, then the actor will create it. If the file already exists, then the actor will ask for permission to overwrite it (unless the append parameter [...]
- </property>
- <property name="author" class="ptolemy.kernel.util.StringAttribute" value="No author given">
- </property>
- <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
- </property>
- <property name="append (parameter)" class="ptolemy.data.expr.StringParameter" value="Specify whether to append the input string to an existing, specified file. By default, the actor will overwrite any preexisting file.">
- </property>
- <property name="confirmOverwrite (parameter)" class="ptolemy.data.expr.StringParameter" value="Specify whether the actor should confirm before overwriting an existing file. By default, the actor will not ask for confirmation.">
- </property>
- <property name="input (port)" class="ptolemy.kernel.util.StringAttribute" value="An input port that receives a string to write to a file.">
- </property>
- <property name="url (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the file name of the generated file.">
- </property>
- <property name="fileName (parameter)" class="ptolemy.data.expr.StringParameter" value="The name of the file to which to write. See FileParameter for more information about specifying file names. ">
- </property>
+ <property name="_expertMode" class="ptolemy.kernel.util.SingletonAttribute">
</property>
- <port name="fileName" class="ptolemy.actor.parameters.ParameterPort">
+ <port name="sof_in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
- </property>
</port>
- <port name="url" class="ptolemy.actor.TypedIOPort">
+ <port name="sof_out" class="ptolemy.actor.TypedIOPort">
<property name="output"/>
- <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
- </property>
</port>
</entity>
- <entity name="String Constant4" class="ptolemy.actor.lib.StringConst">
- <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
- </property>
- <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
- </property>
- <property name="value" class="ptolemy.data.expr.Parameter" value="$END_PRODUCT_SUBDIR">
- </property>
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
-<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
-<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
-<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
-<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:17547:23:2">
+ <entity name="kmo_make_image_1" class="org.eso.RecipeExecuter">
+ <property name="Lazy Mode" class="ptolemy.data.expr.Parameter" value="false">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
- </property>
+ <property name="Recipe Failure Mode" class="ptolemy.data.expr.StringParameter" value="Continue">
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ <property name="Input Files Category" class="ptolemy.data.expr.StringParameter" value="">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ <property name="Output Files Category" class="ptolemy.data.expr.StringParameter" value="">
</property>
- <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
- <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
- </property>
- <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
- </property>
+ <property name="Pause after execution" class="ptolemy.data.expr.Parameter" value="false">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{275.0, 540.0}">
+ <property name="recipe_param_1" class="ptolemy.data.expr.Parameter" value="range=0,3.">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[346.99999237060547, 828.7499694824219]">
</property>
- <port name="trigger" class="ptolemy.actor.TypedIOPort">
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </port>
+ <port name="sop in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
</property>
</port>
</entity>
- <entity name="String Constant5" class="ptolemy.actor.lib.StringConst">
- <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
- </property>
- <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
- </property>
- <property name="value" class="ptolemy.data.expr.Parameter" value="$GLOBAL_TIMESTAMP">
+ <entity name="SofSplitter" class="org.eso.SofSplitter">
+ <property name="Group purposes" class="ptolemy.data.expr.Parameter" value="true">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
-<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
-<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
-<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
-<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:122:3">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
- </property>
- </property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofSplitter takes a set of files as input and split it into smaller sets, grouping them by purpose. Files with universal purpose are attached to every subset. This smaller sets can then be sent to e.g. a RecipeExecuter. Please refer to the user manual for more information.</configure></property>
+<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sof</configure></property>
+<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups generated</configure></property>
+<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sofs</configure></property>
+<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:680:1">
</property>
- <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
- <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
- </property>
- <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofSplitter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{730.0, 510.0}">
+ <property name="semanticType" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[145.0, 955.0]">
</property>
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org/ns/:12925:5:1:urn:lsid:kepler-project.org/ns/:21155:650:1:urn:lsid:kepler-project.org/ns/:31617:265:2">
</property>
- <port name="trigger" class="ptolemy.actor.TypedIOPort">
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="multiport"/>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
</port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </port>
+ <port name="#groups" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </port>
</entity>
- <entity name="Write to stdout" class="org.geon.FileWrite">
- <property name="fileName" class="ptolemy.actor.parameters.FilePortParameter" value="/dev/stdout">
- </property>
- <property name="append" class="ptolemy.data.expr.Parameter" value="true">
- </property>
- <property name="confirmOverwrite" class="ptolemy.data.expr.Parameter" value="false">
- </property>
- <property name="alwaysFlush" class="ptolemy.data.expr.Parameter" value="true">
+ <entity name="SofAccumulator" class="org.eso.SofAccumulator">
+ <property name="same dataset" class="ptolemy.data.expr.Parameter" value="true">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>No author given</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FileWriter actor reads a string and writes it to a file. The actor outputs the file path of the generated file.</p>
<p>Specify a destination file path with the fileName parameter. If the specified file does not exist, then the actor will create it. If the file already exists, then the actor will ask for permission to overwrite it (unless the append param [...]
-<property name="port:input" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An input port that receives a string to write to a file.</configure></property>
-<property name="port:url" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the file name of the generated file.</configure></property>
-<property name="prop:append" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether to append the input string to an existing, specified file. By default, the actor will overwrite any preexisting file.</configure></property>
-<property name="prop:confirmOverwrite" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether the actor should confirm before overwriting an existing file. By default, the actor will not ask for confirmation.</configure></property>
-<property name="prop:fileName" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The name of the file to which to write. See FileParameter for more information about specifying file names. </configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:17547:24:2">
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofAccumulator is meant to be used together with the SofSplitter: it puts back together in a single set of files the tokens generated by the SofSplitter (and usually processed by the RecipeExecuter)</configure></property>
+<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
+<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups to collect</configure></property>
+<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sof</configure></property>
+<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:same dataset" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>If true the SofAccumulator throws an error if the input tokens do not belong all to the same dataset</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:682:1">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.geon.FileWrite">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1003:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofAccumulator">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#WriterOutputActor">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#LocalOutput">
+ <property name="semanticType" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{850.0, 265.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[570.0, 950.0]">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:144:1:urn:lsid:kepler-project.org/ns/:15165:55:3">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org/ns/:12925:7:1">
</property>
- <property name="" class="ptolemy.vergil.basic.DocAttribute">
- <property name="description" class="ptolemy.kernel.util.StringAttribute" value="<p>The FileWriter actor reads a string and writes it to a file. The actor outputs the file path of the generated file.</p>
<p>Specify a destination file path with the fileName parameter. If the specified file does not exist, then the actor will create it. If the file already exists, then the actor will ask for permission to overwrite it (unless the append parameter [...]
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
- <property name="author" class="ptolemy.kernel.util.StringAttribute" value="No author given">
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="0">
</property>
- <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </port>
+ <port name="#groups" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
- <property name="append (parameter)" class="ptolemy.data.expr.StringParameter" value="Specify whether to append the input string to an existing, specified file. By default, the actor will overwrite any preexisting file.">
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
</property>
- <property name="confirmOverwrite (parameter)" class="ptolemy.data.expr.StringParameter" value="Specify whether the actor should confirm before overwriting an existing file. By default, the actor will not ask for confirmation.">
- </property>
- <property name="input (port)" class="ptolemy.kernel.util.StringAttribute" value="An input port that receives a string to write to a file.">
- </property>
- <property name="url (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the file name of the generated file.">
- </property>
- <property name="fileName (parameter)" class="ptolemy.data.expr.StringParameter" value="The name of the file to which to write. See FileParameter for more information about specifying file names. ">
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
- </property>
+ </port>
</entity>
- <entity name="String Constant6" class="ptolemy.actor.lib.StringConst">
- <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
- </property>
- <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
- </property>
- <property name="value" class="ptolemy.data.expr.Parameter" value="$END_PRODUCTS_DIR">
- </property>
+ <entity name="SofCombiner" class="org.eso.SofCombiner">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
-<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
-<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
-<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
-<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:17547:23:5">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofCombiner takes as input a number of set of files and combines them into one set of files that contains only the files whose purposes are present in all the input tokens. With this respect empty tokens are ignored and files with universal purpose are always collected. Please refer to the user manual for more information.</configure></property>
+<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
+<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The combined sof</configure></property>
+<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:681:1">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofCombiner">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[221.99999237060547, 818.7499694824219]">
</property>
- <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
- <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:908:1:urn:lsid:kepler-project.org/ns/:31617:249:2">
+ </property>
+ <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
- <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
</property>
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{275.0, 415.0}">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1">
- </property>
- <port name="trigger" class="ptolemy.actor.TypedIOPort">
+ </port>
+ <port name="sof in opt" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </port>
+ <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </port>
+ <port name="logs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
</port>
</entity>
- <entity name="Path to README" class="org.resurgence.actor.StringAccumulator">
- <property name="Substring separator" class="ptolemy.data.expr.Parameter" value=""/"">
- </property>
+ <entity name="FitsRouter" class="org.eso.FitsRouter">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>
The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p></configure></property>
-<property name="port:whole" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the full string.</configure></property>
-<property name="port:parts" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts substrings.</configure></property>
-<property name="prop:Substring separator" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The characters used to separate the elements in the output string. By default, the value is "".</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:124:4">
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>1.0</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FitsRouter routes files base on their category: by default, all the files are routed to the rejected directory, but the user can add additional port and configure the actor to route particular files there.</p>
<p>Basic Mode: create an output port named as a category (e.g.: FLAT), all files belonging to that category will be routed to that port.</p>
& [...]
+<property name="port:in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input data</configure></property>
+<property name="port:sof rejected" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The rejected SoF</configure></property>
+<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:653:4">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.StringAccumulator">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1117:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.FitsRouter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
+ <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{880.0, 495.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[-215.0, 810.0]">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:292:1">
+ <property name="OH_SPEC" class="ptolemy.data.expr.Parameter" value=""OH_SPEC"">
</property>
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:903:1">
</property>
- <port name="whole" class="ptolemy.actor.TypedIOPort">
+ <port name="in" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ <port name="sof rejected" class="ptolemy.actor.TypedIOPort">
<property name="output"/>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="OH_SPEC" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
</port>
</entity>
- <entity name="Final message" class="org.resurgence.actor.StringAccumulator">
- <property name="Substring separator" class="ptolemy.data.expr.Parameter" value="""">
+ <entity name="give purpose number" class="ptolemy.actor.lib.python.PythonScript">
+ <property name="script" class="ptolemy.kernel.util.StringAttribute" value="# This is a simple actor that copies the input to the output.
# You can remove the ports, add new ports, and modify the script.
from org.eso.util import JSONTools
#from org.eso.domain import SetOfFiles
import java.lang.String
import java.util.TreeSet
class Main :
"Trim the last purpose"
def fire(self) :
in_sof = self.in_sof.get(0)
out_s [...]
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Xiaojun Liu</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>
The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p></configure></property>
-<property name="port:whole" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the full string.</configure></property>
-<property name="port:parts" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts substrings.</configure></property>
-<property name="prop:Substring separator" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The characters used to separate the elements in the output string. By default, the value is "".</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:17547:26:1">
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
This actor executes a Python script. The default script has an
input port and an output port. To view or edit the script, double-click
on the actor.
<p>
As an example, a simplified version of the Scale actor can be
implemented by the following script:
</p>
<pre>
1. class Main :
2. "scale"
3. def fire(se [...]
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:264:4">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.StringAccumulator">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1117:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.python.PythonScript">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:545:1">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#GeneralPurpose">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.TextEditorConfigureFactory">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="script">
+ </property>
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{480.0, 335.0}">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[-15.0, 955.0]">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:292:1">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:545:1:urn:lsid:kepler-project.org/ns/:16482:31:16:urn:lsid:kepler-project.org/ns/:24723:5:7:urn:lsid:kepler-project.org/ns/:25047:2:13">
+ </property>
+ <port name="in_sof" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ </port>
+ <port name="out_sof" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ </port>
+ </entity>
+ <entity name="Repeat" class="ptolemy.domains.sdf.lib.Repeat">
+ <property name="numberOfTimes" class="ptolemy.actor.parameters.PortParameter" value="200">
+ </property>
+ <property name="blockSize" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Shankar Rao, Steve Neuendorffer</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
<p>The Repeat actor reads and repeats a "block" of tokens (i.e., one or more tokens of any type). The actor outputs the block a user-specified number of times.</p>
<p>Specify the block size with the blockSize parameter and the number of times to repeat the block with the numberOfTimes parameter. Note: because the actor reads multiple input tokens [...]
+<property name="port:input" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An input port that accepts tokens of any type. Specify the number of tokens to read at each iteration with the blockSize parameter.</configure></property>
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the block of tokens the specified number of times. Specify the number of times to repeat the output with the numberOfTimes parameter.</configure></property>
+<property name="prop:blockSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of tokens in a block. The value is an integer and must be greater than zero. The default is 1. </configure></property>
+<property name="prop:numberOfTimes" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The repetition factor. The value is an integer and must be greater than 0. The default is 2. </configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:269:5">
</property>
<property name="" class="ptolemy.vergil.basic.DocAttribute">
- <property name="description" class="ptolemy.kernel.util.StringAttribute" value="<p>
The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p>">
+ <property name="description" class="ptolemy.kernel.util.StringAttribute" value="
<p>The Repeat actor reads and repeats a "block" of tokens (i.e., one or more tokens of any type). The actor outputs the block a user-specified number of times.</p>
<p>Specify the block size with the blockSize parameter and the number of times to repeat the block with the numberOfTimes parameter. Note: because the actor reads multiple input tokens at e [...]
</property>
- <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Wibke Sudholt">
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Shankar Rao, Steve Neuendorffer">
</property>
<property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
- <property name="Substring separator (parameter)" class="ptolemy.data.expr.StringParameter" value="The characters used to separate the elements in the output string. By default, the value is "".">
+ <property name="blockSize (parameter)" class="ptolemy.data.expr.StringParameter" value="The number of tokens in a block. The value is an integer and must be greater than zero. The default is 1. ">
</property>
- <property name="parts (port)" class="ptolemy.kernel.util.StringAttribute" value="A multiport that accepts substrings.">
+ <property name="input (port)" class="ptolemy.kernel.util.StringAttribute" value="An input port that accepts tokens of any type. Specify the number of tokens to read at each iteration with the blockSize parameter.">
</property>
- <property name="whole (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the full string.">
+ <property name="output (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the block of tokens the specified number of times. Specify the number of times to repeat the output with the numberOfTimes parameter.">
+ </property>
+ <property name="numberOfTimes (parameter)" class="ptolemy.data.expr.StringParameter" value="The repetition factor. The value is an integer and must be greater than 0. The default is 2. ">
</property>
</property>
- </entity>
- <relation name="relation" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
- </property>
- <vertex name="vertex1" value="[570.0, 355.0]">
- </vertex>
- </relation>
- <relation name="relation2" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.domains.sdf.lib.Repeat">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1130:1">
+ </property>
</property>
- </relation>
- <relation name="relation3" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#ControlActor">
</property>
- </relation>
- <relation name="relation4" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowControl">
</property>
- </relation>
- <relation name="relation5" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[96.99999237060547, 818.7499694824219]">
</property>
- </relation>
- <relation name="relation6" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:364:1">
</property>
- </relation>
- <relation name="relation7" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </entity>
+ <entity name="ModifyPurpose" class="org.eso.ModifyPurpose">
+ <property name="File Purpose Processing" class="ptolemy.data.expr.StringParameter" value="Set to universal">
</property>
- </relation>
- <relation name="relation8" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Modifies files purposes</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>This actor allows to modify the purposes of files, in case the user wants to deviate from what is described in the OCA rules.</configure></property>
+<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sof</configure></property>
+<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The output sof</configure></property>
+<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:File Purpose Processing" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>how the purpose of the input files will be sent to the output:
<p>Do nothing: leave the input purpose unmodified</p><p>Strip last: remove the last section of the input purpose, if there is only one section set the purpose to universal</p><p>Set to universal: set the output purpose to universal</p></configure></property>
+<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+</property> <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.ModifyPurpose">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
</property>
- </relation>
- <relation name="relation9" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[-18.00000762939453, 818.7499694824219]">
</property>
- </relation>
- <relation name="relation10" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
- </property>
- <vertex name="vertex1" value="[85.0, 405.0]">
- </vertex>
- </relation>
- <relation name="relation11" class="ptolemy.actor.TypedIORelation">
- <property name="width" class="ptolemy.data.expr.Parameter" value="1">
- </property>
- </relation>
- <link port="current_dataset" relation="relation7"/>
- <link port="final_files" relation="relation10"/>
- <link port="String Constant.output" relation="relation9"/>
- <link port="String Constant.trigger" relation="relation"/>
- <link port="Display Current Dataset.input" relation="relation"/>
- <link port="String Constant2.output" relation="relation2"/>
- <link port="String Constant2.trigger" relation="relation"/>
- <link port="String Constant3.output" relation="relation11"/>
- <link port="String Constant3.trigger" relation="relation10"/>
- <link port="Final directory path.parts" relation="relation5"/>
- <link port="Final directory path.parts" relation="relation3"/>
- <link port="Final directory path.whole" relation="relation4"/>
- <link port="Write README.input" relation="relation"/>
- <link port="Write README.fileName" relation="relation6"/>
- <link port="String Constant4.output" relation="relation3"/>
- <link port="String Constant4.trigger" relation="relation10"/>
- <link port="String Constant5.output" relation="relation8"/>
- <link port="String Constant5.trigger" relation="relation"/>
- <link port="Write to stdout.input" relation="relation"/>
- <link port="String Constant6.output" relation="relation5"/>
- <link port="String Constant6.trigger" relation="relation10"/>
- <link port="Path to README.parts" relation="relation2"/>
- <link port="Path to README.parts" relation="relation8"/>
- <link port="Path to README.parts" relation="relation9"/>
- <link port="Path to README.whole" relation="relation6"/>
- <link port="Final message.parts" relation="relation7"/>
- <link port="Final message.parts" relation="relation11"/>
- <link port="Final message.parts" relation="relation4"/>
- <link port="Final message.whole" relation="relation"/>
- </entity>
- <entity name="STANDARD_STAR" class="ptolemy.actor.TypedCompositeActor">
- <display name="STANDARD_STAR
(TELLURIC)"/>
- <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="8.1.devel">
- </property>
- <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:427:41">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.TypedCompositeActor">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:449:1">
- </property>
- </property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Actor">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#GeneralPurpose">
- </property>
- <property name="semanticType22" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Workflow">
- </property>
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Yuhong Xiong</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>A Composite actor is an aggregation of actors. It may have a local director that is responsible for executing the contained actors. A Composite actor with a local director is called an opaque actor. Composite actors do not require a local director. Composite actors with no local director "inherit" the director from the containing workflow and are called non-opaque.</ [...]
-</property> <property name="_location" class="ptolemy.kernel.util.Location" value="[685.0, 980.0]">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:15314:197:41:urn:lsid:kepler-project.org/ns/:21155:64:67:urn:lsid:kepler-project.org/ns/:29452:30:11">
- </property>
- <port name="sof_in" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{65.0, 165.0}">
- </property>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
- </property>
- </port>
- <port name="sof_out" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{675.0, 175.0}">
- </property>
- </port>
- <entity name="SofSplitter" class="org.eso.SofSplitter">
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofSplitter takes a set of files as input and split it into smaller sets based on the purpose. This smaller sets can then be sent to e.g. a RecipeExecuter</configure></property>
-<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sof</configure></property>
-<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups generated</configure></property>
-<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sofs</configure></property>
-<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:198:2">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofSplitter">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
- </property>
- </property>
- <property name="semanticType" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{160.0, 140.0}">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org/ns/:12925:5:1">
- </property>
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList">
</property>
<port name="sof in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
@@ -6644,195 +6508,240 @@
</port>
<port name="sof out" class="ptolemy.actor.TypedIOPort">
<property name="output"/>
- <property name="multiport"/>
<property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
</port>
- <port name="#groups" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
- </property>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
- </property>
- </port>
</entity>
- <entity name="SofAccumulator" class="org.eso.SofAccumulator">
- <property name="same dataset" class="ptolemy.data.expr.Parameter" value="true">
- </property>
+ <entity name="FitsRouter2" class="org.eso.FitsRouter">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofAccumulator is meant to be used together with the SofSplitter: it puts back together in a single set of files the tokens generated by the PurposeSerializer (and usually processed by the RecipeExecuter)</configure></property>
-<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
-<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups to collect</configure></property>
-<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sof</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>1.0</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FitsRouter routes files base on their category: by default, all the files are routed to the rejected directory, but the user can add additional port and configure the actor to route particular files there.</p>
<p>Basic Mode: create an output port named as a category (e.g.: FLAT), all files belonging to that category will be routed to that port.</p>
& [...]
+<property name="port:in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input data</configure></property>
+<property name="port:sof rejected" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The rejected SoF</configure></property>
<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:same dataset" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>If true the SofAccumulator throws an error if the input tokens do not belong all to the same dataset</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:199:2">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofAccumulator">
+</property> <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.FitsRouter">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
</property>
- <property name="semanticType" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="{565.0, 150.0}">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org/ns/:12925:7:1">
+ <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
</property>
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[-225.0, 945.0]">
</property>
- <port name="sof in" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
- </property>
- </port>
- <port name="#groups" class="ptolemy.actor.TypedIOPort">
+ <port name="in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
</property>
<property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
</property>
</port>
- <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <port name="sof rejected" class="ptolemy.actor.TypedIOPort">
<property name="output"/>
<property name="multiport"/>
<property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
</port>
+ <port name="SCI_COMBINED" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ </port>
</entity>
- <entity name="kmo_std_star_1" class="org.eso.RecipeExecuter">
- <property name="Recipe Failure Mode" class="ptolemy.data.expr.StringParameter" value="Continue">
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[345.0, 120.0]">
- </property>
- </entity>
- <relation name="relation2" class="ptolemy.actor.TypedIORelation">
- </relation>
<relation name="relation4" class="ptolemy.actor.TypedIORelation">
</relation>
+ <relation name="relation9" class="ptolemy.actor.TypedIORelation">
+ <vertex name="vertex1" value="[-68.00000762939453, 838.7499694824219]">
+ </vertex>
+ </relation>
+ <relation name="relation10" class="ptolemy.actor.TypedIORelation">
+ </relation>
+ <relation name="relation8" class="ptolemy.actor.TypedIORelation">
+ </relation>
<relation name="relation5" class="ptolemy.actor.TypedIORelation">
</relation>
- <relation name="relation3" class="ptolemy.actor.TypedIORelation">
- <vertex name="vertex1" value="[245.0, 140.0]">
- </vertex>
+ <relation name="relation7" class="ptolemy.actor.TypedIORelation">
+ </relation>
+ <relation name="relation11" class="ptolemy.actor.TypedIORelation">
+ </relation>
+ <relation name="relation12" class="ptolemy.actor.TypedIORelation">
</relation>
<relation name="relation" class="ptolemy.actor.TypedIORelation">
</relation>
- <link port="sof_in" relation="relation4"/>
- <link port="sof_out" relation="relation5"/>
- <link port="SofSplitter.sof in" relation="relation4"/>
- <link port="SofSplitter.sof out" relation="relation3"/>
- <link port="SofSplitter.#groups" relation="relation2"/>
- <link port="SofAccumulator.sof in" relation="relation"/>
- <link port="SofAccumulator.#groups" relation="relation2"/>
- <link port="SofAccumulator.sof out" relation="relation5"/>
- <link port="kmo_std_star_1.sof in" relation="relation3"/>
- <link port="kmo_std_star_1.sof out" relation="relation"/>
+ <relation name="relation2" class="ptolemy.actor.TypedIORelation">
+ </relation>
+ <relation name="relation3" class="ptolemy.actor.TypedIORelation">
+ </relation>
+ <relation name="relation6" class="ptolemy.actor.TypedIORelation">
+ </relation>
+ <relation name="relation13" class="ptolemy.actor.TypedIORelation">
+ </relation>
+ <link port="output" relation="relation4"/>
+ <link port="SOF_SCI_RED" relation="relation10"/>
+ <link port="sci_combined" relation="relation13"/>
+ <link port="Change CATG.sof_in" relation="relation12"/>
+ <link port="Change CATG.sof_out" relation="relation"/>
+ <link port="kmo_make_image_1.sof in" relation="relation5"/>
+ <link port="kmo_make_image_1.sof out" relation="relation3"/>
+ <link port="SofSplitter.sof in" relation="relation8"/>
+ <link port="SofSplitter.sof out" relation="relation2"/>
+ <link port="SofSplitter.#groups" relation="relation6"/>
+ <link port="SofAccumulator.sof in" relation="relation3"/>
+ <link port="SofAccumulator.#groups" relation="relation6"/>
+ <link port="SofAccumulator.sof out" relation="relation4"/>
+ <link port="SofCombiner.sof in" relation="relation2"/>
+ <link port="SofCombiner.sof in opt" relation="relation7"/>
+ <link port="SofCombiner.sof out" relation="relation5"/>
+ <link port="FitsRouter.in" relation="relation10"/>
+ <link port="FitsRouter.OH_SPEC" relation="relation9"/>
+ <link port="give purpose number.in_sof" relation="relation"/>
+ <link port="give purpose number.out_sof" relation="relation8"/>
+ <link port="Repeat.input" relation="relation11"/>
+ <link port="Repeat.output" relation="relation7"/>
+ <link port="ModifyPurpose.sof in" relation="relation9"/>
+ <link port="ModifyPurpose.sof out" relation="relation11"/>
+ <link port="FitsRouter2.in" relation="relation13"/>
+ <link port="FitsRouter2.SCI_COMBINED" relation="relation12"/>
</entity>
- <entity name="SofCombiner5" class="org.eso.SofCombiner">
+ <entity name="ProvenanceExplorer" class="org.eso.ProvenanceExplorer">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[1310.0, 1080.0]">
+ </property>
+ </entity>
+ <entity name="SofCombiner3" class="org.eso.SofCombiner">
+ <property name="IgnorePurpose" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofCombiner takes as input a number of set of files and combines them into one set of files that contains only the files whose purposes are present in all the input tokens. With this respect empty tokens are ignored and files with universal purpose are always collected</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofCombiner takes as input a number of set of files and combines them into one set of files that contains only the files whose purposes are present in all the input tokens. With this respect empty tokens are ignored and files with universal purpose are always collected. Please refer to the user manual for more information.</configure></property>
<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The combined sof</configure></property>
<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:430:103">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofCombiner">
+</property> <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofCombiner">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
</property>
<property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[155.0, 825.0]">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:908:1">
- </property>
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[1185.0, 760.0]">
</property>
<port name="sof in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
</port>
<port name="sof in opt" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
- </property>
- <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
</port>
<port name="sof out" class="ptolemy.actor.TypedIOPort">
<property name="output"/>
<property name="multiport"/>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </port>
+ <port name="logs" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
</property>
</port>
</entity>
- <entity name="SofCombiner7" class="org.eso.SofCombiner">
+ <entity name="ProductRenamer" class="ptolemy.actor.lib.python.PythonScript">
+ <property name="jythonClassName" class="ptolemy.kernel.util.StringAttribute" value="Main">
+ </property>
+ <property name="script" class="ptolemy.kernel.util.StringAttribute" value="import os
import shutil
from ptolemy.data import StringToken, IntToken
from ptolemy.data.expr import Parameter
from org.eso.util import JSONTools
from nom.tam.fits import Fits
from nom.tam.fits import FitsFactory
from ptolemy.kernel.util import IllegalActionException
from org.eso.service import ExecutionServiceDB
import org.apache.log4j
from java.util import Has [...]
+ </property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Renames recipe products based on FITS keywords</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofCombiner takes as input a number of set of files and combines them into one set of files that contains only the files whose purposes are present in all the input tokens. With this respect empty tokens are ignored and files with universal purpose are always collected</configure></property>
-<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
-<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The combined sof</configure></property>
-<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:490:3">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofCombiner">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
- </property>
- </property>
- <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure> This actor moves (or copies or links) its input sof to a final product directory based on some FITS keywords.
Usually, it should be connected to the output of the recipes that produce final products. If the recipe produces more products that are not relevant to rename, an output filter can be put in the recipe.</configure></property>
+<property name="port:sof_out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The final list of files produced</configure></property>
+<property name="port:sof_in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The files to be copied/moved or linked</configure></property>
+<property name="prop:RenameKeywords" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The list of keywords used to create the new name</configure></property>
+<property name="prop:OutputExistsMode" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>This parameter defines the behaviour in case the output files already exists: it can be "append_version" (create a new file with a running index suffix), "overwrite" (replace the existing file), "stop" (stop the workflow)</configure></property>
+<property name="prop:script" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:FinalProductDirectory" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The directory where the files are going to be copied/linked or renamed. It is usually set to END_PRODUCTS_DIR</configure></property>
+<property name="prop:SubDir" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>If it is not empty, a subdirectory will be created with this string. The value can contain backslashes (and intermediate directories will be created). It will usually be END_PROD_SUBDIR, created somewhere in the workflow</configure></property>
+<property name="prop:CopyMode" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>There are several options: "copy", "move" or "link".</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:38241:57:8">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[370.0, 790.0]">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.python.PythonScript">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:908:1">
+ <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
</property>
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.TextEditorConfigureFactory">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="script">
+ </property>
</property>
- <port name="sof in" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[1250.0, 815.0]">
+ </property>
+ <property name="RenameKeywords" class="ptolemy.data.expr.StringParameter" value="HIERARCH.ESO.OBS.NAME,'_',HIERARCH.ESO.PRO.CATG">
+ </property>
+ <property name="FinalProductDirectory" class="ptolemy.data.expr.StringParameter" value="$END_PRODUCTS_DIR">
+ </property>
+ <property name="SubDir" class="ptolemy.data.expr.StringParameter" value="$END_PRODUCTS_SUBDIR">
+ </property>
+ <property name="CopyMode" class="ptolemy.data.expr.StringParameter" value="copy">
+ </property>
+ <property name="OutputExistsMode" class="ptolemy.data.expr.StringParameter" value="append_version">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:910:1:urn:lsid:kepler-project.org/ns/:24723:4:5:urn:lsid:kepler-project.org/ns/:25047:16:2:urn:lsid:kepler-project.org/ns/:25158:50:1">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="description" class="ptolemy.kernel.util.StringAttribute" value=" This actor moves (or copies or links) its input sof to a final product directory based on some FITS keywords.
Usually, it should be connected to the output of the recipes that produce final products. If the recipe produces more products that are not relevant to rename, an output filter can be put in the recipe.">
</property>
- </port>
- <port name="sof in opt" class="ptolemy.actor.TypedIOPort">
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="ESO">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="2.0">
+ </property>
+ <property name="RenameKeywords (parameter)" class="ptolemy.data.expr.StringParameter" value="The list of keywords used to create the new name">
+ </property>
+ <property name="FinalProductDirectory (parameter)" class="ptolemy.data.expr.StringParameter" value="The directory where the files are going to be copied/linked or renamed. It is usually set to END_PRODUCTS_DIR">
+ </property>
+ <property name="SubDir (parameter)" class="ptolemy.data.expr.StringParameter" value="If it is not empty, a subdirectory will be created with this string. The value can contain backslashes (and intermediate directories will be created). It will usually be END_PROD_SUBDIR, created somewhere in the workflow">
+ </property>
+ <property name="CopyMode (parameter)" class="ptolemy.data.expr.StringParameter" value="There are several options: "copy", "move" or "link".">
+ </property>
+ <property name="OutputExistsMode (parameter)" class="ptolemy.data.expr.StringParameter" value="This parameter defines the behaviour in case the output files already exists: it can be "append_version" (create a new file with a running index suffix), "overwrite" (replace the existing file), "stop" (stop the workflow)">
+ </property>
+ <property name="script (parameter)" class="ptolemy.data.expr.StringParameter" value="">
+ </property>
+ <property name="sof_out (port)" class="ptolemy.kernel.util.StringAttribute" value="The final list of files produced">
+ </property>
+ <property name="sof_in (port)" class="ptolemy.kernel.util.StringAttribute" value="The files to be copied/moved or linked">
+ </property>
+ </property>
+ <property name="BookkeepingDir" class="ptolemy.data.expr.StringParameter" value="$BOOKKEEPING_DIR">
+ </property>
+ <port name="sof_in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
- <property name="multiport"/>
- <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
</property>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
</property>
</port>
- <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <port name="sof_out" class="ptolemy.actor.TypedIOPort">
<property name="output"/>
<property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
</property>
</port>
</entity>
- <entity name="CompositeActor" class="ptolemy.actor.TypedCompositeActor">
- <display name="Collapse datacube"/>
- <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="8.1.devel">
+ <entity name="Close DataSet" class="ptolemy.actor.TypedCompositeActor">
+ <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="7.0.2">
</property>
- <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:679:95">
+ <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:46342:18:1">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.TypedCompositeActor">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:449:1">
@@ -6849,572 +6758,957 @@
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Yuhong Xiong</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>A Composite actor is an aggregation of actors. It may have a local director that is responsible for executing the contained actors. A Composite actor with a local director is called an opaque actor. Composite actors do not require a local director. Composite actors with no local director "inherit" the director from the containing workflow and are called non-opaque.</ [...]
-</property> <property name="_location" class="ptolemy.kernel.util.Location" value="[1025.0, 695.0]">
+</property> <property name="_location" class="ptolemy.kernel.util.Location" value="[1155.0, 1080.0]">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:21155:635:86:urn:lsid:kepler-project.org/ns/:31617:248:133">
+ <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={616, 37, 1304, 811}, maximized=false}">
</property>
- <property name="DDF Director" class="ptolemy.domains.ddf.kernel.DDFDirector">
- <property name="timeResolution" class="ptolemy.actor.parameters.SharedParameter" value="1E-10">
+ <property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[988, 658]">
+ </property>
+ <property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="1.5267529457215">
+ </property>
+ <property name="_vergilCenter" class="ptolemy.data.expr.ExpertParameter" value="{1284.5625, 895.4900050607288}">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:31989:45:2:urn:lsid:kepler-project.org/ns/:43955:74:3:urn:lsid:kepler-project.org/ns/:44497:3:4:urn:lsid:kepler-project.org/ns/:44576:50:16">
+ </property>
+ <property name="Annotation" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
- <property name="iterations" class="ptolemy.data.expr.Parameter" value="0">
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="14">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 0.0, 1.0, 1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="This subworkflow modifies takes care of the final tasks:
-Creating a README file with the list of files
-Displaying a window with the finished datasets
-Creating input for ProvenanceExplorer">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:44576:49:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[280.0, 680.0]">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:436:1">
+ </property>
+ </property>
+ <port name="current_dataset" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{431.6612027096115, 167.69104677914112}">
+ </property>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ <port name="final_files" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{66.66120270961146, 397.6910467791411}">
+ </property>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="bookkeeping_db" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[480.0, 575.0]">
+ </property>
+ </port>
+ <port name="global_timestamp" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[485.0, 640.0]">
+ </property>
+ </port>
+ <entity name="String Constant" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="README">
+ </property>
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:123:3">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
+ </property>
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{731.6612027096114, 477.6910467791411}">
+ </property>
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1">
+ </property>
+ <port name="trigger" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ </entity>
+ <entity name="Finished Datasets" class="ptolemy.actor.lib.gui.Display">
+ <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds={33, 726, 1325, 199}, maximized=false}">
+ </property>
+ <property name="_paneSize" class="ptolemy.actor.gui.SizeAttribute" value="[1323, 153]">
+ </property>
+ <property name="rowsDisplayed" class="ptolemy.data.expr.Parameter" value="10">
+ </property>
+ <property name="columnsDisplayed" class="ptolemy.data.expr.Parameter" value="120">
+ </property>
+ <property name="suppressBlankLines" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="title" class="ptolemy.data.expr.StringParameter" value="Current Dataset">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Yuhong Xiong, Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The Display actor reads tokens of any type via its input multiport, and displays each token on a separate line in a text display window.</p>
<p>Specify the size of the text display window with the rowsDisplayed and columnsDisplayed parameters. Simply resizing the window onscreen does not persistently change the size when the workflow is saved, closed, and the [...]
+<property name="port:input" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts tokens of any type.</configure></property>
+<property name="prop:suppressBlankLines" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether the actor should display blank lines (the default) or suppress them.</configure></property>
+<property name="prop:rowsDisplayed" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The vertical size of the display, in rows. The value is an integer that defaults to 10.</configure></property>
+<property name="prop:columnsDisplayed" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The horizontal size of the display, in columns. The value is an integer that defaults to 40.</configure></property>
+<property name="prop:title" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The title of the text display window. If specified, the value will appear in the title bar of the text display window.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:44576:53:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.gui.Display">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:883:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#TextualOutputActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#TextualOutput">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{801.6612027096114, 157.69104677914112}">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:7:1:urn:lsid:kepler-project.org/ns/:13643:22:2:urn:lsid:kepler-project.org/ns/:17547:3:12">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="description" class="ptolemy.kernel.util.StringAttribute" value="<p>The Display actor reads tokens of any type via its input multiport, and displays each token on a separate line in a text display window.</p>
<p>Specify the size of the text display window with the rowsDisplayed and columnsDisplayed parameters. Simply resizing the window onscreen does not persistently change the size when the workflow is saved, closed, and then re- [...]
+ </property>
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Yuhong Xiong, Edward A. Lee">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="rowsDisplayed (parameter)" class="ptolemy.data.expr.StringParameter" value="The vertical size of the display, in rows. The value is an integer that defaults to 10.">
+ </property>
+ <property name="columnsDisplayed (parameter)" class="ptolemy.data.expr.StringParameter" value="The horizontal size of the display, in columns. The value is an integer that defaults to 40.">
+ </property>
+ <property name="suppressBlankLines (parameter)" class="ptolemy.data.expr.StringParameter" value="Specify whether the actor should display blank lines (the default) or suppress them.">
+ </property>
+ <property name="title (parameter)" class="ptolemy.data.expr.StringParameter" value="The title of the text display window. If specified, the value will appear in the title bar of the text display window.">
+ </property>
+ <property name="input (port)" class="ptolemy.kernel.util.StringAttribute" value="A multiport that accepts tokens of any type.">
+ </property>
+ </property>
+ </entity>
+ <entity name="String Constant2" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="$END_PRODUCTS_DIR">
+ </property>
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:121:3">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
+ </property>
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{731.6612027096114, 402.6910467791411}">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1">
+ </property>
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <port name="trigger" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ </entity>
+ <entity name="String Constant3" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value=" Dataset has been reduced and saved in ">
+ </property>
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:17547:19:3">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
+ </property>
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{266.6612027096115, 232.69104677914112}">
+ </property>
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1:urn:lsid:kepler-project.org/ns/:13643:21:2">
+ </property>
+ <port name="trigger" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="Final directory path" class="org.resurgence.actor.StringAccumulator">
+ <property name="Substring separator" class="ptolemy.data.expr.Parameter" value=""/"">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>
The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p></configure></property>
+<property name="port:whole" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the full string.</configure></property>
+<property name="port:parts" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts substrings.</configure></property>
+<property name="prop:Substring separator" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The characters used to separate the elements in the output string. By default, the value is "".</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:17547:25:2">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.StringAccumulator">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1117:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{341.6612027096115, 352.6910467791411}">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:292:1">
+ </property>
+ </entity>
+ <entity name="Write README" class="org.geon.FileWrite">
+ <property name="fileName" class="ptolemy.actor.parameters.FilePortParameter" value="/home/yjung/P_kmos/reflex//OUT/2013-10-29T11:50:16/README">
+ </property>
+ <property name="append" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="confirmOverwrite" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="alwaysFlush" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>No author given</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FileWriter actor reads a string and writes it to a file. The actor outputs the file path of the generated file.</p>
<p>Specify a destination file path with the fileName parameter. If the specified file does not exist, then the actor will create it. If the file already exists, then the actor will ask for permission to overwrite it (unless the append param [...]
+<property name="port:input" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An input port that receives a string to write to a file.</configure></property>
+<property name="port:url" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the file name of the generated file.</configure></property>
+<property name="prop:append" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether to append the input string to an existing, specified file. By default, the actor will overwrite any preexisting file.</configure></property>
+<property name="prop:confirmOverwrite" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether the actor should confirm before overwriting an existing file. By default, the actor will not ask for confirmation.</configure></property>
+<property name="prop:fileName" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The name of the file to which to write. See FileParameter for more information about specifying file names. </configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:43955:73:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.geon.FileWrite">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1003:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#WriterOutputActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#LocalOutput">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{766.6612027096114, 557.6910467791411}">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:144:1:urn:lsid:kepler-project.org/ns/:15314:118:5">
+ </property>
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="description" class="ptolemy.kernel.util.StringAttribute" value="<p>The FileWriter actor reads a string and writes it to a file. The actor outputs the file path of the generated file.</p>
<p>Specify a destination file path with the fileName parameter. If the specified file does not exist, then the actor will create it. If the file already exists, then the actor will ask for permission to overwrite it (unless the append parameter [...]
+ </property>
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="No author given">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="append (parameter)" class="ptolemy.data.expr.StringParameter" value="Specify whether to append the input string to an existing, specified file. By default, the actor will overwrite any preexisting file.">
+ </property>
+ <property name="confirmOverwrite (parameter)" class="ptolemy.data.expr.StringParameter" value="Specify whether the actor should confirm before overwriting an existing file. By default, the actor will not ask for confirmation.">
+ </property>
+ <property name="input (port)" class="ptolemy.kernel.util.StringAttribute" value="An input port that receives a string to write to a file.">
+ </property>
+ <property name="url (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the file name of the generated file.">
+ </property>
+ <property name="fileName (parameter)" class="ptolemy.data.expr.StringParameter" value="The name of the file to which to write. See FileParameter for more information about specifying file names. ">
+ </property>
+ </property>
+ <port name="fileName" class="ptolemy.actor.parameters.ParameterPort">
+ <property name="input"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="NORTH">
+ </property>
+ </port>
+ <port name="url" class="ptolemy.actor.TypedIOPort">
+ <property name="output"/>
+ <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="String Constant4" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="$END_PRODUCTS_SUBDIR">
+ </property>
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:17547:23:2">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
+ </property>
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{231.66120270961147, 402.6910467791411}">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1">
+ </property>
+ <port name="trigger" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ </port>
+ </entity>
+ <entity name="String Constant5" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="$GLOBAL_TIMESTAMP">
</property>
- <property name="maximumReceiverCapacity" class="ptolemy.data.expr.Parameter" value="0">
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
</property>
- <property name="runUntilDeadlockInOneIteration" class="ptolemy.data.expr.Parameter" value="true">
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Gang Zhou</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
<p> The dynamic dataflow (DDF) domain is a superset of the synchronous
dataflow(SDF) and Boolean dataflow(BDF) domains. In the SDF domain,
an actor consumes and produces a fixed number of tokens per firing.
This static information makes possible compile-time scheduling. In the
DDF domain, there are few [...]
-<property name="prop:iterations" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify the number of times a workflow is iterated. By default, this parameter is set to "0". Note that "0" does not mean "no iterations." Rather, "0" means that the workflow will iterate forever. Values greater than zero specify the actual number of times the director should execute the entire workflow. </configure></property>
-<property name="prop:maximumReceiverCapacity" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A Parameter representing the maximum capacity of each receiver controlled by this director. This is an integer that defaults to 0, which means the queue in each receiver is unbounded. To specify bounded queues, set this to a positive integer. </configure></property>
-<property name="prop:runUntilDeadlockInOneIteration" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A parameter indicating whether one iteration consists of repeated basic iterations until deadlock. If this parameter is true, the model will be executed until deadlock in one iteration. The default value is a BooleanToken with the value false. It cannot be set to true if this director is at the top level.</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:262:1">
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:15314:122:3">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.domains.ddf.kernel.DDFDirector">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:directorclass:5:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Director">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Director">
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[-275.0, 640.0]">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:director:5:1">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
</property>
- </property>
- <property name="Annotation" class="ptolemy.vergil.kernel.attributes.TextAttribute">
- <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
+ </property>
</property>
- <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{741.6612027096114, 442.6910467791411}">
</property>
- <property name="textSize" class="ptolemy.data.expr.Parameter" value="20">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1">
</property>
- <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.007843138,0.0,1.0}">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
- <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ <port name="trigger" class="ptolemy.actor.TypedIOPort">
+ <property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ </port>
+ </entity>
+ <entity name="Write to stdout" class="org.geon.FileWrite">
+ <property name="fileName" class="ptolemy.actor.parameters.FilePortParameter" value="/dev/stdout">
</property>
- <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ <property name="append" class="ptolemy.data.expr.Parameter" value="true">
</property>
- <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ <property name="confirmOverwrite" class="ptolemy.data.expr.Parameter" value="false">
</property>
- <property name="text" class="ptolemy.kernel.util.StringAttribute" value="NOTE: There are two actors in this workflow that fix bugs in other actors.
They should be removed once those bugs have been fixed!!!!
The two actors are:
The "give purpose number" actor fixes a problem with the SOF splitter.
The "Change CATG" actor fixes a problem with the make_image recipe.">
- <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
- <property name="height" class="ptolemy.data.expr.Parameter" value="20">
- </property>
- <property name="width" class="ptolemy.data.expr.Parameter" value="80">
- </property>
- </property>
+ <property name="alwaysFlush" class="ptolemy.data.expr.Parameter" value="true">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>No author given</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
-<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
-<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
-<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
-<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
-<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
-<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:277:6">
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FileWriter actor reads a string and writes it to a file. The actor outputs the file path of the generated file.</p>
<p>Specify a destination file path with the fileName parameter. If the specified file does not exist, then the actor will create it. If the file already exists, then the actor will ask for permission to overwrite it (unless the append param [...]
+<property name="port:input" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An input port that receives a string to write to a file.</configure></property>
+<property name="port:url" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the file name of the generated file.</configure></property>
+<property name="prop:append" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether to append the input string to an existing, specified file. By default, the actor will overwrite any preexisting file.</configure></property>
+<property name="prop:confirmOverwrite" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Specify whether the actor should confirm before overwriting an existing file. By default, the actor will not ask for confirmation.</configure></property>
+<property name="prop:fileName" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The name of the file to which to write. See FileParameter for more information about specifying file names. </configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:17547:24:2">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.geon.FileWrite">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1003:1">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#WriterOutputActor">
</property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#LocalOutput">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[-110.0, 575.0]">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{846.6612027096114, 242.69104677914112}">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:436:1:urn:lsid:kepler-project.org/ns/:13757:278:7:urn:lsid:kepler-project.org/ns/:15166:196:1:urn:lsid:kepler-project.org/ns/:13757:433:1:urn:lsid:kepler-project.org/ns/:28993:48:7">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:144:1:urn:lsid:kepler-project.org/ns/:15165:55:3">
</property>
- </property>
- <port name="output" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
+ </entity>
+ <entity name="String Constant6" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="$END_PRODUCTS_DIR">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[665.0, 975.0]">
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
</property>
- </port>
- <port name="SOF_SCI_RED" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="WEST">
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[-305.0, 835.0]">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:17547:23:5">
</property>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
+ </property>
</property>
- </port>
- <port name="sci_combined" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[-305.0, 970.0]">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
</property>
- </port>
- <entity name="Change CATG" class="ptolemy.actor.lib.python.PythonScript">
- <property name="script" class="ptolemy.kernel.util.StringAttribute" value="from ptolemy.data import StringToken
from org.eso.util import JSONTools
from ptolemy.kernel.util import IllegalActionException
import java.util.regex.Pattern as Pattern;
class Main :
"Catg Changer"
def fire(self) :
#Read input files
input = self.sof_in.get(0)
string = input.stringValue()
#Creat [...]
- <property name="style" class="ptolemy.actor.gui.style.TextStyle">
- <property name="height" class="ptolemy.data.expr.Parameter" value="10">
- </property>
- <property name="width" class="ptolemy.data.expr.Parameter" value="30">
- </property>
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
</property>
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[-115.0, 955.0]">
- </property>
- <property name="Replacements" class="ptolemy.data.expr.StringParameter" value="SCI_COMBINED:MAKE_IMG_DATA">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{236.66120270961147, 342.6910467791411}">
</property>
- <property name="_expertMode" class="ptolemy.kernel.util.SingletonAttribute">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1">
</property>
- <port name="sof_in" class="ptolemy.actor.TypedIOPort">
+ <port name="trigger" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
</port>
- <port name="sof_out" class="ptolemy.actor.TypedIOPort">
+ </entity>
+ <entity name="Path to README" class="org.resurgence.actor.StringAccumulator">
+ <property name="Substring separator" class="ptolemy.data.expr.Parameter" value=""/"">
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>
The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p></configure></property>
+<property name="port:whole" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the full string.</configure></property>
+<property name="port:parts" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts substrings.</configure></property>
+<property name="prop:Substring separator" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The characters used to separate the elements in the output string. By default, the value is "".</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:43955:72:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.StringAccumulator">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1117:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{876.6612027096114, 427.6910467791411}">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:292:1:urn:lsid:kepler-project.org/ns/:15314:124:4">
+ </property>
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="false">
+ </property>
+ <port name="whole" class="ptolemy.actor.TypedIOPort">
<property name="output"/>
+ <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
+ </property>
</port>
</entity>
- <entity name="kmo_make_image_1" class="org.eso.RecipeExecuter">
- <property name="Lazy Mode" class="ptolemy.data.expr.Parameter" value="false">
+ <entity name="Final message" class="org.resurgence.actor.StringAccumulator">
+ <property name="Substring separator" class="ptolemy.data.expr.Parameter" value="""">
</property>
- <property name="Recipe Failure Mode" class="ptolemy.data.expr.StringParameter" value="Continue">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>
The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p></configure></property>
+<property name="port:whole" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the full string.</configure></property>
+<property name="port:parts" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts substrings.</configure></property>
+<property name="prop:Substring separator" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The characters used to separate the elements in the output string. By default, the value is "".</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:17547:26:1">
</property>
- <property name="Input Files Category" class="ptolemy.data.expr.StringParameter" value="">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.StringAccumulator">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1117:1">
+ </property>
</property>
- <property name="Output Files Category" class="ptolemy.data.expr.StringParameter" value="">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
</property>
- <property name="Pause after execution" class="ptolemy.data.expr.Parameter" value="false">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
</property>
- <property name="recipe_param_1" class="ptolemy.data.expr.Parameter" value="range=0,3.">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{476.6612027096115, 312.6910467791411}">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[346.99999237060547, 828.7499694824219]">
+ <property name="" class="ptolemy.vergil.basic.DocAttribute">
+ <property name="description" class="ptolemy.kernel.util.StringAttribute" value="<p>
The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p>">
+ </property>
+ <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Wibke Sudholt">
+ </property>
+ <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
+ </property>
+ <property name="Substring separator (parameter)" class="ptolemy.data.expr.StringParameter" value="The characters used to separate the elements in the output string. By default, the value is "".">
+ </property>
+ <property name="parts (port)" class="ptolemy.kernel.util.StringAttribute" value="A multiport that accepts substrings.">
+ </property>
+ <property name="whole (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the full string.">
+ </property>
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:292:1">
</property>
</entity>
- <entity name="SofSplitter" class="org.eso.SofSplitter">
- <property name="Group purposes" class="ptolemy.data.expr.Parameter" value="true">
+ <entity name="String Constant7" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value=" with files: ">
+ </property>
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofSplitter takes a set of files as input and split it into smaller sets, grouping them by purpose. Files with universal purpose are attached to every subset. This smaller sets can then be sent to e.g. a RecipeExecuter. Please refer to the user manual for more information.</configure></property>
-<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sof</configure></property>
-<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sofs</configure></property>
-<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups generated</configure></property>
-<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:680:1">
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:43955:68:1">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofSplitter">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
</property>
</property>
- <property name="semanticType" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{231.66120270961147, 442.6910467791411}">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[145.0, 955.0]">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org/ns/:12925:5:1:urn:lsid:kepler-project.org/ns/:21155:650:1:urn:lsid:kepler-project.org/ns/:31617:265:2">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1:urn:lsid:kepler-project.org/ns/:13643:21:2:urn:lsid:kepler-project.org/ns/:17547:19:3">
</property>
- <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <port name="trigger" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
- </property>
- </port>
- <port name="sof out" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
- </property>
- </port>
- <port name="#groups" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
</port>
</entity>
- <entity name="SofAccumulator" class="org.eso.SofAccumulator">
- <property name="same dataset" class="ptolemy.data.expr.Parameter" value="true">
+ <entity name="README message" class="org.resurgence.actor.StringAccumulator">
+ <property name="Substring separator" class="ptolemy.data.expr.Parameter" value="""">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofAccumulator is meant to be used together with the SofSplitter: it puts back together in a single set of files the tokens generated by the SofSplitter (and usually processed by the RecipeExecuter)</configure></property>
-<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
-<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The grouped sof</configure></property>
-<property name="port:#groups" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of groups to collect</configure></property>
-<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:same dataset" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>If true the SofAccumulator throws an error if the input tokens do not belong all to the same dataset</configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:682:1">
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Wibke Sudholt</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>
The StringAccumulator actor reads multiple strings via its input port and outputs a string containing all of the input values. The characters separating the substrings in the output string can be specified with the substringSeparator parameter.</p></configure></property>
+<property name="port:whole" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the full string.</configure></property>
+<property name="port:parts" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that accepts substrings.</configure></property>
+<property name="prop:Substring separator" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The characters used to separate the elements in the output string. By default, the value is "".</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:43955:69:4">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofAccumulator">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.resurgence.actor.StringAccumulator">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1117:1">
</property>
</property>
- <property name="semanticType" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[570.0, 950.0]">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#IterativeOperation">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org/ns/:12925:7:1">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="{451.6612027096115, 462.6910467791411}">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:292:1:urn:lsid:kepler-project.org/ns/:17547:25:2">
</property>
- <port name="sof in" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
- </property>
- </port>
- <port name="#groups" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
- </property>
- </port>
- <port name="sof out" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
- </property>
- </port>
</entity>
- <entity name="SofCombiner" class="org.eso.SofCombiner">
+ <entity name="ObjectToText" class="org.eso.ObjectToText">
+ <property name="Include Header and Footer" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Converts Reflex JSON objects into a human-readable form</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The SofCombiner takes as input a number of set of files and combines them into one set of files that contains only the files whose purposes are present in all the input tokens. With this respect empty tokens are ignored and files with universal purpose are always collected. Please refer to the user manual for more information.</configure></property>
-<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sofs</configure></property>
-<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The combined sof</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The ObjectToString converts the JSON objects used by ESO actors (i.e. datasets, sof and sop) into a human-readable form.</configure></property>
+<property name="port:text out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A nicely formatted string</configure></property>
+<property name="port:json in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input JSON object</configure></property>
<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
+<property name="prop:Include Header and Footer" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>if true the output text will contain a descriptive header and footer</configure></property>
<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:681:1">
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org:actor:907:1">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.SofCombiner">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.ObjectToText">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
</property>
</property>
<property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[221.99999237060547, 818.7499694824219]">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:908:1:urn:lsid:kepler-project.org/ns/:31617:249:2">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[250.0, 500.0]">
</property>
- <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <port name="json in" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
- <property name="multiport"/>
<property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
- </property>
- </port>
- <port name="sof in opt" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
</property>
</port>
- <port name="sof out" class="ptolemy.actor.TypedIOPort">
+ <port name="text out" class="ptolemy.actor.TypedIOPort">
<property name="output"/>
- <property name="multiport"/>
<property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
</property>
- </port>
- <port name="logs" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="SOUTH">
- </property>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
- </property>
- <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
+ <property name="tokenProductionRate" class="ptolemy.data.expr.Parameter" value="1">
</property>
</port>
</entity>
- <entity name="FitsRouter" class="org.eso.FitsRouter">
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>1.0</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FitsRouter routes files base on their category: by default, all the files are routed to the rejected directory, but the user can add additional port and configure the actor to route particular files there.</p>
<p>Basic Mode: create an output port named as a category (e.g.: FLAT), all files belonging to that category will be routed to that port.</p>
& [...]
-<property name="port:in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input data</configure></property>
-<property name="port:sof rejected" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The rejected SoF</configure></property>
-<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:21155:653:4">
- </property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.FitsRouter">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
- </property>
- </property>
- <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
+ <entity name="String Constant8" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="$BOOKKEEPING_DIR/bookkeeping.db">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[-215.0, 810.0]">
- </property>
- <property name="OH_SPEC" class="ptolemy.data.expr.Parameter" value=""OH_SPEC"">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:903:1">
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
</property>
- <port name="in" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
- </property>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
- </property>
- </port>
- <port name="sof rejected" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
- </property>
- <property name="_hide" class="ptolemy.data.expr.SingletonParameter" value="true">
- </property>
- </port>
- <port name="OH_SPEC" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="_cardinal" class="ptolemy.kernel.util.StringAttribute" value="EAST">
- </property>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
- </property>
- </port>
- </entity>
- <entity name="give purpose number" class="ptolemy.actor.lib.python.PythonScript">
- <property name="script" class="ptolemy.kernel.util.StringAttribute" value="# This is a simple actor that copies the input to the output.
# You can remove the ports, add new ports, and modify the script.
from org.eso.util import JSONTools
#from org.eso.domain import SetOfFiles
import java.lang.String
import java.util.TreeSet
class Main :
"Trim the last purpose"
def fire(self) :
in_sof = self.in_sof.get(0)
out_s [...]
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Xiaojun Liu</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
This actor executes a Python script. The default script has an
input port and an output port. To view or edit the script, double-click
on the actor.
<p>
As an example, a simplified version of the Scale actor can be
implemented by the following script:
</p>
<pre>
1. class Main :
2. "scale"
3. def fire(se [...]
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:264:4">
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:44576:8:1">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.python.PythonScript">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:545:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#GeneralPurpose">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
</property>
- <property name="_editorFactory" class="ptolemy.vergil.toolbox.TextEditorConfigureFactory">
- <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="script">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
</property>
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[-15.0, 955.0]">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[285.0, 575.0]">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:545:1:urn:lsid:kepler-project.org/ns/:16482:31:16:urn:lsid:kepler-project.org/ns/:24723:5:7:urn:lsid:kepler-project.org/ns/:25047:2:13">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1:urn:lsid:kepler-project.org/ns/:17547:23:2:urn:lsid:kepler-project.org/ns/:38241:62:1">
</property>
- <port name="in_sof" class="ptolemy.actor.TypedIOPort">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <port name="trigger" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
- </port>
- <port name="out_sof" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
+ <property name="multiport"/>
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
</port>
</entity>
- <entity name="Repeat" class="ptolemy.domains.sdf.lib.Repeat">
- <property name="numberOfTimes" class="ptolemy.data.expr.Parameter" value="200">
+ <entity name="String Constant9" class="ptolemy.actor.lib.StringConst">
+ <property name="value" class="ptolemy.data.expr.Parameter" value="$GLOBAL_TIMESTAMP">
</property>
- <property name="blockSize" class="ptolemy.data.expr.Parameter" value="1">
+ <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="NONE">
+ </property>
+ <property name="NONE" class="ptolemy.data.expr.Parameter" value="0">
</property>
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Shankar Rao, Steve Neuendorffer</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward Lee</configure></property>
<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>
<p>The Repeat actor reads and repeats a "block" of tokens (i.e., one or more tokens of any type). The actor outputs the block a user-specified number of times.</p>
<p>Specify the block size with the blockSize parameter and the number of times to repeat the block with the numberOfTimes parameter. Note: because the actor reads multiple input tokens [...]
-<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts the block of tokens the specified number of times. Specify the number of times to repeat the output with the numberOfTimes parameter.</configure></property>
-<property name="port:input" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An input port that accepts tokens of any type. Specify the number of tokens to read at each iteration with the blockSize parameter.</configure></property>
-<property name="prop:blockSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The number of tokens in a block. The value is an integer and must be greater than zero. The default is 1. </configure></property>
-<property name="prop:numberOfTimes" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The repetition factor. The value is an integer and must be greater than 0. The default is 2. </configure></property>
-</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:31617:269:5">
- </property>
- <property name="" class="ptolemy.vergil.basic.DocAttribute">
- <property name="description" class="ptolemy.kernel.util.StringAttribute" value="
<p>The Repeat actor reads and repeats a "block" of tokens (i.e., one or more tokens of any type). The actor outputs the block a user-specified number of times.</p>
<p>Specify the block size with the blockSize parameter and the number of times to repeat the block with the numberOfTimes parameter. Note: because the actor reads multiple input tokens at e [...]
- </property>
- <property name="author" class="ptolemy.kernel.util.StringAttribute" value="Shankar Rao, Steve Neuendorffer">
- </property>
- <property name="version" class="ptolemy.kernel.util.StringAttribute" value="null">
- </property>
- <property name="numberOfTimes (parameter)" class="ptolemy.data.expr.StringParameter" value="The repetition factor. The value is an integer and must be greater than 0. The default is 2. ">
- </property>
- <property name="blockSize (parameter)" class="ptolemy.data.expr.StringParameter" value="The number of tokens in a block. The value is an integer and must be greater than zero. The default is 1. ">
- </property>
- <property name="input (port)" class="ptolemy.kernel.util.StringAttribute" value="An input port that accepts tokens of any type. Specify the number of tokens to read at each iteration with the blockSize parameter.">
- </property>
- <property name="output (port)" class="ptolemy.kernel.util.StringAttribute" value="An output port that broadcasts the block of tokens the specified number of times. Specify the number of times to repeat the output with the numberOfTimes parameter.">
- </property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The StringConstant actor outputs a string specified via the actor's value parameter.</p>
<p>Specifying strings with the StringConstant actor is convenient, as the actor does not require that strings be surrounded by quotes. The actor is often used to specify file paths, which can be selected using the Browse button available in the actor's parameters.</p&g [...]
+<property name="port:output" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>An output port that broadcasts a string constant specified by the value parameter. </configure></property>
+<property name="port:trigger" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>A multiport that has no declared type (in other words, the port can accept any data type: double, int, array, etc.) If the port is connected, the actor will not fire until the trigger port receives an input token. Connecting the port is optional, but useful when scheduling the actor to perform at a certain time. </configure></property>
+<property name="prop:firingCountLimit" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The limit on the number of times the actor will fire. The default value is 'NONE', meaning there is no limit on the number of time the constant will be provided to the output port. Any integer can be provided as a value for this parameter.</configure></property>
+<property name="prop:value" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.)</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:44576:9:1">
</property>
- <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.domains.sdf.lib.Repeat">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1130:1">
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.lib.StringConst">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1052:1">
</property>
</property>
- <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#ControlActor">
- </property>
- <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowControl">
- </property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[96.99999237060547, 818.7499694824219]">
- </property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:364:1">
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#StringFunctionActor">
</property>
- </entity>
- <entity name="ModifyPurpose" class="org.eso.ModifyPurpose">
- <property name="File Purpose Processing" class="ptolemy.data.expr.StringParameter" value="Set to universal">
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Constant">
</property>
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Modifies files purposes</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>2.0</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>This actor allows to modify the purposes of files, in case the user wants to deviate from what is described in the OCA rules.</configure></property>
-<property name="port:sof in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input sof</configure></property>
-<property name="port:sof out" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The output sof</configure></property>
-<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:File Purpose Processing" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>how the purpose of the input files will be sent to the output:
<p>Do nothing: leave the input purpose unmodified</p><p>Strip last: remove the last section of the input purpose, if there is only one section set the purpose to universal</p><p>Set to universal: set the output purpose to universal</p></configure></property>
-<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-</property> <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.ModifyPurpose">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
+ <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
+ <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="value">
+ </property>
+ <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
</property>
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[-18.00000762939453, 818.7499694824219]">
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[240.0, 640.0]">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:204:1:urn:lsid:kepler-project.org/ns/:17547:23:2:urn:lsid:kepler-project.org/ns/:38241:63:1">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
- <port name="sof in" class="ptolemy.actor.TypedIOPort">
+ <port name="trigger" class="ptolemy.actor.TypedIOPort">
<property name="input"/>
<property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
- </property>
- </port>
- <port name="sof out" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
+ <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="true">
</property>
</port>
</entity>
- <entity name="FitsRouter2" class="org.eso.FitsRouter">
-<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
-<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
-<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>ESO</configure></property>
-<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>1.0</configure></property>
-<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>The FitsRouter routes files base on their category: by default, all the files are routed to the rejected directory, but the user can add additional port and configure the actor to route particular files there.</p>
<p>Basic Mode: create an output port named as a category (e.g.: FLAT), all files belonging to that category will be routed to that port.</p>
& [...]
-<property name="port:in" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The input data</configure></property>
-<property name="port:sof rejected" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The rejected SoF</configure></property>
-<property name="prop:semanticType41" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:entityId" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-<property name="prop:class" class="ptolemy.kernel.util.ConfigurableAttribute"><configure></configure></property>
-</property> <property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.eso.FitsRouter">
- <property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
- </property>
+ <relation name="relation" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
</property>
- <property name="semanticType41" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:4:1#ESO">
+ <vertex name="vertex1" value="{576.6612027096114, 497.6910467791411}">
+ </vertex>
+ </relation>
+ <relation name="relation2" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
</property>
- <property name="_location" class="ptolemy.kernel.util.Location" value="[-225.0, 945.0]">
+ </relation>
+ <relation name="relation3" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
</property>
- <port name="in" class="ptolemy.actor.TypedIOPort">
- <property name="input"/>
- <property name="tokenConsumptionRate" class="ptolemy.data.expr.Parameter" value="1">
- </property>
- <property name="_showName" class="ptolemy.data.expr.SingletonParameter" value="false">
- </property>
- </port>
- <port name="sof rejected" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="multiport"/>
- <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
- </property>
- </port>
- <port name="SCI_COMBINED" class="ptolemy.actor.TypedIOPort">
- <property name="output"/>
- <property name="_showName" class="ptolemy.data.expr.Parameter" value="true">
- </property>
- </port>
- </entity>
+ </relation>
<relation name="relation4" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
- <relation name="relation9" class="ptolemy.actor.TypedIORelation">
- <vertex name="vertex1" value="[-68.00000762939453, 838.7499694824219]">
- </vertex>
+ <relation name="relation5" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
- <relation name="relation10" class="ptolemy.actor.TypedIORelation">
+ <relation name="relation6" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation7" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation8" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
- <relation name="relation5" class="ptolemy.actor.TypedIORelation">
+ <relation name="relation9" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
- <relation name="relation7" class="ptolemy.actor.TypedIORelation">
+ <relation name="relation10" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <vertex name="vertex1" value="{101.66120270961146, 482.6910467791411}">
+ </vertex>
</relation>
<relation name="relation11" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation12" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ <vertex name="vertex1" value="{571.6612027096114, 327.6910467791411}">
+ </vertex>
</relation>
- <relation name="relation" class="ptolemy.actor.TypedIORelation">
- </relation>
- <relation name="relation2" class="ptolemy.actor.TypedIORelation">
+ <relation name="relation13" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
- <relation name="relation3" class="ptolemy.actor.TypedIORelation">
+ <relation name="relation14" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
- <relation name="relation6" class="ptolemy.actor.TypedIORelation">
+ <relation name="relation15" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
- <relation name="relation13" class="ptolemy.actor.TypedIORelation">
+ <relation name="relation16" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
- <link port="output" relation="relation4"/>
- <link port="SOF_SCI_RED" relation="relation10"/>
- <link port="sci_combined" relation="relation13"/>
- <link port="Change CATG.sof_in" relation="relation12"/>
- <link port="Change CATG.sof_out" relation="relation"/>
- <link port="kmo_make_image_1.sof in" relation="relation5"/>
- <link port="kmo_make_image_1.sof out" relation="relation3"/>
- <link port="SofSplitter.sof in" relation="relation8"/>
- <link port="SofSplitter.sof out" relation="relation2"/>
- <link port="SofSplitter.#groups" relation="relation6"/>
- <link port="SofAccumulator.sof in" relation="relation3"/>
- <link port="SofAccumulator.#groups" relation="relation6"/>
- <link port="SofAccumulator.sof out" relation="relation4"/>
- <link port="SofCombiner.sof in" relation="relation2"/>
- <link port="SofCombiner.sof in opt" relation="relation7"/>
- <link port="SofCombiner.sof out" relation="relation5"/>
- <link port="FitsRouter.in" relation="relation10"/>
- <link port="FitsRouter.OH_SPEC" relation="relation9"/>
- <link port="give purpose number.in_sof" relation="relation"/>
- <link port="give purpose number.out_sof" relation="relation8"/>
- <link port="Repeat.input" relation="relation11"/>
- <link port="Repeat.output" relation="relation7"/>
- <link port="ModifyPurpose.sof in" relation="relation9"/>
- <link port="ModifyPurpose.sof out" relation="relation11"/>
- <link port="FitsRouter2.in" relation="relation13"/>
- <link port="FitsRouter2.SCI_COMBINED" relation="relation12"/>
+ <link port="current_dataset" relation="relation7"/>
+ <link port="final_files" relation="relation10"/>
+ <link port="bookkeeping_db" relation="relation15"/>
+ <link port="global_timestamp" relation="relation16"/>
+ <link port="String Constant.output" relation="relation9"/>
+ <link port="String Constant.trigger" relation="relation"/>
+ <link port="Finished Datasets.input" relation="relation12"/>
+ <link port="String Constant2.output" relation="relation2"/>
+ <link port="String Constant2.trigger" relation="relation"/>
+ <link port="String Constant3.output" relation="relation11"/>
+ <link port="String Constant3.trigger" relation="relation10"/>
+ <link port="Final directory path.parts" relation="relation5"/>
+ <link port="Final directory path.parts" relation="relation3"/>
+ <link port="Final directory path.whole" relation="relation4"/>
+ <link port="Write README.input" relation="relation"/>
+ <link port="Write README.fileName" relation="relation6"/>
+ <link port="String Constant4.output" relation="relation3"/>
+ <link port="String Constant4.trigger" relation="relation10"/>
+ <link port="String Constant5.output" relation="relation8"/>
+ <link port="String Constant5.trigger" relation="relation"/>
+ <link port="Write to stdout.input" relation="relation12"/>
+ <link port="String Constant6.output" relation="relation5"/>
+ <link port="String Constant6.trigger" relation="relation10"/>
+ <link port="Path to README.parts" relation="relation2"/>
+ <link port="Path to README.parts" relation="relation8"/>
+ <link port="Path to README.parts" relation="relation9"/>
+ <link port="Path to README.whole" relation="relation6"/>
+ <link port="Final message.parts" relation="relation7"/>
+ <link port="Final message.parts" relation="relation11"/>
+ <link port="Final message.parts" relation="relation4"/>
+ <link port="Final message.whole" relation="relation12"/>
+ <link port="String Constant7.output" relation="relation13"/>
+ <link port="String Constant7.trigger" relation="relation10"/>
+ <link port="README message.parts" relation="relation12"/>
+ <link port="README message.parts" relation="relation13"/>
+ <link port="README message.parts" relation="relation14"/>
+ <link port="README message.whole" relation="relation"/>
+ <link port="ObjectToText.json in" relation="relation10"/>
+ <link port="ObjectToText.text out" relation="relation14"/>
+ <link port="String Constant8.output" relation="relation15"/>
+ <link port="String Constant8.trigger" relation="relation10"/>
+ <link port="String Constant9.output" relation="relation16"/>
+ <link port="String Constant9.trigger" relation="relation10"/>
</entity>
<relation name="relation2" class="ptolemy.actor.TypedIORelation">
<property name="width" class="ptolemy.data.expr.Parameter" value="1">
</property>
</relation>
- <relation name="relation8" class="ptolemy.actor.TypedIORelation">
+ <relation name="relation" class="ptolemy.actor.TypedIORelation">
<property name="width" class="ptolemy.data.expr.Parameter" value="1">
</property>
</relation>
- <relation name="relation" class="ptolemy.actor.TypedIORelation">
- </relation>
<relation name="relation5" class="ptolemy.actor.TypedIORelation">
- </relation>
- <relation name="relation10" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation11" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation14" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation23" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation15" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation4" class="ptolemy.actor.TypedIORelation">
- </relation>
- <relation name="relation28" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation31" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation40" class="ptolemy.actor.TypedIORelation">
<property name="width" class="ptolemy.data.expr.Parameter" value="-1">
@@ -7422,91 +7716,157 @@
<vertex name="vertex1" value="[1015.0, 780.0]">
</vertex>
</relation>
- <relation name="relation36" class="ptolemy.actor.TypedIORelation">
- </relation>
<relation name="relation13" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[550.0, 855.0]">
</vertex>
</relation>
<relation name="relation3" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation25" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[-100.0, 740.0]">
</vertex>
</relation>
<relation name="relation16" class="ptolemy.actor.TypedIORelation">
- </relation>
- <relation name="relation6" class="ptolemy.actor.TypedIORelation">
- <vertex name="vertex" value="{0.0, 0.0}">
- </vertex>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation24" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[110.0, 685.0]">
</vertex>
</relation>
<relation name="relation12" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[320.0, 895.0]">
</vertex>
</relation>
<relation name="relation32" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[135.0, 975.0]">
</vertex>
</relation>
<relation name="relation22" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[335.0, 975.0]">
</vertex>
</relation>
<relation name="relation17" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[560.0, 1070.0]">
</vertex>
</relation>
<relation name="relation18" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[320.0, 685.0]">
</vertex>
</relation>
<relation name="relation26" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[565.0, 685.0]">
</vertex>
</relation>
<relation name="relation19" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[335.0, 740.0]">
</vertex>
</relation>
<relation name="relation29" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[545.0, 1050.0]">
</vertex>
</relation>
<relation name="relation27" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[575.0, 895.0]">
</vertex>
</relation>
<relation name="relation30" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[780.0, 895.0]">
</vertex>
</relation>
<relation name="relation34" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[825.0, 1085.0]">
</vertex>
</relation>
<relation name="relation33" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[790.0, 920.0]">
</vertex>
</relation>
<relation name="relation38" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
<vertex name="vertex1" value="[485.0, 920.0]">
</vertex>
</relation>
<relation name="relation20" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation21" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation39" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation35" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation7" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<relation name="relation9" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation10" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation8" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation28" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation36" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation37" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
+ </relation>
+ <relation name="relation41" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<link port="FitsRouter.in" relation="relation14"/>
<link port="FitsRouter.DARK" relation="relation4"/>
@@ -7535,13 +7895,8 @@
<link port="LAMP_FLAT.sof_out" relation="relation24"/>
<link port="KMOS_SCIENCE_REDUCTION.sof_out" relation="relation40"/>
<link port="KMOS_SCIENCE_REDUCTION.port" relation="relation9"/>
- <link port="DataFilter.sof in" relation="relation36"/>
- <link port="DataFilter.sof in" relation="relation40"/>
- <link port="DataFilter.sof out" relation="relation8"/>
<link port="SofCombiner4.sof in" relation="relation4"/>
<link port="SofCombiner4.sof out" relation="relation2"/>
- <link port="ProductRenamer.sof_in" relation="relation8"/>
- <link port="ProductRenamer.sof_out" relation="relation10"/>
<link port="WAVE_CAL.sof_in" relation="relation15"/>
<link port="WAVE_CAL.sof_out" relation="relation12"/>
<link port="ILLUMINATION.sof_in" relation="relation31"/>
@@ -7558,11 +7913,9 @@
<link port="Initialize.raw_data_dir" relation="relation"/>
<link port="Data Set Selection.datasets_in" relation="relation5"/>
<link port="Data Set Selection.dataset_out" relation="relation11"/>
- <link port="Initialise Current Dataset.current_dataset" relation="relation28"/>
+ <link port="Initialise Current Dataset.current_dataset" relation="relation41"/>
<link port="Initialise Current Dataset.dataset_in" relation="relation11"/>
<link port="Initialise Current Dataset.dataset" relation="relation14"/>
- <link port="Close DataSet.current_dataset" relation="relation28"/>
- <link port="Close DataSet.final_files" relation="relation10"/>
<link port="STANDARD_STAR.sof_in" relation="relation23"/>
<link port="STANDARD_STAR.sof_out" relation="relation35"/>
<link port="SofCombiner5.sof in" relation="relation24"/>
@@ -7576,9 +7929,20 @@
<link port="SofCombiner7.sof in" relation="relation12"/>
<link port="SofCombiner7.sof in" relation="relation22"/>
<link port="SofCombiner7.sof out" relation="relation31"/>
- <link port="CompositeActor.output" relation="relation36"/>
+ <link port="CompositeActor.output" relation="relation10"/>
<link port="CompositeActor.SOF_SCI_RED" relation="relation7"/>
<link port="CompositeActor.sci_combined" relation="relation40"/>
+ <link port="ProvenanceExplorer.bookkeeping db" relation="relation36"/>
+ <link port="ProvenanceExplorer.start date" relation="relation37"/>
+ <link port="SofCombiner3.sof in" relation="relation10"/>
+ <link port="SofCombiner3.sof in" relation="relation40"/>
+ <link port="SofCombiner3.sof out" relation="relation8"/>
+ <link port="ProductRenamer.sof_in" relation="relation8"/>
+ <link port="ProductRenamer.sof_out" relation="relation28"/>
+ <link port="Close DataSet.current_dataset" relation="relation41"/>
+ <link port="Close DataSet.final_files" relation="relation28"/>
+ <link port="Close DataSet.bookkeeping_db" relation="relation36"/>
+ <link port="Close DataSet.global_timestamp" relation="relation37"/>
<link relation1="relation25" relation2="relation19"/>
<link relation1="relation24" relation2="relation18"/>
<link relation1="relation12" relation2="relation27"/>
diff --git a/regtests/tests/Makefile.am b/regtests/tests/Makefile.am
index b3603ff..f493e88 100644
--- a/regtests/tests/Makefile.am
+++ b/regtests/tests/Makefile.am
@@ -38,7 +38,7 @@ reg1:
valgrind:
esoreg.pl -valgrind -preload ../../${PACKAGE}_reg/sof
-check:
+regcheck:
mkdir -p .purifydir
@if test -d ../../${PACKAGE}_reg/sof/; then esorex --version ; fi
@if test -d ../../${PACKAGE}_reg/sof/; then mkdir -p ../../${PACKAGE}_reg/sof/.purifydir ; fi
diff --git a/regtests/tests/Makefile.in b/regtests/tests/Makefile.in
index e6f1e91..01965a3 100644
--- a/regtests/tests/Makefile.in
+++ b/regtests/tests/Makefile.in
@@ -414,7 +414,7 @@ reg1:
valgrind:
esoreg.pl -valgrind -preload ../../${PACKAGE}_reg/sof
-check:
+regcheck:
mkdir -p .purifydir
@if test -d ../../${PACKAGE}_reg/sof/; then esorex --version ; fi
@if test -d ../../${PACKAGE}_reg/sof/; then mkdir -p ../../${PACKAGE}_reg/sof/.purifydir ; fi
diff --git a/setup b/setup
index daf7f3d..0790939 100755
--- a/setup
+++ b/setup
@@ -17,9 +17,9 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# $Author: yjung $
-# $Date: 2013/02/28 15:42:26 $
+# $Date: 2013-02-28 15:42:26 $
# $Revision: 1.2 $
-# $Name: kmosp_v1_2_4__20130807 $
+# $Name: not supported by cvs2svn $
# This script is the autoinstaller for the VLT instrument pipeline
diff --git a/tools/easySPARK/Makefile b/tools/easySPARK/Makefile
index fc5c8e0..0b9aede 100644
--- a/tools/easySPARK/Makefile
+++ b/tools/easySPARK/Makefile
@@ -86,22 +86,22 @@ SCRIPTS = $(dist_bin_SCRIPTS)
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = ${SHELL} /home/yjung/tmp/1.2.4/kmosp/admin/missing --run aclocal-1.11
+ACLOCAL = ${SHELL} /home/yjung/tmp/kmos-1_2_6/kmosp/admin/missing --run aclocal-1.11
AMTAR = $${TAR-tar}
AR = ar
-AUTOCONF = ${SHELL} /home/yjung/tmp/1.2.4/kmosp/admin/missing --run autoconf
-AUTOHEADER = ${SHELL} /home/yjung/tmp/1.2.4/kmosp/admin/missing --run autoheader
-AUTOMAKE = ${SHELL} /home/yjung/tmp/1.2.4/kmosp/admin/missing --run automake-1.11
+AUTOCONF = ${SHELL} /home/yjung/tmp/kmos-1_2_6/kmosp/admin/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/yjung/tmp/kmos-1_2_6/kmosp/admin/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/yjung/tmp/kmos-1_2_6/kmosp/admin/missing --run automake-1.11
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g3 -ggdb -O0 -rdynamic -Wall -W -fno-builtin
-CPL_INCLUDES = -I/home_eso/yjung/install/ga016532/include -I/home_eso/yjung/install/ga016532/include
-CPL_LDFLAGS = -L/home_eso/yjung/install/ga016532/lib -L/home_eso/yjung/install/ga016532/lib
+CPL_INCLUDES = -I/home_eso/yjung/install/dfs_ga016532/include -I/home_eso/yjung/install/dfs_ga016532/include
+CPL_LDFLAGS = -L/home_eso/yjung/install/dfs_ga016532/lib -L/home_eso/yjung/install/dfs_ga016532/lib
CPP = gcc -E
CPPFLAGS =
-CX_INCLUDES = -I/home_eso/yjung/install/ga016532/include
-CX_LDFLAGS = -L/home_eso/yjung/install/ga016532/lib
+CX_INCLUDES = -I/home_eso/yjung/install/dfs_ga016532/include
+CX_LDFLAGS = -L/home_eso/yjung/install/dfs_ga016532/lib
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
@@ -122,15 +122,15 @@ INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
-KMOS_BINARY_AGE = 204
-KMOS_BINARY_VERSION = 10204
-KMOS_INCLUDES = -I$(top_srcdir)/kmos -I$(top_srcdir)/irplib
+KMOS_BINARY_AGE = 206
+KMOS_BINARY_VERSION = 10206
+KMOS_INCLUDES = -I$(top_srcdir)/kmos -I$(top_srcdir)/irplib -I$(top_srcdir)/kmclipm
KMOS_INTERFACE_AGE = 0
KMOS_LDFLAGS = -L$(top_builddir)/kmos
KMOS_MAJOR_VERSION = 1
-KMOS_MICRO_VERSION = 4
+KMOS_MICRO_VERSION = 6
KMOS_MINOR_VERSION = 2
-KMOS_VERSION = 1.2.4
+KMOS_VERSION = 1.2.6
LATEX = /usr/bin/latex
LD = /usr/bin/ld -m elf_x86_64
LDFLAGS =
@@ -152,7 +152,7 @@ LT_AGE = 0
LT_CURRENT = 0
LT_REVISION = 0
MAINT =
-MAKEINFO = ${SHELL} /home/yjung/tmp/1.2.4/kmosp/admin/missing --run makeinfo
+MAKEINFO = ${SHELL} /home/yjung/tmp/kmos-1_2_6/kmosp/admin/missing --run makeinfo
MANIFEST_TOOL = :
MKDIR_P = /bin/mkdir -p
NM = /usr/bin/nm -B
@@ -164,10 +164,10 @@ OTOOL64 =
PACKAGE = kmos
PACKAGE_BUGREPORT = kmos-spark at mpe.mpg.de
PACKAGE_NAME = KMOS Instrument Pipeline
-PACKAGE_STRING = KMOS Instrument Pipeline 1.2.4
+PACKAGE_STRING = KMOS Instrument Pipeline 1.2.6
PACKAGE_TARNAME = kmos
PACKAGE_URL =
-PACKAGE_VERSION = 1.2.4
+PACKAGE_VERSION = 1.2.6
PATH_SEPARATOR = :
PURIFY_CMD = NONE
RANLIB = ranlib
@@ -175,11 +175,11 @@ SED = /bin/sed
SET_MAKE =
SHELL = /bin/bash
STRIP = strip
-VERSION = 1.2.4
-abs_builddir = /home/yjung/tmp/1.2.4/kmosp/tools/easySPARK
-abs_srcdir = /home/yjung/tmp/1.2.4/kmosp/tools/easySPARK
-abs_top_builddir = /home/yjung/tmp/1.2.4/kmosp
-abs_top_srcdir = /home/yjung/tmp/1.2.4/kmosp
+VERSION = 1.2.6
+abs_builddir = /home/yjung/tmp/kmos-1_2_6/kmosp/tools/easySPARK
+abs_srcdir = /home/yjung/tmp/kmos-1_2_6/kmosp/tools/easySPARK
+abs_top_builddir = /home/yjung/tmp/kmos-1_2_6/kmosp
+abs_top_srcdir = /home/yjung/tmp/kmos-1_2_6/kmosp
ac_ct_AR = ar
ac_ct_CC = gcc
ac_ct_DUMPBIN =
@@ -212,7 +212,7 @@ host_vendor = unknown
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
-install_sh = ${SHELL} /home/yjung/tmp/1.2.4/kmosp/admin/install-sh
+install_sh = ${SHELL} /home/yjung/tmp/kmos-1_2_6/kmosp/admin/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
@@ -249,8 +249,10 @@ dist_bin_SCRIPTS = easySPARK_calibration.sh \
easySPARK_flat.sh \
easySPARK_illumination.sh \
easySPARK_reconstruct.sh \
+ easySPARK_multi_reconstruct.sh \
easySPARK_sci_red.sh \
easySPARK_std_star.sh \
+ easySPARK_test.sh \
easySPARK_wave_cal.sh
all: all-am
diff --git a/tools/easySPARK/Makefile.am b/tools/easySPARK/Makefile.am
index 575787c..90a9b54 100644
--- a/tools/easySPARK/Makefile.am
+++ b/tools/easySPARK/Makefile.am
@@ -32,7 +32,9 @@ dist_bin_SCRIPTS = easySPARK_calibration.sh \
easySPARK_flat.sh \
easySPARK_illumination.sh \
easySPARK_reconstruct.sh \
+ easySPARK_multi_reconstruct.sh \
easySPARK_sci_red.sh \
easySPARK_std_star.sh \
+ easySPARK_test.sh \
easySPARK_wave_cal.sh
diff --git a/tools/easySPARK/Makefile.in b/tools/easySPARK/Makefile.in
index 5a797b0..20ca740 100644
--- a/tools/easySPARK/Makefile.in
+++ b/tools/easySPARK/Makefile.in
@@ -249,8 +249,10 @@ dist_bin_SCRIPTS = easySPARK_calibration.sh \
easySPARK_flat.sh \
easySPARK_illumination.sh \
easySPARK_reconstruct.sh \
+ easySPARK_multi_reconstruct.sh \
easySPARK_sci_red.sh \
easySPARK_std_star.sh \
+ easySPARK_test.sh \
easySPARK_wave_cal.sh
all: all-am
diff --git a/tools/easySPARK/easySPARK_calibration.sh b/tools/easySPARK/easySPARK_calibration.sh
index b1e377e..fdd6d30 100755
--- a/tools/easySPARK/easySPARK_calibration.sh
+++ b/tools/easySPARK/easySPARK_calibration.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+EASY_VERSION="1.0"
+
bb=`tput bold`
nn=`tput sgr0`
@@ -24,15 +26,21 @@ if [ $# -eq 0 ]; then
echo " All matching exposures are collected automatically."
echo "- Sometimes the provided ${bb}KMOS_spec_cal_dark${nn} frames are a bit"
echo " arbitrary. If a badpixel_dark*.fits is already present in the working"
- echo " directory, it can be chosen as well depending on user input."
- echo "- (Optional) If as 2nd argument ${bb}sof${nn} is provided, then only"
+ echo " directory, it can be chosen as well, depending on user input."
+ echo "- (Optional) If as additional argument ${bb}sof${nn} is provided, then only"
echo " the sof-file is generated but not executed."
+ echo "- (Optional) If as additional argument ${bb}par${nn} is provided, then"
+ echo " all flats and all wave_cals for all bands are processed in parallel."
+ echo " If not set, only 3 tasks are started in parallel and afterwards the"
+ echo " remaining bands are processed."
echo "- All processing output is logged into log_xxx.txt files"
echo " "
echo "${bb}Usage:${nn}"
echo " easySPARK_calibration.sh <filename with full path>"
echo " or"
echo " easySPARK_calibration.sh <filename with full path> sof"
+ echo " "
+ echo "Version: "$EASY_VERSION
echo "${bb}-------------------------------------------------------------------${nn}"
exit
fi
@@ -91,6 +99,66 @@ getTplStartIds()
echo "${tplStart[@]}"
}
+vers_dark=( $(easySPARK_dark.sh vers) )
+vers_flat=( $(easySPARK_flat.sh vers) )
+vers_wave=( $(easySPARK_wave_cal.sh vers) )
+vers_test=( $(easySPARK_test.sh vers) )
+
+if [[ $EASY_VERSION != $vers_dark || $EASY_VERSION != $vers_flat || $EASY_VERSION != $vers_wave || $EASY_VERSION != $vers_test ]]; then
+ echo "${bb}ERROR:${nn} Version mismatch!"
+ echo " easySPARK_calibration.sh: v"$EASY_VERSION
+ echo " easySPARK_dark.sh: v"$vers_dark
+ echo " easySPARK_flat.sh: v"$vers_flat
+ echo " easySPARK_wave_cal.sh: v"$vers_wave
+ echo " easySPARK_test.sh: v"$vers_test
+ echo ""
+ echo "Here the paths of the identified easySPARK-scripts:"
+ echo " "$(which easySPARK_calibration.sh)
+ echo " "$(which easySPARK_dark.sh)
+ echo " "$(which easySPARK_flat.sh)
+ echo " "$(which easySPARK_wave_cal.sh)
+ echo " "$(which easySPARK_test.sh)
+ exit
+fi
+
+# init
+sofOnly=0
+parallelMode=0
+printVers=0
+
+# extract all arguments beginning with KMOS, eventually imethod and sof
+while [ "$1" ] ; do
+ tmp=$(basename $1)
+ if [[ $tmp == KMOS* ]]; then
+ # file-check
+ if [ ! -e $1 ]; then
+ echo "${bb}ERROR:${nn} File doesn't exist! ($1)"
+ exit
+ fi
+
+ fileName=$1
+
+ if [ ${fileName:0:1} != "/" ]; then
+ echo "${bb}ERROR:${nn} Filepath should be absolute!"
+ exit
+ fi
+ else
+ if [[ $tmp == sof ]]; then
+ sofOnly=1
+ elif [[ $tmp == par ]]; then
+ parallelMode=1
+ elif [[ $tmp == vers ]]; then
+ printVers=1
+ fi
+ fi
+ shift
+done
+
+if [ $printVers = 1 ]; then
+ echo $EASY_VERSION
+ exit
+fi
+
# check if gawk is existing
if command -v gawk >/dev/null; then
:
@@ -103,18 +171,6 @@ else
echo "Aborting now.!"
fi
-# file-check
-fileName=$1
-if [ ! -e $fileName ]; then
- echo "${bb}ERROR:${nn} File doesn't exist!"
- exit
-fi
-
-if [ ${fileName:0:1} != "/" ]; then
- echo "${bb}ERROR:${nn} Filepath should be absolute!"
- exit
-fi
-
cntBadPixDark=0
fn_badpix=
if ls badpixel_dark* &> /dev/null; then
@@ -133,12 +189,13 @@ if [[ $tplId != KMOS_spec_cal_dark && $tplId != KMOS_spec_cal_calunitflat && $tp
exit
fi
-# check if only sof-file should be generated
-sofOnly=0
-sof=
-if [[ ${@: -1} == sof ]]; then # checking for last argument
- sofOnly=1
- sof=" sof"
+if [ -z "${KMOS_CALIB}" ]; then
+ echo "${bb}ERROR${nn}: environment variable KMOS_CALIB is not defined! (see help)"
+ exit
+fi
+
+if [ $parallelMode = 1 ]; then
+ echo "${bb}PARALLEL MODE activated: all flats and wave_cals for all bands are processed in parallel.${nn}"
fi
##########################################################
@@ -288,51 +345,114 @@ cntDarkSets=$[${#tplStartIdsDark[@]}]
if [[ $cntDarkSets -eq 0 && $cntBadPixDark -eq 0 ]]; then
echo "${bb}ERROR:${nn} No matching dark exposures and no badpixel_dark*.fits found!"
exit
-else
- if [[ $cntBadPixDark -eq 1 && $cntDarkSets -eq 0 ]]; then
- echo "${bb}ATTENTION:${nn}"
- echo "No ${bb}KMOS_spec_cal_dark${nn} template has been executed in this OB,"
- echo "but "$fn_badpix" has been found in this directory."
- echo "It will be used to calculate flats and wave_cals."
- echo ""
- cntBadPixDark=1
- cntDarkSets=0
- elif [[ $cntBadPixDark -eq 0 && $cntDarkSets -gt 1 ]]; then
- echo "${bb}ATTENTION:${nn}"
- echo "Several ${bb}KMOS_spec_cal_dark${nn} templates have been executed in this OB!"
- echo "Select the set you want to use for calibration (normally EXPTIME = 10s and"
- echo "at least 3 exposures per set)"
- echo ""
- echo -e "ID\tEXPTIME\tTPL.START\t\tFILES"
- echo ""
-
- # print available TPL.START sets
- setNr=1
- for id in ${tplStartIdsDark[*]}; do
- tmpDarks=$(dfits $matchingDarks | \
- fitsort -d tpl.start |\
- grep $id|\
- gawk '{print $1}')
- tmpExptime=$(dfits ${tmpDarks} | \
- fitsort -d tpl.start exptime |\
- grep $id |\
- gawk '{print $3}')
-
- echo -e "$setNr\t${tmpExptime%%.*}\t$id"
- for file in $tmpDarks; do
- echo -e "\t\t\t\t\t"$(basename $file)
- done
- setNr=$[$setNr+1]
+elif [[ $cntBadPixDark -eq 1 && $cntDarkSets -eq 0 ]]; then
+ echo "${bb}ATTENTION:${nn}"
+ echo "No ${bb}KMOS_spec_cal_dark${nn} template has been executed in this OB,"
+ echo "but "$fn_badpix" has been found in this directory."
+ echo "It will be used to calculate flats and wave_cals."
+ echo ""
+ cntBadPixDark=1
+ cntDarkSets=0
+elif [[ $cntBadPixDark -eq 0 && $cntDarkSets -eq 1 ]]; then
+ # do nothing
+ cntBadPixDark=0
+ cntDarkSets=1
+elif [[ $cntBadPixDark -eq 0 && $cntDarkSets -gt 1 ]]; then
+ echo "${bb}ATTENTION:${nn}"
+ echo "Several ${bb}KMOS_spec_cal_dark${nn} templates have been executed in this OB!"
+ echo "Select the set you want to use for calibration (normally EXPTIME = 10s and"
+ echo "at least 3 exposures per set)"
+ echo ""
+ echo -e "ID\tEXPTIME\tTPL.START\t\tFILES"
+ echo ""
+
+ # print available TPL.START sets
+ setNr=1
+ for id in ${tplStartIdsDark[*]}; do
+ tmpDarks=$(dfits $matchingDarks | \
+ fitsort -d tpl.start |\
+ grep $id|\
+ gawk '{print $1}')
+ tmpExptime=$(dfits ${tmpDarks} | \
+ fitsort -d tpl.start exptime |\
+ grep $id |\
+ gawk '{print $3}')
+
+ echo -e "$setNr\t${tmpExptime%%.*}\t$id"
+ for file in $tmpDarks; do
+ echo -e "\t\t\t\t\t"$(basename $file)
done
- setNr=$[$setNr-1]
+ setNr=$[$setNr+1]
+ done
+ setNr=$[$setNr-1]
- # ask user which one to use
+ # ask user which one to use
+ read -p "Enter ID (1 to $setNr): " input
+ while [[ $input -lt 1 || $input -gt $setNr ]]; do
read -p "Enter ID (1 to $setNr): " input
- while [[ $input -lt 1 || $input -gt $setNr ]]; do
- read -p "Enter ID (1 to $setNr): " input
+ done
+
+ myTplStartIdDark=${tplStartIdsDark[$[$input-1]]}
+
+ # update matchingDarks
+ for id in ${tplStartIdsDark[*]}; do
+ if [ $id = $myTplStartIdDark ]; then
+ matchingDarks=$(dfits $matchingDarks | \
+ fitsort -d tpl.start |\
+ grep $id|\
+ gawk '{print $1}')
+ fi
+ done
+ cntDarkSets=1
+ cntBadPixDark=0
+else
+ echo "${bb}ATTENTION:${nn}"
+ echo "Several ${bb}KMOS_spec_cal_dark${nn} templates have been executed in this OB!"
+ echo "as well "$fn_badpix" has been found in this directory!"
+ echo "Select the set you want to use for calibration (normally EXPTIME = 10s and"
+ echo "at least 3 exposures per set)"
+ echo ""
+ echo -e "ID\tEXPTIME\tTPL.START\t\tFILES"
+ echo ""
+
+ # print available badpixel_dark*.fits
+ setNr=1
+ for i in $fn_badpix; do
+ echo -e "$setNr\t"$i
+ echo ""
+ setNr=$[$setNr+1]
+ done
+
+ # print available TPL.START sets
+ for id in ${tplStartIdsDark[*]}; do
+ tmpDarks=$(dfits $matchingDarks | \
+ fitsort -d tpl.start |\
+ grep $id|\
+ gawk '{print $1}')
+ tmpExptime=$(dfits ${tmpDarks} | \
+ fitsort -d tpl.start exptime |\
+ grep $id |\
+ gawk '{print $3}')
+
+ echo -e "$setNr\t${tmpExptime%%.*}\t$id"
+ for file in $tmpDarks; do
+ echo -e "\t\t\t\t\t"$(basename $file)
done
+ setNr=$[$setNr+1]
+ done
+ setNr=$[$setNr-1]
+
+ # ask user which one to use
+ read -p "Enter ID (1 to $setNr): " input
+ while [[ $input -lt 1 || $input -gt $setNr ]]; do
+ read -p "Enter ID (1 to $setNr): " input
+ done
- myTplStartIdDark=${tplStartIdsDark[$[$input-1]]}
+ if [[ $input -ge 1 && $input -le $cntBadPixDark ]]; then
+ cntDarkSets=0
+ cntBadPixDark=$input
+ else
+ myTplStartIdDark=${tplStartIdsDark[$[$input-2]]}
# update matchingDarks
for id in ${tplStartIdsDark[*]}; do
@@ -345,67 +465,6 @@ else
done
cntDarkSets=1
cntBadPixDark=0
- else
- echo "${bb}ATTENTION:${nn}"
- echo "Several ${bb}KMOS_spec_cal_dark${nn} templates have been executed in this OB!"
- echo "as well "$fn_badpix" has been found in this directory!"
- echo "Select the set you want to use for calibration (normally EXPTIME = 10s and"
- echo "at least 3 exposures per set)"
- echo ""
- echo -e "ID\tEXPTIME\tTPL.START\t\tFILES"
- echo ""
-
- # print available badpixel_dark*.fits
- setNr=1
- for i in $fn_badpix; do
- echo -e "$setNr\t"$i
- echo ""
- setNr=$[$setNr+1]
- done
-
- # print available TPL.START sets
- for id in ${tplStartIdsDark[*]}; do
- tmpDarks=$(dfits $matchingDarks | \
- fitsort -d tpl.start |\
- grep $id|\
- gawk '{print $1}')
- tmpExptime=$(dfits ${tmpDarks} | \
- fitsort -d tpl.start exptime |\
- grep $id |\
- gawk '{print $3}')
-
- echo -e "$setNr\t${tmpExptime%%.*}\t$id"
- for file in $tmpDarks; do
- echo -e "\t\t\t\t\t"$(basename $file)
- done
- setNr=$[$setNr+1]
- done
- setNr=$[$setNr-1]
-
- # ask user which one to use
- read -p "Enter ID (1 to $setNr): " input
- while [[ $input -lt 1 || $input -gt $setNr ]]; do
- read -p "Enter ID (1 to $setNr): " input
- done
-
- if [ $input -eq 1 ]; then
- cntDarkSets=0
- cntBadPixDark=1
- else
- myTplStartIdDark=${tplStartIdsDark[$[$input-2]]}
-
- # update matchingDarks
- for id in ${tplStartIdsDark[*]}; do
- if [ $id = $myTplStartIdDark ]; then
- matchingDarks=$(dfits $matchingDarks | \
- fitsort -d tpl.start |\
- grep $id|\
- gawk '{print $1}')
- fi
- done
- cntDarkSets=1
- cntBadPixDark=0
- fi
fi
fi
@@ -452,15 +511,20 @@ echo ""
# print darks
echo " darks:"
-i=$[1]
+i=1
if [ $cntDarkSets -eq 1 ]; then
for file in $matchingDarks; do
echo -e "`printf "%02d" $i` $(basename $file)"
i=$[i+1]
done
-fi
-if [ $cntBadPixDark -eq 1 ]; then
- echo -e "`printf "%02d" $i` badpixel_dark.fits"
+else
+ for file in $fn_badpix; do
+ if [ $i -eq $cntBadPixDark ]; then
+ echo "01 $file"
+ myDarkFilename=$file
+ fi
+ i=$[$i+1]
+ done
fi
echo ""
@@ -551,7 +615,7 @@ fi
echo "--------------------------------------------------------------------"
if [ $sofOnly = 0 ]; then
# execute
- if [[ $cntDarkSets -eq 1 || $cntBadPixDark -eq 1 ]]; then
+ if [[ $cntDarkSets -eq 1 || $cntBadPixDark -ge 1 ]]; then
read -p "Should the calibrations be executed like this now? (Y/n)" input
input=${input:-y}
if [[ "$input" != "y" && "$input" != "Y" ]]; then
@@ -578,26 +642,8 @@ if [ $sofOnly = 0 ]; then
if [[ "$createDir" != "n" && "$createDir" != "N" ]]; then
mkdir $obsStartTime
cd $obsStartTime
- if [ $cntBadPixDark -eq 1 ]; then
- ln -s ../badpixel_dark.fits badpixel_dark.fits
- fi
- fi
-
- if [ -z "${KMOS_CALIB}" ]; then
- echo "ERROR: environment variable KMOS_CALIB is not defined! (see help)"
- exit
- fi
-
- procSerial=0
- if [[ $cntFlatSets -gt 1 || $cntArcSets -gt 1 ]]; then
- echo "--------------------------------------------------------------------"
- echo "Should all bands be processed in parallel (16GB of RAM recommended)?"
- read -p "Otherwise up to 3 bands are processed first and the remaining afterwards. (y/N)" input
- input=${input:-n}
- if [[ "$input" != "n" && "$input" != "N" ]]; then
- procSerial=0
- else
- procSerial=1
+ if [ $cntBadPixDark -ge 1 ]; then
+ cp -s ../$myDarkFilename .
fi
fi
@@ -625,7 +671,7 @@ if [ $sofOnly = 0 ]; then
# the bands are started with 90 seconds delay in order not to slow down
# the computer too much when saving files to disk
##########################################################
- if [ $procSerial = 1 ]; then
+ if [ $parallelMode = 0 ]; then
# serial processing
echo "The first 3 flats are now started in parallel with an offset of 90 seconds."
setNr=0
@@ -633,7 +679,7 @@ if [ $sofOnly = 0 ]; then
if [ $setNr -le 2 ]; then
mkdir -p ${flatGratings[$setNr]}"tmp"
cd ${flatGratings[$setNr]}"tmp"
- ln -s ../badpixel_dark.fits badpixel_dark.fits
+ ln -s ../$myDarkFilename $myDarkFilename
echo "Start processing flat in ${flatGratings[$setNr]}-band... (log_flat_${flatGratings[$setNr]}.txt)"
echo "easySPARK_flat.sh "$(echo ${matchingFlatBand[$setNr]}|gawk '{print $(NF)}') auto > ../log_flat_${flatGratings[$setNr]}.txt
(easySPARK_flat.sh $(echo ${matchingFlatBand[$setNr]}|gawk '{print $(NF)}') auto 2>&1 >> ../log_flat_${flatGratings[$setNr]}.txt) &
@@ -652,7 +698,7 @@ if [ $sofOnly = 0 ]; then
if [ $setNr -ge 3 ]; then
mkdir -p ${flatGratings[$setNr]}"tmp"
cd ${flatGratings[$setNr]}"tmp"
- ln -s ../badpixel_dark.fits badpixel_dark.fits
+ ln -s ../myDarkFilename $myDarkFilename
echo "Start processing flat in ${flatGratings[$setNr]}-band... (log_flat_${flatGratings[$setNr]}.txt)"
echo "easySPARK_flat.sh "$(echo ${matchingFlatBand[$setNr]}|gawk '{print $(NF)}') auto > ../log_flat_${flatGratings[$setNr]}.txt
(easySPARK_flat.sh $(echo ${matchingFlatBand[$setNr]}|gawk '{print $(NF)}') auto 2>&1 >> ../log_flat_${flatGratings[$setNr]}.txt) &
@@ -672,7 +718,7 @@ if [ $sofOnly = 0 ]; then
for i in ${tplStartIdsFlat[*]}; do
mkdir -p ${flatGratings[$setNr]}"tmp"
cd ${flatGratings[$setNr]}"tmp"
- ln -s ../badpixel_dark.fits badpixel_dark.fits
+ ln -s ../$myDarkFilename $myDarkFilename
echo "Start processing flat in ${flatGratings[$setNr]}-band... (log_flat_${flatGratings[$setNr]}.txt)"
echo "easySPARK_flat.sh "$(echo ${matchingFlatBand[$setNr]}|gawk '{print $(NF)}') auto > ../log_flat_${flatGratings[$setNr]}.txt
(easySPARK_flat.sh $(echo ${matchingFlatBand[$setNr]}|gawk '{print $(NF)}') auto 2>&1 >> ../log_flat_${flatGratings[$setNr]}.txt) &
@@ -691,7 +737,7 @@ if [ $sofOnly = 0 ]; then
setNr=0
for i in ${tplStartIdsFlat[*]}; do
cd ${flatGratings[$setNr]}"tmp"
- rm badpixel_dark.fits
+ rm $myDarkFilename
cd ..
mv ${flatGratings[$setNr]}"tmp"/* .
rm -r ${flatGratings[$setNr]}"tmp"
@@ -705,7 +751,7 @@ if [ $sofOnly = 0 ]; then
# the bands are started with 90 seconds delay in order not to slow down
# the computer too much when saving files to disk
##########################################################
- if [ $procSerial = 1 ]; then
+ if [ $parallelMode = 0 ]; then
# serial processing
echo "The first 3 wave_cals are now started in parallel with an offset of 90 seconds."
setNr=0
@@ -766,6 +812,9 @@ if [ $sofOnly = 0 ]; then
endTime=`date +%s`
echo "Overall execution time was "`expr $endTime - $startTime`" s."
echo "${bb}--------------------------------------------------------------------${nn}"
+
+ # print status report of created files
+ easySPARK_test.sh .
else
# just create sof files
if [ $cntDarkSets -eq 1 ]; then
diff --git a/tools/easySPARK/easySPARK_dark.sh b/tools/easySPARK/easySPARK_dark.sh
index 7522afe..491ef4e 100755
--- a/tools/easySPARK/easySPARK_dark.sh
+++ b/tools/easySPARK/easySPARK_dark.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+EASY_VERSION="1.0"
+
bb=`tput bold`
nn=`tput sgr0`
@@ -27,10 +29,44 @@ if [ $# -eq 0 ]; then
echo " easySPARK_dark.sh <filename with full path> sof ext"
echo " or"
echo " easySPARK_dark.sh <filename with full path> ext"
+ echo " "
+ echo "Version: "$EASY_VERSION
echo "${bb}-------------------------------------------------------------------${nn}"
exit
fi
+# init
+sofOnly=0
+appendExt=
+printVers=0
+
+# extract all arguments beginning with KMOS, eventually imethod and sof
+while [ "$1" ] ; do
+ tmp=$(basename $1)
+ if [[ $tmp == KMOS* ]]; then
+ # file-check
+ if [ ! -e $1 ]; then
+ echo "${bb}ERROR:${nn} File doesn't exist! ($1)"
+ exit
+ fi
+ fileName=$1
+ else
+ if [[ $tmp == ext ]]; then
+ appendExt=" --file_extension "
+ elif [[ $tmp == sof ]]; then
+ sofOnly=1
+ elif [[ $tmp == vers ]]; then
+ printVers=1
+ fi
+ fi
+ shift
+done
+
+if [ $printVers = 1 ]; then
+ echo $EASY_VERSION
+ exit
+fi
+
# check if gawk is existing
if command -v gawk >/dev/null; then
:
@@ -43,30 +79,6 @@ else
echo "Aborting now.!"
fi
-# init
-sofOnly=0
-appendExt=
-
-# extract all arguments beginning with KMOS, eventually imethod and sof
-while [ "$1" ] ; do
- tmp=$(basename $1)
- if [[ $tmp == KMOS* ]]; then
- # file-check
- if [ ! -e $1 ]; then
- echo "${bb}ERROR:${nn} File doesn't exist! ($1)"
- exit
- fi
- fileName=$1
- else
- if [[ $tmp == ext ]]; then
- appendExt=" --file_extension "
- elif [[ $tmp == sof ]]; then
- sofOnly=1
- fi
- fi
- shift
-done
-
#check if file is of correct template
tplId=$(dfits $fileName |\
fitsort -d tpl.id |\
diff --git a/tools/easySPARK/easySPARK_flat.sh b/tools/easySPARK/easySPARK_flat.sh
index 6710ed2..2b265c0 100755
--- a/tools/easySPARK/easySPARK_flat.sh
+++ b/tools/easySPARK/easySPARK_flat.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+EASY_VERSION="1.0"
+
bb=`tput bold`
nn=`tput sgr0`
@@ -25,6 +27,8 @@ if [ $# -eq 0 ]; then
echo " easySPARK_flat.sh <filename with full path>"
echo " or"
echo " easySPARK_flat.sh <filename with full path> sof"
+ echo " "
+ echo "Version: "$EASY_VERSION
echo "${bb}-------------------------------------------------------------------${nn}"
exit
fi
@@ -117,20 +121,11 @@ getdark()
eval $__resultvar="'$fn_BadPixelDark'"
}
-# check if gawk is existing
-if command -v gawk >/dev/null; then
- :
-else
- echo "'gawk' has not been found on your system!"
- OS=$(uname -s)
- if [ $OS != "Linux" ]; then
- echo "You seem using a MacOS, please use e.g. MacPorts to install gawk."
- fi
- echo "Aborting now.!"
-fi
-
+#init
sofOnly=0
automode=0
+printVers=0
+
# extract all arguments beginning with KMOS, eventually imethod and sof
while [ "$1" ] ; do
tmp=$(basename $1)
@@ -143,14 +138,33 @@ while [ "$1" ] ; do
fileName=$1
else
if [[ $tmp == auto ]]; then
- automode=1
+ automode=1
elif [[ $tmp == sof ]]; then
sofOnly=1
+ elif [[ $tmp == vers ]]; then
+ printVers=1
fi
fi
shift
done
+if [ $printVers = 1 ]; then
+ echo $EASY_VERSION
+ exit
+fi
+
+# check if gawk is existing
+if command -v gawk >/dev/null; then
+ :
+else
+ echo "'gawk' has not been found on your system!"
+ OS=$(uname -s)
+ if [ $OS != "Linux" ]; then
+ echo "You seem using a MacOS, please use e.g. MacPorts to install gawk."
+ fi
+ echo "Aborting now.!"
+fi
+
#check if file is of correct template
tplId=$(dfits $fileName |\
fitsort -d tpl.id |\
@@ -226,10 +240,12 @@ done
# get all files with matching tplStartTime and FLAT_LAMP from yesterday
matchingFiles=
+matchingFiles_yesterday=
+matchingFiles_tomorrow=
+matchingFiles_today=
date -d $today > /dev/null 2>&1
if [ $? = 0 ]; then
# we have a directory like 2013-06-10
- matchingFiles_yesterday=
if [ -e $dataDir_yesterday ]; then
matchingFiles_yesterday=$(dfits $dataDir_yesterday/KMOS*.fits | \
fitsort -d tpl.start dpr.type |\
@@ -240,7 +256,6 @@ if [ $? = 0 ]; then
fi
# get all files with matching tplStartTime and FLAT_LAMP from tomorrow
- matchingFiles_tomorrow=
if [ -e $dataDir_tomorrow ]; then
matchingFiles_tomorrow=$(dfits $dataDir_tomorrow/KMOS*.fits | \
fitsort -d tpl.start dpr.type |\
diff --git a/tools/easySPARK/easySPARK_illumination.sh b/tools/easySPARK/easySPARK_illumination.sh
index 54781ee..3ae3051 100755
--- a/tools/easySPARK/easySPARK_illumination.sh
+++ b/tools/easySPARK/easySPARK_illumination.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+EASY_VERSION="1.0"
+
bb=`tput bold`
nn=`tput sgr0`
@@ -27,10 +29,41 @@ if [ $# -eq 0 ]; then
echo " easySPARK_illumination.sh <filename with full path>"
echo " or"
echo " easySPARK_illumination.sh <filename with full path> sof"
+ echo " "
+ echo "Version: "$EASY_VERSION
echo "${bb}-------------------------------------------------------------------${nn}"
exit
fi
+# init
+sofOnly=0
+printVers=0
+
+# extract all arguments beginning with KMOS, eventually imethod and sof
+while [ "$1" ] ; do
+ tmp=$(basename $1)
+ if [[ $tmp == KMOS* ]]; then
+ # file-check
+ if [ ! -e $1 ]; then
+ echo "${bb}ERROR:${nn} File doesn't exist! ($1)"
+ exit
+ fi
+ fileName=$1
+ else
+ if [[ $tmp == sof ]]; then
+ sofOnly=1
+ elif [[ $tmp == vers ]]; then
+ printVers=1
+ fi
+ fi
+ shift
+done
+
+if [ $printVers = 1 ]; then
+ echo $EASY_VERSION
+ exit
+fi
+
# check if gawk is existing
if command -v gawk >/dev/null; then
:
@@ -48,13 +81,6 @@ if [ -z "${KMOS_CALIB}" ]; then
exit
fi
-# file-check
-fileName=$1
-if [ ! -e $fileName ]; then
- echo "${bb}ERROR:${nn} File doesn't exist!"
- exit
-fi
-
#check if file is of correct template
tplId=$(dfits $fileName |\
fitsort -d tpl.id |\
@@ -64,12 +90,6 @@ if [ $tplId != KMOS_spec_cal_skyflat ]; then
exit
fi
-# check if only sof-file should be generated
-sofOnly=0
-if [[ ${@: -1} == sof ]]; then # checking for last argument
- sofOnly=1
-fi
-
# extract TPL.START of ths file
tplStartTime=$(dfits $fileName |\
fitsort -d tpl.start |\
diff --git a/tools/easySPARK/easySPARK_multi_reconstruct.sh b/tools/easySPARK/easySPARK_multi_reconstruct.sh
index f4e8bed..277322a 100755
--- a/tools/easySPARK/easySPARK_multi_reconstruct.sh
+++ b/tools/easySPARK/easySPARK_multi_reconstruct.sh
@@ -1,19 +1,10 @@
#!/bin/bash
+EASY_VERSION="1.0"
+
bb=`tput bold`
nn=`tput sgr0`
-echo ""
-echo "${bb}######################################################################${nn}"
-echo "${bb}# Not functional yet! Still --ifu or --name parameter has to be #${nn}"
-echo "${bb}# specified! In the next release the NEW kmo_multi_reconstruct will #${nn}"
-echo "${bb}# be available! #${nn}"
-echo "${bb}# #${nn}"
-echo "${bb}# Use instead easySPARK_sci_red.sh with the sof-option to create #${nn}"
-echo "${bb}# an sof-file for kmo_multi_reconstruct! #${nn}"
-echo "${bb}######################################################################${nn}"
-echo ""
-exit
# help
if [ $# -eq 0 ]; then
echo "${bb}-------------------------------------------------------------------${nn}"
@@ -35,10 +26,41 @@ if [ $# -eq 0 ]; then
echo " easySPARK_multi_reconstruct.sh <filename with full path>"
echo " or"
echo " easySPARK_multi_reconstruct.sh <filename with full path> sof"
+ echo " "
+ echo "Version: "$EASY_VERSION
echo "${bb}-------------------------------------------------------------------${nn}"
exit
fi
+# init
+sofOnly=0
+printVers=0
+
+# extract all arguments beginning with KMOS, eventually imethod and sof
+while [ "$1" ] ; do
+ tmp=$(basename $1)
+ if [[ $tmp == KMOS* ]]; then
+ # file-check
+ if [ ! -e $1 ]; then
+ echo "${bb}ERROR:${nn} File doesn't exist! ($1)"
+ exit
+ fi
+ fileName=$1
+ else
+ if [[ $tmp == sof ]]; then
+ sofOnly=1
+ elif [[ $tmp == vers ]]; then
+ printVers=1
+ fi
+ fi
+ shift
+done
+
+if [ $printVers = 1 ]; then
+ echo $EASY_VERSION
+ exit
+fi
+
# check if gawk is existing
if command -v gawk >/dev/null; then
:
@@ -56,13 +78,6 @@ if [ -z "${KMOS_CALIB}" ]; then
exit
fi
-# file-check
-fileName=$1
-if [ ! -e $fileName ]; then
- echo "${bb}ERROR:${nn} File doesn't exist!"
- exit
-fi
-
#check if file is of correct template
tplId=$(dfits $fileName |\
fitsort -d tpl.id |\
@@ -72,12 +87,6 @@ if [[ $tplId != KMOS_spec_obs_nodtosky && $tplId != KMOS_spec_obs_stare && $tp
exit
fi
-# check if only sof-file should be generated
-sofOnly=0
-if [[ ${@: -1} == sof ]]; then # checking for last argument
- sofOnly=1
-fi
-
# extract TPL.START of ths file
tplStartTime=$(dfits $fileName |\
fitsort -d tpl.start |\
diff --git a/tools/easySPARK/easySPARK_reconstruct.sh b/tools/easySPARK/easySPARK_reconstruct.sh
index 482b089..acbf72c 100755
--- a/tools/easySPARK/easySPARK_reconstruct.sh
+++ b/tools/easySPARK/easySPARK_reconstruct.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+EASY_VERSION="1.0"
+
bb=`tput bold`
nn=`tput sgr0`
@@ -27,30 +29,16 @@ if [ $# -eq 0 ]; then
echo " easySPARK_reconstruct.sh <FILENAME(s)> <METHOD> sof"
echo " or"
echo " easySPARK_reconstruct.sh <FILENAME(s)> sof"
+ echo " "
+ echo "Version: "$EASY_VERSION
echo "${bb}-------------------------------------------------------------------${nn}"
exit
fi
-if [ -z "${KMOS_CALIB}" ]; then
- echo "${bb}ERROR:${nn} environment variable KMOS_CALIB is not defined! (see help)"
- exit
-fi
-
-# check if gawk is existing
-if command -v gawk >/dev/null; then
- :
-else
- echo "'gawk' has not been found on your system!"
- OS=$(uname -s)
- if [ $OS != "Linux" ]; then
- echo "You seem using a MacOS, please use e.g. MacPorts to install gawk."
- fi
- echo "Aborting now.!"
-fi
-
# init
sofOnly=0
nrAllFiles=0
+printVers=0
# extract all arguments beginning with KMOS, eventually imethod and sof
while [ "$1" ] ; do
@@ -70,11 +58,35 @@ while [ "$1" ] ; do
imethod=$tmp
elif [[ $tmp == sof ]]; then
sofOnly=1
+ elif [[ $tmp == vers ]]; then
+ printVers=1
fi
fi
shift
done
+if [ $printVers = 1 ]; then
+ echo $EASY_VERSION
+ exit
+fi
+
+if [ -z "${KMOS_CALIB}" ]; then
+ echo "${bb}ERROR:${nn} environment variable KMOS_CALIB is not defined! (see help)"
+ exit
+fi
+
+# check if gawk is existing
+if command -v gawk >/dev/null; then
+ :
+else
+ echo "'gawk' has not been found on your system!"
+ OS=$(uname -s)
+ if [ $OS != "Linux" ]; then
+ echo "You seem using a MacOS, please use e.g. MacPorts to install gawk."
+ fi
+ echo "Aborting now.!"
+fi
+
if [ $nrAllFiles = 0 ]; then
echo "${bb}ERROR:${nn} No valid file(s) provided!"
fi
diff --git a/tools/easySPARK/easySPARK_sci_red.sh b/tools/easySPARK/easySPARK_sci_red.sh
index 45609a0..6c52f4e 100755
--- a/tools/easySPARK/easySPARK_sci_red.sh
+++ b/tools/easySPARK/easySPARK_sci_red.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+EASY_VERSION="1.0"
+
bb=`tput bold`
nn=`tput sgr0`
@@ -24,10 +26,41 @@ if [ $# -eq 0 ]; then
echo " easySPARK_sci_red.sh <filename with full path>"
echo " or"
echo " easySPARK_sci_red.sh <filename with full path> sof"
+ echo " "
+ echo "Version: "$EASY_VERSION
echo "${bb}-------------------------------------------------------------------${nn}"
exit
fi
+# init
+sofOnly=0
+printVers=0
+
+# extract all arguments beginning with KMOS, eventually imethod and sof
+while [ "$1" ] ; do
+ tmp=$(basename $1)
+ if [[ $tmp == KMOS* ]]; then
+ # file-check
+ if [ ! -e $1 ]; then
+ echo "${bb}ERROR:${nn} File doesn't exist! ($1)"
+ exit
+ fi
+ fileName=$1
+ else
+ if [[ $tmp == sof ]]; then
+ sofOnly=1
+ elif [[ $tmp == vers ]]; then
+ printVers=1
+ fi
+ fi
+ shift
+done
+
+if [ $printVers = 1 ]; then
+ echo $EASY_VERSION
+ exit
+fi
+
# check if gawk is existing
if command -v gawk >/dev/null; then
:
@@ -45,13 +78,6 @@ if [ -z "${KMOS_CALIB}" ]; then
exit
fi
-# file-check
-fileName=$1
-if [ ! -e $fileName ]; then
- echo "${bb}ERROR:${nn} File doesn't exist!"
- exit
-fi
-
#check if file is of correct template
tplId=$(dfits $fileName |\
fitsort -d tpl.id |\
@@ -61,12 +87,6 @@ if [[ $tplId != KMOS_spec_obs_nodtosky && $tplId != KMOS_spec_obs_stare && $tp
exit
fi
-# check if only sof-file should be generated
-sofOnly=0
-if [[ ${@: -1} == sof ]]; then # checking for last argument
- sofOnly=1
-fi
-
# extract TPL.START of ths file
tplStartTime=$(dfits $fileName |\
fitsort -d tpl.start |\
diff --git a/tools/easySPARK/easySPARK_std_star.sh b/tools/easySPARK/easySPARK_std_star.sh
index fa4d913..a5c6359 100755
--- a/tools/easySPARK/easySPARK_std_star.sh
+++ b/tools/easySPARK/easySPARK_std_star.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+EASY_VERSION="1.0"
+
bb=`tput bold`
nn=`tput sgr0`
@@ -25,10 +27,41 @@ if [ $# -eq 0 ]; then
echo " easySPARK_std_star.sh <filename with full path>"
echo " or"
echo " easySPARK_std_star.sh <filename with full path> sof"
+ echo " "
+ echo "Version: "$EASY_VERSION
echo "${bb}-------------------------------------------------------------------${nn}"
exit
fi
+# init
+sofOnly=0
+printVers=0
+
+# extract all arguments beginning with KMOS, eventually imethod and sof
+while [ "$1" ] ; do
+ tmp=$(basename $1)
+ if [[ $tmp == KMOS* ]]; then
+ # file-check
+ if [ ! -e $1 ]; then
+ echo "${bb}ERROR:${nn} File doesn't exist! ($1)"
+ exit
+ fi
+ fileName=$1
+ else
+ if [[ $tmp == sof ]]; then
+ sofOnly=1
+ elif [[ $tmp == vers ]]; then
+ printVers=1
+ fi
+ fi
+ shift
+done
+
+if [ $printVers = 1 ]; then
+ echo $EASY_VERSION
+ exit
+fi
+
# check if gawk is existing
if command -v gawk >/dev/null; then
:
@@ -46,13 +79,6 @@ if [ -z "${KMOS_CALIB}" ]; then
exit
fi
-# file-check
-fileName=$1
-if [ ! -e $fileName ]; then
- echo "${bb}ERROR:${nn} File doesn't exist!"
- exit
-fi
-
#check if file is of correct template
tplId=$(dfits $fileName |\
fitsort -d tpl.id |\
@@ -62,12 +88,6 @@ if [[ $tplId != KMOS_spec_cal_stdstar && $tplId != KMOS_spec_cal_stdstarscipatt
exit
fi
-# check if only sof-file should be generated
-sofOnly=0
-if [[ ${@: -1} == sof ]]; then # checking for last argument
- sofOnly=1
-fi
-
# extract TPL.START of ths file
tplStartTime=$(dfits $fileName |\
fitsort -d tpl.start |\
diff --git a/tools/easySPARK/easySPARK_test.sh b/tools/easySPARK/easySPARK_test.sh
new file mode 100755
index 0000000..1afcd7a
--- /dev/null
+++ b/tools/easySPARK/easySPARK_test.sh
@@ -0,0 +1,457 @@
+#!/bin/bash
+
+EASY_VERSION="1.0"
+
+bb=`tput bold`
+nn=`tput sgr0`
+
+# help
+if [ $# -eq 0 ]; then
+ echo "${bb}-------------------------------------------------------------------${nn}"
+ echo "${bb}Tests the output from easySPARK_calibration.sh"
+ echo " "
+ echo "- This script is executed automatically at the end of"
+ echo " easySPARK_calibration.sh"
+ echo "- It has to be called from the directory containing the products to check"
+ echo "- This script checks the coherence of XCAL, YCAL and LCAL products as"
+ echo " easySPARK-calibration.sh is creating them."
+ echo " - The number of products of each categrory is checked"
+ echo " - The file sizes are checked"
+ echo " - The number of extensions is checked"
+ echo " - The angles contained are checked"
+ echo " - If they match for every extension"
+ echo " - If the number of angles is modulo 3 (for every detector)"
+ echo " - If the angles are the same for each detector"
+ echo " "
+ echo "${bb}Usage:${nn}"
+ echo " easySPARK_test.sh"
+ echo " "
+ echo "Version: "$EASY_VERSION
+ echo "${bb}-------------------------------------------------------------------${nn}"
+ exit
+fi
+
+# init
+printVers=0
+all_ok=1
+my_path=
+
+# extract all arguments beginning with KMOS, eventually imethod and sof
+while [ "$1" ] ; do
+ if [[ $1 == vers ]]; then
+ printVers=1
+ else
+ my_path=$1
+ fi
+ shift
+done
+
+if [ $printVers = 1 ]; then
+ echo $EASY_VERSION
+ exit
+fi
+
+if [ ! -e "$my_path" ]; then
+ echo "${bb}ERROR:${nn} Path '"$my_path"' is not existing"
+ exit
+fi
+
+myPwd=$(pwd)
+cd $my_path
+
+######################################################################################
+# parse files
+######################################################################################
+unalias ls 2>/dev/null
+
+# parse xcal
+nr_xc=0
+for xc in xcal_*.fits; do
+ if [ -e "$xc" ]; then
+ xc_b[$nr_xc]=$(ls -l $xc| awk '{ print $5 }')
+ xc_mb[$nr_xc]=$(ls -lh $xc| awk '{ print $5 }')
+ xc_rot[$nr_xc]=$(dfits -x 0 $xc | grep "PRO ROT NAANGLE")
+ xc_ext[$nr_xc]=$(echo "${xc_rot[$nr_xc]}" | wc -l)
+#printf " %-18s: %d (%s) (%d ext)\n" "$xc" "${xc_b[$nr_xc]}" "${xc_mb[$nr_xc]}" "${xc_ext[$nr_xc]}"
+ nr_xc=$[$nr_xc+1]
+ fi
+done
+
+# parse ycal
+nr_yc=0
+for yc in ycal_*.fits; do
+ if [ -e "$yc" ]; then
+ yc_b[$nr_yc]=$(ls -l $yc| awk '{ print $5 }')
+ yc_mb[$nr_yc]=$(ls -lh $yc| awk '{ print $5 }')
+ yc_rot[$nr_yc]=$(dfits -x 0 $yc | grep "PRO ROT NAANGLE")
+ yc_ext[$nr_yc]=$(echo "${yc_rot[$nr_yc]}" | wc -l)
+#printf " %-18s: %d (%s) (%d ext)\n" "$yc" "${yc_b[$nr_yc]}" "${yc_mb[$nr_yc]}" "${yc_ext[$nr_yc]}"
+ nr_yc=$[$nr_yc+1]
+ fi
+done
+
+# parse lcal
+nr_lc=0
+for lc in lcal_*.fits; do
+ if [ -e "$lc" ]; then
+ lc_b[$nr_lc]=$(ls -l $lc| awk '{ print $5 }')
+ lc_mb[$nr_lc]=$(ls -lh $lc| awk '{ print $5 }')
+ lc_rot[$nr_lc]=$(dfits -x 0 $lc | grep "PRO ROT NAANGLE")
+ lc_ext[$nr_lc]=$(echo "${lc_rot[$nr_lc]}" | wc -l)
+#printf " %-18s: %d (%s) (%d ext)\n" "$lc" "${lc_b[$nr_lc]}" "${lc_mb[$nr_lc]}" "${lc_ext[$nr_lc]}"
+ nr_lc=$[$nr_lc+1]
+ fi
+done
+
+if [[ $nr_xc -eq 0 && $nr_yc -eq 0 && $nr_xc -eq 0 ]]; then
+ echo "${bb}WARNING:${nn} Didn't find any XCAL, YCAL and LCAL products!"
+ exit
+fi
+######################################################################################
+# #XCAL == #YCAL == #LCAL
+######################################################################################
+echo "--------------------------------------------------------------------"
+echo "Check if number of XCAL, YCAL and LCAL products is equal"
+if [[ $nr_xc -eq $nr_yc && $nr_xc -eq $nr_lc ]]; then
+ echo "yes"
+else
+ all_ok=0
+ echo "${bb}ERROR:${nn} the number of calibration products for XCAL, YCAL and LCAL differs!"
+ echo "Nr. of XCALs : "$nr_xc
+ echo "Nr. of YCALs : "$nr_yc
+ echo "Nr. of LCALs : "$nr_lc
+fi
+
+######################################################################################
+# bytes(XCAL_xxx) == bytes(XCAL_yyy)
+######################################################################################
+if [ $nr_xc -gt 1 ]; then
+ echo "--------------------------------------------------------------------"
+ echo "Check if size (bytes) of all XCALs is equal"
+
+ ok=1
+ first=${xc_b[0]}
+ for i in "${xc_b[@]}"; do
+ if [ $first -ne $i ]; then
+ ok=0
+ fi
+ done
+
+ if [ $ok -eq 1 ]; then
+ echo "yes"
+ else
+ all_ok=0
+ echo "${bb}ERROR:${nn} the byte size for XCALs differs!"
+ i=0
+ for xc in xcal_*.fits; do
+ printf "%-18s: %d bytes\n" "$xc" "${xc_b[$i]}"
+ i=$[$i+1]
+ done
+ fi
+fi
+
+######################################################################################
+# bytes(YCAL_xxx) == bytes(YCAL_yyy)
+######################################################################################
+if [ $nr_yc -gt 1 ]; then
+ echo "--------------------------------------------------------------------"
+ echo "Check if size (bytes) of all YCALs is equal"
+
+ ok=1
+ first=${yc_b[0]}
+ for i in "${yc_b[@]}"; do
+ if [ $first -ne $i ]; then
+ ok=0
+ fi
+ done
+
+ if [ $ok -eq 1 ]; then
+ echo "yes"
+ else
+ all_ok=0
+ echo "${bb}ERROR:${nn} the byte size for YCALs differs!"
+ i=0
+ for yc in ycal_*.fits; do
+ printf "%-18s: %d bytes\n" "$yc" "${yc_b[$i]}"
+ i=$[$i+1]
+ done
+ fi
+fi
+
+######################################################################################
+# bytes(LCAL_xxx) == bytes(LCAL_yyy)
+######################################################################################
+if [ $nr_lc -gt 1 ]; then
+ echo "--------------------------------------------------------------------"
+ echo "Check if size (bytes) of all LCALs is equal"
+
+ ok=1
+ first=${lc_b[0]}
+ for i in "${lc_b[@]}"; do
+ if [ $first -ne $i ]; then
+ ok=0
+ fi
+ done
+
+ if [ $ok -eq 1 ]; then
+ echo "yes"
+ else
+ all_ok=0
+ echo "${bb}ERROR:${nn} the byte size for LCALs differs!"
+ i=0
+ for lc in lcal_*.fits; do
+ printf "%-18s: %d bytes\n" "$lc" "${lc_b[$i]}"
+ i=$[$i+1]
+ done
+ fi
+fi
+
+######################################################################################
+# mega_bytes(XCAL) == mega_bytes(YCAL) == mega_bytes(LCAL)
+######################################################################################
+if [ $(echo "$nr_xc+$nr_yc+$nr_lc"|bc) -gt 1 ]; then
+ echo "--------------------------------------------------------------------"
+ echo "Check if size (MB) of all XCALs, YCALs and LCALs is equal"
+
+ ok=1
+ first=${xc_mb[0]}
+ for i in "${xc_mb[@]}"; do
+ if [ "$first" != "$i" ]; then
+ ok=0
+ fi
+ done
+ for i in "${yc_mb[@]}"; do
+ if [ "$first" != "$i" ]; then
+ ok=0
+ fi
+ done
+ for i in "${lc_mb[@]}"; do
+ if [ "$first" != "$i" ]; then
+ ok=0
+ fi
+ done
+
+ if [ $ok -eq 1 ]; then
+ echo "yes"
+ else
+ all_ok=0
+ echo "${bb}ERROR:${nn} the size in MB for XCALs, YCALs and LCALs differs!"
+ i=0
+ for xc in xcal_*.fits; do
+ strlen=$(echo "${#xc_mb[$i]}-1"|bc)
+ printf "%-18s: %d MB\n" "$xc" "${xc_mb[$i]:0:$strlen}"
+ i=$[$i+1]
+ done
+ i=0
+ for yc in ycal_*.fits; do
+ strlen=$(echo "${#xc_mb[$i]}-1"|bc)
+ printf "%-18s: %d MB\n" "$yc" "${yc_mb[$i]:0:$strlen}"
+ i=$[$i+1]
+ done
+ i=0
+ for lc in lcal_*.fits; do
+ strlen=$(echo "${#xc_mb[$i]}-1"|bc)
+ printf "%-18s: %d MB\n" "$lc" "${lc_mb[$i]:0:$strlen}"
+ i=$[$i+1]
+ done
+ fi
+fi
+
+######################################################################################
+# #extensions(XCAL) == #extensions(YCAL) == #extensions(LCAL)
+######################################################################################
+if [ $(echo "$nr_xc+$nr_yc+$nr_lc"|bc) -gt 1 ]; then
+ echo "--------------------------------------------------------------------"
+ echo "Check if the number of extensions of all XCALs, YCALs and LCALs is equal"
+
+ ok=1
+ first=${xc_ext[0]}
+ for i in "${xc_ext[@]}"; do
+ if [ "$first" != "$i" ]; then
+ ok=0
+ fi
+ done
+ for i in "${yc_ext[@]}"; do
+ if [ "$first" != "$i" ]; then
+ ok=0
+ fi
+ done
+ for i in "${lc_ext[@]}"; do
+ if [ "$first" != "$i" ]; then
+ ok=0
+ fi
+ done
+
+ if [ $ok -eq 1 ]; then
+ echo "yes"
+ else
+ all_ok=0
+ echo "${bb}ERROR:${nn} the number of extensions of all XCALs, YCALs and LCALs differs!"
+ i=0
+ for xc in xcal_*.fits; do
+ printf "%-18s: %d extensions\n" "$xc" "${xc_ext[$i]}"
+ i=$[$i+1]
+ done
+ i=0
+ for yc in ycal_*.fits; do
+ printf "%-18s: %d extensions\n" "$yc" "${yc_ext[$i]}"
+ i=$[$i+1]
+ done
+ i=0
+ for lc in lcal_*.fits; do
+ printf "%-18s: %d extensions\n" "$lc" "${lc_ext[$i]}"
+ i=$[$i+1]
+ done
+ fi
+fi
+
+######################################################################################
+# pro_rot_naangle(XCAL) == pro_rot_naangle(YCAL) == pro_rot_naangle(LCAL)
+######################################################################################
+pro_test_ok=0
+if [ $(echo "$nr_xc+$nr_yc+$nr_lc"|bc) -gt 1 ]; then
+ echo "--------------------------------------------------------------------"
+ echo "Check if the PRO ROT NAANGLE keyword in all extensions of all XCALs, YCALs and LCALs are equal"
+
+ ok=1
+ first=
+ for (( fi=0,si=1; si<=${xc_ext[0]}; si++,fi++ )); do
+ first="$first $(echo "${xc_rot[0]}" | sed -n "$si"p | gawk '{print $7}')"
+ done
+
+ for (( nr=0; nr<$nr_xc; nr++ )); do
+ my_x=
+ for (( fi=0,si=1; si<=${xc_ext[$nr]}; si++,fi++ )); do
+ my_x="$my_x $(echo "${xc_rot[$nr]}" | sed -n "$si"p | gawk '{print $7}')"
+ done
+ if [ "$first" != "$my_x" ]; then
+ ok=0
+ fi
+ done
+
+ for (( nr=0; nr<$nr_yc; nr++ )); do
+ my_y=
+ for (( fi=0,si=1; si<=${yc_ext[$nr]}; si++,fi++ )); do
+ my_y="$my_y $(echo "${yc_rot[$nr]}" | sed -n "$si"p | gawk '{print $7}')"
+ done
+ if [ "$first" != "$my_y" ]; then
+ ok=0
+ fi
+ done
+
+ for (( nr=0; nr<$nr_lc; nr++ )); do
+ my_l=
+ for (( fi=0,si=1; si<=${lc_ext[$nr]}; si++,fi++ )); do
+ my_l="$my_l $(echo "${lc_rot[$nr]}" | sed -n "$si"p | gawk '{print $7}')"
+ done
+ if [ "$first" != "$my_l" ]; then
+ ok=0
+ fi
+ done
+
+ if [ $ok -eq 1 ]; then
+ echo "yes"
+ pro_test_ok=1
+ else
+ all_ok=0
+ echo "${bb}ERROR:${nn} PRO ROT NAANGLE keyword not the same in all extensions of all XCALs, YCALs and LCALs!"
+ nr=0
+ for xc in xcal_*.fits; do
+ my_x=
+ for (( fi=0,si=1; si<=${xc_ext[$nr]}; si++,fi++ )); do
+ my_x="$my_x $(echo "${xc_rot[$nr]}" | sed -n "$si"p | gawk '{print $7}')"
+ done
+ printf "%-18s: %s\n" "$xc" "$my_x"
+ nr=$[$nr+1]
+ done
+
+ nr=0
+ for yc in ycal_*.fits; do
+ my_y=
+ for (( fi=0,si=1; si<=${yc_ext[$nr]}; si++,fi++ )); do
+ my_y="$my_y $(echo "${yc_rot[$nr]}" | sed -n "$si"p | gawk '{print $7}')"
+ done
+ printf "%-18s: %s\n" "$yc" "$my_y"
+ nr=$[$nr+1]
+ done
+
+ nr=0
+ for lc in lcal_*.fits; do
+ my_l=
+ for (( fi=0,si=1; si<=${lc_ext[$nr]}; si++,fi++ )); do
+ my_l="$my_l $(echo "${lc_rot[$nr]}" | sed -n "$si"p | gawk '{print $7}')"
+ done
+ printf "%-18s: %s\n" "$lc" "$my_l"
+ nr=$[$nr+1]
+ done
+ fi
+fi
+
+######################################################################################
+# check if PRO ROT NAANGLE the same for all 3 detectors
+######################################################################################
+if [ $pro_test_ok -eq 1 ]; then
+ pro_mod_ok=0
+ echo "--------------------------------------------------------------------"
+ echo "Check if the number of angles is modulo 3 (extension for every detector)"
+ mod=$(expr ${xc_ext[0]} % 3)
+ if [ $mod -eq 0 ]; then
+ echo "yes"
+ pro_mod_ok=1
+ else
+ all_ok=0
+ echo "${bb}ERROR:${nn} There is at least one file with "${xc_ext[0]}" extensions!"
+ fi
+
+ if [ $pro_mod_ok -eq 1 ]; then
+ summary=
+ echo "--------------------------------------------------------------------"
+ echo "Check if the PRO ROT NAANGLE keyword is the same for all 3 detectors"
+
+ ok=1
+ for (( nr=1; nr<=${xc_ext[0]}; nr=nr+3 )); do
+ one=$(echo $first | gawk -v r=$nr '{print $r}')
+ two=$(echo $first | gawk -v r=$(expr $nr + 1) '{print $r}')
+ three=$(echo $first | gawk -v r=$(expr $nr + 2) '{print $r}')
+
+ if [[ "$one" != "$two" || "$one" != "$three" ]]; then
+ ok=0
+ fi
+ summary="$summary $one"
+ done
+
+ if [ $ok -eq 1 ]; then
+ echo "yes"
+ echo "${bb}--------------------------------------------------------------------${nn}"
+ echo "${bb}Angles:${nn} "$summary
+ else
+ all_ok=0
+ echo "${bb}ERROR:${nn} PRO ROT NAANGLE isn't the same for all 3 detectors!"
+ det1="Det 1: "
+ det2="Det 2: "
+ det3="Det 3: "
+ for (( nr=1; nr<=${xc_ext[0]}; nr=nr+3 )); do
+ det1="$det1 $(echo $first | gawk -v r=$nr '{print $r}')"
+ det2="$det2 $(echo $first | gawk -v r=$(expr $nr + 1) '{print $r}')"
+ det3="$det3 $(echo $first | gawk -v r=$(expr $nr + 2) '{print $r}')"
+ done
+ echo $det1
+ echo $det2
+ echo $det3
+ fi
+ fi
+else
+ echo "--------------------------------------------------------------------"
+ echo "${bb}WARNING:${nn} Skipped following test because last test failed anyway!"
+ echo " Check if the number of angles is modulo 3 (extension for every detector)"
+fi
+
+if [ $all_ok -eq 1 ]; then
+ echo "${bb}Passed:${nn} All tests on XCAL, YCAL and LCAL are fine."
+ echo "${bb}--------------------------------------------------------------------${nn}"
+else
+ echo "${bb}At least one test failed !!!${nn}"
+ echo "${bb}--------------------------------------------------------------------${nn}"
+fi
+
+cd $myPwd
diff --git a/tools/easySPARK/easySPARK_wave_cal.sh b/tools/easySPARK/easySPARK_wave_cal.sh
index 50ebac7..0521730 100755
--- a/tools/easySPARK/easySPARK_wave_cal.sh
+++ b/tools/easySPARK/easySPARK_wave_cal.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+EASY_VERSION="1.0"
+
bb=`tput bold`
nn=`tput sgr0`
@@ -27,10 +29,41 @@ if [ $# -eq 0 ]; then
echo " easySPARK_wave_cal.sh <filename with full path>"
echo " or"
echo " easySPARK_wave_cal.sh <filename with full path> sof"
+ echo " "
+ echo "Version: "$EASY_VERSION
echo "${bb}-------------------------------------------------------------------${nn}"
exit
fi
+# init
+sofOnly=0
+printVers=0
+
+# extract all arguments beginning with KMOS, eventually imethod and sof
+while [ "$1" ] ; do
+ tmp=$(basename $1)
+ if [[ $tmp == KMOS* ]]; then
+ # file-check
+ if [ ! -e $1 ]; then
+ echo "${bb}ERROR:${nn} File doesn't exist! ($1)"
+ exit
+ fi
+ fileName=$1
+ else
+ if [[ $tmp == sof ]]; then
+ sofOnly=1
+ elif [[ $tmp == vers ]]; then
+ printVers=1
+ fi
+ fi
+ shift
+done
+
+if [ $printVers = 1 ]; then
+ echo $EASY_VERSION
+ exit
+fi
+
# check if gawk is existing
if command -v gawk >/dev/null; then
:
@@ -48,13 +81,6 @@ if [ -z "${KMOS_CALIB}" ]; then
exit
fi
-# file-check
-fileName=$1
-if [ ! -e $fileName ]; then
- echo "${bb}ERROR:${nn} File doesn't exist!"
- exit
-fi
-
#check if file is of correct template
tplId=$(dfits $fileName |\
fitsort -d tpl.id |\
@@ -64,12 +90,6 @@ if [ $tplId != KMOS_spec_cal_wave ]; then
exit
fi
-# check if only sof-file should be generated
-sofOnly=0
-if [[ ${@: -1} == sof ]]; then # checking for last argument
- sofOnly=1
-fi
-
# extract TPL.START of ths file
tplStartTime=$(dfits $fileName |\
fitsort -d tpl.start |\
@@ -136,10 +156,12 @@ done
# get all files with matching tplStartTime and ARC_ON from yesterday
matchingFiles=
+matchingFiles_yesterday=
+matchingFiles_tomorrow=
+matchingFiles_today=
date -d $today > /dev/null 2>&1
if [ $? = 0 ]; then
# we have a directory like 2013-06-10
- matchingFiles_yesterday=
if [ -e $dataDir_yesterday ]; then
matchingFiles_yesterday=$(dfits $dataDir_yesterday/KMOS*.fits | \
fitsort -d tpl.start dpr.type |\
@@ -150,7 +172,6 @@ if [ $? = 0 ]; then
fi
# get all files with matching tplStartTime and ARC_ON from tomorrow
- matchingFiles_tomorrow=
if [ -e $dataDir_tomorrow ]; then
matchingFiles_tomorrow=$(dfits $dataDir_tomorrow/KMOS*.fits | \
fitsort -d tpl.start dpr.type |\
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cpl-plugin-kmos.git
More information about the debian-science-commits
mailing list