diff -Nru cpl-plugin-kmos-1.4.3+dfsg/acinclude.m4 cpl-plugin-kmos-2.0.2+dfsg/acinclude.m4 --- cpl-plugin-kmos-1.4.3+dfsg/acinclude.m4 2013-12-04 14:29:58.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/acinclude.m4 2018-03-16 09:35:04.000000000 +0000 @@ -100,7 +100,7 @@ fi if test -z "$configdir"; then - configdir='${datadir}/${PACKAGE}/config' + configdir='${datadir}/esopipes/${PACKAGE}-${VERSION}/config' fi if test -z "$wkfextradir"; then diff -Nru cpl-plugin-kmos-1.4.3+dfsg/aclocal.m4 cpl-plugin-kmos-2.0.2+dfsg/aclocal.m4 --- cpl-plugin-kmos-1.4.3+dfsg/aclocal.m4 2017-02-27 20:41:50.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/aclocal.m4 2018-04-24 13:37:11.000000000 +0000 @@ -1216,4 +1216,5 @@ m4_include([m4macros/ltsugar.m4]) m4_include([m4macros/ltversion.m4]) m4_include([m4macros/lt~obsolete.m4]) +m4_include([m4macros/molecfit.m4]) m4_include([acinclude.m4]) diff -Nru cpl-plugin-kmos-1.4.3+dfsg/calib/cal_size cpl-plugin-kmos-2.0.2+dfsg/calib/cal_size --- cpl-plugin-kmos-1.4.3+dfsg/calib/cal_size 2017-06-28 20:52:38.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/calib/cal_size 2018-04-26 10:21:34.000000000 +0000 @@ -1 +1 @@ -5332 +95016 diff -Nru cpl-plugin-kmos-1.4.3+dfsg/calib/gasgano/config/KMOS.prefs cpl-plugin-kmos-2.0.2+dfsg/calib/gasgano/config/KMOS.prefs --- cpl-plugin-kmos-1.4.3+dfsg/calib/gasgano/config/KMOS.prefs 2017-02-27 20:41:46.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/calib/gasgano/config/KMOS.prefs 2018-04-24 13:37:00.000000000 +0000 @@ -5,7 +5,7 @@ COMPONENT_FONT=Dialog:14 CUBE_TO_VIEWER= CUBE_VIEWER_TYPE=SKYCAT -DATA_FILES=/usr/share/esopipes/datastatic/kmos-1.4.3 +DATA_FILES=/usr/share/esopipes/datastatic/kmos-2.0.2 DBOBS_DISPLAY_COLUMNS=CLASSIFICATION:RA:DEC:TPL.EXPNO:TPL.NEXP DBOBS_DISPLAY_COLUMNS_SIZE=0:0:0:0:0 DBOBS_INSTRUMENT=All @@ -41,7 +41,7 @@ PRINT_FONT=Monospaced:16 PRINT_ORIENTATION=P RADEC_CONVERSION=true -RECIPE_SET=kmo_arithmetic=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmo_arithmetic.so;kmos_combine=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmos_combine.so;kmo_copy=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmo_copy.so;kmos_dark=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmos_dark.so;kmos_extract_spec=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmos_extract_spec.so;kmo_fit_profile=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmo_fit_profile.so;kmos_flat=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmos_flat.so;kmos_illumination=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmos_illumination.so;kmo_make_image=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmo_make_image.so;kmo_noise_map=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmo_noise_map.so;kmos_reconstruct=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmos_reconstruct.so;kmo_rotate=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmo_rotate.so;kmos_sci_red=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmos_sci_red.so;kmo_shift=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmo_shift.so;kmo_sky_mask=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmo_sky_mask.so;kmo_stats=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmo_stats.so;kmos_std_star=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmos_std_star.so;kmos_wave_cal=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmos_wave_cal.so;kmo_fits_strip=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmo_fits_strip.so;kmos_gen_reflines=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmos_gen_reflines.so;kmos_sky_tweak=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmos_sky_tweak.so;kmos_gen_telluric=/usr/lib64/esopipes-plugins/kmos-1.4.3/kmos_gen_telluric.so +RECIPE_SET=kmo_arithmetic=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmo_arithmetic.so;kmos_combine=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmos_combine.so;kmo_copy=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmo_copy.so;kmos_dark=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmos_dark.so;kmos_extract_spec=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmos_extract_spec.so;kmo_fit_profile=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmo_fit_profile.so;kmos_flat=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmos_flat.so;kmos_illumination=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmos_illumination.so;kmo_make_image=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmo_make_image.so;kmo_noise_map=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmo_noise_map.so;kmos_reconstruct=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmos_reconstruct.so;kmo_rotate=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmo_rotate.so;kmos_sci_red=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmos_sci_red.so;kmo_shift=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmo_shift.so;kmo_sky_mask=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmo_sky_mask.so;kmo_stats=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmo_stats.so;kmos_std_star=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmos_std_star.so;kmos_wave_cal=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmos_wave_cal.so;kmo_fits_strip=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmo_fits_strip.so;kmos_gen_reflines=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmos_gen_reflines.so;kmos_sky_tweak=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmos_sky_tweak.so;kmos_gen_telluric=/usr/lib64/esopipes-plugins/kmos-2.0.2/kmos_gen_telluric.so SCRIPTS_DIR=gasgano/scripts SHORTEN_FILES_PATH=true SHORT_FILENAME=true diff -Nru cpl-plugin-kmos-1.4.3+dfsg/configure cpl-plugin-kmos-2.0.2+dfsg/configure --- cpl-plugin-kmos-1.4.3+dfsg/configure 2017-02-27 20:41:51.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/configure 2018-04-24 13:37:12.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for KMOS Instrument Pipeline 1.4.3. +# Generated by GNU Autoconf 2.69 for KMOS Instrument Pipeline 2.0.2. # # Report bugs to . # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='KMOS Instrument Pipeline' PACKAGE_TARNAME='kmos' -PACKAGE_VERSION='1.4.3' -PACKAGE_STRING='KMOS Instrument Pipeline 1.4.3' +PACKAGE_VERSION='2.0.2' +PACKAGE_STRING='KMOS Instrument Pipeline 2.0.2' PACKAGE_BUGREPORT='usd-help@eso.org' PACKAGE_URL='' @@ -651,6 +651,12 @@ apidocdir pipedocsdir plugindir +LIBMOLECFIT +MOLECFIT_LDFLAGS +MOLECFIT_CFLAGS +MOLECFIT_INCLUDES +MOLECFITDIR +PKGCONFIG CPL_LDFLAGS CPL_CFLAGS CPL_INCLUDES @@ -812,6 +818,10 @@ with_cpl_includes with_cpl_libs enable_cpl_test +with_molecfit +with_molecfit_includes +with_molecfit_libs +enable_molecfit_test with_extra_includes with_extra_libs with_dmalloc @@ -827,7 +837,9 @@ CPP DOXYGEN LATEX -LT_SYS_LIBRARY_PATH' +LT_SYS_LIBRARY_PATH +PKGCONFIG +MOLECFITDIR' # Initialize some variables set by options. @@ -1368,7 +1380,7 @@ # 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.4.3 to adapt to many kinds of systems. +\`configure' configures KMOS Instrument Pipeline 2.0.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1439,7 +1451,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of KMOS Instrument Pipeline 1.4.3:";; + short | recursive ) echo "Configuration of KMOS Instrument Pipeline 2.0.2:";; esac cat <<\_ACEOF @@ -1465,6 +1477,7 @@ optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-cpl-test disables checks for the CPL library and headers + --disable-molecfit-test disables checks for the molecfit library and headers Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1480,6 +1493,10 @@ --with-cpl location where CPL is installed --with-cpl-includes location of the CPL header files --with-cpl-libs location of the CPL library + --with-molecfit location where molecfit is installed + --with-molecfit-includes + location of the molecfit header files + --with-molecfit-libs location of the molecfit library --with-extra-includes=DIR adds non standard include paths --with-extra-libs=DIR adds non standard library paths @@ -1498,6 +1515,8 @@ LATEX latex command LT_SYS_LIBRARY_PATH User-defined run-time library search path. + PKGCONFIG pkg-config command + MOLECFITDIR Location where molecfit is installed Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1565,7 +1584,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -KMOS Instrument Pipeline configure 1.4.3 +KMOS Instrument Pipeline configure 2.0.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1980,7 +1999,7 @@ 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.4.3, which was +It was created by KMOS Instrument Pipeline $as_me 2.0.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2958,7 +2977,7 @@ # Define the identity of the package. PACKAGE='kmos' - VERSION='1.4.3' + VERSION='2.0.2' cat >>confdefs.h <<_ACEOF @@ -5016,9 +5035,10 @@ - flag=`echo fno-builtin | sed 'y%.=/+-%___p_%'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-builtin" >&5 -$as_echo_n "checking whether $CC supports -fno-builtin... " >&6; } + + flag=`echo std=c99 | sed 'y%.=/+-%___p_%'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 +$as_echo_n "checking whether $CC supports -std=c99... " >&6; } if eval \${eso_cv_prog_cc_$flag+:} false; then : $as_echo_n "(cached) " >&6 else @@ -5033,9 +5053,9 @@ echo 'int main() { return 0; }' >conftest.$ac_ext - try_compile="`$CC -fno-builtin -c conftest.$ac_ext 2>&1`" + try_compile="`$CC -std=c99 -c conftest.$ac_ext 2>&1`" if test -z "$try_compile"; then - try_link="`$CC -fno-builtin -o conftest$ac_exeext \ + try_link="`$CC -std=c99 -o conftest$ac_exeext \ conftest.$ac_ext 2>&1`" if test -z "$try_link"; then eval "eso_cv_prog_cc_$flag=yes" @@ -5057,7 +5077,7 @@ if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then : - CFLAGS="$CFLAGS -fno-builtin" + CFLAGS="$CFLAGS -std=c99" else : @@ -13707,6 +13727,270 @@ + + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_PKGCONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$PKGCONFIG"; then + ac_cv_prog_PKGCONFIG="$PKGCONFIG" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_PKGCONFIG="pkg-config" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +PKGCONFIG=$ac_cv_prog_PKGCONFIG +if test -n "$PKGCONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 +$as_echo "$PKGCONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + + + molecfit_check_version="1.4.0" + molecfit_check_header="molecfit.h" + molecfit_check_libraries="-lmolecfit" + + molecfit_pkgconfig="molecfit" + + + + + + +# Check whether --with-molecfit was given. +if test "${with_molecfit+set}" = set; then : + withval=$with_molecfit; + molecfit_with_molecfit=$withval + +fi + + + +# Check whether --with-molecfit-includes was given. +if test "${with_molecfit_includes+set}" = set; then : + withval=$with_molecfit_includes; molecfit_with_molecfit_includes=$withval +fi + + + +# Check whether --with-molecfit-libs was given. +if test "${with_molecfit_libs+set}" = set; then : + withval=$with_molecfit_libs; molecfit_with_molecfit_libs=$withval +fi + + + # Check whether --enable-molecfit-test was given. +if test "${enable_molecfit_test+set}" = set; then : + enableval=$enable_molecfit_test; molecfit_enable_molecfit_test=$enableval +else + molecfit_enable_molecfit_test=yes +fi + + + + + if test "x$molecfit_enable_molecfit_test" = xyes; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for molecfit" >&5 +$as_echo_n "checking for molecfit... " >&6; } + + # If include directories and libraries are given as arguments, use them + # initially. Otherwise assume a standard system installation of the + # package. This may then updated in the following. + + molecfit_libs="$molecfit_check_libraries" + molecfit_cflags="-I/usr/include/molecfit -I/usr/include" + molecfit_ldflags="" + + if test -n "${PKGCONFIG}"; then + + $PKGCONFIG --exists $molecfit_pkgconfig + + if test x$? = x0; then + molecfit_cflags="`$PKGCONFIG --cflags $molecfit_pkgconfig`" + molecfit_ldflags="`$PKGCONFIG --libs-only-L $molecfit_pkgconfig`" + molecfit_libs="`$PKGCONFIG --libs-only-l $molecfit_pkgconfig`" + fi + + fi + + # Directories given as arguments replace a standard system installation + # setup if they are given. + + if test -n "$MOLECFITDIR"; then + molecfit_cflags="-I$MOLECFITDIR/include/molecfit -I$MOLECFITDIR/include" + molecfit_ldflags="-L$MOLECFITDIR/lib64 -L$MOLECFITDIR/lib" + fi + + if test -n "$molecfit_with_molecfit"; then + molecfit_cflags="-I$molecfit_with_molecfit/include/molecfit -I$molecfit_with_molecfit/include" + molecfit_ldflags="-L$molecfit_with_molecfit/lib64 -L$molecfit_with_molecfit/lib" + fi + + if test -n "$molecfit_with_molecfit_includes"; then + molecfit_cflags="-I$molecfit_with_molecfit_includes" + fi + + if test -n "$molecfit_with_molecfit_libs"; then + molecfit_ldflags="-L$molecfit_with_molecfit_libs" + fi + + + # Check whether the header files and the library are present and + # whether they can be used. + + molecfit_have_molecfit_libraries="no" + molecfit_have_molecfit_headers="no" + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + molecfit_cflags_save="$CFLAGS" + molecfit_ldflags_save="$LDFLAGS" + molecfit_libs_save="$LIBS" + + CFLAGS="$CPL_INCLUDES $molecfit_cflags" + LDFLAGS="$molecfit_ldflags $CPL_LDFLAGS" + LIBS="$molecfit_libs $LIBCPLUI $LIBCPLCORE" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <$molecfit_check_header> + +int +main () +{ + + char c; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + molecfit_have_molecfit_headers="yes" + +else + + molecfit_have_molecfit_headers="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ + + mf_cleanup((void *)0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + molecfit_have_molecfit_libraries="yes" + +else + + molecfit_have_molecfit_libraries="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + CFLAGS="$molecfit_cflags_save" + LDFLAGS="$molecfit_ldflags_save" + LIBS="$molecfit_libs_save" + + if test x"$molecfit_have_molecfit_libraries" = xno || \ + test x"$molecfit_have_molecfit_headers" = xno; then + molecfit_notfound="" + + if test x"$molecfit_have_molecfit_headers" = xno; then + if test x"$molecfit_have_molecfit_libraries" = xno; then + molecfit_notfound="(headers and libraries)" + else + molecfit_notfound="(headers)" + fi + else + molecfit_notfound="(libraries)" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "molecfit $molecfit_notfound was not found on your system." "$LINENO" 5 + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + MOLECFIT_INCLUDES="$molecfit_cflags" + MOLECFIT_CFLAGS="$molecfit_cflags" + MOLECFIT_LDFLAGS="$molecfit_ldflags" + LIBMOLECFIT="$molecfit_libs" + fi + + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: molecfit checks have been disabled! This package may not build!" >&5 +$as_echo "$as_me: WARNING: molecfit checks have been disabled! This package may not build!" >&2;} + + MOLECFIT_INCLUDES="" + MOLECFIT_CFLAGS="" + MOLECFIT_LDFLAGS="" + LIBMOLECFIT="" + + fi + + + + + + + + # call after CPL_CHECK_LIBS and XXCLIPM_CHECK_LIB if test -z "$plugindir"; then @@ -13726,7 +14010,7 @@ fi if test -z "$configdir"; then - configdir='${datadir}/${PACKAGE}/config' + configdir='${datadir}/esopipes/${PACKAGE}-${VERSION}/config' fi if test -z "$wkfextradir"; then @@ -14437,7 +14721,7 @@ # 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.4.3, which was +This file was extended by KMOS Instrument Pipeline $as_me 2.0.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14503,7 +14787,7 @@ 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.4.3 +KMOS Instrument Pipeline config.status 2.0.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru cpl-plugin-kmos-1.4.3+dfsg/configure.ac cpl-plugin-kmos-2.0.2+dfsg/configure.ac --- cpl-plugin-kmos-1.4.3+dfsg/configure.ac 2017-01-31 13:01:01.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/configure.ac 2018-04-24 11:57:47.000000000 +0000 @@ -1,6 +1,6 @@ # Process this file with autoconf to produce a configure script. -AC_INIT([KMOS Instrument Pipeline], [1.4.3], [usd-help@eso.org], [kmos]) +AC_INIT([KMOS Instrument Pipeline], [2.0.2], [usd-help@eso.org], [kmos]) AC_PREREQ([2.59]) AC_CONFIG_SRCDIR([Makefile.am]) @@ -40,7 +40,8 @@ ESO_ENABLE_DEBUG(no) ESO_ENABLE_STRICT(no) -ESO_PROG_CC_FLAG([fno-builtin], [CFLAGS="$CFLAGS -fno-builtin"]) + +ESO_PROG_CC_FLAG([std=c99], [CFLAGS="$CFLAGS -std=c99"]) ESO_CHECK_DOCTOOLS @@ -70,6 +71,8 @@ # Check for CPL presence and usability CPL_CHECK_LIBS +MOLECFIT_CHECK_LIBS([1.4.0]) + # call after CPL_CHECK_LIBS and XXCLIPM_CHECK_LIB KMOS_SET_PATHS KMOS_CREATE_SYMBOLS diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/changelog cpl-plugin-kmos-2.0.2+dfsg/debian/changelog --- cpl-plugin-kmos-1.4.3+dfsg/debian/changelog 2017-07-01 09:43:12.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/changelog 2018-05-03 13:20:32.000000000 +0000 @@ -1,3 +1,15 @@ +cpl-plugin-kmos (2.0.2+dfsg-1) unstable; urgency=medium + + * Update VCS fields to use salsa.d.o + * Use name-based sorting for the recipes to ensure reproducible build + * New upstream version 2.0.2+dfsg. Rediff patches + * Push Standards-Version to 4.1.4. Change remaining URLs to https + * Push compat to 11 + * Switch to Python 3 + * Remove molecfit dependency + + -- Ole Streicher Thu, 03 May 2018 15:20:32 +0200 + cpl-plugin-kmos (1.4.3+dfsg-1) unstable; urgency=low * New upstream version 1.4.3+dfsg diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/compat cpl-plugin-kmos-2.0.2+dfsg/debian/compat --- cpl-plugin-kmos-1.4.3+dfsg/debian/compat 2016-11-20 09:32:16.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/compat 2018-04-27 15:31:20.000000000 +0000 @@ -1 +1 @@ -9 +11 diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/control cpl-plugin-kmos-2.0.2+dfsg/debian/control --- cpl-plugin-kmos-1.4.3+dfsg/debian/control 2017-07-01 09:42:44.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/control 2018-05-03 12:43:57.000000000 +0000 @@ -3,17 +3,16 @@ Priority: optional Maintainer: Debian Astronomy Maintainers Uploaders: Ole Streicher -Build-Depends: debhelper (>= 9), - dh-autoreconf, +Build-Depends: debhelper (>= 11), libcpl-dev (>= 6.3.1), - python, - python-astropy, - python-cpl, - python-sphinx -Standards-Version: 4.0.0 -Homepage: http://www.eso.org/sci/software/pipelines/kmos -Vcs-Git: https://anonscm.debian.org/git/debian-astro/packages/cpl-plugin-kmos.git -Vcs-Browser: https://anonscm.debian.org/cgit/debian-astro/packages/cpl-plugin-kmos.git + python3, + python3-astropy, + python3-cpl, + python3-sphinx +Standards-Version: 4.1.4 +Homepage: https://www.eso.org/sci/software/pipelines/kmos +Vcs-Git: https://salsa.debian.org/debian-astro-team/cpl-plugin-kmos.git +Vcs-Browser: https://salsa.debian.org/debian-astro-team/cpl-plugin-kmos Package: cpl-plugin-kmos Architecture: any diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/copyright cpl-plugin-kmos-2.0.2+dfsg/debian/copyright --- cpl-plugin-kmos-1.4.3+dfsg/debian/copyright 2016-11-20 09:32:16.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/copyright 2018-04-27 15:31:20.000000000 +0000 @@ -1,4 +1,4 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: kmos Upstream-Contact: ESO User Support Department Source: ftp://ftp.eso.org/pub/dfs/pipelines/kmos diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/cpl-plugin-doc.doc-base.in cpl-plugin-kmos-2.0.2+dfsg/debian/cpl-plugin-doc.doc-base.in --- cpl-plugin-kmos-1.4.3+dfsg/debian/cpl-plugin-doc.doc-base.in 2016-11-20 09:32:16.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/cpl-plugin-doc.doc-base.in 2018-04-27 15:31:20.000000000 +0000 @@ -12,5 +12,5 @@ This document describes the Python interface for the __PIPELINE__ pipeline. Format: HTML -Index: /usr/share/doc/cpl-plugin-__PIPELINE__-doc/html/index.html -Files: /usr/share/doc/cpl-plugin-__PIPELINE__-doc/html/* +Index: /usr/share/doc/cpl-plugin-__PIPELINE__/html/index.html +Files: /usr/share/doc/cpl-plugin-__PIPELINE__/html/* diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/create_manpage.py cpl-plugin-kmos-2.0.2+dfsg/debian/create_manpage.py --- cpl-plugin-kmos-1.4.3+dfsg/debian/create_manpage.py 2016-11-20 09:32:16.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/create_manpage.py 2018-05-03 13:10:54.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import cpl import os @@ -31,13 +31,13 @@ .B ftp://ftp.eso.org/pub/dfs/pipelines/{pipeline}/{pipeline}-pipeline-manual-2.9.pdf .PP An overview over the existing ESO pipelines can be found on the web page -\\fBhttp://www.eso.org/sci/software/pipelines/\\fR. +\\fBhttps://www.eso.org/sci/software/pipelines/\\fR. .PP Basic documentation about the EsoRex program can be found at the esorex (1) man page. .PP It is possible to call the pipelines from python using the python-cpl package. -See \\fBhttp://packages.python.org/python-cpl/index.html\\fR for further +See \\fBhttps://packages.python.org/python-cpl/index.html\\fR for further information. .PP The other recipes of the {pipeline} pipeline are @@ -109,6 +109,7 @@ recipe = cpl.Recipe(name) f = open(os.path.join("man", fname_template.format(name = name, - section=section)), "w") + section=section)), "w", + encoding="utf-8") f.write(manpage(recipe).replace('-', '\\-')) f.close() diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/create_sphinx.py cpl-plugin-kmos-2.0.2+dfsg/debian/create_sphinx.py --- cpl-plugin-kmos-1.4.3+dfsg/debian/create_sphinx.py 2016-11-20 09:32:16.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/create_sphinx.py 2018-05-03 13:11:42.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import cpl import os @@ -35,7 +35,7 @@ {parameters} -.. seealso:: `cpl.Recipe `_ +.. seealso:: `cpl.Recipe `_ for more information about the recipe object. Bug reports @@ -78,10 +78,10 @@ * The `{PIPELINE} Pipeline User Manual `_ in PDF format, - * an `overview `_ + * an `overview `_ over the existing ESO pipelines, - * the `python-cpl `_ package. + * the `python-cpl `_ package. Bug reports =========== @@ -139,11 +139,10 @@ cpl.Recipe.path = "recipes" recipes = [ cpl.Recipe(name) for name, version in cpl.Recipe.list() ] -oca = file(os.path.join("calib", "gasgano", "config", pipeline + ".oca")).read() +oca = open(os.path.join("calib", "gasgano", "config", pipeline + ".oca")).read() oca = oca[oca.find("action"):] recipes_oca = [recipe for recipe in recipes if recipe.__name__ in oca] -index = [ oca.find(recipe.__name__) for recipe in recipes_oca ] -recipes_oca = [r for (i, r) in sorted(zip(index, recipes_oca))] +recipes_oca.sort(key = lambda x: x.__name__) recipes_x = [recipe for recipe in recipes if not recipe.__name__ in oca] recipes_x.sort(key = lambda x: x.__name__) @@ -209,7 +208,9 @@ for recipe in recipes_oca + recipes_x: f = open(os.path.join("sphinx", - fname_template.format(recipe = recipe.__name__)), "w") + fname_template.format(recipe = recipe.__name__)), + "w", + encoding="utf-8") f.write(rstpage(recipe, rst_template, rst_partemplate)) f.close() diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/patches/Add-the-cpl-libraries-to-the-recips.so-and-the-test-progr.patch cpl-plugin-kmos-2.0.2+dfsg/debian/patches/Add-the-cpl-libraries-to-the-recips.so-and-the-test-progr.patch --- cpl-plugin-kmos-1.4.3+dfsg/debian/patches/Add-the-cpl-libraries-to-the-recips.so-and-the-test-progr.patch 2017-07-01 09:42:34.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/patches/Add-the-cpl-libraries-to-the-recips.so-and-the-test-progr.patch 2018-05-03 13:07:46.000000000 +0000 @@ -7,10 +7,10 @@ 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/recipes/Makefile.am b/recipes/Makefile.am -index d69f61b..f30b925 100644 +index 43ba17b..7f116e0 100644 --- a/recipes/Makefile.am +++ b/recipes/Makefile.am -@@ -56,77 +56,87 @@ plugin_LTLIBRARIES = kmo_arithmetic.la \ +@@ -59,72 +59,82 @@ plugin_LTLIBRARIES = kmo_arithmetic.la \ kmos_test.la kmo_arithmetic_la_SOURCES = kmo_arithmetic.c @@ -107,13 +107,16 @@ kmos_dark_la_LDFLAGS = -module -avoid-version kmos_dark_la_DEPENDENCIES = $(LIBKMOS) +@@ -147,7 +157,7 @@ kmos_molecfit_correct_la_LDFLAGS = $(MOLECFIT_LDFLAGS) -module -avoid-version + kmos_molecfit_correct_la_DEPENDENCIES = $(LIBKMOS) + kmos_flat_la_SOURCES = kmos_flat.c -kmos_flat_la_LIBADD = $(LIBKMOS) +kmos_flat_la_LIBADD = $(LIBKMOS) $(LIBCPLCORE) $(LIBCPLDFS) $(LIBCPLUI) kmos_flat_la_LDFLAGS = -module -avoid-version kmos_flat_la_DEPENDENCIES = $(LIBKMOS) -@@ -136,32 +146,32 @@ kmos_gen_telluric_la_LDFLAGS = -module -avoid-version +@@ -157,32 +167,32 @@ kmos_gen_telluric_la_LDFLAGS = -module -avoid-version kmos_gen_telluric_la_DEPENDENCIES = $(LIBKMOS) kmos_wave_cal_la_SOURCES = kmos_wave_cal.c diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/patches/Increase-tolerance-to-fix-FTBS-on-mips-mipsel64-and-ia64.patch cpl-plugin-kmos-2.0.2+dfsg/debian/patches/Increase-tolerance-to-fix-FTBS-on-mips-mipsel64-and-ia64.patch --- cpl-plugin-kmos-1.4.3+dfsg/debian/patches/Increase-tolerance-to-fix-FTBS-on-mips-mipsel64-and-ia64.patch 2017-07-01 09:42:34.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/patches/Increase-tolerance-to-fix-FTBS-on-mips-mipsel64-and-ia64.patch 2018-05-03 13:07:46.000000000 +0000 @@ -7,10 +7,10 @@ 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/irplib/tests/irplib_polynomial-test.c b/irplib/tests/irplib_polynomial-test.c -index c27d167..d5cdf86 100644 +index cead713..8b02e90 100644 --- a/irplib/tests/irplib_polynomial-test.c +++ b/irplib/tests/irplib_polynomial-test.c -@@ -579,16 +579,16 @@ irplib_polynomial_test_root_all_macro(const cpl_vector * self, cpl_size nreal, +@@ -589,16 +589,16 @@ irplib_polynomial_test_root_all_macro(const cpl_vector * self, cpl_size nreal, const double root = cpl_vector_get(roots, i); const double residual = cpl_polynomial_eval_1d(p1d, root, NULL); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/patches/Remove-molecfit-dependency.patch cpl-plugin-kmos-2.0.2+dfsg/debian/patches/Remove-molecfit-dependency.patch --- cpl-plugin-kmos-1.4.3+dfsg/debian/patches/Remove-molecfit-dependency.patch 1970-01-01 00:00:00.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/patches/Remove-molecfit-dependency.patch 2018-05-03 13:07:46.000000000 +0000 @@ -0,0 +1,70 @@ +From: Ole Streicher +Date: Thu, 3 May 2018 14:48:46 +0200 +Subject: Remove molecfit dependency + +While molecfit itself is GPL, it depends on radiative transfer code +LNFL and LBLRTM which are not DFSG free (and as being not GPL +conform contradict the GPL). Both packages are research-only: + +> The LNFL software you are downloading has been copyrighted by +> Atmospheric and Environmental Research, Inc. (AER) and is proprietary +> to AER. AER grants USER the right to download, install, use and copy +> this software for scientific and research purposes only. +--- + aclocal.m4 | 1 - + configure.ac | 2 -- + kmos/Makefile.am | 3 +-- + recipes/Makefile.am | 3 --- + 4 files changed, 1 insertion(+), 8 deletions(-) + +diff --git a/aclocal.m4 b/aclocal.m4 +index e5ef6b6..4d626ee 100644 +--- a/aclocal.m4 ++++ b/aclocal.m4 +@@ -1216,5 +1216,4 @@ m4_include([m4macros/ltoptions.m4]) + m4_include([m4macros/ltsugar.m4]) + m4_include([m4macros/ltversion.m4]) + m4_include([m4macros/lt~obsolete.m4]) +-m4_include([m4macros/molecfit.m4]) + m4_include([acinclude.m4]) +diff --git a/configure.ac b/configure.ac +index d776248..d9bdd5f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -71,8 +71,6 @@ ESO_FUNC_STRDUP + # Check for CPL presence and usability + CPL_CHECK_LIBS + +-MOLECFIT_CHECK_LIBS([1.4.0]) +- + # call after CPL_CHECK_LIBS and XXCLIPM_CHECK_LIB + KMOS_SET_PATHS + KMOS_CREATE_SYMBOLS +diff --git a/kmos/Makefile.am b/kmos/Makefile.am +index 07bd3f2..753a02e 100644 +--- a/kmos/Makefile.am ++++ b/kmos/Makefile.am +@@ -112,8 +112,7 @@ libkmos_la_SOURCES = kmo_cpl_extensions.c \ + ../kmclipm/src/kmclipm_priv_reconstruct.c \ + ../kmclipm/src/kmclipm_priv_splines.c \ + ../kmclipm/src/kmclipm_vector.c \ +- kmos_oscan.c \ +- kmos_molecfit.c ++ kmos_oscan.c + + + libkmos_la_LDFLAGS = $(EXTRA_LDFLAGS) $(CPL_LDFLAGS) $(MOLECFIT_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) +diff --git a/recipes/Makefile.am b/recipes/Makefile.am +index 7f116e0..1078a34 100644 +--- a/recipes/Makefile.am ++++ b/recipes/Makefile.am +@@ -44,9 +44,6 @@ plugin_LTLIBRARIES = kmo_arithmetic.la \ + kmos_combine.la \ + kmos_dark.la \ + kmos_extract_spec.la \ +- kmos_molecfit_model.la \ +- kmos_molecfit_calctrans.la \ +- kmos_molecfit_correct.la \ + kmos_flat.la \ + kmos_gen_telluric.la \ + kmos_wave_cal.la \ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/patches/Remove-several-small-spelling-errors.patch cpl-plugin-kmos-2.0.2+dfsg/debian/patches/Remove-several-small-spelling-errors.patch --- cpl-plugin-kmos-1.4.3+dfsg/debian/patches/Remove-several-small-spelling-errors.patch 2017-07-01 09:42:34.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/patches/Remove-several-small-spelling-errors.patch 2018-05-03 13:07:46.000000000 +0000 @@ -8,7 +8,7 @@ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/kmos_gen_reflines.c b/recipes/kmos_gen_reflines.c -index 239901f..a60994e 100644 +index 040911b..d270c81 100644 --- a/recipes/kmos_gen_reflines.c +++ b/recipes/kmos_gen_reflines.c @@ -65,7 +65,7 @@ static char kmos_gen_reflines_description[] = @@ -21,7 +21,7 @@ "First product: the table with the configuration for the model.\n" ; diff --git a/recipes/kmos_wave_cal.c b/recipes/kmos_wave_cal.c -index 759bf3a..482aecd 100644 +index 1a0e116..65a2d5d 100644 --- a/recipes/kmos_wave_cal.c +++ b/recipes/kmos_wave_cal.c @@ -95,7 +95,7 @@ static char kmos_wave_cal_description[] = diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/patches/Replace-strcat-calls-with-size-checked-strncat-calls.patch cpl-plugin-kmos-2.0.2+dfsg/debian/patches/Replace-strcat-calls-with-size-checked-strncat-calls.patch --- cpl-plugin-kmos-1.4.3+dfsg/debian/patches/Replace-strcat-calls-with-size-checked-strncat-calls.patch 2017-07-01 09:42:34.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/patches/Replace-strcat-calls-with-size-checked-strncat-calls.patch 2018-05-03 13:07:46.000000000 +0000 @@ -7,10 +7,10 @@ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/recipes/kmo_stats.c b/recipes/kmo_stats.c -index 8f73059..d77d31d 100644 +index c295ae4..577cbb1 100644 --- a/recipes/kmo_stats.c +++ b/recipes/kmo_stats.c -@@ -848,9 +848,10 @@ static int kmo_stats(cpl_parameterlist *parlist, cpl_frameset *frameset) +@@ -849,9 +849,10 @@ static int kmo_stats(cpl_parameterlist *parlist, cpl_frameset *frameset) sub_header = kmo_dfs_load_sub_header(frameset, STATS, extnr, FALSE)); @@ -24,7 +24,7 @@ cpl_propertylist_delete(sub_header); sub_header = NULL; KMO_TRY_EXIT_IF_NULL( -@@ -868,7 +869,7 @@ static int kmo_stats(cpl_parameterlist *parlist, cpl_frameset *frameset) +@@ -869,7 +870,7 @@ static int kmo_stats(cpl_parameterlist *parlist, cpl_frameset *frameset) tmp_str = cpl_sprintf(" - |")); } @@ -33,7 +33,7 @@ cpl_free(tmp_str); tmp_str = NULL; } kmclipm_vector_delete(data_out); data_out = NULL; -@@ -877,9 +878,10 @@ static int kmo_stats(cpl_parameterlist *parlist, cpl_frameset *frameset) +@@ -878,9 +879,10 @@ static int kmo_stats(cpl_parameterlist *parlist, cpl_frameset *frameset) KMO_TRY_EXIT_IF_NULL( sub_header = kmo_dfs_load_sub_header(frameset, STATS, extnr, TRUE)); @@ -47,7 +47,7 @@ cpl_propertylist_delete(sub_header); sub_header = NULL; KMO_TRY_EXIT_IF_NULL( -@@ -898,7 +900,7 @@ static int kmo_stats(cpl_parameterlist *parlist, cpl_frameset *frameset) +@@ -899,7 +901,7 @@ static int kmo_stats(cpl_parameterlist *parlist, cpl_frameset *frameset) tmp_str = cpl_sprintf(" - |")); } diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/patches/series cpl-plugin-kmos-2.0.2+dfsg/debian/patches/series --- cpl-plugin-kmos-1.4.3+dfsg/debian/patches/series 2017-07-01 09:42:34.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/patches/series 2018-05-03 13:07:46.000000000 +0000 @@ -6,3 +6,4 @@ Increase-tolerance-to-fix-FTBS-on-mips-mipsel64-and-ia64.patch Force-serial-tests-to-get-better-verbose-output.patch Disable-priv_reconstruct-patch-on-mips.patch +Remove-molecfit-dependency.patch diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/patches/Set-the-plugin-directory-so-that-esorex-and-python-cpl-ca.patch cpl-plugin-kmos-2.0.2+dfsg/debian/patches/Set-the-plugin-directory-so-that-esorex-and-python-cpl-ca.patch --- cpl-plugin-kmos-1.4.3+dfsg/debian/patches/Set-the-plugin-directory-so-that-esorex-and-python-cpl-ca.patch 2017-07-01 09:42:34.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/patches/Set-the-plugin-directory-so-that-esorex-and-python-cpl-ca.patch 2018-05-03 13:07:46.000000000 +0000 @@ -7,7 +7,7 @@ 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 -index 276da17..b8de136 100644 +index 950afb5..4f0f9b8 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -84,15 +84,15 @@ AC_DEFUN([KMOS_SET_VERSION_INFO], diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/README.Debian cpl-plugin-kmos-2.0.2+dfsg/debian/README.Debian --- cpl-plugin-kmos-1.4.3+dfsg/debian/README.Debian 1970-01-01 00:00:00.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/README.Debian 2018-05-03 13:20:32.000000000 +0000 @@ -0,0 +1,19 @@ +From version 2, the KMOS pipeline uses molecfit. While molecfit itself +is GPL, it depends on radiative transfer code LNFL and LBLRTM which +are not DFSG free (and as being not GPL conform contradict the +GPL). Both packages are research-only: + +> The LNFL software you are downloading has been copyrighted by +> Atmospheric and Environmental Research, Inc. (AER) and is proprietary +> to AER. AER grants USER the right to download, install, use and copy +> this software for scientific and research purposes only. + +This makes it impossible to include molecfit in Debian. Consequently, +the molecfit recipes are disabled. + + -- Ole Streicher , Thu, 3 May 2018 15:18:55 +0200 + +Due to their size, static calibration files are not included. Installing the +"calib" subpackage will download the corresponding files from the ESO archive. + + -- Ole Streicher Fri, 13 Sep 2013 18:50:00 +0200 diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/README.Debian.in cpl-plugin-kmos-2.0.2+dfsg/debian/README.Debian.in --- cpl-plugin-kmos-1.4.3+dfsg/debian/README.Debian.in 2016-11-20 09:32:16.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/README.Debian.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -Due to their size, static calibration files are not included. Installing the -"calib" subpackage will download the corresponding files from the ESO archive. - - -- Ole Streicher Fri, 13 Sep 2013 18:50:00 +0200 diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/rules cpl-plugin-kmos-2.0.2+dfsg/debian/rules --- cpl-plugin-kmos-1.4.3+dfsg/debian/rules 2016-11-20 09:32:16.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/rules 2018-05-03 13:20:32.000000000 +0000 @@ -2,28 +2,27 @@ # -*- makefile -*- #export DH_VERBOSE=1 -DEBVERS ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p') -VERSION ?= $(shell echo '$(DEBVERS)' | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/+.*//') -DEBPKGNAME ?= $(shell dpkg-parsechangelog | grep -E ^Source: | cut -d" " -f2) -PIPELINE ?= $(shell echo '$(DEBPKGNAME)' | sed -e 's/cpl-plugin-//') +include /usr/share/dpkg/pkg-info.mk + +VERSION ?= $(shell echo '$(DEB_VERSION)' | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/+.*//') +PIPELINE ?= $(shell echo '$(DEB_SOURCE)' | sed -e 's/cpl-plugin-//') get-orig-source: sh ./debian/repackage.sh %: - dh $@ --with autoreconf,sphinxdoc + dh $@ --with sphinxdoc debian_files: if [ -d calib/cal ] ; then \ dfiles=".install -doc.manpages -doc.docs -doc.doc-base -calib.install" ; \ else \ - cp -f debian/README.Debian.in debian/README.Debian ; \ dfiles=".install -doc.manpages -doc.docs -doc.doc-base -calib.postinst -calib.prerm -calib.lintian-overrides" ; \ fi ; \ for f in $$dfiles ; do \ sed "s/__VERSION__/$(VERSION)/g;s/__PIPELINE__/${PIPELINE}/g" \ < debian/cpl-plugin$$f.in \ - > debian/${DEBPKGNAME}$$f ; \ + > debian/${DEB_SOURCE}$$f ; \ done override_dh_install: debian_files @@ -31,12 +30,12 @@ override_dh_installman-indep: mkdir -p man - python debian/create_manpage.py ${PIPELINE} + python3 debian/create_manpage.py ${PIPELINE} dh_installman override_dh_installdocs-indep: mkdir -p sphinx - python debian/create_sphinx.py ${PIPELINE} + python3 debian/create_sphinx.py ${PIPELINE} sphinx-build sphinx sphinx/html dh_installdocs @@ -47,15 +46,14 @@ override_dh_clean: dh_clean - rm -rf debian/${DEBPKGNAME}.install \ - debian/${DEBPKGNAME}-doc.manpages \ - debian/${DEBPKGNAME}-doc.docs \ - debian/${DEBPKGNAME}-doc.doc-base \ - debian/${DEBPKGNAME}-calib.lintian-overrides \ - debian/${DEBPKGNAME}-calib.install \ - debian/${DEBPKGNAME}-calib.postinst \ - debian/${DEBPKGNAME}-calib.prerm \ - debian/README.Debian \ + rm -rf debian/${DEB_SOURCE}.install \ + debian/${DEB_SOURCE}-doc.manpages \ + debian/${DEB_SOURCE}-doc.docs \ + debian/${DEB_SOURCE}-doc.doc-base \ + debian/${DEB_SOURCE}-calib.lintian-overrides \ + debian/${DEB_SOURCE}-calib.install \ + debian/${DEB_SOURCE}-calib.postinst \ + debian/${DEB_SOURCE}-calib.prerm \ man sphinx override_dh_auto_configure: @@ -74,7 +72,7 @@ override_dh_gencontrol-indep: dh_gencontrol if [ ! -d calib/cal ] ; then \ - sed "s/Installed-Size:.*/Installed-Size: $(shell cat calib/cal_size)/" -i debian/${DEBPKGNAME}-calib/DEBIAN/control ; \ + sed "s/Installed-Size:.*/Installed-Size: $(shell cat calib/cal_size)/" -i debian/${DEB_SOURCE}-calib/DEBIAN/control ; \ fi override_dh_auto_test: diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/tests/control cpl-plugin-kmos-2.0.2+dfsg/debian/tests/control --- cpl-plugin-kmos-1.4.3+dfsg/debian/tests/control 2016-11-20 09:32:16.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/tests/control 2018-04-27 15:31:20.000000000 +0000 @@ -1,2 +1,2 @@ Tests: test-recipe.py -Depends: cpl-plugin-kmos, python-cpl, python-astropy +Depends: cpl-plugin-kmos, python3-cpl, python3-astropy diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/tests/test-recipe.py cpl-plugin-kmos-2.0.2+dfsg/debian/tests/test-recipe.py --- cpl-plugin-kmos-1.4.3+dfsg/debian/tests/test-recipe.py 2016-11-20 09:32:16.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/tests/test-recipe.py 2018-04-27 15:31:20.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Simple pipeline test by loading all recipes and printing some diff -Nru cpl-plugin-kmos-1.4.3+dfsg/debian/watch cpl-plugin-kmos-2.0.2+dfsg/debian/watch --- cpl-plugin-kmos-1.4.3+dfsg/debian/watch 2016-11-20 09:32:16.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/debian/watch 2018-04-27 15:31:20.000000000 +0000 @@ -1,6 +1,6 @@ version=3 opts=dversionmangle=s/\+dfsg// \ -http://www.eso.org/sci/software/pipelines/ \ +https://www.eso.org/sci/software/pipelines/ \ .*/kmos-kit-([\d\.]+)(?:-.+)?\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz)) \ debian debian/repackage.sh #opts=uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|b|a)[\-\.]?\d*)$/$1~$2/ \ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_calib.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_calib.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_calib.c 2014-12-02 16:37:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_calib.c 2018-01-18 08:56:57.000000000 +0000 @@ -33,10 +33,13 @@ Includes -----------------------------------------------------------------------------*/ +#include "irplib_calib.h" + #include -#include -#include "irplib_calib.h" +/*----------------------------------------------------------------------------- + Static Function Prototypes + -----------------------------------------------------------------------------*/ static int irplib_get_clean_mean_window(cpl_image* img, @@ -48,18 +51,6 @@ double* clean_mean, double* clean_stdev); -/*----------------------------------------------------------------------------- - Defines - -----------------------------------------------------------------------------*/ - -#if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(6, 3, 0) -#define IRPLIB_FRAMESET_GET cpl_frameset_get_position -#else -/* Remove this branch once CPL versions less than 6.3 are no longer supported */ -#define IRPLIB_FRAMESET_GET cpl_frameset_get_frame -#endif - - static double irplib_pfits_get_dit(const cpl_propertylist * plist); static double irplib_pfits_get_exp_time(const cpl_propertylist* plist); /*----------------------------------------------------------------------------*/ @@ -231,7 +222,7 @@ for(i=0;i + +/*----------------------------------------------------------------------------- + Function prototypes + -----------------------------------------------------------------------------*/ + cpl_table* irplib_compute_gain( cpl_frameset* son, cpl_frameset* sof, int* zone1, const int kappa1, - const int nclip1); -cpl_table* irplib_compute_linearity(cpl_frameset* son, cpl_frameset* sof); + const int nclip1) CPL_ATTR_ALLOC; + +cpl_table* irplib_compute_linearity(cpl_frameset* son, cpl_frameset* sof) + CPL_ATTR_ALLOC; + int irplib_flat_dark_bpm_calib(cpl_imagelist *, const char *, const char *, const char *); int irplib_detlin_correct(cpl_imagelist *, const char *, const char *, diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_cat.h cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_cat.h --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_cat.h 2009-12-16 14:49:52.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_cat.h 2017-09-18 08:05:11.000000000 +0000 @@ -34,6 +34,10 @@ #include +/*----------------------------------------------------------------------------- + Function prototypes + -----------------------------------------------------------------------------*/ + int irplib_2mass_get_catpars (const cpl_frame *master_index, char **catpath, diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_distortion.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_distortion.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_distortion.c 2014-12-02 16:37:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_distortion.c 2017-09-18 13:05:17.000000000 +0000 @@ -409,7 +409,7 @@ #else cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "Not enough valid arcs, min=" - IRPLIB_STRINGIFY(ARC_MINNBARCS)); + CPL_STRINGIFY(ARC_MINNBARCS)); #endif cpl_image_delete(*label_im); *label_im = NULL; @@ -995,13 +995,13 @@ #if defined CPL_HAVE_VA_ARGS && CPL_HAVE_VA_ARGS != 0 cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "image has %d lines, min=" - IRPLIB_STRINGIFY(IS_SKIPZONE) "*" - IRPLIB_STRINGIFY(IS_NB_TESTPOINTS), ny); + CPL_STRINGIFY(IS_SKIPZONE) "*" + CPL_STRINGIFY(IS_NB_TESTPOINTS), ny); #else cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "image has too few lines, min=" - IRPLIB_STRINGIFY(IS_SKIPZONE) "*" - IRPLIB_STRINGIFY(IS_NB_TESTPOINTS)); + CPL_STRINGIFY(IS_SKIPZONE) "*" + CPL_STRINGIFY(IS_NB_TESTPOINTS)); #endif return NULL; } diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_distortion.h cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_distortion.h --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_distortion.h 2013-01-29 08:49:53.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_distortion.h 2017-09-18 08:05:11.000000000 +0000 @@ -29,13 +29,13 @@ #define IRPLIB_DISTORTION_H /*----------------------------------------------------------------------------- - Includes + Includes -----------------------------------------------------------------------------*/ #include /*----------------------------------------------------------------------------- - Prototypes + Function prototypes -----------------------------------------------------------------------------*/ cpl_polynomial * irplib_distortion_estimate(const cpl_image *, int, int, int, diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_flat.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_flat.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_flat.c 2014-12-02 16:37:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_flat.c 2017-09-18 08:05:11.000000000 +0000 @@ -33,10 +33,8 @@ Includes -----------------------------------------------------------------------------*/ -#include -#include - #include "irplib_flat.h" +#include /*----------------------------------------------------------------------------- Functions prototypes diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_framelist.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_framelist.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_framelist.c 2014-12-02 16:37:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_framelist.c 2018-04-11 08:42:15.000000000 +0000 @@ -29,7 +29,6 @@ #include "irplib_framelist.h" #include "irplib_utils.h" -#include #include #include @@ -200,10 +199,8 @@ /*----------------------------------------------------------------------------*/ irplib_framelist * irplib_framelist_cast(const cpl_frameset * frameset) { - irplib_framelist * self; - int i; - + int i ; cpl_ensure(frameset != NULL, CPL_ERROR_NULL_INPUT, NULL); @@ -216,7 +213,10 @@ cpl_frame * copy = cpl_frame_duplicate(frame); - const cpl_error_code error = irplib_framelist_set(self, copy, i); +#ifndef NDEBUG + const cpl_error_code error = +#endif + irplib_framelist_set(self, copy, i); assert(error == CPL_ERROR_NONE); @@ -241,9 +241,8 @@ /*----------------------------------------------------------------------------*/ cpl_frameset * irplib_frameset_cast(const irplib_framelist * self) { - cpl_frameset * new; - int i; + int i ; cpl_ensure(self != NULL, CPL_ERROR_NULL_INPUT, NULL); @@ -252,7 +251,10 @@ for (i = 0; i < self->size; i++) { cpl_frame * frame = cpl_frame_duplicate(self->frame[i]); - const cpl_error_code error = cpl_frameset_insert(new, frame); +#ifndef NDEBUG + const cpl_error_code error = +#endif + cpl_frameset_insert(new, frame); assert(error == CPL_ERROR_NONE); @@ -296,20 +298,21 @@ const cpl_frame * frame = self->frame[i]; const char * ftag = cpl_frame_get_tag(frame); cpl_frame * copy; - cpl_error_code error; + cpl_error_code code; if (ftag == NULL) { /* The frame is ill-formed */ irplib_framelist_delete(new); - cpl_ensure(0, CPL_ERROR_ILLEGAL_INPUT, NULL); + (void)cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT); + return NULL; } if (strcmp(tag, ftag)) continue; copy = cpl_frame_duplicate(frame); - error = irplib_framelist_set(new, copy, newsize); - assert(error == CPL_ERROR_NONE); + code = irplib_framelist_set(new, copy, newsize); + if (code != CPL_ERROR_NONE) break; /* Should not be possible */ if (self->propertylist[i] != NULL) new->propertylist[newsize] = cpl_propertylist_duplicate(self->propertylist[i]); @@ -902,8 +905,8 @@ cpl_boolean is_equal, double fp_tol) { - char * value_0; - char * value_i; + char * value_0 = NULL; + char * value_i = NULL; cpl_type type_0 = CPL_TYPE_INVALID; int i, ifirst = -1; /* First non-NULL propertylist */ @@ -1059,7 +1062,7 @@ for (i=0; i < self->size; i++, image = NULL) { const char * filename = cpl_frame_get_filename(self->frame[i]); - cpl_error_code error; + cpl_error_code code; if (filename == NULL) break; @@ -1077,8 +1080,8 @@ break; } - error = cpl_imagelist_set(list, image, i); - assert(error == CPL_ERROR_NONE); + code = cpl_imagelist_set(list, image, i); + if (code != CPL_ERROR_NONE) break; /* Should not be possible */ } cpl_image_delete(image); @@ -1086,7 +1089,7 @@ if (cpl_imagelist_get_size(list) != self->size) { cpl_imagelist_delete(list); list = NULL; - assert(cpl_error_get_code() != CPL_ERROR_NONE); + (void)cpl_error_set_where(cpl_func); } return list; @@ -1266,10 +1269,11 @@ } default: /* Unknown property type */ +#ifdef NDEBUG + equal = CPL_FALSE; +#endif assert( 0 ); - equal = CPL_FALSE; /* In case of -DNDEBUG */ - } if (!equal) { diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_match_cats.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_match_cats.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_match_cats.c 2009-12-18 10:44:48.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_match_cats.c 2018-01-18 08:59:02.000000000 +0000 @@ -33,16 +33,16 @@ Includes -----------------------------------------------------------------------------*/ +#include "irplib_match_cats.h" #include -#include -#include -#include "irplib_match_cats.h" +/*----------------------------------------------------------------------------- + Defines + -----------------------------------------------------------------------------*/ #define FILENAME_SZBUF 1024 - /*----------------------------------------------------------------------------*/ /* Private functions */ @@ -90,8 +90,8 @@ (int * cats_idx_set_ptr, int ncats); -int nCombinations; -int nFilter; +int irplib_nCombinations; +int irplib_nFilter; /*----------------------------------------------------------------------------*/ /** @@ -157,8 +157,8 @@ int icat1; int icat2; - nCombinations = 0; - nFilter = 0; + irplib_nCombinations = 0; + irplib_nFilter = 0; for(icat1 = 0; icat1 < ncats ; ++icat1) for(icat2 = icat1 + 1 ; icat2 < ncats ; ++icat2) @@ -174,7 +174,7 @@ for(iobj1 = 0; iobj1 < nobj1 ; ++iobj1) for(iobj2 = 0 ; iobj2 < nobj2 ; ++iobj2) { - ++nCombinations; + ++irplib_nCombinations; if(binary_match_condition(catalogues[icat1], catalogues[icat2], iobj1, iobj2)) @@ -182,7 +182,7 @@ cpl_array * cats_idx_set; int icat; - ++nFilter; + ++irplib_nFilter; cats_idx_set = cpl_array_new(ncats, CPL_TYPE_INT); for(icat = 0; icat < ncats; ++icat) { diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_match_cats.h cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_match_cats.h --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_match_cats.h 2009-12-18 10:44:48.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_match_cats.h 2018-01-18 08:57:36.000000000 +0000 @@ -34,6 +34,10 @@ #include +/*----------------------------------------------------------------------------- + Function prototypes + -----------------------------------------------------------------------------*/ + cpl_table * irplib_match_cat_pairs (cpl_table ** catalogues, int nCats, @@ -41,6 +45,6 @@ (cpl_table * catalogue1, cpl_table * catalogue2, int iobj1, - int iobj2) ); + int iobj2) ) CPL_ATTR_ALLOC; #endif diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_plugin.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_plugin.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_plugin.c 2014-12-02 16:37:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_plugin.c 2017-09-18 13:05:17.000000000 +0000 @@ -33,15 +33,14 @@ #include #endif +#include "irplib_plugin.h" + +#include "irplib_utils.h" /* irplib_reset() */ + #include #include #include -#include - - -#include "irplib_plugin.h" - /*----------------------------------------------------------------------------*/ /** * @defgroup irplib_plugin Irplib plugin functionality @@ -60,9 +59,14 @@ /* Maximum line length in SOF-file */ #ifndef LINE_LEN_MAX -#define LINE_LEN_MAX 1024 +#define LINE_LEN_MAX 1023 #endif +#define LINE_SCAN_FMT \ + "%" CPL_STRINGIFY(LINE_LEN_MAX) "s " \ + "%" CPL_STRINGIFY(LINE_LEN_MAX) "s " \ + "%" CPL_STRINGIFY(LINE_LEN_MAX) "s" + /* This device provides quite-random data */ #define DEV_RANDOM "/dev/urandom" @@ -1023,8 +1027,8 @@ { FILE *fp; - char line[LINE_LEN_MAX]; - char path[LINE_LEN_MAX], group[LINE_LEN_MAX], tag[LINE_LEN_MAX]; + char line[LINE_LEN_MAX + 1]; + char path[LINE_LEN_MAX + 1], group[LINE_LEN_MAX + 1], tag[LINE_LEN_MAX + 1]; int line_number; assert( set != NULL ); @@ -1037,18 +1041,15 @@ } /* Loop over all the lines in the set-of-frames file */ - for (line_number = 0; fgets(line, LINE_LEN_MAX - 1, fp); line_number++) { + for (line_number = 0; fgets(line, LINE_LEN_MAX, fp); line_number++) { - char scan_fmt[50]; cpl_frame_group grp; cpl_frame * frame; int n; if (line[0] == '#') continue; - 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); + n = sscanf(line, LINE_SCAN_FMT, path, tag, group); if (n < 1) { cpl_msg_warning(cpl_func, "Spurious line no. %d in %s: %s", diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_plugin.h cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_plugin.h --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_plugin.h 2012-01-11 08:03:37.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_plugin.h 2017-09-18 08:31:18.000000000 +0000 @@ -32,19 +32,9 @@ Includes -----------------------------------------------------------------------------*/ -#include /* irplib_reset() */ - #include /*----------------------------------------------------------------------------- - Define - -----------------------------------------------------------------------------*/ - -/* Needed (by uves) to concatenate two macro arguments */ -#define IRPLIB_CONCAT(a,b) a ## _ ## b -#define IRPLIB_CONCAT2X(a,b) IRPLIB_CONCAT(a,b) - -/*----------------------------------------------------------------------------- Function prototypes -----------------------------------------------------------------------------*/ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_polynomial.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_polynomial.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_polynomial.c 2017-02-03 09:54:27.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_polynomial.c 2017-09-18 08:52:16.000000000 +0000 @@ -34,6 +34,10 @@ #endif #include "irplib_polynomial.h" + +/* IRPLIB_SWAP_DOUBLE: */ +#include "irplib_utils.h" + #include #include /* DBL_MAX: */ @@ -49,18 +53,6 @@ /**@{*/ /*----------------------------------------------------------------------------- - Macro definitions - -----------------------------------------------------------------------------*/ - -#define IRPLIB_SWAP(a,b) { const double t=(a);(a)=(b);(b)=t; } - -#if 0 -#define irplib_trace() cpl_msg_info(cpl_func, "%d: Trace", __LINE__) -#else -#define irplib_trace() /* Trace */ -#endif - -/*----------------------------------------------------------------------------- Static functions -----------------------------------------------------------------------------*/ @@ -335,7 +327,7 @@ cpl_vector * reals = cpl_vector_wrap(*preal, cpl_vector_get_data(roots)); - cpl_vector_sort(reals, 1); + cpl_vector_sort(reals, CPL_SORT_ASCENDING); (void)cpl_vector_unwrap(reals); } } @@ -353,9 +345,11 @@ @param p2 The non-zero coefficient to x^2 @param p1 The coefficient to x @param p0 The constant term - @param px1 The 1st root or the real part of the complex roots - @param px2 The 2nd root or the imaginary part of the complex roots - @return CPL_TRUE iff the roots are complex + @param px1 The 1st real root or the real part of the complex, conjugate + roots + @param px2 The 2nd real root or the positive, imaginary part of the + complex roots + @return CPL_TRUE iff the roots are complex conjugate */ /*----------------------------------------------------------------------------*/ @@ -384,10 +378,8 @@ /* x1 is the root with largest absolute value */ if (p1 > 0.0) { x1 = -0.5 * (p1 + sqrtD); - irplib_trace(); /* OK */ } else { x1 = -0.5 * (p1 - sqrtD); - irplib_trace(); /* OK */ } /* Compute smaller root via division to avoid loss of precision due to cancellation */ @@ -401,11 +393,9 @@ if (x2 > x1) { *px1 = x1; *px2 = x2; - irplib_trace(); /* OK */ } else { *px1 = x2; *px2 = x1; - irplib_trace(); /* OK */ } } @@ -420,7 +410,6 @@ *px1 = x1; *px2 = x2; is_complex = CPL_TRUE; - irplib_trace(); /* OK */ } return is_complex; @@ -450,13 +439,11 @@ if (is_c) { res = fabs(p0 + x1 * (p1 + x1 * p2) - p2 * x2 * x2); - irplib_trace(); /* OK */ } else { const double r1 = fabs(p0 + x1 * (p1 + x1 * p2)); const double r2 = fabs(p0 + x2 * (p1 + x2 * p2)); res = r1 > r2 ? r1 : r2; - irplib_trace(); /* OK */ } return res; @@ -492,12 +479,10 @@ - x3 * x3 * ( 3.0 * p3 * x2 + p2)); res = r1 > r2 ? r1 : r2; - irplib_trace(); /* OK */ } else { const double r2 = fabs(p0 + x2 * (p1 + x2 * (p2 + x2 * p3))); const double r3 = fabs(p0 + x3 * (p1 + x3 * (p2 + x3 * p3))); res = r1 > r2 ? (r1 > r3 ? r1 : r3) : (r2 > r3 ? r2 : r3); - irplib_trace(); /* OK */ } /* cpl_msg_info(cpl_func, "%d: %g (%g)", __LINE__, res, r1); */ @@ -592,7 +577,6 @@ if (pdbl1 != NULL) *pdbl1 = CPL_FALSE; if (!is_c && pdbl2 != NULL) *pdbl2 = dbl2; is_complex = is_c; - irplib_trace(); /* OK */ } @@ -617,7 +601,6 @@ if (pdbl1 != NULL) *pdbl1 = CPL_FALSE; if (pdbl2 != NULL) *pdbl2 = CPL_FALSE; is_complex = CPL_FALSE; - irplib_trace(); /* OK */ } } @@ -643,7 +626,6 @@ if (pdbl1 != NULL) *pdbl1 = CPL_FALSE; if (pdbl2 != NULL) *pdbl2 = dbl2; is_complex = CPL_FALSE; - irplib_trace(); /* OK */ } @@ -664,7 +646,6 @@ if (pdbl1 != NULL) *pdbl1 = dbl1; if (pdbl2 != NULL) *pdbl2 = CPL_FALSE; is_complex = CPL_FALSE; - irplib_trace(); /* OK */ } } @@ -673,13 +654,10 @@ *px1 = x1; *px2 = x2; *px3 = x3; - irplib_trace(); /* OK */ } else if (is_complex) { *px1 = x1; - irplib_trace(); /* OK */ } else { *px1 = x3; - irplib_trace(); /* OK */ } return is_complex; @@ -717,7 +695,6 @@ *px2 = x2; *px3 = x3; - irplib_trace(); /* OK */ return; } @@ -755,18 +732,15 @@ end up here, with the sign lost for one of them */ x3 = x2 = -a < x1 ? -sqrt(fabs(c / x1)) : sqrt(fabs(c / x1)); if (pdbl2 != NULL) *pdbl2 = CPL_TRUE; - irplib_trace(); /* OK */ } else if (a < 0.0) { /* a and sqrt(Q) have opposite signs - or Q is zero */ x3 = x2 = sqrtQ - a / 3.0; x1 = -c / (x2 * x2); if (pdbl2 != NULL) *pdbl2 = CPL_TRUE; - irplib_trace(); /* OK */ } else { x1 = -2.0 * sqrtQ; x3 = x2 = sqrtQ; if (pdbl2 != NULL) *pdbl2 = CPL_TRUE; - irplib_trace(); /* OK */ } *px1 = x1; @@ -832,7 +806,6 @@ x3 = 0.5 * CPL_MATH_SQRT3 * fabs(A - B); x1 = -c / (x2 * x2 + x3 * x3); - irplib_trace(); /* OK */ } else { /* A+B and a have opposite signs - or exactly one is zero */ x1 = A + B - a / 3.0; @@ -842,24 +815,20 @@ if (x3 > 0.0) { /* Real part of complex conjugate */ x2 = -0.5 * (A + B) - a / 3.0; /* FIXME: Cancellation */ - irplib_trace(); /* OK */ } else { x2 = -a < x1 ? -sqrt(fabs(c / x1)) : sqrt(fabs(c / x1)); x3 = 0.0; - irplib_trace(); /* OK */ } } if (x3 > 0.0) { is_complex = CPL_TRUE; - irplib_trace(); /* OK */ } else { /* Whoaa, the imaginary part was truncated to zero - return a real, double root */ x3 = x2; if (pdbl2 != NULL) *pdbl2 = CPL_TRUE; - irplib_trace(); /* OK */ } *px1 = x1; @@ -920,7 +889,6 @@ /* FIXME: Cancellation may still effect x3 ? */ x3 = TR3 - a / 3.0; x2 = -c / ( x1 * x3 ); - irplib_trace(); /* OK */ } else { /* FIXME: Cancellation may still effect x2, especially if x2, x3 is (almost) a double root, i.e. @@ -928,24 +896,20 @@ x2 = TR2 - a / 3.0; x3 = -c / ( x1 * x2 ); - irplib_trace(); /* OK */ } } else if (a < 0.0) { x3 = TR3 - a / 3.0; if (TR2 < 0.0 && (TR1 + TR2) > 2.0 * a) { x1 = TR1 - a / 3.0; x2 = -c / ( x1 * x3 ); - irplib_trace(); /* OK */ } else { x2 = TR2 - a / 3.0; x1 = -c / ( x2 * x3 ); - irplib_trace(); /* OK */ } } else { x1 = TR1; x2 = TR2; x3 = TR3; - irplib_trace(); /* OK */ } assert(x1 < x3); @@ -959,7 +923,6 @@ theta is close to PI */ x1 = x2 = 0.5 * ( x1 + x2 ); - irplib_trace(); /* OK, tested only for x1 == x2 */ } else if (x2 > x3) { /* In absence of round-off: theta == 0: x2 == x3, @@ -969,7 +932,6 @@ Round-off can cause x2 to become greater than x3 */ x3 = x2 = 0.5 * ( x2 + x3 ); - irplib_trace(); /* OK */ } *px1 = x1; @@ -1047,7 +1009,7 @@ x4 -= 0.25 * p3 / p4; /* Need (only) a guarded swap of x2, x3 */ if (x2 > x3) { - IRPLIB_SWAP(x2, x3); + IRPLIB_SWAP_DOUBLE(x2, x3); } if (dbl1) { assert( x1 <= x2); /* The cubic may have 0 as triple root */ @@ -1064,7 +1026,7 @@ if (x1 > x2) { assert( x3 <= x2 ); /* Don't swap a complex root */ - IRPLIB_SWAP(x1, x2); + IRPLIB_SWAP_DOUBLE(x1, x2); } else { assert( x3 >= x2 ); } diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_sdp_spectrum.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_sdp_spectrum.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_sdp_spectrum.c 2014-12-02 16:37:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_sdp_spectrum.c 2018-01-10 08:22:39.000000000 +0000 @@ -1598,6 +1598,44 @@ GET_SET_METHODS_TYPE_DOUBLE(tdmax, KEY_TDMAX(1), KEY_TDMAX1_COMMENT) +#if 0 +/*----------------------------------------------------------------------------*/ +/** + * @brief Replace a keyword comment by a custom string. + * @param self The spectrum object to update. + * @param keyword The name of the keyword to update. + * @param comment The string to use as keyword comment. + * @return @c CPL_ERROR_NONE on success or an appropriate error code otherwise. + * + * This function will replace the comment of the keyword @c keyword with + * the string @c comment. The string @c keyword is the full keyword name. + * Both, the keyword @c keyword and the new comment @c comment must not + * be @a NULL. + * If any error occurs then a error code is set and returned, otherwise + * @c CPL_ERROR_NONE is returned on success. + */ +/*----------------------------------------------------------------------------*/ + +cpl_error_code +irplib_sdp_spectrum_replace_comment(irplib_sdp_spectrum *self, + const char *keyword, + const char *comment) +{ + cpl_ensure_code((self != NULL) && (keyword != NULL) && (comment != NULL), + CPL_ERROR_NULL_INPUT); + cpl_ensure_code((self->proplist != NULL), CPL_ERROR_ILLEGAL_INPUT); + + if (!cpl_propertylist_has(self->proplist, keyword)) { + return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND, + "Could not find '%s' keyword.", keyword); + } + + cpl_propertylist_set_comment(self->proplist, keyword, comment); + return CPL_ERROR_NONE; +} +#endif + + cpl_error_code irplib_sdp_spectrum_append_prov(irplib_sdp_spectrum *self, cpl_size firstindex, const cpl_frameset *frames) @@ -2496,6 +2534,57 @@ } +/*----------------------------------------------------------------------------*/ +/** + * @brief Replace the comment of a column description keyword. + * @param self The spectrum object to update. + * @param name The name of the column to update. + * @param keyword The name of the keyword to update. + * @param comment The string to use as keyword comment. + * @return @c CPL_ERROR_NONE on success or an appropriate error code otherwise. + * + * This function will replace the comment of the keyword @c keyword of + * the column @c name with the string @c comment. The string @c keyword + * is the keyword name without the column index appended. The latter is + * deduced from the column name @name. The new comment @c comment must not + * be @a NULL. + * If any error occurs then a error code is set and returned, otherwise + * @c CPL_ERROR_NONE is returned on success. + */ +/*----------------------------------------------------------------------------*/ + +cpl_error_code +irplib_sdp_spectrum_replace_column_comment(irplib_sdp_spectrum *self, + const char *name, + const char *keyword, + const char *comment) +{ + cpl_ensure_code((self != NULL), CPL_ERROR_NULL_INPUT); + cpl_ensure_code((self->proplist != NULL), CPL_ERROR_ILLEGAL_INPUT); + cpl_ensure_code((name != NULL) && (keyword != NULL) && (comment != NULL), + CPL_ERROR_NULL_INPUT); + + cpl_size index = _irplib_sdp_spectrum_get_column_index(self, name); + if (index == (cpl_size)-1) { + return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND, + "Could not find column '%s'.", name); + } + + char *propname = cpl_sprintf("%s%"CPL_SIZE_FORMAT, keyword, index + 1); + if (!cpl_propertylist_has(self->proplist, propname)) { + cpl_free(propname); + return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND, + "Could not find '%s' keyword for column '%s'.", keyword, + name); + } + + cpl_propertylist_set_comment(self->proplist, propname, comment); + cpl_free(propname); + + return CPL_ERROR_NONE; +} + + const cpl_array * irplib_sdp_spectrum_get_column_data(const irplib_sdp_spectrum *self, const char *name) diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_sdp_spectrum.h cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_sdp_spectrum.h --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_sdp_spectrum.h 2014-12-02 16:37:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_sdp_spectrum.h 2018-01-10 08:22:39.000000000 +0000 @@ -599,6 +599,16 @@ const char *name); /* + * Method to replace the default keyword comment with a custom comment + */ + +cpl_error_code +irplib_sdp_spectrum_replace_column_comment(irplib_sdp_spectrum *self, + const char *name, + const char *keyword, + const char *comment); + +/* * Column manipulation functions. */ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_spectrum.h cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_spectrum.h --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_spectrum.h 2009-07-30 12:38:37.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_spectrum.h 2017-09-18 08:05:11.000000000 +0000 @@ -48,7 +48,7 @@ } spec_shadows ; /*----------------------------------------------------------------------------- - Prototypes + Function prototypes -----------------------------------------------------------------------------*/ int irplib_spectrum_find_brightest(const cpl_image *, int, spec_shadows, diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_stdstar.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_stdstar.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_stdstar.c 2014-12-02 16:37:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_stdstar.c 2018-01-18 08:55:56.000000000 +0000 @@ -42,18 +42,6 @@ #include #include -/*----------------------------------------------------------------------------- - Defines - -----------------------------------------------------------------------------*/ - -#if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(6, 3, 0) -#define IRPLIB_FRAMESET_GET_CONST cpl_frameset_get_position_const -#else -/* Remove this branch once CPL versions less than 6.3 are no longer supported */ -#define IRPLIB_FRAMESET_GET_CONST cpl_frameset_get_frame_const -#endif - - /*----------------------------------------------------------------------------*/ /** * @defgroup irplib_stdstar Functions for standard stars @@ -119,7 +107,8 @@ /* Process the catalogs */ for (i = 0; i < nb_catalogs; i++) { /* Get the catalog name */ - const cpl_frame * cur_frame = IRPLIB_FRAMESET_GET_CONST(set_raw, i); + const cpl_frame * cur_frame = cpl_frameset_get_position_const(set_raw, + i); const char * cat_name = cpl_frame_get_filename(cur_frame); cpl_table * out = convert_ascii_table(cat_name); @@ -335,15 +324,14 @@ /*----------------------------------------------------------------------------*/ /** - @brief Select the stars that are within a given distance - @param cat the catalog - @param ra RA pos - @param dec DEC pos - @param dist the distancw - @return 0 if ok, -1 in error case + @brief Deselect the stars that are beyond a given distance + @param cat The standard star catalog, with too distant stars to unselect + @param ra Right ascension [degrees] + @param dec Declination [degrees] + @param dist The distance [degrees] + @return 0 if ok, -1 in error case - The stars that are within not further than dist from ra,dec are - selected in the table. + The stars that are further than dist from ra,dec are unselected in the table. */ /*----------------------------------------------------------------------------*/ int irplib_stdstar_select_stars_dist( @@ -352,31 +340,34 @@ double dec, double dist) { - double distance; - int nrows; - int i; + cpl_size i, nrows; /* Check entries */ if (cat == NULL) return -1; /* Get the number of selected rows */ nrows = cpl_table_get_nrow(cat); - + /* Check if the columns are there */ if (!cpl_table_has_column(cat, IRPLIB_STDSTAR_RA_COL)) { - cpl_msg_error(cpl_func, "Missing %s column", IRPLIB_STDSTAR_RA_COL); + cpl_msg_error(cpl_func, "Missing column: " IRPLIB_STDSTAR_RA_COL); return -1; } if (!cpl_table_has_column(cat, IRPLIB_STDSTAR_DEC_COL)) { - cpl_msg_error(cpl_func, "Missing %s column", IRPLIB_STDSTAR_DEC_COL); + cpl_msg_error(cpl_func, "Missing column: " IRPLIB_STDSTAR_DEC_COL); + return -1; + } + + if (cpl_table_count_selected(cat) == 0) { + cpl_msg_error(cpl_func, "All %d row(s) already deselected", (int)nrows); return -1; } /* Compute distances of the selected rows */ - for (i=0; i dist) cpl_table_unselect_row(cat, i); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_strehl.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_strehl.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_strehl.c 2014-12-02 16:37:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_strehl.c 2017-10-23 09:30:58.000000000 +0000 @@ -102,9 +102,15 @@ static cpl_error_code irplib_gaussian_maxpos(const cpl_image *, double, + double, + double, double *, double *, double *); + +static cpl_error_code +irplib_closeset_aperture(const cpl_apertures * self, + const double x, const double y, int * ind); #endif /*----------------------------------------------------------------------------- @@ -219,7 +225,7 @@ *psf_flux = 1.0; /* The psf flux, cpl_image_get_flux(psf), is always 1 */ #ifndef IRPLIB_NO_FIT_GAUSSIAN - code = irplib_gaussian_maxpos(im, IRPLIB_STREHL_DETECT_LEVEL, + code = irplib_gaussian_maxpos(im, IRPLIB_STREHL_DETECT_LEVEL, xpos, ypos, &xposfit, &yposfit, &peak); if (code) { cpl_errorstate_set(prestate); @@ -707,7 +713,9 @@ /*----------------------------------------------------------------------------*/ static double PSF_sinc_norm(double x) { - return sin(x * CPL_MATH_PI) / (x * CPL_MATH_PI); + /* This static function should not be called with zero, but handle it + anyway. */ + return x != 0.0 ? sin(x * CPL_MATH_PI) / (x * CPL_MATH_PI) : 1.0; } /*----------------------------------------------------------------------------* @@ -893,6 +901,33 @@ } +static cpl_error_code +irplib_closeset_aperture(const cpl_apertures * self, + const double x, const double y, int * ind){ + + double dist = INFINITY; + + const int nsize = cpl_apertures_get_size(self); + + cpl_ensure_code(nsize > 0, cpl_error_get_code()); + cpl_ensure_code(ind, CPL_ERROR_NULL_INPUT); + + *ind = -1; + + for(int i = 1; i <= nsize; ++i){ + const double this_x = cpl_apertures_get_centroid_x(self, i); + const double this_y = cpl_apertures_get_centroid_y(self, i); + const double this_d_sq = pow(this_x - x, 2.0) + pow(this_y - y, 2.0); + + if(this_d_sq < dist){ + dist = this_d_sq; + *ind = i; + } + + } + return CPL_ERROR_NONE; +} + /*----------------------------------------------------------------------------*/ /** @brief Find the peak flux, peak sum and position of a Gaussian @@ -907,7 +942,9 @@ /*----------------------------------------------------------------------------*/ static cpl_error_code irplib_gaussian_maxpos(const cpl_image * self, - double sigma, + double sigma, + double x_initial, + double y_initial, double * pxpos, double * pypos, double * ppeak) @@ -971,8 +1008,8 @@ aperts = cpl_apertures_new_from_image(self, labels); - /* Find the aperture with the greatest flux */ - code = irplib_apertures_find_max_flux(aperts, &ifluxapert, 1); + /* Find the aperture closest to the provided coordinates */ + code = irplib_closeset_aperture(aperts, x_initial, y_initial, &ifluxapert); if (code) { cpl_apertures_delete(aperts); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_strehl.h cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_strehl.h --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_strehl.h 2014-03-19 11:44:02.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_strehl.h 2017-09-18 08:05:11.000000000 +0000 @@ -104,7 +104,7 @@ } irplib_strehl_bg_method; /*----------------------------------------------------------------------------- - Functions prototypes + Function prototypes -----------------------------------------------------------------------------*/ cpl_error_code irplib_strehl_compute(const cpl_image *, double, double, double, diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_utils.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_utils.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_utils.c 2017-02-06 12:49:00.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_utils.c 2017-09-18 08:05:11.000000000 +0000 @@ -32,9 +32,6 @@ #include #include -#include -#include - /*----------------------------------------------------------------------------- Defines -----------------------------------------------------------------------------*/ @@ -1726,3 +1723,82 @@ } return cpl_frameset_iterator_get_const(iterator); } + + +/*----------------------------------------------------------------------------*/ +/** + @internal + @brief Find the kth smallest value in a cpl_vector + @param self The vector to permute and search + @param k The requested value position in the sorted array, zero for 1st + + After a successful call, self is permuted so elements less than the kth have + lower indices, while elements greater than the kth have higher indices. If + the call fails, self is not modified. + + Reference: + + Author: Wirth, Niklaus + Title: Algorithms + data structures = programs + Publisher: Englewood Cliffs: Prentice-Hall, 1976 + Physical description: 366 p. + Series: Prentice-Hall Series in Automatic Computation + + See also: http://ndevilla.free.fr/median/median/ + + */ +/*----------------------------------------------------------------------------*/ + +void irplib_vector_get_kth(cpl_vector * self, cpl_size k) +{ + + cpl_size l = 0; + cpl_size m = cpl_vector_get_size(self) - 1; + cpl_size i = l; + cpl_size j = m; + double* pself = cpl_vector_get_data(self); + + if (pself == NULL) { + (void)cpl_error_set(cpl_func, CPL_ERROR_NULL_INPUT); + return; + } else if (k < 0) { + (void)cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT); + return; + } else if (k > m) { + (void)cpl_error_set(cpl_func, CPL_ERROR_ACCESS_OUT_OF_RANGE); + return; + } + + while (l < m) { + const double x = pself[k]; + + do { + while (pself[i] < x) i++; + while (x < pself[j]) j--; + if (i <= j) { + IRPLIB_SWAP_DOUBLE(pself[i], pself[j]); + i++; j--; + } + } while (i <= j); + + assert( j < i ); + + /* The original implementation has two index comparisons and + two, three or four index assignments. This has been reduced + to one or two index comparisons and two index assignments. + */ + + if (k <= j) { + assert( k < i ); + m = j; + i = l; + } else { + if (k < i) { + m = j; + } else { + j = m; + } + l = i; + } + } +} diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_utils.h cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_utils.h --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_utils.h 2014-06-06 12:23:07.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_utils.h 2017-09-18 13:05:17.000000000 +0000 @@ -71,11 +71,29 @@ #include /*----------------------------------------------------------------------------- - Define + Defines -----------------------------------------------------------------------------*/ -#define IRPLIB_XSTRINGIFY(TOSTRING) #TOSTRING -#define IRPLIB_STRINGIFY(TOSTRING) IRPLIB_XSTRINGIFY(TOSTRING) +/* Concatenate two macro arguments */ +#define IRPLIB_CONCAT(a,b) a ## _ ## b +#define IRPLIB_CONCAT2X(a,b) IRPLIB_CONCAT(a,b) + +/*----------------------------------------------------------------------------*/ +/* + @brief Swap two double values + @param A The 1st double to swap + @param B The 2nd double to swap + @note A and B are evaluated twice, so side-effects should be avoided +*/ +/*----------------------------------------------------------------------------*/ +#define IRPLIB_SWAP_DOUBLE(A, B) do { \ + const double irplib_swap_double=(A); \ + (A)=(B); \ + (B)=irplib_swap_double; \ + } while (0) + +#define IRPLIB_XSTRINGIFY CPL_XSTRINGIFY +#define IRPLIB_STRINGIFY CPL_STRINGIFY #if !defined __GNUC__ && !defined __inline__ #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L @@ -85,31 +103,21 @@ #endif #endif -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) -#define IRPLIB_DIAG_PRAGMA_PUSH_IGN(x) \ - _Pragma("GCC diagnostic push") \ - _Pragma(IRPLIB_STRINGIFY(GCC diagnostic ignored #x)) -#define IRPLIB_DIAG_PRAGMA_PUSH_ERR(x) \ - _Pragma("GCC diagnostic push") \ - _Pragma(IRPLIB_STRINGIFY(GCC diagnostic error #x)) -#define IRPLIB_DIAG_PRAGMA_POP \ - _Pragma("GCC diagnostic pop") -#else -#define IRPLIB_DIAG_PRAGMA_PUSH_IGN(x) -#define IRPLIB_DIAG_PRAGMA_PUSH_ERR(x) -#define IRPLIB_DIAG_PRAGMA_POP -#endif - +#define IRPLIB_DIAG_PRAGMA_PUSH_IGN CPL_DIAG_PRAGMA_PUSH_IGN +#define IRPLIB_DIAG_PRAGMA_PUSH_ERR CPL_DIAG_PRAGMA_PUSH_ERR +#define IRPLIB_DIAG_PRAGMA_POP CPL_DIAG_PRAGMA_POP /* FIXME: Remove when no longer used by any irplib-based pipelines */ /* Useful for debugging */ -#define irplib_trace() do if (cpl_error_get_code()) { \ - cpl_msg_debug(cpl_func, __FILE__ " at line %d: ERROR '%s' at %s", \ - __LINE__, cpl_error_get_message(), cpl_error_get_where()); \ - } else { \ - cpl_msg_debug(cpl_func, __FILE__ " at line %d: OK", __LINE__); \ - } while (0) - +#define irplib_trace() do if (cpl_error_get_code()) { \ + cpl_msg_debug(cpl_func, __FILE__ " at line " \ + CPL_STRINGIFY(__LINE__) ": ERROR '%s' at %s", \ + cpl_error_get_message(), cpl_error_get_where()); \ + } else { \ + cpl_msg_debug(cpl_func, __FILE__ " at line " \ + CPL_STRINGIFY(__LINE__) ": OK"); \ + } while (0) + #define irplib_error_recover(ESTATE, ...) \ do if (!cpl_errorstate_is_equal(ESTATE)) { \ cpl_msg_warning(cpl_func, __VA_ARGS__); \ @@ -291,16 +299,16 @@ @note end_skip should be used exactly once in functions that use skip_if() etc */ /*----------------------------------------------------------------------------*/ -#define end_skip \ - do { \ - cleanup: \ - if (cpl_error_get_code()) \ - cpl_msg_debug(cpl_func, "Cleanup in " __FILE__ " line %u with " \ - "error '%s' at %s", __LINE__, \ - cpl_error_get_message(), cpl_error_get_where()); \ - else \ - cpl_msg_debug(cpl_func, "Cleanup in " __FILE__ " line %u", \ - __LINE__); \ +#define end_skip \ + do { \ + cleanup: \ + if (cpl_error_get_code()) \ + cpl_msg_debug(cpl_func, "Cleanup in " __FILE__ " line " \ + CPL_STRINGIFY(__LINE__) " with error '%s' at %s", \ + cpl_error_get_message(), cpl_error_get_where()); \ + else \ + cpl_msg_debug(cpl_func, "Cleanup in " __FILE__ " line " \ + CPL_STRINGIFY(__LINE__)); \ } while (0) @@ -352,16 +360,16 @@ */ /*----------------------------------------------------------------------------*/ -#define irplib_check(COMMAND, ...) \ - do { \ - cpl_errorstate irplib_check_prestate = cpl_errorstate_get(); \ - skip_if(0); \ - COMMAND; \ - irplib_trace(); \ - irplib_ensure(cpl_errorstate_is_equal(irplib_check_prestate), \ - cpl_error_get_code(), __VA_ARGS__); \ - irplib_trace(); \ - } while (0) +#define irplib_check(COMMAND, ...) \ + do { \ + cpl_errorstate irplib_check_prestate = cpl_errorstate_get(); \ + skip_if(0); \ + COMMAND; \ + irplib_trace(); \ + irplib_ensure(cpl_errorstate_is_equal(irplib_check_prestate), \ + cpl_error_get_code(), __VA_ARGS__); \ + irplib_trace(); \ + } while (0) /*----------------------------------------------------------------------------- Function prototypes @@ -517,6 +525,9 @@ const cpl_frame * irplib_frameset_get_next_const(cpl_frameset_iterator *iterator); + +void irplib_vector_get_kth(cpl_vector *, cpl_size); + /*----------------------------------------------------------------------------- Function inlines -----------------------------------------------------------------------------*/ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_wavecal.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_wavecal.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_wavecal.c 2014-12-02 16:37:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_wavecal.c 2018-01-25 09:32:20.000000000 +0000 @@ -30,8 +30,6 @@ /* Needed for irplib_errorstate_dump_debug() */ #include "irplib_utils.h" -#include - #include #include @@ -1013,19 +1011,20 @@ /*----------------------------------------------------------------------------*/ /** - @brief Generate a 1D spectrum from (arc) lines and a dispersion relation - @param self Vector to fill with spectrum - @param linepix Vector to update with best guess of line pixel position - @param disp 1D-Dispersion relation, at least of degree 1 - @param lines Catalogue of lines, with increasing wavelengths - @param wslit Positive width of the slit - @param wfwhm Positive FWHM of the transfer function - @param xtrunc Truncate the line profile beyond distance xtrunc, xtrunc > 0 - @param hsize The 1st intensity in self will be disp(1-hsize), hsize >= 0 - @param dofast Iff true compose profile from pairs of two integer-placed - @param dolog Iff true log(1+I) is used for the (positive) intensities - @param pulines Iff non-NULL, number of lines used, on success - @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code + @brief Generate a 1D spectrum from (arc) lines and a dispersion relation + @param self Vector to fill with spectrum + @param linepix Vector to update with best guess of line pixel position + @param erftmp Vector with temporary buffer for erf() values + @param disp 1D-Dispersion relation, at least of degree 1 + @param lines Catalogue of lines, with increasing wavelengths + @param wslit Positive width of the slit + @param wfwhm Positive FWHM of the transfer function + @param xtrunc Truncate the line profile beyond distance xtrunc, xtrunc > 0 + @param hsize The 1st intensity in self will be disp(1-hsize), hsize >= 0 + @param dofast Iff true compose profile from pairs of two integer-placed + @param dolog Iff true log(1+I) is used for the (positive) intensities + @param pulines Iff non-NULL, number of lines used, on success + @return CPL_ERROR_NONE on success, otherwise the relevant CPL error code @see irplib_vector_fill_line_spectrum() @note This function is supposed to be called via irplib_vector_fill_line_spectrum(). diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_wcs.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_wcs.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_wcs.c 2014-12-02 16:37:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_wcs.c 2017-05-23 15:09:28.000000000 +0000 @@ -25,19 +25,18 @@ * $Name: not supported by cvs2svn $ */ -#ifdef HAVE_CONFIG_H -#include -#endif - /*----------------------------------------------------------------------------- Includes -----------------------------------------------------------------------------*/ -#include -#include +#ifdef HAVE_CONFIG_H +#include +#endif #include "irplib_wcs.h" +#include + /*----------------------------------------------------------------------------*/ /** * @defgroup irplib_wcs Functions related to WCS @@ -46,6 +45,9 @@ static cpl_error_code irplib_wcs_is_iso8601(int, int, int, int, int, double); +/* Standard year-2000 form: CCYY-MM-DD[Thh:mm:ss[.sss...]] */ +#define IRPLIB_ISO8601_FORMAT "%4d-%2d-%2dT%2d:%2d:%lf" + /**@{*/ /*----------------------------------------------------------------------------*/ @@ -237,8 +239,7 @@ const char * iso8601) { - /* Standard year-2000 form: CCYY-MM-DD[Thh:mm:ss[.sss...]] */ - const char * iso8601format = "%4d-%2d-%2dT%2d:%2d:%lf"; + int nret; cpl_ensure_code(pyear != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(pmonth != NULL, CPL_ERROR_NULL_INPUT); @@ -248,16 +249,18 @@ cpl_ensure_code(psecond != NULL, CPL_ERROR_NULL_INPUT); cpl_ensure_code(iso8601 != NULL, CPL_ERROR_NULL_INPUT); - cpl_error_ensure(sscanf(iso8601, iso8601format, pyear, pmonth, - pday, phour, pminute, psecond) == 6, - CPL_ERROR_ILLEGAL_INPUT, return cpl_error_get_code(), - "%s is not formatted as %s", iso8601, iso8601format); - - cpl_ensure_code(!irplib_wcs_is_iso8601(*pyear, *pmonth, *pday, *phour, - *pminute, *psecond), - cpl_error_get_code()); + nret = sscanf(iso8601, IRPLIB_ISO8601_FORMAT, pyear, pmonth, + pday, phour, pminute, psecond); - return CPL_ERROR_NONE; + if (nret != 6) { + return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "Parsed" + " %d != 6: input %s is not in format %s", + nret, iso8601, IRPLIB_ISO8601_FORMAT); + } + + return irplib_wcs_is_iso8601(*pyear, *pmonth, *pday, *phour, *pminute, + *psecond) + ? cpl_error_set_where(cpl_func) : CPL_ERROR_NONE; } diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_wcs.h cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_wcs.h --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_wcs.h 2010-10-07 14:10:55.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_wcs.h 2017-09-18 08:05:11.000000000 +0000 @@ -34,6 +34,10 @@ #include +/*----------------------------------------------------------------------------- + Function prototypes + -----------------------------------------------------------------------------*/ + cpl_error_code irplib_wcs_xytoradec(const cpl_wcs * wcs, double x, double y, diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_wlxcorr.c cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_wlxcorr.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/irplib_wlxcorr.c 2014-12-02 16:37:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/irplib_wlxcorr.c 2017-07-05 12:27:08.000000000 +0000 @@ -352,10 +352,10 @@ corr_poly, spec_sz, 1.0); cpl_error_code error; - cpl_msg_debug(cpl_func, "Tabel for guess dispersion polynomial (slitw=%g, " + cpl_msg_debug(cpl_func, "Table for guess dispersion polynomial (slitw=%g, " "fwhm=%g) with %d-point observed spectrum with%s catalog re" "sampling", slitw, fwhm, spec_sz, guess_resamp ? "out" : ""); - cpl_msg_debug(cpl_func, "Tabel for corr. dispersion polynomial (slitw=%g, " + cpl_msg_debug(cpl_func, "Table for corr. dispersion polynomial (slitw=%g, " "fwhm=%g) with %d-point observed spectrum with%s catalog re" "sampling", slitw, fwhm, spec_sz, corr_resamp ? "out" : ""); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/Makefile.in cpl-plugin-kmos-2.0.2+dfsg/irplib/Makefile.in --- cpl-plugin-kmos-1.4.3+dfsg/irplib/Makefile.in 2017-02-27 20:41:52.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/Makefile.in 2018-04-24 13:37:15.000000000 +0000 @@ -99,7 +99,8 @@ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4macros/molecfit.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ @@ -314,6 +315,7 @@ LIBIRPLIB = @LIBIRPLIB@ LIBKMCLIPMLIB = @LIBKMCLIPMLIB@ LIBKMOS = @LIBKMOS@ +LIBMOLECFIT = @LIBMOLECFIT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -329,6 +331,10 @@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOLECFITDIR = @MOLECFITDIR@ +MOLECFIT_CFLAGS = @MOLECFIT_CFLAGS@ +MOLECFIT_INCLUDES = @MOLECFIT_INCLUDES@ +MOLECFIT_LDFLAGS = @MOLECFIT_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -343,6 +349,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG = @PKGCONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/tests/irplib_plugin-test.c cpl-plugin-kmos-2.0.2+dfsg/irplib/tests/irplib_plugin-test.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/tests/irplib_plugin-test.c 2014-07-14 21:05:36.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/tests/irplib_plugin-test.c 2017-09-18 08:05:11.000000000 +0000 @@ -26,6 +26,7 @@ -----------------------------------------------------------------------------*/ #include +#include #include #include diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/tests/irplib_polynomial-test.c cpl-plugin-kmos-2.0.2+dfsg/irplib/tests/irplib_polynomial-test.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/tests/irplib_polynomial-test.c 2017-02-22 09:54:38.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/tests/irplib_polynomial-test.c 2017-06-01 12:59:07.000000000 +0000 @@ -264,6 +264,13 @@ irplib_polynomial_test_root_all(xtrue, nreal, 1.0, 4.0*DBL_EPSILON, 30.0*DBL_EPSILON); + (void)cpl_vector_set(xtrue, 0, 1.0); + (void)cpl_vector_set(xtrue, 1, 2.0); + (void)cpl_vector_set(xtrue, 2, 1.0); + + irplib_polynomial_test_root_all(xtrue, nreal-2, 1.0, + 4.0*DBL_EPSILON, 30.0*DBL_EPSILON); + #if MAXDEGREE > 3 nreal = 4; @@ -552,9 +559,12 @@ code = irplib_polynomial_solve_1d_all(p1d, roots, &jreal); cpl_test_eq_error(code, CPL_ERROR_NONE); + cpl_msg_info(cpl_func, "1D-polynomial of degree %d:", (int)degree); + cpl_polynomial_dump(p1d, stderr); + cpl_test_eq(jreal, nreal); if (jreal != nreal) { - cpl_msg_info(cpl_func, "1D-polynomial:"); + cpl_msg_info(cpl_func, "1D-polynomial of degree %d:", (int)degree); cpl_polynomial_dump(p1d, stderr); cpl_msg_error(cpl_func, "True roots (%" CPL_SIZE_FORMAT " real): (line=%u)", nreal, line); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/tests/irplib_strehl-test.c cpl-plugin-kmos-2.0.2+dfsg/irplib/tests/irplib_strehl-test.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/tests/irplib_strehl-test.c 2014-02-06 10:27:17.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/tests/irplib_strehl-test.c 2017-09-18 13:05:17.000000000 +0000 @@ -178,12 +178,12 @@ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); cpl_msg_info("Strehl-testing with star with ", - IRPLIB_XSTRINGIFY(IRPLIB_STREHL_STAR_RADIUS) " = " - IRPLIB_STRINGIFY(IRPLIB_STREHL_STAR_RADIUS) ". " - IRPLIB_XSTRINGIFY(IRPLIB_STREHL_BACKGROUND_R1) " = " - IRPLIB_STRINGIFY(IRPLIB_STREHL_BACKGROUND_R1) ". " - IRPLIB_XSTRINGIFY(IRPLIB_STREHL_BACKGROUND_R2) " = " - IRPLIB_STRINGIFY(IRPLIB_STREHL_BACKGROUND_R2) "."); + CPL_XSTRINGIFY(IRPLIB_STREHL_STAR_RADIUS) " = " + CPL_STRINGIFY(IRPLIB_STREHL_STAR_RADIUS) ". " + CPL_XSTRINGIFY(IRPLIB_STREHL_BACKGROUND_R1) " = " + CPL_STRINGIFY(IRPLIB_STREHL_BACKGROUND_R1) ". " + CPL_XSTRINGIFY(IRPLIB_STREHL_BACKGROUND_R2) " = " + CPL_STRINGIFY(IRPLIB_STREHL_BACKGROUND_R2) "."); irplib_strehl_test_one(); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/tests/irplib_utils-test.c cpl-plugin-kmos-2.0.2+dfsg/irplib/tests/irplib_utils-test.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/tests/irplib_utils-test.c 2014-12-02 16:37:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/tests/irplib_utils-test.c 2017-09-18 12:47:32.000000000 +0000 @@ -63,6 +63,8 @@ /* Initialize CPL for unit testing */ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING); + irplib_trace(); + test_irplib_isnaninf(); test_irplib_dfs_table_convert(); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/tests/irplib_wcs-test.c cpl-plugin-kmos-2.0.2+dfsg/irplib/tests/irplib_wcs-test.c --- cpl-plugin-kmos-1.4.3+dfsg/irplib/tests/irplib_wcs-test.c 2013-01-29 08:49:53.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/tests/irplib_wcs-test.c 2018-03-06 10:23:52.000000000 +0000 @@ -35,6 +35,7 @@ #include #include "irplib_wcs.h" +#include "math.h" /*----------------------------------------------------------------------------- Static functions @@ -43,6 +44,7 @@ static void irplib_wcs_mjd_test(void); +static void irplib_wcs_great_circle_dist_test(void); /*----------------------------------------------------------------------------- Main @@ -56,6 +58,8 @@ irplib_wcs_mjd_test(); + irplib_wcs_great_circle_dist_test(); + return cpl_test_end(0); } @@ -305,3 +309,56 @@ cpl_test_eq_error(error, CPL_ERROR_NULL_INPUT); } + +/*----------------------------------------------------------------------------*/ +/** + @internal + @brief Test the function, using trivial cases + @return void + */ +/*----------------------------------------------------------------------------*/ +static void irplib_wcs_great_circle_dist_test(void) +{ + double dist1, dist2; + + /* Commutative */ + dist1 = irplib_wcs_great_circle_dist(12.0, 34.0, 56.0, 78.0); + dist2 = irplib_wcs_great_circle_dist(56.0, 78.0, 12.0, 34.0); + cpl_test_abs(dist1, dist2, 0.0); + + for (int j = 0; j <= 360; j += 4) { + const double ra2 = CPL_MATH_E + (double)j; + + for (int i = 0; i < 180; i++) { + const double ra1 = (double)i; + const double dec1 = (double)i; + + /* Poles Apart */ + dist1 = irplib_wcs_great_circle_dist(ra2, 90.0, ra2 + ra1, -90.0); + cpl_test_abs(dist1, 180.0, 0.0); + + /* Equatorial */ + dist1 = irplib_wcs_great_circle_dist(ra2, 0.0, ra2 + ra1, 0.0); + cpl_test_abs(dist1, ra1, 2560.0 * DBL_EPSILON); + + /* "I will go on the slightest errand now to the Antipodes..." */ + dist1 = irplib_wcs_great_circle_dist(ra2, dec1, ra2 + 180.0, -dec1); + cpl_test_abs(dist1, 180.0, 30.0 * FLT_EPSILON); + + } + /* Meridional */ + for (int i = -90; i <= 90; i += 3) { + const double dec1 = (double)i; + for (int k = 0; k <= 90; k += 3) { + const double dec2 = (double)k; + + dist1 = irplib_wcs_great_circle_dist(ra2, dec1, ra2, dec2); + cpl_test_abs(dist1, fabs(dec1 - dec2), 1024.0 * DBL_EPSILON); + } + + dist1 = irplib_wcs_great_circle_dist(ra2, dec1, ra2 + 180.0, + 90.0 - dec1); + cpl_test_abs(dist1, 90.0, 512.0 * DBL_EPSILON); + } + } +} diff -Nru cpl-plugin-kmos-1.4.3+dfsg/irplib/tests/Makefile.in cpl-plugin-kmos-2.0.2+dfsg/irplib/tests/Makefile.in --- cpl-plugin-kmos-1.4.3+dfsg/irplib/tests/Makefile.in 2017-02-27 20:41:52.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/irplib/tests/Makefile.in 2018-04-24 13:37:15.000000000 +0000 @@ -104,7 +104,8 @@ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4macros/molecfit.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ @@ -528,6 +529,7 @@ LIBIRPLIB = @LIBIRPLIB@ LIBKMCLIPMLIB = @LIBKMCLIPMLIB@ LIBKMOS = @LIBKMOS@ +LIBMOLECFIT = @LIBMOLECFIT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -543,6 +545,10 @@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOLECFITDIR = @MOLECFITDIR@ +MOLECFIT_CFLAGS = @MOLECFIT_CFLAGS@ +MOLECFIT_INCLUDES = @MOLECFIT_INCLUDES@ +MOLECFIT_LDFLAGS = @MOLECFIT_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -557,6 +563,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG = @PKGCONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmclipm/include/kmclipm_rtd_image.h cpl-plugin-kmos-2.0.2+dfsg/kmclipm/include/kmclipm_rtd_image.h --- cpl-plugin-kmos-1.4.3+dfsg/kmclipm/include/kmclipm_rtd_image.h 2012-06-26 08:44:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmclipm/include/kmclipm_rtd_image.h 2018-04-10 11:16:28.000000000 +0000 @@ -32,7 +32,7 @@ extern "C" { #endif -int kmclipm_print_cal_files; +//int kmclipm_print_cal_files; /*------------------------------------------------------------------------------ * Prototypes diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmclipm/Makefile.in cpl-plugin-kmos-2.0.2+dfsg/kmclipm/Makefile.in --- cpl-plugin-kmos-1.4.3+dfsg/kmclipm/Makefile.in 2017-02-27 20:41:52.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmclipm/Makefile.in 2018-04-24 13:37:15.000000000 +0000 @@ -99,7 +99,8 @@ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4macros/molecfit.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ @@ -313,6 +314,7 @@ LIBIRPLIB = @LIBIRPLIB@ LIBKMCLIPMLIB = @LIBKMCLIPMLIB@ LIBKMOS = @LIBKMOS@ +LIBMOLECFIT = @LIBMOLECFIT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -328,6 +330,10 @@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOLECFITDIR = @MOLECFITDIR@ +MOLECFIT_CFLAGS = @MOLECFIT_CFLAGS@ +MOLECFIT_INCLUDES = @MOLECFIT_INCLUDES@ +MOLECFIT_LDFLAGS = @MOLECFIT_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -342,6 +348,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG = @PKGCONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmclipm/test/kmclipm_test_math.c cpl-plugin-kmos-2.0.2+dfsg/kmclipm/test/kmclipm_test_math.c --- cpl-plugin-kmos-1.4.3+dfsg/kmclipm/test/kmclipm_test_math.c 2014-07-24 07:36:01.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmclipm/test/kmclipm_test_math.c 2018-04-10 07:42:03.000000000 +0000 @@ -37,12 +37,12 @@ * Implementation *----------------------------------------------------------------------------*/ -void test_kmclipm_median_min() +void test_kmclipm_median_min(void) { cpl_image *img = NULL; - double ret_val = 0.0, - *dbl = NULL, - tol = 0.01; + double ret_val = 0.0; + /*double *dbl = NULL;*/ + double tol = 0.01; float *img_data = NULL; int i = 0; @@ -83,11 +83,11 @@ cpl_test_error(CPL_ERROR_NULL_INPUT); /* casted pointer to double */ - dbl = cpl_malloc(sizeof(double)); + /*dbl = cpl_malloc(sizeof(double)); *dbl = 5.5; ret_val = kmclipm_median_min((cpl_image*)dbl, NULL, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); - cpl_free(dbl); + cpl_free(dbl);*/ /* empty 1x1 image */ img = cpl_image_new(1, 1, CPL_TYPE_FLOAT); @@ -103,12 +103,12 @@ } -void test_kmclipm_median_max() +void test_kmclipm_median_max(void) { cpl_image *img = NULL; - double ret_val = 0.0, - *dbl = NULL, - tol = 0.01; + double ret_val = 0.0; + /*double *dbl = NULL;*/ + double tol = 0.01; float *img_data = NULL; int i = 0; @@ -146,11 +146,11 @@ cpl_test_error(CPL_ERROR_NULL_INPUT); /* casted pointer to double */ - dbl = cpl_malloc(sizeof(double)); + /*dbl = cpl_malloc(sizeof(double)); *dbl = 5.5; ret_val = kmclipm_median_max((cpl_image*)dbl, NULL, NULL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); - cpl_free(dbl); + cpl_free(dbl);*/ /* empty 1x1 image */ img = cpl_image_new(1, 1, CPL_TYPE_FLOAT); @@ -164,7 +164,7 @@ tol = ret_val; /* against warnings [-Wunused-but-set-variable] */ } -void test_kmclipm_is_nan_or_inf() +void test_kmclipm_is_nan_or_inf(void) { cpl_test_eq(FALSE, kmclipm_is_nan_or_inf(5.0)); cpl_test_eq(TRUE, kmclipm_is_nan_or_inf(0.0/0.0)); @@ -174,7 +174,7 @@ cpl_test_error(CPL_ERROR_NONE); } -void test_kmclipm_is_inf() +void test_kmclipm_is_inf(void) { cpl_test_eq(0, kmclipm_is_inf(5.0)); cpl_test_eq(0, kmclipm_is_inf(0.0/0.0)); @@ -189,7 +189,7 @@ @return Error code, 0 for NONE. */ -int main() +int main(void) { /* For DEVELOPERS: * to omit all CPL_MSG_INFO output, apply following statement in the shell diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmclipm/test/Makefile.in cpl-plugin-kmos-2.0.2+dfsg/kmclipm/test/Makefile.in --- cpl-plugin-kmos-1.4.3+dfsg/kmclipm/test/Makefile.in 2017-02-27 20:41:52.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmclipm/test/Makefile.in 2018-04-24 13:37:15.000000000 +0000 @@ -106,7 +106,8 @@ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4macros/molecfit.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ @@ -523,6 +524,7 @@ LIBIRPLIB = @LIBIRPLIB@ LIBKMCLIPMLIB = @LIBKMCLIPMLIB@ LIBKMOS = @LIBKMOS@ +LIBMOLECFIT = @LIBMOLECFIT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -538,6 +540,10 @@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOLECFITDIR = @MOLECFITDIR@ +MOLECFIT_CFLAGS = @MOLECFIT_CFLAGS@ +MOLECFIT_INCLUDES = @MOLECFIT_INCLUDES@ +MOLECFIT_LDFLAGS = @MOLECFIT_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -552,6 +558,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG = @PKGCONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_cpl_extensions.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_cpl_extensions.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_cpl_extensions.c 2013-06-17 07:52:26.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_cpl_extensions.c 2018-04-09 13:42:16.000000000 +0000 @@ -1421,8 +1421,8 @@ */ cpl_error_code kmo_image_divide(cpl_image *img1, const cpl_image *img2) { - float *df1 = NULL, - *df2 = NULL; + float *df1 = NULL; + const float *df2 = NULL; int x1 = 0, y1 = 0, x2 = 0, @@ -1458,7 +1458,7 @@ KMO_TRY_EXIT_IF_NULL( df1 = (float*)cpl_image_get_data(img1)); KMO_TRY_EXIT_IF_NULL( - df2 = (float*)cpl_image_get_data_const(img2)); + df2 = (const float*)cpl_image_get_data_const(img2)); for (i = 0; i < x1 * y1; i++) { df1[i] /= df2[i]; diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_debug.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_debug.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_debug.c 2014-07-23 15:16:43.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_debug.c 2018-04-09 13:42:16.000000000 +0000 @@ -728,7 +728,7 @@ Any possibly set error from cpl_plot_vector() */ cpl_error_code kmo_plot_vectors_xy(const char *pre, const char *opt, - const cpl_vector *x, const cpl_vector *y) + cpl_vector *x, cpl_vector *y) { cpl_error_code ret_error = CPL_ERROR_NONE; @@ -752,8 +752,7 @@ } KMO_TRY_EXIT_IF_NULL( - bi = cpl_bivector_wrap_vectors((cpl_vector*)x, - (cpl_vector*)y)); + bi = cpl_bivector_wrap_vectors(x, y)); KMO_TRY_EXIT_IF_ERROR( cpl_plot_bivector(pre_final, opt, NULL, bi)); @@ -788,9 +787,9 @@ Any possibly set error from cpl_plot_vector() */ cpl_error_code kmo_plot_vectors2(const char *pre, const char **opt, - const cpl_vector *x, - const cpl_vector *y1, - const cpl_vector *y2) + cpl_vector *x, + cpl_vector *y1, + cpl_vector *y2) { cpl_error_code ret_error = CPL_ERROR_NONE; @@ -814,18 +813,17 @@ } KMO_TRY_EXIT_IF_NULL( - plots[0] = cpl_bivector_wrap_vectors((cpl_vector*)x, - (cpl_vector*)y1)); + plots[0] = cpl_bivector_wrap_vectors(x, y1)); KMO_TRY_EXIT_IF_NULL( - plots[1] = cpl_bivector_wrap_vectors((cpl_vector*)x, - (cpl_vector*)y2)); + plots[1] = cpl_bivector_wrap_vectors(x, y2)); - KMO_TRY_EXIT_IF_ERROR( - cpl_plot_bivectors(pre_final, - (const char**)opt, - "", - (const cpl_bivector**)plots, - nr_plots)); + CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual); + cpl_error_code err = cpl_plot_bivectors(pre_final, opt, "", + (const cpl_bivector **)plots, + nr_plots); + CPL_DIAG_PRAGMA_POP; + + KMO_TRY_EXIT_IF_ERROR(err); int k = 0; for (k = 0; k < nr_plots; k++) { @@ -908,8 +906,7 @@ KMO_TRY_EXIT_IF_NULL( punused = cpl_array_get_data_int(unused)); - int j = 0; - for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) { + for (int j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) { switch (punused[j]) { case 0: break; @@ -947,8 +944,7 @@ sprintf(str, " "); KMO_TRY_EXIT_IF_NULL( punused = cpl_array_get_data_int(unused)); - int j = 0; - for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) { + for (int j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) { switch (punused[j]) { case 0: strcat(str, " ."); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_debug.h cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_debug.h --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_debug.h 2013-12-04 14:29:58.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_debug.h 2018-04-09 13:42:16.000000000 +0000 @@ -89,13 +89,13 @@ const cpl_vector *vector); cpl_error_code kmo_plot_vectors_xy(const char *pre, const char *opt, - const cpl_vector *x, - const cpl_vector *y); + cpl_vector *x, + cpl_vector *y); cpl_error_code kmo_plot_vectors2(const char *pre, const char **opt, - const cpl_vector *x, - const cpl_vector *y1, - const cpl_vector *y2); + cpl_vector *x, + cpl_vector *y1, + cpl_vector *y2); cpl_error_code kmo_plot_image(const char *pre, const char *opt, const cpl_image *image); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_dfs.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_dfs.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_dfs.c 2016-12-08 13:22:55.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_dfs.c 2018-04-20 09:41:58.000000000 +0000 @@ -34,6 +34,7 @@ #include "kmclipm_math.h" #include "kmo_dfs.h" +#include "kmos_pfits.h" #include "kmo_utils.h" #include "kmo_error.h" #include "kmo_constants.h" @@ -42,7 +43,32 @@ /*----------------------------------------------------------------------------- * Static *----------------------------------------------------------------------------*/ + +static int kmos_idp_is_valid(const cpl_image * ima) ; +static int kmos_idp_get_valid_planes( + const cpl_imagelist * cube_combined_error, + int * first, + int * last) ; static char * kmo_dfs_create_filename(const char *, const char *, const char *); +static int kmos_idp_add_files_infos( + cpl_propertylist * plist, + cpl_frameset * fset, + const char * raw_tag) ; +static double kmos_idp_compute_mjd_end( + cpl_frameset * fset, + const char * raw_tag) ; +static cpl_matrix * kmos_muse_matrix_new_gaussian_2d( + int aXHalfwidth, + int aYHalfwidth, + double aSigma) ; +static cpl_image * kmos_muse_convolve_image( + const cpl_image * aImage, + const cpl_matrix * aKernel) ; +static double kmos_muse_idp_compute_abmaglimit( + const cpl_imagelist * aCube, + double aWlenMin, + double aWlenMax, + double aFwhm) ; /*----------------------------------------------------------------------------*/ /** @@ -365,7 +391,7 @@ "Not all input data is provided!"); KMO_TRY_ASSURE(device >= 0, CPL_ERROR_ILLEGAL_INPUT, "device number is negative!"); - KMO_TRY_ASSURE((noise >= 0) || (noise <= 2), CPL_ERROR_ILLEGAL_INPUT, + KMO_TRY_ASSURE(noise >= 0 && noise <= 2, CPL_ERROR_ILLEGAL_INPUT, "noise must be 0, 1 or 2!"); frame = kmo_dfs_get_frame(frameset, category); @@ -387,7 +413,7 @@ KMO_CATCH_MSG(); cpl_image_delete(img); img = NULL; if (nr_sat != NULL) { - nr_sat = 0; + *nr_sat = 0; } } return img; @@ -460,7 +486,7 @@ KMO_CATCH_MSG(); cpl_image_delete(img); img = NULL; if (nr_sat != NULL) { - nr_sat = 0; + *nr_sat = 0; } } return img; @@ -512,7 +538,7 @@ "Not all input data is provided!"); KMO_TRY_ASSURE(device >= 0, CPL_ERROR_ILLEGAL_INPUT, "device number is negative!"); - KMO_TRY_ASSURE((noise >= 0) || (noise <= 2), CPL_ERROR_ILLEGAL_INPUT, + KMO_TRY_ASSURE(noise >= 0 && noise <= 2, CPL_ERROR_ILLEGAL_INPUT, "noise must be 0, 1 or 2!"); frame = kmo_dfs_get_frame(frameset, category); @@ -533,7 +559,7 @@ KMO_CATCH_MSG(); cpl_image_delete(img); img = NULL; if (nr_sat != NULL) { - nr_sat = 0; + *nr_sat = 0; } } return img; @@ -576,7 +602,7 @@ "Not all input data is provided!"); KMO_TRY_ASSURE(device >= 0, CPL_ERROR_ILLEGAL_INPUT, "device number is negative!"); - KMO_TRY_ASSURE((noise >= 0) || (noise <= 2), CPL_ERROR_ILLEGAL_INPUT, + KMO_TRY_ASSURE(noise >= 0 && noise <= 2, CPL_ERROR_ILLEGAL_INPUT, "noise must be 0, 1 or 2!"); index = kmo_identify_index(cpl_frame_get_filename(frame), device, @@ -602,7 +628,7 @@ KMO_CATCH_MSG(); cpl_image_delete(img); img = NULL; if (nr_sat != NULL) { - nr_sat = 0; + *nr_sat = 0; } } @@ -833,7 +859,7 @@ KMO_CATCH_MSG(); cpl_image_delete(img); img = NULL; if (nr_sat != NULL) { - nr_sat = 0; + *nr_sat = 0; } } if (img2 != NULL) {cpl_image_delete(img2); img2 = NULL;} @@ -888,7 +914,7 @@ "Not all input data is provided!"); KMO_TRY_ASSURE(device >= 0, CPL_ERROR_ILLEGAL_INPUT, "device number is negative!"); - KMO_TRY_ASSURE((noise >= 0) || (noise <= 2), CPL_ERROR_ILLEGAL_INPUT, + KMO_TRY_ASSURE(noise >= 0 && noise <= 2, CPL_ERROR_ILLEGAL_INPUT, "noise must be 0, 1 or 2!"); index = kmo_identify_index(cpl_frame_get_filename(frame), device,noise); @@ -914,7 +940,7 @@ KMO_CATCH_MSG(); cpl_image_delete(img); img = NULL; if (nr_sat != NULL) { - nr_sat = 0; + *nr_sat = 0; } } @@ -1074,44 +1100,6 @@ /*----------------------------------------------------------------------------*/ /** - @brief Generate output filename.. - @param path The path to save the file to - @param category The category to save the file with. - @param suffix Any suffix to the category. - @return the filename, has to be deallocated again. - Add suffix, category etc.. -*/ -/*----------------------------------------------------------------------------*/ -static char * kmo_dfs_create_filename( - const char * path, - const char * category, - const char * suffix) -{ - char *filename = NULL, - *tmpstr = NULL; - - KMO_TRY - { - KMO_TRY_ASSURE((path != NULL) && (category != NULL) && (suffix != NULL), - CPL_ERROR_NULL_INPUT, "Not all input data is provided!"); - - // setup path - KMO_TRY_EXIT_IF_NULL(tmpstr = cpl_sprintf("%s", category)); - KMO_TRY_EXIT_IF_NULL( - filename = cpl_sprintf("%s%s%s%s", path, tmpstr, suffix, ".fits")); - cpl_free(tmpstr); tmpstr = NULL; - KMO_TRY_CHECK_ERROR_STATE(); - } - KMO_CATCH - { - KMO_CATCH_MSG(); - cpl_free(filename); filename = NULL; - } - return filename; -} - -/*----------------------------------------------------------------------------*/ -/** @brief Generate suffix for output filename. @param frame The frame to get the grating and rotator angle from. @param grating TRUE if grating information should be added, FALSE otherwise. @@ -1232,6 +1220,7 @@ { char *filenameAll = NULL, *clean_suffix = NULL, + *my_prodcatg = NULL, *my_procatg = NULL; cpl_error_code ret_error = CPL_ERROR_NONE; cpl_propertylist *tmp_header = NULL; @@ -1257,22 +1246,44 @@ KMO_TRY_EXIT_IF_NULL(tmp_header=cpl_propertylist_duplicate(header)); } - if (!strncmp(filename, "COMBINE_SCI_RECONSTRUCTED", 25)) { - /* DFS-6227 */ - /* TRICK to fix the PROCATG=COMBINE_SCI_RECONSTRUCTED_030 */ - /* -------------> PROCATG=COMBINE_SCI_RECONSTRUCTED */ - my_procatg = cpl_sprintf("COMBINE_SCI_RECONSTRUCTED") ; - } else if (!strncmp(filename, "EXP_MASK_SCI_RECONSTRUCTED", 26)) { - /* DFS-6276 */ - /* TRICK to fix the PROCATG=EXP_MASK_SCI_RECONSTRUCTED_030 */ - /* -------------> PROCATG=EXP_MASK_SCI_RECONSTRUCTED */ - my_procatg = cpl_sprintf("EXP_MASK_SCI_RECONSTRUCTED") ; + /* NOTE: Modified to accept SINGLE_CUBES in kmos_combine (PIPE-7566) */ + if ( !strncmp(filename, COMBINED_RECONS, strlen(COMBINED_RECONS )) || + !strncmp(filename, COMBINED_SINGLE_CUBES, strlen(COMBINED_SINGLE_CUBES)) ){ + + /* DFS-6227 */ + /* TRICK to fix the PROCATG=COMBINED_RECONS"_030" */ + /* -------------> PROCATG=COMBINED_RECONS */ + + my_procatg = cpl_sprintf(COMBINED_CUBE); + + } else if ( !strncmp(filename, EXP_MASK_RECONS, strlen(EXP_MASK_RECONS )) || + !strncmp(filename, EXP_MASK_SINGLE_CUBES, strlen(EXP_MASK_SINGLE_CUBES)) ){ + + /* DFS-6276 */ + /* TRICK to fix the PROCATG=EXP_MASK_RECONS"_030" */ + /* -------------> PROCATG=EXP_MASK_RECONS */ + + my_procatg = cpl_sprintf(EXP_MASK) ; + my_prodcatg = cpl_sprintf("ANCILLARY.EXPMAP") ; + + } else if ( !strcmp(filename, RECONSTRUCTED_CUBE) ){ + + my_procatg = cpl_sprintf(RECONSTRUCTED_CUBE) ; + my_prodcatg = cpl_sprintf("ANCILLARY.KMOS.SCI_RECONSTRUCTED") ; + } else { + my_procatg = cpl_strdup(filename) ; } - KMO_TRY_EXIT_IF_ERROR( - cpl_propertylist_update_string(tmp_header, CPL_DFS_PRO_CATG, - my_procatg)); + + cpl_propertylist_update_string(tmp_header, CPL_DFS_PRO_CATG,my_procatg); + if (my_prodcatg != NULL) { + cpl_propertylist_update_string(tmp_header, KEY_PRODCATG, + my_prodcatg); + cpl_free(my_prodcatg) ; + cpl_propertylist_set_comment(tmp_header, KEY_PRODCATG, + KEY_PRODCATG_COMMENT); + } cpl_free(my_procatg) ; KMO_TRY_EXIT_IF_ERROR( @@ -1522,6 +1533,687 @@ /*----------------------------------------------------------------------------*/ /** + @brief + @param + @return +*/ +/*----------------------------------------------------------------------------*/ +double kmos_idp_compute_abmaglim( + cpl_imagelist * datacube, + double sky_res, + const cpl_propertylist * plist) +{ + double wave_min, wave_max, crval3, cd3_3, crpix3; + int naxis3 ; + + /* Check Entries */ + if (datacube == NULL || plist == NULL) return -1.0 ; + if (sky_res < 0.0) return -1.0 ; + + /* Compute wave_min/max */ + crval3 = kmos_pfits_get_crval3(plist) ; + cd3_3 = kmos_pfits_get_cd3_3(plist) ; + crpix3 = kmos_pfits_get_crpix3(plist) ; + naxis3 = kmos_pfits_get_naxis3(plist) ; + if (cpl_error_get_code() != CPL_ERROR_NONE) { + cpl_error_reset() ; + cpl_msg_error(__func__, "Cannot Compute ABMAGLIM") ; + return -1.0 ; + } + wave_min = crval3 ; + wave_max = crval3 + cd3_3 * naxis3 - (crpix3-1) * cd3_3 ; + + /* Convert Microns to Angstroms */ + wave_min *= 1e4 ; + wave_max *= 1e4 ; + + return + kmos_muse_idp_compute_abmaglimit(datacube, wave_min, wave_max, sky_res); +} + +/*----------------------------------------------------------------------------*/ +/** + @brief Compute the AB magnitude limit + @param aCube Data cube for which the magnitude limit is computed. + @param aWlenMin Lower limit of the wavelength range [Angstrom]. + @param aWlenMax Upper limit of the wavelength range [Angstrom]. + @param aFwhm FWHM to use for the convolution filter. + @return The estimate of the AB magnitude limit. + */ +/*----------------------------------------------------------------------------*/ +static double kmos_muse_idp_compute_abmaglimit( + const cpl_imagelist * aCube, + double aWlenMin, + double aWlenMax, + double aFwhm) +{ + cpl_ensure(aCube != NULL, CPL_ERROR_NULL_INPUT, 0.); + cpl_ensure(aWlenMax > aWlenMin, CPL_ERROR_ILLEGAL_INPUT, 0.); + cpl_ensure(aFwhm > 0., CPL_ERROR_ILLEGAL_INPUT, 0.); + + /* Initialise */ + double kMuseFluxUnitFactor = 1.0 ; + + /* Minimum number of valid data pixel needed to perform the computation * + * of the magnitude limit. This is given by using the standard deviation * + * in the computation of the limiting magnitude */ + const cpl_size min_valid = 2; + + /* Create white light image and encode all invalid pixels as NaN for * + * the following analysis. */ + cpl_image * fov ; + kmclipm_make_image(aCube, NULL, &fov, NULL, NULL, DEF_REJ_METHOD, + DEF_POS_REJ_THRES, DEF_NEG_REJ_THRES, DEF_ITERATIONS, + DEF_NR_MIN_REJ, DEF_NR_MAX_REJ); + + cpl_size nx = cpl_image_get_size_x(fov); + cpl_size ny = cpl_image_get_size_y(fov); + + /* Debug Message */ + if (cpl_msg_get_level() == CPL_MSG_DEBUG) + cpl_image_save(fov, "collapse.fits", CPL_TYPE_FLOAT, NULL, + CPL_IO_CREATE) ; + + /* Get median pixel value ignoring bad pixel values (NaN) */ + cpl_image_reject_value(fov, CPL_VALUE_NOTFINITE); +#undef USE_HISTOGRAM +#ifndef USE_HISTOGRAM + double median = cpl_image_get_median(fov); +#else + double sigma = 0; + double median = cpl_image_get_mad(fov, &sigma); +#endif + + /* Create cleaned FOV image from the original image using only * + * pixels which have less intensity than the median. All invalid * + * pixels are recorded in a mask image. To prepare for the following * + * convolution step the image is also cropped to an even number of * + * pixels along both axes (if needed). */ + cpl_size _nx = (nx % 2) == 0 ? nx : nx - 1; + cpl_size _ny = (ny % 2) == 0 ? ny : ny - 1; + cpl_size npixel = _nx * _ny; + + cpl_image *fov_clean = cpl_image_new(_nx, _ny, CPL_TYPE_DOUBLE); + cpl_image_fill_window(fov_clean, 1, 1, _nx, _ny, median); + + cpl_mask *fov_invalid = cpl_mask_new(_nx, _ny); + cpl_binary *_fov_invalid = cpl_mask_get_data(fov_invalid); + + const float *_fov_data = cpl_image_get_data_float(fov); + double *_fov_clean = cpl_image_get_data_double(fov_clean); + + cpl_size iy; + for (iy = 0; iy < _ny; ++iy) { + cpl_size ix; + for (ix = 0; ix < _nx; ++ix) { + cpl_size _ipixel = nx * iy + ix; + if ((isnan(_fov_data[_ipixel]) == 0) && + (_fov_data[_ipixel] < median)) { + _fov_clean[_nx * iy + ix] = _fov_data[_ipixel]; + } else { + _fov_invalid[_nx * iy + ix] = CPL_BINARY_1; + } + } + } + cpl_image_delete(fov); + + /* Debug Message */ + if (cpl_msg_get_level() == CPL_MSG_DEBUG) + cpl_image_save(fov_clean, "collapse_clean.fits", CPL_TYPE_FLOAT, NULL, + CPL_IO_CREATE) ; + + /* Convolve the valid image with a Gaussian normalized to 1 at the peak. * + * kmos_muse_matrix_new_gaussian_2d() creates a 2d Gaussian normalized * + * such the integral (the total sum of the elements) is 1. It needs to be * + * renormalized. The half width (radius) of the convolution box is set to * + * 3 sigma. */ + const double csigma = aFwhm / (2. * sqrt(2. * log(2.))); + const double radius = CPL_MAX(3. * csigma, 2.001); + const int nhalf = (int)(radius + 0.5); + cpl_matrix *ckernel = kmos_muse_matrix_new_gaussian_2d(nhalf,nhalf,csigma); + cpl_matrix_divide_scalar(ckernel, cpl_matrix_get_max(ckernel)); + + cpl_image *fov_smooth = kmos_muse_convolve_image(fov_clean, ckernel); + cpl_matrix_delete(ckernel); + cpl_image_delete(fov_clean); + if (fov_smooth == NULL) { + cpl_error_reset() ; + cpl_mask_delete(fov_invalid); + cpl_msg_error(__func__, "Cannot convolve the image") ; + return -1 ; + } + + /* Debug Message */ + if (cpl_msg_get_level() == CPL_MSG_DEBUG) + cpl_image_save(fov_smooth, "collapse_clean_convolved.fits", + CPL_TYPE_FLOAT, NULL, CPL_IO_CREATE) ; + + + /* Perform a morphological dilation on the mask to create an additional * + * border of masked pixels around the already masked areas. This should * + * invalidated pixels in the smoothed image which are affected by border * + * effects during the convolution. */ + cpl_size nmask = 2 * nhalf + 1; + cpl_mask *mkernel = cpl_mask_new(nmask, nmask); + cpl_binary *_mkernel = cpl_mask_get_data(mkernel); + double rsquare = radius * radius; + + for (iy = 0; iy < nmask; ++iy) { + cpl_size ix; + double y = (double)iy - radius; + for (ix = 0; ix < nmask; ++ix) { + double x = (double)ix - radius; + _mkernel[nmask * iy + ix] = ((x * x + y * y) > rsquare) ? + CPL_BINARY_0 : CPL_BINARY_1; + } + } + + cpl_mask *fov_mask = cpl_mask_new(_nx, _ny); + cpl_mask_filter(fov_mask, fov_invalid, mkernel, + CPL_FILTER_DILATION, CPL_BORDER_ZERO); + cpl_mask_delete(mkernel); + + /* The filtering of the mask leaves an nhalf pixel wide border on each * + * side of the mask image which are not flagged. These are set as masked * + * here. * + */ + cpl_binary *_fov_mask = cpl_mask_get_data(fov_mask); + cpl_size ipixel; + for (ipixel = 0; ipixel < npixel; ++ipixel) { + cpl_size _x = ipixel % _nx; + cpl_size _y = ipixel / _nx; + if (((_x < nhalf) ||(_x > (_nx - nhalf - 1))) || + ((_y < nhalf) ||(_y > (_ny - nhalf - 1)))) { + _fov_mask[_y * _nx + _x] = CPL_BINARY_1; + } + } + + /* Check whether enough valid pixels are left for the following analysis. * + * If not enough valid pixels are found revert the dilated mask to the * + * original and use this instead. */ + if (npixel - cpl_mask_count(fov_mask) < min_valid) { + cpl_msg_debug(__func__, "Number of valid pixels in the dilated mask is" + "less than 2! Falling back to the original mask!"); + cpl_mask_delete(fov_mask); + fov_mask = fov_invalid; + fov_invalid = NULL; + } else { + cpl_mask_delete(fov_invalid); + } +#ifndef USE_HISTOGRAM + const double *_fov_smooth = cpl_image_get_data_double_const(fov_smooth); + double *_fov_valid = cpl_calloc(npixel, sizeof *_fov_valid); + + cpl_size nvalid = 0; + for (ipixel = 0; ipixel < npixel; ++ipixel) { + if (_fov_mask[ipixel] == CPL_BINARY_0) { + _fov_valid[nvalid] = _fov_smooth[ipixel]; + ++nvalid; + } + } + cpl_mask_delete(fov_mask); + cpl_image_delete(fov_smooth); + + cpl_vector *fov_valid = cpl_vector_wrap(nvalid, _fov_valid); + double sdev = cpl_vector_get_stdev(fov_valid); + + cpl_vector_unwrap(fov_valid); + cpl_free(_fov_valid); + + /* Compute the AB limiting magnitude: Numerical values are from * + * converting f(nu) to f(lambda) and from the unit conversion [Jy] * + * to [erg/cm**2/s/Angstrom]: * + * f(nu) = lambda**2 / c * f(lambda), * + * f(nu)/Jy = 3.34e4 * (lambda/Angstrom)**2 * * + * f(lambda)/(erg/cm**2/s/Angstrom) * + * and the monochromatic AB magnitude * + * m_AB = -2.5 * log10(f(nu) / (3631 Jy)) */ + double zeropoint = -2.5*log10(5. * (3.34e4 * aWlenMin * aWlenMax / 3631.)); + double abmaglimit = -2.5*log10(2. * sdev / kMuseFluxUnitFactor) + zeropoint; +#else + /* Create histogram from the smoothed image of valid pixels. The bin size * + * is chosen to be 0.1 times the median absolute deviation of the pixel * + * values of the original image */ + const double hstep = 0.1 * sigma; + double hmin = cpl_image_get_min(fov_smooth); + double hmax = cpl_image_get_max(fov_smooth); + + cpl_size nbins = (hmax - hmin) / hstep + 1; + cpl_vector *bins = cpl_vector_new(nbins); + + /* To prepare for the following fit of the histogram peak use the bin * + * center as the value of the histogram bin */ + cpl_size ibin; + for (ibin = 0; ibin < nbins; ++ ibin) { + cpl_vector_set(bins, ibin, hmin + (ibin + 0.5) * hstep); + } + + cpl_vector *histogram = cpl_vector_new(nbins); + cpl_vector_fill(histogram, 0.); + double *hdata = cpl_vector_get_data(histogram); + + const double *_fov_smooth = cpl_image_get_data_double_const(fov_smooth); + for (ipixel = 0; ipixel < npixel; ++ipixel) { + if ((_fov_mask[ipixel] == CPL_BINARY_0) && + (_fov_smooth[ipixel] >= hmin) && (_fov_smooth[ipixel] <= hmax)){ + cpl_size jbin=(cpl_size)((_fov_smooth[ipixel] + fabs(hmin))/hstep); + hdata[jbin] += 1.; + } + } + cpl_mask_delete(fov_mask); + cpl_image_delete(fov_smooth); + + /* Fit a Gaussian to the histogram peak */ + double center = 0.; + double sdev = 0.; + double area = 0.; + double bckgrnd = 0.; + + cpl_fit_mode mode = CPL_FIT_CENTROID | CPL_FIT_STDEV | CPL_FIT_AREA; + cpl_errorstate status = cpl_errorstate_get(); + cpl_error_code ecode = cpl_vector_fit_gaussian(bins, NULL, histogram, NULL, + mode, ¢er, &sdev, &area, &bckgrnd, NULL, NULL, NULL); + cpl_vector_delete(histogram); + cpl_vector_delete(bins); + + double abmaglimit = 0.; + if (!cpl_errorstate_is_equal(status) && (ecode != CPL_ERROR_CONTINUE)) { + cpl_msg_debug(__func__, + "Fit of a Gaussian to the histogram peak failed"); + cpl_errorstate_set(status); + } else { + if (ecode == CPL_ERROR_CONTINUE) { + cpl_msg_debug(__func__, + "Fit of a Gaussian to the histogram peak did not converge"); + cpl_errorstate_set(status); + } + + /* Compute the AB limiting magnitude: Numerical values are from * + * converting f(nu) to f(lambda) and from the unit conversion [Jy] * + * to [erg/cm**2/s/Angstrom]: * + * f(nu) = lambda**2 / c * f(lambda), * + * f(nu)/Jy = 3.34e4 * (lambda/Angstrom)**2 * * + * f(lambda)/(erg/cm**2/s/Angstrom) * + * and the monochromatic AB magnitude * + * m_AB = -2.5 * log10(f(nu) / (3631 Jy)) */ + + double zeropoint = -2.5 * + log10(5. * (3.34e4 * aWlenMin * aWlenMax / 3631.)); + abmaglimit = -2.5 * log10(2. * sdev / kMuseFluxUnitFactor) + zeropoint; + } +#endif + return abmaglimit; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief Compute the IDP errors + @param data the data cube + @return the error cube or NULL in error case +*/ +/*----------------------------------------------------------------------------*/ +cpl_imagelist * kmos_idp_compute_error( + cpl_imagelist * data_cube) +{ + cpl_imagelist * error_cube ; + cpl_vector * vec ; + double * pvec ; + cpl_image * curr_plane ; + float * pcurr_plane ; + const cpl_image * tmp_plane ; + const float * ptmp_plane ; + cpl_size i, j, k, l, ni, nx, ny, start_plane, stop_plane ; + + /* Check Entries */ + if (data_cube == NULL) return NULL ; + + /* Initialise */ + ni = cpl_imagelist_get_size(data_cube); + + /* Create the error cube */ + error_cube = cpl_imagelist_duplicate(data_cube) ; + + /* Loop on the planes */ + for (i=0 ; i stat set to Nan */ + if (fabs(pcurr_plane[j+k*nx]) < 1e-30) + pcurr_plane[j+k*nx] = 0.0/0.0 ; + } + } + cpl_vector_delete(vec) ; + } + return error_cube ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief Derive the EXTNAME for the error extenѕion + @param extname The DATA extname + @return The newly allocated string with the error ext extname or NULL +*/ +/*----------------------------------------------------------------------------*/ +char * kmos_idp_compute_error_extname( + const char * data_extname) +{ + char new_extname[4096+1]; + char * lastdot ; + + return cpl_strdup("STAT") ; + + /* Update EXTNAME : replace DATA by ERROR */ + memset(new_extname, 0, 4096); + strcpy(new_extname, data_extname); + lastdot = strrchr(new_extname, '.'); + if (lastdot != NULL && !strcmp(lastdot, ".DATA")) { + lastdot[0] = (char)0; + return cpl_sprintf("%s.ERROR", new_extname) ; + } + return NULL ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief Add IDP keywords to the main header + @param plist Extension header to update + @return 0 if ok +*/ +/*----------------------------------------------------------------------------*/ +int kmos_idp_prepare_main_keys( + cpl_propertylist * plist, + cpl_frameset * fset, + cpl_propertylist * first_combined_ifu_ext, + const char * raw_tag, + cpl_imagelist * cube_combined_error) +{ + cpl_frame * frame ; + cpl_propertylist * main_header ; + const char * progid ; + const char * cube_unit ; + double seq1_dit, texptime, exptime, crval3, cd3_3, + crpix3, wave_min, wave_max, exp_mask_avg, mjd_end ; + int obid, naxis3, nb_comb_ifus, ncombine, + first_plane, last_plane ; + + /* Set the new PRO CATG */ + cpl_propertylist_update_string(plist, CPL_DFS_PRO_CATG, IDP_COMBINE_CUBES); + + /* Collect data from main header */ + frame = cpl_frameset_find(fset, raw_tag) ; + main_header=kmclipm_propertylist_load(cpl_frame_get_filename(frame),0); + seq1_dit = kmos_pfits_get_dit(main_header) ; + obid = kmos_pfits_get_obs_id(main_header) ; + progid = kmos_pfits_get_progid(main_header) ; + nb_comb_ifus=kmos_pfits_get_qc_combined_cubes_nb(plist) ; + + /* TEXPTIME */ + /* Number of IFUs used for combining * DET.SEQ1.DIT */ + texptime = seq1_dit * nb_comb_ifus ; + cpl_propertylist_update_double(plist, KEY_TEXPTIME, texptime); + cpl_propertylist_set_comment(plist, KEY_TEXPTIME, KEY_TEXPTIME_COMMENT); + + /* EXPTIME */ + /* DET.SEQ1.DIT * AVG(exp_map) */ + exp_mask_avg = kmos_pfits_get_qc_expmask_avg(plist) ; + exptime = seq1_dit * exp_mask_avg ; + cpl_propertylist_update_double(plist, KEY_EXPTIME, exptime); + cpl_propertylist_set_comment(plist, KEY_EXPTIME, KEY_EXPTIME_COMMENT); + + /* NCOMBINE */ + /* NCOMBINE <- Number of RAW files in fset */ + ncombine = kmos_count_raw_in_frameset(fset); + cpl_propertylist_update_int(plist, KEY_NCOMBINE, ncombine); + + /* OBID1 */ + /* OBID1 <- HIERARCH ESO OBS ID */ + cpl_propertylist_update_int(plist, KEY_OBID1, obid); + cpl_propertylist_set_comment(plist, KEY_OBID1, KEY_OBID1_COMMENT); + + /* WAVELMIN / WAVELMAX */ + crval3 = kmos_pfits_get_crval3(first_combined_ifu_ext) ; + cd3_3 = kmos_pfits_get_cd3_3(first_combined_ifu_ext) ; + crpix3 = kmos_pfits_get_crpix3(first_combined_ifu_ext) ; + naxis3 = kmos_pfits_get_naxis3(first_combined_ifu_ext) ; + + /* Use cube_combined_error to find first and last valid planes */ + first_plane = 1 ; + last_plane = naxis3 ; + if (kmos_idp_get_valid_planes(cube_combined_error, + &first_plane, &last_plane)) { + cpl_msg_warning(__func__, "Cannot identify first/last valid planes") ; + first_plane = 1 ; + last_plane = naxis3 ; + } else { + cpl_msg_debug(__func__, "First / Last : %d / %d", + first_plane, last_plane) ; + } + + /* wave_min = crval3 * 1e3 ; */ + wave_min = (crval3 + cd3_3 * (first_plane - (crpix3-0.5))) * 1e3 ; + wave_max = (crval3 + cd3_3 * (last_plane - (crpix3-0.5))) * 1e3 ; + cpl_propertylist_update_double(plist, KEY_WAVELMIN, wave_min) ; + cpl_propertylist_set_comment(plist, KEY_WAVELMIN, KEY_WAVELMIN_COMMENT); + cpl_propertylist_update_double(plist, KEY_WAVELMAX, wave_max) ; + cpl_propertylist_set_comment(plist, KEY_WAVELMAX, KEY_WAVELMAX_COMMENT); + + /* PROG_ID */ + cpl_propertylist_update_string(plist, KEY_PROG_ID, progid) ; + cpl_propertylist_set_comment(plist, KEY_PROG_ID, KEY_PROG_ID_COMMENT); + + /* MJD-END */ + mjd_end = kmos_idp_compute_mjd_end(fset, raw_tag) ; + cpl_propertylist_update_double(plist, KEY_MJDEND, mjd_end) ; + cpl_propertylist_set_comment(plist, KEY_MJDEND, KEY_MJDEND_COMMENT); + + /* PRODCATG */ + cpl_propertylist_update_string(plist, KEY_PRODCATG, "SCIENCE.CUBE.IFS") ; + cpl_propertylist_set_comment(plist, KEY_PRODCATG, KEY_PRODCATG_COMMENT); + + /* FLUXCAL */ + cube_unit = kmos_pfits_get_qc_cube_unit(first_combined_ifu_ext) ; + if (!strcmp(cube_unit, "ERG/sec/cm2/A")) { + cpl_propertylist_update_string(plist, KEY_FLUXCAL, "ABSOLUTE") ; + } else { + cpl_propertylist_update_string(plist, KEY_FLUXCAL, "UNCALIBRATED") ; + } + cpl_propertylist_set_comment(plist, KEY_FLUXCAL, KEY_FLUXCAL_COMMENT); + + /* REFERENC */ + cpl_propertylist_update_string(plist, KEY_REFERENC, "") ; + cpl_propertylist_set_comment(plist, KEY_REFERENC, KEY_REFERENC_COMMENT); + + /* OBSTECH */ + cpl_propertylist_update_string(plist, KEY_OBSTECH, "IFU") ; + cpl_propertylist_set_comment(plist, KEY_OBSTECH, KEY_OBSTECH_COMMENT); + + /* PROVi / ASSONi / ASSOMi */ + kmos_idp_add_files_infos(plist, fset, raw_tag) ; + + /* PROCSOFT */ + cpl_propertylist_update_string(plist, KEY_PROCSOFT, + PACKAGE "/" PACKAGE_VERSION) ; + cpl_propertylist_set_comment(plist, KEY_PROCSOFT, KEY_PROCSOFT_COMMENT); + + cpl_propertylist_delete(main_header) ; + return 0 ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief Add IDP keywords to the DATA extension + @param plist Extension header to update + @return 0 if ok +*/ +/*----------------------------------------------------------------------------*/ +int kmos_idp_prepare_data_keys( + cpl_propertylist * plist, + const char * error_extname, + const char * object) +{ + cpl_property * prop ; + char * my_object ; + + kmclipm_update_property_string(plist, EXTNAME, "DATA", ""); + + /* IDP Cleanup */ + cpl_propertylist_erase(plist, CDELT1); + cpl_propertylist_erase(plist, CDELT2); + cpl_propertylist_erase(plist, CDELT3); + cpl_propertylist_erase(plist, CD1_3); + cpl_propertylist_erase(plist, CD2_3); + cpl_propertylist_erase(plist, CD3_1); + cpl_propertylist_erase(plist, CD3_2); + + /* BUNIT <- HIERARCH ESO QC CUBE_UNIT */ + prop = cpl_property_duplicate( + cpl_propertylist_get_property_const(plist, "ESO QC CUBE_UNIT")) ; + cpl_property_set_name(prop, "BUNIT") ; + cpl_propertylist_append_property(plist, prop) ; + cpl_property_delete(prop) ; + + /* CSYER1 */ + cpl_propertylist_update_double(plist, KEY_CSYER1, 1.0) ; + cpl_propertylist_set_comment(plist, KEY_CSYER1, KEY_CSYER1_COMMENT) ; + + /* CSYER2 */ + cpl_propertylist_update_double(plist, KEY_CSYER2, 1.0) ; + cpl_propertylist_set_comment(plist, KEY_CSYER2, KEY_CSYER2_COMMENT) ; + + /* HDUCLASS */ + cpl_propertylist_update_string(plist, "HDUCLASS", "ESO") ; + + /* HDUDOC */ + cpl_propertylist_update_string(plist, "HDUDOC", "DICD") ; + + /* HDUVERS */ + cpl_propertylist_update_string(plist, "HDUVERS", "DICD version 6") ; + + /* HDUCLAS1 */ + cpl_propertylist_update_string(plist, "HDUCLAS1", "IMAGE") ; + + /* HDUCLAS2 */ + cpl_propertylist_update_string(plist, "HDUCLAS2", "DATA") ; + + /* ERRDATA */ + cpl_propertylist_update_string(plist, "ERRDATA", error_extname) ; + + /* OBJECT */ + my_object = cpl_sprintf("%s (DATA)", object) ; + cpl_propertylist_update_string(plist, "OBJECT", my_object) ; + cpl_free(my_object) ; + + return 0 ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief Add IDP keywords to the ERROR extension + @param plist Extension header to update + @return 0 if ok +*/ +/*----------------------------------------------------------------------------*/ +int kmos_idp_prepare_error_keys( + cpl_propertylist * plist, + const char * error_extname, + const char * data_extname, + const char * object) +{ + cpl_property * prop ; + char * my_object ; + + /* IDP Cleanup */ + cpl_propertylist_erase(plist, CDELT1); + cpl_propertylist_erase(plist, CDELT2); + cpl_propertylist_erase(plist, CDELT3); + cpl_propertylist_erase(plist, CD1_3); + cpl_propertylist_erase(plist, CD2_3); + cpl_propertylist_erase(plist, CD3_1); + cpl_propertylist_erase(plist, CD3_2); + + /* Update EXTNAME */ + kmclipm_update_property_string(plist, EXTNAME, error_extname, + "FITS extension name"); + + /* BUNIT <- HIERARCH ESO QC CUBE_UNIT */ + prop = cpl_property_duplicate( + cpl_propertylist_get_property_const(plist, "ESO QC CUBE_UNIT")) ; + cpl_property_set_name(prop, "BUNIT") ; + cpl_propertylist_append_property(plist, prop) ; + cpl_property_delete(prop) ; + + /* CSYER1 */ + cpl_propertylist_update_double(plist, KEY_CSYER1, 1.0) ; + cpl_propertylist_set_comment(plist, KEY_CSYER1, KEY_CSYER1_COMMENT) ; + + /* CSYER2 */ + cpl_propertylist_update_double(plist, KEY_CSYER2, 1.0) ; + cpl_propertylist_set_comment(plist, KEY_CSYER2, KEY_CSYER2_COMMENT) ; + + /* HDUCLASS */ + cpl_propertylist_update_string(plist, "HDUCLASS", "ESO") ; + + /* HDUDOC */ + cpl_propertylist_update_string(plist, "HDUDOC", "DICD") ; + + /* HDUVERS */ + cpl_propertylist_update_string(plist, "HDUVERS", "DICD version 6") ; + + /* HDUCLAS1 */ + cpl_propertylist_update_string(plist, "HDUCLAS1", "IMAGE") ; + + /* HDUCLAS2 */ + cpl_propertylist_update_string(plist, "HDUCLAS2", "STAT") ; + + /* SCIDATA */ + cpl_propertylist_update_string(plist, "SCIDATA", data_extname) ; + + /* HDUCLAS3 */ + cpl_propertylist_update_string(plist, "HDUCLAS3", "RMSE") ; + + /* OBJECT */ + my_object = cpl_sprintf("%s (STAT)", object) ; + cpl_propertylist_update_string(plist, "OBJECT", my_object) ; + cpl_free(my_object) ; + + return 0 ; +} + +/*----------------------------------------------------------------------------*/ +/** @brief Saving table of given category. @param table The table to save @param category The category of the image to save (is also name of file) @@ -1723,7 +2415,6 @@ { KMO_CATCH_MSG(); ret_error = cpl_error_get_code(); - cpl_free(content); content = NULL; *type = illegal_frame; *id = -1; } @@ -2279,63 +2970,84 @@ /*----------------------------------------------------------------------------*/ int kmo_dfs_set_groups(cpl_frameset * set) { - cpl_frame * frame ; - const char * tag ; - int nframes, i ; - /* Check entries */ if (set == NULL) return -1 ; /* Initialize */ - nframes = cpl_frameset_get_size(set) ; + cpl_size nframes = cpl_frameset_get_size(set) ; /* Loop on frames */ - for (i = 0 ; i < nframes ; i++) { - frame = cpl_frameset_get_position(set, i); - tag = cpl_frame_get_tag(frame); + for (cpl_size i = 0 ; i < nframes ; i++) { + cpl_frame *frame = cpl_frameset_get_position(set, i); + const char *tag = cpl_frame_get_tag(frame); if (tag == NULL) { - cpl_msg_warning(cpl_func, "Frame %d has no tag", i); - } else if (!strcmp(tag, DARK) || - !strcmp(tag, FLAT_ON) || - !strcmp(tag, FLAT_OFF) || - !strcmp(tag, ARC_ON) || - !strcmp(tag, ARC_OFF) || - !strcmp(tag, FLAT_SKY) || - !strcmp(tag, STD) || - !strcmp(tag, SCIENCE) || - !strcmp(tag, RECONSTRUCTED_CUBE) || - !strcmp(tag, KMOS_GEN_REFLINES_RAW) || - !strcmp(tag, CUBE_OBJECT) || - !strcmp(tag, CUBE_SKY) || - !strcmp(tag, COMMANDLINE)) { - /* RAW frames */ + + cpl_msg_warning(cpl_func, "Frame %lld has no tag", i); + + } else if (!strcmp(tag, DARK ) || + !strcmp(tag, FLAT_ON ) || + !strcmp(tag, FLAT_OFF ) || + !strcmp(tag, ARC_ON ) || + !strcmp(tag, ARC_OFF ) || + !strcmp(tag, FLAT_SKY ) || + !strcmp(tag, STD ) || + !strcmp(tag, SCIENCE ) || + !strcmp(tag, RECONSTRUCTED_CUBE ) || + !strcmp(tag, KMOS_GEN_REFLINES_RAW) || + !strcmp(tag, CUBE_OBJECT ) || + !strcmp(tag, CUBE_SKY ) || + !strcmp(tag, COMMANDLINE ) || + !strcmp(tag, STAR_SPEC ) || + !strcmp(tag, EXTRACT_SPEC ) || + !strcmp(tag, SINGLE_SPECTRA ) || + !strcmp(tag, SINGLE_CUBES ) || + !strcmp(tag, COMBINED_CUBE ) || + !strcmp(tag, COMBINED_IMAGE ) || + !strcmp(tag, EXP_MASK ) ){ + + /* RAW frames */ cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW); - } else if (!strcmp(tag, MASTER_DARK) || - !strcmp(tag, BADPIXEL_DARK) || - !strcmp(tag, BADPIXEL_FLAT) || - !strcmp(tag, MASTER_FLAT) || - !strcmp(tag, XCAL) || - !strcmp(tag, YCAL) || - !strcmp(tag, FLAT_EDGE) || - !strcmp(tag, ARC_LIST) || - !strcmp(tag, REF_LINES) || - !strcmp(tag, LCAL) || - !strcmp(tag, ILLUM_CORR) || - !strcmp(tag, SKYFLAT_EDGE) || - !strcmp(tag, ATMOS_MODEL) || - !strcmp(tag, SOLAR_SPEC) || - !strcmp(tag, SPEC_TYPE_LOOKUP) || - !strcmp(tag, TELLURIC) || - !strcmp(tag, TELLURIC_CORR) || - !strcmp(tag, RESPONSE) || - !strcmp(tag, OH_SPEC) || - !strcmp(tag, WAVE_BAND)) { + + } else if (!strcmp(tag, MASTER_DARK ) || + !strcmp(tag, BADPIXEL_DARK ) || + !strcmp(tag, BADPIXEL_FLAT ) || + !strcmp(tag, MASTER_FLAT ) || + !strcmp(tag, XCAL ) || + !strcmp(tag, YCAL ) || + !strcmp(tag, FLAT_EDGE ) || + !strcmp(tag, ARC_LIST ) || + !strcmp(tag, REF_LINES ) || + !strcmp(tag, LCAL ) || + !strcmp(tag, ILLUM_CORR ) || + !strcmp(tag, TELLURIC_GEN ) || + !strcmp(tag, SKYFLAT_EDGE ) || + !strcmp(tag, ATMOS_MODEL ) || + !strcmp(tag, SOLAR_SPEC ) || + !strcmp(tag, SPEC_TYPE_LOOKUP ) || + !strcmp(tag, TELLURIC ) || + !strcmp(tag, TELLURIC_CORR ) || + !strcmp(tag, RESPONSE ) || + !strcmp(tag, OH_SPEC ) || + !strcmp(tag, WAVE_BAND ) || + !strcmp(tag, KERNEL_LIBRARY ) || + !strcmp(tag, ATMOS_PARM ) || + !strcmp(tag, BEST_FIT_PARM ) || + !strcmp(tag, BEST_FIT_MODEL ) || + !strcmp(tag, TELLURIC_DATA ) ){ + /* CALIB frames */ cpl_frame_set_group(frame, CPL_FRAME_GROUP_CALIB); + + } else { + + /* unknown-frame */ + cpl_frame_set_group(frame, CPL_FRAME_GROUP_NONE); + cpl_msg_warning(cpl_func, "Frame:%d with tag:%s, unknown!", (int)i, tag); } } - return 1 ; + + return 1; } /*----------------------------------------------------------------------------*/ @@ -2447,7 +3159,7 @@ KMO_CATCH_MSG(); ret = FALSE; if (nr_sat != NULL) { - nr_sat = 0; + *nr_sat = 0; } } return ret; @@ -2781,5 +3493,428 @@ return frame; } - /** @} */ + +/*----------------------------------------------------------------------------*/ +/** + @brief Find First and last valid planes + @param cube_combined_error Error Cube + @param first [out] First valid plane + @param last [out] Last valid plane + @return 0 if ok, -1 otherwise +*/ +/*----------------------------------------------------------------------------*/ +static int kmos_idp_get_valid_planes( + const cpl_imagelist * cube_combined_error, + int * first, + int * last) +{ + cpl_size i, nima ; + int first_loc, last_loc ; + + /* Check entries */ + if (cube_combined_error == NULL || first == NULL || last == NULL) + return -1 ; + nima = cpl_imagelist_get_size(cube_combined_error) ; + if (nima <= 0) return -1 ; + + /* Loop on the planes */ + first_loc = -1 ; + for (i=0 ; i=0 ; i--) { + if (kmos_idp_is_valid(cpl_imagelist_get_const(cube_combined_error,i))){ + last_loc = i+1 ; + break ; + } + } + if (first_loc > 0 && last_loc > 0 && first_loc <= last_loc) { + *first = first_loc ; + *last = last_loc ; + return 0 ; + } + return -1 ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief Find out if a plane is valid + @param ima + @return 1 if valid, 0 if not, -1 in error case + A valid plane is where at least 50% of the pixels are not NaNs +*/ +/*----------------------------------------------------------------------------*/ +static int kmos_idp_is_valid(const cpl_image * ima) +{ + const float * pima ; + int n_nans ; + cpl_size nx, ny, i, j ; + + /* Check Entries */ + if (ima == NULL) return -1 ; + nx = cpl_image_get_size_x(ima) ; + ny = cpl_image_get_size_y(ima) ; + pima = cpl_image_get_data_float_const(ima) ; + + /* Initialise */ + n_nans = 0; + for (i=0 ; i nx*ny/2.0) return 0 ; + return 1 ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief Generate output filename.. + @param path The path to save the file to + @param category The category to save the file with. + @param suffix Any suffix to the category. + @return the filename, has to be deallocated again. + Add suffix, category etc.. +*/ +/*----------------------------------------------------------------------------*/ +static char * kmo_dfs_create_filename( + const char * path, + const char * category, + const char * suffix) +{ + char *filename = NULL, + *tmpstr = NULL; + + KMO_TRY + { + KMO_TRY_ASSURE((path != NULL) && (category != NULL) && (suffix != NULL), + CPL_ERROR_NULL_INPUT, "Not all input data is provided!"); + + // setup path + KMO_TRY_EXIT_IF_NULL(tmpstr = cpl_sprintf("%s", category)); + KMO_TRY_EXIT_IF_NULL( + filename = cpl_sprintf("%s%s%s%s", path, tmpstr, suffix, ".fits")); + cpl_free(tmpstr); tmpstr = NULL; + KMO_TRY_CHECK_ERROR_STATE(); + } + KMO_CATCH + { + KMO_CATCH_MSG(); + cpl_free(filename); filename = NULL; + } + return filename; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief + @param + @return + Max (mjd_obs + (dit/24*60*60)) +*/ +/*----------------------------------------------------------------------------*/ +static double kmos_idp_compute_mjd_end( + cpl_frameset * fset, + const char * raw_tag) +{ + cpl_frame * cur_frame ; + const char * cur_fname ; + cpl_propertylist * plist ; + double mjd_end_cur, mjd_end_max, mjd_obs, dit ; + + /* Initialise */ + mjd_end_max = -1.0 ; + + cur_frame = kmo_dfs_get_frame(fset, raw_tag); + while (cur_frame != NULL) { + /* Get header infos */ + cur_fname = cpl_frame_get_filename(cur_frame); + plist = cpl_propertylist_load(cur_fname, 0) ; + dit = kmos_pfits_get_dit(plist) ; + mjd_obs = kmos_pfits_get_pro_mjd_obs(plist) ; + cpl_propertylist_delete(plist) ; + + /* Compute current value */ + mjd_end_cur = mjd_obs + (dit/(24*60*60)) ; + + /* Update max */ + if (mjd_end_cur > mjd_end_max) mjd_end_max = mjd_end_cur ; + + /* Next candidate */ + cur_frame = kmo_dfs_get_frame(fset, NULL); + } + return mjd_end_max ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief + @param + @return +*/ +/*----------------------------------------------------------------------------*/ +static int kmos_idp_add_files_infos( + cpl_propertylist * out, + cpl_frameset * fset, + const char * raw_tag) +{ + cpl_frame * cur_frame ; + int frames_counter ; + char * key_name ; + const char * cur_fname ; + cpl_propertylist * plist ; + + /* Initialise */ + frames_counter = 1 ; + + cur_frame = kmo_dfs_get_frame(fset, raw_tag); + while (cur_frame != NULL ) { + /* ASSONi */ + cur_fname = cpl_frame_get_filename(cur_frame); + key_name = cpl_sprintf("%s%d", KEY_ASSON, frames_counter) ; + cpl_propertylist_update_string(out, key_name, + kmos_get_base_name(cur_fname)) ; + cpl_propertylist_set_comment(out, key_name, KEY_ASSON_COMMENT); + cpl_free(key_name) ; + + /* ASSOCi */ + /* + key_name = cpl_sprintf("%s%d", KEY_ASSOC, frames_counter) ; + cpl_propertylist_update_string(out, key_name, + cpl_frame_get_tag(cur_frame)) ; + cpl_propertylist_set_comment(out, key_name, KEY_ASSOC_COMMENT); + cpl_free(key_name) ; + */ + + /* ASSOMi */ + key_name = cpl_sprintf("%s%d", KEY_ASSOM, frames_counter) ; + /* cpl_propertylist_update_string(out, key_name, cksum) ; */ + /* cpl_propertylist_set_comment(out, key_name, KEY_ASSOM_COMMENT); */ + cpl_free(key_name) ; + + /* PROVi */ + /* ARCFILE of the SCI_RECONSTRUCTED files -> KMOS.2013-06-30T...*/ + plist = cpl_propertylist_load(cur_fname, 0) ; + key_name = cpl_sprintf("%s%d", KEY_PROV, frames_counter) ; + cpl_propertylist_update_string(out, key_name, + kmos_get_base_name(kmos_pfits_get_arcfile(plist))) ; + cpl_propertylist_set_comment(out, key_name, KEY_PROV_COMMENT); + cpl_free(key_name) ; + cpl_propertylist_delete(plist) ; + + /* Next candidate */ + frames_counter++ ; + cur_frame = kmo_dfs_get_frame(fset, NULL); + } + + /* Add expmap */ + /* ASSONi */ + cur_fname = kmos_pfits_get_qc_expmask_name(out); + key_name = cpl_sprintf("%s%d", KEY_ASSON, frames_counter) ; + cpl_propertylist_update_string(out, key_name,kmos_get_base_name(cur_fname)); + cpl_propertylist_set_comment(out, key_name, KEY_ASSON_COMMENT); + cpl_free(key_name) ; + + /* ASSOCi */ + /* + key_name = cpl_sprintf("%s%d", KEY_ASSOC, frames_counter) ; + cpl_propertylist_update_string(out, key_name, "EXP_MASK_SCI_RECONSTRUCTED"); + cpl_propertylist_set_comment(out, key_name, KEY_ASSOC_COMMENT); + cpl_free(key_name) ; + */ + + /* ASSOMi */ + key_name = cpl_sprintf("%s%d", KEY_ASSOM, frames_counter) ; + /* cpl_propertylist_update_string(out, key_name, cksum) ; */ + /* cpl_propertylist_set_comment(out, key_name, KEY_ASSOM_COMMENT); */ + cpl_free(key_name) ; + frames_counter ++ ; + + /* Add collapse */ + /* ASSONi */ + cur_fname = kmos_pfits_get_qc_collapse_name(out); + if (cur_fname == NULL) { + cpl_error_reset() ; + } else { + key_name = cpl_sprintf("%s%d", KEY_ASSON, frames_counter) ; + cpl_propertylist_update_string(out, + key_name,kmos_get_base_name(cur_fname)); + cpl_propertylist_set_comment(out, key_name, KEY_ASSON_COMMENT); + cpl_free(key_name) ; + + /* ASSOMi */ + key_name = cpl_sprintf("%s%d", KEY_ASSOM, frames_counter) ; + /* cpl_propertylist_update_string(out, key_name, cksum) ; */ + /* cpl_propertylist_set_comment(out, key_name, KEY_ASSOM_COMMENT); */ + cpl_free(key_name) ; + frames_counter ++ ; + } + + return 0 ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief Create a matrix that contains a normalized 2D Gaussian + @param aXHalfwidth horizontal half width of the kernel matrix + @param aYHalfwidth vertical half width of the kernel matrix + @param aSigma sigma of Gaussian function + @return The new matrix or NULL on error + + The 2*halfwidth+1 gives the size of one side of the matrix, i.e. + halfwidth=3 for a 7x7 matrix. + The created matrix has to be deallocated by cpl_matrix_delete(). + */ +/*----------------------------------------------------------------------------*/ +static cpl_matrix * kmos_muse_matrix_new_gaussian_2d( + int aXHalfwidth, + int aYHalfwidth, + double aSigma) +{ + cpl_matrix *kernel = cpl_matrix_new(2*aXHalfwidth+1, 2*aYHalfwidth+1); + if (!kernel) { + cpl_msg_error(__func__, "Could not create matrix: %s", + cpl_error_get_message()); + return NULL; + } + double sum = 0.; + int i; + for (i = -aXHalfwidth; i <= aXHalfwidth; i++) { + int j; + for (j = -aYHalfwidth; j <= aYHalfwidth; j++) { + /* set Gaussian kernel */ + double gauss = 1. / (aSigma*sqrt(2.*CPL_MATH_PI)) + * exp(-(i*i + j*j) / (2.*aSigma*aSigma)); + cpl_matrix_set(kernel, i+aXHalfwidth, j+aYHalfwidth, gauss); + sum += gauss; + } + } + /* normalize the matrix, the sum of the elements should be 1 */ + cpl_matrix_divide_scalar(kernel, sum); + return kernel; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief Compute the convolution of an image with a kernel. + @param aImage The image to convolve. + @param aKernel The convolution kernel. + @return On success the convoluted image is returned, and @c NULL if an + error occurred. + + The function convolves the input image @em aImage with the convolution + kernel @em aKernel using an FFT. If @em aImage has an odd number of pixels + along the y-axis, the last image row is discarded to make it a size even, + however, the size of @em aImage along the x-axis must be even and an + error is returned if it is not. + + @error{set CPL_ERROR_NULL_INPUT\, return NULL, a parameter is NULL} + @error{set CPL_ERROR_IVALID_TYPE\, return NULL, aImage is not if type double} + @error{set CPL_ERROR_INCOMPATIBLE_INPUT\, return NULL, invalid image size} + + */ +/*----------------------------------------------------------------------------*/ +static cpl_image * kmos_muse_convolve_image( + const cpl_image * aImage, + const cpl_matrix * aKernel) +{ + cpl_ensure(aImage && aKernel, CPL_ERROR_NULL_INPUT, NULL); + + cpl_size nx = cpl_image_get_size_x(aImage); + cpl_size ny = cpl_image_get_size_y(aImage); + cpl_size nc = cpl_matrix_get_ncol(aKernel); + cpl_size nr = cpl_matrix_get_nrow(aKernel); + + cpl_ensure(cpl_image_get_type(aImage) == CPL_TYPE_DOUBLE, + CPL_ERROR_INVALID_TYPE, NULL); + cpl_ensure(nx % 2 == 0, CPL_ERROR_INCOMPATIBLE_INPUT, NULL); + + cpl_size kstart[2] = {(nx - nc) / 2, (ny - nr) / 2}; + cpl_size kend[2] = {kstart[0] + nc, kstart[1] + nr}; + + cpl_image *kernel = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE); + double *_kernel = cpl_image_get_data_double(kernel); + + const double *_aKernel = cpl_matrix_get_data_const(aKernel); + cpl_size iy; + for (iy = 0; iy < ny; ++iy) { + cpl_size ix; + for (ix = 0; ix < nx; ++ix) { + cpl_size idx = nx * iy + ix; + cpl_boolean inside = ((ix >= kstart[0]) && (ix < kend[0])) && + ((iy >= kstart[1]) && (iy < kend[1])); + if (inside) { + _kernel[idx] = _aKernel[nc*(iy-kstart[1])+(ix-kstart[0])]; + } + } + } + + cpl_size nxhalf = nx / 2 + 1; + cpl_image *fft_image = cpl_image_new(nxhalf, ny, CPL_TYPE_DOUBLE_COMPLEX); + cpl_image *fft_kernel = cpl_image_new(nxhalf, ny, CPL_TYPE_DOUBLE_COMPLEX); + + cpl_error_code status; + status = cpl_fft_image(fft_image, aImage, CPL_FFT_FORWARD); + if (status != CPL_ERROR_NONE) { + cpl_image_delete(fft_kernel); + cpl_image_delete(fft_image); + cpl_image_delete(kernel); + cpl_error_set_message(__func__, CPL_ERROR_INCOMPATIBLE_INPUT, + "FFT of input image failed!"); + return NULL; + } + status = cpl_fft_image(fft_kernel, kernel, CPL_FFT_FORWARD); + if (status != CPL_ERROR_NONE) { + cpl_image_delete(fft_kernel); + cpl_image_delete(fft_image); + cpl_image_delete(kernel); + cpl_error_set_message(__func__, CPL_ERROR_INCOMPATIBLE_INPUT, + "FFT of convolution kernel failed!"); + return NULL; + } + cpl_image_delete(kernel); + + double complex *_fft_image = cpl_image_get_data_double_complex(fft_image); + double complex *_fft_kernel = cpl_image_get_data_double_complex(fft_kernel); + + /* Convolve the input image with the kernel. Compute the two FFTs, for * + * the image and the kernel and multiply the results. * + * * + * After the forward transform the zero frequency is stored in the 4 * + * corners of the result image, and not in the center as one may * + * expect. In order to get a correct convolution of the image the input * + * buffer of the inverse transformation must be rearranged such that * + * the zero frequency appears in the center. This is done by multiplying * + * all results at odd index positions in the buffer by -1, which * + * effectively swaps the quadrants of the frequency plane. * + * www.mvkonnik.info/2014/06/fft-ifft-and-why-do-we-need-fftshift.html */ + for (iy = 0; iy < ny; ++iy) { + cpl_size ix; + for (ix = 0; ix < nxhalf; ++ix) { + cpl_size idx = nxhalf * iy + ix; + int sign = ((ix + iy) % 2) ? -1 : 1; + _fft_image[idx] *= sign * _fft_kernel[idx] / (nx * ny); + } + } + cpl_image_delete(fft_kernel); + + cpl_image *result = cpl_image_new(nx, ny, CPL_TYPE_DOUBLE); + status = cpl_fft_image(result, fft_image, + CPL_FFT_BACKWARD | CPL_FFT_NOSCALE); + if (status != CPL_ERROR_NONE) { + cpl_image_delete(result); + cpl_image_delete(fft_image); + cpl_error_set_message(__func__, CPL_ERROR_INCOMPATIBLE_INPUT, + "Backward FFT of convolution result failed!"); + return NULL; + } + cpl_image_delete(fft_image); + + return result; +} + diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_dfs.h cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_dfs.h --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_dfs.h 2017-01-17 16:30:41.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_dfs.h 2018-04-19 13:21:41.000000000 +0000 @@ -25,14 +25,67 @@ *--------------------------------------------------------------------------*/ #include - #include "kmclipm_vector.h" - #include "kmo_utils.h" /*------------------------------------------------------------------------------ Defines -----------------------------------------------------------------------------*/ + +/* ---------------------- IDP RELATED ------------------------------------ */ +#define KEY_ASSON "ASSON" +#define KEY_ASSON_COMMENT "Associated file name" +#define KEY_ASSOC "ASSOC" +#define KEY_ASSOC_COMMENT "Associated file category" +#define KEY_ASSOM "ASSOM" +#define KEY_ASSOM_COMMENT "Associated file Md5" +#define KEY_PROV "PROV" +#define KEY_PROV_COMMENT "Originating raw science file" +#define KEY_TEXPTIME "TEXPTIME" +#define KEY_TEXPTIME_COMMENT "[s] Total integration time of exposures" +#define KEY_EXPTIME "EXPTIME" +#define KEY_EXPTIME_COMMENT "[s] Total integration time per pixel" +#define KEY_OBID1 "OBID1" +#define KEY_OBID1_COMMENT "Observation block ID" +#define KEY_WAVELMIN "WAVELMIN" +#define KEY_WAVELMIN_COMMENT "[nm] Minimum wavelength" +#define KEY_WAVELMAX "WAVELMAX" +#define KEY_WAVELMAX_COMMENT "[nm] Maximum wavelength" +#define KEY_PROG_ID "PROG_ID" +#define KEY_PROG_ID_COMMENT "ESO programme identification" +#define KEY_MJDEND "MJD-END" +#define KEY_MJDEND_COMMENT "[d] End of observations (days)" +#define KEY_PRODCATG "PRODCATG" +#define KEY_PRODCATG_COMMENT "Data product category" +#define KEY_FLUXCAL "FLUXCAL" +#define KEY_FLUXCAL_COMMENT "Type of flux calibration" +#define KEY_REFERENC "REFERENC" +#define KEY_REFERENC_COMMENT "Reference publication" +#define KEY_OBSTECH "OBSTECH" +#define KEY_OBSTECH_COMMENT "Technique for observation" +#define KEY_PROCSOFT "PROCSOFT" +#define KEY_PROCSOFT_COMMENT "ESO pipeline version" +#define KEY_ABMAGLIM "ABMAGLIM" +#define KEY_ABMAGLIM_COMMENT "5-sigma magnitude limit for point sources" +#define KEY_SKY_RES "SKY_RES" +#define KEY_SKY_RES_COMMENT "[arcsec] FWHM effective spatial resolution (measured)" +#define KEY_SKY_RERR "SKY_RERR" +#define KEY_SKY_RERR_COMMENT "[arcsec] Error of SKY_RES (estimated)" +#define KEY_SPEC_RES "SPEC_RES" +#define KEY_SPEC_RES_COMMENT "Spectral resolving power at central wavelength" +#define KEY_PIXNOISE "PIXNOISE" +#define KEY_PIXNOISE_COMMENT "[erg/s/cm**2/Angstrom] pixel-to-pixel noise" +#define KEY_CSYER1 "CSYER1" +#define KEY_CSYER1_COMMENT "[deg] Systematic error in coordinate" +#define KEY_CSYER2 "CSYER2" +#define KEY_CSYER2_COMMENT "[deg] Systematic error in coordinate" +#define KEY_CRDER3 "CRDER3" +#define KEY_CRDER3_COMMENT "" +#define KEY_NCOMBINE "NCOMBINE" + +/* ------------------ END IDP RELATED ------------------------------------ */ + + #define INSTRUMENT "INSTRUME" #define TPL_ID "ESO TPL ID" #define MAPPING8 "KMOS_spec_obs_mapping8" @@ -83,6 +136,8 @@ // kmo_illumination_flat #define FLAT_SKY_FLAT "FLAT_SKY_FLAT" // RAW #define ILLUM_CORR_FLAT "ILLUM_CORR" // CALIB +// kmos_gen_telluric +#define TELLURIC_GEN "TELLURIC_GEN" // CALIB // kmo_std_star #define STD "STD" // RAW #define TELLURIC "TELLURIC" // CALIB @@ -96,18 +151,26 @@ #define STD_CUBE "STD_CUBE" #define STAR_SPEC "STAR_SPEC" #define NOISE_SPEC "NOISE_SPEC" + // kmo_sci_red #define SCIENCE "SCIENCE" // RAW -#define COMBINED_RECONS "COMBINE_SCI_RECONSTRUCTED" -#define COMBINED_CUBE "SCI_COMBINED" -#define COMBINED_COLLAPSED "SCI_COMBINED_COLL" -#define COMBINED_RECONS_COLLAPSED "COMBINE_SCI_RECONSTRUCTED_COLL" #define RECONSTRUCTED_CUBE "SCI_RECONSTRUCTED" #define RECONSTRUCTED_COLLAPSED "SCI_RECONSTRUCTED_COLL" #define INTERIM_OBJECT_CUBE "SCI_INTERIM_OBJECT" #define INTERIM_OBJECT_SKY "SCI_INTERIM_SKY" -// kmo_multi_reconstruct -#define CUBE_MULTI "CUBE_MULTI" + +// kmos_molecfit +#define KERNEL_LIBRARY "KERNEL_LIBRARY" +// kmos_molecfit_model +#define ATMOS_PARM "ATMOS_PARM" +#define BEST_FIT_PARM "BEST_FIT_PARM" +#define BEST_FIT_MODEL "BEST_FIT_MODEL" +// kmos_molecfit_calctrans +#define TELLURIC_DATA "TELLURIC_DATA" +// kmos_molecfit_correct +#define SINGLE_SPECTRA "SINGLE_SPECTRA" +#define SINGLE_CUBES "SINGLE_CUBES" + // // other recipes @@ -116,9 +179,18 @@ #define ARITH_OP1 "ARITH_OP1" #define ARITH_OP2 "ARITH_OP2" #define ARITHMETIC "ARITHMETIC" + // kmos_combine -#define COMBINE "COMBINE" #define EXP_MASK "EXP_MASK" +#define EXP_MASK_RECONS "EXP_MASK_SCI_RECONSTRUCTED" +#define EXP_MASK_SINGLE_CUBES "EXP_MASK_SINGLE_CUBES" +#define COMBINE "COMBINE" +#define COMBINED_RECONS "COMBINE_SCI_RECONSTRUCTED" +#define COMBINED_SINGLE_CUBES "COMBINE_SINGLE_CUBES" +#define COMBINED_CUBE "COMBINED_CUBE" +#define COMBINED_IMAGE "COMBINED_IMAGE" +#define IDP_COMBINE_CUBES "IDP_COMBINED_CUBE" + // kmo_copy #define COPY "COPY" // kmo_reconstruct @@ -128,8 +200,10 @@ #define CUBE_OBJECT "CUBE_OBJECT" #define CUBE_STD "CUBE_STD" #define CUBE_SCIENCE "CUBE_SCIENCE" +#define CUBE_ACQUISITION "CUBE_ACQUISITION" #define DET_IMG_REC "DET_IMG_REC" #define OBJECT "OBJECT" // RAW +#define ACQUISITION "ACQUISITION" // RAW #define WAVE_BAND "WAVE_BAND" #define OH_SPEC "OH_SPEC" @@ -410,6 +484,35 @@ const cpl_parameterlist *parlist, const char *recipename); + +/********************* IDPs related *******************************/ +int kmos_idp_prepare_main_keys( + cpl_propertylist * plist, + cpl_frameset * fset, + cpl_propertylist * first_combined_ifu_ext, + const char * raw_tag, + cpl_imagelist * cube_combined_error) ; +int kmos_idp_prepare_data_keys( + cpl_propertylist * plist, + const char * error_extname, + const char * object) ; +int kmos_idp_prepare_error_keys( + cpl_propertylist * plist, + const char * error_extname, + const char * data_extname, + const char * object) ; +cpl_imagelist * kmos_idp_compute_error( + cpl_imagelist * data_cube) ; +char * kmos_idp_compute_error_extname( + const char * data_extname) ; +double kmos_idp_compute_abmaglim( + cpl_imagelist * datacube, + double sky_res, + const cpl_propertylist * plist) ; + +/********************************************************************/ + + cpl_error_code kmo_dfs_save_sub_header(const char *category, const char *suffix, const cpl_propertylist *pl); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_functions.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_functions.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_functions.c 2016-11-23 17:40:10.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_functions.c 2018-04-10 10:48:52.000000000 +0000 @@ -17,6 +17,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define _DEFAULT_SOURCE +#define _BSD_SOURCE + #ifdef HAVE_CONFIG_H #include #include @@ -445,71 +448,71 @@ /* Skip header */ // read first charachter and check if it is a '#' - if (fgets(tmpstr, 2, fh)) ; + fgets(tmpstr, 2, fh); while (strcmp(tmpstr, "#") != 0) { // skip rest of line - if (fgets(tmpstr, maxchar, fh)) ; + fgets(tmpstr, maxchar, fh); // read first charachter again - if (fgets(tmpstr, 2, fh)) ; + fgets(tmpstr, 2, fh); } /* Read in filenames and their indices */ while (strcmp(tmpstr, "#") == 0) { // read index - if (fscanf(fh, "%d", &(allFrameIndices[allFrameCnt]))); + fscanf(fh, "%d", &(allFrameIndices[allFrameCnt])); // skip ':' - if (fscanf(fh, "%s", tmpstr)) ; + fscanf(fh, "%2048s", tmpstr); // read filename - if (fscanf(fh, "%s", allFrameFilenames[allFrameCnt])); + fscanf(fh, "%2048s", allFrameFilenames[allFrameCnt]); // skip rest of line - if (fgets(tmpstr, maxchar, fh)) ; + fgets(tmpstr, maxchar, fh); // read first charachter again - if (fgets(tmpstr, 2, fh)) ; + fgets(tmpstr, 2, fh); allFrameCnt++; } /* Skip intermediate header (IFU 1 2 3 4....) */ // read first character and check if it is a 'f' - if (fgets(tmpstr, 2, fh)) ; + fgets(tmpstr, 2, fh); while (strcmp(tmpstr, "f") != 0) { // skip rest of line - if (fgets(tmpstr, maxchar, fh)) ; + fgets(tmpstr, maxchar, fh); // read first charachter again - if (fgets(tmpstr, 2, fh)) ; + fgets(tmpstr, 2, fh); } /* Read in indices and associations */ while (strcmp(tmpstr, "f") == 0) { // 1st line // skip 'frame' - if (fscanf(fh, "%s", tmpstr)) ; + fscanf(fh, "%2048s", tmpstr); // skip '#' - if (fscanf(fh, "%s", tmpstr)) ; + fscanf(fh, "%2048s", tmpstr); // read index - if (fscanf(fh, "%d", &(validFrameIndices[validFrameCnt]))); + fscanf(fh, "%d", &(validFrameIndices[validFrameCnt])); // skip rest of line - if (fgets(tmpstr, maxchar, fh)) ; + fgets(tmpstr, maxchar, fh); // 2nd line // skip 'type:' - if (fscanf(fh, "%s", tmpstr)) ; + fscanf(fh, "%2048s", tmpstr); for (i = 0; i < KMOS_NR_IFUS; i++) { // read type-code - if (fscanf(fh, "%s", type[validFrameCnt][i])); + fscanf(fh, "%c", type[validFrameCnt][i]); } // skip rest of line - if (fgets(tmpstr, maxchar, fh)); + fgets(tmpstr, maxchar, fh); // 3rd line // skip 'sky' - if (fscanf(fh, "%s", tmpstr)) ; + fscanf(fh, "%2048s", tmpstr); // skip 'in' - if (fscanf(fh, "%s", tmpstr)) ; + fscanf(fh, "%2048s", tmpstr); // skip '#:' - if (fscanf(fh, "%s", tmpstr)) ; + fscanf(fh, "%2048s", tmpstr); for (i = 0; i < KMOS_NR_IFUS; i++) { // read sky-index - if (fscanf(fh, "%s", tmpstr)) ; + fscanf(fh, "%2048s", tmpstr); if (strcmp(tmpstr, ".") != 0) { // valid index to sky frame (any optional /x IFU // identifier is ignored by atoi()) @@ -528,9 +531,9 @@ } } // skip rest of line - if (fgets(tmpstr, maxchar, fh)) ; + fgets(tmpstr, maxchar, fh); // read first charachter again - if (fgets(tmpstr, 2, fh)) ; + fgets(tmpstr, 2, fh); validFrameCnt++; } fclose(fh); @@ -632,6 +635,7 @@ { KMO_CATCH_MSG(); kmo_delete_objSkyStruct(obj_sky_struct); + obj_sky_struct = NULL; } cpl_free(validFrameIndices); validFrameIndices = NULL; @@ -860,6 +864,7 @@ cpl_msg_info(cpl_func, "Encountered error: %s in %s", cpl_error_get_message(), cpl_error_get_where()); kmo_delete_objSkyStruct(obj_sky_struct); + obj_sky_struct = NULL; } if (tmpFrameTable != NULL) { cpl_free(tmpFrameTable); tmpFrameTable = NULL; @@ -984,7 +989,7 @@ cpl_free(obj_sky_struct->indexStruct); obj_sky_struct->indexStruct = NULL; } - cpl_free(obj_sky_struct); obj_sky_struct = NULL; + cpl_free(obj_sky_struct); } } @@ -1009,7 +1014,11 @@ KMO_TRY { KMO_TRY_ASSURE((arm_name_struct != NULL) && (frameset != NULL), CPL_ERROR_ILLEGAL_INPUT, "Not all inputs provided"); - has_telluric = cpl_frameset_count_tags(frameset, TELLURIC); + + has_telluric = cpl_frameset_count_tags(frameset, TELLURIC_GEN); + if (has_telluric == 0) + has_telluric = cpl_frameset_count_tags(frameset, TELLURIC); + kmo_print_objSkyStruct(arm_name_struct->obj_sky_struct); cpl_msg_info("", "Object ID/IFU associations to process"); @@ -1082,7 +1091,7 @@ const char * mapping_mode, int acceptAllSky) { - armNameStruct *arm_name_struct = NULL; + armNameStruct *arm_name_struct = NULL; KMO_TRY { KMO_TRY_ASSURE((unused_ifus != NULL) && (bounds != NULL), @@ -1098,8 +1107,10 @@ KMO_CATCH { KMO_CATCH_MSG(); - kmo_delete_armNameStruct(arm_name_struct); + if (arm_name_struct) kmo_delete_armNameStruct(arm_name_struct); + return NULL; } + return arm_name_struct; } @@ -1137,7 +1148,8 @@ KMO_CATCH { KMO_CATCH_MSG(); - kmo_delete_armNameStruct(arm_name_struct); + if (arm_name_struct) kmo_delete_armNameStruct(arm_name_struct); + return NULL; } return arm_name_struct; } @@ -1199,7 +1211,9 @@ arm_name_struct->obj_sky_struct->size); } - has_telluric = cpl_frameset_count_tags(frameset, TELLURIC); + has_telluric = cpl_frameset_count_tags(frameset, TELLURIC_GEN); + if (has_telluric ==0) + has_telluric = cpl_frameset_count_tags(frameset, TELLURIC); KMO_TRY_EXIT_IF_NULL(arm_name_struct->names = cpl_calloc(arm_name_struct->size*KMOS_NR_IFUS, sizeof(char*))); @@ -1481,7 +1495,7 @@ kmo_delete_objSkyStruct((objSkyStruct*)arm_name_struct->obj_sky_struct); arm_name_struct->obj_sky_struct = NULL; - cpl_free(arm_name_struct); arm_name_struct = NULL; + cpl_free(arm_name_struct); } } @@ -2496,8 +2510,10 @@ CPL_ERROR_ILLEGAL_INPUT, "ifu_nr must be from 1 to 24!"); /* Load primary header */ - KMO_TRY_EXIT_IF_NULL( - header = kmo_dfs_load_primary_header(frameset, TELLURIC)); + header = kmo_dfs_load_primary_header(frameset, TELLURIC_GEN); + if (header == NULL) + KMO_TRY_EXIT_IF_NULL( + header = kmo_dfs_load_primary_header(frameset, TELLURIC)); /* Check if ifu_nr is a standard star */ // ESO PRO STDSTARi diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_combine.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_combine.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_combine.c 2016-11-23 16:04:07.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_combine.c 2018-04-10 09:32:28.000000000 +0000 @@ -32,15 +32,15 @@ #include "kmclipm_constants.h" #include "kmclipm_math.h" -#include "kmclipm_functions.h" #include "kmo_dfs.h" #include "kmo_error.h" #include "kmo_cpl_extensions.h" -#include "kmo_priv_combine.h" #include "kmo_priv_fit_profile.h" #include "kmo_priv_shift.h" +#include "kmo_priv_combine.h" + /*----------------------------------------------------------------------------- Functions prototypes -----------------------------------------------------------------------------*/ @@ -137,10 +137,11 @@ cpl_image * cur_img2 ; kmclipm_vector * data_vec ; float * pavg_data ; - float * pavg_noise ; + float * pavg_noise = NULL; float * pcur_img2 ; int nx, ny, nz, ix, iy, iz, rej ; - double stderr, tol, tmp_dbl ; + double std_err; + double tol, tmp_dbl ; enum combine_status status = combine_ok; /* Check inputs */ @@ -234,18 +235,18 @@ kmclipm_vector_set(data_vec, iz, 0.0/0.0); } } /* for iz = 0 */ - + std_err = 0; pavg_data[ix+iy*nx] = (float)kmos_combine_vector(data_vec, cmethod, cpos_rej, cneg_rej, citer, cmax, cmin, - &stderr, default_val, &status); + &std_err, default_val, &status); if (status == combine_rejected) { /* this pixel is invalid */ cpl_image_reject(*avg_data, ix+1, iy+1); } if (avg_noise != NULL) { - pavg_noise[ix+iy*nx] = (float)stderr; - if (status == combine_rejected || ((stderr == -1)&&(nz != 1))) { + pavg_noise[ix+iy*nx] = (float)std_err; + if (status == combine_rejected || ((std_err == -1)&&(nz != 1))) { /* This noise pixel is invalid */ cpl_image_reject(*avg_noise, ix+1, iy+1); } @@ -255,7 +256,7 @@ kmclipm_vector_delete(data_vec); /* if nz is 1, kmclipm_combine_vector() - returns default_val for stderr. We replace this by stddev(data)*/ + returns default_val for std_err. We replace this by stddev(data)*/ if ((nz == 1) && (avg_noise != NULL)) { cpl_imagelist *data_dup = cpl_imagelist_duplicate(data); cur_img2 = cpl_imagelist_get(data_dup, 0); @@ -480,8 +481,7 @@ if ((fabs(fract_part_x) > tol) || (fabs(fract_part_y) > tol)) { KMO_TRY_EXIT_IF_ERROR( kmo_priv_shift(data, noise, header_data, header_noise, - fract_part_x, fract_part_y, flux, -1, method, extrapolate, - FALSE)); + fract_part_x, fract_part_y, flux, method, extrapolate)); } else { fract_part_x = 0; fract_part_y = 0; @@ -523,7 +523,7 @@ { KMO_CATCH_MSG(); ret = cpl_error_get_code(); - x = 0; + *x = 0; } return ret; @@ -914,21 +914,20 @@ char * clean_suffix; char * ext_name ; char * fn_shifts ; - int nx, ny, nz, nx_new, ny_new, y_min, x_min, y_max, - x_max, tmp_int, nr_identified ; - double cd1_1, cd1_2, ang1, ang2, stdev, tol, stderr ; + int nx, ny, nz, nx_new, ny_new, tmp_int, nr_identified ; + double cd1_1, cd1_2, ang1, ang2, stdev, tol, std_err ; cpl_bivector * shifts ; double * pxshifts ; double * pyshifts ; double * ptmp_data_vec ; - double * ptmp_noise_vec ; + double * ptmp_noise_vec = NULL; cpl_vector * identified ; double * pidentified ; int i, ix, iy, iz ; cpl_image * img_data_tmp ; cpl_image * img_noise_tmp ; cpl_image ** data_cur_img_list ; - cpl_image ** noise_cur_img_list ; + cpl_image ** noise_cur_img_list = NULL; float * pimg_data_tmp ; float * pimg_noise_tmp ; float * pexp_mask ; @@ -1126,7 +1125,7 @@ pimg_data_tmp[ix+iy*nx_new] = kmclipm_combine_vector(kvd, kvn, cmethod, cpos_rej, cneg_rej, citer, cmax, cmin, &tmp_int, - &stdev, &stderr, 0., &combStatus); + &stdev, &std_err, 0., &combStatus); if (exp_mask != NULL) { pexp_mask[ix+iy*nx_new] = nr_identified; } @@ -1137,7 +1136,7 @@ kmclipm_vector_delete(kvd); if (noise_counter > 0) kmclipm_vector_delete(kvn); if (nr_identified > 1) { - pimg_noise_tmp[ix+iy*nx_new] = stderr; + pimg_noise_tmp[ix+iy*nx_new] = std_err; } else { // no noise value here, reject pixel cpl_image_reject(img_noise_tmp, ix+1,iy+1); @@ -1401,7 +1400,7 @@ (cmethod == "min_max" only) @param cmin Number of minimum pixel values to reject (cmethod == "min_max" only) - @param stderr (Output) The standard error of @c data_in calculated + @param std_err (Output) The standard error of @c data_in calculated with rejection. @param default_val The default value to return if all values have been rejected. @@ -1432,7 +1431,7 @@ int citer, int cmax, int cmin, - double * stderr, + double * std_err, double default_val, enum combine_status * status) { @@ -1453,9 +1452,9 @@ calc_noise = FALSE; nz = cpl_vector_get_size(data_in->data); - *status = combine_ok; - out_val = default_val; - *stderr = default_val; + *status = combine_ok; + out_val = default_val; + *std_err = default_val; data = kmclipm_vector_duplicate(data_in); size = kmclipm_vector_count_non_rejected(data); @@ -1523,9 +1522,9 @@ } if (all_rejected == TRUE) { size = 0; - out_val = default_val; - *status = combine_rejected; - *stderr = default_val; + out_val = default_val; + *status = combine_rejected; + *std_err = default_val; calc_noise = FALSE; } else { /* compute the average out of the remaining values */ @@ -1534,31 +1533,31 @@ } } } else { - out_val = default_val; - *status = combine_rejected; - *stderr = default_val; + out_val = default_val; + *status = combine_rejected; + *std_err = default_val; } - /* Compute stderr */ + /* Compute std_err */ if (calc_noise == TRUE) { size = kmclipm_vector_count_non_rejected(data); if (size > 2) { if (!strcmp(cmethod, "median")) { - *stderr = kmclipm_vector_get_stdev_median(data) / sqrt(size) ; + *std_err = kmclipm_vector_get_stdev_median(data) / sqrt(size) ; } else { - *stderr = kmclipm_vector_get_stdev(data) / sqrt(size) ; + *std_err = kmclipm_vector_get_stdev(data) / sqrt(size) ; } } else { /* error estimation on input data */ if (size == 1) { - *stderr = default_val; + *std_err = default_val; } else if (size == 2) { i = 0; while (kmclipm_vector_is_rejected(data, i)) i++; j = i+1; while (kmclipm_vector_is_rejected(data, j)) j++; - *stderr = fabs(kmclipm_vector_get(data, i, NULL) - + *std_err = fabs(kmclipm_vector_get(data, i, NULL) - kmclipm_vector_get(data, j, NULL)) / sqrt(2); } } diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_combine.h cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_combine.h --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_combine.h 2014-06-16 09:06:51.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_combine.h 2018-04-09 13:42:16.000000000 +0000 @@ -26,6 +26,9 @@ #include +#include "kmclipm_functions.h" + + /*------------------------------------------------------------------------------ * Prototypes *----------------------------------------------------------------------------*/ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_fit_profile.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_fit_profile.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_fit_profile.c 2017-02-10 14:22:49.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_fit_profile.c 2018-04-09 13:42:16.000000000 +0000 @@ -30,6 +30,13 @@ #include "kmo_cpl_extensions.h" #include "kmo_debug.h" +static int kmos_fit_lorentz_plot( + const cpl_vector * x, + const cpl_vector * y, + const cpl_vector * fit_par, + double peak_pos, + int fitted) ; + /*----------------------------------------------------------------------------*/ /** @defgroup kmos_priv_fit_profile Helper functions for recipe kmo_fit_profile @@ -67,9 +74,9 @@ @li CPL_ERROR_ILLEGAL_INPUT if the provided @c method is incorrect or if x1 is too small or x2 too large. */ -cpl_vector* kmo_fit_profile_1D(const cpl_vector *lambda_in, +cpl_vector* kmo_fit_profile_1D(cpl_vector *lambda_in, const cpl_vector *data_in, - const cpl_vector *noise_in, + cpl_vector *noise_in, const char *method, cpl_vector **data_out, cpl_propertylist **pl) @@ -78,6 +85,7 @@ double *pfit_pars = NULL, max_val = 0.0, + min_val = 0.0, max_pos = 0, *pdata_out = NULL, result = 0.0, @@ -121,6 +129,7 @@ kmo_vector_get_maxpos_old(data_in, &tmp_int)); max_pos = cpl_vector_get(lambda_in, tmp_int); max_val = cpl_vector_get_max(data_in); + min_val = cpl_vector_get_min(data_in); // calculate fit parameters if (strcmp(method, "gauss") == 0) { @@ -153,7 +162,7 @@ fit_pars = kmo_vector_fit_lorentz(lambda_in, data_in, noise_in, max_pos, max_val, - pl, FALSE)); + min_val, pl, FALSE)); } // calculate fitted function to return @@ -394,7 +403,7 @@ */ cpl_vector* kmo_vector_fit_gauss(const cpl_vector *x, const cpl_vector *y, - const cpl_vector *noise, + cpl_vector *noise, double max_pos, cpl_propertylist **pl) { @@ -431,7 +440,7 @@ KMO_TRY_EXIT_IF_ERROR( cpl_vector_fill(sigma_y, 1.0)); } else { - sigma_y = (cpl_vector*)noise; + sigma_y = noise; } KMO_TRY_EXIT_IF_ERROR( @@ -570,8 +579,8 @@ @li CPL_ERROR_NULL_INPUT if @c x or @c y is NULL. @li CPL_ERROR_ILLEGAL_INPUT if @c x and @c y don't have the same length. */ -cpl_vector* kmo_vector_fit_moffat(const cpl_vector *x, const cpl_vector *y, - const cpl_vector *noise, +cpl_vector* kmo_vector_fit_moffat(cpl_vector *x, const cpl_vector *y, + cpl_vector *noise, double max_pos, double max_val, cpl_propertylist **pl) { @@ -614,7 +623,7 @@ //kmo_debug_vector(fit_par); KMO_TRY_EXIT_IF_NULL( x_mat = cpl_matrix_wrap(cpl_vector_get_size(x), 1, - (double*)cpl_vector_get_data_const(x))); + cpl_vector_get_data(x))); // if no noise is provided, create a sigma-vector filled with ones if (noise == NULL) { @@ -623,7 +632,7 @@ KMO_TRY_EXIT_IF_ERROR( cpl_vector_fill(sigma_y, 1.0)); } else { - sigma_y = (cpl_vector*)noise; + sigma_y = noise; } fit_error = cpl_fit_lvmq(x_mat, NULL, @@ -775,263 +784,231 @@ return fit_par; } +/*----------------------------------------------------------------------------*/ /** - @brief - Fits a lorentz function to vectors. - - @param x The x data vector. - @param y The y data vector. - @param noise The associated noise. - @param max_pos The position of the maximum value. (If CRPIX, CDELT and - CRVAL are provided, max_pos is a spectral value. Otherwise - a pixel value). Needed as initial estimate. - @param max_val The maximum value. Needed as initial estimate. - @param pl (Optinal output) If @c pl is non-null, a propertylist will - be created containing the fit parameters. If the fit was - successful also the associated errors and the - reduced chi squared are returned. - @param fit_linear FALSE: if linear component shouldn't be fitted - TRUE: if linear component should be fitted - - @return - The fitted parameters. - - The lorentz function is fitted using the Levenberg-Marquardt method. - - The fit parameters are returned in a vector of length four where the first - value is the constant term: - f(x) = fit_par[0] + fit_par[1]/Pi*(fit_par[3]/2) / - ((x-fit_par[2]^2 + (fit_par[3]/2)^2 - + fit_par[4]*x - (fit_par[4] will be always zero when fit_linear==FALSE) - - The returned vector an pl have to be deleted manually afterwards. - - Possible cpl_error_code set in this function: + @brief Fits a lorentz function to vectors + @param x The x data vector + @param y The y data vector + @param noise The associated noise + @param peak_pos The position of the maximum value. (If CRPIX, CDELT + and CRVAL are provided, max_pos is a spectral value. + Otherwise a pixel value). Needed as initial estimate. + @param peak_val The maximum value. Needed as initial estimate. + @param background_val The background value + @param pl (Optinal output) If @c pl is non-null, a propertylist will + be created containing the fit parameters. If the fit was + successful also the associated errors and the reduced chi + squared are returned. + @param fit_linear FALSE: if linear component shouldn't be fitted + TRUE: if linear component should be fitted + @return The fitted parameters + @see kmos_oscan_mid_var_tukey() + + The lorentz function is fitted using the Levenberg-Marquardt method. + The fit parameters are returned in a vector of length four where the first + value is the constant term: + f(x) = fit_par[0] + fit_par[1]/Pi*(fit_par[3]/2) / + ((x-fit_par[2]^2 + (fit_par[3]/2)^2 + fit_par[4]*x + (fit_par[4] will be always zero when fit_linear==FALSE) + The returned vector an pl have to be deleted manually afterwards. + Possible cpl_error_code set in this function: @li CPL_ERROR_NULL_INPUT if @c x or @c y is NULL. @li CPL_ERROR_ILLEGAL_INPUT if @c x and @c y don't have the same length. - -*/ -cpl_vector* kmo_vector_fit_lorentz(const cpl_vector *x, const cpl_vector *y, - const cpl_vector *noise, - double max_pos, double max_val, - cpl_propertylist **pl, - int fit_linear) + */ +/*----------------------------------------------------------------------------*/ +cpl_vector * kmo_vector_fit_lorentz( + cpl_vector * x, + const cpl_vector * y, + cpl_vector * noise, + double peak_pos, + double peak_val, + double background_val, + cpl_propertylist ** pl, + int fit_linear) { - cpl_vector *fit_par = NULL, - *sigma_y = NULL; - - cpl_matrix *x_mat = NULL; - - cpl_error_code fit_error = CPL_ERROR_NONE; - - double cdelt = 0.0, - red_chisq = 0.0, - *pfit_par = NULL; - - cpl_matrix *covariance = NULL; - - int *valid = NULL; - - KMO_TRY - { - KMO_TRY_ASSURE((x != NULL) && - (y != NULL), - CPL_ERROR_NULL_INPUT, - "Not all input data is provided!"); - - KMO_TRY_ASSURE(cpl_vector_get_size(x) == cpl_vector_get_size(y), - CPL_ERROR_ILLEGAL_INPUT, - "x and y don't have same size!"); - - KMO_TRY_EXIT_IF_NULL( - fit_par = cpl_vector_new(5)); - - // initial estimates - cdelt = cpl_vector_get(x, 1) - cpl_vector_get(x, 0); - cpl_vector_set(fit_par, 0, 0.0); - cpl_vector_set(fit_par, 1, max_val); - cpl_vector_set(fit_par, 2, max_pos); - cpl_vector_set(fit_par, 3, cdelt); - cpl_vector_set(fit_par, 4, 0.0); - - if (fit_linear == FALSE) { - KMO_TRY_EXIT_IF_NULL( - valid = (int*)cpl_malloc(5*sizeof(int))); - valid[0] = 1.0; - valid[1] = 1.0; - valid[2] = 1.0; - valid[3] = 1.0; - valid[4] = 0.0; - } - -//printf("*********************************************\n"); -//printf("### ESTIMATES ### LORENTZ 1D ################\n"); -//kmo_debug_vector(fit_par); - KMO_TRY_EXIT_IF_NULL( - x_mat = cpl_matrix_wrap(cpl_vector_get_size(x), 1, - (double*)cpl_vector_get_data_const(x))); - - // if no noise is provided, create a sigma-vector filled with ones - if (noise == NULL) { - KMO_TRY_EXIT_IF_NULL( - sigma_y = cpl_vector_new(cpl_vector_get_size(x))); - KMO_TRY_EXIT_IF_ERROR( - cpl_vector_fill(sigma_y, 1.0)); - } else { - sigma_y = (cpl_vector*)noise; - } - - fit_error = cpl_fit_lvmq(x_mat, NULL, - y, sigma_y, - fit_par, valid, - &kmo_priv_lorentz1d_fnc, &kmo_priv_lorentz1d_fncd, - CPL_FIT_LVMQ_TOLERANCE, /* 0.01 */ - CPL_FIT_LVMQ_COUNT, /* 5 */ - CPL_FIT_LVMQ_MAXITER, /* 1000 */ - NULL, - &red_chisq, - &covariance); -//printf("### 1st FIT ###################\n"); -//kmo_debug_vector(fit_par); -//printf("ERROR: %d %s\n", fit_error); - if (fit_error == CPL_ERROR_CONTINUE) - { - KMO_TRY_RECOVER(); - - // try to fit again with previously fitted parameters - // and a LVMQ_COUNT of 2 - fit_error = cpl_fit_lvmq(x_mat, NULL, - y, sigma_y, - fit_par, valid, - &kmo_priv_lorentz1d_fnc, &kmo_priv_lorentz1d_fncd, - CPL_FIT_LVMQ_TOLERANCE, /* 0.01 */ - 2,//CPL_FIT_LVMQ_COUNT, /* 5 */ - CPL_FIT_LVMQ_MAXITER, /* 1000 */ - NULL, - &red_chisq, - &covariance); -//printf("### 2nd FIT ###################\n"); -//kmo_debug_vector(fit_par); -//printf("ERROR: %d\n", fit_error); - if (fit_error == CPL_ERROR_CONTINUE) - { - KMO_TRY_RECOVER(); - - // try to fit again a last time - // with first estimates and a LVMQ_COUNT of 1 - cpl_vector_set(fit_par, 0, 0); - cpl_vector_set(fit_par, 1, max_val); - cpl_vector_set(fit_par, 2, max_pos); - cpl_vector_set(fit_par, 3, cdelt); - cpl_vector_set(fit_par, 4, 0.0); - - fit_error = cpl_fit_lvmq(x_mat, NULL, - y, sigma_y, - fit_par, valid, - &kmo_priv_lorentz1d_fnc, &kmo_priv_lorentz1d_fncd, - CPL_FIT_LVMQ_TOLERANCE, /* 0.01 */ - 1,//CPL_FIT_LVMQ_COUNT, /* 5 */ - CPL_FIT_LVMQ_MAXITER, /* 1000 */ - NULL, - &red_chisq, - &covariance); -//printf("### 3rd FIT ###################\n"); -//kmo_debug_vector(fit_par); -//printf("ERROR: %d\n", fit_error); - - // if it didn't convert again, give up and take the - // estimated value - KMO_TRY_RECOVER(); - } - } - - if (pl != NULL) { - // put the fit parameters and errors into a propertylist - KMO_TRY_EXIT_IF_NULL( - pfit_par = cpl_vector_get_data(fit_par)); + cpl_vector * fit_par ; + cpl_vector * sigma_y ; + cpl_matrix * x_mat ; + double * pfit_par ; + cpl_matrix * covariance ; + int * valid ; + cpl_error_code fit_error ; + double cdelt, red_chisq; + + /* Check entries */ + if (x==NULL || y==NULL) { + cpl_msg_error(__func__, "NULL inputs") ; + cpl_error_set(__func__, CPL_ERROR_NULL_INPUT) ; + return NULL ; + } + if (cpl_vector_get_size(x) != cpl_vector_get_size(y)) { + cpl_msg_error(__func__, "x and y don't have same size") ; + cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; + return NULL ; + } + + /* Initialise */ + covariance = NULL ; + red_chisq = 0.0 ; + valid = NULL ; + + /* Create Estimates */ + cdelt = cpl_vector_get(x, 1) - cpl_vector_get(x, 0); + fit_par = cpl_vector_new(5); + cpl_vector_set(fit_par, 0, 0.0); + cpl_vector_set(fit_par, 1, -1*(peak_val-background_val)); + cpl_vector_set(fit_par, 2, peak_pos); + cpl_vector_set(fit_par, 3, 3 * cdelt); + cpl_vector_set(fit_par, 4, 0.0); + + /* Plot in debug mode */ + if (cpl_msg_get_level() == CPL_MSG_DEBUG) { + kmos_fit_lorentz_plot(x, y, fit_par, peak_pos, 0) ; + } - KMO_TRY_EXIT_IF_NULL( - *pl = cpl_propertylist_new()); + if (fit_linear == FALSE) { + valid = (int*)cpl_malloc(5*sizeof(int)); + valid[0] = 1.0; + valid[1] = 1.0; + valid[2] = 1.0; + valid[3] = 1.0; + valid[4] = 0.0; + } - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*pl, FIT_MAX_PIX, - max_pos, - "[pix] position of the maximum")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*pl, FIT_CENTROID, - pfit_par[2], - "[pix] position of the centroid")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*pl, FIT_OFFSET, - pfit_par[0], - "[adu] offset/background")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*pl, FIT_INTENSITY, - pfit_par[1], - "[adu] intensity of the function")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*pl, FIT_SCALE, - pfit_par[3], - "[adu] scale")); + x_mat = cpl_matrix_wrap(cpl_vector_get_size(x), 1, + cpl_vector_get_data(x)); - if (covariance == NULL) { -// cpl_msg_warning(cpl_func, "The function fit didn't converge! " -// "The fitted function is anyway calculated, " -// "but no errors can be provided. (Try to narrow " -// "the range to fit!)"); - } else { - // append errors to the propertylist - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*pl, FIT_RED_CHISQ, - red_chisq, - "[] reduced chi square of function fit")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*pl, FIT_ERR_OFFSET, - sqrt(red_chisq * cpl_matrix_get(covariance, 0, 0)), - "[adu] error in the offset/background")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*pl, FIT_ERR_INTENSITY, - sqrt(red_chisq * cpl_matrix_get(covariance, 1, 1)), - "[adu] error in the intensity of the function")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*pl, FIT_ERR_CENTROID, - sqrt(red_chisq * cpl_matrix_get(covariance, 2, 2)), - "[pix] error in the position of the centroid")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*pl, FIT_ERR_SCALE, - sqrt(red_chisq * cpl_matrix_get(covariance, 3, 3)), - "[adu] error in the scale")); + /* if no noise is provided, create a sigma-vector filled with ones */ + if (noise == NULL) { + sigma_y = cpl_vector_new(cpl_vector_get_size(x)); + cpl_vector_fill(sigma_y, 1.0); + } else { + sigma_y = noise; + } + + if ((fit_error = cpl_fit_lvmq(x_mat, NULL, y, sigma_y, fit_par, valid, + &kmo_priv_lorentz1d_fnc, &kmo_priv_lorentz1d_fncd, + CPL_FIT_LVMQ_TOLERANCE, CPL_FIT_LVMQ_COUNT, CPL_FIT_LVMQ_MAXITER, + NULL, &red_chisq, &covariance)) != CPL_ERROR_NONE) { + cpl_error_reset() ; + + cpl_msg_warning(__func__, "Cannot fit the line") ; + /* Try to fit again with previously fitted parameters */ + if ((fit_error = cpl_fit_lvmq(x_mat, NULL, y, sigma_y, fit_par, valid, + &kmo_priv_lorentz1d_fnc, &kmo_priv_lorentz1d_fncd, + CPL_FIT_LVMQ_TOLERANCE, 2, CPL_FIT_LVMQ_MAXITER, NULL, + &red_chisq, &covariance)) != CPL_ERROR_NONE) { + cpl_error_reset() ; + + /* Try to fit again a last time */ + cpl_vector_set(fit_par, 0, 0.0); + cpl_vector_set(fit_par, 1, peak_val-background_val); + cpl_vector_set(fit_par, 2, peak_pos); + cpl_vector_set(fit_par, 3, 3 * cdelt); + cpl_vector_set(fit_par, 4, 0.0); + + if ((fit_error = cpl_fit_lvmq(x_mat, NULL, y, sigma_y, fit_par, + valid, &kmo_priv_lorentz1d_fnc, + &kmo_priv_lorentz1d_fncd, CPL_FIT_LVMQ_TOLERANCE, + 1, CPL_FIT_LVMQ_MAXITER, NULL, &red_chisq, + &covariance)) != CPL_ERROR_NONE) { + /* give up and take the estimated value */ + cpl_error_reset() ; } } } - KMO_CATCH - { -// KMO_CATCH_MSG(); // commented out to be more silent when - // kmo_remove_line() can't fit a lorentz - cpl_vector_delete(fit_par); fit_par = NULL; - if (pl!=NULL) { - cpl_propertylist_delete(*pl); - *pl = NULL; - } - } - - cpl_matrix_unwrap(x_mat); - cpl_matrix_delete(covariance); covariance = NULL; - - if (noise == NULL) { - cpl_vector_delete(sigma_y); sigma_y = NULL; - } + if (noise == NULL) cpl_vector_delete(sigma_y); + if (fit_linear == FALSE) cpl_free(valid); - if (fit_linear == FALSE) { - cpl_free(valid); valid = NULL; + /* Plot in debug mode */ + if (cpl_msg_get_level() == CPL_MSG_DEBUG) { + kmos_fit_lorentz_plot(x, y, fit_par, peak_pos, 1) ; + } + + /* Put the fit parameters and errors into a propertylist */ + if (pl != NULL) { + pfit_par = cpl_vector_get_data(fit_par); + *pl = cpl_propertylist_new(); + kmclipm_update_property_double(*pl, FIT_MAX_PIX, peak_pos, + "[pix] position of the maximum"); + kmclipm_update_property_double(*pl, FIT_CENTROID, pfit_par[2], + "[pix] position of the centroid"); + kmclipm_update_property_double(*pl, FIT_OFFSET, pfit_par[0], + "[adu] offset/background"); + kmclipm_update_property_double(*pl, FIT_INTENSITY, pfit_par[1], + "[adu] intensity of the function"); + kmclipm_update_property_double(*pl, FIT_SCALE, pfit_par[3], + "[adu] scale"); + + /* Append errors to the propertylist */ + if (covariance != NULL) { + kmclipm_update_property_double(*pl, FIT_RED_CHISQ, red_chisq, + "[] reduced chi square of function fit"); + kmclipm_update_property_double(*pl, FIT_ERR_OFFSET, + sqrt(red_chisq * cpl_matrix_get(covariance, 0, 0)), + "[adu] error in the offset/background"); + kmclipm_update_property_double(*pl, FIT_ERR_INTENSITY, + sqrt(red_chisq * cpl_matrix_get(covariance, 1, 1)), + "[adu] error in the intensity of the function"); + kmclipm_update_property_double(*pl, FIT_ERR_CENTROID, + sqrt(red_chisq * cpl_matrix_get(covariance, 2, 2)), + "[pix] error in the position of the centroid"); + kmclipm_update_property_double(*pl, FIT_ERR_SCALE, + sqrt(red_chisq * cpl_matrix_get(covariance, 3, 3)), + "[adu] error in the scale"); + } } + /* Free and return */ + if (covariance != NULL) cpl_matrix_delete(covariance); return fit_par; } +static int kmos_fit_lorentz_plot( + const cpl_vector * x, + const cpl_vector * y_spec, + const cpl_vector * fit_par, + double peak_pos, + int fitted) +{ + char * title ; + double x_array[1] ; + double y_array[1] ; + cpl_vector * y ; + double * py ; + int i ; + + /* if (peak_pos != 1.27882) return 0 ; */ + + /* Create the vector to plot */ + y = cpl_vector_duplicate(x) ; + py = cpl_vector_get_data(y) ; + for (i = 0; i < cpl_vector_get_size(y); i++) { + x_array[0] = cpl_vector_get(x, i); + kmo_priv_lorentz1d_fnc(x_array, cpl_vector_get_data_const(fit_par), + y_array); + py[i] = y_array[0]; + } + + if (fitted) { + title = cpl_sprintf("t 'Fitted (%g)' w lines", peak_pos) ; + } else { + /* Plot the spectrum to fit */ + title = cpl_sprintf("t 'Spectrum to Fit (%g)' w lines", peak_pos) ; + cpl_plot_vector("set grid;", title, "", y_spec); + cpl_free(title) ; + + /* Plot the guess */ + title = cpl_sprintf("t 'Guess (%g)' w lines", peak_pos) ; + } + cpl_plot_vector("set grid;", title, "", y); + cpl_free(title) ; + cpl_vector_delete(y) ; + return 0 ; +} + /** @brief Fits a 2D gauss to an image. diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_fit_profile.h cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_fit_profile.h --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_fit_profile.h 2013-12-04 14:29:58.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_fit_profile.h 2018-04-09 13:42:16.000000000 +0000 @@ -42,9 +42,9 @@ *----------------------------------------------------------------------------*/ cpl_vector* kmo_fit_profile_1D( - const cpl_vector *lambda_in, + cpl_vector *lambda_in, const cpl_vector *data_in, - const cpl_vector *noise_in, + cpl_vector *noise_in, const char *method, cpl_vector **data_out, cpl_propertylist **pl); @@ -59,26 +59,27 @@ cpl_vector* kmo_vector_fit_gauss( const cpl_vector *x, const cpl_vector *y, - const cpl_vector *noise, + cpl_vector *noise, double max_pos, cpl_propertylist **pl); cpl_vector* kmo_vector_fit_moffat( - const cpl_vector *x, + cpl_vector *x, const cpl_vector *y, - const cpl_vector *noise, + cpl_vector *noise, double max_pos, double max_val, cpl_propertylist **pl); -cpl_vector* kmo_vector_fit_lorentz( - const cpl_vector *x, - const cpl_vector *y, - const cpl_vector *noise, - double max_pos, - double max_val, - cpl_propertylist **pl, - int fit_linear); +cpl_vector * kmo_vector_fit_lorentz( + cpl_vector * x, + const cpl_vector * y, + cpl_vector * noise, + double peak_pos, + double peak_val, + double background_val, + cpl_propertylist ** pl, + int fit_linear) ; cpl_vector* kmo_image_fit_gauss( const cpl_image *img, diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_fits_stack.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_fits_stack.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_fits_stack.c 2014-07-23 15:16:43.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_fits_stack.c 2018-04-09 13:42:16.000000000 +0000 @@ -497,8 +497,13 @@ switch(cpl_propertylist_get_int(header, NAXIS)) { case 3: z = cpl_propertylist_get_int(header, NAXIS3); + y = cpl_propertylist_get_int(header, NAXIS2); + x = cpl_propertylist_get_int(header, NAXIS1); + break; case 2: y = cpl_propertylist_get_int(header, NAXIS2); + x = cpl_propertylist_get_int(header, NAXIS1); + break; case 1: x = cpl_propertylist_get_int(header, NAXIS1); break; @@ -639,7 +644,6 @@ // rewind file and read now values and fill into table int br = FALSE, - j = 0, cnt = FALSE; char line[2000], *pEnd = NULL, @@ -1163,7 +1167,7 @@ } // add additional KMOS keywords to sub-header - int j = 0; + j = 0; if (subkey_values != NULL) { while (subkey_values[j] != NULL) { if (strcmp("string", subkey_values[j+1]) == 0) { diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_flat.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_flat.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_flat.c 2015-03-09 14:20:29.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_flat.c 2018-04-09 13:42:16.000000000 +0000 @@ -109,7 +109,7 @@ static kmclipm_vector * kmo_get_slitedges(const kmclipm_vector *, double) ; static kmclipm_vector * kmo_create_line_profile(const cpl_image *, int, int) ; static cpl_array ** kmo_accept_all_ifu_edges(kmclipm_vector *, cpl_array *) ; -static int kmos_display_slitlets_positions(cpl_array **) ; + static int kmo_find_first_non_rejected(const kmclipm_vector *, int) ; static cpl_error_code kmo_get_slit_gap(const cpl_vector *, cpl_vector **, cpl_vector **) ; @@ -3406,12 +3406,18 @@ opt[1] = "w linespoints pt 2 t 'output'"; opt[2] = "w l t 'first fit'"; opt[3] = "w l t 'second fit'"; + tv[0] = cpl_bivector_wrap_vectors(posv, ov[px]); tv[1] = cpl_bivector_wrap_vectors(posv, sparsv[px]); tv[2] = cpl_bivector_wrap_vectors(posv, first_fit[px]); tv[3] = cpl_bivector_wrap_vectors(posv, second_fit[px]); - cpl_plot_bivectors((const char *) popt,opt,"", - (const cpl_bivector **)tv, nr_plots); + + CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual); + cpl_plot_bivectors(popt,opt,"", + (const cpl_bivector **)tv, + nr_plots); + CPL_DIAG_PRAGMA_POP; + cpl_free(popt); popt = NULL; for (ix=0; ix LCAL (%s) and TELLURIC (%s)", b_lcal, b_tell); } + } - // check if b_start is equal - KMO_TRY_EXIT_IF_NULL( - b_lcal = kmo_get_pro_keyword_val(mainLcal, "b_start")); - KMO_TRY_EXIT_IF_NULL( - b_tell = kmo_get_pro_keyword_val(mainTell, "b_start")); - - if (strcmp(b_lcal, b_tell) != 0) { - matchError = TRUE; - cpl_msg_warning("","*** The parameter b_start isn't the same in LCAL and TELLURIC! ***"); - cpl_msg_warning("","*** ==> LCAL (%s) and TELLURIC (%s)", b_lcal, b_tell); - } - - // check if b_end is equal + mainTellGen = kmo_dfs_load_primary_header(frameset, TELLURIC_GEN); + if (mainTellGen != NULL) { + // check if b_samples is equal KMO_TRY_EXIT_IF_NULL( - b_lcal = kmo_get_pro_keyword_val(mainLcal, "b_end")); + b_lcal = kmo_get_pro_keyword_val(mainLcal, "b_samples")); KMO_TRY_EXIT_IF_NULL( - b_tell = kmo_get_pro_keyword_val(mainTell, "b_end")); + b_tellgen = kmo_get_pro_keyword_val(mainTellGen, "b_samples")); - if (strcmp(b_lcal, b_tell) != 0) { + if (strcmp(b_lcal, b_tellgen) != 0) { matchError = TRUE; - cpl_msg_warning("","*** The parameter b_end isn't the same in LCAL and TELLURIC! ***"); - cpl_msg_warning("","*** ==> LCAL (%s) and TELLURIC (%s)", b_lcal, b_tell); - } - - if (matchError) { - cpl_msg_warning("","*** ***"); - cpl_msg_warning("","*** The recipe will be executed, but the ***"); - cpl_msg_warning("","*** results should be mistrusted !!! ***"); cpl_msg_warning("","**********************************************************************"); cpl_msg_warning("","**********************************************************************"); + cpl_msg_warning("","*** The parameter b_samples isn't the same in LCAL and TELLURIC_GEN! ***"); + cpl_msg_warning("","*** ==> LCAL (%s) and TELLURIC_GEN (%s)", b_lcal, b_tellgen); } } + + if (matchError) { + cpl_msg_warning("","*** ***"); + cpl_msg_warning("","*** The recipe will be executed, but the ***"); + cpl_msg_warning("","*** results should be mistrusted !!! ***"); + cpl_msg_warning("","**********************************************************************"); + cpl_msg_warning("","**********************************************************************"); + } } KMO_CATCH { @@ -1787,6 +1788,7 @@ } cpl_propertylist_delete(mainLcal); mainLcal = NULL; cpl_propertylist_delete(mainTell); mainTell = NULL; + cpl_propertylist_delete(mainTellGen); mainTellGen = NULL; return ret_error; } diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_lcorr.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_lcorr.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_lcorr.c 2014-04-29 13:29:18.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_lcorr.c 2018-04-09 13:42:16.000000000 +0000 @@ -249,8 +249,8 @@ double l_low, l_up = 0.0; double max_value = 0.0; int *cnts = NULL; - const double *m_data = NULL; - float *mask_data = NULL; + double *m_data = NULL; + float *mask_data = NULL; KMO_TRY { @@ -319,9 +319,9 @@ KMO_TRY_EXIT_IF_NULL( m_img = cpl_image_cast(tmp_img, CPL_TYPE_DOUBLE)); KMO_TRY_EXIT_IF_NULL( - m_data = cpl_image_get_data_double_const(m_img)); + m_data = cpl_image_get_data_double(m_img)); KMO_TRY_EXIT_IF_NULL( - m_vector = cpl_vector_wrap(nx * ny, (double *) m_data)); + m_vector = cpl_vector_wrap(nx * ny, m_data)); KMO_TRY_EXIT_IF_NULL( sorted_sum = cpl_vector_duplicate(m_vector)); cpl_vector_sort(sorted_sum, CPL_SORT_ASCENDING); @@ -514,14 +514,14 @@ vsize = cpl_vector_get_size(lambda); + KMO_TRY_EXIT_IF_NULL( + lambda_out = cpl_vector_duplicate(lambda)); + spec_data = cubicspline_reg_irreg(naxis1, crval + (1-crpix)*cdelt, cdelt, file_data, - vsize, (double *) cpl_vector_get_data_const(lambda), NATURAL); + vsize, cpl_vector_get_data(lambda_out), NATURAL); KMO_TRY_EXIT_IF_NULL( spec_out = cpl_vector_wrap(vsize, spec_data)); - - KMO_TRY_EXIT_IF_NULL( - lambda_out = cpl_vector_duplicate(lambda)); } KMO_TRY_EXIT_IF_NULL( @@ -756,7 +756,7 @@ const double sqrt2pi = sqrt(2. * 3.14159265358979323846); sigma = *sigma_par; - if (IDL !=NULL ) fprintf(IDL, "%20s: %f %d %d %f\n","fitpeak input", lambda_in, half_width, size, sigma); + if (IDL !=NULL ) fprintf(IDL, "%20s: %f %d %lld %f\n", "fitpeak input", lambda_in, half_width, size, sigma); if ((lambda_in < cpl_vector_get(cpl_bivector_get_x_const(spectrum), 0)) || (lambda_in > cpl_vector_get(cpl_bivector_get_x_const(spectrum),size-1))) { @@ -779,9 +779,9 @@ vy = cpl_vector_extract(cpl_bivector_get_y_const(spectrum), low_bound, high_bound, 1); // printf("low: %5d high: %5d lamda_in: %f\n", low_bound, high_bound, lambda_in); if (IDL !=NULL ) { - fprintf(IDL, "%20s: %d %d %d\n", "fitpeak selection", low_bound, high_bound, cpl_vector_get_size(vx)); - fprintf(IDL, "%20s: %d", "fitpeak vx",cpl_vector_get_size(vx)); cpl_vector_dump(vx, IDL); - fprintf(IDL, "%20s: %d", "fitpeak vy",cpl_vector_get_size(vx)); cpl_vector_dump(vy, IDL); + fprintf(IDL, "%20s: %lld %lld %lld\n", "fitpeak selection", low_bound, high_bound, cpl_vector_get_size(vx)); + fprintf(IDL, "%20s: %lld", "fitpeak vx", cpl_vector_get_size(vx)); cpl_vector_dump(vx, IDL); + fprintf(IDL, "%20s: %lld", "fitpeak vy", cpl_vector_get_size(vx)); cpl_vector_dump(vy, IDL); } if (high_bound-low_bound < 4) { if (vx != NULL) {cpl_vector_delete(vx);} @@ -922,7 +922,7 @@ resolution = 1800.; } else if (strcmp(band_id, "IZ") == 0) { resolution = 3200.; - } else if (strcmp(band_id, "YJ") == 0) { + } else { /* if (strcmp(band_id, "YJ") == 0) { */ resolution = 3200.; } @@ -930,12 +930,12 @@ ref_size = cpl_bivector_get_size(reference); no_peaks = cpl_vector_get_size(peaks); if (IDL !=NULL ) { - fprintf(IDL, "%20s: %d %d %d %f\n", "xcorr input", obj_size, ref_size, no_peaks, resolution); - fprintf(IDL, "%20s: %d ", "xcorr object_l", obj_size); cpl_vector_dump(cpl_bivector_get_x_const(object), IDL); - fprintf(IDL, "%20s: %d ", "xcorr object_v", obj_size); cpl_vector_dump(cpl_bivector_get_y_const(object), IDL); - fprintf(IDL, "%20s: %d ", "xcorr reference_l", ref_size); cpl_vector_dump(cpl_bivector_get_x_const(reference), IDL); - fprintf(IDL, "%20s: %d ", "xcorr reference_v", ref_size); cpl_vector_dump(cpl_bivector_get_y_const(reference), IDL); - fprintf(IDL, "%20s: %d ", "xcorr peaks", no_peaks); cpl_vector_dump(peaks, IDL); + fprintf(IDL, "%20s: %lld %lld %lld %f\n", "xcorr input", obj_size, ref_size, no_peaks, resolution); + fprintf(IDL, "%20s: %lld ", "xcorr object_l", obj_size); cpl_vector_dump(cpl_bivector_get_x_const(object), IDL); + fprintf(IDL, "%20s: %lld ", "xcorr object_v", obj_size); cpl_vector_dump(cpl_bivector_get_y_const(object), IDL); + fprintf(IDL, "%20s: %lld ", "xcorr reference_l", ref_size); cpl_vector_dump(cpl_bivector_get_x_const(reference), IDL); + fprintf(IDL, "%20s: %lld ", "xcorr reference_v", ref_size); cpl_vector_dump(cpl_bivector_get_y_const(reference), IDL); + fprintf(IDL, "%20s: %lld ", "xcorr peaks", no_peaks); cpl_vector_dump(peaks, IDL); } KMO_TRY_ASSURE(obj_size > 1 && ref_size > 1 , @@ -1016,9 +1016,9 @@ KMO_TRY_EXIT_IF_ERROR( cpl_vector_set_size(sigma_tmp,peak_idx)); if (IDL !=NULL ) { - fprintf(IDL, "%20s: %d ", "xcorr lambda_ref", peak_idx); cpl_vector_dump(lambda_ref, IDL); - fprintf(IDL, "%20s: %d ", "xcorr lambda_tmp", peak_idx); cpl_vector_dump(lambda_tmp, IDL); - fprintf(IDL, "%20s: %d ", "xcorr sigma_tmp", peak_idx); cpl_vector_dump(sigma_tmp, IDL); + fprintf(IDL, "%20s: %lld ", "xcorr lambda_ref", peak_idx); cpl_vector_dump(lambda_ref, IDL); + fprintf(IDL, "%20s: %lld ", "xcorr lambda_tmp", peak_idx); cpl_vector_dump(lambda_tmp, IDL); + fprintf(IDL, "%20s: %lld ", "xcorr sigma_tmp", peak_idx); cpl_vector_dump(sigma_tmp, IDL); } KMO_TRY_EXIT_IF_ERROR( @@ -1102,9 +1102,9 @@ KMO_TRY_EXIT_IF_ERROR( cpl_vector_set_size(sigma_tmp,peak_idx)); if (IDL !=NULL ) { - fprintf(IDL, "%20s: %d ", "xcorr lambda_ref", peak_idx); cpl_vector_dump(lambda_ref, IDL); - fprintf(IDL, "%20s: %d ", "xcorr lambda_tmp", peak_idx); cpl_vector_dump(lambda_tmp, IDL); - fprintf(IDL, "%20s: %d ", "xcorr sigma_tmp", peak_idx); cpl_vector_dump(sigma_tmp, IDL); + fprintf(IDL, "%20s: %lld ", "xcorr lambda_ref", peak_idx); cpl_vector_dump(lambda_ref, IDL); + fprintf(IDL, "%20s: %lld ", "xcorr lambda_tmp", peak_idx); cpl_vector_dump(lambda_tmp, IDL); + fprintf(IDL, "%20s: %lld ", "xcorr sigma_tmp", peak_idx); cpl_vector_dump(sigma_tmp, IDL); } KMO_TRY_EXIT_IF_ERROR( @@ -1144,7 +1144,7 @@ KMO_TRY_EXIT_IF_NULL( dbg_msg = cpl_malloc((no_peaks * 2 + 1) * sizeof(char))); dbg_msg[no_peaks*2] = '\0'; - if (IDL !=NULL ) fprintf(IDL, "%20s: %d", "xcorr invalid peaks", no_peaks); + if (IDL !=NULL ) fprintf(IDL, "%20s: %lld", "xcorr invalid peaks", no_peaks); for (i = 0; i < no_peaks; i++){ sprintf(&dbg_msg[2*i], "%2d", invalid_index[i]); if (invalid_index[i] == 0) { @@ -1179,9 +1179,9 @@ } } if (IDL !=NULL ) { - fprintf(IDL, "%20s: %d ", "xcorr final_obj_in", no_valid_peaks); cpl_vector_dump(final_obj_in, IDL); - fprintf(IDL, "%20s: %d ", "xcorr final_obj_fit", no_valid_peaks); cpl_vector_dump(final_obj_fit, IDL); - fprintf(IDL, "%20s: %d ", "xcorr final_obj_diff", no_valid_peaks); cpl_vector_dump(final_obj_diff, IDL); + fprintf(IDL, "%20s: %lld ", "xcorr final_obj_in", no_valid_peaks); cpl_vector_dump(final_obj_in, IDL); + fprintf(IDL, "%20s: %lld ", "xcorr final_obj_fit", no_valid_peaks); cpl_vector_dump(final_obj_fit, IDL); + fprintf(IDL, "%20s: %lld ", "xcorr final_obj_diff", no_valid_peaks); cpl_vector_dump(final_obj_diff, IDL); } cpl_size degree[1] = {2}; @@ -1206,7 +1206,7 @@ if (IDL !=NULL ) { cpl_size pows[1]; - fprintf(IDL, "%20s: %d", "xcorr polyfit", cpl_polynomial_get_degree(coeffs)); + fprintf(IDL, "%20s: %lld", "xcorr polyfit", cpl_polynomial_get_degree(coeffs)); for (i = 0; i <= cpl_polynomial_get_degree(coeffs); i++) { pows[0] = i; fprintf(IDL, " %f", cpl_polynomial_get_coeff(coeffs,pows)); @@ -1237,7 +1237,7 @@ void kmo_lcorr_open_debug_file (char* filename) { IDL = fopen(filename,"w"); } -void kmo_lcorr_close_debug_file () { +void kmo_lcorr_close_debug_file (void) { fclose(IDL); IDL = NULL; } diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_lcorr.h cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_lcorr.h --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_lcorr.h 2013-12-04 14:29:58.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_lcorr.h 2018-04-09 13:42:16.000000000 +0000 @@ -79,6 +79,6 @@ const char *band_id); void kmo_lcorr_open_debug_file(char* filename); -void kmo_lcorr_close_debug_file(); +void kmo_lcorr_close_debug_file(void); #endif diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_shift.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_shift.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_shift.c 2014-04-02 08:15:01.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_shift.c 2018-04-09 13:42:16.000000000 +0000 @@ -57,7 +57,6 @@ @param yshift The shift in y-direction (positive to the top) [pixel] @param flux 1 if flux should be conserved, 0 otherwise. Flux changes only if a subpixel shift is applied. - @param ifu_nr The number of the IFU being processed. @param method The interpolation method (BCS only). @param extrapolate The extrapolation method (BCS_NATURAL, BCS_ESTIMATED, NONE_NANS, RESIZE_BCS_NATURAL, RESIZE_BCS_ESTIMATED, @@ -84,224 +83,175 @@ double xshift, double yshift, int flux, - int ifu_nr, const char * method, - const enum extrapolationType extrapolate, - int wcs_only) + const enum extrapolationType extrapolate) { - double flux_in = 0.0, - flux_out = 0.0, - xshift_sub = 0.0, - yshift_sub = 0.0, - precision = 1e-6, - crpix1 = 0.0, - crpix2 = 0.0, - crpix3 = 0.0, - crpix1_new = 0.0, - crpix2_new = 0.0, - crval1_new = 0.0, - crval2_new = 0.0, - mode_noise = 0.0; - int xshift_int = 0, - yshift_int = 0, - mode_sigma = 1000; - cpl_imagelist *data_out = NULL, - *noise_out = NULL; - cpl_error_code ret_error = CPL_ERROR_NONE; - cpl_wcs *wcs = NULL; - cpl_matrix *phys = NULL, - *world = NULL; - cpl_array *status = NULL; - - KMO_TRY - { - /* Check inputs */ - KMO_TRY_ASSURE((data != NULL) && (header_data != NULL) && - (*data != NULL) && (*header_data != NULL), - CPL_ERROR_NULL_INPUT, "Not all input data is provided!"); - - KMO_TRY_ASSURE((wcs_only == TRUE) || (wcs_only == FALSE), - CPL_ERROR_NULL_INPUT, "wcs_only must be TRUE or FALSE!"); - - if ((noise != NULL) && (*noise != NULL)) { - KMO_TRY_ASSURE((header_noise != NULL) && (*header_noise != NULL), - CPL_ERROR_NULL_INPUT, "header_noise isn't provided!"); - } - - KMO_TRY_ASSURE((flux == TRUE) || (flux == FALSE), - CPL_ERROR_ILLEGAL_INPUT, "flux must be TRUE or FALSE!"); - - /* Calculate amount of sub-/whole-pixel-shifts */ - - /* Whole-pixel-shift */ - if (xshift >= 0.0) xshift_int = xshift + precision; - else xshift_int = xshift - precision; - if (yshift >= 0.0) yshift_int = yshift + precision; - else yshift_int = yshift - precision; - - /* Sub-pixel-shift */ - xshift_sub = xshift-xshift_int; - if (fabs(xshift_sub) < precision) xshift_sub = 0.0; - yshift_sub = yshift-yshift_int; - if (fabs(yshift_sub) < precision) yshift_sub = 0.0; - - /* One pixel shift */ - if (xshift_sub > 0.5) { - xshift_sub -= 1; - xshift_int +=1; - } - if (yshift_sub > 0.5) { - yshift_sub -= 1; - yshift_int +=1; + cpl_imagelist * data_out ; + cpl_imagelist * noise_out ; + cpl_wcs * wcs ; + cpl_matrix * phys ; + cpl_matrix * world ; + cpl_array * status ; + double flux_in, flux_out, xshift_loc, yshift_loc, xshift_sub, + yshift_sub, precision, crpix1, crpix2, crpix3, + crpix1_new, crpix2_new, crval1_new, crval2_new, + mode_noise ; + int xshift_int, yshift_int, mode_sigma ; + + /* Check inputs */ + if (data==NULL || header_data==NULL || *data==NULL || *header_data==NULL) { + return CPL_ERROR_NULL_INPUT ; + } + if ((noise != NULL) && (*noise != NULL)) { + if (header_noise==NULL || *header_noise==NULL) { + return CPL_ERROR_NULL_INPUT ; } + } - xshift = xshift_sub+xshift_int; - yshift = yshift_sub+yshift_int; - - crpix1 = cpl_propertylist_get_double(*header_data, CRPIX1); - crpix2 = cpl_propertylist_get_double(*header_data, CRPIX2); - crpix3 = cpl_propertylist_get_double(*header_data, CRPIX3); - KMO_TRY_CHECK_ERROR_STATE(); - - crpix1_new = crpix1 - xshift; - crpix2_new = crpix2 + yshift; - - phys = cpl_matrix_new (2, 3); - cpl_matrix_set(phys, 0, 0, crpix1); - cpl_matrix_set(phys, 0, 1, crpix2); - cpl_matrix_set(phys, 0, 2, crpix3); - cpl_matrix_set(phys, 1, 0, crpix1_new); - cpl_matrix_set(phys, 1, 1, crpix2_new); - cpl_matrix_set(phys, 1, 2, crpix3); + /* Initialise */ + precision = 1e-6 ; + mode_sigma = 1000 ; + + /* Calculate amount of sub-/whole-pixel-shifts */ + + /* Whole-pixel-shift */ + if (xshift >= 0.0) xshift_int = xshift + precision; + else xshift_int = xshift - precision; + if (yshift >= 0.0) yshift_int = yshift + precision; + else yshift_int = yshift - precision; + + /* Sub-pixel-shift */ + xshift_sub = xshift-xshift_int; + if (fabs(xshift_sub) < precision) xshift_sub = 0.0; + yshift_sub = yshift-yshift_int; + if (fabs(yshift_sub) < precision) yshift_sub = 0.0; + + /* One pixel shift */ + if (xshift_sub > 0.5) { + xshift_sub -= 1; + xshift_int +=1; + } + if (yshift_sub > 0.5) { + yshift_sub -= 1; + yshift_int +=1; + } - KMO_TRY_EXIT_IF_NULL(wcs = cpl_wcs_new_from_propertylist(*header_data)); + xshift_loc = xshift_sub+xshift_int; + yshift_loc = yshift_sub+yshift_int; - KMO_TRY_EXIT_IF_ERROR( - cpl_wcs_convert(wcs, phys, &world, &status, CPL_WCS_PHYS2WORLD)); + crpix1 = cpl_propertylist_get_double(*header_data, CRPIX1); + crpix2 = cpl_propertylist_get_double(*header_data, CRPIX2); + crpix3 = cpl_propertylist_get_double(*header_data, CRPIX3); + + crpix1_new = crpix1 - xshift_loc; + crpix2_new = crpix2 + yshift_loc; + + phys = cpl_matrix_new (2, 3); + cpl_matrix_set(phys, 0, 0, crpix1); + cpl_matrix_set(phys, 0, 1, crpix2); + cpl_matrix_set(phys, 0, 2, crpix3); + cpl_matrix_set(phys, 1, 0, crpix1_new); + cpl_matrix_set(phys, 1, 1, crpix2_new); + cpl_matrix_set(phys, 1, 2, crpix3); + + if ((wcs = cpl_wcs_new_from_propertylist(*header_data)) == NULL) { + cpl_matrix_delete(phys); + return CPL_ERROR_ILLEGAL_INPUT ; + } + /* WCS Computation */ + if (cpl_wcs_convert(wcs, phys, &world, &status, + CPL_WCS_PHYS2WORLD) == CPL_ERROR_NONE) { + /* New Values */ crval1_new = cpl_matrix_get(world, 1, 0); crval2_new = cpl_matrix_get(world, 1, 1); - - crpix1_new = crpix1-2*xshift; - crpix2_new = crpix2+2*yshift; + crpix1_new = crpix1-2*xshift_loc; + crpix2_new = crpix2+2*yshift_loc; /* Update WCS */ - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*header_data, CRPIX1, crpix1_new, - "[pix] Reference pixel in x")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*header_data, CRPIX2, crpix2_new, - "[pix] Reference pixel in y")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*header_data, CRVAL1, crval1_new, - "[deg] RA at ref. pixel")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*header_data, CRVAL2, crval2_new, - "[deg] DEC at ref. pixel")); + kmclipm_update_property_double(*header_data, CRPIX1, crpix1_new, + "[pix] Reference pixel in x"); + kmclipm_update_property_double(*header_data, CRPIX2, crpix2_new, + "[pix] Reference pixel in y"); + kmclipm_update_property_double(*header_data, CRVAL1, crval1_new, + "[deg] RA at ref. pixel"); + kmclipm_update_property_double(*header_data, CRVAL2, crval2_new, + "[deg] DEC at ref. pixel"); if ((noise != NULL) && (*noise != NULL)) { - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*header_noise, CRPIX1, - crpix1_new, "[pix] Reference pixel in x")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*header_noise, CRPIX2, - crpix2_new, "[pix] Reference pixel in y")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*header_noise, CRVAL1, - crval1_new, "[deg] RA at ref. pixel")); - KMO_TRY_EXIT_IF_ERROR( - kmclipm_update_property_double(*header_noise, CRVAL2, - crval2_new, "[deg] DEC at ref. pixel")); - } - - if (wcs_only == FALSE) { - /* Apply shifts */ - /* sub-pixel-shift */ - if ((xshift_sub != 0.0) || (yshift_sub != 0.0)) { - /* Calculate flux_in */ - if (flux == TRUE) { - KMO_TRY_EXIT_IF_ERROR( - kmo_calc_mode_for_flux_cube(*data, NULL, &mode_noise)); - - flux_in = kmo_imagelist_get_flux(*data); - KMO_TRY_CHECK_ERROR_STATE(); - - if (isnan(mode_noise) || flux_in < mode_sigma*mode_noise) { - flux_in = 0./0.; - cpl_msg_warning("","Flux in < %d*noise", mode_sigma); - } - } - - /* Apply subpixel-shift */ - /* Sign of xshift_sub is inverted, since orientation of */ - /* x-axis goes from rigth to left */ - KMO_TRY_EXIT_IF_NULL( - data_out = kmclipm_shift(*data, xshift_sub, -yshift_sub, - method, extrapolate)); - cpl_imagelist_delete(*data); *data = data_out; - - if ((noise != NULL) && (*noise != NULL)) { - KMO_TRY_EXIT_IF_NULL( - noise_out = kmclipm_shift(*noise, xshift_sub, - -yshift_sub, method, extrapolate)); - cpl_imagelist_delete(*noise); *noise = noise_out; - } - - /* Apply flux conservation */ - if (flux == TRUE) { - KMO_TRY_EXIT_IF_ERROR( - kmo_calc_mode_for_flux_cube(*data, NULL, &mode_noise)); - - flux_out = kmo_imagelist_get_flux(*data); - KMO_TRY_CHECK_ERROR_STATE(); - if (isnan(mode_noise) || flux_out < mode_sigma*mode_noise) { - flux_out = 0./0.; - cpl_msg_warning("","Flux out < %d*noise", mode_sigma); - } - if (!isnan(flux_in) && !isnan(flux_out)) { - KMO_TRY_EXIT_IF_ERROR( - cpl_imagelist_multiply_scalar(*data, - flux_in / flux_out)); - } - } - if (ifu_nr > 0) { - cpl_msg_info(cpl_func, - "Applied subpixel shift to IFU %d", ifu_nr); - } + kmclipm_update_property_double(*header_noise, CRPIX1, crpix1_new, + "[pix] Reference pixel in x"); + kmclipm_update_property_double(*header_noise, CRPIX2, crpix2_new, + "[pix] Reference pixel in y"); + kmclipm_update_property_double(*header_noise, CRVAL1, crval1_new, + "[deg] RA at ref. pixel"); + kmclipm_update_property_double(*header_noise, CRVAL2, crval2_new, + "[deg] DEC at ref. pixel"); + } + } else { + cpl_msg_warning(__func__, "Failed to compute the new WCS") ; + cpl_error_reset() ; + } + cpl_matrix_delete(phys); + cpl_array_delete(status); + cpl_wcs_delete(wcs); + cpl_matrix_delete(world); + + /* Apply shifts */ + /* sub-pixel-shift */ + if ((xshift_sub != 0.0) || (yshift_sub != 0.0)) { + + /* Calculate flux_in */ + flux_in = 0.; + + if (flux == TRUE) { + kmo_calc_mode_for_flux_cube(*data, NULL, &mode_noise); + flux_in = kmo_imagelist_get_flux(*data); + if (isnan(mode_noise) || flux_in < mode_sigma*mode_noise) { + flux_in = 0./0.; + cpl_msg_warning("","Flux in < %d*noise", mode_sigma); } + } + + /* Apply subpixel-shift */ + /* Sign of xshift_sub is inverted, since orientation of */ + /* x-axis goes from rigth to left */ + data_out = kmclipm_shift(*data, xshift_sub, -yshift_sub, method, + extrapolate); + cpl_imagelist_delete(*data); + *data = data_out; - /* Whole-pixel-shift */ - if ((xshift_int != 0) || (yshift_int != 0)) { - KMO_TRY_EXIT_IF_ERROR( - kmo_imagelist_shift(*data, -xshift_int, yshift_int)); - if ((noise != NULL) && (*noise != NULL)) { - KMO_TRY_EXIT_IF_ERROR( - kmo_imagelist_shift(*noise, -xshift_int, yshift_int)); - } - if (ifu_nr > 0) { - cpl_msg_info(cpl_func, - "Applied pixel shift to IFU %d", ifu_nr); - } + if ((noise != NULL) && (*noise != NULL)) { + noise_out = kmclipm_shift(*noise, xshift_sub, -yshift_sub, method, + extrapolate); + cpl_imagelist_delete(*noise); + *noise = noise_out; + } + + /* Apply flux conservation */ + if (flux == TRUE) { + kmo_calc_mode_for_flux_cube(*data, NULL, &mode_noise); + + flux_out = kmo_imagelist_get_flux(*data); + if (isnan(mode_noise) || flux_out < mode_sigma*mode_noise) { + flux_out = 0./0.; + cpl_msg_warning("","Flux out < %d*noise", mode_sigma); } - } else { - /* Update WCS only */ - if (ifu_nr > 0) { - cpl_msg_info(cpl_func, "Updated WCS only on IFU %d", ifu_nr); + if (!isnan(flux_in) && !isnan(flux_out)) { + cpl_imagelist_multiply_scalar(*data, flux_in / flux_out); } } } - KMO_CATCH - { - KMO_CATCH_MSG(); - ret_error = cpl_error_get_code(); - } - cpl_matrix_delete(phys); phys = NULL; - cpl_matrix_delete(world); world = NULL; - cpl_array_delete(status); status = NULL; - cpl_wcs_delete(wcs); wcs = NULL; + /* Whole-pixel-shift */ + if ((xshift_int != 0) || (yshift_int != 0)) { + kmo_imagelist_shift(*data, -xshift_int, yshift_int); + if ((noise != NULL) && (*noise != NULL)) { + kmo_imagelist_shift(*noise, -xshift_int, yshift_int); + } + } - return ret_error; + return CPL_ERROR_NONE ; } /** @} */ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_shift.h cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_shift.h --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_shift.h 2012-02-27 09:48:01.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_shift.h 2017-04-27 12:52:38.000000000 +0000 @@ -47,9 +47,7 @@ double xshift, double yshift, int flux, - int ifu_nr, const char *method, - const enum extrapolationType extrapolate, - int wcs_only); + const enum extrapolationType extrapolate); #endif diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_std_star.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_std_star.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_std_star.c 2017-02-03 08:12:42.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_std_star.c 2018-04-10 10:24:37.000000000 +0000 @@ -493,7 +493,7 @@ same length. */ cpl_error_code kmo_divide_blackbody(cpl_vector *ydata, - const cpl_vector *xdata, + cpl_vector *xdata, double temperature) { cpl_error_code ret_err = CPL_ERROR_NONE; @@ -558,15 +558,18 @@ KMO_TRY_EXIT_IF_NULL( plots[1] = cpl_bivector_wrap_vectors((cpl_vector*)xdata, ydata)); - char *options[2] = {"w l t 'input'", - "w l t 'divided by blackbody'"}; + const char *options[] = {"w l t 'input'", + "w l t 'divided by blackbody'"}; + + CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual); KMO_TRY_EXIT_IF_ERROR( error_code = cpl_plot_bivectors( "set datafile missing 'nan';" "set title 'blackbody division';", - (const char**)options, + options, "", (const cpl_bivector**)plots, 2)); + CPL_DIAG_PRAGMA_POP; } } KMO_CATCH @@ -620,7 +623,7 @@ double * pbase ; double x_array[1] ; double y_array[1] ; - double min ; + double min, max ; int lowIndex, highIndex, i ; /* Check entries */ @@ -668,16 +671,10 @@ /* Divide by atmos */ cpl_vector_divide(spectrum_range, atmos_range); - /* - if (line_center == 0.88635) { - cpl_plot_vector("set grid;", "t 'line to fit' w lines", "", - spectrum_range); - } - */ - min = cpl_vector_get_min(spectrum_range); + max = cpl_vector_get_max(spectrum_range); if ((fit_par = kmo_vector_fit_lorentz(lambda_range, spectrum_range, NULL, - line_center, min, NULL, 1)) == NULL) { + line_center, min, max, NULL, 1)) == NULL) { cpl_msg_warning(""," Couldn't identify the line at %g [um]", line_center); cpl_error_reset(); @@ -694,15 +691,6 @@ } cpl_vector_delete(fit_par) ; - /* - if (line_center == 0.88635) { - cpl_plot_vector("set grid;", "t 'line to fit' w lines", "", - spectrum_range); - cpl_plot_vector("set grid;", "t 'Fitted' w lines", "", - fit); - } - */ - cpl_vector_multiply(spectrum_range, atmos_range); cpl_msg_info(__func__, "Removed line at %g [um]", line_center); } @@ -1094,7 +1082,7 @@ @li CPL_ERROR_NULL_INPUT if any of the inputs is NULL or fmethod is empty or cube is empty. */ -cpl_error_code kmo_calculate_std_trace(const cpl_imagelist *cube, +cpl_error_code kmo_calculate_std_trace(cpl_imagelist *cube, const char *fmethod, double *std_trace) { @@ -1138,7 +1126,7 @@ cnt = 0; for (i = 300; i <=400; i++) { KMO_TRY_EXIT_IF_NULL( - tmp_img = cpl_imagelist_get((cpl_imagelist*)cube, i)); + tmp_img = cpl_imagelist_get(cube, i)); KMO_TRY_EXIT_IF_ERROR( cpl_imagelist_set(cube1, cpl_image_duplicate(tmp_img), cnt++)); } @@ -1146,7 +1134,7 @@ cnt = 0; for (i = 1600; i <=1700; i++) { KMO_TRY_EXIT_IF_NULL( - tmp_img = cpl_imagelist_get((cpl_imagelist*)cube, i)); + tmp_img = cpl_imagelist_get(cube, i)); KMO_TRY_EXIT_IF_ERROR( cpl_imagelist_set(cube2, cpl_image_duplicate(tmp_img), cnt++)); } @@ -1469,7 +1457,7 @@ for (i = 0; i < KMOS_NR_IFUS; i++) { cpl_free(sky_sky_struct[i].skyPairs); sky_sky_struct[i].skyPairs = NULL; } - cpl_free(sky_sky_struct); sky_sky_struct = NULL; + cpl_free(sky_sky_struct); } } diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_std_star.h cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_std_star.h --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_std_star.h 2015-02-26 13:39:46.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_std_star.h 2018-04-09 13:42:16.000000000 +0000 @@ -74,7 +74,7 @@ cpl_error_code kmo_divide_blackbody( cpl_vector *ydata, - const cpl_vector *xdata, + cpl_vector *xdata, double temperature); cpl_error_code kmo_remove_line(cpl_vector *spectrum, @@ -115,7 +115,7 @@ double *stdev); cpl_error_code kmo_calculate_std_trace( - const cpl_imagelist *cube, + cpl_imagelist *cube, const char * fmethod, double *std_trace); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_wave_cal.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_wave_cal.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_priv_wave_cal.c 2015-03-09 14:20:29.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_priv_wave_cal.c 2018-04-09 13:57:45.000000000 +0000 @@ -95,8 +95,8 @@ int slitlet_nr, const char * filter_id, lampConfiguration lamp_config, - const cpl_bivector * lines, - const cpl_table * reflines, + cpl_bivector * lines, + cpl_table * reflines, const int lines_estimation, const int fit_order, cpl_image ** lcal, @@ -111,7 +111,7 @@ int, int, int, const char *) ; static void kmos_find_lines(const char *, int, int, cpl_vector *, - const cpl_bivector *, const cpl_table *, cpl_vector **, cpl_vector **) ; + cpl_bivector *, cpl_table *, cpl_vector **, cpl_vector **) ; static cpl_vector * kmo_wave_wrap_array_part(double *, int, int, int) ; static int kmos_extrapolate_arclines(const cpl_image *, @@ -139,10 +139,7 @@ static cpl_error_code kmo_priv_reject_qc(const kmclipm_vector *, double *, double *); -static void plot_estimated_lines(cpl_vector *, const cpl_bivector *, - cpl_vector *, cpl_vector *) ; - -static cpl_error_code debug_fitted_lines(const cpl_vector *, const cpl_vector *, +static cpl_error_code debug_fitted_lines(cpl_vector *, const cpl_vector *, const cpl_vector *, const cpl_vector *, const cpl_vector *, int, int, int) ; @@ -299,8 +296,8 @@ const int detector_nr, cpl_array * ifu_inactive, cpl_table ** edge_table, - const cpl_bivector * lines, - const cpl_table * reflines, + cpl_bivector * lines, + cpl_table * reflines, cpl_image ** lcal, double * qc_ar_eff, double * qc_ne_eff, @@ -314,7 +311,7 @@ double * pqc_ar_flux ; double * pqc_ne_flux ; int nx, ny, nr_edges, - slitlet_cnt, slitlet_nr, nr_valid_slitlets, + slitlet_cnt, slitlet_nr, ifu_nr, global_ifu_nr, i, k ; double qc_ar, qc_ne ; @@ -389,7 +386,7 @@ if ((edge_table[i] != NULL) && (cpl_array_get_int(ifu_inactive, i, NULL) == 0)) { - nr_valid_slitlets = 0 ; + int nr_valid_slitlets = 0 ; /* Loop the slitlets of the IFU */ for (k = 0; k < cpl_table_get_nrow(edge_table[i]); k+=2) { @@ -507,8 +504,8 @@ int slitlet_nr, const char * filter_id, lampConfiguration lamp_config, - const cpl_bivector * lines, - const cpl_table * reflines, + cpl_bivector * lines, + cpl_table * reflines, const int lines_estimation, const int fit_order, cpl_image ** lcal, @@ -535,7 +532,7 @@ double * pfitpars ; cpl_array * valid_columns ; int * pvalid_columns; - int ny, nr_extrap_lines, nr_valid_slitlets, i, + int ny, nr_extrap_lines, i, slitlet_index, fit_arc_size_x, fit_arc_size_y, edge_offset, max_nr_x_positions ; @@ -759,7 +756,6 @@ lcal, pfitpars, fit_order, pvalid_columns, slitlet_index * max_nr_x_positions * (fit_order+1), detector_nr, ifu_nr, slitlet_nr); - nr_valid_slitlets += tmp_int; if (tmp_int < 0) { cpl_msg_warning(__func__, "Couldn't fit a spectrum (slitlet %d IFU %d)", slitlet_nr, global_ifu_nr); @@ -835,9 +831,9 @@ vscale = 0., wavelength = 0., cdelt = 0.; - char *imethod = "CS", - lutFilename[1024], - *last_env = NULL; + const char *imethod = "CS"; + char lutFilename[1024]; + const char *last_env = NULL; float *pdet_img = NULL; cpl_frame *xcalFrame = NULL, *ycalFrame = NULL; @@ -2810,9 +2806,7 @@ cpl_vector_set(xx, ii, ii); plots[0] = cpl_bivector_wrap_vectors(xx, tmp_xarr2); plots[1] = cpl_bivector_wrap_vectors(xx, dbg_ggg); - char *options[2] = { - "w l t 'yfit'", - "w l lc rgbcolor \"blue\" t 'data'"}; + const char *options[] = { "w l t 'yfit'", "w l lc rgbcolor \"blue\" t 'data'"}; char title[1024], nr[256]; strcpy(title, "set term x11; " "set title 'Det: "); sprintf(nr, "%d", dbg_detector_nr); @@ -2830,8 +2824,11 @@ sprintf(nr, "%g", stddev); strcat(title, nr); strcat(title, "';"); - cpl_plot_bivectors(title, (const char**)options, "", - (const cpl_bivector**)plots, 2); + + CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual); + cpl_plot_bivectors(title, options, "", (const cpl_bivector**)plots, 2); + CPL_DIAG_PRAGMA_POP; + cpl_vector_delete(xx); cpl_bivector_unwrap_vectors(plots[0]) ; cpl_bivector_unwrap_vectors(plots[1]) ; @@ -3201,8 +3198,8 @@ int global_ifu_nr, int slitlet_nr, cpl_vector * spectrum, - const cpl_bivector * catalog, - const cpl_table * reflines, + cpl_bivector * catalog, + cpl_table * reflines, cpl_vector ** positions, cpl_vector ** lambdas) { @@ -3235,14 +3232,14 @@ else if (global_ifu_nr < 17) detector = 2; else detector = 3; - cpl_table_select_all((cpl_table*)reflines); + cpl_table_select_all(reflines); filter_regex[0] = 0; strncat(filter_regex, "^",1); strncat(filter_regex,filter_id,2); strncat(filter_regex, "$",1); - row_cnt = cpl_table_and_selected_string((cpl_table*)reflines, "FILTER", + row_cnt = cpl_table_and_selected_string(reflines, "FILTER", CPL_EQUAL_TO, filter_regex); - row_cnt = cpl_table_and_selected_int((cpl_table*)reflines, "DETECTOR", + row_cnt = cpl_table_and_selected_int(reflines, "DETECTOR", CPL_EQUAL_TO, detector); if (row_cnt <= 0) { cpl_msg_error(__func__, @@ -3467,7 +3464,7 @@ double *c; cpl_vector *catalog_lambdas; c = cpl_vector_get_data(fit_pars); - catalog_lambdas = cpl_bivector_get_x((cpl_bivector*)catalog) ; + catalog_lambdas = cpl_bivector_get_x(catalog) ; n_catalog = cpl_vector_get_size(catalog_lambdas); ll_pos = cpl_malloc(sizeof(double) * n_catalog); ll_lambda = cpl_malloc(sizeof(double) * n_catalog); @@ -3568,109 +3565,6 @@ /*----------------------------------------------------------------------------*/ /** - @brief - @param - @return -*/ -/*----------------------------------------------------------------------------*/ -static void plot_estimated_lines( - cpl_vector * spectrum, - const cpl_bivector * catalog, - cpl_vector * positions, - cpl_vector * lambdas) -{ - int catalog_size = cpl_bivector_get_size(catalog); - cpl_bivector *catalog_lines = cpl_bivector_new(3 * catalog_size); - double *xcl = cpl_bivector_get_x_data(catalog_lines); - double *ycl = cpl_bivector_get_y_data(catalog_lines); - const double *xc = cpl_bivector_get_x_data_const(catalog); - const double *yc = cpl_bivector_get_y_data_const(catalog); - const double l_off = 0.000001; - double ratio = cpl_vector_get_max(spectrum) / - cpl_vector_get_max(cpl_bivector_get_y_const(catalog)); - int ix = 0; - for (ix = 0; ix < catalog_size; ix++) { - xcl[ix*3+0] = xc[ix] - l_off; - xcl[ix*3+1] = xc[ix]; - xcl[ix*3+2] = xc[ix] + l_off; - ycl[ix*3+0] = 0.; - ycl[ix*3+1] = yc[ix] * ratio; - ycl[ix*3+2] = 0.; - } - - int degree = 6; - int line_list_size = cpl_vector_get_size(positions); - if (line_list_size < (degree+1)) { - degree = line_list_size - 1; - } - - cpl_polynomial *poly = cpl_polynomial_new(1); - double *px = cpl_vector_get_data((cpl_vector*)positions); - cpl_matrix *x_matrix = - cpl_matrix_wrap(1, cpl_vector_get_size(positions), px); - const cpl_boolean sampsym = CPL_FALSE; - cpl_size mindeg1d = 0, - maxdeg1d = degree; - cpl_polynomial_fit(poly, - x_matrix, - &sampsym, - lambdas, - NULL, - CPL_FALSE, - &mindeg1d, - &maxdeg1d); - - cpl_vector *xwave_l = cpl_vector_duplicate(spectrum); - cpl_vector *xwave_p = cpl_vector_duplicate(spectrum); - for (ix = 0; ix < cpl_vector_get_size(spectrum); ix++) { - cpl_vector_set(xwave_p, ix, ix); - } - cpl_vector_fill_polynomial(xwave_l,poly,0.,1.); - cpl_bivector *spec_l = cpl_bivector_wrap_vectors(xwave_l, spectrum); - cpl_bivector *spec_p = cpl_bivector_wrap_vectors(xwave_p, spectrum); - - cpl_bivector *line_list = cpl_bivector_new(3 * line_list_size); - double *xll = cpl_bivector_get_x_data(line_list); - double *yll = cpl_bivector_get_y_data(line_list); - for (ix = 0; ix < line_list_size; ix++) { - double pos = cpl_vector_get(positions,ix); - double lambda = cpl_vector_get(lambdas,ix); - int lx; - for (lx=0; lx +#endif + +/*----------------------------------------------------------------------------*/ +/** + * Includes + */ +/*----------------------------------------------------------------------------*/ + +#include + +#define __USE_XOPEN2K +#include + +#include "kmos_molecfit.h" + +#include "kmo_priv_extract_spec.h" + +/*----------------------------------------------------------------------------*/ +/** + * Defines + */ +/*----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------*/ +/** + * Functions prototypes + */ +/*----------------------------------------------------------------------------*/ + +/* Load STAR_SPEC spectrum */ +static cpl_error_code kmos_molecfit_load_spectrum_1D( + kmos_spectrum *ifu, const char* filename, cpl_boolean ext24); + +/* Load STAR_SPEC spectrum */ +static cpl_error_code kmos_molecfit_load_spectrum_3D( + kmos_spectrum *ifu, const char* filename, cpl_boolean ext24, const char *recipe_name, kmos_spectrum *ifus); + +/* Parse 1D Spectrum and put the data in ifu */ +static cpl_error_code kmos_molecfit_parse_1D_Spectrum( + cpl_vector *spec, kmos_spectrum *ifu); + +/*----------------------------------------------------------------------------*/ +/** + * Static variables + */ +/*----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------*/ +/** + * @defgroup kmos_molecfit Common functions to the kmos_molecfit recipes + */ +/*----------------------------------------------------------------------------*/ + +/**@{*/ + +/*----------------------------------------------------------------------------*/ +/** + * Functions code + */ +/*----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------*/ +/** + * @brief Add parameter to the recipe parameterlist + * + * @param recipe Name of the recipe + * @param plist Propertylist in the recipe for put the parameter + * @param param Name of the parameter + * @param range Flag: If the value is unique or it's a range + * @param rMin In case of range: Min value + * @param rMax In case of range: Max value + * @param type Type of the parameter + * @param value Generic pointer to the value/s of the parameter + * @param description Description of the parameter + * @param mf_conf Flag: If the parameter is for the molecfit configuration + * + * @return CPL_ERROR_NONE if everything is OK and CPL_ERROR_INVALID_TYPE if + * the type isn't correct. + * + * Description: + * Create a parameter with the input and insert in the recipe parameterlist. + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_molecfit_fill_parameter( + const char* recipe, cpl_parameterlist *plist, const char* param, + cpl_boolean range, const void *rMin, const void *rMax, + cpl_type type, const void *value, const char* description, + cpl_boolean mf_conf) +{ + cpl_parameter *p; + + if (range) { + + if(type == CPL_TYPE_INT) { + + const int val = *(const int *)value; + const int valMin = *(const int *)rMin; + const int valMax = *(const int *)rMax; + if(val < valMin || val > valMax) { + return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "Illegal int value range"); + } + p = cpl_parameter_new_range(param, type, description, recipe, val, valMin, valMax); + + } else if( type == CPL_TYPE_DOUBLE) { + + const double val = *(const double *)value; + const double valMin = *(const double *)rMin; + const double valMax = *(const double *)rMax; + if(val < valMin || val > valMax) { + return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "Illegal double value range"); + } + p = cpl_parameter_new_range(param, type, description, recipe, val, valMin, valMax); + + } else { + return cpl_error_set_message(cpl_func, CPL_ERROR_INVALID_TYPE, "cpl_type is not correct with ranges"); + } + + } else { + + switch(type) { + case CPL_TYPE_STRING : + p = cpl_parameter_new_value(param, type, description, recipe, (const char *) value); break; + case CPL_TYPE_BOOL : + p = cpl_parameter_new_value(param, type, description, recipe, *(const cpl_boolean *)value); break; + case CPL_TYPE_INT : + p = cpl_parameter_new_value(param, type, description, recipe, *(const int *) value); break; + case CPL_TYPE_DOUBLE : + p = cpl_parameter_new_value(param, type, description, recipe, *(const double *) value); break; + default : + return cpl_error_set_message(cpl_func, CPL_ERROR_INVALID_TYPE, "cpl_type is not correct"); + } + } + + if(!mf_conf) { + cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, param); + cpl_parameter_disable( p, CPL_PARAMETER_MODE_ENV); + } else { + cpl_parameter_disable( p, CPL_PARAMETER_MODE_CLI); + cpl_parameter_disable( p, CPL_PARAMETER_MODE_ENV); + cpl_parameter_disable( p, CPL_PARAMETER_MODE_CFG); + } + cpl_parameterlist_append(plist, p); + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Set the grating type that check with grating string + * + * @param name name of grating in one string + * @param type out: type of grating. + * + * @return cpl_error_code + * + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_molecfit_grating_type( + const char* name, kmos_grating_type *type) +{ + if (strcmp(name, "IZ") == 0) *type = GRATING_IZ; + else if (strcmp(name, "YJ") == 0) *type = GRATING_YJ; + else if (strcmp(name, "H" ) == 0) *type = GRATING_H; + else if (strcmp(name, "K" ) == 0) *type = GRATING_K; + else if (strcmp(name, "HK") == 0) *type = GRATING_HK; + else { + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "name of grating unknown!"); + } + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Fill the configuration grating by default, depending of the type + * + * @param grating Grating to fill + * @param type Specific grating + * + * @return cpl_error_code + * + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_molecfit_grating_by_default( + kmos_grating *grating, kmos_grating_type type) +{ + cpl_error_ensure(grating, CPL_ERROR_NULL_INPUT, + return CPL_ERROR_NULL_INPUT, "kmos_molecfit_calctrans_grating_by_default grating input is NULL!"); + + cpl_boolean wave_range_default = (strcmp(grating->wave_range, "-1") == 0) ? CPL_TRUE : CPL_FALSE; + cpl_boolean list_molec_default = (strcmp(grating->list_molec, "-1") == 0) ? CPL_TRUE : CPL_FALSE; + cpl_boolean fit_molec_default = (strcmp(grating->fit_molec, "-1") == 0) ? CPL_TRUE : CPL_FALSE; + cpl_boolean relcol_default = (strcmp(grating->relcol, "-1") == 0) ? CPL_TRUE : CPL_FALSE; + + if (type == GRATING_IZ) { + + if (wave_range_default) grating->wave_range = "0.815,0.830,0.894,0.899,0.914,0.919,0.929,0.940,0.972,0.986"; + if (list_molec_default) grating->list_molec = "H2O"; + if (fit_molec_default ) grating->fit_molec = "1"; + if (relcol_default ) grating->relcol = "1."; + + } else if (type == GRATING_YJ) { + + if (wave_range_default) grating->wave_range = "1.106,1.116,1.075,1.083,1.131,1.137,1.139,1.149,1.155,1.166,1.177,1.189,1.201,1.209,1.263,1.276,1.294,1.303,1.312,1.336"; + if (list_molec_default) grating->list_molec = "H2O,CO2,CH4,O2"; + if (fit_molec_default ) grating->fit_molec = "1,0,0,1"; + if (relcol_default ) grating->relcol = "1.,1.06,1.,1."; + + } else if (type == GRATING_H ) { + + if (wave_range_default) grating->wave_range = "1.482,1.491,1.500,1.512,1.559,1.566,1.598,1.605,1.575,1.583,1.622,1.629,1.646,1.671,1.699,1.711,1.721,1.727,1.746,1.758,1.764,1.767,1.773,1.780,1.789,1.794"; + if (list_molec_default) grating->list_molec = "H2O,CO2,CO,CH4"; + if (fit_molec_default ) grating->fit_molec = "1,1,0,1"; + if (relcol_default ) grating->relcol = "1.,1.06,1.,1."; + + } else if (type == GRATING_K ) { + + if (wave_range_default) grating->wave_range = "1.975,1.987,1.993,2.010,2.041,2.060,2.269,2.291,2.308,2.335,2.360,2.379,2.416,2.440,2.445,2.475"; + if (list_molec_default) grating->list_molec = "H2O,CO2,CH4"; + if (fit_molec_default ) grating->fit_molec = "1,1,1"; + if (relcol_default ) grating->relcol = "1.,1.06,1."; + + } else if (type == GRATING_HK) { + + if (wave_range_default) grating->wave_range = "1.575,1.584,1.594,1.606,1.646,1.671,1.756,1.771,1.781,1.811,1.945,1.969,1.975,1.987,1.993,2.030,2.043,2.089,2.242,2.294,2.308,2.335,2.360,2.379"; + if (list_molec_default) grating->list_molec = "H2O,CO2,CH4"; + if (fit_molec_default ) grating->fit_molec = "1,1,1"; + if (relcol_default ) grating->relcol = "1.,1.06,1."; + } + + + /*** Check same number in the list refered to the molecules ***/ + char **tokens; + + int n_tokens1; + tokens = kmo_strsplit(grating->list_molec, ",", &n_tokens1); + kmo_strfreev(tokens); + + int n_tokens2; + tokens = kmo_strsplit(grating->fit_molec, ",", &n_tokens2); + kmo_strfreev(tokens); + + int n_tokens3; + tokens = kmo_strsplit(grating->relcol, ",", &n_tokens3); + kmo_strfreev(tokens); + + if (n_tokens1 != n_tokens2 || n_tokens1 != n_tokens3 ){ + return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, + "--list_molec, --fit_molec,and --relcol must contain the same number of elements."); + } + + + /*** Show info about the grating configuration ***/ + + if (wave_range_default) cpl_msg_info(cpl_func, "Configuring wavelength ranges in grating('%s') defined by default : %s", grating->name, grating->wave_range); + else cpl_msg_info(cpl_func, "Configuring wavelength ranges in grating('%s') defined by the user : %s", grating->name, grating->wave_range); + + if (list_molec_default) cpl_msg_info(cpl_func, "Configuring list of molecules in grating('%s') defined by default : %s", grating->name, grating->list_molec); + else cpl_msg_info(cpl_func, "Configuring list of molecules in grating('%s') defined by the user : %s", grating->name, grating->list_molec); + + if (fit_molec_default ) cpl_msg_info(cpl_func, "Configuring fit of molecules in grating('%s') defined by default : %s", grating->name, grating->fit_molec); + else cpl_msg_info(cpl_func, "Configuring fit of molecules in grating('%s') defined by the user : %s", grating->name, grating->fit_molec); + + if (relcol_default ) cpl_msg_info(cpl_func, "Configuring relcol of molecules in grating('%s') defined by default : %s", grating->name, grating->relcol); + else cpl_msg_info(cpl_func, "Configuring relcol of molecules in grating('%s') defined by the user : %s", grating->name, grating->relcol); + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Generate wave_ranges and molecules cpl_table's in the conf file + * + * @param conf Configuration file in the recipe + * + * @return cpl_error_code + * + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_molecfit_generate_wave_molec_tables( + kmos_molecfit_parameter *conf) +{ + cpl_error_ensure(conf, CPL_ERROR_NULL_INPUT, + return CPL_ERROR_NULL_INPUT, "conf input is NULL!"); + + /* Get prestate */ + cpl_errorstate preState = cpl_errorstate_get(); + + + /*** Check if it's necessary to fill the grating variables with the default configuration ***/ + kmos_grating *grating = &(conf->grating); + kmos_grating_type type = conf->grating.type; + + /* Put variables by default if it's necessary */ + if (kmos_molecfit_grating_by_default(grating, type) != CPL_ERROR_NONE) { + return cpl_error_get_code(); + } + + + /*** Wavelength ranges ***/ + int n_wavelength; + char **wave_ranges = kmo_strsplit(grating->wave_range, ",", &n_wavelength); + + /* Create wave_ranges cpl_table */ + int n_wave_ranges = n_wavelength / 2; + grating->incl_wave_ranges = cpl_table_new(n_wave_ranges); + cpl_table_new_column(grating->incl_wave_ranges, MF_WAVELENGTH_COLUMN_LOWER, CPL_TYPE_DOUBLE); + cpl_table_new_column(grating->incl_wave_ranges, MF_WAVELENGTH_COLUMN_UPPER, CPL_TYPE_DOUBLE); + + for (cpl_size i = 0; i < n_wavelength / 2; i++) { + cpl_size idx = i * 2; + double start = strtod(wave_ranges[idx], NULL); + double end = strtod(wave_ranges[idx + 1], NULL); + cpl_table_set_double(grating->incl_wave_ranges, MF_WAVELENGTH_COLUMN_LOWER, i, start); + cpl_table_set_double(grating->incl_wave_ranges, MF_WAVELENGTH_COLUMN_UPPER, i, end); + + cpl_msg_info(cpl_func, "wave_range[%lld]={%g,%g}", i, start, end); + } + + + /*** Molecules ***/ + int n_molec; + char **list_molecs = kmo_strsplit(grating->list_molec, ",", &n_molec); + char **fit_molecs = kmo_strsplit(grating->fit_molec, ",", &n_molec); + char **relcols = kmo_strsplit(grating->relcol, ",", &n_molec); + + /* Create Molecules cpl_table */ + grating->molecules = cpl_table_new(n_molec); + cpl_table_new_column(grating->molecules, MF_MOLECULES_COLUMN_LIST, CPL_TYPE_STRING); + cpl_table_new_column(grating->molecules, MF_MOLECULES_COLUMN_FIT, CPL_TYPE_INT ); + cpl_table_new_column(grating->molecules, MF_MOLECULES_COLUMN_RELCOL, CPL_TYPE_DOUBLE); + + /* Insert molecules properties in the cpl_table */ + for (cpl_size i = 0; i < n_molec; i++) { + int fit = atoi(fit_molecs[i]); + double relcol = strtod(relcols[i], NULL); + + cpl_table_set_string(grating->molecules, MF_MOLECULES_COLUMN_LIST, i, list_molecs[i]); + cpl_table_set_int( grating->molecules, MF_MOLECULES_COLUMN_FIT, i, fit); + cpl_table_set_double(grating->molecules, MF_MOLECULES_COLUMN_RELCOL, i, relcol); + + cpl_msg_info(cpl_func, "Molec[%s] -> %d:{%g}", list_molecs[i], fit, relcol); + } + + + /*** Cleanup values ***/ + kmo_strfreev(wave_ranges); + kmo_strfreev(list_molecs); + kmo_strfreev(fit_molecs); + kmo_strfreev(relcols); + + + /* Check execution */ + if (!cpl_errorstate_is_equal(preState)) { + return cpl_error_get_code(); + } else { + return CPL_ERROR_NONE; + } +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Function needed to fill the molecfit generic configuration file + * + * @param recipe Name of the recipe + * @param conf Recipe configuration. The variable conf->recipe_parameters is + * modified in order to include the hardcode values + * + * @return parameterlist with contain the config to molecfit or NULL if error + * + */ +/*----------------------------------------------------------------------------*/ +cpl_parameterlist * kmos_molecfit_conf_generic( + const char* recipe, kmos_molecfit_parameter *conf) +{ + /* Add the config values necessaries to execute molecfit */ + cpl_errorstate prestate = cpl_errorstate_get(); + + /* Fill the parameters list */ + cpl_error_code e = CPL_ERROR_NONE; + cpl_boolean range = CPL_TRUE; + const void *dummyMin = NULL; + const void *dummyMax = NULL; + int boolMin = 0; + int boolMax = 1; + + + /*** Create a new parematerlist ***/ + cpl_parameterlist *mf_config = cpl_parameterlist_new(); + + + /* --kernmode */ + if(!e) e = kmos_molecfit_fill_parameter(recipe, mf_config, "kernmode", + range, &boolMin, &boolMax, CPL_TYPE_INT, &(conf->kernmode), + "molecfit", CPL_TRUE); + + /* --kernfac */ + if(!e) e = kmos_molecfit_fill_parameter(recipe, mf_config, "kernfac", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &(conf->kernfac), + "molecfit", CPL_TRUE); + + /* --varkern */ + if(!e) e = kmos_molecfit_fill_parameter(recipe, mf_config, "varkern", + range, &boolMin, &boolMax, CPL_TYPE_INT, &(conf->varkern), + "molecfit", CPL_TRUE); + + + /*** PARAMETERS NOT INCLUDED IN THE RECIPE: HARD-CODED ***/ + + /* --col_lam */ + const char *col_lam = MF_SPECTRUM_COLUMN_WLEN; /* Molecfit default: "undef" */ + if(!e) e = kmos_molecfit_fill_parameter(recipe, mf_config, "col_lam", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)col_lam, + "molecfit", CPL_TRUE); + + /* --col_flux */ + const char *col_flux = MF_SPECTRUM_COLUMN_FLUX; /* Molecfit default: "undef" */ + if(!e) e = kmos_molecfit_fill_parameter(recipe, mf_config, "col_flux", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)col_flux, + "molecfit", CPL_TRUE); + + /* --col_dflux */ + const char *col_dflux = "NULL"; /* Molecfit default: "undef" */ + if(!e) e = kmos_molecfit_fill_parameter(recipe, mf_config, "col_dflux", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)col_dflux, + "molecfit", CPL_TRUE); + + /* --col_mask */ + const char *col_mask = "NULL"; /* Molecfit default: "undef" */ + if(!e) e = kmos_molecfit_fill_parameter(recipe, mf_config, "col_mask", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)col_mask, + "molecfit", CPL_TRUE); + + /* --wlgtomicron -- Conversion factor to microns (1., KMOS work in micros) */ + double wlgtomicron = 1.; /* Molecfit default: 1. */ + if(!e) e = kmos_molecfit_fill_parameter(recipe, mf_config, "wlgtomicron", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &wlgtomicron, + "molecfit", CPL_TRUE); + + /* --vac_air */ + const char *vac_air = "vac"; /* Molecfit default: "vac" */ + if(!e) e = kmos_molecfit_fill_parameter(recipe, mf_config, "vac_air", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)vac_air, + "molecfit", CPL_TRUE); + + + /* --slitw */ + double slitw = 0.4; /* Molecfit default: 0.4 */ + if(!e) e = kmos_molecfit_fill_parameter(recipe, mf_config, "slitw", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &slitw, + "molecfit", CPL_TRUE); + + /* --slitw_key */ + const char *slitw_key = "ANY"; /* Molecfit default: "ESO INS SLIT1 WID" */ + if(!e) e = kmos_molecfit_fill_parameter(recipe, mf_config, "slitw_key", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)slitw_key, + "molecfit", CPL_TRUE); + + /* --pixsc */ + double pixsc = 0.2; /* Molecfit default: 0.086 */ + if(!e) e = kmos_molecfit_fill_parameter(recipe, mf_config, "pixsc", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &pixsc, + "molecfit", CPL_TRUE); + + /* --pixsc_key */ + const char *pixsc_key = "NONE"; /* Molecfit default: "NONE" */ + if(!e) e = kmos_molecfit_fill_parameter(recipe, mf_config, "pixsc_key", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)pixsc_key, + "molecfit", CPL_TRUE); + + + /*** Check possible errors ***/ + if (!cpl_errorstate_is_equal(prestate) || e != CPL_ERROR_NONE) { + cpl_parameterlist_delete(mf_config); + cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Building molecfit generic configuration variable failed!"); + return NULL; + } + + return mf_config; +} + + +/*----------------------------------------------------------------------------*/ +/** + * @brief Get the data input frame in the frameset file + * + * @param frameset Set of input frames + * + * @return The cpl_frame that contains the frame with data + */ +/*----------------------------------------------------------------------------*/ +cpl_frame * kmos_molecfit_get_frame_spectrums( + cpl_frameset *frameset) +{ + /*** Get frame, header and check input data ***/ + cpl_errorstate preStateLoadData = cpl_errorstate_get(); + cpl_msg_info(cpl_func, "Loading header, input data frame ..."); + cpl_frame *frm = cpl_frameset_find(frameset, STAR_SPEC); + if (!frm) { + cpl_errorstate_set(preStateLoadData); + frm = cpl_frameset_find(frameset, EXTRACT_SPEC); + if (!frm) { + cpl_errorstate_set(preStateLoadData); + frm = cpl_frameset_find(frameset, SCIENCE); + if (!frm) { + cpl_errorstate_set(preStateLoadData); + frm = cpl_frameset_find(frameset, RECONSTRUCTED_CUBE); + if (!frm) { + cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND, + "Frame with input data not found in frameset ('%s','%s','%s','%s') !", + STAR_SPEC, EXTRACT_SPEC, SCIENCE, RECONSTRUCTED_CUBE); + return NULL; + } + } + } + } + + return frm; +} + + +/*----------------------------------------------------------------------------*/ +/** + * @brief Load the data input spectrums in the frameset file + * + * @param frameset Set of input frames + * @param conf Generic kmos_molecfit configuration + * @param recipe_name Name of recipe + * + * @return cpl_error + * + * Description: + * Loads the spectrum properties and the spectrums table from the extensions with data. + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_molecfit_load_spectrums( + cpl_frameset *frameset, kmos_molecfit_parameter *conf, const char *recipe_name) +{ + /*** CHARGE ALL OF THE IFU EXTENSIONS WITH DATA ***/ + + /* KMOS works with wavelengths units in microns like molecfit. + * It's not necessary to check nor do any conversion or special management */ + + /* Load the input spectrum of the standard used to derive the atmospheric + * column densities, and update the molecfit configuration with the + * input spectrum specific values. */ + + /* Get frame, filename, tag and number of extensions, ext24=1 (24ext), ext24=2 (48ext) */ + cpl_frame *frm = kmos_molecfit_get_frame_spectrums(frameset); + cpl_error_ensure(frm, CPL_ERROR_DATA_NOT_FOUND, + return CPL_ERROR_DATA_NOT_FOUND, "Raw data not found in input frameset!"); + const char *fileData = cpl_frame_get_filename(frm); + const char* tag = cpl_frame_get_tag(frm); + cpl_size n_extensions = cpl_fits_count_extensions(fileData); + cpl_msg_info(cpl_func, "Load spectrums in %s -> n_extensions = %lld", fileData, n_extensions); + cpl_size ext24 = (N_IFUS == n_extensions) ? 1 : 2; + + + /* Get primary header and show PRO.CATG */ + conf->header_spectrums = cpl_propertylist_load(fileData, 0); + cpl_error_ensure(conf->header_spectrums, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load raw primary header propertylist from '%s'!", fileData); + cpl_msg_info(cpl_func, "Input data fits file: PRO.CATG = %s", cpl_propertylist_get_string(conf->header_spectrums, "ESO PRO CATG")); + + /* Get unique grating using in all of data in this STAR_SPEC file {0,60,120,180,240,300} */ + conf->grating.name = cpl_propertylist_get_string(conf->header_spectrums, "ESO INS GRAT1 ID"); + kmos_molecfit_grating_type(conf->grating.name, &(conf->grating.type)); + + /* How now I know the type of grating --> Generate cpl_tables by the user/default configuration */ + if (kmos_molecfit_generate_wave_molec_tables(conf) != CPL_ERROR_NONE) { + return cpl_error_get_code(); + } + + /* Get rotator angle: NAANGLE and convert to more close string(num) in the range {0,60,120,180,240,300}*/ + int rot_angle_close; + conf->rot_angle = cpl_propertylist_get_float(conf->header_spectrums, "ESO OCS ROT NAANGLE"); + cpl_error_ensure(conf->rot_angle >= -360. && conf->rot_angle <= 360., CPL_ERROR_ILLEGAL_INPUT, + return CPL_ERROR_ILLEGAL_INPUT, "The rotator angle in '%s' is out of range=%g!", fileData, conf->rot_angle); + if (conf->rot_angle >= 0) { + rot_angle_close = (int)( 60. * floorf(conf->rot_angle / 60. + 0.5)) % 360; + } else { + rot_angle_close = (int)(360. - fabs(60. * ceilf( conf->rot_angle / 60. - 0.5))) % 360; + } + + /* In KMOS IFU STAR_SPEC = {DATA,NOISE}. The odd extension are .DATA (1,3,...,N_EXTENSIONS-1) and the even extension are .NOISE (2,4,...,N_EXTENSIONS) */ + cpl_msg_info(cpl_func, "Loading data spectrums ('%s') from the file: '%s', rot_angle=%f (more close=%d)", tag, fileData, conf->rot_angle, rot_angle_close); + for (cpl_size n_ifu = 0; n_ifu < N_IFUS; n_ifu++) { + + /* Get and initialize a specific ifu */ + kmos_spectrum *ifu = &(conf->ifus[n_ifu]); + ifu->name = NULL; + ifu->num = n_ifu + 1; + ifu->ext = (n_ifu * ext24) + 1; + ifu->kernel.header_ext = NULL; + ifu->kernel.data = NULL; + ifu->kernel.ext = (n_ifu * 6) + (rot_angle_close / 60) + 1; + + /* Load data */ + if ( strcmp(tag, STAR_SPEC ) == 0 || + strcmp(tag, EXTRACT_SPEC ) == 0 ){ + + if (kmos_molecfit_load_spectrum_1D(ifu, fileData, (ext24 == 1)) != CPL_ERROR_NONE) { + return cpl_error_get_code(); + } + + } else if (strcmp(tag, SCIENCE ) == 0 || + strcmp(tag, RECONSTRUCTED_CUBE) == 0 ){ + + if (kmos_molecfit_load_spectrum_3D(ifu, fileData, (ext24 == 1), recipe_name, conf->ifus) != CPL_ERROR_NONE) { + return cpl_error_get_code(); + } + + } else { + + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, "Unexpected tag ..."); + } + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Load 1D spectrum + * + * @param ifu Concrete IFU in KMOS + * @param filename Name of file that contains the data spectrum + * @param ext24 cpl_boolean that explain if the fits input file have 24ext + * + * @return cpl_error + * + */ +/*----------------------------------------------------------------------------*/ +static cpl_error_code kmos_molecfit_load_spectrum_1D( + kmos_spectrum *ifu, const char* filename, cpl_boolean ext24) { + + /* Get propertylist data/header */ + ifu->header_ext_data = cpl_propertylist_load(filename, ifu->ext); + + /* Get extension name */ + ifu->name = cpl_sprintf("%s", cpl_propertylist_get_string(ifu->header_ext_data, EXTNAME)); + + /* Check 24 or 48 extensions */ + if (ext24) { + /* Add Fake noise extension */ + ifu->header_ext_noise = cpl_propertylist_duplicate(ifu->header_ext_data); + char *noise_name = cpl_sprintf("IFU.%d.NOISE", ifu->num); + cpl_propertylist_update_string(ifu->header_ext_noise, EXTNAME, noise_name); + cpl_free(noise_name); + } else { + ifu->header_ext_noise = cpl_propertylist_load(filename, ifu->ext + 1); + } + + /* Check headers */ + cpl_error_ensure(ifu->header_ext_data && ifu->header_ext_noise, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load data propertylist from IFU='%d'", ifu->num); + + + /* Load the data spectrum in 1D, it's an image 1D (vector) */ + cpl_errorstate preState = cpl_errorstate_get(); + cpl_vector *data = cpl_vector_load(filename, ifu->ext); + if (!data) { + + /* The extension doesn't have data spectrum */ + cpl_errorstate_set(preState); + ifu->header_1D_data = NULL; + ifu->data = NULL; + + cpl_msg_info(cpl_func, "IFU.%02d - Extension: %02d:%s --> Properties charged.", ifu->num, ifu->ext, ifu->name); + + } else { + + /* Parse from cpl_vector to 1D spectrum: Don't need to convert property form 3D Datacube to 1D spectrum. Copy ifu->header_ext because is 1D */ + ifu->header_1D_data = cpl_propertylist_duplicate(ifu->header_ext_data); + if (kmos_molecfit_parse_1D_Spectrum(data, ifu) != CPL_ERROR_NONE) { + if (data) cpl_vector_delete(data); + return cpl_error_get_code(); + } + cpl_vector_delete(data); + + cpl_msg_info(cpl_func, "IFU.%02d - Extension: %02d:%s --> Properties charged and loaded data spectrum!", + ifu->num, ifu->ext, ifu->name); + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Load 3D spectrum + * + * @param ifu Concrete IFU in KMOS + * @param filename Name of file that contains the data spectrum + * @param ext24 cpl_boolean that explain if the fits input file have 24ext + * @param recipe_name Name of recipe + * @param ifus All of configuration that contain the ifu mapping. + * + * @return cpl_error + * + */ +/*----------------------------------------------------------------------------*/ +static cpl_error_code kmos_molecfit_load_spectrum_3D( + kmos_spectrum *ifu, const char* filename, cpl_boolean ext24, const char *recipe_name, kmos_spectrum *ifus) { + + int ext_map; + if (ext24) ext_map = ifu->map; + else ext_map = (ifu->map * 2) - 1; + + /* Get propertylist header of IFU */ + ifu->header_ext_data = cpl_propertylist_load(filename, ext_map); + + /* Update extension name -> Change IFU.Y.DATA by IFU.X-Y.DATA */ + ifu->name = cpl_sprintf("IFU.%d.DATA", ifu->num); + char *noise_name = cpl_sprintf("IFU.%d.NOISE", ifu->num); + cpl_propertylist_update_string(ifu->header_ext_data, EXTNAME, ifu->name); + + /* Check 24 or 48 extensions */ + if (ext24) { + /* Add Fake noise extension */ + ifu->header_ext_noise = cpl_propertylist_duplicate(ifu->header_ext_data); + cpl_propertylist_update_string(ifu->header_ext_noise, EXTNAME, noise_name); + } else { + ifu->header_ext_noise = cpl_propertylist_load(filename, ifu->ext + 1); + } + + /* Check headers */ + if (!(ifu->header_ext_data) || !(ifu->header_ext_noise)) { + cpl_free(noise_name); + return cpl_error_set_message(cpl_func, cpl_error_get_code(), "Cannot load data propertylist from IFU='%d', ext=%02d", ifu->num, ext_map); + } + + /* Check if actual IFU is mapping */ + if (ifu->num != ifu->map) { + + /* It's not an IFU mapping */ + ifu->data = NULL; + cpl_msg_info(cpl_func, "IFU.%02d - Extension: %02d:%s --> Properties charged (Not IFU mapping).", + ifu->num, ifu->ext, ifu->name); + + } else { + + /* It's an IFU_Y: Load DataCube 3D and extract 1D spectrum */ + + /* Search a valid 1D spectrum in SCIENCE file */ + cpl_propertylist *header_convert1D = NULL; + cpl_vector *data = NULL; + + if (strcmp(recipe_name, KMOS_MOLECFIT_MODEL) ==0) { + + /* Recipe kmos_recipe_model */ + int ext = ifu->ext; + + header_convert1D = cpl_propertylist_load(filename, ext); + if (!header_convert1D) { + cpl_free(noise_name); + return cpl_error_set_message(cpl_func, cpl_error_get_code(), "Cannot load data propertylist from file=%s, ext=%d", filename, ext); + } + + /* Extract 1D spectrum from extension in filename (FITS file) */ + cpl_errorstate preState = cpl_errorstate_get(); + data = kmos_molecfit_extract_spec_from_datacube(filename, ext, header_convert1D); + if (!data) { + + /* The extension doesn't have data spectrum */ + cpl_errorstate_set(preState); + ifu->header_1D_data = NULL; + ifu->data = NULL; + + cpl_msg_info(cpl_func, "IFU.%02d - Extension: %02d:%s --> Properties charged.", ifu->num, ifu->ext, ifu->name); + + } else { + + /* Parse from cpl_vector to 1D spectrum: Need to storage cpl_propertylist form 3D Datacube to 1D spectrumn */ + ifu->header_1D_data = cpl_propertylist_duplicate(header_convert1D); + cpl_propertylist_delete(header_convert1D); + if (kmos_molecfit_parse_1D_Spectrum(data, ifu) != CPL_ERROR_NONE) { + cpl_free(noise_name); + if (data) cpl_vector_delete(data); + return cpl_error_get_code(); + } + cpl_vector_delete(data); + + cpl_msg_info(cpl_func, "IFU.%02d - Extension: %02d:%s --> Properties charged in extension: %02d and 1D data spectrum extracted!)", + ifu->num, ifu->ext, ifu->name, ext); + } + + } else { + + /* Recipe kmos_recipe_calctrans */ + int ext_data = -1; + + /* Get the first data spectrum that match with the map of my ifu */ + for (cpl_size n_ifu = 0; n_ifu < N_IFUS && !data; n_ifu++) { + + if (ext24) ext_data = n_ifu + 1; + else ext_data = (n_ifu * 2) + 1; + + + /* IFU_X = ifu->num : Get the first with data spectrum */ + if (ifus[n_ifu].map == ifu->num) { + + /* Get errorstate preState */ + cpl_errorstate preState = cpl_errorstate_get(); + + /* Cleanup header, if it was storage in a previous loop */ + if (header_convert1D) cpl_propertylist_delete(header_convert1D); + + header_convert1D = cpl_propertylist_load(filename, ext_data); + if (!header_convert1D) { + cpl_free(noise_name); + return cpl_error_set_message(cpl_func, cpl_error_get_code(), "Cannot load data propertylist from file=%s, ext=%d", filename, ext_data); + } + + /* Extract 1D spectrum from extension in filename (FITS file) */ + data = kmos_molecfit_extract_spec_from_datacube(filename, ext_data, header_convert1D); + if (!data && cpl_error_get_code() == CPL_ERROR_FILE_IO) { + /* This extension doesn't contain datacube information */ + cpl_errorstate_set(preState); + } + + /* Check prestate */ + if (!cpl_errorstate_is_equal(preState)) { + cpl_free(noise_name); + cpl_propertylist_delete(header_convert1D); + if (data) cpl_vector_delete(data); + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Load raw spectrum and the STAR_SPEC from IFU.%02d failed!", ifu->num); + } + } + } + + /* Check that all of IFU_Y have data */ + if (!data) { + cpl_free(noise_name); + if (header_convert1D) cpl_propertylist_delete(header_convert1D); + return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "Data science datacube spectrum not found to IFU_Y=%d", ifu->num); + } + + /* Parse from cpl_vector to 1D spectrum: Need to storage cpl_propertylist form 3D Datacube to 1D spectrumn */ + ifu->header_1D_data = cpl_propertylist_duplicate(header_convert1D); + cpl_propertylist_delete(header_convert1D); + if (kmos_molecfit_parse_1D_Spectrum(data, ifu) != CPL_ERROR_NONE) { + cpl_free(noise_name); + if (data) cpl_vector_delete(data); + return cpl_error_get_code(); + } + cpl_vector_delete(data); + + cpl_msg_info(cpl_func, "IFU.%02d - Extension: %02d:%s --> Properties charged in extension: %02d and 1D data spectrum extracted!)", + ifu->num, ifu->ext, ifu->name, ext_data); + } + + /* If data, turn coherente the headers */ + if (ifu->header_1D_data) { + + /* Data header */ + cpl_propertylist_delete(ifu->header_ext_data); + ifu->header_ext_data = cpl_propertylist_duplicate(ifu->header_1D_data); + cpl_propertylist_update_string(ifu->header_ext_data, EXTNAME, ifu->name); + + /* Noise header */ + cpl_propertylist_delete(ifu->header_ext_noise); + ifu->header_ext_noise = cpl_propertylist_duplicate(ifu->header_1D_data); + cpl_propertylist_update_string(ifu->header_ext_noise, EXTNAME, noise_name); + } + } + + /* Cleanup */ + cpl_free(noise_name); + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Parse 1D Spectrum and put the data in ifu + * + * @param spc cpl_vector that contains the 1D spectrum + * @param ifu Concrete IFU in KMOS + * + * @return cpl_error + * + */ +/*----------------------------------------------------------------------------*/ +static cpl_error_code kmos_molecfit_parse_1D_Spectrum( + cpl_vector *spec, kmos_spectrum *ifu) { + + cpl_error_ensure(spec && ifu, CPL_ERROR_NULL_INPUT, + return CPL_ERROR_NULL_INPUT, "Null inputs parse spectrum"); + + /* Get preState */ + cpl_errorstate preState = cpl_errorstate_get(); + + /* Create structure */ + double n_wave = cpl_vector_get_size(spec); + ifu->data = cpl_table_new(n_wave); + cpl_table_new_column(ifu->data, MF_SPECTRUM_COLUMN_WLEN, CPL_TYPE_DOUBLE); + cpl_table_new_column(ifu->data, MF_SPECTRUM_COLUMN_FLUX, CPL_TYPE_DOUBLE); + + /* Get Wavelength values: CRVAL1 (initial wavelength) and CDELT1 (step wavelength) */ + ifu->header_CRVAL1 = cpl_propertylist_get_double(ifu->header_1D_data, CRVAL1); + double wave_ini = ifu->header_CRVAL1; + if (wave_ini < 0. || wave_ini > 4.) { + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + CRVAL1"=%g invalid reading propertylist in %s", wave_ini, ifu->name); + } + ifu->header_CDELT1 = cpl_propertylist_get_double(ifu->header_1D_data, CDELT1); + double wave_step = ifu->header_CDELT1; + if (wave_step <= 0 || wave_ini + (n_wave * wave_step) > 4.) { + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + CDELT1"=%g invalid reading propertylist in %s", wave_ini, ifu->name); + } + + /* Set waveleght */ + double wavelength = wave_ini; + for (cpl_size i = 0; i < n_wave; i++) { + cpl_table_set_double(ifu->data, MF_SPECTRUM_COLUMN_WLEN, i, wavelength); + wavelength += wave_step; + } + + /* Set flux */ + cpl_table_copy_data_double(ifu->data, MF_SPECTRUM_COLUMN_FLUX, cpl_vector_get_data(spec)); + + /* Set median (It need non_null values) */ + cpl_size n_nonnull = 0; + cpl_size n_pos = cpl_vector_get_size(spec); + for (cpl_size i = 0; i < n_pos; i++) { + if (!isnan(cpl_vector_get(spec, i))) n_nonnull++; + } + cpl_vector *data_nonnull = cpl_vector_new(n_nonnull); + cpl_size j = 0; + for (cpl_size i = 0; i < n_pos; i++) { + double d = cpl_vector_get(spec, i); + if (!isnan(d)) { + cpl_vector_set(data_nonnull, j, d); + j++; + } + } + ifu->median = cpl_vector_get_median(data_nonnull); + cpl_vector_delete(data_nonnull); + + + /* Check preState */ + if (!cpl_errorstate_is_equal(preState)) { + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Parse 1D spectrum from IFU.%02d failed!", ifu->num); + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Extract a 1D spectrum from a extension datacube data in one FITS file + * + * @param filename filename with the FITS file that conteins the datacube + * @param ext Extension that conteins the datacube + * @param header out: header of extension with the changes need for conver 3D in 1D + * + * @return cpl_vector * Spectrum extracted from the extension datacube data + * or NULL in case of error. + */ +/*----------------------------------------------------------------------------*/ +cpl_vector * kmos_molecfit_extract_spec_from_datacube( + const char *filename, int ext, cpl_propertylist *header) +{ + /* load data */ + cpl_imagelist *imgList = cpl_imagelist_load(filename, CPL_TYPE_FLOAT, ext); + if (!imgList) { + cpl_error_set_message(cpl_func, CPL_ERROR_FILE_IO, + "Cannot load datacube from %s, ext=%d", filename, ext); + return NULL; + } + + cpl_vector *data = NULL; + if (cpl_imagelist_get_size(imgList) > 0) { + + /*** Extract 1D spectrum from the input imagelist datacube ***/ + kmo_priv_extract_spec(imgList, NULL, NULL, &data, NULL); + cpl_imagelist_delete(imgList); + if (!data) { + cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND, + "Cannot extract 1D spectrum from datacube in %s, ext=%d", filename, ext); + return NULL; + } + + /* Check datacube header properties */ + if( !cpl_propertylist_has(header, CRPIX3) || + !cpl_propertylist_has(header, CRVAL3) || + !cpl_propertylist_has(header, CDELT3) || + !cpl_propertylist_has(header, CTYPE3) ){ + cpl_vector_delete(data); + cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, "Not all input data are in the header!"); + return NULL; + } + + /*** Change WCS here (CRPIX3 goes to CRPIX1 etc...) ***/ + cpl_errorstate prestate = cpl_errorstate_get(); + + if (cpl_propertylist_has(header, CTYPE1)) { + const char *key = cpl_propertylist_get_string(header, CTYPE1); + if (strcmp(key, "WAVE") != 0) cpl_propertylist_update_string(header, CTYPE1, "WAVE"); + } else { + cpl_propertylist_set_string(header, CTYPE1, "WAVE"); + } + if (cpl_propertylist_has(header, CTYPE2)) cpl_propertylist_erase(header, CTYPE2); + + if (cpl_propertylist_has(header, CUNIT1)) { + const char *unit = cpl_propertylist_get_string(header, CUNIT1); + if(strcmp(unit, "um") != 0) cpl_propertylist_update_string(header, CUNIT1, "um"); + } else { + cpl_propertylist_append_string(header, CUNIT1, "um"); + } + if (cpl_propertylist_has(header, CUNIT2)) cpl_propertylist_erase(header, CUNIT2); + if (cpl_propertylist_has(header, CUNIT3)) cpl_propertylist_erase(header, CUNIT3); + + cpl_propertylist_set_double(header, CRPIX1, cpl_propertylist_get_double(header, CRPIX3)); + cpl_propertylist_erase( header, CRPIX2); + cpl_propertylist_erase( header, CRPIX3); + + cpl_propertylist_set_double(header, CRVAL1, cpl_propertylist_get_double(header, CRVAL3)); + cpl_propertylist_erase( header, CRVAL2); + cpl_propertylist_erase( header, CRVAL3); + + cpl_propertylist_set_double(header, CDELT1, cpl_propertylist_get_double(header, CDELT3)); + cpl_propertylist_erase( header, CDELT2); + cpl_propertylist_erase( header, CDELT3); + + cpl_propertylist_set_string(header, CTYPE1, cpl_propertylist_get_string(header, CTYPE3)); + cpl_propertylist_erase( header, CTYPE2); + cpl_propertylist_erase( header, CTYPE3); + + cpl_propertylist_erase( header, CD1_1); + cpl_propertylist_erase( header, CD1_2); + cpl_propertylist_erase( header, CD1_3); + + cpl_propertylist_erase( header, CD2_1); + cpl_propertylist_erase( header, CD2_2); + cpl_propertylist_erase( header, CD2_3); + + cpl_propertylist_erase( header, CD3_1); + cpl_propertylist_erase( header, CD3_2); + cpl_propertylist_erase( header, CD3_3); + + if (!cpl_errorstate_is_equal(prestate)) { + cpl_vector_delete(data); + cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, + "Cannot update the header to convert 3D datacube header en 1D spectrum header from %s, ext=%d", filename, ext); + return NULL; + } + } + + return data; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Load and setup a convolution kernel provided by the user + * + * @param frameset Input frameset list + * @param conf The parameter configuration variable in the recipe + * + * @return cpl_error_code + * + * Description: + * Load the convolution kernel library from a file and cast their kernels to a cpl_matrix for use in molecfit. + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_molecfit_load_kernels( + const cpl_frame *frm, kmos_molecfit_parameter *conf) +{ + /* Check frame */ + cpl_error_ensure(frm, CPL_ERROR_DATA_NOT_FOUND, + return CPL_ERROR_DATA_NOT_FOUND, "Kernel library not found in input frameset!"); + + /* Get and verify input parameters in the header */ + const char *filename = cpl_frame_get_filename(frm); + + /* Get primary header */ + conf->header_kernels = cpl_propertylist_load(filename, 0); + cpl_error_ensure(conf->header_kernels, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load kernels library primary header propertylist from '%s'!", filename); + + /* Check PRO.CATG */ + if (strcmp(cpl_propertylist_get_string(conf->header_kernels, "ESO PRO CATG"), "KERNEL_LIBRARY") != 0) { + cpl_msg_warning(cpl_func, "Input kernel library PRO.CATG isn't %s, is %s", + KERNEL_LIBRARY, cpl_propertylist_get_string(conf->header_kernels, "ESO PRO CATG")); + } + + /* Load kernel for each IFU with data. The DATA are in the odd extension */ + cpl_msg_info(cpl_func, "Loading convolution kernel library ('%s') from the file '%s' ...", KERNEL_LIBRARY, filename); + for (cpl_size i = 0; i < N_IFUS; i++) { + kmos_spectrum *ifu = &(conf->ifus[i]); + kmos_spectrum *ifu_map = &(conf->ifus[ifu->map - 1]); + kmos_kernel *kernel = &(ifu->kernel); + + /* ifu = ifu_map in kmos_molecfit_model and it can be different in kmos_molecfit_calctrans */ + if (ifu_map->data) { + + /* Load kernel */ + if (kmos_molecfit_load_kernel(filename, kernel) != CPL_ERROR_NONE) { + return cpl_error_get_code(); + } + + /* If data spectrum loaded, resampling kernel (When it's necessary) */ + if (kmos_molecfit_resample_kernel(ifu, ifu_map->header_CRVAL1, ifu_map->header_CDELT1, cpl_table_get_nrow(ifu_map->data)) != CPL_ERROR_NONE) { + return cpl_error_get_code(); + } + } + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Load and setup one convolution kernel provided by the kernel library + * + * @param filename Kernel library file (including path) + * @param kernel out: variable to fill, but it contains the extension to load + * + * @return cpl_error_code + * + * Description: + * Load the convolution kernel from the kernelibrary and cast it to a cpl_matrix + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_molecfit_load_kernel( + const char *filename, kmos_kernel *kernel) +{ + cpl_error_ensure(filename && kernel, CPL_ERROR_NULL_INPUT, + return CPL_ERROR_NULL_INPUT, "Null inputs"); + + /* Get header of extension */ + kernel->header_ext = cpl_propertylist_load(filename, kernel->ext); + cpl_error_ensure(kernel->header_ext, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load convolution kernel library extension propertylist from '%s', ext=%d!", filename, kernel->ext); + + kernel->name = cpl_propertylist_get_string(kernel->header_ext, EXTNAME); + cpl_error_ensure(kernel->name, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot get the extension name in propertylist from '%s', ext=%d!", filename, kernel->ext); + + /* Check molec_list variable*/ + int n_tokens; + char **tokens = kmo_strsplit(kernel->name, ".", &n_tokens); + if (n_tokens != 4) { + kmo_strfreev(tokens); + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Unexpected error in the name of kernel library extension"); + } else { + kernel->num = atoi(tokens[1]); + if (kernel->num < 1 || kernel->num > N_IFUS) { + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Unexpected error in the ifu name of kernel library extension"); + } + } + kmo_strfreev(tokens); + + + /* Load kernel */ + cpl_msg_info(cpl_func, "Loading kernel - IFU[%02d], Extension[%03d]: %s ...", kernel->num, kernel->ext, kernel->name); + cpl_image *imgKernel = cpl_image_load(filename, CPL_TYPE_DOUBLE, 0, kernel->ext); + cpl_error_ensure(imgKernel, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load kernel library extension=%d!", kernel->ext); + + + /* Create the needed matrix version of the convolution kernel from the input kernel image. */ + cpl_errorstate e_state = cpl_errorstate_get(); + cpl_matrix *tmp = cpl_matrix_wrap( cpl_image_get_size_y(imgKernel), + cpl_image_get_size_x(imgKernel), + cpl_image_get_data_double(imgKernel)); + kernel->data = cpl_matrix_duplicate(tmp); + cpl_matrix_unwrap(tmp); + cpl_image_delete(imgKernel); + if (!cpl_errorstate_is_equal(e_state)) { + return cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Setup of convolution kernel failed!"); + } + + /* Get Wavelength values in kernel : CRVAL1 (initial wavelength) and CD2_2 (step wavelength) */ + kernel->header_CRVAL1 = cpl_propertylist_get_double(kernel->header_ext, CRVAL1); + double wave_ini = kernel->header_CRVAL1; + if (wave_ini < 0. || wave_ini > 4.) { + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + CRVAL1"=%g invalid reading propertylist in %s", wave_ini, kernel->name); + } + kernel->header_CD2_2 = cpl_propertylist_get_double(kernel->header_ext, CD2_2); + double wave_step = kernel->header_CD2_2; + if (wave_step <= 0 || wave_ini + (cpl_matrix_get_nrow(kernel->data) * wave_step) > 4.) { + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + CD2_2"=%g invalid reading propertylist in %s", wave_ini, kernel->name); + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Get a kernel->resampled with the number of rows indicate in kernel->n_rows_resampled + * + * @param ifu Struct variable with all info about the IFU + * @param header_map cpl_propertylist of the reference map IFU (It's possible that the header_map = ifu->header_ext_data) + * + * @return cpl_error_code + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_molecfit_resample_kernel( + kmos_spectrum *ifu, double spec_lambda_ini, double spec_lambda_delta, cpl_size spec_n_lambdas) +{ + /* Check ifu */ + cpl_error_ensure(ifu, CPL_ERROR_NULL_INPUT, + return CPL_ERROR_NULL_INPUT, "Null input spectrum structure"); + + /* Check pointers in ifu */ + cpl_error_ensure(ifu->kernel.header_ext && ifu->kernel.data, CPL_ERROR_NULL_INPUT, + return CPL_ERROR_NULL_INPUT, "Null inputs kernel data"); + + /* Get KERNEL header values */ + double kernel_lambda_ini = cpl_propertylist_get_double(ifu->kernel.header_ext, CRVAL1); + double kernel_lambda_delta = cpl_propertylist_get_double(ifu->kernel.header_ext, CD2_2 ); + cpl_size kernel_n_lambdas = cpl_propertylist_get_int( ifu->kernel.header_ext, NAXIS2); + cpl_size kernel_n_points = cpl_propertylist_get_int( ifu->kernel.header_ext, NAXIS1); + + /* Check values in the headers */ + cpl_error_ensure(spec_lambda_ini > 0 && kernel_lambda_ini > 0 && + spec_lambda_delta > 0 && kernel_lambda_delta > 0 && + spec_n_lambdas > 0 && kernel_n_lambdas > 0 && + kernel_n_points > 0, CPL_ERROR_ILLEGAL_INPUT, + return CPL_ERROR_ILLEGAL_INPUT, "Illegal value in the inputs headers"); + + double diff_lambda_ini = fabs(spec_lambda_ini - kernel_lambda_ini ); + double diff_lambda_delta = fabs(spec_lambda_delta - kernel_lambda_delta); + + /* Check if it's necessary resample the kernel */ + if ( spec_n_lambdas != kernel_n_lambdas || + diff_lambda_ini > 1.e-4 || + diff_lambda_delta > 1.e-4 ){ + + cpl_msg_info(cpl_func, "Resampling kernel - IFU[%02d], Extension[%03d]: %s ... n_lambdas(SPEC=%lld, KERNEL=%lld), diff_lambda_ini=%g, diff_lambda_delta=%g", + ifu->kernel.num, ifu->kernel.ext, ifu->kernel.name, spec_n_lambdas, kernel_n_lambdas, diff_lambda_ini, diff_lambda_delta); + + /* Save original kernel and create the new kernel */ + cpl_matrix *k_new = ifu->kernel.data; + cpl_matrix *k_old = cpl_matrix_duplicate(k_new); + cpl_matrix_delete(k_new); + k_new = cpl_matrix_new(spec_n_lambdas, kernel_n_points); + + /* Get access to rows in the matrix */ + double* k_old_d = cpl_matrix_get_data(k_old); + double* k_new_d = cpl_matrix_get_data(k_new); + + /* Loop about the lambdas */ + double lambdaSpec = spec_lambda_ini; + cpl_size k_old_idx = 0; + for (cpl_size i = 0; i < spec_n_lambdas; i++) { + + /* Initialize index */ + cpl_size k_old_idx_i = k_old_idx; + cpl_size k_old_idx_j = k_old_idx; + + /* Get index kernels: top/down */ + double lambdaKernel_ini = kernel_lambda_ini + k_old_idx_i * kernel_lambda_delta; + double lambdaKernel_end = lambdaKernel_ini; + while(lambdaKernel_end < lambdaSpec) { + if (lambdaKernel_end + kernel_lambda_delta < lambdaSpec) { + k_old_idx_i++; + } + k_old_idx_j++; + lambdaKernel_end += kernel_lambda_delta; + } + + /* The last position doesn't match between ifu and kernel, Not resampling for avoid access beyond the boundaries */ + if (k_old_idx_j + 1 > kernel_n_lambdas) { + + k_old_idx_j = k_old_idx_i; + lambdaKernel_end = lambdaKernel_ini; + } + + /* Update index */ + k_old_idx = k_old_idx_i; + + /* Get Row and high resolution signal */ + cpl_size k_new_index = i * kernel_n_points; + cpl_size k_old_index_1 = k_old_idx_i * kernel_n_points; + cpl_size k_old_index_2 = k_old_idx_j * kernel_n_points; + + /* Check if (i==j) --> (init/end cases) */ + if (k_old_idx_i == k_old_idx_j) { + + /* Copy values related with k_old_index_1 */ + for (cpl_size j = 0; j < kernel_n_points; j++) { + k_new_d[j + k_new_index] = k_old_d[j + k_old_index_1]; + } + + } else { + + /* Apply linear interpolation */ + double x = lambdaSpec; + double x1 = lambdaKernel_ini; + double x2 = lambdaKernel_end; + for (cpl_size j = 0; j < kernel_n_points; j++) { + double y1 = k_old_d[j + k_old_index_1]; + double y2 = k_old_d[j + k_old_index_2]; + + k_new_d[j + k_new_index] = y1 + (x - x1) * (y2 - y1) / (x2 - x1); + } + } + + /* Next lambda */ + lambdaSpec += spec_lambda_delta; + } + + /* Cleanup */ + cpl_matrix_delete(k_old); + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Read library kernel from FITS file and save to ASCII file + * + * @param refFitsFile FITS file path (including absolute path) of kernel library + * @param target_dir ASCII file name (including absolute path) of kernel library + * + * @return cpl_error_code + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_molecfit_kernelLibrary_FITS_2_ASCII( + const char *refFitsFile, const char *target_dir) { + + struct stat st = {0}; + if (stat(target_dir, &st) == -1) { + mkdir(target_dir, 0700); + } + + /* Load kernel in each extension */ + cpl_msg_info(cpl_func, "Loading kernel library ('%s') from the file '%s' ...", KERNEL_LIBRARY, refFitsFile); + for (cpl_size i = 0; i < N_KERNEL_LIBRARY_EXTENSIONS; i = i + 1) { + + int ext = i + 1; + + /* Get header of extension */ + cpl_propertylist *header = cpl_propertylist_load(refFitsFile, ext); + cpl_error_ensure(header, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load convolution kernel library extension propertylist from '%s', ext=%d!", refFitsFile, ext); + + /* Get name extension */ + const char *name = cpl_propertylist_get_string(header, EXTNAME); + if (!name) { + cpl_propertylist_delete(header); + return cpl_error_set_message(cpl_func, cpl_error_get_code(), "Cannot get the extension name in propertylist from '%s', ext=%d!", refFitsFile, ext); + } + + /* Get data in the extension */ + cpl_image *imgKernel = cpl_image_load(refFitsFile, CPL_TYPE_DOUBLE, 0, ext); + if (!imgKernel) { + cpl_propertylist_delete(header); + return cpl_error_set_message(cpl_func, cpl_error_get_code(), "Cannot load kernel library extension=%d!", ext); + } + + /* Open output file */ + char *str = cpl_sprintf("%s/%s.dat", target_dir, name); + FILE *stream = fopen(str, "w"); + cpl_free(str); + if (!stream) { + cpl_propertylist_delete(header); + cpl_image_delete(imgKernel); + return cpl_error_set_message(cpl_func, CPL_ERROR_FILE_IO, "Path problem with the kernel library extension (%s)", name); + } + + /* Get error state */ + cpl_errorstate preState = cpl_errorstate_get(); + + /* Dump to file in matrix format */ + cpl_matrix *mat = cpl_matrix_wrap( cpl_image_get_size_y(imgKernel), + cpl_image_get_size_x(imgKernel), + cpl_image_get_data_double(imgKernel)); + cpl_matrix_dump(mat, stream); + cpl_matrix_unwrap(mat); + + /* Cleanup */ + cpl_propertylist_delete(header); + cpl_image_delete(imgKernel); + fclose(stream); + + /* Check errorstate */ + if (!cpl_errorstate_is_equal(preState)) { + return cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Dump kernel library extension (%s) failed!", name); + } + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Read library kernel from ASCII file and save to FITS file + * + * @param refFitsFile Reference fits file (for to get the header and add only the kernels) + * @param target_dir folder (absolute path) that contains the kernel library files in ASCII + * @param target_fits FITS file path (including absolute path) of new FITS kernel library + * + * @return cpl_error_code + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_molecfit_kernelLibrary_ASCII_2_FITS( + const char *refFitsFile, const char *target_dir, const char *target_fits) { + + cpl_error_ensure(strcmp(refFitsFile, target_fits) != 0, CPL_ERROR_ILLEGAL_INPUT, + return CPL_ERROR_ILLEGAL_INPUT, "Source and target are equal!"); + + /* Get header of extension */ + cpl_propertylist *pl_header = cpl_propertylist_load(refFitsFile, 0); + cpl_error_ensure(pl_header, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load propertylist from '%s'!", refFitsFile); + cpl_propertylist_save(pl_header, target_fits, CPL_IO_CREATE); + cpl_propertylist_delete(pl_header); + + /* Load every kernel extension */ + for (cpl_size idx = 0; idx < N_KERNEL_LIBRARY_EXTENSIONS; idx++) { + int ext = idx + 1; + + /* Get header of extension */ + cpl_propertylist *ext_header = cpl_propertylist_load(refFitsFile, ext); + cpl_error_ensure(ext_header, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load convolution kernel library extension propertylist from '%s', ext=%d!", refFitsFile, ext); + + /* get file name of extension */ + const char* name = cpl_propertylist_get_string(ext_header, EXTNAME); + + /* Load orignal data from the fits file */ + cpl_image *imgKernel = cpl_image_load(refFitsFile, CPL_TYPE_DOUBLE, 0, ext); + cpl_error_ensure(imgKernel, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load kernel library extension=%d!", ext); + + cpl_matrix *mat = cpl_matrix_wrap( cpl_image_get_size_y(imgKernel), + cpl_image_get_size_x(imgKernel), + cpl_image_get_data_double(imgKernel)); + + cpl_size n_rows = cpl_matrix_get_nrow(mat); + cpl_size n_cols = cpl_matrix_get_ncol(mat); + + /* Initialize with a know value */ + for (cpl_size i = 0; i < n_rows; i++) { + for (cpl_size j = 0; j < n_cols; j++){ + cpl_matrix_set(mat, i, j, DBL_MIN); + } + } + + /* Open input dump file */ + char *filename = cpl_sprintf("%s/%s.dat", target_dir, name); + FILE *stream = fopen(filename, "r"); + if (!stream) { + cpl_propertylist_delete(ext_header); + cpl_matrix_unwrap(mat); + cpl_image_delete(imgKernel); + cpl_free(filename); + return cpl_error_set_message(cpl_func, CPL_ERROR_FILE_IO, "Cannot open file dump of kernel library extension (%s)", name); + } + + /* Read and set cpl_image */ + char line[1024]; + cpl_size n_lines = -1; + while(fgets(line, 1024 - 1, stream)) { + n_lines++; + + /* In order to jump the col index and the last empty line */ + cpl_size row = n_lines - 1; + if (n_lines > 0 && row < n_rows) { + + int n_tokens; + char **tokens = kmo_strsplit(line, " ", &n_tokens); + + /* Copy nonempty at the beginning of array */ + int n_tokens_nonempty = -1; + for (cpl_size token = 0; token < n_tokens; token++) { + if(strcmp(tokens[token],"") != 0) { + /* Jump the row index in the file */ + if (n_tokens_nonempty >= 0) { + strcpy(tokens[n_tokens_nonempty],tokens[token]); + } + n_tokens_nonempty++; + } + } + + /* Check loading data in file dump */ + if (n_tokens_nonempty != n_cols) { + cpl_propertylist_delete(ext_header); + cpl_matrix_unwrap(mat); + cpl_image_delete(imgKernel); + cpl_free(filename); + kmo_strfreev(tokens); + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "File dump no compatible with the kernel library extension (%s), different number of data colums", name); + } + + /* Set values in the matrix */ + cpl_size col = 0; + for (cpl_size token = 0; token < n_tokens_nonempty; token++){ + double value = strtod(tokens[token], NULL); + cpl_matrix_set(mat, row, col, value); + col++; + } + + /* Cleanup array */ + kmo_strfreev(tokens); + } + } + cpl_msg_info(cpl_func,"File dump %s load and restored!", filename); + fclose(stream); + + /* Save extension and cleanup*/ + cpl_matrix_unwrap(mat); + cpl_image_save(imgKernel, target_fits, CPL_TYPE_FLOAT, ext_header, CPL_IO_EXTEND); + cpl_propertylist_delete(ext_header); + cpl_image_delete(imgKernel); + cpl_free(filename); + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Save to disk a new *.fits output file + * + * @param frameset Input frameset in the recipe. + * @param parlist Input parameter list in the recipe. + * @param recipe Name of the recipe + * @param list Propertylist with the recipe input parameters + * @param tag Tag in the ESO PRO CATG property. + * @param gratingname Name of grating, for if filename is NULL + * @param filename Name of the output *.fits file, if NULL the funtion compose the name with the tag + * + * @return cpl_error_code + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_molecfit_save( + cpl_frameset *frameset, + const cpl_parameterlist *parlist, + const char *recipe, + cpl_propertylist *list, + const char *tag, + const char *gratingname, + const char *filename) +{ + /* Check inputs */ + cpl_error_ensure(frameset && parlist && strcmp(recipe, "") != 0 && list && strcmp(tag, "") != 0, + CPL_ERROR_NULL_INPUT, return CPL_ERROR_NULL_INPUT, "Null inputs in save function"); + + /*** Save the base files ***/ + cpl_errorstate preState = cpl_errorstate_get(); + + /* Set applist with the input recipe parameters */ + cpl_propertylist *applist = cpl_propertylist_duplicate(list); + cpl_propertylist_update_string(applist, CPL_DFS_PRO_CATG, tag); + if (strcmp(tag, SINGLE_SPECTRA) == 0 || strcmp(tag, SINGLE_CUBES) == 0 ){ + cpl_propertylist_update_string(applist, CPL_DFS_PRO_TECH, "IFU"); + cpl_propertylist_update_bool( applist, CPL_DFS_PRO_SCIENCE, CPL_TRUE); + } + + /* Get filename: If filename not NULL get this, if NULL create with tag */ + char *tag_fits; + if (filename) { + tag_fits = cpl_sprintf("%s", filename); + } else if (gratingname){ + tag_fits = cpl_sprintf("%s_%s%s%s.fits", tag, gratingname, gratingname, gratingname); + } else { + tag_fits = cpl_sprintf("%s.fits", tag); + } + + /* Save to disk the fits file */ + cpl_dfs_save_propertylist( frameset, NULL, parlist, frameset, NULL, + recipe, applist, NULL, PACKAGE "/" PACKAGE_VERSION, + tag_fits); + cpl_free(tag_fits); + + /* Cleanup */ + cpl_propertylist_delete(applist); + + /* Check possible errors */ + if (!cpl_errorstate_is_equal(preState)) { + return cpl_error_get_code(); + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Save IFU output cpl_table data to disk: Only add data to extension + * + * @param header_data IFU header of data + * @param header_noise IFU header of noise + * @param tag Name of the output *.fits file. + * @param gratingname Name of grating, for if filename is NULL + * @param filename Name of the output *.fits file, if NULL the funtion compose the name with the tag + * @param table cpl_table data to save in one concrete IFU (only one table or spec, if exist both only the table). + * @param vec 1D vector spectrum data to save in one concrete IFU (only one table or spec, if exist both only the table). + * + * @return cpl_error_code + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_molecfit_save_mf_results( + cpl_propertylist *header_data, + cpl_propertylist *header_noise, + const char *tag, + const char *gratingname, + const char *filename, + cpl_table *table, + cpl_vector *vec) +{ + /* Check inputs */ + cpl_error_ensure(header_data && header_noise && tag, + CPL_ERROR_NULL_INPUT, return CPL_ERROR_NULL_INPUT, "Null inputs in IFU molecfit save data execution"); + + /*** Save the IFU extension files {DATA,NOISE} ***/ + cpl_errorstate preState = cpl_errorstate_get(); + + /* Get filename: If filename not NULL get this, if NULL create with tag */ + char *tag_fits; + if (filename) { + tag_fits = cpl_sprintf("%s", filename); + } else if (gratingname){ + tag_fits = cpl_sprintf("%s_%s%s%s.fits", tag, gratingname, gratingname, gratingname); + } else { + tag_fits = cpl_sprintf("%s.fits", tag); + } + + /* Save to disk */ + if (table) { + cpl_table_save(table, NULL, header_data, tag_fits, CPL_IO_EXTEND); + }else if (vec) { + cpl_vector_save(vec, tag_fits, CPL_TYPE_DOUBLE, header_data, CPL_IO_EXTEND); + } else { + cpl_propertylist_save(header_data, tag_fits, CPL_IO_EXTEND); + } + cpl_propertylist_save(header_noise, tag_fits, CPL_IO_EXTEND); + cpl_free(tag_fits); + + /* Check possible errors */ + if (!cpl_errorstate_is_equal(preState)) { + return cpl_error_get_code(); + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Deallocate the given parameter generic configuration struct and its contents + * + * @param conf The parameter configuration variable in the recipe. + */ +/*----------------------------------------------------------------------------*/ +void kmos_molecfit_clean( + kmos_molecfit_parameter *conf) +{ + if (conf) { + + if (conf->parms) cpl_propertylist_delete(conf->parms); + if (conf->header_spectrums) cpl_propertylist_delete(conf->header_spectrums); + + for (cpl_size i = 0; i < N_IFUS; i++) { + kmos_spectrum *ifu = &(conf->ifus[i]); + kmos_molecfit_clean_spectrum(ifu); + } + + kmos_grating *grating = &(conf->grating); + kmos_molecfit_clean_graing(grating); + + if (conf->header_kernels) cpl_propertylist_delete(conf->header_kernels); + } +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Deallocate the given parameter IFU spectrum configuration struct and its contents + * + * @param ifu One parameter spectrum in the recipe. + */ +/*----------------------------------------------------------------------------*/ +void kmos_molecfit_clean_spectrum( + kmos_spectrum *ifu) { + if (ifu->name) cpl_free( ifu->name); + if (ifu->header_ext_data) cpl_propertylist_delete(ifu->header_ext_data); + if (ifu->header_ext_noise) cpl_propertylist_delete(ifu->header_ext_noise); + if (ifu->header_1D_data) cpl_propertylist_delete(ifu->header_1D_data); + if (ifu->data) cpl_table_delete( ifu->data); + kmos_kernel *kernel = &(ifu->kernel); + kmos_molecfit_clean_kernel(kernel); +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Deallocate the given parameter kernel configuration struct and its contents + * + * @param kernel One parameter kernel in the recipe. + */ +/*----------------------------------------------------------------------------*/ +void kmos_molecfit_clean_kernel( + kmos_kernel *kernel) { + if (kernel->header_ext) cpl_propertylist_delete(kernel->header_ext); + if (kernel->data) cpl_matrix_delete( kernel->data); +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Deallocate the given parameter grating configuration struct and its contents + * + * @param grating One parameter grating in the recipe. + */ +/*----------------------------------------------------------------------------*/ +void kmos_molecfit_clean_graing( + kmos_grating *grating) { + if (grating->incl_wave_ranges) cpl_table_delete( grating->incl_wave_ranges); + if (grating->molecules) cpl_table_delete( grating->molecules); +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Nullify the given parameter generic configuration object and its contents + * + * @param conf The parameter configuration variable in the recipe. + */ +/*----------------------------------------------------------------------------*/ +void kmos_molecfit_nullify( + kmos_molecfit_parameter *conf) +{ + if (conf) { + + conf->parms = NULL; + conf->header_spectrums = NULL; + + for (cpl_size i = 0; i < N_IFUS; i++) { + + kmos_spectrum* ifu = &(conf->ifus[i]); + ifu->name = NULL; + ifu->header_ext_data = NULL; + ifu->header_ext_noise = NULL; + ifu->header_1D_data = NULL; + ifu->data = NULL; + + kmos_kernel* kernel = &(ifu->kernel); + kernel->header_ext = NULL; + kernel->data = NULL; + } + + kmos_grating *grating = &(conf->grating); + grating->incl_wave_ranges = NULL; + grating->molecules = NULL; + + conf->header_kernels = NULL; + } +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Get the directory of execution + * + * @return Path of execution + * + */ +/*----------------------------------------------------------------------------*/ +char * kmos_molecfit_cwd_get(void) +{ + char cwd[4096]; + if (!getcwd(cwd, sizeof cwd)) { + return NULL; + } + + char *path = cpl_sprintf("%s", cwd); + return path; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Set the temporary directory variable with path + * + * @param path A valid path + * @param oldpath Previous temporary path + * + * @return cpl_error_code + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_molecfit_tmpdir_set(const char *path, char **oldpath) +{ + if (oldpath && (*oldpath != NULL)) { + return -1; + } + + const char *tmpdir = getenv("TMPDIR"); + + if (!path) { + unsetenv("TMPDIR"); + } else { + if (setenv("TMPDIR", path, 1)) { + return CPL_ERROR_INCOMPATIBLE_INPUT; + } + } + + if (oldpath) { + *oldpath = cpl_strdup(tmpdir); + } + + return CPL_ERROR_NONE; +} + +/**@}*/ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmos_molecfit.h cpl-plugin-kmos-2.0.2+dfsg/kmos/kmos_molecfit.h --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmos_molecfit.h 1970-01-01 00:00:00.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmos_molecfit.h 2018-04-24 11:43:06.000000000 +0000 @@ -0,0 +1,298 @@ +/* + * This file is part of the KMOS Pipeline + * Copyright (C) 2002,2003 European Southern Observatory + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef KMOS_MOLECFIT_H +#define KMOS_MOLECFIT_H + +/*----------------------------------------------------------------------------*/ +/** + * Includes + */ +/*----------------------------------------------------------------------------*/ + +#include +#include + +#include +#include + +#include "kmo_constants.h" +#include "kmo_utils.h" +#include "kmo_dfs.h" +#include "kmos_pfits.h" + + +/*----------------------------------------------------------------------------*/ +/** + * Defines + */ +/*----------------------------------------------------------------------------*/ + +/* KMOS_MOLECFIT RECIPES */ +#define KMOS_MOLECFIT_MODEL "kmos_molecfit_model" +#define KMOS_MOLECFIT_CALCTRANS "kmos_molecfit_calctrans" +#define KMOS_MOLECFIT_CORRECT "kmos_molecfit_correct" + +/* FRAME TAGS */ + +/* RAW: DATA */ +//#define KMOS_TAG_STAR_SPEC "STAR_SPEC" /* CPL_VECTOR (1D, ROWS=X): 1-HEADER + 48 -EXTENSIONS (DATA+NOISE) */ +//#define KMOS_TAG_EXTRACT_SPEC "EXTRACT_SPEC" /* CPL_VECTOR (1D, ROWS=X): 1-HEADER + (24/48)-EXTENSIONS (DATA/NOISE) */ +//#define KMOS_TAG_SCIENCE "SCIENCE" /* CPL_IMAGELIST (3D, N_IMG=X, ROWS=COLS=14): 1-HEADER + (24/48)-EXTENSIONS (DATA/NOISE) */ +//#define KMOS_TAG_SCI_RECONSTRUCTED "SCI_RECONSTRUCTED" /* CPL_IMAGELIST (3D, N_IMG=X, ROWS=COLS=14): 1-HEADER + (24/48)-EXTENSIONS (DATA/NOISE) */ + +/* CALIB: KERNEL */ +//#define KMOS_TAG_KERNEL "KERNEL_LIBRARY" /* CPL_IMAGE (2D, ROWS=Y, COLS=15): 1-HEADER + (24*6)-EXTENSIONS (DATA) */ + +/* CALIB: kmos_molecfit_model */ +//#define KMOS_TAG_ATMOS_PARM "ATMOS_PARM" /* CPL_TABLE (2D, ROWS=50, COLS=4 ): 1-HEADER + 48 -EXTENSIONS (DATA+NOISE) */ +//#define KMOS_TAG_BEST_FIT_PARM "BEST_FIT_PARM" /* CPL_TABLE (2D, ROWS=36, COLS=3 ): 1-HEADER + 48 -EXTENSIONS (DATA+NOISE) */ +//#define KMOS_TAG_BEST_FIT_MODEL "BEST_FIT_MODEL" /* CPL_TABLE (2D, ROWS=X, COLS=11): 1-HEADER + 48 -EXTENSIONS (DATA+NOISE) */ + +/* CALIB: kmos_molecfit_calctrans */ +//#define KMOS_TAG_TELLURIC_DATA "TELLURIC_DATA" /* CPL_TABLE (2D, ROWS=X, COLS=9): 1-HEADER + 48 -EXTENSIONS (DATA+NOISE) */ +//#define KMOS_TAG_TELLURIC "TELLURIC" /* CPL_VECTOR (1D, ROWS=X): 1-HEADER + 48 -EXTENSIONS (DATA+NOISE) */ + +/* CALIB: RESPONSE */ +//#define KMOS_TAG_RESPONSE "RESPONSE" /* CPL_VECTOR (1D, ROWS=X): 1-HEADER + 48 -EXTENSIONS (DATA+NOISE) */ + +/* CALIB: kmos_molecfit_correct */ +//#define KMOS_TAG_SPEC_SINGLE "SINGLE_SPECTRA" /* CPL_VECTOR (1D, ROWS=X): 1-HEADER + 48 -EXTENSIONS (DATA+NOISE) */ +//#define KMOS_TAG_CUBE_SINGLE "SINGLE_CUBES" /* CPL_IMAGELIST (3D, N_IMG=X, ROWS=COLS=14): 1-HEADER + 48 -EXTENSIONS (DATA+NOISE) */ + + +/* Column names of the input spectrum table */ +#define MF_SPECTRUM_COLUMN_WLEN "lambda" +#define MF_SPECTRUM_COLUMN_FLUX "flux" +#define MF_SPECTRUM_COLUMN_FLUX_ERROR "fluxerr" +#define MF_SPECTRUM_COLUMN_MASK "mask" + +/* Column names of the input wavelength table */ +#define MF_WAVELENGTH_COLUMN_LOWER "llim" +#define MF_WAVELENGTH_COLUMN_UPPER "ulim" + +/* Column names of the input molecules table */ +#define MF_MOLECULES_COLUMN_LIST "list_molec" +#define MF_MOLECULES_COLUMN_FIT "fit_molec" +#define MF_MOLECULES_COLUMN_RELCOL "relcol" + + +/* Name of parameter in the output fits file */ +#define KMOS_MF_PARAM_RECIPE "ESO DRS MOLECFIT PARAM " + +/* KMOS counters */ +#define N_IFUS 24 +#define N_KERNEL_LIBRARY_EXTENSIONS N_IFUS * 6 + +/* Wavelength detection limits in KMOS */ +#define KMOS_WAVELENGTH_START 0.8 +#define KMOS_WAVELENGTH_END 2.5 + +/* Initial FWHM of the Gaussian in pixels have Grating dependency */ +#define RES_GAUSS_IZ 1.84 +#define RES_GAUSS_YJ 1.82 +#define RES_GAUSS_H 1.76 +#define RES_GAUSS_K 1.73 +#define RES_GAUSS_HK 2.06 + +#define MOLECFIT_MAX_POLY_FIT 8 + + +/*----------------------------------------------------------------------------*/ +/** + * Typedefs: Structs and enum types + */ +/*----------------------------------------------------------------------------*/ + +typedef struct { + const char *name; /* Kernel extension name */ + int num; /* IFU number */ + int ext; /* IFU.ANGLE num extension in the kernel library */ + cpl_propertylist *header_ext; /* Header property list in IFU extension of kernel library for the specific angle */ + double header_CRVAL1; /* RA at ref. pixel [deg] */ + double header_CD2_2; /* Pixel resolution in x [deg] */ + cpl_matrix *data; /* Convolution kernel values specifics in the grating */ +} kmos_kernel; + +typedef struct { + cpl_boolean process; /* Flag: Process this IFU or not */ + int map; /* Mapping of ifu (in kmos_molecfit_calctrans relation between IFU_X and IFU_Y */ + char *name; /* IFU extension name in the raw file */ + int num; /* IFU number in the raw file */ + int ext; /* IFU extension number in the raw file */ + cpl_propertylist *header_ext_data; /* Header property list in IFU data extension of raw file */ + cpl_propertylist *header_ext_noise; /* Header property list in IFU noise extension of raw file */ + cpl_propertylist *header_1D_data; /* Header property list convert from 3D DataCube to 1D spectrum, if necessary */ + double header_CRVAL1; /* RA at ref. pixel [deg] */ + double header_CDELT1; /* Pixel resolution in x [deg] */ + cpl_table *data; /* Wavelength data in the input file. Contain only one column with wavelengths */ + double median; /* Median of data spectrum */ + kmos_kernel kernel; /* Associate kernel to one IFU */ +} kmos_spectrum; + +typedef enum { + GRATING_IZ = 0, /* KMOS IZ grating */ + GRATING_YJ, /* KMOS YJ grating */ + GRATING_H, /* KMOS H grating */ + GRATING_K, /* KMOS K grating */ + GRATING_HK /* KMOS HK grating */ +} kmos_grating_type; + +typedef struct { + const char *name; /* Specific unique grating to these spectrums data: 'IZ', 'YJ', 'H', 'K', 'HK' */ + kmos_grating_type type; /* Type that match with grating_name */ + const char *wave_range; /* wave_ranges{ini1,end1,...,iniN,endN} defined by the user to fit in the grating */ + const char *list_molec; /* list_molec{H2O,CO,CO2,CH4,O2} str defined by the user to fit in the grating */ + const char *fit_molec; /* fit_molec {1, 0, 1, 1, 0 } flag defined by the user to fit in the grating */ + const char *relcol; /* relDensity{1.,1.,1.06,1.,1. } double defined by the user to fit in the grating */ + cpl_table *incl_wave_ranges; /* Wavelength ranges to fit in the grating. Contains 2 columns(llim, ulim) */ + cpl_table *molecules; /* Molecules to fit. Contains 3 columns (list_molec, fit_molec, relcol) */ +} kmos_grating; + +typedef struct { + cpl_boolean fit; /* Flag: Polynomial fit */ + cpl_size n; /* Polynomial degree */ + double const_val; /* Initial value of the constant term of the polynomial fit */ +} mf_fit; + +typedef struct { + cpl_propertylist *parms; /* Input recipe parameters to be save in the output res_out fits file */ + kmos_spectrum ifus[N_IFUS]; /* Data ifu spectrums. Contains name, property list, data and scale of wavelength */ + cpl_propertylist *header_spectrums; /* Primary property list header in the raw STAR_SPEC file */ + float rot_angle; /* Rotator relative to nasmyth [deg] */ + kmos_grating grating; /* Grating data by user or default values */ + cpl_boolean use_input_kernel; /* The parameters below are ignored if use_input_kernel */ + cpl_propertylist *header_kernels; /* Primary property list header in the kernel library file */ + cpl_boolean kernmode; /* Voigt profile approx. or independent Gauss and Lorentz */ + double kernfac; /* Size of kernel in FWHM */ + cpl_boolean varkern; /* Does the kernel size increase linearly with wavelength? */ + mf_fit fit_continuum; /* Continuum fit */ + mf_fit fit_wavelenght; /* Wavelength solution refinement/adjustment */ +} kmos_molecfit_parameter; + + +/*----------------------------------------------------------------------------*/ +/** + * Functions prototypes + */ +/*----------------------------------------------------------------------------*/ + +/* Insert parameter in the input parameterlist */ +cpl_error_code kmos_molecfit_fill_parameter( + const char* recipe, cpl_parameterlist *self, const char* param, + cpl_boolean range, const void *rMin, const void *rMax, + cpl_type type, const void *value, const char* description, + cpl_boolean mf_conf); + +/* Set the grating type that check with grating string */ +cpl_error_code kmos_molecfit_grating_type( + const char* name, kmos_grating_type *type); + +/* Fill type grating with parameters by default */ +cpl_error_code kmos_molecfit_grating_by_default( + kmos_grating *grating, kmos_grating_type type); + +/* Generate the wave_range and molecules cpl_table's */ +cpl_error_code kmos_molecfit_generate_wave_molec_tables( + kmos_molecfit_parameter *conf); + +/* Fill the molecfit generic configuration file */ +cpl_parameterlist * kmos_molecfit_conf_generic( + const char* recipe, kmos_molecfit_parameter *conf); + +/* Get frame with input data */ +cpl_frame * kmos_molecfit_get_frame_spectrums( + cpl_frameset *frameset); + +/* Load input spectrum in the RAW file for a kmos_std_star execution */ +cpl_error_code kmos_molecfit_load_spectrums( + cpl_frameset *frameset, kmos_molecfit_parameter *conf, const char *recipe_name); + +/* Extract a 1D spectrum from a extension datacube data in one FITS file */ +cpl_vector * kmos_molecfit_extract_spec_from_datacube( + const char *filename, int ext, cpl_propertylist *header); + +/* Load and setup the convolution kernels provided by the user for one grating */ +cpl_error_code kmos_molecfit_load_kernels( + const cpl_frame *frm, kmos_molecfit_parameter *conf); + +/* Load a convolution kernel for one specific extensions in the kernel library */ +cpl_error_code kmos_molecfit_load_kernel( + const char *filename, kmos_kernel *kernel); + +/* Get a resampled kernel with the number of rows indicate in n_rows_resampled */ +cpl_error_code kmos_molecfit_resample_kernel( + kmos_spectrum *ifu, double spec_lambda_ini, double spec_lambda_delta, cpl_size spec_n_lambdas); + +/* Read library kernel from FITS file and save to ASCII file */ +cpl_error_code kmos_molecfit_kernelLibrary_FITS_2_ASCII( + const char *refFitsFile, const char *target_dir); + +/* Read library kernel from ASCII file and save to FITS file */ +cpl_error_code kmos_molecfit_kernelLibrary_ASCII_2_FITS( + const char *refFitsFile, const char *target_dir, const char *target_fits); + +/* Save to disk a new *.fits output file */ +cpl_error_code kmos_molecfit_save( + cpl_frameset *frameset, + const cpl_parameterlist *parlist, + const char *recipe, + cpl_propertylist *list, + const char *tag, + const char *gratingname, + const char *filename); + +/* Save to disk a cpl_table output for one IFU molecfit execution */ +cpl_error_code kmos_molecfit_save_mf_results( + cpl_propertylist *header_data, + cpl_propertylist *header_noise, + const char *tag, + const char *gratingname, + const char *filename, + cpl_table *table, + cpl_vector *vec); + +/* Clean configuration generic parameter */ +void kmos_molecfit_clean( + kmos_molecfit_parameter *conf); + +/* Clean spectrum parameter */ +void kmos_molecfit_clean_spectrum( + kmos_spectrum *ifu); + +/* Clean kernel parameter */ +void kmos_molecfit_clean_kernel( + kmos_kernel *kernel); + +/* Clean grating parameter */ +void kmos_molecfit_clean_graing( + kmos_grating *grating); + +/* Nullify configuration generic parameter */ +void kmos_molecfit_nullify( + kmos_molecfit_parameter *conf); + +/* Get the directory of execution */ +char * kmos_molecfit_cwd_get(void); + +/* Set the temporary directory variable with path */ +cpl_error_code kmos_molecfit_tmpdir_set(const char *path, char **oldpath); + + +#endif /* KMOS_MOLECFIT_H */ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmos_pfits.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmos_pfits.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmos_pfits.c 2015-12-14 17:13:53.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmos_pfits.c 2018-04-20 09:41:58.000000000 +0000 @@ -57,6 +57,42 @@ /*----------------------------------------------------------------------------*/ /** + @brief find out the seeing + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_ia_fwhmlin(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "ESO TEL IA FWHM") ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the airmass start + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_airmass_start(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "ESO TEL AIRM START") ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the airmass end + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_airmass_end(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "ESO TEL AIRM END") ; +} + +/*----------------------------------------------------------------------------*/ +/** @brief find out the position angle @param plist property list to read from @return the requested value @@ -69,6 +105,18 @@ /*----------------------------------------------------------------------------*/ /** + @brief find out the extname + @param plist property list to read from + @return pointer to statically allocated character string + */ +/*----------------------------------------------------------------------------*/ +const char * kmos_pfits_get_extname(const cpl_propertylist * plist) +{ + return (const char *) cpl_propertylist_get_string(plist, "EXTNAME"); +} + +/*----------------------------------------------------------------------------*/ +/** @brief find out the arcfile @param plist property list to read from @return pointer to statically allocated character string @@ -81,6 +129,165 @@ /*----------------------------------------------------------------------------*/ /** + @brief find out the OBJECT + @param plist property list to read from + @return pointer to statically allocated character string + */ +/*----------------------------------------------------------------------------*/ +const char * kmos_pfits_get_object(const cpl_propertylist * plist) +{ + return (const char *) cpl_propertylist_get_string(plist, "OBJECT"); +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the expmask name + @param plist property list to read from + @return pointer to statically allocated character string + */ +/*----------------------------------------------------------------------------*/ +const char * kmos_pfits_get_qc_expmask_name(const cpl_propertylist * plist) +{ + return (const char *) cpl_propertylist_get_string(plist, + "ESO QC EXPMASK NAME"); +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the collapse image name + @param plist property list to read from + @return pointer to statically allocated character string + */ +/*----------------------------------------------------------------------------*/ +const char * kmos_pfits_get_qc_collapse_name(const cpl_propertylist * plist) +{ + return (const char *) cpl_propertylist_get_string(plist, + "ESO QC COLLAPSE NAME"); +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the QC COMBINED_CUBES NB + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +int kmos_pfits_get_qc_combined_cubes_nb(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_int(plist, "ESO QC COMBINED_CUBES NB"); +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the QC EXPMASK AVG + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_qc_expmask_avg(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "ESO QC EXPMASK AVG"); +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the QC ARC AR VSCALE + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_qc_ar_vscale(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "ESO QC ARC AR VSCALE"); +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the QC ARC NE VSCALE + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_qc_ne_vscale(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "ESO QC ARC NE VSCALE"); +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the QC ARC AR FWHM MEAN + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_qc_ar_fwhm_mean(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "ESO QC ARC AR FWHM MEAN"); +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the QC ARC NE FWHM MEAN + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_qc_ne_fwhm_mean(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "ESO QC ARC NE FWHM MEAN"); +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the QC ARC NE POS STDEV + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_qc_ne_pos_stdev(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "ESO QC ARC NE POS STDEV"); +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the QC ARC AR POS STDEV + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_qc_ar_pos_stdev(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "ESO QC ARC AR POS STDEV"); +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the QC CUBE_UNIT + @param plist property list to read from + @return pointer to statically allocated character string + */ +/*----------------------------------------------------------------------------*/ +const char * kmos_pfits_get_qc_cube_unit(const cpl_propertylist * plist) +{ + return (const char *) cpl_propertylist_get_string(plist,"ESO QC CUBE_UNIT"); +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the PROG ID + @param plist property list to read from + @return pointer to statically allocated character string + */ +/*----------------------------------------------------------------------------*/ +const char * kmos_pfits_get_progid(const cpl_propertylist * plist) +{ + return (const char *) cpl_propertylist_get_string(plist, + "ESO OBS PROG ID"); +} + +/*----------------------------------------------------------------------------*/ +/** @brief find out the TPL ID @param plist property list to read from @return pointer to statically allocated character string @@ -107,6 +314,18 @@ /*----------------------------------------------------------------------------*/ /** + @brief find out the NCOMBINE value + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +int kmos_pfits_get_datancom(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_int(plist, "ESO PRO DATANCOM") ; +} + +/*----------------------------------------------------------------------------*/ +/** @brief find out the NAXIS1 value @param plist property list to read from @return the requested value @@ -143,6 +362,30 @@ /*----------------------------------------------------------------------------*/ /** + @brief find out the MJD-OBS value + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_mjd_obs(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "MJD-OBS") ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the PRO MJD-OBS value + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_pro_mjd_obs(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "ESO PRO MJD-OBS") ; +} + +/*----------------------------------------------------------------------------*/ +/** @brief find out the DIT value @param plist property list to read from @return the requested value @@ -165,4 +408,76 @@ return cpl_propertylist_get_int(plist, "ESO DET NDIT") ; } +/*----------------------------------------------------------------------------*/ +/** + @brief find out the OBS ID value + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +int kmos_pfits_get_obs_id(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_int(plist, "ESO OBS ID") ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the CRVAL1 value + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_crval1(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "CRVAL1") ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the CDELT1 value + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_cdelt1(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "CDELT1") ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the CRVAL3 value + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_crval3(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "CRVAL3") ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the CRPIX3 value + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_crpix3(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "CRPIX3") ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief find out the CD3_3 value + @param plist property list to read from + @return the requested value + */ +/*----------------------------------------------------------------------------*/ +double kmos_pfits_get_cd3_3(const cpl_propertylist * plist) +{ + return cpl_propertylist_get_double(plist, "CD3_3") ; +} + /**@}*/ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmos_pfits.h cpl-plugin-kmos-2.0.2+dfsg/kmos/kmos_pfits.h --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmos_pfits.h 2015-12-14 17:13:53.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmos_pfits.h 2018-04-20 09:29:02.000000000 +0000 @@ -34,13 +34,39 @@ int kmos_pfits_get_naxis2(const cpl_propertylist *) ; int kmos_pfits_get_naxis3(const cpl_propertylist *) ; int kmos_pfits_get_ndit(const cpl_propertylist *) ; +int kmos_pfits_get_obs_id(const cpl_propertylist *) ; +int kmos_pfits_get_qc_combined_cubes_nb(const cpl_propertylist *) ; +int kmos_pfits_get_datancom(const cpl_propertylist *) ; double kmos_pfits_get_dit(const cpl_propertylist *) ; double kmos_pfits_get_rotangle(const cpl_propertylist *) ; double kmos_pfits_get_exptime(const cpl_propertylist *) ; +double kmos_pfits_get_crval1(const cpl_propertylist *) ; +double kmos_pfits_get_cdelt1(const cpl_propertylist *) ; +double kmos_pfits_get_crval3(const cpl_propertylist *) ; +double kmos_pfits_get_crpix3(const cpl_propertylist *) ; +double kmos_pfits_get_cd3_3(const cpl_propertylist *) ; +double kmos_pfits_get_qc_ar_vscale(const cpl_propertylist *) ; +double kmos_pfits_get_qc_ne_vscale(const cpl_propertylist *) ; +double kmos_pfits_get_qc_ar_fwhm_mean(const cpl_propertylist *) ; +double kmos_pfits_get_qc_ne_fwhm_mean(const cpl_propertylist *) ; +double kmos_pfits_get_qc_ar_pos_stdev(const cpl_propertylist *) ; +double kmos_pfits_get_qc_ne_pos_stdev(const cpl_propertylist *) ; +double kmos_pfits_get_qc_expmask_avg(const cpl_propertylist *) ; +double kmos_pfits_get_mjd_obs(const cpl_propertylist *) ; +double kmos_pfits_get_pro_mjd_obs(const cpl_propertylist *) ; +double kmos_pfits_get_ia_fwhmlin(const cpl_propertylist *) ; +double kmos_pfits_get_airmass_start(const cpl_propertylist *) ; +double kmos_pfits_get_airmass_end(const cpl_propertylist *) ; +const char * kmos_pfits_get_extname(const cpl_propertylist *) ; const char * kmos_pfits_get_tplid(const cpl_propertylist *) ; +const char * kmos_pfits_get_progid(const cpl_propertylist *) ; const char * kmos_pfits_get_arcfile(const cpl_propertylist *) ; const char * kmos_pfits_get_readmode(const cpl_propertylist *) ; +const char * kmos_pfits_get_qc_cube_unit(const cpl_propertylist *) ; +const char * kmos_pfits_get_qc_collapse_name(const cpl_propertylist *) ; +const char * kmos_pfits_get_qc_expmask_name(const cpl_propertylist *) ; +const char * kmos_pfits_get_object(const cpl_propertylist *) ; #endif diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmos_priv_sky_tweak.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmos_priv_sky_tweak.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmos_priv_sky_tweak.c 2016-09-19 12:35:42.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmos_priv_sky_tweak.c 2018-04-10 10:34:10.000000000 +0000 @@ -208,7 +208,6 @@ const cpl_propertylist * header, float min_frac, int tbsub, - int ifu_nr, int skip_last, int stretch, int stretch_degree, @@ -218,8 +217,8 @@ { cpl_imagelist * result ; cpl_image * mask ; - cpl_bivector * obj_spec ; - cpl_bivector * sky_spec ; + cpl_bivector * obj_spec = NULL; + cpl_bivector * sky_spec = NULL; cpl_bivector * thermal_backg ; cpl_bivector * vscales ; cpl_vector * lambda ; @@ -365,9 +364,12 @@ vectors[1] = cpl_vector_wrap(arr_size, obj) ; vectors[2] = cpl_vector_wrap(arr_size, sky) ; + CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual); cpl_plot_vectors("set grid;set xlabel 'Wavelength (microns)';", "t 'Obj and Sky sub-band' w lines", "", - (const cpl_vector **)vectors, 3); + (const cpl_vector **)vectors, + 3); + CPL_DIAG_PRAGMA_POP; cpl_vector_unwrap(vectors[0]) ; cpl_vector_unwrap(vectors[1]) ; @@ -608,8 +610,6 @@ cpl_vector ** obj_spec, cpl_vector ** sky_spec) { - cpl_bivector * obj_spectrum ; - cpl_bivector * sky_spectrum ; cpl_vector * intobj ; cpl_vector * intsky ; const cpl_image * oimg ; @@ -734,20 +734,29 @@ nr_valid_int, m_is_rejected, o_is_rejected, s_is_rejected; - nx = cpl_image_get_size_x(cpl_imagelist_get_const(object, 0)); - ny = cpl_image_get_size_y(cpl_imagelist_get_const(object, 0)); - nz = cpl_imagelist_get_size(object); + /* Check entries */ + + if (first_nonan==NULL) { + cpl_msg_error(__func__, "Illegal inputs") ; + cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; + return CPL_ERROR_ILLEGAL_INPUT ; + } else { + *first_nonan = -1 ; + } + + nx = cpl_image_get_size_x(cpl_imagelist_get_const(object, 0)); + ny = cpl_image_get_size_y(cpl_imagelist_get_const(object, 0)); + nz = cpl_imagelist_get_size(object); snx = cpl_image_get_size_x(cpl_imagelist_get_const(sky, 0)); sny = cpl_image_get_size_y(cpl_imagelist_get_const(sky, 0)); snz = cpl_imagelist_get_size(sky); - *first_nonan = -1 ; - /* Check entries */ - if (nx!=snx || ny!=sny || nz!=snz || first_nonan==NULL) { + if (nx!=snx || ny!=sny || nz!=snz) { cpl_msg_error(__func__, "Illegal inputs") ; cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; return CPL_ERROR_ILLEGAL_INPUT ; } + if (nz != cpl_vector_get_size(lambda)) { cpl_msg_error(__func__, "Illegal inputs") ; cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; @@ -862,7 +871,7 @@ cpl_bivector * result ; double * scalings ; double * lambda_boundaries ; - char ** labels ; + const char ** labels ; const double * lambda ; const double * intobj ; const double * intsky ; @@ -1228,11 +1237,13 @@ cpl_vector * sky_lines_map_vec, int * cont_start, int * cont_end, - int * cont_size, - int * lines_size) + int * local_cont_size, + int * local_lines_size) { int current_line_size, nr_samples, i ; + /* local_ prefix added to avoid conflict with global variables */ + /* Initialise */ current_line_size = 0 ; nr_samples = cpl_vector_get_size(sky_lines_map_vec) ; @@ -1240,8 +1251,8 @@ /* Make sure cont/line regions start and end with a contin. reg */ *cont_start = -1; *cont_end = -1; - *cont_size = 0; - *lines_size = 0; + *local_cont_size = 0; + *local_lines_size = 0; for (i=0; i 0.) { /*** Line ***/ @@ -1252,13 +1263,13 @@ /*** Continuum ***/ if (*cont_start == -1) *cont_start = i; *cont_end = i; - (*cont_size)++; - *lines_size += current_line_size; + (*local_cont_size)++; + *local_lines_size += current_line_size; current_line_size = 0; } } cpl_msg_debug(__func__, "Cont [%d, %d] size: %d / Lines size: %d", - *cont_start, *cont_end, *cont_size, *lines_size) ; + *cont_start, *cont_end, *local_cont_size, *local_lines_size) ; return 0 ; } @@ -1603,8 +1614,6 @@ double * ppos ; double * resampled_array ; cpl_vector * new_pos ; - cpl_bivector * ref_spec ; - cpl_bivector * resampled_spec ; int spec_size, nx, ny, i, j, k ; /* Initialize */ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmos_priv_sky_tweak.h cpl-plugin-kmos-2.0.2+dfsg/kmos/kmos_priv_sky_tweak.h --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmos_priv_sky_tweak.h 2016-09-13 17:34:23.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmos_priv_sky_tweak.h 2018-04-09 13:42:16.000000000 +0000 @@ -37,7 +37,6 @@ const cpl_propertylist * header, float min_frac, int tbsub, - int ifu_nr, int skip_last, int stretch, int stretch_degree, diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_utils.c cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_utils.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_utils.c 2016-12-21 12:56:26.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_utils.c 2018-04-09 13:42:16.000000000 +0000 @@ -60,7 +60,6 @@ int ifu_nr, double angle, int * xtnum) ; -static int kmos_sci_red_clean_plist(cpl_propertylist *) ; /*----------------------------------------------------------------------------*/ /** @@ -93,6 +92,155 @@ return kmos_license ; } +/*----------------------------------------------------------------------------*/ +/** + @brief Return a pointer to the basename of a full-path filename + @param self The filename + @return The pointer (possibly self, which may be NULL) + @note The pointer returned by this function may not be used after self is + de/re-allocated, nor after a call of the function with another string. + */ +/*----------------------------------------------------------------------------*/ +const char * kmos_get_base_name(const char * self) +{ + const char * p = self ? strrchr(self, '/') : NULL; + + return p ? p + 1 : self; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief check the entries in the recipe and classify the frameset with the tags + * + * @param frameset input set of frames + * + * @return cpl_error_code + */ +/*----------------------------------------------------------------------------*/ +cpl_error_code kmos_check_and_set_groups( + cpl_frameset *frameset) +{ + /* Check size of frameset for to know if the sof file is not empty */ + cpl_size nframes = cpl_frameset_get_size(frameset); + if(nframes <= 0){ + + /* Empty sof file */ + return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND, + "There aren't frames in the frameset"); + } else { + for (cpl_size i = 0; i < nframes; i++) { + + cpl_frame *frame = cpl_frameset_get_position(frameset, i); + const char *filename = cpl_frame_get_filename(frame); + + /* Check if the FITS file exist and have correct data, + * return 0 if the fits file is valid without extensions */ + if (cpl_fits_count_extensions(filename) < 0){ + + return cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Problem with the file '%s' (%s --> Code %d)", + filename, cpl_error_get_message(), cpl_error_get_code()); + } + } + } + + /* Identify the RAW, CONF and CALIB frames in the input frameset */ + if (kmo_dfs_set_groups(frameset) != 1) { + + /* Error classify frames */ + return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND, + "Cannot classify RAW and/or CALIB frames"); + } else { + + /* Check classification */ + for (cpl_size i = 0; i < nframes; i++) { + + cpl_frame *frame = cpl_frameset_get_position(frameset, i); + const char *tag = cpl_frame_get_tag(frame); + cpl_frame_group group = cpl_frame_get_group(frame); + + /* The tag is invalid */ + if (group == CPL_FRAME_GROUP_NONE) { + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Frame:%lld with tag:%s is invalid", i, tag); + } + } + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief Count the number of RAW files in a frameset + @param in A non-empty frameset + @return the count, or -1 in error case + */ +/*----------------------------------------------------------------------------*/ +int kmos_count_raw_in_frameset(const cpl_frameset * in) +{ + const cpl_frame * cur_frame ; + int nbframes, nbraw ; + int i ; + + /* Test entries */ + if (in == NULL) return -1 ; + + /* Initialise */ + nbframes = cpl_frameset_get_size(in) ; + nbraw = 0 ; + + /* Loop frames */ + for (i=0 ; i 0) { @@ -1487,7 +1711,7 @@ } else if (strcmp(arr_content[i], EXT_LIST) == 0) { nr_list++; arr_id[i] = i+1; - arr_xtension[i] = BINTABLE; + arr_xtension[i] = cpl_sprintf("%s", BINTABLE); } else { KMO_TRY_ASSURE(1==0, CPL_ERROR_ILLEGAL_INPUT, "First subheader has a content flag of %s (instead of DATA, NOISE or BADPIX)", @@ -1499,7 +1723,7 @@ XTENSION)) == 0) { /* XTENSION = BINTABLE */ nr_list++; - arr_xtension[i] = BINTABLE; + arr_xtension[i] = cpl_sprintf("%s", BINTABLE); arr_type[i] = list_frame; @@ -1880,13 +2104,24 @@ cpl_free(arr_type); arr_type = NULL; cpl_free(arr_id); arr_id = NULL; cpl_free(arr_tfields); arr_tfields = NULL; - if (arr_content != NULL) { + + if (arr_content) { for (i = 0; i < desc.nr_ext; i++) { - cpl_free(arr_content[i]); arr_content[i] = NULL; + if (arr_content[i]) { + cpl_free(arr_content[i]); + } } } - cpl_free(arr_content); arr_content = NULL; - cpl_free(arr_xtension); arr_xtension = NULL; + cpl_free(arr_content); + + if(arr_xtension) { + for (i = 0; i < desc.nr_ext; i++) { + if (arr_xtension[i]) { + cpl_free(arr_xtension[i]); + } + } + } + cpl_free(arr_xtension); return desc; } @@ -2315,7 +2550,7 @@ @li CPL_ERROR_NULL_INPUT if @c frameset is NULL. */ -cpl_array** kmo_get_unused_ifus(const cpl_frameset *frameset, +cpl_array** kmo_get_unused_ifus(cpl_frameset *frameset, int use_telluric, int use_illum) { @@ -2335,6 +2570,7 @@ ILLUM_CORR_FLAT, STD, TELLURIC, + TELLURIC_GEN, /*STD_IMAGE, STD_MASK, STAR_SPEC, @@ -2396,10 +2632,11 @@ // 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_telluric && (strcmp(cat_check[i_cat], TELLURIC_GEN)==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, + header = kmo_dfs_load_primary_header(frameset, cat_check[i_cat]); KMO_TRY_CHECK_ERROR_STATE(); @@ -2445,7 +2682,7 @@ cpl_propertylist_delete(header); header = NULL; // get header of next frame of type cat_check[i] - header = kmo_dfs_load_primary_header((cpl_frameset*)frameset, + header = kmo_dfs_load_primary_header(frameset, NULL); KMO_TRY_CHECK_ERROR_STATE(); } // END: loop frameset @@ -2832,6 +3069,8 @@ // prepare next token remainder = s + sz; if (strlen(remainder) == 0) { + /* TODO: s=NULL; is the proper thing to do according to JE + To be verified with a test */ s = ""; } else { s = strstr(remainder, delimiter); @@ -2971,4 +3210,6 @@ return s; } + + /** @} */ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_utils.h cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_utils.h --- cpl-plugin-kmos-1.4.3+dfsg/kmos/kmo_utils.h 2016-11-25 12:53:42.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/kmo_utils.h 2018-04-09 13:42:16.000000000 +0000 @@ -121,6 +121,17 @@ const char * kmos_get_license(void) ; +const char * kmos_get_base_name(const char *) ; + +cpl_error_code kmos_check_and_set_groups( + cpl_frameset *frameset); + +int kmos_count_raw_in_frameset(const cpl_frameset *) ; + +cpl_frameset * kmos_extract_frameset( + const cpl_frameset * in, + const char * tag) ; + cpl_image * kmos_illum_load( const char * filename, cpl_type im_type, @@ -133,8 +144,8 @@ const char * ifus_txt, const char * name, const char * obj_name) ; -int kmos_collapse_cubes(char *, cpl_frameset *, cpl_parameterlist *, double, - const char *, const char *, double, double, int, int, int) ; +int kmos_collapse_cubes(const char *, cpl_frameset *, cpl_parameterlist *, + double, const char *, const char *, double, double, int, int, int) ; cpl_frame * kmos_get_angle_frame(cpl_frameset *, int, const char *) ; cpl_frameset * kmos_get_angle_frameset(cpl_frameset *, int, const char *) ; cpl_frameset * kmos_purge_wrong_angles_frameset(cpl_frameset *, int, @@ -142,6 +153,10 @@ int * kmos_get_angles(cpl_frameset *, int *, const char *) ; +int kmos_3dim_clean_plist(cpl_propertylist *) ; +int kmos_all_clean_plist(cpl_propertylist *) ; + + cpl_error_code kmo_cut_endings(cpl_vector** vec, int *begin, int *end, @@ -152,7 +167,7 @@ double *sigma, double *area, double *offset); -cpl_vector* kmo_polyfit_1d(const cpl_vector *x, +cpl_vector* kmo_polyfit_1d( cpl_vector *x, const cpl_vector *y, const int degree); double kmo_to_deg(double val); @@ -180,7 +195,7 @@ const cpl_vector *indices); /* ---------------------- other --------------------------------------------- */ -cpl_array** kmo_get_unused_ifus(const cpl_frameset *frameset, +cpl_array** kmo_get_unused_ifus(cpl_frameset *frameset, int omit_telluric, int omit_illum); cpl_error_code kmo_set_unused_ifus(cpl_array **unused, diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/Makefile.am cpl-plugin-kmos-2.0.2+dfsg/kmos/Makefile.am --- cpl-plugin-kmos-1.4.3+dfsg/kmos/Makefile.am 2015-06-29 12:33:25.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/Makefile.am 2018-03-13 15:45:44.000000000 +0000 @@ -29,7 +29,7 @@ endif -INCLUDES = $(all_includes) -I../kmclipm/include/ +INCLUDES = $(all_includes) $(MOLECFIT_INCLUDES) -I../kmclipm/include/ noinst_HEADERS = kmo_constants.h \ kmo_cpl_extensions.h \ @@ -70,7 +70,8 @@ ../kmclipm/include/kmclipm_priv_reconstruct.h \ ../kmclipm/include/kmclipm_priv_splines.h \ ../kmclipm/include/kmclipm_vector.h \ - kmos_oscan.h + kmos_oscan.h \ + kmos_molecfit.h pkginclude_HEADERS = @@ -111,9 +112,10 @@ ../kmclipm/src/kmclipm_priv_reconstruct.c \ ../kmclipm/src/kmclipm_priv_splines.c \ ../kmclipm/src/kmclipm_vector.c \ - kmos_oscan.c + kmos_oscan.c \ + kmos_molecfit.c -libkmos_la_LDFLAGS = $(EXTRA_LDFLAGS) $(CPL_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -libkmos_la_LIBADD = $(LIBIRPLIB) $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE) +libkmos_la_LDFLAGS = $(EXTRA_LDFLAGS) $(CPL_LDFLAGS) $(MOLECFIT_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) +libkmos_la_LIBADD = $(LIBIRPLIB) $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE) $(LIBMOLECFIT) libkmos_la_DEPENDENCIES = $(LIBIRPLIB) diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/Makefile.in cpl-plugin-kmos-2.0.2+dfsg/kmos/Makefile.in --- cpl-plugin-kmos-1.4.3+dfsg/kmos/Makefile.in 2017-02-27 20:41:52.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/Makefile.in 2018-04-24 13:37:15.000000000 +0000 @@ -99,7 +99,8 @@ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4macros/molecfit.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ @@ -152,7 +153,7 @@ kmclipm_functions.lo kmclipm_math.lo kmclipm_priv_constants.lo \ kmclipm_priv_error.lo kmclipm_priv_functions.lo \ kmclipm_priv_reconstruct.lo kmclipm_priv_splines.lo \ - kmclipm_vector.lo kmos_oscan.lo + kmclipm_vector.lo kmos_oscan.lo kmos_molecfit.lo libkmos_la_OBJECTS = $(am_libkmos_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -321,6 +322,7 @@ LIBIRPLIB = @LIBIRPLIB@ LIBKMCLIPMLIB = @LIBKMCLIPMLIB@ LIBKMOS = @LIBKMOS@ +LIBMOLECFIT = @LIBMOLECFIT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -336,6 +338,10 @@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOLECFITDIR = @MOLECFITDIR@ +MOLECFIT_CFLAGS = @MOLECFIT_CFLAGS@ +MOLECFIT_INCLUDES = @MOLECFIT_INCLUDES@ +MOLECFIT_LDFLAGS = @MOLECFIT_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -350,6 +356,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG = @PKGCONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -425,7 +432,7 @@ DISTCLEANFILES = *~ SUBDIRS = tests @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = Makefile.in -INCLUDES = $(all_includes) -I../kmclipm/include/ +INCLUDES = $(all_includes) $(MOLECFIT_INCLUDES) -I../kmclipm/include/ noinst_HEADERS = kmo_constants.h \ kmo_cpl_extensions.h \ kmo_debug.h \ @@ -465,7 +472,8 @@ ../kmclipm/include/kmclipm_priv_reconstruct.h \ ../kmclipm/include/kmclipm_priv_splines.h \ ../kmclipm/include/kmclipm_vector.h \ - kmos_oscan.h + kmos_oscan.h \ + kmos_molecfit.h pkginclude_HEADERS = privatelib_LTLIBRARIES = libkmos.la @@ -504,10 +512,11 @@ ../kmclipm/src/kmclipm_priv_reconstruct.c \ ../kmclipm/src/kmclipm_priv_splines.c \ ../kmclipm/src/kmclipm_vector.c \ - kmos_oscan.c + kmos_oscan.c \ + kmos_molecfit.c -libkmos_la_LDFLAGS = $(EXTRA_LDFLAGS) $(CPL_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -libkmos_la_LIBADD = $(LIBIRPLIB) $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE) +libkmos_la_LDFLAGS = $(EXTRA_LDFLAGS) $(CPL_LDFLAGS) $(MOLECFIT_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) +libkmos_la_LIBADD = $(LIBIRPLIB) $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE) $(LIBMOLECFIT) libkmos_la_DEPENDENCIES = $(LIBIRPLIB) all: all-recursive @@ -620,6 +629,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmo_priv_std_star.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmo_priv_wave_cal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmo_utils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmos_molecfit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmos_oscan.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmos_pfits.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmos_priv_sky_tweak.Plo@am__quote@ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/create_data_kmos.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/create_data_kmos.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/create_data_kmos.c 2014-01-31 15:40:51.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/create_data_kmos.c 2018-04-09 13:42:16.000000000 +0000 @@ -8,7 +8,7 @@ /** @brief Switches off error-messages. */ -void kmo_test_verbose_off() +void kmo_test_verbose_off(void) { if (getenv("KMO_TEST_VERBOSE") == NULL) { cpl_msg_set_level(CPL_MSG_OFF); @@ -18,7 +18,7 @@ /** @brief Switches on error-messages. */ -void kmo_test_verbose_on() +void kmo_test_verbose_on(void) { if (getenv("KMO_TEST_VERBOSE") == NULL) { cpl_msg_set_level(CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_cpl_extensions-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_cpl_extensions-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_cpl_extensions-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_cpl_extensions-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -46,7 +46,7 @@ /** @brief tests kmo_image_histogram() */ -void test_kmo_image_histogram() +void test_kmo_image_histogram(void) { cpl_image *img = cpl_image_new(2, 2, CPL_TYPE_FLOAT); cpl_vector *res = NULL; @@ -63,7 +63,7 @@ /** @brief tests kmo_image_sort() */ -void test_kmo_image_sort() +void test_kmo_image_sort(void) { cpl_image *img = cpl_image_new(2, 2, CPL_TYPE_FLOAT); cpl_vector *res = NULL; @@ -80,7 +80,7 @@ /** @brief tests kmo_image_fill() */ -void test_kmo_image_fill() +void test_kmo_image_fill(void) { cpl_image *img = cpl_image_new(2, 2, CPL_TYPE_FLOAT); float tol = 0.01; @@ -94,7 +94,7 @@ /** @brief tests kmo_image_get_flux() */ -void test_kmo_image_get_flux() +void test_kmo_image_get_flux(void) { kmo_test_verbose_off(); kmo_image_get_flux(NULL); @@ -116,7 +116,7 @@ /** @brief tests kmo_image_reject_from_mask() */ -void test_kmo_image_reject_from_mask() +void test_kmo_image_reject_from_mask(void) { cpl_image *img = cpl_image_new(2, 1, CPL_TYPE_FLOAT); cpl_image *map = cpl_image_new(2, 1, CPL_TYPE_FLOAT); @@ -148,7 +148,7 @@ /** @brief tests kmo_imagelist_power() */ -void test_kmo_imagelist_power() +void test_kmo_imagelist_power(void) { cpl_imagelist *cube1 = cpl_imagelist_new(); @@ -189,7 +189,7 @@ /** @brief tests test_kmo_imagelist_get_mean() */ -void test_kmo_imagelist_get_mean() +void test_kmo_imagelist_get_mean(void) { cpl_imagelist *cube1 = cpl_imagelist_new(); @@ -206,7 +206,7 @@ /** @brief tests test_kmo_imagelist_get_flux() */ -void test_kmo_imagelist_get_flux() +void test_kmo_imagelist_get_flux(void) { cpl_imagelist *cube1 = cpl_imagelist_new(); @@ -223,7 +223,7 @@ /** @brief tests kmo_imagelist_turn() */ -void test_kmo_imagelist_turn() +void test_kmo_imagelist_turn(void) { int t; kmo_test_verbose_off(); @@ -260,7 +260,7 @@ /** @brief tests kmo_vector_divide() */ -void test_kmo_vector_divide() +void test_kmo_vector_divide(void) { cpl_vector *vec1 = cpl_vector_new(3), *vec2 = cpl_vector_new(3); @@ -285,7 +285,7 @@ /** @brief tests kmo_array_fill_int() */ -void test_kmo_array_fill_int() +void test_kmo_array_fill_int(void) { kmo_test_verbose_off(); kmo_array_fill_int(NULL, 0.0); @@ -302,7 +302,8 @@ /** @brief tests kmo_vector_histogram_old() */ -void test_kmo_vector_histogram_old() { +void test_kmo_vector_histogram_old(void) +{ /* all the same values in input vector --> all values in first entry of out-vector */ cpl_vector* in = cpl_vector_new(108); cpl_vector_fill(in, 1.23457834678); @@ -328,7 +329,7 @@ /** @brief tests kmo_image_divide_scalar() */ -void test_kmo_image_divide_scalar() +void test_kmo_image_divide_scalar(void) { cpl_image *img1 = cpl_image_new(2, 2, CPL_TYPE_FLOAT); int rej = 0; @@ -347,7 +348,7 @@ /** @brief tests kmo_image_divide() */ -void test_kmo_image_divide() +void test_kmo_image_divide(void) { cpl_image *img1 = cpl_image_new(2, 2, CPL_TYPE_FLOAT), *img2 = cpl_image_new(2, 2, CPL_TYPE_FLOAT); @@ -370,7 +371,7 @@ /** @brief tests kmo_image_power() */ -void test_kmo_image_power() +void test_kmo_image_power(void) { cpl_image *img1 = cpl_image_new(2, 2, CPL_TYPE_FLOAT); float tol = 0.01; @@ -386,7 +387,7 @@ /** @brief tests kmo_imagelist_divide_scalar() */ -void test_kmo_imagelist_divide_scalar() +void test_kmo_imagelist_divide_scalar(void) { cpl_imagelist *cube3 = cpl_imagelist_new(); cpl_image *tmp = NULL; @@ -413,7 +414,7 @@ /** @brief tests kmo_imagelist_divide() */ -void test_kmo_imagelist_divide() +void test_kmo_imagelist_divide(void) { cpl_imagelist *cube4 = cpl_imagelist_new(), *cube5 = cpl_imagelist_new(); @@ -444,7 +445,7 @@ /** @brief Tests for cpl extension functions. */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_debug-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_debug-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_debug-test.c 2014-07-23 14:38:18.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_debug-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -37,7 +37,7 @@ /** @brief test kmo_debug_header() */ -void test_kmo_debug_header() +void test_kmo_debug_header(void) { cpl_propertylist *pl = cpl_propertylist_new(); kmo_test_verbose_off(); @@ -50,7 +50,7 @@ /** @brief test kmo_debug_frameset() */ -void test_kmo_debug_frameset() +void test_kmo_debug_frameset(void) { cpl_frameset *fs = cpl_frameset_new(); kmo_test_verbose_off(); @@ -63,7 +63,7 @@ /** @brief test kmo_debug_frame() */ -void test_kmo_debug_frame() +void test_kmo_debug_frame(void) { cpl_frame *f = cpl_frame_new(); kmo_test_verbose_off(); @@ -76,7 +76,7 @@ /** @brief test kmo_debug_cube() */ -void test_kmo_debug_cube() +void test_kmo_debug_cube(void) { cpl_imagelist *cube = cpl_imagelist_new(); kmo_test_verbose_off(); @@ -89,7 +89,7 @@ /** @brief test kmo_debug_image() */ -void test_kmo_debug_image() +void test_kmo_debug_image(void) { cpl_image *img = cpl_image_new(5, 5, CPL_TYPE_FLOAT); kmo_test_verbose_off(); @@ -102,7 +102,7 @@ /** @brief test kmo_debug_vector() */ -void test_kmo_debug_vector() +void test_kmo_debug_vector(void) { cpl_vector *vec = cpl_vector_new(5); kmo_test_verbose_off(); @@ -116,7 +116,7 @@ /** @brief test kmo_debug_array() */ -void test_kmo_debug_array() +void test_kmo_debug_array(void) { cpl_array *a = cpl_array_new(5, CPL_TYPE_INT); kmo_test_verbose_off(); @@ -130,7 +130,7 @@ /** @brief test kmo_debug_desc() */ -void test_kmo_debug_desc() +void test_kmo_debug_desc(void) { kmo_test_verbose_off(); char *my_path = cpl_sprintf("%s/ref_data/KMOS_dummy.fits", getenv("srcdir")); @@ -144,7 +144,7 @@ /** @brief test kmo_debug_table() */ -void test_kmo_debug_table() +void test_kmo_debug_table(void) { cpl_table *t = cpl_table_new(3); kmo_test_verbose_off(); @@ -157,7 +157,7 @@ /** @brief test kmo_plot_vector() */ -void test_kmo_plot_vector() +void test_kmo_plot_vector(void) { kmo_test_verbose_off(); kmo_plot_vector(NULL, NULL, NULL); @@ -167,7 +167,7 @@ /** @brief test kmo_plot_vectors_xy() */ -void test_kmo_plot_vectors_xy() +void test_kmo_plot_vectors_xy(void) { kmo_test_verbose_off(); kmo_plot_vectors_xy(NULL, NULL, NULL, NULL); @@ -177,7 +177,7 @@ /** @brief test kmo_plot_vectors2() */ -void test_kmo_plot_vectors2() +void test_kmo_plot_vectors2(void) { kmo_test_verbose_off(); kmo_plot_vectors2(NULL, NULL, NULL, NULL, NULL); @@ -187,7 +187,7 @@ /** @brief test kmo_plot_image() */ -void test_kmo_plot_image() +void test_kmo_plot_image(void) { kmo_test_verbose_off(); kmo_plot_image(NULL, NULL, NULL); @@ -197,7 +197,7 @@ /** @brief Test of debug helper functions */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_dfs-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_dfs-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_dfs-test.c 2016-05-06 14:04:31.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_dfs-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -48,7 +48,7 @@ /** * @brief test strlower */ -void test_strlower() +void test_strlower(void) { char *s = cpl_sprintf("%s", "GAGA"); cpl_test_nonnull(strlower(s)); @@ -59,7 +59,7 @@ /** * @brief test kmo_extname_extractor */ -void test_kmo_extname_extractor() +void test_kmo_extname_extractor(void) { char *s = cpl_sprintf("%s", "DET.1.DATA"); enum kmo_frame_type type = illegal_frame; @@ -77,7 +77,7 @@ /** * @brief test kmo_extname_creator */ -void test_kmo_extname_creator() +void test_kmo_extname_creator(void) { char *s = kmo_extname_creator(detector_frame, 2, EXT_NOISE); @@ -89,7 +89,7 @@ /** * @brief test kmo_get_index_from_ocs_name */ -void test_kmo_get_index_from_ocs_name() +void test_kmo_get_index_from_ocs_name(void) { cpl_frame *fr = NULL; cpl_vector *v = NULL; @@ -150,7 +150,7 @@ /** * @brief test kmo_update_sub_keywords */ -void test_kmo_update_sub_keywords() +void test_kmo_update_sub_keywords(void) { cpl_propertylist *pl = cpl_propertylist_new(); @@ -177,7 +177,7 @@ /** * @brief test kmo_dfs_load_primary_header */ -void test_kmo_dfs_load_primary_header() +void test_kmo_dfs_load_primary_header(void) { cpl_propertylist *pl = NULL; cpl_frameset *fs = cpl_frameset_new(); @@ -207,7 +207,7 @@ /** * @brief test kmo_dfs_load_sub_header */ -void test_kmo_dfs_load_sub_header() +void test_kmo_dfs_load_sub_header(void) { cpl_propertylist *pl = NULL; cpl_frameset *fs = cpl_frameset_new(); @@ -241,7 +241,7 @@ /** * @brief test kmo_dfs_load_vector() */ -void test_kmo_dfs_load_vector() +void test_kmo_dfs_load_vector(void) { cpl_frameset *fs = NULL; cpl_frame *fr = NULL; @@ -293,7 +293,7 @@ /** * @brief test kmo_dfs_load_image() */ -void test_kmo_dfs_load_image() +void test_kmo_dfs_load_image(void) { cpl_frameset *fs = NULL; cpl_frame *fr = NULL; @@ -344,7 +344,7 @@ /** * @brief test kmo_dfs_load_image_window() */ -void test_kmo_dfs_load_image_window() +void test_kmo_dfs_load_image_window(void) { cpl_frameset *fs = NULL; cpl_frame *fr = NULL; @@ -401,7 +401,7 @@ /** * @brief test kmo_dfs_load_image_frame() */ -void test_kmo_dfs_load_image_frame() +void test_kmo_dfs_load_image_frame(void) { cpl_frame *fr = NULL; cpl_image *img = cpl_image_new(2, 2, CPL_TYPE_FLOAT), @@ -446,7 +446,7 @@ /** * @brief test kmo_dfs_load_image_frame_window() */ -void test_kmo_dfs_load_image_frame_window() +void test_kmo_dfs_load_image_frame_window(void) { cpl_frame *fr = NULL; cpl_image *img = cpl_image_new(2, 2, CPL_TYPE_FLOAT), @@ -503,7 +503,7 @@ /** * @brief test kmo_dfs_load_cube() */ -void test_kmo_dfs_load_cube() +void test_kmo_dfs_load_cube(void) { cpl_frameset *fs = NULL; cpl_frame *fr = NULL; @@ -557,7 +557,7 @@ /** * @brief test kmo_dfs_load_table() */ -void test_kmo_dfs_load_table() +void test_kmo_dfs_load_table(void) { kmo_test_verbose_off(); cpl_test_null(kmo_dfs_load_table(NULL, NULL, -1, -1)); @@ -585,7 +585,7 @@ /** * @brief test kmo_dfs_create_filename() */ -void test_kmo_dfs_create_filename() +void test_kmo_dfs_create_filename(void) { /* char *s = NULL; @@ -608,7 +608,7 @@ /** * @brief test kmo_dfs_save_main_header() */ -void test_kmo_dfs_save_main_header() +void test_kmo_dfs_save_main_header(void) { cpl_propertylist *pl = NULL; cpl_frameset *fs = cpl_frameset_new(); @@ -654,7 +654,7 @@ /** * @brief test kmo_dfs_save_sub_header() */ -void test_kmo_dfs_save_sub_header() +void test_kmo_dfs_save_sub_header(void) { cpl_propertylist *pl = NULL; @@ -682,7 +682,7 @@ /** * @brief test kmo_dfs_save_vector() */ -void test_kmo_dfs_save_vector() +void test_kmo_dfs_save_vector(void) { cpl_propertylist *pl = cpl_propertylist_new(), *main_header = NULL, @@ -741,7 +741,7 @@ /** * @brief test kmo_dfs_save_image() */ -void test_kmo_dfs_save_image() +void test_kmo_dfs_save_image(void) { cpl_propertylist *pl = cpl_propertylist_new(), *main_header = NULL, @@ -803,7 +803,7 @@ /** * @brief test kmo_dfs_save_cube() */ -void test_kmo_dfs_save_cube() +void test_kmo_dfs_save_cube(void) { cpl_propertylist *pl = cpl_propertylist_new(), *main_header = NULL, @@ -860,7 +860,7 @@ /** * @brief test kmo_dfs_save_table() */ -void test_kmo_dfs_save_table() +void test_kmo_dfs_save_table(void) { cpl_frameset *fs = cpl_frameset_new(); cpl_frame *fr = kmo_test_frame_new("aga_vec.fits", "", CPL_FRAME_GROUP_RAW); @@ -883,7 +883,7 @@ /** * @brief test kmo_dfs_get_frame */ -void test_kmo_dfs_get_frame() +void test_kmo_dfs_get_frame(void) { int flag = 0; cpl_frameset *fs = NULL; @@ -917,7 +917,7 @@ /** * @brief test kmo_dfs_get_parameter_bool */ -void test_kmo_dfs_get_parameter_bool() +void test_kmo_dfs_get_parameter_bool(void) { cpl_parameterlist *parl = cpl_parameterlist_new(); cpl_parameter *par = NULL; @@ -945,7 +945,7 @@ /** * @brief test kmo_dfs_get_parameter_int */ -void test_kmo_dfs_get_parameter_int() +void test_kmo_dfs_get_parameter_int(void) { cpl_parameterlist *parl = cpl_parameterlist_new(); cpl_parameter *par = NULL; @@ -972,7 +972,7 @@ /** * @brief test kmo_dfs_get_parameter_double */ -void test_kmo_dfs_get_parameter_double() +void test_kmo_dfs_get_parameter_double(void) { cpl_parameterlist *parl = cpl_parameterlist_new(); cpl_parameter *par = NULL; @@ -1000,7 +1000,7 @@ /** * @brief test kmo_dfs_get_parameter_string */ -void test_kmo_dfs_get_parameter_string() +void test_kmo_dfs_get_parameter_string(void) { cpl_parameterlist *parl = cpl_parameterlist_new(); cpl_parameter *par = NULL; @@ -1027,7 +1027,7 @@ /** * @brief test kmo_dfs_print_parameter_help */ -void test_kmo_dfs_print_parameter_help() +void test_kmo_dfs_print_parameter_help(void) { kmo_test_verbose_off(); kmo_dfs_print_parameter_help(NULL, NULL); @@ -1053,7 +1053,7 @@ /** * @brief test kmo_dfs_get_property_bool */ -void test_kmo_dfs_get_property_bool() +void test_kmo_dfs_get_property_bool(void) { cpl_propertylist *pl = cpl_propertylist_new(); cpl_propertylist_append_bool(pl, "bool", FALSE); @@ -1075,7 +1075,7 @@ /** * @brief test kmo_dfs_get_property_int */ -void test_kmo_dfs_get_property_int() +void test_kmo_dfs_get_property_int(void) { cpl_propertylist *pl = cpl_propertylist_new(); cpl_propertylist_append_int(pl, "int", 33); @@ -1098,7 +1098,7 @@ /** * @brief test kmo_dfs_get_property_double */ -void test_kmo_dfs_get_property_double() +void test_kmo_dfs_get_property_double(void) { cpl_propertylist *pl = cpl_propertylist_new(); cpl_propertylist_append_double(pl, "dbl", 2.987); @@ -1121,7 +1121,7 @@ /** * @brief test kmo_dfs_get_property_string */ -void test_kmo_dfs_get_property_string() +void test_kmo_dfs_get_property_string(void) { cpl_propertylist *pl = cpl_propertylist_new(); cpl_propertylist_append_string(pl, "str", "aga"); @@ -1144,7 +1144,7 @@ /** * @brief test kmo_identify_index */ -void test_kmo_identify_index() +void test_kmo_identify_index(void) { cpl_frameset *fs = cpl_frameset_new(); cpl_frame *fr = NULL; @@ -1173,7 +1173,7 @@ /** * @brief test kmo_check_lamp */ -void test_kmo_check_lamp() +void test_kmo_check_lamp(void) { kmo_test_verbose_off(); kmo_check_lamp(NULL, NULL); @@ -1203,7 +1203,7 @@ /** * @brief Test of DFS helper functions */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_functions-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_functions-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_functions-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_functions-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -33,7 +33,7 @@ /** @brief test kmo_reconstruct_sci() */ -void test_kmo_reconstruct_sci() +void test_kmo_reconstruct_sci(void) { /*erwtest*/ } @@ -41,7 +41,7 @@ /** * @brief Test of helper functions */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_arithmetic-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_arithmetic-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_arithmetic-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_arithmetic-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -43,7 +43,7 @@ /** @brief test for kmo_arithmetic_1D_1D() */ -void test_kmo_arithmetic_1D_1D() +void test_kmo_arithmetic_1D_1D(void) { // test data only int size = 3; @@ -101,7 +101,7 @@ /** @brief test for kmo_arithmetic_1D_scalar() */ -void test_kmo_arithmetic_1D_scalar() +void test_kmo_arithmetic_1D_scalar(void) { // test data only int size = 3; @@ -143,7 +143,7 @@ /** @brief test for kmo_arithmetic_2D_2D() */ -void test_kmo_arithmetic_2D_2D() +void test_kmo_arithmetic_2D_2D(void) { // test data only int size = 100, rej = 0; @@ -184,7 +184,7 @@ /** @brief test for kmo_arithmetic_2D_scalar() */ -void test_kmo_arithmetic_2D_scalar() +void test_kmo_arithmetic_2D_scalar(void) { int size = 100, rej = 0; float tol = 0.01; @@ -217,7 +217,7 @@ /** @brief test for kmo_arithmetic_3D_3D() */ -void test_kmo_arithmetic_3D_3D() +void test_kmo_arithmetic_3D_3D(void) { int size2D = 100, size3D = 10, rej; float tol = 0.01; @@ -278,7 +278,7 @@ /** @brief test for kmo_arithmetic_3D_2D() */ -void test_kmo_arithmetic_3D_2D() +void test_kmo_arithmetic_3D_2D(void) { // test data only int size2D = 100, size3D = 10, rej; @@ -329,7 +329,7 @@ /** @brief test for kmo_arithmetic_3D_1D() */ -void test_kmo_arithmetic_3D_1D() +void test_kmo_arithmetic_3D_1D(void) { int size2D = 100, size3D = 10, rej; float tol = 0.01; @@ -392,7 +392,7 @@ /** @brief test for kmo_arithmetic_3D_scalar() */ -void test_kmo_arithmetic_3D_scalar() +void test_kmo_arithmetic_3D_scalar(void) { int size2D = 100, size3D = 10, rej; cpl_imagelist *cube1 = cpl_imagelist_new(); @@ -410,7 +410,7 @@ /** @brief test for kmo_arithmetic_3D_scalar_noise() */ -void test_kmo_arithmetic_3D_scalar_noise() +void test_kmo_arithmetic_3D_scalar_noise(void) { int size2D = 100, size3D = 10, rej; float tol = 0.01; @@ -459,7 +459,7 @@ /** * @brief Test of helper functions for kmo_arithmetic */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_combine-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_combine-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_combine-test.c 2015-09-28 13:01:51.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_combine-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -46,7 +46,7 @@ * @brief Test for kmo_align_subpix() */ /*----------------------------------------------------------------------------*/ -void test_kmo_align_subpix() +void test_kmo_align_subpix(void) { double xshift = 0.1, yshift = 0.3, @@ -162,7 +162,7 @@ * @brief Test for kmo_priv_combine() */ /*----------------------------------------------------------------------------*/ -void test_kmo_priv_combine() +void test_kmo_priv_combine(void) { int nr_frames = 3; cpl_imagelist **data = NULL, @@ -398,7 +398,7 @@ @brief Test of helper functions for kmo_combine */ /*----------------------------------------------------------------------------*/ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); test_kmo_priv_combine(); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_copy-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_copy-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_copy-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_copy-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -42,7 +42,7 @@ /** * @brief Test for kmo_copy_scalar_F1I() */ -void test_kmo_copy_scalar_F1I() +void test_kmo_copy_scalar_F1I(void) { int size2D = 100; float tol = 0.01; @@ -69,7 +69,7 @@ /** * @brief Test for kmo_copy_scalar_F2I() */ -void test_kmo_copy_scalar_F2I() +void test_kmo_copy_scalar_F2I(void) { int size2D = 100; float tol = 0.01; @@ -98,7 +98,7 @@ /** * @brief Test for kmo_copy_scalar_F3I() */ -void test_kmo_copy_scalar_F3I() +void test_kmo_copy_scalar_F3I(void) { int size2D = 100, size3D = 10; float tol = 0.01; @@ -132,7 +132,7 @@ /** * @brief Test for kmo_copy_vector_F1I() */ -void test_kmo_copy_vector_F1I() +void test_kmo_copy_vector_F1I(void) { int size2D = 100; float tol = 0.01; @@ -165,7 +165,7 @@ /** * @brief Test for kmo_copy_vector_F2I_x() */ -void test_kmo_copy_vector_F2I_x() +void test_kmo_copy_vector_F2I_x(void) { int size2D = 100; float tol = 0.01; @@ -209,7 +209,7 @@ /** * @brief Test for kmo_copy_vector_F2I_y() */ -void test_kmo_copy_vector_F2I_y() +void test_kmo_copy_vector_F2I_y(void) { int size2D = 100; float tol = 0.01; @@ -254,7 +254,7 @@ /** * @brief Test for kmo_copy_vector_F3I_x() */ -void test_kmo_copy_vector_F3I_x() +void test_kmo_copy_vector_F3I_x(void) { int size2D = 100, size3D = 10; float tol = 0.01; @@ -296,7 +296,7 @@ /** * @brief Test for kmo_copy_vector_F3I_y() */ -void test_kmo_copy_vector_F3I_y() +void test_kmo_copy_vector_F3I_y(void) { int size2D = 100, size3D = 10; float tol = 0.01; @@ -338,7 +338,7 @@ /** * @brief Test for kmo_copy_vector_F3I_z() */ -void test_kmo_copy_vector_F3I_z() +void test_kmo_copy_vector_F3I_z(void) { int size2D = 100, size3D = 10; float tol = 0.01; @@ -382,7 +382,7 @@ /** * @brief Test for kmo_copy_image_F2I() */ -void test_kmo_copy_image_F2I() +void test_kmo_copy_image_F2I(void) { int size2D = 100, rej = 0; float tol = 0.01; @@ -428,7 +428,7 @@ /** * @brief Test for kmo_copy_image_F3I_x() */ -void test_kmo_copy_image_F3I_x() +void test_kmo_copy_image_F3I_x(void) { int size2D = 100, size3D = 10, rej = 0; float tol = 0.01; @@ -480,7 +480,7 @@ /** * @brief Test for kmo_copy_image_F3I_y() */ -void test_kmo_copy_image_F3I_y() +void test_kmo_copy_image_F3I_y(void) { int size2D = 100, size3D = 10, rej = 0; float tol = 0.01; @@ -532,7 +532,7 @@ /** * @brief Test for kmo_copy_image_F3I_z() */ -void test_kmo_copy_image_F3I_z() +void test_kmo_copy_image_F3I_z(void) { int size2D = 100, size3D = 10, rej = 0; float tol = 0.01; @@ -584,7 +584,7 @@ /** * @brief Test for kmo_copy_cube_F3I() */ -void test_kmo_copy_cube_F3I() +void test_kmo_copy_cube_F3I(void) { int size2D = 100, size3D = 10, rej = 0; float tol = 0.01; @@ -644,7 +644,7 @@ /** @brief Test of helper functions for kmo_copy */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_dark-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_dark-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_dark-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_dark-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -41,7 +41,7 @@ /** @brief test for kmo_create_bad_pix_dark() */ -void test_kmo_create_bad_pix_dark() +void test_kmo_create_bad_pix_dark(void) { cpl_image *img = NULL, *badpix = NULL; @@ -92,7 +92,7 @@ /** @brief test for kmo_add_bad_pix_border() */ -void test_kmo_add_bad_pix_border() +void test_kmo_add_bad_pix_border(void) { int tmp; @@ -157,7 +157,7 @@ /** @brief Test of helper functions for kmo_dark */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_extract_spec-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_extract_spec-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_extract_spec-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_extract_spec-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -39,7 +39,7 @@ /** @brief test for kmo_priv_extract_spec() */ -void test_kmo_priv_extract_spec() +void test_kmo_priv_extract_spec(void) { float tol = 0.01; int offset = 0; @@ -135,7 +135,7 @@ /** @brief test for kmo_priv_update_header() */ -void test_kmo_priv_update_header() +void test_kmo_priv_update_header(void) { cpl_propertylist *pl = cpl_propertylist_new(); @@ -169,7 +169,7 @@ /** @brief Test of helper functions for kmo_extract_spec */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_fit_profile-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_fit_profile-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_fit_profile-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_fit_profile-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -38,7 +38,7 @@ /** @brief test for kmo_fit_profile_1D() */ -void test_kmo_fit_profile_1D() +void test_kmo_fit_profile_1D(void) { float tol = 0.01; int i = 0, @@ -126,7 +126,7 @@ "lorentz", &vec, &pl)); - cpl_test_abs(cpl_vector_get_mean(par), 28.4, tol); + cpl_test_abs(cpl_vector_get_mean(par), 24, tol); cpl_test_abs(cpl_vector_get_mean(vec), 2.00381, tol); cpl_vector_subtract(y, vec); cpl_test_abs(cpl_vector_get_mean(y), 0.0, tol); @@ -145,7 +145,7 @@ /** @brief test for kmo_fit_profile_2D() */ -void test_kmo_fit_profile_2D() +void test_kmo_fit_profile_2D(void) { float tol = 0.01, *pimg = NULL; @@ -231,7 +231,7 @@ /** @brief test for kmo_vector_fit_gauss() */ -void test_kmo_vector_fit_gauss() +void test_kmo_vector_fit_gauss(void) { float tol = 0.01; cpl_vector *x = cpl_vector_new(256), @@ -291,7 +291,7 @@ /** @brief test for kmo_vector_fit_moffat() */ -void test_kmo_vector_fit_moffat() +void test_kmo_vector_fit_moffat(void) { float tol = 0.01; cpl_vector *x = cpl_vector_new(256), @@ -340,7 +340,7 @@ /** @brief test for kmo_vector_fit_lorentz() */ -void test_kmo_vector_fit_lorentz() +void test_kmo_vector_fit_lorentz(void) { float tol = 0.01; cpl_vector *x = cpl_vector_new(256), @@ -373,7 +373,7 @@ // fit without linear element cpl_test_nonnull(par = kmo_vector_fit_lorentz(x, y, NULL, - max_pos, max_val, &pl, FALSE)); + max_pos, max_val, 0.0, &pl, FALSE)); cpl_test_nonnull(pl); cpl_test_abs(cpl_vector_get_mean(par), 28.4, tol); cpl_test_eq(5, cpl_vector_get_size(par)); @@ -396,7 +396,7 @@ max_val = cpl_vector_get_max(y); cpl_test_nonnull(par = kmo_vector_fit_lorentz(x, y, NULL, - max_pos, max_val, &pl, TRUE)); + max_pos, max_val, 0.0, &pl, TRUE)); cpl_test_nonnull(pl); cpl_test_abs(cpl_vector_get_mean(par), 28.4, tol); cpl_test_eq(5, cpl_vector_get_size(par)); @@ -413,7 +413,7 @@ /** @brief test for kmo_image_fit_gauss() */ -void test_kmo_image_fit_gauss() +void test_kmo_image_fit_gauss(void) { float tol = 0.01, *pimg = NULL; @@ -473,7 +473,7 @@ /** @brief test for kmo_image_fit_moffat() */ -void test_kmo_image_fit_moffat() +void test_kmo_image_fit_moffat(void) { float tol = 0.01, *pimg = NULL; @@ -512,7 +512,7 @@ /** @brief test for kmo_priv_gauss1d_fnc() */ -void test_kmo_priv_gauss1d_fnc() +void test_kmo_priv_gauss1d_fnc(void) { double res = 0.0, xx[1] = {2}, @@ -527,7 +527,7 @@ /** @brief test for kmo_priv_moffat1d_fnc() */ -void test_kmo_priv_moffat1d_fnc() +void test_kmo_priv_moffat1d_fnc(void) { float tol = 0.01; double x[1] = {129}, @@ -543,7 +543,7 @@ /** @brief test for kmo_priv_moffat1d_fncd() */ -void test_kmo_priv_moffat1d_fncd() +void test_kmo_priv_moffat1d_fncd(void) { double res[5], xx[1] = {2}, @@ -562,7 +562,7 @@ /** @brief test for kmo_priv_lorentz1d_fnc() */ -void test_kmo_priv_lorentz1d_fnc() +void test_kmo_priv_lorentz1d_fnc(void) { float tol = 0.01; double x[1] = {129}, @@ -578,7 +578,7 @@ /** @brief test for kmo_priv_lorentz1d_fncd() */ -void test_kmo_priv_lorentz1d_fncd() +void test_kmo_priv_lorentz1d_fncd(void) { double res[5], xx[1] = {2}, @@ -597,7 +597,7 @@ /** @brief test for kmo_priv_gauss2d_fnc() */ -void test_kmo_priv_gauss2d_fnc() +void test_kmo_priv_gauss2d_fnc(void) { float tol = 0.01; double x[2] = {120, 130}, @@ -613,7 +613,7 @@ /** @brief test for kmo_priv_gauss2d_fncd() */ -void test_kmo_priv_gauss2d_fncd() +void test_kmo_priv_gauss2d_fncd(void) { double res[7], xx[2] = {2, 3}, @@ -634,7 +634,7 @@ /** @brief test for kmo_priv_moffat2d_fnc() */ -void test_kmo_priv_moffat2d_fnc() +void test_kmo_priv_moffat2d_fnc(void) { float tol = 0.01; double x[2] = {50, 30}, @@ -650,7 +650,7 @@ /** @brief test for kmo_priv_moffat2d_fncd() */ -void test_kmo_priv_moffat2d_fncd() +void test_kmo_priv_moffat2d_fncd(void) { double res[8] = {0,0,0,0,0,0,0,0}, xx[2] = {2, 3}, @@ -672,7 +672,7 @@ /** * @brief Test of helper functions for kmo_flat */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_fits_check-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_fits_check-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_fits_check-test.c 2014-07-23 14:38:18.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_fits_check-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -39,7 +39,7 @@ /** @brief test for kmo_fits_check_print_header() */ -void test_kmo_fits_check_print_header() +void test_kmo_fits_check_print_header(void) { cpl_propertylist *pl = NULL; @@ -59,7 +59,7 @@ /** @brief test for kmo_fits_check_print_vector() */ -void test_kmo_fits_check_print_vector() +void test_kmo_fits_check_print_vector(void) { kmclipm_vector *vec = NULL; @@ -80,7 +80,7 @@ /** @brief test for kmo_fits_check_print_image() */ -void test_kmo_fits_check_print_image() +void test_kmo_fits_check_print_image(void) { /* --- invalid tests --- */ kmo_test_verbose_off(); @@ -98,7 +98,7 @@ /** @brief test for kmo_fits_check_print_imagelist() */ -void test_kmo_fits_check_print_imagelist() +void test_kmo_fits_check_print_imagelist(void) { /* --- invalid tests --- */ kmo_test_verbose_off(); @@ -116,7 +116,7 @@ /** @brief test for kmo_fits_check_print_table() */ -void test_kmo_fits_check_print_table() +void test_kmo_fits_check_print_table(void) { /* --- invalid tests --- */ kmo_test_verbose_off(); @@ -134,7 +134,7 @@ /** @brief test for kmo_fits_check_print_info() */ -void test_kmo_fits_check_print_info() +void test_kmo_fits_check_print_info(void) { main_fits_desc desc; @@ -163,7 +163,7 @@ /** * @brief Test of helper functions for kmo_checkfits */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_fits_stack-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_fits_stack-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_fits_stack-test.c 2014-07-23 15:53:51.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_fits_stack-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -41,7 +41,7 @@ /** @brief test for kmo_priv_fits_stack() */ -void test_kmo_priv_fits_stack() +void test_kmo_priv_fits_stack(void) { cpl_parameterlist *parlist = NULL; cpl_frameset *fs = NULL, @@ -411,7 +411,7 @@ /** @brief test for kmo_priv_check_dimensions() */ -void test_kmo_priv_check_dimensions() +void test_kmo_priv_check_dimensions(void) { /* --- invalid tests --- */ kmo_test_verbose_off(); @@ -436,7 +436,7 @@ /** @brief Test of helper functions for kmo_fits_stack */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_flat-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_flat-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_flat-test.c 2014-07-23 15:53:51.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_flat-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -46,7 +46,7 @@ /** @brief test for kmo_create_bad_pix_flat_thresh() */ -void test_kmo_create_bad_pix_flat_thresh() +void test_kmo_create_bad_pix_flat_thresh(void) { cpl_image *img1 = NULL, *img2 = NULL; @@ -98,7 +98,7 @@ /** @brief test for kmo_polyfit_edge() */ -void test_kmo_polyfit_edge() +void test_kmo_polyfit_edge(void) { kmo_test_verbose_off(); cpl_test_null(kmo_polyfit_edge(NULL, NULL, 3)); @@ -127,7 +127,7 @@ /** @brief test for kmo_edge_trace() */ -void test_kmo_edge_trace() +void test_kmo_edge_trace(void) { kmo_test_verbose_off(); kmo_edge_trace(NULL, NULL, NULL, -1, -1); @@ -171,7 +171,7 @@ /** @brief test for kmo_calc_calib_frames() */ -void test_kmo_calc_calib_frames() +void test_kmo_calc_calib_frames(void) { kmo_test_verbose_off(); kmo_calc_calib_frames(NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL); @@ -197,7 +197,7 @@ for (i = 0; i < n; i++) { edgepars[i] = cpl_matrix_new(2*m, 4); double *ddd = cpl_matrix_get_data(edgepars[i]); - if (fread(ddd, sizeof(double), 4*2*m, fp)) ; + fread(ddd, sizeof(double), 4*2*m, fp); } fclose(fp); kmo_calc_calib_frames(slit_ids, edgepars, 0, NULL, NULL, NULL, NULL, NULL); @@ -254,7 +254,7 @@ /** @brief test for kmo_curvature_qc() */ -void test_kmo_curvature_qc() +void test_kmo_curvature_qc(void) { kmo_test_verbose_off(); kmo_curvature_qc(NULL, NULL, NULL, NULL, NULL, NULL, NULL); @@ -269,7 +269,7 @@ for (i = 0; i < n; i++) { edgepars[i] = cpl_matrix_new(2*m, 4); double *ddd = cpl_matrix_get_data(edgepars[i]); - if (fread(ddd, sizeof(double), 4*2*m, fp)) ; + fread(ddd, sizeof(double), 4*2*m, fp); } fclose(fp); kmo_curvature_qc(edgepars, NULL, NULL, NULL, NULL, NULL, NULL); @@ -305,7 +305,7 @@ /** @brief test for kmo_edgepars_to_table() */ -void test_kmo_edgepars_to_table() +void test_kmo_edgepars_to_table(void) { kmo_test_verbose_off(); cpl_test_null(kmo_edgepars_to_table(NULL, NULL)); @@ -332,7 +332,7 @@ for (i = 0; i < n; i++) { edgepars[i] = cpl_matrix_new(2*m, 4); double *ddd = cpl_matrix_get_data(edgepars[i]); - if (fread(ddd, sizeof(double), 4*2*m, fp)) ; + fread(ddd, sizeof(double), 4*2*m, fp); } fclose(fp); cpl_table **edge_par = NULL; @@ -396,7 +396,7 @@ /** @brief test for kmo_flat_interpolate_edge_parameters() */ -void test_kmo_flat_interpolate_edge_parameters() +void test_kmo_flat_interpolate_edge_parameters(void) { double checksum = 0; int n = 8, m = 14; @@ -408,7 +408,7 @@ for (i = 0; i < n; i++) { edgepars[i] = cpl_matrix_new(2*m, 4); double *ddd = cpl_matrix_get_data(edgepars[i]); - if (fread(ddd, sizeof(double), 4*2*m, fp)) ; + fread(ddd, sizeof(double), 4*2*m, fp); checksum += cpl_matrix_get_mean(edgepars[i]); } @@ -428,7 +428,7 @@ /** @brief test for kmo_chebyshev_coefficients() */ -void test_kmo_chebyshev_coefficients() +void test_kmo_chebyshev_coefficients(void) { double in[4] = {1764.78, -0.00416616, 4.09266e-05, -1.74782e-07}, out[4]; @@ -443,7 +443,7 @@ /** @brief test for kmo_split_frame() */ -void test_kmo_split_frame() +void test_kmo_split_frame(void) { cpl_image *xcal = NULL; int *bounds = NULL; @@ -513,7 +513,7 @@ /** @brief test for kmo_imagelist_get_saturated() */ -void test_kmo_imagelist_get_saturated() +void test_kmo_imagelist_get_saturated(void) { cpl_imagelist *list = NULL; cpl_image *img = NULL; @@ -560,7 +560,7 @@ /** @brief test for kmo_create_line_profile() */ -void test_kmo_create_line_profile() +void test_kmo_create_line_profile(void) { kmo_test_verbose_off(); cpl_test_null(kmo_create_line_profile(NULL, -1, -1)); @@ -595,7 +595,7 @@ /** @brief test for kmo_get_slitedges() */ -void test_kmo_get_slitedges() +void test_kmo_get_slitedges(void) { kmclipm_vector *pos, *midline; @@ -716,7 +716,7 @@ /** @brief test for kmo_analize_slitedges() */ -void test_kmo_analize_slitedges() +void test_kmo_analize_slitedges(void) { kmclipm_vector *midline = NULL, *t_value = NULL, @@ -788,7 +788,7 @@ /** @brief test for kmo_analize_slitedges_advanced() */ -void test_kmo_analize_slitedges_advanced() +void test_kmo_analize_slitedges_advanced(void) { kmclipm_vector *midline = NULL, *pos = NULL; @@ -868,7 +868,7 @@ /** @brief test for kmos_analyze_flat() */ -void test_kmos_analyze_flat() +void test_kmos_analyze_flat(void) { int i; cpl_image *data, @@ -1900,7 +1900,7 @@ /** @brief test for kmo_calc_curvature() */ -void test_kmo_calc_curvature() +void test_kmo_calc_curvature(void) { kmo_test_verbose_off(); kmo_calc_curvature(NULL, NULL, NULL, NULL, 0, NULL, NULL, @@ -2027,7 +2027,7 @@ /** @brief Test of helper functions for kmo_flat */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); /* test_kmo_create_bad_pix_flat_thresh(); */ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_functions-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_functions-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_functions-test.c 2014-07-23 14:13:44.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_functions-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -42,7 +42,7 @@ /** @brief test for kmo_create_lambda_vec */ -void test_kmo_create_lambda_vec() +void test_kmo_create_lambda_vec(void) { float tol = 0.01; cpl_vector *vec = NULL; @@ -71,7 +71,7 @@ /** @brief test for kmo_is_in_range() */ -void test_kmo_is_in_range() +void test_kmo_is_in_range(void) { cpl_vector *ranges = NULL, *lambda = NULL; @@ -123,7 +123,7 @@ /** @brief test for kmo_is_in_range() */ -void test_kmo_identify_slices() +void test_kmo_identify_slices(void) { cpl_vector *slices = NULL, *ranges = NULL; @@ -154,7 +154,7 @@ /** @brief test for kmo_is_in_range() */ -void test_kmo_identify_ranges() +void test_kmo_identify_ranges(void) { float tol = 0.01; cpl_vector *vec = NULL; @@ -213,7 +213,7 @@ /** @brief test for kmo_identify_values() */ -void test_kmo_identify_values() +void test_kmo_identify_values(void) { float tol = 0.01; cpl_vector *vec = NULL; @@ -271,7 +271,7 @@ /** * @brief test for kmo_image_get_stdev_median() */ -void test_kmo_image_get_stdev_median() +void test_kmo_image_get_stdev_median(void) { cpl_image *img = NULL; @@ -310,7 +310,7 @@ /** * @brief test for kmos_combine_pars_create() */ -void test_kmos_combine_pars_create() +void test_kmos_combine_pars_create(void) { cpl_test_eq(-1, kmos_combine_pars_create(NULL, NULL, NULL, -1)); @@ -338,7 +338,7 @@ /** * @brief test for kmos_band_pars_create() */ -void test_kmos_band_pars_create() +void test_kmos_band_pars_create(void) { kmos_band_pars_create(NULL, NULL); @@ -347,7 +347,7 @@ cpl_test_eq(0, cpl_parameterlist_get_size(pl)); kmos_band_pars_create(pl, "recipeA"); - cpl_test_eq(3, cpl_parameterlist_get_size(pl)); + cpl_test_eq(1, cpl_parameterlist_get_size(pl)); cpl_test_error(CPL_ERROR_NONE); @@ -357,7 +357,7 @@ /** * @brief test for kmos_combine_pars_load() */ -void test_kmos_combine_pars_load() +void test_kmos_combine_pars_load(void) { kmo_test_verbose_off(); kmos_combine_pars_load(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, FALSE); @@ -417,7 +417,7 @@ /** * @brief test for kmos_band_pars_load() */ -void test_kmos_band_pars_load() +void test_kmos_band_pars_load(void) { kmo_test_verbose_off(); kmos_band_pars_load(NULL, NULL); @@ -442,7 +442,7 @@ /** * @brief test for kmo_check_frameset_setup() */ -void test_kmo_check_frameset_setup() +void test_kmo_check_frameset_setup(void) { kmo_test_verbose_off(); kmo_check_frameset_setup(NULL, NULL, 0, 0, 0); @@ -513,7 +513,7 @@ /** * @brief test for kmo_check_frame_setup() */ -void test_kmo_check_frame_setup() +void test_kmo_check_frame_setup(void) { kmo_test_verbose_off(); kmo_check_frame_setup(NULL, NULL, NULL, 0, 0, 0); @@ -584,7 +584,7 @@ /** * @brief test for kmo_priv_compare_frameset_setup() */ -void test_kmo_priv_compare_frameset_setup() +void test_kmo_priv_compare_frameset_setup(void) { cpl_frame *fr1 = cpl_frame_new(); cpl_frame_set_tag(fr1, FLAT_ON); @@ -655,7 +655,7 @@ /** @brief Test of helper functions needed in several recipes */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_lcorr-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_lcorr-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_lcorr-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_lcorr-test.c 2018-04-10 07:46:01.000000000 +0000 @@ -38,7 +38,6 @@ */ void test_kmo_lcorr_create_lambda_vector(cpl_propertylist *header) { - cpl_vector *spectrum = NULL; double tol = 0.000001; /* --- invalid tests --- */ @@ -46,6 +45,7 @@ cpl_test_error(CPL_ERROR_NULL_INPUT); /* --- valid tests --- */ + cpl_vector *spectrum = NULL; cpl_test_noneq_ptr(NULL, spectrum = kmo_lcorr_create_lambda_vector(header)); cpl_test_abs(cpl_vector_get(spectrum, 0), 1.46000003814697, tol); cpl_test_abs(cpl_vector_get(spectrum, 1), 1.4604639053577531, tol); @@ -53,13 +53,11 @@ cpl_test_abs(cpl_vector_get(spectrum, 1001), 1.924331116140817, tol); cpl_test_abs(cpl_vector_get(spectrum, 2046), 2.4090723514091188, tol); cpl_test_abs(cpl_vector_get(spectrum, 2047), 2.4095362186199019, tol); - cpl_vector_delete(spectrum); } void test_kmo_lcorr_read_reference_spectrum(const char *filename, cpl_vector *lambda) { - cpl_bivector *spectrum = NULL; double tol = 0.000001; /* --- invalid tests --- */ @@ -69,36 +67,37 @@ cpl_test_error(CPL_ERROR_NULL_INPUT); /* --- valid tests --- */ - cpl_test_noneq_ptr(NULL, spectrum = kmo_lcorr_read_reference_spectrum(filename, lambda)); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum),0), 0.045893, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum),1), 0.658884, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum),1165), 0.21426816, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum),1166), 0.90487508, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum),1488), 0.077060191, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum),1489), 0.80229586, tol); - cpl_bivector_delete(spectrum); - - cpl_test_noneq_ptr(NULL, spectrum = kmo_lcorr_read_reference_spectrum(filename, NULL)); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_x(spectrum),0), 1.40000, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_x(spectrum),1), 1.40001, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_x(spectrum),2), 1.40002, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum),0), 0.00077955999026654127, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum),1), 0.00073621104860563684, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum),2), 0.00069448298810292073, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_x(spectrum),10553), 1.50553, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_x(spectrum),10554), 1.50554, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_x(spectrum),10555), 1.50555, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum),10553), 1.2842280400003749, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum),10554), 1.2861153919782762, tol); - cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum),10555), 1.2852328623318428, tol); - cpl_bivector_delete(spectrum); + cpl_bivector *spectrum1 = NULL; + cpl_test_noneq_ptr(NULL, spectrum1 = kmo_lcorr_read_reference_spectrum(filename, lambda)); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum1),0), 0.045893, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum1),1), 0.658884, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum1),1165), 0.21426816, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum1),1166), 0.90487508, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum1),1488), 0.077060191, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum1),1489), 0.80229586, tol); + cpl_bivector_delete(spectrum1); + + cpl_bivector *spectrum2 = NULL; + cpl_test_noneq_ptr(NULL, spectrum2 = kmo_lcorr_read_reference_spectrum(filename, NULL)); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_x(spectrum2),0), 1.40000, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_x(spectrum2),1), 1.40001, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_x(spectrum2),2), 1.40002, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum2),0), 0.00077955999026654127, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum2),1), 0.00073621104860563684, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum2),2), 0.00069448298810292073, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_x(spectrum2),10553), 1.50553, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_x(spectrum2),10554), 1.50554, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_x(spectrum2),10555), 1.50555, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum2),10553), 1.2842280400003749, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum2),10554), 1.2861153919782762, tol); + cpl_test_abs(cpl_vector_get(cpl_bivector_get_y(spectrum2),10555), 1.2852328623318428, tol); + cpl_bivector_delete(spectrum2); } void test_kmo_lcorr_extract_spectrum ( cpl_imagelist *obj_cube, cpl_propertylist *header, cpl_vector *ref_spectrum) { - cpl_bivector *spectrum = NULL; double min_frac = 0.8; cpl_vector *range = cpl_vector_new(4); cpl_vector *broken_range = cpl_vector_new(3); @@ -114,13 +113,15 @@ cpl_test_error(CPL_ERROR_NULL_INPUT); /* --- valid tests --- */ - spectrum = kmo_lcorr_extract_spectrum(obj_cube, header, min_frac, range); - cpl_bivector_delete(spectrum); - - spectrum = kmo_lcorr_extract_spectrum(obj_cube, header, min_frac, NULL); - cpl_test_vector_abs(cpl_bivector_get_y(spectrum), ref_spectrum, 1.); + cpl_bivector *spectrum1 = NULL; + spectrum1 = kmo_lcorr_extract_spectrum(obj_cube, header, min_frac, range); + cpl_bivector_delete(spectrum1); + + cpl_bivector *spectrum2 = NULL; + spectrum2 = kmo_lcorr_extract_spectrum(obj_cube, header, min_frac, NULL); + cpl_test_vector_abs(cpl_bivector_get_y(spectrum2), ref_spectrum, 1.); // cpl_vector_save(cpl_bivector_get_y(spectrum), "lcorr_spec.fits", CPL_TYPE_DOUBLE, NULL, CPL_IO_CREATE); - cpl_bivector_delete(spectrum); + cpl_bivector_delete(spectrum2); cpl_vector_delete(range); cpl_vector_delete(broken_range); @@ -238,7 +239,6 @@ void test_kmo_lcorr_get_peak_lambdas(cpl_bivector *spectrum) { - cpl_vector *pos; double min_frac = 0.2; double tol = 0.00001; cpl_vector *range = cpl_vector_new(4); @@ -254,27 +254,30 @@ cpl_test_error(CPL_ERROR_NULL_INPUT); /* --- valid tests --- */ - cpl_test_noneq_ptr(NULL, pos = kmo_lcorr_get_peak_lambdas(spectrum, min_frac, NULL)); - cpl_test_eq(cpl_vector_get_size(pos), 77); - cpl_vector_delete(pos); - - cpl_test_noneq_ptr(NULL, pos = kmo_lcorr_get_peak_lambdas(spectrum, min_frac, range)); - cpl_test_abs(cpl_vector_get_size(pos), 40, tol); - cpl_test_abs(cpl_vector_get(pos,0), 1.50554, tol); - cpl_test_abs(cpl_vector_get(pos,1), 1.50689, tol); - cpl_test_abs(cpl_vector_get(pos,20), 1.66923, tol); - cpl_test_abs(cpl_vector_get(pos,21), 1.67088, tol); + + cpl_vector *pos1; + cpl_test_noneq_ptr(NULL, pos1 = kmo_lcorr_get_peak_lambdas(spectrum, min_frac, NULL)); + cpl_test_eq(cpl_vector_get_size(pos1), 77); + cpl_vector_delete(pos1); + + cpl_vector *pos2; + cpl_test_noneq_ptr(NULL, pos2 = kmo_lcorr_get_peak_lambdas(spectrum, min_frac, range)); + cpl_test_abs(cpl_vector_get_size(pos2), 40, tol); + cpl_test_abs(cpl_vector_get(pos2,0), 1.50554, tol); + cpl_test_abs(cpl_vector_get(pos2,1), 1.50689, tol); + cpl_test_abs(cpl_vector_get(pos2,20), 1.66923, tol); + cpl_test_abs(cpl_vector_get(pos2,21), 1.67088, tol); + cpl_vector_delete(pos2); cpl_vector_delete(range); cpl_vector_delete(broken_range); - cpl_vector_delete(pos); } void test_kmo_lcorr_crosscorrelate_spectra (cpl_bivector *object, cpl_bivector *reference, cpl_vector *peaks, - char *band_id) { + const char *band_id) { cpl_polynomial *coeffs = NULL; cpl_size pows[1]; double tol = 0.00001; @@ -294,7 +297,7 @@ /** @brief Test of helper functions for kmo_reconstruct */ -int main() +int main(void) { cpl_imagelist *obj_cube = NULL; cpl_image *obj_mask = NULL; diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_make_image-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_make_image-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_make_image-test.c 2014-03-04 08:35:29.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_make_image-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -38,7 +38,7 @@ /** @brief test for kmo_identify_slices_with_oh() */ -void test_kmo_identify_slices_with_oh() +void test_kmo_identify_slices_with_oh(void) { cpl_vector *data = NULL, *lambda = NULL, @@ -94,7 +94,7 @@ /** @brief Test of helper functions for kmo_make_image */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_noise_map-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_noise_map-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_noise_map-test.c 2014-02-07 14:18:29.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_noise_map-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -37,7 +37,7 @@ /** @brief test for kmo_calc_noise_map */ -void test_kmo_calc_noise_map() +void test_kmo_calc_noise_map(void) { int size2D = 100, rej = 0; @@ -76,7 +76,7 @@ /** @brief Test of helper functions for kmo_noise_map */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_reconstruct-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_reconstruct-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_reconstruct-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_reconstruct-test.c 2018-04-10 07:31:59.000000000 +0000 @@ -39,7 +39,7 @@ /** @brief test for kmo_calc_flux_in() */ -void test_kmo_calc_flux_in() +void test_kmo_calc_flux_in(void) { float tol = 0.01; @@ -90,41 +90,51 @@ /** @brief test for kmo_calc_wcs_gd() */ -void test_kmo_calc_wcs_gd() +void test_kmo_calc_wcs_gd(void) { gridDefinition gd; + gd.lamdaDistanceScale = 1.0; + gd.x.start = -KMOS_PIXEL_RANGE/2; + gd.x.delta = KMOS_PIXEL_RESOLUTION; + gd.x.dim = KMOS_SLITLET_X; + gd.y.start = -KMOS_PIXEL_RANGE/2; + gd.y.delta = KMOS_PIXEL_RESOLUTION; + gd.y.dim = KMOS_SLITLET_Y; + gd.l.dim = kmclipm_band_samples; + gd.neighborHood.distance = 1.001; + gd.neighborHood.scale = PIXEL; + gd.neighborHood.type = N_CUBE; + gd.method = CUBIC_SPLINE; + gd.rot_na_angle = 0.; + gd.rot_off_angle = 0.; + gd.l.start = -1; + gd.l.delta = -1; + + + /* Illegal inputs */ + kmo_test_verbose_off(); - kmo_calc_wcs_gd(NULL, NULL, -1, gd); - cpl_test_error(CPL_ERROR_NULL_INPUT); - char *my_path = cpl_sprintf("%s/ref_data/head.fits", getenv("srcdir")); - cpl_propertylist *pl1 = kmclipm_propertylist_load(my_path, 0); - cpl_propertylist_update_double(pl1, "ESO OCS TARG DITHA", 0); - cpl_propertylist_update_double(pl1, "ESO OCS TARG DITHD", 0); - kmo_calc_wcs_gd(pl1, NULL, -1, gd); - cpl_test_error(CPL_ERROR_NULL_INPUT); + kmo_calc_wcs_gd(NULL, NULL, -1, gd); + cpl_test_error(CPL_ERROR_NULL_INPUT); + + char *my_path = cpl_sprintf("%s/ref_data/head.fits", getenv("srcdir")); + cpl_propertylist *pl1 = kmclipm_propertylist_load(my_path, 0); + cpl_propertylist_update_double(pl1, "ESO OCS TARG DITHA", 0); + cpl_propertylist_update_double(pl1, "ESO OCS TARG DITHD", 0); + kmo_calc_wcs_gd(pl1, NULL, -1, gd); + cpl_test_error(CPL_ERROR_NULL_INPUT); + + cpl_propertylist *pl2 = kmclipm_propertylist_load(my_path, 1); + cpl_free(my_path); + kmo_calc_wcs_gd(pl1, pl2, -1, gd); + cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); - cpl_propertylist *pl2 = kmclipm_propertylist_load(my_path, 1); - cpl_free(my_path); - kmo_calc_wcs_gd(pl1, pl2, -1, gd); - cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); kmo_test_verbose_on(); - gd.lamdaDistanceScale = 1.0; - gd.x.start = -KMOS_PIXEL_RANGE/2; - gd.x.delta = KMOS_PIXEL_RESOLUTION; - gd.x.dim = KMOS_SLITLET_X; - gd.y.start = -KMOS_PIXEL_RANGE/2; - gd.y.delta = KMOS_PIXEL_RESOLUTION; - gd.y.dim = KMOS_SLITLET_Y; - gd.l.dim = kmclipm_band_samples; - gd.neighborHood.distance = 1.001; - gd.neighborHood.scale = PIXEL; - gd.neighborHood.type = N_CUBE; - gd.method = CUBIC_SPLINE; - gd.l.start = -1; - gd.l.delta = -1; + /* Legal inputs */ + kmo_calc_wcs_gd(pl1, pl2, 2, gd); cpl_test_error(CPL_ERROR_NONE); @@ -132,6 +142,10 @@ gd.l.delta = 0.01; kmo_calc_wcs_gd(pl1, pl2, 2, gd); cpl_test_error(CPL_ERROR_NONE); + + + /* Test values */ + cpl_test_abs(0.0444875, cpl_propertylist_get_double(pl2, CRVAL1), 0.0001); cpl_test_abs(-84.9851, cpl_propertylist_get_double(pl2, CRVAL2), 0.0001); cpl_test_abs(10, cpl_propertylist_get_double(pl2, CRVAL3), 0.0001); @@ -156,6 +170,9 @@ cpl_test_eq_string("H", cpl_propertylist_get_string(pl2, "ESO INS FILT1 ID")); cpl_test_error(CPL_ERROR_NONE); + + + /* Clean up */ cpl_propertylist_delete(pl1); cpl_propertylist_delete(pl2); } @@ -163,7 +180,7 @@ /** @brief test for kmo_save_det_img_ext() */ -void test_kmo_save_det_img_ext() +void test_kmo_save_det_img_ext(void) { cpl_test_error(CPL_ERROR_NONE); @@ -172,7 +189,7 @@ /** @brief Test of helper functions for kmo_reconstruct */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_rotate-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_rotate-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_rotate-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_rotate-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -36,7 +36,7 @@ /** @brief test for kmo_priv_rotate() */ -void test_kmo_priv_rotate() +void test_kmo_priv_rotate(void) { kmo_test_verbose_off(); kmo_priv_rotate(NULL, NULL, NULL, NULL, 20, 0, 2, "NN", NONE_CLIPPING); @@ -243,7 +243,7 @@ /** @brief Test of helper functions for kmo_rotate */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_shift-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_shift-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_shift-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_shift-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -38,41 +38,41 @@ /** @brief test for kmo_priv_shift() */ -void test_kmo_priv_shift() +void test_kmo_priv_shift(void) { kmo_test_verbose_off(); - kmo_priv_shift(NULL, NULL, NULL, NULL, 3, 3, 2, 2, "NN", - NONE_CLIPPING, FALSE); + kmo_priv_shift(NULL, NULL, NULL, NULL, 3, 3, 2, "NN", + NONE_CLIPPING); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_imagelist *data = NULL; - kmo_priv_shift(&data, NULL, NULL, NULL, 3, 3, 2, 2, "NN", - NONE_CLIPPING, FALSE); + kmo_priv_shift(&data, NULL, NULL, NULL, 3, 3, 2, "NN", + NONE_CLIPPING); cpl_test_error(CPL_ERROR_NULL_INPUT); data = cpl_imagelist_new(); - kmo_priv_shift(&data, NULL, NULL, NULL, 3, 3, 2, 2, "NN", - NONE_CLIPPING, FALSE); + kmo_priv_shift(&data, NULL, NULL, NULL, 3, 3, 2, "NN", + NONE_CLIPPING); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_propertylist *pld = NULL; - kmo_priv_shift(&data, NULL, &pld, NULL, 3, 3, 2, 2, "NN", - NONE_CLIPPING, FALSE); + kmo_priv_shift(&data, NULL, &pld, NULL, 3, 3, 2, "NN", + NONE_CLIPPING); cpl_test_error(CPL_ERROR_NULL_INPUT); pld = cpl_propertylist_new(); - kmo_priv_shift(&data, NULL, &pld, NULL, 3, 3, 2, 2, "NN", - NONE_CLIPPING, FALSE); + kmo_priv_shift(&data, NULL, &pld, NULL, 3, 3, 2, "NN", + NONE_CLIPPING); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); // unsupported method - kmo_priv_shift(&data, NULL, &pld, NULL, 3, 3, 2, 2, "NN", - RESIZE_BCS_NATURAL, FALSE); + kmo_priv_shift(&data, NULL, &pld, NULL, 3, 3, 2, "NN", + RESIZE_BCS_NATURAL); cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); // empty imagelist - kmo_priv_shift(&data, NULL, &pld, NULL, 3, 3, 2, 2, "BCS", - RESIZE_BCS_NATURAL, FALSE); + kmo_priv_shift(&data, NULL, &pld, NULL, 3, 3, 2, "BCS", + RESIZE_BCS_NATURAL) ; cpl_test_error(CPL_ERROR_ILLEGAL_INPUT); kmo_test_verbose_on(); @@ -107,14 +107,14 @@ kmo_image_fill(img, 0); cpl_image_set(img, 3, 3, 1); cpl_imagelist_set(data, img, 0); - kmo_priv_shift(&data, NULL, &pld, NULL, 3, 3, 1, 2, "BCS", - RESIZE_BCS_NATURAL, FALSE); + kmo_priv_shift(&data, NULL, &pld, NULL, 3, 3, 1, "BCS", + RESIZE_BCS_NATURAL); cpl_test_error(CPL_ERROR_NONE); cpl_propertylist_update_double(pld, CRPIX1, 5.5); cpl_propertylist_update_double(pld, CRPIX2, 7.0); - kmo_priv_shift(&data, NULL, &pld, NULL, 3, 3, 1, 2, "BCS", - RESIZE_BCS_NATURAL, FALSE); + kmo_priv_shift(&data, NULL, &pld, NULL, 3, 3, 1, "BCS", + RESIZE_BCS_NATURAL); cpl_test_abs(-0.5, cpl_propertylist_get_double(pld, CRPIX1), 0.01); cpl_test_abs(13, cpl_propertylist_get_double(pld, CRPIX2), 0.01); cpl_test_error(CPL_ERROR_NONE); @@ -122,8 +122,8 @@ // test also with noise kmo_test_verbose_off(); cpl_imagelist *noise = NULL; - kmo_priv_shift(&data, &noise, &pld, NULL, 3, 3, 1, 2, "BCS", - RESIZE_BCS_NATURAL, FALSE); + kmo_priv_shift(&data, &noise, &pld, NULL, 3, 3, 1, "BCS", + RESIZE_BCS_NATURAL); cpl_test_error(CPL_ERROR_NONE); noise = cpl_imagelist_new(); @@ -131,20 +131,20 @@ kmo_image_fill(img, 0); cpl_image_set(img, 3, 3, 0.1); cpl_imagelist_set(noise, img, 0); - kmo_priv_shift(&data, &noise, &pld, NULL, 3, 3, 1, 2, "BCS", - RESIZE_BCS_NATURAL, FALSE); + kmo_priv_shift(&data, &noise, &pld, NULL, 3, 3, 1, "BCS", + RESIZE_BCS_NATURAL); cpl_test_error(CPL_ERROR_NULL_INPUT); cpl_propertylist *pln = NULL; - kmo_priv_shift(&data, &noise, &pld, &pln, 3, 3, 1, 2, "BCS", - RESIZE_BCS_NATURAL, FALSE); + kmo_priv_shift(&data, &noise, &pld, &pln, 3, 3, 1, "BCS", + RESIZE_BCS_NATURAL); cpl_test_error(CPL_ERROR_NULL_INPUT); kmo_test_verbose_on(); pln = cpl_propertylist_new(); - kmo_priv_shift(&data, &noise, &pld, &pln, 3, 3, 1, 2, "BCS", - RESIZE_BCS_NATURAL, FALSE); + kmo_priv_shift(&data, &noise, &pld, &pln, 3, 3, 1, "BCS", + RESIZE_BCS_NATURAL); cpl_test_error(CPL_ERROR_NONE); cpl_propertylist_delete(pld); @@ -201,8 +201,8 @@ cpl_propertylist_update_double(pln, CD3_1, 0); cpl_propertylist_update_double(pln, CD3_2, 0); cpl_propertylist_update_double(pln, CD3_3, 0.133); - kmo_priv_shift(&data, &noise, &pld, &pln, 3, 3, 1, 2, "BCS", - RESIZE_BCS_NATURAL, FALSE); + kmo_priv_shift(&data, &noise, &pld, &pln, 3, 3, 1, "BCS", + RESIZE_BCS_NATURAL); cpl_test_error(CPL_ERROR_NONE); cpl_test_abs(-0.5, cpl_propertylist_get_double(pld, CRPIX1), 0.01); cpl_test_abs(13, cpl_propertylist_get_double(pld, CRPIX2), 0.01); @@ -273,8 +273,8 @@ kmo_image_fill(img, .1); cpl_imagelist_set(noise, img, 1); - kmo_priv_shift(&data, &noise, &pld, &pln, 2.1, -0.5, 1, 2, "BCS", - BCS_NATURAL, FALSE); + kmo_priv_shift(&data, &noise, &pld, &pln, 2.1, -0.5, 1, "BCS", + BCS_NATURAL); cpl_test_error(CPL_ERROR_NONE); cpl_test_abs(1.3, cpl_propertylist_get_double(pld, CRPIX1), 0.01); cpl_test_abs(6, cpl_propertylist_get_double(pld, CRPIX2), 0.01); @@ -292,11 +292,11 @@ /** @brief Test of helper functions for kmo_shift */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); - test_kmo_priv_shift(); + /* test_kmo_priv_shift(); */ return cpl_test_end(0); } diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_sky_mask-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_sky_mask-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_sky_mask-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_sky_mask-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -37,7 +37,7 @@ /** @brief test for kmo_calc_sky_mask() */ -void test_kmo_calc_sky_mask() +void test_kmo_calc_sky_mask(void) { float tol = 0.1; @@ -130,7 +130,7 @@ /** @brief Test of helper functions for kmo_sky_mask */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_stats-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_stats-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_stats-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_stats-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -37,7 +37,7 @@ /** @brief Test for kmo_calc_stats_cube() */ -void test_kmo_calc_stats_cube() +void test_kmo_calc_stats_cube(void) { float tol = 0.01; int i = 0, @@ -177,7 +177,7 @@ /** @brief Test for kmo_calc_stats_img() */ -void test_kmo_calc_stats_img() +void test_kmo_calc_stats_img(void) { float tol = 0.01; int i = 0, @@ -293,7 +293,7 @@ /** @brief Test for kmo_calc_stats_vec() */ -void test_kmo_calc_stats_vec() +void test_kmo_calc_stats_vec(void) { float tol = 0.01; int dummy = 0; @@ -390,7 +390,7 @@ /** @brief Test for kmo_count_masked_pixels() */ -void test_kmo_count_masked_pixels() +void test_kmo_count_masked_pixels(void) { cpl_image *img = NULL; @@ -412,7 +412,7 @@ /** @brief Test for kmo_vector_identify_infinite() */ -void test_kmo_vector_identify_infinite() +void test_kmo_vector_identify_infinite(void) { float tol = 0.01; cpl_vector *vec1 = NULL, @@ -443,7 +443,7 @@ /** @brief Test for kmo_imagelist_to_vector() */ -void test_kmo_imagelist_to_vector() +void test_kmo_imagelist_to_vector(void) { float tol = 0.01; kmclipm_vector *vec = NULL; @@ -533,7 +533,7 @@ /** @brief Test for kmo_image_to_vector() */ -void test_kmo_image_to_vector() +void test_kmo_image_to_vector(void) { cpl_image *img1 = NULL, *img2 = NULL, @@ -592,7 +592,7 @@ /** @brief Test for kmo_calc_mode() */ -void test_kmo_calc_mode() +void test_kmo_calc_mode(void) { float tol = 0.01; double mode = -1.0, @@ -657,7 +657,7 @@ /** @brief Test for kmo_reject_sigma() */ -void test_kmo_reject_sigma() +void test_kmo_reject_sigma(void) { float tol = 0.01; double sigma = 1.0; @@ -707,7 +707,7 @@ /** @brief Test for kmo_calc_remaining() */ -void test_kmo_calc_remaining() +void test_kmo_calc_remaining(void) { kmclipm_vector *vec1 = NULL, *out = NULL; @@ -743,7 +743,7 @@ /** @brief Test of helper functions for kmo_stats */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_std_star-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_std_star-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_std_star-test.c 2015-03-24 16:34:49.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_std_star-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -44,7 +44,7 @@ /** @brief Test for kmo_get_obj_sky_frame_table() */ -void test_kmo_get_obj_sky_frame_table() +void test_kmo_get_obj_sky_frame_table(void) { /*erwtest*/ kmo_test_verbose_off(); @@ -56,7 +56,7 @@ /** @brief Test for kmo_collapse_object_sky_frame_table() */ -void test_kmo_collapse_object_sky_frame_table() +void test_kmo_collapse_object_sky_frame_table(void) { /*erwtest*/ kmo_test_verbose_off(); @@ -68,7 +68,7 @@ /** @brief Test for kmo_interpolate_vector_wcs() */ -void test_kmo_interpolate_vector_wcs() +void test_kmo_interpolate_vector_wcs(void) { kmo_test_verbose_off(); // missing inputs @@ -112,7 +112,7 @@ /** @brief Test for kmo_divide_blackbody() */ -void test_kmo_divide_blackbody() +void test_kmo_divide_blackbody(void) { kmo_test_verbose_off(); // null inputs @@ -157,7 +157,7 @@ /** @brief Test for kmo_remove_line() */ -void test_kmo_remove_line() +void test_kmo_remove_line(void) { kmo_test_verbose_off(); // null inputs @@ -210,7 +210,7 @@ /** @brief Test for kmo_calc_counts() */ -void test_kmo_calc_counts() +void test_kmo_calc_counts(void) { double cnt1=0, cnt2=0; kmo_test_verbose_off(); @@ -218,11 +218,13 @@ cpl_test_error(CPL_ERROR_NULL_INPUT); char *my_path = cpl_sprintf("%s/ref_data/test_br_gamma.fits", getenv("srcdir")); -kmclipm_vector *ddd = kmclipm_vector_load(my_path, 0); + kmclipm_vector *ddd = kmclipm_vector_load(my_path, 0); cpl_free(my_path); -cpl_vector *data = cpl_vector_duplicate(ddd->data); -kmclipm_vector_delete(ddd); - kmo_calc_counts(data, NULL, -1, -1, -1, NULL, NULL), 0.01; + + cpl_vector *data = cpl_vector_duplicate(ddd->data); + kmclipm_vector_delete(ddd); + + kmo_calc_counts(data, NULL, -1, -1, -1, NULL, NULL); cpl_test_error(CPL_ERROR_NULL_INPUT); kmo_test_verbose_on(); @@ -244,7 +246,7 @@ /** @brief Test for kmo_calc_zeropoint() */ -void test_kmo_calc_zeropoint() +void test_kmo_calc_zeropoint(void) { cpl_test_abs(1, kmclipm_is_nan_or_inf(kmo_calc_zeropoint(-1, -1, -1, -1, 0.01, "H")), 0.01); @@ -259,7 +261,7 @@ /** @brief Test for kmo_calc_throughput() */ -void test_kmo_calc_throughput() +void test_kmo_calc_throughput(void) { kmo_test_verbose_off(); cpl_test_abs(0, kmo_calc_throughput(-1, -1, -1, -1, -1, NULL), 1e-10); @@ -282,7 +284,7 @@ /** @brief Test for kmo_calc_mean_throughput() */ -void test_kmo_calc_mean_throughput() +void test_kmo_calc_mean_throughput(void) { kmo_test_verbose_off(); kmo_calc_mean_throughput(NULL, -1, NULL, NULL); @@ -310,7 +312,7 @@ /** @brief Test for kmo_calculate_std_trace() */ -void test_kmo_calculate_std_trace() +void test_kmo_calculate_std_trace(void) { kmo_test_verbose_off(); kmo_calculate_std_trace(NULL, NULL, NULL); @@ -358,7 +360,7 @@ /** * @brief Test of helper functions for kmo_std_star */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_wave_cal-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_wave_cal-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_priv_wave_cal-test.c 2014-02-07 14:16:54.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_priv_wave_cal-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -33,7 +33,7 @@ /** @brief test kmo_calc_fitted_slitlet_edge() */ -void test_kmo_calc_fitted_slitlet_edge() +void test_kmo_calc_fitted_slitlet_edge(void) { int left_edge = 0, right_edge = 0; @@ -89,7 +89,7 @@ cpl_test_error(CPL_ERROR_NONE); } -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmos_priv_sky_tweak-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmos_priv_sky_tweak-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmos_priv_sky_tweak-test.c 2016-11-24 12:49:30.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmos_priv_sky_tweak-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -19,8 +19,8 @@ /** @brief */ -int main(){ - +int main(void) +{ cpl_imagelist *obj_cube = NULL, *sky_cube = NULL; cpl_propertylist *obj_header = NULL; diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_utils-test.c cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_utils-test.c --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/kmo_utils-test.c 2014-02-24 10:37:34.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/kmo_utils-test.c 2018-04-09 13:42:16.000000000 +0000 @@ -45,7 +45,7 @@ /** @brief test for kmos_get_license() */ -void test_kmos_get_license() +void test_kmos_get_license(void) { const char *ch = NULL; @@ -55,7 +55,7 @@ /** @brief test kmo_cut_endings() */ -void test_kmo_cut_endings() +void test_kmo_cut_endings(void) { cpl_vector *vec = cpl_vector_new(5); int begin = 0, end = 0; @@ -96,7 +96,7 @@ /** @brief test kmo_easy_gaussfit() */ -void test_kmo_easy_gaussfit() +void test_kmo_easy_gaussfit(void) { cpl_vector *x = cpl_vector_new(5), *y = cpl_vector_new(5); @@ -133,7 +133,7 @@ /** @brief test kmo_polyfit_1d() */ -void test_kmo_polyfit_1d() +void test_kmo_polyfit_1d(void) { cpl_vector *x = cpl_vector_new(5), *y = cpl_vector_new(5), @@ -168,7 +168,7 @@ /** @brief test kmo_to_deg() */ -void test_kmo_to_deg() +void test_kmo_to_deg(void) { kmo_test_verbose_off(); cpl_test_abs(0, kmo_to_deg(10000001), 0.01); @@ -185,7 +185,7 @@ /** @brief test kmo_string_to_frame_type() */ -void test_kmo_string_to_frame_type() +void test_kmo_string_to_frame_type(void) { cpl_test_eq(ifu_frame, kmo_string_to_frame_type("F2I")); cpl_test_eq(ifu_frame, kmo_string_to_frame_type("F3I")); @@ -212,7 +212,7 @@ /** @brief test kmo_identify_fits_header() */ -void test_kmo_identify_fits_header() +void test_kmo_identify_fits_header(void) { main_fits_desc main_desc; @@ -247,7 +247,7 @@ /** @brief test kmo_identify_fits_sub_header() */ -void test_kmo_identify_fits_sub_header() +void test_kmo_identify_fits_sub_header(void) { sub_fits_desc sub_desc; @@ -263,7 +263,7 @@ /** @brief test for kmo_check_indices() */ -void test_kmo_check_indices() +void test_kmo_check_indices(void) { kmo_test_verbose_off(); kmo_check_indices(NULL, -1, -1); @@ -295,7 +295,7 @@ /** @brief test kmo_free_fits_desc() */ -void test_kmo_free_fits_desc() +void test_kmo_free_fits_desc(void) { main_fits_desc main_desc; @@ -316,7 +316,7 @@ /** @brief test kmo_init_fits_desc() */ -void test_kmo_init_fits_desc() +void test_kmo_init_fits_desc(void) { main_fits_desc main_desc; @@ -343,7 +343,7 @@ /** @brief test for kmo_init_fits_sub_desc() */ -void test_kmo_init_fits_sub_desc() +void test_kmo_init_fits_sub_desc(void) { kmo_test_verbose_off(); kmo_init_fits_sub_desc(NULL); @@ -363,7 +363,7 @@ /** @brief test kmo_idl_where() */ -void test_kmo_idl_where() +void test_kmo_idl_where(void) { cpl_vector *vec = cpl_vector_new(5), *res = NULL; @@ -385,7 +385,7 @@ /** @brief test kmo_idl_values_at_indices() */ -void test_kmo_idl_values_at_indices() +void test_kmo_idl_values_at_indices(void) { cpl_vector *vec = cpl_vector_new(5), *res = NULL, @@ -416,7 +416,7 @@ /** @brief Test for kmo_get_unused_ifus() */ -void test_kmo_get_unused_ifus() +void test_kmo_get_unused_ifus(void) { kmo_test_verbose_off(); cpl_test_null(kmo_get_unused_ifus(NULL, 1, 1)); @@ -501,7 +501,7 @@ /** @brief Test for kmo_set_unused_ifus() */ -void test_kmo_set_unused_ifus() +void test_kmo_set_unused_ifus(void) { kmo_test_verbose_off(); kmo_set_unused_ifus(NULL, NULL, NULL); @@ -567,7 +567,7 @@ /** @brief Test for kmo_duplicate_unused_ifus() */ -void test_kmo_duplicate_unused_ifus() +void test_kmo_duplicate_unused_ifus(void) { kmo_test_verbose_off(); cpl_test_null(kmo_duplicate_unused_ifus(NULL)); @@ -616,7 +616,7 @@ /** @brief Test for kmo_print_unused_ifus() */ -void test_kmo_print_unused_ifus() +void test_kmo_print_unused_ifus(void) { kmo_test_verbose_off(); kmo_print_unused_ifus(NULL, -1); @@ -668,7 +668,7 @@ /** @brief Test for kmo_free_unused_ifus() */ -void test_kmo_free_unused_ifus() +void test_kmo_free_unused_ifus(void) { kmo_test_verbose_off(); kmo_free_unused_ifus(NULL); @@ -712,7 +712,7 @@ /** @brief Test for kmo_strsplit() */ -void test_kmo_strsplit() +void test_kmo_strsplit(void) { kmo_test_verbose_off(); cpl_test_null(kmo_strsplit(NULL, NULL, NULL)); @@ -767,7 +767,7 @@ /** @brief Test for kmo_strfreev() */ -void test_kmo_strfreev() +void test_kmo_strfreev(void) { kmo_strfreev(NULL); cpl_test_error(CPL_ERROR_NONE); @@ -783,7 +783,7 @@ /** @brief Test for kmo_strlower() */ -void test_kmo_strlower() +void test_kmo_strlower(void) { kmo_test_verbose_off(); cpl_test_null(kmo_strlower(NULL)); @@ -809,7 +809,7 @@ /** @brief Test for kmo_strupper() */ -void test_kmo_strupper() +void test_kmo_strupper(void) { kmo_test_verbose_off(); cpl_test_null(kmo_strupper(NULL)); @@ -835,7 +835,7 @@ /** @brief Test of utility functions */ -int main() +int main(void) { cpl_test_init("", CPL_MSG_WARNING); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/Makefile.in cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/Makefile.in --- cpl-plugin-kmos-1.4.3+dfsg/kmos/tests/Makefile.in 2017-02-27 20:41:52.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/kmos/tests/Makefile.in 2018-04-24 13:37:16.000000000 +0000 @@ -116,7 +116,8 @@ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4macros/molecfit.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -711,6 +712,7 @@ LIBIRPLIB = @LIBIRPLIB@ LIBKMCLIPMLIB = @LIBKMCLIPMLIB@ LIBKMOS = @LIBKMOS@ +LIBMOLECFIT = @LIBMOLECFIT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -726,6 +728,10 @@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOLECFITDIR = @MOLECFITDIR@ +MOLECFIT_CFLAGS = @MOLECFIT_CFLAGS@ +MOLECFIT_INCLUDES = @MOLECFIT_INCLUDES@ +MOLECFIT_LDFLAGS = @MOLECFIT_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -740,6 +746,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG = @PKGCONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/m4macros/cpl.m4 cpl-plugin-kmos-2.0.2+dfsg/m4macros/cpl.m4 --- cpl-plugin-kmos-1.4.3+dfsg/m4macros/cpl.m4 2017-01-27 14:36:15.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/m4macros/cpl.m4 2017-09-05 11:58:51.000000000 +0000 @@ -14,24 +14,24 @@ AC_REQUIRE([ESO_CHECK_THREADS_POSIX]) AC_ARG_WITH(cfitsio, - AC_HELP_STRING([--with-cfitsio], + AS_HELP_STRING([--with-cfitsio], [location where cfitsio is installed]), [ cpl_with_cfitsio=$withval ]) AC_ARG_WITH(cfitsio-includes, - AC_HELP_STRING([--with-cfitsio-includes], + AS_HELP_STRING([--with-cfitsio-includes], [location of the cfitsio header files]), cpl_with_cfitsio_includes=$withval) AC_ARG_WITH(cfitsio-libs, - AC_HELP_STRING([--with-cfitsio-libs], + AS_HELP_STRING([--with-cfitsio-libs], [location of the cfitsio library]), cpl_with_cfitsio_libs=$withval) AC_ARG_ENABLE(cfitsio-test, - AC_HELP_STRING([--disable-cfitsio-test], + AS_HELP_STRING([--disable-cfitsio-test], [disables checks for the cfitsio library and headers]), cpl_enable_cfitsio_test=$enableval, cpl_enable_cfitsio_test=yes) @@ -378,24 +378,24 @@ AC_REQUIRE([ESO_PROG_PKGCONFIG]) AC_ARG_WITH(cext, - AC_HELP_STRING([--with-cext], + AS_HELP_STRING([--with-cext], [location where libcext is installed]), [ cpl_with_cext=$withval ]) AC_ARG_WITH(cext-includes, - AC_HELP_STRING([--with-cext-includes], + AS_HELP_STRING([--with-cext-includes], [location of the libcext header files]), cpl_with_cext_includes=$withval) AC_ARG_WITH(cext-libs, - AC_HELP_STRING([--with-cext-libs], + AS_HELP_STRING([--with-cext-libs], [location of the libcext library]), cpl_with_cext_libs=$withval) AC_ARG_ENABLE(cext-test, - AC_HELP_STRING([--disable-cext-test], + AS_HELP_STRING([--disable-cext-test], [disables checks for the libcext library and headers]), cpl_enable_cext_test=$enableval, cpl_enable_cext_test=yes) @@ -564,25 +564,25 @@ AC_REQUIRE([ESO_PROG_PKGCONFIG]) AC_ARG_WITH(wcslib, - AC_HELP_STRING([--with-wcslib], + AS_HELP_STRING([--with-wcslib], [location where wcslib is installed]), [ cpl_with_wcs=$withval ]) AC_ARG_WITH(wcslib-includes, - AC_HELP_STRING([--with-wcslib-includes], + AS_HELP_STRING([--with-wcslib-includes], [location of the wcslib header files]), cpl_with_wcs_includes=$withval) AC_ARG_WITH(wcslib-libs, - AC_HELP_STRING([--with-wcslib-libs], + AS_HELP_STRING([--with-wcslib-libs], [location of the wcslib library]), cpl_with_wcs_libs=$withval) AC_ARG_ENABLE(wcs, - AC_HELP_STRING([--disable-wcs], + AS_HELP_STRING([--disable-wcs], [disable WCS support.]), [cpl_enable_wcs=$enable_wcs], [cpl_enable_wcs="yes"]) @@ -851,24 +851,24 @@ AC_REQUIRE([ESO_PROG_PKGCONFIG]) AC_ARG_WITH(fftw, - AC_HELP_STRING([--with-fftw], + AS_HELP_STRING([--with-fftw], [location where fftw is installed]), [ cpl_with_fftw=$withval ]) AC_ARG_WITH(fftw-includes, - AC_HELP_STRING([--with-fftw-includes], + AS_HELP_STRING([--with-fftw-includes], [location of the fftw header files]), cpl_with_fftw_includes=$withval) AC_ARG_WITH(fftw-libs, - AC_HELP_STRING([--with-fftw-libs], + AS_HELP_STRING([--with-fftw-libs], [location of the fftw libraries]), cpl_with_fftw_libs=$withval) AC_ARG_ENABLE(fft, - AC_HELP_STRING([--disable-fft], + AS_HELP_STRING([--disable-fft], [disable FFt support.]), [cpl_enable_fft=$enable_fft], [cpl_enable_fft="yes"]) @@ -1421,24 +1421,24 @@ AC_ARG_WITH(cpl, - AC_HELP_STRING([--with-cpl], + AS_HELP_STRING([--with-cpl], [location where CPL is installed]), [ cpl_with_cpl=$withval ]) AC_ARG_WITH(cpl-includes, - AC_HELP_STRING([--with-cpl-includes], + AS_HELP_STRING([--with-cpl-includes], [location of the CPL header files]), cpl_with_cpl_includes=$withval) AC_ARG_WITH(cpl-libs, - AC_HELP_STRING([--with-cpl-libs], + AS_HELP_STRING([--with-cpl-libs], [location of the CPL library]), cpl_with_cpl_libs=$withval) AC_ARG_ENABLE(cpl-test, - AC_HELP_STRING([--disable-cpl-test], + AS_HELP_STRING([--disable-cpl-test], [disables checks for the CPL library and headers]), cpl_enable_cpl_test=$enableval, cpl_enable_cpl_test=yes) diff -Nru cpl-plugin-kmos-1.4.3+dfsg/m4macros/eso.m4 cpl-plugin-kmos-2.0.2+dfsg/m4macros/eso.m4 --- cpl-plugin-kmos-1.4.3+dfsg/m4macros/eso.m4 2016-10-25 09:25:42.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/m4macros/eso.m4 2017-09-05 11:58:51.000000000 +0000 @@ -83,7 +83,7 @@ AC_REQUIRE([AC_PROG_CC]) AC_ARG_ENABLE(debug, - AC_HELP_STRING([--enable-debug], + AS_HELP_STRING([--enable-debug], [creates debugging code [default=$1]]), eso_enable_debug=$enableval, eso_enable_debug=$1) @@ -174,7 +174,7 @@ AC_REQUIRE([AC_PROG_CC]) AC_ARG_ENABLE(strict, - AC_HELP_STRING([--enable-strict], + AS_HELP_STRING([--enable-strict], [compiles with strict compiler options (may not work!) [default=$1]]), eso_enable_strict=$enableval, eso_enable_strict=$1) @@ -211,7 +211,7 @@ AC_REQUIRE([AC_PROG_CC]) AC_ARG_ENABLE(profile, - AC_HELP_STRING([--enable-profile], + AS_HELP_STRING([--enable-profile], [compiles with compiler options necessary for profiling (may not work!) [default=$1]]), eso_enable_profile=$enableval, eso_enable_profile=$1) @@ -285,12 +285,12 @@ [ AC_ARG_WITH(extra-includes, - AC_HELP_STRING([--with-extra-includes=DIR], + AS_HELP_STRING([--with-extra-includes=DIR], [adds non standard include paths]), eso_with_extra_includes=$withval, eso_with_extra_includes=NONE) AC_ARG_WITH(extra-libs, - AC_HELP_STRING([--with-extra-libs=DIR], + AS_HELP_STRING([--with-extra-libs=DIR], [adds non standard library paths]), eso_with_extra_libs=$withval, eso_with_extra_libs=NONE) diff -Nru cpl-plugin-kmos-1.4.3+dfsg/m4macros/molecfit.m4 cpl-plugin-kmos-2.0.2+dfsg/m4macros/molecfit.m4 --- cpl-plugin-kmos-1.4.3+dfsg/m4macros/molecfit.m4 1970-01-01 00:00:00.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/m4macros/molecfit.m4 2017-09-05 11:58:51.000000000 +0000 @@ -0,0 +1,180 @@ +# MOLECFIT_CHECK_LIBS(version) +#--------------------------------------- +# Checks for the MOLECFIT library and header files. +AC_DEFUN([MOLECFIT_CHECK_LIBS], +[ + + molecfit_check_version="$1" + molecfit_check_header="molecfit.h" + molecfit_check_libraries="-lmolecfit" + + molecfit_pkgconfig="molecfit" + + + AC_REQUIRE([ESO_PROG_PKGCONFIG]) + AC_REQUIRE([CPL_CHECK_LIBS]) + + AC_ARG_WITH(molecfit, + AS_HELP_STRING([--with-molecfit], + [location where molecfit is installed]), + [ + molecfit_with_molecfit=$withval + ]) + + AC_ARG_WITH(molecfit-includes, + AS_HELP_STRING([--with-molecfit-includes], + [location of the molecfit header files]), + molecfit_with_molecfit_includes=$withval) + + AC_ARG_WITH(molecfit-libs, + AS_HELP_STRING([--with-molecfit-libs], + [location of the molecfit library]), + molecfit_with_molecfit_libs=$withval) + + AC_ARG_ENABLE(molecfit-test, + AS_HELP_STRING([--disable-molecfit-test], + [disables checks for the molecfit library and headers]), + molecfit_enable_molecfit_test=$enableval, + molecfit_enable_molecfit_test=yes) + + AC_ARG_VAR([MOLECFITDIR], [Location where molecfit is installed]) + + if test "x$molecfit_enable_molecfit_test" = xyes; then + + AC_MSG_CHECKING([for molecfit]) + + # If include directories and libraries are given as arguments, use them + # initially. Otherwise assume a standard system installation of the + # package. This may then updated in the following. + + molecfit_libs="$molecfit_check_libraries" + molecfit_cflags="-I/usr/include/molecfit -I/usr/include" + molecfit_ldflags="" + + if test -n "${PKGCONFIG}"; then + + $PKGCONFIG --exists $molecfit_pkgconfig + + if test x$? = x0; then + molecfit_cflags="`$PKGCONFIG --cflags $molecfit_pkgconfig`" + molecfit_ldflags="`$PKGCONFIG --libs-only-L $molecfit_pkgconfig`" + molecfit_libs="`$PKGCONFIG --libs-only-l $molecfit_pkgconfig`" + fi + + fi + + # Directories given as arguments replace a standard system installation + # setup if they are given. + + if test -n "$MOLECFITDIR"; then + molecfit_cflags="-I$MOLECFITDIR/include/molecfit -I$MOLECFITDIR/include" + molecfit_ldflags="-L$MOLECFITDIR/lib64 -L$MOLECFITDIR/lib" + fi + + if test -n "$molecfit_with_molecfit"; then + molecfit_cflags="-I$molecfit_with_molecfit/include/molecfit -I$molecfit_with_molecfit/include" + molecfit_ldflags="-L$molecfit_with_molecfit/lib64 -L$molecfit_with_molecfit/lib" + fi + + if test -n "$molecfit_with_molecfit_includes"; then + molecfit_cflags="-I$molecfit_with_molecfit_includes" + fi + + if test -n "$molecfit_with_molecfit_libs"; then + molecfit_ldflags="-L$molecfit_with_molecfit_libs" + fi + + + # Check whether the header files and the library are present and + # whether they can be used. + + molecfit_have_molecfit_libraries="no" + molecfit_have_molecfit_headers="no" + + AC_LANG_PUSH(C) + + molecfit_cflags_save="$CFLAGS" + molecfit_ldflags_save="$LDFLAGS" + molecfit_libs_save="$LIBS" + + CFLAGS="$CPL_INCLUDES $molecfit_cflags" + LDFLAGS="$molecfit_ldflags $CPL_LDFLAGS" + LIBS="$molecfit_libs $LIBCPLUI $LIBCPLCORE" + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[ + #include <$molecfit_check_header> + ]], + [ + char c; + ])], + [ + molecfit_have_molecfit_headers="yes" + ], + [ + molecfit_have_molecfit_headers="no" + ]) + + AC_LINK_IFELSE([AC_LANG_PROGRAM( + [[ + ]], + [ + mf_cleanup((void *)0); + ])], + [ + molecfit_have_molecfit_libraries="yes" + ], + [ + molecfit_have_molecfit_libraries="no" + ]) + + AC_LANG_POP(C) + + CFLAGS="$molecfit_cflags_save" + LDFLAGS="$molecfit_ldflags_save" + LIBS="$molecfit_libs_save" + + if test x"$molecfit_have_molecfit_libraries" = xno || \ + test x"$molecfit_have_molecfit_headers" = xno; then + molecfit_notfound="" + + if test x"$molecfit_have_molecfit_headers" = xno; then + if test x"$molecfit_have_molecfit_libraries" = xno; then + molecfit_notfound="(headers and libraries)" + else + molecfit_notfound="(headers)" + fi + else + molecfit_notfound="(libraries)" + fi + + AC_MSG_RESULT([no]) + AC_MSG_ERROR([molecfit $molecfit_notfound was not found on your system.]) + + else + AC_MSG_RESULT([yes]) + + MOLECFIT_INCLUDES="$molecfit_cflags" + MOLECFIT_CFLAGS="$molecfit_cflags" + MOLECFIT_LDFLAGS="$molecfit_ldflags" + LIBMOLECFIT="$molecfit_libs" + fi + + else + + AC_MSG_WARN([molecfit checks have been disabled! This package may not build!]) + + MOLECFIT_INCLUDES="" + MOLECFIT_CFLAGS="" + MOLECFIT_LDFLAGS="" + LIBMOLECFIT="" + + fi + + AC_SUBST(MOLECFIT_INCLUDES) + AC_SUBST(MOLECFIT_CFLAGS) + AC_SUBST(MOLECFIT_LDFLAGS) + AC_SUBST(LIBMOLECFIT) + +]) +# vim: et:ts=4:sw=4 diff -Nru cpl-plugin-kmos-1.4.3+dfsg/Makefile.in cpl-plugin-kmos-2.0.2+dfsg/Makefile.in --- cpl-plugin-kmos-1.4.3+dfsg/Makefile.in 2017-02-27 20:41:52.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/Makefile.in 2018-04-24 13:37:15.000000000 +0000 @@ -98,7 +98,8 @@ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4macros/molecfit.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ @@ -300,6 +301,7 @@ LIBIRPLIB = @LIBIRPLIB@ LIBKMCLIPMLIB = @LIBKMCLIPMLIB@ LIBKMOS = @LIBKMOS@ +LIBMOLECFIT = @LIBMOLECFIT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -315,6 +317,10 @@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOLECFITDIR = @MOLECFITDIR@ +MOLECFIT_CFLAGS = @MOLECFIT_CFLAGS@ +MOLECFIT_INCLUDES = @MOLECFIT_INCLUDES@ +MOLECFIT_LDFLAGS = @MOLECFIT_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -329,6 +335,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG = @PKGCONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/NEWS cpl-plugin-kmos-2.0.2+dfsg/NEWS --- cpl-plugin-kmos-1.4.3+dfsg/NEWS 2012-01-18 09:32:01.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/NEWS 2018-04-24 11:57:47.000000000 +0000 @@ -0,0 +1,33 @@ +KMOS 2.0.2 (2018-04-24): +----------------------- +* Recipes + - kms_combine error when method="center" + - --save_interim in kmos_sci_red fails in some cases + - kmo_fit_profile needs a fall-back solution when called by kmos_std_star + - bug fix and improvement for kmos_gen_telluric + - b_end and b_start do not work + - kmos_reconstruct: allow ACQUISITION as DO category for input files + - KMOS recipe kmos_illumination bug when using pix_scale=0.1 + - kmos_illumination: QC parameters should not be in extensions + - DPB - Make the KMOS pipeline products IDPs compliant + - kmos_combine and PythonActorCombine have to accept PRO.CATG=SINGLE_CUBES + +* Tools + - KMOS kmos_calib.py and kmos_verify.py not compatible with astropy + +* Reflex + - kmos_sci_red: expose --method parameter as PORT + - kmos_wave_cal.py must handle cases were not all 6 rot angle are + observed + - KMOS workflow does not work with reflex 2.9 + - compatibility with new version of numpy in correct_std.py in the + KMOS workflow + - Upgrade of Reflex workflows in KMOS + +* Molecfit + - DMO CCB: Include molecfit tools into the KMOS pipeline to correct + telluric absorption in KMOS data. + +* Documentation + - Make proper use of the NEWS file when releasing pipeline packages + diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmo_arithmetic.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmo_arithmetic.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmo_arithmetic.c 2016-04-04 13:19:20.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmo_arithmetic.c 2018-03-08 12:06:50.000000000 +0000 @@ -23,6 +23,7 @@ #include +#include #include #include "kmo_debug.h" @@ -32,6 +33,8 @@ #include "kmo_priv_arithmetic.h" #include "kmo_constants.h" +#define FORBIDDEN_SCALAR -99999.9 + static int kmo_arithmetic_create(cpl_plugin *); static int kmo_arithmetic_exec(cpl_plugin *); static int kmo_arithmetic_destroy(cpl_plugin *); @@ -179,7 +182,7 @@ CPL_TYPE_DOUBLE, "The scalar operand", "kmos.kmo_arithmetic", - -DBL_MAX); + FORBIDDEN_SCALAR); cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "scalar"); cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV); cpl_parameterlist_append(recipe->parameters, p); @@ -263,7 +266,7 @@ *op2_1d = NULL, *op1_noise_1d = NULL, *op2_noise_1d = NULL; - double op2_scalar = -DBL_MAX; + double op2_scalar = FORBIDDEN_SCALAR; int ret_val = 0, nr_devices = 0, i = 0, @@ -304,7 +307,7 @@ KMO_TRY_ASSURE((cpl_frameset_get_size(frameset) == 2) || ((cpl_frameset_get_size(frameset) == 1) && - (op2_scalar != -DBL_MAX)), + (fabs(op2_scalar-FORBIDDEN_SCALAR) > 1e-3)), CPL_ERROR_NULL_INPUT, "Two fits-files or one fits-file and one " "scalar must be provided!"); @@ -364,7 +367,7 @@ "(KMOSTYPE must be F3I, F2I, F1I, F2D or RAW)!"); // load descriptor, header of second operand - if (op2_scalar == -DBL_MAX) { + if (fabs(op2_scalar-FORBIDDEN_SCALAR) < 1e-3) { desc2 = kmo_identify_fits_header( cpl_frame_get_filename(op2_frame)); KMO_TRY_CHECK_ERROR_STATE_MSG("Provided fits file doesn't seem to " @@ -535,7 +538,7 @@ devnr1 = desc1.sub_desc[2 * i - 1].device_nr; } - if (op2_scalar == -DBL_MAX) { + if (fabs(op2_scalar-FORBIDDEN_SCALAR) < 1e-3) { if (desc2.ex_noise == FALSE) { devnr2 = desc2.sub_desc[i - 1].device_nr; } else { @@ -572,7 +575,7 @@ // // process RAW & scalar // - else if (op2_scalar != -DBL_MAX) { + else if (fabs(op2_scalar-FORBIDDEN_SCALAR) > 1e-3) { KMO_TRY_EXIT_IF_ERROR( kmo_arithmetic_2D_scalar(op1_2d, op2_scalar, NULL, op)); @@ -620,7 +623,8 @@ // // process F2D & scalar // - else if (op2_scalar != -DBL_MAX) { + + else if (fabs(op2_scalar-FORBIDDEN_SCALAR) > 1e-3) { // process data & noise if (desc1.ex_noise == TRUE) { KMO_TRY_EXIT_IF_NULL( @@ -657,7 +661,7 @@ // check if IFUs are valid if (desc1.ex_noise == FALSE) { if (desc1.sub_desc[i - 1].valid_data == TRUE) { - if (op2_scalar != -DBL_MAX) { + if (fabs(op2_scalar-FORBIDDEN_SCALAR) > 1e-3) { calc_f3i = TRUE; } else if (((single_ifu == TRUE) && (desc2.sub_desc[0].valid_data == TRUE)) @@ -799,7 +803,7 @@ // // process F3I & scalar // - else if (op2_scalar != -DBL_MAX) { + else if (fabs(op2_scalar-FORBIDDEN_SCALAR) > 1e-3) { if (desc1.ex_noise == TRUE) { KMO_TRY_EXIT_IF_NULL( op1_noise_3d = kmo_dfs_load_cube(frameset, @@ -849,7 +853,7 @@ ) && (desc2.ex_noise == TRUE) ) || - (op2_scalar != -DBL_MAX) + (fabs(op2_scalar-FORBIDDEN_SCALAR) > 1e-3) ) ) { @@ -874,7 +878,7 @@ // check if IFUs are valid if (desc1.ex_noise == FALSE) { if (desc1.sub_desc[i - 1].valid_data == TRUE) { - if (op2_scalar != -DBL_MAX) { + if (fabs(op2_scalar-FORBIDDEN_SCALAR) > 1e-3) { calc_f2i = TRUE; } else if (((single_ifu == TRUE) && (desc2.sub_desc[0].valid_data == TRUE)) @@ -947,7 +951,7 @@ // // process F2I & scalar // - else if (op2_scalar != -DBL_MAX) { + else if (fabs(op2_scalar-FORBIDDEN_SCALAR) > 1e-3) { if (desc1.ex_noise == TRUE) { KMO_TRY_EXIT_IF_NULL( op1_noise_2d = kmo_dfs_load_image( @@ -991,7 +995,7 @@ if ((desc1.ex_noise == TRUE) && (((desc2.fits_type == f2i_fits) && (desc2.ex_noise == TRUE)) || - (op2_scalar != -DBL_MAX))) + (fabs(op2_scalar-FORBIDDEN_SCALAR) > 1e-3))) { KMO_TRY_EXIT_IF_NULL( @@ -1013,7 +1017,7 @@ // check if IFUs are valid if (desc1.ex_noise == FALSE) { if (desc1.sub_desc[i - 1].valid_data == TRUE) { - if (op2_scalar != -DBL_MAX) { + if (fabs(op2_scalar-FORBIDDEN_SCALAR) > 1e-3) { calc_f1i = TRUE; } else if (((single_ifu == TRUE) && (desc2.sub_desc[0].valid_data == TRUE)) @@ -1086,7 +1090,7 @@ // // process F1I & scalar // - else if (op2_scalar != -DBL_MAX) { + else if (fabs(op2_scalar-FORBIDDEN_SCALAR) > 1e-3) { if (desc1.ex_noise == TRUE) { KMO_TRY_EXIT_IF_NULL( op1_noise_1d = kmo_dfs_load_vector( @@ -1130,7 +1134,7 @@ if ((desc1.ex_noise == TRUE) && (((desc2.fits_type == f2i_fits) && (desc2.ex_noise == TRUE)) || - (op2_scalar != -DBL_MAX))) + (fabs(op2_scalar-FORBIDDEN_SCALAR) > 1e-3))) { KMO_TRY_EXIT_IF_NULL( diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmo_fits_strip.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmo_fits_strip.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmo_fits_strip.c 2016-04-04 13:19:20.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmo_fits_strip.c 2018-04-09 13:42:16.000000000 +0000 @@ -29,6 +29,7 @@ #include "kmclipm_constants.h" #include "kmclipm_functions.h" +#include "kmo_utils.h" #include "kmo_dfs.h" #include "kmo_error.h" #include "kmo_debug.h" @@ -229,13 +230,6 @@ return 0 ; } -static const char * kmos_get_base_name(const char * self) -{ - const char * p = self ? strrchr(self, '/') : NULL; - - return p ? p + 1 : self; -} - // kmo_dfs_save_main_header() doesn't allow to change ESO OCS ROT NAANGLE cpl_error_code kmo_save_header_fits_strip(cpl_propertylist *header, cpl_parameterlist *parlist, @@ -379,8 +373,7 @@ actDetNr = 0, cal_device_nr = 0, dummy = 0, - index = 0, - i = 0; + index = 0; double angle = 0., tmp_angle = 0., ret_angle = 0., @@ -479,11 +472,12 @@ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_fits_strip.extension")); if (strcmp(extension_txt, "") != 0) { + // extract values from string KMO_TRY_EXIT_IF_NULL( split = kmo_strsplit(extension_txt, ",", NULL)); - i = 0; + int i = 0; while (split[i] != NULL) { i++; } @@ -545,7 +539,7 @@ // KMO_TRY_EXIT_IF_NULL( pextension = cpl_vector_get_data(extension)); - for (i = 0; i < cpl_vector_get_size(extension); i++) { + for (int i = 0; i < cpl_vector_get_size(extension); i++) { KMO_TRY_EXIT_IF_NULL( sub_header = cpl_propertylist_load(filename, pextension[i])); if ((desc.fits_type == f2d_fits) || @@ -641,11 +635,11 @@ } actDetNr = 1; - int i = 0, n = 0; - for (i = 0; i < nr_devices; i++) - { + for (int i = 0; i < nr_devices; i++) { + // either loop noise or not - for (n = FALSE; n <= remove_noise; n++) { + for (int n = FALSE; n <= remove_noise; n++) { + if (isCalFrame) { KMO_TRY_EXIT_IF_NULL( header = kmclipm_cal_propertylist_load(filename, i+1, n, angle, &ret_angle)); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_combine.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_combine.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_combine.c 2016-09-28 14:25:59.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_combine.c 2018-04-19 13:21:41.000000000 +0000 @@ -1,5 +1,4 @@ -/* - * This file is part of the KMOS Pipeline +/* * This file is part of the KMOS Pipeline * Copyright (C) 2002,2003 European Southern Observatory * * This program is free software; you can redistribute it and/or modify @@ -18,13 +17,18 @@ */ #ifdef HAVE_CONFIG_H -#include + #include #endif +#define _DEFAULT_SOURCE +#define _BSD_SOURCE + /*----------------------------------------------------------------------------- * Includes *----------------------------------------------------------------------------*/ +#include +#include #include #include @@ -34,6 +38,7 @@ #include "kmo_debug.h" #include "kmo_utils.h" #include "kmo_dfs.h" +#include "kmos_pfits.h" #include "kmo_error.h" #include "kmo_priv_functions.h" #include "kmo_cpl_extensions.h" @@ -41,9 +46,21 @@ #include "kmo_priv_combine.h" /*----------------------------------------------------------------------------- + * Define + *----------------------------------------------------------------------------*/ + +#define CPL_DFS_PRO_DID "PRO-1.16" + +/*----------------------------------------------------------------------------- * Functions prototypes *----------------------------------------------------------------------------*/ +static int kmos_combine_collect_data( + const cpl_propertylist * recons_prim_header, + const cpl_propertylist * recons_ext_header, + double * lambda, + double * seeing, + double * airmass) ; static char * kmos_combine_create_ifus_string(const int *,const int *,int); static cpl_bivector * kmos_combine_parse_skipped(const char *) ; static int kmos_combine_is_skipped(const cpl_bivector *, int, int) ; @@ -326,44 +343,78 @@ { const cpl_parameter * par ; cpl_frameset * rawframes ; - const char * filename,* fmethod,* method,* ifus_txt,* cmethod, - * skipped_frames; - double cpos_rej, cneg_rej ; - cpl_vector * ifus ; - int citer, cmin, cmax, nr_frames, index, - data_cube_counter, skip_cube_counter, - noise_cube_counter, flux, edge_nan, name_vec_size, - found, suppress_extension, suppress_index, ifu_nr, nv, - collapse_combined, mapping_id ; - char * tmp_str, * fn_combine, * fn_mask, * mapping_mode, - * name, ** name_vec, * name_loc ; - const char * frame_filename, * tmp_strc ; - cpl_image * exp_mask ; - cpl_imagelist ** data_cube_list, ** noise_cube_list, * cube_combined_data, - * cube_combined_noise ; - cpl_propertylist * main_header, **data_header_list, **noise_header_list, - * tmp_header, * pro_plist ; + const char * raw_tag, + * filename, + * fmethod, + * method, + * ifus_txt, + * cmethod, + * skipped_frames; + double cpos_rej, cneg_rej, fwhm_ar_med, fwhm_ne_med, + spec_res, fwhm_ar_val, fwhm_ne_val, pos_ar_val, + pos_ne_val, airmass, lambda, seeing, sky_res, + sky_rerr, abmaglim, outer_scale, + crval1, crval2, pos_ar_med, pos_ne_med, + crder3 ; + cpl_vector * ifus ; + int citer, cmin, cmax, nr_frames, index, + data_cube_counter, skip_cube_counter, + noise_cube_counter, flux, edge_nan, name_vec_size, + found, suppress_extension, ifu_nr, + nv, collapse_combined, mapping_id, fwhm_count, + data_count; + int suppress_index = 0; + char * tmp_str, + * fn_combine, + * fn_mask, + * mapping_mode, + ** name_vec, + * name_loc ; + const char * name; + const char * frame_filename, + * tmp_strc ; + cpl_image * exp_mask ; + cpl_imagelist ** data_cube_list, + ** noise_cube_list, + * cube_combined_data, + * cube_combined_noise ; + cpl_propertylist * main_header, + ** data_header_list, + ** noise_header_list, + * tmp_header, + * plist ; + cpl_vector * pos_ar ; + cpl_vector * pos_ne ; + cpl_vector * fwhm_ar ; + cpl_vector * fwhm_ne ; + cpl_vector * sky_res_vec ; + cpl_vector * airmass_vec ; + cpl_vector * seeing_vec ; + cpl_vector * lambda_vec ; + cpl_vector * tmp_vec ; char * reflex_suffix ; - cpl_bivector * skipped_bivector ; - cpl_frame * frame ; - cpl_size ci ; - main_fits_desc desc; - int * used_frame_idx ; - int * used_ifus ; - char * used_ifus_str ; - int * skip_frame_idx ; - int * skip_ifus ; - char * skip_ifus_str ; + cpl_bivector * skipped_bivector ; + cpl_frame * frame ; + cpl_size ci ; + main_fits_desc desc; + int * used_frame_idx ; + int * used_ifus ; + char * used_ifus_str ; + int * skip_frame_idx ; + int * skip_ifus ; + char * skip_ifus_str ; enum extrapolationType extrapol_enum = NONE_CLIPPING; - int i, j ; + double light_speed ; + int i, j ; - /* Check entries */ - if (parlist == NULL || frameset == NULL) { - cpl_msg_error(__func__, "Null Inputs") ; - cpl_error_set(__func__, CPL_ERROR_NULL_INPUT) ; - return -1 ; + /* Check initial Entries */ + if (kmos_check_and_set_groups(frameset) != CPL_ERROR_NONE) { + return cpl_error_get_code(); } + /* Initialise */ + light_speed = 299792.48 ; + /* Get parameters */ par = cpl_parameterlist_find_const(parlist, "kmos.kmos_combine.method"); method = cpl_parameter_get_string(par) ; @@ -374,7 +425,7 @@ par = cpl_parameterlist_find_const(parlist, "kmos.kmos_combine.ifus"); ifus_txt = cpl_parameter_get_string(par) ; par = cpl_parameterlist_find_const(parlist, "kmos.kmos_combine.name"); - name = (char*)cpl_parameter_get_string(par) ; + name = cpl_parameter_get_string(par) ; par = cpl_parameterlist_find_const(parlist, "kmos.kmos_combine.flux"); flux = cpl_parameter_get_bool(par) ; par = cpl_parameterlist_find_const(parlist, @@ -412,13 +463,6 @@ return -1 ; } - /* Identify the RAW and CALIB frames in the input frameset */ - if (kmo_dfs_set_groups(frameset) != 1) { - cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ; - cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; - return -1 ; - } - /* Parse the skipped frames option */ skipped_bivector = NULL ; if (strcmp(skipped_frames, "")) { @@ -442,6 +486,10 @@ return -1 ; } + /* Get the rawframes tag used */ + frame = cpl_frameset_get_position(rawframes, 0); + raw_tag = cpl_frame_get_tag(frame) ; + /* Load IFUS if specified */ if (strcmp(ifus_txt, "")) { ifus = kmo_identify_values(ifus_txt); @@ -570,7 +618,6 @@ sizeof(cpl_imagelist*)); noise_header_list = cpl_calloc(nr_frames*KMOS_NR_IFUS, sizeof(cpl_propertylist*)); - /* if (ifus != NULL) cpl_vector_delete(ifus); cpl_frameset_delete(rawframes) ; @@ -588,6 +635,13 @@ for (nv = 0; nv < name_vec_size; nv++) { name_loc = name_vec[nv]; + fwhm_ar = cpl_vector_new(nr_frames*KMOS_NR_IFUS) ; + fwhm_ne = cpl_vector_new(nr_frames*KMOS_NR_IFUS) ; + pos_ar = cpl_vector_new(nr_frames*KMOS_NR_IFUS) ; + pos_ne = cpl_vector_new(nr_frames*KMOS_NR_IFUS) ; + airmass_vec = cpl_vector_new(nr_frames*KMOS_NR_IFUS) ; + seeing_vec = cpl_vector_new(nr_frames*KMOS_NR_IFUS) ; + lambda_vec = cpl_vector_new(nr_frames*KMOS_NR_IFUS) ; used_frame_idx = cpl_calloc(nr_frames*KMOS_NR_IFUS, sizeof(int)) ; used_ifus = cpl_calloc(nr_frames*KMOS_NR_IFUS, sizeof(int)) ; skip_frame_idx = cpl_calloc(nr_frames*KMOS_NR_IFUS, sizeof(int)) ; @@ -596,12 +650,15 @@ data_cube_counter = 0; skip_cube_counter = 0; noise_cube_counter = 0; + fwhm_count = 0 ; + data_count = 0 ; for (i = 0; i < nr_frames; i++) { tmp_str = cpl_sprintf("%d", i); frame = kmo_dfs_get_frame(rawframes, tmp_str); frame_filename = cpl_frame_get_filename(frame); kmo_init_fits_desc(&desc); desc = kmo_identify_fits_header(frame_filename); + main_header = cpl_propertylist_load(frame_filename, 0) ; if (mapping_mode != NULL) { /* Mapping mode */ @@ -622,6 +679,44 @@ data_header_list[data_cube_counter] = kmo_dfs_load_sub_header(rawframes, tmp_str, j, FALSE); + + /* Store some other quantities */ + if (kmos_combine_collect_data(main_header, + data_header_list[data_cube_counter], + &lambda, &seeing, &airmass) == -1) { + cpl_error_reset() ; + } else { + cpl_vector_set(lambda_vec, data_count, lambda) ; + cpl_vector_set(seeing_vec, data_count, seeing) ; + cpl_vector_set(airmass_vec,data_count,airmass) ; + data_count ++ ; + } + + /* Store the Resolution */ + fwhm_ar_val = kmos_pfits_get_qc_ar_fwhm_mean( + data_header_list[data_cube_counter]) ; + fwhm_ne_val = kmos_pfits_get_qc_ne_fwhm_mean( + data_header_list[data_cube_counter]) ; + pos_ar_val = kmos_pfits_get_qc_ar_pos_stdev( + data_header_list[data_cube_counter]) ; + pos_ne_val = kmos_pfits_get_qc_ne_pos_stdev( + data_header_list[data_cube_counter]) ; + if (cpl_error_get_code() != CPL_ERROR_NONE) { + cpl_msg_warning(__func__, + "Cannot retrieve QC ARC xx FWHM MEAN") ; + cpl_error_reset() ; + } else { + cpl_vector_set(fwhm_ar,fwhm_count, + light_speed/fwhm_ar_val) ; + cpl_vector_set(fwhm_ne,fwhm_count, + light_speed/fwhm_ne_val) ; + cpl_vector_set(pos_ar,fwhm_count, + pos_ar_val*lambda*1000/light_speed) ; + cpl_vector_set(pos_ne,fwhm_count, + pos_ne_val*lambda*1000/light_speed) ; + fwhm_count++ ; + } + cpl_propertylist_update_string( data_header_list[data_cube_counter], "ESO PRO FRNAME", frame_filename); @@ -697,6 +792,44 @@ data_header_list[data_cube_counter] = kmo_dfs_load_sub_header(rawframes, tmp_str, ifu_nr, FALSE); + + /* Store some other quantities */ + if (kmos_combine_collect_data(main_header, + data_header_list[data_cube_counter], + &lambda, &seeing, &airmass) == -1) { + cpl_error_reset() ; + } else { + cpl_vector_set(lambda_vec, data_count, lambda) ; + cpl_vector_set(seeing_vec, data_count, seeing) ; + cpl_vector_set(airmass_vec,data_count,airmass) ; + data_count ++ ; + } + + /* Store the Resolution and crder3 */ + fwhm_ar_val = kmos_pfits_get_qc_ar_fwhm_mean( + data_header_list[data_cube_counter]) ; + fwhm_ne_val = kmos_pfits_get_qc_ne_fwhm_mean( + data_header_list[data_cube_counter]) ; + pos_ar_val = kmos_pfits_get_qc_ar_pos_stdev( + data_header_list[data_cube_counter]) ; + pos_ne_val = kmos_pfits_get_qc_ne_pos_stdev( + data_header_list[data_cube_counter]) ; + if (cpl_error_get_code() != CPL_ERROR_NONE) { + cpl_msg_warning(__func__, + "Cannot retrieve QC ARC xx FWHM MEAN") ; + cpl_error_reset() ; + } else { + cpl_vector_set(fwhm_ar,fwhm_count, + light_speed/fwhm_ar_val) ; + cpl_vector_set(fwhm_ne,fwhm_count, + light_speed/fwhm_ne_val) ; + cpl_vector_set(pos_ar,fwhm_count, + pos_ar_val*lambda*1000/light_speed) ; + cpl_vector_set(pos_ne,fwhm_count, + pos_ne_val*lambda*1000/light_speed) ; + fwhm_count++ ; + } + cpl_propertylist_update_string( data_header_list[data_cube_counter], "ESO PRO FRNAME", frame_filename); @@ -743,10 +876,76 @@ } } } + cpl_propertylist_delete(main_header) ; kmo_free_fits_desc(&desc); cpl_free(tmp_str); } - + + /* Compute the Resolution */ + if (fwhm_count > 2) { + tmp_vec = cpl_vector_extract(fwhm_ar, 0, fwhm_count-1, 1) ; + fwhm_ar_med = cpl_vector_get_median(tmp_vec) ; + cpl_vector_delete(tmp_vec) ; + tmp_vec = cpl_vector_extract(fwhm_ne, 0, fwhm_count-1, 1) ; + fwhm_ne_med = cpl_vector_get_median(tmp_vec) ; + cpl_vector_delete(tmp_vec) ; + tmp_vec = cpl_vector_extract(pos_ar, 0, fwhm_count-1, 1) ; + pos_ar_med = cpl_vector_get_median(tmp_vec) ; + cpl_vector_delete(tmp_vec) ; + tmp_vec = cpl_vector_extract(pos_ne, 0, fwhm_count-1, 1) ; + pos_ne_med = cpl_vector_get_median(tmp_vec) ; + cpl_vector_delete(tmp_vec) ; + spec_res = (fwhm_ar_med + fwhm_ne_med) / 2.0 ; + crder3 = (pos_ar_med + pos_ne_med) / 2.0 ; + } else if (fwhm_count > 0) { + tmp_vec = cpl_vector_extract(fwhm_ar, 0, fwhm_count-1, 1) ; + fwhm_ar_med = cpl_vector_get_mean(tmp_vec) ; + cpl_vector_delete(tmp_vec) ; + tmp_vec = cpl_vector_extract(fwhm_ne, 0, fwhm_count-1, 1) ; + fwhm_ne_med = cpl_vector_get_mean(tmp_vec) ; + cpl_vector_delete(tmp_vec) ; + tmp_vec = cpl_vector_extract(pos_ar, 0, fwhm_count-1, 1) ; + pos_ar_med = cpl_vector_get_mean(tmp_vec) ; + cpl_vector_delete(tmp_vec) ; + tmp_vec = cpl_vector_extract(pos_ne, 0, fwhm_count-1, 1) ; + pos_ne_med = cpl_vector_get_mean(tmp_vec) ; + cpl_vector_delete(tmp_vec) ; + spec_res = (fwhm_ar_med + fwhm_ne_med) / 2.0 ; + crder3 = (pos_ar_med + pos_ne_med) / 2.0 ; + } else { + spec_res = -1.0 ; + crder3 = -1.0 ; + } + cpl_vector_delete(fwhm_ar) ; + cpl_vector_delete(fwhm_ne) ; + cpl_vector_delete(pos_ar) ; + cpl_vector_delete(pos_ne) ; + + /* Compute SKY_RES / SKY_RERR */ + sky_res_vec = cpl_vector_new(data_count) ; + for (i=0 ; i 2) { + sky_res = cpl_vector_get_median_const(sky_res_vec) ; + sky_rerr = sqrt((0.2*0.2)+pow(cpl_vector_get_stdev(sky_res_vec),2)); + } else { + sky_res = cpl_vector_get_mean(sky_res_vec) ; + sky_rerr = 0.2; + } + cpl_vector_delete(sky_res_vec) ; + /* Create String for the output header - IFUs usage */ used_ifus_str = kmos_combine_create_ifus_string(used_frame_idx, used_ifus, data_cube_counter); @@ -815,6 +1014,11 @@ cpl_propertylist_delete(noise_header_list[0]) ; cpl_frameset_delete(rawframes) ; */ + + /* Compute ABMAGLIM */ + abmaglim = kmos_idp_compute_abmaglim(cube_combined_data, + sky_res, data_header_list[0]) ; + /* Save data */ if (!suppress_extension) { /* Setup output category COMBINE + ESO PRO CATG */ @@ -832,28 +1036,70 @@ } /* Create PRO keys plist */ - pro_plist = cpl_propertylist_new() ; + plist = cpl_propertylist_new() ; if (used_ifus_str != NULL) - cpl_propertylist_update_string(pro_plist, "ESO PRO USEDIFUS", + cpl_propertylist_update_string(plist, "ESO PRO USEDIFUS", used_ifus_str) ; if (skip_ifus_str != NULL) - cpl_propertylist_update_string(pro_plist, "ESO PRO SKIPPEDIFUS", + cpl_propertylist_update_string(plist, "ESO PRO SKIPPEDIFUS", skip_ifus_str) ; + /* QC EXPMASK AVG */ + cpl_propertylist_update_double(plist, "ESO QC EXPMASK AVG", + cpl_image_get_mean(exp_mask)) ; + + /* PIXNOISE */ + cpl_propertylist_update_double(plist, KEY_PIXNOISE, + cpl_image_get_median( + cpl_imagelist_get_const(cube_combined_data, 1000))) ; + cpl_propertylist_set_comment(plist, KEY_PIXNOISE, KEY_PIXNOISE_COMMENT); + + /* Store SPEC_REC in the header */ + cpl_propertylist_update_double(plist, KEY_SPEC_RES, spec_res) ; + cpl_propertylist_set_comment(plist, KEY_SPEC_RES, KEY_SPEC_RES_COMMENT); + + /* Store data_cube_counter */ + cpl_propertylist_update_int(plist, "ESO QC COMBINED_CUBES NB", + data_cube_counter) ; + + /* EXPMASK NAME */ + tmp_str = cpl_sprintf("%s.fits", fn_mask) ; + cpl_propertylist_update_string(plist, "ESO QC EXPMASK NAME", tmp_str) ; + cpl_free(tmp_str) ; + + /* Add the Collapsed File Name */ + if (collapse_combined) { + tmp_str = cpl_sprintf("make_image_%s", fn_combine) ; + cpl_propertylist_update_string(plist, "ESO QC COLLAPSE NAME", + tmp_str) ; + cpl_free(tmp_str) ; + } + + /* ABMAGLIM */ + cpl_propertylist_update_double(plist, KEY_ABMAGLIM, abmaglim) ; + cpl_propertylist_set_comment(plist, KEY_ABMAGLIM, KEY_ABMAGLIM_COMMENT); + + /* SKY_RES / SKY_RERR */ + cpl_propertylist_update_double(plist, KEY_SKY_RES, sky_res) ; + cpl_propertylist_set_comment(plist, KEY_SKY_RES, KEY_SKY_RES_COMMENT) ; + cpl_propertylist_update_double(plist, KEY_SKY_RERR, sky_rerr) ; + cpl_propertylist_set_comment(plist, KEY_SKY_RERR,KEY_SKY_RERR_COMMENT) ; + /* Add REFLEX SUFFIX keyword */ reflex_suffix = kmos_get_reflex_suffix(mapping_id, ifus_txt, name, name_loc) ; - cpl_propertylist_update_string(pro_plist, "ESO PRO REFLEX SUFFIX", + cpl_propertylist_update_string(plist, "ESO PRO REFLEX SUFFIX", reflex_suffix) ; cpl_free(reflex_suffix) ; /* Save Headers first */ frame = cpl_frameset_find(rawframes, NULL); - kmo_dfs_save_main_header(frameset, fn_combine, "", frame, pro_plist, + kmo_dfs_save_main_header(frameset, fn_combine, "", frame, plist, parlist, cpl_func); - kmo_dfs_save_main_header(frameset, fn_mask, "", frame, pro_plist, + + kmo_dfs_save_main_header(frameset, fn_mask, "", frame, plist, parlist, cpl_func); - cpl_propertylist_delete(pro_plist) ; + cpl_propertylist_delete(plist) ; cpl_free(used_ifus_str) ; cpl_free(skip_ifus_str) ; @@ -874,24 +1120,27 @@ cpl_propertylist_erase(noise_header_list[0], "ESO PRO IFUNR"); } } - kmo_dfs_save_cube(cube_combined_data, fn_combine, "", - data_header_list[0], 0./0.); + /* Save DATA extension */ + plist = cpl_propertylist_duplicate(data_header_list[0]) ; + + /* Store CRDER3 in the header */ + cpl_propertylist_update_double(plist, KEY_CRDER3, crder3) ; + cpl_propertylist_set_comment(plist, KEY_CRDER3, KEY_CRDER3_COMMENT); + + kmo_dfs_save_cube(cube_combined_data, fn_combine, "", plist, 0./0.); + cpl_propertylist_delete(plist) ; cpl_imagelist_delete(cube_combined_data); - kmo_dfs_save_cube(cube_combined_noise, fn_combine, "", - noise_header_list[0], 0./0.); + + /* Save NOISE extension */ + plist = cpl_propertylist_duplicate(noise_header_list[0]) ; + kmo_dfs_save_cube(cube_combined_noise, fn_combine, "", plist, 0./0.); cpl_imagelist_delete(cube_combined_noise); + cpl_propertylist_delete(plist) ; cpl_free(fn_combine); - cpl_propertylist_erase(data_header_list[0], CRPIX3); - cpl_propertylist_erase(data_header_list[0], CRPIX3); - cpl_propertylist_erase(data_header_list[0], CRVAL3); - cpl_propertylist_erase(data_header_list[0], CDELT3); - cpl_propertylist_erase(data_header_list[0], CD1_3); - cpl_propertylist_erase(data_header_list[0], CD2_3); - cpl_propertylist_erase(data_header_list[0], CD3_1); - cpl_propertylist_erase(data_header_list[0], CD3_2); - cpl_propertylist_erase(data_header_list[0], CD3_3); - cpl_propertylist_erase(data_header_list[0], CTYPE3); + /* Clean 3rd dimension keys */ + kmos_3dim_clean_plist(data_header_list[0]) ; + kmo_dfs_save_image(exp_mask, fn_mask, "", data_header_list[0], 0./0.); cpl_free(fn_mask); cpl_image_delete(exp_mask); @@ -903,7 +1152,6 @@ if (noise_header_list!=NULL && noise_cube_counter==0) cpl_propertylist_delete(noise_header_list[0]) ; } - cpl_frameset_delete(rawframes) ; if (skipped_bivector!=NULL) cpl_bivector_delete(skipped_bivector) ; if (ifus != NULL) cpl_vector_delete(ifus); cpl_free(data_cube_list); @@ -916,10 +1164,138 @@ /* Collapse the combined cubes if requested */ if (collapse_combined) { - kmos_collapse_cubes(COMBINED_RECONS, frameset, parlist, 0.1, "", - DEF_REJ_METHOD, DEF_POS_REJ_THRES, DEF_NEG_REJ_THRES, - DEF_ITERATIONS, DEF_NR_MIN_REJ, DEF_NR_MAX_REJ) ; + kmos_collapse_cubes(COMBINED_CUBE, frameset, parlist, 0.1, "", + DEF_REJ_METHOD, DEF_POS_REJ_THRES, DEF_NEG_REJ_THRES, + DEF_ITERATIONS, DEF_NR_MIN_REJ, DEF_NR_MAX_REJ); + + } + + /* Create the IDP Products */ + cpl_frame * combined_frame ; + const char * combined_fname ; + char * idp_combined_fname ; + cpl_imagelist * cube_combined_error ; + const char * const_data_extname ; + char * data_extname ; + char * error_extname ; + char * object ; + cpl_frameset * combined_frames ; + + /* Loop on the Combined Frames */ + combined_frames = kmos_extract_frameset(frameset, COMBINED_CUBE) ; + combined_frame = kmo_dfs_get_frame(combined_frames, COMBINED_CUBE); + while (combined_frame != NULL ) { + combined_fname = cpl_frame_get_filename(combined_frame); + + /* Load combined data cube */ + cube_combined_data=cpl_imagelist_load(combined_fname, CPL_TYPE_FLOAT,1); + + /* Compute the IDP error */ + cube_combined_error = kmos_idp_compute_error(cube_combined_data); + + /************* IDP PRIMARY **********/ + main_header = cpl_propertylist_load(combined_fname, 0) ; + plist = cpl_propertylist_load(combined_fname, 1) ; + kmos_idp_prepare_main_keys(main_header, frameset, plist, + raw_tag, cube_combined_error) ; + cpl_propertylist_delete(plist) ; + frame = cpl_frameset_find(rawframes, NULL); + + /* Save Primary */ + idp_combined_fname = cpl_sprintf("IDP_%s", combined_fname) ; + + /***************************************************/ + /* Replace the call of cpl_dfs_save_propertylist() */ + /* because RA/DEC need to be changed */ + /***************************************************/ + const char * procat = cpl_propertylist_get_string(main_header, + CPL_DFS_PRO_CATG); + cpl_msg_info(cpl_func, "Writing FITS propertylist product(%s): %s", + procat, idp_combined_fname); + + cpl_frame * product_frame = cpl_frame_new(); + cpl_frame_set_filename(product_frame, idp_combined_fname); + cpl_frame_set_tag(product_frame, procat); + cpl_frame_set_type(product_frame, CPL_FRAME_TYPE_ANY); + cpl_frame_set_group(product_frame, CPL_FRAME_GROUP_PRODUCT); + cpl_frame_set_level(product_frame, CPL_FRAME_LEVEL_FINAL); + + plist = cpl_propertylist_duplicate(main_header); + + /* Add DataFlow keywords */ + cpl_dfs_setup_product_header(plist, product_frame, frameset, parlist, + cpl_func, VERSION, CPL_DFS_PRO_DID, frame); + + /* Fix RA / DEC <- Set to CRVAL1 / CRVAL2 */ + /* plist(RA / DEC) from plist2(CRVAL1 / CRVAL2) */ + cpl_propertylist * plist2 = cpl_propertylist_load(combined_fname, 1) ; + crval1 = cpl_propertylist_get_double(plist2, CRVAL1); + crval2 = cpl_propertylist_get_double(plist2, CRVAL2); + cpl_propertylist_delete(plist2) ; + kmclipm_update_property_double(plist, "RA", crval1, "") ; + kmclipm_update_property_double(plist, "DEC", crval2, "") ; + + /* Save and register */ + cpl_propertylist_save(plist, idp_combined_fname, CPL_IO_CREATE); + cpl_propertylist_delete(plist) ; + cpl_frameset_insert(frameset, product_frame); + /* cpl_frame_delete(product_frame); */ + + /***************************************************/ + /* Instead of : */ + /***************************************************/ + /* + cpl_dfs_save_propertylist(frameset, NULL, parlist, frameset, frame, + cpl_func, main_header, NULL, VERSION, idp_combined_fname); + */ + /***************************************************/ + + /* Remember OBJECT for the extensions */ + object = cpl_strdup(kmos_pfits_get_object(main_header)) ; + + cpl_propertylist_delete(main_header) ; + + /************* IDP DATA extension **********/ + /* Handle extname values */ + plist = cpl_propertylist_load(combined_fname, 1) ; + const_data_extname = kmos_pfits_get_extname(plist) ; + error_extname = kmos_idp_compute_error_extname(const_data_extname) ; + + /* IDP Add DATA Keywords */ + kmos_idp_prepare_data_keys(plist, error_extname, object) ; + cpl_free(error_extname) ; + + /* Ѕave Data */ + cpl_imagelist_save(cube_combined_data, idp_combined_fname, + CPL_BPP_IEEE_FLOAT, + plist, CPL_IO_EXTEND) ; + cpl_propertylist_delete(plist) ; + cpl_imagelist_delete(cube_combined_data); + + /************* IDP ERROR extension **********/ + /* IDP Add ERROR Keywords */ + plist = cpl_propertylist_load(combined_fname, 1) ; + kmclipm_update_property_string(plist, EXTNAME, "DATA", ""); + data_extname = cpl_strdup(kmos_pfits_get_extname(plist)) ; + error_extname = kmos_idp_compute_error_extname(data_extname) ; + kmos_idp_prepare_error_keys(plist, error_extname, data_extname, object); + cpl_free(object) ; + cpl_free(error_extname) ; + cpl_free(data_extname) ; + + /* Save ERROR extension */ + cpl_imagelist_save(cube_combined_error, idp_combined_fname, + CPL_BPP_IEEE_FLOAT, + plist, CPL_IO_EXTEND) ; + cpl_imagelist_delete(cube_combined_error); + cpl_propertylist_delete(plist) ; + cpl_free(idp_combined_fname) ; + + /* Next candidate */ + combined_frame = kmo_dfs_get_frame(combined_frames, NULL); } + cpl_frameset_delete(rawframes) ; + cpl_frameset_delete(combined_frames) ; return 0; } @@ -976,6 +1352,54 @@ @return */ /*----------------------------------------------------------------------------*/ +static int kmos_combine_collect_data( + const cpl_propertylist * recons_prim_header, + const cpl_propertylist * recons_ext_header, + double * lambda, + double * seeing, + double * airmass) +{ + + double crval3, cd3_3, crpix3, airm_start, airm_end, fwhmlin ; + int naxis3 ; + + /* Check Entries */ + if (recons_prim_header == NULL || recons_ext_header == NULL) return -1; + if (lambda == NULL || seeing == NULL || airmass == NULL) return -1; + + /* Get Values from header */ + crval3 = kmos_pfits_get_crval3(recons_ext_header) ; + cd3_3 = kmos_pfits_get_cd3_3(recons_ext_header) ; + crpix3 = kmos_pfits_get_crpix3(recons_ext_header) ; + naxis3 = kmos_pfits_get_naxis3(recons_ext_header) ; + airm_start = kmos_pfits_get_airmass_start(recons_prim_header) ; + airm_end = kmos_pfits_get_airmass_end(recons_prim_header) ; + fwhmlin = kmos_pfits_get_ia_fwhmlin(recons_prim_header) ; + if (cpl_error_get_code() != CPL_ERROR_NONE) { + cpl_error_reset() ; + cpl_msg_error(__func__, "Cannot collect data from header") ; + return -1 ; + } + + /* Lambda */ + *lambda = (crval3 + (crval3 + cd3_3 * naxis3 - (crpix3-1) * cd3_3)) / 2.0; + + /* Airmass */ + *airmass = (airm_start + airm_end) / 2.0 ; + + /* Seeing */ + *seeing = fwhmlin ; + + return 0 ; +} + +/*----------------------------------------------------------------------------*/ +/** + @brief + @param + @return + */ +/*----------------------------------------------------------------------------*/ static cpl_bivector * kmos_combine_parse_skipped(const char * str) { cpl_bivector * out ; @@ -985,8 +1409,8 @@ int nb_values ; char * s1 ; char * s2 ; - int val1, val2, ret ; - + int val1, val2; + /* Check Entries */ if (str == NULL) return NULL ; diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_dark.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_dark.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_dark.c 2016-04-04 13:19:20.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_dark.c 2018-04-03 13:27:16.000000000 +0000 @@ -263,11 +263,9 @@ cpl_propertylist * sub_header ; int i ; - /* Check entries */ - if (parlist == NULL || frameset == NULL) { - cpl_msg_error(__func__, "Null Inputs") ; - cpl_error_set(__func__, CPL_ERROR_NULL_INPUT) ; - return -1 ; + /* Check initial Entries */ + if (kmos_check_and_set_groups(frameset) != CPL_ERROR_NONE) { + return cpl_error_get_code(); } /* Inistialise */ @@ -286,13 +284,6 @@ kmos_combine_pars_load(parlist, "kmos.kmos_dark", &cmethod, &cpos_rej, &cneg_rej, &citer, &cmin, &cmax, FALSE); - /* Identify the RAW and CALIB frames in the input frameset */ - if (kmo_dfs_set_groups(frameset) != 1) { - cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ; - cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; - return -1 ; - } - /* Check the inputs consistency */ if (kmos_dark_check_inputs(frameset, &nx, &ny, &ndit, &next,&exptime) != 1){ cpl_msg_error(__func__, "Input frameset is not consistent") ; diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_extract_spec.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_extract_spec.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_extract_spec.c 2016-04-04 13:19:20.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_extract_spec.c 2018-04-09 13:42:16.000000000 +0000 @@ -245,11 +245,13 @@ const char * cmethod ; const char * centre_txt ; cpl_vector * centre ; - int cmin, cmax, valid_ifu, citer, save_mask, - devnr1, index_data, index_noise, - nr_devices ; - double cpos_rej, cneg_rej, radius, r, x_lo, y_lo, - x_hi, y_hi, cen_x, cen_y, loc_cen_x, loc_cen_y ; + int cmin, cmax, valid_ifu, citer, save_mask, devnr1; + int index_data ; + int index_noise; + int nr_devices ; + double cpos_rej, cneg_rej, r, x_lo, y_lo, + x_hi, y_hi, loc_cen_x, loc_cen_y ; + double cen_x = 0., cen_y = 0., radius = -1; cpl_size auto_cen_x, auto_cen_y ; cpl_imagelist * data_in ; cpl_imagelist * noise_in ; @@ -259,7 +261,7 @@ cpl_vector * spec_noise_out ; cpl_vector * fit_par ; cpl_propertylist * sub_header_data ; - cpl_propertylist * sub_header_noise ; + cpl_propertylist * sub_header_noise = NULL ; cpl_propertylist * sub_header_mask ; cpl_propertylist * fit_pl ; cpl_frame * op1_frame ; @@ -373,6 +375,8 @@ } if (desc1.ex_noise) { index_noise = kmo_identify_index_desc(desc1, devnr1, TRUE); + } else { + index_noise = -1; } sub_header_data = kmo_dfs_load_sub_header(frameset, "0", devnr1, FALSE); @@ -480,7 +484,7 @@ cpl_propertylist_delete(sub_header_mask); /* Process & save noise, if existing */ - if (desc1.ex_noise) { + if (desc1.ex_noise && sub_header_noise) { kmclipm_vector *nnn = NULL; if (spec_noise_out != NULL) { nnn = kmclipm_vector_create(spec_noise_out); @@ -502,7 +506,9 @@ } } cpl_propertylist_delete(sub_header_data); - if (desc1.ex_noise) cpl_propertylist_delete(sub_header_noise); + if (desc1.ex_noise && sub_header_noise) { + cpl_propertylist_delete(sub_header_noise); + } } kmo_free_fits_desc(&desc1); kmo_free_fits_desc(&desc2); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_flat.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_flat.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_flat.c 2016-11-23 16:04:07.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_flat.c 2018-04-09 13:42:16.000000000 +0000 @@ -383,9 +383,9 @@ char * suffix ; char * fn_suffix ; unsigned int save_mode ; - char * fn_flat = "flat_tmp.fits" ; - char * fn_noise = "flat_noise.fits" ; - char * fn_badpix = "badpix_tmp.fits" ; + const char * fn_flat = "flat_tmp.fits" ; + const char * fn_noise = "flat_noise.fits" ; + const char * fn_badpix = "badpix_tmp.fits" ; cpl_imagelist * det_lamp_on ; cpl_imagelist * det_lamp_off ; cpl_image * img_in ; @@ -407,11 +407,9 @@ double gain, exptime, mean_data, mean_noise ; int sx, nr_bad_pix, nr_sat, i, j, a ; - /* Check entries */ - if (parlist == NULL || frameset == NULL) { - cpl_msg_error(__func__, "Null Inputs") ; - cpl_error_set(__func__, CPL_ERROR_NULL_INPUT) ; - return -1 ; + /* Check initial Entries */ + if (kmos_check_and_set_groups(frameset) != CPL_ERROR_NONE) { + return cpl_error_get_code(); } /* Get Parameters */ @@ -447,13 +445,6 @@ cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; return -1 ; } - - /* Identify the RAW and CALIB frames in the input frameset */ - if (kmo_dfs_set_groups(frameset) != 1) { - cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ; - cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; - return -1 ; - } /* Check the inputs consistency */ if (kmos_flat_check_inputs(frameset, &nx, &ny, &next, &exptime) != 1) { diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_gen_reflines.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_gen_reflines.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_gen_reflines.c 2016-04-04 13:19:20.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_gen_reflines.c 2018-04-10 10:54:53.000000000 +0000 @@ -226,7 +226,7 @@ /* Count number of entries */ nentries = 0 ; while (fgets(line, 1024, in) != NULL) { - if (line[0] != '#' && sscanf(line, "%s %d %lg %d %d %d %d", + if (line[0] != '#' && sscanf(line, "%1023s %d %lg %d %d %d %d", band, &det, &wave, &ref, &offset, &range, &cut) == 7) nentries++ ; } @@ -250,7 +250,7 @@ i = 0 ; rewind(in) ; while (fgets(line, 1024, in) != NULL) { - if (line[0] != '#' && sscanf(line, "%s %d %lg %d %d %d %d", + if (line[0] != '#' && sscanf(line, "%1023s %d %lg %d %d %d %d", band, &det, &wave, &ref, &offset, &range, &cut) == 7) { cpl_table_set_string(tab, "FILTER", i, band) ; cpl_table_set_int(tab, "DETECTOR", i, det) ; diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_gen_telluric.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_gen_telluric.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_gen_telluric.c 2016-12-21 15:23:37.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_gen_telluric.c 2018-04-09 13:42:16.000000000 +0000 @@ -30,6 +30,7 @@ #include +#include "kmclipm_priv_splines.h" #include "kmclipm_functions.h" #include "kmclipm_constants.h" @@ -41,6 +42,13 @@ * Functions prototypes *----------------------------------------------------------------------------*/ +static cpl_vector * kmos_gen_telluric_resample( + cpl_vector * vec, + int b_samples, + double crval1, + double cdelt1, + double * new_crval1, + double * new_cdelt1) ; static int kmos_gen_telluric_get_avg_zpoint( const cpl_frame * zp_frame, double * zp1_avg, @@ -52,12 +60,16 @@ const cpl_frame * zp_frame, const char * filename, cpl_frameset * allframes, + int b_samples, const cpl_parameterlist * parlist) ; static int kmos_gen_telluric_create_file_simple( const cpl_frame * data_frame, const cpl_frame * zp_frame, + const cpl_frame * resp_frame, const char * filename, cpl_frameset * allframes, + int b_samples, + int fill_empty_ifus, const cpl_parameterlist * parlist) ; static int kmos_gen_telluric_check_inputs(cpl_frameset *, int); @@ -91,14 +103,14 @@ " DO category Explanation Required \n" " ----------- ----------- -------- \n" " TELLURIC Produced by kmos_std_star N\n" -" TELLURIC_CORR Produced bym molecfit N\n" +" TELLURIC_CORR Produced by molecfit N\n" " RESPONSE static calibration N\n" "\n" "Output files:\n" "\n" " DO category Explanation\n" " ----------- -----------\n" -" TELLURIC Used by kmos_sci_red\n" +" TELLURIC_GEN Used by kmos_sci_red\n" "----------------------------------------------------------------------------\n" "\n"; @@ -177,6 +189,22 @@ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV); cpl_parameterlist_append(recipe->parameters, p); + /* --b_samples */ + p = cpl_parameter_new_value("kmos.kmos_gen_telluric.b_samples", + CPL_TYPE_INT, "The number of samples in wavelength", + "kmos.kmos_gen_telluric", -1); + cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "b_samples"); + cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV); + cpl_parameterlist_append(recipe->parameters, p); + + /* --fill_empty_ifus */ + p = cpl_parameter_new_value("kmos.kmos_gen_telluric.fill_empty_ifus", + CPL_TYPE_BOOL, "Flag to fill empty TELLURIC IFUs (only method 0)", + "kmos.kmos_gen_telluric", FALSE); + cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "fill_empty_ifus"); + cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV); + cpl_parameterlist_append(recipe->parameters, p); + return 0; } @@ -230,19 +258,15 @@ static int kmos_gen_telluric(cpl_parameterlist *parlist, cpl_frameset *frameset) { const cpl_parameter * par ; - int method ; + int method, fill_empty_ifus, b_samples ; cpl_frame * tell_frame ; cpl_frame * tell_corr_frame ; cpl_frame * resp_frame ; const char * fn ; - - int i, j, ifu_nr, ext_nb ; - /* Check entries */ - if (parlist == NULL || frameset == NULL) { - cpl_msg_error(__func__, "Null Inputs") ; - cpl_error_set(__func__, CPL_ERROR_NULL_INPUT) ; - return -1 ; + /* Check initial Entries */ + if (kmos_check_and_set_groups(frameset) != CPL_ERROR_NONE) { + return cpl_error_get_code(); } /* Initialise */ @@ -251,12 +275,18 @@ /* Get Parameters */ par = cpl_parameterlist_find_const(parlist,"kmos.kmos_gen_telluric.method"); method = cpl_parameter_get_int(par); - - /* Identify the RAW and CALIB frames in the input frameset */ - if (kmo_dfs_set_groups(frameset) != 1) { - cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ; - cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; - return -1 ; + par = cpl_parameterlist_find_const(parlist, + "kmos.kmos_gen_telluric.b_samples"); + b_samples = cpl_parameter_get_int(par); + par = cpl_parameterlist_find_const(parlist, + "kmos.kmos_gen_telluric.fill_empty_ifus"); + fill_empty_ifus = cpl_parameter_get_bool(par); + + /* Check Parameters */ + if (method != 0 && fill_empty_ifus != 0) { + fill_empty_ifus = 0 ; + cpl_msg_warning(__func__, + "Filling empty IFUs is only possible in method 0 - disable it"); } /* Check the inputs consistency */ @@ -276,31 +306,31 @@ if (tell_frame != NULL) { cpl_msg_info(__func__, "Use %s for Data and Zpoint", cpl_frame_get_filename(tell_frame)) ; - kmos_gen_telluric_create_file_simple(tell_frame, NULL, fn, - frameset, parlist) ; + kmos_gen_telluric_create_file_simple(tell_frame, NULL, resp_frame, + fn, frameset, b_samples, fill_empty_ifus, parlist) ; } else { cpl_msg_info(__func__, "Use %s for Data and Zpoint", cpl_frame_get_filename(resp_frame)) ; - kmos_gen_telluric_create_file_simple(resp_frame, NULL, fn, - frameset, parlist) ; + kmos_gen_telluric_create_file_simple(resp_frame, NULL, NULL, + fn, frameset, b_samples, 0, parlist) ; } } else if (method == 1) { cpl_msg_info(__func__, "Use %s for Data and Zpoint", cpl_frame_get_filename(tell_corr_frame)) ; - kmos_gen_telluric_create_file_simple(tell_corr_frame, NULL, fn, - frameset, parlist) ; + kmos_gen_telluric_create_file_simple(tell_corr_frame, NULL, NULL, + fn, frameset, b_samples, 0, parlist) ; } else if (method == 2) { if (tell_frame != NULL) { cpl_msg_info(__func__, "Use %s for Data and %s for Zpoint", cpl_frame_get_filename(resp_frame), cpl_frame_get_filename(tell_frame)) ; - kmos_gen_telluric_create_file_simple(resp_frame, tell_frame, fn, - frameset, parlist) ; + kmos_gen_telluric_create_file_simple(resp_frame, tell_frame, NULL, + fn, frameset, b_samples, 0, parlist) ; } else { cpl_msg_info(__func__, "Use %s for Data and Zpoint", cpl_frame_get_filename(resp_frame)) ; - kmos_gen_telluric_create_file_simple(resp_frame, NULL, fn, - frameset, parlist) ; + kmos_gen_telluric_create_file_simple(resp_frame, NULL, NULL, + fn, frameset, b_samples, 0, parlist) ; } } else if (method == 3) { cpl_msg_info(__func__, "Use %s X %s for Data and %s for Zpoint", @@ -308,7 +338,7 @@ cpl_frame_get_filename(tell_corr_frame), cpl_frame_get_filename(tell_corr_frame)) ; kmos_gen_telluric_create_file_multiply(resp_frame, tell_corr_frame, - tell_corr_frame, fn, frameset, parlist) ; + tell_corr_frame, fn, frameset, b_samples, parlist) ; } else { cpl_msg_error(__func__, "Unsupported - Should never come here") ; cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; @@ -325,6 +355,7 @@ const cpl_frame * zp_frame, const char * filename, cpl_frameset * allframes, + int b_samples, const cpl_parameterlist * parlist) { cpl_propertylist * mh ; @@ -333,7 +364,8 @@ cpl_propertylist * zph ; cpl_vector * vec1 ; cpl_vector * vec2 ; - double zpoint ; + cpl_vector * vec_resampled ; + double zpoint, crval1, cdelt1, new_crval1, new_cdelt1 ; enum kmo_frame_type ft ; char content[256] ; const char * extname ; @@ -344,20 +376,25 @@ id = -1 ; ft = illegal_frame ; - /* Load main header */ - mh=kmclipm_propertylist_load(cpl_frame_get_filename(data1_frame), 0); - /* Get Extensions number */ ext_nb = cpl_fits_count_extensions(cpl_frame_get_filename(data1_frame)) ; + if (cpl_fits_count_extensions(cpl_frame_get_filename(data2_frame))!=ext_nb){ + cpl_msg_error(__func__, "Extensions numbers do not match - abort") ; + return -1 ; + } + + /* Load main header */ + mh = cpl_propertylist_load(cpl_frame_get_filename(data1_frame), 0); + /* Create applist with PRO CATG */ applist = cpl_propertylist_new() ; - cpl_propertylist_update_string(applist, CPL_DFS_PRO_CATG, "TELLURIC") ; + cpl_propertylist_update_string(applist, CPL_DFS_PRO_CATG, TELLURIC_GEN) ; /* Create PRO_STD keywords */ for (i = 0; i < ext_nb ; i++) { /* Load extension header */ - eh = kmclipm_propertylist_load(cpl_frame_get_filename(data2_frame),i+1); + eh = cpl_propertylist_load(cpl_frame_get_filename(data2_frame),i+1); /* Read EXTNAME */ extname = cpl_propertylist_get_string(eh, "EXTNAME") ; kmo_extname_extractor(extname, &ft, &ifu_nr, content) ; @@ -367,7 +404,7 @@ if (vec1 != NULL) { cpl_vector_delete(vec1) ; - /* The Telluric is presenet in this IFU - write the keyword */ + /* The Telluric is present in this IFU - write the keyword */ keyword = cpl_sprintf("%s%d", PRO_STD, ifu_nr); cpl_propertylist_update_int(applist, keyword, 1); cpl_free(keyword); @@ -388,7 +425,7 @@ for (i = 0; i < ext_nb ; i++) { /* Load extension header */ - eh = kmclipm_propertylist_load(cpl_frame_get_filename(data1_frame),i+1); + eh = cpl_propertylist_load(cpl_frame_get_filename(data1_frame),i+1); /* Read EXTNAME */ extname = cpl_propertylist_get_string(eh, "EXTNAME") ; @@ -399,9 +436,47 @@ vec2 = cpl_vector_load(cpl_frame_get_filename(data2_frame), i+1) ; if (vec1 == NULL || vec2 == NULL) cpl_error_reset() ; + /* Resample vec1 if needed */ + if (vec1 != NULL && + cpl_vector_get_size(vec1) != b_samples && b_samples > 0) { + + /* Get crval1, cdelt1 */ + cdelt1 = kmos_pfits_get_cdelt1(eh) ; + crval1 = kmos_pfits_get_crval1(eh) ; + + /* Recreate vec */ + vec_resampled = kmos_gen_telluric_resample(vec1, b_samples, crval1, + cdelt1, &new_crval1, &new_cdelt1) ; + if (vec_resampled != NULL) { + cpl_vector_delete(vec1) ; + vec1 = vec_resampled ; + + /* Update CRVAL1 / CDELT1 in eh */ + cpl_propertylist_update_double(eh, "CRVAL1", new_crval1) ; + cpl_propertylist_update_double(eh, "CDELT1", new_cdelt1) ; + } + } + + /* Resample vec2 if needed */ + if (vec1 != NULL && vec2 != NULL && + cpl_vector_get_size(vec1) != cpl_vector_get_size(vec2)) { + + /* Get crval1, cdelt1 */ + cdelt1 = kmos_pfits_get_cdelt1(eh) ; + crval1 = kmos_pfits_get_crval1(eh) ; + + /* Recreate vec */ + vec_resampled = kmos_gen_telluric_resample(vec2, b_samples, crval1, + cdelt1, &new_crval1, &new_cdelt1) ; + if (vec_resampled != NULL) { + cpl_vector_delete(vec2) ; + vec2 = vec_resampled ; + } + } + /* Need to update ZPOINT ? */ if (vec1 != NULL && vec2 != NULL && zp_frame != NULL) { - zph=kmclipm_propertylist_load(cpl_frame_get_filename(zp_frame),i+1); + zph=cpl_propertylist_load(cpl_frame_get_filename(zp_frame),i+1); zpoint = cpl_propertylist_get_double(zph, "ESO QC ZPOINT"); cpl_propertylist_delete(zph); if (cpl_error_get_code() != CPL_ERROR_NONE) { @@ -435,17 +510,30 @@ static int kmos_gen_telluric_create_file_simple( const cpl_frame * data_frame, const cpl_frame * zp_frame, + const cpl_frame * resp_frame, const char * filename, cpl_frameset * allframes, + int b_samples, + int fill_empty_ifus, const cpl_parameterlist * parlist) { cpl_propertylist * mh ; cpl_propertylist * applist ; cpl_propertylist * eh ; + cpl_propertylist * tmp_eh ; cpl_propertylist * zph ; cpl_vector * vec ; - double zpoint, zp1_avg, zp2_avg, zp3_avg ; - int i, ext_nb, id, det_nr, ifu_nr ; + cpl_vector * vec_ref ; + cpl_vector * resp_ref ; + cpl_vector * resp_cur ; + cpl_vector * vec_resampled ; + double zpoint, zpoint_vec_ref, zpoint_resp_ref, + zpoint_resp_cur, zp1_avg, zp2_avg, zp3_avg, + cdelt1, crval1, new_crval1, new_cdelt1; + int i, ext_nb, id, det_nr, ifu_nr, first_data_det1, + first_data_det2, first_data_det3, + first_noise_det1, first_noise_det2, + first_noise_det3, ref_ifu ; enum kmo_frame_type ft ; char content[256] ; char * keyword ; @@ -455,31 +543,61 @@ zp1_avg = zp2_avg = zp3_avg = -1.0 ; id = -1 ; ft = illegal_frame ; + first_data_det1 = first_data_det2 = first_data_det3 = -1 ; + first_noise_det1 = first_noise_det2 = first_noise_det3 = -1 ; /* Get Extensions number */ ext_nb = cpl_fits_count_extensions(cpl_frame_get_filename(data_frame)) ; /* Load main header */ - mh=kmclipm_propertylist_load(cpl_frame_get_filename(data_frame), 0); + mh = cpl_propertylist_load(cpl_frame_get_filename(data_frame), 0); /* Create applist with PRO CATG */ applist = cpl_propertylist_new() ; - cpl_propertylist_update_string(applist, CPL_DFS_PRO_CATG, "TELLURIC") ; + cpl_propertylist_update_string(applist, CPL_DFS_PRO_CATG, TELLURIC_GEN) ; /* Create PRO_STD keywords */ for (i = 0; i < ext_nb ; i++) { /* Load extension header */ - eh = kmclipm_propertylist_load(cpl_frame_get_filename(data_frame), i+1); + eh = cpl_propertylist_load(cpl_frame_get_filename(data_frame), i+1); /* Read EXTNAME */ extname = cpl_propertylist_get_string(eh, "EXTNAME") ; + kmo_extname_extractor(extname, &ft, &ifu_nr, content) ; cpl_propertylist_delete(eh); - /* Load the data */ + + /* Get Detector */ + if (ifu_nr >= 1 && ifu_nr <= 8) det_nr = 1 ; + else if (ifu_nr >= 9 && ifu_nr <= 16) det_nr = 2 ; + else if (ifu_nr >= 17 && ifu_nr <= 24) det_nr = 3 ; + else { + cpl_msg_error(__func__, "Cannot Identify the detector") ; + cpl_propertylist_delete(mh); + cpl_propertylist_delete(applist); + return -1 ; + } + + /* Try to load the data */ vec = cpl_vector_load(cpl_frame_get_filename(data_frame), i+1) ; + if (vec == NULL) cpl_error_reset() ; + + /* Store the first non-null extensions per detector */ if (vec != NULL) { - cpl_vector_delete(vec) ; + if (!strcmp(content, "DATA")) { + if (det_nr == 1 && first_data_det1 < 0) first_data_det1 = i+1 ; + if (det_nr == 2 && first_data_det2 < 0) first_data_det2 = i+1 ; + if (det_nr == 3 && first_data_det3 < 0) first_data_det3 = i+1 ; + } else if (!strcmp(content, "NOISE")) { + if (det_nr == 1 && first_noise_det1 < 0) first_noise_det1 = i+1; + if (det_nr == 2 && first_noise_det2 < 0) first_noise_det2 = i+1; + if (det_nr == 3 && first_noise_det3 < 0) first_noise_det3 = i+1; + } + } - /* The Telluric is presenet in this IFU - write the keyword */ + if (vec != NULL || fill_empty_ifus == 1) { + if (vec != NULL) cpl_vector_delete(vec) ; + + /* The Telluric is present in this IFU - write the keyword */ keyword = cpl_sprintf("%s%d", PRO_STD, ifu_nr); cpl_propertylist_update_int(applist, keyword, 1); cpl_free(keyword); @@ -505,7 +623,7 @@ for (i = 0; i < ext_nb ; i++) { /* Load extension header */ - eh = kmclipm_propertylist_load(cpl_frame_get_filename(data_frame), i+1); + eh = cpl_propertylist_load(cpl_frame_get_filename(data_frame), i+1); /* Read EXTNAME */ extname = cpl_propertylist_get_string(eh, "EXTNAME") ; @@ -524,9 +642,127 @@ vec = cpl_vector_load(cpl_frame_get_filename(data_frame), i+1) ; if (vec == NULL) cpl_error_reset() ; + /* Recover vec if requested */ + if (vec == NULL && fill_empty_ifus == 1) { + + /* Initialise */ + vec_ref = NULL ; + ref_ifu = -1 ; + if (!strcmp(content, "NOISE")) { + /* Get ref_ifu */ + if (det_nr==1) ref_ifu = first_noise_det1 ; + if (det_nr==2) ref_ifu = first_noise_det2 ; + if (det_nr==3) ref_ifu = first_noise_det3 ; + + /* Load noise reference */ + vec_ref=cpl_vector_load(cpl_frame_get_filename(data_frame), + ref_ifu); + + } else if (!strcmp(content, "DATA")) { + + /* Get ref_ifu */ + if (det_nr==1) ref_ifu = first_data_det1 ; + if (det_nr==2) ref_ifu = first_data_det2 ; + if (det_nr==3) ref_ifu = first_data_det3 ; + + /* Load data reference */ + vec_ref=cpl_vector_load(cpl_frame_get_filename(data_frame), + ref_ifu); + + resp_ref = cpl_vector_load(cpl_frame_get_filename(resp_frame), + ref_ifu) ; + resp_cur = cpl_vector_load(cpl_frame_get_filename(resp_frame), + i+1) ; + if (resp_ref != NULL && resp_cur != NULL) { + /* Resample resp_ref if needed */ + if (cpl_vector_get_size(vec_ref) != + cpl_vector_get_size(resp_ref)) { + + /* Get crval1, cdelt1 from the resp_ref_ifu */ + tmp_eh = cpl_propertylist_load( + cpl_frame_get_filename(resp_frame), ref_ifu); + cdelt1 = kmos_pfits_get_cdelt1(tmp_eh) ; + crval1 = kmos_pfits_get_crval1(tmp_eh) ; + cpl_propertylist_delete(tmp_eh) ; + + /* Resample */ + vec_resampled = kmos_gen_telluric_resample(resp_ref, + cpl_vector_get_size(vec_ref), crval1, cdelt1, + &new_crval1, &new_cdelt1) ; + if (vec_resampled != NULL) { + cpl_vector_delete(resp_ref) ; + resp_ref = vec_resampled ; + } + } + + /* Resample resp_cur if needed */ + if (cpl_vector_get_size(vec_ref) != + cpl_vector_get_size(resp_cur)) { + + /* Get crval1, cdelt1 from the resp_cur_ifu */ + tmp_eh = cpl_propertylist_load( + cpl_frame_get_filename(resp_frame), i+1); + cdelt1 = kmos_pfits_get_cdelt1(tmp_eh) ; + crval1 = kmos_pfits_get_crval1(tmp_eh) ; + cpl_propertylist_delete(tmp_eh) ; + + /* Resample */ + vec_resampled = kmos_gen_telluric_resample(resp_cur, + cpl_vector_get_size(vec_ref), crval1, cdelt1, + &new_crval1, &new_cdelt1) ; + if (vec_resampled != NULL) { + cpl_vector_delete(resp_ref) ; + resp_ref = vec_resampled ; + } + } + cpl_vector_divide(vec_ref, resp_ref); + cpl_vector_multiply(vec_ref, resp_cur); + } + if (resp_ref != NULL) cpl_vector_delete(resp_ref) ; + if (resp_cur != NULL) cpl_vector_delete(resp_cur) ; + } + vec = vec_ref ; + + /* Get crval1, cdelt1 from the ref_ifu */ + tmp_eh = cpl_propertylist_load( + cpl_frame_get_filename(data_frame), ref_ifu); + + cpl_propertylist_copy_property(eh, tmp_eh, "CTYPE1") ; + cpl_propertylist_copy_property(eh, tmp_eh, "CRPIX1") ; + cpl_propertylist_copy_property(eh, tmp_eh, "CRVAL1") ; + cpl_propertylist_copy_property(eh, tmp_eh, "CDELT1") ; + cpl_propertylist_delete(tmp_eh) ; + cpl_propertylist_erase(eh, "CRPIX2") ; + cpl_propertylist_erase(eh, "CTYPE2") ; + cpl_propertylist_erase(eh, "CD1_1") ; + cpl_propertylist_erase(eh, "CD1_2") ; + cpl_propertylist_erase(eh, "CD2_1") ; + cpl_propertylist_erase(eh, "CD2_2") ; + + /* Compute ZPOINT */ + tmp_eh = cpl_propertylist_load( + cpl_frame_get_filename(data_frame), ref_ifu); + zpoint_vec_ref = cpl_propertylist_get_double(tmp_eh, + "ESO QC ZPOINT"); + cpl_propertylist_delete(tmp_eh) ; + tmp_eh = cpl_propertylist_load( + cpl_frame_get_filename(resp_frame), ref_ifu); + zpoint_resp_ref = cpl_propertylist_get_double(tmp_eh, + "ESO QC ZPOINT"); + cpl_propertylist_delete(tmp_eh) ; + tmp_eh = cpl_propertylist_load( + cpl_frame_get_filename(resp_frame), i+1); + zpoint_resp_cur = cpl_propertylist_get_double(tmp_eh, + "ESO QC ZPOINT"); + cpl_propertylist_delete(tmp_eh) ; + /* Compute new ZPOINT */ + zpoint = zpoint_vec_ref - zpoint_resp_ref + zpoint_resp_cur ; + cpl_propertylist_update_double(eh, "ESO QC ZPOINT", zpoint) ; + } + /* Need to update ZPOINT ? */ if (vec != NULL && zp_frame != NULL) { - zph=kmclipm_propertylist_load(cpl_frame_get_filename(zp_frame),i+1); + zph = cpl_propertylist_load(cpl_frame_get_filename(zp_frame),i+1); zpoint = cpl_propertylist_get_double(zph, "ESO QC ZPOINT"); cpl_propertylist_delete(zph); if (cpl_error_get_code() != CPL_ERROR_NONE) { @@ -541,6 +777,27 @@ cpl_propertylist_update_double(eh, "ESO QC ZPOINT", zpoint) ; } + /* Resample vec if needed */ + if (vec != NULL && + cpl_vector_get_size(vec) != b_samples && b_samples > 0) { + + /* Get crval1, cdelt1 */ + cdelt1 = kmos_pfits_get_cdelt1(eh) ; + crval1 = kmos_pfits_get_crval1(eh) ; + + /* Recreate vec */ + vec_resampled = kmos_gen_telluric_resample(vec, b_samples, crval1, + cdelt1, &new_crval1, &new_cdelt1) ; + if (vec_resampled != NULL) { + cpl_vector_delete(vec) ; + vec = vec_resampled ; + + /* Update CRVAL1 / CDELT1 in eh */ + cpl_propertylist_update_double(eh, "CRVAL1", new_crval1) ; + cpl_propertylist_update_double(eh, "CDELT1", new_cdelt1) ; + } + } + /* Save the Extension */ if (vec != NULL) { /* Save the data */ @@ -554,6 +811,101 @@ } return 0 ; } +/*----------------------------------------------------------------------------*/ +/** + @brief Resample 1d vector + @param vec Vector to resample + @param b_samples Number of samples wished + @param crval1 + @param cdelt1 + @param new_crval1 [out] + @param new_cdelt1 [out] + @return resampled vector or NULL in error case + */ +/*----------------------------------------------------------------------------*/ +static cpl_vector * kmos_gen_telluric_resample( + cpl_vector * vec, + int b_samples, + double crval1, + double cdelt1, + double * new_crval1, + double * new_cdelt1) +{ + cpl_bivector * fold ; + cpl_bivector * fnew ; + cpl_vector * old_x ; + cpl_vector * new_x ; + cpl_vector * new_y ; + int vec_size ; + cpl_error_code err; + double current_lambda ; + int i, j ; + + /* Check entries */ + if (vec == NULL || new_crval1 == NULL || new_cdelt1 == NULL) return NULL; + + /* Initialise */ + vec_size = cpl_vector_get_size(vec) ; + + /* No resample needed */ + if (b_samples == vec_size) { + *new_crval1 = crval1 ; + *new_cdelt1 = cdelt1 ; + return cpl_vector_duplicate(vec) ; + } + + /* Prepare data */ + *new_crval1 = crval1 ; + *new_cdelt1 = cdelt1 * vec_size / b_samples ; + + /* Fill the old lambda */ + old_x = cpl_vector_new(vec_size) ; + for (i=0 ; i current_lambda) break ; + } + cpl_vector_set(new_y, i, cpl_vector_get(vec, j)) ; + } + } + cpl_vector_delete(old_x) ; + cpl_vector_delete(new_x) ; + return new_y ; +} /*----------------------------------------------------------------------------*/ /** @@ -595,7 +947,7 @@ /* Loop on the extensions */ for (i = 0; i < ext_nb ; i++) { /* Load extension header */ - eh = kmclipm_propertylist_load(cpl_frame_get_filename(zp_frame), i+1); + eh = cpl_propertylist_load(cpl_frame_get_filename(zp_frame), i+1); /* Read EXTNAME */ extname = cpl_propertylist_get_string(eh, "EXTNAME") ; diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmo_shift.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmo_shift.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmo_shift.c 2016-04-04 13:19:20.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmo_shift.c 2017-04-27 12:52:38.000000000 +0000 @@ -44,11 +44,6 @@ "left, a positive y-shift shifts upwards, where a shift of one pixel equals\n" "0.2arcsec. The output will still have the same dimensions, but the borders \n" "will be filled with NaNs accordingly.\n" -"To adjust only the WCS without moving the data the --wcs-only parameter has to\n" -"be set to TRUE. The WCS is updated in the same way as if the data would have\n" -"moved as well. This means that the point at (x,y) has the same coordinates as\n" -"the point (x+1,y+1) after updating the WCS (the WCS moved in the opposite\n" -"direction).\n" "\n" "BASIC PARAMETERS:\n" "-----------------\n" @@ -79,11 +74,6 @@ "turning extrapolation on, the size of the output frame stays the same as for\n" "the input frame.\n" "\n" -"--wcs-only\n" -"By default data and WCS are shifted in sync. If this parameter is set to TRUE\n" -"only the WCS is updated (i.e. if someone thinks that the IFU isn't pointing\n" -"exactly to the correct coordinates.)\n" -"\n" "-------------------------------------------------------------------------------\n" " Input files:\n" "\n" @@ -225,17 +215,6 @@ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV); cpl_parameterlist_append(recipe->parameters, p); - /* --wcs-only */ - p = cpl_parameter_new_value("kmos.kmo_shift.wcs-only", - CPL_TYPE_BOOL, - "FALSE: if data and wcs should be updated." - "TRUE: if only wcs should be corrected", - "kmos.kmo_shift", - 0); - cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "wcs-only"); - cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV); - cpl_parameterlist_append(recipe->parameters, p); - return 0; } @@ -307,7 +286,6 @@ size = 0, ifu = 0, extrapolate = 0, - wcs_only = FALSE, devnr = 0, index_data = 0, index_noise = 0; @@ -443,14 +421,7 @@ CPL_ERROR_ILLEGAL_INPUT, "flux must be TRUE or FALSE!"); - wcs_only = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_shift.wcs-only"); KMO_TRY_CHECK_ERROR_STATE(); - KMO_TRY_EXIT_IF_ERROR( - kmo_dfs_print_parameter_help(parlist, "kmos.kmo_shift.wcs-only")); - - KMO_TRY_ASSURE((wcs_only == TRUE) || (wcs_only == FALSE), - CPL_ERROR_NULL_INPUT, - "wcs_only must be TRUE or FALSE!"); cpl_msg_info("", "-------------------------------------------"); @@ -539,8 +510,7 @@ &sub_header_data, &sub_header_noise, pshifts2[2*i-2] / KMOS_PIX_RESOLUTION, pshifts2[2*i-1] / KMOS_PIX_RESOLUTION, - flux, devnr, method, extrapol_enum, - wcs_only)); + flux, method, extrapol_enum)); } else { // leave data and noise as they are and // save them again unshifted diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_illumination.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_illumination.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_illumination.c 2017-01-18 14:35:11.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_illumination.c 2018-04-10 07:52:21.000000000 +0000 @@ -292,7 +292,6 @@ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV); cpl_parameterlist_append(recipe->parameters, p); - return 0 ; } @@ -363,7 +362,7 @@ suppress_extension, reduce_det, has_flat_edge ; double neighborhoodRange, pix_scale, cpos_rej, cneg_rej, - rotangle, reduce_angle ; + reduce_angle ; int nb_raw_sky, nb_raw_lamp ; const char * do_catg_used ; int * angles_array ; @@ -374,11 +373,9 @@ cpl_frame * frame ; cpl_propertylist * main_header ; - /* Check entries */ - if (parlist == NULL || frameset == NULL) { - cpl_msg_error(__func__, "Null Inputs") ; - cpl_error_set(__func__, CPL_ERROR_NULL_INPUT) ; - return -1 ; + /* Check initial Entries */ + if (kmos_check_and_set_groups(frameset) != CPL_ERROR_NONE) { + return cpl_error_get_code(); } /* Get parameters */ @@ -446,13 +443,6 @@ has_flat_edge = cpl_frameset_count_tags(frameset, FLAT_EDGE); - /* Identify the RAW and CALIB frames in the input frameset */ - if (kmo_dfs_set_groups(frameset) != 1) { - cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ; - cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; - return -1 ; - } - /* Determine the used rawfiles */ nb_raw_sky = cpl_frameset_count_tags(frameset, FLAT_SKY); nb_raw_lamp = cpl_frameset_count_tags(frameset, FLAT_ON); @@ -514,8 +504,6 @@ a, angles_array[a]); cpl_msg_indent_more() ; - if (cpl_error_get_code()) - printf("angle nb %d - %s\n", a, cpl_error_get_where()) ; /* Get the frameset with this angle */ angle_frameset = kmos_purge_wrong_angles_frameset(frameset, angles_array[a], do_catg_used); @@ -591,7 +579,6 @@ cpl_propertylist * main_header ; char * filter ; char * keyword ; - const char * ranges_txt_loc ; gridDefinition gd; char * fn_lut ; cpl_propertylist * tmp_header ; @@ -603,7 +590,7 @@ cpl_image ** stored_noise_images ; cpl_propertylist ** stored_sub_data_headers ; cpl_propertylist ** stored_sub_noise_headers ; - cpl_table *** edge_table_sky ; + cpl_table *** edge_table_sky = NULL; cpl_vector * calAngles ; cpl_imagelist * detector_in ; cpl_image * img_in ; @@ -621,10 +608,10 @@ cpl_table * band_table ; cpl_propertylist * sub_header ; char * extname ; - cpl_vector * identified_slices ; + cpl_vector * identified_slices = NULL; cpl_image * tmp_img ; float * pdata ; - float * pnoise ; + float * pnoise = NULL; cpl_vector * ranges ; cpl_imagelist * cube_data ; cpl_imagelist * cube_noise ; @@ -700,8 +687,6 @@ return -1 ; } cpl_free(filter) ; - } else { - ranges_txt_loc = ranges_txt ; } cpl_msg_info(__func__, "Spectral range to collapse: %s um", ranges_txt); @@ -803,7 +788,7 @@ cpl_free(stored_noise_images); cpl_free(stored_sub_data_headers); cpl_free(stored_sub_noise_headers); - if (has_flat_edge) cpl_free(edge_table_sky) ; + if (edge_table_sky) cpl_free(edge_table_sky) ; cpl_vector_delete(calAngles) ; cpl_msg_error(__func__, "Combination failed") ; cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; @@ -1054,18 +1039,25 @@ /* Apply median smoothing - Taking care of edges */ /* (IFUs 1-16 top/bottom, IFUs 17-24 left/right) */ if (!strcmp(do_catg_used, FLAT_ON)) { + nx = cpl_image_get_size_x(stored_data_images[ifu_nr-1]) ; + ny = cpl_image_get_size_x(stored_data_images[ifu_nr-1]) ; int firstx = 0, lastx = 0, firsty = 0, lasty = 0 ; - if (ifu_nr <= 2*KMOS_IFUS_PER_DETECTOR) - { firstx = 0; lastx = 13; firsty = 1; lasty = 12; } - else - { firstx = 1; lastx= 12; firsty = 0; lasty = 13; } + if (ifu_nr <= 2*KMOS_IFUS_PER_DETECTOR) { + firstx = 0; + lastx = nx-1; + firsty = 1; + lasty = ny-2; + } else { + firstx = 1; + lastx= nx-2; + firsty = 0; + lasty = ny-1; + } tmp_img = cpl_image_duplicate(stored_data_images[ifu_nr-1]); pdata = cpl_image_get_data_float(tmp_img); pnoise = cpl_image_get_data_float(stored_noise_images[ifu_nr-1]); - nx = cpl_image_get_size_x(tmp_img); - ny = cpl_image_get_size_y(tmp_img); /* Median filtering */ int mhalf = 3 ; @@ -1079,7 +1071,6 @@ 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-1],xmin+1,ymin+1, xmax+1, ymax+1); @@ -1093,12 +1084,13 @@ cpl_image_delete(stored_data_images[ifu_nr-1]); stored_data_images[ifu_nr-1] = tmp_img; } - cpl_vector_delete(identified_slices); + if(identified_slices) cpl_vector_delete(identified_slices); } else { /* IFU is invalid */ } } cpl_msg_indent_less() ; + } cpl_vector_delete(ranges); for (i = 0; i < next * KMOS_IFUS_PER_DETECTOR; i++) { @@ -1134,6 +1126,25 @@ "RAW frames are exactly the same as the " "frames used for MASTER_DARK calculation."); cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; + + if (stored_sub_data_headers) { + for (int k = 0; k < next * KMOS_IFUS_PER_DETECTOR; k++) { + if (stored_sub_data_headers[k]) { + cpl_propertylist_delete(stored_sub_data_headers[k]); + } + } + cpl_free(stored_sub_data_headers); + } + + if (stored_sub_noise_headers) { + for (int k = 0; k < next * KMOS_IFUS_PER_DETECTOR; k++) { + if (stored_sub_noise_headers[k]) { + cpl_propertylist_delete(stored_sub_noise_headers[k]); + } + } + cpl_free(stored_sub_noise_headers); + } + return -1 ; } mean_data += cpl_image_get_mean(stored_data_images[ifu_nr]); @@ -1189,8 +1200,10 @@ 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) * + if (pnoise) { + pnoise[ix+nx*iy] = sqrt(pow(new_val, 2) * pow(pnoise[ix+nx*iy],2)/pow(old_val,2)); + } } } } @@ -1305,9 +1318,9 @@ } cpl_free(stored_sub_data_headers); cpl_free(stored_sub_noise_headers); - if (has_flat_edge) { + if (edge_table_sky) { for (i = 0; i < KMOS_NR_DETECTORS; i++) { - if (edge_table_sky[i] != NULL) { + if (edge_table_sky[i]) { for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) cpl_table_delete(edge_table_sky[i][j]); cpl_free(edge_table_sky[i]); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_molecfit_calctrans.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_molecfit_calctrans.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_molecfit_calctrans.c 1970-01-01 00:00:00.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_molecfit_calctrans.c 2018-04-24 11:43:06.000000000 +0000 @@ -0,0 +1,1127 @@ +/* + * This file is part of the KMOS Pipeline + * Copyright (C) 2002,2003 European Southern Observatory + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +/*----------------------------------------------------------------------------*/ +/** + * Includes + */ +/*----------------------------------------------------------------------------*/ + +#include "kmos_molecfit.h" + +/*----------------------------------------------------------------------------*/ +/** + * Defines + */ +/*----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------*/ +/** + * Typedefs: Structs and enum types + */ +/*----------------------------------------------------------------------------*/ + +typedef struct { + kmos_molecfit_parameter mf; /* Generic molecfit parameter */ + cpl_propertylist *pl_atmos_params; /* Primary property list header in the ATMOS_PARM file */ + cpl_table *atmprof[N_IFUS]; /* cpl_table in the ATMOS_PARM file (one for each extension DATA executed in kmos_molecfit_model) */ + cpl_propertylist *pl_best_fit_params; /* Primary property list header in the BEST_FIT_PARM file */ + cpl_table *res_table[N_IFUS]; /* cpl_table in the BEST_FIT_PARM file (one for each extension DATA executed in kmos_molecfit_model) */ + cpl_table *telluric[N_IFUS]; /* Results of telluric corrections after execute convolution */ +} kmos_molecfit_calctrans_parameter; + + +/*----------------------------------------------------------------------------*/ +/** + * Functions prototypes + */ +/*----------------------------------------------------------------------------*/ + +/* Fill the internal KMOS configuration file */ +static kmos_molecfit_calctrans_parameter * kmos_molecfit_calctrans_conf( + const cpl_parameterlist *list); + +/* Use the kmos_molecfit_model output to configure kmos_molecfit_caltrans */ +static cpl_error_code kmos_molecfit_calctrans_frames_conf( + kmos_molecfit_calctrans_parameter *conf, cpl_frameset *frameset); + +/* Fill the molecfit specific recipe configuration file */ +static cpl_parameterlist * kmos_molecfit_calctrans_mf_conf( + kmos_molecfit_calctrans_parameter *conf, double median); + +/* Clean variables allocated in the recipe */ +static void kmos_molecfit_calctrans_clean( + kmos_molecfit_calctrans_parameter *conf); + +/*----------------------------------------------------------------------------*/ +/** + * Static variables + */ +/*----------------------------------------------------------------------------*/ + +#define RECIPE_NAME KMOS_MOLECFIT_CALCTRANS +#define CONTEXT "kmos."RECIPE_NAME + +static char kmos_molecfit_calctrans_description[] = + "This recipe applies the results from kmos_molecfit_model and runs calctrans to calculate the \n" + "telluric correction for scientific input data. Scientific input data can have category: \n" + " - STAR_SPEC (24 DATA plus 24 NOISE extensions)\n" + " - EXTRACT_SPEC (24 DATA extensions, additional 24 NOISE extensions are optional)\n" + " - SCIENCE (24 DATA extensions, additional 24 NOISE extensions are optional)\n" + " - SCI_RECONSTRUCTED (24 DATA extensions, additional 24 NOISE extensions are optional)\n" + "It is not mandatory that all the DATA extension contains data.\n" + "It accounts for the difference in airmass between the input model and the input scientific data. \n" + "It accounts for different spectral resolutions between the various KMOS IFUs.\n" + "\n" + "Input files: (It's mandatory to provide 1 file only of type A) \n" + "\n" + " DO KMOS \n" + " category Type required Explanation \n" + " -------- ----- -------- ----------- \n" + " STAR_SPEC F1I A The science spectrum to compute the telluric correction for (1D spectrum, IMAGE format).\n" + " EXTRACT_SPEC F1I A The science spectrum to compute the telluric correction for (1D spectrum, IMAGE format).\n" + " SCIENCE F3I A The science spectrum to compute the telluric correction for (3D cube, IMAGE format).\n" + " SCI_RECONSTRUCTED F3I A The science spectrum to compute the telluric correction for (3D cube, IMAGE format).\n" + " ATMOS_PARM F1L Y Atmospheric model as computed by the recipe kmos_molecfit_model.\n" + " BEST_FIT_PARM F1L Y Best fitting model and parameters as computed by the recipe kmos_molecfit_model.\n" + " KERNEL_LIBRARY F2I N The kernel library; must be the same grating as the other inputs.\n" + "\n" + "Output files: \n" + "\n" + " DO KMOS \n" + " category Type Explanation \n" + " -------- ----- ----------- \n" + " TELLURIC_DATA F1L Telluric correction and intermediate products for each IFU. Output fits file with 48 ext. (24-data and 24-error, in TABLE format).\n" + " Each data extension contains the telluric correction for one IFU.\n" + " TELLURIC_CORR F1I Telluric correction for each IFU. Output fits file with 48 ext. (24-data and 24-error, in IMAGE format).\n" + " Each data extension contains the telluric correction for one IFU.\n" + "\n" + "----------------------------------------------------------------------------\n" + "The input atmospheric model and best fitting parameters (as obtained in the kmos_molecfit_model) for a given IFU.X are used to generate a telluric correction for IFU.Y.\n" + "The instrumental spectral resolution of IFU.Y is taken into account if a kernel library is provided.\n" + "The mapping between IFU.X and IFU.Y is either specified by the user or automatic.\n" + "The difference in airmass between the data used in kmos_molecfit_model and the input data of kmos_molecfit_calctrans are taken into account.\n" + "\n"; + +/* Standard CPL recipe definition */ +cpl_recipe_define( kmos_molecfit_calctrans, + KMOS_BINARY_VERSION, + "Jose A. Escartin, Yves Jung", + "usd-help@eso.org", + "2017", + "Read the results from kmos_molecfit_model and computes the telluric correction for a scientific input data.", + kmos_molecfit_calctrans_description); + + +/*----------------------------------------------------------------------------*/ +/** + * @defgroup kmos_molecfit_calctrans It runs molectift on KMOS standard star file to compute an atmospheric model. + */ +/*----------------------------------------------------------------------------*/ + +/**@{*/ + +/*----------------------------------------------------------------------------*/ +/** + * Functions code + */ +/*----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------*/ +/** + * @brief Interpret the command line options and execute the data processing + * + * @param frameset the frames list + * @param parlist the parameters list + * + * @return CPL_ERROR_NONE if everything is OK or CPL_ERROR_CODE in other case + * + */ +/*----------------------------------------------------------------------------*/ +static int kmos_molecfit_calctrans( + cpl_frameset *frameset, const cpl_parameterlist *parlist) +{ + /* Check initial Entries */ + if (kmos_check_and_set_groups(frameset) != CPL_ERROR_NONE) { + return cpl_error_get_code(); + } + + /* Get initial errorstate */ + cpl_errorstate initial_errorstate = cpl_errorstate_get(); + + /* Extract and verify data in the parameters of the recipe */ + cpl_msg_info(cpl_func, "Configuring initial parameters in the recipe ..."); + kmos_molecfit_calctrans_parameter *conf = kmos_molecfit_calctrans_conf(parlist); + cpl_error_ensure(conf, CPL_ERROR_ILLEGAL_INPUT, + return (int)CPL_ERROR_ILLEGAL_INPUT, "Problems with the configuration parameters"); + + /* Complete configuration with the ATMOS_PARAM and BEST_FIT_PARM, outputs of the recipe kmos_molecfit_model */ + if (kmos_molecfit_calctrans_frames_conf(conf, frameset) != CPL_ERROR_NONE) { + kmos_molecfit_calctrans_clean(conf); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Configuration with kmos_molecfit_model output failed!"); + } + + if (!(conf->mf.fit_wavelenght.fit)) cpl_msg_info(cpl_func, "Not fit wavelenght!"); + if (!(conf->mf.fit_continuum.fit) ) cpl_msg_info(cpl_func, "Not fit continuum!" ); + + /* Loading data spectrums */ + if(kmos_molecfit_load_spectrums(frameset, &(conf->mf), RECIPE_NAME) != CPL_ERROR_NONE) { + kmos_molecfit_calctrans_clean(conf); + return (int)cpl_error_set_message(cpl_func, CPL_ERROR_FILE_IO, + "Loading spectrums data in the input frameset failed!"); + } + + /* Loading kernels */ + const cpl_frame *frmKernel = cpl_frameset_find(frameset, KERNEL_LIBRARY); + if (frmKernel && conf->mf.use_input_kernel) { + if (kmos_molecfit_load_kernels(frmKernel, &(conf->mf)) != CPL_ERROR_NONE) { + kmos_molecfit_calctrans_clean(conf); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Loading convolution kernel data in the input frameset failed!"); + } + } else { + if (frmKernel) { + cpl_msg_warning(cpl_func, "Kernel is provided, but use_input_kernel = false !"); + } else if (conf->mf.use_input_kernel){ + cpl_msg_warning(cpl_func, "Kernel isn't provided, but use_input_kernel = true !"); + } + cpl_msg_info(cpl_func, "Using the default molecfit kernels -> With the values inside BEST_FIT_PARMS!"); + } + + cpl_msg_info(cpl_func, " +++ All input data loaded successfully! +++"); + + + /* Saving generic multi-extension output *.fits file */ + cpl_msg_info(cpl_func, "Saving generic multi-extension output fits file ('%s','%s') ...", TELLURIC_DATA, TELLURIC); + cpl_error_code sTel_data = kmos_molecfit_save(frameset, parlist, RECIPE_NAME, conf->mf.parms, TELLURIC_DATA, conf->mf.grating.name, NULL); + cpl_error_code sTel_img = kmos_molecfit_save(frameset, parlist, RECIPE_NAME, conf->mf.parms, TELLURIC_CORR, conf->mf.grating.name, NULL); + if (sTel_data != CPL_ERROR_NONE || sTel_img != CPL_ERROR_NONE) { + kmos_molecfit_calctrans_clean(conf); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Saving generic multi-extension output fits files ('%s','%s') failed!", TELLURIC_DATA, TELLURIC_CORR); + } + + + /* Constant values in Molecfit executions */ + const double wlmin = -1.; + const double wlmax = -1.; + + /* Get molecules in the grating */ + cpl_table *molecules = conf->mf.grating.molecules; + + /* Change the TMPDIR environment variable to force molecfit and calctrans to create its temporary directory in the current working directory. + * This is to adhere to pipeline recipe standards, which require recipe output of any kind being created only in the current working directory. */ + char *cwd = kmos_molecfit_cwd_get(); + char *tmpdir = NULL; + if (cwd) { + kmos_molecfit_tmpdir_set(cwd, &tmpdir); + cpl_free(cwd); + cwd = NULL; + } + + /* Execute molecfit (lblrtm and convolution) */ + for (cpl_size n_ifuY = 0; n_ifuY < N_IFUS; n_ifuY++) { + + /* Get specific IFU */ + kmos_spectrum *ifuY = &(conf->mf.ifus[n_ifuY]); + + /* Running Molecfit lblrtm only in IFU_Y (when ifuY->num is equal to ifuY->map) */ + if (ifuY->num == ifuY->map) { + + if (conf->telluric[n_ifuY]) { + kmos_molecfit_calctrans_clean(conf); + kmos_molecfit_tmpdir_set(tmpdir, NULL); + cpl_free(tmpdir); + return (int)cpl_error_set_message(cpl_func, CPL_ERROR_DUPLICATING_STREAM, + "Unexpected error: Molecfit call mf_run_calctrans_lblrtm(...) already executed in this IFU"); + } + + /* Building molecfic configuration variable */ + cpl_msg_info(cpl_func, "Building molecfict configuration variable ... "); + cpl_parameterlist *mf_config_ifuY = kmos_molecfit_calctrans_mf_conf(conf, ifuY->median); + if (!mf_config_ifuY) { + kmos_molecfit_calctrans_clean(conf); + kmos_molecfit_tmpdir_set(tmpdir, NULL); + cpl_free(tmpdir); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Building molecfit configuration variable failed!"); + } + + /* Get state */ + cpl_errorstate preState_lblrtm = cpl_errorstate_get(); + + /* Initialize the mf_state for molecfit */ + mf_calctrans_state *mf_state = mf_init_calctrans_state(); + + /* Execute Molecfit lblrtm routine */ + cpl_table *table_lblrtm = cpl_table_duplicate(ifuY->data); + cpl_msg_info(cpl_func, "Executing mf_run_calctrans_lblrtm(...), in IFU_Y->map=%d),(num=%d,name=%s)", + ifuY->map, ifuY->num, ifuY->name); + mf_run_calctrans_lblrtm( mf_config_ifuY, /* cpl_parameterlist *parlist */ + conf->mf.header_spectrums, /* cpl_propertylist *plist */ + &(table_lblrtm), /* cpl_table **inspec */ + 1, /* cpl_size nspec */ + molecules, /* cpl_table *molectab */ + wlmin, /* double wl_start */ + wlmax, /* double wl_end */ + conf->atmprof[n_ifuY], /* cpl_table *atmprof */ + conf->res_table[n_ifuY], /* cpl_table *res_table */ + &mf_state); /* mf_calctrans_state **state */ + + /* Check execution */ + if (cpl_errorstate_is_equal(preState_lblrtm)) { + cpl_msg_info(cpl_func, "Molecfit call (mf_run_calctrans_lblrtm) run successfully! in %s ...", ifuY->name); + } else { + cpl_msg_info(cpl_func, "Molecfit call (mf_run_calctrans_lblrtm) failed! in %s -> error: %s", ifuY->name, cpl_error_get_message()); + kmos_molecfit_calctrans_clean(conf); + mf_cleanup(mf_state); + cpl_parameterlist_delete(mf_config_ifuY); + cpl_table_delete(table_lblrtm); + kmos_molecfit_tmpdir_set(tmpdir, NULL); + cpl_free(tmpdir); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Molecfit call (mf_run_calctrans_lblrtm) failed!"); + } + + /* Write down IFU executed and cleanup */ + cpl_parameterlist_delete(mf_config_ifuY); + cpl_table_delete(table_lblrtm); + + + /* Execute molecfit convolution: including ifuX == ifuY */ + for (cpl_size n_ifuX = 0; n_ifuX < N_IFUS; n_ifuX++) { + + /* Get specifics ifus */ + kmos_spectrum *ifuX = &(conf->mf.ifus[n_ifuX]); + + /* Running Molecfit convolution in each IFU_X(ifu->num) match with the reference math with IFU_Y (when ifuX->map == ifu->num) */ + if (ifuX->map == ifuY->num) { + + if (conf->telluric[n_ifuX]) { + kmos_molecfit_calctrans_clean(conf); + mf_cleanup(mf_state); + kmos_molecfit_tmpdir_set(tmpdir, NULL); + cpl_free(tmpdir); + return (int)cpl_error_set_message(cpl_func, CPL_ERROR_DUPLICATING_STREAM, + "Unexpected error: Molecfit call mf_run_calctrans_convolution(...) already executed in this IFU"); + } + + /* Building molecfic configuration variable */ + cpl_msg_info(cpl_func, "Building molecfict configuration variable ... "); + cpl_parameterlist *mf_config2_ifuX = kmos_molecfit_calctrans_mf_conf(conf, ifuY->median); + if (!mf_config2_ifuX) { + kmos_molecfit_calctrans_clean(conf); + kmos_molecfit_tmpdir_set(tmpdir, NULL); + cpl_free(tmpdir); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Building molecfit configuration variable failed!"); + } + + /* Convolution of the model transmission spectrum with the kernel */ + cpl_table *table_conv = cpl_table_duplicate(ifuY->data); + cpl_msg_info(cpl_func, "Executing mf_run_calctrans_convolution(...), in IFU_X->map=%d),(num=%d,name=%s) IFU_Y->map=%d),(num=%d,name=%s)", + ifuX->map, ifuX->num, ifuX->name, ifuY->map, ifuY->num, ifuY->name); + cpl_errorstate preState_convolution = cpl_errorstate_get(); + cpl_table *telluric_correction = NULL; + mf_run_calctrans_convolution( mf_config2_ifuX, /* cpl_parameterlist *parlist */ + conf->mf.header_spectrums, /* cpl_propertylist *plist, */ + &(table_conv), /* cpl_table **inspec */ + 1, /* cpl_size nspec, */ + ifuX->kernel.data, /* cpl_matrix *kernel, */ + wlmin, /* double wl_start, */ + wlmax, /* double wl_end, */ + conf->atmprof[n_ifuY], /* cpl_table *atmprof, */ + conf->res_table[n_ifuY], /* cpl_table *res_table, */ + &mf_state, /* mf_calctrans_state **state, */ + &telluric_correction); /* cpl_table **result */ + + if (telluric_correction) { + conf->telluric[n_ifuX] = cpl_table_duplicate(telluric_correction); + cpl_table_delete(telluric_correction); + } + + /* Check execution */ + if (cpl_errorstate_is_equal(preState_convolution)) { + if (conf->telluric[n_ifuX]) { + cpl_msg_info(cpl_func, "Molecfit call (mf_run_calctrans_convolution) run successfully! in %s ...", ifuX->name); + } else { + kmos_molecfit_calctrans_clean(conf); + mf_cleanup(mf_state); + cpl_parameterlist_delete(mf_config2_ifuX); + cpl_table_delete(table_conv); + kmos_molecfit_tmpdir_set(tmpdir, NULL); + cpl_free(tmpdir); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Molecfit call (mf_run_calctrans_convolution) doesn't provide error, but telluric_correction is NULL!"); + } + } else { + cpl_msg_info(cpl_func, "Molecfit call (mf_run_calctrans_convolution) failed! in %s -> error: %s", ifuX->name, cpl_error_get_message()); + kmos_molecfit_calctrans_clean(conf); + mf_cleanup(mf_state); + cpl_parameterlist_delete(mf_config2_ifuX); + cpl_table_delete(table_conv); + kmos_molecfit_tmpdir_set(tmpdir, NULL); + cpl_free(tmpdir); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Molecfit call (mf_run_calctrans_convolution) failed!"); + + } + + /* Write down IFU executed */ + cpl_parameterlist_delete(mf_config2_ifuX); + cpl_table_delete(table_conv); + } + } + + /* Clean Molecfit state for the next execution */ + mf_cleanup(mf_state); + } + } + + /* Restore tmp_directory */ + kmos_molecfit_tmpdir_set(tmpdir, NULL); + cpl_free(tmpdir); + + /* Save data in each the IFU */ + for (cpl_size n_ifu = 0; n_ifu < N_IFUS; n_ifu++) { + + /* Get specifics ifus */ + kmos_spectrum *ifu = &(conf->mf.ifus[n_ifu]); + + cpl_table *telluric_data = conf->telluric[n_ifu]; + double *data = NULL; + cpl_vector *telluric_vec = NULL; + if (telluric_data) { + + /* Wrap the data */ + data = cpl_table_get_data_double(telluric_data, "mtrans"); + cpl_vector *vAux = cpl_vector_wrap(cpl_table_get_nrow(telluric_data), data); + telluric_vec = cpl_vector_duplicate(vAux); + cpl_vector_unwrap(vAux); + + double mtrans_max = cpl_vector_get_max(telluric_vec); + //cpl_vector_divide_scalar(telluric_vec, mtrans_max); + cpl_msg_info(cpl_func, "Saving telluric data and image in IFU=%02d ... (Convolution executed) --> Max_value(%lf)", ifu->num, mtrans_max); + + } else { + cpl_msg_info(cpl_func, "Saving data in IFU=%02d ...", ifu->num); + } + + cpl_propertylist *header_data; + cpl_propertylist *header_noise; + if (ifu->num == ifu->map) { + header_data = cpl_propertylist_duplicate(ifu->header_ext_data); + header_noise = cpl_propertylist_duplicate(ifu->header_ext_noise); + } else { + + kmos_spectrum *ifu_ref = &(conf->mf.ifus[ifu->map - 1]); + header_data = cpl_propertylist_duplicate(ifu_ref->header_ext_data); + header_noise = cpl_propertylist_duplicate(ifu_ref->header_ext_noise); + + char* name_data = cpl_sprintf("IFU.%d.DATA", ifu->num); + cpl_propertylist_update_string(header_data, EXTNAME, name_data); + cpl_free(name_data); + + char* name_noise = cpl_sprintf("IFU.%d.NOISE", ifu->num); + cpl_propertylist_update_string(header_noise, EXTNAME, name_noise); + cpl_free(name_noise); + } + + /* Save cpl_table with the data of the mf_convolution execution */ + sTel_data = kmos_molecfit_save_mf_results(header_data, header_noise, + TELLURIC_DATA, conf->mf.grating.name, NULL, telluric_data, NULL); + if (sTel_data != CPL_ERROR_NONE) { + if (telluric_vec) cpl_vector_delete(telluric_vec); + cpl_propertylist_delete(header_data); + cpl_propertylist_delete(header_noise); + kmos_molecfit_calctrans_clean(conf); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Saving Molecfit output fits file ('%s') failed!, ext=%lld", TELLURIC_DATA, n_ifu + 1); + } + + + /* Save data image with the data obtained in the mf_convolution execution */ + sTel_img = kmos_molecfit_save_mf_results(header_data, header_noise, + TELLURIC_CORR, conf->mf.grating.name, NULL, NULL, telluric_vec); + if (sTel_img != CPL_ERROR_NONE) { + if (telluric_vec) cpl_vector_delete(telluric_vec); + cpl_propertylist_delete(header_data); + cpl_propertylist_delete(header_noise); + kmos_molecfit_calctrans_clean(conf); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Saving Molecfit output fits file ('%s') failed!, ext=%lld", TELLURIC_CORR, n_ifu + 1); + } + + /* Cleanup */ + if (telluric_vec) cpl_vector_delete(telluric_vec); + cpl_propertylist_delete(header_data); + cpl_propertylist_delete(header_noise); + } + + /* Cleanup configuration */ + cpl_msg_info(cpl_func,"Cleaning variables ..."); + kmos_molecfit_calctrans_clean(conf); + + /* Check Recipe status and end */ + if (cpl_errorstate_is_equal(initial_errorstate) && cpl_error_get_code() == CPL_ERROR_NONE ) { + cpl_msg_info(cpl_func,"Recipe successfully!"); + } else { + /* Dump the error history since recipe execution start. + * At this point the recipe cannot recover from the error */ + cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL); + cpl_msg_info(cpl_func,"Recipe failed!, error(%d)=%s", cpl_error_get_code(), cpl_error_get_message()); + } + + return (int)cpl_error_get_code(); +} + +/**@}*/ + +/*----------------------------------------------------------------------------*/ +/** + * @brief Function needed by cpl_recipe_define to fill the input parameters + * + * @param self parameterlist where you need put parameters + * + * @return cpl_error_code + * + */ +/*----------------------------------------------------------------------------*/ +static cpl_error_code kmos_molecfit_calctrans_fill_parameterlist( + cpl_parameterlist *self) +{ + /* Add the different default parameters to the recipe */ + cpl_errorstate prestate = cpl_errorstate_get(); + + /* Fill the parameters list */ + cpl_error_code e; + cpl_boolean range = CPL_TRUE; + const void *dummyMin = NULL; + const void *dummyMax = NULL; + + + /* --use_input_kernel */ + cpl_boolean use_input_kernel = CPL_TRUE; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "use_input_kernel", + !range, dummyMin, dummyMax, CPL_TYPE_BOOL, &use_input_kernel, + "In order to use kernel library provide by the user.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + + /*** Mapping IFUS ***/ + int automatic = -1.; + + /* --ifu_1 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_1", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 1 .", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_2 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_2", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 2 .", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_3 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_3", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 3 .", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_4 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_4", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 4 .", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_5 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_5", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 5 .", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_6 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_6", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 6 .", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_7 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_7", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 7 .", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_8 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_8", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 8 .", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_9 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_9", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 9 .", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_10 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_10", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 10.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_11 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_11", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 11.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_12 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_12", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 12.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_13 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_13", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 13.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_14 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_14", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 14.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_15 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_15", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 15.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_16 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_16", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 16.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_17 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_17", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 17.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_18 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_18", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 18.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_19 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_19", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 19.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_20 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_20", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 20.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_21 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_21", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 21.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_22 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_22", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 22.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_23 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_23", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 23.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ifu_24 */ + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "IFU_24", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &automatic, + "IFU number in ATMOS_PARM and BEST_FIT_PARM to be used to compute the telluric correction for IFU 24.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + + /* Check possible errors */ + if (!cpl_errorstate_is_equal(prestate)) { + return cpl_error_set_message(cpl_func, cpl_error_get_code(), + "kmos_molecfit_calctrans_fill_parameterlist failed!"); + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Generate the internal configuration file for the recipe and check values + * + * @param list parameterlist with the parameters + * + * @return configuration file or NULL if exist an error + * + */ +/*----------------------------------------------------------------------------*/ +static kmos_molecfit_calctrans_parameter * kmos_molecfit_calctrans_conf( + const cpl_parameterlist *list) +{ + /* Check input */ + cpl_error_ensure(list, CPL_ERROR_NULL_INPUT, + return NULL, "kmos_molecfit_calctrans_fill_conf input list NULL!"); + + /* Get preState */ + cpl_errorstate preState = cpl_errorstate_get(); + const cpl_parameter *p; + + + /* Create the configuration parameter */ + kmos_molecfit_calctrans_parameter *conf = (kmos_molecfit_calctrans_parameter *)cpl_malloc(sizeof(kmos_molecfit_calctrans_parameter)); + kmos_molecfit_nullify(&(conf->mf)); + conf->pl_atmos_params = NULL; + conf->pl_best_fit_params = NULL; + for (cpl_size i = 0; i < N_IFUS; i ++) { + conf->atmprof[i] = NULL; + conf->res_table[i] = NULL; + conf->telluric[i] = NULL; + } + + /* Initialize input parameters propertylist */ + conf->mf.parms = cpl_propertylist_new(); + + + /* Mapping IFUS in kmos_molecfit_calctrans recipe */ + int ifu = -1; + + p = cpl_parameterlist_find_const(list, "IFU_1"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_2"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_3"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_4"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_5"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_6"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_7"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_8"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_9"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_10"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_11"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_12"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_13"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_14"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_15"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_16"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_17"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_18"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_19"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_20"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_21"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_22"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_23"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + p = cpl_parameterlist_find_const(list, "IFU_24"); + conf->mf.ifus[++ifu].map = cpl_parameter_get_int(p); + + + /* User input kernel ? */ + p = cpl_parameterlist_find_const(list, "use_input_kernel"); + conf->mf.use_input_kernel = cpl_parameter_get_bool(p); + + + /* Save parameter in the output propertylist */ + ifu = -1; + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_1", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_2", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_3", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_4", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_5", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_6", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_7", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_8", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_9", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_10", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_11", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_12", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_13", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_14", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_15", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_16", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_17", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_18", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_19", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_20", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_21", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_22", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_23", conf->mf.ifus[++ifu].map ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"IFU_24", conf->mf.ifus[++ifu].map ); + + cpl_propertylist_update_bool(conf->mf.parms, KMOS_MF_PARAM_RECIPE"USE_INPUT_KERNEL", conf->mf.use_input_kernel); + + + /* Check status */ + if (!cpl_errorstate_is_equal(preState)) { + /* Configuration failed */ + kmos_molecfit_calctrans_clean(conf); + return NULL; + } else { + /* Configuration successfully */ + return conf; + } +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Generate the internal configuration file for the recipe and check values + * + * @param conf configuration file in the recipe + * @param frameset the frames list + * + * @return cpl_error_code + * + */ +/*----------------------------------------------------------------------------*/ +static cpl_error_code kmos_molecfit_calctrans_frames_conf( + kmos_molecfit_calctrans_parameter *conf, cpl_frameset *frameset) +{ + /* Check input */ + cpl_error_ensure(conf && frameset, CPL_ERROR_NULL_INPUT, + return CPL_ERROR_NULL_INPUT, "kmos_molecfit_calctrans_recipe_model_conf inputs NULL!"); + + /* Get preState */ + cpl_errorstate initialState = cpl_errorstate_get(); + + + /*** Get frame, header and check: ATMOS_PARAM ***/ + cpl_msg_info(cpl_func, "Loading '%s' header, input to kmos_molecfit_model recipe ...", ATMOS_PARM); + const cpl_frame *frmAtmosParm = cpl_frameset_find(frameset, ATMOS_PARM); + cpl_error_ensure(frmAtmosParm, CPL_ERROR_DATA_NOT_FOUND, + return CPL_ERROR_DATA_NOT_FOUND, ATMOS_PARM" not found in input frameset!"); + const char *fileAtmosParm = cpl_frame_get_filename(frmAtmosParm); + conf->pl_atmos_params = cpl_propertylist_load(fileAtmosParm, 0); + cpl_error_ensure(conf->pl_atmos_params, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load ATMOS_PARM primary header propertylist from '%s'!", fileAtmosParm); + + + /*** Get frame, header and check: BEST_FIT_PARM ***/ + cpl_msg_info(cpl_func, "Loading '%s' header, input to kmos_molecfit_model recipe ...", BEST_FIT_PARM); + const cpl_frame *frmBestFitParm = cpl_frameset_find(frameset, BEST_FIT_PARM); + cpl_error_ensure(frmBestFitParm, CPL_ERROR_DATA_NOT_FOUND, + return CPL_ERROR_DATA_NOT_FOUND, BEST_FIT_PARM" not found in input frameset!"); + const char *fileBestFitParm = cpl_frame_get_filename(frmBestFitParm); + conf->pl_best_fit_params = cpl_propertylist_load(fileBestFitParm, 0); + cpl_error_ensure(conf->pl_best_fit_params, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load BEST_FIT_PARM primary header propertylist from '%s'!", fileBestFitParm); + + + /*** Loading data form the input fits file ***/ + cpl_errorstate preState = cpl_errorstate_get(); + for (cpl_size n_ifu = 0; n_ifu < N_IFUS; n_ifu++) { + + /* Get number of extension */ + cpl_size ext = (n_ifu * 2) + 1; + + /* Get Atmospheric profile */ + conf->atmprof[n_ifu] = cpl_table_load(fileAtmosParm, ext, 0); + if (!(conf->atmprof[n_ifu])) { + /* The extension doesn't have atmprof */ + cpl_errorstate_set(preState); + } else { + cpl_msg_info(cpl_func, "%s, ext=%02lld: Loaded input data to kmos_molecfit_model recipe.", ATMOS_PARM, ext); + } + + /* Get Best fit parameters */ + conf->res_table[n_ifu] = cpl_table_load(fileBestFitParm, ext, 0); + if (!(conf->res_table[n_ifu])) { + /* The extension doesn't have data spectrum */ + cpl_errorstate_set(preState); + } else { + cpl_msg_info(cpl_func, "%s, ext=%02lld: Loaded input data to kmos_molecfit_model recipe.", BEST_FIT_PARM, ext); + } + } + + + /*** Check and assign mapping of IFUS ***/ + cpl_msg_info(cpl_func, "Mapping IFU's ... (Using BEST_FIT_PARM data in automatic assignment)"); + for (cpl_size n_ifu = 0; n_ifu < N_IFUS; n_ifu++) { + kmos_spectrum *ifu = &(conf->mf.ifus[n_ifu]); + cpl_size ifu_num = n_ifu + 1; + + /* Check if it's necessary to re-mapping automatically */ + if (ifu->map != -1) { + + if (!(conf->res_table[ifu->map - 1])) { + return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, + "Mapping IFU_X.%02lld->IFU_Y.%02d by the user failed! It doesn't contain IFU_Y data in the file %s.fits", + ifu_num, ifu->map, BEST_FIT_PARM); + } + + cpl_msg_info(cpl_func, "IFU_X.%02lld mapping to IFU_Y.%02d --> " + "Defined by the user", ifu_num, ifu->map); + } else { + + /* First rule: ifuX_(1-8)-->ifu_Y(1-8), ifuX_(9-16)-->ifu_Y(9-16), ifuX_(17-24)-->ifu_Y(17-24) */ + cpl_size indx = (n_ifu / 8) * 8; + for (cpl_size ifu_Y = indx; ifu_Y < indx + 8 && ifu->map == -1; ifu_Y++) { + + /* If exist data --> Map */ + if (conf->res_table[ifu_Y]) { + ifu->map = ifu_Y + 1; + cpl_msg_info(cpl_func, "IFU_X.%02lld mapping to IFU_Y.%02d --> " + "Defined automatically (Inside the normal range)", ifu_num, ifu->map); + } + } + + /* Second rule: If not found it in the normal range, looking for in all the range */ + if (ifu->map == -1) { + for (cpl_size ifu_Y = 0; ifu_Y < N_IFUS && ifu->map == -1; ifu_Y++) { + + /* If exist data --> Map */ + if (conf->res_table[ifu_Y]) { + ifu->map = ifu_Y + 1; + cpl_msg_info(cpl_func, "IFU_X.%02lld mapping to IFU_Y.%02d --> " + "Defined automatically (Outside the normal range)", ifu_num, ifu->map); + } + } + } + + cpl_error_ensure(ifu->map != -1, CPL_ERROR_ILLEGAL_INPUT, + return CPL_ERROR_ILLEGAL_INPUT, "Cannot search any IFU_Y data for the IFU_X"); + } + } + + + /*** Get the molecfit parameters from the BEST_FIL_PARAMS propertylist ***/ + cpl_msg_info(cpl_func, "Loading input parameters provided from kmos_molecfit_model recipe ..."); + + conf->mf.grating.wave_range = cpl_propertylist_get_string(conf->pl_best_fit_params, KMOS_MF_PARAM_RECIPE"WAVE_RANGE"); + conf->mf.grating.list_molec = cpl_propertylist_get_string(conf->pl_best_fit_params, KMOS_MF_PARAM_RECIPE"LIST_MOLEC"); + conf->mf.grating.fit_molec = cpl_propertylist_get_string(conf->pl_best_fit_params, KMOS_MF_PARAM_RECIPE"FIT_MOLEC" ); + conf->mf.grating.relcol = cpl_propertylist_get_string(conf->pl_best_fit_params, KMOS_MF_PARAM_RECIPE"RECOL" ); + + conf->mf.kernmode = cpl_propertylist_get_bool( conf->pl_best_fit_params, KMOS_MF_PARAM_RECIPE"KERNMODE" ); + conf->mf.kernfac = cpl_propertylist_get_double(conf->pl_best_fit_params, KMOS_MF_PARAM_RECIPE"KERNFAC" ); + conf->mf.varkern = cpl_propertylist_get_bool( conf->pl_best_fit_params, KMOS_MF_PARAM_RECIPE"VARKERN" ); + + conf->mf.fit_continuum.fit = cpl_propertylist_get_bool( conf->pl_best_fit_params, KMOS_MF_PARAM_RECIPE"FIT_CONT" ); + conf->mf.fit_continuum.n = cpl_propertylist_get_int( conf->pl_best_fit_params, KMOS_MF_PARAM_RECIPE"CONT_N" ); + + conf->mf.fit_wavelenght.fit = cpl_propertylist_get_bool( conf->pl_best_fit_params, KMOS_MF_PARAM_RECIPE"FIT_WLC" ); + conf->mf.fit_wavelenght.n = cpl_propertylist_get_int( conf->pl_best_fit_params, KMOS_MF_PARAM_RECIPE"WLC_N" ); + conf->mf.fit_wavelenght.const_val = cpl_propertylist_get_double(conf->pl_best_fit_params, KMOS_MF_PARAM_RECIPE"WLC_CONST" ); + + + /* Save parameter in the output propertylist */ + + cpl_propertylist_update_string(conf->mf.parms, KMOS_MF_PARAM_RECIPE"WAVE_RANGE", conf->mf.grating.wave_range ); + cpl_propertylist_update_string(conf->mf.parms, KMOS_MF_PARAM_RECIPE"LIST_MOLEC", conf->mf.grating.list_molec ); + cpl_propertylist_update_string(conf->mf.parms, KMOS_MF_PARAM_RECIPE"FIT_MOLEC", conf->mf.grating.fit_molec ); + cpl_propertylist_update_string(conf->mf.parms, KMOS_MF_PARAM_RECIPE"RECOL", conf->mf.grating.relcol ); + + cpl_propertylist_update_bool( conf->mf.parms, KMOS_MF_PARAM_RECIPE"KERNMODE", conf->mf.kernmode ); + cpl_propertylist_update_double(conf->mf.parms, KMOS_MF_PARAM_RECIPE"KERNFAC", conf->mf.kernfac ); + cpl_propertylist_update_bool( conf->mf.parms, KMOS_MF_PARAM_RECIPE"VARKERN", conf->mf.varkern ); + + cpl_propertylist_update_bool( conf->mf.parms, KMOS_MF_PARAM_RECIPE"FIT_CONT", conf->mf.fit_continuum.fit ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"CONT_N", conf->mf.fit_continuum.n ); + + cpl_propertylist_update_bool( conf->mf.parms, KMOS_MF_PARAM_RECIPE"FIT_WLC", conf->mf.fit_wavelenght.fit ); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"WLC_N", conf->mf.fit_wavelenght.n ); + cpl_propertylist_update_double(conf->mf.parms, KMOS_MF_PARAM_RECIPE"WLC_CONST", conf->mf.fit_wavelenght.const_val); + + + /* Check status */ + if (!cpl_errorstate_is_equal(initialState)) { + /* Configuration failed */ + return cpl_error_get_code(); + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Function needed to fill the molecfit configuration file + * + * @param conf Recipe configuration. + * + * @return parameterlist with contain the config to molecfit or NULL if error + * + */ +/*----------------------------------------------------------------------------*/ +static cpl_parameterlist * kmos_molecfit_calctrans_mf_conf( + kmos_molecfit_calctrans_parameter *conf, double median) +{ + /* Check input */ + cpl_error_ensure(conf, CPL_ERROR_NULL_INPUT, + return NULL, "conf input is NULL!"); + + /* Add the config values necessaries to execute molecfit */ + cpl_errorstate prestate = cpl_errorstate_get(); + + + /*** Building generic configuration molecfic file ***/ + cpl_parameterlist *mf_config = kmos_molecfit_conf_generic(RECIPE_NAME, &(conf->mf)); + if (!mf_config) { + return NULL; + } + + + /*** Set molecfit configuration with recipe parameters ***/ + cpl_error_code e = CPL_ERROR_NONE; + cpl_boolean range = CPL_TRUE; + const void *dummyMin = NULL; + const void *dummyMax = NULL; + int boolMin = 0; + int boolMax = 1; + + + /*** PARAMETERS NOT INCLUDED IN THE RECIPE: HARD-CODED ***/ + + + /* --fit_cont */ + int fit_cont = conf->mf.fit_continuum.fit; + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "fit_cont", + range, &boolMin, &boolMax, CPL_TYPE_INT, &fit_cont, + "molecfit", CPL_TRUE); + + /* --cont_n */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "cont_n", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &(conf->mf.fit_continuum.n), + "molecfit", CPL_TRUE); + + /* --cont_const -> Spectrum data dependency, Calculate median (ifu->median) of the input spectrum (ifu->data) */ + double cont_const = median; + cpl_msg_info(cpl_func,"--.cont_const = %g", cont_const); + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "cont_const", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &cont_const, + "molecfit", CPL_TRUE); + + /* --fit_wlc */ + int fit_wlc = conf->mf.fit_wavelenght.fit; + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "fit_wlc", + range, &boolMin, &boolMax, CPL_TYPE_INT, &fit_wlc, + "molecfit", CPL_TRUE); + + /* --wlc_n */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "wlc_n", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &(conf->mf.fit_wavelenght.n), + "molecfit", CPL_TRUE); + + /* --wlc_const */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "wlc_const", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &(conf->mf.fit_wavelenght.const_val), + "molecfit", CPL_TRUE); + + + /*** Check possible errors ***/ + if (!cpl_errorstate_is_equal(prestate) || e != CPL_ERROR_NONE) { + cpl_parameterlist_delete(mf_config); + cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Building molecfit configuration variable failed!"); + return NULL; + } + + return mf_config; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Deallocate the given parameter configuration object and its contents + * + * @param conf The parameter configuration variable in the recipe. + */ +/*----------------------------------------------------------------------------*/ +static void kmos_molecfit_calctrans_clean( + kmos_molecfit_calctrans_parameter *conf) +{ + if (conf) { + + kmos_molecfit_clean(&(conf->mf)); + + if (conf->pl_atmos_params) cpl_propertylist_delete(conf->pl_atmos_params); + if (conf->pl_best_fit_params) cpl_propertylist_delete(conf->pl_best_fit_params); + for (cpl_size i = 0; i < N_IFUS; i ++) { + if (conf->atmprof[i]) cpl_table_delete( conf->atmprof[i]); + if (conf->res_table[i]) cpl_table_delete( conf->res_table[i]); + if (conf->telluric[i]) cpl_table_delete( conf->telluric[i]); + } + + cpl_free(conf); + } +} diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_molecfit_correct.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_molecfit_correct.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_molecfit_correct.c 1970-01-01 00:00:00.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_molecfit_correct.c 2018-04-10 10:28:31.000000000 +0000 @@ -0,0 +1,617 @@ +/* + * This file is part of the KMOS Pipeline + * Copyright (C) 2002,2003 European Southern Observatory + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +/*----------------------------------------------------------------------------*/ +/** + * Includes + */ +/*----------------------------------------------------------------------------*/ + +#include "kmclipm_vector.h" +#include "kmo_priv_arithmetic.h" +#include "kmos_molecfit.h" + +/*----------------------------------------------------------------------------*/ +/** + * Defines + */ +/*----------------------------------------------------------------------------*/ + +#define KMOS_MOLECFIT_CORRECT_REFLEX_SUFFIX "ESO PRO REFLEX SUFFIX" + +/*----------------------------------------------------------------------------*/ +/** + * Typedefs: Structs and enum types + */ +/*----------------------------------------------------------------------------*/ + +typedef struct { + cpl_propertylist *header_ext_data; /* Data header */ + cpl_propertylist *header_ext_noise; /* Noise header */ + cpl_imagelist *cube_data; /* Data cube (3D) */ + cpl_imagelist *cube_noise; /* Noise cube (3D) */ + cpl_vector *vec_data; /* Data (1D) */ + cpl_vector *vec_noise; /* Noise (1D) */ + cpl_vector *correction; /* Data correction (1D) TELLURIC_CORR/RESPONSE */ + +} kmos_molecfit_correct_data; + +typedef struct { + kmos_molecfit_correct_data ifus[N_IFUS]; /* Input data */ + cpl_propertylist *parms; /* Input parameters propertylist */ + cpl_propertylist *pl_data; /* Header of input data fits file */ + cpl_propertylist *pl_correction; /* Header of input correction fits file */ + const char *tag_output; /* Tag of the output files */ +} kmos_molecfit_correct_parameter; + + +/*----------------------------------------------------------------------------*/ +/** + * Functions prototypes + */ +/*----------------------------------------------------------------------------*/ + +/* Fill the internal KMOS configuration file */ +static kmos_molecfit_correct_parameter * kmos_molecfit_correct_conf( + const cpl_parameterlist *list); + +/* Use the data input and kmos_molecfit_calctrans output to configure kmos_molecfit_correct */ +static cpl_error_code kmos_molecfit_correct_frames_conf( + kmos_molecfit_correct_parameter *conf, cpl_frameset *frameset); + +/* Clean variables allocated in the recipe */ +static void kmos_molecfit_correct_clean( + kmos_molecfit_correct_parameter *conf); + +/*----------------------------------------------------------------------------*/ +/** + * Static variables + */ +/*----------------------------------------------------------------------------*/ + +#define RECIPE_NAME KMOS_MOLECFIT_CORRECT +#define CONTEXT "kmos."RECIPE_NAME + +static char kmos_molecfit_correct_description[] = + "This recipe reads the results from kmos_molecfit_calctrans and apply the telluric correction for scientific input data file.\n" + "The input data can have category: \n" + " - STAR_SPEC (24 DATA plus 24 NOISE extensions)\n" + " - EXTRACT_SPEC (24 DATA extensions, additional 24 NOISE extensions are optional)\n" + " - SCIENCE (24 DATA extensions, additional 24 NOISE extensions are optional)\n" + " - SCI_RECONSTRUCTED (24 DATA extensions, additional 24 NOISE extensions are optional)\n" + "It is not mandatory that all the DATA extension contains data.\n" + "The recipe will be run on all the extension that contain data, it include noise extensions.\n" + "It is independent from molecfit/calctrans and uses one utility that is available in the KMOS pipeline (kmo_arithmetic).\n" + "The result obtained by the proposed molecfit/calctrans recipes must be the same as at the current molecfit and calctrans stand-alone tools.\n" + "\n" + "Input files: (It's mandatory to provide 1 file only of type A and B) \n" + "\n" + " DO KMOS \n" + " category Type required Explanation \n" + " -------- ----- -------- ----------- \n" + " STAR_SPEC F1I A The spectrum (1D spectrum, IMAGE format).\n" + " EXTRACT_SPEC F1I A The spectrum (1D spectrum, IMAGE format).\n" + " SCIENCE F3I A The spectrum (3D cube, IMAGE format).\n" + " SCI_RECONSTRUCTED F3I A The spectrum (3D cube, IMAGE format).\n" + " TELLURIC_CORR F1I B Telluric correction for each IFU (24-data extensions, additionaly 24-error are optional, in IMAGE format).\n" + " RESPONSE F1S B Response correction for each IFU (24-data extensions, additionaly 24-error are optional, in IMAGE format).\n" + "\n" + "Output files: (The output is 1 file of type C. The file match with the input dimensions)\n" + "\n" + " DO KMOS \n" + " category Type Explanation \n" + " -------- ----- ----------- \n" + " SINGLE_SPECTRA F1I C The 1D input data corrected file.\n" + " SINGLE_CUBES F3I C The 3D input data corrected file.\n" + "\n"; + +/* Standard CPL recipe definition */ +cpl_recipe_define( kmos_molecfit_correct, + KMOS_BINARY_VERSION, + "Jose A. Escartin, Yves Jung", + "usd-help@eso.org", + "2017", + "Read the results from kmos_molecfit_calctrans and apply the telluric correction for a scientific input data.", + kmos_molecfit_correct_description); + + +/*----------------------------------------------------------------------------*/ +/** + * @defgroup kmos_molecfit_correct It runs molectift on KMOS standard star file to compute an atmospheric model. + */ +/*----------------------------------------------------------------------------*/ + +/**@{*/ + +/*----------------------------------------------------------------------------*/ +/** + * Functions code + */ +/*----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------*/ +/** + * @brief Interpret the command line options and execute the data processing + * + * @param frameset the frames list + * @param parlist the parameters list + * + * @return CPL_ERROR_NONE if everything is OK or CPL_ERROR_CODE in other case + * + */ +/*----------------------------------------------------------------------------*/ +static int kmos_molecfit_correct( + cpl_frameset *frameset, const cpl_parameterlist *parlist) +{ + /* Check initial Entries */ + if (kmos_check_and_set_groups(frameset) != CPL_ERROR_NONE) { + return cpl_error_get_code(); + } + + /* Get initial errorstate */ + cpl_errorstate initial_errorstate = cpl_errorstate_get(); + + /* Extract and verify data in the parameters of the recipe */ + cpl_msg_info(cpl_func, "Configuring initial parameters in the recipe ..."); + kmos_molecfit_correct_parameter *conf = kmos_molecfit_correct_conf(parlist); + cpl_error_ensure(conf, CPL_ERROR_ILLEGAL_INPUT, + return (int)CPL_ERROR_ILLEGAL_INPUT, "Problems with the configuration parameters"); + + /* Complete configuration using the data input and kmos_molecfit_calctrans output to configure kmos_molecfit_correct */ + + if (kmos_molecfit_correct_frames_conf(conf, frameset) != CPL_ERROR_NONE) { + kmos_molecfit_correct_clean(conf); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Configuration with kmos_molecfit_model output failed!"); + } + + cpl_msg_info(cpl_func, " +++ All input data loaded successfully! +++"); + + + /* Saving generic multi-extension output *.fits file */ + char *filename = cpl_sprintf("%s_%s", conf->tag_output, cpl_propertylist_get_string(conf->pl_data, "ARCFILE")); + cpl_msg_info(cpl_func, "Saving generic multi-extension output fits file ('%s') ...", filename); + if (kmos_molecfit_save(frameset, parlist, RECIPE_NAME, conf->parms, conf->tag_output, NULL, filename) != CPL_ERROR_NONE) { + cpl_free(filename); + kmos_molecfit_correct_clean(conf); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Saving generic multi-extension output fits files failed!"); + } + + + /* Execute correction */ + for (cpl_size n_ifu = 0; n_ifu < N_IFUS; n_ifu++) { + kmos_molecfit_correct_data *ifu = &(conf->ifus[n_ifu]); + + /* Get state */ + cpl_errorstate preState = cpl_errorstate_get(); + + /* Apply the correction and save */ + cpl_error_code e_sData; + cpl_error_code e_sNoise = CPL_ERROR_NONE; + + /*** Get input data ***/ + if (ifu->vec_data) { + + cpl_msg_info(cpl_func, "Correcting 1D data spectrum , IFU.%02lld ...", n_ifu + 1); + cpl_vector_divide(ifu->vec_data, ifu->correction); + + cpl_msg_info(cpl_func, "Saving in '%s' 1D data , IFU.%02lld ...", filename, n_ifu + 1); + e_sData = cpl_vector_save(ifu->vec_data, filename, CPL_TYPE_FLOAT, ifu->header_ext_data, CPL_IO_EXTEND); + + if (ifu->vec_noise) { + + cpl_msg_info(cpl_func, "Correcting 1D noise spectrum, IFU.%02lld ...", n_ifu + 1); + cpl_vector_divide(ifu->vec_noise, ifu->correction); + + cpl_msg_info(cpl_func, "Saving in '%s' 1D noise , IFU.%02lld ...", filename, n_ifu + 1); + e_sNoise = cpl_vector_save(ifu->vec_noise, filename, CPL_TYPE_FLOAT, ifu->header_ext_noise, CPL_IO_EXTEND); + + } else if (ifu->header_ext_noise){ + + cpl_msg_info(cpl_func, "Saving in '%s' header noise , IFU.%02lld ...", filename, n_ifu + 1); + e_sNoise = cpl_propertylist_save(ifu->header_ext_noise, filename, CPL_IO_EXTEND); + } + + } else if (ifu->cube_data) { + + /* Conver ifu->correction for operate with kmo_priv_arithmetic */ + kmclipm_vector *correction = kmclipm_vector_create(cpl_vector_duplicate(ifu->correction)); + + cpl_msg_info(cpl_func, "Correcting 3D data cube , IFU.%02lld ...", n_ifu + 1); + if (kmo_arithmetic_3D_1D(ifu->cube_data, correction, NULL, NULL, "/") != CPL_ERROR_NONE) { + cpl_free(filename); + kmclipm_vector_delete(correction); + kmos_molecfit_correct_clean(conf); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Correction 3D failed in IFU.%02lld!", n_ifu + 1); + } + + cpl_msg_info(cpl_func, "Saving in '%s' 3D data , IFU.%02lld ...", filename, n_ifu + 1); + e_sData = cpl_imagelist_save(ifu->cube_data, filename, CPL_TYPE_FLOAT, ifu->header_ext_data, CPL_IO_EXTEND); + + if (ifu->cube_noise) { + + cpl_msg_info(cpl_func, "Correcting 3D noise cube, IFU.%02lld ...", n_ifu + 1); + if (kmo_arithmetic_3D_1D(ifu->cube_noise, correction, NULL, NULL, "/") != CPL_ERROR_NONE) { + cpl_free(filename); + kmclipm_vector_delete(correction); + kmos_molecfit_correct_clean(conf); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Correction 3D failed in IFU.%02lld!", n_ifu + 1); + } + + cpl_msg_info(cpl_func, "Saving in '%s' 3D noise correction cube, IFU.%02lld ...", filename, n_ifu + 1); + e_sNoise = cpl_imagelist_save(ifu->cube_noise, filename, CPL_TYPE_FLOAT, ifu->header_ext_noise, CPL_IO_EXTEND); + + } else if (ifu->header_ext_noise) { + + cpl_msg_info(cpl_func, "Saving in '%s' header noise , IFU.%02lld ...", filename, n_ifu + 1); + e_sNoise = cpl_propertylist_save(ifu->header_ext_noise, filename, CPL_IO_EXTEND); + } + + /* Cleanup correction */ + kmclipm_vector_delete(correction); + + } else { + + cpl_msg_info(cpl_func, "Saving in '%s' header data , IFU.%02lld ...", filename, n_ifu + 1); + e_sData = cpl_propertylist_save(ifu->header_ext_data, filename, CPL_IO_EXTEND); + if (ifu->header_ext_noise) { + cpl_msg_info(cpl_func, "Saving in '%s' header noise , IFU.%02lld ...", filename, n_ifu + 1); + e_sNoise = cpl_propertylist_save(ifu->header_ext_noise, filename, CPL_IO_EXTEND); + } + } + + /* Check save */ + if (e_sData != CPL_ERROR_NONE || e_sNoise != CPL_ERROR_NONE) { + cpl_free(filename); + kmos_molecfit_correct_clean(conf); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Saving correction output failed!, ext=%lld", n_ifu + 1); + } + + /* Check execution */ + if (!cpl_errorstate_is_equal(preState)) { + cpl_msg_info(cpl_func, "Correction failed! in IFU.%02lld -> error: %s", n_ifu + 1, cpl_error_get_message()); + cpl_free(filename); + kmos_molecfit_correct_clean(conf); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Correction failed! in IFU.%02lld ...", n_ifu + 1); + + } + } + + /* Cleanup configuration */ + cpl_msg_info(cpl_func,"Cleaning variables ..."); + cpl_free(filename); + kmos_molecfit_correct_clean(conf); + + /* Check Recipe status and end */ + if (cpl_errorstate_is_equal(initial_errorstate) && cpl_error_get_code() == CPL_ERROR_NONE ) { + cpl_msg_info(cpl_func,"Recipe successfully!"); + } else { + /* Dump the error history since recipe execution start. + * At this point the recipe cannot recover from the error */ + cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL); + cpl_msg_info(cpl_func,"Recipe failed!, error(%d)=%s", cpl_error_get_code(), cpl_error_get_message()); + } + + return (int)cpl_error_get_code(); +} + +/**@}*/ + +/*----------------------------------------------------------------------------*/ +/** + * @brief Function needed by cpl_recipe_define to fill the input parameters + * + * @param self parameterlist where you need put parameters + * + * @return cpl_error_code + * + */ +/*----------------------------------------------------------------------------*/ +static cpl_error_code kmos_molecfit_correct_fill_parameterlist( + cpl_parameterlist *self) +{ + cpl_error_ensure(self, CPL_ERROR_NULL_INPUT, return CPL_ERROR_NULL_INPUT, "Null input"); + + /* Add the different default parameters to the recipe */ + cpl_errorstate prestate = cpl_errorstate_get(); + + /* Check possible errors */ + if (!cpl_errorstate_is_equal(prestate)) { + return cpl_error_set_message(cpl_func, cpl_error_get_code(), + "kmos_molecfit_correct_fill_parameterlist failed!"); + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Generate the internal configuration file for the recipe and check values + * + * @param list parameterlist with the parameters + * + * @return configuration file or NULL if exist an error + * + */ +/*----------------------------------------------------------------------------*/ +static kmos_molecfit_correct_parameter * kmos_molecfit_correct_conf( + const cpl_parameterlist *list) +{ + /* Check input */ + cpl_error_ensure(list, CPL_ERROR_NULL_INPUT, + return NULL, "kmos_molecfit_correct_fill_conf input list NULL!"); + + /* Get preState */ + cpl_errorstate preState = cpl_errorstate_get(); + + /* Create the configuration parameter */ + kmos_molecfit_correct_parameter *conf = (kmos_molecfit_correct_parameter *)cpl_malloc(sizeof(kmos_molecfit_correct_parameter)); + conf->parms = cpl_propertylist_new(); + conf->pl_data = NULL; + conf->pl_correction = NULL; + for (cpl_size n_ifu = 0; n_ifu < N_IFUS; n_ifu++) { + kmos_molecfit_correct_data *ifu = &(conf->ifus[n_ifu]); + + ifu->header_ext_data = NULL; + ifu->header_ext_noise = NULL; + + ifu->cube_data = NULL; + ifu->cube_noise = NULL; + + ifu->vec_data = NULL; + ifu->vec_noise = NULL; + + ifu->correction = NULL; + } + + /* Check status */ + if (!cpl_errorstate_is_equal(preState)) { + /* Configuration failed */ + kmos_molecfit_correct_clean(conf); + return NULL; + } + + /* Configuration successfully */ + return conf; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Generate the internal configuration file for the recipe and check values + * + * @param conf configuration file in the recipe + * @param frameset the frames list + * + * @return cpl_error_code + * + */ +/*----------------------------------------------------------------------------*/ +static cpl_error_code kmos_molecfit_correct_frames_conf( + kmos_molecfit_correct_parameter *conf, cpl_frameset *frameset) +{ + /* Check input */ + cpl_error_ensure(conf && frameset, CPL_ERROR_NULL_INPUT, + return CPL_ERROR_NULL_INPUT, "kmos_molecfit_correct_inputs_conf inputs NULL!"); + + /* Get preState */ + cpl_errorstate initialState = cpl_errorstate_get(); + + + /*** Get frame, header and check input data ***/ + cpl_msg_info(cpl_func, "Loading header, input data frame ..."); + cpl_frame *frmData = kmos_molecfit_get_frame_spectrums(frameset); + const char *fileData = cpl_frame_get_filename(frmData); + conf->pl_data = cpl_propertylist_load(fileData, 0); + cpl_error_ensure(conf->pl_data, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load input data primary header propertylist from '%s'!", fileData); + + /* Get REFLEX_SUFFIX if exist in the file */ + if (cpl_propertylist_has(conf->pl_data, KMOS_MOLECFIT_CORRECT_REFLEX_SUFFIX)) { + cpl_propertylist_update_string(conf->parms, KMOS_MOLECFIT_CORRECT_REFLEX_SUFFIX, cpl_propertylist_get_string(conf->pl_data, KMOS_MOLECFIT_CORRECT_REFLEX_SUFFIX)); + } + + /* Get input data tag and select ouput tag */ + const char *tag = cpl_frame_get_tag(frmData); + if ( strcmp(tag, STAR_SPEC ) == 0 || + strcmp(tag, EXTRACT_SPEC ) == 0 ){ + conf->tag_output = SINGLE_SPECTRA; + } else if (strcmp(tag, SCIENCE ) == 0 || + strcmp(tag, RECONSTRUCTED_CUBE) == 0 ){ + conf->tag_output = SINGLE_CUBES; + } else { + return cpl_error_set_message(cpl_func, CPL_ERROR_TYPE_MISMATCH, + "Tag input data unexpected: %s", tag); + } + + /* Get if the file raw have 24(1) or 48(2) extensions */ + cpl_size n_extensions_raw = cpl_fits_count_extensions(fileData); + cpl_size ext24_raw = (N_IFUS == n_extensions_raw) ? 1 : 2; + + + /*** Get frame, header and check: correction TELLURIC_CORR/RESPONSE ***/ + cpl_errorstate preStateLoadCorrection = cpl_errorstate_get(); + cpl_msg_info(cpl_func, "Loading header, input spectrum correction ..."); + cpl_frame *frmCorrection = cpl_frameset_find(frameset, TELLURIC_CORR); + if (!frmCorrection) { + cpl_errorstate_set(preStateLoadCorrection); + frmCorrection = cpl_frameset_find(frameset, RESPONSE); + if (!frmCorrection) { + return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND, + "Frame with input correction data spectrum not found in frameset ('%s','%s') !", + TELLURIC_CORR, RESPONSE); + } + } + const char *fileCorrection = cpl_frame_get_filename(frmCorrection); + conf->pl_correction = cpl_propertylist_load(fileCorrection, 0); + cpl_error_ensure(conf->pl_correction, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load TELLURIC_CORR primary header propertylist from '%s'!", fileCorrection); + + /* Get input correction tag */ + const char *tag_correction = cpl_frame_get_tag(frmCorrection); + + /* Get if the file correction have 24(1) or 48(2) extensions */ + cpl_size n_extensions_correction = cpl_fits_count_extensions(fileCorrection); + cpl_size ext24_correction = (N_IFUS == n_extensions_correction) ? 1 : 2; + + + /*** Loading data form the input fits file ***/ + cpl_errorstate preState = cpl_errorstate_get(); + for (cpl_size n_ifu = 0; n_ifu < N_IFUS; n_ifu++) { + kmos_molecfit_correct_data *ifu = &(conf->ifus[n_ifu]); + + /* Get number of extensions */ + cpl_size correction_ext = (n_ifu * ext24_correction) + 1; /* 24/48 extensions (odd ext - data ) */ + cpl_size data_ext = (n_ifu * ext24_raw ) + 1; /* 24/48 extensions (odd ext - data ) */ + cpl_size noise_ext = data_ext + 1; /* 24/48 extensions (even ext - noise) */ + + + /*** Get input data header ***/ + ifu->header_ext_data = cpl_propertylist_load(fileData, data_ext); + cpl_error_ensure(ifu->header_ext_data, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load input data extension header propertylist from '%s', ext=%lld!", fileData, n_ifu + 1); + + + /*** Get input noise header: 48 extensions in the file? ***/ + if (ext24_raw > 1) { + + /* Load header noise extension */ + ifu->header_ext_noise = cpl_propertylist_load(fileData, noise_ext); + cpl_error_ensure(ifu->header_ext_data, cpl_error_get_code(), + return cpl_error_get_code(), "Cannot load input data extension header propertylist from '%s', ext=%lld!", fileData, n_ifu + 1); + } + + + /*** Get input data ***/ + if (strcmp(conf->tag_output, SINGLE_SPECTRA) == 0){ + + ifu->vec_data = cpl_vector_load(fileData, data_ext); + if (!(ifu->vec_data)) { + /* The extension doesn't have 1D data */ + cpl_errorstate_set(preState); + cpl_msg_info(cpl_func, "Frame: %s --> IFU.%02lld : Loaded 1D input data header (not exist input data).", tag, n_ifu + 1); + } else { + cpl_msg_info(cpl_func, "Frame: %s --> IFU.%02lld : Loaded 1D input data!", tag, n_ifu + 1); + + /* Get input noise: 48 extensions in the file? */ + if (ext24_raw > 1) { + + ifu->vec_noise = cpl_vector_load(fileData, noise_ext); + if (!(ifu->vec_noise)) { + /* The extension doesn't have 1D data */ + cpl_errorstate_set(preState); + cpl_msg_info(cpl_func, "Frame: %s --> IFU.%02lld : Loaded 1D input noise header (not exist input noise).", tag, n_ifu + 1); + + } else { + cpl_msg_info(cpl_func, "Frame: %s --> IFU.%02lld : Loaded 1D input noise!", tag, n_ifu + 1); + } + } + } + + + } else if (strcmp(conf->tag_output, SINGLE_CUBES) == 0){ + + ifu->cube_data = cpl_imagelist_load(fileData, CPL_TYPE_FLOAT, data_ext); + if (!(ifu->cube_data)) { + /* The extension doesn't have 1D data */ + cpl_errorstate_set(preState); + cpl_msg_info(cpl_func, "Frame: %s --> IFU.%02lld : Loaded 3D input data header (not exist input data).", tag, n_ifu + 1); + } else { + cpl_msg_info(cpl_func, "Frame: %s --> IFU.%02lld : Loaded 3D input data!", tag, n_ifu + 1); + + /* Get input noise: 48 extensions in the file? */ + if (ext24_raw > 1) { + + ifu->cube_noise = cpl_imagelist_load(fileData, CPL_TYPE_FLOAT, noise_ext); + if (!(ifu->cube_noise)) { + /* The extension doesn't have 1D data */ + cpl_errorstate_set(preState); + cpl_msg_info(cpl_func, "Frame: %s --> IFU.%02lld : Loaded 3D input noise header (not exist input noise).", tag, n_ifu + 1); + + } else { + cpl_msg_info(cpl_func, "Frame: %s --> IFU.%02lld : Loaded 3D input noise!", tag, n_ifu + 1); + } + } + } + } + + + /* Get Telluric correction */ + ifu->correction = cpl_vector_load(fileCorrection, correction_ext); + if (!(ifu->correction)) { + /* The extension doesn't have correction (telluric/response) */ + return cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND, + "The extension doesn't have correction spectrum in IFU.%02lld", n_ifu + 1); + } else { + cpl_msg_info(cpl_func, "Frame: %s --> IFU.%02lld : Loaded input data spectrum correction (output of kmos_molecfit_calctrans recipe).", tag_correction, n_ifu + 1); + } + } + + + /* Check status */ + if (!cpl_errorstate_is_equal(initialState)) { + /* Configuration failed */ + return cpl_error_get_code(); + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Deallocate the given parameter configuration object and its contents + * + * @param conf The parameter configuration variable in the recipe. + */ +/*----------------------------------------------------------------------------*/ +static void kmos_molecfit_correct_clean( + kmos_molecfit_correct_parameter *conf) +{ + if (conf) { + + if (conf->parms) cpl_propertylist_delete(conf->parms); + if (conf->pl_data) cpl_propertylist_delete(conf->pl_data); + if (conf->pl_correction) cpl_propertylist_delete(conf->pl_correction); + + for (cpl_size n_ifu = 0; n_ifu < N_IFUS; n_ifu ++) { + kmos_molecfit_correct_data *ifu = &(conf->ifus[n_ifu]); + + if (ifu->header_ext_data) cpl_propertylist_delete(ifu->header_ext_data); + if (ifu->header_ext_noise) cpl_propertylist_delete(ifu->header_ext_noise); + + if (ifu->cube_data) cpl_imagelist_delete( ifu->cube_data); + if (ifu->cube_noise) cpl_imagelist_delete( ifu->cube_noise); + + if (ifu->vec_data) cpl_vector_delete( ifu->vec_data); + if (ifu->vec_noise) cpl_vector_delete( ifu->vec_noise); + + if (ifu->correction) cpl_vector_delete( ifu->correction); + } + + cpl_free(conf); + } +} diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_molecfit_model.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_molecfit_model.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_molecfit_model.c 1970-01-01 00:00:00.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_molecfit_model.c 2018-04-24 11:43:06.000000000 +0000 @@ -0,0 +1,1236 @@ +/* + * This file is part of the KMOS Pipeline + * Copyright (C) 2002,2003 European Southern Observatory + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +/*----------------------------------------------------------------------------*/ +/** + * Includes + */ +/*----------------------------------------------------------------------------*/ + +#include "kmos_molecfit.h" + +/*----------------------------------------------------------------------------*/ +/** + * Defines + */ +/*----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------*/ +/** + * Typedefs: Structs and enum types + */ +/*----------------------------------------------------------------------------*/ + +typedef struct { + cpl_boolean fit; /* Flag: Fit resolution */ + double res; /* Initial value for FWHM */ +} mf_kernel; + +typedef struct { + kmos_molecfit_parameter mf; /* Generic molecfit parameter */ + const char *process_ifus; /* IFUs to process. If -1 (default), process all IFUs with data */ + double ftol; /* Relative chi-square convergence criterion */ + double xtol; /* Relative parameter convergence criterion */ + mf_kernel boxcar; /* Fit resolution by boxcar LSF */ + mf_kernel gauss; /* Fit resolution by Gaussian */ + mf_kernel lorentz; /* Fit resolution by Lorentz */ +} kmos_molecfit_model_parameter; + + +/*----------------------------------------------------------------------------*/ +/** + * Functions prototypes + */ +/*----------------------------------------------------------------------------*/ + +/* Check the string variables defined by the user (wave_range and molecules definition) */ +static cpl_error_code kmos_molecfit_model_check_wave_molec_conf( + kmos_grating *grating); + +/* Fill the internal KMOS configuration file */ +static kmos_molecfit_model_parameter * kmos_molecfit_model_conf( + const cpl_parameterlist *list); + +/* Fill the molecfit specific recipe configuration file */ +static cpl_parameterlist * kmos_molecfit_model_mf_conf( + kmos_molecfit_model_parameter *conf, kmos_spectrum *ifu, kmos_grating_type type); + +/* Clean variables allocated in the recipe */ +static void kmos_molecfit_model_clean( + kmos_molecfit_model_parameter *conf); + +/*----------------------------------------------------------------------------*/ +/** + * Static variables + */ +/*----------------------------------------------------------------------------*/ + +#define RECIPE_NAME KMOS_MOLECFIT_MODEL +#define CONTEXT "kmos."RECIPE_NAME + +static char kmos_molecfit_model_description[] = + "This recipe runs molecfit on a 1D spectrum and the input data can have category: \n" + " - STAR_SPEC (24 DATA plus 24 NOISE extensions)\n" + " - EXTRACT_SPEC (24 DATA extensions, additional 24 NOISE extensions are optional)\n" + " - SCIENCE (24 DATA extensions, additional 24 NOISE extensions are optional)\n" + " - SCI_RECONSTRUCTED (24 DATA extensions, additional 24 NOISE extensions are optional)\n" + "It is not mandatory that all the DATA extension contains data.\n" + "Molecfit will be run on all the extension that contain data (not noise extensions). \n" + "The recipe also accepts as input a kernel library, e.g. the information of the spectral resolution for each IFU and each rotator angle. \n" + "When the recipe executes molecfit on the i-th IFU, the kernel in the library that matches the IFU number and rotator angle is used. \n" + "If no kernel are provided, each time the recipe runs molecfit, the kernel is considered as a free parameter and it will be determined by molecfit itself and stored into the BEST_FIT_PARM output. \n" + "\n" + "Input files: (It's mandatory to provide 1 file only of type A) \n" + "\n" + " DO KMOS \n" + " category Type required Explanation \n" + " -------- ----- -------- ----------- \n" + " STAR_SPEC F1I A The spectrum (1D spectrum, IMAGE format).\n" + " EXTRACT_SPEC F1I A The spectrum (1D spectrum, IMAGE format).\n" + " SCIENCE F3I A The spectrum (3D cube, IMAGE format).\n" + " SCI_RECONSTRUCTED F3I A The spectrum (3D cube, IMAGE format).\n" + " KERNEL_LIBRARY F2I N The kernel library; must be the same grating as the other inputs.\n" + "\n" + "Output files: \n" + "\n" + " DO KMOS \n" + " category Type Explanation \n" + " -------- ----- ----------- \n" + " ATMOS_PARM F1L Atmospheric parameters (multiextension fits table).\n" + " BEST_FIT_PARM F1L Best fitting parameters (multiextension fits table).\n" + " BEST_FIT_MODEL F1L Best fit model and intermediate products (multiextension fits table).\n" + "\n"; + +/* Standard CPL recipe definition */ +cpl_recipe_define( kmos_molecfit_model, + KMOS_BINARY_VERSION, + "Jose A. Escartin, Yves Jung", + "usd-help@eso.org", + "2017", + "Run molecfit on set of 1D spectra to compute an atmospheric model.", + kmos_molecfit_model_description); + + +/*----------------------------------------------------------------------------*/ +/** + * @defgroup kmos_molecfit_model It runs molecfit on KMOS standard star file + * to compute an atmospheric model. + */ +/*----------------------------------------------------------------------------*/ + +/**@{*/ + +/*----------------------------------------------------------------------------*/ +/** + * Functions code + */ +/*----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------*/ +/** + * @brief Interpret the command line options and execute the data processing + * + * @param frameset the frames list + * @param parlist the parameters list + * + * @return CPL_ERROR_NONE if everything is OK or CPL_ERROR_CODE in other case + * + */ +/*----------------------------------------------------------------------------*/ +static int kmos_molecfit_model( + cpl_frameset *frameset, const cpl_parameterlist *parlist) +{ + /* Check initial Entries */ + if (kmos_check_and_set_groups(frameset) != CPL_ERROR_NONE) { + return cpl_error_get_code(); + } + + /* Get initial errorstate */ + cpl_errorstate initial_errorstate = cpl_errorstate_get(); + + /* Extract and verify data in the parameters of the recipe */ + cpl_msg_info(cpl_func, "Configuring initial parameters in the recipe ..."); + kmos_molecfit_model_parameter *conf = kmos_molecfit_model_conf(parlist); + cpl_error_ensure(conf, CPL_ERROR_ILLEGAL_INPUT, + return (int)CPL_ERROR_ILLEGAL_INPUT, "Problems with the configuration parameters"); + if (!(conf->mf.fit_wavelenght.fit)) cpl_msg_info(cpl_func, "Not fit wavelenght!"); + if (!(conf->mf.fit_continuum.fit) ) cpl_msg_info(cpl_func, "Not fit continuum!" ); + + /* Loading data spectrums */ + if(kmos_molecfit_load_spectrums(frameset, &(conf->mf), RECIPE_NAME) != CPL_ERROR_NONE) { + kmos_molecfit_model_clean(conf); + return (int)cpl_error_set_message(cpl_func, CPL_ERROR_FILE_IO, + "Loading spectrums data in the input frameset failed!"); + } + + /* Loading kernels */ + const cpl_frame *frmKernel = cpl_frameset_find(frameset, KERNEL_LIBRARY); + if (frmKernel && conf->mf.use_input_kernel) { + if(kmos_molecfit_load_kernels(frmKernel, &(conf->mf)) != CPL_ERROR_NONE) { + kmos_molecfit_model_clean(conf); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Loading convolution kernel data in the input frameset failed!"); + } + } else { + if (frmKernel) { + cpl_msg_warning(cpl_func, "Kernel is provided, but use_input_kernel = false !"); + } else if (conf->mf.use_input_kernel){ + cpl_msg_warning(cpl_func, "Kernel isn't provided, but use_input_kernel = true !"); + } + cpl_msg_info(cpl_func, "Using the default molecfit kernels!"); + cpl_msg_info(cpl_func, "Fit resolution by Boxcar (--fit_res_box ) = %d", conf->boxcar.fit ); + cpl_msg_info(cpl_func, "Fit resolution by Gaussian (--fit_res_gauss ) = %d", conf->gauss.fit ); + cpl_msg_info(cpl_func, "Fit resolution by Lorentz (--fit_res_lorentz) = %d", conf->lorentz.fit); + } + + cpl_msg_info(cpl_func, " +++ All input data loaded successfully! +++"); + + + /* Saving generic multi-extension output *.fits files */ + cpl_msg_info(cpl_func, "Saving generic multi-extension output fits file ('%s','%s','%s') ...", ATMOS_PARM, BEST_FIT_PARM, BEST_FIT_MODEL); + cpl_error_code sAtm_e = kmos_molecfit_save(frameset, parlist, RECIPE_NAME, conf->mf.parms, ATMOS_PARM, conf->mf.grating.name, NULL); + cpl_error_code sBParms_e = kmos_molecfit_save(frameset, parlist, RECIPE_NAME, conf->mf.parms, BEST_FIT_PARM, conf->mf.grating.name, NULL); + cpl_error_code sBModel_e = kmos_molecfit_save(frameset, parlist, RECIPE_NAME, conf->mf.parms, BEST_FIT_MODEL, conf->mf.grating.name, NULL); + if (sAtm_e != CPL_ERROR_NONE || sBParms_e != CPL_ERROR_NONE || sBModel_e != CPL_ERROR_NONE) { + kmos_molecfit_model_clean(conf); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Saving generic multi-extension output fits files ('%s','%s','%s') failed!", ATMOS_PARM, BEST_FIT_PARM, BEST_FIT_MODEL); + } + + /* Change the TMPDIR environment variable to force molecfit and calctrans to create its temporary directory in the current working directory. + * This is to adhere to pipeline recipe standards, which require recipe output of any kind being created only in the current working directory. */ + char *cwd = kmos_molecfit_cwd_get(); + char *tmpdir = NULL; + if (cwd) { + kmos_molecfit_tmpdir_set(cwd, &tmpdir); + cpl_free(cwd); + cwd = NULL; + } + + /* Number of IFUs processed with molecfit */ + cpl_size n_procesed_ifus = 0; + + /* Execute molecfit for each data spectrum (odd extensions) in STAR_SPEC */ + kmos_grating *grating = &(conf->mf.grating); + for (cpl_size i = 0; i < N_IFUS; i++) { + kmos_spectrum *ifu = &(conf->mf.ifus[i]); + + /* Initialize variables for molecfit execution */ + cpl_table *atmprof = NULL; + cpl_table *res_table = NULL; + cpl_table *spec_out = NULL; + + /* Check if the IFU contains data */ + if (ifu->process && ifu->data) { + + /* Building molecfic configuration file */ + cpl_msg_info(cpl_func, "Building molecfict configuration variable in %s ... ", ifu->name); + cpl_parameterlist *mf_config = kmos_molecfit_model_mf_conf(conf, ifu, grating->type); + if (!mf_config) { + kmos_molecfit_model_clean(conf); + kmos_molecfit_tmpdir_set(tmpdir, NULL); + cpl_free(tmpdir); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Building molecfit configuration variable failed!"); + } + + /* Get errorstate */ + cpl_errorstate preState = cpl_errorstate_get(); + + /* Initialize the mf_state for molecfit */ + mf_calctrans_state *mf_state = mf_init_calctrans_state(); + + /* Running molecfit */ + cpl_msg_info(cpl_func, "Call mf_run_molecfit(...) in %s ...", ifu->name); + cpl_table *data = cpl_table_duplicate(ifu->data); + mf_run_molecfit( mf_config, /* cpl_parameterlist *parlist */ + conf->mf.header_spectrums, /* cpl_propertylist *plist */ + &data, /* cpl_table **inspec */ + 1, /* cpl_size nspec */ + grating->molecules, /* cpl_table *molectab */ + grating->incl_wave_ranges, /* cpl_table *wlinclude */ + NULL, /* cpl_table *wlexclude */ + NULL, /* cpl_table *pixexclude */ + ifu->kernel.data, /* cpl_matrix *kernel */ + &atmprof, /* cpl_table **prof_out */ + &res_table, /* cpl_table **res_out */ + &spec_out, /* cpl_table **spec_out */ + &mf_state); /* mf_calctrans_state **state */ + + /* Check execution */ + if (cpl_errorstate_is_equal(preState)) { + cpl_msg_info(cpl_func, "Call mf_run_molecfit(...) run successfully! in %s ...", ifu->name); + } else { + cpl_msg_info(cpl_func, "Call mf_run_molecfit(...) failed! in %s -> error: %s", ifu->name, cpl_error_get_message()); + kmos_molecfit_model_clean(conf); + cpl_parameterlist_delete(mf_config); + mf_cleanup(mf_state); + cpl_table_delete(data); + kmos_molecfit_tmpdir_set(tmpdir, NULL); + cpl_free(tmpdir); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Molecfit call (mf_run_molecfit) failed! ..."); + } + n_procesed_ifus++; + + /* Cleanup molecfic output variables */ + cpl_parameterlist_delete(mf_config); + mf_cleanup(mf_state); + cpl_table_delete(data); + } + + /* Saving data */ + if (!(ifu->data)) { + cpl_msg_info(cpl_func, "Saving data IFU=%d ...", ifu->num); + } else if (!(ifu->process)){ + cpl_msg_info(cpl_func, "Saving data IFU=%d ... (data spectrum -> But not processed)", ifu->num); + } else { + cpl_msg_info(cpl_func, "Saving data IFU=%d ... (data spectrum -> Molecfit executed)", ifu->num); + } + sAtm_e = kmos_molecfit_save_mf_results(ifu->header_ext_data, ifu->header_ext_noise, ATMOS_PARM, conf->mf.grating.name, NULL, atmprof, NULL); + sBParms_e = kmos_molecfit_save_mf_results(ifu->header_ext_data, ifu->header_ext_noise, BEST_FIT_PARM, conf->mf.grating.name, NULL, res_table, NULL); + sBModel_e = kmos_molecfit_save_mf_results(ifu->header_ext_data, ifu->header_ext_noise, BEST_FIT_MODEL, conf->mf.grating.name, NULL, spec_out, NULL); + if (atmprof) cpl_table_delete(atmprof); + if (res_table) cpl_table_delete(res_table); + if (spec_out) cpl_table_delete(spec_out); + if (sAtm_e != CPL_ERROR_NONE || sBParms_e != CPL_ERROR_NONE || sBModel_e != CPL_ERROR_NONE) { + kmos_molecfit_model_clean(conf); + kmos_molecfit_tmpdir_set(tmpdir, NULL); + cpl_free(tmpdir); + return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Saving Molecfit output fits files ('%s','%s','%s') failed!", ATMOS_PARM, BEST_FIT_PARM, BEST_FIT_MODEL); + } + } + + /* Cleanup configuration */ + cpl_msg_info(cpl_func,"Cleaning variables ..."); + kmos_molecfit_model_clean(conf); + + /* Restore tmp_directory */ + kmos_molecfit_tmpdir_set(tmpdir, NULL); + cpl_free(tmpdir); + + /* Check Recipe status and end */ + if (cpl_errorstate_is_equal(initial_errorstate) && cpl_error_get_code() == CPL_ERROR_NONE ) { + cpl_msg_info(cpl_func,"Recipe successfully!, Number of IFUs processed (with data): %lld", n_procesed_ifus); + } else { + /* Dump the error history since recipe execution start. + * At this point the recipe cannot recover from the error */ + cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL); + cpl_msg_info(cpl_func,"Recipe failed!, error(%d)=%s", cpl_error_get_code(), cpl_error_get_message()); + } + + return (int)cpl_error_get_code(); +} + +/**@}*/ + +/*----------------------------------------------------------------------------*/ +/** + * @brief Function needed by cpl_recipe_define to fill the input parameters + * + * @param self parameterlist where you need put parameters + * + * @return cpl_error_code + * + */ +/*----------------------------------------------------------------------------*/ +static cpl_error_code kmos_molecfit_model_fill_parameterlist( + cpl_parameterlist *self) +{ + /* Add the different default parameters to the recipe */ + cpl_errorstate prestate = cpl_errorstate_get(); + + /* Fill the parameters list */ + cpl_error_code e; + cpl_boolean range = CPL_TRUE; + const void *dummyMin = NULL; + const void *dummyMax = NULL; + + + /* --process_ifus */ + const char *process_ifus = "-1"; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "process_ifus", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)process_ifus, + "A list of IFUs to process. If set to -1, all the IFUs that have data will be process.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --wave_range */ + const char *wave_range = "-1"; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "wave_range", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)wave_range, + "A list of numbers defining the wavelength ranges to fit in the grating. " + "If set to -1, grating dependent default values are used (see manual for reference). ", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --list_molec */ + const char *list_molec = "-1"; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "list_molec", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)list_molec, + "A list of molecules to fit in grating IZ. " + "If set to -1, grating dependent default values are used (see manual for reference). ", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --fit_molec */ + const char *fit_molec = "-1"; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "fit_molec", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)fit_molec, + "Flags to fit the column density of the corresponding list_molec in grating. " + "If set to -1, grating dependent default values are used (see manual for reference). ", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --relcol */ + const char *relcol = "-1"; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "relcol", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)relcol, + "Column density relative to atmospheric profile of the corresponding list_molec in grating. " + "If set to -1, grating dependent default values are used (see manual for reference). ", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --ftol */ + double ftol = 0.01; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "ftol", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &ftol, + "Relative chi-square convergence criterion.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --xtol */ + double xtol = 0.001; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "xtol", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &xtol, + "Relative parameter convergence criterion.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --fit_cont */ + cpl_boolean fit_cont = CPL_TRUE; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "fit_cont", + !range, dummyMin, dummyMax, CPL_TYPE_BOOL, &fit_cont, + "Flag to enable/disable the polynomial fit of the continuum.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --cont_n */ + int cont_n = 1; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "cont_n", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &cont_n, + "Degree of polynomial continuum fit.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --fit_wlc */ + cpl_boolean fit_wlc = CPL_TRUE; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "fit_wlc", + !range, dummyMin, dummyMax, CPL_TYPE_BOOL, &fit_wlc, + "Flag to enable/disable the refinement of the wavelength solution.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --wlc_n */ + int wlc_n = 2; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "wlc_n", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &wlc_n, + "Polynomial degree of the refined wavelength solution.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --wlc_const */ + double wlc_const = 0.; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "wlc_const", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &wlc_const, + "Initial constant term for wavelength adjustment (shift relative to half wavelength range).", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --use_input_kernel */ + cpl_boolean use_input_kernel = CPL_TRUE; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "use_input_kernel", + !range, dummyMin, dummyMax, CPL_TYPE_BOOL, &use_input_kernel, + "The parameters below are ignored if use_input_kernel.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --fit_res_box */ + cpl_boolean fit_res_box = CPL_FALSE; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "fit_res_box", + !range, dummyMin, dummyMax, CPL_TYPE_BOOL, &fit_res_box, + "Fit resolution by Boxcar LSF.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --relres_box */ + double relres_box = 0.; + double relres_box_Min = 0.; + double relres_box_Max = 2.; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "relres_box", + range, &relres_box_Min, &relres_box_Max, CPL_TYPE_DOUBLE, &relres_box, + "Initial value for FWHM of Boxcar rel. to slit width (Range between 0 and 2).", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --fit_res_gauss */ + cpl_boolean fit_res_gauss = CPL_TRUE; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "fit_res_gauss", + !range, dummyMin, dummyMax, CPL_TYPE_BOOL, &fit_res_gauss, + "Fit resolution by Gaussian.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --res_gauss */ + double res_gauss = -1.; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "res_gauss", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &res_gauss, + "Initial value for FWHM of the Gaussian in pixels (Default = -1: IZ=1.84, YJ=1.82, H=1.76, K=1.73, HK=2.06).", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --fit_res_lorentz */ + cpl_boolean fit_res_lorentz = CPL_FALSE; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "fit_res_lorentz", + !range, dummyMin, dummyMax, CPL_TYPE_BOOL, &fit_res_lorentz, + "Fit resolution by Lorentz.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --res_lorentz */ + double res_lorentz = 0.5; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "res_lorentz", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &res_lorentz, + "Initial value for FWHM of the Lorentz in pixels.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --kernmode */ + cpl_boolean kernmode = CPL_FALSE; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "kernmode", + !range, dummyMin, dummyMax, CPL_TYPE_BOOL, &kernmode, + "Voigt profile approx. or independent Gauss and Lorentz.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --kernfac */ + double kernfac = 5.; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "kernfac", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &kernfac, + "Size of Gaussian/Lorentz/Voigt kernel in FWHM..", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + /* --varkern */ + cpl_boolean varkern = CPL_FALSE; + e = kmos_molecfit_fill_parameter(RECIPE_NAME, self, "varkern", + !range, dummyMin, dummyMax, CPL_TYPE_BOOL, &varkern, + "Does the kernel size increase linearly with wavelength?.", CPL_FALSE); + if (e != CPL_ERROR_NONE) return (int)e; + + + /* Check possible errors */ + if (!cpl_errorstate_is_equal(prestate)) { + return cpl_error_set_message(cpl_func, cpl_error_get_code(), + "kmos_molecfit_model_fill_parameterlist failed!"); + } + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Check the string variables defined by the user (wave_range and molecules definition) + * + * @param grating Struct with the variables to check + * + * @return cpl_error_code + * + */ +/*----------------------------------------------------------------------------*/ +static cpl_error_code kmos_molecfit_model_check_wave_molec_conf( + kmos_grating *grating) +{ + /* Check input */ + cpl_error_ensure(grating, CPL_ERROR_NULL_INPUT, + return CPL_ERROR_NULL_INPUT, "grating input is NULL!"); + + cpl_error_ensure(grating->wave_range && grating->list_molec && grating->fit_molec && grating->relcol, CPL_ERROR_NULL_INPUT, + return CPL_ERROR_NULL_INPUT, "values of grating input are NULL!"); + + /* Init variables */ + char **tokens; + int n_tokens; + + + /*** Check wave_range variable ***/ + if (strcmp(grating->wave_range, "-1") != 0) { + + tokens = kmo_strsplit(grating->wave_range, ",", &n_tokens); + + /* Any token? */ + if (!tokens || n_tokens <= 0) { + if (tokens) kmo_strfreev(tokens); + return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, + "Unexpected error getting .wave_ranges!"); + } + + /* At least 2 parameters, Check even number of parameters */ + if (n_tokens % 2 != 0) { + kmo_strfreev(tokens); + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + ".wave_range haven't a even number of parameters"); + } + + /* Range of wavelenghts and direction */ + for (cpl_size i = 0; i < n_tokens / 2; i++) { + + cpl_size idx = i * 2; + double start = strtod(tokens[idx], NULL); + double end = strtod(tokens[idx + 1], NULL); + + /* Check the wavelength range - range of KMOS between 0.8 to 2.5 (um) */ + if (start < KMOS_WAVELENGTH_START || start > KMOS_WAVELENGTH_END || end < KMOS_WAVELENGTH_START || end > KMOS_WAVELENGTH_END) { + kmo_strfreev(tokens); + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "wavelength in '.wave_range' out of the valid range [%g,%g]", KMOS_WAVELENGTH_START, KMOS_WAVELENGTH_END); + } else if (start > end) { + kmo_strfreev(tokens); + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "wavelength in '.wave_range' starts before end , valid range [%g,%g]", KMOS_WAVELENGTH_START, KMOS_WAVELENGTH_END); + } + } + kmo_strfreev(tokens); + } + + /*** Check molec_list variable ***/ + if (strcmp(grating->list_molec, "-1") != 0 ){ + + tokens = kmo_strsplit(grating->list_molec, ",", &n_tokens); + + /* Any token? */ + if (!tokens || n_tokens <= 0) { + kmo_strfreev(tokens); + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "It's necessary at least one molecule in .list_molec"); + } + + /* Name of molecs */ + for (cpl_size i = 0; i < n_tokens; i++) { + + /* Check the name of the molecules */ + if (strcmp(tokens[i], "H2O") != 0 && + strcmp(tokens[i], "CH4") != 0 && + strcmp(tokens[i], "CO" ) != 0 && + strcmp(tokens[i], "CO2") != 0 && + strcmp(tokens[i], "O2" ) != 0 ){ + kmo_strfreev(tokens); + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Molecule unknown in .list_molec"); + } + } + kmo_strfreev(tokens); + } + + /*** Check fit_molec variable ***/ + if (strcmp(grating->fit_molec, "-1") != 0) { + + tokens = kmo_strsplit(grating->fit_molec, ",", &n_tokens); + + /* Any token? */ + if (!tokens || n_tokens <= 0) { + kmo_strfreev(tokens); + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "It's necessary the same number of values in .list_molec and .fit_molec"); + } + + /* Boolean value? */ + for (cpl_size i = 0; i < n_tokens; i++) { + int fit_molec = atoi(tokens[i]); + + if (fit_molec != 0 && fit_molec != 1) { + kmo_strfreev(tokens); + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Unexpected value in .fit_molec it'll be boolean, 0 or 1"); + } + } + kmo_strfreev(tokens); + } + + /*** Check relcol variable ***/ + if (strcmp(grating->relcol, "-1") != 0) { + + tokens = kmo_strsplit(grating->relcol, ",", &n_tokens); + + /* Any token? */ + if (!tokens || n_tokens <= 0) { + kmo_strfreev(tokens); + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "It's necessary the same number of values in .list_molec and .relcol"); + } + + /* Range between 0. to 1. ? */ + for (cpl_size j = 0; j < n_tokens; j++) { + double relcol = strtod(tokens[j], NULL); + if (relcol < 0. || relcol > 1.) { + kmo_strfreev(tokens); + return cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Unexpected value in .relcol, it's a fraction. It'll be < 0. or > 1."); + } + } + kmo_strfreev(tokens); + } + + + return CPL_ERROR_NONE; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Generate the internal configuration file for the recipe and check values + * + * @param list parameterlist with the parameters + * + * @return configuration file or NULL if exist an error + * + */ +/*----------------------------------------------------------------------------*/ +static kmos_molecfit_model_parameter * kmos_molecfit_model_conf( + const cpl_parameterlist *list) +{ + /* Check input */ + cpl_error_ensure(list, CPL_ERROR_NULL_INPUT, + return NULL, "list input is NULL!"); + + /* Get preState */ + cpl_errorstate preState = cpl_errorstate_get(); + const cpl_parameter *p; + + + /* Create the configuration parameter */ + kmos_molecfit_model_parameter *conf = (kmos_molecfit_model_parameter *)cpl_malloc(sizeof(kmos_molecfit_model_parameter)); + kmos_molecfit_nullify(&(conf->mf)); + + /* Initialize input parameters propertylist */ + conf->mf.parms = cpl_propertylist_new(); + + + /*** Mapping IFUs in kmos_molecfit_model recipe, correspondence 1 to 1 ***/ + for (cpl_size n_ifu = 0; n_ifu < N_IFUS; n_ifu++) { + conf->mf.ifus[n_ifu].map = n_ifu + 1; + } + + + /*** What IFUs Do I need to process? ***/ + p = cpl_parameterlist_find_const(list, "process_ifus"); + conf->process_ifus = cpl_parameter_get_string(p); + if (strcmp(conf->process_ifus, "-1") == 0) { + + /* Process all IFUs by default */ + cpl_msg_info(cpl_func, "Processing all IFUs (by default) ... "); + for (cpl_size n_ifu = 0; n_ifu < N_IFUS; n_ifu++) { + conf->mf.ifus[n_ifu].process = CPL_TRUE; + } + + } else { + + /* Initialize process IFUs to CPL_FALSE */ + for (cpl_size n_ifu = 0; n_ifu < N_IFUS; n_ifu++) { + conf->mf.ifus[n_ifu].process = CPL_FALSE; + } + + /* Init variables */ + int n_tokens; + char **tokens = kmo_strsplit(conf->process_ifus, ",", &n_tokens); + + /* Any token? */ + if (!tokens || n_tokens <= 0) { + kmo_strfreev(tokens); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "proccess_IFU empty. It's necessary to process some IFU"); + return NULL; + } + + /* Set process IFUs */ + for (cpl_size i = 0; i < n_tokens; i++) { + int n_ifu = atoi(tokens[i]); + + /* Number of IFU correct */ + if (n_ifu <1 || n_ifu > 24) { + kmo_strfreev(tokens); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Incorrect value in process_ifus. It need to be from 1 to 24"); + return NULL; + } + + /* Process this IFU */ + cpl_msg_info(cpl_func, "Processing IFU.%02d (assigned by the user) ... ", n_ifu); + conf->mf.ifus[n_ifu - 1].process = CPL_TRUE; + } + kmo_strfreev(tokens); + } + + + /*** Wavelenght ranges & molecules: Defined by the user ****/ + + /* Get string iwht the list of wavelenght for the grating defined by the user */ + p = cpl_parameterlist_find_const(list, "wave_range"); + conf->mf.grating.wave_range = cpl_parameter_get_string(p); + + /* Get string with the list of molecules for the grating defined by the user */ + p = cpl_parameterlist_find_const(list, "list_molec"); + conf->mf.grating.list_molec = cpl_parameter_get_string(p); + + /* Get string with the fit list of molecules for this grating */ + p = cpl_parameterlist_find_const(list, "fit_molec"); + conf->mf.grating.fit_molec = cpl_parameter_get_string(p); + + /* Get string with the relcol list of molecules for this grating */ + p = cpl_parameterlist_find_const(list, "relcol"); + conf->mf.grating.relcol = cpl_parameter_get_string(p); + + /* Check values defined by the user */ + if (kmos_molecfit_model_check_wave_molec_conf(&(conf->mf.grating)) != CPL_ERROR_NONE) { + kmos_molecfit_model_clean(conf); + return NULL; + } + + + /*** Convergence criterion ***/ + + p = cpl_parameterlist_find_const(list, "ftol"); + conf->ftol = cpl_parameter_get_double(p); + if (conf->ftol < 1.e-10) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + ".ftol out of the valid range"); + return NULL; + } + + p = cpl_parameterlist_find_const(list, "xtol"); + conf->xtol = cpl_parameter_get_double(p); + if (conf->xtol < 1.e-10) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + ".xtol out of the valid range"); + return NULL; + } + + + /*** Continuum ***/ + + p = cpl_parameterlist_find_const(list, "fit_cont"); + conf->mf.fit_continuum.fit = cpl_parameter_get_bool(p); + if (cpl_error_get_code() != CPL_ERROR_NONE) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Unexpected value in .fit_cont it'll be boolean, 0 or 1"); + return NULL; + } + + p = cpl_parameterlist_find_const(list, "cont_n"); + conf->mf.fit_continuum.n = cpl_parameter_get_int(p); + if (conf->mf.fit_continuum.n < 0 || conf->mf.fit_continuum.n > MOLECFIT_MAX_POLY_FIT) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + ".cont_n out of the valid range"); + return NULL; + } + + + /*** Wavelength solution fit/adjustment ***/ + + p = cpl_parameterlist_find_const(list, "fit_wlc"); + conf->mf.fit_wavelenght.fit = cpl_parameter_get_bool(p); + if (cpl_error_get_code() != CPL_ERROR_NONE) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Unexpected value in .fit_wlc it'll be boolean, 0 or 1"); + return NULL; + } + + p = cpl_parameterlist_find_const(list, "wlc_n"); + conf->mf.fit_wavelenght.n = cpl_parameter_get_int(p); + if (conf->mf.fit_wavelenght.n < 1 || conf->mf.fit_wavelenght.n > MOLECFIT_MAX_POLY_FIT) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + ".wlc_n out of the valid range"); + return NULL; + } + + p = cpl_parameterlist_find_const(list, "wlc_const"); + conf->mf.fit_wavelenght.const_val = cpl_parameter_get_double(p); + if (conf->mf.fit_wavelenght.const_val < 0.) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + ".wlc_const out of the valid range"); + return NULL; + } + + + /*** User input kernel ? ***/ + p = cpl_parameterlist_find_const(list, "use_input_kernel"); + conf->mf.use_input_kernel = cpl_parameter_get_bool(p); + if (cpl_error_get_code() != CPL_ERROR_NONE) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Unexpected value in .use_input_kernel it'll be boolean, 0 or 1"); + return NULL; + } + + + /*** Default kernel: Boxcar kernel ***/ + p = cpl_parameterlist_find_const(list, "fit_res_box"); + conf->boxcar.fit = cpl_parameter_get_bool(p); + if (cpl_error_get_code() != CPL_ERROR_NONE) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Unexpected value in .fit_res_box it'll be boolean, 0 or 1"); + return NULL; + } + p = cpl_parameterlist_find_const(list, "relres_box"); + conf->boxcar.res = cpl_parameter_get_double(p); + if (conf->boxcar.res < 0. || conf->boxcar.res > 2.) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + ".relres_box out of the valid range"); + return NULL; + } + + + /*** Default kernel: Gaussian kernel ***/ + p = cpl_parameterlist_find_const(list, "fit_res_gauss"); + conf->gauss.fit = cpl_parameter_get_bool(p); + if (cpl_error_get_code() != CPL_ERROR_NONE) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Unexpected value in .fit_res_gauss it'll be boolean, 0 or 1"); + return NULL; + } + p = cpl_parameterlist_find_const(list, "res_gauss"); + conf->gauss.res = cpl_parameter_get_double(p); + if (conf->gauss.res != -1. && conf->gauss.res < 0.01) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + ".res_gauss out of the valid range"); + return NULL; + } + + /*** Default kernel: Lorentz kernel ***/ + p = cpl_parameterlist_find_const(list, "fit_res_lorentz"); + conf->lorentz.fit = cpl_parameter_get_bool(p); + if (cpl_error_get_code() != CPL_ERROR_NONE) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Unexpected value in .fit_res_lorentz it'll be boolean, 0 or 1"); + return NULL; + } + p = cpl_parameterlist_find_const(list, "res_lorentz"); + conf->lorentz.res = cpl_parameter_get_double(p); + if (conf->lorentz.res < 0. || conf->lorentz.res > 100.) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + ".res_lorentz out of the valid range"); + return NULL; + } + + + /*** Default kernels: Generic parameters ***/ + + p = cpl_parameterlist_find_const(list, "kernmode"); + conf->mf.kernmode = cpl_parameter_get_bool(p); + if (cpl_error_get_code() != CPL_ERROR_NONE) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Unexpected value in .kernmode it'll be boolean, 0 or 1"); + return NULL; + } + + p = cpl_parameterlist_find_const(list, "kernfac"); + conf->mf.kernfac = cpl_parameter_get_double(p); + if (conf->mf.kernfac < 3. || conf->mf.kernfac > 300.) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + ".kernfac out of the valid range"); + return NULL; + } + + p = cpl_parameterlist_find_const(list, "varkern"); + conf->mf.varkern = cpl_parameter_get_bool(p); + if (cpl_error_get_code() != CPL_ERROR_NONE) { + kmos_molecfit_model_clean(conf); + cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT, + "Unexpected value in .varkern it'll be boolean, 0 or 1"); + return NULL; + } + + + /* Save parameter in the output propertylist */ + + cpl_propertylist_update_string(conf->mf.parms, KMOS_MF_PARAM_RECIPE"PROCESS_IFUS", conf->process_ifus); + + cpl_propertylist_update_string(conf->mf.parms, KMOS_MF_PARAM_RECIPE"WAVE_RANGE", conf->mf.grating.wave_range); + cpl_propertylist_update_string(conf->mf.parms, KMOS_MF_PARAM_RECIPE"LIST_MOLEC", conf->mf.grating.list_molec); + cpl_propertylist_update_string(conf->mf.parms, KMOS_MF_PARAM_RECIPE"FIT_MOLEC", conf->mf.grating.fit_molec); + cpl_propertylist_update_string(conf->mf.parms, KMOS_MF_PARAM_RECIPE"RECOL", conf->mf.grating.relcol); + + cpl_propertylist_update_double(conf->mf.parms, KMOS_MF_PARAM_RECIPE"FTOL", conf->ftol); + cpl_propertylist_update_double(conf->mf.parms, KMOS_MF_PARAM_RECIPE"XTOL", conf->xtol); + + cpl_propertylist_update_bool( conf->mf.parms, KMOS_MF_PARAM_RECIPE"FIT_CONT", conf->mf.fit_continuum.fit); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"CONT_N", conf->mf.fit_continuum.n); + + cpl_propertylist_update_bool( conf->mf.parms, KMOS_MF_PARAM_RECIPE"FIT_WLC", conf->mf.fit_wavelenght.fit); + cpl_propertylist_update_int( conf->mf.parms, KMOS_MF_PARAM_RECIPE"WLC_N", conf->mf.fit_wavelenght.n); + cpl_propertylist_update_double(conf->mf.parms, KMOS_MF_PARAM_RECIPE"WLC_CONST", conf->mf.fit_wavelenght.const_val); + + cpl_propertylist_update_bool( conf->mf.parms, KMOS_MF_PARAM_RECIPE"USE_INPUT_KERNEL", conf->mf.use_input_kernel); + cpl_propertylist_update_bool( conf->mf.parms, KMOS_MF_PARAM_RECIPE"KERNMODE", conf->mf.kernmode); + cpl_propertylist_update_double(conf->mf.parms, KMOS_MF_PARAM_RECIPE"KERNFAC", conf->mf.kernfac); + cpl_propertylist_update_bool( conf->mf.parms, KMOS_MF_PARAM_RECIPE"VARKERN", conf->mf.varkern); + + cpl_propertylist_update_bool( conf->mf.parms, KMOS_MF_PARAM_RECIPE"FIT_RES_BOX", conf->boxcar.fit); + cpl_propertylist_update_double(conf->mf.parms, KMOS_MF_PARAM_RECIPE"RELRES_BOX", conf->boxcar.res); + + cpl_propertylist_update_bool( conf->mf.parms, KMOS_MF_PARAM_RECIPE"FIT_RES_GAUSS", conf->gauss.fit); + cpl_propertylist_update_double(conf->mf.parms, KMOS_MF_PARAM_RECIPE"RES_GAUSS", conf->gauss.res); + + cpl_propertylist_update_bool( conf->mf.parms, KMOS_MF_PARAM_RECIPE"FIT_RES_LORENTZ", conf->lorentz.fit); + cpl_propertylist_update_double(conf->mf.parms, KMOS_MF_PARAM_RECIPE"RES_LORENTZ", conf->lorentz.res); + + + /* Check status */ + if (!cpl_errorstate_is_equal(preState)) { + /* Configuration failed */ + kmos_molecfit_model_clean(conf); + return NULL; + } else { + /* Configuration successfully */ + return conf; + } +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Function needed to fill the molecfit configuration file + * + * @param conf Recipe configuration. + * @param ifu Concrete IFU for whitch generate the molecfit configuration + * @param type Concrete grating + * + * @return parameterlist with contain the config to molecfit or NULL if error + * + */ +/*----------------------------------------------------------------------------*/ +static cpl_parameterlist * kmos_molecfit_model_mf_conf( + kmos_molecfit_model_parameter *conf, kmos_spectrum *ifu, kmos_grating_type type) +{ + /* Check inputs */ + cpl_error_ensure(conf && ifu, CPL_ERROR_NULL_INPUT, + return NULL, "Any input is NULL!"); + + /* Add the config values necessaries to execute molecfit */ + cpl_errorstate prestate = cpl_errorstate_get(); + + + /*** Building generic configuration molecfic file ***/ + cpl_parameterlist *mf_config = kmos_molecfit_conf_generic(RECIPE_NAME, &(conf->mf)); + if (!mf_config) { + return NULL; + } + + + /*** Set molecfit configuration with recipe parameters ***/ + cpl_error_code e = CPL_ERROR_NONE; + cpl_boolean range = CPL_TRUE; + const void *dummyMin = NULL; + const void *dummyMax = NULL; + int boolMin = 0; + int boolMax = 1; + + /* --ftol */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "ftol", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &(conf->ftol), + "molecfit", CPL_TRUE); + + /* --xtol */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "xtol", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &(conf->xtol), + "molecfit", CPL_TRUE); + + /* --fit_cont */ + int cont_fit = conf->mf.fit_continuum.fit; + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "fit_cont", + range, &boolMin, &boolMax, CPL_TYPE_INT, &cont_fit, + "molecfit", CPL_TRUE); + + /* --cont_n */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "cont_n", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &(conf->mf.fit_continuum.n), + "molecfit", CPL_TRUE); + + /* --cont_const -> Spectrum data dependency, Calculate median (ifu->median) of the input spectrum (ifu->data) */ + double cont_const = ifu->median; + cpl_msg_info(cpl_func,"--.cont_const = %g", cont_const); + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "cont_const", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &cont_const, + "molecfit", CPL_TRUE); + + /* --fit_wlc */ + int wlc_fit = conf->mf.fit_wavelenght.fit; + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "fit_wlc", + range, &boolMin, &boolMax, CPL_TYPE_INT, &wlc_fit, + "molecfit", CPL_TRUE); + + /* --wlc_n */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "wlc_n", + !range, dummyMin, dummyMax, CPL_TYPE_INT, &(conf->mf.fit_wavelenght.n), + "molecfit", CPL_TRUE); + + /* --wlc_const */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "wlc_const", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &(conf->mf.fit_wavelenght.const_val), + "molecfit", CPL_TRUE); + + /* --fit_res_box */ + int boxcar_fit = conf->boxcar.fit; + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "fit_res_box", + range, &boolMin, &boolMax, CPL_TYPE_INT, &boxcar_fit, + "molecfit", CPL_TRUE); + + /* --relres_box */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "relres_box", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &(conf->boxcar.res), + "molecfit", CPL_TRUE); + + /* --fit_res_gauss */ + int gauss_fit = conf->gauss.fit; + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "fit_res_gauss", + range, &boolMin, &boolMax, CPL_TYPE_INT, &gauss_fit, + "molecfit", CPL_TRUE); + + /* --res_gauss -> Grating dependency, set with the define constant values */ + double res_gauss = conf->gauss.res; + if (res_gauss == -1.) { + switch(type) { + case GRATING_IZ: res_gauss = RES_GAUSS_IZ; break; + case GRATING_YJ: res_gauss = RES_GAUSS_YJ; break; + case GRATING_H: res_gauss = RES_GAUSS_H; break; + case GRATING_K: res_gauss = RES_GAUSS_K; break; + case GRATING_HK: res_gauss = RES_GAUSS_HK; break; + } + cpl_msg_info(cpl_func,"--.res_gauss by default = %g", res_gauss); + } else { + cpl_msg_info(cpl_func,"--.res_gauss by the user = %g", res_gauss); + } + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "res_gauss", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &res_gauss, + "molecfit", CPL_TRUE); + + /* --fit_res_lorentz */ + int lorentz_fit = conf->lorentz.fit; + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "fit_res_lorentz", + range, &boolMin, &boolMax, CPL_TYPE_INT, &lorentz_fit, + "molecfit", CPL_TRUE); + + /* --res_lorentz */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "res_lorentz", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &(conf->lorentz.res), + "molecfit", CPL_TRUE); + + + + /*** PARAMETERS NOT INCLUDED IN THE RECIPE: HARD-CODED ***/ + + + /* --trans: spectrum_type (The range is between 0 to 2, KMOS need 1 - TRANSMISSION) */ + int trans = 1; /* Molecfit default: 1 */ + int trans_min = 0; + int trans_max = 2; + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "trans", + range, &trans_min, &trans_max, CPL_TYPE_INT, &trans, + "molecfit", CPL_TRUE); + + /* --fit_back */ + int fit_back = 0; /* Molecfit default: 1 */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "fit_back", + range, &boolMin, &boolMax, CPL_TYPE_INT, &fit_back, + "molecfit", CPL_TRUE); + + /* --telback */ + double telback = 0.1; /* Molecfit default: 0.1 */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "telback", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &telback, + "molecfit", CPL_TRUE); + + /* --flux_unit */ + int flux_unit = 0; /* Molecfit default: 0 */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "flux_unit", + range, &boolMin, &boolMax, CPL_TYPE_INT, &flux_unit, + "molecfit", CPL_TRUE); + + /* --default_error */ + double default_error = 0.01; /* Molecfit default: 0.01 */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "default_error", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &default_error, + "molecfit", CPL_TRUE); + + /* --ref_atm */ + const char *ref_atm = "equ.atm"; /* Molecfit default: "equ.atm" */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "ref_atm", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)ref_atm, + "molecfit", CPL_TRUE); + + /* --gdas_prof */ + const char *gdas_prof = "auto"; /* Molecfit default: "auto" */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "gdas_prof", + !range, dummyMin, dummyMax, CPL_TYPE_STRING, (const void *)gdas_prof, + "molecfit", CPL_TRUE); + + /* --layers */ + int layers = 1; /* Molecfit default: 1 */ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "layers", + range, &boolMin, &boolMax, CPL_TYPE_INT, &layers, + "molecfit", CPL_TRUE); + + /* --emix */ + double emix = 5.; /* Molecfit default: 5.*/ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "emix", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &emix, + "molecfit", CPL_TRUE); + + /* --pwv */ + double pwv = -1.; /* Molecfit default: -1.*/ + if(!e) e = kmos_molecfit_fill_parameter(RECIPE_NAME, mf_config, "pwv", + !range, dummyMin, dummyMax, CPL_TYPE_DOUBLE, &pwv, + "molecfit", CPL_TRUE); + + + /*** Check possible errors ***/ + if (!cpl_errorstate_is_equal(prestate) || e != CPL_ERROR_NONE) { + cpl_parameterlist_delete(mf_config); + cpl_error_set_message(cpl_func, cpl_error_get_code(), + "Building molecfit configuration variable failed!"); + return NULL; + } + + return mf_config; +} + +/*----------------------------------------------------------------------------*/ +/** + * @brief Deallocate the given parameter configuration object and its contents + * + * @param conf The parameter configuration variable in the recipe. + */ +/*----------------------------------------------------------------------------*/ +static void kmos_molecfit_model_clean( + kmos_molecfit_model_parameter *conf) +{ + if (conf) { + + kmos_molecfit_clean(&(conf->mf)); + + cpl_free(conf); + } +} diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_reconstruct.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_reconstruct.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_reconstruct.c 2016-04-04 13:19:20.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_reconstruct.c 2018-04-09 13:42:16.000000000 +0000 @@ -76,7 +76,8 @@ " ARC_ON or RAW/F2D \n" " OBJECT or RAW \n" " STD or RAW \n" -" SCIENCE RAW \n" +" SCIENCE or RAW \n" +" ACQUISITION RAW \n" " XCAL F2D x-direction calib. frame Y 1 \n" " YCAL F2D y-direction calib. frame Y 1 \n" " LCAL F2D Wavelength calib. frame Y 1 \n" @@ -415,12 +416,18 @@ } else if (cpl_frameset_count_tags(frameset, OBJECT) == 1) { input_frame_name = OBJECT; output_frame_name = CUBE_OBJECT; + } else if (cpl_frameset_count_tags(frameset, ACQUISITION) == 1) { + input_frame_name = ACQUISITION; + output_frame_name = CUBE_ACQUISITION; } else if (cpl_frameset_count_tags(frameset, STD) == 1) { input_frame_name = STD; output_frame_name = CUBE_STD; } else if (cpl_frameset_count_tags(frameset, SCIENCE) == 1) { input_frame_name = SCIENCE; output_frame_name = CUBE_SCIENCE; + } else if (cpl_frameset_count_tags(frameset, ACQUISITION) == 1) { + input_frame_name = SCIENCE; + output_frame_name = CUBE_SCIENCE; } else { cpl_msg_error(__func__, "Missing Inputs") ; cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; @@ -501,7 +508,7 @@ cpl_table_delete(band_table); /* Create empty detector images */ - if (detectorimage == TRUE) { + if (detectorimage) { det_img_data = cpl_image_new( gd.x.dim*gd.y.dim*KMOS_IFUS_PER_DETECTOR, gd.l.dim, CPL_TYPE_FLOAT); @@ -630,17 +637,22 @@ } // IFUs loop if (detectorimage) { + /* Save Product (detector image) Data Cube */ index = kmo_identify_index(cpl_frame_get_filename(input_frame), i, FALSE); + tmp_header = kmclipm_propertylist_load( cpl_frame_get_filename(input_frame), index); - kmo_save_det_img_ext(det_img_data, gd, i, DET_IMG_REC, - obs_suffix, tmp_header, FALSE, FALSE); - cpl_propertylist_delete(tmp_header); - cpl_image_delete(det_img_data); + if (det_img_data) { + kmo_save_det_img_ext(det_img_data, gd, i, DET_IMG_REC, + obs_suffix, tmp_header, FALSE, FALSE); + cpl_image_delete(det_img_data); + } + cpl_propertylist_delete(tmp_header); if (detImgCube) { + /* Save Product (detector image) Noise Cube */ /* Index changes (*2) if Noise extensions are there */ if (desc1.ex_noise) { @@ -649,11 +661,13 @@ } tmp_header = kmclipm_propertylist_load( cpl_frame_get_filename(input_frame), index); - kmo_save_det_img_ext(det_img_noise, gd, i, DET_IMG_REC, - obs_suffix, tmp_header, FALSE, TRUE); + if (det_img_noise) { + kmo_save_det_img_ext(det_img_noise, gd, i, DET_IMG_REC, + obs_suffix, tmp_header, FALSE, TRUE); + } cpl_propertylist_delete(tmp_header); } - cpl_image_delete(det_img_noise); + if (det_img_noise) cpl_image_delete(det_img_noise); } } // Detectors loop cpl_propertylist_delete(main_header); @@ -694,6 +708,7 @@ cpl_frameset_count_tags(frameset, FLAT_ON) != 1 && cpl_frameset_count_tags(frameset, ARC_ON) != 1 && cpl_frameset_count_tags(frameset, OBJECT) != 1 && + cpl_frameset_count_tags(frameset, ACQUISITION) != 1 && cpl_frameset_count_tags(frameset, STD) != 1 && cpl_frameset_count_tags(frameset, SCIENCE) != 1) { cpl_msg_error(__func__, "1 data frame must be provided") ; diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_sci_red.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_sci_red.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_sci_red.c 2016-12-21 15:24:20.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_sci_red.c 2018-04-20 09:29:02.000000000 +0000 @@ -59,8 +59,15 @@ int ifu_nr, int is_noise, int no_subtract, + const char * telluric_tag, int * ifu_nr_telluric) ; +static int kmos_sci_red_propagate_qc( + const cpl_propertylist * main_input, + cpl_propertylist * to_update, + const cpl_frame * inframe, + int det_nr) ; + static double kmos_sci_red_get_f0(const char *, int, double, double) ; static double kmos_sci_red_get_zpoint(cpl_frame *, int) ; static int kmos_sci_red_check_inputs(cpl_frameset *, double, int *); @@ -100,6 +107,7 @@ " 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" +" TELLURIC_GEN F1I normalised telluric spectrum N 0,1 \n" " OH_SPEC F1S Vector holding OH lines N 0,1 \n" "\n" " Output files:\n" @@ -549,14 +557,14 @@ * fn_reconstr ; /*********************/ - double scaling, conversion, f_0, zpoint, dit, angle ; + double scaling, conversion, f_0, zpoint, dit, angle; int print_once, cube_counter_data, cube_counter_noise, do_sky_subtraction, suppress_index, mapping_id, nb_science, nb_telluric, nb_illum_corr, telluric_ok, actual_msg_level, nr_data, discard_subband, stretch, stretch_degree, stretch_resampling, skip_sky_oh ; int i, j, jj, sf, ifu_nr, sky_ifu_nr, det_nr, ifu_nr_telluric ; char * suffix ; - char * mapping_mode ; + const char * mapping_mode ; char * extname ; char * keyword ; char ** split ; @@ -579,7 +587,7 @@ cpl_propertylist * main_header ; cpl_propertylist * keys_plist ; char * reflex_suffix ; - int * qc_output_unit ; + int * qc_output_unit = NULL; int * bounds ; gridDefinition gd ; armNameStruct * arm_name_struct ; @@ -608,26 +616,34 @@ cpl_imagelist * tmp_cube1 ; cpl_imagelist * tmp_cube2 ; cpl_imagelist * new_sky ; - cpl_imagelist * result ; cpl_image * tmpImg ; cpl_image * exp_mask ; cpl_image * illum_data ; - cpl_image * illum_noise ; cpl_imagelist ** cube_data ; cpl_imagelist ** cube_noise ; - cpl_imagelist ** cube_interim_object ; - cpl_imagelist ** cube_interim_sky ; + cpl_imagelist ** cube_interim_object = NULL; + cpl_imagelist ** cube_interim_sky = NULL; cpl_propertylist ** header_data ; cpl_propertylist ** header_noise ; - cpl_propertylist ** header_sky ; + cpl_propertylist ** header_sky = NULL; kmclipm_vector * telluric_data ; kmclipm_vector * telluric_noise ; + const char * telluric_tag ; + + + + /* Check initial Entries */ + if (kmos_check_and_set_groups(frameset) != CPL_ERROR_NONE) { + return cpl_error_get_code(); + } + /* Initialise */ + telluric_tag = TELLURIC ; print_once = FALSE ; cube_counter_data = cube_counter_noise = 0 ; do_sky_subtraction = FALSE ; @@ -636,13 +652,6 @@ combined_data = combined_noise = NULL ; sky_as_object_frame = NULL ; - /* Check entries */ - if (parlist == NULL || frameset == NULL) { - cpl_msg_error(__func__, "Null Inputs") ; - cpl_error_set(__func__, CPL_ERROR_NULL_INPUT) ; - return -1 ; - } - /* Get parameters */ par = cpl_parameterlist_find_const(parlist, "kmos.kmos_sci_red.flux"); flux = cpl_parameter_get_bool(par); @@ -810,13 +819,6 @@ "--no_combine set to TRUE (1 SCIENCE frame or --no_subtract"); } - /* Identify the RAW and CALIB frames in the input frameset */ - if (kmo_dfs_set_groups(frameset) != 1) { - cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ; - cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; - return -1 ; - } - /* Check the inputs consistency */ if (kmos_sci_red_check_inputs(frameset, pix_scale, &mapping_id) != 1) { cpl_msg_error(__func__, "Input frameset is not consistent") ; @@ -937,12 +939,17 @@ /* Check Telluric availability for each Object */ /* in mapping-mode check if for all IFUs there is either no */ /* telluric at all or the same number of tellurics than object names */ - nb_telluric = cpl_frameset_count_tags(frameset, TELLURIC); + nb_telluric = cpl_frameset_count_tags(frameset, TELLURIC_GEN); + if (nb_telluric == 0) { + nb_telluric = cpl_frameset_count_tags(frameset, telluric_tag); + } else { + telluric_tag = TELLURIC_GEN ; + } if (nb_telluric > 0 && mapping_id > 0) { for (i = 0; i < arm_name_struct->nrNames; i++) { if (arm_name_struct->telluricCnt[i] != arm_name_struct->namesCnt[i] && (arm_name_struct->telluricCnt[i] != 0)) { - cpl_msg_error(__func__, "Mosaics need a TELLURIC per detector"); + cpl_msg_error(__func__, "Mosaics need a telluric per detector"); cpl_error_set(__func__, CPL_ERROR_UNSUPPORTED_MODE) ; return -1 ; } @@ -974,16 +981,18 @@ kmo_free_unused_ifus(unused_ifus_after); cpl_free(bounds); kmo_delete_armNameStruct(arm_name_struct); - cpl_free(qc_output_unit) ; + + if (qc_output_unit) cpl_free(qc_output_unit) ; + cpl_free(cube_data) ; cpl_free(cube_noise) ; cpl_free(header_data) ; cpl_free(header_noise) ; - if (save_interims) { - cpl_free(cube_interim_object) ; - cpl_free(cube_interim_sky) ; - cpl_free(header_sky) ; - } + + if (cube_interim_object) cpl_free(cube_interim_object) ; + if (cube_interim_sky ) cpl_free(cube_interim_sky ) ; + if (header_sky ) cpl_free(header_sky ) ; + cpl_msg_error(__func__, "Cannot Load main header"); cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; return -1 ; @@ -1010,6 +1019,10 @@ EXTNAME, extname, "FITS extension name"); cpl_free(extname); + /* Inherit some QCs */ + kmos_sci_red_propagate_qc(main_header, header_data[ifu_nr-1], + lcal_frame, det_nr) ; + if (arm_name_struct->name_ids[ifu_nr-1+sf*KMOS_NR_IFUS] >= 1) { // IFU is valid @@ -1193,7 +1206,7 @@ /* Apply the SKY tweaking */ tmp_cube2 = kmos_priv_sky_tweak(cube_data[ifu_nr-1], tmp_cube1, header_data[ifu_nr-1], .3, tbsub, - ifu_nr, discard_subband, stretch, stretch_degree, + discard_subband, stretch, stretch_degree, stretch_resampling, 0, &new_sky); cpl_imagelist_delete(cube_data[ifu_nr-1]); cpl_imagelist_delete(tmp_cube1); @@ -1248,9 +1261,11 @@ if (telluric_ok) { telluric_data = kmo_tweak_load_telluric(frameset, - ifu_nr, FALSE, no_subtract, &ifu_nr_telluric); + ifu_nr, FALSE, no_subtract, + telluric_tag, &ifu_nr_telluric); if (telluric_data != NULL) { - telluric_frame=kmo_dfs_get_frame(frameset,TELLURIC); + telluric_frame = + kmo_dfs_get_frame(frameset, telluric_tag); kmo_init_fits_desc(&desc_telluric); desc_telluric=kmo_identify_fits_header( cpl_frame_get_filename(telluric_frame)); @@ -1262,7 +1277,7 @@ /* Load noise if present */ telluric_noise = kmo_tweak_load_telluric( frameset,ifu_nr, TRUE, no_subtract, - &ifu_nr_telluric); + telluric_tag, &ifu_nr_telluric); } else { telluric_noise = NULL ; } @@ -1387,6 +1402,10 @@ reflex_suffix) ; cpl_free(reflex_suffix) ; + /* Add PRO MJD-OBS */ + cpl_propertylist_update_double(keys_plist, "ESO PRO MJD-OBS", + kmos_pfits_get_mjd_obs(main_header)) ; + /* Create Primary Header */ kmo_dfs_save_main_header(frameset, fn_out, fn_suffix, arm_name_struct->obj_sky_struct->table[sf].objFrame, @@ -1417,25 +1436,34 @@ "ESO QC CUBE_UNIT", "ADU/sec", "Cube Unit"); } else { kmclipm_update_property_string(header_data[ifu_nr-1], - "ESO QC CUBE_UNIT", "ERG/sec/cm2/A", "Cube Unit"); + "ESO QC CUBE_UNIT", + "erg.s**(-1).cm**(-2).angstrom**(-1)", "Cube Unit"); if (header_noise[ifu_nr-1] != NULL) kmclipm_update_property_string(header_noise[ifu_nr-1], - "ESO QC CUBE_UNIT", "ERG/sec/cm2/A", + "ESO QC CUBE_UNIT", + "erg.s**(-1).cm**(-2).angstrom**(-1)", "Cube Unit"); } /* Save data Extension */ + if (cube_data[ifu_nr-1] == NULL) + kmos_all_clean_plist(header_data[ifu_nr-1]) ; kmo_dfs_save_cube(cube_data[ifu_nr-1], fn_out, fn_suffix, header_data[ifu_nr-1], 0./0.); cpl_imagelist_delete(cube_data[ifu_nr-1]); + cube_data[ifu_nr-1] = NULL ; /* Save noise Extension */ if (cube_counter_noise > 0) { + if (cube_noise[ifu_nr-1] == NULL) + kmos_all_clean_plist(header_noise[ifu_nr-1]) ; kmo_dfs_save_cube(cube_noise[ifu_nr-1], fn_out, fn_suffix, header_noise[ifu_nr-1], 0./0.); } cpl_propertylist_delete(header_noise[ifu_nr-1]); + header_noise[ifu_nr-1] = NULL ; cpl_imagelist_delete(cube_noise[ifu_nr-1]); + cube_noise[ifu_nr-1] = NULL ; /* save intermediate products (only in sky tweak case */ if (save_interims && (sky_as_object_frame != NULL)) { @@ -1447,10 +1475,14 @@ 0./0.); } cpl_propertylist_delete(header_data[ifu_nr-1]); + header_data[ifu_nr-1] = NULL ; if (save_interims) { cpl_imagelist_delete(cube_interim_object[ifu_nr-1]); + cube_interim_object[ifu_nr-1] = NULL ; cpl_imagelist_delete(cube_interim_sky[ifu_nr-1]); + cube_interim_sky[ifu_nr-1] = NULL ; cpl_propertylist_delete(header_sky[ifu_nr-1]); + header_sky[ifu_nr-1] = NULL ; } } cpl_free(fn_suffix); @@ -1458,7 +1490,9 @@ cpl_msg_info(__func__, " > all IFUs invalid, don't save"); for (ifu_nr = 1; ifu_nr <= KMOS_NR_IFUS; ifu_nr++) { cpl_propertylist_delete(header_data[ifu_nr-1]); + header_data[ifu_nr-1] = NULL ; cpl_propertylist_delete(header_noise[ifu_nr-1]); + header_noise[ifu_nr-1] = NULL ; } } cpl_propertylist_delete(main_header) ; @@ -1478,7 +1512,9 @@ kmo_print_unused_ifus(unused_ifus_after, TRUE); kmo_free_unused_ifus(unused_ifus_after); + /***********/ /* Combine */ + /***********/ suppress_index = 0; if (!no_combine) { cpl_msg_info(__func__, "Combining reconstructed objects"); @@ -1657,19 +1693,24 @@ "ESO PRO REFLEX SUFFIX", reflex_suffix) ; cpl_free(reflex_suffix); - // save combined cube + /* Save Products */ tmp_frame = kmo_dfs_get_frame(frameset, RECONSTRUCTED_CUBE); + /* Save Combined Cube Main Header */ kmo_dfs_save_main_header(frameset, fn_out, fn_suffix, tmp_frame, keys_plist, parlist, cpl_func); + /* Save Mask Main Header */ kmo_dfs_save_main_header(frameset, EXP_MASK, fn_suffix, tmp_frame, keys_plist, parlist, cpl_func); cpl_propertylist_delete(keys_plist) ; + /* Save Combined Cube Data */ kmo_dfs_save_cube(combined_data, fn_out, fn_suffix, header_data[0], 0./0.); + /* Save Mask Data */ kmo_dfs_save_image(exp_mask, EXP_MASK, fn_suffix, header_data[0], 0./0.); cpl_image_delete(exp_mask); + /* Save Combined Cube Noise */ if (header_noise[0] == NULL) { header_noise[0]=cpl_propertylist_duplicate(header_data[0]); tmp_str=cpl_propertylist_get_string(header_data[0],EXTNAME); @@ -1909,7 +1950,8 @@ int * mapping_id) { int nb_science, nb_xcal, nb_ycal, nb_lcal, nb_wave_band, - nb_master_flat, nb_illum_corr, nb_telluric, nb_oh_spec ; + nb_master_flat, nb_illum_corr, nb_telluric, nb_oh_spec, + nb_telluric_gen ; cpl_error_code err ; const cpl_frame * frame1 ; const cpl_frame * frame2 ; @@ -1931,6 +1973,7 @@ nb_master_flat = cpl_frameset_count_tags(frameset, MASTER_FLAT); nb_illum_corr = cpl_frameset_count_tags(frameset, ILLUM_CORR); nb_telluric = cpl_frameset_count_tags(frameset, TELLURIC); + nb_telluric_gen = cpl_frameset_count_tags(frameset, TELLURIC_GEN); nb_oh_spec = cpl_frameset_count_tags(frameset, OH_SPEC) ; /* Checks */ @@ -1972,6 +2015,8 @@ MASTER_FLAT, TRUE, FALSE, TRUE); if (nb_telluric > 0) err += kmo_check_frame_setup(frameset, XCAL, TELLURIC, TRUE, FALSE, TRUE); + if (nb_telluric_gen > 0) err += kmo_check_frame_setup(frameset, XCAL, + TELLURIC_GEN, TRUE, FALSE, TRUE); if (nb_oh_spec > 0) err += kmo_check_oh_spec_setup(frameset, XCAL); /* Check XCAL */ @@ -2034,6 +2079,16 @@ return 0 ; } } + /* Check TELLURIC_GEN */ + if (nb_telluric_gen >= 1) { + frame2 = kmo_dfs_get_frame(frameset, TELLURIC_GEN); + next2 = cpl_frame_get_nextensions(frame2); + if (next2 != 24 && next2 != 48) { + cpl_msg_error(__func__, "TELLURIC_GEN wrong format") ; + cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; + return 0 ; + } + } /* Loop on the SCIENCE frames */ frame2 = kmo_dfs_get_frame(frameset, SCIENCE); @@ -2066,7 +2121,7 @@ err += kmo_check_frame_setup_md5_xycal(frameset); /* Verify that XCAL and YCAL / LCAL were generated together */ err += kmo_check_frame_setup_md5(frameset); - /* b_start/b_end/b_samples used for LCAL and TELLURIC were the same */ + /* b_samples used for LCAL and TELLURIC were the same */ err += kmo_check_frame_setup_sampling(frameset); if (err != CPL_ERROR_NONE) { @@ -2177,6 +2232,7 @@ int ifu_nr, int is_noise, int no_subtract, + const char * telluric_tag, int * ifu_nr_telluric) { kmclipm_vector *vec = NULL; @@ -2200,7 +2256,7 @@ actual_msg_level = cpl_msg_get_level(); cpl_msg_set_level(CPL_MSG_OFF); - vec = kmo_dfs_load_vector(frameset, TELLURIC, *ifu_nr_telluric,is_noise); + vec = kmo_dfs_load_vector(frameset, telluric_tag,*ifu_nr_telluric,is_noise); cpl_msg_set_level(actual_msg_level); if (cpl_error_get_code() != CPL_ERROR_NONE) cpl_error_reset(); @@ -2217,3 +2273,54 @@ return vec; } +static int kmos_sci_red_propagate_qc( + const cpl_propertylist * main_input, + cpl_propertylist * to_update, + const cpl_frame * inframe, + int det_nr) +{ + cpl_propertylist * plist ; + double rotangle, fwhm_ar, fwhm_ne, + vscale_ar, vscale_ne, pos_ne, pos_ar ; + int xtnum ; + + /* Get the Angle from plist */ + rotangle = kmo_dfs_get_property_double(main_input, ROTANGLE); + + /* Get the extension number */ + (void)kmclipm_cal_propertylist_find_angle( + cpl_frame_get_filename(inframe), det_nr, 0, rotangle, + &xtnum, NULL); + + /* Get the Header with the QC to propagate */ + plist = cpl_propertylist_load(cpl_frame_get_filename(inframe), xtnum) ; + fwhm_ar = kmos_pfits_get_qc_ar_fwhm_mean(plist) ; + vscale_ar = kmos_pfits_get_qc_ar_vscale(plist) ; + fwhm_ne = kmos_pfits_get_qc_ne_fwhm_mean(plist) ; + vscale_ne = kmos_pfits_get_qc_ne_vscale(plist) ; + pos_ar = kmos_pfits_get_qc_ar_pos_stdev(plist) ; + pos_ne = kmos_pfits_get_qc_ne_pos_stdev(plist) ; + cpl_propertylist_delete(plist) ; + if (cpl_error_get_code() != CPL_ERROR_NONE) { + cpl_msg_warning(__func__, + "Cannot propagate the QC ARC xx FWHM MEAN keyword") ; + cpl_error_reset() ; + } + + /* Set the QC */ + kmclipm_update_property_double(to_update, "ESO QC ARC NE POS STDEV", + pos_ne, "[km/s] mean stdev of pos. of NE"); + kmclipm_update_property_double(to_update, "ESO QC ARC AR POS STDEV", + pos_ar, "[km/s] mean stdev of pos. of AR"); + kmclipm_update_property_double(to_update, "ESO QC ARC NE FWHM MEAN", + fwhm_ne, "[km/s] mean of fwhm for Ne"); + kmclipm_update_property_double(to_update, "ESO QC ARC AR FWHM MEAN", + fwhm_ar, "[km/s] mean of fwhm for Ar"); + kmclipm_update_property_double(to_update, "ESO QC ARC NE VSCALE", + vscale_ne, "Velocity scale for Ne"); + kmclipm_update_property_double(to_update, "ESO QC ARC AR VSCALE", + vscale_ar, "Velocity scale for Ar"); + return 0 ; +} + + diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_sky_tweak.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_sky_tweak.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_sky_tweak.c 2016-09-19 12:38:49.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_sky_tweak.c 2018-04-09 13:42:16.000000000 +0000 @@ -406,7 +406,7 @@ /* Apply the sky tweaking */ result = kmos_priv_sky_tweak(obj_data, sky_data, - sub_header, .3, tbsub, ifu_nr, discard_subband, + sub_header, .3, tbsub, discard_subband, stretch, stretch_degree, stretch_resampling, plot, &new_sky); cpl_imagelist_delete(new_sky); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_std_star.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_std_star.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_std_star.c 2017-02-03 08:09:21.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_std_star.c 2018-04-09 13:42:16.000000000 +0000 @@ -541,8 +541,8 @@ cpl_vector * centre ; const char * spec_type ; const char * magnitude_txt ; - double cpos_rej, cneg_rej, neighborhoodRange, cen_x, cen_y, - radius ; + double cpos_rej, cneg_rej, neighborhoodRange; + double cen_x = 0., cen_y = 0., radius = 0.; int flux, save_cubes, no_noise, citer, cmin, cmax, xcal_interpolation, suppress_extension ; /*********************/ @@ -605,19 +605,17 @@ char star_type ; kmclipm_vector * ddd ; int i, j ; + + /* Check initial Entries */ + if (kmos_check_and_set_groups(frameset) != CPL_ERROR_NONE) { + return cpl_error_get_code(); + } /* Initialise */ nr_std_stars = 0 ; zeropoint = throughput_mean = throughput_sdv = -1.0 ; magnitude1 = magnitude2 = -1.0 ; - /* Check entries */ - if (parlist == NULL || frameset == NULL) { - cpl_msg_error(__func__, "Null Inputs") ; - cpl_error_set(__func__, CPL_ERROR_NULL_INPUT) ; - return -1 ; - } - /* Get parameters */ par = cpl_parameterlist_find_const(parlist, "kmos.kmos_std_star.imethod"); imethod = cpl_parameter_get_string(par) ; @@ -700,13 +698,6 @@ return -1 ; } - /* Identify the RAW and CALIB frames in the input frameset */ - if (kmo_dfs_set_groups(frameset) != 1) { - cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ; - cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; - return -1 ; - } - /* Check the inputs consistency */ if (kmos_std_star_check_inputs(frameset, magnitude_txt, &is_stdstarscipatt, &compute_qcs, &magnitude1, &magnitude2) != 1) { @@ -1289,7 +1280,7 @@ cpl_imagelist * tmp_cube ; cpl_vector * lambda_x ; cpl_vector * atmos_model ; - int i, j, k, nr_sky_pairs, npix, x, y, det_nr ; + int i, j, k, nr_sky_pairs, npix, x, y ; /* Check inputs */ @@ -1363,7 +1354,6 @@ /* Illumination correction */ /* Illumination noise small versus noise - skipped */ if (illum_frame != NULL) { - det_nr = (ifu_nr - 1)/KMOS_IFUS_PER_DETECTOR + 1; plist = kmclipm_propertylist_load(cpl_frame_get_filename(obj_frame), 0); angle = kmo_dfs_get_property_double(plist, ROTANGLE); cpl_propertylist_delete(plist); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmo_stats.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmo_stats.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmo_stats.c 2016-04-04 13:19:20.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmo_stats.c 2017-05-12 11:57:50.000000000 +0000 @@ -94,6 +94,7 @@ "In the first iteration median and percentile level are used.\n" "\n" "-------------------------------------------------------------------------------\n" + " Input files:\n" "\n" " DO DO KMOS \n" diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_test.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_test.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_test.c 2017-02-03 08:07:28.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_test.c 2018-04-09 13:42:16.000000000 +0000 @@ -43,7 +43,6 @@ static int kmos_test_create(cpl_plugin *plugin) { cpl_recipe *recipe; - cpl_parameter *p; /* Check that the plugin is part of a valid recipe */ if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) @@ -114,10 +113,12 @@ cpl_vector * vec_x_extract ; cpl_vector * vec_y_extract ; cpl_vector * fit_par ; + cpl_vector * guess_vec ; + double * pguess_vec ; cpl_vector * fit ; double * pfit ; cpl_matrix * x_mat ; - double line_center, line_width, cdelt ; + double line_center, line_width ; int lowIndex, highIndex, i ; double red_chisq ; cpl_matrix * covariance ; @@ -162,19 +163,40 @@ fit_par = cpl_vector_new(5); /* Initial estimates */ - cdelt = cpl_vector_get(vec_x_extract, 1) - cpl_vector_get(vec_x_extract, 0); cpl_vector_set(fit_par, 0, 0.0); + cpl_vector_set(fit_par, 0, 17000.0); cpl_vector_set(fit_par, 1, cpl_vector_get_min(vec_y_extract)); cpl_vector_set(fit_par, 1, 17310.7); + cpl_vector_set(fit_par, 1, 6000); cpl_vector_set(fit_par, 2, line_center); cpl_vector_set(fit_par, 2, 0.88635); cpl_vector_set(fit_par, 3, 0.000151367); cpl_vector_set(fit_par, 4, 0.0); cpl_vector_dump(fit_par, stdout); + + /* cpl_vector_set(fit_par, 0, 23000.0); */ + /* cpl_vector_set(fit_par, 1, 0.0); */ + /* cpl_vector_set(fit_par, 2, 0.0); */ + /* cpl_vector_set(fit_par, 3, 0.0); */ + /* cpl_vector_set(fit_par, 4, 0.0); */ + + /* Compute the guess vector for plotting*/ + guess_vec = cpl_vector_new(cpl_vector_get_size(vec_y_extract)); + pguess_vec = cpl_vector_get_data(guess_vec); + for (i = 0; i < cpl_vector_get_size(guess_vec); i++) { + x_array[0] = cpl_vector_get(vec_x_extract, i); + kmo_priv_lorentz1d_fnc(x_array, cpl_vector_get_data(fit_par), + y_array); + pguess_vec[i] = y_array[0]; + } + cpl_plot_vector("set grid;", "t 'Guess' w lines", "", guess_vec); + cpl_vector_delete(guess_vec) ; + + /* Prepare data for fitting */ x_mat = cpl_matrix_wrap(cpl_vector_get_size(vec_x_extract), 1, - (double*)cpl_vector_get_data_const(vec_x_extract)); + cpl_vector_get_data(vec_x_extract)); sigma_y = cpl_vector_new(cpl_vector_get_size(vec_x_extract)); cpl_vector_fill(sigma_y, 1.0); diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_wave_cal.c cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_wave_cal.c --- cpl-plugin-kmos-1.4.3+dfsg/recipes/kmos_wave_cal.c 2016-04-04 13:19:20.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/kmos_wave_cal.c 2018-04-09 13:42:16.000000000 +0000 @@ -104,11 +104,6 @@ "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" "--suppress_extension\n" "If set to TRUE, the arbitrary filename extensions are supressed. If\n" "multiple products with the same category are produced, they will be numered\n" @@ -363,11 +358,9 @@ const char * tmp_str ; cpl_error_code err ; - /* Check entries */ - if (parlist == NULL || frameset == NULL) { - cpl_msg_error(__func__, "Null Inputs") ; - cpl_error_set(__func__, CPL_ERROR_NULL_INPUT) ; - return -1 ; + /* Check initial Entries */ + if (kmos_check_and_set_groups(frameset) != CPL_ERROR_NONE) { + return cpl_error_get_code(); } /* Get Parameters */ @@ -398,13 +391,6 @@ return -1 ; } - /* Identify the RAW and CALIB frames in the input frameset */ - if (kmo_dfs_set_groups(frameset) != 1) { - cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ; - cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ; - return -1 ; - } - /* Check the inputs consistency */ if (kmos_wave_cal_check_inputs(frameset, &nx, &ny, &next, &exptime, &non_dest_rom, &lamp_config) != 1) { @@ -531,13 +517,14 @@ /* Set default fit orders for the different bands */ if (fit_order_par == 0) { + if ((strcmp(filter_ids[i-1], "H") == 0) || (strcmp(filter_ids[i-1], "K") == 0) || (strcmp(filter_ids[i-1], "YJ") == 0)) { fit_order = 6; } else if (strcmp(filter_ids[i-1], "IZ") == 0) { fit_order = 4; - } else if (strcmp(filter_ids[i-1], "HK") == 0) { + } else { //if (strcmp(filter_ids[i-1], "HK") == 0) { fit_order = 5; } cpl_msg_info(__func__, @@ -810,7 +797,9 @@ cpl_propertylist * mh_on ; cpl_propertylist * eh_off ; cpl_propertylist * eh_on ; - int ext, next_off, next_on, nx_on, ny_on, nx_off,ny_off; + int ext; + int next_off; + int next_on; double ndit_off, ndit_on, exptime_off, exptime_on ; const char * readmode_off ; const char * readmode_on ; @@ -842,12 +831,14 @@ /* Check READ OUT MODE */ readmode_on = kmos_pfits_get_readmode(mh_on); + cpl_propertylist_delete(mh_on); + if (!readmode_on) return -1; + if (!strcmp(readmode_on, "Nondest")) { *non_dest_rom = 1 ; } else { *non_dest_rom = 0 ; } - cpl_propertylist_delete(mh_on); /* Get ARC_OFF */ frame_off = kmo_dfs_get_frame(frameset, ARC_OFF); @@ -895,6 +886,10 @@ cpl_propertylist_delete(mh_off); /* Check the extensions */ + int nx_on = -1; + int nx_off = -1; + int ny_on = -1; + int ny_off = -1; for (ext = 1; ext <= next_off ; ext++) { eh_off = cpl_propertylist_load(cpl_frame_get_filename(frame_off), ext); nx_off = kmos_pfits_get_naxis1(eh_off) ; diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/Makefile.am cpl-plugin-kmos-2.0.2+dfsg/recipes/Makefile.am --- cpl-plugin-kmos-1.4.3+dfsg/recipes/Makefile.am 2017-02-02 14:27:20.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/Makefile.am 2018-04-09 10:33:09.000000000 +0000 @@ -44,6 +44,9 @@ kmos_combine.la \ kmos_dark.la \ kmos_extract_spec.la \ + kmos_molecfit_model.la \ + kmos_molecfit_calctrans.la \ + kmos_molecfit_correct.la \ kmos_flat.la \ kmos_gen_telluric.la \ kmos_wave_cal.la \ @@ -125,6 +128,24 @@ kmos_dark_la_LDFLAGS = -module -avoid-version kmos_dark_la_DEPENDENCIES = $(LIBKMOS) +kmos_molecfit_model_la_SOURCES = kmos_molecfit_model.c +kmos_molecfit_model_la_CPPFLAGS = $(MOLECFIT_INCLUDES) $(AM_CPPFLAGS) +kmos_molecfit_model_la_LIBADD = $(LIBKMOS) $(LIBMOLECFIT) +kmos_molecfit_model_la_LDFLAGS = $(MOLECFIT_LDFLAGS) -module -avoid-version +kmos_molecfit_model_la_DEPENDENCIES = $(LIBKMOS) + +kmos_molecfit_calctrans_la_SOURCES = kmos_molecfit_calctrans.c +kmos_molecfit_calctrans_la_CPPFLAGS = $(MOLECFIT_INCLUDES) $(AM_CPPFLAGS) +kmos_molecfit_calctrans_la_LIBADD = $(LIBKMOS) $(LIBMOLECFIT) +kmos_molecfit_calctrans_la_LDFLAGS = $(MOLECFIT_LDFLAGS) -module -avoid-version +kmos_molecfit_calctrans_la_DEPENDENCIES = $(LIBKMOS) + +kmos_molecfit_correct_la_SOURCES = kmos_molecfit_correct.c +kmos_molecfit_correct_la_CPPFLAGS = $(MOLECFIT_INCLUDES) $(AM_CPPFLAGS) +kmos_molecfit_correct_la_LIBADD = $(LIBKMOS) $(LIBMOLECFIT) +kmos_molecfit_correct_la_LDFLAGS = $(MOLECFIT_LDFLAGS) -module -avoid-version +kmos_molecfit_correct_la_DEPENDENCIES = $(LIBKMOS) + kmos_flat_la_SOURCES = kmos_flat.c kmos_flat_la_LIBADD = $(LIBKMOS) kmos_flat_la_LDFLAGS = -module -avoid-version diff -Nru cpl-plugin-kmos-1.4.3+dfsg/recipes/Makefile.in cpl-plugin-kmos-2.0.2+dfsg/recipes/Makefile.in --- cpl-plugin-kmos-1.4.3+dfsg/recipes/Makefile.in 2017-02-27 20:41:52.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/recipes/Makefile.in 2018-04-24 13:37:16.000000000 +0000 @@ -99,7 +99,8 @@ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4macros/molecfit.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ @@ -238,6 +239,29 @@ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(kmos_illumination_la_LDFLAGS) \ $(LDFLAGS) -o $@ +am_kmos_molecfit_calctrans_la_OBJECTS = \ + kmos_molecfit_calctrans_la-kmos_molecfit_calctrans.lo +kmos_molecfit_calctrans_la_OBJECTS = \ + $(am_kmos_molecfit_calctrans_la_OBJECTS) +kmos_molecfit_calctrans_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(kmos_molecfit_calctrans_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_kmos_molecfit_correct_la_OBJECTS = \ + kmos_molecfit_correct_la-kmos_molecfit_correct.lo +kmos_molecfit_correct_la_OBJECTS = \ + $(am_kmos_molecfit_correct_la_OBJECTS) +kmos_molecfit_correct_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(kmos_molecfit_correct_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_kmos_molecfit_model_la_OBJECTS = \ + kmos_molecfit_model_la-kmos_molecfit_model.lo +kmos_molecfit_model_la_OBJECTS = $(am_kmos_molecfit_model_la_OBJECTS) +kmos_molecfit_model_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(kmos_molecfit_model_la_LDFLAGS) \ + $(LDFLAGS) -o $@ am_kmos_reconstruct_la_OBJECTS = kmos_reconstruct.lo kmos_reconstruct_la_OBJECTS = $(am_kmos_reconstruct_la_OBJECTS) kmos_reconstruct_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ @@ -316,10 +340,13 @@ $(kmos_extract_spec_la_SOURCES) $(kmos_flat_la_SOURCES) \ $(kmos_gen_reflines_la_SOURCES) \ $(kmos_gen_telluric_la_SOURCES) \ - $(kmos_illumination_la_SOURCES) $(kmos_reconstruct_la_SOURCES) \ - $(kmos_sci_red_la_SOURCES) $(kmos_sky_tweak_la_SOURCES) \ - $(kmos_std_star_la_SOURCES) $(kmos_test_la_SOURCES) \ - $(kmos_wave_cal_la_SOURCES) + $(kmos_illumination_la_SOURCES) \ + $(kmos_molecfit_calctrans_la_SOURCES) \ + $(kmos_molecfit_correct_la_SOURCES) \ + $(kmos_molecfit_model_la_SOURCES) \ + $(kmos_reconstruct_la_SOURCES) $(kmos_sci_red_la_SOURCES) \ + $(kmos_sky_tweak_la_SOURCES) $(kmos_std_star_la_SOURCES) \ + $(kmos_test_la_SOURCES) $(kmos_wave_cal_la_SOURCES) DIST_SOURCES = $(kmo_arithmetic_la_SOURCES) $(kmo_copy_la_SOURCES) \ $(kmo_fit_profile_la_SOURCES) $(kmo_fits_strip_la_SOURCES) \ $(kmo_make_image_la_SOURCES) $(kmo_noise_map_la_SOURCES) \ @@ -329,10 +356,13 @@ $(kmos_extract_spec_la_SOURCES) $(kmos_flat_la_SOURCES) \ $(kmos_gen_reflines_la_SOURCES) \ $(kmos_gen_telluric_la_SOURCES) \ - $(kmos_illumination_la_SOURCES) $(kmos_reconstruct_la_SOURCES) \ - $(kmos_sci_red_la_SOURCES) $(kmos_sky_tweak_la_SOURCES) \ - $(kmos_std_star_la_SOURCES) $(kmos_test_la_SOURCES) \ - $(kmos_wave_cal_la_SOURCES) + $(kmos_illumination_la_SOURCES) \ + $(kmos_molecfit_calctrans_la_SOURCES) \ + $(kmos_molecfit_correct_la_SOURCES) \ + $(kmos_molecfit_model_la_SOURCES) \ + $(kmos_reconstruct_la_SOURCES) $(kmos_sci_red_la_SOURCES) \ + $(kmos_sky_tweak_la_SOURCES) $(kmos_std_star_la_SOURCES) \ + $(kmos_test_la_SOURCES) $(kmos_wave_cal_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -415,6 +445,7 @@ LIBIRPLIB = @LIBIRPLIB@ LIBKMCLIPMLIB = @LIBKMCLIPMLIB@ LIBKMOS = @LIBKMOS@ +LIBMOLECFIT = @LIBMOLECFIT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -430,6 +461,10 @@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOLECFITDIR = @MOLECFITDIR@ +MOLECFIT_CFLAGS = @MOLECFIT_CFLAGS@ +MOLECFIT_INCLUDES = @MOLECFIT_INCLUDES@ +MOLECFIT_LDFLAGS = @MOLECFIT_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -444,6 +479,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG = @PKGCONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -533,6 +569,9 @@ kmos_combine.la \ kmos_dark.la \ kmos_extract_spec.la \ + kmos_molecfit_model.la \ + kmos_molecfit_calctrans.la \ + kmos_molecfit_correct.la \ kmos_flat.la \ kmos_gen_telluric.la \ kmos_wave_cal.la \ @@ -600,6 +639,21 @@ kmos_dark_la_LIBADD = $(LIBKMOS) kmos_dark_la_LDFLAGS = -module -avoid-version kmos_dark_la_DEPENDENCIES = $(LIBKMOS) +kmos_molecfit_model_la_SOURCES = kmos_molecfit_model.c +kmos_molecfit_model_la_CPPFLAGS = $(MOLECFIT_INCLUDES) $(AM_CPPFLAGS) +kmos_molecfit_model_la_LIBADD = $(LIBKMOS) $(LIBMOLECFIT) +kmos_molecfit_model_la_LDFLAGS = $(MOLECFIT_LDFLAGS) -module -avoid-version +kmos_molecfit_model_la_DEPENDENCIES = $(LIBKMOS) +kmos_molecfit_calctrans_la_SOURCES = kmos_molecfit_calctrans.c +kmos_molecfit_calctrans_la_CPPFLAGS = $(MOLECFIT_INCLUDES) $(AM_CPPFLAGS) +kmos_molecfit_calctrans_la_LIBADD = $(LIBKMOS) $(LIBMOLECFIT) +kmos_molecfit_calctrans_la_LDFLAGS = $(MOLECFIT_LDFLAGS) -module -avoid-version +kmos_molecfit_calctrans_la_DEPENDENCIES = $(LIBKMOS) +kmos_molecfit_correct_la_SOURCES = kmos_molecfit_correct.c +kmos_molecfit_correct_la_CPPFLAGS = $(MOLECFIT_INCLUDES) $(AM_CPPFLAGS) +kmos_molecfit_correct_la_LIBADD = $(LIBKMOS) $(LIBMOLECFIT) +kmos_molecfit_correct_la_LDFLAGS = $(MOLECFIT_LDFLAGS) -module -avoid-version +kmos_molecfit_correct_la_DEPENDENCIES = $(LIBKMOS) kmos_flat_la_SOURCES = kmos_flat.c kmos_flat_la_LIBADD = $(LIBKMOS) kmos_flat_la_LDFLAGS = -module -avoid-version @@ -756,6 +810,15 @@ kmos_illumination.la: $(kmos_illumination_la_OBJECTS) $(kmos_illumination_la_DEPENDENCIES) $(EXTRA_kmos_illumination_la_DEPENDENCIES) $(AM_V_CCLD)$(kmos_illumination_la_LINK) -rpath $(plugindir) $(kmos_illumination_la_OBJECTS) $(kmos_illumination_la_LIBADD) $(LIBS) +kmos_molecfit_calctrans.la: $(kmos_molecfit_calctrans_la_OBJECTS) $(kmos_molecfit_calctrans_la_DEPENDENCIES) $(EXTRA_kmos_molecfit_calctrans_la_DEPENDENCIES) + $(AM_V_CCLD)$(kmos_molecfit_calctrans_la_LINK) -rpath $(plugindir) $(kmos_molecfit_calctrans_la_OBJECTS) $(kmos_molecfit_calctrans_la_LIBADD) $(LIBS) + +kmos_molecfit_correct.la: $(kmos_molecfit_correct_la_OBJECTS) $(kmos_molecfit_correct_la_DEPENDENCIES) $(EXTRA_kmos_molecfit_correct_la_DEPENDENCIES) + $(AM_V_CCLD)$(kmos_molecfit_correct_la_LINK) -rpath $(plugindir) $(kmos_molecfit_correct_la_OBJECTS) $(kmos_molecfit_correct_la_LIBADD) $(LIBS) + +kmos_molecfit_model.la: $(kmos_molecfit_model_la_OBJECTS) $(kmos_molecfit_model_la_DEPENDENCIES) $(EXTRA_kmos_molecfit_model_la_DEPENDENCIES) + $(AM_V_CCLD)$(kmos_molecfit_model_la_LINK) -rpath $(plugindir) $(kmos_molecfit_model_la_OBJECTS) $(kmos_molecfit_model_la_LIBADD) $(LIBS) + kmos_reconstruct.la: $(kmos_reconstruct_la_OBJECTS) $(kmos_reconstruct_la_DEPENDENCIES) $(EXTRA_kmos_reconstruct_la_DEPENDENCIES) $(AM_V_CCLD)$(kmos_reconstruct_la_LINK) -rpath $(plugindir) $(kmos_reconstruct_la_OBJECTS) $(kmos_reconstruct_la_LIBADD) $(LIBS) @@ -797,6 +860,9 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmos_gen_reflines.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmos_gen_telluric.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmos_illumination.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmos_molecfit_calctrans_la-kmos_molecfit_calctrans.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmos_molecfit_correct_la-kmos_molecfit_correct.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmos_molecfit_model_la-kmos_molecfit_model.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmos_reconstruct.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmos_sci_red.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmos_sky_tweak.Plo@am__quote@ @@ -825,6 +891,27 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< +kmos_molecfit_calctrans_la-kmos_molecfit_calctrans.lo: kmos_molecfit_calctrans.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmos_molecfit_calctrans_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmos_molecfit_calctrans_la-kmos_molecfit_calctrans.lo -MD -MP -MF $(DEPDIR)/kmos_molecfit_calctrans_la-kmos_molecfit_calctrans.Tpo -c -o kmos_molecfit_calctrans_la-kmos_molecfit_calctrans.lo `test -f 'kmos_molecfit_calctrans.c' || echo '$(srcdir)/'`kmos_molecfit_calctrans.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/kmos_molecfit_calctrans_la-kmos_molecfit_calctrans.Tpo $(DEPDIR)/kmos_molecfit_calctrans_la-kmos_molecfit_calctrans.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kmos_molecfit_calctrans.c' object='kmos_molecfit_calctrans_la-kmos_molecfit_calctrans.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmos_molecfit_calctrans_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmos_molecfit_calctrans_la-kmos_molecfit_calctrans.lo `test -f 'kmos_molecfit_calctrans.c' || echo '$(srcdir)/'`kmos_molecfit_calctrans.c + +kmos_molecfit_correct_la-kmos_molecfit_correct.lo: kmos_molecfit_correct.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmos_molecfit_correct_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmos_molecfit_correct_la-kmos_molecfit_correct.lo -MD -MP -MF $(DEPDIR)/kmos_molecfit_correct_la-kmos_molecfit_correct.Tpo -c -o kmos_molecfit_correct_la-kmos_molecfit_correct.lo `test -f 'kmos_molecfit_correct.c' || echo '$(srcdir)/'`kmos_molecfit_correct.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/kmos_molecfit_correct_la-kmos_molecfit_correct.Tpo $(DEPDIR)/kmos_molecfit_correct_la-kmos_molecfit_correct.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kmos_molecfit_correct.c' object='kmos_molecfit_correct_la-kmos_molecfit_correct.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmos_molecfit_correct_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmos_molecfit_correct_la-kmos_molecfit_correct.lo `test -f 'kmos_molecfit_correct.c' || echo '$(srcdir)/'`kmos_molecfit_correct.c + +kmos_molecfit_model_la-kmos_molecfit_model.lo: kmos_molecfit_model.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmos_molecfit_model_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmos_molecfit_model_la-kmos_molecfit_model.lo -MD -MP -MF $(DEPDIR)/kmos_molecfit_model_la-kmos_molecfit_model.Tpo -c -o kmos_molecfit_model_la-kmos_molecfit_model.lo `test -f 'kmos_molecfit_model.c' || echo '$(srcdir)/'`kmos_molecfit_model.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/kmos_molecfit_model_la-kmos_molecfit_model.Tpo $(DEPDIR)/kmos_molecfit_model_la-kmos_molecfit_model.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kmos_molecfit_model.c' object='kmos_molecfit_model_la-kmos_molecfit_model.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmos_molecfit_model_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmos_molecfit_model_la-kmos_molecfit_model.lo `test -f 'kmos_molecfit_model.c' || echo '$(srcdir)/'`kmos_molecfit_model.c + mostlyclean-libtool: -rm -f *.lo diff -Nru cpl-plugin-kmos-1.4.3+dfsg/reflex/correct_std.py cpl-plugin-kmos-2.0.2+dfsg/reflex/correct_std.py --- cpl-plugin-kmos-1.4.3+dfsg/reflex/correct_std.py 2017-02-23 12:21:08.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/reflex/correct_std.py 2017-10-06 13:29:16.000000000 +0000 @@ -69,7 +69,7 @@ response_ = hdu_res[exten].data error_response_ = hdu_res[exten+1].data - if data != None: + if data is not None: wdata = getw(hdu_spc[exten].header) wresponse = getw(hdu_res[exten].header) @@ -78,7 +78,7 @@ response = np.interp(wdata,wresponse,response_) hdu_spc[exten].data = data / response - if noise != None: + if noise is not None: wnoise = getw(hdu_res[exten+1].header) #I need to interpolate the response and error_response to the wavelength range and step of data and noise. error_response = np.interp(wnoise,wresponse,error_response_) diff -Nru cpl-plugin-kmos-1.4.3+dfsg/reflex/kmos_combine.py cpl-plugin-kmos-2.0.2+dfsg/reflex/kmos_combine.py --- cpl-plugin-kmos-1.4.3+dfsg/reflex/kmos_combine.py 2016-04-15 15:43:29.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/reflex/kmos_combine.py 2018-02-27 09:50:27.000000000 +0000 @@ -34,9 +34,11 @@ class DataPlotterManager(object): # static members - recipe_name = "kmos_combine" - combined_cat = "COMBINE_SCI_RECONSTRUCTED" - recons_cat = "SCI_RECONSTRUCTED" + recipe_name = "kmos_combine" + recons_cat = "SCI_RECONSTRUCTED" + recons_cat2 = "SINGLE_CUBES" + combined_cat = "COMBINED_CUBE" + oh_spec_cat = "OH_SPEC" cores = ['r', 'g', '0.50', 'c', 'm', 'y', 'b'] labels_view=['Display input and output spectra', 'Display output spectra', 'Display input spectra'] @@ -184,7 +186,7 @@ # Loop on all input fitsfiles countr = 0 for frec in fitsFiles: - if frec.category == self.recons_cat : + if frec.category == self.recons_cat or frec.category == self.recons_cat2 : reconstructed_file = PipelineProduct(frec) reconstructed_filename = os.path.basename(frec.name) @@ -490,7 +492,7 @@ def _process_label(self, in_label): # If known, 'pretty print' the label - if (in_label == "ERG/sec/cm2/A"): + if (in_label == "erg.s**(-1).cm**(-2).angstrom**(-1)"): return "erg sec" + r"$^{-1}$"+"cm" + r"$^{-2}$" + r"$\AA^{-1}$" else: return in_label diff -Nru cpl-plugin-kmos-1.4.3+dfsg/reflex/kmos_sci_red.py cpl-plugin-kmos-2.0.2+dfsg/reflex/kmos_sci_red.py --- cpl-plugin-kmos-1.4.3+dfsg/reflex/kmos_sci_red.py 2016-09-28 12:40:07.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/reflex/kmos_sci_red.py 2018-02-27 09:50:27.000000000 +0000 @@ -49,15 +49,7 @@ group="Recons.", description="Apply Overscan Correction"), reflex.RecipeParameter(recipe=self.recipe_name, displayName="xcal_interpolation", group="Recons.", description="Interpolate xcal between rotator angles"), - reflex.RecipeParameter(recipe=self.recipe_name, displayName="b_samples", - group="Recons.", description="The number of samples in wavelength"), - reflex.RecipeParameter(recipe=self.recipe_name, displayName="b_start", - group="Recons.", description="The lowest wavelength"), - reflex.RecipeParameter(recipe=self.recipe_name, displayName="b_end", - group="Recons.", description="The highest wavelength"), - reflex.RecipeParameter(recipe=self.recipe_name, displayName="fmethod", - group="Extr.", description="Fitting Method (gauss, moffat)"), reflex.RecipeParameter(recipe=self.recipe_name, displayName="neighborhoodRange", group="Extr.", description="Range for Neighbors"), reflex.RecipeParameter(recipe=self.recipe_name, displayName="flux", @@ -287,7 +279,7 @@ def _process_label(self, in_label): # If known, 'pretty print' the label - if (in_label == "ERG/sec/cm2/A"): + if (in_label == "erg.s**(-1).cm**(-2).angstrom**(-1)"): return "erg sec" + r"$^{-1}$"+"cm" + r"$^{-2}$" + r"$\AA^{-1}$" else: return in_label diff -Nru cpl-plugin-kmos-1.4.3+dfsg/reflex/kmos_std_star.py cpl-plugin-kmos-2.0.2+dfsg/reflex/kmos_std_star.py --- cpl-plugin-kmos-1.4.3+dfsg/reflex/kmos_std_star.py 2015-11-06 17:51:07.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/reflex/kmos_std_star.py 2018-01-15 09:25:57.000000000 +0000 @@ -44,12 +44,6 @@ group="Recons.", description="Interpolation Method (NN, lwNN, swNN, MS, CS)"), reflex.RecipeParameter(recipe=self.recipe_name, displayName="xcal_interpolation", group="Recons.", description="Interpolate xcal between rotator angles"), - reflex.RecipeParameter(recipe=self.recipe_name, displayName="b_samples", - group="Recons.", description="The number of samples in wavelength"), - reflex.RecipeParameter(recipe=self.recipe_name, displayName="b_start", - group="Recons.", description="The lowest wavelength"), - reflex.RecipeParameter(recipe=self.recipe_name, displayName="b_end", - group="Recons.", description="The highest wavelength"), reflex.RecipeParameter(recipe=self.recipe_name, displayName="mask_method", group="Extr.", description="Extraction Method (optimal/integrated)"), diff -Nru cpl-plugin-kmos-1.4.3+dfsg/reflex/kmos_wave_cal.py cpl-plugin-kmos-2.0.2+dfsg/reflex/kmos_wave_cal.py --- cpl-plugin-kmos-1.4.3+dfsg/reflex/kmos_wave_cal.py 2015-06-22 15:28:30.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/reflex/kmos_wave_cal.py 2018-01-16 09:31:01.000000000 +0000 @@ -45,12 +45,6 @@ group="Wavelength Calibration", description="The expected dispersion of the wavelength in microns/pixel"), reflex.RecipeParameter(recipe=self.recipe_name, displayName="suppress_extension", group="Wavelength Calibration", description="Suppress arbitrary filename extension"), - reflex.RecipeParameter(recipe=self.recipe_name, displayName="b_samples", - group="Wavelength Calibration", description="The number of samples in wavelength for the reconstructed cube"), - reflex.RecipeParameter(recipe=self.recipe_name, displayName="b_start", - group="Wavelength Calibration", description="The lowest wavelength to take into account when reconstructing"), - reflex.RecipeParameter(recipe=self.recipe_name, displayName="b_end", - group="Wavelength Calibration", description="The highest wavelength to take into account when reconstructing"), ] def readFitsData(self, fitsFiles): @@ -68,11 +62,11 @@ # Get the angle values self.angles_list = dict() for i in range(18): - angle = det_img_wave.readKeyword('ESO PRO ROT NAANGLE', i+1) - - if not (angle in self.angles_list) : - self.angles_list[angle] = [] - self.angles_list[angle].append(i+1) + if (i+1 < len(det_img_wave.all_hdu)): + angle = det_img_wave.readKeyword('ESO PRO ROT NAANGLE', i+1) + if not (angle in self.angles_list) : + self.angles_list[angle] = [] + self.angles_list[angle].append(i+1) # Sorted angles list self.sorted_angles = self.angles_list.keys() @@ -84,31 +78,33 @@ self.neon_pos_data = [] self.neon_fwhm_data = [] for i in range(18): - key1 = det_img_wave.readKeyword('ESO QC ARC AR POS MEAN', i+1) - key2 = det_img_wave.readKeyword('ESO QC ARC AR FWHM MEAN', i+1) - ar_vscale = det_img_wave.readKeyword('ESO QC ARC AR VSCALE', i+1) - - key3 = det_img_wave.readKeyword('ESO QC ARC NE POS MEAN', i+1) - key4 = det_img_wave.readKeyword('ESO QC ARC NE FWHM MEAN', i+1) - ne_vscale = det_img_wave.readKeyword('ESO QC ARC NE VSCALE', i+1) - - # Correct Key2 and Key4 units - key2 /= ar_vscale - key4 /= ne_vscale - - # Fill the Argon Data for the scatter plot - self.argon_pos_data.append(key1) - self.argon_fwhm_data.append(key2) - - # Fill the Neon Data for the scatter plot - self.neon_pos_data.append(key3) - self.neon_fwhm_data.append(key4) + if (i+1 < len(det_img_wave.all_hdu)): + key1 = det_img_wave.readKeyword('ESO QC ARC AR POS MEAN', i+1) + key2 = det_img_wave.readKeyword('ESO QC ARC AR FWHM MEAN', i+1) + ar_vscale = det_img_wave.readKeyword('ESO QC ARC AR VSCALE', i+1) + + key3 = det_img_wave.readKeyword('ESO QC ARC NE POS MEAN', i+1) + key4 = det_img_wave.readKeyword('ESO QC ARC NE FWHM MEAN', i+1) + ne_vscale = det_img_wave.readKeyword('ESO QC ARC NE VSCALE', i+1) + + # Correct Key2 and Key4 units + key2 /= ar_vscale + key4 /= ne_vscale + + # Fill the Argon Data for the scatter plot + self.argon_pos_data.append(key1) + self.argon_fwhm_data.append(key2) + + # Fill the Neon Data for the scatter plot + self.neon_pos_data.append(key3) + self.neon_fwhm_data.append(key4) # Read the images self.images = [] for i in range(18): - det_img_wave.readImage(i+1) - self.images.append(det_img_wave.image) + if (i+1 < len(det_img_wave.all_hdu)): + det_img_wave.readImage(i+1) + self.images.append(det_img_wave.image) # Set the plotting functions self._add_subplots = self._add_subplots @@ -178,8 +174,9 @@ print "Wrong number of extensions for this angle" # Define x - x = numpy.linspace(1, 18, num=18) - + size = len(self.argon_pos_data) + x = numpy.linspace(1, size, num=size) + # Plot Argon and Neon plots scadsp = pipeline_display.ScatterDisplay() scadsp.display(self.argon_plot, "Argon Lines", "Mean Argon line positional offset, with error bars equal to the FWH", x, self.argon_pos_data, diff -Nru cpl-plugin-kmos-1.4.3+dfsg/reflex/kmos_wkf.oca cpl-plugin-kmos-2.0.2+dfsg/reflex/kmos_wkf.oca --- cpl-plugin-kmos-1.4.3+dfsg/reflex/kmos_wkf.oca 2017-01-10 10:25:34.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/reflex/kmos_wkf.oca 2018-02-19 14:18:36.000000000 +0000 @@ -1,359 +1,368 @@ -//////////////////// -// Classification // -//////////////////// - -if (T) then -{ - REFLEX.CATG="UNDEFINED"; -} - -if DPR.CATG=="CALIB" and DPR.TYPE=="DARK" and DPR.TECH=="IMAGE" and INSTRUME=="KMOS" then -{ - RAW.TYPE = "DARK"; - REFLEX.CATG = "DARK"; - PACK.DIR = "PACK_DIR_DUMMY"; - CATG = "CALIB"; -} - -if DPR.CATG like "%CALIB%" and DPR.TYPE like "%FLAT%" and DPR.TYPE like "%OFF%" and DPR.TECH like "%IMAGE%" and INSTRUME=="KMOS" then -{ - RAW.TYPE = "FLAT"; - REFLEX.CATG = "FLAT_OFF"; - PACK.DIR = "PACK_DIR_DUMMY"; - CATG = "CALIB"; - -} -if DPR.CATG like "%CALIB%" and DPR.TYPE like "%FLAT%" and DPR.TYPE like "%LAMP%" and DPR.TECH like "%SPECTRUM%" and INSTRUME=="KMOS" then -{ - RAW.TYPE = "FLAT"; - REFLEX.CATG = "FLAT_ON"; - PACK.DIR = "PACK_DIR_DUMMY"; - CATG = "CALIB"; -} - -if DPR.CATG like "%CALIB%" and DPR.TYPE like "%WAVE%" and DPR.TYPE like "%LAMP%" and DPR.TECH like "%SPECTRUM%" and INSTRUME=="KMOS" then -{ - RAW.TYPE = "ARC"; - REFLEX.CATG = "ARC_ON"; - PACK.DIR = "PACK_DIR_DUMMY"; - CATG = "CALIB"; -} - -if DPR.CATG like "%CALIB%" and DPR.TYPE like "%WAVE%" and DPR.TYPE like "%OFF%" and DPR.TECH like "%IMAGE%" and INSTRUME=="KMOS" then -{ - RAW.TYPE = "ARC"; - REFLEX.CATG = "ARC_OFF"; - PACK.DIR = "PACK_DIR_DUMMY"; - CATG = "CALIB"; -} - -if DPR.CATG like "%CALIB%" and DPR.TYPE like "%FLAT%" and DPR.TYPE like "%SKY%" and DPR.TECH like "%IFU%" and INSTRUME=="KMOS" then -{ - RAW.TYPE = "ILLUM"; - REFLEX.CATG = "FLAT_SKY"; - PACK.DIR = "PACK_DIR_DUMMY"; - CATG = "CALIB"; -} - -if DPR.CATG like "%CALIB%" and DPR.TYPE like "%OBJECT%" and DPR.TYPE like "%SKY%" and DPR.TYPE like "%STD%" and DPR.TYPE like "%FLUX%" and DPR.TECH like "%IFU%" and INSTRUME=="KMOS" then -{ - RAW.TYPE = "STD"; - REFLEX.CATG = "STD"; - PACK.DIR = "PACK_DIR_DUMMY"; - CATG = "CALIB"; -} - -if DPR.CATG like "%SCIENCE%" and DPR.TYPE like "%OBJECT%" and DPR.TYPE like "%SKY%" and DPR.TECH like "%IFU%" and INSTRUME=="KMOS" then -{ - RAW.TYPE = "SCIENCE"; - REFLEX.CATG = "SCIENCE"; - PACK.DIR = "PACK_DIR_DUMMY"; - CATG = "SCIENCE"; - REFLEX.TARGET = "T"; -} - -if PRO.CATG=="WAVE_BAND" and INSTRUME=="KMOS" then -{ - REFLEX.CATG = "WAVE_BAND"; -} - -if PRO.CATG=="TELLURIC" and INSTRUME=="KMOS" then -{ - REFLEX.CATG = "TELLURIC"; - -} -if PRO.CATG=="TELLURIC_CORR" and INSTRUME=="KMOS" then -{ - REFLEX.CATG = "TELLURIC_CORR"; - PRO.CATG = "TELLURIC_CORR"; -} -if PRO.CATG=="TELLURIC_ONLY" and INSTRUME=="KMOS" then -{ - REFLEX.CATG = "TELLURIC_CORR"; - PRO.CATG = "TELLURIC_CORR"; -} -if PRO.CATG=="RESPONSE" and INSTRUME=="KMOS" then -{ - REFLEX.CATG = "RESPONSE"; -} - -if PRO.CATG=="REF_LINES" and INSTRUME=="KMOS" then -{ - REFLEX.CATG = "REF_LINES"; -} -if PRO.CATG=="ARC_LIST" and INSTRUME=="KMOS" then -{ - REFLEX.CATG = "ARC_LIST"; -} -if PRO.CATG == "ATMOS_MODEL" and INSTRUME=="KMOS" then -{ - REFLEX.CATG = "ATMOS_MODEL"; -} -if PRO.CATG == "SOLAR_SPEC" and INSTRUME=="KMOS" then -{ - REFLEX.CATG = "SOLAR_SPEC"; -} -if PRO.CATG == "SPEC_TYPE_LOOKUP" and INSTRUME=="KMOS" then -{ - REFLEX.CATG = "SPEC_TYPE_LOOKUP"; -} -if PRO.CATG == "OH_SPEC" and INSTRUME=="KMOS" then -{ - REFLEX.CATG = "OH_SPEC"; -} - -/////////////////////////////////////// -// Selection of actions and grouping // -/////////////////////////////////////// -minRet=3; -select execute(DARK) from inputFiles where RAW.TYPE=="DARK" - group by TPL.START ; -minRet=6; -select execute(FLAT) from inputFiles where RAW.TYPE == "FLAT" - group by TPL.START as (TPL_A,tpl) ; -minRet=2; -select execute(ARC) from inputFiles where RAW.TYPE == "ARC" - group by TPL.START as (TPL_A,tpl); -minRet=0; -select execute(ILLUM) from inputFiles where RAW.TYPE == "ILLUM" - group by TPL.START as (TPL_A,tpl); - -select execute(ILLUM_FLAT) from inputFiles where REFLEX.CATG == "FLAT_ON" - group by TPL.START as (TPL_A,tpl); -select execute(STD) from inputFiles where RAW.TYPE == "STD" - group by TPL.START as (TPL_A,tpl); -select execute(SCIENCE) from inputFiles where RAW.TYPE == "SCIENCE" - group by TPL.START as (TPL_A,tpl); - -///////////////////// -// Execute recipes // -///////////////////// -// The _WKF suffix is used to avoid association of already existing calibration frames -// All the associations should go through virtual products -action DARK -{ - recipe kmos_dark; - - product MASTER_DARK_WKF { PRO.CATG="MASTER_DARK_WKF"; PRO.EXT="tpl_0000.fits";} - product BADPIXEL_DARK_WKF { PRO.CATG="BADPIXEL_DARK_WKF"; PRO.EXT="tpl_0001.fits";} -} -action FLAT -{ - minRet = 1; maxRet = 1; - select file as BADPIXEL_DARK_WKF from calibFiles where - PRO.CATG=="BADPIXEL_DARK_WKF" - and inputFile.INSTRUME==INSTRUME; - - recipe kmos_flat; - - product MASTER_FLAT_WKF { PRO.CATG="MASTER_FLAT_WKF"; PRO.EXT="tpl_0000.fits";} - product XCAL_WKF { PRO.CATG="XCAL_WKF"; PRO.EXT="tpl_0001.fits";} - product YCAL_WKF { PRO.CATG="YCAL_WKF"; PRO.EXT="tpl_0002.fits";} - product BADPIXEL_FLAT_WKF { PRO.CATG="BADPIXEL_FLAT_WKF"; PRO.EXT="tpl_0003.fits";} - product FLAT_EDGE_WKF { PRO.CATG="FLAT_EDGE_WKF"; PRO.EXT="tpl_0004.fits";} -} -action ARC -{ - minRet = 1; maxRet = 1; - select file as XCAL_WKF from calibFiles where PRO.CATG == "XCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as YCAL_WKF from calibFiles where PRO.CATG == "YCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as FLAT_EDGE_WKF from calibFiles where PRO.CATG == "FLAT_EDGE_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as REF_LINES from calibFiles where PRO.CATG == "REF_LINES"; - - minRet = 1; maxRet = 1; - select file as WAVE_BAND from calibFiles where PRO.CATG == "WAVE_BAND"; - - minRet = 1; maxRet = 1; - select file as ARC_LIST from calibFiles where PRO.CATG == "ARC_LIST" - and inputFile.INS.GRAT1.ID==FILT.ID ; - - recipe kmos_wave_cal; - - product LCAL_WKF { PRO.CATG="LCAL_WKF"; PRO.EXT="tpl_0000.fits";} - product DET_IMG_WAVE_WKF { PRO.CATG="DET_IMG_WAVE_WKF"; PRO.EXT="tpl_0001.fits";} -} -action ILLUM -{ - minRet = 1; maxRet = 1; - select file as MASTER_DARK_WKF from calibFiles where PRO.CATG == "MASTER_DARK_WKF" ; - - minRet = 1; maxRet = 1; - select file as MASTER_FLAT_WKF from calibFiles where PRO.CATG == "MASTER_FLAT_WKF" and - inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 0; maxRet = 1; - select file as FLAT_EDGE_WKF from calibFiles where PRO.CATG == "FLAT_EDGE_WKF" and - inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as XCAL_WKF from calibFiles where PRO.CATG == "XCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as YCAL_WKF from calibFiles where PRO.CATG == "YCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as LCAL_WKF from calibFiles where PRO.CATG == "LCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as WAVE_BAND from calibFiles where PRO.CATG == "WAVE_BAND"; - - recipe kmos_illumination{"--imethod=swNN";} - - product ILLUM_CORR_WKF { PRO.CATG="ILLUM_CORR_WKF"; PRO.EXT="tpl_0000.fits";} -} - -action ILLUM_FLAT -{ - minRet = 1; maxRet = 1; - select file as XCAL_WKF from calibFiles where PRO.CATG == "XCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as YCAL_WKF from calibFiles where PRO.CATG == "YCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as LCAL_WKF from calibFiles where PRO.CATG == "LCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as WAVE_BAND from calibFiles where PRO.CATG == "WAVE_BAND"; - - - recipe kmos_illumination{"--imethod=swNN";} - - product ILLUM_CORR_FLAT_WKF { PRO.CATG="ILLUM_CORR_FLAT_WKF"; PRO.EXT="tpl_0000.fits";} -} -action STD -{ - minRet = 1; maxRet = 1; - select file as MASTER_FLAT_WKF from calibFiles where PRO.CATG == "MASTER_FLAT_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as XCAL_WKF from calibFiles where PRO.CATG == "XCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as YCAL_WKF from calibFiles where PRO.CATG == "YCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as LCAL_WKF from calibFiles where PRO.CATG == "LCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 0; maxRet = 1; - select file as ILLUM_CORR_WKF from calibFiles where PRO.CATG == "ILLUM_CORR_WKF" - and MJD-OBS > inputFile.MJD-OBS - 15. and MJD-OBS < inputFile.MJD-OBS + 15. - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 0; maxRet = 1; - select file as ILLUM_CORR_FLAT_WKF from calibFiles where PRO.CATG == "ILLUM_CORR_FLAT_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 0; maxRet = 1; - select file as SOLAR_SPEC from calibFiles where PRO.CATG == "SOLAR_SPEC" - and inputFile.INS.GRAT1.ID==FILT.ID; - - minRet = 0; maxRet = 1; - select file as ATMOS_MODEL from calibFiles where PRO.CATG == "ATMOS_MODEL" - and inputFile.INS.GRAT1.ID==FILT.ID; - - minRet = 0; maxRet = 1; - select file as SPEC_TYPE_LOOKUP from calibFiles where PRO.CATG == "SPEC_TYPE_LOOKUP"; - - minRet = 1; maxRet = 1; - select file as WAVE_BAND from calibFiles where PRO.CATG == "WAVE_BAND"; - - recipe kmos_std_star{"--imethod=swNN";} - - product TELLURIC_WKF { PRO.CATG="TELLURIC_WKF"; PRO.EXT="tpl_0000.fits";} -} -action SCIENCE -{ - minRet = 1; maxRet = 1; - select file as MASTER_FLAT_WKF from calibFiles where PRO.CATG == "MASTER_FLAT_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as XCAL_WKF from calibFiles where PRO.CATG == "XCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as YCAL_WKF from calibFiles where PRO.CATG == "YCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 1; maxRet = 1; - select file as LCAL_WKF from calibFiles where PRO.CATG == "LCAL_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 0; maxRet = 1; - select file as ILLUM_CORR_WKF from calibFiles where PRO.CATG == "ILLUM_CORR_WKF" - and MJD-OBS > inputFile.MJD-OBS - 15. and MJD-OBS < inputFile.MJD-OBS + 15. - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 0; maxRet = 1; - select file as ILLUM_CORR_FLAT_WKF from calibFiles where PRO.CATG == "ILLUM_CORR_FLAT_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; - - minRet = 0; maxRet = 1; - select file as TELLURIC_WKF from calibFiles where PRO.CATG == "TELLURIC_WKF" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID - and MJD-OBS > inputFile.MJD-OBS - 0.2 and MJD-OBS < inputFile.MJD-OBS + 0.2; - - minRet = 0; maxRet = 1; - select file as TELLURIC from calibFiles where PRO.CATG == "TELLURIC" - and MJD-OBS > inputFile.MJD-OBS - 0.2 and MJD-OBS < inputFile.MJD-OBS + 0.2 - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID; - - minRet = 0; maxRet = 1; - select file as RESPONSE from calibFiles where PRO.CATG == "RESPONSE" - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID; - - minRet = 0; maxRet = 1; - select file as TELLURIC_CORR from calibFiles where PRO.CATG == "TELLURIC_CORR" - and MJD-OBS > inputFile.MJD-OBS - 0.2 and MJD-OBS < inputFile.MJD-OBS + 0.2 - and inputFile.INS.GRAT1.ID==INS.GRAT1.ID; - - minRet = 1; maxRet = 1; - select file as WAVE_BAND from calibFiles where PRO.CATG == "WAVE_BAND"; - - minRet = 0; maxRet = 1; - select file as OH_SPEC from calibFiles where PRO.CATG == "OH_SPEC" - and inputFile.INS.GRAT1.ID==FILT.ID; - - recipe kmos_sci_red{"--imethod=swNN";} -} - +//////////////////// +// Classification // +//////////////////// + +if (T) then +{ + REFLEX.CATG="UNDEFINED"; +} + +if DPR.CATG=="CALIB" and DPR.TYPE=="DARK" and DPR.TECH=="IMAGE" and INSTRUME=="KMOS" then +{ + RAW.TYPE = "DARK"; + REFLEX.CATG = "DARK"; + PACK.DIR = "PACK_DIR_DUMMY"; + CATG = "CALIB"; +} + +if DPR.CATG like "%CALIB%" and DPR.TYPE like "%FLAT%" and DPR.TYPE like "%OFF%" and DPR.TECH like "%IMAGE%" and INSTRUME=="KMOS" then +{ + RAW.TYPE = "FLAT"; + REFLEX.CATG = "FLAT_OFF"; + PACK.DIR = "PACK_DIR_DUMMY"; + CATG = "CALIB"; + +} +if DPR.CATG like "%CALIB%" and DPR.TYPE like "%FLAT%" and DPR.TYPE like "%LAMP%" and DPR.TECH like "%SPECTRUM%" and INSTRUME=="KMOS" then +{ + RAW.TYPE = "FLAT"; + REFLEX.CATG = "FLAT_ON"; + PACK.DIR = "PACK_DIR_DUMMY"; + CATG = "CALIB"; +} + +if DPR.CATG like "%CALIB%" and DPR.TYPE like "%WAVE%" and DPR.TYPE like "%LAMP%" and DPR.TECH like "%SPECTRUM%" and INSTRUME=="KMOS" then +{ + RAW.TYPE = "ARC"; + REFLEX.CATG = "ARC_ON"; + PACK.DIR = "PACK_DIR_DUMMY"; + CATG = "CALIB"; +} + +if DPR.CATG like "%CALIB%" and DPR.TYPE like "%WAVE%" and DPR.TYPE like "%OFF%" and DPR.TECH like "%IMAGE%" and INSTRUME=="KMOS" then +{ + RAW.TYPE = "ARC"; + REFLEX.CATG = "ARC_OFF"; + PACK.DIR = "PACK_DIR_DUMMY"; + CATG = "CALIB"; +} + +if DPR.CATG like "%CALIB%" and DPR.TYPE like "%FLAT%" and DPR.TYPE like "%SKY%" and DPR.TECH like "%IFU%" and INSTRUME=="KMOS" then +{ + RAW.TYPE = "ILLUM"; + REFLEX.CATG = "FLAT_SKY"; + PACK.DIR = "PACK_DIR_DUMMY"; + CATG = "CALIB"; +} + +if DPR.CATG like "%CALIB%" and DPR.TYPE like "%OBJECT%" and DPR.TYPE like "%SKY%" and DPR.TYPE like "%STD%" and DPR.TYPE like "%FLUX%" and DPR.TECH like "%IFU%" and INSTRUME=="KMOS" then +{ + RAW.TYPE = "STD"; + REFLEX.CATG = "STD"; + PACK.DIR = "PACK_DIR_DUMMY"; + CATG = "CALIB"; +} + +if DPR.CATG like "%SCIENCE%" and DPR.TYPE like "%OBJECT%" and DPR.TYPE like "%SKY%" and DPR.TECH like "%IFU%" and INSTRUME=="KMOS" then +{ + RAW.TYPE = "SCIENCE"; + REFLEX.CATG = "SCIENCE"; + PACK.DIR = "PACK_DIR_DUMMY"; + CATG = "SCIENCE"; + REFLEX.TARGET = "T"; +} + +if PRO.CATG=="WAVE_BAND" and INSTRUME=="KMOS" then +{ + REFLEX.CATG = "WAVE_BAND"; +} + +if PRO.CATG=="TELLURIC" and INSTRUME=="KMOS" then +{ + REFLEX.CATG = "TELLURIC"; + +} +if PRO.CATG=="TELLURIC_CORR" and INSTRUME=="KMOS" then +{ + REFLEX.CATG = "TELLURIC_CORR"; + PRO.CATG = "TELLURIC_CORR"; +} +if PRO.CATG=="TELLURIC_ONLY" and INSTRUME=="KMOS" then +{ + REFLEX.CATG = "TELLURIC_CORR"; + PRO.CATG = "TELLURIC_CORR"; +} +if PRO.CATG=="RESPONSE" and INSTRUME=="KMOS" then +{ + REFLEX.CATG = "RESPONSE"; +} + +if PRO.CATG=="REF_LINES" and INSTRUME=="KMOS" then +{ + REFLEX.CATG = "REF_LINES"; +} +if PRO.CATG=="ARC_LIST" and INSTRUME=="KMOS" then +{ + REFLEX.CATG = "ARC_LIST"; +} +if PRO.CATG == "ATMOS_MODEL" and INSTRUME=="KMOS" then +{ + REFLEX.CATG = "ATMOS_MODEL"; +} +if PRO.CATG == "SOLAR_SPEC" and INSTRUME=="KMOS" then +{ + REFLEX.CATG = "SOLAR_SPEC"; +} +if PRO.CATG == "SPEC_TYPE_LOOKUP" and INSTRUME=="KMOS" then +{ + REFLEX.CATG = "SPEC_TYPE_LOOKUP"; +} +if PRO.CATG == "OH_SPEC" and INSTRUME=="KMOS" then +{ + REFLEX.CATG = "OH_SPEC"; +} +if PRO.CATG == "KERNEL_LIBRARY" and INSTRUME=="KMOS" then +{ + REFLEX.CATG = "KERNEL_LIBRARY"; +} + +/////////////////////////////////////// +// Selection of actions and grouping // +/////////////////////////////////////// +minRet=3; +select execute(DARK) from inputFiles where RAW.TYPE=="DARK" + group by TPL.START ; +minRet=6; +select execute(FLAT) from inputFiles where RAW.TYPE == "FLAT" + group by TPL.START as (TPL_A,tpl) ; +minRet=2; +select execute(ARC) from inputFiles where RAW.TYPE == "ARC" + group by TPL.START as (TPL_A,tpl); +minRet=0; +select execute(ILLUM) from inputFiles where RAW.TYPE == "ILLUM" + group by TPL.START as (TPL_A,tpl); + +select execute(ILLUM_FLAT) from inputFiles where REFLEX.CATG == "FLAT_ON" + group by TPL.START as (TPL_A,tpl); +select execute(STD) from inputFiles where RAW.TYPE == "STD" + group by TPL.START as (TPL_A,tpl); +select execute(SCIENCE) from inputFiles where RAW.TYPE == "SCIENCE" + group by TPL.START as (TPL_A,tpl); + +///////////////////// +// Execute recipes // +///////////////////// +// The _WKF suffix is used to avoid association of already existing calibration frames +// All the associations should go through virtual products +action DARK +{ + recipe kmos_dark; + + product MASTER_DARK_WKF { PRO.CATG="MASTER_DARK_WKF"; PRO.EXT="tpl_0000.fits";} + product BADPIXEL_DARK_WKF { PRO.CATG="BADPIXEL_DARK_WKF"; PRO.EXT="tpl_0001.fits";} +} +action FLAT +{ + minRet = 1; maxRet = 1; + select file as BADPIXEL_DARK_WKF from calibFiles where + PRO.CATG=="BADPIXEL_DARK_WKF" + and inputFile.INSTRUME==INSTRUME; + + recipe kmos_flat; + + product MASTER_FLAT_WKF { PRO.CATG="MASTER_FLAT_WKF"; PRO.EXT="tpl_0000.fits";} + product XCAL_WKF { PRO.CATG="XCAL_WKF"; PRO.EXT="tpl_0001.fits";} + product YCAL_WKF { PRO.CATG="YCAL_WKF"; PRO.EXT="tpl_0002.fits";} + product BADPIXEL_FLAT_WKF { PRO.CATG="BADPIXEL_FLAT_WKF"; PRO.EXT="tpl_0003.fits";} + product FLAT_EDGE_WKF { PRO.CATG="FLAT_EDGE_WKF"; PRO.EXT="tpl_0004.fits";} +} +action ARC +{ + minRet = 1; maxRet = 1; + select file as XCAL_WKF from calibFiles where PRO.CATG == "XCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as YCAL_WKF from calibFiles where PRO.CATG == "YCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as FLAT_EDGE_WKF from calibFiles where PRO.CATG == "FLAT_EDGE_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as REF_LINES from calibFiles where PRO.CATG == "REF_LINES"; + + minRet = 1; maxRet = 1; + select file as WAVE_BAND from calibFiles where PRO.CATG == "WAVE_BAND"; + + minRet = 1; maxRet = 1; + select file as ARC_LIST from calibFiles where PRO.CATG == "ARC_LIST" + and inputFile.INS.GRAT1.ID==FILT.ID ; + + recipe kmos_wave_cal; + + product LCAL_WKF { PRO.CATG="LCAL_WKF"; PRO.EXT="tpl_0000.fits";} + product DET_IMG_WAVE_WKF { PRO.CATG="DET_IMG_WAVE_WKF"; PRO.EXT="tpl_0001.fits";} +} +action ILLUM +{ + minRet = 1; maxRet = 1; + select file as MASTER_DARK_WKF from calibFiles where PRO.CATG == "MASTER_DARK_WKF" ; + + minRet = 1; maxRet = 1; + select file as MASTER_FLAT_WKF from calibFiles where PRO.CATG == "MASTER_FLAT_WKF" and + inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 0; maxRet = 1; + select file as FLAT_EDGE_WKF from calibFiles where PRO.CATG == "FLAT_EDGE_WKF" and + inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as XCAL_WKF from calibFiles where PRO.CATG == "XCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as YCAL_WKF from calibFiles where PRO.CATG == "YCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as LCAL_WKF from calibFiles where PRO.CATG == "LCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as WAVE_BAND from calibFiles where PRO.CATG == "WAVE_BAND"; + + recipe kmos_illumination{"--imethod=swNN";} + + product ILLUM_CORR_WKF { PRO.CATG="ILLUM_CORR_WKF"; PRO.EXT="tpl_0000.fits";} +} + +action ILLUM_FLAT +{ + minRet = 1; maxRet = 1; + select file as XCAL_WKF from calibFiles where PRO.CATG == "XCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as YCAL_WKF from calibFiles where PRO.CATG == "YCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as LCAL_WKF from calibFiles where PRO.CATG == "LCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as WAVE_BAND from calibFiles where PRO.CATG == "WAVE_BAND"; + + + recipe kmos_illumination{"--imethod=swNN";} + + product ILLUM_CORR_FLAT_WKF { PRO.CATG="ILLUM_CORR_FLAT_WKF"; PRO.EXT="tpl_0000.fits";} +} +action STD +{ + minRet = 1; maxRet = 1; + select file as MASTER_FLAT_WKF from calibFiles where PRO.CATG == "MASTER_FLAT_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as XCAL_WKF from calibFiles where PRO.CATG == "XCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as YCAL_WKF from calibFiles where PRO.CATG == "YCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as LCAL_WKF from calibFiles where PRO.CATG == "LCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 0; maxRet = 1; + select file as ILLUM_CORR_WKF from calibFiles where PRO.CATG == "ILLUM_CORR_WKF" + and MJD-OBS > inputFile.MJD-OBS - 15. and MJD-OBS < inputFile.MJD-OBS + 15. + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 0; maxRet = 1; + select file as ILLUM_CORR_FLAT_WKF from calibFiles where PRO.CATG == "ILLUM_CORR_FLAT_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 0; maxRet = 1; + select file as SOLAR_SPEC from calibFiles where PRO.CATG == "SOLAR_SPEC" + and inputFile.INS.GRAT1.ID==FILT.ID; + + minRet = 0; maxRet = 1; + select file as ATMOS_MODEL from calibFiles where PRO.CATG == "ATMOS_MODEL" + and inputFile.INS.GRAT1.ID==FILT.ID; + + minRet = 0; maxRet = 1; + select file as SPEC_TYPE_LOOKUP from calibFiles where PRO.CATG == "SPEC_TYPE_LOOKUP"; + + minRet = 1; maxRet = 1; + select file as WAVE_BAND from calibFiles where PRO.CATG == "WAVE_BAND"; + + recipe kmos_std_star{"--imethod=swNN";} + + product TELLURIC_WKF { PRO.CATG="TELLURIC_WKF"; PRO.EXT="tpl_0000.fits";} +} +action SCIENCE +{ + minRet = 1; maxRet = 1; + select file as MASTER_FLAT_WKF from calibFiles where PRO.CATG == "MASTER_FLAT_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as XCAL_WKF from calibFiles where PRO.CATG == "XCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as YCAL_WKF from calibFiles where PRO.CATG == "YCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 1; maxRet = 1; + select file as LCAL_WKF from calibFiles where PRO.CATG == "LCAL_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 0; maxRet = 1; + select file as ILLUM_CORR_WKF from calibFiles where PRO.CATG == "ILLUM_CORR_WKF" + and MJD-OBS > inputFile.MJD-OBS - 15. and MJD-OBS < inputFile.MJD-OBS + 15. + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 0; maxRet = 1; + select file as ILLUM_CORR_FLAT_WKF from calibFiles where PRO.CATG == "ILLUM_CORR_FLAT_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID ; + + minRet = 0; maxRet = 1; + select file as TELLURIC_WKF from calibFiles where PRO.CATG == "TELLURIC_WKF" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID + and MJD-OBS > inputFile.MJD-OBS - 0.2 and MJD-OBS < inputFile.MJD-OBS + 0.2; + + minRet = 0; maxRet = 1; + select file as TELLURIC from calibFiles where PRO.CATG == "TELLURIC" + and MJD-OBS > inputFile.MJD-OBS - 0.2 and MJD-OBS < inputFile.MJD-OBS + 0.2 + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID; + + minRet = 0; maxRet = 1; + select file as RESPONSE from calibFiles where PRO.CATG == "RESPONSE" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID; + + minRet = 0; maxRet = 1; + select file as TELLURIC_CORR from calibFiles where PRO.CATG == "TELLURIC_CORR" + and MJD-OBS > inputFile.MJD-OBS - 0.2 and MJD-OBS < inputFile.MJD-OBS + 0.2 + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID; + + minRet = 1; maxRet = 1; + select file as WAVE_BAND from calibFiles where PRO.CATG == "WAVE_BAND"; + + minRet = 0; maxRet = 1; + select file as OH_SPEC from calibFiles where PRO.CATG == "OH_SPEC" + and inputFile.INS.GRAT1.ID==FILT.ID; + + minRet = 0; maxRet = 1; + select file as KERNEL_LIBRARY from calibFiles where PRO.CATG == "KERNEL_LIBRARY" + and inputFile.INS.GRAT1.ID==INS.GRAT1.ID; + + + recipe kmos_sci_red{"--imethod=swNN";} +} + diff -Nru cpl-plugin-kmos-1.4.3+dfsg/reflex/kmos.xml.in cpl-plugin-kmos-2.0.2+dfsg/reflex/kmos.xml.in --- cpl-plugin-kmos-1.4.3+dfsg/reflex/kmos.xml.in 2017-01-18 14:09:53.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/reflex/kmos.xml.in 2018-04-13 12:20:32.000000000 +0000 @@ -7,7 +7,7 @@ - + @@ -28,11 +28,11 @@ Edward A. Lee null <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> -The line width. The value is a double that defaults to 1.0. The vertical extent. The value is a double that defaults to 100.0. -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). -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The line width. The value is a double that defaults to 1.0. The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +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). The horizontal extent. The value is a double that defaults to 100.0. 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} 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." @@ -56,13 +56,13 @@ - + - + @@ -77,15 +77,15 @@ Edward A. Lee null <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> -The vertical extent. The value is a double that defaults to 100.0. The line width. The value is a double that defaults to 1.0. -The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The vertical extent. The value is a double that defaults to 100.0. 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). +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. The horizontal extent. The value is a double that defaults to 100.0. 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} 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." - + @@ -95,7 +95,7 @@ - + @@ -139,13 +139,13 @@ - + - + @@ -160,15 +160,15 @@ Edward A. Lee null <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> -The line width. The value is a double that defaults to 1.0. The vertical extent. The value is a double that defaults to 100.0. -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). -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The line width. The value is a double that defaults to 1.0. The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +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). The horizontal extent. The value is a double that defaults to 100.0. 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} 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." - + @@ -178,7 +178,7 @@ - + @@ -198,7 +198,7 @@ - + @@ -217,7 +217,7 @@ 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} 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. The text of the annotation. - + @@ -227,14 +227,14 @@ - + - + - + @@ -245,13 +245,13 @@ - + - + @@ -266,15 +266,15 @@ Edward A. Lee null <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> -The line width. The value is a double that defaults to 1.0. The vertical extent. The value is a double that defaults to 100.0. -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). -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The line width. The value is a double that defaults to 1.0. The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +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). The horizontal extent. The value is a double that defaults to 100.0. 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} 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." - + @@ -284,7 +284,7 @@ - + @@ -294,15 +294,15 @@ - + - + - + @@ -315,15 +315,15 @@ Edward A. Lee null <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> -The vertical extent. The value is a double that defaults to 100.0. The line width. The value is a double that defaults to 1.0. -The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The vertical extent. The value is a double that defaults to 100.0. 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). +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. The horizontal extent. The value is a double that defaults to 100.0. 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} 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." - + @@ -333,20 +333,20 @@ - + - + - + - + - + - + @@ -399,17 +399,17 @@ - + - + - + - + - + - + @@ -418,15 +418,15 @@ - + - + - + @@ -439,15 +439,15 @@ Edward A. Lee null <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> -The vertical extent. The value is a double that defaults to 100.0. The line width. The value is a double that defaults to 1.0. -The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The vertical extent. The value is a double that defaults to 100.0. 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). +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. The horizontal extent. The value is a double that defaults to 100.0. 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} 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." - + @@ -457,7 +457,7 @@ - + @@ -506,24 +506,24 @@ - + - + - + - + - + - + - + @@ -532,15 +532,15 @@ - + - + - + @@ -553,15 +553,15 @@ Edward A. Lee null <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> -The line width. The value is a double that defaults to 1.0. The vertical extent. The value is a double that defaults to 100.0. -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). -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The line width. The value is a double that defaults to 1.0. The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +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). The horizontal extent. The value is a double that defaults to 100.0. 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} 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." - + @@ -571,7 +571,7 @@ - + @@ -620,24 +620,24 @@ - + - + - + - + - + - + - + @@ -683,24 +683,24 @@ - + - + - + - + - + - + - + @@ -750,24 +750,24 @@ - + - + - + - + - + - + - + @@ -802,10 +802,10 @@ - + - + null Edward A. Lee @@ -836,12 +836,12 @@ - + - + null Edward A. Lee @@ -872,7 +872,7 @@ - + @@ -880,7 +880,7 @@ - + @@ -901,11 +901,11 @@ Edward A. Lee null <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> -The line width. The value is a double that defaults to 1.0. The vertical extent. The value is a double that defaults to 100.0. -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). -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The line width. The value is a double that defaults to 1.0. The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +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). The horizontal extent. The value is a double that defaults to 100.0. 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} 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." @@ -964,7 +964,7 @@ - + @@ -1011,7 +1011,7 @@ - + @@ -1031,7 +1031,7 @@ - + @@ -1050,7 +1050,7 @@ 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} 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. The text of the annotation. - + @@ -1060,9 +1060,9 @@ - + - + @@ -1070,13 +1070,13 @@ - + - + @@ -1091,15 +1091,15 @@ Edward A. Lee null <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> -The line width. The value is a double that defaults to 1.0. The vertical extent. The value is a double that defaults to 100.0. -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). -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The line width. The value is a double that defaults to 1.0. The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +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). The horizontal extent. The value is a double that defaults to 100.0. 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} 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." - + @@ -1109,7 +1109,7 @@ - + @@ -1169,8 +1169,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -1182,7 +1182,7 @@ - + @@ -1229,12 +1229,12 @@ - + - + @@ -1280,7 +1280,7 @@ - + @@ -1289,17 +1289,17 @@ - + - + - + - + - + - + @@ -1349,7 +1349,7 @@ - + @@ -1398,24 +1398,24 @@ - + - + - + - + - + - + - + @@ -1424,7 +1424,7 @@ - + @@ -1445,11 +1445,11 @@ Edward A. Lee null <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> -The vertical extent. The value is a double that defaults to 100.0. The line width. The value is a double that defaults to 1.0. -The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The vertical extent. The value is a double that defaults to 100.0. 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). +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. The horizontal extent. The value is a double that defaults to 100.0. 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} 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." @@ -1499,7 +1499,7 @@ - + @@ -1509,7 +1509,7 @@ - + @@ -1530,11 +1530,11 @@ Edward A. Lee null <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> -The line width. The value is a double that defaults to 1.0. The vertical extent. The value is a double that defaults to 100.0. -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). -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The line width. The value is a double that defaults to 1.0. The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +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). The horizontal extent. The value is a double that defaults to 100.0. 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} 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." @@ -1558,15 +1558,15 @@ - + - + - + @@ -1579,15 +1579,15 @@ Edward A. Lee null <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> -The vertical extent. The value is a double that defaults to 100.0. The line width. The value is a double that defaults to 1.0. -The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The vertical extent. The value is a double that defaults to 100.0. 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). +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. The horizontal extent. The value is a double that defaults to 100.0. 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} 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." - + @@ -1597,7 +1597,7 @@ - + @@ -1607,7 +1607,7 @@ - + @@ -1628,11 +1628,11 @@ Edward A. Lee null <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> -The line width. The value is a double that defaults to 1.0. The vertical extent. The value is a double that defaults to 100.0. -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). -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The line width. The value is a double that defaults to 1.0. The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +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). The horizontal extent. The value is a double that defaults to 100.0. 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} 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." @@ -1683,14 +1683,14 @@ - + - + @@ -1732,14 +1732,14 @@ - + - + @@ -1781,14 +1781,14 @@ - + - + @@ -1830,14 +1830,14 @@ - + - + @@ -1879,14 +1879,14 @@ - + - + @@ -1927,7 +1927,7 @@ - + @@ -1963,7 +1963,7 @@ - + @@ -2000,7 +2000,7 @@ - + @@ -2013,7 +2013,7 @@ - + @@ -2063,7 +2063,7 @@ - + @@ -2112,7 +2112,7 @@ - + @@ -2161,24 +2161,24 @@ - + - + - + - + - + - + - + @@ -2226,24 +2226,24 @@ - + - + - + - + - + - + - + @@ -2291,24 +2291,24 @@ - + - + - + - + - + - + - + @@ -2356,7 +2356,7 @@ - + @@ -2392,7 +2392,7 @@ - + @@ -2429,14 +2429,14 @@ - + - + @@ -2477,7 +2477,7 @@ - + @@ -2526,7 +2526,7 @@ - + @@ -2562,7 +2562,7 @@ - + @@ -2611,7 +2611,7 @@ - + @@ -2647,7 +2647,7 @@ - + @@ -2696,7 +2696,7 @@ - + @@ -2745,7 +2745,7 @@ - + @@ -2782,14 +2782,14 @@ - + - + @@ -2889,7 +2889,7 @@ - + @@ -2910,11 +2910,11 @@ Edward A. Lee null <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> -The line width. The value is a double that defaults to 1.0. The vertical extent. The value is a double that defaults to 100.0. -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). -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The line width. The value is a double that defaults to 1.0. The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +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). The horizontal extent. The value is a double that defaults to 100.0. 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} 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." @@ -2977,12 +2977,12 @@ - + - + null Edward A. Lee @@ -3021,7 +3021,7 @@ - + @@ -3070,24 +3070,24 @@ - + - + - + - + - + - + - + @@ -3137,24 +3137,24 @@ - + - + - + - + - + - + - + @@ -3204,24 +3204,24 @@ - + - + - + - + - + - + - + @@ -3271,24 +3271,24 @@ - + - + - + - + - + - + - + @@ -3338,24 +3338,24 @@ - + - + - + - + - + - + - + @@ -3405,24 +3405,24 @@ - + - + - + - + - + - + - + @@ -3472,24 +3472,24 @@ - + - + - + - + - + - + - + @@ -3539,24 +3539,24 @@ - + - + - + - + - + - + - + @@ -3600,7 +3600,7 @@ - + @@ -3620,7 +3620,7 @@ - + @@ -3639,7 +3639,7 @@ 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} 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. The text of the annotation. - + @@ -3649,9 +3649,9 @@ - + - + @@ -3659,13 +3659,13 @@ - + - + @@ -3680,15 +3680,15 @@ Edward A. Lee null <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> -The vertical extent. The value is a double that defaults to 100.0. The line width. The value is a double that defaults to 1.0. -The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The vertical extent. The value is a double that defaults to 100.0. 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). +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. The horizontal extent. The value is a double that defaults to 100.0. 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} 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." - + @@ -3698,7 +3698,7 @@ - + @@ -3752,17 +3752,17 @@ - + - + - + - + - + - + @@ -3854,86 +3854,409 @@ - + + null -ESO -1.0 -<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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a comma separated list of regular expressions: each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> -The input data -The rejected SoF - - - - +Edward A. Lee +null +<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> + - - + + - + - + - + - + + + - + + + + -S- + + - - - - - - - - - - + + + + + + + + + + +null +Edward A. Lee +null +<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> + + + + - + + + + + + + + + - + + + + + -S- + + + + + + + + + + + + + +null +Edward A. Lee +null +<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> + + + + - + + + + + + + + + - + + + + -S- + + - + - + - + - + + + - + - + - + - + - + - - - - - - - - - - - - - + + + + + + + + - + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + +null +ESO +1.0 +<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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a comma separated list of regular expressions: each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> +The input data +The rejected SoF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3971,6 +4294,13 @@ + + + + + + + @@ -3978,16 +4308,16 @@ - + - + - + @@ -4035,7 +4365,7 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + @@ -4061,8 +4391,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -4098,8 +4428,8 @@ 2.0 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 The input sof -The number of groups generated The grouped sofs +The number of groups generated @@ -4144,8 +4474,8 @@ 2.0 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) The input sofs -The number of groups to collect The grouped sof +The number of groups to collect @@ -4195,7 +4525,50 @@ - + +null +null +null +<p>The RecipeExecuter executes one CPL recipe. The recipe can be chosen only when you instantiate the component: at the moment the user is presented with a list of the available recipes (the output of esorex --recipes). After the user selects the recipe the actor queries EsoRex for the recipe parameters and adds them to the actor. Each parameter is set to the default value: if the user wants to change any of the parameters then he can enter his own value or he can write the special value PORT, in which case the value is taken from the input port SoP.</p><p>The actor has three modes: Run, Skip and Disabled</p><p>Note: since this actor has very different behaviour depending on the pipeline recipe to which it is associated, it is not present in the left hand side actor list, and instead it must be instantiated from the menu.</p> +the recipe input parameters +the outputs not matching any of the output categories +the logs generated by EsoRex, empty if lazy mode is triggered +the inputs not matching any of the input categories +the warnings generated by EsoRex, empty if lazy mode is triggered +the input files +the output files +the errors generated by EsoRex, empty if lazy mode is triggered +the parameters used in the last execution of the recipe +a list of file categories separated by a comma or a space: only input files belonging to one of these categories will be passed to the recipe +the selected pipeline recipe (cannot be changed) +a list of file categories separated by a comma or a space: only products belonging to one of these categories will be broadcast to the output port +if true then the execution is paused just before executing the recipe + +the directory the recipe will use as a working directory +if true, the temporary directories (where the logs, the final and the temporary products of the recipe are created) are cleaned before the execution +if true then the actor will check whether the pipeline recipe has already been executed with the same input files and with the same recipe parameters. If this is the case then the recipe will not be executed, and instead the previously generated products (which are the same as those that would have been generated if the recipe were executed, except for a timestamp) will be broadcast to the output port. +<p>Run: the recipe will be executed (see lazy mode)</p><p>Skip: the inputs are broadcast to the output with the following modifications: input files will be filtered according to input and output tags and recipe parameters will be filtered based on the recipe and whether the parameter is set to PORT</p><p>Disabled: the recipe is not executed and an empty SoF is generated on the output port</p> +<p>how the purpose of the input files will be sent to the output:</p><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. This is the default mode, and it means that the actor has completed a reduction step and removes it from the purpose chain</p><p>Set to universal: set the output purpose to universal</p> +Parameter name: cmax. Default value:1 +Parameter name: citer. Default value:3 +the directory where the EsoRex logs will be saved +Parameter name: cneg_rej. Default value:3 +Parameter name: cpos_rej. Default value:3 +Parameter name: cmethod. Default value:ksigma +Parameter name: file_extension. Default value:false +the directory where the products will be created +Parameter name: neg_bad_pix_rej. Default value:50 +Parameter name: pos_bad_pix_rej. Default value:50 +Parameter name: oscan. Default value:true +<p>it specifies the behavior of the actor if the recipe fails</p> <p>Stop: the actor produces an error message and the workflows stops. This is the default</p><p>Continue: the actor outputs an empty SoF</p><p>Ask: the actor pops up a window and asks the user whether he wants to continue or stop the execution</p> +additional parameters passed to EsoRex +Parameter name: cmin. Default value:1 +if true then the execution is paused after the execution of the recipe +if true then an empty sof on the input port will be broadcast to the output without executing the recipe + + + + @@ -4251,7 +4624,7 @@ - + @@ -4297,7 +4670,7 @@ - + @@ -4345,7 +4718,7 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + @@ -4367,8 +4740,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -4402,8 +4775,8 @@ 2.0 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 The input sof -The grouped sofs The number of groups generated +The grouped sofs @@ -4450,8 +4823,8 @@ 2.0 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) The input sofs -The grouped sof The number of groups to collect +The grouped sof @@ -4503,7 +4876,51 @@ - + +null +null +null +<p>The RecipeExecuter executes one CPL recipe. The recipe can be chosen only when you instantiate the component: at the moment the user is presented with a list of the available recipes (the output of esorex --recipes). After the user selects the recipe the actor queries EsoRex for the recipe parameters and adds them to the actor. Each parameter is set to the default value: if the user wants to change any of the parameters then he can enter his own value or he can write the special value PORT, in which case the value is taken from the input port SoP.</p><p>The actor has three modes: Run, Skip and Disabled</p><p>Note: since this actor has very different behaviour depending on the pipeline recipe to which it is associated, it is not present in the left hand side actor list, and instead it must be instantiated from the menu.</p> +the recipe input parameters +the outputs not matching any of the output categories +the logs generated by EsoRex, empty if lazy mode is triggered +the inputs not matching any of the input categories +the warnings generated by EsoRex, empty if lazy mode is triggered +the input files +the output files +the errors generated by EsoRex, empty if lazy mode is triggered +the parameters used in the last execution of the recipe +a list of file categories separated by a comma or a space: only input files belonging to one of these categories will be passed to the recipe +the selected pipeline recipe (cannot be changed) +a list of file categories separated by a comma or a space: only products belonging to one of these categories will be broadcast to the output port +if true then the execution is paused just before executing the recipe + +the directory the recipe will use as a working directory +if true, the temporary directories (where the logs, the final and the temporary products of the recipe are created) are cleaned before the execution +if true then the actor will check whether the pipeline recipe has already been executed with the same input files and with the same recipe parameters. If this is the case then the recipe will not be executed, and instead the previously generated products (which are the same as those that would have been generated if the recipe were executed, except for a timestamp) will be broadcast to the output port. +<p>Run: the recipe will be executed (see lazy mode)</p><p>Skip: the inputs are broadcast to the output with the following modifications: input files will be filtered according to input and output tags and recipe parameters will be filtered based on the recipe and whether the parameter is set to PORT</p><p>Disabled: the recipe is not executed and an empty SoF is generated on the output port</p> +<p>how the purpose of the input files will be sent to the output:</p><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. This is the default mode, and it means that the actor has completed a reduction step and removes it from the purpose chain</p><p>Set to universal: set the output purpose to universal</p> +Parameter name: cmin. Default value:1 +Parameter name: cmax. Default value:1 +the directory where the EsoRex logs will be saved +Parameter name: citer. Default value:3 +Parameter name: cneg_rej. Default value:3 +Parameter name: cpos_rej. Default value:3 +Parameter name: cmethod. Default value:ksigma +the directory where the products will be created +Parameter name: suppress_extension. Default value:false +Parameter name: surrounding_pixels. Default value:5 +Parameter name: badpix_thresh. Default value:35 +<p>it specifies the behavior of the actor if the recipe fails</p> <p>Stop: the actor produces an error message and the workflows stops. This is the default</p><p>Continue: the actor outputs an empty SoF</p><p>Ask: the actor pops up a window and asks the user whether he wants to continue or stop the execution</p> +additional parameters passed to EsoRex +Parameter name: angle. Default value:370 +Parameter name: det. Default value:0 +if true then the execution is paused after the execution of the recipe +if true then an empty sof on the input port will be broadcast to the output without executing the recipe + + + + @@ -4785,7 +5202,7 @@ - + @@ -4816,7 +5233,7 @@ - + @@ -4833,9 +5250,9 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + - + @@ -4945,115 +5362,7 @@ - - -null -Edward A. Lee -null -<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> - - - - - - - - - - - - - - - - - - - - -S- - - - - - - - - - - - - -null -Edward A. Lee -null -<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> - - - - - - - - - - - - - - - - - - - - -S- - - - - - - - - - - - - -null -Edward A. Lee -null -<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> - - - - - - - - - - - - - - - - - - - - -S- - - - - - - - - - - - + @@ -5079,8 +5388,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -5099,14 +5408,14 @@ - + - + @@ -5118,8 +5427,8 @@ 2.0 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 The input sof -The number of groups generated The grouped sofs +The number of groups generated @@ -5131,7 +5440,7 @@ - + @@ -5158,22 +5467,26 @@ + + + + null ESO 2.0 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 complete is false. When the token on the iteration complete port is true the actor starts accepting again tokens from the sof in and sop in ports. -The signal to terminate the current iteration The loop input sof -The loop input sop +The signal to terminate the current iteration The input sop +The loop input sop The output sop The input sof The output sof - + @@ -5183,19 +5496,19 @@ - + - + - + @@ -5213,7 +5526,7 @@ - + @@ -5247,7 +5560,7 @@ Edward Lee, Steve Neuendorffer, Jerome Blanc null 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 value deterministically (independent of the schedule of execution of the actors). If delayed is false, then the change to the value of the variable is performed immediately. This allows more frequent reconfiguration, and can mimic the operation of PGM's graph variables. Note that the variable name is observed during preinitialize(). If it is changed after that, the change will not take effect until the next time the model is executed. Moreover, the type of the variable is constrained in preinitialize() to be at least that of the input port for this actor. The variable can be either any attribute that implements the Settable interface. If it is in addition an instance of Variable, then the input token is used directly to set the value, and the type of the variable is constrained to be the same as the type of the input. Otherwise, then input token is converted to a string and the setExpression() method on the variable is used to set the value. The variable can occur anywhere in the hierarchy above the current level. If the variable is not found in the container, then the container of the container is checked until we reach the top level. - + @@ -5257,10 +5570,20 @@ - + - + + + + + + + + + + + @@ -5312,7 +5635,7 @@ - + If true, the script does not save the standard output and the standard error of the script execution in the logging directory. This feature is useful if you are using Pyraf and you experience occasional crashes. @@ -5391,7 +5714,7 @@ - + @@ -5408,9 +5731,9 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + - + @@ -5425,14 +5748,25 @@ + + - + + + + + + + + + + - + @@ -5453,7 +5787,7 @@ 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. 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. The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) - + @@ -5469,9 +5803,9 @@ - + - + @@ -5499,7 +5833,7 @@ - + @@ -5518,10 +5852,14 @@ + + + + @@ -5534,8 +5872,8 @@ 2.0 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) The input sofs -The grouped sof The number of groups to collect +The grouped sof @@ -5548,7 +5886,7 @@ - + @@ -5559,12 +5897,12 @@ - + - + @@ -5621,25 +5959,54 @@ - - - - - + +null +null +null +<p>The RecipeExecuter executes one CPL recipe. The recipe can be chosen only when you instantiate the component: at the moment the user is presented with a list of the available recipes (the output of esorex --recipes). After the user selects the recipe the actor queries EsoRex for the recipe parameters and adds them to the actor. Each parameter is set to the default value: if the user wants to change any of the parameters then he can enter his own value or he can write the special value PORT, in which case the value is taken from the input port SoP.</p><p>The actor has three modes: Run, Skip and Disabled</p><p>Note: since this actor has very different behaviour depending on the pipeline recipe to which it is associated, it is not present in the left hand side actor list, and instead it must be instantiated from the menu.</p> +the recipe input parameters +the outputs not matching any of the output categories +the logs generated by EsoRex, empty if lazy mode is triggered +the inputs not matching any of the input categories +the warnings generated by EsoRex, empty if lazy mode is triggered +the input files +the output files +the errors generated by EsoRex, empty if lazy mode is triggered +the parameters used in the last execution of the recipe +a list of file categories separated by a comma or a space: only input files belonging to one of these categories will be passed to the recipe +the selected pipeline recipe (cannot be changed) +a list of file categories separated by a comma or a space: only products belonging to one of these categories will be broadcast to the output port +if true then the execution is paused just before executing the recipe + +the directory the recipe will use as a working directory +if true, the temporary directories (where the logs, the final and the temporary products of the recipe are created) are cleaned before the execution +if true then the actor will check whether the pipeline recipe has already been executed with the same input files and with the same recipe parameters. If this is the case then the recipe will not be executed, and instead the previously generated products (which are the same as those that would have been generated if the recipe were executed, except for a timestamp) will be broadcast to the output port. +<p>Run: the recipe will be executed (see lazy mode)</p><p>Skip: the inputs are broadcast to the output with the following modifications: input files will be filtered according to input and output tags and recipe parameters will be filtered based on the recipe and whether the parameter is set to PORT</p><p>Disabled: the recipe is not executed and an empty SoF is generated on the output port</p> +<p>how the purpose of the input files will be sent to the output:</p><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. This is the default mode, and it means that the actor has completed a reduction step and removes it from the purpose chain</p><p>Set to universal: set the output purpose to universal</p> +the directory where the EsoRex logs will be saved +Parameter name: angle. Default value:370 +Parameter name: det. Default value:0 +Parameter name: b_samples. Default value:2048 +the directory where the products will be created +Parameter name: lines_estimation. Default value:false +Parameter name: suppress_extension. Default value:false +Parameter name: order. Default value:0 +<p>it specifies the behavior of the actor if the recipe fails</p> <p>Stop: the actor produces an error message and the workflows stops. This is the default</p><p>Continue: the actor outputs an empty SoF</p><p>Ask: the actor pops up a window and asks the user whether he wants to continue or stop the execution</p> +additional parameters passed to EsoRex +if true then the execution is paused after the execution of the recipe +if true then an empty sof on the input port will be broadcast to the output without executing the recipe + - - - - - + - + + @@ -5673,14 +6040,17 @@ - + -null -Xiaojun Liu -null - 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(self) : 4. if not self.input.hasToken(0) : 5. return 6. s = self.scale.getToken() 7. t = self.input.get(0) 8. self.output.broadcast(s.multiply(t)) </pre> Line 1 defines a Python class Main. This name is fixed. An instance of this class is created when the actor is initialized. Line 2 is a description of the purpose of the script. Lines 3-8 define the fire() method. In the method body, <i>input</i> and <i>output</i> are ports that have been added to the actor, and <i>scale</i> is a parameter added to the actor (these can be added in the XML that defines the actor instance in an actor library). The Main class can provide other methods in the Executable interface as needed. <p> In the script, use <code>self.actor</code> to access the actor. For example, <code>self.actor.getDirector()</code> returns the current director of the actor. For debugging, use <code>self.actor.debug(someMessage)</code>. The final message sent to the debug listeners of the actor will have the string "From script: " inserted at the beginning. To avoid generating the debug message when there are no listeners, use: <pre> if self.actor.isDebugging() : self.actor.debug(someMessage) </pre> <p> This class relies on Jython, which is a Java implementation of Python. </p> Follow the links below for more information about the Python language, licensing, downloads, etc. <p><a href="http://www.python.org" target="_top">Python</a></p> <p><a href="http://www.jython.org" target="_top">Jython</a></p> <p><a href="http://www.jython.org/docs/differences.html">Differences between Jython and the C version of Python</a></p> <p><a href="http://www.jython.org/Project/userguide.html#the-jython-registry">The Jython Registry</a> - information about how to set the search path. </p> - +This actor is used to set the initial loop parameters defined on the workflow canvas. +ESO +2.9 +<p>This actor could be used to set a number of string variables in a workflow canvas. The typical use case is in an interactive loop: The interactive window allows to change some of the parameters and you would like to use those parameters as default initial values the next time the loop kicks in. Usually this initial parameters are set with variables in the canvas that start with init_ (or INIT_) and the name of the recipe parameter. This actor will read from its input port sop_in a set of recipe parameters and will search for variables in the canvas with those parameter names prefixed with init_, changing their values to the specified in the input </p> +Values from the input port will simply be forwarded to this output port. This can be used as a control/trigger signal in subsequent parts of the workflow, such as controlling loop structures. +The input set of parameters in a JSON string format that will be used to update the workflow parameters in the current scope. This can be an empty list, in which case no parameters are updated. +The Python class name to execute. + @@ -5692,22 +6062,102 @@ - + - + + + + + + + + + + + + + + + + +null +Paul Whitaker +$Id: Synchronizer.java 61458 2011-07-11 19:54:07Z cxh $ + This actor implements a token synchronizer. It has one input port and one output port, both of which are multiports. When at least one token exists on every input channel, exactly one token is consumed from each input channel, and the tokens are output on the corresponding output channels. If any input channel is missing a token, then no output is produced. <p> Note that the ordering of channels of a multiport is determined by the order of connection. Thus the n<sup>th</sup> input channel connected corresponds to the n<sup>th</sup> output channel connected. +The input port. This base class imposes no type constraints except that the type of the input cannot be greater than the type of the output. +The output port. By default, the type of this output is constrained to be at least that of the input. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Steve Neuendorffer, Edward A. Lee +null +<p>The SampleDelay actor outputs a set of tokens that are used as initial input values when a workflow starts up. The actor is used to break dependency cycles created by loops in SDF models. </p> <p>Feedback loops, created when an actor cycles its own output into its input port, can create "deadlock" errors under an SDF Director. The deadlock errors occur because the actor depends on its own output value as an initial input. To fix this problem, use a SampleDelay actor to inject an initial value into the workflow.</p> <p>Specify an array of initial values with the initialOutputs parameter. By default, the actor produces a single integer token, {0}.</p> +An input port that accepts tokens of any type. +An output port that broadcasts the initial tokens. +The values produced when the workflow is initialized. The value must be an array token, and defaults to an array that contains a single integer token, {0}. + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -5730,13 +6180,23 @@ - + + + - + + + + + + + + + @@ -5749,30 +6209,38 @@ - + + - - + + - + + - - - - + + + + + + + + + + @@ -5785,7 +6253,7 @@ - + @@ -5793,11 +6261,11 @@ - + - + @@ -5812,6 +6280,8 @@ + + @@ -5841,22 +6311,20 @@ - + - + - - - + - + - + @@ -5894,9 +6362,9 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + - + @@ -5973,8 +6441,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -6036,8 +6504,8 @@ null null <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> -A multiport that accepts tokens of any one type. The type must be consistent. An output port that broadcasts an assembled array. The type of the array elements matches that of the input. +A multiport that accepts tokens of any one type. The type must be consistent. @@ -6079,7 +6547,7 @@ - + @@ -6183,10 +6651,10 @@ Xiaojun Liu, Edward A. Lee, Steve Neuendorffer null <p>The External Execution actor executes a system command from a workflow. The actor accepts a command, a directory and environment in which to execute the command, and a command input string. Once the command has finished executing, the actor will output the execution results along with any errors. If no results are generated, the actor will output an empty string.</p> <p>The External Execution actor depends on system-specific executables and is operating-system specific.</p> <p>To mimic the effect of executing a command in a shell interpreter, set the command parameter to "cmd" (Windows) or "sh" (Windows with Cygwin or Linux), and then provide commands, as a string, via the input port. Note that each passed command must be terminated with a newline. For example, to open a workflow in vergil and run it, set command to "sh" and use a StringConstant actor to pass the input port the string: "vergil -run model.xml\n exit\n"</p> -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. An input port that accepts strings to pass to the standard input of the subprocess. Note that a newline is not appended to the string. If you require a newline, add one using the AddSubtract actor. This port is an input port of type String. -An output port that broadcasts any errors generated by the command execution. Errors are output as a string after the command has finished executing. If the execution generates no errors, an empty string is output. +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. If connected, a token must be available on this port before actor will execute. +An output port that broadcasts any errors generated by the command execution. Errors are output as a string after the command has finished executing. If the execution generates no errors, an empty string is output. An output port that broadcasts the command's exit code. A non-zero value signifies an error. 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="", value = ""}}, then the environment from the parent process is used. If environmental variables are set with the parameter, the parent values may not be passed to the process. To view the current environment, use the "env" command. 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. @@ -6212,17 +6680,17 @@ - + - + - + - + - + - + @@ -6234,7 +6702,7 @@ - + @@ -6349,7 +6817,7 @@ - + @@ -6366,9 +6834,9 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + - + @@ -6382,8 +6850,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -6413,7 +6881,7 @@ - + @@ -6441,13 +6909,11 @@ - - - + - + - + @@ -6455,10 +6921,10 @@ - + - + @@ -6490,7 +6956,7 @@ Edward Lee, Steve Neuendorffer, Jerome Blanc null 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 value deterministically (independent of the schedule of execution of the actors). If delayed is false, then the change to the value of the variable is performed immediately. This allows more frequent reconfiguration, and can mimic the operation of PGM's graph variables. Note that the variable name is observed during preinitialize(). If it is changed after that, the change will not take effect until the next time the model is executed. Moreover, the type of the variable is constrained in preinitialize() to be at least that of the input port for this actor. The variable can be either any attribute that implements the Settable interface. If it is in addition an instance of Variable, then the input token is used directly to set the value, and the type of the variable is constrained to be the same as the type of the input. Otherwise, then input token is converted to a string and the setExpression() method on the variable is used to set the value. The variable can occur anywhere in the hierarchy above the current level. If the variable is not found in the container, then the container of the container is checked until we reach the top level. - + @@ -6500,11 +6966,11 @@ - + - + @@ -6527,24 +6993,74 @@ - - + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - + - + + + + @@ -6567,9 +7083,9 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + - + @@ -6662,11 +7178,11 @@ Edward A. Lee null <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> -The vertical extent. The value is a double that defaults to 100.0. The line width. The value is a double that defaults to 1.0. -The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The vertical extent. The value is a double that defaults to 100.0. 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). +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. The horizontal extent. The value is a double that defaults to 100.0. 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} 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." @@ -6695,8 +7211,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -6938,7 +7454,7 @@ - + @@ -7186,7 +7702,7 @@ - + @@ -7351,7 +7867,7 @@ - + @@ -7399,7 +7915,7 @@ - + @@ -7435,7 +7951,7 @@ - + @@ -7452,9 +7968,9 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + - + @@ -7529,7 +8045,7 @@ - + @@ -7537,43 +8053,6 @@ - - -null -Edward A. Lee -null -<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> - - - - - - - - - - - - - - - - - - - - - -S- - - - - - - - - - - null @@ -7759,117 +8238,6 @@ - - -null -Edward A. Lee -null -<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> - - - - - - - - - - - - - - - - - - - - - -S- - - - - - - - - - - - - -null -Edward A. Lee -null -<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> - - - - - - - - - - - - - - - - - - - - - -S- - - - - - - - - - - - - -null -Edward A. Lee -null -<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> - - - - - - - - - - - - - - - - - - - - - -S- - - - - - - - - - - null @@ -7939,7 +8307,7 @@ - + @@ -7962,8 +8330,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -7975,7 +8343,7 @@ - + @@ -8011,7 +8379,7 @@ - + @@ -8048,7 +8416,7 @@ - + @@ -8122,7 +8490,7 @@ - + @@ -8159,7 +8527,7 @@ - + @@ -8196,7 +8564,7 @@ - + @@ -8233,87 +8601,21 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -null -Edward A. Lee -null -<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> -The line width. The value is a double that defaults to 1.0. -The vertical extent. The value is a double that defaults to 100.0. -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). -Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. -The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. -The horizontal extent. The value is a double that defaults to 100.0. -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} -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." - - - - - - - - - - - - - - - - + - - - - - - - - - - + @@ -8323,8 +8625,8 @@ 2.0 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 The input sof -The grouped sofs The number of groups generated +The grouped sofs @@ -8363,22 +8665,26 @@ + + + + null ESO 2.0 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 complete is false. When the token on the iteration complete port is true the actor starts accepting again tokens from the sof in and sop in ports. -The loop input sof The signal to terminate the current iteration -The input sop +The loop input sof The loop input sop +The input sop The output sop The input sof The output sof - + @@ -8388,7 +8694,7 @@ - + @@ -8452,7 +8758,7 @@ Edward Lee, Steve Neuendorffer, Jerome Blanc null 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 value deterministically (independent of the schedule of execution of the actors). If delayed is false, then the change to the value of the variable is performed immediately. This allows more frequent reconfiguration, and can mimic the operation of PGM's graph variables. Note that the variable name is observed during preinitialize(). If it is changed after that, the change will not take effect until the next time the model is executed. Moreover, the type of the variable is constrained in preinitialize() to be at least that of the input port for this actor. The variable can be either any attribute that implements the Settable interface. If it is in addition an instance of Variable, then the input token is used directly to set the value, and the type of the variable is constrained to be the same as the type of the input. Otherwise, then input token is converted to a string and the setExpression() method on the variable is used to set the value. The variable can occur anywhere in the hierarchy above the current level. If the variable is not found in the container, then the container of the container is checked until we reach the top level. - + @@ -8462,10 +8768,20 @@ - + - + + + + + + + + + + + @@ -8592,7 +8908,7 @@ - + @@ -8609,9 +8925,9 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + - + @@ -8626,14 +8942,23 @@ + + + + + + + + + - + @@ -8654,7 +8979,7 @@ 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. 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. The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) - + @@ -8735,8 +9060,8 @@ 2.0 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) The input sofs -The number of groups to collect The grouped sof +The number of groups to collect @@ -8749,7 +9074,7 @@ - + @@ -8839,7 +9164,7 @@ - + @@ -8864,45 +9189,79 @@ - - - - + + + null -Xiaojun Liu +null null - 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(self) : 4. if not self.input.hasToken(0) : 5. return 6. s = self.scale.getToken() 7. t = self.input.get(0) 8. self.output.broadcast(s.multiply(t)) </pre> Line 1 defines a Python class Main. This name is fixed. An instance of this class is created when the actor is initialized. Line 2 is a description of the purpose of the script. Lines 3-8 define the fire() method. In the method body, <i>input</i> and <i>output</i> are ports that have been added to the actor, and <i>scale</i> is a parameter added to the actor (these can be added in the XML that defines the actor instance in an actor library). The Main class can provide other methods in the Executable interface as needed. <p> In the script, use <code>self.actor</code> to access the actor. For example, <code>self.actor.getDirector()</code> returns the current director of the actor. For debugging, use <code>self.actor.debug(someMessage)</code>. The final message sent to the debug listeners of the actor will have the string "From script: " inserted at the beginning. To avoid generating the debug message when there are no listeners, use: <pre> if self.actor.isDebugging() : self.actor.debug(someMessage) </pre> <p> This class relies on Jython, which is a Java implementation of Python. </p> Follow the links below for more information about the Python language, licensing, downloads, etc. <p><a href="http://www.python.org" target="_top">Python</a></p> <p><a href="http://www.jython.org" target="_top">Jython</a></p> <p><a href="http://www.jython.org/docs/differences.html">Differences between Jython and the C version of Python</a></p> <p><a href="http://www.jython.org/Project/userguide.html#the-jython-registry">The Jython Registry</a> - information about how to set the search path. </p> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +<p>The RecipeExecuter executes one CPL recipe. The recipe can be chosen only when you instantiate the component: at the moment the user is presented with a list of the available recipes (the output of esorex --recipes). After the user selects the recipe the actor queries EsoRex for the recipe parameters and adds them to the actor. Each parameter is set to the default value: if the user wants to change any of the parameters then he can enter his own value or he can write the special value PORT, in which case the value is taken from the input port SoP.</p><p>The actor has three modes: Run, Skip and Disabled</p><p>Note: since this actor has very different behaviour depending on the pipeline recipe to which it is associated, it is not present in the left hand side actor list, and instead it must be instantiated from the menu.</p> +the recipe input parameters +the outputs not matching any of the output categories +the logs generated by EsoRex, empty if lazy mode is triggered +the inputs not matching any of the input categories +the warnings generated by EsoRex, empty if lazy mode is triggered +the input files +the output files +the errors generated by EsoRex, empty if lazy mode is triggered +the parameters used in the last execution of the recipe +if true then the actor will check whether the pipeline recipe has already been executed with the same input files and with the same recipe parameters. If this is the case then the recipe will not be executed, and instead the previously generated products (which are the same as those that would have been generated if the recipe were executed, except for a timestamp) will be broadcast to the output port. +additional parameters passed to EsoRex +the selected pipeline recipe (cannot be changed) +the directory where the products will be created +<p>how the purpose of the input files will be sent to the output:</p><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. This is the default mode, and it means that the actor has completed a reduction step and removes it from the purpose chain</p><p>Set to universal: set the output purpose to universal</p> +Parameter name: no_subtract. Default value:false +Parameter name: no_combine. Default value:false +Parameter name: edge_nan. Default value:false +if true then an empty sof on the input port will be broadcast to the output without executing the recipe +Parameter name: xcal_interpolation. Default value:true +<p>Run: the recipe will be executed (see lazy mode)</p><p>Skip: the inputs are broadcast to the output with the following modifications: input files will be filtered according to input and output tags and recipe parameters will be filtered based on the recipe and whether the parameter is set to PORT</p><p>Disabled: the recipe is not executed and an empty SoF is generated on the output port</p> +if true then the execution is paused after the execution of the recipe +Parameter name: extrapolate. Default value:false +Parameter name: fast_mode. Default value:false +Parameter name: background. Default value:false +Parameter name: flux. Default value:false +Parameter name: filename. Default value: +Parameter name: neighborhoodRange. Default value:1.001 +Parameter name: cmin. Default value:1 +if true then the execution is paused just before executing the recipe +Parameter name: cmax. Default value:1 +Parameter name: citer. Default value:3 +Parameter name: cneg_rej. Default value:3 +Parameter name: cpos_rej. Default value:3 +Parameter name: cmethod. Default value:ksigma +Parameter name: collapse_combined. Default value:false +Parameter name: suppress_extension. Default value:false +Parameter name: collapse_reconstructed. Default value:false +Parameter name: pix_scale. Default value:0.2 +Parameter name: save_interims. Default value:false +Parameter name: oscan. Default value:true +Parameter name: ifus. Default value: +Parameter name: name. Default value: +Parameter name: fmethod. Default value:gauss +Parameter name: method. Default value:header +Parameter name: smethod. Default value:CS +Parameter name: imethod. Default value:CS +the directory where the EsoRex logs will be saved + +a list of file categories separated by a comma or a space: only input files belonging to one of these categories will be passed to the recipe +Parameter name: velocity_offset. Default value:0 +Parameter name: obj_sky_table. Default value: +<p>it specifies the behavior of the actor if the recipe fails</p> <p>Stop: the actor produces an error message and the workflows stops. This is the default</p><p>Continue: the actor outputs an empty SoF</p><p>Ask: the actor pops up a window and asks the user whether he wants to continue or stop the execution</p> +Parameter name: b_samples. Default value:2048 +Parameter name: tbsub. Default value:true +a list of file categories separated by a comma or a space: only products belonging to one of these categories will be broadcast to the output port +Parameter name: stretch_resampling. Default value:spline +Parameter name: stretch_degree. Default value:8 +Parameter name: stretch. Default value:false +Parameter name: discard_subband. Default value:false +Parameter name: skip_sky_oh_align. Default value:false +the directory the recipe will use as a working directory +Parameter name: sky_tweak. Default value:false +if true, the temporary directories (where the logs, the final and the temporary products of the recipe are created) are cleaned before the execution + @@ -8932,17 +9291,20 @@ - + - + - + - + - + - + + + + @@ -8969,476 +9331,125 @@ - - -null -ESO -1.0 -<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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> -The input data -The rejected SoF - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - - - - - - -null +This actor is used to set the initial loop parameters defined on the workflow canvas. ESO -1.0 -<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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> -The input data -The rejected SoF - - - - +2.9 +<p>This actor could be used to set a number of string variables in a workflow canvas. The typical use case is in an interactive loop: The interactive window allows to change some of the parameters and you would like to use those parameters as default initial values the next time the loop kicks in. Usually this initial parameters are set with variables in the canvas that start with init_ (or INIT_) and the name of the recipe parameter. This actor will read from its input port sop_in a set of recipe parameters and will search for variables in the canvas with those parameter names prefixed with init_, changing their values to the specified in the input </p> +Values from the input port will simply be forwarded to this output port. This can be used as a control/trigger signal in subsequent parts of the workflow, such as controlling loop structures. +The input set of parameters in a JSON string format that will be used to update the workflow parameters in the current scope. This can be an empty list, in which case no parameters are updated. +The Python class name to execute. + - + - + - + + + - + - + - + - - - + - - - - - + - + - + - + - - - + - -ESO -2.0 -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. -The input sofs -The combined sof - - - - +null +Paul Whitaker +$Id: Synchronizer.java 61458 2011-07-11 19:54:07Z cxh $ + This actor implements a token synchronizer. It has one input port and one output port, both of which are multiports. When at least one token exists on every input channel, exactly one token is consumed from each input channel, and the tokens are output on the corresponding output channels. If any input channel is missing a token, then no output is produced. <p> Note that the ordering of channels of a multiport is determined by the order of connection. Thus the n<sup>th</sup> input channel connected corresponds to the n<sup>th</sup> output channel connected. +The input port. This base class imposes no type constraints except that the type of the input cannot be greater than the type of the output. +The output port. By default, the type of this output is constrained to be at least that of the input. + - + - - - + - + - + - - - - - - - + - + - + - - - - - - + - + + + null -Gang Zhou +Steve Neuendorffer, Edward A. Lee null -<p> A type polymorphic select with boolean valued control for use in the DDF domain. In the first iteration, an input token at the <i>control</i> port is read and its value is noted. In the second iteration, if the <i>control</i> input read from the previous iteration is true, then an input token at the <i>trueInput</i> port is read and sent to the output. Likewise with a false <i>control</i> input and the <i>falseInput</i> port. It alternates between these two kinds of iterations until stopped. The <i>control</i> port must receive Boolean Tokens. The <i>trueInput</i> and <i>falseInput</i> ports may receive Tokens of any type. Because tokens are immutable, the same Token is sent to the output, rather than a copy.</p> <p> Note this actor sends an output token every two iterations. Contrast this with BooleanSelect which sends an output token every iteration. </p> -Input for tokens on the false path. The port type can be any type. -The output port. The type is at least the type of <i>trueInput</i> and <i>falseInput</i>. -Input for tokens on the true path. The port type can be any type. -Input that selects one of the other input ports. The type is boolean. - +<p>The SampleDelay actor outputs a set of tokens that are used as initial input values when a workflow starts up. The actor is used to break dependency cycles created by loops in SDF models. </p> <p>Feedback loops, created when an actor cycles its own output into its input port, can create "deadlock" errors under an SDF Director. The deadlock errors occur because the actor depends on its own output value as an initial input. To fix this problem, use a SampleDelay actor to inject an initial value into the workflow.</p> <p>Specify an array of initial values with the initialOutputs parameter. By default, the actor produces a single integer token, {0}.</p> +An input port that accepts tokens of any type. +An output port that broadcasts the initial tokens. +The values produced when the workflow is initialized. The value must be an array token, and defaults to an array that contains a single integer token, {0}. + - - + + - + - + - + - - - - - - - - - - - - - - - + - - - - - - + - + - - - - - + + + - - - - - -ESO -2.0 -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. -The input sofs -The combined sof - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Identifies empty SoFs -ESO -2.0 -IsSofEmpty emits a true token if the input soF is empty -true if the input is empty -The input sof - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -null -Gang Zhou -null - <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. -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. -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. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -null -Edward Lee -null -<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> -An output port that broadcasts a string constant specified by the value parameter. -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. -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. -The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -It reads a formatted string and converts it to an SoP. -ESO -2.0 -The SoPCreator reads a formatted string and converts it into an SoP. The input string must be a list of tokens in the following format: recipe_name:par_name=value separated by either a comma or a newline -The output sop -The input string - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -9463,46 +9474,29 @@ - - - - - + - - - + - + - - + + - - - + - + - + - - - - - - - - - + - - + @@ -9511,20 +9505,22 @@ - + + - - + + - + + @@ -9532,37 +9528,23 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - + @@ -9579,9 +9561,9 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + - + @@ -9656,7 +9638,7 @@ - + @@ -9886,117 +9868,6 @@ - - -null -Edward A. Lee -null -<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> - - - - - - - - - - - - - - - - - - - - - -S- - - - - - - - - - - - - -null -Edward A. Lee -null -<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> - - - - - - - - - - - - - - - - - - - - - -S- - - - - - - - - - - - - -null -Edward A. Lee -null -<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> - - - - - - - - - - - - - - - - - - - - - -S- - - - - - - - - - - null @@ -10348,8 +10219,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -10375,7 +10246,7 @@ - + @@ -10386,7 +10257,7 @@ - + @@ -10396,8 +10267,8 @@ 2.0 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 The input sof -The number of groups generated The grouped sofs +The number of groups generated @@ -10436,22 +10307,26 @@ + + + + null ESO 2.0 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 complete is false. When the token on the iteration complete port is true the actor starts accepting again tokens from the sof in and sop in ports. -The signal to terminate the current iteration The loop input sof -The loop input sop +The signal to terminate the current iteration The input sop +The loop input sop The output sop The input sof The output sof - + @@ -10459,9 +10334,9 @@ - + - + @@ -10525,7 +10400,7 @@ Edward Lee, Steve Neuendorffer, Jerome Blanc null 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 value deterministically (independent of the schedule of execution of the actors). If delayed is false, then the change to the value of the variable is performed immediately. This allows more frequent reconfiguration, and can mimic the operation of PGM's graph variables. Note that the variable name is observed during preinitialize(). If it is changed after that, the change will not take effect until the next time the model is executed. Moreover, the type of the variable is constrained in preinitialize() to be at least that of the input port for this actor. The variable can be either any attribute that implements the Settable interface. If it is in addition an instance of Variable, then the input token is used directly to set the value, and the type of the variable is constrained to be the same as the type of the input. Otherwise, then input token is converted to a string and the setExpression() method on the variable is used to set the value. The variable can occur anywhere in the hierarchy above the current level. If the variable is not found in the container, then the container of the container is checked until we reach the top level. - + @@ -10535,10 +10410,20 @@ - + - + + + + + + + + + + + @@ -10590,7 +10475,7 @@ - + If true, the script does not save the standard output and the standard error of the script execution in the logging directory. This feature is useful if you are using Pyraf and you experience occasional crashes. @@ -10667,7 +10552,7 @@ - + @@ -10684,9 +10569,9 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + - + @@ -10701,14 +10586,25 @@ + + - + + + + + + + + + + - + @@ -10729,7 +10625,7 @@ 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. 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. The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) - + @@ -10745,9 +10641,9 @@ - + - + @@ -10775,7 +10671,7 @@ - + @@ -10794,10 +10690,14 @@ + + + + @@ -10810,8 +10710,8 @@ 2.0 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) The input sofs -The grouped sof The number of groups to collect +The grouped sof @@ -10824,7 +10724,7 @@ - + @@ -10895,83 +10795,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - null @@ -11066,7 +10889,7 @@ - + @@ -11215,43 +11038,13 @@ - - - - - - -null -Xiaojun Liu -null - 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(self) : 4. if not self.input.hasToken(0) : 5. return 6. s = self.scale.getToken() 7. t = self.input.get(0) 8. self.output.broadcast(s.multiply(t)) </pre> Line 1 defines a Python class Main. This name is fixed. An instance of this class is created when the actor is initialized. Line 2 is a description of the purpose of the script. Lines 3-8 define the fire() method. In the method body, <i>input</i> and <i>output</i> are ports that have been added to the actor, and <i>scale</i> is a parameter added to the actor (these can be added in the XML that defines the actor instance in an actor library). The Main class can provide other methods in the Executable interface as needed. <p> In the script, use <code>self.actor</code> to access the actor. For example, <code>self.actor.getDirector()</code> returns the current director of the actor. For debugging, use <code>self.actor.debug(someMessage)</code>. The final message sent to the debug listeners of the actor will have the string "From script: " inserted at the beginning. To avoid generating the debug message when there are no listeners, use: <pre> if self.actor.isDebugging() : self.actor.debug(someMessage) </pre> <p> This class relies on Jython, which is a Java implementation of Python. </p> Follow the links below for more information about the Python language, licensing, downloads, etc. <p><a href="http://www.python.org" target="_top">Python</a></p> <p><a href="http://www.jython.org" target="_top">Jython</a></p> <p><a href="http://www.jython.org/docs/differences.html">Differences between Jython and the C version of Python</a></p> <p><a href="http://www.jython.org/Project/userguide.html#the-jython-registry">The Jython Registry</a> - information about how to set the search path. </p> - - - - - - - - - - - - - - - - - - - - - + - + - + @@ -11271,8 +11064,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -11300,7 +11093,7 @@ - + @@ -11354,7 +11147,7 @@ - + If true, the script does not save the standard output and the standard error of the script execution in the logging directory. This feature is useful if you are using Pyraf and you experience occasional crashes. @@ -11378,154 +11171,14 @@ - - + + - - - -Renames recipe products based on FITS keywords -ESO -2.0 - 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. -The final list of files produced -The files to be copied/moved or linked -The list of keywords used to create the new name -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) - -The directory where the files are going to be copied/linked or renamed. It is usually set to END_PRODUCTS_DIR -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 -There are several options: "copy", "move" or "link". - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ESO -2.0 -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. -The input sofs -The combined sof - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + @@ -11534,12 +11187,6 @@ - - - - - - @@ -11560,7 +11207,7 @@ - + @@ -11596,7 +11243,7 @@ - + @@ -11604,9 +11251,9 @@ - + - + @@ -11620,7 +11267,9 @@ - + + + @@ -11631,12 +11280,247 @@ + + + + + +null +null +null +<p>The RecipeExecuter executes one CPL recipe. The recipe can be chosen only when you instantiate the component: at the moment the user is presented with a list of the available recipes (the output of esorex --recipes). After the user selects the recipe the actor queries EsoRex for the recipe parameters and adds them to the actor. Each parameter is set to the default value: if the user wants to change any of the parameters then he can enter his own value or he can write the special value PORT, in which case the value is taken from the input port SoP.</p><p>The actor has three modes: Run, Skip and Disabled</p><p>Note: since this actor has very different behaviour depending on the pipeline recipe to which it is associated, it is not present in the left hand side actor list, and instead it must be instantiated from the menu.</p> +the recipe input parameters +the outputs not matching any of the output categories +the logs generated by EsoRex, empty if lazy mode is triggered +the inputs not matching any of the input categories +the warnings generated by EsoRex, empty if lazy mode is triggered +the input files +the output files +the errors generated by EsoRex, empty if lazy mode is triggered +the parameters used in the last execution of the recipe +if true then the actor will check whether the pipeline recipe has already been executed with the same input files and with the same recipe parameters. If this is the case then the recipe will not be executed, and instead the previously generated products (which are the same as those that would have been generated if the recipe were executed, except for a timestamp) will be broadcast to the output port. +additional parameters passed to EsoRex +the selected pipeline recipe (cannot be changed) +the directory where the products will be created +<p>how the purpose of the input files will be sent to the output:</p><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. This is the default mode, and it means that the actor has completed a reduction step and removes it from the purpose chain</p><p>Set to universal: set the output purpose to universal</p> +Parameter name: cmax. Default value:1 +Parameter name: citer. Default value:3 +Parameter name: cneg_rej. Default value:3 +if true then an empty sof on the input port will be broadcast to the output without executing the recipe +Parameter name: cpos_rej. Default value:3 +<p>Run: the recipe will be executed (see lazy mode)</p><p>Skip: the inputs are broadcast to the output with the following modifications: input files will be filtered according to input and output tags and recipe parameters will be filtered based on the recipe and whether the parameter is set to PORT</p><p>Disabled: the recipe is not executed and an empty SoF is generated on the output port</p> +if true then the execution is paused after the execution of the recipe +Parameter name: cmethod. Default value:ksigma +Parameter name: radius. Default value:3 +Parameter name: centre. Default value:7.5,7.5 +Parameter name: mask_method. Default value:optimal +Parameter name: b_samples. Default value:2048 +Parameter name: suppress_extension. Default value:false +if true then the execution is paused just before executing the recipe +Parameter name: xcal_interpolation. Default value:true +Parameter name: no_noise. Default value:false +Parameter name: save_cubes. Default value:false +Parameter name: flux. Default value:true +Parameter name: magnitude. Default value: +Parameter name: neighborhoodRange. Default value:1.001 +Parameter name: fmethod. Default value:gauss +Parameter name: imethod. Default value:CS +Parameter name: startype. Default value: +the directory where the EsoRex logs will be saved + +a list of file categories separated by a comma or a space: only input files belonging to one of these categories will be passed to the recipe +<p>it specifies the behavior of the actor if the recipe fails</p> <p>Stop: the actor produces an error message and the workflows stops. This is the default</p><p>Continue: the actor outputs an empty SoF</p><p>Ask: the actor pops up a window and asks the user whether he wants to continue or stop the execution</p> +a list of file categories separated by a comma or a space: only products belonging to one of these categories will be broadcast to the output port +the directory the recipe will use as a working directory +Parameter name: cmin. Default value:1 +if true, the temporary directories (where the logs, the final and the temporary products of the recipe are created) are cleaned before the execution + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +This actor is used to set the initial loop parameters defined on the workflow canvas. +ESO +2.9 +<p>This actor could be used to set a number of string variables in a workflow canvas. The typical use case is in an interactive loop: The interactive window allows to change some of the parameters and you would like to use those parameters as default initial values the next time the loop kicks in. Usually this initial parameters are set with variables in the canvas that start with init_ (or INIT_) and the name of the recipe parameter. This actor will read from its input port sop_in a set of recipe parameters and will search for variables in the canvas with those parameter names prefixed with init_, changing their values to the specified in the input </p> +Values from the input port will simply be forwarded to this output port. This can be used as a control/trigger signal in subsequent parts of the workflow, such as controlling loop structures. +The input set of parameters in a JSON string format that will be used to update the workflow parameters in the current scope. This can be an empty list, in which case no parameters are updated. +The Python class name to execute. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Paul Whitaker +$Id: Synchronizer.java 61458 2011-07-11 19:54:07Z cxh $ + This actor implements a token synchronizer. It has one input port and one output port, both of which are multiports. When at least one token exists on every input channel, exactly one token is consumed from each input channel, and the tokens are output on the corresponding output channels. If any input channel is missing a token, then no output is produced. <p> Note that the ordering of channels of a multiport is determined by the order of connection. Thus the n<sup>th</sup> input channel connected corresponds to the n<sup>th</sup> output channel connected. +The input port. This base class imposes no type constraints except that the type of the input cannot be greater than the type of the output. +The output port. By default, the type of this output is constrained to be at least that of the input. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Steve Neuendorffer, Edward A. Lee +null +<p>The SampleDelay actor outputs a set of tokens that are used as initial input values when a workflow starts up. The actor is used to break dependency cycles created by loops in SDF models. </p> <p>Feedback loops, created when an actor cycles its own output into its input port, can create "deadlock" errors under an SDF Director. The deadlock errors occur because the actor depends on its own output value as an initial input. To fix this problem, use a SampleDelay actor to inject an initial value into the workflow.</p> <p>Specify an array of initial values with the initialOutputs parameter. By default, the actor produces a single integer token, {0}.</p> +An input port that accepts tokens of any type. +An output port that broadcasts the initial tokens. +The values produced when the workflow is initialized. The value must be an array token, and defaults to an array that contains a single integer token, {0}. + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -11655,12 +11539,6 @@ - - - - - - @@ -11670,7 +11548,7 @@ - + @@ -11685,19 +11563,37 @@ - - - + - + + + + + + + + + + + + + + + + + + + + + - + @@ -11711,29 +11607,27 @@ - + + - + - - + + - + + - - - - @@ -11750,14 +11644,23 @@ - - + - - - + + + + + + + + + + + + + @@ -11779,7 +11682,7 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + @@ -11858,8 +11761,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -11946,7 +11849,7 @@ - + @@ -11989,13 +11892,13 @@ - + - + - + - + @@ -12118,7 +12021,7 @@ - + @@ -12157,15 +12060,15 @@ - + - + - + @@ -12407,7 +12310,7 @@ - + @@ -12499,8 +12402,8 @@ A nicely formatted string The input JSON object - if true the output text will contain a descriptive header and footer + @@ -12653,9 +12556,9 @@ - + - + @@ -12716,8 +12619,8 @@ Wibke Sudholt null <p>The StringToInt actor reads a string, converts it to an integer, and outputs the result. </p> <p>The actor creates the integer by placing one byte (i.e., one character) of the string into the least significant byte of an integer. Typically, this byte is the ASCII code of the character.</p> -An input port that accepts a string. An output port that broadcasts the converted string as an integer. +An input port that accepts a string. @@ -12870,7 +12773,7 @@ - + @@ -12887,9 +12790,9 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + - + @@ -12927,7 +12830,7 @@ - + @@ -13360,8 +13263,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -13490,14 +13393,14 @@ - + - + @@ -13509,8 +13412,8 @@ 2.0 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 The input sof -The number of groups generated The grouped sofs +The number of groups generated @@ -13522,7 +13425,7 @@ - + @@ -13549,22 +13452,26 @@ + + + + null ESO 2.0 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 complete is false. When the token on the iteration complete port is true the actor starts accepting again tokens from the sof in and sop in ports. -The signal to terminate the current iteration The loop input sof -The loop input sop +The signal to terminate the current iteration The input sop +The loop input sop The output sop The input sof The output sof - + @@ -13572,9 +13479,9 @@ - + - + @@ -13644,7 +13551,7 @@ Edward Lee, Steve Neuendorffer, Jerome Blanc null 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 value deterministically (independent of the schedule of execution of the actors). If delayed is false, then the change to the value of the variable is performed immediately. This allows more frequent reconfiguration, and can mimic the operation of PGM's graph variables. Note that the variable name is observed during preinitialize(). If it is changed after that, the change will not take effect until the next time the model is executed. Moreover, the type of the variable is constrained in preinitialize() to be at least that of the input port for this actor. The variable can be either any attribute that implements the Settable interface. If it is in addition an instance of Variable, then the input token is used directly to set the value, and the type of the variable is constrained to be the same as the type of the input. Otherwise, then input token is converted to a string and the setExpression() method on the variable is used to set the value. The variable can occur anywhere in the hierarchy above the current level. If the variable is not found in the container, then the container of the container is checked until we reach the top level. - + @@ -13654,15 +13561,25 @@ - + - + + + + + + + + + + + - + @@ -13679,9 +13596,9 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + - + @@ -13696,10 +13613,21 @@ + + - + + + + + + + + + + @@ -13740,7 +13668,7 @@ - + @@ -13770,7 +13698,7 @@ - + @@ -13789,10 +13717,14 @@ + + + + @@ -13805,8 +13737,8 @@ 2.0 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) The input sofs -The grouped sof The number of groups to collect +The grouped sof @@ -13819,7 +13751,7 @@ - + @@ -14032,13 +13964,61 @@ + + - + - + +null +null +null +<p>The RecipeExecuter executes one CPL recipe. The recipe can be chosen only when you instantiate the component: at the moment the user is presented with a list of the available recipes (the output of esorex --recipes). After the user selects the recipe the actor queries EsoRex for the recipe parameters and adds them to the actor. Each parameter is set to the default value: if the user wants to change any of the parameters then he can enter his own value or he can write the special value PORT, in which case the value is taken from the input port SoP.</p><p>The actor has three modes: Run, Skip and Disabled</p><p>Note: since this actor has very different behaviour depending on the pipeline recipe to which it is associated, it is not present in the left hand side actor list, and instead it must be instantiated from the menu.</p> +the recipe input parameters +the outputs not matching any of the output categories +the logs generated by EsoRex, empty if lazy mode is triggered +the inputs not matching any of the input categories +the warnings generated by EsoRex, empty if lazy mode is triggered +the input files +the output files +the errors generated by EsoRex, empty if lazy mode is triggered +the parameters used in the last execution of the recipe +a list of file categories separated by a comma or a space: only input files belonging to one of these categories will be passed to the recipe +the selected pipeline recipe (cannot be changed) +a list of file categories separated by a comma or a space: only products belonging to one of these categories will be broadcast to the output port +if true then the execution is paused just before executing the recipe + +the directory the recipe will use as a working directory +if true, the temporary directories (where the logs, the final and the temporary products of the recipe are created) are cleaned before the execution +if true then the actor will check whether the pipeline recipe has already been executed with the same input files and with the same recipe parameters. If this is the case then the recipe will not be executed, and instead the previously generated products (which are the same as those that would have been generated if the recipe were executed, except for a timestamp) will be broadcast to the output port. +<p>Run: the recipe will be executed (see lazy mode)</p><p>Skip: the inputs are broadcast to the output with the following modifications: input files will be filtered according to input and output tags and recipe parameters will be filtered based on the recipe and whether the parameter is set to PORT</p><p>Disabled: the recipe is not executed and an empty SoF is generated on the output port</p> +<p>how the purpose of the input files will be sent to the output:</p><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. This is the default mode, and it means that the actor has completed a reduction step and removes it from the purpose chain</p><p>Set to universal: set the output purpose to universal</p> +Parameter name: suppress_extension. Default value:false +Parameter name: skipped_frames. Default value: +the directory where the EsoRex logs will be saved +Parameter name: edge_nan. Default value:false +Parameter name: flux. Default value:false +Parameter name: filename. Default value: +Parameter name: fmethod. Default value:gauss +the directory where the products will be created +Parameter name: method. Default value:none +Parameter name: ifus. Default value: +Parameter name: name. Default value: +<p>it specifies the behavior of the actor if the recipe fails</p> <p>Stop: the actor produces an error message and the workflows stops. This is the default</p><p>Continue: the actor outputs an empty SoF</p><p>Ask: the actor pops up a window and asks the user whether he wants to continue or stop the execution</p> +Parameter name: cmin. Default value:1 +Parameter name: cmax. Default value:1 +additional parameters passed to EsoRex +Parameter name: citer. Default value:3 +Parameter name: cneg_rej. Default value:3 +Parameter name: cpos_rej. Default value:3 +Parameter name: cmethod. Default value:ksigma +Parameter name: collapse_combined. Default value:false +if true then the execution is paused after the execution of the recipe +if true then an empty sof on the input port will be broadcast to the output without executing the recipe + @@ -14068,7 +14048,10 @@ - + + + + @@ -14098,14 +14081,17 @@ - + -null -Xiaojun Liu -null - 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(self) : 4. if not self.input.hasToken(0) : 5. return 6. s = self.scale.getToken() 7. t = self.input.get(0) 8. self.output.broadcast(s.multiply(t)) </pre> Line 1 defines a Python class Main. This name is fixed. An instance of this class is created when the actor is initialized. Line 2 is a description of the purpose of the script. Lines 3-8 define the fire() method. In the method body, <i>input</i> and <i>output</i> are ports that have been added to the actor, and <i>scale</i> is a parameter added to the actor (these can be added in the XML that defines the actor instance in an actor library). The Main class can provide other methods in the Executable interface as needed. <p> In the script, use <code>self.actor</code> to access the actor. For example, <code>self.actor.getDirector()</code> returns the current director of the actor. For debugging, use <code>self.actor.debug(someMessage)</code>. The final message sent to the debug listeners of the actor will have the string "From script: " inserted at the beginning. To avoid generating the debug message when there are no listeners, use: <pre> if self.actor.isDebugging() : self.actor.debug(someMessage) </pre> <p> This class relies on Jython, which is a Java implementation of Python. </p> Follow the links below for more information about the Python language, licensing, downloads, etc. <p><a href="http://www.python.org" target="_top">Python</a></p> <p><a href="http://www.jython.org" target="_top">Jython</a></p> <p><a href="http://www.jython.org/docs/differences.html">Differences between Jython and the C version of Python</a></p> <p><a href="http://www.jython.org/Project/userguide.html#the-jython-registry">The Jython Registry</a> - information about how to set the search path. </p> - +This actor is used to set the initial loop parameters defined on the workflow canvas. +ESO +2.9 +<p>This actor could be used to set a number of string variables in a workflow canvas. The typical use case is in an interactive loop: The interactive window allows to change some of the parameters and you would like to use those parameters as default initial values the next time the loop kicks in. Usually this initial parameters are set with variables in the canvas that start with init_ (or INIT_) and the name of the recipe parameter. This actor will read from its input port sop_in a set of recipe parameters and will search for variables in the canvas with those parameter names prefixed with init_, changing their values to the specified in the input </p> +The input set of parameters in a JSON string format that will be used to update the workflow parameters in the current scope. This can be an empty list, in which case no parameters are updated. +Values from the input port will simply be forwarded to this output port. This can be used as a control/trigger signal in subsequent parts of the workflow, such as controlling loop structures. +The Python class name to execute. + @@ -14117,22 +14103,102 @@ - + - + + + + + + + + + + + + + + + + +null +Paul Whitaker +$Id: Synchronizer.java 61458 2011-07-11 19:54:07Z cxh $ + This actor implements a token synchronizer. It has one input port and one output port, both of which are multiports. When at least one token exists on every input channel, exactly one token is consumed from each input channel, and the tokens are output on the corresponding output channels. If any input channel is missing a token, then no output is produced. <p> Note that the ordering of channels of a multiport is determined by the order of connection. Thus the n<sup>th</sup> input channel connected corresponds to the n<sup>th</sup> output channel connected. +The output port. By default, the type of this output is constrained to be at least that of the input. +The input port. This base class imposes no type constraints except that the type of the input cannot be greater than the type of the output. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Steve Neuendorffer, Edward A. Lee +null +<p>The SampleDelay actor outputs a set of tokens that are used as initial input values when a workflow starts up. The actor is used to break dependency cycles created by loops in SDF models. </p> <p>Feedback loops, created when an actor cycles its own output into its input port, can create "deadlock" errors under an SDF Director. The deadlock errors occur because the actor depends on its own output value as an initial input. To fix this problem, use a SampleDelay actor to inject an initial value into the workflow.</p> <p>Specify an array of initial values with the initialOutputs parameter. By default, the actor produces a single integer token, {0}.</p> +An output port that broadcasts the initial tokens. +An input port that accepts tokens of any type. +The values produced when the workflow is initialized. The value must be an array token, and defaults to an array that contains a single integer token, {0}. + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -14162,6 +14228,16 @@ + + + + + + + + + + @@ -14176,8 +14252,10 @@ + + @@ -14192,17 +14270,23 @@ - + - + + + + + + + - + @@ -14219,9 +14303,9 @@ Yuhong Xiong null <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> <p>To create a composite actor, drag and drop the Composite actor onto the Workflow canvas. Right-click the actor and select Open Actor from the drop-down menu. A new Kepler application window will open for designing the composite.</p> - + - + @@ -14241,8 +14325,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -14254,40 +14338,78 @@ - + - + - + - + + + + + + + + + + +null +ESO +2.0 +The ProductExplorer allows the suer to browse all the executions of the datasets and to visualize the calibration cascade and the intermediate products. Refer to the Reflex User Manual for a more detailed documentation +If Mode is triggered a BooleanToken on this port defines whether the actor should pop up or not +The newest execution date of the datasets to be displayed: if not connected defaults to now + +The oldest execution date of the datasets to be displayed: if not connected defaults to now-24h +the file containing the bookkeeping database + +The application used to inspect FITS files + + +The actor mode, can be either Enabled, Disabled or Triggered + +The format of start and end date + - + + + - + + + + + + + + - + + + + @@ -14295,12 +14417,12 @@ - - - - + + + + - + @@ -14313,7 +14435,7 @@ - + @@ -14321,36 +14443,36 @@ - + - + - + - - + + - + - + - + - + - + @@ -14361,8 +14483,8 @@ - - + + @@ -14374,7 +14496,7 @@ - + @@ -14382,25 +14504,21 @@ - - - + + + - - - - @@ -14409,8 +14527,6 @@ - - @@ -14422,164 +14538,24 @@ - - - + + + - + - -Renames recipe products based on FITS keywords -ESO -2.0 - 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. -The final list of files produced -The files to be copied/moved or linked -The list of keywords used to create the new name -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) - -The directory where the files are going to be copied/linked or renamed. It is usually set to END_PRODUCTS_DIR -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 -There are several options: "copy", "move" or "link". - + - - + + + + + + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ESO -2.0 -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. -The input sofs -The combined sof - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -14588,8 +14564,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -14631,7 +14607,7 @@ - + @@ -14670,8 +14646,8 @@ Gang Zhou null <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> -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. 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. +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. 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. @@ -14707,8 +14683,8 @@ 2.0 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 The input sof -The number of groups generated The grouped sofs +The number of groups generated @@ -14755,8 +14731,8 @@ 2.0 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) The input sofs -The number of groups to collect The grouped sof +The number of groups to collect @@ -14800,188 +14776,6093 @@ - + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +It reads a formatted string and converts it to an SoP. +ESO +2.0 +The SoPCreator reads a formatted string and converts it into an SoP. The input string must be a list of tokens in the following format: recipe_name:par_name=value separated by either a comma or a newline +The output sop +The input string + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +null +null +<p>The RecipeExecuter executes one CPL recipe. The recipe can be chosen only when you instantiate the component: at the moment the user is presented with a list of the available recipes (the output of esorex --recipes). After the user selects the recipe the actor queries EsoRex for the recipe parameters and adds them to the actor. Each parameter is set to the default value: if the user wants to change any of the parameters then he can enter his own value or he can write the special value PORT, in which case the value is taken from the input port SoP.</p><p>The actor has three modes: Run, Skip and Disabled</p><p>Note: since this actor has very different behaviour depending on the pipeline recipe to which it is associated, it is not present in the left hand side actor list, and instead it must be instantiated from the menu.</p> +the recipe input parameters +the outputs not matching any of the output categories +the logs generated by EsoRex, empty if lazy mode is triggered +the inputs not matching any of the input categories +the warnings generated by EsoRex, empty if lazy mode is triggered +the input files +the output files +the errors generated by EsoRex, empty if lazy mode is triggered +the parameters used in the last execution of the recipe +a list of file categories separated by a comma or a space: only input files belonging to one of these categories will be passed to the recipe +the selected pipeline recipe (cannot be changed) +a list of file categories separated by a comma or a space: only products belonging to one of these categories will be broadcast to the output port +if true then the execution is paused just before executing the recipe + +the directory the recipe will use as a working directory +if true, the temporary directories (where the logs, the final and the temporary products of the recipe are created) are cleaned before the execution +if true then the actor will check whether the pipeline recipe has already been executed with the same input files and with the same recipe parameters. If this is the case then the recipe will not be executed, and instead the previously generated products (which are the same as those that would have been generated if the recipe were executed, except for a timestamp) will be broadcast to the output port. +<p>Run: the recipe will be executed (see lazy mode)</p><p>Skip: the inputs are broadcast to the output with the following modifications: input files will be filtered according to input and output tags and recipe parameters will be filtered based on the recipe and whether the parameter is set to PORT</p><p>Disabled: the recipe is not executed and an empty SoF is generated on the output port</p> +<p>how the purpose of the input files will be sent to the output:</p><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. This is the default mode, and it means that the actor has completed a reduction step and removes it from the purpose chain</p><p>Set to universal: set the output purpose to universal</p> +Parameter name: b_samples. Default value:2048 +Parameter name: suppress_extension. Default value:false +the directory where the EsoRex logs will be saved +Parameter name: pix_scale. Default value:0.2 +Parameter name: add-all. Default value:false +Parameter name: flux. Default value:false +Parameter name: range. Default value: +the directory where the products will be created +Parameter name: neighborhoodRange. Default value:1.001 +Parameter name: imethod. Default value:CS +Parameter name: used_flat_type. Default value:sky +<p>it specifies the behavior of the actor if the recipe fails</p> <p>Stop: the actor produces an error message and the workflows stops. This is the default</p><p>Continue: the actor outputs an empty SoF</p><p>Ask: the actor pops up a window and asks the user whether he wants to continue or stop the execution</p> +Parameter name: angle. Default value:370 +Parameter name: det. Default value:0 +Parameter name: cmin. Default value:1 +additional parameters passed to EsoRex +Parameter name: cmax. Default value:1 +Parameter name: citer. Default value:3 +Parameter name: cneg_rej. Default value:3 +Parameter name: cpos_rej. Default value:3 +Parameter name: cmethod. Default value:ksigma +if true then the execution is paused after the execution of the recipe +if true then an empty sof on the input port will be broadcast to the output without executing the recipe + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Steve Neuendorffer +null +<p>The Boolean Multiplexor uses a Boolean value to determine which of two input values to output. The actor is useful when creating workflow control structures, which allow workflows to branch, for example.</p> <p>The actor reads values of any type via its trueInput and falseInput port. In addition, the actor receives a Boolean "select" token, which it uses to determine which input value to select and output. The actor outputs the selected value each time it iterates.</p> <p>The actor must receive tokens on all ports. Each time the actor fires, it reads one token from each of its input ports and outputs the selected token.</p> +An input port that receives a Boolean token (true or false) that is used to select and output either the trueInput or falseInput value. +An input port that receives tokens of any type. The value will be output if the "select" token is false. +An output port that broadcasts the selected input value. +An input port that receives tokens of any type. The value will be output if the "select" token is true. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Vinay Krishnan, Daniel Lazaro Cuadrado (contributor: Edward A. Lee) +null + <p>The StringCompare actor reads two strings and compares them using a specified comparison function. The actor outputs true if the strings satisfy the comparison criteria, or false if not.</p> <p>The comparison functions are specified with the function parameter: </p> <ul> <li>equals: Output true if the strings are equal (the default). </li> <li>startsWith: Output true if the first string starts with second string. </li> <li>endsWith: Output true if the first string ends with the second string. </li> <li>contains: Output true if the first string contains the second string. </li> </ul> <p>Strings will be read from the input ports if they are connected; otherwise strings are read from the parameters.</p> +An input port that accepts the second string. +An output port that broadcasts the result of the comparison (either true or false). +An input port that accepts the first string. +The comparison function (equals, startsWith, endsWith, contains). The default is "equals". +The second string. +Specify whether to ignore case. By default, the actor is case-sensitive. Select the parameter to ignore case. +The first string. + + + + + + + + + + + + + + + +null +ESO +1.0 +<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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> +The input data +The rejected SoF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null + <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> +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. +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. +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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +<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> +The vertical extent. The value is a double that defaults to 100.0. +The line width. The value is a double that defaults to 1.0. +The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +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). +The horizontal extent. The value is a double that defaults to 100.0. +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} +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." + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +ESO +1.0 +<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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> +The input data +The rejected SoF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +ESO +1.0 +<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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> +The input data +The rejected SoF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ESO +2.0 +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. +The input sofs +The combined sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null +<p> A type polymorphic select with boolean valued control for use in the DDF domain. In the first iteration, an input token at the <i>control</i> port is read and its value is noted. In the second iteration, if the <i>control</i> input read from the previous iteration is true, then an input token at the <i>trueInput</i> port is read and sent to the output. Likewise with a false <i>control</i> input and the <i>falseInput</i> port. It alternates between these two kinds of iterations until stopped. The <i>control</i> port must receive Boolean Tokens. The <i>trueInput</i> and <i>falseInput</i> ports may receive Tokens of any type. Because tokens are immutable, the same Token is sent to the output, rather than a copy.</p> <p> Note this actor sends an output token every two iterations. Contrast this with BooleanSelect which sends an output token every iteration. </p> +Input for tokens on the false path. The port type can be any type. +The output port. The type is at least the type of <i>trueInput</i> and <i>falseInput</i>. +Input for tokens on the true path. The port type can be any type. +Input that selects one of the other input ports. The type is boolean. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ESO +2.0 +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. +The input sofs +The combined sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Identifies empty SoFs +ESO +2.0 +IsSofEmpty emits a true token if the input soF is empty +true if the input is empty +The input sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null + <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> +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. +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. +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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +It reads a formatted string and converts it to an SoP. +ESO +2.0 +The SoPCreator reads a formatted string and converts it into an SoP. The input string must be a list of tokens in the following format: recipe_name:par_name=value separated by either a comma or a newline +The output sop +The input string + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +null +null +<p>The RecipeExecuter executes one CPL recipe. The recipe can be chosen only when you instantiate the component: at the moment the user is presented with a list of the available recipes (the output of esorex --recipes). After the user selects the recipe the actor queries EsoRex for the recipe parameters and adds them to the actor. Each parameter is set to the default value: if the user wants to change any of the parameters then he can enter his own value or he can write the special value PORT, in which case the value is taken from the input port SoP.</p><p>The actor has three modes: Run, Skip and Disabled</p><p>Note: since this actor has very different behaviour depending on the pipeline recipe to which it is associated, it is not present in the left hand side actor list, and instead it must be instantiated from the menu.</p> +the recipe input parameters +the outputs not matching any of the output categories +the logs generated by EsoRex, empty if lazy mode is triggered +the inputs not matching any of the input categories +the warnings generated by EsoRex, empty if lazy mode is triggered +the input files +the output files +the errors generated by EsoRex, empty if lazy mode is triggered +the parameters used in the last execution of the recipe +a list of file categories separated by a comma or a space: only input files belonging to one of these categories will be passed to the recipe +the selected pipeline recipe (cannot be changed) +a list of file categories separated by a comma or a space: only products belonging to one of these categories will be broadcast to the output port +if true then the execution is paused just before executing the recipe + +the directory the recipe will use as a working directory +if true, the temporary directories (where the logs, the final and the temporary products of the recipe are created) are cleaned before the execution +if true then the actor will check whether the pipeline recipe has already been executed with the same input files and with the same recipe parameters. If this is the case then the recipe will not be executed, and instead the previously generated products (which are the same as those that would have been generated if the recipe were executed, except for a timestamp) will be broadcast to the output port. +<p>Run: the recipe will be executed (see lazy mode)</p><p>Skip: the inputs are broadcast to the output with the following modifications: input files will be filtered according to input and output tags and recipe parameters will be filtered based on the recipe and whether the parameter is set to PORT</p><p>Disabled: the recipe is not executed and an empty SoF is generated on the output port</p> +<p>how the purpose of the input files will be sent to the output:</p><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. This is the default mode, and it means that the actor has completed a reduction step and removes it from the purpose chain</p><p>Set to universal: set the output purpose to universal</p> +the directory where the EsoRex logs will be saved +the directory where the products will be created +Parameter name: fill_empty_ifus. Default value:false +Parameter name: b_samples. Default value:-1 +Parameter name: method. Default value:0 +<p>it specifies the behavior of the actor if the recipe fails</p> <p>Stop: the actor produces an error message and the workflows stops. This is the default</p><p>Continue: the actor outputs an empty SoF</p><p>Ask: the actor pops up a window and asks the user whether he wants to continue or stop the execution</p> +additional parameters passed to EsoRex +if true then the execution is paused after the execution of the recipe +if true then an empty sof on the input port will be broadcast to the output without executing the recipe + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null + <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> +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. +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. +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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Steve Neuendorffer +null +<p>The BooleanSwitch actor reads a value of any type, as well as a Boolean token that is used as a control. If the Boolean token is true, the actor outputs the received value to the trueOutput port; if the Boolean token is false, the actor outputs the received value to the falseOutput port. If the actor has never received a value on the control port, then the actor will output to the falseOutput port.</p> <p>The actor only works under certain directors. It will not work under an SDF Director, but it will under a PN Director, for example.</p> +An input port that accepts tokens of any type. +An output port that broadcasts the input token when the control is false. +An output port that broadcasts the input token when the control is true. +An input port that accepts a Boolean token used to select which output port (trueOutput or falseOutput) to broadcast. + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null +<p> A type polymorphic select with boolean valued control for use in the DDF domain. In the first iteration, an input token at the <i>control</i> port is read and its value is noted. In the second iteration, if the <i>control</i> input read from the previous iteration is true, then an input token at the <i>trueInput</i> port is read and sent to the output. Likewise with a false <i>control</i> input and the <i>falseInput</i> port. It alternates between these two kinds of iterations until stopped. The <i>control</i> port must receive Boolean Tokens. The <i>trueInput</i> and <i>falseInput</i> ports may receive Tokens of any type. Because tokens are immutable, the same Token is sent to the output, rather than a copy.</p> <p> Note this actor sends an output token every two iterations. Contrast this with BooleanSelect which sends an output token every iteration. </p> +Input for tokens on the false path. The port type can be any type. +The output port. The type is at least the type of <i>trueInput</i> and <i>falseInput</i>. +Input for tokens on the true path. The port type can be any type. +Input that selects one of the other input ports. The type is boolean. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Vinay Krishnan, Daniel Lazaro Cuadrado (contributor: Edward A. Lee) +null + <p>The StringCompare actor reads two strings and compares them using a specified comparison function. The actor outputs true if the strings satisfy the comparison criteria, or false if not.</p> <p>The comparison functions are specified with the function parameter: </p> <ul> <li>equals: Output true if the strings are equal (the default). </li> <li>startsWith: Output true if the first string starts with second string. </li> <li>endsWith: Output true if the first string ends with the second string. </li> <li>contains: Output true if the first string contains the second string. </li> </ul> <p>Strings will be read from the input ports if they are connected; otherwise strings are read from the parameters.</p> +An input port that accepts the second string. +An output port that broadcasts the result of the comparison (either true or false). +An input port that accepts the first string. +The comparison function (equals, startsWith, endsWith, contains). The default is "equals". +The second string. +Specify whether to ignore case. By default, the actor is case-sensitive. Select the parameter to ignore case. +The first string. + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee, Steve Neuendorffer, Jerome Blanc +null + 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 value deterministically (independent of the schedule of execution of the actors). If delayed is false, then the change to the value of the variable is performed immediately. This allows more frequent reconfiguration, and can mimic the operation of PGM's graph variables. Note that the variable name is observed during preinitialize(). If it is changed after that, the change will not take effect until the next time the model is executed. Moreover, the type of the variable is constrained in preinitialize() to be at least that of the input port for this actor. The variable can be either any attribute that implements the Settable interface. If it is in addition an instance of Variable, then the input token is used directly to set the value, and the type of the variable is constrained to be the same as the type of the input. Otherwise, then input token is converted to a string and the setExpression() method on the variable is used to set the value. The variable can occur anywhere in the hierarchy above the current level. If the variable is not found in the container, then the container of the container is checked until we reach the top level. + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Wibke Sudholt +null +<p>The StringToInt actor reads a string, converts it to an integer, and outputs the result. </p> <p>The actor creates the integer by placing one byte (i.e., one character) of the string into the least significant byte of an integer. Typically, this byte is the ASCII code of the character.</p> +An output port that broadcasts the converted string as an integer. +An input port that accepts a string. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null + <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> +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. +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. +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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +null +null +<p>The RecipeExecuter executes one CPL recipe. The recipe can be chosen only when you instantiate the component: at the moment the user is presented with a list of the available recipes (the output of esorex --recipes). After the user selects the recipe the actor queries EsoRex for the recipe parameters and adds them to the actor. Each parameter is set to the default value: if the user wants to change any of the parameters then he can enter his own value or he can write the special value PORT, in which case the value is taken from the input port SoP.</p><p>The actor has three modes: Run, Skip and Disabled</p><p>Note: since this actor has very different behaviour depending on the pipeline recipe to which it is associated, it is not present in the left hand side actor list, and instead it must be instantiated from the menu.</p> +the recipe input parameters +the outputs not matching any of the output categories +the logs generated by EsoRex, empty if lazy mode is triggered +the inputs not matching any of the input categories +the warnings generated by EsoRex, empty if lazy mode is triggered +the input files +the output files +the errors generated by EsoRex, empty if lazy mode is triggered +the parameters used in the last execution of the recipe +the directory where the products will be created +a list of file categories separated by a comma or a space: only input files belonging to one of these categories will be passed to the recipe +if true, the temporary directories (where the logs, the final and the temporary products of the recipe are created) are cleaned before the execution +the directory the recipe will use as a working directory +a list of file categories separated by a comma or a space: only products belonging to one of these categories will be broadcast to the output port +<p>how the purpose of the input files will be sent to the output:</p><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. This is the default mode, and it means that the actor has completed a reduction step and removes it from the purpose chain</p><p>Set to universal: set the output purpose to universal</p> + +<p>Run: the recipe will be executed (see lazy mode)</p><p>Skip: the inputs are broadcast to the output with the following modifications: input files will be filtered according to input and output tags and recipe parameters will be filtered based on the recipe and whether the parameter is set to PORT</p><p>Disabled: the recipe is not executed and an empty SoF is generated on the output port</p> +<p>it specifies the behavior of the actor if the recipe fails</p> <p>Stop: the actor produces an error message and the workflows stops. This is the default</p><p>Continue: the actor outputs an empty SoF</p><p>Ask: the actor pops up a window and asks the user whether he wants to continue or stop the execution</p> +additional parameters passed to EsoRex +if true then the actor will check whether the pipeline recipe has already been executed with the same input files and with the same recipe parameters. If this is the case then the recipe will not be executed, and instead the previously generated products (which are the same as those that would have been generated if the recipe were executed, except for a timestamp) will be broadcast to the output port. +if true then the execution is paused just before executing the recipe +the selected pipeline recipe (cannot be changed) +if true then an empty sof on the input port will be broadcast to the output without executing the recipe +if true then the execution is paused after the execution of the recipe +the directory where the EsoRex logs will be saved + + + + + + + + + + + + + + + + + + + +null +ESO +1.0 +<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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> +The input data +The rejected SoF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Shankar Rao, Steve Neuendorffer +null + <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 each iteration, it causes a sample rate increase by a factor of numberOfTimes, and hence affects the number of invocations of downstream actors. </p> +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. +An input port that accepts tokens of any type. Specify the number of tokens to read at each iteration with the blockSize parameter. +The number of tokens in a block. The value is an integer and must be greater than zero. The default is 1. +The repetition factor. The value is an integer and must be greater than 0. The default is 2. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +ESO +2.0 +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. +The input sof +The number of groups generated +The grouped sofs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +ESO +2.0 +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) +The input sofs +The number of groups to collect +The grouped sof + + + +If true the SofAccumulator throws an error if the input tokens do not belong all to the same dataset + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ESO +2.0 +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. +The input sofs +The combined sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ESO +2.0 +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. +The input sofs +The combined sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Steve Neuendorffer +null +<p>The BooleanSwitch actor reads a value of any type, as well as a Boolean token that is used as a control. If the Boolean token is true, the actor outputs the received value to the trueOutput port; if the Boolean token is false, the actor outputs the received value to the falseOutput port. If the actor has never received a value on the control port, then the actor will output to the falseOutput port.</p> <p>The actor only works under certain directors. It will not work under an SDF Director, but it will under a PN Director, for example.</p> +An input port that accepts tokens of any type. +An output port that broadcasts the input token when the control is false. +An output port that broadcasts the input token when the control is true. +An input port that accepts a Boolean token used to select which output port (trueOutput or falseOutput) to broadcast. + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null +<p> A type polymorphic select with boolean valued control for use in the DDF domain. In the first iteration, an input token at the <i>control</i> port is read and its value is noted. In the second iteration, if the <i>control</i> input read from the previous iteration is true, then an input token at the <i>trueInput</i> port is read and sent to the output. Likewise with a false <i>control</i> input and the <i>falseInput</i> port. It alternates between these two kinds of iterations until stopped. The <i>control</i> port must receive Boolean Tokens. The <i>trueInput</i> and <i>falseInput</i> ports may receive Tokens of any type. Because tokens are immutable, the same Token is sent to the output, rather than a copy.</p> <p> Note this actor sends an output token every two iterations. Contrast this with BooleanSelect which sends an output token every iteration. </p> +Input for tokens on the false path. The port type can be any type. +The output port. The type is at least the type of <i>trueInput</i> and <i>falseInput</i>. +Input for tokens on the true path. The port type can be any type. +Input that selects one of the other input ports. The type is boolean. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +ESO +1.0 +<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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> +The input data +The rejected SoF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Steve Neuendorffer +null +<p>The BooleanSwitch actor reads a value of any type, as well as a Boolean token that is used as a control. If the Boolean token is true, the actor outputs the received value to the trueOutput port; if the Boolean token is false, the actor outputs the received value to the falseOutput port. If the actor has never received a value on the control port, then the actor will output to the falseOutput port.</p> <p>The actor only works under certain directors. It will not work under an SDF Director, but it will under a PN Director, for example.</p> +An input port that accepts tokens of any type. +An output port that broadcasts the input token when the control is false. +An output port that broadcasts the input token when the control is true. +An input port that accepts a Boolean token used to select which output port (trueOutput or falseOutput) to broadcast. + + + + + + + + + + + + + + + + + + +Identifies empty SoFs +ESO +2.9 +IsSofEmpty emits a true token if the input soF is empty +true if the input is not empty +true if the input is empty +The input sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null +<p> A type polymorphic select with boolean valued control for use in the DDF domain. In the first iteration, an input token at the <i>control</i> port is read and its value is noted. In the second iteration, if the <i>control</i> input read from the previous iteration is true, then an input token at the <i>trueInput</i> port is read and sent to the output. Likewise with a false <i>control</i> input and the <i>falseInput</i> port. It alternates between these two kinds of iterations until stopped. The <i>control</i> port must receive Boolean Tokens. The <i>trueInput</i> and <i>falseInput</i> ports may receive Tokens of any type. Because tokens are immutable, the same Token is sent to the output, rather than a copy.</p> <p> Note this actor sends an output token every two iterations. Contrast this with BooleanSelect which sends an output token every iteration. </p> +Input for tokens on the false path. The port type can be any type. +The output port. The type is at least the type of <i>trueInput</i> and <i>falseInput</i>. +Input for tokens on the true path. The port type can be any type. +Input that selects one of the other input ports. The type is boolean. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Vinay Krishnan, Daniel Lazaro Cuadrado (contributor: Edward A. Lee) +null + <p>The StringCompare actor reads two strings and compares them using a specified comparison function. The actor outputs true if the strings satisfy the comparison criteria, or false if not.</p> <p>The comparison functions are specified with the function parameter: </p> <ul> <li>equals: Output true if the strings are equal (the default). </li> <li>startsWith: Output true if the first string starts with second string. </li> <li>endsWith: Output true if the first string ends with the second string. </li> <li>contains: Output true if the first string contains the second string. </li> </ul> <p>Strings will be read from the input ports if they are connected; otherwise strings are read from the parameters.</p> +An input port that accepts the second string. +An output port that broadcasts the result of the comparison (either true or false). +An input port that accepts the first string. +The comparison function (equals, startsWith, endsWith, contains). The default is "equals". +The second string. +Specify whether to ignore case. By default, the actor is case-sensitive. Select the parameter to ignore case. +The first string. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +ESO +2.9 +<p>The FitsRouter sorts files based on their category: by default, all files are routed to the rejected directory, but the user can add an additional port and configure the actor to route particular files to the new port. The category is defined by the value of either HIERARCH.ESO.PRO.CATG (keyword added to the file by the pipeline recipes) or REFLEX.CATG (virtual keyword created by the DataOrganizer).</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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> +The input data +The rejected SoF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Identifies empty SoFs +ESO +2.9 +IsSofEmpty emits a true token if the input soF is empty +true if the input is not empty +true if the input is empty +The input sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Vinay Krishnan, Daniel Lazaro Cuadrado (contributor: Edward A. Lee) +null + <p>The StringCompare actor reads two strings and compares them using a specified comparison function. The actor outputs true if the strings satisfy the comparison criteria, or false if not.</p> <p>The comparison functions are specified with the function parameter: </p> <ul> <li>equals: Output true if the strings are equal (the default). </li> <li>startsWith: Output true if the first string starts with second string. </li> <li>endsWith: Output true if the first string ends with the second string. </li> <li>contains: Output true if the first string contains the second string. </li> </ul> <p>Strings will be read from the input ports if they are connected; otherwise strings are read from the parameters.</p> +An input port that accepts the second string. +An output port that broadcasts the result of the comparison (either true or false). +An input port that accepts the first string. +The comparison function (equals, startsWith, endsWith, contains). The default is "equals". +The second string. +Specify whether to ignore case. By default, the actor is case-sensitive. Select the parameter to ignore case. +The first string. + + + + + + + + + + + + + + + + + +null +Paul Whitaker +null +<p>The Logic Function actor reads Boolean tokens, performs a specified logical operation (e.g., "and" or "xnor"), and outputs the evaluated result as a Boolean token.</p> <p>Specify a logic function with the function parameter. The following logic functions may be performed:</p> <table> <tr><th>Logic Function </th><th>Definition</th></tr> <tr><td>and </td><td>The logical "and" operator (the default)</td></tr> <tr><td>or </td><td>The logical "or" operator.</td></tr> <tr><td>xor</td><td>The logical "xor" operator. </td></tr> <tr><td>nand</td><td>The logical "nand" operator. Equivalent to the negation of "and". </td></tr> <tr><td>nor</td><td>The logical "nor" operator. Equivalent to the negation of "or". </td></tr> <tr><td>xnor</td><td>The logical "xnor" operator. Equivalent to the negation of "xor".</td></tr> </table> <p>For more information about these functions, see http://whatis.techtarget.com/definition/0,,sid9_gci213512,00.html.</p> <p>The actor consumes at most one token on each input channel. It does not require that each input channel have a token upon firing. As long as one channel contains a token, the actor will produce output. If no input tokens are available, then no output is produced.</p> +An output port that broadcasts Boolean tokens representing the evaluated input. +A multiport that accepts Boolean tokens. +The logical operation to perform: and, or, xor, nand, nor, xnor. For more information about these functions, see http://whatis.techtarget.com/definition/0,,sid9_gci213512,00.html. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +ESO +2.9 +<p>The FitsRouter sorts files based on their category: by default, all files are routed to the rejected directory, but the user can add an additional port and configure the actor to route particular files to the new port. The category is defined by the value of either HIERARCH.ESO.PRO.CATG (keyword added to the file by the pipeline recipes) or REFLEX.CATG (virtual keyword created by the DataOrganizer).</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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> +The input data +The rejected SoF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ESO +2.0 +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. +The input sofs +The combined sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ESO +2.0 +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. +The input sofs +The combined sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null + <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> +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. +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. +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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +null +null +<p>The RecipeExecuter executes one CPL recipe. The recipe can be chosen only when you instantiate the component: at the moment the user is presented with a list of the available recipes (the output of esorex --recipes). After the user selects the recipe the actor queries EsoRex for the recipe parameters and adds them to the actor. Each parameter is set to the default value: if the user wants to change any of the parameters then he can enter his own value or he can write the special value PORT, in which case the value is taken from the input port SoP.</p><p>The actor has three modes: Run, Skip and Disabled</p><p>Note: since this actor has very different behaviour depending on the pipeline recipe to which it is associated, it is not present in the left hand side actor list, and instead it must be instantiated from the menu.</p> +the recipe input parameters +the outputs not matching any of the output categories +the logs generated by EsoRex, empty if lazy mode is triggered +the inputs not matching any of the input categories +the warnings generated by EsoRex, empty if lazy mode is triggered +the input files +the output files +the errors generated by EsoRex, empty if lazy mode is triggered +the parameters used in the last execution of the recipe +if true then the actor will check whether the pipeline recipe has already been executed with the same input files and with the same recipe parameters. If this is the case then the recipe will not be executed, and instead the previously generated products (which are the same as those that would have been generated if the recipe were executed, except for a timestamp) will be broadcast to the output port. +additional parameters passed to EsoRex +the selected pipeline recipe (cannot be changed) +the directory where the products will be created +<p>how the purpose of the input files will be sent to the output:</p><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. This is the default mode, and it means that the actor has completed a reduction step and removes it from the purpose chain</p><p>Set to universal: set the output purpose to universal</p> +Parameter name: IFU_18. Default value:-1 +Parameter name: IFU_17. Default value:-1 +Parameter name: IFU_16. Default value:-1 +if true then an empty sof on the input port will be broadcast to the output without executing the recipe +Parameter name: IFU_15. Default value:-1 +<p>Run: the recipe will be executed (see lazy mode)</p><p>Skip: the inputs are broadcast to the output with the following modifications: input files will be filtered according to input and output tags and recipe parameters will be filtered based on the recipe and whether the parameter is set to PORT</p><p>Disabled: the recipe is not executed and an empty SoF is generated on the output port</p> +if true then the execution is paused after the execution of the recipe +Parameter name: IFU_14. Default value:-1 +Parameter name: IFU_13. Default value:-1 +Parameter name: IFU_12. Default value:-1 +Parameter name: IFU_11. Default value:-1 +Parameter name: IFU_10. Default value:-1 +Parameter name: IFU_9. Default value:-1 +if true then the execution is paused just before executing the recipe +Parameter name: IFU_8. Default value:-1 +Parameter name: IFU_7. Default value:-1 +Parameter name: IFU_6. Default value:-1 +Parameter name: IFU_5. Default value:-1 +Parameter name: IFU_4. Default value:-1 +Parameter name: IFU_3. Default value:-1 +Parameter name: IFU_2. Default value:-1 +Parameter name: IFU_1. Default value:-1 +Parameter name: use_input_kernel. Default value:true +the directory where the EsoRex logs will be saved + +a list of file categories separated by a comma or a space: only input files belonging to one of these categories will be passed to the recipe +<p>it specifies the behavior of the actor if the recipe fails</p> <p>Stop: the actor produces an error message and the workflows stops. This is the default</p><p>Continue: the actor outputs an empty SoF</p><p>Ask: the actor pops up a window and asks the user whether he wants to continue or stop the execution</p> +a list of file categories separated by a comma or a space: only products belonging to one of these categories will be broadcast to the output port +Parameter name: IFU_24. Default value:-1 +Parameter name: IFU_23. Default value:-1 +Parameter name: IFU_22. Default value:-1 +Parameter name: IFU_21. Default value:-1 +Parameter name: IFU_20. Default value:-1 +the directory the recipe will use as a working directory +Parameter name: IFU_19. Default value:-1 +if true, the temporary directories (where the logs, the final and the temporary products of the recipe are created) are cleaned before the execution + + + + + + + + + + + + + + + + + + + +null +ESO +1.0 +<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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> +The input data +The rejected SoF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ESO +2.0 +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. +The input sofs +The combined sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Steve Neuendorffer +null +<p>The BooleanSwitch actor reads a value of any type, as well as a Boolean token that is used as a control. If the Boolean token is true, the actor outputs the received value to the trueOutput port; if the Boolean token is false, the actor outputs the received value to the falseOutput port. If the actor has never received a value on the control port, then the actor will output to the falseOutput port.</p> <p>The actor only works under certain directors. It will not work under an SDF Director, but it will under a PN Director, for example.</p> +An input port that accepts tokens of any type. +An output port that broadcasts the input token when the control is false. +An output port that broadcasts the input token when the control is true. +An input port that accepts a Boolean token used to select which output port (trueOutput or falseOutput) to broadcast. + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null +<p> A type polymorphic select with boolean valued control for use in the DDF domain. In the first iteration, an input token at the <i>control</i> port is read and its value is noted. In the second iteration, if the <i>control</i> input read from the previous iteration is true, then an input token at the <i>trueInput</i> port is read and sent to the output. Likewise with a false <i>control</i> input and the <i>falseInput</i> port. It alternates between these two kinds of iterations until stopped. The <i>control</i> port must receive Boolean Tokens. The <i>trueInput</i> and <i>falseInput</i> ports may receive Tokens of any type. Because tokens are immutable, the same Token is sent to the output, rather than a copy.</p> <p> Note this actor sends an output token every two iterations. Contrast this with BooleanSelect which sends an output token every iteration. </p> +Input for tokens on the false path. The port type can be any type. +The output port. The type is at least the type of <i>trueInput</i> and <i>falseInput</i>. +Input for tokens on the true path. The port type can be any type. +Input that selects one of the other input ports. The type is boolean. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Vinay Krishnan, Daniel Lazaro Cuadrado (contributor: Edward A. Lee) +null + <p>The StringCompare actor reads two strings and compares them using a specified comparison function. The actor outputs true if the strings satisfy the comparison criteria, or false if not.</p> <p>The comparison functions are specified with the function parameter: </p> <ul> <li>equals: Output true if the strings are equal (the default). </li> <li>startsWith: Output true if the first string starts with second string. </li> <li>endsWith: Output true if the first string ends with the second string. </li> <li>contains: Output true if the first string contains the second string. </li> </ul> <p>Strings will be read from the input ports if they are connected; otherwise strings are read from the parameters.</p> +An input port that accepts the second string. +An output port that broadcasts the result of the comparison (either true or false). +An input port that accepts the first string. +The comparison function (equals, startsWith, endsWith, contains). The default is "equals". +The second string. +Specify whether to ignore case. By default, the actor is case-sensitive. Select the parameter to ignore case. +The first string. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +It reads the content of a directory and creates an SoF +ESO +2.0 +The SofCreator reads the contents of a directory and creates an SoF: the file category is based on the keyword PRO.CATG or REFLEX.CATG. If both are missing the Default Category is used. +The input dir. If an empty string is provided the actor generates an empty SoF +The output sof + +a wildcard pattern representing the files to be included (e.g. *.fits) + +The default category to be used if none is defined in the file. + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +ESO +2.9 +<p>The FitsRouter sorts files based on their category: by default, all files are routed to the rejected directory, but the user can add an additional port and configure the actor to route particular files to the new port. The category is defined by the value of either HIERARCH.ESO.PRO.CATG (keyword added to the file by the pipeline recipes) or REFLEX.CATG (virtual keyword created by the DataOrganizer).</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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> +The input data +The rejected SoF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Identifies empty SoFs +ESO +2.9 +IsSofEmpty emits a true token if the input soF is empty +true if the input is not empty +true if the input is empty +The input sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Vinay Krishnan, Daniel Lazaro Cuadrado (contributor: Edward A. Lee) +null + <p>The StringCompare actor reads two strings and compares them using a specified comparison function. The actor outputs true if the strings satisfy the comparison criteria, or false if not.</p> <p>The comparison functions are specified with the function parameter: </p> <ul> <li>equals: Output true if the strings are equal (the default). </li> <li>startsWith: Output true if the first string starts with second string. </li> <li>endsWith: Output true if the first string ends with the second string. </li> <li>contains: Output true if the first string contains the second string. </li> </ul> <p>Strings will be read from the input ports if they are connected; otherwise strings are read from the parameters.</p> +An input port that accepts the second string. +An output port that broadcasts the result of the comparison (either true or false). +An input port that accepts the first string. +The comparison function (equals, startsWith, endsWith, contains). The default is "equals". +The second string. +Specify whether to ignore case. By default, the actor is case-sensitive. Select the parameter to ignore case. +The first string. + + + + + + + + + + + + + + + + + +null +Paul Whitaker +null +<p>The Logic Function actor reads Boolean tokens, performs a specified logical operation (e.g., "and" or "xnor"), and outputs the evaluated result as a Boolean token.</p> <p>Specify a logic function with the function parameter. The following logic functions may be performed:</p> <table> <tr><th>Logic Function </th><th>Definition</th></tr> <tr><td>and </td><td>The logical "and" operator (the default)</td></tr> <tr><td>or </td><td>The logical "or" operator.</td></tr> <tr><td>xor</td><td>The logical "xor" operator. </td></tr> <tr><td>nand</td><td>The logical "nand" operator. Equivalent to the negation of "and". </td></tr> <tr><td>nor</td><td>The logical "nor" operator. Equivalent to the negation of "or". </td></tr> <tr><td>xnor</td><td>The logical "xnor" operator. Equivalent to the negation of "xor".</td></tr> </table> <p>For more information about these functions, see http://whatis.techtarget.com/definition/0,,sid9_gci213512,00.html.</p> <p>The actor consumes at most one token on each input channel. It does not require that each input channel have a token upon firing. As long as one channel contains a token, the actor will produce output. If no input tokens are available, then no output is produced.</p> +A multiport that accepts Boolean tokens. +An output port that broadcasts Boolean tokens representing the evaluated input. +The logical operation to perform: and, or, xor, nand, nor, xnor. For more information about these functions, see http://whatis.techtarget.com/definition/0,,sid9_gci213512,00.html. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ESO +2.0 +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. +The input sofs +The combined sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null + <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> +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. +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. +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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +null +null +<p>The RecipeExecuter executes one CPL recipe. The recipe can be chosen only when you instantiate the component: at the moment the user is presented with a list of the available recipes (the output of esorex --recipes). After the user selects the recipe the actor queries EsoRex for the recipe parameters and adds them to the actor. Each parameter is set to the default value: if the user wants to change any of the parameters then he can enter his own value or he can write the special value PORT, in which case the value is taken from the input port SoP.</p><p>The actor has three modes: Run, Skip and Disabled</p><p>Note: since this actor has very different behaviour depending on the pipeline recipe to which it is associated, it is not present in the left hand side actor list, and instead it must be instantiated from the menu.</p> +the recipe input parameters +the outputs not matching any of the output categories +the logs generated by EsoRex, empty if lazy mode is triggered +the inputs not matching any of the input categories +the warnings generated by EsoRex, empty if lazy mode is triggered +the input files +the output files +the errors generated by EsoRex, empty if lazy mode is triggered +the parameters used in the last execution of the recipe +if true then the actor will check whether the pipeline recipe has already been executed with the same input files and with the same recipe parameters. If this is the case then the recipe will not be executed, and instead the previously generated products (which are the same as those that would have been generated if the recipe were executed, except for a timestamp) will be broadcast to the output port. +additional parameters passed to EsoRex +the selected pipeline recipe (cannot be changed) +the directory where the products will be created +<p>how the purpose of the input files will be sent to the output:</p><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. This is the default mode, and it means that the actor has completed a reduction step and removes it from the purpose chain</p><p>Set to universal: set the output purpose to universal</p> +Parameter name: res_lorentz. Default value:0.5 +Parameter name: fit_res_lorentz. Default value:false +Parameter name: res_gauss. Default value:-1 +if true then an empty sof on the input port will be broadcast to the output without executing the recipe +Parameter name: fit_res_gauss. Default value:true +<p>Run: the recipe will be executed (see lazy mode)</p><p>Skip: the inputs are broadcast to the output with the following modifications: input files will be filtered according to input and output tags and recipe parameters will be filtered based on the recipe and whether the parameter is set to PORT</p><p>Disabled: the recipe is not executed and an empty SoF is generated on the output port</p> +if true then the execution is paused after the execution of the recipe +Parameter name: relres_box. Default value:0 +Parameter name: fit_res_box. Default value:false +Parameter name: use_input_kernel. Default value:true +Parameter name: wlc_const. Default value:0 +Parameter name: wlc_n. Default value:2 +Parameter name: fit_wlc. Default value:true +if true then the execution is paused just before executing the recipe +Parameter name: cont_n. Default value:1 +Parameter name: fit_cont. Default value:true +Parameter name: xtol. Default value:0.001 +Parameter name: ftol. Default value:0.01 +Parameter name: relcol. Default value:-1 +Parameter name: fit_molec. Default value:-1 +Parameter name: list_molec. Default value:-1 +Parameter name: wave_range. Default value:-1 +Parameter name: process_ifus. Default value:-1 +the directory where the EsoRex logs will be saved + +a list of file categories separated by a comma or a space: only input files belonging to one of these categories will be passed to the recipe +<p>it specifies the behavior of the actor if the recipe fails</p> <p>Stop: the actor produces an error message and the workflows stops. This is the default</p><p>Continue: the actor outputs an empty SoF</p><p>Ask: the actor pops up a window and asks the user whether he wants to continue or stop the execution</p> +a list of file categories separated by a comma or a space: only products belonging to one of these categories will be broadcast to the output port +Parameter name: varkern. Default value:false +Parameter name: kernfac. Default value:5 +the directory the recipe will use as a working directory +Parameter name: kernmode. Default value:false +if true, the temporary directories (where the logs, the final and the temporary products of the recipe are created) are cleaned before the execution + + + + + + + + + + + + + + + + + + + +null +ESO +1.0 +<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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> +The input data +The rejected SoF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +ESO +2.0 +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. +The input sof +The number of groups generated +The grouped sofs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +ESO +2.0 +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) +The input sofs +The number of groups to collect +The grouped sof + + + +If true the SofAccumulator throws an error if the input tokens do not belong all to the same dataset + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Steve Neuendorffer +null +<p>The BooleanSwitch actor reads a value of any type, as well as a Boolean token that is used as a control. If the Boolean token is true, the actor outputs the received value to the trueOutput port; if the Boolean token is false, the actor outputs the received value to the falseOutput port. If the actor has never received a value on the control port, then the actor will output to the falseOutput port.</p> <p>The actor only works under certain directors. It will not work under an SDF Director, but it will under a PN Director, for example.</p> +An input port that accepts tokens of any type. +An output port that broadcasts the input token when the control is false. +An output port that broadcasts the input token when the control is true. +An input port that accepts a Boolean token used to select which output port (trueOutput or falseOutput) to broadcast. + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null +<p> A type polymorphic select with boolean valued control for use in the DDF domain. In the first iteration, an input token at the <i>control</i> port is read and its value is noted. In the second iteration, if the <i>control</i> input read from the previous iteration is true, then an input token at the <i>trueInput</i> port is read and sent to the output. Likewise with a false <i>control</i> input and the <i>falseInput</i> port. It alternates between these two kinds of iterations until stopped. The <i>control</i> port must receive Boolean Tokens. The <i>trueInput</i> and <i>falseInput</i> ports may receive Tokens of any type. Because tokens are immutable, the same Token is sent to the output, rather than a copy.</p> <p> Note this actor sends an output token every two iterations. Contrast this with BooleanSelect which sends an output token every iteration. </p> +Input for tokens on the false path. The port type can be any type. +The output port. The type is at least the type of <i>trueInput</i> and <i>falseInput</i>. +Input for tokens on the true path. The port type can be any type. +Input that selects one of the other input ports. The type is boolean. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Vinay Krishnan, Daniel Lazaro Cuadrado (contributor: Edward A. Lee) +null + <p>The StringCompare actor reads two strings and compares them using a specified comparison function. The actor outputs true if the strings satisfy the comparison criteria, or false if not.</p> <p>The comparison functions are specified with the function parameter: </p> <ul> <li>equals: Output true if the strings are equal (the default). </li> <li>startsWith: Output true if the first string starts with second string. </li> <li>endsWith: Output true if the first string ends with the second string. </li> <li>contains: Output true if the first string contains the second string. </li> </ul> <p>Strings will be read from the input ports if they are connected; otherwise strings are read from the parameters.</p> +An input port that accepts the second string. +An output port that broadcasts the result of the comparison (either true or false). +An input port that accepts the first string. +The comparison function (equals, startsWith, endsWith, contains). The default is "equals". +The second string. +Specify whether to ignore case. By default, the actor is case-sensitive. Select the parameter to ignore case. +The first string. + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +It reads the content of a directory and creates an SoF +ESO +2.0 +The SofCreator reads the contents of a directory and creates an SoF: the file category is based on the keyword PRO.CATG or REFLEX.CATG. If both are missing the Default Category is used. +The input dir. If an empty string is provided the actor generates an empty SoF +The output sof + +a wildcard pattern representing the files to be included (e.g. *.fits) + +The default category to be used if none is defined in the file. + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +ESO +2.9 +<p>The FitsRouter sorts files based on their category: by default, all files are routed to the rejected directory, but the user can add an additional port and configure the actor to route particular files to the new port. The category is defined by the value of either HIERARCH.ESO.PRO.CATG (keyword added to the file by the pipeline recipes) or REFLEX.CATG (virtual keyword created by the DataOrganizer).</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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> +The input data +The rejected SoF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Identifies empty SoFs +ESO +2.9 +IsSofEmpty emits a true token if the input soF is empty +true if the input is not empty +true if the input is empty +The input sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Vinay Krishnan, Daniel Lazaro Cuadrado (contributor: Edward A. Lee) +null + <p>The StringCompare actor reads two strings and compares them using a specified comparison function. The actor outputs true if the strings satisfy the comparison criteria, or false if not.</p> <p>The comparison functions are specified with the function parameter: </p> <ul> <li>equals: Output true if the strings are equal (the default). </li> <li>startsWith: Output true if the first string starts with second string. </li> <li>endsWith: Output true if the first string ends with the second string. </li> <li>contains: Output true if the first string contains the second string. </li> </ul> <p>Strings will be read from the input ports if they are connected; otherwise strings are read from the parameters.</p> +An input port that accepts the second string. +An output port that broadcasts the result of the comparison (either true or false). +An input port that accepts the first string. +The comparison function (equals, startsWith, endsWith, contains). The default is "equals". +The second string. +Specify whether to ignore case. By default, the actor is case-sensitive. Select the parameter to ignore case. +The first string. + + + + + + + + + + + + + + + + + +null +Paul Whitaker +null +<p>The Logic Function actor reads Boolean tokens, performs a specified logical operation (e.g., "and" or "xnor"), and outputs the evaluated result as a Boolean token.</p> <p>Specify a logic function with the function parameter. The following logic functions may be performed:</p> <table> <tr><th>Logic Function </th><th>Definition</th></tr> <tr><td>and </td><td>The logical "and" operator (the default)</td></tr> <tr><td>or </td><td>The logical "or" operator.</td></tr> <tr><td>xor</td><td>The logical "xor" operator. </td></tr> <tr><td>nand</td><td>The logical "nand" operator. Equivalent to the negation of "and". </td></tr> <tr><td>nor</td><td>The logical "nor" operator. Equivalent to the negation of "or". </td></tr> <tr><td>xnor</td><td>The logical "xnor" operator. Equivalent to the negation of "xor".</td></tr> </table> <p>For more information about these functions, see http://whatis.techtarget.com/definition/0,,sid9_gci213512,00.html.</p> <p>The actor consumes at most one token on each input channel. It does not require that each input channel have a token upon firing. As long as one channel contains a token, the actor will produce output. If no input tokens are available, then no output is produced.</p> +An output port that broadcasts Boolean tokens representing the evaluated input. +A multiport that accepts Boolean tokens. +The logical operation to perform: and, or, xor, nand, nor, xnor. For more information about these functions, see http://whatis.techtarget.com/definition/0,,sid9_gci213512,00.html. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ESO +2.0 +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. +The input sofs +The combined sof + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +<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> + + + + + + + + + + + + + + + + + + + + -S- + + + + + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null + <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> +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. +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. +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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +<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> +The vertical extent. The value is a double that defaults to 100.0. +The line width. The value is a double that defaults to 1.0. +The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +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). +The horizontal extent. The value is a double that defaults to 100.0. +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} +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." + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +<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> +The line width. The value is a double that defaults to 1.0. +The vertical extent. The value is a double that defaults to 100.0. +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). +Indicate whether the shape should be centered on its origin. By default, the location is the upper-left corner. +The amount of rounding of the corners. The value is a double that defaults to 0.0, which indicates no rounding. +The horizontal extent. The value is a double that defaults to 100.0. +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} +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." + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +<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> + + + + + + + + + + + + + + + + + + + + -S- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Vinay Krishnan, Daniel Lazaro Cuadrado (contributor: Edward A. Lee) +null + <p>The StringCompare actor reads two strings and compares them using a specified comparison function. The actor outputs true if the strings satisfy the comparison criteria, or false if not.</p> <p>The comparison functions are specified with the function parameter: </p> <ul> <li>equals: Output true if the strings are equal (the default). </li> <li>startsWith: Output true if the first string starts with second string. </li> <li>endsWith: Output true if the first string ends with the second string. </li> <li>contains: Output true if the first string contains the second string. </li> </ul> <p>Strings will be read from the input ports if they are connected; otherwise strings are read from the parameters.</p> +An input port that accepts the second string. +An output port that broadcasts the result of the comparison (either true or false). +An input port that accepts the first string. +The comparison function (equals, startsWith, endsWith, contains). The default is "equals". +The second string. +Specify whether to ignore case. By default, the actor is case-sensitive. Select the parameter to ignore case. +The first string. + + + + + + + + + + + + + + + +null +Steve Neuendorffer +null +<p>The BooleanSwitch actor reads a value of any type, as well as a Boolean token that is used as a control. If the Boolean token is true, the actor outputs the received value to the trueOutput port; if the Boolean token is false, the actor outputs the received value to the falseOutput port. If the actor has never received a value on the control port, then the actor will output to the falseOutput port.</p> <p>The actor only works under certain directors. It will not work under an SDF Director, but it will under a PN Director, for example.</p> +An input port that accepts tokens of any type. +An output port that broadcasts the input token when the control is false. +An output port that broadcasts the input token when the control is true. +An input port that accepts a Boolean token used to select which output port (trueOutput or falseOutput) to broadcast. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null + <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 constraints on the production and consumption behavior of actors, and the schedulers make no attempt to construct a compile-time schedule. Instead, each actor has a set of firing rules (patterns) and can be fired if one of them is satisfied, i.e., one particular firing pattern forms a prefix of sequences of unconsumed tokens at input ports. The canonical actors in the DDF domain include Select and Switch, which consume or produce tokens on different channels based on the token received from the control port. (In practice, use DDFSelect and DDFBooleanSelect in the DDF-specific library instead of Select and BooleanSelect in the regular FlowControl library; however, Switch and BooleanSwitch in the regular FlowControl library can be used in DDF domain.)</p> <p> The dynamic scheduler implemented in this director fires all enabled and non-deferrable actors once in a basic iteration. A deferrable actor is one that will not help one of the downstream actors become enabled because that downstream actor either already has enough tokens on the channel connecting those two actors or is waiting for tokens on another channel. If no actor fires so far, which means there is no enabled and non-deferrable actor, then among all enabled and deferrable actors, this director fires those which have the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors. If still no actor fires, then there is no enabled actor. A user can treat several such basic iterations as a single iteration by adding a parameter with name <i>requiredFiringsPerIteration</i> to an actor (which is often a sink actor or an actor directly connected to output port of the composite actor) and specifying the number of times this actor must be fired in a single iteration. If the value of the parameter <i>runUntilDeadlockInOneIteration</i> is a BooleanToken with value true, one single iteration consists of repeating the basic iteration until deadlock is reached (thus overriding the previous definition of one iteration), which is the status of the model where all active actors under the control of this director are unable to fire because their firing rules are not satisfied. However, they may be able to fire again during next iteration when tokens are transferred in from an outside domain. Note <i>runUntilDeadlockInOneIteration</i> can be set to true only when this director is not on the top level.</p> <p> The algorithm implementing one basic iteration goes like this: <pre> E = set of enabled actors D = set of deferrable enabled actors </pre> One basic(default) iteration consists of: <pre> if (E\D != empty set) { fire (E\D) } else if (D != empty set) { fire minimax(D) } else { declare deadlock } </pre> The function "minimax(D)" returns a subset of D with the smallest maximum number of tokens on their output channels which satisfy the demand of destination actors.</p> <p> Note that any SDF model can be run with a DDF Director. However, the notion of iteration is different. One could try to imitate the SDF iteration in the DDF domain by controlling the number of firings in one iteration for some actors, such as requiring a plotter to plot a fixed number of points in each iteration.</p> <p> In the DDF domain, the firing rule of any actor is specified by the token consumption rates of its input ports. A general DDF actor could change the consumption rates of its input ports after each firing of this actor. For multiports, an array token could be used to specify different rates for different channels connected to the same multiport. Note that in SDF, all channels connected to the same multiport have the same rate.</p> <p> Based on DDFSimpleSched in Ptolemy Classic, by Edward Lee. See E. A. Lee et al., "The Almagest," documentation for Ptolemy Classic, Vol. 1, Chapter 7, 1997.</p> +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. +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. +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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +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). +The font face. Select a font from the drop-down menu. The default is "SansSerif". +Select to indicate that the type should be italics. By default, type will not be italicized. +Select to indicate that the type should be bold. By default, type will not be bold. +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} +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. +The text of the annotation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +ESO +2.0 +The ProductExplorer allows the suer to browse all the executions of the datasets and to visualize the calibration cascade and the intermediate products. Refer to the Reflex User Manual for a more detailed documentation +If Mode is triggered a BooleanToken on this port defines whether the actor should pop up or not +The newest execution date of the datasets to be displayed: if not connected defaults to now + +The oldest execution date of the datasets to be displayed: if not connected defaults to now-24h +the file containing the bookkeeping database + +The application used to inspect FITS files + +The actor mode, can be either Enabled, Disabled or Triggered + + +The format of start and end date + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward A. Lee +null +<p>The IsPresent actor outputs "true" or "false" depending on whether it has received a data token or not.</p> <p>The actor reads tokens of any type via the channels of its input multiport. If a token is present on a channel, the actor outputs the Boolean value true on the corresponding channel of the output port; if a token is not present on a channel, the actor outputs false on the corresponding channel of the output port.</p> <p>The width of the input and output port (i.e., the number of channels on each port) must be the same.</p> <p>Note that this actor is most useful when used with synchronous directors like SDF. Under a PN Director, input is always present (by definition). Under a DE Director, the actor is only triggered if one of the input channels has data.</p> +A multiport that accepts values of any type. The width of the port must match the width of the output ports. +A multiport that broadcasts Boolean values: true if the corresponding input channel receives a token; false if the corresponding input channel does not receive a token. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Gang Zhou +null +<p> A type polymorphic select with boolean valued control for use in the DDF domain. In the first iteration, an input token at the <i>control</i> port is read and its value is noted. In the second iteration, if the <i>control</i> input read from the previous iteration is true, then an input token at the <i>trueInput</i> port is read and sent to the output. Likewise with a false <i>control</i> input and the <i>falseInput</i> port. It alternates between these two kinds of iterations until stopped. The <i>control</i> port must receive Boolean Tokens. The <i>trueInput</i> and <i>falseInput</i> ports may receive Tokens of any type. Because tokens are immutable, the same Token is sent to the output, rather than a copy.</p> <p> Note this actor sends an output token every two iterations. Contrast this with BooleanSelect which sends an output token every iteration. </p> +Input for tokens on the false path. The port type can be any type. +The output port. The type is at least the type of <i>trueInput</i> and <i>falseInput</i>. +Input for tokens on the true path. The port type can be any type. +Input that selects one of the other input ports. The type is boolean. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Xiaojun Liu +null + 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(self) : 4. if not self.input.hasToken(0) : 5. return 6. s = self.scale.getToken() 7. t = self.input.get(0) 8. self.output.broadcast(s.multiply(t)) </pre> Line 1 defines a Python class Main. This name is fixed. An instance of this class is created when the actor is initialized. Line 2 is a description of the purpose of the script. Lines 3-8 define the fire() method. In the method body, <i>input</i> and <i>output</i> are ports that have been added to the actor, and <i>scale</i> is a parameter added to the actor (these can be added in the XML that defines the actor instance in an actor library). The Main class can provide other methods in the Executable interface as needed. <p> In the script, use <code>self.actor</code> to access the actor. For example, <code>self.actor.getDirector()</code> returns the current director of the actor. For debugging, use <code>self.actor.debug(someMessage)</code>. The final message sent to the debug listeners of the actor will have the string "From script: " inserted at the beginning. To avoid generating the debug message when there are no listeners, use: <pre> if self.actor.isDebugging() : self.actor.debug(someMessage) </pre> <p> This class relies on Jython, which is a Java implementation of Python. </p> Follow the links below for more information about the Python language, licensing, downloads, etc. <p><a href="http://www.python.org" target="_top">Python</a></p> <p><a href="http://www.jython.org" target="_top">Jython</a></p> <p><a href="http://www.jython.org/docs/differences.html">Differences between Jython and the C version of Python</a></p> <p><a href="http://www.jython.org/Project/userguide.html#the-jython-registry">The Jython Registry</a> - information about how to set the search path. </p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +null +Vinay Krishnan, Daniel Lazaro Cuadrado (contributor: Edward A. Lee) +null + <p>The StringCompare actor reads two strings and compares them using a specified comparison function. The actor outputs true if the strings satisfy the comparison criteria, or false if not.</p> <p>The comparison functions are specified with the function parameter: </p> <ul> <li>equals: Output true if the strings are equal (the default). </li> <li>startsWith: Output true if the first string starts with second string. </li> <li>endsWith: Output true if the first string ends with the second string. </li> <li>contains: Output true if the first string contains the second string. </li> </ul> <p>Strings will be read from the input ports if they are connected; otherwise strings are read from the parameters.</p> +An input port that accepts the second string. +An output port that broadcasts the result of the comparison (either true or false). +An input port that accepts the first string. +The comparison function (equals, startsWith, endsWith, contains). The default is "equals". +The second string. +Specify whether to ignore case. By default, the actor is case-sensitive. Select the parameter to ignore case. +The first string. + + + + - + + + + + + + + + - + - -null -Edward Lee -null -<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> -An output port that broadcasts a string constant specified by the value parameter. -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. -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. -The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) - + - - - + - + - + - - - - - + - + - + - - - - - - - - + + + + + + + + + + -It reads a formatted string and converts it to an SoP. -ESO -2.0 -The SoPCreator reads a formatted string and converts it into an SoP. The input string must be a list of tokens in the following format: recipe_name:par_name=value separated by either a comma or a newline -The output sop -The input string - - - - +null +Paul Whitaker +null +<p>The Logic Function actor reads Boolean tokens, performs a specified logical operation (e.g., "and" or "xnor"), and outputs the evaluated result as a Boolean token.</p> <p>Specify a logic function with the function parameter. The following logic functions may be performed:</p> <table> <tr><th>Logic Function </th><th>Definition</th></tr> <tr><td>and </td><td>The logical "and" operator (the default)</td></tr> <tr><td>or </td><td>The logical "or" operator.</td></tr> <tr><td>xor</td><td>The logical "xor" operator. </td></tr> <tr><td>nand</td><td>The logical "nand" operator. Equivalent to the negation of "and". </td></tr> <tr><td>nor</td><td>The logical "nor" operator. Equivalent to the negation of "or". </td></tr> <tr><td>xnor</td><td>The logical "xnor" operator. Equivalent to the negation of "xor".</td></tr> </table> <p>For more information about these functions, see http://whatis.techtarget.com/definition/0,,sid9_gci213512,00.html.</p> <p>The actor consumes at most one token on each input channel. It does not require that each input channel have a token upon firing. As long as one channel contains a token, the actor will produce output. If no input tokens are available, then no output is produced.</p> +An output port that broadcasts Boolean tokens representing the evaluated input. +A multiport that accepts Boolean tokens. +The logical operation to perform: and, or, xor, nand, nor, xnor. For more information about these functions, see http://whatis.techtarget.com/definition/0,,sid9_gci213512,00.html. + + + + - - - + + + + + + + + + + + - + - + - - - - - - - - - - - - - + - + - + - + + + + - + + + + +null +John Li +$Id: LogicalNot.java 57040 2010-01-27 20:52:32Z cxh $ + This actor implements a logical NOT operator. It has one input and one output port, neither of which is a multiport, and both of which have type boolean. A BooleanToken that arrives in the <i>input</i> will be negated and sent on the <i>output</i>. If no input token is available, then no output is produced. +The output port. By default, the type of this output is constrained to be at least that of the input. +The input port. This base class imposes no type constraints except that the type of the input cannot be greater than the type of the output. + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + + null Steve Neuendorffer null -<p>The Boolean Multiplexor uses a Boolean value to determine which of two input values to output. The actor is useful when creating workflow control structures, which allow workflows to branch, for example.</p> <p>The actor reads values of any type via its trueInput and falseInput port. In addition, the actor receives a Boolean "select" token, which it uses to determine which input value to select and output. The actor outputs the selected value each time it iterates.</p> <p>The actor must receive tokens on all ports. Each time the actor fires, it reads one token from each of its input ports and outputs the selected token.</p> -An input port that receives a Boolean token (true or false) that is used to select and output either the trueInput or falseInput value. -An input port that receives tokens of any type. The value will be output if the "select" token is false. -An output port that broadcasts the selected input value. -An input port that receives tokens of any type. The value will be output if the "select" token is true. - +<p>The BooleanSwitch actor reads a value of any type, as well as a Boolean token that is used as a control. If the Boolean token is true, the actor outputs the received value to the trueOutput port; if the Boolean token is false, the actor outputs the received value to the falseOutput port. If the actor has never received a value on the control port, then the actor will output to the falseOutput port.</p> <p>The actor only works under certain directors. It will not work under an SDF Director, but it will under a PN Director, for example.</p> +An input port that accepts tokens of any type. +An output port that broadcasts the input token when the control is false. +An output port that broadcasts the input token when the control is true. +An input port that accepts a Boolean token used to select which output port (trueOutput or falseOutput) to broadcast. + - - + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + +null +ESO +2.0 +The ProductExplorer allows the suer to browse all the executions of the datasets and to visualize the calibration cascade and the intermediate products. Refer to the Reflex User Manual for a more detailed documentation +If Mode is triggered a BooleanToken on this port defines whether the actor should pop up or not +The newest execution date of the datasets to be displayed: if not connected defaults to now + +The oldest execution date of the datasets to be displayed: if not connected defaults to now-24h +the file containing the bookkeeping database + +The application used to inspect FITS files + +The actor mode, can be either Enabled, Disabled or Triggered + + +The format of start and end date + + + + + + + + + + + - + + + - + - + - + - - - + + + - - + + +null +Edward A. Lee +null +<p>The IsPresent actor outputs "true" or "false" depending on whether it has received a data token or not.</p> <p>The actor reads tokens of any type via the channels of its input multiport. If a token is present on a channel, the actor outputs the Boolean value true on the corresponding channel of the output port; if a token is not present on a channel, the actor outputs false on the corresponding channel of the output port.</p> <p>The width of the input and output port (i.e., the number of channels on each port) must be the same.</p> <p>Note that this actor is most useful when used with synchronous directors like SDF. Under a PN Director, input is always present (by definition). Under a DE Director, the actor is only triggered if one of the input channels has data.</p> +A multiport that accepts values of any type. The width of the port must match the width of the output ports. +A multiport that broadcasts Boolean values: true if the corresponding input channel receives a token; false if the corresponding input channel does not receive a token. + - + + + + + + + + + + + + + + + + + + + + + + + @@ -14994,7 +20875,7 @@ 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. 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. The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) - + @@ -15010,21 +20891,23 @@ - + + + - + - - + + - + @@ -15037,7 +20920,7 @@ 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. 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. The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) - + @@ -15053,25 +20936,28 @@ - + + + - + - + + - + - + null @@ -15085,7 +20971,7 @@ The second string. Specify whether to ignore case. By default, the actor is case-sensitive. Select the parameter to ignore case. The first string. - + @@ -15095,97 +20981,257 @@ - + + + - + + + + + + + null -ESO -1.0 -<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> <p>Advanced Mode: create an output port named as you want (e.g.: MyPort), then create a string parameter whose name is the port name plus "_config" (e.g.: MyPort_config). This parameter can be a list of regular expressions separated by a comma or a space (you can mix both in the same parameter): each file matching at least one of them will be routed to this port.</p> <p>If you want to define the minimum or maximum the number of files that are broadcasted to a port you can define a parameter whose name is the port name plus "_min_number" or "_max_number", respectively.</p> <p>Note: one file can be routed to many ports, if no port fits it is routed to the rejected port.</p> -The input data -The rejected SoF - - - - +Edward Lee +null +<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> <p>Specified string values can include references to parameters within scope (i.e., parameters defined at the same level of the hierarchy or higher). </p> <p>NOTE: If using a PN Director, the 'firingCountLimit' parameter is often set to a finite integer (e.g. '1') so that the workflow will terminate. </p> +An output port that broadcasts a string constant specified by the value parameter. +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. +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. +The value produced by the actor. Specified strings do not require enclosing quotes. (To include a '$' sign in the string, enter '$$'.) + - - + + - + - + - + + + + + - + - + + + + + - - - - - - - - - - - - - + + + + + - + - + + + + + + + + + - + - + - + + + - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + + +Renames recipe products based on FITS keywords +ESO +2.9 +This actor renames files based on some FITS keywords and stores them in a destination directory. It is usually connected to the output of recipes that produce final products. All the frames received by the ProductRenamer will be copied/linked to a new location. If there are recipe products that are not relevant as final science products, an output filter can be configured in the RecipeExecuter. The copying/linking of files is done a configurable directory where the final products are stored. The final destination is controlled by parameters FinalProductDirectory and SubDir. Typically, the later will contain an execution timestamp.   The input files port must contain a Sof with files that can be read by the actor, otherwise the workflow will stop with an error message. The ProductRenamer is also responsible of updating the bookkeeping database with the new names of the files. The ProductRenamer is a simple script that can be easily modified to fine tune the names of the output files by manipulating the header keyword strings. Double-clicking on the actor in Reflex opens it up for editing. The script is in Jython, a Java implementation of the Python scripting language, with which it shares much of the syntax. The script source code is saved in the workflow XML structure, so every change made by the user applies only to the specific instance of the actor he has modified, which also means that when a new version of the actor is released, usually together with a new release of Reflex, the code in the existing workflows is not updated. +The final list of files produced +The files to be copied/moved or linked +it specifies a set of FITS keywords that collated together will give the pattern to create the output filename. It is also possible to add fixed strings using 'my-string' format. For example, if the value of this parameter is 'MyPrefix_',HIERARCH.ESO.OBS.NAME, then the output filename will be, assuming that the value of the keyword is M51, MyPrefix_M51.fits. +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) + +The directory where the files are going to be copied/linked or renamed. It is usually set to END_PRODUCTS_DIR +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 +There are several options: "copy", "move" or "link". + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -15212,7 +21258,7 @@ - + @@ -15222,85 +21268,85 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -15314,7 +21360,7 @@ - + @@ -15325,56 +21371,50 @@ - - - + - + - + - + - + - - - - - + - + - + - + @@ -15383,15 +21423,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -15405,8 +21484,8 @@ + - @@ -15423,7 +21502,7 @@ - + @@ -15442,7 +21521,6 @@ - @@ -15454,14 +21532,9 @@ - - - - - @@ -15470,6 +21543,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -15478,7 +21577,8 @@ - + + diff -Nru cpl-plugin-kmos-1.4.3+dfsg/reflex/Makefile.in cpl-plugin-kmos-2.0.2+dfsg/reflex/Makefile.in --- cpl-plugin-kmos-1.4.3+dfsg/reflex/Makefile.in 2017-02-27 20:41:52.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/reflex/Makefile.in 2018-04-24 13:37:16.000000000 +0000 @@ -98,7 +98,8 @@ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4macros/molecfit.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -212,6 +213,7 @@ LIBIRPLIB = @LIBIRPLIB@ LIBKMCLIPMLIB = @LIBKMCLIPMLIB@ LIBKMOS = @LIBKMOS@ +LIBMOLECFIT = @LIBMOLECFIT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -227,6 +229,10 @@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOLECFITDIR = @MOLECFITDIR@ +MOLECFIT_CFLAGS = @MOLECFIT_CFLAGS@ +MOLECFIT_INCLUDES = @MOLECFIT_INCLUDES@ +MOLECFIT_LDFLAGS = @MOLECFIT_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -241,6 +247,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG = @PKGCONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/reflex/README cpl-plugin-kmos-2.0.2+dfsg/reflex/README --- cpl-plugin-kmos-1.4.3+dfsg/reflex/README 2016-12-08 13:47:29.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/reflex/README 2018-02-26 09:26:38.000000000 +0000 @@ -4,25 +4,28 @@ no-combine set to true collapse-reconstructed set to true Input Files : - SCIENCE,XCAL,YCAL,LCAL,WAVE_BAND,MASTER_FLAT,ILLUM_CORR,TELLURIC,OH_SPEC + SCIENCE,XCAL,YCAL,LCAL,WAVE_BAND,MASTER_FLAT,ILLUM_CORR,TELLURIC,OH_SPEC, TELLURIC_GEN + PORT: imethod, oscan, pix_scale, neighborhoodRange, flux, background, xcal_interpolation, no_subratact, + sky_tweak, skip_sky_oh_align, stretch, stretch_degree, stretch_resampling, b_samples, obj_sky_table, + velocity_offset - kmos_combine : collapse-combine set to true cmethod = header Input Files : - SCI_RECONSTRUCTED, OH_SPEC + SCI_RECONSTRUCTED, OH_SPEC, SINGLE_CUBES - kmos_std_star : Input Files : STD,XCAL,YCAL,LCAL,MASTER_FLAT,WAVE_BAND,ILLUM_CORR,SOLAR_SPEC,ATMOS_MODEL,SPEC_TYPE_LOOKUP + port: startype, imethod, fmethod, nieighborhoodRange, magnitude, flux, xcal_interpolation, b_samples, + mask_method, centre, radius, cmethod, cpos_rej, cneg_rej, citer, cmax, cmin - kmos_iluminaion : Input Files : - FLAT_ON,MASTER_DARK,MASTER_FLAT,XCAL,YCAL,LCAL,WAVE_BAND - PORT: pixscale - or - FLAT_SKY,MASTER_DARK,MASTER_FLAT,XCAL,YCAL,LCAL,WAVE_BAND,FLAT_EDGE + FLAT_SKY,MASTER_DARK,MASTER_FLAT,XCAL,YCAL,LCAL,WAVE_BAND,FLAT_EDGE,FLAT_ON PORT: pixscale - kmos_wave_cal : Input Files : ARC_ON,ARC_OFF,XCAL,YCAL,ARC_LIST,FLAT_EDGE,REF_LINES,WAVE_BAND + order, suppress_extension, b_samples -> PORT - kmos_flat : Input Files : FLAT_ON,FLAT_OFF,BADPIXEL_DARK @@ -30,7 +33,19 @@ Input Files : DARK +- kmos_gen_telluric + Input Files : + TELLURIC, TELLURIC_CORR, RESPONSE + PORT : method, fill_empty_ifus, b_samples + Strip Last Purpose : Do Nothing + + - All recipes: recipe Failure Mode = $RecipeFailureMode + $TMP_PRODUCTS_DIR + $LOGS_DIR + $BOOKKEEPING_DIR + $ESORexArgs + $BOOKKEEPING_DB diff -Nru cpl-plugin-kmos-1.4.3+dfsg/regtests/Makefile.in cpl-plugin-kmos-2.0.2+dfsg/regtests/Makefile.in --- cpl-plugin-kmos-1.4.3+dfsg/regtests/Makefile.in 2017-02-27 20:41:52.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/regtests/Makefile.in 2018-04-24 13:37:16.000000000 +0000 @@ -97,7 +97,8 @@ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4macros/molecfit.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -242,6 +243,7 @@ LIBIRPLIB = @LIBIRPLIB@ LIBKMCLIPMLIB = @LIBKMCLIPMLIB@ LIBKMOS = @LIBKMOS@ +LIBMOLECFIT = @LIBMOLECFIT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -257,6 +259,10 @@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOLECFITDIR = @MOLECFITDIR@ +MOLECFIT_CFLAGS = @MOLECFIT_CFLAGS@ +MOLECFIT_INCLUDES = @MOLECFIT_INCLUDES@ +MOLECFIT_LDFLAGS = @MOLECFIT_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -271,6 +277,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG = @PKGCONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/regtests/tests/Makefile.in cpl-plugin-kmos-2.0.2+dfsg/regtests/tests/Makefile.in --- cpl-plugin-kmos-1.4.3+dfsg/regtests/tests/Makefile.in 2017-02-27 20:41:52.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/regtests/tests/Makefile.in 2018-04-24 13:37:16.000000000 +0000 @@ -97,7 +97,8 @@ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4macros/molecfit.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -182,6 +183,7 @@ LIBIRPLIB = @LIBIRPLIB@ LIBKMCLIPMLIB = @LIBKMCLIPMLIB@ LIBKMOS = @LIBKMOS@ +LIBMOLECFIT = @LIBMOLECFIT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -197,6 +199,10 @@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOLECFITDIR = @MOLECFITDIR@ +MOLECFIT_CFLAGS = @MOLECFIT_CFLAGS@ +MOLECFIT_INCLUDES = @MOLECFIT_INCLUDES@ +MOLECFIT_LDFLAGS = @MOLECFIT_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -211,6 +217,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG = @PKGCONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff -Nru cpl-plugin-kmos-1.4.3+dfsg/tools/kmos_calib.py cpl-plugin-kmos-2.0.2+dfsg/tools/kmos_calib.py --- cpl-plugin-kmos-1.4.3+dfsg/tools/kmos_calib.py 2016-04-04 08:22:46.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/tools/kmos_calib.py 2017-04-26 13:31:42.000000000 +0000 @@ -4,9 +4,14 @@ import os import time from optparse import OptionParser -import pyfits -from pyfits import getval -from pyfits import getheader +try: + import pyfits + from pyfits import getval + from pyfits import getheader +except: + from astropy.io import fits as fits + from fits import getval + from fits import getheader import glob import logging import subprocess @@ -181,15 +186,15 @@ # Add Calibrations if filelist[0]['tpl_id'] == "KMOS_spec_cal_calunitflat" : - sof.write(os.getcwd()+"/badpixel_dark.fits BADPIXEL_DARK\n") + sof.write(os.getcwd()+"/BADPIXEL_DARK.fits BADPIXEL_DARK\n") if filelist[0]['tpl_id'] == "KMOS_spec_cal_wave" : sof.write(os.environ['KMOS_CALIB']+"/kmos_wave_ref_table.fits REF_LINES\n") sof.write(os.environ['KMOS_CALIB']+"/kmos_wave_band.fits WAVE_BAND\n") sof.write(os.environ['KMOS_CALIB']+"/kmos_ar_ne_list_"+band_lc+".fits ARC_LIST\n") - sof.write(os.getcwd()+"/"+filelist[0]['band']+"/flat_edge_"+band_3uc+".fits FLAT_EDGE\n") - sof.write(os.getcwd()+"/"+filelist[0]['band']+"/xcal_"+band_3uc+".fits XCAL\n") - sof.write(os.getcwd()+"/"+filelist[0]['band']+"/ycal_"+band_3uc+".fits YCAL\n") + sof.write(os.getcwd()+"/"+filelist[0]['band']+"/FLAT_EDGE_"+band_3uc+".fits FLAT_EDGE\n") + sof.write(os.getcwd()+"/"+filelist[0]['band']+"/XCAL_"+band_3uc+".fits XCAL\n") + sof.write(os.getcwd()+"/"+filelist[0]['band']+"/YCAL_"+band_3uc+".fits YCAL\n") # Close sof file sof.close() @@ -279,15 +284,15 @@ \033[1mPurpose:\033[0m Execute kmos_dark/_flat/_wave_cal on the data from the 3 relevant templates in the 5 bands in order to create the calibration files set needed for the image reconstruction on the instrument workstation. The wished 37 files are: -- badpixel_dark.fits -- master_dark.fits -- badpixel_flat_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits -- det_img_wave_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits -- flat_edge_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits -- master_flat_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits -- lcal_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits -- xcal_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits -- ycal_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits +- BADPIXEL_DARK.fits +- MASTER_DARK.fits +- BADPIXEL_FLAT_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits +- DET_IMG_WAVE_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits +- FLAT_EDGE_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits +- MASTER_FLAT_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits +- LCAL_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits +- XCAL_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits +- YCAL_[HHH|KKK|HKHKHK|IZIZIZ|YJYJYJ].fits \033[1mUsage:\033[0m - Create a new directory and cd to it (mkdir tmp ; cd tmp) @@ -507,8 +512,8 @@ os.mkdir('results') # Collect results -os.rename(os.getcwd()+"/master_dark.fits", os.getcwd()+"/results/master_dark.fits") -os.rename(os.getcwd()+"/badpixel_dark.fits", os.getcwd()+"/results/badpixel_dark.fits") +os.rename(os.getcwd()+"/MASTER_DARK.fits", os.getcwd()+"/results/MASTER_DARK.fits") +os.rename(os.getcwd()+"/BADPIXEL_DARK.fits", os.getcwd()+"/results/BADPIXEL_DARK.fits") for set_curr in selected_sets: # Skip the bands that are not wished if options.band != 'All' and options.band != set_curr['band']: @@ -517,13 +522,13 @@ # Collect the band results my_dir = set_curr['band'] band_3uc = set_curr['band']*3 - filenames = [ "xcal_{0}.fits".format(band_3uc), - "ycal_{0}.fits".format(band_3uc), - "lcal_{0}.fits".format(band_3uc), - "master_flat_{0}.fits".format(band_3uc), - "badpixel_flat_{0}.fits".format(band_3uc), - "det_img_wave_{0}.fits".format(band_3uc), - "flat_edge_{0}.fits".format(band_3uc)] + filenames = [ "XCAL_{0}.fits".format(band_3uc), + "YCAL_{0}.fits".format(band_3uc), + "LCAL_{0}.fits".format(band_3uc), + "MASTER_FLAT_{0}.fits".format(band_3uc), + "BADPIXEL_FLAT_{0}.fits".format(band_3uc), + "DET_IMG_WAVE_{0}.fits".format(band_3uc), + "FLAT_EDGE_{0}.fits".format(band_3uc)] for filename in filenames : src_file = os.getcwd()+"/"+my_dir+"/"+filename dest_file = os.getcwd()+"/results/"+filename diff -Nru cpl-plugin-kmos-1.4.3+dfsg/tools/kmos_verify.py cpl-plugin-kmos-2.0.2+dfsg/tools/kmos_verify.py --- cpl-plugin-kmos-1.4.3+dfsg/tools/kmos_verify.py 2014-10-27 19:43:46.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/tools/kmos_verify.py 2017-04-26 13:31:42.000000000 +0000 @@ -4,8 +4,12 @@ import os import time from optparse import OptionParser -import pyfits -from pyfits import getheader +try: + import pyfits + from pyfits import getheader +except: + from astropy.io import fits as fits + from fits import getheader import glob import logging diff -Nru cpl-plugin-kmos-1.4.3+dfsg/tools/Makefile cpl-plugin-kmos-2.0.2+dfsg/tools/Makefile --- cpl-plugin-kmos-1.4.3+dfsg/tools/Makefile 2017-02-27 20:41:55.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/tools/Makefile 2018-04-24 13:37:22.000000000 +0000 @@ -98,7 +98,8 @@ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4macros/molecfit.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(dist_bin_SCRIPTS) \ @@ -158,17 +159,17 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /home/vagrant/kmos-1_4_3/kmosp/admin/missing aclocal-1.15 +ACLOCAL = ${SHELL} /home/vagrant/kmos-2_0_2/kmosp/admin/missing aclocal-1.15 AMTAR = $${TAR-tar} AM_DEFAULT_VERBOSITY = 1 AR = ar -AUTOCONF = ${SHELL} /home/vagrant/kmos-1_4_3/kmosp/admin/missing autoconf -AUTOHEADER = ${SHELL} /home/vagrant/kmos-1_4_3/kmosp/admin/missing autoheader -AUTOMAKE = ${SHELL} /home/vagrant/kmos-1_4_3/kmosp/admin/missing automake-1.15 +AUTOCONF = ${SHELL} /home/vagrant/kmos-2_0_2/kmosp/admin/missing autoconf +AUTOHEADER = ${SHELL} /home/vagrant/kmos-2_0_2/kmosp/admin/missing autoheader +AUTOMAKE = ${SHELL} /home/vagrant/kmos-2_0_2/kmosp/admin/missing automake-1.15 AWK = gawk CC = gcc CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -fno-builtin +CFLAGS = -g -O2 -std=c99 CPL_CFLAGS = -I/usr/include/cpl -I/usr/include CPL_INCLUDES = -I/usr/include/cpl -I/usr/include CPL_LDFLAGS = -L/usr/lib64 -L/usr/lib @@ -194,15 +195,15 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_SCRIPT = ${INSTALL} INSTALL_STRIP_PROGRAM = $(install_sh) -c -s -KMOS_BINARY_AGE = 403 -KMOS_BINARY_VERSION = 10403 +KMOS_BINARY_AGE = 2 +KMOS_BINARY_VERSION = 20002 KMOS_INCLUDES = -I$(top_srcdir)/kmos -I$(top_srcdir)/irplib -I$(top_srcdir)/kmclipm/include KMOS_INTERFACE_AGE = 0 KMOS_LDFLAGS = -L$(top_srcdir)/kmos -KMOS_MAJOR_VERSION = 1 -KMOS_MICRO_VERSION = 3 -KMOS_MINOR_VERSION = 4 -KMOS_VERSION = 1.4.3 +KMOS_MAJOR_VERSION = 2 +KMOS_MICRO_VERSION = 2 +KMOS_MINOR_VERSION = 0 +KMOS_VERSION = 2.0.2 LATEX = /usr/bin/latex LD = /usr/bin/ld -m elf_x86_64 LDFLAGS = @@ -213,6 +214,7 @@ LIBIRPLIB = $(top_builddir)/irplib/libirplib.la LIBKMCLIPMLIB = $(top_builddir)/kmclipm/libkmclipmlib.la LIBKMOS = $(top_builddir)/kmos/libkmos.la +LIBMOLECFIT = -lmolecfit LIBOBJS = LIBS = -lm -lnsl LIBTOOL = $(SHELL) $(top_builddir)/libtool @@ -225,9 +227,13 @@ LT_REVISION = 0 LT_SYS_LIBRARY_PATH = MAINT = -MAKEINFO = ${SHELL} /home/vagrant/kmos-1_4_3/kmosp/admin/missing makeinfo +MAKEINFO = ${SHELL} /home/vagrant/kmos-2_0_2/kmosp/admin/missing makeinfo MANIFEST_TOOL = : MKDIR_P = /usr/bin/mkdir -p +MOLECFITDIR = +MOLECFIT_CFLAGS = -I/usr/include/molecfit -I/usr/include +MOLECFIT_INCLUDES = -I/usr/include/molecfit -I/usr/include +MOLECFIT_LDFLAGS = NM = /usr/bin/nm -B NMEDIT = OBJDUMP = objdump @@ -237,21 +243,22 @@ PACKAGE = kmos PACKAGE_BUGREPORT = usd-help@eso.org PACKAGE_NAME = KMOS Instrument Pipeline -PACKAGE_STRING = KMOS Instrument Pipeline 1.4.3 +PACKAGE_STRING = KMOS Instrument Pipeline 2.0.2 PACKAGE_TARNAME = kmos PACKAGE_URL = -PACKAGE_VERSION = 1.4.3 +PACKAGE_VERSION = 2.0.2 PATH_SEPARATOR = : +PKGCONFIG = pkg-config RANLIB = ranlib SED = /usr/bin/sed SET_MAKE = SHELL = /bin/sh STRIP = strip -VERSION = 1.4.3 -abs_builddir = /home/vagrant/kmos-1_4_3/kmosp/tools -abs_srcdir = /home/vagrant/kmos-1_4_3/kmosp/tools -abs_top_builddir = /home/vagrant/kmos-1_4_3/kmosp -abs_top_srcdir = /home/vagrant/kmos-1_4_3/kmosp +VERSION = 2.0.2 +abs_builddir = /home/vagrant/kmos-2_0_2/kmosp/tools +abs_srcdir = /home/vagrant/kmos-2_0_2/kmosp/tools +abs_top_builddir = /home/vagrant/kmos-2_0_2/kmosp +abs_top_srcdir = /home/vagrant/kmos-2_0_2/kmosp ac_ct_AR = ar ac_ct_CC = gcc ac_ct_DUMPBIN = @@ -270,7 +277,7 @@ build_os = linux-gnu build_vendor = unknown builddir = . -configdir = ${datadir}/${PACKAGE}/config +configdir = ${datadir}/esopipes/${PACKAGE}-${VERSION}/config datadir = ${datarootdir} datarootdir = ${prefix}/share docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} @@ -284,7 +291,7 @@ htmldir = ${docdir} includedir = ${prefix}/include infodir = ${datarootdir}/info -install_sh = ${SHELL} /home/vagrant/kmos-1_4_3/kmosp/admin/install-sh +install_sh = ${SHELL} /home/vagrant/kmos-2_0_2/kmosp/admin/install-sh libdir = ${exec_prefix}/lib libexecdir = ${exec_prefix}/libexec localedir = ${datarootdir}/locale diff -Nru cpl-plugin-kmos-1.4.3+dfsg/tools/Makefile.in cpl-plugin-kmos-2.0.2+dfsg/tools/Makefile.in --- cpl-plugin-kmos-1.4.3+dfsg/tools/Makefile.in 2017-02-27 20:41:52.000000000 +0000 +++ cpl-plugin-kmos-2.0.2+dfsg/tools/Makefile.in 2018-04-24 13:37:16.000000000 +0000 @@ -98,7 +98,8 @@ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4macros/molecfit.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(dist_bin_SCRIPTS) \ @@ -213,6 +214,7 @@ LIBIRPLIB = @LIBIRPLIB@ LIBKMCLIPMLIB = @LIBKMCLIPMLIB@ LIBKMOS = @LIBKMOS@ +LIBMOLECFIT = @LIBMOLECFIT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -228,6 +230,10 @@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MOLECFITDIR = @MOLECFITDIR@ +MOLECFIT_CFLAGS = @MOLECFIT_CFLAGS@ +MOLECFIT_INCLUDES = @MOLECFIT_INCLUDES@ +MOLECFIT_LDFLAGS = @MOLECFIT_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -242,6 +248,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGCONFIG = @PKGCONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@