[cpl-plugin-kmos] 01/03: New upstream version 1.2.8
Ole Streicher
olebole-guest at moszumanska.debian.org
Mon Jan 13 11:03:11 UTC 2014
This is an automated email from the git hooks/post-receive script.
olebole-guest pushed a commit to branch debian
in repository cpl-plugin-kmos.
commit e77008d08afaabd5a7c7f52a6c01636f245bdd1b
Author: Ole Streicher <debian at liska.ath.cx>
Date: Mon Jan 13 11:45:05 2014 +0100
New upstream version 1.2.8
---
ChangeLog | 119 +-
Makefile.am | 6 +-
Makefile.in | 7 +-
acinclude.m4 | 16 +-
calib/gasgano/config/KMOS.prefs | 2 +-
configure | 62 +-
configure.ac | 17 +-
irplib/Makefile.in | 1 +
irplib/irplib_distortion.c | 14 -
irplib/irplib_framelist.c | 16 +-
irplib/irplib_plugin.c | 6 +-
irplib/irplib_polynomial.c | 173 +-
irplib/irplib_polynomial.h | 26 -
irplib/irplib_strehl.c | 849 +++--
irplib/irplib_strehl.h | 57 +
irplib/tests/Makefile.am | 5 +
irplib/tests/Makefile.in | 22 +-
irplib/tests/irplib_framelist-test.c | 19 +
irplib/tests/irplib_polynomial-test.c | 6 +-
irplib/tests/irplib_strehl-test.c | 677 ++++
ChangeLog => kmclipm/ChangeLog | 119 +-
kmclipm/INSTALL | 229 ++
kmclipm/Makefile.am | 66 +
{kmos => kmclipm}/Makefile.in | 383 +--
kmclipm/README | 59 +
kmclipm/TODO | 0
kmclipm/include/kmclipm_rtd_image.h | 86 +
kmclipm/include/kmclipm_version.h | 44 +
kmclipm/src/kmclipm_functions.c | 8 +-
kmclipm/src/kmclipm_priv_constants.c | 1 -
kmclipm/src/kmclipm_priv_functions.c | 1 -
kmclipm/src/kmclipm_priv_reconstruct.c | 1 -
kmclipm/src/kmclipm_priv_splines.c | 48 +-
kmclipm/src/kmclipm_rtd_image.c | 1189 +++++++
kmclipm/src/kmclipm_vector.c | 1 -
kmclipm/src/kmclipm_version.c | 116 +
kmclipm/test/Makefile.am | 102 +
{irplib/tests => kmclipm/test}/Makefile.in | 271 +-
kmclipm/test/README | 94 +
kmclipm/test/kmclipm_test_functions.c | 3620 ++++++++++++++++++++
kmclipm/test/kmclipm_test_math.c | 220 ++
kmclipm/test/kmclipm_test_priv_constants.c | 191 ++
kmclipm/test/kmclipm_test_priv_functions.c | 1114 ++++++
kmclipm/test/kmclipm_test_priv_reconstruct.c | 553 +++
kmclipm/test/kmclipm_test_priv_splines.c | 266 ++
kmclipm/test/kmclipm_test_rtd.c | 2660 ++++++++++++++
kmclipm/test/kmclipm_test_vector.c | 1738 ++++++++++
kmclipm/test/ref/kmclipm_test_functions.ref | 2 +
kmclipm/test/ref/kmclipm_test_math.ref | 2 +
kmclipm/test/ref/kmclipm_test_priv_constants.ref | 2 +
.../ref/kmclipm_test_priv_find_neighbors_five.ref | 308 ++
.../ref/kmclipm_test_priv_find_neighbors_four.ref | 268 ++
.../ref/kmclipm_test_priv_find_neighbors_one.ref | 308 ++
.../ref/kmclipm_test_priv_find_neighbors_six.ref | 296 ++
.../ref/kmclipm_test_priv_find_neighbors_three.ref | 308 ++
.../ref/kmclipm_test_priv_find_neighbors_two.ref | 308 ++
kmclipm/test/ref/kmclipm_test_priv_functions.ref | 2 +
kmclipm/test/ref/kmclipm_test_priv_reconstruct.ref | 8 +
kmclipm/test/ref/kmclipm_test_priv_splines.ref | 2 +
.../ref/kmclipm_test_rotate_BCS_ESTIMATED_004.ref | 6 +
.../ref/kmclipm_test_rotate_BCS_ESTIMATED_040.ref | 6 +
.../ref/kmclipm_test_rotate_BCS_ESTIMATED_045.ref | 6 +
.../ref/kmclipm_test_rotate_BCS_ESTIMATED_090.ref | 6 +
.../ref/kmclipm_test_rotate_BCS_ESTIMATED_180.ref | 6 +
.../ref/kmclipm_test_rotate_BCS_ESTIMATED_270.ref | 6 +
.../ref/kmclipm_test_rotate_BCS_ESTIMATED_356.ref | 6 +
.../test/ref/kmclipm_test_rotate_BCS_NANS_004.ref | 6 +
.../test/ref/kmclipm_test_rotate_BCS_NANS_040.ref | 6 +
.../test/ref/kmclipm_test_rotate_BCS_NANS_045.ref | 6 +
.../test/ref/kmclipm_test_rotate_BCS_NANS_090.ref | 6 +
.../test/ref/kmclipm_test_rotate_BCS_NANS_180.ref | 6 +
.../test/ref/kmclipm_test_rotate_BCS_NANS_270.ref | 6 +
.../test/ref/kmclipm_test_rotate_BCS_NANS_356.ref | 6 +
.../ref/kmclipm_test_rotate_BCS_NATURAL_004.ref | 6 +
.../ref/kmclipm_test_rotate_BCS_NATURAL_040.ref | 6 +
.../ref/kmclipm_test_rotate_BCS_NATURAL_045.ref | 6 +
.../ref/kmclipm_test_rotate_BCS_NATURAL_090.ref | 6 +
.../ref/kmclipm_test_rotate_BCS_NATURAL_180.ref | 6 +
.../ref/kmclipm_test_rotate_BCS_NATURAL_270.ref | 6 +
.../ref/kmclipm_test_rotate_BCS_NATURAL_356.ref | 6 +
kmclipm/test/ref/kmclipm_test_rotate_NN_004.ref | 6 +
kmclipm/test/ref/kmclipm_test_rotate_NN_040.ref | 6 +
kmclipm/test/ref/kmclipm_test_rotate_NN_045.ref | 6 +
kmclipm/test/ref/kmclipm_test_rotate_NN_090.ref | 6 +
kmclipm/test/ref/kmclipm_test_rotate_NN_180.ref | 6 +
kmclipm/test/ref/kmclipm_test_rotate_NN_270.ref | 6 +
kmclipm/test/ref/kmclipm_test_rotate_NN_356.ref | 6 +
.../test/ref/kmclipm_test_rotate_NN_RESIZE_004.ref | 6 +
.../test/ref/kmclipm_test_rotate_NN_RESIZE_040.ref | 6 +
.../test/ref/kmclipm_test_rotate_NN_RESIZE_045.ref | 6 +
.../test/ref/kmclipm_test_rotate_NN_RESIZE_090.ref | 6 +
.../test/ref/kmclipm_test_rotate_NN_RESIZE_180.ref | 6 +
.../test/ref/kmclipm_test_rotate_NN_RESIZE_270.ref | 6 +
.../test/ref/kmclipm_test_rotate_NN_RESIZE_356.ref | 6 +
...mclipm_test_rotate_RESIZE_BCS_ESTIMATED_004.ref | 6 +
...mclipm_test_rotate_RESIZE_BCS_ESTIMATED_040.ref | 6 +
...mclipm_test_rotate_RESIZE_BCS_ESTIMATED_045.ref | 6 +
...mclipm_test_rotate_RESIZE_BCS_ESTIMATED_090.ref | 6 +
...mclipm_test_rotate_RESIZE_BCS_ESTIMATED_180.ref | 6 +
...mclipm_test_rotate_RESIZE_BCS_ESTIMATED_270.ref | 6 +
...mclipm_test_rotate_RESIZE_BCS_ESTIMATED_356.ref | 6 +
.../kmclipm_test_rotate_RESIZE_BCS_NATURAL_004.ref | 6 +
.../kmclipm_test_rotate_RESIZE_BCS_NATURAL_040.ref | 6 +
.../kmclipm_test_rotate_RESIZE_BCS_NATURAL_045.ref | 6 +
.../kmclipm_test_rotate_RESIZE_BCS_NATURAL_090.ref | 6 +
.../kmclipm_test_rotate_RESIZE_BCS_NATURAL_180.ref | 6 +
.../kmclipm_test_rotate_RESIZE_BCS_NATURAL_270.ref | 6 +
.../kmclipm_test_rotate_RESIZE_BCS_NATURAL_356.ref | 6 +
.../ref/kmclipm_test_rotate_RESIZE_NANS_004.ref | 6 +
.../ref/kmclipm_test_rotate_RESIZE_NANS_040.ref | 6 +
.../ref/kmclipm_test_rotate_RESIZE_NANS_045.ref | 6 +
.../ref/kmclipm_test_rotate_RESIZE_NANS_090.ref | 6 +
.../ref/kmclipm_test_rotate_RESIZE_NANS_180.ref | 6 +
.../ref/kmclipm_test_rotate_RESIZE_NANS_270.ref | 6 +
.../ref/kmclipm_test_rotate_RESIZE_NANS_356.ref | 6 +
.../kmclipm_test_rotate_animation_NONE_NANS_NN.ref | 121 +
...mclipm_test_rotate_animation_RESIZE_NANS_NN.ref | 121 +
kmclipm/test/ref/kmclipm_test_rtd.ref | 17 +
.../ref/kmclipm_test_shift_BCS_CLIPPING+0.8.ref | 6 +
.../ref/kmclipm_test_shift_BCS_CLIPPING+08.ref | 6 +
.../ref/kmclipm_test_shift_BCS_CLIPPING+1.0.ref | 6 +
.../ref/kmclipm_test_shift_BCS_CLIPPING-0.8.ref | 6 +
.../ref/kmclipm_test_shift_BCS_CLIPPING-08.ref | 6 +
.../ref/kmclipm_test_shift_BCS_CLIPPING-1.0.ref | 6 +
.../ref/kmclipm_test_shift_BCS_ESTIMATED+0.8.ref | 6 +
.../ref/kmclipm_test_shift_BCS_ESTIMATED+08.ref | 6 +
.../ref/kmclipm_test_shift_BCS_ESTIMATED-0.8.ref | 6 +
.../ref/kmclipm_test_shift_BCS_ESTIMATED-08.ref | 6 +
.../test/ref/kmclipm_test_shift_BCS_NANS+0.8.ref | 6 +
.../test/ref/kmclipm_test_shift_BCS_NANS+08.ref | 6 +
.../test/ref/kmclipm_test_shift_BCS_NANS+1.0.ref | 6 +
.../test/ref/kmclipm_test_shift_BCS_NANS-0.8.ref | 6 +
.../test/ref/kmclipm_test_shift_BCS_NANS-08.ref | 6 +
.../test/ref/kmclipm_test_shift_BCS_NANS-1.0.ref | 6 +
.../ref/kmclipm_test_shift_BCS_NATURAL+0.8.ref | 6 +
.../test/ref/kmclipm_test_shift_BCS_NATURAL+08.ref | 6 +
.../ref/kmclipm_test_shift_BCS_NATURAL-0.8.ref | 6 +
.../test/ref/kmclipm_test_shift_BCS_NATURAL-08.ref | 6 +
.../ref/kmclipm_test_shift_NN_CLIPPING+0.8.ref | 6 +
.../test/ref/kmclipm_test_shift_NN_CLIPPING+08.ref | 6 +
.../ref/kmclipm_test_shift_NN_CLIPPING-0.8.ref | 6 +
.../test/ref/kmclipm_test_shift_NN_CLIPPING-08.ref | 6 +
.../test/ref/kmclipm_test_shift_NN_NANS+0.8.ref | 6 +
kmclipm/test/ref/kmclipm_test_shift_NN_NANS+08.ref | 6 +
.../test/ref/kmclipm_test_shift_NN_NANS-0.8.ref | 6 +
kmclipm/test/ref/kmclipm_test_shift_NN_NANS-08.ref | 6 +
kmclipm/test/ref/kmclipm_test_vector.ref | 2 +
kmclipm/test/ref/parameter_config.txt | 5 +
kmos/Makefile.am | 157 +-
kmos/Makefile.in | 158 +-
kmos/kmo_debug.h | 1 +
kmos/kmo_dfs.c | 9 +-
kmos/kmo_dfs.h | 8 +-
kmos/kmo_functions.c | 730 +++-
kmos/kmo_functions.h | 68 +-
kmos/kmo_priv_combine.c | 159 +-
kmos/kmo_priv_combine.h | 5 +-
kmos/kmo_priv_dark.c | 1 +
kmos/kmo_priv_extract_spec.c | 1 +
kmos/kmo_priv_fit_profile.c | 5 +-
kmos/kmo_priv_fit_profile.h | 1 +
kmos/kmo_priv_fits_check.c | 1 +
kmos/kmo_priv_fits_stack.c | 2 +
kmos/kmo_priv_flat.c | 155 +-
kmos/kmo_priv_flat.h | 8 +-
kmos/kmo_priv_functions.h | 1 +
kmos/kmo_priv_lcorr.c | 7 +-
kmos/kmo_priv_lcorr.h | 2 +-
kmos/kmo_priv_multi_reconstruct.c | 4 +-
kmos/kmo_priv_reconstruct.c | 1 +
kmos/kmo_priv_reconstruct.h | 1 +
kmos/kmo_priv_rotate.h | 1 +
kmos/kmo_priv_shift.c | 2 +
kmos/kmo_priv_sky_tweak.c | 70 +-
kmos/kmo_priv_stats.c | 1 +
kmos/kmo_priv_stats.h | 1 +
kmos/kmo_priv_std_star.c | 145 +-
kmos/kmo_priv_std_star.h | 17 +
kmos/kmo_priv_wave_cal.c | 5 +-
kmos/kmo_test_create_data.h | 288 --
kmos/kmo_utils.c | 6 +-
kmos/tests/Makefile.am | 72 +-
kmos/tests/Makefile.in | 357 +-
kmos/tests/create_data_kmos.c | 247 ++
kmos/tests/kmo_cpl_extensions-test.c | 8 +-
kmos/tests/kmo_debug-test.c | 9 +-
kmos/tests/kmo_dfs-test.c | 71 +-
kmos/tests/kmo_functions-test.c | 5 +-
kmos/tests/kmo_priv_arithmetic-test.c | 9 +-
kmos/tests/kmo_priv_combine-test.c | 18 +-
kmos/tests/kmo_priv_copy-test.c | 8 +-
kmos/tests/kmo_priv_dark-test.c | 4 +-
kmos/tests/kmo_priv_extract_spec-test.c | 5 +-
kmos/tests/kmo_priv_fit_profile-test.c | 1 -
kmos/tests/kmo_priv_fits_check-test.c | 10 +-
kmos/tests/kmo_priv_fits_stack-test.c | 17 +-
kmos/tests/kmo_priv_flat-test.c | 232 +-
kmos/tests/kmo_priv_functions-test.c | 54 +-
kmos/tests/kmo_priv_lcorr-test.c | 32 +-
kmos/tests/kmo_priv_make_image-test.c | 11 +-
kmos/tests/kmo_priv_noise_map-test.c | 9 +-
kmos/tests/kmo_priv_reconstruct-test.c | 10 +-
kmos/tests/kmo_priv_rotate-test.c | 4 +-
kmos/tests/kmo_priv_shift-test.c | 4 +-
kmos/tests/kmo_priv_sky_mask-test.c | 5 +-
kmos/tests/kmo_priv_sky_tweak-test.c | 31 +-
kmos/tests/kmo_priv_stats-test.c | 4 +-
kmos/tests/kmo_priv_std_star-test.c | 32 +-
kmos/tests/kmo_priv_wave_cal-test.c | 5 +-
kmos/tests/kmo_utils-test.c | 15 +-
recipes/Makefile.am | 3 +-
recipes/Makefile.in | 4 +-
recipes/kmo_combine.c | 116 +-
recipes/kmo_copy.c | 1 +
recipes/kmo_dev_setup.c | 1 +
recipes/kmo_flat.c | 1 +
recipes/kmo_illumination.c | 3 +-
recipes/kmo_illumination_flat.c | 3 +-
recipes/kmo_multi_reconstruct.c | 73 +-
recipes/kmo_reconstruct.c | 2 +
recipes/kmo_sci_red.c | 493 ++-
recipes/kmo_sky_tweak.c | 5 -
recipes/kmo_std_star.c | 640 +++-
recipes/tests/Makefile.am | 71 +-
recipes/tests/Makefile.in | 412 +--
.../tests/create_data_recipes.c | 335 +-
recipes/tests/kmo_arithmetic-test.c | 32 +-
recipes/tests/kmo_combine-test.c | 35 +-
recipes/tests/kmo_copy-test.c | 32 +-
recipes/tests/kmo_dark-test.c | 32 +-
recipes/tests/kmo_dev_setup-test.c | 32 +-
recipes/tests/kmo_extract_spec-test.c | 32 +-
.../tests/{leak_check-test.c => kmo_final-test.c} | 7 +-
recipes/tests/{leak_check.sh => kmo_final_test.sh} | 0
recipes/tests/kmo_fit_profile-test.c | 45 +-
recipes/tests/kmo_fits_check-test.c | 29 +-
recipes/tests/kmo_fits_stack-test.c | 37 +-
recipes/tests/kmo_fits_strip-test.c | 26 +-
recipes/tests/kmo_flat-test.c | 33 +-
recipes/tests/kmo_illumination-test.c | 38 +-
recipes/tests/kmo_illumination_flat-test.c | 40 +-
recipes/tests/kmo_init-test.c | 39 +
recipes/tests/kmo_make_image-test.c | 34 +-
recipes/tests/kmo_multi_reconstruct-test.c | 39 +-
recipes/tests/kmo_noise_map-test.c | 32 +-
recipes/tests/kmo_reconstruct-test.c | 37 +-
recipes/tests/kmo_rotate-test.c | 36 +-
recipes/tests/kmo_sci_red-test.c | 39 +-
recipes/tests/kmo_shift-test.c | 36 +-
recipes/tests/kmo_sky_mask-test.c | 32 +-
recipes/tests/kmo_stats-test.c | 32 +-
recipes/tests/kmo_std_star-test.c | 49 +-
recipes/tests/kmo_wave_cal-test.c | 43 +-
reflex/Makefile.in | 1 +
reflex/kmos.xml.in | 97 +-
regtests/Makefile.in | 1 +
regtests/tests/Makefile.in | 1 +
tools/easySPARK/Makefile | 50 +-
tools/easySPARK/Makefile.am | 1 +
tools/easySPARK/Makefile.in | 2 +
tools/easySPARK/easySPARK_calibration.sh | 2 +-
tools/easySPARK/easySPARK_dark.sh | 2 +-
tools/easySPARK/easySPARK_flat.sh | 2 +-
tools/easySPARK/easySPARK_illumination.sh | 2 +-
...umination.sh => easySPARK_illumination_flat.sh} | 65 +-
tools/easySPARK/easySPARK_multi_reconstruct.sh | 2 +-
tools/easySPARK/easySPARK_reconstruct.sh | 2 +-
tools/easySPARK/easySPARK_sci_red.sh | 2 +-
tools/easySPARK/easySPARK_std_star.sh | 2 +-
tools/easySPARK/easySPARK_test.sh | 2 +-
tools/easySPARK/easySPARK_wave_cal.sh | 2 +-
271 files changed, 21311 insertions(+), 3162 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 014608c..83c723d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,120 @@
------------------------------------------------------------------
Releases
------------------------------------------------------------------
-v1.2.5 2013.10.14 - Several bug fixes, new kmo_multi_reconstruct, easySPARK_calibration.sh
-v1.2.4 2013.08.07 - Bug fix for installation on MacOSX
-v1.2.3 2013.08.02 - Bug fixes for SV1 data
-v1.2.2 2013.06.29 - Bug fixes in reconstruction and kmo_std_star
-v1.2.1 2013.06.20 - Bug fix in kmo_multi_reconstruct: Multiple angles in calibration frames were ignored
+v1.2.8 2013.12.12 - kmo_sci_red
+ - Adding the option to apply a fixed velocity offset when reconstructing cubes.
+ - Adding parameter --save_interims which can be used only together with
+ --no_sky_tweak. Interim reconstructed object and sky cubes are saved to disk as well.
+ - Adding the possibility to subtract skies from objects from different IFUs
+ (using the generated obj_sky_table.txt)
+ - kmo_std_star
+ - Bug fix: reducing templates with the 3-star configuration produced a
+ segmentation fault
+ - kmo_wave_cal
+ - Bug fix: in rare cases an error occurred calculating the QC parameters
+ (singular matrix)
+v1.2.7 2013.11.19 - kmo_combine, kmo_sci_red
+ - New additional output frame EXP_MASK: For every combined output
+ frame there is now as well an exposure time mask which indicates
+ for every spatial pixel how many input frames were taken into account
+ for combining.
+ - kmo_sci_red
+ - Bug fix: "checkerboard pattern" effect: rarely it could happen, that
+ single spaxels at the border of an IFU were spectral misfitted (only
+ with --imethod=CS). This effect normally to be overlooked, has a strong
+ effect when these cobes are combined after reconstruction. Then some kind
+ of checkerboard pattern could emerge in the corners of arbitrary IFUs.
+ - kmo_sci_red, kmo_multi_reconstruct
+ - The object-sky-association table is stored to disk as an intermediate
+ text file. It can be edited to alter the associated skies and then read
+ into the recipe again to apply it.
+ - kmo_combine
+ - Bug fix: when --ifus parameter wasn't defined and if the first IFU wasn't
+ used the recipe would create a segmentation fault
+ - Bug fix: when working with the --ifus parameter, the EXTNAME keyword could
+ get too long and the extension descriptor DATA/NOISE could be cut off. The
+ keyword is now truncated and DATA or NOISE is appended in every case. The
+ same naming convention applies to the craeted filenames (except that
+ DATA/NOISE isn't added).
+ - kmo_std_star
+ - The signal level of the extracted spectrum (in the masked area) is scaled to
+ the same level as the spectrum of the whole IFU (which is used for zeropoint
+ and throughput calculations). The user can now do his own calculations on
+ zeropoint, extracted spectrum etc., since they match now.
+ - New product: NOISE_SPEC (Only generated for data taken with template
+ KMOS_spec_cal_stdstarscipatt) The noise is estimated based on the sky exposures
+ present in all exposures: Skies are subtracted pairwise and reconstructed for
+ every IFU over all exposures. Then the spectra are extracted and for every
+ wavelength point the stddev is calculated and saved
+v1.2.6 2013.10.30 - kmo_illumination_flat
+ - New recipe creating an illumination correction based on FLAT_ON frames.
+ - kmo_reconstruct
+ - Bug fix: wrong calibration angles have been displayed, but the right ones
+ were processed (probably introduced with v1.2.5)
+v1.2.5 2013.10.14 - kmo_flat
+ - Bug fix: Enhanced edge detection taking into account deactivated IFUs which
+ are illuminated quite strongly.
+ - kmo_multi_reconstruct
+ - Accepts now like kmo_sci_red MASTER_FLAT and OH_SPEC frames, does proper sky
+ subtraction and optionally flux/background calibration. Telluric correction is
+ possible if the objects are on the same IFU for all exposures. Maps can't be reduced.
+ - kmo_sci_red
+ - Bug fix: Object names containing [ or ] couldn't be processed.
+ - sky_tweak
+ - Bug fix: With continuum missing on one side of the spectrum the code failed.
+ - easySPARK_calibration.sh
+ - The user is not asked anymore if the data should be processed in parallel/serial.
+ This option can be set via a parameter.
+ - After completion of processing a set of tests is executed to ensure integrity of
+ calibration products (easySPARK_test.sh)
+ - Added version numbers to easySPARK-scripts
+v1.2.4 2013.08.07 - kmo_wave_cal
+ - Bug fix: Sometimes DET_IMG_WAVE product wasn't calculated.
+ - SPARK-kit installation
+ - Bug fix: On MacOSX compilation of the kit failed.
+v1.2.3 2013.08.02 - kmo_sky_tweak
+ - New, advanced recipe for OH-line subtraction
+ - kmo_sci_red
+ - Bug fix: When using reflex it happend that only the IFUs containing the std-stars
+ were processed (in v1.2.2 this can be fixed by omitting STD_IMAGE from sof)
+ - Bug fix: TELLURIC frames generated with data from the 3star-template couldn't be
+ processed if the std-stars weren't at the default IFUs
+ - Enhanced handling of telluric corrections in general
+ - kmo_flat
+ - Fix: Due to the corrupted IFU 16, it occured in some FLAT_ON frames that IFU 15 was
+ vignetted strongly and not all edges could be identified. This is detected now and
+ IFU 15 will be omitted.
+ - kmo_illumination
+ - Bug fix: When data contains IFUs marked as NOTUSED and FLAT_EDGE frame is provided,
+ the recipe just fails without any notice. Without FLAT_EDGE frame the recipe runs through
+ - kmo_fits_strip
+ - Bug fix: Parameters noise and empty failed on sci_combine-products
+ - Added extension-parameter: Provide absolute extension numbers to strip all other extensions
+ - kmo_fits_check
+ - Now prints as well the number of empty extensions
+ - kmo_reconstruct, kmo_sci_red, kmo_std_star, kmo_illumination
+ - Increased verbosity on picked calibration frames. Emitting warnings when angles differ
+ too much
+ - xcal_interpolation is switched off automatically when interval of neighbouring angles is
+ larger than 65deg (for 6 equidistant rotator angles it would be 60deg)
+ - easySPARK-scripts
+ - Fixed bug: Now the frames needn't anymore be organised in directories with names like
+ YYYY-MM-DD
+ - Fixed bug: Now the scripts work as well on MacOSX
+v1.2.2 2013.06.29 - reconstruction
+ - Bug fix: the implementation of xcal_interpolation accidentially marked internally some
+ areas in the calibration frames as bad. Since these areas had a width of 1 pixel, they
+ were just interpolated from the neighbourhood. Now the values are a little bit more
+ correct.
+ - Bug fix: the implementation of cubic spline (CS) interpolation in the reconstruction of
+ data cubes led from time to time to misfitted spectra, mostly at the borders of the IFUs.
+ Pronounced spectral bell-curves were the result.
+ - kmo_std_star
+ - Bug fix: Due to the NGC using a wrong data type for CRPIX, CRVAL and CD keywords (integer
+ instead of double) in the RAW frames, no standard stars could be processed.
+v1.2.1 2013.06.20 - Bug fix in kmo_multi_reconstruct
+ - The new calibration format containing multiple angles was ignored processed wrongly. For
+ the calibration frames always the first angle present has been used in the past.
v1.2.0 2013.06.19 - (release for science verification)
- Reference Manual
- Updated version.
diff --git a/Makefile.am b/Makefile.am
index b283ea6..c3d41e5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,7 +17,7 @@
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-AUTOMAKE_OPTIONS = 1.8 foreign
+AUTOMAKE_OPTIONS = 1.8 foreign
ACLOCAL_AMFLAGS = -I m4macros
@@ -26,7 +26,7 @@ DISTCLEANFILES = *~
COMPILE_FIRST =
-TOPSUBDIRS = tools/easySPARK irplib kmos recipes regtests reflex
+TOPSUBDIRS = tools/easySPARK irplib kmclipm kmos recipes regtests reflex
COMPILE_LAST =
@@ -36,7 +36,7 @@ DOXYGEN_SUBDIRS =
SUBDIRS = $(COMPILE_FIRST) $(TOPSUBDIRS) $(COMPILE_LAST)
EXTRA_DIST = catalogs tools m4macros/eso.m4 m4macros/cpl.m4 admin/doxygen.am \
- doxygen/Doxyfile.in setup recipes/tests/leak_check.sh
+ doxygen/Doxyfile.in setup recipes/tests/kmo_final_test.sh
pipedocs_DATA = ChangeLog AUTHORS NEWS README TODO
diff --git a/Makefile.in b/Makefile.in
index 0106c06..3db968d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -201,6 +201,7 @@ LIBCPLDFS = @LIBCPLDFS@
LIBCPLDRS = @LIBCPLDRS@
LIBCPLUI = @LIBCPLUI@
LIBIRPLIB = @LIBIRPLIB@
+LIBKMCLIPMLIB = @LIBKMCLIPMLIB@
LIBKMOS = @LIBKMOS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@@ -302,16 +303,16 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
wkfcopydir = @wkfcopydir@
wkfextradir = @wkfextradir@
-AUTOMAKE_OPTIONS = 1.8 foreign
+AUTOMAKE_OPTIONS = 1.8 foreign
ACLOCAL_AMFLAGS = -I m4macros
DISTCLEANFILES = *~
COMPILE_FIRST =
-TOPSUBDIRS = tools/easySPARK irplib kmos recipes regtests reflex
+TOPSUBDIRS = tools/easySPARK irplib kmclipm kmos recipes regtests reflex
COMPILE_LAST =
DOXYGEN_SUBDIRS =
SUBDIRS = $(COMPILE_FIRST) $(TOPSUBDIRS) $(COMPILE_LAST)
EXTRA_DIST = catalogs tools m4macros/eso.m4 m4macros/cpl.m4 admin/doxygen.am \
- doxygen/Doxyfile.in setup recipes/tests/leak_check.sh
+ doxygen/Doxyfile.in setup recipes/tests/kmo_final_test.sh
pipedocs_DATA = ChangeLog AUTHORS NEWS README TODO
@MAINTAINER_MODE_TRUE at MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.h.in configure stamp-h.in
diff --git a/acinclude.m4 b/acinclude.m4
index 0259235..276da17 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -143,16 +143,17 @@ AC_DEFUN([KMOS_CREATE_SYMBOLS],
# Symbols for package include file and library search paths
- KMOS_INCLUDES='-I$(top_srcdir)/kmos -I$(top_srcdir)/irplib -I$(top_srcdir)/kmclipm'
- KMOS_LDFLAGS='-L$(top_builddir)/kmos'
+ KMOS_INCLUDES='-I$(top_srcdir)/kmos -I$(top_srcdir)/irplib -I$(top_srcdir)/kmclipm/include'
+ KMOS_LDFLAGS='-L$(top_srcdir)/kmos'
- all_includes='$(KMOS_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES) $(XXCLIPM_INCLUDES)'
- all_ldflags='$(KMOS_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS) $(XXCLIPM_LDFLAGS)'
+ all_includes='$(KMOS_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES)'
+ all_ldflags='$(KMOS_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS)'
# Library aliases
- LIBKMOS='$(top_srcdir)/kmos/libkmos.la'
+ LIBKMOS='$(top_builddir)/kmos/libkmos.la'
LIBIRPLIB='$(top_builddir)/irplib/libirplib.la'
+ LIBKMCLIPMLIB='$(top_builddir)/kmclipm/libkmclipmlib.la'
# Substitute the defined symbols
@@ -161,13 +162,14 @@ AC_DEFUN([KMOS_CREATE_SYMBOLS],
AC_SUBST(LIBKMOS)
AC_SUBST(LIBIRPLIB)
+ AC_SUBST(LIBKMCLIPMLIB)
# Check for CPL and user defined libraries
AC_REQUIRE([CPL_CHECK_LIBS])
AC_REQUIRE([ESO_CHECK_EXTRA_LIBS])
- all_includes='$(KMOS_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES) $(XXCLIPM_INCLUDES)'
- all_ldflags='$(KMOS_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS) $(XXCLIPM_LDFLAGS)'
+ all_includes='$(KMOS_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES)'
+ all_ldflags='$(KMOS_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS)'
AC_SUBST(all_includes)
AC_SUBST(all_ldflags)
diff --git a/calib/gasgano/config/KMOS.prefs b/calib/gasgano/config/KMOS.prefs
index 0047fa7..1022f5a 100644
--- a/calib/gasgano/config/KMOS.prefs
+++ b/calib/gasgano/config/KMOS.prefs
@@ -41,7 +41,7 @@ PRINTER_NAME=lp
PRINT_FONT=Monospaced:16
PRINT_ORIENTATION=P
RADEC_CONVERSION=true
-RECIPE_SET=kmo_arithmetic=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.6/kmo_arithmetic.so;kmo_combine=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.6/kmo_combine.so;kmo_copy=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.6/kmo_copy.so;kmo_dark=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.6/kmo_dark.so;kmo_extract_spec=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.6/kmo_extract_spec.so;kmo_fit_profile=/home/quality/pipelin [...]
+RECIPE_SET=kmo_arithmetic=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.8/kmo_arithmetic.so;kmo_combine=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.8/kmo_combine.so;kmo_copy=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.8/kmo_copy.so;kmo_dark=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.8/kmo_dark.so;kmo_extract_spec=/home/quality/pipelines/kmos/lib/esopipes-plugins/kmos-1.2.8/kmo_extract_spec.so;kmo_fit_profile=/home/quality/pipelin [...]
SCRIPTS_DIR=gasgano/scripts
SHORTEN_FILES_PATH=true
SHORT_FILENAME=true
diff --git a/configure b/configure
index bab39f7..ba3c7b4 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for KMOS Instrument Pipeline 1.2.6.
+# Generated by GNU Autoconf 2.68 for KMOS Instrument Pipeline 1.2.8.
#
# Report bugs to <kmos-spark at mpe.mpg.de>.
#
@@ -570,8 +570,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='KMOS Instrument Pipeline'
PACKAGE_TARNAME='kmos'
-PACKAGE_VERSION='1.2.6'
-PACKAGE_STRING='KMOS Instrument Pipeline 1.2.6'
+PACKAGE_VERSION='1.2.8'
+PACKAGE_STRING='KMOS Instrument Pipeline 1.2.8'
PACKAGE_BUGREPORT='kmos-spark at mpe.mpg.de'
PACKAGE_URL=''
@@ -619,6 +619,7 @@ LTLIBOBJS
LIBOBJS
all_ldflags
all_includes
+LIBKMCLIPMLIB
LIBIRPLIB
LIBKMOS
KMOS_LDFLAGS
@@ -1351,7 +1352,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures KMOS Instrument Pipeline 1.2.6 to adapt to many kinds of systems.
+\`configure' configures KMOS Instrument Pipeline 1.2.8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1422,7 +1423,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of KMOS Instrument Pipeline 1.2.6:";;
+ short | recursive ) echo "Configuration of KMOS Instrument Pipeline 1.2.8:";;
esac
cat <<\_ACEOF
@@ -1434,7 +1435,7 @@ Optional Features:
(and sometimes confusing) to the casual installer
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
- --enable-debug creates debugging code [[default=yes]]
+ --enable-debug creates debugging code [[default=no]]
--enable-strict compiles with strict compiler options (may not
work!) [[default=no]]
--enable-static[=PKGS] build static libraries [default=no]
@@ -1543,7 +1544,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-KMOS Instrument Pipeline configure 1.2.6
+KMOS Instrument Pipeline configure 1.2.8
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1958,7 +1959,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by KMOS Instrument Pipeline $as_me 1.2.6, which was
+It was created by KMOS Instrument Pipeline $as_me 1.2.8, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2888,7 +2889,7 @@ fi
# Define the identity of the package.
PACKAGE='kmos'
- VERSION='1.2.6'
+ VERSION='1.2.8'
cat >>confdefs.h <<_ACEOF
@@ -4346,7 +4347,7 @@ fi
if test "${enable_debug+set}" = set; then :
enableval=$enable_debug; eso_enable_debug=$enableval
else
- eso_enable_debug=yes
+ eso_enable_debug=no
fi
@@ -12875,7 +12876,7 @@ fi
for i in $cpl_incdirs; do
for j in $cpl_check_cpl_header; do
- echo "configure: 12878: $i/$j" >&5
+ echo "configure: 12879: $i/$j" >&5
if test -r "$i/$j"; then
echo "taking that" >&5
@@ -12925,7 +12926,7 @@ fi
for i in $cpl_libdirs; do
for j in $cpl_check_cpl_lib; do
- echo "configure: 12928: $i/$j" >&5
+ echo "configure: 12929: $i/$j" >&5
if test -r "$i/$j"; then
echo "taking that" >&5
@@ -13060,7 +13061,7 @@ fi
for i in $cpl_cext_incdirs; do
for j in $cpl_cext_check_header; do
- echo "configure: 13063: $i/$j" >&5
+ echo "configure: 13064: $i/$j" >&5
if test -r "$i/$j"; then
echo "taking that" >&5
@@ -13116,7 +13117,7 @@ fi
for i in $cpl_cext_libdirs; do
for j in $cpl_cext_check_lib; do
- echo "configure: 13119: $i/$j" >&5
+ echo "configure: 13120: $i/$j" >&5
if test -r "$i/$j"; then
echo "taking that" >&5
@@ -13341,13 +13342,6 @@ $as_echo "$as_me: WARNING: CPL checks have been disabled! This package may not b
-# Check for kmclipm
-# - can be called multiple times
-# - replace the argument "xxclipm" by your library name,
-# e.g. with KMOS: XXCLIPM_CHECK_LIB(kmclipm)
-# Comment in if required!
-#AA XXCLIPM_CHECK_LIB(kmclipm)
-
# Check for purify
@@ -13561,16 +13555,17 @@ $as_echo "no" >&6; }
# Symbols for package include file and library search paths
- KMOS_INCLUDES='-I$(top_srcdir)/kmos -I$(top_srcdir)/irplib -I$(top_srcdir)/kmclipm'
- KMOS_LDFLAGS='-L$(top_builddir)/kmos'
+ KMOS_INCLUDES='-I$(top_srcdir)/kmos -I$(top_srcdir)/irplib -I$(top_srcdir)/kmclipm/include'
+ KMOS_LDFLAGS='-L$(top_srcdir)/kmos'
- all_includes='$(KMOS_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES) $(XXCLIPM_INCLUDES)'
- all_ldflags='$(KMOS_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS) $(XXCLIPM_LDFLAGS)'
+ all_includes='$(KMOS_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES)'
+ all_ldflags='$(KMOS_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS)'
# Library aliases
- LIBKMOS='$(top_srcdir)/kmos/libkmos.la'
+ LIBKMOS='$(top_builddir)/kmos/libkmos.la'
LIBIRPLIB='$(top_builddir)/irplib/libirplib.la'
+ LIBKMCLIPMLIB='$(top_builddir)/kmclipm/libkmclipmlib.la'
# Substitute the defined symbols
@@ -13580,12 +13575,13 @@ $as_echo "no" >&6; }
+
# Check for CPL and user defined libraries
- all_includes='$(KMOS_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES) $(XXCLIPM_INCLUDES)'
- all_ldflags='$(KMOS_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS) $(XXCLIPM_LDFLAGS)'
+ all_includes='$(KMOS_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES)'
+ all_ldflags='$(KMOS_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS)'
@@ -13615,7 +13611,7 @@ fi
-ac_config_files="$ac_config_files Makefile Makefile.purify doxygen/Doxyfile kmos/Makefile kmos/tests/Makefile kmos/tests/ref_data/Makefile tools/easySPARK/Makefile reflex/Makefile reflex/kmos.xml recipes/Makefile recipes/tests/Makefile recipes/tests/ref_data/Makefile regtests/Makefile regtests/tests/Makefile irplib/Makefile irplib/tests/Makefile"
+ac_config_files="$ac_config_files Makefile Makefile.purify doxygen/Doxyfile kmos/Makefile kmos/tests/Makefile tools/easySPARK/Makefile reflex/Makefile reflex/kmos.xml recipes/Makefile recipes/tests/Makefile regtests/Makefile regtests/tests/Makefile irplib/Makefile irplib/tests/Makefile kmclipm/Makefile kmclipm/test/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -14159,7 +14155,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by KMOS Instrument Pipeline $as_me 1.2.6, which was
+This file was extended by KMOS Instrument Pipeline $as_me 1.2.8, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14225,7 +14221,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-KMOS Instrument Pipeline config.status 1.2.6
+KMOS Instrument Pipeline config.status 1.2.8
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
@@ -14639,17 +14635,17 @@ do
"doxygen/Doxyfile") CONFIG_FILES="$CONFIG_FILES doxygen/Doxyfile" ;;
"kmos/Makefile") CONFIG_FILES="$CONFIG_FILES kmos/Makefile" ;;
"kmos/tests/Makefile") CONFIG_FILES="$CONFIG_FILES kmos/tests/Makefile" ;;
- "kmos/tests/ref_data/Makefile") CONFIG_FILES="$CONFIG_FILES kmos/tests/ref_data/Makefile" ;;
"tools/easySPARK/Makefile") CONFIG_FILES="$CONFIG_FILES tools/easySPARK/Makefile" ;;
"reflex/Makefile") CONFIG_FILES="$CONFIG_FILES reflex/Makefile" ;;
"reflex/kmos.xml") CONFIG_FILES="$CONFIG_FILES reflex/kmos.xml" ;;
"recipes/Makefile") CONFIG_FILES="$CONFIG_FILES recipes/Makefile" ;;
"recipes/tests/Makefile") CONFIG_FILES="$CONFIG_FILES recipes/tests/Makefile" ;;
- "recipes/tests/ref_data/Makefile") CONFIG_FILES="$CONFIG_FILES recipes/tests/ref_data/Makefile" ;;
"regtests/Makefile") CONFIG_FILES="$CONFIG_FILES regtests/Makefile" ;;
"regtests/tests/Makefile") CONFIG_FILES="$CONFIG_FILES regtests/tests/Makefile" ;;
"irplib/Makefile") CONFIG_FILES="$CONFIG_FILES irplib/Makefile" ;;
"irplib/tests/Makefile") CONFIG_FILES="$CONFIG_FILES irplib/tests/Makefile" ;;
+ "kmclipm/Makefile") CONFIG_FILES="$CONFIG_FILES kmclipm/Makefile" ;;
+ "kmclipm/test/Makefile") CONFIG_FILES="$CONFIG_FILES kmclipm/test/Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
diff --git a/configure.ac b/configure.ac
index b01e2ae..f629c1e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
-AC_INIT([KMOS Instrument Pipeline], [1.2.6], [kmos-spark at mpe.mpg.de],
+AC_INIT([KMOS Instrument Pipeline], [1.2.8], [kmos-spark at mpe.mpg.de],
[kmos])
AC_PREREQ([2.59])
@@ -39,7 +39,7 @@ AC_PROG_CPP
AM_PROG_CC_C_O
AC_PROG_LN_S
-ESO_ENABLE_DEBUG(yes)
+ESO_ENABLE_DEBUG(no)
ESO_ENABLE_STRICT(no)
ESO_PROG_CC_FLAG([fno-builtin], [CFLAGS="$CFLAGS -fno-builtin"])
@@ -71,13 +71,6 @@ ESO_FUNC_STRDUP
# Check for CPL presence and usability
CPL_CHECK_LIBS
-# Check for kmclipm
-# - can be called multiple times
-# - replace the argument "xxclipm" by your library name,
-# e.g. with KMOS: XXCLIPM_CHECK_LIB(kmclipm)
-# Comment in if required!
-#AA XXCLIPM_CHECK_LIB(kmclipm)
-
# Check for purify
CHECK_PURIFY
@@ -92,15 +85,15 @@ AC_CONFIG_FILES(Makefile
doxygen/Doxyfile
kmos/Makefile
kmos/tests/Makefile
- kmos/tests/ref_data/Makefile
tools/easySPARK/Makefile
reflex/Makefile
reflex/kmos.xml
recipes/Makefile
recipes/tests/Makefile
- recipes/tests/ref_data/Makefile
regtests/Makefile
regtests/tests/Makefile
irplib/Makefile
- irplib/tests/Makefile)
+ irplib/tests/Makefile
+ kmclipm/Makefile
+ kmclipm/test/Makefile)
AC_OUTPUT
diff --git a/irplib/Makefile.in b/irplib/Makefile.in
index 5257725..e513831 100644
--- a/irplib/Makefile.in
+++ b/irplib/Makefile.in
@@ -207,6 +207,7 @@ LIBCPLDFS = @LIBCPLDFS@
LIBCPLDRS = @LIBCPLDRS@
LIBCPLUI = @LIBCPLUI@
LIBIRPLIB = @LIBIRPLIB@
+LIBKMCLIPMLIB = @LIBKMCLIPMLIB@
LIBKMOS = @LIBKMOS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
diff --git a/irplib/irplib_distortion.c b/irplib/irplib_distortion.c
index 02a53dc..82b292d 100644
--- a/irplib/irplib_distortion.c
+++ b/irplib/irplib_distortion.c
@@ -33,20 +33,6 @@
Includes
-----------------------------------------------------------------------------*/
-/* TEMPORARY SUPPORT OF CPL 5.x */
-#include <cpl.h>
-
-#ifndef CPL_SIZE_FORMAT
-#define CPL_SIZE_FORMAT "d"
-#define cpl_size int
-#endif
-
-#if defined CPL_VERSION_CODE && CPL_VERSION_CODE <= CPL_VERSION(5, 92, 0)
-#define cpl_apertures_get_pos_x cpl_apertures_get_max_x
-#endif
-
-/* END TEMPORARY SUPPORT OF CPL 5.x */
-
#include "irplib_distortion.h"
#include "irplib_flat.h"
diff --git a/irplib/irplib_framelist.c b/irplib/irplib_framelist.c
index fb0c2b4..4025e98 100644
--- a/irplib/irplib_framelist.c
+++ b/irplib/irplib_framelist.c
@@ -1,5 +1,4 @@
-/* $Id: irplib_framelist.c,v 1.30 2013-02-27 16:05:13 jtaylor Exp $
- *
+/*
* This file is part of the irplib package
* Copyright (C) 2002,2003 European Southern Observatory
*
@@ -18,13 +17,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
*/
-/*
- * $Author: jtaylor $
- * $Date: 2013-02-27 16:05:13 $
- * $Revision: 1.30 $
- * $Name: not supported by cvs2svn $
- */
-
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -219,9 +211,9 @@ irplib_framelist * irplib_framelist_cast(const cpl_frameset * frameset)
/* The function cannot fail now */
self = irplib_framelist_new();
- for (i = 0, frame = cpl_frameset_get_first_const(frameset);
- frame != NULL;
- i++, frame = cpl_frameset_get_next_const(frameset)) {
+ for (i = 0; i < cpl_frameset_get_size(frameset); i++)
+ {
+ frame = cpl_frameset_get_position_const(frameset, i);
cpl_frame * copy = cpl_frame_duplicate(frame);
diff --git a/irplib/irplib_plugin.c b/irplib/irplib_plugin.c
index 17428b3..254dfee 100644
--- a/irplib/irplib_plugin.c
+++ b/irplib/irplib_plugin.c
@@ -765,7 +765,9 @@ static void recipe_sof_test_image_empty(cpl_plugin * plugin, size_t nstr,
for (i = 0; i < nstr; i++) {
cpl_frame * f = cpl_frame_new();
- char * rawname = cpl_sprintf("raw%05u.fits", (unsigned)(i+1));
+ char * rawname = cpl_sprintf("%s-raw%05u.fits",
+ cpl_plugin_get_name(plugin),
+ (unsigned)(i+1));
error = cpl_image_save(iempty, rawname,CPL_BPP_IEEE_FLOAT, NULL,
CPL_IO_DEFAULT);
@@ -851,7 +853,7 @@ cpl_boolean irplib_plugin_has_sof_from_env(const cpl_plugin * plugin,
frames = cpl_frameset_new();
recipe_frameset_load(frames, sof_name);
- ffirst = cpl_frameset_get_first_const(frames);
+ ffirst = cpl_frameset_get_position_const(frames, 0);
cpl_free(sof_name);
cpl_frameset_delete(frames);
diff --git a/irplib/irplib_polynomial.c b/irplib/irplib_polynomial.c
index 1bd1ace..ba0a663 100644
--- a/irplib/irplib_polynomial.c
+++ b/irplib/irplib_polynomial.c
@@ -112,174 +112,6 @@ static double irplib_polynomial_depress_1d(cpl_polynomial *);
Function codes
-----------------------------------------------------------------------------*/
-#if defined CPL_VERSION_CODE && CPL_VERSION_CODE > CPL_VERSION(5, 92, 0)
-#else
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Add two polynomials of the same dimension
- @param self The polynomial to hold the result
- @param first The 1st polynomial to add
- @param second The 2nd polynomial to add
- @return CPL_ERROR_NONE or the relevant CPL error code
- @note self may be passed also as first and/or second
-
- Possible CPL error code set in this function:
- - CPL_ERROR_NULL_INPUT if an input pointer is NULL
- - CPL_ERROR_INCOMPATIBLE_INPUT if the polynomials do not have identical
- dimensions
- - CPL_ERROR_UNSUPPORTED_MODE if the dimension is not 1 (FIXME)
- */
-/*----------------------------------------------------------------------------*/
-cpl_error_code irplib_polynomial_add(cpl_polynomial * self,
- const cpl_polynomial * first,
- const cpl_polynomial * second)
-{
- cpl_size degree0 = cpl_polynomial_get_degree(self);
- const cpl_size degree1 = cpl_polynomial_get_degree(first);
- const cpl_size degree2 = cpl_polynomial_get_degree(second);
- const cpl_size maxdeg = degree1 > degree2 ? degree1 : degree2;
-
-
- cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
- cpl_ensure_code(first != NULL, CPL_ERROR_NULL_INPUT);
- cpl_ensure_code(second != NULL, CPL_ERROR_NULL_INPUT);
-
- cpl_ensure_code(cpl_polynomial_get_dimension(self) ==
- cpl_polynomial_get_dimension(first),
- CPL_ERROR_INCOMPATIBLE_INPUT);
- cpl_ensure_code(cpl_polynomial_get_dimension(self) ==
- cpl_polynomial_get_dimension(second),
- CPL_ERROR_INCOMPATIBLE_INPUT);
-
- /* FIXME: */
- cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1,
- CPL_ERROR_UNSUPPORTED_MODE);
-
- if (degree0 < maxdeg) {
- degree0 = maxdeg;
- } else {
- /* Reset coefficients in self as needed */
- for (; degree0 > maxdeg; degree0--) {
- cpl_polynomial_set_coeff(self, °ree0, 0.0);
- }
- }
-
- /* assert( degree0 == maxdeg ); */
-
- for (; degree0 >= 0; degree0--) {
- const double val1 = cpl_polynomial_get_coeff(first, °ree0);
- const double val2 = cpl_polynomial_get_coeff(second, °ree0);
- cpl_polynomial_set_coeff(self, °ree0, val1 + val2);
- }
-
- return CPL_ERROR_NONE;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Subtract two polynomials of the same dimension
- @param self The polynomial to hold the result
- @param first The polynomial to subtract from
- @param second The polynomial to subtract
- @return CPL_ERROR_NONE or the relevant CPL error code
- @note self may be passed also as first and/or second
-
- Possible CPL error code set in this function:
- - CPL_ERROR_NULL_INPUT if an input pointer is NULL
- - CPL_ERROR_INCOMPATIBLE_INPUT if the polynomials do not have identical
- dimensions
- - CPL_ERROR_UNSUPPORTED_MODE if the dimension is not 1 (FIXME)
- */
-/*----------------------------------------------------------------------------*/
-cpl_error_code irplib_polynomial_subtract(cpl_polynomial * self,
- const cpl_polynomial * first,
- const cpl_polynomial * second)
-{
- cpl_size degree0 = cpl_polynomial_get_degree(self);
- const cpl_size degree1 = cpl_polynomial_get_degree(first);
- const cpl_size degree2 = cpl_polynomial_get_degree(second);
- const cpl_size maxdeg = degree1 > degree2 ? degree1 : degree2;
-
-
- cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
- cpl_ensure_code(first != NULL, CPL_ERROR_NULL_INPUT);
- cpl_ensure_code(second != NULL, CPL_ERROR_NULL_INPUT);
-
- cpl_ensure_code(cpl_polynomial_get_dimension(self) ==
- cpl_polynomial_get_dimension(first),
- CPL_ERROR_INCOMPATIBLE_INPUT);
- cpl_ensure_code(cpl_polynomial_get_dimension(self) ==
- cpl_polynomial_get_dimension(second),
- CPL_ERROR_INCOMPATIBLE_INPUT);
-
- /* FIXME: */
- cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1,
- CPL_ERROR_UNSUPPORTED_MODE);
-
- if (degree0 < maxdeg) {
- degree0 = maxdeg;
- } else {
- /* Reset coefficients in self as needed */
- for (; degree0 > maxdeg; degree0--) {
- cpl_polynomial_set_coeff(self, °ree0, 0.0);
- }
- }
-
- /* assert( degree0 == maxdeg ); */
-
- for (; degree0 >= 0; degree0--) {
- const double val1 = cpl_polynomial_get_coeff(first, °ree0);
- const double val2 = cpl_polynomial_get_coeff(second, °ree0);
- cpl_polynomial_set_coeff(self, °ree0, val1 - val2);
- }
-
- return CPL_ERROR_NONE;
-}
-
-/*----------------------------------------------------------------------------*/
-/**
- @brief Multiply a polynomial with a scalar
- @param self The polynomial to hold the result
- @param other The polynomial to scale, may equal self
- @param factor The factor to multiply with
- @return CPL_ERROR_NONE or the relevant CPL error code
-
- Possible CPL error code set in this function:
- - CPL_ERROR_NULL_INPUT if an input pointer is NULL
- - CPL_ERROR_UNSUPPORTED_MODE if the dimension is not 1 (FIXME)
- */
-/*----------------------------------------------------------------------------*/
-cpl_error_code irplib_polynomial_multiply_scalar(cpl_polynomial * self,
- const cpl_polynomial * other,
- double factor)
-{
-
- const cpl_size maxdeg = cpl_polynomial_get_degree(other);
- const cpl_size zerodeg = cpl_polynomial_get_degree(self);
- cpl_size degree;
-
- cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
- cpl_ensure_code(other != NULL, CPL_ERROR_NULL_INPUT);
-
- cpl_ensure_code(cpl_polynomial_get_dimension(self) == 1,
- CPL_ERROR_UNSUPPORTED_MODE);
- cpl_ensure_code(cpl_polynomial_get_dimension(other) == 1,
- CPL_ERROR_UNSUPPORTED_MODE);
-
- for (degree = 0; degree <= maxdeg; degree++) {
- const double val = factor * cpl_polynomial_get_coeff(other, °ree);
- cpl_polynomial_set_coeff(self, °ree, val);
- }
-
- /* Reset coefficients in self as needed */
- for (; degree <= zerodeg; degree++) {
- cpl_polynomial_set_coeff(self, &zerodeg, 0.0);
- }
-
- return CPL_ERROR_NONE;
-}
-#endif
/*----------------------------------------------------------------------------*/
/**
@brief Compute all n roots of p(x) = 0, where p(x) is of degree n, n > 0.
@@ -347,6 +179,7 @@ cpl_error_code irplib_polynomial_solve_1d_all(const cpl_polynomial * self,
@param roots A pre-allocated vector of length n to hold the roots
@param preal The number of real roots found, or undefined on error
@return CPL_ERROR_NONE or the relevant CPL error code
+ @note There is no support for more than 4 complex roots
The *preal real roots are stored first in ascending order, then follows for
each pair of complex conjugate roots, the real and imaginary parts of the
@@ -1065,9 +898,9 @@ static void irplib_polynomial_solve_1d_3r(double a, double c,
/* -1.0 <= cos((theta + CPL_MATH_2PI) / 3.0) <= -0.5
-0.5 <= cos((theta - CPL_MATH_2PI) / 3.0) <= 0.5
- 0.5 <= cos((theta ) / 3.0) <= 1.0 */
+ 0.5 <= cos((theta ) / 3.0) <= 1.0 */
-#define TR1 (-2.0 * sqrtQ * cos( theta / 3.0))
+#define TR1 (-2.0 * sqrtQ * cos( theta / 3.0))
#define TR2 (-2.0 * sqrtQ * cos((theta - CPL_MATH_2PI) / 3.0))
#define TR3 (-2.0 * sqrtQ * cos((theta + CPL_MATH_2PI) / 3.0))
diff --git a/irplib/irplib_polynomial.h b/irplib/irplib_polynomial.h
index fa0c16d..bcf75ff 100644
--- a/irplib/irplib_polynomial.h
+++ b/irplib/irplib_polynomial.h
@@ -38,32 +38,6 @@
Function prototypes
-----------------------------------------------------------------------------*/
-/* TEMPORARY SUPPORT OF CPL 5.x */
-#ifndef CPL_SIZE_FORMAT
-#define CPL_SIZE_FORMAT "d"
-#define cpl_size int
-#endif
-
-#if defined CPL_VERSION_CODE && CPL_VERSION_CODE > CPL_VERSION(5, 92, 0)
-#define irplib_polynomial_add cpl_polynomial_add
-#define irplib_polynomial_subtract cpl_polynomial_subtract
-#define irplib_polynomial_multiply_scalar cpl_polynomial_multiply_scalar
-#else
-cpl_error_code irplib_polynomial_add(cpl_polynomial *,
- const cpl_polynomial *,
- const cpl_polynomial *);
-
-cpl_error_code irplib_polynomial_subtract(cpl_polynomial *,
- const cpl_polynomial *,
- const cpl_polynomial *);
-
-cpl_error_code irplib_polynomial_multiply_scalar(cpl_polynomial *,
- const cpl_polynomial *,
- double);
-#endif
-
-/* END TEMPORARY SUPPORT OF CPL 5.x */
-
cpl_error_code irplib_polynomial_solve_1d_all(const cpl_polynomial *,
cpl_vector *, cpl_size *);
diff --git a/irplib/irplib_strehl.c b/irplib/irplib_strehl.c
index 4e58397..fb3c3cf 100644
--- a/irplib/irplib_strehl.c
+++ b/irplib/irplib_strehl.c
@@ -33,15 +33,12 @@
Includes
-----------------------------------------------------------------------------*/
-#include <string.h>
+#include "irplib_strehl.h"
+#include "irplib_utils.h"
+
#include <assert.h>
+#include <stdint.h>
#include <math.h>
-#include <float.h>
-
-#include <cpl.h>
-
-#include "irplib_utils.h"
-#include "irplib_strehl.h"
/*----------------------------------------------------------------------------*/
/**
@@ -57,10 +54,26 @@
#define IRPLIB_STREHL_RAD_CENTRAL 5
#endif
+#ifndef IRPLIB_STREHL_DETECT_LEVEL
+#define IRPLIB_STREHL_DETECT_LEVEL 5.0
+#endif
+
#define IRPLIB_DISK_BG_MIN_PIX_NB 30
#define IRPLIB_DISK_BG_REJ_LOW 0.1
#define IRPLIB_DISK_BG_REJ_HIGH 0.1
+#ifdef CPL_MIN
+#define IRPLIB_MIN CPL_MIN
+#else
+#define IRPLIB_MIN(A,B) ((A) < (B) ? (A) : (B))
+#endif
+
+#ifdef CPL_MAX
+#define IRPLIB_MAX CPL_MAX
+#else
+#define IRPLIB_MAX(A,B) ((A) > (B) ? (A) : (B))
+#endif
+
/*-----------------------------------------------------------------------------
Functions prototypes
-----------------------------------------------------------------------------*/
@@ -70,10 +83,30 @@ static cpl_image * irplib_strehl_generate_otf(double, double, double, double,
static double PSF_H1(double, double, double);
static double PSF_H2(double, double);
static double PSF_G(double, double);
-static double PSF_sinc(double);
+static double PSF_sinc_norm(double);
static double PSF_TelOTF(double, double);
static cpl_error_code update_bad_pixel_map(cpl_image* im);
+#ifndef IRPLIB_NO_FIT_GAUSSIAN
+#ifdef IRPLIB_STREHL_USE_CPL_IMAGE_FIT_GAUSSIAN
+static double irplib_gaussian_2d(double, double, double, double, double);
+#endif
+
+#if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(6, 9, 1)
+#define irplib_gaussian_eval_2d cpl_gaussian_eval_2d
+#else
+static double irplib_gaussian_eval_2d(const cpl_array *, double, double);
+#endif
+
+static uint32_t irplib_roundup_power2(uint32_t v) CPL_ATTR_CONST;
+
+static
+cpl_error_code irplib_gaussian_maxpos(const cpl_image *,
+ double,
+ double *,
+ double *,
+ double *);
+#endif
/*-----------------------------------------------------------------------------
Functions code
@@ -83,7 +116,7 @@ static cpl_error_code update_bad_pixel_map(cpl_image* im);
/**
@brief Update the bad pixel map for the image - mark all pixels with NaN value as a bad
@param im Image with pixel-type float or double
- @return 0 iff ok
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
*/
cpl_error_code update_bad_pixel_map(cpl_image* im)
{
@@ -109,7 +142,7 @@ cpl_error_code update_bad_pixel_map(cpl_image* im)
}
/**
@brief Compute the strehl ratio in an image.
- at param im Image with pixel-type float
+ @param im Image with pixel-type float
@param m1 Diameter of the M1 mirror [m]
@param m2 Diameter of the M2 mirror [m]
@param lam Central wavelength [micron]
@@ -131,7 +164,7 @@ cpl_error_code update_bad_pixel_map(cpl_image* im)
@param psf_peak Pointer to the PSF Peak (positive on success)
@param psf_flux Pointer to the PSF Flux (1 on success)
@param bg_noise Pointer to the Background Noise
- @return 0 iff ok
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
@note The output is undefined on error. On success the Strehl Ratio may
exceed 1. Before computation, all NaN values in the image would be marked in the
bad pixel map. That means, parameter im would changed (bad pixel map would be updated / created).
@@ -186,7 +219,8 @@ cpl_error_code irplib_strehl_mark_bad_and_compute(cpl_image * im,
@param lam Central wavelength [micron]
@param dlam Filter bandwidth [micron]
@param pscale Positive pixel scale [Arcsecond/pixel]
- @param size Size of image to be used for internal PSF [pixel]
+ @param size Size of image to be used for internal PSF,
+ must be a power of two. [pixel]
@param xpos The x position of the ring center [pixel]
@param ypos The y position of the ring center [pixel]
@param r1 The Star Radius, r1 > 0 [Arcsecond]
@@ -202,11 +236,10 @@ cpl_error_code irplib_strehl_mark_bad_and_compute(cpl_image * im,
@param psf_peak Pointer to the PSF Peak (positive on success)
@param psf_flux Pointer to the PSF Flux (1 on success)
@param bg_noise Pointer to the Background Noise
- @return 0 iff ok
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
+ @see rplib_strehl_mark_bad_and_compute() for input with NaNs not marked as bad
@note The output is undefined on error. On success the Strehl Ratio may
- exceed 1. Strehl computation could fail if the image contains NaN values
- and those values are not marked in the bad pixel map. In that case the function
- rplib_strehl_mark_bad_and_compute could be used instead.
+ exceed 1.
*/
/*----------------------------------------------------------------------------*/
cpl_error_code irplib_strehl_compute(const cpl_image * im,
@@ -243,7 +276,11 @@ cpl_error_code irplib_strehl_compute(const cpl_image * im,
double ring[4];
/* cpl_flux_get_noise_ring() must succeed with this many tries */
int ring_tries = 3;
- cpl_errorstate prestate;
+#ifndef IRPLIB_NO_FIT_GAUSSIAN
+ double xposfit, yposfit, peak;
+ cpl_error_code code;
+#endif
+ cpl_errorstate prestate = cpl_errorstate_get();
/* Check compile-time constant */
cpl_ensure_code(window_size > 0.0, CPL_ERROR_ILLEGAL_INPUT);
@@ -269,7 +306,9 @@ cpl_error_code irplib_strehl_compute(const cpl_image * im,
/* Generate first appropriate PSF to find max peak */
psf = irplib_strehl_generate_psf(m1, m2, lam, dlam, pscale, size);
- cpl_ensure_code(psf != NULL, CPL_ERROR_ILLEGAL_OUTPUT);
+ if (psf == NULL) {
+ return cpl_error_set_where(cpl_func);
+ }
/* Compute flux in PSF and find max peak */
*psf_peak = cpl_image_get_max(psf);
@@ -278,9 +317,24 @@ cpl_error_code irplib_strehl_compute(const cpl_image * im,
assert( *psf_peak > 0.0); /* The ideal PSF has a positive maximum */
*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,
+ &xposfit, &yposfit, &peak);
+ if (code) {
+ cpl_errorstate_set(prestate);
+ } else {
+ xpos = xposfit;
+ ypos = yposfit;
+ }
+#endif
+
/* Measure the background in the candidate image */
- *star_bg = irplib_strehl_ring_background(im, xpos, ypos, r2/pscale, r3/pscale,
+ *star_bg = irplib_strehl_ring_background(im, xpos, ypos,
+ r2/pscale, r3/pscale,
IRPLIB_BG_METHOD_AVER_REJ);
+ if (!cpl_errorstate_is_equal(prestate)) {
+ return cpl_error_set_where(cpl_func);
+ }
/* Compute star_radius in pixels */
star_radius = r1/pscale;
@@ -288,7 +342,11 @@ cpl_error_code irplib_strehl_compute(const cpl_image * im,
/* Measure the flux on the candidate image */
*star_flux = irplib_strehl_disk_flux(im, xpos, ypos, star_radius, *star_bg);
- cpl_ensure_code(*star_flux > 0.0, CPL_ERROR_ILLEGAL_OUTPUT);
+ if (*star_flux <= 0.0) {
+ return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_OUTPUT,
+ "Non-positive star flux=%g (Star "
+ "background=%g)", *star_flux, *star_bg);
+ }
/* Find the peak value on the central part of the candidate image */
max_radius = window_size < star_radius ? window_size : star_radius;
@@ -296,16 +354,27 @@ cpl_error_code irplib_strehl_compute(const cpl_image * im,
star_peak), cpl_error_get_code());
*star_peak -= *star_bg;
- cpl_ensure_code(*star_peak > 0.0, CPL_ERROR_ILLEGAL_OUTPUT);
+ if (*star_flux <= 0.0) {
+ return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_OUTPUT,
+ "Non-positive star peak=%g (Star "
+ "background=%g, Star flux=%g)",
+ *star_flux, *star_bg, *star_flux);
+ }
/* Compute Strehl */
/* (StarPeak / StarFlux) / (PsfPeak / PsfFlux) */
*strehl = (*star_peak * *psf_flux ) / ( *star_flux * *psf_peak);
- if (*strehl > 1)
- cpl_msg_warning(cpl_func, "Extreme Strehl-ratio=%g, star_peak=%g, "
- "star_flux=%g, psf_peak=%g, psf_flux=%g", *strehl,
- *star_peak, *star_flux, *psf_peak, *psf_flux);
+#ifndef IRPLIB_NO_FIT_GAUSSIAN
+ if (code == CPL_ERROR_NONE && peak > *star_peak && *star_peak > 0.0 &&
+ *strehl * peak / *star_peak <= 1.0) {
+ cpl_msg_debug(cpl_func, "Increasing Strehl from %g: %g (%g)",
+ *strehl, *strehl * peak / *star_peak,
+ peak / *star_peak);
+ *strehl *= peak / *star_peak;
+ *star_peak = peak;
+ }
+#endif
/* Compute Strehl error */
/* computation could fail if the image contains pixels with NaN value*/
@@ -314,9 +383,6 @@ cpl_error_code irplib_strehl_compute(const cpl_image * im,
ring[2] = r2/pscale;
ring[3] = r3/pscale;
- /* FIXME: With CPL 5.1 the recoverable error
- will be CPL_ERROR_DATA_NOT_FOUND */
- prestate = cpl_errorstate_get();
while (cpl_flux_get_noise_ring(im, ring, noise_box_sz, noise_nsamples,
bg_noise, NULL) && --ring_tries > 0);
if (ring_tries > 0) {
@@ -328,16 +394,27 @@ cpl_error_code irplib_strehl_compute(const cpl_image * im,
*strehl_err = strehl_error_coefficient * (*bg_noise) * pscale *
star_radius * star_radius / *star_flux;
- /* This check should not be able to fail, but just to be sure */
- cpl_ensure_code(*strehl_err >= 0.0, CPL_ERROR_ILLEGAL_OUTPUT);
+ if (*strehl > 1.0) {
+ cpl_msg_warning(cpl_func, "Extreme Strehl-ratio=%g (strehl-error=%g, "
+ "star_peak=%g, star_flux=%g, psf_peak=%g, psf_flux=%g)",
+ *strehl, *strehl_err, *star_peak, *star_flux, *psf_peak,
+ *psf_flux);
+ }
- return CPL_ERROR_NONE;
+ /* This check should not be able to fail, but just to be sure */
+ return *strehl_err >= 0.0
+ ? CPL_ERROR_NONE
+ : cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_OUTPUT,
+ "Negative strehl-error=%g (Strehl-ratio=%g, "
+ "star_peak=%g, star_flux=%g, psf_peak=%g, "
+ "psf_flux=%g", *strehl_err, *strehl,
+ *star_peak, *star_flux, *psf_peak, *psf_flux);
}
/*----------------------------------------------------------------------------*/
/**
@brief Compute the flux from a disk
- @param im Image with pixel-type float
+ @param im Image to compute from
@param xpos the x position of the disk center
@param ypos the y position of the disk center
@param rad the radius
@@ -357,55 +434,49 @@ double irplib_strehl_disk_flux(const cpl_image * im,
double rad,
double bg)
{
+ const int nx = cpl_image_get_size_x(im);
+ const int ny = cpl_image_get_size_y(im);
+ /* Round down */
+ const int lx = (int)(xpos - rad);
+ const int ly = (int)(ypos - rad);
+ /* Round up */
+ const int ux = (int)(xpos + rad) + 1;
+ const int uy = (int)(ypos + rad) + 1;
+
const double sqr = rad * rad;
- double sqrest;
- const float * pim;
double flux = 0.0;
- double yj, xi;
- int nx, ny;
- int lx, ly, ux, uy;
int i, j;
/* Check entries */
cpl_ensure(im != NULL, CPL_ERROR_NULL_INPUT, 0.0);
- cpl_ensure(cpl_image_get_type(im) == CPL_TYPE_FLOAT,
- CPL_ERROR_UNSUPPORTED_MODE, 0.0);
cpl_ensure(rad > 0.0, CPL_ERROR_ILLEGAL_INPUT, 0.0);
- nx = cpl_image_get_size_x(im);
- ny = cpl_image_get_size_y(im);
+ for (j = IRPLIB_MAX(ly, 0); j < IRPLIB_MIN(uy, ny-1); j++) {
+ const double yj = (double)j - ypos;
+ for (i = IRPLIB_MAX(lx, 0); i < IRPLIB_MIN(ux, nx-1); i++) {
+ const double xi = (double)i - xpos;
+ const double dist = yj * yj + xi * xi;
+ if (dist <= sqr) {
+ int isbad;
+ const double value = cpl_image_get(im, i+1, j+1, &isbad);
- /* Round down */
- lx = (int)(xpos - rad);
- ly = (int)(ypos - rad);
- if (lx < 0) lx = 0;
- if (ly < 0) ly = 0;
+ if (!isbad && irplib_isnan(value) == 0) {
- /* Round up */
- ux = (int)(xpos + rad) + 1;
- uy = (int)(ypos + rad) + 1;
- if (ux > (nx-1)) ux = nx-1;
- if (uy > (ny-1)) uy = ny-1;
-
- pim = cpl_image_get_data_float_const(im);
- for (j=ly ; j<uy ; j++) {
- yj = (double)j - ypos;
- sqrest = sqr - yj * yj;
- for (i=lx; i<ux ; i++) {
- xi = (double)i - xpos;
- if (sqrest >= xi * xi && irplib_isnan(pim[i+j*nx]) == 0) {
- flux += (double)pim[i+j*nx] - bg;
+ flux += value - bg;
+
+ }
}
}
}
+
return flux;
}
/*----------------------------------------------------------------------------*/
/**
@brief Compute the background in the image from a specified disk
- @param im Image with pixel-type float
+ @param im Image to compute from
@param xpos the x position of the ring center
@param ypos the y position of the ring center
@param rad_int the internal radius
@@ -424,22 +495,23 @@ double irplib_strehl_ring_background(const cpl_image * im,
double rad_ext,
irplib_strehl_bg_method mode)
{
- int npix;
+ const int nx = cpl_image_get_size_x(im);
+ const int ny = cpl_image_get_size_y(im);
+ /* Round down */
+ const int lx = (int)(xpos - rad_ext);
+ const int ly = (int)(ypos - rad_ext);
+ /* Round up */
+ const int ux = (int)(xpos + rad_ext) + 1;
+ const int uy = (int)(ypos + rad_ext) + 1;
+ int mpix, npix;
const double sqr_int = rad_int * rad_int;
const double sqr_ext = rad_ext * rad_ext;
- double dist;
cpl_vector * pix_arr;
- const float * pim;
double flux = 0.0;
- double yj, xi;
- int lx, ly, ux, uy;
- int nx, ny;
int i, j;
/* Check entries */
cpl_ensure(im != NULL, CPL_ERROR_NULL_INPUT, 0.0);
- cpl_ensure(cpl_image_get_type(im) == CPL_TYPE_FLOAT,
- CPL_ERROR_UNSUPPORTED_MODE, 0.0);
cpl_ensure(rad_int > 0.0, CPL_ERROR_ILLEGAL_INPUT, 0.0);
cpl_ensure(rad_ext > rad_int, CPL_ERROR_ILLEGAL_INPUT, 0.0);
@@ -447,53 +519,46 @@ double irplib_strehl_ring_background(const cpl_image * im,
mode == IRPLIB_BG_METHOD_MEDIAN,
CPL_ERROR_UNSUPPORTED_MODE, 0.0);
- nx = cpl_image_get_size_x(im);
- ny = cpl_image_get_size_y(im);
-
- /* Round down */
- lx = (int)(xpos - rad_ext);
- ly = (int)(ypos - rad_ext);
- if (lx < 0) lx = 0;
- if (ly < 0) ly = 0;
-
- /* Round up */
- ux = (int)(xpos + rad_ext) + 1;
- uy = (int)(ypos + rad_ext) + 1;
- if (ux > (nx-1)) ux = nx-1;
- if (uy > (ny-1)) uy = ny-1;
-
- npix = (ux - lx + 1) * (uy - ly + 1);
- cpl_ensure(npix >= IRPLIB_DISK_BG_MIN_PIX_NB, CPL_ERROR_DATA_NOT_FOUND, 0.0);
+ mpix = (int)((2.0 * rad_ext + 1.0) * (2.0 * rad_ext + 1.0));
/* Allocate pixel array to hold values in the ring */
- pix_arr = cpl_vector_new(npix);
+ pix_arr = cpl_vector_new(mpix);
/* Count number of pixels in the ring */
/* Retrieve all pixels which belong to the ring */
- pim = cpl_image_get_data_float_const(im);
npix = 0;
- for (j=ly ; j<uy ; j++) {
- yj = (double)j - ypos;
- for (i=lx ; i<ux; i++) {
- xi = (double)i - xpos;
- dist = yj * yj + xi * xi;
- if (sqr_int <= dist && dist <= sqr_ext &&
- irplib_isnan(pim[i+j*nx]) == 0) {
- cpl_vector_set(pix_arr, npix, (double)pim[i+j*nx]);
- npix++;
+ for (j = IRPLIB_MAX(ly, 0); j < IRPLIB_MIN(uy, ny-1); j++) {
+ const double yj = (double)j - ypos;
+ for (i = IRPLIB_MAX(lx, 0); i < IRPLIB_MIN(ux, nx-1); i++) {
+ const double xi = (double)i - xpos;
+ const double dist = yj * yj + xi * xi;
+ if (sqr_int <= dist && dist <= sqr_ext) {
+ int isbad;
+ const double value = cpl_image_get(im, i+1, j+1, &isbad);
+
+ if (!isbad && irplib_isnan(value) == 0) {
+ cpl_vector_set(pix_arr, npix, value);
+ npix++;
+ }
}
}
}
+ assert(npix <= mpix);
+
if (npix < IRPLIB_DISK_BG_MIN_PIX_NB) {
cpl_vector_delete(pix_arr);
- cpl_ensure(0, CPL_ERROR_DATA_NOT_FOUND, 0.0);
+ (void)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND, "Need "
+ "at least %d (not %d <= %d) samples to "
+ "compute noise", IRPLIB_DISK_BG_MIN_PIX_NB,
+ npix, mpix);
+ return 0.0;
}
/* Should not be able to fail now */
/* Resize pixel array to actual number of values within the ring */
- cpl_vector_set_size(pix_arr, npix);
+ pix_arr = cpl_vector_wrap(npix, (double*)cpl_vector_unwrap(pix_arr));
if (mode == IRPLIB_BG_METHOD_AVER_REJ) {
const int low_ind = (int)((double)npix * IRPLIB_DISK_BG_REJ_LOW);
@@ -501,9 +566,9 @@ double irplib_strehl_ring_background(const cpl_image * im,
* (1.0 - IRPLIB_DISK_BG_REJ_HIGH));
/* Sort the array */
- cpl_vector_sort(pix_arr, 1);
+ cpl_vector_sort(pix_arr, CPL_SORT_ASCENDING);
- for (i=low_ind ; i<high_ind ; i++) {
+ for (i=low_ind; i<high_ind; i++) {
flux += cpl_vector_get(pix_arr, i);
}
if (high_ind - low_ind > 1) flux /= (double)(high_ind - low_ind);
@@ -537,29 +602,28 @@ double irplib_strehl_ring_background(const cpl_image * im,
*/
/*----------------------------------------------------------------------------*/
-cpl_image * irplib_strehl_generate_psf(
- double m1,
- double m2,
- double lam,
- double dlam,
- double pscale,
- int size)
+cpl_image * irplib_strehl_generate_psf(double m1,
+ double m2,
+ double lam,
+ double dlam,
+ double pscale,
+ int size)
{
cpl_image * otf_image = irplib_strehl_generate_otf(m1, m2, lam, dlam,
- size, pscale);
+ size, pscale);
- if (otf_image == NULL) return NULL;
+ if (otf_image == NULL ||
- /* Transform back to real space
- - Normalization is unnecessary, due to the subsequent normalisation.
- - An OTF is point symmetric about its center, i.e. it is even,
- i.e. the real space image is real.
- - Because of this a forward FFT works as well.
- - If the PSF ever needs to have its images halves swapped add
- CPL_FFT_SWAP_HALVES to the FFT call.
- */
+ /* Transform back to real space
+ - Normalization is unnecessary, due to the subsequent normalisation.
+ - An OTF is point symmetric about its center, i.e. it is even,
+ i.e. the real space image is real.
+ - Because of this a forward FFT works as well.
+ - If the PSF ever needs to have its images halves swapped add
+ CPL_FFT_SWAP_HALVES to the FFT call.
+ */
- if (cpl_image_fft(otf_image, NULL, CPL_FFT_UNNORMALIZED) ||
+ cpl_image_fft(otf_image, NULL, CPL_FFT_UNNORMALIZED) ||
/* Compute absolute values of PSF */
cpl_image_abs(otf_image) ||
@@ -567,8 +631,9 @@ cpl_image * irplib_strehl_generate_psf(
/* Normalize PSF to get flux=1 */
cpl_image_normalise(otf_image, CPL_NORM_FLUX)) {
+ (void)cpl_error_set_where(cpl_func);
cpl_image_delete(otf_image);
- return NULL;
+ otf_image = NULL;
}
return otf_image;
@@ -583,7 +648,7 @@ cpl_image * irplib_strehl_generate_psf(
@param m2 Diameter of the M2 mirror [m], m2 < m1
@param lam Central wavelength [micron]
@param dlam Filter bandwidth [micron]
- @param size Generated image size (image will be square).
+ @param size The generated (square) image will be size X size pixels
@param pscale Pixel scale on the sky [Arcsecond/pixel]
@return 1 newly generated cpl_image
@@ -593,87 +658,109 @@ cpl_image * irplib_strehl_generate_psf(
(p. 99).
*/
/*----------------------------------------------------------------------------*/
-static cpl_image * irplib_strehl_generate_otf(
- double m1,
- double m2,
- double lam,
- double dlam,
- int size,
- double pscale)
+static cpl_image * irplib_strehl_generate_otf(double m1,
+ double m2,
+ double lam,
+ double dlam,
+ int size,
+ double pscale)
{
- cpl_image * otf_image;
- double * otf_data;
- double obs_ratio ; /* m1 / m2 */
- double f_max ; /* cut-off frequency */
- int pix0 ; /* Pixel corresponding to the zero frequency */
- double a, x, y;
- double f, rsq, fc, invfc, lambda;
- double sincy;
- double invsize;
- register int pos;
- int i, j, k;
-
-
- cpl_ensure(m2 > 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL);
- cpl_ensure(m1 > m2, CPL_ERROR_ILLEGAL_INPUT, NULL);
- cpl_ensure(lam > 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL);
- cpl_ensure(dlam > 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL);
- cpl_ensure(size > 0, CPL_ERROR_ILLEGAL_INPUT, NULL);
- cpl_ensure(pscale > 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL);
-
- /* Convert pixel scale from sec to radians, microns in meters */
- pscale /= (double)206265;
- lam /= (double)1.0e6;
- dlam /= (double)1.0e6;
-
- /* Obscuration ratio */
- obs_ratio = m2 / m1;
-
- /* Pixel corresponding to the zero frequency */
- pix0 = size/2;
- invsize = (double)1.0 / (double)size;
-
- /* Cut-off frequency in pixels */
- f_max = m1 * pscale * (double)size / lam;
-
- /* Allocate for output image */
- otf_image = cpl_image_new(size, size, CPL_TYPE_DOUBLE);
- if (otf_image==NULL) return NULL;
- otf_data = cpl_image_get_data_double(otf_image);
-
- /* Now compute the OTF */
- /* OPTIMIZED CODE !!! LIMITED READABILITY !!! */
-
- for (k=1 ; k<=9 ; k++) { /* iteration on the wavelength */
- /* Compute intermediate cut-off frequency */
- lambda = (double)(lam - dlam*(double)(k-5)/8.0);
- fc = (double)f_max * (double)lam / lambda;
- invfc = 1.0 / fc;
-
- /* Convolution with the detector pixels */
- pos = 0;
- for (j=0 ; j<size ; j++) {
- y = (double)(j-pix0);
- sincy = PSF_sinc(CPL_MATH_PI * y * invsize);
- for (i=0 ; i<size ; i++) {
- x = (double)(i-pix0);
- rsq = x*x + y*y;
- if (rsq < fc*fc) {
- if (rsq < 0.01)
- a = 1.0;
- else {
- f = sqrt(rsq) * invfc;
- a = PSF_TelOTF(f,obs_ratio) *
- PSF_sinc(CPL_MATH_PI * x * invsize) * sincy;
+ double * otf_data;
+ /* Obscuration ratio, m1 / m2 */
+ const double obs_ratio = m1 != 0.0 ? m2 / m1 : 0.0;
+ /* pixel scale converted from Arsecond to radian */
+ const double rpscale = pscale * CPL_MATH_2PI / (double)(360 * 60 * 60);
+ /* Cut-off frequency in pixels per central wavelength (in m) */
+ const double f_max = m1 * rpscale * (double)size;
+
+ /* Pixel corresponding to the zero frequency */
+ const int pix0 = size / 2;
+ int i, j;
+
+
+ cpl_ensure(m2 > 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(m1 > m2, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(dlam > 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(pscale > 0.0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ cpl_ensure(size > 0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+ /* Due the the FFT, size is actually required to be a power of two */
+ cpl_ensure(size % 2 == 0, CPL_ERROR_ILLEGAL_INPUT, NULL);
+
+ /* Ensure positive lambda */
+ cpl_ensure(2.0 * lam > dlam, CPL_ERROR_ILLEGAL_INPUT, NULL);
+
+ /* Convert wavelengths from micron to meter */
+ lam /= 1.0e6;
+ dlam /= 1.0e6;
+
+ /* Allocate the output pixel buffer */
+ otf_data = (double*)cpl_malloc(size * size * sizeof(*otf_data));
+
+ /* Convolution with the detector pixels */
+ /* The OTF is point symmetric so the whole image can be computed from the
+ values of a single octant. */
+ /* The image could be created with calloc() and j limited by
+ f_max / (mlam - mdlam * 0.5) but this is not faster */
+ for (j = 0; j <= pix0; j++) {
+ double sinc_y_9 = 0.0; /* Avoid uninit warning */
+ for (i = 0; i <= j; i++) {
+ if (i == 0 && j == 0) {
+ otf_data[size * pix0 + pix0] = 1.0;
+ } else {
+ const double x = (double)i;
+ const double y = (double)j;
+ const double sqdist = x * x + y * y;
+ double f_lambda, sinc_xy_9 = 0.0; /* Zero if OTF is zero */
+ double otfxy = 0.0;
+ int k;
+
+ assert( j > 0 );
+
+ /* 9 iterations on the wavelength */
+ /* Unrolling the loop is not faster (due to the break?) */
+ for (k = 4; k >= -4; k--) {
+ /* Compute intermediate cut-off frequency */
+ const double lambda = lam - dlam * (double)k / 8.0;
+
+ /* A decreasing k ensures that we either enter on the first
+ iteration or not at all */
+ if (sqdist * lambda * lambda >= f_max * f_max) break;
+
+ if (k == 4) {
+ f_lambda = sqrt(sqdist) / f_max;
+ if (i == 0) {
+ /* Sinc(x = 0) == 1 */
+ sinc_xy_9 = sinc_y_9 =
+ PSF_sinc_norm(y / (double)size) / 9.0;
+ } else {
+ sinc_xy_9 = sinc_y_9 *
+ PSF_sinc_norm(x / (double)size);
+ }
+ }
+
+ otfxy += PSF_TelOTF(f_lambda * lambda, obs_ratio);
+ }
+ otfxy *= sinc_xy_9;
+
+ /* When i == j the same value is written to the same
+ position twice. That's probably faster than a guard */
+ otf_data[size * (pix0 - j) + pix0 - i] = otfxy;
+ otf_data[size * (pix0 - i) + pix0 - j] = otfxy;
+ if (i < pix0) {
+ otf_data[size * (pix0 - j) + pix0 + i] = otfxy;
+ otf_data[size * (pix0 + i) + pix0 - j] = otfxy;
+ if (j < pix0) {
+ otf_data[size * (pix0 + j) + pix0 - i] = otfxy;
+ otf_data[size * (pix0 - i) + pix0 + j] = otfxy;
+ otf_data[size * (pix0 + j) + pix0 + i] = otfxy;
+ otf_data[size * (pix0 + i) + pix0 + j] = otfxy;
}
- } else {
- a = 0.0;
}
- otf_data[pos++] += a / 9.0;
}
}
}
- return otf_image;
+
+ return cpl_image_wrap_double(size, size, otf_data);
}
/*----------------------------------------------------------------------------*
@@ -713,12 +800,18 @@ static double PSF_G(double f,
else return(PSF_H1(f,u,1.0) + PSF_H1(f,u,u) + PSF_H2(f,u));
}
-/*----------------------------------------------------------------------------*
- * sinc function
- *----------------------------------------------------------------------------*/
-static double PSF_sinc(double x)
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief The normalized sinc function
+ @param x The non-zero argument
+ @return sin(x * pi)/ (x * pi)
+
+ */
+/*----------------------------------------------------------------------------*/
+static double PSF_sinc_norm(double x)
{
- return fabs(x) > fabs(sin(x)) ? sin(x)/x : 1.0;
+ return sin(x * CPL_MATH_PI) / (x * CPL_MATH_PI);
}
/*----------------------------------------------------------------------------*
@@ -737,70 +830,338 @@ static double PSF_TelOTF(double f,
@param xpos The x position of the disk center
@param ypos The y position of the disk center
@param radius The positive radius
- @param ppeak Pointer to the Star Peak
- @return 0 iff successful
- @note *ppeak is undefined on error
+ @param ppeak On success, *ppeak is the peak intensity
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
*/
/*----------------------------------------------------------------------------*/
cpl_error_code irplib_strehl_disk_max(const cpl_image * self,
- double xpos,
- double ypos,
- double radius,
- double * ppeak)
+ double xpos,
+ double ypos,
+ double radius,
+ double * ppeak)
{
+ const int nx = cpl_image_get_size_x(self);
+ const int ny = cpl_image_get_size_y(self);
+ /* Round down */
+ const int lx = (int)(xpos - radius);
+ const int ly = (int)(ypos - radius);
+ /* Round up */
+ const int ux = (int)(xpos + radius) + 1;
+ const int uy = (int)(ypos + radius) + 1;
+
const double sqr = radius * radius;
- double sqrest;
- const float * pself;
- float peak = FLT_MAX; /* Avoid (false) uninit warning */
- double yj, xi;
- int nx, ny;
- int lx, ly, ux, uy;
- int i, j;
cpl_boolean first = CPL_TRUE;
+ int i, j;
/* Check entries */
- cpl_ensure_code(ppeak != NULL, CPL_ERROR_NULL_INPUT);
cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
- cpl_ensure_code(cpl_image_get_type(self) == CPL_TYPE_FLOAT,
- CPL_ERROR_UNSUPPORTED_MODE);
- cpl_ensure_code(radius > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+ cpl_ensure_code(ppeak != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_ensure_code(radius > 0.0, CPL_ERROR_ILLEGAL_INPUT);
- nx = cpl_image_get_size_x(self);
- ny = cpl_image_get_size_y(self);
- /* Round down */
- lx = (int)(xpos - radius);
- ly = (int)(ypos - radius);
- if (lx < 0) lx = 0;
- if (ly < 0) ly = 0;
+ for (j = IRPLIB_MAX(ly, 0); j < IRPLIB_MIN(uy, ny-1); j++) {
+ const double yj = (double)j - ypos;
+ for (i = IRPLIB_MAX(lx, 0); i < IRPLIB_MIN(ux, nx-1); i++) {
+ const double xi = (double)i - xpos;
+ const double dist = yj * yj + xi * xi;
+ if (dist <= sqr) {
+ int isbad;
+ const double value = cpl_image_get(self, i+1, j+1, &isbad);
- /* Round up */
- ux = (int)(xpos + radius) + 1;
- uy = (int)(ypos + radius) + 1;
- if (ux > (nx-1)) ux = nx-1;
- if (uy > (ny-1)) uy = ny-1;
-
- pself = cpl_image_get_data_float_const(self);
- for (j=ly ; j<uy ; j++) {
- yj = (double)j - ypos;
- sqrest = sqr - yj * yj;
- for (i=lx; i<ux ; i++) {
- xi = (double)i - xpos;
- if (sqrest >= xi * xi && irplib_isnan(pself[i+j*nx]) == 0) {
- if (first || pself[i+j*nx] > peak) {
+ if (!isbad && irplib_isnan(value) == 0 &&
+ (first || value > *ppeak)) {
first = CPL_FALSE;
- peak = pself[i+j*nx];
+ *ppeak = value;
}
}
}
}
- cpl_ensure_code(!first, CPL_ERROR_DATA_NOT_FOUND);
+ return first
+ ? cpl_error_set(cpl_func, CPL_ERROR_DATA_NOT_FOUND)
+ : CPL_ERROR_NONE;
+}
- *ppeak = (double)peak;
+#ifndef IRPLIB_NO_FIT_GAUSSIAN
+#ifdef IRPLIB_STREHL_USE_CPL_IMAGE_FIT_GAUSSIAN
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Compute the value of a Gaussian function at a given point.
+ @param x x coordinate where to compute the function.
+ @param y y coordinate where to compute the function.
+ @param norm The norm of the gaussian.
+ @param sig_x Sigma in x for the Gauss distribution.
+ @param sig_y Sigma in y for the Gauss distribution.
+ @return the gaussian value
+
+ Compute the value of a 2d Gaussian function at a given point:
+
+ f(x, y) = (norm/(2*pi*sig_x*sig_y)) * exp(-x^2/(2*sig_x^2)) *
+ exp(-y^2/(2*sig_y^2))
+ */
+/*----------------------------------------------------------------------------*/
+static double irplib_gaussian_2d(double x,
+ double y,
+ double norm,
+ double sig_x,
+ double sig_y)
+{
- return CPL_ERROR_NONE;
+ /* Copied from CPL */
+ return norm / (sig_x * sig_y * CPL_MATH_2PI *
+ exp(x * x / (2.0 * sig_x * sig_x) +
+ y * y / (2.0 * sig_y * sig_y)));
}
+#endif
+
+#if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(6, 9, 1)
+#else
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Evaluate the Gaussian in a 2D-point
+ @param self The seven Gaussian parameters
+ @param x The X-coordinate to evaluate
+ @param y The Y-coordinate to evaluate
+ @return The gaussian value or zero on error
+ @see cpl_fit_image_gaussian()
+ @note The function should not be able to fail if the parameters come from
+ a succesful call to cpl_fit_image_gaussian()
+
+ Possible #_cpl_error_code_ set in this function:
+ - CPL_ERROR_NULL_INPUT if a pointer is NULL.
+ - CPL_ERROR_TYPE_MISMATCH if the array is not of type double
+ - CPL_ERROR_ILLEGAL_INPUT if the array has a length different from 7
+ - CPL_ERROR_ILLEGAL_OUTPUT if the (absolute value of the) radius exceeds 1
+ - CPL_ERROR_DIVISION_BY_ZERO if a sigma is 0, or the radius is 1
+
+ */
+/*----------------------------------------------------------------------------*/
+static
+double irplib_gaussian_eval_2d(const cpl_array * self, double x, double y)
+{
+ cpl_errorstate prestate = cpl_errorstate_get();
+ const double B = cpl_array_get_double(self, 0, NULL);
+ const double A = cpl_array_get_double(self, 1, NULL);
+ const double R = cpl_array_get_double(self, 2, NULL);
+ const double M_x = cpl_array_get_double(self, 3, NULL);
+ const double M_y = cpl_array_get_double(self, 4, NULL);
+ const double S_x = cpl_array_get_double(self, 5, NULL);
+ const double S_y = cpl_array_get_double(self, 6, NULL);
+
+ double value = 0.0;
+
+ if (!cpl_errorstate_is_equal(prestate)) {
+ (void)cpl_error_set_where(cpl_func);
+ } else if (cpl_array_get_size(self) != 7) {
+ (void)cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT);
+ } else if (fabs(R) < 1.0 && S_x != 0.0 && S_y != 0.0) {
+ const double x_n = (x - M_x) / S_x;
+ const double y_n = (y - M_y) / S_y;
+
+ value = B + A / (CPL_MATH_2PI * S_x * S_y * sqrt(1 - R * R)) *
+ exp(-0.5 / (1 - R * R) * ( x_n * x_n + y_n * y_n
+ - 2.0 * R * x_n * y_n));
+ } else if (fabs(R) > 1.0) {
+ (void)cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_OUTPUT,
+ "fabs(R=%g) > 1", R);
+ } else {
+ (void)cpl_error_set_message(cpl_func, CPL_ERROR_DIVISION_BY_ZERO,
+ "R=%g. Sigma=(%g, %g)", R, S_x, S_y);
+ }
+
+ return value;
+}
+#endif
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Increase a non-zero, unsigned 32-bit integer to the next power of 2
+ @param v The non-zero number to increase
+ @return The power of two
+ @see http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
+ */
+/*----------------------------------------------------------------------------*/
+static uint32_t irplib_roundup_power2(uint32_t v)
+{
+ v |= v >> 1;
+ v |= v >> 2;
+ v |= v >> 4;
+ v |= v >> 8;
+ v |= v >> 16;
+
+ return v + 1;
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief Find the peak flux, peak sum and position of a Gaussian
+ @param self Image to process
+ @param sigma The initial detection level
+ @param pxpos On success, the refined X-position
+ @param pypos On success, the refined Y-position
+ @param ppeak On success, the refined peak flux
+ @return CPL_ERROR_NONE or the relevant CPL error code on error
+
+ */
+/*----------------------------------------------------------------------------*/
+static
+cpl_error_code irplib_gaussian_maxpos(const cpl_image * self,
+ double sigma,
+ double * pxpos,
+ double * pypos,
+ double * ppeak)
+{
+
+ const cpl_size nx = cpl_image_get_size_x(self);
+ const cpl_size ny = cpl_image_get_size_y(self);
+ int iretry = 3; /* Number retries with decreasing sigma */
+ int ifluxapert;
+ double med_dist;
+ const double median = cpl_image_get_median_dev(self, &med_dist);
+ cpl_mask * selection;
+ cpl_size nlabels = 0;
+ cpl_image * labels = NULL;
+ cpl_apertures * aperts;
+ cpl_size npixobj;
+ double objradius;
+ cpl_size winsize;
+ cpl_size xposmax, yposmax;
+ double xposcen, yposcen;
+ double valmax, valfit = -1.0;
+#ifdef IRPLIB_STREHL_USE_CPL_IMAGE_FIT_GAUSSIAN
+ double norm, xcen, ycen, sig_x, sig_y, fwhm_x, fwhm_y;
+#endif
+ cpl_array * gauss_parameters = NULL;
+ cpl_errorstate prestate = cpl_errorstate_get();
+ cpl_error_code code;
+
+
+ cpl_ensure_code( sigma > 0.0, CPL_ERROR_ILLEGAL_INPUT);
+
+ selection = cpl_mask_new(nx, ny);
+
+ for (; iretry > 0 && nlabels == 0; iretry--, sigma *= 0.5) {
+
+ /* Compute the threshold */
+ const double threshold = median + sigma * med_dist;
+
+
+ /* Select the pixel above the threshold */
+ code = cpl_mask_threshold_image(selection, self, threshold, DBL_MAX,
+ CPL_BINARY_1);
+
+ if (code) break;
+
+ /* Labelise the thresholded selection */
+ cpl_image_delete(labels);
+ labels = cpl_image_labelise_mask_create(selection, &nlabels);
+ }
+ sigma *= 2.0; /* FIXME: unelegant */
+
+ cpl_mask_delete(selection);
+
+ if (code) {
+ cpl_image_delete(labels);
+ return cpl_error_set_where(cpl_func);
+ } else if (nlabels == 0) {
+ cpl_image_delete(labels);
+ return cpl_error_set(cpl_func, CPL_ERROR_DATA_NOT_FOUND);
+ }
+
+ aperts = cpl_apertures_new_from_image(self, labels);
+
+ /* Find the aperture with the greatest flux */
+ code = irplib_apertures_find_max_flux(aperts, &ifluxapert, 1);
+
+ npixobj = cpl_apertures_get_npix(aperts, ifluxapert);
+ objradius = sqrt((double)npixobj * CPL_MATH_1_PI);
+ /* Size is power of two for future noise filtering w. fft */
+ winsize = IRPLIB_MIN(IRPLIB_MIN(nx, ny), irplib_roundup_power2
+ ((uint32_t)(3.0 * objradius + 0.5)));
+
+ xposmax = cpl_apertures_get_maxpos_x(aperts, ifluxapert);
+ yposmax = cpl_apertures_get_maxpos_y(aperts, ifluxapert);
+ xposcen = cpl_apertures_get_centroid_x(aperts, ifluxapert);
+ yposcen = cpl_apertures_get_centroid_y(aperts, ifluxapert);
+ valmax = cpl_apertures_get_max(aperts, ifluxapert);
+
+ cpl_apertures_delete(aperts);
+ cpl_image_delete(labels);
+
+ cpl_msg_debug(cpl_func, "Object radius at S/R=%g: %g (window-size=%u)",
+ sigma, objradius, (unsigned)winsize);
+ cpl_msg_debug(cpl_func, "Object-peak @ (%d, %d) = %g", (int)xposmax,
+ (int)yposmax, valmax);
+
+ gauss_parameters = cpl_array_new(7, CPL_TYPE_DOUBLE);
+ cpl_array_set_double(gauss_parameters, 0, median);
+
+ code = cpl_fit_image_gaussian(self, NULL, xposcen, yposcen,
+ winsize, winsize, gauss_parameters,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
+ if (!code) {
+ const double M_x = cpl_array_get_double(gauss_parameters, 3, NULL);
+ const double M_y = cpl_array_get_double(gauss_parameters, 4, NULL);
+
+ valfit = irplib_gaussian_eval_2d(gauss_parameters, M_x, M_y);
+
+ if (!cpl_errorstate_is_equal(prestate)) {
+ code = cpl_error_get_code();
+ } else {
+ *pxpos = M_x;
+ *pypos = M_y;
+ *ppeak = valfit;
+
+ cpl_msg_debug(cpl_func, "Gauss-fit @ (%g, %g) = %g",
+ M_x, M_y, valfit);
+ }
+ }
+ cpl_array_delete(gauss_parameters);
+
+#ifdef IRPLIB_STREHL_USE_CPL_IMAGE_FIT_GAUSSIAN
+ if (code || valfit < valmax) {
+ cpl_errorstate_set(prestate);
+
+ code = cpl_image_fit_gaussian(self, xposcen, yposcen,
+ (int)(2.0 * objradius),
+ &norm,
+ &xcen,
+ &ycen,
+ &sig_x,
+ &sig_y,
+ &fwhm_x,
+ &fwhm_y);
+
+ if (!code) {
+ valfit = irplib_gaussian_2d(0.0, 0.0, norm, sig_x, sig_y);
+
+ cpl_msg_debug(cpl_func, "Gauss-Fit @ (%g, %g) = %g. norm=%g, "
+ "sigma=(%g, %g)", xcen, ycen, valfit, norm,
+ sig_x, sig_y);
+
+ if (valfit > valmax) {
+ *pxpos = xcen;
+ *pypos = ycen;
+ *ppeak = valfit;
+ }
+ }
+ }
+#endif
+
+ if (code || valfit < valmax) {
+ cpl_errorstate_set(prestate);
+ *pxpos = xposcen;
+ *pypos = yposcen;
+ *ppeak = valmax;
+ }
+
+ return code ? cpl_error_set_where(cpl_func) : CPL_ERROR_NONE;
+}
+#endif
diff --git a/irplib/irplib_strehl.h b/irplib/irplib_strehl.h
index 4acce38..53462e5 100644
--- a/irplib/irplib_strehl.h
+++ b/irplib/irplib_strehl.h
@@ -42,6 +42,62 @@
#define IRPLIB_STREHL_BORDER 5
#endif
+/*----------------------------------------------------------------------------*/
+/**
+ @hideinitializer
+ @ingroup irplib_strehl
+ @brief The diameter of the primary mirror, [m]
+ @see irplib_strehl_compute()
+ */
+/*----------------------------------------------------------------------------*/
+#define IRPLIB_STREHL_M1 8.0
+/*----------------------------------------------------------------------------*/
+/**
+ @hideinitializer
+ @ingroup irplib_strehl
+ @brief The diameter of the secondary mirror, [m]
+ @see irplib_strehl_compute()
+ */
+/*----------------------------------------------------------------------------*/
+#define IRPLIB_STREHL_M2 1.1
+/*----------------------------------------------------------------------------*/
+/**
+ @hideinitializer
+ @ingroup irplib_strehl
+ @brief The size of the internally used PSF-image, [pixel]
+ @see irplib_strehl_compute()
+ */
+/*----------------------------------------------------------------------------*/
+#define IRPLIB_STREHL_BOX_SIZE 64
+
+/*----------------------------------------------------------------------------*/
+/**
+ @hideinitializer
+ @ingroup irplib_strehl
+ @brief The radius of the star, [Arcseconds]
+ @see irplib_strehl_compute()
+ */
+/*----------------------------------------------------------------------------*/
+#define IRPLIB_STREHL_STAR_RADIUS 2.0
+/*----------------------------------------------------------------------------*/
+/**
+ @hideinitializer
+ @ingroup irplib_strehl
+ @brief The inner radius of the noise-estimation region, [Arcseconds]
+ @see irplib_strehl_compute()
+ */
+/*----------------------------------------------------------------------------*/
+#define IRPLIB_STREHL_BACKGROUND_R1 2.0
+/*----------------------------------------------------------------------------*/
+/**
+ @hideinitializer
+ @ingroup irplib_strehl
+ @brief The outer radius of the noise-estimation region, [Arcseconds]
+ @see irplib_strehl_compute()
+ */
+/*----------------------------------------------------------------------------*/
+#define IRPLIB_STREHL_BACKGROUND_R2 3.0
+
typedef enum {
IRPLIB_BG_METHOD_AVER_REJ,
IRPLIB_BG_METHOD_MEDIAN
@@ -56,6 +112,7 @@ cpl_error_code irplib_strehl_compute(const cpl_image *, double, double, double,
double, double, double, int, int,
double *, double *, double *, double *,
double *, double *, double *, double *);
+
cpl_error_code irplib_strehl_mark_bad_and_compute(
cpl_image *, double, double, double,
double, double, int, double, double,
diff --git a/irplib/tests/Makefile.am b/irplib/tests/Makefile.am
index d9a33d8..8a403b4 100644
--- a/irplib/tests/Makefile.am
+++ b/irplib/tests/Makefile.am
@@ -43,6 +43,7 @@ check_PROGRAMS = irplib_wlxcorr-test \
irplib_utils-test \
irplib_framelist-test \
irplib_wcs-test \
+ irplib_strehl-test \
irplib_cat-test
irplib_wlxcorr_test_SOURCES = irplib_wlxcorr-test.c
@@ -77,6 +78,10 @@ irplib_cat_test_SOURCES = irplib_cat-test.c
irplib_cat_test_LDFLAGS = $(CPL_LDFLAGS) $(WCSLIB_LDFLAGS)
irplib_cat_test_LDADD = $(LDADD) $(LIBWCSLIB)
+irplib_strehl_test_SOURCES = irplib_strehl-test.c
+irplib_strehl_test_LDFLAGS = $(CPL_LDFLAGS) $(WCSLIB_LDFLAGS)
+irplib_strehl_test_LDADD = $(LDADD) $(LIBWCSLIB)
+
TESTS = $(check_PROGRAMS)
# Be sure to reexport important environment variables.
diff --git a/irplib/tests/Makefile.in b/irplib/tests/Makefile.in
index 850dca5..ad5a3a1 100644
--- a/irplib/tests/Makefile.in
+++ b/irplib/tests/Makefile.in
@@ -39,7 +39,7 @@ check_PROGRAMS = irplib_wlxcorr-test$(EXEEXT) \
irplib_hist-test$(EXEEXT) irplib_polynomial-test$(EXEEXT) \
irplib_plugin-test$(EXEEXT) irplib_utils-test$(EXEEXT) \
irplib_framelist-test$(EXEEXT) irplib_wcs-test$(EXEEXT) \
- irplib_cat-test$(EXEEXT)
+ irplib_strehl-test$(EXEEXT) irplib_cat-test$(EXEEXT)
subdir = irplib/tests
DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in
@@ -93,6 +93,12 @@ irplib_polynomial_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
irplib_polynomial_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(irplib_polynomial_test_LDFLAGS) $(LDFLAGS) -o $@
+am_irplib_strehl_test_OBJECTS = irplib_strehl-test.$(OBJEXT)
+irplib_strehl_test_OBJECTS = $(am_irplib_strehl_test_OBJECTS)
+irplib_strehl_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
+irplib_strehl_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(irplib_strehl_test_LDFLAGS) $(LDFLAGS) -o $@
am_irplib_utils_test_OBJECTS = irplib_utils-test.$(OBJEXT)
irplib_utils_test_OBJECTS = $(am_irplib_utils_test_OBJECTS)
irplib_utils_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
@@ -126,12 +132,14 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(irplib_cat_test_SOURCES) $(irplib_framelist_test_SOURCES) \
$(irplib_hist_test_SOURCES) $(irplib_plugin_test_SOURCES) \
- $(irplib_polynomial_test_SOURCES) $(irplib_utils_test_SOURCES) \
+ $(irplib_polynomial_test_SOURCES) \
+ $(irplib_strehl_test_SOURCES) $(irplib_utils_test_SOURCES) \
$(irplib_wcs_test_SOURCES) $(irplib_wlxcorr_test_SOURCES)
DIST_SOURCES = $(irplib_cat_test_SOURCES) \
$(irplib_framelist_test_SOURCES) $(irplib_hist_test_SOURCES) \
$(irplib_plugin_test_SOURCES) \
- $(irplib_polynomial_test_SOURCES) $(irplib_utils_test_SOURCES) \
+ $(irplib_polynomial_test_SOURCES) \
+ $(irplib_strehl_test_SOURCES) $(irplib_utils_test_SOURCES) \
$(irplib_wcs_test_SOURCES) $(irplib_wlxcorr_test_SOURCES)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@@ -221,6 +229,7 @@ LIBCPLDFS = @LIBCPLDFS@
LIBCPLDRS = @LIBCPLDRS@
LIBCPLUI = @LIBCPLUI@
LIBIRPLIB = @LIBIRPLIB@
+LIBKMCLIPMLIB = @LIBKMCLIPMLIB@
LIBKMOS = @LIBKMOS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@@ -353,6 +362,9 @@ irplib_wcs_test_LDADD = $(LDADD) $(LIBWCSLIB)
irplib_cat_test_SOURCES = irplib_cat-test.c
irplib_cat_test_LDFLAGS = $(CPL_LDFLAGS) $(WCSLIB_LDFLAGS)
irplib_cat_test_LDADD = $(LDADD) $(LIBWCSLIB)
+irplib_strehl_test_SOURCES = irplib_strehl-test.c
+irplib_strehl_test_LDFLAGS = $(CPL_LDFLAGS) $(WCSLIB_LDFLAGS)
+irplib_strehl_test_LDADD = $(LDADD) $(LIBWCSLIB)
TESTS = $(check_PROGRAMS)
# Be sure to reexport important environment variables.
@@ -420,6 +432,9 @@ irplib_plugin-test$(EXEEXT): $(irplib_plugin_test_OBJECTS) $(irplib_plugin_test_
irplib_polynomial-test$(EXEEXT): $(irplib_polynomial_test_OBJECTS) $(irplib_polynomial_test_DEPENDENCIES) $(EXTRA_irplib_polynomial_test_DEPENDENCIES)
@rm -f irplib_polynomial-test$(EXEEXT)
$(irplib_polynomial_test_LINK) $(irplib_polynomial_test_OBJECTS) $(irplib_polynomial_test_LDADD) $(LIBS)
+irplib_strehl-test$(EXEEXT): $(irplib_strehl_test_OBJECTS) $(irplib_strehl_test_DEPENDENCIES) $(EXTRA_irplib_strehl_test_DEPENDENCIES)
+ @rm -f irplib_strehl-test$(EXEEXT)
+ $(irplib_strehl_test_LINK) $(irplib_strehl_test_OBJECTS) $(irplib_strehl_test_LDADD) $(LIBS)
irplib_utils-test$(EXEEXT): $(irplib_utils_test_OBJECTS) $(irplib_utils_test_DEPENDENCIES) $(EXTRA_irplib_utils_test_DEPENDENCIES)
@rm -f irplib_utils-test$(EXEEXT)
$(irplib_utils_test_LINK) $(irplib_utils_test_OBJECTS) $(irplib_utils_test_LDADD) $(LIBS)
@@ -441,6 +456,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_hist-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_plugin-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_polynomial-test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_strehl-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_utils-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_wcs-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_wlxcorr-test.Po at am__quote@
diff --git a/irplib/tests/irplib_framelist-test.c b/irplib/tests/irplib_framelist-test.c
index a2a6bdc..1fb1c8d 100644
--- a/irplib/tests/irplib_framelist-test.c
+++ b/irplib/tests/irplib_framelist-test.c
@@ -46,6 +46,7 @@ int main(void)
irplib_framelist * flist;
irplib_framelist * nulllist;
+ cpl_frame * frm;
cpl_frameset * fset;
cpl_frameset * nullset;
int i;
@@ -91,6 +92,24 @@ int main(void)
cpl_test_zero(irplib_framelist_get_size(flist));
+ irplib_framelist_delete(flist);
+
+ frm = cpl_frame_new();
+ cpl_frame_set_filename(frm, "test.fits");
+ cpl_frame_set_tag(frm, "TEST");
+ cpl_frameset_insert(fset, frm);
+
+ flist = irplib_framelist_cast(fset);
+
+ cpl_test_eq(irplib_framelist_get_size(flist), 1);
+
+ irplib_framelist_delete(flist);
+
+ cpl_frameset_insert(fset, cpl_frame_duplicate(frm));
+ flist = irplib_framelist_cast(fset);
+
+ cpl_test_eq(irplib_framelist_get_size(flist), 2);
+
cpl_frameset_delete(fset);
irplib_framelist_delete(flist);
diff --git a/irplib/tests/irplib_polynomial-test.c b/irplib/tests/irplib_polynomial-test.c
index 33a50c9..2fa19c2 100644
--- a/irplib/tests/irplib_polynomial-test.c
+++ b/irplib/tests/irplib_polynomial-test.c
@@ -202,7 +202,7 @@ static void irplib_polynomial_solve_1d_all_test(void)
DBL_EPSILON, 2.0*DBL_EPSILON);
/* A more extreme case: Same with negative roots */
- (void)cpl_vector_fill(xtrue, -2.0e-3 * FLT_EPSILON);
+ (void)cpl_vector_fill(xtrue, -0.2 * FLT_EPSILON);
(void)cpl_vector_set(xtrue, 0, -1.0);
irplib_polynomial_test_root_all(xtrue, nreal, CPL_MATH_PI,
@@ -488,9 +488,9 @@ cpl_error_code irplib_polynomial_multiply_1d_factor(cpl_polynomial * self,
irplib_polynomial_multiply_1d_factor(self, aroot, 2);
- irplib_polynomial_multiply_scalar(copy, copy, b * b);
+ cpl_polynomial_multiply_scalar(copy, copy, b * b);
- irplib_polynomial_add(self, self, copy);
+ cpl_polynomial_add(self, self, copy);
cpl_vector_delete(aroot);
cpl_polynomial_delete(copy);
diff --git a/irplib/tests/irplib_strehl-test.c b/irplib/tests/irplib_strehl-test.c
new file mode 100644
index 0000000..103fd5b
--- /dev/null
+++ b/irplib/tests/irplib_strehl-test.c
@@ -0,0 +1,677 @@
+/* $Id: irplib_strehl-test.c,v 1.10 2013-01-29 08:43:33 jtaylor Exp $
+ *
+ * This file is part of the ESO Common Pipeline Library
+ * Copyright (C) 2001-2008 European Southern Observatory
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * $Author: jtaylor $
+ * $Date: 2013-01-29 08:43:33 $
+ * $Revision: 1.10 $
+ * $Name: not supported by cvs2svn $
+ */
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "irplib_strehl.h"
+
+/*-----------------------------------------------------------------------------
+ Defines
+ -----------------------------------------------------------------------------*/
+
+#ifndef IMAGESZ
+#define IMAGESZ 1024
+#endif
+
+#ifndef CWLEN
+#define CWLEN 1.6
+#endif
+
+#ifndef DWLEN
+#define DWLEN 0.05
+#endif
+
+#ifndef PIXSCALE
+#define PIXSCALE 12.25e-3
+#endif
+
+/*-----------------------------------------------------------------------------
+ Static functions
+ -----------------------------------------------------------------------------*/
+static void irplib_strehl_test_one(void);
+static void irplib_psf_test_one(int);
+static void irplib_psf_test(void);
+static cpl_image * irplib_strehl_create(cpl_size, cpl_size, cpl_type,
+ double, double, double);
+static void irplib_strehl_test(const cpl_image *, double, double,
+ double, double, double);
+
+static void irplib_strehl_test_fits(const char *, double, double, double);
+
+
+/*-----------------------------------------------------------------------------
+ Main
+ -----------------------------------------------------------------------------*/
+int main (int argc, char * argv[])
+{
+
+ int iarg;
+
+ cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
+
+ irplib_strehl_test_one();
+
+ for (iarg = 1; iarg < argc; iarg++) {
+ irplib_strehl_test_fits(argv[iarg], PIXSCALE, CWLEN, DWLEN);
+ }
+
+ irplib_psf_test();
+
+ return cpl_test_end(0);
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Test the strehl with a FITS-file and specific settings
+ @param file The FITS file to load
+ @param pixscale The pixel scale [Arcsecond]
+ @param lam The central wavelength [micron]
+ @param dlam The filter bandwidth [micron]
+
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_strehl_test_fits(const char * file, double pixscale,
+ double lam, double dlam)
+{
+
+ cpl_type type = CPL_TYPE_DOUBLE;
+ int i;
+
+ for (i = 0; i < 2; i++, type = CPL_TYPE_FLOAT) {
+
+ cpl_image * img = cpl_image_load(file, type, 0, 0);
+
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_nonnull(img);
+
+ cpl_msg_info(cpl_func, "Testing %s with pixel scale=%g, lam=%g, dlam=%g",
+ file, pixscale, lam, dlam);
+
+ irplib_strehl_test(img, 0.0, 10.0, pixscale, lam, dlam);
+
+ cpl_image_delete(img);
+ }
+}
+
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Test the strehl with specific settings
+
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_psf_test(void)
+{
+
+ const int is_bench = cpl_msg_get_level() <= CPL_MSG_INFO
+ ? CPL_TRUE : CPL_FALSE;
+
+ double tstop;
+ const double tstart = cpl_test_get_cputime();
+
+ int szstart = 4;
+ int szstop = is_bench ? IMAGESZ : IRPLIB_STREHL_BOX_SIZE * 2;
+
+ int isz, irep;
+
+ for (irep = 0; irep < (is_bench ? 3 : 1); irep++) {
+
+ for (isz = szstart; isz <= szstop; isz *= 2) {
+ irplib_psf_test_one(isz);
+ }
+ }
+
+ tstop = cpl_test_get_cputime() - tstart;
+
+ cpl_msg_info(cpl_func, "Time to generate %d set(s) of PSFs up to size "
+ "%d X %d [s]: %g", irep, szstop, szstop, tstop);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Test the strehl with specific settings
+
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_psf_test_one(int size)
+{
+ cpl_image * imgpsf = irplib_strehl_generate_psf(IRPLIB_STREHL_M1,
+ IRPLIB_STREHL_M2,
+ CWLEN, DWLEN, PIXSCALE,
+ size);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_nonnull(imgpsf);
+ cpl_test_eq(cpl_image_get_size_x(imgpsf),
+ cpl_image_get_size_y(imgpsf));
+
+ cpl_test_eq(cpl_image_get_size_x(imgpsf), size);
+
+ cpl_image_delete(imgpsf);
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Test the strehl with specific settings
+
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_strehl_test_one(void)
+{
+ cpl_type type = CPL_TYPE_DOUBLE;
+ int i;
+
+ for (i = 0; i < 2; i++, type = CPL_TYPE_FLOAT) {
+
+ cpl_image * img = irplib_strehl_create(IMAGESZ, IMAGESZ, type,
+ 1000.0, 1.0, 1.0);
+
+ irplib_strehl_test(img, 1000.0, 1.0, 0.03,
+ 2.18, 0.35); /* NACO values */
+
+ cpl_image_delete(img);
+ }
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Fill image for strehl testing
+ @param nx Image X-size
+ @param ny Image Y-size
+ @param type Image pixel type
+ @param norm norm of the gaussian.
+ @param sig_x Sigma in x for the gaussian distribution.
+ @param sig_y Sigma in y for the gaussian distribution.
+ @return The created image
+
+ */
+/*----------------------------------------------------------------------------*/
+static cpl_image * irplib_strehl_create(cpl_size nx, cpl_size ny,
+ cpl_type type,
+ double norm,
+ double sig_x,
+ double sig_y)
+{
+
+ const double noise = FLT_EPSILON;
+ cpl_size mx, my;
+ cpl_image * im1 = cpl_image_new(nx, ny, type);
+ cpl_error_code code;
+
+ code = cpl_image_fill_gaussian(im1, nx/2, ny/2, norm, sig_x, sig_y);
+ cpl_test_eq_error(code, CPL_ERROR_NONE);
+
+ if (noise != 0.0) {
+ cpl_image * im0 = cpl_image_new(nx, ny, CPL_TYPE_FLOAT);
+ code = cpl_image_fill_noise_uniform(im0, -noise, noise);
+ cpl_test_eq_error(code, CPL_ERROR_NONE);
+ code = cpl_image_subtract(im1, im0);
+ cpl_test_eq_error(code, CPL_ERROR_NONE);
+ cpl_image_delete(im0);
+ }
+
+ code = cpl_image_get_maxpos(im1, &mx, &my);
+ cpl_test_eq_error(code, CPL_ERROR_NONE);
+ cpl_test_eq(mx, nx/2);
+ cpl_test_eq(my, ny/2);
+
+ return im1;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @internal
+ @brief Test Strehl computation
+ @param norm norm of the gaussian, or zero
+ @param sigma The detection level
+ @param pixscale The pixel scale (arcsecs/pixel)
+ @param lam Central wavelength [micron]
+ @param dlam Filter bandwidth [micron]
+ @return void
+
+ */
+/*----------------------------------------------------------------------------*/
+static void irplib_strehl_test(const cpl_image * im1, double norm,
+ double sigma,
+ double pixscale, double lam, double dlam)
+{
+
+ const cpl_size nx = cpl_image_get_size_x(im1);
+ const cpl_size ny = cpl_image_get_size_y(im1);
+ cpl_error_code code;
+
+ /* Sigma-levels for detection of a bright star, copied from NACO */
+ const double psigmas[] = {sigma, sigma/2.0, sigma/4.0};
+ const size_t nsigmas = sizeof(psigmas)/sizeof(*psigmas);
+ cpl_size isigma;
+ cpl_vector * sigmas = cpl_vector_wrap(nsigmas, (double*)psigmas);
+ cpl_apertures * apert = NULL;
+ double fwhm_x, fwhm_y;
+ cpl_size mx, my;
+ cpl_image * imgpsf;
+
+ double strehl = 0.0, strehl_err = 0.0;
+ double star_bg = 0.0, star_peak = 0.0, star_flux = 0.0;
+ double psf_peak = 0.0, psf_flux = 0.0, bg_noise = 0.0;
+
+ const double star_radius = IRPLIB_STREHL_STAR_RADIUS;
+ const double background_1 = IRPLIB_STREHL_BACKGROUND_R1;
+ const double background_2 = IRPLIB_STREHL_BACKGROUND_R2;
+
+ code = cpl_image_get_maxpos(im1, &mx, &my);
+ cpl_test_eq_error(code, CPL_ERROR_NONE);
+ cpl_test_leq(mx - nx/4, mx);
+ cpl_test_leq(my - ny/4, my);
+ cpl_test_leq(mx, mx + nx/4);
+ cpl_test_leq(my, my + ny/4);
+
+ apert = cpl_apertures_extract_window(im1, sigmas,
+ mx - nx/4, my - ny/4,
+ mx + nx/4, my + ny/4,
+ &isigma);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_nonnull(apert);
+ cpl_test_zero(isigma);
+
+ cpl_apertures_delete(apert);
+ cpl_test_eq_ptr(cpl_vector_unwrap(sigmas), psigmas);
+
+ cpl_test_lt(0.0, pixscale);
+
+ code = cpl_image_get_fwhm(im1, mx, my, &fwhm_x, &fwhm_y);
+ cpl_test_eq_error(code, CPL_ERROR_NONE);
+
+ cpl_msg_info(cpl_func, "Expected star-radius vs. actual FWHM [pixel]: "
+ "%g <=> (%g, %g)", star_radius / pixscale,
+ fwhm_x, fwhm_y);
+
+ cpl_msg_debug(cpl_func, "Inner and outer radius of ring-zone for noise "
+ "estimate [pixel]: %g < %g", background_1 / pixscale,
+ background_2 / pixscale);
+
+
+ imgpsf = irplib_strehl_generate_psf(IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_nonnull(imgpsf);
+ cpl_test_eq(cpl_image_get_size_x(imgpsf),
+ cpl_image_get_size_y(imgpsf));
+
+ cpl_test_eq(cpl_image_get_size_x(imgpsf),
+ IRPLIB_STREHL_BOX_SIZE);
+
+ cpl_image_delete(imgpsf);
+
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ mx, my,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_NONE);
+ cpl_test_leq(0.0, strehl);
+ cpl_test_leq(strehl, 1.0);
+ cpl_test_leq(0.0, strehl_err);
+ if (norm > 0.0) {
+ cpl_test_rel(norm, star_flux, 0.01);
+ }
+
+ cpl_msg_info(cpl_func, "Strehl: ratio=%g, error=%g; Background: flux=%g, "
+ "noise=%g; Star: peak=%g, flux=%g; PSF: peak=%g, flux=%g",
+ strehl, strehl_err, star_bg, bg_noise, star_peak, star_flux,
+ psf_peak, psf_flux);
+
+ /* Test for various errors */
+
+ /* M2 < 0*/
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, 0.0,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT);
+
+
+ /* M1 < M2 */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M2, IRPLIB_STREHL_M1,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT);
+
+
+ /* lam = 0 */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ 0.0, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* dlam = 0 */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, 0.0, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* pixscale = 0 */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, 0.0,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* IRPLIB_STREHL_BOX_SIZE = 0 */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, pixscale,
+ 0,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* star_radius = 0 */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ 0.0,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* background_1 = 0 */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ 0.0,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* background_2 too small */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_1,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_ILLEGAL_INPUT);
+
+ /* strehl pointer is NULL */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ NULL,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT);
+
+ /* strehl_err pointer is NULL */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ NULL,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT);
+
+ /* star_bg pointer is NULL */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ NULL,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT);
+
+ /* star_peak pointer is NULL */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ NULL,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT);
+
+ /* psf_peak pointer is NULL */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ NULL,
+ &psf_flux,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT);
+
+ /* psf_flux pointer is NULL */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ NULL,
+ &bg_noise);
+ cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT);
+
+
+ /* bg_noise pointer is NULL */
+ code = irplib_strehl_compute(im1, IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
+ lam, dlam, pixscale,
+ IRPLIB_STREHL_BOX_SIZE,
+ nx/2, ny/2,
+ star_radius,
+ background_1,
+ background_2,
+ -1, -1,
+ &strehl,
+ &strehl_err,
+ &star_bg,
+ &star_peak,
+ &star_flux,
+ &psf_peak,
+ &psf_flux,
+ NULL);
+ cpl_test_eq_error(code, CPL_ERROR_NULL_INPUT);
+}
diff --git a/ChangeLog b/kmclipm/ChangeLog
similarity index 55%
copy from ChangeLog
copy to kmclipm/ChangeLog
index 014608c..83c723d 100644
--- a/ChangeLog
+++ b/kmclipm/ChangeLog
@@ -1,11 +1,120 @@
------------------------------------------------------------------
Releases
------------------------------------------------------------------
-v1.2.5 2013.10.14 - Several bug fixes, new kmo_multi_reconstruct, easySPARK_calibration.sh
-v1.2.4 2013.08.07 - Bug fix for installation on MacOSX
-v1.2.3 2013.08.02 - Bug fixes for SV1 data
-v1.2.2 2013.06.29 - Bug fixes in reconstruction and kmo_std_star
-v1.2.1 2013.06.20 - Bug fix in kmo_multi_reconstruct: Multiple angles in calibration frames were ignored
+v1.2.8 2013.12.12 - kmo_sci_red
+ - Adding the option to apply a fixed velocity offset when reconstructing cubes.
+ - Adding parameter --save_interims which can be used only together with
+ --no_sky_tweak. Interim reconstructed object and sky cubes are saved to disk as well.
+ - Adding the possibility to subtract skies from objects from different IFUs
+ (using the generated obj_sky_table.txt)
+ - kmo_std_star
+ - Bug fix: reducing templates with the 3-star configuration produced a
+ segmentation fault
+ - kmo_wave_cal
+ - Bug fix: in rare cases an error occurred calculating the QC parameters
+ (singular matrix)
+v1.2.7 2013.11.19 - kmo_combine, kmo_sci_red
+ - New additional output frame EXP_MASK: For every combined output
+ frame there is now as well an exposure time mask which indicates
+ for every spatial pixel how many input frames were taken into account
+ for combining.
+ - kmo_sci_red
+ - Bug fix: "checkerboard pattern" effect: rarely it could happen, that
+ single spaxels at the border of an IFU were spectral misfitted (only
+ with --imethod=CS). This effect normally to be overlooked, has a strong
+ effect when these cobes are combined after reconstruction. Then some kind
+ of checkerboard pattern could emerge in the corners of arbitrary IFUs.
+ - kmo_sci_red, kmo_multi_reconstruct
+ - The object-sky-association table is stored to disk as an intermediate
+ text file. It can be edited to alter the associated skies and then read
+ into the recipe again to apply it.
+ - kmo_combine
+ - Bug fix: when --ifus parameter wasn't defined and if the first IFU wasn't
+ used the recipe would create a segmentation fault
+ - Bug fix: when working with the --ifus parameter, the EXTNAME keyword could
+ get too long and the extension descriptor DATA/NOISE could be cut off. The
+ keyword is now truncated and DATA or NOISE is appended in every case. The
+ same naming convention applies to the craeted filenames (except that
+ DATA/NOISE isn't added).
+ - kmo_std_star
+ - The signal level of the extracted spectrum (in the masked area) is scaled to
+ the same level as the spectrum of the whole IFU (which is used for zeropoint
+ and throughput calculations). The user can now do his own calculations on
+ zeropoint, extracted spectrum etc., since they match now.
+ - New product: NOISE_SPEC (Only generated for data taken with template
+ KMOS_spec_cal_stdstarscipatt) The noise is estimated based on the sky exposures
+ present in all exposures: Skies are subtracted pairwise and reconstructed for
+ every IFU over all exposures. Then the spectra are extracted and for every
+ wavelength point the stddev is calculated and saved
+v1.2.6 2013.10.30 - kmo_illumination_flat
+ - New recipe creating an illumination correction based on FLAT_ON frames.
+ - kmo_reconstruct
+ - Bug fix: wrong calibration angles have been displayed, but the right ones
+ were processed (probably introduced with v1.2.5)
+v1.2.5 2013.10.14 - kmo_flat
+ - Bug fix: Enhanced edge detection taking into account deactivated IFUs which
+ are illuminated quite strongly.
+ - kmo_multi_reconstruct
+ - Accepts now like kmo_sci_red MASTER_FLAT and OH_SPEC frames, does proper sky
+ subtraction and optionally flux/background calibration. Telluric correction is
+ possible if the objects are on the same IFU for all exposures. Maps can't be reduced.
+ - kmo_sci_red
+ - Bug fix: Object names containing [ or ] couldn't be processed.
+ - sky_tweak
+ - Bug fix: With continuum missing on one side of the spectrum the code failed.
+ - easySPARK_calibration.sh
+ - The user is not asked anymore if the data should be processed in parallel/serial.
+ This option can be set via a parameter.
+ - After completion of processing a set of tests is executed to ensure integrity of
+ calibration products (easySPARK_test.sh)
+ - Added version numbers to easySPARK-scripts
+v1.2.4 2013.08.07 - kmo_wave_cal
+ - Bug fix: Sometimes DET_IMG_WAVE product wasn't calculated.
+ - SPARK-kit installation
+ - Bug fix: On MacOSX compilation of the kit failed.
+v1.2.3 2013.08.02 - kmo_sky_tweak
+ - New, advanced recipe for OH-line subtraction
+ - kmo_sci_red
+ - Bug fix: When using reflex it happend that only the IFUs containing the std-stars
+ were processed (in v1.2.2 this can be fixed by omitting STD_IMAGE from sof)
+ - Bug fix: TELLURIC frames generated with data from the 3star-template couldn't be
+ processed if the std-stars weren't at the default IFUs
+ - Enhanced handling of telluric corrections in general
+ - kmo_flat
+ - Fix: Due to the corrupted IFU 16, it occured in some FLAT_ON frames that IFU 15 was
+ vignetted strongly and not all edges could be identified. This is detected now and
+ IFU 15 will be omitted.
+ - kmo_illumination
+ - Bug fix: When data contains IFUs marked as NOTUSED and FLAT_EDGE frame is provided,
+ the recipe just fails without any notice. Without FLAT_EDGE frame the recipe runs through
+ - kmo_fits_strip
+ - Bug fix: Parameters noise and empty failed on sci_combine-products
+ - Added extension-parameter: Provide absolute extension numbers to strip all other extensions
+ - kmo_fits_check
+ - Now prints as well the number of empty extensions
+ - kmo_reconstruct, kmo_sci_red, kmo_std_star, kmo_illumination
+ - Increased verbosity on picked calibration frames. Emitting warnings when angles differ
+ too much
+ - xcal_interpolation is switched off automatically when interval of neighbouring angles is
+ larger than 65deg (for 6 equidistant rotator angles it would be 60deg)
+ - easySPARK-scripts
+ - Fixed bug: Now the frames needn't anymore be organised in directories with names like
+ YYYY-MM-DD
+ - Fixed bug: Now the scripts work as well on MacOSX
+v1.2.2 2013.06.29 - reconstruction
+ - Bug fix: the implementation of xcal_interpolation accidentially marked internally some
+ areas in the calibration frames as bad. Since these areas had a width of 1 pixel, they
+ were just interpolated from the neighbourhood. Now the values are a little bit more
+ correct.
+ - Bug fix: the implementation of cubic spline (CS) interpolation in the reconstruction of
+ data cubes led from time to time to misfitted spectra, mostly at the borders of the IFUs.
+ Pronounced spectral bell-curves were the result.
+ - kmo_std_star
+ - Bug fix: Due to the NGC using a wrong data type for CRPIX, CRVAL and CD keywords (integer
+ instead of double) in the RAW frames, no standard stars could be processed.
+v1.2.1 2013.06.20 - Bug fix in kmo_multi_reconstruct
+ - The new calibration format containing multiple angles was ignored processed wrongly. For
+ the calibration frames always the first angle present has been used in the past.
v1.2.0 2013.06.19 - (release for science verification)
- Reference Manual
- Updated version.
diff --git a/kmclipm/INSTALL b/kmclipm/INSTALL
new file mode 100644
index 0000000..54caf7c
--- /dev/null
+++ b/kmclipm/INSTALL
@@ -0,0 +1,229 @@
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+Foundation, Inc.
+
+ This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory. After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on. Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the `--target=TYPE' option to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+ Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+will cause the specified gcc to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+`configure' Invocation
+======================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
diff --git a/kmclipm/Makefile.am b/kmclipm/Makefile.am
new file mode 100644
index 0000000..c8a24bb
--- /dev/null
+++ b/kmclipm/Makefile.am
@@ -0,0 +1,66 @@
+## Process this file with automake to produce Makefile.in
+
+## This file is part of the irplib package
+## Copyright (C) 2002,2003 European Southern Observatory
+
+## This library 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+
+AUTOMAKE_OPTIONS = 1.8 foreign
+
+DISTCLEANFILES = *~
+
+SUBDIRS = test
+
+if MAINTAINER_MODE
+
+MAINTAINERCLEANFILES = Makefile.in
+
+endif
+
+#AM_CPPFLAGS = $(all_includes) -Iinclude
+#AM_CPPFLAGS = $(all_includes)
+INCLUDES = $(all_includes)
+
+noinst_HEADERS = include/kmclipm_compatibility_cpl.h \
+ include/kmclipm_constants.h \
+ include/kmclipm_math.h \
+ include/kmclipm_priv_error.h \
+ include/kmclipm_priv_reconstruct.h \
+ include/kmclipm_rtd_image.h \
+ include/kmclipm_version.h \
+ include/kmclipm_functions.h \
+ include/kmclipm_priv_constants.h \
+ include/kmclipm_priv_functions.h \
+ include/kmclipm_priv_splines.h \
+ include/kmclipm_vector.h
+
+pkginclude_HEADERS =
+
+noinst_LTLIBRARIES = libkmclipmlib.la
+
+libkmclipmlib_la_SOURCES = src/kmclipm_functions.c \
+ src/kmclipm_priv_constants.c \
+ src/kmclipm_priv_functions.c \
+ src/kmclipm_priv_splines.c \
+ src/kmclipm_vector.c \
+ src/kmclipm_math.c \
+ src/kmclipm_priv_error.c \
+ src/kmclipm_priv_reconstruct.c \
+ src/kmclipm_rtd_image.c \
+ src/kmclipm_version.c
+
+libkmclipmlib_la_LDFLAGS = $(CPL_LDFLAGS)
+libkmclipmlib_la_LIBADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE)
+libkmclipmlib_la_DEPENDENCIES =
diff --git a/kmos/Makefile.in b/kmclipm/Makefile.in
similarity index 68%
copy from kmos/Makefile.in
copy to kmclipm/Makefile.in
index b72ff37..ce4b765 100644
--- a/kmos/Makefile.in
+++ b/kmclipm/Makefile.in
@@ -36,9 +36,10 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-subdir = kmos
-DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \
- $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+subdir = kmclipm
+DIST_COMMON = README $(noinst_HEADERS) $(pkginclude_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog INSTALL \
+ TODO
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4macros/cpl.m4 \
$(top_srcdir)/m4macros/eso.m4 \
@@ -55,6 +56,39 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+am_libkmclipmlib_la_OBJECTS = kmclipm_functions.lo \
+ kmclipm_priv_constants.lo kmclipm_priv_functions.lo \
+ kmclipm_priv_splines.lo kmclipm_vector.lo kmclipm_math.lo \
+ kmclipm_priv_error.lo kmclipm_priv_reconstruct.lo \
+ kmclipm_rtd_image.lo kmclipm_version.lo
+libkmclipmlib_la_OBJECTS = $(am_libkmclipmlib_la_OBJECTS)
+libkmclipmlib_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libkmclipmlib_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/admin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libkmclipmlib_la_SOURCES)
+DIST_SOURCES = $(libkmclipmlib_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -82,51 +116,7 @@ am__uninstall_files_from_dir = { \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
-am__installdirs = "$(DESTDIR)$(privatelibdir)" \
- "$(DESTDIR)$(pkgincludedir)"
-LTLIBRARIES = $(privatelib_LTLIBRARIES)
-am__DEPENDENCIES_1 =
-am_libkmos_la_OBJECTS = kmo_cpl_extensions.lo kmo_debug.lo kmo_dfs.lo \
- kmo_functions.lo kmo_utils.lo kmo_priv_arithmetic.lo \
- kmo_priv_copy.lo kmo_priv_combine.lo \
- kmo_priv_multi_reconstruct.lo kmo_priv_dark.lo \
- kmo_priv_extract_spec.lo kmo_priv_fit_profile.lo \
- kmo_priv_fits_check.lo kmo_priv_fits_stack.lo kmo_priv_flat.lo \
- kmo_priv_functions.lo kmo_priv_make_image.lo \
- kmo_priv_noise_map.lo kmo_priv_reconstruct.lo \
- kmo_priv_rotate.lo kmo_priv_shift.lo kmo_priv_sky_mask.lo \
- kmo_priv_stats.lo kmo_priv_wave_cal.lo kmo_priv_std_star.lo \
- kmo_priv_lcorr.lo kmo_priv_sky_tweak.lo \
- kmo_test_create_data.lo 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
-libkmos_la_OBJECTS = $(am_libkmos_la_OBJECTS)
-libkmos_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(libkmos_la_LDFLAGS) $(LDFLAGS) -o $@
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/admin/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = $(libkmos_la_SOURCES)
-DIST_SOURCES = $(libkmos_la_SOURCES)
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
+am__installdirs = "$(DESTDIR)$(pkgincludedir)"
HEADERS = $(noinst_HEADERS) $(pkginclude_HEADERS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
@@ -216,6 +206,7 @@ LIBCPLDFS = @LIBCPLDFS@
LIBCPLDRS = @LIBCPLDRS@
LIBCPLUI = @LIBCPLUI@
LIBIRPLIB = @LIBIRPLIB@
+LIBKMCLIPMLIB = @LIBKMCLIPMLIB@
LIBKMOS = @LIBKMOS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@@ -319,92 +310,41 @@ wkfcopydir = @wkfcopydir@
wkfextradir = @wkfextradir@
AUTOMAKE_OPTIONS = 1.8 foreign
DISTCLEANFILES = *~
-SUBDIRS = tests
+SUBDIRS = test
@MAINTAINER_MODE_TRUE at MAINTAINERCLEANFILES = Makefile.in
-INCLUDES = $(all_includes) -I../kmclipm/include/
-noinst_HEADERS = kmo_constants.h \
- kmo_cpl_extensions.h \
- kmo_debug.h \
- kmo_dfs.h \
- kmo_error.h \
- kmo_functions.h \
- kmo_utils.h \
- kmo_priv_arithmetic.h \
- kmo_priv_combine.h \
- kmo_priv_multi_reconstruct.h \
- kmo_priv_copy.h \
- kmo_priv_dark.h \
- kmo_priv_extract_spec.h \
- kmo_priv_fit_profile.h \
- kmo_priv_fits_check.h \
- kmo_priv_fits_stack.h \
- kmo_priv_flat.h \
- kmo_priv_functions.h \
- kmo_priv_make_image.h \
- kmo_priv_noise_map.h \
- kmo_priv_reconstruct.h \
- kmo_priv_rotate.h \
- kmo_priv_shift.h \
- kmo_priv_sky_mask.h \
- kmo_priv_stats.h \
- kmo_priv_wave_cal.h \
- kmo_priv_std_star.h \
- kmo_priv_lcorr.h \
- kmo_priv_sky_tweak.h \
- kmo_test_create_data.h \
- ../kmclipm/include/kmclipm_compatibility_cpl.h \
- ../kmclipm/include/kmclipm_constants.h \
- ../kmclipm/include/kmclipm_functions.h \
- ../kmclipm/include/kmclipm_math.h \
- ../kmclipm/include/kmclipm_priv_constants.h \
- ../kmclipm/include/kmclipm_priv_error.h \
- ../kmclipm/include/kmclipm_priv_functions.h \
- ../kmclipm/include/kmclipm_priv_reconstruct.h \
- ../kmclipm/include/kmclipm_priv_splines.h \
- ../kmclipm/include/kmclipm_vector.h
+
+#AM_CPPFLAGS = $(all_includes) -Iinclude
+#AM_CPPFLAGS = $(all_includes)
+INCLUDES = $(all_includes)
+noinst_HEADERS = include/kmclipm_compatibility_cpl.h \
+ include/kmclipm_constants.h \
+ include/kmclipm_math.h \
+ include/kmclipm_priv_error.h \
+ include/kmclipm_priv_reconstruct.h \
+ include/kmclipm_rtd_image.h \
+ include/kmclipm_version.h \
+ include/kmclipm_functions.h \
+ include/kmclipm_priv_constants.h \
+ include/kmclipm_priv_functions.h \
+ include/kmclipm_priv_splines.h \
+ include/kmclipm_vector.h
pkginclude_HEADERS =
-privatelib_LTLIBRARIES = libkmos.la
-libkmos_la_SOURCES = kmo_cpl_extensions.c \
- kmo_debug.c \
- kmo_dfs.c \
- kmo_functions.c \
- kmo_utils.c \
- kmo_priv_arithmetic.c \
- kmo_priv_copy.c \
- kmo_priv_combine.c \
- kmo_priv_multi_reconstruct.c \
- kmo_priv_dark.c \
- kmo_priv_extract_spec.c \
- kmo_priv_fit_profile.c \
- kmo_priv_fits_check.c \
- kmo_priv_fits_stack.c \
- kmo_priv_flat.c \
- kmo_priv_functions.c \
- kmo_priv_make_image.c \
- kmo_priv_noise_map.c \
- kmo_priv_reconstruct.c \
- kmo_priv_rotate.c \
- kmo_priv_shift.c \
- kmo_priv_sky_mask.c \
- kmo_priv_stats.c \
- kmo_priv_wave_cal.c \
- kmo_priv_std_star.c \
- kmo_priv_lcorr.c \
- kmo_priv_sky_tweak.c \
- kmo_test_create_data.c \
- ../kmclipm/src/kmclipm_functions.c \
- ../kmclipm/src/kmclipm_math.c \
- ../kmclipm/src/kmclipm_priv_constants.c \
- ../kmclipm/src/kmclipm_priv_error.c \
- ../kmclipm/src/kmclipm_priv_functions.c \
- ../kmclipm/src/kmclipm_priv_reconstruct.c \
- ../kmclipm/src/kmclipm_priv_splines.c \
- ../kmclipm/src/kmclipm_vector.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_DEPENDENCIES = $(LIBIRPLIB)
+noinst_LTLIBRARIES = libkmclipmlib.la
+libkmclipmlib_la_SOURCES = src/kmclipm_functions.c \
+ src/kmclipm_priv_constants.c \
+ src/kmclipm_priv_functions.c \
+ src/kmclipm_priv_splines.c \
+ src/kmclipm_vector.c \
+ src/kmclipm_math.c \
+ src/kmclipm_priv_error.c \
+ src/kmclipm_priv_reconstruct.c \
+ src/kmclipm_rtd_image.c \
+ src/kmclipm_version.c
+
+libkmclipmlib_la_LDFLAGS = $(CPL_LDFLAGS)
+libkmclipmlib_la_LIBADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE)
+libkmclipmlib_la_DEPENDENCIES =
all: all-recursive
.SUFFIXES:
@@ -418,9 +358,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign kmos/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign kmclipm/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign kmos/Makefile
+ $(AUTOMAKE) --foreign kmclipm/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -439,39 +379,17 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
-install-privatelibLTLIBRARIES: $(privatelib_LTLIBRARIES)
- @$(NORMAL_INSTALL)
- test -z "$(privatelibdir)" || $(MKDIR_P) "$(DESTDIR)$(privatelibdir)"
- @list='$(privatelib_LTLIBRARIES)'; test -n "$(privatelibdir)" || list=; \
- list2=; for p in $$list; do \
- if test -f $$p; then \
- list2="$$list2 $$p"; \
- else :; fi; \
- done; \
- test -z "$$list2" || { \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(privatelibdir)'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(privatelibdir)"; \
- }
-
-uninstall-privatelibLTLIBRARIES:
- @$(NORMAL_UNINSTALL)
- @list='$(privatelib_LTLIBRARIES)'; test -n "$(privatelibdir)" || list=; \
- for p in $$list; do \
- $(am__strip_dir) \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(privatelibdir)/$$f'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(privatelibdir)/$$f"; \
- done
-clean-privatelibLTLIBRARIES:
- -test -z "$(privatelib_LTLIBRARIES)" || rm -f $(privatelib_LTLIBRARIES)
- @list='$(privatelib_LTLIBRARIES)'; for p in $$list; do \
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libkmos.la: $(libkmos_la_OBJECTS) $(libkmos_la_DEPENDENCIES) $(EXTRA_libkmos_la_DEPENDENCIES)
- $(libkmos_la_LINK) -rpath $(privatelibdir) $(libkmos_la_OBJECTS) $(libkmos_la_LIBADD) $(LIBS)
+libkmclipmlib.la: $(libkmclipmlib_la_OBJECTS) $(libkmclipmlib_la_DEPENDENCIES) $(EXTRA_libkmclipmlib_la_DEPENDENCIES)
+ $(libkmclipmlib_la_LINK) $(libkmclipmlib_la_OBJECTS) $(libkmclipmlib_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -486,35 +404,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_priv_functions.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_priv_reconstruct.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_priv_splines.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_rtd_image.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_vector.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_cpl_extensions.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_debug.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_dfs.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_functions.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_arithmetic.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_combine.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_copy.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_dark.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_extract_spec.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_fit_profile.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_fits_check.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_fits_stack.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_flat.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_functions.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_lcorr.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_make_image.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_multi_reconstruct.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_noise_map.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_reconstruct.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_rotate.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_shift.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_sky_mask.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_sky_tweak.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_stats.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_std_star.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_wave_cal.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_test_create_data.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_utils.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_version.Plo at am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -537,61 +429,75 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-kmclipm_functions.lo: ../kmclipm/src/kmclipm_functions.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_functions.lo -MD -MP -MF $(DEPDIR)/kmclipm_functions.Tpo -c -o kmclipm_functions.lo `test -f '../kmclipm/src/kmclipm_functions.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_functions.c
+kmclipm_functions.lo: src/kmclipm_functions.c
+ at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_functions.lo -MD -MP -MF $(DEPDIR)/kmclipm_functions.Tpo -c -o kmclipm_functions.lo `test -f 'src/kmclipm_functions.c' || echo '$(srcdir)/'`src/kmclipm_functions.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_functions.Tpo $(DEPDIR)/kmclipm_functions.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../kmclipm/src/kmclipm_functions.c' object='kmclipm_functions.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/kmclipm_functions.c' object='kmclipm_functions.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_functions.lo `test -f '../kmclipm/src/kmclipm_functions.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_functions.c
+ at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_functions.lo `test -f 'src/kmclipm_functions.c' || echo '$(srcdir)/'`src/kmclipm_functions.c
-kmclipm_math.lo: ../kmclipm/src/kmclipm_math.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_math.lo -MD -MP -MF $(DEPDIR)/kmclipm_math.Tpo -c -o kmclipm_math.lo `test -f '../kmclipm/src/kmclipm_math.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_math.c
- at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_math.Tpo $(DEPDIR)/kmclipm_math.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../kmclipm/src/kmclipm_math.c' object='kmclipm_math.lo' libtool=yes @AMDEPBACKSLASH@
+kmclipm_priv_constants.lo: src/kmclipm_priv_constants.c
+ at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_priv_constants.lo -MD -MP -MF $(DEPDIR)/kmclipm_priv_constants.Tpo -c -o kmclipm_priv_constants.lo `test -f 'src/kmclipm_priv_constants.c' || echo '$(srcdir)/'`src/kmclipm_priv_constants.c
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_priv_constants.Tpo $(DEPDIR)/kmclipm_priv_constants.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/kmclipm_priv_constants.c' object='kmclipm_priv_constants.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_math.lo `test -f '../kmclipm/src/kmclipm_math.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_math.c
+ at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_priv_constants.lo `test -f 'src/kmclipm_priv_constants.c' || echo '$(srcdir)/'`src/kmclipm_priv_constants.c
-kmclipm_priv_constants.lo: ../kmclipm/src/kmclipm_priv_constants.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_priv_constants.lo -MD -MP -MF $(DEPDIR)/kmclipm_priv_constants.Tpo -c -o kmclipm_priv_constants.lo `test -f '../kmclipm/src/kmclipm_priv_constants.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_priv_constants.c
- at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_priv_constants.Tpo $(DEPDIR)/kmclipm_priv_constants.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../kmclipm/src/kmclipm_priv_constants.c' object='kmclipm_priv_constants.lo' libtool=yes @AMDEPBACKSLASH@
+kmclipm_priv_functions.lo: src/kmclipm_priv_functions.c
+ at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_priv_functions.lo -MD -MP -MF $(DEPDIR)/kmclipm_priv_functions.Tpo -c -o kmclipm_priv_functions.lo `test -f 'src/kmclipm_priv_functions.c' || echo '$(srcdir)/'`src/kmclipm_priv_functions.c
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_priv_functions.Tpo $(DEPDIR)/kmclipm_priv_functions.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/kmclipm_priv_functions.c' object='kmclipm_priv_functions.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_priv_constants.lo `test -f '../kmclipm/src/kmclipm_priv_constants.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_priv_constants.c
+ at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_priv_functions.lo `test -f 'src/kmclipm_priv_functions.c' || echo '$(srcdir)/'`src/kmclipm_priv_functions.c
-kmclipm_priv_error.lo: ../kmclipm/src/kmclipm_priv_error.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_priv_error.lo -MD -MP -MF $(DEPDIR)/kmclipm_priv_error.Tpo -c -o kmclipm_priv_error.lo `test -f '../kmclipm/src/kmclipm_priv_error.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_priv_error.c
- at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_priv_error.Tpo $(DEPDIR)/kmclipm_priv_error.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../kmclipm/src/kmclipm_priv_error.c' object='kmclipm_priv_error.lo' libtool=yes @AMDEPBACKSLASH@
+kmclipm_priv_splines.lo: src/kmclipm_priv_splines.c
+ at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_priv_splines.lo -MD -MP -MF $(DEPDIR)/kmclipm_priv_splines.Tpo -c -o kmclipm_priv_splines.lo `test -f 'src/kmclipm_priv_splines.c' || echo '$(srcdir)/'`src/kmclipm_priv_splines.c
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_priv_splines.Tpo $(DEPDIR)/kmclipm_priv_splines.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/kmclipm_priv_splines.c' object='kmclipm_priv_splines.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_priv_error.lo `test -f '../kmclipm/src/kmclipm_priv_error.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_priv_error.c
+ at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_priv_splines.lo `test -f 'src/kmclipm_priv_splines.c' || echo '$(srcdir)/'`src/kmclipm_priv_splines.c
-kmclipm_priv_functions.lo: ../kmclipm/src/kmclipm_priv_functions.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_priv_functions.lo -MD -MP -MF $(DEPDIR)/kmclipm_priv_functions.Tpo -c -o kmclipm_priv_functions.lo `test -f '../kmclipm/src/kmclipm_priv_functions.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_priv_functions.c
- at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_priv_functions.Tpo $(DEPDIR)/kmclipm_priv_functions.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../kmclipm/src/kmclipm_priv_functions.c' object='kmclipm_priv_functions.lo' libtool=yes @AMDEPBACKSLASH@
+kmclipm_vector.lo: src/kmclipm_vector.c
+ at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_vector.lo -MD -MP -MF $(DEPDIR)/kmclipm_vector.Tpo -c -o kmclipm_vector.lo `test -f 'src/kmclipm_vector.c' || echo '$(srcdir)/'`src/kmclipm_vector.c
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_vector.Tpo $(DEPDIR)/kmclipm_vector.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/kmclipm_vector.c' object='kmclipm_vector.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_priv_functions.lo `test -f '../kmclipm/src/kmclipm_priv_functions.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_priv_functions.c
+ at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_vector.lo `test -f 'src/kmclipm_vector.c' || echo '$(srcdir)/'`src/kmclipm_vector.c
-kmclipm_priv_reconstruct.lo: ../kmclipm/src/kmclipm_priv_reconstruct.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_priv_reconstruct.lo -MD -MP -MF $(DEPDIR)/kmclipm_priv_reconstruct.Tpo -c -o kmclipm_priv_reconstruct.lo `test -f '../kmclipm/src/kmclipm_priv_reconstruct.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_priv_reconstruct.c
+kmclipm_math.lo: src/kmclipm_math.c
+ at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_math.lo -MD -MP -MF $(DEPDIR)/kmclipm_math.Tpo -c -o kmclipm_math.lo `test -f 'src/kmclipm_math.c' || echo '$(srcdir)/'`src/kmclipm_math.c
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_math.Tpo $(DEPDIR)/kmclipm_math.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/kmclipm_math.c' object='kmclipm_math.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_math.lo `test -f 'src/kmclipm_math.c' || echo '$(srcdir)/'`src/kmclipm_math.c
+
+kmclipm_priv_error.lo: src/kmclipm_priv_error.c
+ at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_priv_error.lo -MD -MP -MF $(DEPDIR)/kmclipm_priv_error.Tpo -c -o kmclipm_priv_error.lo `test -f 'src/kmclipm_priv_error.c' || echo '$(srcdir)/'`src/kmclipm_priv_error.c
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_priv_error.Tpo $(DEPDIR)/kmclipm_priv_error.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/kmclipm_priv_error.c' object='kmclipm_priv_error.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_priv_error.lo `test -f 'src/kmclipm_priv_error.c' || echo '$(srcdir)/'`src/kmclipm_priv_error.c
+
+kmclipm_priv_reconstruct.lo: src/kmclipm_priv_reconstruct.c
+ at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_priv_reconstruct.lo -MD -MP -MF $(DEPDIR)/kmclipm_priv_reconstruct.Tpo -c -o kmclipm_priv_reconstruct.lo `test -f 'src/kmclipm_priv_reconstruct.c' || echo '$(srcdir)/'`src/kmclipm_priv_reconstruct.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_priv_reconstruct.Tpo $(DEPDIR)/kmclipm_priv_reconstruct.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../kmclipm/src/kmclipm_priv_reconstruct.c' object='kmclipm_priv_reconstruct.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/kmclipm_priv_reconstruct.c' object='kmclipm_priv_reconstruct.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_priv_reconstruct.lo `test -f '../kmclipm/src/kmclipm_priv_reconstruct.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_priv_reconstruct.c
+ at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_priv_reconstruct.lo `test -f 'src/kmclipm_priv_reconstruct.c' || echo '$(srcdir)/'`src/kmclipm_priv_reconstruct.c
-kmclipm_priv_splines.lo: ../kmclipm/src/kmclipm_priv_splines.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_priv_splines.lo -MD -MP -MF $(DEPDIR)/kmclipm_priv_splines.Tpo -c -o kmclipm_priv_splines.lo `test -f '../kmclipm/src/kmclipm_priv_splines.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_priv_splines.c
- at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_priv_splines.Tpo $(DEPDIR)/kmclipm_priv_splines.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../kmclipm/src/kmclipm_priv_splines.c' object='kmclipm_priv_splines.lo' libtool=yes @AMDEPBACKSLASH@
+kmclipm_rtd_image.lo: src/kmclipm_rtd_image.c
+ at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_rtd_image.lo -MD -MP -MF $(DEPDIR)/kmclipm_rtd_image.Tpo -c -o kmclipm_rtd_image.lo `test -f 'src/kmclipm_rtd_image.c' || echo '$(srcdir)/'`src/kmclipm_rtd_image.c
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_rtd_image.Tpo $(DEPDIR)/kmclipm_rtd_image.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/kmclipm_rtd_image.c' object='kmclipm_rtd_image.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_priv_splines.lo `test -f '../kmclipm/src/kmclipm_priv_splines.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_priv_splines.c
+ at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_rtd_image.lo `test -f 'src/kmclipm_rtd_image.c' || echo '$(srcdir)/'`src/kmclipm_rtd_image.c
-kmclipm_vector.lo: ../kmclipm/src/kmclipm_vector.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_vector.lo -MD -MP -MF $(DEPDIR)/kmclipm_vector.Tpo -c -o kmclipm_vector.lo `test -f '../kmclipm/src/kmclipm_vector.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_vector.c
- at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_vector.Tpo $(DEPDIR)/kmclipm_vector.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../kmclipm/src/kmclipm_vector.c' object='kmclipm_vector.lo' libtool=yes @AMDEPBACKSLASH@
+kmclipm_version.lo: src/kmclipm_version.c
+ at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmclipm_version.lo -MD -MP -MF $(DEPDIR)/kmclipm_version.Tpo -c -o kmclipm_version.lo `test -f 'src/kmclipm_version.c' || echo '$(srcdir)/'`src/kmclipm_version.c
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/kmclipm_version.Tpo $(DEPDIR)/kmclipm_version.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/kmclipm_version.c' object='kmclipm_version.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_vector.lo `test -f '../kmclipm/src/kmclipm_vector.c' || echo '$(srcdir)/'`../kmclipm/src/kmclipm_vector.c
+ at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmclipm_version.lo `test -f 'src/kmclipm_version.c' || echo '$(srcdir)/'`src/kmclipm_version.c
mostlyclean-libtool:
-rm -f *.lo
@@ -815,7 +721,7 @@ check: check-recursive
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs: installdirs-recursive
installdirs-am:
- for dir in "$(DESTDIR)$(privatelibdir)" "$(DESTDIR)$(pkgincludedir)"; do \
+ for dir in "$(DESTDIR)$(pkgincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
@@ -852,7 +758,7 @@ maintainer-clean-generic:
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-recursive
-clean-am: clean-generic clean-libtool clean-privatelibLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
mostlyclean-am
distclean: distclean-recursive
@@ -873,8 +779,7 @@ info: info-recursive
info-am:
-install-data-am: install-pkgincludeHEADERS \
- install-privatelibLTLIBRARIES
+install-data-am: install-pkgincludeHEADERS
install-dvi: install-dvi-recursive
@@ -920,28 +825,26 @@ ps: ps-recursive
ps-am:
-uninstall-am: uninstall-pkgincludeHEADERS \
- uninstall-privatelibLTLIBRARIES
+uninstall-am: uninstall-pkgincludeHEADERS
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic clean-libtool \
- clean-privatelibLTLIBRARIES ctags ctags-recursive distclean \
+ clean-noinstLTLIBRARIES ctags ctags-recursive distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-pkgincludeHEADERS \
- install-privatelibLTLIBRARIES install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- installdirs-am maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am uninstall-pkgincludeHEADERS \
- uninstall-privatelibLTLIBRARIES
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-pkgincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/kmclipm/README b/kmclipm/README
new file mode 100644
index 0000000..81b36b7
--- /dev/null
+++ b/kmclipm/README
@@ -0,0 +1,59 @@
+------------------------------------------------------------------
+ In this file:
+------------------------------------------------------------------
+* About KMCLIPM
+* Prerequisites
+* Installation
+* Reporting Bugs
+
+------------------------------------------------------------------
+ About KMCLIPM
+------------------------------------------------------------------
+This module is an interface to the KMOS data reduction pipeline (DRS)
+and the KMOS instrument control software (ICS).
+DRS provides means to reconstruct exposures which ICS in return needs
+for displaying in the real time display (RTD).
+
+------------------------------------------------------------------
+ Prerequisites
+------------------------------------------------------------------
+- CPL 5.3.1 or higher (see http://www.eso.org/observing/cpl/)
+- ANSI-C compiler
+- UNIX Sh-Shell
+
+------------------------------------------------------------------
+ Installation
+------------------------------------------------------------------
+To install this library, THE FIRST thing is to decide where it shall be
+installed, on a VLT machine or under a standard UNIX environment.
+
+1.) VLT Installation
+On a VLT machine, run the commands below (for detailed information please refer
+to the user manual):
+
+ $ cd src/
+ $ make
+ $ make install
+
+2.) UNIX Installation
+On a UNIX machine or under a compatible environment, run the commands below (for
+detailed information please refer to the user manual):
+
+ $ ./configure --prefix=<install-directory>
+ $ make
+ $ make install
+
+Optionally, if the HTML reference manual should be created, execute also
+
+ $ cd doxygen
+ $ make html
+
+Finally, if the KMCLIPM was not installed in one of the standard system
+directories do not forget to add the location of the KMCLIPM library to
+your LD_LIBRARY_PATH variable or the equivalent for your system.
+
+------------------------------------------------------------------
+ Reporting Bugs
+------------------------------------------------------------------
+Please report any bugs to the ESO SPR system.
+
diff --git a/kmclipm/TODO b/kmclipm/TODO
new file mode 100644
index 0000000..e69de29
diff --git a/kmclipm/include/kmclipm_rtd_image.h b/kmclipm/include/kmclipm_rtd_image.h
new file mode 100644
index 0000000..14b7346
--- /dev/null
+++ b/kmclipm/include/kmclipm_rtd_image.h
@@ -0,0 +1,86 @@
+
+/*********************************************************************
+ * E.S.O. - VLT project
+ *
+ * "@(#) $Id: kmclipm_rtd_image.h,v 1.4 2012-06-26 08:44:15 aagudo Exp $"
+ *
+ * Main functions for the RTD.
+ *
+ * who when what
+ * -------- ---------- ----------------------------------------------
+ * aagudo 2007-10-19 created
+ * aagudo 2007-12-07 added kmclipm_rtd_image_from_memory()
+ */
+
+#ifndef KMCLIPM_RTD_IMAGE_H
+#define KMCLIPM_RTD_IMAGE_H
+
+/*------------------------------------------------------------------------------
+ * Includes
+ *----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+#include "kmclipm_functions.h"
+
+
+/*------------------------------------------------------------------------------
+ * Declaration Block
+ *----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int kmclipm_print_cal_files;
+
+/*------------------------------------------------------------------------------
+ * Prototypes
+ *----------------------------------------------------------------------------*/
+
+cpl_error_code kmclipm_rtd_image(
+ const cpl_image *actual_img,
+ const char *actual_img_type,
+ const char *additional_img_path,
+ const char *additional_img_type,
+ const int *ifu_id,
+ const double *nominal_pos,
+ const char *grating,
+ const char *filter,
+ const double rotator_offset,
+ kmclipm_fitpar *fitpar,
+ cpl_image **rtd_img,
+ cpl_image **patrol_img);
+
+cpl_error_code kmclipm_rtd_image_from_files(
+ const char *actual_img,
+ const char *actual_img_type,
+ const char *additional_img_path,
+ const char *additional_img_type,
+ const int *ifu_id,
+ const double *nominal_pos,
+ kmclipm_fitpar *fitpar,
+ cpl_image **rtd_img,
+ cpl_image **patrol_img);
+
+cpl_error_code kmclipm_rtd_image_from_memory(
+ const cpl_image *actual_img,
+ const char *actual_img_type,
+ const cpl_image *additional_img,
+ const char *additional_img_type,
+ const int *ifu_id,
+ const double *nominal_pos,
+ const char *grating,
+ const char *filter,
+ const double rotator_offset,
+ kmclipm_fitpar *fitpar,
+ cpl_image **rtd_img,
+ cpl_image **patrol_img);
+
+/*----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/kmclipm/include/kmclipm_version.h b/kmclipm/include/kmclipm_version.h
new file mode 100644
index 0000000..d451e8a
--- /dev/null
+++ b/kmclipm/include/kmclipm_version.h
@@ -0,0 +1,44 @@
+
+/*********************************************************************
+ * E.S.O. - VLT project
+ *
+ * "@(#) $Id: kmclipm_version.h,v 1.1.1.1 2012-01-18 09:32:30 yjung Exp $"
+ *
+ * Functions to access the kmclipm version information
+ *
+ * who when what
+ * -------- ---------- ----------------------------------------------
+ * author yyyy-mm-dd created
+ */
+
+#ifndef KMCLIPM_VERSION_H
+#define KMCLIPM_VERSION_H
+
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ Declaration Block
+ -----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*-----------------------------------------------------------------------------
+ Prototypes
+ -----------------------------------------------------------------------------*/
+
+const char *kmclipm_version_get_revision(void);
+
+const char *kmclipm_version_get_date(void);
+
+/*----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* KMCLIPM_VERSION_H */
diff --git a/kmclipm/src/kmclipm_functions.c b/kmclipm/src/kmclipm_functions.c
index 00ad0d4..721aa5a 100644
--- a/kmclipm/src/kmclipm_functions.c
+++ b/kmclipm/src/kmclipm_functions.c
@@ -3388,8 +3388,8 @@ double kmclipm_cal_propertylist_find_angle(const char *filename,
ax = 0,
ext_type = 0,
pl_device = 0,
- has_left = FALSE,
- has_right = FALSE,
+ has_left = FALSE, /* left in the sense of looking from the circle center... */
+ has_right = FALSE, /* right: the same */
index_closest = 0,
index_2nd_closest = 0,
first_pos = 0;
@@ -3474,7 +3474,9 @@ double kmclipm_cal_propertylist_find_angle(const char *filename,
kmclipm_vector_set(ext_vec, ax, ix);
kmclipm_vector_set(diff_vec, ax, tmp_diff);
- if (fabs(angle_in+tmp_diff-tmp_angle) < 0.01) {
+ double tmp_dbl = angle_in + tmp_diff;
+ kmclipm_strip_angle(&tmp_dbl);
+ if (fabs(tmp_dbl - tmp_angle) < 0.01) {
/* to the right*/
kmclipm_vector_set(dir_vec, ax, 1);
has_right = TRUE;
diff --git a/kmclipm/src/kmclipm_priv_constants.c b/kmclipm/src/kmclipm_priv_constants.c
index 6aa6cfc..4fee2fb 100644
--- a/kmclipm/src/kmclipm_priv_constants.c
+++ b/kmclipm/src/kmclipm_priv_constants.c
@@ -24,7 +24,6 @@
#include "kmclipm_constants.h"
#include "kmclipm_priv_constants.h"
-/*#include "kmclipm_compatibility_replacements.h"*/
/*------------------------------------------------------------------------------
* Global Debugging Variables
diff --git a/kmclipm/src/kmclipm_priv_functions.c b/kmclipm/src/kmclipm_priv_functions.c
index 2be95ee..5445855 100644
--- a/kmclipm/src/kmclipm_priv_functions.c
+++ b/kmclipm/src/kmclipm_priv_functions.c
@@ -50,7 +50,6 @@
#include <cpl.h>
-/*#include "kmclipm_compatibility_replacements.h"*/
#include "kmclipm_constants.h"
#include "kmclipm_functions.h"
#include "kmclipm_priv_constants.h"
diff --git a/kmclipm/src/kmclipm_priv_reconstruct.c b/kmclipm/src/kmclipm_priv_reconstruct.c
index 7e68224..7913e15 100644
--- a/kmclipm/src/kmclipm_priv_reconstruct.c
+++ b/kmclipm/src/kmclipm_priv_reconstruct.c
@@ -36,7 +36,6 @@
#include <cpl.h>
-/*#include "kmclipm_compatibility_replacements.h"*/
#include "kmclipm_priv_error.h"
#include "kmclipm_constants.h"
#include "kmclipm_functions.h"
diff --git a/kmclipm/src/kmclipm_priv_splines.c b/kmclipm/src/kmclipm_priv_splines.c
index 3917f02..242fd12 100644
--- a/kmclipm/src/kmclipm_priv_splines.c
+++ b/kmclipm/src/kmclipm_priv_splines.c
@@ -1009,7 +1009,7 @@ double *polynomial_irreg_reg_nonans(
remove_2nans(nin, xi, yi, &new_size, &x, &y);
tmpVals = polynomial_irreg_reg(new_size, x, y,
nout, xo0, dxo, order);
- cpl_free(x); cpl_free(y);
+ cpl_free(x); cpl_free(y);
}
KMCLIPM_CATCH
{
@@ -1117,13 +1117,45 @@ double *polynomial_irreg_irreg_nonans(
@param dy xxx
@return xxx
*/
-double polynomial_interpolation (double xi[], double yi[], int n,
- double x, double *dy)
+double polynomial_interpolation (double xi[],
+ double yi[],
+ int n,
+ double x,
+ double *dy)
{
- int i = 0, m = 0, ns = 0;
- double den = 0., dif = 0., dift = 0., ho = 0., hp = 0., w = 0.;
- double *c = NULL, *d = NULL;
- double y = 0;
+ int i = 0,
+ m = 0,
+ ns = 0;
+ double den = 0.,
+ dif = 0.,
+ dift = 0.,
+ ho = 0.,
+ hp = 0.,
+ w = 0.,
+ *c = NULL,
+ *d = NULL,
+ y = 0.,
+ median = 0.;
+ cpl_vector *ll = NULL;
+
+ if (n == 0) {
+ return NAN;
+ } else {
+ /* this is to get rid of wrong polynomial fitting, if there are large steps
+ * in xi due to NaN-removal excercised beforehand if the NaNs are left in,
+ * the fit will go mad at the end. Even worse: when combining the cubes in a
+ * map afterwards, it can happen, that a checkerboard pattern is arising occasionally!
+ */
+ ll = cpl_vector_new(n-1);
+ for (i = 0; i < n-1; i++) {
+ cpl_vector_set(ll, i, xi[i]-xi[i+1]);
+ }
+ median = cpl_vector_get_median(ll);
+ cpl_vector_delete(ll); ll = NULL;
+ if (fabs(xi[0]-xi[n-1]) > fabs(median*(n-1)*1.5)) {
+ return NAN;
+ }
+ }
dif=fabs(x-xi[0]);
c=vector(n);
@@ -1136,6 +1168,7 @@ double polynomial_interpolation (double xi[], double yi[], int n,
c[i]=yi[i];
d[i]=yi[i];
}
+
y=yi[ns--];
for (m=1;m<n;m++) {
for (i=0;i<n-m;i++) {
@@ -1151,6 +1184,7 @@ double polynomial_interpolation (double xi[], double yi[], int n,
}
free_vector(d);
free_vector(c);
+
return y;
}
diff --git a/kmclipm/src/kmclipm_rtd_image.c b/kmclipm/src/kmclipm_rtd_image.c
new file mode 100644
index 0000000..1130ff9
--- /dev/null
+++ b/kmclipm/src/kmclipm_rtd_image.c
@@ -0,0 +1,1189 @@
+
+/*********************************************************************
+ * E.S.O. - VLT project
+ *
+ * "@(#) $Id: kmclipm_rtd_image.c,v 1.48 2013-10-08 14:55:01 erw Exp $"
+ *
+ * Main functions for the RTD.
+ *
+ * who when what
+ * -------- ---------- ----------------------------------------------
+ * aagudo 2007-10-19 created
+ * aagudo 2007-12-07 in kmclipm_rtd_image(): the rtd_image created
+ * now uses RTD_GAP defined in
+ * kmclipm_priv_constants.h
+ * aagudo 2007-12-07 added kmclipm_rtd_image_from_memory()
+ * aagudo 2008-01-09 fixed bugs in:
+ * kmclipm_test_rtd_image(),
+ * kmclipm_test_rtd_image_from_files()
+ * kmclipm_test_rtd_image_from_memory(): when no sky was
+ * supplied, these functions were not correctly handled
+ */
+
+/**
+ @defgroup kmclipm_rtd_image RTD image functions
+
+ This module provides the main functions to create RTD- and PatrolView-images.
+
+ @par Synopsis:
+ @code
+ #include <kmclipm_rtd_image.h>
+ @endcode
+ @{
+ */
+
+/*------------------------------------------------------------------------------
+ * Includes
+ *----------------------------------------------------------------------------*/
+
+#define _ISOC99_SOURCE
+
+#include <cpl.h>
+#include <math.h>
+#include <string.h>
+#include <time.h>
+
+#include "kmclipm_rtd_image.h"
+#include "kmclipm_math.h"
+#include "kmclipm_functions.h"
+#include "kmclipm_priv_functions.h"
+#include "kmclipm_constants.h"
+#include "kmclipm_priv_constants.h"
+#include "kmclipm_priv_reconstruct.h"
+#include "kmclipm_priv_error.h"
+
+int kmclipm_print_cal_files = 0;
+
+/*------------------------------------------------------------------------------
+ * Functions code
+ *----------------------------------------------------------------------------*/
+
+/**
+ @brief Creates the RTD- and PatrolView-images. Reads actual image from
+ shared memory.
+ @param actual_img Pointer to the raw detector-image which resides
+ actually in shared memory. Can be of type
+ @c "TARG" or @c "SKY"
+ @param actual_img_type The type of the actually loaded image (@c "TARG"
+ or @c "SKY").
+ @param additional_img_path @em OPTIONAL: The full path to an additional raw
+ detector-image. Can be of type @c "TARG" or
+ @c "SKY", but not of the same type as parameter
+ @c actual_img_type .
+ If no additional image is required pass
+ @c "NOT_AVAILABLE".
+ @param additional_img_type @em OPTIONAL: The type of the additional image
+ to load (@c "TARG" or @c "SKY", but not of the
+ same type as parameter @c actual_img_type ). If
+ no additional image is required pass
+ @c "NOT_AVAILABLE" .
+ @param ifu_id The array indicating which IFUs actually have to
+ be processed and if target and sky are switched.
+ The array has to be of type and size
+ <tt>int[KMOS_NR_IFUS + 1]</tt>. The first
+ value is not used, so <tt>ifu_id[i]</tt>
+ designates IFU @c i. If the IFU should be
+ processed, set the corresponding value to @c 1,
+ otherwise to @c 0 . If target and sky are
+ switched the value must be @c 2 .
+ @param nominal_pos The array indicating the nominal positions of
+ the IFUs. The array has to be of type and
+ size <tt>double[2 * KMOS_NR_IFUS + 2]</tt>. The
+ first and second values are not used, so
+ <tt>nominal_pos[2 * i]</tt> designates the
+ x-position of IFU @c i and
+ <tt>nominal_pos[2 * i + 1]</tt> designates the
+ y-position. The unit of the values is
+ in millimeters.
+ @param grating Not used yet.
+ @param filter The filter used: Either "IZ", "YJ", "H", "K" or
+ "HK"
+ @param rotator_offset The rotator offset angle.
+ @param fitpar @em OUTPUT: A struct containing all fit-parameters.
+ Must be deallocated with kmclipm_free_fitpar().
+ @param rtd_img @em OUTPUT: An image with tiled IFU-images.
+ The returned image has to be deallocated with
+ @c cpl_image_delete().
+ @param patrol_img @em OUTPUT: An image containing the PatrolView
+ with IFU-images placed at positions defined in
+ @c nominal_pos .
+ The returned image has to be deallocated with
+ @c cpl_image_delete().
+ @return CPL_ERROR_NONE or the relevant _cpl_error_code_ on error.
+
+ Possible _cpl_error_code_ set in this function:
+
+ @li CPL_ERROR_NULL_INPUT if any input is NULL.
+ @li CPL_ERROR_ILLEGAL_INPUT actual_img_type or additional_img_type are not
+ valid.
+
+ This function is written as recipe as defined in the ESO Document
+ VLT-TRE-KMO-146611-003 (KMOS Data Reduction Library Design), it will also be
+ used in the Data Reduction Pipeline.
+
+ The parameters @c pix_pos, @c errors and @c intensity have to be deallocated
+ with @c cpl_free().
+ The parameters @c rtd_img and @c patrol_img have to be deallocated with
+ @c cpl_image_delete().
+ */
+
+cpl_error_code kmclipm_rtd_image(const cpl_image *actual_img,
+ const char *actual_img_type,
+ const char *additional_img_path,
+ const char *additional_img_type,
+ const int *ifu_id,
+ const double *nominal_pos,
+ const char *grating,
+ const char *filter,
+ const double rotator_offset,
+ kmclipm_fitpar *fitpar,
+ cpl_image **rtd_img,
+ cpl_image **patrol_img)
+{
+
+ cpl_error_code error = CPL_ERROR_NONE;
+ cpl_image *additional_img = NULL;
+
+ KMCLIPM_TRY
+ {
+ if (additional_img_path == NULL) {
+ KMCLIPM_TRY_CHECK_AUTOMSG(strcmp(additional_img_type, "NOT_AVAILABLE") == 0,
+ CPL_ERROR_NULL_INPUT);
+ }
+
+ /* just following two inputs are checked, the other are checked in
+ kmclipm_rtd_image_from_memory() */
+ if ((strcmp(additional_img_path, "NOT_AVAILABLE") != 0) &&
+ (strcmp(additional_img_type, "NOT_AVAILABLE") != 0))
+ {
+
+ KMCLIPM_TRY_CHECK_AUTOMSG(additional_img_path != NULL,
+ CPL_ERROR_NULL_INPUT);
+
+ KMCLIPM_TRY_EXIT_IFN(
+ additional_img = kmclipm_load_image_with_extensions(additional_img_path));
+ }
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_rtd_image_from_memory(actual_img,
+ actual_img_type,
+ additional_img,
+ additional_img_type,
+ ifu_id,
+ nominal_pos,
+ grating,
+ filter,
+ rotator_offset,
+ fitpar,
+ rtd_img,
+ patrol_img));
+ }
+ KMCLIPM_CATCH
+ {
+ error = KMCLIPM_ERROR_GET_NEW_SINCE_TRY();
+ }
+
+ cpl_image_delete(additional_img); additional_img = NULL;
+
+ return error;
+}
+
+/**
+ @internal
+ @brief Creates the RTD- and PatrolView-images. Reads both images from file.
+
+ <em>This function is intended for testing purposes only. </em>
+
+ The only difference to @li kmclipm_rtd_image is, that the actual image is
+ also read from disk instead out of the shared memory.
+
+ @param actual_img_path Path to the actual raw detector-image. Can be of
+ type @c "TARG" or @c "SKY"
+ @param actual_img_type The type of the actually loaded image (@c "TARG"
+ or @c "SKY").
+ @param additional_img_path @em OPTIONAL: The full path to an additional raw
+ detector-image. Can be of type @c "TARG" or
+ @c "SKY", but not of the same type as parameter
+ @c actual_img_type .
+ If no additional image is required pass
+ @c "NOT_AVAILABLE".
+ @param additional_img_type @em OPTIONAL: The type of the additional image
+ to load (@c "TARG" or @c "SKY", but not of the
+ same type as parameter @c actual_img_type ). If
+ no additional image is required pass
+ @c "NOT_AVAILABLE" .
+ @param ifu_id The array indicating which IFUs actually have to
+ be processed and if target and sky are switched.
+ The array has to be of type and size
+ <tt>int[KMOS_NR_IFUS + 1]</tt>. The first
+ value is not used, so <tt>ifu_id[i]</tt>
+ designates IFU @c i. If the IFU should be
+ processed, set the corresponding value to @c 1,
+ otherwise to @c 0 . If target and sky are
+ switched the value must be @c 2 .
+ @param nominal_pos The array indicating the nominal positions of
+ the IFUs. The array has to be of type and
+ size <tt>double[2 * KMOS_NR_IFUS + 2]</tt>. The
+ first and second values are not used, so
+ <tt>nominal_pos[2 * i]</tt> designates the
+ x-position of IFU @c i and
+ <tt>nominal_pos[2 * i + 1]</tt> designates the
+ y-position. The unit of the values is
+ in millimeters.
+ @param grating Not used yet.
+ @param filter The filter used: Either "IZ", "YJ", "H", "K" or
+ "HK"
+ @param rotator_offset The rotator offset angle.
+ @param fitpar @em OUTPUT: A struct containing all fit-parameters.
+ Must be deallocated with kmclipm_free_fitpar().
+ @param rtd_img @em OUTPUT: An image with tiled IFU-images.
+ The returned image has to be deallocated with
+ @c cpl_image_delete().
+ @param patrol_img @em OUTPUT: An image containing the PatrolView
+ with IFU-images placed at positions defined in
+ @c nominal_pos .
+ The returned image has to be deallocated with
+ @c cpl_image_delete().
+
+ @return CPL_ERROR_NONE or the relevant _cpl_error_code_ on error.
+
+ Possible _cpl_error_code_ set in this function:
+
+ @li CPL_ERROR_NULL_INPUT if any input is NULL.
+ @li CPL_ERROR_ILLEGAL_INPUT actual_img_type or additional_img_type are not
+ valid.
+
+ The parameters @c pix_pos, @c errors and @c intensity have to be deallocated
+ with @c cpl_free().
+ The parameters @c rtd_img and @c patrol_img have to be deallocated with
+ @c cpl_image_delete().
+ */
+cpl_error_code kmclipm_rtd_image_from_files(const char *actual_img_path,
+ const char *actual_img_type,
+ const char *additional_img_path,
+ const char *additional_img_type,
+ const int *ifu_id,
+ const double *nominal_pos,
+ kmclipm_fitpar *fitpar,
+ cpl_image **rtd_img,
+ cpl_image **patrol_img)
+{
+ cpl_error_code error = CPL_ERROR_NONE;
+ cpl_image *actual_img = NULL;
+ cpl_image *additional_img = NULL;
+ const char *grating = NULL,
+ *filter = NULL;
+ char *tmp = NULL;
+ double rotator_offset = 0.;
+ cpl_propertylist *pl = NULL;
+
+
+ KMCLIPM_TRY
+ {
+ KMCLIPM_TRY_CHECK_AUTOMSG((actual_img_path != NULL) &&
+ (additional_img_path != NULL),
+ CPL_ERROR_NULL_INPUT);
+
+ KMCLIPM_TRY_EXIT_IFN(
+ actual_img = kmclipm_load_image_with_extensions(actual_img_path));
+
+ KMCLIPM_TRY_EXIT_IFN(
+ pl = kmclipm_propertylist_load(actual_img_path, 0));
+
+ if ((strcmp(additional_img_path, "NOT_AVAILABLE") != 0) &&
+ (strcmp(additional_img_type, "NOT_AVAILABLE") != 0))
+ {
+ KMCLIPM_TRY_EXIT_IFN(
+ additional_img = kmclipm_load_image_with_extensions(additional_img_path));
+ }
+
+ KMCLIPM_TRY_EXIT_IFN(
+ tmp = cpl_sprintf("%s%d%s", IFU_GRATID_PREFIX, 1, IFU_GRATID_POSTFIX));
+ KMCLIPM_TRY_EXIT_IFN(
+ grating = cpl_propertylist_get_string(pl, tmp));
+ cpl_free(tmp); tmp = NULL;
+
+ KMCLIPM_TRY_EXIT_IFN(
+ tmp = cpl_sprintf("%s%d%s", IFU_FILTID_PREFIX, 1, IFU_FILTID_POSTFIX));
+ KMCLIPM_TRY_EXIT_IFN(
+ filter = cpl_propertylist_get_string(pl, tmp));
+ cpl_free(tmp); tmp = NULL;
+
+ rotator_offset = cpl_propertylist_get_double(pl, ROTANGLE);
+ KMCLIPM_TRY_CHECK_ERROR_STATE();
+
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_rtd_image_from_memory(actual_img,
+ actual_img_type,
+ additional_img,
+ additional_img_type,
+ ifu_id,
+ nominal_pos,
+ grating,
+ filter,
+ rotator_offset,
+ fitpar,
+ rtd_img,
+ patrol_img));
+ }
+ KMCLIPM_CATCH
+ {
+ error = KMCLIPM_ERROR_GET_NEW_SINCE_TRY();
+ }
+
+ cpl_image_delete(actual_img); actual_img = NULL;
+ cpl_image_delete(additional_img); additional_img = NULL;
+ cpl_propertylist_delete(pl); pl = NULL;
+
+ return error;
+}
+
+/**
+ @internal
+ @brief Creates the RTD- and PatrolView-images. Reads both images from
+ shared memory.
+
+ <em>This function is intended for testing purposes only. </em>
+
+ The only difference to @li kmclipm_rtd_image is, that the actual image as
+ well the additional image are read from shared memory.
+
+ @param actual_img Pointer to the raw detector-image which resides
+ actually in shared memory. Can be of type
+ @c "TARG" or @c "SKY"
+ @param actual_img_type The type of the actually loaded image (@c "TARG"
+ or @c "SKY").
+ @param additional_img @em OPTIONAL: Pointer to an additional raw
+ detector-image. Can be of type @c "TARG" or
+ @c "SKY", but not of the same type as parameter
+ @c actual_img_type .
+ If no additional image is required pass
+ @c NULL.
+ @param additional_img_type @em OPTIONAL: The type of the additional image
+ to load (@c "TARG" or @c "SKY", but not of the
+ same type as parameter @c actual_img_type ). If
+ no additional image is required pass
+ @c "NOT_AVAILABLE" .
+ @param ifu_id The array indicating which IFUs actually have to
+ be processed and if target and sky are switched.
+ The array has to be of type and size
+ <tt>int[KMOS_NR_IFUS + 1]</tt>. The first
+ value is not used, so <tt>ifu_id[i]</tt>
+ designates IFU @c i. If the IFU should be
+ processed, set the corresponding value to @c 1,
+ otherwise to @c 0 . If target and sky are
+ switched the value must be @c 2 .
+ @param nominal_pos The array indicating the nominal positions of
+ the IFUs. The array has to be of type and
+ size <tt>double[2 * KMOS_NR_IFUS + 2]</tt>. The
+ first and second values are not used, so
+ <tt>nominal_pos[2 * i]</tt> designates the
+ x-position of IFU @c i and
+ <tt>nominal_pos[2 * i + 1]</tt> designates the
+ y-position. The unit of the values is
+ in millimeters.
+ @param grating Not used yet.
+ @param filter The filter used: Either "IZ", "YJ", "H", "K" or
+ "HK"
+ @param rotator_offset The rotator offset angle.
+ @param fitpar @em OUTPUT: A struct containing all fit-parameters.
+ Must be deallocated with kmclipm_free_fitpar().
+ @param rtd_img @em OUTPUT: An image with tiled IFU-images.
+ The returned image has to be deallocated with
+ @c cpl_image_delete().
+ @param patrol_img @em OUTPUT: An image containing the PatrolView
+ with IFU-images placed at positions defined in
+ @c nominal_pos .
+ The returned image has to be deallocated with
+ @c cpl_image_delete().
+
+ @return CPL_ERROR_NONE or the relevant _cpl_error_code_ on error.
+
+ Possible _cpl_error_code_ set in this function:
+
+ @li CPL_ERROR_NULL_INPUT if any input is NULL.
+ @li CPL_ERROR_ILLEGAL_INPUT actual_img_type or additional_img_type are not
+ valid.
+
+ The parameters @c pix_pos, @c errors and @c intensity have to be deallocated
+ with @c cpl_free().
+ The parameters @c rtd_img and @c patrol_img have to be deallocated with
+ @c cpl_image_delete().
+ */
+cpl_error_code kmclipm_rtd_image_from_memory(const cpl_image *actual_img,
+ const char *actual_img_type,
+ const cpl_image *additional_img,
+ const char *additional_img_type,
+ const int *ifu_id,
+ const double *nominal_pos,
+ const char *grating,
+ const char *filter,
+ const double rotator_offset,
+ kmclipm_fitpar *fitpar,
+ cpl_image **rtd_img,
+ cpl_image **patrol_img)
+{
+/*------------------------------------------------------------------------------
+ * Initialisation & input parameter checking
+ *----------------------------------------------------------------------------*/
+
+ int j = 0,
+ det_nr = 0,
+ ifu_nr = 0,
+ *bounds = NULL,
+ ts_lut_valid = FALSE,
+ lx = 0,
+ rx = 0,
+ nr_sat = 0,
+ mask_saturated_pixels = FALSE,
+ ifu_id_copy[KMOS_NR_IFUS + 1];
+ float val = 0.0,
+ out_val = 0.0;
+ double median = 0.0,
+ neighborhoodRange = 1.001,
+ angle_found = 0.,
+ fitted_pars[11];
+ char *temp_path = NULL,
+ *fn_xcal = NULL,
+ *fn_ycal = NULL,
+ *fn_lcal = NULL,
+ *fn_lut = NULL,
+ *fn_wave_band = NULL,
+ *filt = NULL,
+ *grat = NULL;
+ enum reconstructMethod method = NEAREST_NEIGHBOR;
+ gridDefinition gd;
+ cpl_error_code error = CPL_ERROR_NONE;
+ cpl_propertylist *main_header = NULL,
+ *pl = NULL;
+ cpl_vector *calAngles = NULL;
+ cpl_image *made_image = NULL,
+ *nan_image = NULL,
+ *ifu_img = NULL,
+ *xcal_img = NULL,
+ *ycal_img = NULL,
+ *lcal_img = NULL,
+ *xcal_ifu = NULL,
+ *ycal_ifu = NULL,
+ *lcal_ifu = NULL,
+ *obj_ifu = NULL,
+ *sky_ifu = NULL,
+ *target_img_det = NULL,
+ *sky_img_det = NULL;
+ cpl_imagelist *cube = NULL,
+ *ifu_image_list = NULL,
+ *cube_noise = NULL;
+ cpl_array *ts_cal = NULL;
+ cpl_table *band_table = NULL;
+
+
+ KMCLIPM_TRY
+ {
+ fitpar->background = NULL;
+ fitpar->background_error = NULL;
+ fitpar->fwhm = NULL;
+ fitpar->fwhm_error = NULL;
+ fitpar->intensity = NULL;
+ fitpar->intensity_error = NULL;
+ fitpar->xpos = NULL;
+ fitpar->xpos_error = NULL;
+ fitpar->ypos = NULL;
+ fitpar->ypos_error = NULL;
+ fitpar->nr_saturated_pixels=NULL;
+
+ if (getenv("RTD_CHECK_FOR_SATURATION") != NULL) {
+ mask_saturated_pixels = TRUE;
+ }
+
+ if ((getenv("KMCLIPM_DEBUG") != NULL) &&
+ (strcmp(getenv("KMCLIPM_DEBUG"), "") != 0))
+ {
+ /* $KMCLIPM_DEBUG is set, so write file */
+ system("mkdir -p $KMCLIPM_DEBUG/tmp");
+ system("echo '-----------------------------------------------------"
+ "----' >> $KMCLIPM_DEBUG/tmp/kmclipm_fitpar.txt");
+ system("date >> $KMCLIPM_DEBUG/tmp/kmclipm_fitpar.txt");
+ char *cmd = cpl_sprintf("echo 'Filt: %s, grat: %s, angle: %g, "
+ "act_img: %p (type: %s), add_img: %p (type: %s), "
+ "ifu_id: %p, nominal_pos: %p'"
+ " >> $KMCLIPM_DEBUG/tmp/kmclipm_fitpar.txt",
+ filter, grating, rotator_offset,
+ actual_img, actual_img_type,
+ additional_img, additional_img_type,
+ ifu_id, nominal_pos);
+ system(cmd);
+ cpl_free(cmd); cmd = NULL;
+ system("echo '#IFU "
+ "intens "
+ "(err) "
+ "x0 "
+ "(err) "
+ "y0 "
+ "(err) "
+ "fwhm "
+ "(err) "
+ "offset "
+ "(err)' >> $KMCLIPM_DEBUG/tmp/kmclipm_fitpar.txt");
+ }
+
+/*------------------------------------------------------------------------------
+ * Check if input parameters are not equal NULL
+ *----------------------------------------------------------------------------*/
+ KMCLIPM_TRY_CHECK_AUTOMSG(actual_img != NULL,
+ CPL_ERROR_NULL_INPUT);
+ KMCLIPM_TRY_CHECK_AUTOMSG(kmclipm_is_nan_or_inf(rotator_offset) == FALSE,
+ CPL_ERROR_ILLEGAL_INPUT);
+ KMCLIPM_TRY_CHECK_AUTOMSG(ifu_id != NULL,
+ CPL_ERROR_NULL_INPUT);
+ KMCLIPM_TRY_CHECK_AUTOMSG(nominal_pos != NULL,
+ CPL_ERROR_NULL_INPUT);
+ KMCLIPM_TRY_CHECK_AUTOMSG(grating != NULL,
+ CPL_ERROR_NULL_INPUT);
+ KMCLIPM_TRY_EXIT_IFN(
+ grat = cpl_sprintf("%s", grating));
+ KMCLIPM_TRY_CHECK_AUTOMSG(filter != NULL,
+ CPL_ERROR_NULL_INPUT);
+ KMCLIPM_TRY_EXIT_IFN(
+ filt = cpl_sprintf("%s", filter));
+ KMCLIPM_TRY_CHECK_AUTOMSG((strcmp(filt, "IZ") == 0) ||
+ (strcmp(filt, "YJ") == 0) ||
+ (strcmp(filt, "H") == 0) ||
+ (strcmp(filt, "K") == 0) ||
+ (strcmp(filt, "HK") == 0),
+ CPL_ERROR_ILLEGAL_INPUT);
+ KMCLIPM_TRY_CHECK_AUTOMSG(strcmp(actual_img_type, additional_img_type) != 0,
+ CPL_ERROR_ILLEGAL_INPUT);
+
+ /* check state of image in memory
+ * Input image is duplicated, since input image is
+ * const & shouldn't be changed */
+ if (strcmp(actual_img_type ,"TARG") == 0) {
+ KMCLIPM_TRY_EXIT_IFN(
+ target_img_det = cpl_image_duplicate(actual_img));
+ } else if (strcmp(actual_img_type, "SKY") == 0) {
+ KMCLIPM_TRY_EXIT_IFN(
+ sky_img_det = cpl_image_duplicate(actual_img));
+ } else {
+ KMCLIPM_TRY_EXIT_WITH_ERROR(CPL_ERROR_ILLEGAL_INPUT);
+ }
+
+ /* check state of additional image */
+ if ((strcmp(additional_img_type, "TARG") == 0) &&
+ (strcmp(actual_img_type, "SKY") == 0))
+ {
+ if (additional_img == NULL) {
+ KMCLIPM_TRY_EXIT_WITH_ERROR(CPL_ERROR_NULL_INPUT);
+ }
+ KMCLIPM_TRY_EXIT_IFN(
+ target_img_det = cpl_image_duplicate(additional_img));
+ }
+ else if ((strcmp(additional_img_type, "SKY") == 0) &&
+ (strcmp(actual_img_type, "TARG") == 0))
+ {
+ if (additional_img == NULL) {
+ KMCLIPM_TRY_EXIT_WITH_ERROR(CPL_ERROR_NULL_INPUT);
+ }
+ KMCLIPM_TRY_EXIT_IFN(
+ sky_img_det = cpl_image_duplicate(additional_img));
+ }
+ else if (strcmp(additional_img_type, "NOT_AVAILABLE") == 0) {
+ ; /* do nothing */
+ } else {
+ KMCLIPM_TRY_EXIT_WITH_ERROR(CPL_ERROR_ILLEGAL_INPUT);
+ }
+
+/*------------------------------------------------------------------------------
+ * Allocations
+ *----------------------------------------------------------------------------*/
+
+ KMCLIPM_TRY_EXIT_IFN(
+ ifu_image_list = cpl_imagelist_new());
+
+ /* allocate memory for return values, has to be freed by caller! */
+ KMCLIPM_TRY_EXIT_IFN(
+ fitpar->xpos = cpl_malloc((1 + KMOS_NR_IFUS) * sizeof(double)));
+ KMCLIPM_TRY_EXIT_IFN(
+ fitpar->xpos_error = cpl_malloc((1 + KMOS_NR_IFUS) * sizeof(double)));
+ KMCLIPM_TRY_EXIT_IFN(
+ fitpar->ypos = cpl_malloc((1 + KMOS_NR_IFUS) * sizeof(double)));
+ KMCLIPM_TRY_EXIT_IFN(
+ fitpar->ypos_error = cpl_malloc((1 + KMOS_NR_IFUS) * sizeof(double)));
+ KMCLIPM_TRY_EXIT_IFN(
+ fitpar->intensity = cpl_malloc((1 + KMOS_NR_IFUS) * sizeof(double)));
+ KMCLIPM_TRY_EXIT_IFN(
+ fitpar->intensity_error = cpl_malloc((1 + KMOS_NR_IFUS) * sizeof(double)));
+ KMCLIPM_TRY_EXIT_IFN(
+ fitpar->fwhm = cpl_malloc((1 + KMOS_NR_IFUS) * sizeof(double)));
+ KMCLIPM_TRY_EXIT_IFN(
+ fitpar->fwhm_error = cpl_malloc((1 + KMOS_NR_IFUS) * sizeof(double)));
+ KMCLIPM_TRY_EXIT_IFN(
+ fitpar->background = cpl_malloc((1 + KMOS_NR_IFUS) * sizeof(double)));
+ KMCLIPM_TRY_EXIT_IFN(
+ fitpar->background_error = cpl_malloc((1 + KMOS_NR_IFUS) * sizeof(double)));
+ KMCLIPM_TRY_EXIT_IFN(
+ fitpar->nr_saturated_pixels = cpl_malloc((1 + KMOS_NR_IFUS) * sizeof(long int)));
+
+ /* initialise values */
+ for (j = 0; j < 1 + KMOS_NR_IFUS; j++) {
+ fitpar->xpos[j] = -1.0;
+ fitpar->xpos_error[j] = -1.0;
+ fitpar->ypos[j] = -1.0;
+ fitpar->ypos_error[j] = -1.0;
+ fitpar->intensity[j] = -1.0;
+ fitpar->intensity_error[j] = -1.0;
+ fitpar->fwhm[j] = -1.0;
+ fitpar->fwhm_error[j] = -1.0;
+ fitpar->background[j] = -1.0;
+ fitpar->background_error[j] = -1.0;
+ fitpar->nr_saturated_pixels[j] = 0;
+ }
+
+ /* generate image with nan all over */
+ KMCLIPM_TRY_EXIT_IFN(
+ nan_image = cpl_image_new(KMOS_SLITLET_X, KMOS_SLITLET_Y, CPL_TYPE_FLOAT));
+
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ cpl_image_fill_gaussian(nan_image, 0.0, 0.0, 0.0, 0.0, 0.0));
+
+ for(j = 1; j < KMOS_NR_IFUS + 1; j++) {
+ ifu_id_copy[j] = ifu_id[j];
+ }
+
+
+/*------------------------------------------------------------------------------
+ * Retrieve matching calibration files
+ *----------------------------------------------------------------------------*/
+
+ /* check, if we are in test mode. If yes: take always the same K-band
+ * data with rot_off=0 regardless which band has been provided by the
+ * user
+ */
+ if (kmclipm_cal_test_mode == -1) {
+ strcpy(kmclipm_cal_file_path, "");
+ kmclipm_cal_test_mode = FALSE;
+ }
+ if (strcmp(kmclipm_cal_file_path, "") != 0) {
+ /* append a trailing "/" if there isn't one
+ (only when cal_file_path isn't empty)*/
+ if (strcmp(kmclipm_cal_file_path+strlen(kmclipm_cal_file_path)-1, "/") != 0) {
+ strcat(kmclipm_cal_file_path, "/");
+ }
+ }
+
+ /* setup calibration filenames */
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_priv_find_angle(rotator_offset, &filt, &grat,
+ &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut));
+ if (kmclipm_cal_test_mode == FALSE) {
+ cpl_free(fn_xcal);
+ cpl_free(fn_ycal);
+ cpl_free(fn_lcal);
+ cpl_free(fn_lut);
+ fn_xcal = cpl_sprintf("%sxcal_%s%s%s.fits", kmclipm_get_cal_path(),grat,grat,grat);
+ fn_ycal = cpl_sprintf("%sycal_%s%s%s.fits", kmclipm_get_cal_path(),grat,grat,grat);
+ fn_lcal = cpl_sprintf("%slcal_%s%s%s.fits", kmclipm_get_cal_path(),grat,grat,grat);
+ fn_lut = cpl_sprintf("%slut_%s%s%s", kmclipm_get_cal_path(),grat,grat,grat);
+ }
+
+
+ fn_wave_band = cpl_sprintf("%s%s", kmclipm_cal_file_path, "kmos_wave_band.fits");
+ pl = kmclipm_propertylist_load(fn_wave_band, 0);
+ KMCLIPM_TRY_CHECK_AUTOMSG(pl != NULL, CPL_ERROR_NULL_INPUT);
+ cpl_propertylist_delete(pl); pl = NULL;
+
+ if (kmclipm_print_cal_files != 0) {
+ printf("%s\n", fn_xcal);
+ printf("%s\n", fn_ycal);
+ printf("%s\n", fn_lcal);
+ printf("%s\n", fn_lut);
+ printf("%s\n", fn_wave_band);
+ }
+
+ /* setup grid */
+ KMCLIPM_TRY_EXIT_IFN(
+ band_table = kmclipm_table_load(fn_wave_band, 1, 0));
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_priv_setup_grid(&gd, method, neighborhoodRange, KMOS_PIX_RESOLUTION, 0.));
+
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_setup_grid_band(&gd, filt, band_table));
+ cpl_table_delete(band_table);
+
+ const char* method_environment_variable = "RTD_RECONSTRUCT_METHOD";
+ if (getenv(method_environment_variable) != NULL) {
+ char *rtd_reconstruct_method = getenv(method_environment_variable);
+ if (strcmp(rtd_reconstruct_method, "NN") == 0) {
+ gd.method = NEAREST_NEIGHBOR;
+ } else if (strcmp(rtd_reconstruct_method, "LWNN") == 0) {
+ gd.method = LINEAR_WEIGHTED_NEAREST_NEIGHBOR;
+ } else if (strcmp(rtd_reconstruct_method, "SWNN") == 0) {
+ gd.method = SQUARE_WEIGHTED_NEAREST_NEIGHBOR;
+ } else if (strcmp(rtd_reconstruct_method, "CS") == 0) {
+ gd.method = CUBIC_SPLINE;
+ } else if (strcmp(rtd_reconstruct_method, "MS") == 0) {
+ gd.method = MODIFIED_SHEPARDS_METHOD;
+ } else if (strcmp(rtd_reconstruct_method, "QI") == 0) {
+ gd.method = QUADRATIC_INTERPOLATION;
+ }
+ }
+
+ /* get timestamps of xcal, ycal & lcal */
+ KMCLIPM_TRY_EXIT_IFN(
+ ts_cal = cpl_array_new(3,CPL_TYPE_STRING));
+ KMCLIPM_TRY_EXIT_IFN(
+ main_header = kmclipm_propertylist_load(fn_xcal, 0));
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ cpl_array_set_string(ts_cal, 0, cpl_propertylist_get_string(main_header, DATE)));
+ KMCLIPM_TRY_EXIT_IFN(
+ bounds = kmclipm_extract_bounds(main_header));
+ cpl_propertylist_delete(main_header); main_header = NULL;
+
+ KMCLIPM_TRY_EXIT_IFN(
+ main_header = kmclipm_propertylist_load(fn_ycal, 0));
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ cpl_array_set_string(ts_cal, 1, cpl_propertylist_get_string(main_header, DATE)));
+ cpl_propertylist_delete(main_header); main_header = NULL;
+
+ KMCLIPM_TRY_EXIT_IFN(
+ main_header = kmclipm_propertylist_load(fn_lcal, 0));
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ cpl_array_set_string(ts_cal, 2, cpl_propertylist_get_string(main_header, DATE)));
+ cpl_propertylist_delete(main_header); main_header = NULL;
+
+ /* create CAL ROT angle vector */
+ KMCLIPM_TRY_EXIT_IFN(
+ calAngles = cpl_vector_new(3));
+
+/*------------------------------------------------------------------------------
+ * - Split detector-frames into raw IFU-frames
+ * - reconstruct cubes & make images
+ * - Calculate pixel positions of targets & errors of IFUs
+ *----------------------------------------------------------------------------*/
+ /* update ifu_id-vector in respect to bounds-vector:
+ * it is possible that in ifu_id an IFU is marked valid and that it
+ * hasn't been detected in kmclipm_extract_bounds().
+ * In this case print a warning and set ifu_id for this IFU to zero
+ */
+ for (j = 0; j < KMOS_NR_IFUS; j++) {
+ if ((bounds[2*j] == -1) &&
+ (bounds[2*j+1]== -1) &&
+ (ifu_id_copy[j+1] > 0))
+ {
+ ifu_id_copy[j+1] = 0;
+ cpl_msg_warning("kmclipm_rtd_image",
+ "IFU %d could not be detected and will "
+ "therefore not be reconstructed!", j+1);
+ }
+ }
+
+ /* loop through all detectors */
+ for (det_nr = 1; det_nr <= KMOS_NR_DETECTORS; det_nr++) {
+ /* load calibration files */
+ KMCLIPM_TRY_EXIT_IFN(
+ xcal_img = kmclipm_cal_image_load(fn_xcal, CPL_TYPE_FLOAT, 0, det_nr, 0,
+ rotator_offset, &angle_found, NULL));
+ cpl_vector_set(calAngles, 0, angle_found);
+ KMCLIPM_TRY_EXIT_IFN(
+ ycal_img = kmclipm_cal_image_load(fn_ycal, CPL_TYPE_FLOAT, 0, det_nr, 0,
+ rotator_offset, &angle_found, NULL));
+ cpl_vector_set(calAngles, 1, angle_found);
+ KMCLIPM_TRY_EXIT_IFN(
+ lcal_img = kmclipm_cal_image_load(fn_lcal, CPL_TYPE_FLOAT, 0, det_nr, 0,
+ rotator_offset, &angle_found, NULL));
+ cpl_vector_set(calAngles, 2, angle_found);
+
+ for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++)
+ {
+ ifu_nr = (det_nr-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
+
+ if (ifu_id_copy[ifu_nr] > 0) {
+ /* if target or sky is present, extract calibration regions*/
+ if ((target_img_det != NULL) || (sky_img_det != NULL)) {
+ KMCLIPM_TRY_EXIT_IFN(
+ xcal_ifu = cpl_image_extract(xcal_img,
+ bounds[2*(ifu_nr-1)],
+ 1,
+ bounds[2*(ifu_nr-1)+1],
+ KMOS_DETECTOR_SIZE));
+
+ KMCLIPM_TRY_EXIT_IFN(
+ ycal_ifu = cpl_image_extract(ycal_img,
+ bounds[2*(ifu_nr-1)],
+ 1,
+ bounds[2*(ifu_nr-1)+1],
+ KMOS_DETECTOR_SIZE));
+
+ KMCLIPM_TRY_EXIT_IFN(
+ lcal_ifu = cpl_image_extract(lcal_img,
+ bounds[2*(ifu_nr-1)],
+ 1,
+ bounds[2*(ifu_nr-1)+1],
+ KMOS_DETECTOR_SIZE));
+ }
+
+ /* modifiy bounds to extract IFUs from target and sky since
+ * these two frames have the 3 detectors collated one to the
+ * other
+ */
+ if (det_nr == 1) {
+ lx = bounds[2*(ifu_nr-1)];
+ rx = bounds[2*(ifu_nr-1)+1];
+ } else if (det_nr == 2) {
+ lx = bounds[2*(ifu_nr-1)] + KMOS_DETECTOR_SIZE;
+ rx = bounds[2*(ifu_nr-1)+1] + KMOS_DETECTOR_SIZE;
+ } else if (det_nr == 3) {
+ lx = bounds[2*(ifu_nr-1)] + 2*KMOS_DETECTOR_SIZE;
+ rx = bounds[2*(ifu_nr-1)+1] + 2*KMOS_DETECTOR_SIZE;
+ }
+
+ /* prepare reconstruction */
+ ts_lut_valid = kmclipm_reconstruct_check_lut(fn_lut, ifu_nr, gd,
+ ts_cal, calAngles);
+
+ /* extract regions of specific IFU for obj- and sky-frame */
+ if (target_img_det != NULL) {
+ KMCLIPM_TRY_EXIT_IFN(
+ obj_ifu = cpl_image_extract(target_img_det,
+ lx, 1,
+ rx, KMOS_DETECTOR_SIZE));
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_reject_saturated_pixels(obj_ifu,
+ mask_saturated_pixels,
+ &nr_sat));
+ fitpar->nr_saturated_pixels[ifu_nr] += nr_sat;
+ }
+ if (sky_img_det != NULL) {
+ KMCLIPM_TRY_EXIT_IFN(
+ sky_ifu = cpl_image_extract(sky_img_det,
+ lx, 1,
+ rx, KMOS_DETECTOR_SIZE));
+
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_reject_saturated_pixels(sky_ifu,
+ mask_saturated_pixels,
+ &nr_sat));
+ fitpar->nr_saturated_pixels[ifu_nr] += nr_sat;
+ }
+
+ /* subtract sky- from target-image before reconstructing */
+ if ((obj_ifu != NULL) && (sky_ifu != NULL)) {
+ if (ifu_id_copy[ifu_nr] == 1) {
+ /* target is in obj_ifu */
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ cpl_image_subtract(obj_ifu, sky_ifu));
+
+ cpl_image_delete(sky_ifu); sky_ifu = NULL;
+ } else if (ifu_id_copy[ifu_nr] == 2) {
+ /* target is in sky_ifu */
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ cpl_image_subtract(sky_ifu, obj_ifu));
+
+ cpl_image_delete(obj_ifu); obj_ifu = sky_ifu; sky_ifu = NULL;
+ } else {
+ cpl_msg_error("", "ifu_id[%d] must be 0 or 1 (is %d)", ifu_nr, ifu_id_copy[ifu_nr]);
+ KMCLIPM_TRY_EXIT_WITH_ERROR(CPL_ERROR_ILLEGAL_INPUT);
+ }
+ } else if ((obj_ifu == NULL) && (sky_ifu != NULL)) {
+ obj_ifu = sky_ifu; sky_ifu = NULL;
+ }
+
+ /* reconstruct now */
+ KMCLIPM_TRY_EXIT_IFN(
+ cube = kmclipm_reconstruct(ifu_nr, obj_ifu, NULL,
+ xcal_ifu, ycal_ifu, lcal_ifu,
+ gd, fn_lut,
+ ts_lut_valid, ts_cal, calAngles,
+ &cube_noise));
+
+ /* save extracted images to disk if option is set
+ * (saved FITS file will have at maximum 5 extensions:
+ * obj, sky, xcal, ycal, lcal
+ */
+ if (kmclipm_priv_get_output_extracted_images() == TRUE) {
+ KMCLIPM_TRY_EXIT_IFN(
+ temp_path = cpl_sprintf("%sextracted_img_%d.fits",
+ kmclipm_priv_get_output_path(),
+ ifu_nr));
+
+ if (obj_ifu != NULL) {
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_image_save(obj_ifu, temp_path,
+ CPL_BPP_IEEE_FLOAT,
+ NULL, CPL_IO_DEFAULT, NAN));
+ }
+
+ if (sky_ifu != NULL) {
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_image_save(sky_ifu, temp_path,
+ CPL_BPP_IEEE_FLOAT,
+ NULL, CPL_IO_EXTEND, NAN));
+ }
+
+ if (xcal_ifu != NULL) {
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_image_save(xcal_ifu, temp_path,
+ CPL_BPP_IEEE_FLOAT,
+ NULL, CPL_IO_EXTEND, NAN));
+ }
+
+ if (ycal_ifu != NULL) {
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_image_save(ycal_ifu, temp_path,
+ CPL_BPP_IEEE_FLOAT,
+ NULL, CPL_IO_EXTEND, NAN));
+ }
+
+ if (lcal_ifu != NULL) {
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_image_save(lcal_ifu, temp_path,
+ CPL_BPP_IEEE_FLOAT,
+ NULL, CPL_IO_EXTEND, NAN));
+ }
+ cpl_free(temp_path); temp_path = NULL;
+ }
+
+ cpl_image_delete(xcal_ifu); xcal_ifu = NULL;
+ cpl_image_delete(ycal_ifu); ycal_ifu = NULL;
+ cpl_image_delete(lcal_ifu); lcal_ifu = NULL;
+ cpl_image_delete(obj_ifu); obj_ifu = NULL;
+ cpl_image_delete(sky_ifu); sky_ifu = NULL;
+
+ /* save cubes to disk if option is set */
+ if (kmclipm_priv_get_output_cubes() == TRUE) {
+ KMCLIPM_TRY_EXIT_IFN(
+ temp_path = cpl_sprintf("%scube_%d.fits",
+ kmclipm_priv_get_output_path(), ifu_nr));
+
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_imagelist_save(cube, temp_path,
+ CPL_BPP_IEEE_FLOAT,
+ NULL, CPL_IO_DEFAULT, NAN));
+
+ cpl_free(temp_path); temp_path = NULL;
+ }
+
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_make_image(cube, NULL, &made_image,
+ NULL, NULL, "average",
+ -1, -1, -1, -1, -1));
+
+ cpl_imagelist_delete(cube); cube = NULL;
+
+ /* calculate center positions and errros
+ * (done with background-subtracted image)
+ */
+ if (((target_img_det != NULL) && (ifu_id_copy[ifu_nr] == 1)) ||
+ ((sky_img_det != NULL) && (ifu_id_copy[ifu_nr] == 2)))
+ {
+ median = kmclipm_median_min(made_image, NULL, NULL);
+ KMCLIPM_TRY_CHECK_ERROR_STATE();
+
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ cpl_image_subtract_scalar(made_image, median));
+
+ if (CPL_ERROR_NONE ==
+ kmclipm_gaussfit_2d(made_image/*_dup*/, fitted_pars))
+ {
+ fitpar->intensity[ifu_nr] = fitted_pars[0];
+ fitpar->xpos[ifu_nr] = fitted_pars[1];
+ fitpar->ypos[ifu_nr] = fitted_pars[2];
+ fitpar->fwhm[ifu_nr] = fitted_pars[3];
+ fitpar->background[ifu_nr] = fitted_pars[4];
+
+ fitpar->intensity_error[ifu_nr] = fitted_pars[5];
+ fitpar->xpos_error[ifu_nr] = fitted_pars[6];
+ fitpar->ypos_error[ifu_nr] = fitted_pars[7];
+ fitpar->fwhm_error[ifu_nr] = fitted_pars[8];
+ fitpar->background_error[ifu_nr] = fitted_pars[9];
+
+ if ((getenv("KMCLIPM_DEBUG") != NULL) &&
+ (strcmp(getenv("KMCLIPM_DEBUG"), "") != 0))
+ {
+ char *cmd = cpl_sprintf("echo '%d\t "
+ "%12.6g\t (%12.6g)\t %12.6g\t "
+ "(%12.6g)\t %12.6g\t (%12.6g)\t "
+ "%12.6g\t (%12.6g)\t %12.6g\t "
+ "(%12.6g)' >>"
+ "$KMCLIPM_DEBUG/tmp/kmclipm_fitpar.txt",
+ ifu_nr,
+ fitted_pars[0],
+ fitted_pars[5],
+ fitted_pars[1],
+ fitted_pars[6],
+ fitted_pars[2],
+ fitted_pars[7],
+ fitted_pars[3],
+ fitted_pars[8],
+ fitted_pars[4],
+ fitted_pars[9]);
+ system(cmd);
+ cpl_free(cmd);
+ cmd = cpl_sprintf("echo '%12.6g' >>"
+ "$KMCLIPM_DEBUG/tmp/kmclipm_intensity.txt",
+ fitted_pars[0]);
+ system(cmd);
+ cpl_free(cmd);
+ cmd = cpl_sprintf("echo '%12.6g' >>"
+ "$KMCLIPM_DEBUG/tmp/kmclipm_xcenter.txt",
+ fitted_pars[1]);
+ system(cmd);
+ cpl_free(cmd);
+ cmd = cpl_sprintf("echo '%12.6g' >>"
+ "$KMCLIPM_DEBUG/tmp/kmclipm_ycenter.txt",
+ fitted_pars[2]);
+ system(cmd);
+ cpl_free(cmd);
+ cmd = cpl_sprintf("echo '%12.6g' >>"
+ "$KMCLIPM_DEBUG/tmp/kmclipm_fwhm.txt",
+ fitted_pars[3]);
+ system(cmd);
+ cpl_free(cmd);
+ cmd = cpl_sprintf("echo '%12.6g' >>"
+ "$KMCLIPM_DEBUG/tmp/kmclipm_offset.txt",
+ fitted_pars[4]);
+ system(cmd);
+ cpl_free(cmd);
+ }
+ } else {
+ /* e.g. image containing only nan */
+ KMCLIPM_ERROR_RECOVER_TRYSTATE();
+ if ((getenv("KMCLIPM_DEBUG") != NULL) &&
+ (strcmp(getenv("KMCLIPM_DEBUG"), "") != 0))
+ {
+ char *cmd = cpl_sprintf("echo '%d : fit failed, returning -1' >>"
+ "$KMCLIPM_DEBUG/tmp/kmclipm_fitpar.txt",
+ ifu_nr);
+ system(cmd);
+ cpl_free(cmd);
+ }
+ }
+ }
+ } else { /* ifu_id_copy[ifu_nr] <= 0 */
+ /* create empty dummy placeholder */
+ KMCLIPM_TRY_EXIT_IFN(
+ made_image = cpl_image_new(KMOS_SLITLET_X, KMOS_SLITLET_Y, CPL_TYPE_FLOAT));
+ }
+
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ cpl_imagelist_set(ifu_image_list, made_image, ifu_nr-1));
+ } /* for j = 0 (IFU counter) */
+
+ cpl_image_delete(xcal_img); xcal_img = NULL;
+ cpl_image_delete(ycal_img); ycal_img = NULL;
+ cpl_image_delete(lcal_img); lcal_img = NULL;
+ } /* for det_nr = 1 */
+
+ cpl_array_delete(ts_cal); ts_cal = NULL;
+ cpl_free(bounds); bounds = NULL;
+ cpl_image_delete(xcal_img); xcal_img = NULL;
+ cpl_image_delete(ycal_img); ycal_img = NULL;
+ cpl_image_delete(lcal_img); lcal_img = NULL;
+ cpl_image_delete(target_img_det); target_img_det = NULL;
+ cpl_image_delete(sky_img_det); sky_img_det = NULL;
+ if (calAngles != NULL) {
+ cpl_vector_delete(calAngles); calAngles = NULL;
+ }
+
+ if (kmclipm_priv_get_output_cubes() == TRUE) {
+ cpl_msg_debug("kmclipm_rtd_image", "Reconstructed cubes saved.");
+ }
+
+ /* save imageList as imageCube if option is set */
+ if (kmclipm_priv_get_output_images()) {
+ KMCLIPM_TRY_EXIT_IFN(
+ temp_path = cpl_sprintf("%simage_cube.fits",
+ kmclipm_priv_get_output_path()));
+
+ KMCLIPM_TRY_EXIT_IFN(CPL_ERROR_NONE ==
+ kmclipm_imagelist_save(ifu_image_list, temp_path, CPL_BPP_IEEE_FLOAT,
+ NULL, CPL_IO_DEFAULT, NAN));
+
+ cpl_free(temp_path); temp_path = NULL;
+ cpl_msg_debug("kmclipm_rtd_image", "ImageCube saved.");
+ }
+
+/*------------------------------------------------------------------------------
+ * Create RTD image (5x5-Array)
+ *----------------------------------------------------------------------------*/
+ KMCLIPM_TRY_EXIT_IFN(
+ *rtd_img = cpl_image_new(kmclipm_priv_get_rtd_width(),
+ kmclipm_priv_get_rtd_height(),
+ CPL_TYPE_FLOAT));
+
+ /*
+ * insert IFU-images at given positions. If IFU is invalid nan-values
+ * are inserted.
+ */
+ for (j = 0; j < KMOS_NR_IFUS; j++) {
+ if (ifu_id_copy[j+1] > 0) {
+ /* get IFU-image & extract data */
+ KMCLIPM_TRY_EXIT_IFN(
+ ifu_img = cpl_imagelist_get(ifu_image_list, j));
+
+ out_val = kmclipm_priv_paste_ifu_images(ifu_img, rtd_img,
+ kmclipm_priv_ifu_pos_x(j),
+ kmclipm_priv_ifu_pos_y(j));
+ KMCLIPM_TRY_CHECK_ERROR_STATE();
+
+ if (out_val > val)
+ val = out_val;
+ } else {
+ /* paste nan_image */
+ kmclipm_priv_paste_ifu_images(nan_image, rtd_img,
+ kmclipm_priv_ifu_pos_x(j),
+ kmclipm_priv_ifu_pos_y(j));
+ KMCLIPM_TRY_CHECK_ERROR_STATE();
+ }
+ }
+
+ /*
+ * draw rectangles in RTD-image (this is in a separate for-loop just
+ * for beauty, first the overall maximum value is determined, then this
+ * value is used to draw the rectangles.
+ * This is a question of contrast...)
+ */
+
+ /* if no IFU-image is to be draw, set a value for the rectangles */
+ if (val == 0.0) {
+ val = 100.0;
+ }
+
+ /* draw rectangles */
+ kmclipm_priv_paint_ifu_rectangle_rtd(rtd_img, ifu_id_copy, val);
+ KMCLIPM_TRY_CHECK_ERROR_STATE();
+
+/*------------------------------------------------------------------------------
+ * Create patrol image
+ *----------------------------------------------------------------------------*/
+ KMCLIPM_TRY_EXIT_IFN(
+ *patrol_img = kmclipm_priv_create_patrol_view(ifu_image_list,
+ nominal_pos,
+ ifu_id_copy));
+ if (*patrol_img == NULL) {
+ KMCLIPM_TRY_CHECK_ERROR_STATE();
+ }
+ }
+ KMCLIPM_CATCH
+ {
+ cpl_msg_error(cpl_func, "%s (Code %d) in %s", cpl_error_get_message(),
+ cpl_error_get_code(), cpl_error_get_where());
+ error = KMCLIPM_ERROR_GET_NEW_SINCE_TRY();
+
+ kmclipm_free_fitpar(fitpar);
+ cpl_image_delete(*rtd_img); *rtd_img = NULL;
+ cpl_image_delete(*patrol_img); *patrol_img = NULL;
+ }
+
+ cpl_free(filt); filt = NULL;
+ cpl_free(grat); grat = NULL;
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_free(fn_wave_band); fn_wave_band = NULL;
+ cpl_imagelist_delete(ifu_image_list); ifu_image_list = NULL;
+ cpl_image_delete(nan_image); nan_image = NULL;
+
+ return error;
+}
+
+/** @} */
diff --git a/kmclipm/src/kmclipm_vector.c b/kmclipm/src/kmclipm_vector.c
index 39786b6..ea66a5a 100644
--- a/kmclipm/src/kmclipm_vector.c
+++ b/kmclipm/src/kmclipm_vector.c
@@ -24,7 +24,6 @@
#include <cpl.h>
-/*#include "kmclipm_compatibility_replacements.h"*/
#include "kmclipm_priv_error.h"
#include "kmclipm_vector.h"
#include "kmclipm_math.h"
diff --git a/kmclipm/src/kmclipm_version.c b/kmclipm/src/kmclipm_version.c
new file mode 100644
index 0000000..fce8997
--- /dev/null
+++ b/kmclipm/src/kmclipm_version.c
@@ -0,0 +1,116 @@
+/*********************************************************************
+ * E.S.O. - VLT project
+ *
+ * "@(#) $Id: kmclipm_version.c,v 1.1.1.1 2012-01-18 09:32:30 yjung Exp $"
+ *
+ * Functions to access the kmclipm version information
+ *
+ * who when what
+ * -------- ---------- ----------------------------------------------
+ * hlorch 2006-05-11 created
+ */
+
+/**
+ * @defgroup kmclipm_version Library Version Information
+ *
+ * This module provides functions to access the kmclipm library's version
+ * information.
+ *
+ * The library version applies to all components of the kmclipm,
+ * and changes if any of the component libraries changes.
+ *
+ * @par Synopsis:
+ * @code
+ * #include <kmclipm_version.h>
+ * @endcode
+ *
+ * @{
+ */
+
+/*-----------------------------------------------------------------------------
+ Includes
+ -----------------------------------------------------------------------------*/
+
+#include <stdlib.h>
+
+#include "kmclipm_version.h"
+
+/*-----------------------------------------------------------------------------
+ Private Prototypes
+ -----------------------------------------------------------------------------*/
+
+static char *kmclipm_rcskey_extract_value( char *rcskey);
+
+/*-----------------------------------------------------------------------------
+ Globals
+ -----------------------------------------------------------------------------*/
+
+static char rcskey_date[] = "@(#) $Date: 2012-01-18 09:32:30 $";
+static char rcskey_revision[] = "@(#) $Revision: 1.1.1.1 $";
+
+/*-----------------------------------------------------------------------------
+ Implementation
+ -----------------------------------------------------------------------------*/
+
+/**
+ * @brief A pointer to the beginning of the value-string inside
+ * the RCS keyword ist returned, and the keyword is terminated
+ * at the end of the value-string.
+ * @param rcskey The RCS keyword
+ * @return The value-string
+ */
+static char *kmclipm_rcskey_extract_value( char *rcskey) {
+ int n = 0;
+ char c, *result;
+
+ /* search end of keyword name (search for the colon) */
+ while ((c = rcskey[n]) != 0 && c != ':')
+ n++;
+
+ /* search end of space = beginning of value */
+ while ((c = rcskey[n]) != 0 && (c == ' ' || c == ':'))
+ n++;
+
+ result = &rcskey[n];
+
+ /* terminate the rcs keyword at the end of the value */
+ while ((c = rcskey[n]) != 0 && c != ' ' && c != ',' && c != '$')
+ n++;
+ rcskey[n] = 0;
+
+ return result;
+}
+
+/**
+ * @brief Get the library's revision string.
+ * @return The function returns the library's revision string.
+ *
+ * The function returns a pointer to the revision string of the library.
+ */
+
+const char *kmclipm_version_get_revision( void) {
+ static char *revision = NULL;
+
+ if (revision == NULL)
+ revision = kmclipm_rcskey_extract_value(rcskey_revision);
+
+ return revision;
+}
+
+/**
+ * @brief Get the library's revision-date string.
+ * @return The library's revision-date string.
+ *
+ * The function returns a pointer to the date string of the library's revision.
+ */
+
+const char *kmclipm_version_get_date( void) {
+ static char *date = NULL;
+
+ if (date == NULL)
+ date = kmclipm_rcskey_extract_value(rcskey_date);
+
+ return date;
+}
+
+/**@}*/
diff --git a/kmclipm/test/Makefile.am b/kmclipm/test/Makefile.am
new file mode 100644
index 0000000..ed98158
--- /dev/null
+++ b/kmclipm/test/Makefile.am
@@ -0,0 +1,102 @@
+## Process this file with automake to produce Makefile.in
+
+## This file is part of the IRPLIB package
+## Copyright (C) 2002,2003 European Southern Observatory
+
+## This library 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+
+AUTOMAKE_OPTIONS = 1.8 foreign
+
+DISTCLEANFILES = *~
+
+EXTRA_DIST = ref
+
+if MAINTAINER_MODE
+
+MAINTAINERCLEANFILES = Makefile.in
+
+endif
+
+#AM_CPPFLAGS = $(all_includes) -I../include
+#AM_CPPFLAGS = $(all_includes)
+INCLUDES = $(all_includes)
+
+LDADD = $(LIBKMCLIPMLIB) $(LIBCPLCORE) $(LIBCPLUI) $(LIBCPLDFS) $(LIBCPLDRS)
+
+pkginclude_HEADERS =
+
+noinst_HEADERS =
+
+check_PROGRAMS = kmclipm_test_functions \
+ kmclipm_test_math \
+ kmclipm_test_priv_functions \
+ kmclipm_test_priv_splines \
+ kmclipm_test_vector \
+ kmclipm_test_priv_constants \
+ kmclipm_test_priv_reconstruct \
+ kmclipm_test_rtd
+
+kmclipm_test_functions_SOURCES = kmclipm_test_functions.c
+kmclipm_test_functions_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_functions_LDADD = $(LDADD)
+
+kmclipm_test_math_SOURCES = kmclipm_test_math.c
+kmclipm_test_math_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_math_LDADD = $(LDADD)
+
+kmclipm_test_priv_functions_SOURCES = kmclipm_test_priv_functions.c
+kmclipm_test_priv_functions_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_priv_functions_LDADD = $(LDADD)
+
+kmclipm_test_priv_splines_SOURCES = kmclipm_test_priv_splines.c
+kmclipm_test_priv_splines_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_priv_splines_LDADD = $(LDADD)
+
+kmclipm_test_vector_SOURCES = kmclipm_test_vector.c
+kmclipm_test_vector_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_vector_LDADD = $(LDADD)
+
+kmclipm_test_priv_constants_SOURCES = kmclipm_test_priv_constants.c
+kmclipm_test_priv_constants_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_priv_constants_LDADD = $(LDADD)
+
+kmclipm_test_priv_reconstruct_SOURCES = kmclipm_test_priv_reconstruct.c
+kmclipm_test_priv_reconstruct_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_priv_reconstruct_LDADD = $(LDADD)
+
+kmclipm_test_rtd_SOURCES = kmclipm_test_rtd.c
+kmclipm_test_rtd_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_rtd_LDADD = $(LDADD)
+
+TESTS = $(check_PROGRAMS)
+
+# Be sure to reexport important environment variables.
+TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
+ CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
+ LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
+ OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" \
+ MALLOC_PERTURB_=137 MALLOC_CHECK_=2
+
+# We need to remove any files that the above tests created.
+clean-local:
+ $(RM) -rf test_data
+ $(RM) -f *.log *.paf *.fits .logfile
+
+#distclean-local: clean-local
+# $(RM) -f ../data
+
+#if PURIFY
+#include $(top_builddir)/Makefile.purify
+#endif
diff --git a/irplib/tests/Makefile.in b/kmclipm/test/Makefile.in
similarity index 71%
copy from irplib/tests/Makefile.in
copy to kmclipm/test/Makefile.in
index 850dca5..79efd6d 100644
--- a/irplib/tests/Makefile.in
+++ b/kmclipm/test/Makefile.in
@@ -35,13 +35,16 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-check_PROGRAMS = irplib_wlxcorr-test$(EXEEXT) \
- irplib_hist-test$(EXEEXT) irplib_polynomial-test$(EXEEXT) \
- irplib_plugin-test$(EXEEXT) irplib_utils-test$(EXEEXT) \
- irplib_framelist-test$(EXEEXT) irplib_wcs-test$(EXEEXT) \
- irplib_cat-test$(EXEEXT)
-subdir = irplib/tests
-DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \
+check_PROGRAMS = kmclipm_test_functions$(EXEEXT) \
+ kmclipm_test_math$(EXEEXT) \
+ kmclipm_test_priv_functions$(EXEEXT) \
+ kmclipm_test_priv_splines$(EXEEXT) \
+ kmclipm_test_vector$(EXEEXT) \
+ kmclipm_test_priv_constants$(EXEEXT) \
+ kmclipm_test_priv_reconstruct$(EXEEXT) \
+ kmclipm_test_rtd$(EXEEXT)
+subdir = kmclipm/test
+DIST_COMMON = README $(noinst_HEADERS) $(pkginclude_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4macros/cpl.m4 \
@@ -59,58 +62,70 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-am_irplib_cat_test_OBJECTS = irplib_cat-test.$(OBJEXT)
-irplib_cat_test_OBJECTS = $(am_irplib_cat_test_OBJECTS)
+am_kmclipm_test_functions_OBJECTS = kmclipm_test_functions.$(OBJEXT)
+kmclipm_test_functions_OBJECTS = $(am_kmclipm_test_functions_OBJECTS)
am__DEPENDENCIES_1 =
am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
-irplib_cat_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
-irplib_cat_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+kmclipm_test_functions_DEPENDENCIES = $(am__DEPENDENCIES_2)
+kmclipm_test_functions_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(irplib_cat_test_LDFLAGS) $(LDFLAGS) -o $@
-am_irplib_framelist_test_OBJECTS = irplib_framelist-test.$(OBJEXT)
-irplib_framelist_test_OBJECTS = $(am_irplib_framelist_test_OBJECTS)
-irplib_framelist_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
-irplib_framelist_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(kmclipm_test_functions_LDFLAGS) $(LDFLAGS) -o $@
+am_kmclipm_test_math_OBJECTS = kmclipm_test_math.$(OBJEXT)
+kmclipm_test_math_OBJECTS = $(am_kmclipm_test_math_OBJECTS)
+kmclipm_test_math_DEPENDENCIES = $(am__DEPENDENCIES_2)
+kmclipm_test_math_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(irplib_framelist_test_LDFLAGS) $(LDFLAGS) -o $@
-am_irplib_hist_test_OBJECTS = irplib_hist-test.$(OBJEXT)
-irplib_hist_test_OBJECTS = $(am_irplib_hist_test_OBJECTS)
-irplib_hist_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
-irplib_hist_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(irplib_hist_test_LDFLAGS) $(LDFLAGS) -o $@
-am_irplib_plugin_test_OBJECTS = irplib_plugin-test.$(OBJEXT)
-irplib_plugin_test_OBJECTS = $(am_irplib_plugin_test_OBJECTS)
-irplib_plugin_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
-irplib_plugin_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(irplib_plugin_test_LDFLAGS) $(LDFLAGS) -o $@
-am_irplib_polynomial_test_OBJECTS = irplib_polynomial-test.$(OBJEXT)
-irplib_polynomial_test_OBJECTS = $(am_irplib_polynomial_test_OBJECTS)
-irplib_polynomial_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
-irplib_polynomial_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(irplib_polynomial_test_LDFLAGS) $(LDFLAGS) -o $@
-am_irplib_utils_test_OBJECTS = irplib_utils-test.$(OBJEXT)
-irplib_utils_test_OBJECTS = $(am_irplib_utils_test_OBJECTS)
-irplib_utils_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
-irplib_utils_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(irplib_utils_test_LDFLAGS) $(LDFLAGS) -o $@
-am_irplib_wcs_test_OBJECTS = irplib_wcs-test.$(OBJEXT)
-irplib_wcs_test_OBJECTS = $(am_irplib_wcs_test_OBJECTS)
-irplib_wcs_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
-irplib_wcs_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(kmclipm_test_math_LDFLAGS) $(LDFLAGS) -o $@
+am_kmclipm_test_priv_constants_OBJECTS = \
+ kmclipm_test_priv_constants.$(OBJEXT)
+kmclipm_test_priv_constants_OBJECTS = \
+ $(am_kmclipm_test_priv_constants_OBJECTS)
+kmclipm_test_priv_constants_DEPENDENCIES = $(am__DEPENDENCIES_2)
+kmclipm_test_priv_constants_LINK = $(LIBTOOL) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(kmclipm_test_priv_constants_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_kmclipm_test_priv_functions_OBJECTS = \
+ kmclipm_test_priv_functions.$(OBJEXT)
+kmclipm_test_priv_functions_OBJECTS = \
+ $(am_kmclipm_test_priv_functions_OBJECTS)
+kmclipm_test_priv_functions_DEPENDENCIES = $(am__DEPENDENCIES_2)
+kmclipm_test_priv_functions_LINK = $(LIBTOOL) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(kmclipm_test_priv_functions_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_kmclipm_test_priv_reconstruct_OBJECTS = \
+ kmclipm_test_priv_reconstruct.$(OBJEXT)
+kmclipm_test_priv_reconstruct_OBJECTS = \
+ $(am_kmclipm_test_priv_reconstruct_OBJECTS)
+kmclipm_test_priv_reconstruct_DEPENDENCIES = $(am__DEPENDENCIES_2)
+kmclipm_test_priv_reconstruct_LINK = $(LIBTOOL) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) \
+ $(kmclipm_test_priv_reconstruct_LDFLAGS) $(LDFLAGS) -o $@
+am_kmclipm_test_priv_splines_OBJECTS = \
+ kmclipm_test_priv_splines.$(OBJEXT)
+kmclipm_test_priv_splines_OBJECTS = \
+ $(am_kmclipm_test_priv_splines_OBJECTS)
+kmclipm_test_priv_splines_DEPENDENCIES = $(am__DEPENDENCIES_2)
+kmclipm_test_priv_splines_LINK = $(LIBTOOL) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(kmclipm_test_priv_splines_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_kmclipm_test_rtd_OBJECTS = kmclipm_test_rtd.$(OBJEXT)
+kmclipm_test_rtd_OBJECTS = $(am_kmclipm_test_rtd_OBJECTS)
+kmclipm_test_rtd_DEPENDENCIES = $(am__DEPENDENCIES_2)
+kmclipm_test_rtd_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(irplib_wcs_test_LDFLAGS) $(LDFLAGS) -o $@
-am_irplib_wlxcorr_test_OBJECTS = irplib_wlxcorr-test.$(OBJEXT)
-irplib_wlxcorr_test_OBJECTS = $(am_irplib_wlxcorr_test_OBJECTS)
-irplib_wlxcorr_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
-irplib_wlxcorr_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(kmclipm_test_rtd_LDFLAGS) $(LDFLAGS) -o $@
+am_kmclipm_test_vector_OBJECTS = kmclipm_test_vector.$(OBJEXT)
+kmclipm_test_vector_OBJECTS = $(am_kmclipm_test_vector_OBJECTS)
+kmclipm_test_vector_DEPENDENCIES = $(am__DEPENDENCIES_2)
+kmclipm_test_vector_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(irplib_wlxcorr_test_LDFLAGS) $(LDFLAGS) -o $@
+ $(kmclipm_test_vector_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/admin/depcomp
am__depfiles_maybe = depfiles
@@ -124,15 +139,20 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(irplib_cat_test_SOURCES) $(irplib_framelist_test_SOURCES) \
- $(irplib_hist_test_SOURCES) $(irplib_plugin_test_SOURCES) \
- $(irplib_polynomial_test_SOURCES) $(irplib_utils_test_SOURCES) \
- $(irplib_wcs_test_SOURCES) $(irplib_wlxcorr_test_SOURCES)
-DIST_SOURCES = $(irplib_cat_test_SOURCES) \
- $(irplib_framelist_test_SOURCES) $(irplib_hist_test_SOURCES) \
- $(irplib_plugin_test_SOURCES) \
- $(irplib_polynomial_test_SOURCES) $(irplib_utils_test_SOURCES) \
- $(irplib_wcs_test_SOURCES) $(irplib_wlxcorr_test_SOURCES)
+SOURCES = $(kmclipm_test_functions_SOURCES) \
+ $(kmclipm_test_math_SOURCES) \
+ $(kmclipm_test_priv_constants_SOURCES) \
+ $(kmclipm_test_priv_functions_SOURCES) \
+ $(kmclipm_test_priv_reconstruct_SOURCES) \
+ $(kmclipm_test_priv_splines_SOURCES) \
+ $(kmclipm_test_rtd_SOURCES) $(kmclipm_test_vector_SOURCES)
+DIST_SOURCES = $(kmclipm_test_functions_SOURCES) \
+ $(kmclipm_test_math_SOURCES) \
+ $(kmclipm_test_priv_constants_SOURCES) \
+ $(kmclipm_test_priv_functions_SOURCES) \
+ $(kmclipm_test_priv_reconstruct_SOURCES) \
+ $(kmclipm_test_priv_splines_SOURCES) \
+ $(kmclipm_test_rtd_SOURCES) $(kmclipm_test_vector_SOURCES)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -221,6 +241,7 @@ LIBCPLDFS = @LIBCPLDFS@
LIBCPLDRS = @LIBCPLDRS@
LIBCPLUI = @LIBCPLUI@
LIBIRPLIB = @LIBIRPLIB@
+LIBKMCLIPMLIB = @LIBKMCLIPMLIB@
LIBKMOS = @LIBKMOS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@@ -324,35 +345,39 @@ wkfcopydir = @wkfcopydir@
wkfextradir = @wkfextradir@
AUTOMAKE_OPTIONS = 1.8 foreign
DISTCLEANFILES = *~
+EXTRA_DIST = ref
@MAINTAINER_MODE_TRUE at MAINTAINERCLEANFILES = Makefile.in
-AM_CPPFLAGS = $(all_includes) -I../../irplib/
-LDADD = $(LIBIRPLIB) $(LIBCPLCORE) $(LIBCPLUI) $(LIBCPLDFS) $(LIBCPLDRS)
+
+#AM_CPPFLAGS = $(all_includes) -I../include
+#AM_CPPFLAGS = $(all_includes)
+INCLUDES = $(all_includes)
+LDADD = $(LIBKMCLIPMLIB) $(LIBCPLCORE) $(LIBCPLUI) $(LIBCPLDFS) $(LIBCPLDRS)
pkginclude_HEADERS =
noinst_HEADERS =
-irplib_wlxcorr_test_SOURCES = irplib_wlxcorr-test.c
-irplib_wlxcorr_test_LDFLAGS = $(CPL_LDFLAGS)
-irplib_wlxcorr_test_LDADD = $(LDADD)
-irplib_hist_test_SOURCES = irplib_hist-test.c
-irplib_hist_test_LDFLAGS = $(CPL_LDFLAGS)
-irplib_hist_test_LDADD = $(LDADD)
-irplib_polynomial_test_SOURCES = irplib_polynomial-test.c
-irplib_polynomial_test_LDFLAGS = $(CPL_LDFLAGS)
-irplib_polynomial_test_LDADD = $(LDADD)
-irplib_plugin_test_SOURCES = irplib_plugin-test.c
-irplib_plugin_test_LDFLAGS = $(CPL_LDFLAGS)
-irplib_plugin_test_LDADD = $(LDADD)
-irplib_utils_test_SOURCES = irplib_utils-test.c
-irplib_utils_test_LDFLAGS = $(CPL_LDFLAGS)
-irplib_utils_test_LDADD = $(LDADD)
-irplib_framelist_test_SOURCES = irplib_framelist-test.c
-irplib_framelist_test_LDFLAGS = $(CPL_LDFLAGS)
-irplib_framelist_test_LDADD = $(LDADD)
-irplib_wcs_test_SOURCES = irplib_wcs-test.c
-irplib_wcs_test_LDFLAGS = $(CPL_LDFLAGS) $(WCSLIB_LDFLAGS)
-irplib_wcs_test_LDADD = $(LDADD) $(LIBWCSLIB)
-irplib_cat_test_SOURCES = irplib_cat-test.c
-irplib_cat_test_LDFLAGS = $(CPL_LDFLAGS) $(WCSLIB_LDFLAGS)
-irplib_cat_test_LDADD = $(LDADD) $(LIBWCSLIB)
+kmclipm_test_functions_SOURCES = kmclipm_test_functions.c
+kmclipm_test_functions_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_functions_LDADD = $(LDADD)
+kmclipm_test_math_SOURCES = kmclipm_test_math.c
+kmclipm_test_math_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_math_LDADD = $(LDADD)
+kmclipm_test_priv_functions_SOURCES = kmclipm_test_priv_functions.c
+kmclipm_test_priv_functions_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_priv_functions_LDADD = $(LDADD)
+kmclipm_test_priv_splines_SOURCES = kmclipm_test_priv_splines.c
+kmclipm_test_priv_splines_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_priv_splines_LDADD = $(LDADD)
+kmclipm_test_vector_SOURCES = kmclipm_test_vector.c
+kmclipm_test_vector_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_vector_LDADD = $(LDADD)
+kmclipm_test_priv_constants_SOURCES = kmclipm_test_priv_constants.c
+kmclipm_test_priv_constants_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_priv_constants_LDADD = $(LDADD)
+kmclipm_test_priv_reconstruct_SOURCES = kmclipm_test_priv_reconstruct.c
+kmclipm_test_priv_reconstruct_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_priv_reconstruct_LDADD = $(LDADD)
+kmclipm_test_rtd_SOURCES = kmclipm_test_rtd.c
+kmclipm_test_rtd_LDFLAGS = $(CPL_LDFLAGS)
+kmclipm_test_rtd_LDADD = $(LDADD)
TESTS = $(check_PROGRAMS)
# Be sure to reexport important environment variables.
@@ -375,9 +400,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign irplib/tests/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign kmclipm/test/Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign irplib/tests/Makefile
+ $(AUTOMAKE) --foreign kmclipm/test/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -405,30 +430,30 @@ clean-checkPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-irplib_cat-test$(EXEEXT): $(irplib_cat_test_OBJECTS) $(irplib_cat_test_DEPENDENCIES) $(EXTRA_irplib_cat_test_DEPENDENCIES)
- @rm -f irplib_cat-test$(EXEEXT)
- $(irplib_cat_test_LINK) $(irplib_cat_test_OBJECTS) $(irplib_cat_test_LDADD) $(LIBS)
-irplib_framelist-test$(EXEEXT): $(irplib_framelist_test_OBJECTS) $(irplib_framelist_test_DEPENDENCIES) $(EXTRA_irplib_framelist_test_DEPENDENCIES)
- @rm -f irplib_framelist-test$(EXEEXT)
- $(irplib_framelist_test_LINK) $(irplib_framelist_test_OBJECTS) $(irplib_framelist_test_LDADD) $(LIBS)
-irplib_hist-test$(EXEEXT): $(irplib_hist_test_OBJECTS) $(irplib_hist_test_DEPENDENCIES) $(EXTRA_irplib_hist_test_DEPENDENCIES)
- @rm -f irplib_hist-test$(EXEEXT)
- $(irplib_hist_test_LINK) $(irplib_hist_test_OBJECTS) $(irplib_hist_test_LDADD) $(LIBS)
-irplib_plugin-test$(EXEEXT): $(irplib_plugin_test_OBJECTS) $(irplib_plugin_test_DEPENDENCIES) $(EXTRA_irplib_plugin_test_DEPENDENCIES)
- @rm -f irplib_plugin-test$(EXEEXT)
- $(irplib_plugin_test_LINK) $(irplib_plugin_test_OBJECTS) $(irplib_plugin_test_LDADD) $(LIBS)
-irplib_polynomial-test$(EXEEXT): $(irplib_polynomial_test_OBJECTS) $(irplib_polynomial_test_DEPENDENCIES) $(EXTRA_irplib_polynomial_test_DEPENDENCIES)
- @rm -f irplib_polynomial-test$(EXEEXT)
- $(irplib_polynomial_test_LINK) $(irplib_polynomial_test_OBJECTS) $(irplib_polynomial_test_LDADD) $(LIBS)
-irplib_utils-test$(EXEEXT): $(irplib_utils_test_OBJECTS) $(irplib_utils_test_DEPENDENCIES) $(EXTRA_irplib_utils_test_DEPENDENCIES)
- @rm -f irplib_utils-test$(EXEEXT)
- $(irplib_utils_test_LINK) $(irplib_utils_test_OBJECTS) $(irplib_utils_test_LDADD) $(LIBS)
-irplib_wcs-test$(EXEEXT): $(irplib_wcs_test_OBJECTS) $(irplib_wcs_test_DEPENDENCIES) $(EXTRA_irplib_wcs_test_DEPENDENCIES)
- @rm -f irplib_wcs-test$(EXEEXT)
- $(irplib_wcs_test_LINK) $(irplib_wcs_test_OBJECTS) $(irplib_wcs_test_LDADD) $(LIBS)
-irplib_wlxcorr-test$(EXEEXT): $(irplib_wlxcorr_test_OBJECTS) $(irplib_wlxcorr_test_DEPENDENCIES) $(EXTRA_irplib_wlxcorr_test_DEPENDENCIES)
- @rm -f irplib_wlxcorr-test$(EXEEXT)
- $(irplib_wlxcorr_test_LINK) $(irplib_wlxcorr_test_OBJECTS) $(irplib_wlxcorr_test_LDADD) $(LIBS)
+kmclipm_test_functions$(EXEEXT): $(kmclipm_test_functions_OBJECTS) $(kmclipm_test_functions_DEPENDENCIES) $(EXTRA_kmclipm_test_functions_DEPENDENCIES)
+ @rm -f kmclipm_test_functions$(EXEEXT)
+ $(kmclipm_test_functions_LINK) $(kmclipm_test_functions_OBJECTS) $(kmclipm_test_functions_LDADD) $(LIBS)
+kmclipm_test_math$(EXEEXT): $(kmclipm_test_math_OBJECTS) $(kmclipm_test_math_DEPENDENCIES) $(EXTRA_kmclipm_test_math_DEPENDENCIES)
+ @rm -f kmclipm_test_math$(EXEEXT)
+ $(kmclipm_test_math_LINK) $(kmclipm_test_math_OBJECTS) $(kmclipm_test_math_LDADD) $(LIBS)
+kmclipm_test_priv_constants$(EXEEXT): $(kmclipm_test_priv_constants_OBJECTS) $(kmclipm_test_priv_constants_DEPENDENCIES) $(EXTRA_kmclipm_test_priv_constants_DEPENDENCIES)
+ @rm -f kmclipm_test_priv_constants$(EXEEXT)
+ $(kmclipm_test_priv_constants_LINK) $(kmclipm_test_priv_constants_OBJECTS) $(kmclipm_test_priv_constants_LDADD) $(LIBS)
+kmclipm_test_priv_functions$(EXEEXT): $(kmclipm_test_priv_functions_OBJECTS) $(kmclipm_test_priv_functions_DEPENDENCIES) $(EXTRA_kmclipm_test_priv_functions_DEPENDENCIES)
+ @rm -f kmclipm_test_priv_functions$(EXEEXT)
+ $(kmclipm_test_priv_functions_LINK) $(kmclipm_test_priv_functions_OBJECTS) $(kmclipm_test_priv_functions_LDADD) $(LIBS)
+kmclipm_test_priv_reconstruct$(EXEEXT): $(kmclipm_test_priv_reconstruct_OBJECTS) $(kmclipm_test_priv_reconstruct_DEPENDENCIES) $(EXTRA_kmclipm_test_priv_reconstruct_DEPENDENCIES)
+ @rm -f kmclipm_test_priv_reconstruct$(EXEEXT)
+ $(kmclipm_test_priv_reconstruct_LINK) $(kmclipm_test_priv_reconstruct_OBJECTS) $(kmclipm_test_priv_reconstruct_LDADD) $(LIBS)
+kmclipm_test_priv_splines$(EXEEXT): $(kmclipm_test_priv_splines_OBJECTS) $(kmclipm_test_priv_splines_DEPENDENCIES) $(EXTRA_kmclipm_test_priv_splines_DEPENDENCIES)
+ @rm -f kmclipm_test_priv_splines$(EXEEXT)
+ $(kmclipm_test_priv_splines_LINK) $(kmclipm_test_priv_splines_OBJECTS) $(kmclipm_test_priv_splines_LDADD) $(LIBS)
+kmclipm_test_rtd$(EXEEXT): $(kmclipm_test_rtd_OBJECTS) $(kmclipm_test_rtd_DEPENDENCIES) $(EXTRA_kmclipm_test_rtd_DEPENDENCIES)
+ @rm -f kmclipm_test_rtd$(EXEEXT)
+ $(kmclipm_test_rtd_LINK) $(kmclipm_test_rtd_OBJECTS) $(kmclipm_test_rtd_LDADD) $(LIBS)
+kmclipm_test_vector$(EXEEXT): $(kmclipm_test_vector_OBJECTS) $(kmclipm_test_vector_DEPENDENCIES) $(EXTRA_kmclipm_test_vector_DEPENDENCIES)
+ @rm -f kmclipm_test_vector$(EXEEXT)
+ $(kmclipm_test_vector_LINK) $(kmclipm_test_vector_OBJECTS) $(kmclipm_test_vector_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -436,14 +461,14 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_cat-test.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_framelist-test.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_hist-test.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_plugin-test.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_polynomial-test.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_utils-test.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_wcs-test.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/irplib_wlxcorr-test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_test_functions.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_test_math.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_test_priv_constants.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_test_priv_functions.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_test_priv_reconstruct.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_test_priv_splines.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_test_rtd.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmclipm_test_vector.Po at am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -797,7 +822,11 @@ uninstall-am: uninstall-pkgincludeHEADERS
# We need to remove any files that the above tests created.
clean-local:
- $(RM) *.log *.paf *.fits .logfile
+ $(RM) -rf test_data
+ $(RM) -f *.log *.paf *.fits .logfile
+
+#distclean-local: clean-local
+# $(RM) -f ../data
#if PURIFY
#include $(top_builddir)/Makefile.purify
diff --git a/kmclipm/test/README b/kmclipm/test/README
new file mode 100644
index 0000000..9c4c498
--- /dev/null
+++ b/kmclipm/test/README
@@ -0,0 +1,94 @@
+*******************************************************************************
+*** How to use & test kmclipm ***
+*******************************************************************************
+
+1.) Install kmclipm
+-------------------------------------------------------------------------------
+- execute following commands:
+ $ ./configure
+ $ make
+ $ make install
+
+2.) Compiling the binary kmclipm_test_rtd
+-------------------------------------------------------------------------------
+- when calling (in kmclipm-folder)
+ $ make check
+ the kmclipm_test_rtd-binary is created and executed (with default configuration)
+ This is the standard unit test. First test data is generated (raw object and sky
+ images), then the data will be processed. At the end the previously generated
+ reference RTD-image is compared with the final RTD-image.
+
+- After this has been done once, kmclipm_test_rtd can be called directly with
+ $ test/kmclipm_test_rtd
+ For options see section 6.
+ In fact, kmclipm_test_rtd calls 'test/.libs/lt-kmclipm_test_rtd'
+ (i.e. when one wants to debug with gdb):
+
+- for additional output, i.e. saving intermediate data to disk,
+ parameters can be changed (see section 7.)
+
+3.) Output data
+-------------------------------------------------------------------------------
+- All output is saved to folder test/data/output
+ There are two files:
+ - patrol.fits is the patrol field of the telescope with the
+ images of the IFUs pasted into it
+ - rtd.fits shows the images of the IFUs in a 5x5-grid. When a IFU is disabled
+ (corresponding value of IFU in vector "ifuIDs" in kmclipm_test.rtd.c is set
+ to zero) a rectangle will appear as placeholder.
+
+4.) Test data
+-------------------------------------------------------------------------------
+- Test data creates raw images of target and sky (fits-file with 3 extensions
+ for each detector). They are saved in './test/data/output' (raw_image_obj.fits
+ and raw_image_sky.fits). Furthermore reference RTD-images are generated and
+ saved in './test/data/output' (ref_rtd.fits (target with subtracted sky),
+ ref_rt_target.fits & ref_rtd_sky.fits).
+ Additionally intermediate data can be saved if desired (see section 6.). All
+ data will be saved in './test/data/output' and provided with a suffix 'ref_'
+
+5.) Creating your own application using libkmclipm
+-------------------------------------------------------------------------------
+- the library containing kmclipm_rtd_image() is located in
+ /kmclipm/src/.lib
+
+6.) Options:
+-------------------------------------------------------------------------------
+- help
+ ./kmclipm_test_rtd --help
+
+- default configuration
+ ./kmclipm_test_rtd
+ or
+ ./kmclipm_test_rtd ./data/raw_image_obj.fits TARG ./data/raw_image_sky.fits SKY
+
+- other possible configurations
+ ./kmclipm_test_rtd ./data/raw_image_sky.fits SKY ./data/raw_image_obj.fits TARG
+ ./kmclipm_test_rtd ./data/raw_image_obj.fits TARG
+ ./kmclipm_test_rtd ./data/raw_image_sky.fits SKY
+
+- data generation
+ ./kmclipm_test_rtd --generate
+ Additional options:
+ --cubes-out Saves the cubes of each IFU to disk
+ (ref_cube_obj#.fits & ref_cube_sky#.fits))
+ --image-cubes-out Saves the collapsed images of cubes to disk
+ (ref_image_cube_obj#.fits & ref_image_cube_sky#.fits)
+
+7.) Debug Parameters
+-------------------------------------------------------------------------------
+- in /data/parameter_config.txt following parameters can be defined
+
+ rtd = TRUE if RTD-image should be saved to disk
+ patrol = TRUE if patrol-view should be saved to disk
+ cubes-out = FALSE if reconstructed cubes of ervery IFU should be
+ saved to disk (time-consuming!) as 'cube_#.fits')
+ images-out = FALSE if flattened image of each reconstructed cube (image
+ pasted into RTD-image and patrol-view) should be saved
+ as cube to disk as 'image_cube.fits'
+
+8.) Checking for memory leaks
+-------------------------------------------------------------------------------
+Use valgrind-3.2.3
+With version 3.1.0 it wont run through (on a intel-based PC with 1GB RAM with
+Kubuntu running)
diff --git a/kmclipm/test/kmclipm_test_functions.c b/kmclipm/test/kmclipm_test_functions.c
new file mode 100644
index 0000000..83b5ab4
--- /dev/null
+++ b/kmclipm/test/kmclipm_test_functions.c
@@ -0,0 +1,3620 @@
+/*********************************************************************
+ * E.S.O. - VLT project
+ *
+ * "@(#) $Id: kmclipm_test_functions.c,v 1.30 2013-10-08 14:55:01 erw Exp $"
+ *
+ * Tests for functions in src/kmclipm_functions.c/.h
+ *
+ * who when what
+ * -------- ---------- ----------------------------------------------
+ * aagudo 2008-06-16 created
+ */
+
+/**
+ @defgroup kmclipm_test_functions Unit tests for the functions in kmclipm_functions
+
+ Unit test for the functions in the module @ref kmclipm_functions
+
+ @{
+*/
+
+/*------------------------------------------------------------------------------
+ * Includes
+ *----------------------------------------------------------------------------*/
+#define _ISOC99_SOURCE
+
+#include <float.h>
+#include <math.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+
+#ifdef __USE_XOPEN2K
+/*#include <stdlib.h>*/
+#include "stdlib.h"
+#define GGG
+#else
+#define __USE_XOPEN2K /* to get the definition for setenv in stdlib.h */
+/*#include <stdlib.h>*/
+#include "stdlib.h"
+#undef __USE_XOPEN2K
+#endif
+
+#include "kmclipm_constants.h"
+#include "kmclipm_priv_constants.h"
+#include "kmclipm_functions.h"
+#include "kmclipm_priv_error.h"
+#include "kmclipm_priv_functions.h"
+
+cpl_msg_severity my_level= CPL_MSG_INFO;
+
+/*------------------------------------------------------------------------------
+ * Implementation
+ *----------------------------------------------------------------------------*/
+
+/**
+ @brief
+ Fills a vector with increasing values.
+
+ @param vec The vector to fill with values.
+ @param seed The starting value.
+ @param offset The offset for the values.
+
+ */
+void kmclipm_test_fill_vector(cpl_vector *vec,
+ float seed,
+ float offset)
+{
+ int i = 0,
+ size = 0;
+ double *data = NULL;
+
+ size = cpl_vector_get_size(vec);
+ cpl_test_eq(1, size > 0);
+
+ cpl_test_nonnull(data = cpl_vector_get_data(vec));
+
+ /* horizontal stripes: bottom = 0, top = seed * (y-1) */
+ for (i = 0; i < size; i++) {
+ data[i] = seed + i * offset;
+ }
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief
+ Fills an image with increasing values.
+
+ @param img The image to fill with values.
+ @param seed The starting value.
+ @param offset The offset for the values.
+
+ */
+void kmclipm_test_fill_image(cpl_image *img,
+ float seed,
+ float offset)
+{
+ float *data = NULL,
+ f = 0.0;
+
+ int d = 0;
+#if KMCLIPM_GET_INSTALLED_CPL_VERSION >= 6
+ cpl_size x = 0,
+ y = 0,
+ i = 0,
+ j = 0;
+#else
+ int x = 0,
+ y = 0,
+ i = 0,
+ j = 0;
+#endif
+
+ x = cpl_image_get_size_x(img);
+ y = cpl_image_get_size_y(img);
+
+ cpl_test_nonnull(data = cpl_image_get_data_float(img));
+
+ /* horizontal stripes: bottom = 0, top = seed * (y-1) */
+ for (i = 0; i < y; i++) {
+ for (j = 0; j < x; j++) {
+ data[d] = seed + f;
+ d++;
+ f += offset;
+ }
+ }
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief
+ Fills a cube with increasing values.
+
+ @param cube The cube to fill with values.
+ @param seed The starting value.
+ @param offset The offset for the values.
+
+ */
+void kmclipm_test_fill_cube(cpl_imagelist *cube,
+ float seed,
+ float offset)
+{
+ int i = 0,
+ size = 0;
+
+ size = cpl_imagelist_get_size(cube);
+ cpl_test_eq(1, size > 0);
+
+ for (i = 0; i < size; i++) {
+ kmclipm_test_fill_image(cpl_imagelist_get(cube, i), seed, offset);
+ seed += offset;
+ }
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief
+ Allocates images in an empty imagelist.
+
+ @param cube The cube to allocate.
+ @param x Size in x-dimension.
+ @param y Size in y-dimension.
+ @param z Size in z-dimension.
+
+ */
+void kmclipm_test_alloc_cube(cpl_imagelist *cube,
+ int x,
+ int y,
+ int z)
+{
+ int i = 0;
+ cpl_image *img = NULL;
+
+ cpl_test_eq(0, cpl_imagelist_get_size(cube));
+
+ for (i = 0; i < z; i++) {
+ cpl_test_nonnull(img = cpl_image_new(x, y, CPL_TYPE_FLOAT));
+ cpl_imagelist_set(cube, img, i);
+ cpl_test_error(CPL_ERROR_NONE);
+ }
+}
+
+/**
+ @brief Routine to test kmclipm_load_image_with_extensions()
+ */
+void test_kmclipm_load_image_with_extensions()
+{
+ float *img_data = NULL;
+
+ cpl_image *img1 = NULL,
+ *img2 = NULL,
+ *img3 = NULL,
+ *img_ref = NULL,
+ *ret_ptr = NULL;
+
+ int i = 0,
+ j = 0,
+ k = 0;
+
+ char *path0 = cpl_sprintf("%s%s", ".", "/test_data/test_ext0.fits");
+ char *path1 = cpl_sprintf("%s%s", ".", "/test_data/test_ext1.fits");
+ char *path2 = cpl_sprintf("%s%s", ".", "/test_data/test_ext2.fits");
+ char *path3 = cpl_sprintf("%s%s", ".", "/test_data/test_ext3.fits");
+
+ /* --- empty image with no extensions */
+ cpl_image_save(NULL, path0, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT);
+
+ /* --- image with only one extension */
+ cpl_image_save(NULL, path1, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT);
+ img1 = cpl_image_new(10, 5, CPL_TYPE_FLOAT);
+ img_data = cpl_image_get_data_float(img1);
+ for (i = 0; i< 10 * 5; i++) { img_data[i] = 1.0; }
+ cpl_image_save(img1, path1, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_EXTEND);
+
+ /* --- image with only two extensions */
+ cpl_image_save(NULL, path2, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT);
+ img2 = cpl_image_new(10, 5, CPL_TYPE_FLOAT);
+ img_data = cpl_image_get_data_float(img2);
+ for (i = 0; i< 10 * 5; i++) { img_data[i] = 2.0; }
+ cpl_image_save(img1, path2, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_EXTEND);
+ cpl_image_save(img2, path2, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_EXTEND);
+
+ /* --- image with three extensions */
+ cpl_image_save(NULL, path3, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT);
+ img3 = cpl_image_new(10, 5, CPL_TYPE_FLOAT);
+ img_data = cpl_image_get_data_float(img3);
+ for (i = 0; i< 10 * 5; i++) { img_data[i] = 3.0; }
+ cpl_image_save(img1, path3, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_EXTEND);
+ cpl_image_save(img2, path3, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_EXTEND);
+ cpl_image_save(img3, path3, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_EXTEND);
+
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+ cpl_image_delete(img3); img3 = NULL;
+
+ /* ----- test with wrong values ----- */
+ cpl_msg_set_level(CPL_MSG_OFF);
+ /* --- empty path */
+ cpl_test_null(ret_ptr = kmclipm_load_image_with_extensions(NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* --- empty image with no extensions */
+ cpl_test_null(ret_ptr = kmclipm_load_image_with_extensions(path0));
+ if (((cpl_version_get_major() == 5) && (cpl_version_get_minor() >= 3)) ||
+ (cpl_version_get_major() > 5))
+ {
+ cpl_test_error(CPL_ERROR_BAD_FILE_FORMAT);
+ } else {
+ cpl_test_error(CPL_ERROR_FILE_IO);
+ }
+
+ /* --- image with only one extension */
+ cpl_test_null(ret_ptr = kmclipm_load_image_with_extensions(path1));
+ if (((cpl_version_get_major() == 5) && (cpl_version_get_minor() >= 3)) ||
+ (cpl_version_get_major() > 5))
+ {
+ cpl_test_error(CPL_ERROR_BAD_FILE_FORMAT);
+ } else {
+ cpl_test_error(CPL_ERROR_FILE_IO);
+ }
+
+ /* --- image with only two extensions */
+ cpl_test_null(ret_ptr = kmclipm_load_image_with_extensions(path2));
+ if (((cpl_version_get_major() == 5) && (cpl_version_get_minor() >= 3)) ||
+ (cpl_version_get_major() > 5))
+ {
+ cpl_test_error(CPL_ERROR_BAD_FILE_FORMAT);
+ } else {
+ cpl_test_error(CPL_ERROR_FILE_IO);
+ }
+
+ cpl_msg_set_level(my_level);
+
+ /* ----- test with correct values ----- */
+ /* --- image with three extensions */
+ cpl_test_nonnull(ret_ptr = kmclipm_load_image_with_extensions(path3));
+
+ /* create reference image and compare it with output */
+ img_ref = cpl_image_new(30, 5, CPL_TYPE_FLOAT);
+ img_data = cpl_image_get_data_float(img_ref);
+ for (k = 1; k <= 3; k++) {
+ for (i = 1; i <= 10; i++) {
+ for (j = 1; j <= 5; j++) {
+ img_data[((k - 1) * 10 + i - 1) + (j - 1) * 30]
+ = (float)k;
+ }
+ }
+ }
+
+ /* Assert that images are equal */
+ cpl_image_subtract(ret_ptr, img_ref);
+ cpl_test_abs(cpl_image_get_max(ret_ptr), 0.0, 0.01);
+
+ cpl_image_delete(img_ref);
+ cpl_image_delete(ret_ptr);
+
+ cpl_free(path0);
+ cpl_free(path1);
+ cpl_free(path2);
+ cpl_free(path3);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_gaussfit_2d()
+{
+ cpl_image *img = NULL;
+
+ double fit[11],
+ err = 0.0001;
+
+ /* ----- test with wrong values ----- */
+ /* --- empty image, empty fit-parameters */
+ kmclipm_gaussfit_2d(NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* --- empty image, empty fit-parameters */
+ img = cpl_image_new(20,20, CPL_TYPE_FLOAT);
+ kmclipm_gaussfit_2d(img, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* ----- test with correct values ----- */
+ cpl_image_fill_gaussian(img, 6.5, 8.0, 1.0, 3.0, 3.0);
+
+ cpl_test_error(kmclipm_gaussfit_2d(img, fit));
+
+ cpl_test_abs(fit[0], 0.0176839, err);
+ cpl_test_abs(fit[1], 6.5 - err, err);
+ cpl_test_abs(fit[2], 8.0, err);
+ cpl_test_abs(fit[3], 7.06446, err);
+ cpl_test_abs(fit[4], -2.93566e-12, err);
+ cpl_test_abs(fit[5], 2.76066e-11, err);
+ cpl_test_abs(fit[6], 4.68791e-09, err);
+ cpl_test_abs(fit[7], 4.64295e-09, err);
+ cpl_test_abs(fit[8], 9.3853e-09, err);
+ cpl_test_abs(fit[9], 7.09255e-12, err);
+
+ cpl_image_delete(img); img = NULL;
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_reconstruct()
+{
+ cpl_image *img = NULL;
+ float *img_data = NULL;
+ cpl_imagelist *cube = NULL;
+ cpl_imagelist *refCube = NULL;
+ int ix, iy, il;
+ int p;
+ int mx, dx;
+
+ /* ----- test with correct values ----- */
+
+ gridDefinition gd;
+ gd.lamdaDistanceScale = 1.0;
+ gd.x.start = -1300;
+ gd.x.delta = 200;
+ gd.x.dim = (1300 - gd.x.start) / gd.x.delta + 1;
+ gd.y.start = -1300;
+ gd.y.delta = 200;
+ gd.y.dim = (1300 - gd.y.start) / gd.y.delta + 1;
+ gd.l.start = 1.927;
+ gd.l.delta = 0.0002649921875;
+ gd.l.dim = (2.469704 - gd.l.start) / gd.l.delta + 1;
+ gd.method = NEAREST_NEIGHBOR;
+ gd.neighborHood.distance = 1.001;
+ gd.neighborHood.scale = PIXEL;
+ gd.neighborHood.type = N_CUBE;
+ gd.rot_na_angle = 0.0;
+ gd.rot_off_angle = 0.0;
+
+ int imgSize = gd.x.dim * gd.y.dim * gd.l.dim;
+ float *xcalArray = (float *) cpl_calloc(imgSize, sizeof(float));
+ float *ycalArray = (float *) cpl_calloc(imgSize, sizeof(float));
+ float *lcalArray = (float *) cpl_calloc(imgSize, sizeof(float));
+ float *vcalArray = (float *) cpl_calloc(imgSize, sizeof(float));
+
+ ix = setenv("KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE","NONE",1);
+ cpl_array *timestamp = NULL;
+ cpl_vector *calAngles = NULL;
+
+ refCube = cpl_imagelist_new();
+
+ for (il=0; il<gd.l.dim; il++) {
+ img = cpl_image_new(gd.x.dim, gd.y.dim, CPL_TYPE_FLOAT);
+ img_data = cpl_image_get_data_float(img);
+ for (iy=0; iy<gd.y.dim; iy++) {
+ for (ix=0; ix<gd.x.dim; ix++) {
+ p = ix + iy * gd.x.dim + il * gd.x.dim * gd.y.dim;
+ xcalArray[p] = gd.x.start + ix * gd.x.delta;
+ ycalArray[p] = gd.y.start + iy * gd.y.delta;
+ lcalArray[p] = gd.l.start + il * gd.l.delta;
+ vcalArray[p] = sqrt(xcalArray[p]*xcalArray[p] +
+ ycalArray[p]*ycalArray[p] +
+ 1.e6 * lcalArray[p]*lcalArray[p]);
+ img_data[ix + iy*gd.x.dim] = vcalArray[p];
+ }
+ }
+ cpl_imagelist_set (refCube, img, il);
+ }
+ char *my_path = cpl_sprintf("%s/test_data/cube_reference.fits", ".");
+ cpl_imagelist_save(refCube, my_path, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+ cpl_free(my_path);
+ for (il=0; il<gd.l.dim; il++) {
+ for (iy=0; iy<gd.y.dim; iy++) {
+ for (ix=0; ix<gd.x.dim; ix++) {
+ int p = ix + iy * gd.x.dim + il * gd.x.dim * gd.y.dim;
+ if ((10*il/gd.l.dim == 10*ix/gd.x.dim) ||
+ (10*il/gd.l.dim == 10*iy/gd.y.dim))
+ {
+ xcalArray[p] = 0;
+ ycalArray[p] = 0;
+ lcalArray[p] = 0;
+ }
+ }
+ }
+ }
+
+ cpl_image *xcal = cpl_image_wrap_float(gd.x.dim * gd.y.dim, gd.l.dim, xcalArray);
+ cpl_image *ycal = cpl_image_wrap_float(gd.x.dim * gd.y.dim, gd.l.dim, ycalArray);
+ cpl_image *lcal = cpl_image_wrap_float(gd.x.dim * gd.y.dim, gd.l.dim, lcalArray);
+ cpl_image *vcal = cpl_image_wrap_float(gd.x.dim * gd.y.dim, gd.l.dim, vcalArray);
+/* printf("--> Memory dump before kmclipm_reconstruct\n");
+ cpl_memory_dump();*/
+ int method [3] = {NEAREST_NEIGHBOR, LINEAR_WEIGHTED_NEAREST_NEIGHBOR,
+ SQUARE_WEIGHTED_NEAREST_NEIGHBOR};
+ for (mx=0; mx<3; mx++) {
+ gd.method = method[mx];
+ float distances [6] = {0.9, 0.999, 1.0, 1.001, 1.9, 2.1};
+ for (dx=0; dx<6; dx++) {
+ for (p=0; p<gd.x.dim*gd.y.dim*gd.l.dim; p++) {
+ if (xcalArray[p] >= 0.0) { /* mark ycal data (which is swapped with xcal */
+ xcalArray[p] += 0.1; /* for IFU 1) as assigned for IFU 1 */
+ ycalArray[p] += 0.1;
+ } else {
+ xcalArray[p] -= 0.1;
+ ycalArray[p] -= 0.1;
+ }
+ }
+ gd.neighborHood.distance = distances[dx];
+ cpl_imagelist *dummy_noise_cube = NULL;
+ timestamp = kmclipm_reconstruct_nnlut_get_timestamp("", 1, gd);
+ calAngles = cpl_vector_new(3);
+ cube = kmclipm_reconstruct(1, vcal, NULL, xcal, ycal, lcal, gd, "",
+ FALSE, timestamp, calAngles, &dummy_noise_cube);
+ cpl_array_delete(timestamp);
+ cpl_vector_delete(calAngles);
+ char * fileName = cpl_sprintf("%s/test_data/cube_nearestNeigbor_%1d_%5.4f.fits",
+ ".", gd.method, gd.neighborHood.distance);
+/* printf("%s\n",fileName); */
+ if (cube != NULL) {
+ cpl_imagelist_save(cube, fileName, CPL_BPP_IEEE_FLOAT, NULL,
+ CPL_IO_CREATE);
+ }
+ cpl_free(fileName); fileName = NULL;
+ cpl_imagelist *diffCube = cpl_imagelist_duplicate (refCube);
+ cpl_imagelist_subtract( diffCube, cube);
+ fileName = cpl_sprintf("%s/test_data/cube_nearestNeigbor_%1d_%5.4f_diff.fits",
+ ".", gd.method, gd.neighborHood.distance);
+ if (diffCube != NULL) {
+ cpl_imagelist_save(diffCube, fileName, CPL_BPP_IEEE_FLOAT,
+ NULL, CPL_IO_CREATE);
+ }
+ cpl_free(fileName); fileName = NULL;
+ cpl_imagelist_delete(cube); cube = NULL;
+ cpl_imagelist_delete(diffCube); diffCube = NULL;
+ }
+
+ }
+ cpl_imagelist_delete(refCube); refCube = NULL;
+/* printf("--> Memory dump after freeing returned cube\n");\
+ cpl_memory_dump();
+*/
+
+ /*printf("--=--> %f\n",4.8);*/
+ cpl_image_delete(xcal); xcal = NULL;
+ cpl_image_delete(ycal); ycal = NULL;
+ cpl_image_delete(lcal); lcal = NULL;
+ cpl_image_delete(vcal); vcal = NULL;
+ /*printf("--=--> %f\n",4.2);*/
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+int single_shift_test(const char *filename,
+ cpl_image *image,
+ double xshift,
+ double yshift,
+ const char *method,
+ enum extrapolationType type)
+{
+ FILE *idl = NULL;
+ cpl_imagelist *cube = NULL,
+ *cube1 = NULL,
+ *cube2 = NULL;
+ float *pixel = NULL;
+ int result = -1;
+#if KMCLIPM_GET_INSTALLED_CPL_VERSION >= 6
+ cpl_size xdim = 0,
+ ydim = 0,
+ i = 0,
+ j = 0;
+#define FT_CPLSIZE "lld"
+#else
+ int xdim = 0,
+ ydim = 0,
+ i = 0,
+ j = 0;
+#define FT_CPLSIZE "d"
+#endif
+ char *dataFilename = cpl_sprintf("%s/test_data/kmclipm_test_shift_%s.dat", ".", filename);
+ char *refFilename = cpl_sprintf("%s/ref/kmclipm_test_shift_%s.ref", getenv("srcdir"), filename);
+ idl = fopen(dataFilename, "w");
+
+ xdim = cpl_image_get_size_x(image);
+ ydim = cpl_image_get_size_y(image);
+
+ fprintf(idl, "%"FT_CPLSIZE" %"FT_CPLSIZE"\n", xdim, ydim);
+ pixel = cpl_image_get_data_float(image);
+ for (j=0; j<ydim ; j++) {
+ for (i=0; i<xdim ; i++) {
+ fprintf(idl, " %g", pixel[i + j*xdim]);
+ }
+ }
+ fprintf(idl, "\n");
+
+ cube = cpl_imagelist_new();
+ cpl_imagelist_set(cube,cpl_image_duplicate(image),0);
+ cpl_test_nonnull(cube1 = kmclipm_shift(cube, xshift, yshift, method, type));
+ cpl_imagelist_delete(cube); cube = NULL;
+
+ pixel = cpl_image_get_data_float(cpl_imagelist_get(cube1, 0));
+ xdim = cpl_image_get_size_x(cpl_imagelist_get(cube1, 0));
+ ydim = cpl_image_get_size_y(cpl_imagelist_get(cube1, 0));
+ fprintf(idl, "%"FT_CPLSIZE" %"FT_CPLSIZE"\n", xdim, ydim);
+ for (j=0; j<ydim ; j++) {
+ for (i=0; i<xdim ; i++) {
+ fprintf(idl, " %g", pixel[i + j*xdim]);
+ }
+ }
+ fprintf(idl, "\n");
+
+ cpl_test_nonnull(cube2 = kmclipm_shift(cube1, -xshift, -yshift, method, type));
+ cpl_imagelist_delete(cube1);
+
+ pixel = cpl_image_get_data_float(cpl_imagelist_get(cube2, 0));
+ xdim = cpl_image_get_size_x(cpl_imagelist_get(cube2, 0));
+ ydim = cpl_image_get_size_y(cpl_imagelist_get(cube2, 0));
+ fprintf(idl, "%"FT_CPLSIZE" %"FT_CPLSIZE"\n", xdim, ydim);
+ for (j=0; j<ydim ; j++) {
+ for (i=0; i<xdim ; i++) {
+ fprintf(idl, " %g", pixel[i + j*xdim]);
+ }
+ }
+ fprintf(idl, "\n");
+ cpl_imagelist_delete(cube2);
+
+ fclose(idl);
+ char* cmpCommand = cpl_sprintf("cmp %s %s", dataFilename, refFilename);
+ result = system(cmpCommand);
+ cpl_free(dataFilename); dataFilename = NULL;
+ cpl_free(refFilename); refFilename = NULL;
+ cpl_free(cmpCommand); cmpCommand = NULL;
+
+ return result;
+}
+
+void test_kmclipm_shift() {
+
+ cpl_image *image;
+ double xshift;
+ double yshift;
+
+ const int xdim=14;
+ const int ydim=14;
+
+ image = cpl_image_new(xdim, ydim, CPL_TYPE_FLOAT);
+ /*
+ cpl_image_set(image, 3, 4, 1.0);
+ cpl_image_set(image, 5, 3, 2.0);
+ */
+ cpl_image_fill_gaussian(image,xdim/2.,ydim/2.,200.,xdim/8.,ydim/8.);
+ xshift = -0.8;
+ yshift = -0.8;
+
+ cpl_test_eq(0, single_shift_test("BCS_NATURAL-0.8", image, xshift, yshift,
+ "BCS", BCS_NATURAL));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, single_shift_test("BCS_ESTIMATED-0.8", image, xshift, yshift,
+ "BCS", BCS_ESTIMATED));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, single_shift_test("BCS_NANS-0.8", image, xshift, yshift,
+ "BCS", NONE_NANS));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, single_shift_test("BCS_CLIPPING-0.8", image, xshift, yshift,
+ "BCS", NONE_CLIPPING));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, single_shift_test("NN_NANS-0.8", image, xshift, yshift,
+ "NN", NONE_NANS));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, single_shift_test("NN_CLIPPING-0.8", image, xshift, yshift,
+ "NN", NONE_CLIPPING));
+ cpl_test_error(CPL_ERROR_NONE);
+
+ xshift = +0.8;
+ yshift = +0.8;
+
+ cpl_test_eq(0, single_shift_test("BCS_NATURAL+0.8", image, xshift, yshift,
+ "BCS", BCS_NATURAL));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, single_shift_test("BCS_ESTIMATED+0.8", image, xshift, yshift,
+ "BCS", BCS_ESTIMATED));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, single_shift_test("BCS_NANS+0.8", image, xshift, yshift,
+ "BCS", NONE_NANS));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, single_shift_test("BCS_CLIPPING+0.8", image, xshift, yshift,
+ "BCS", NONE_CLIPPING));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, single_shift_test("NN_NANS+0.8", image, xshift, yshift,
+ "NN", NONE_NANS));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, single_shift_test("NN_CLIPPING+0.8", image, xshift, yshift,
+ "NN", NONE_CLIPPING));
+
+ xshift = +1.0;
+ yshift = +1.0;
+ cpl_test_eq(0, single_shift_test("BCS_NANS+1.0", image, xshift, yshift,
+ "BCS", NONE_NANS));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, single_shift_test("BCS_CLIPPING+1.0", image, xshift, yshift,
+ "BCS", NONE_CLIPPING));
+ cpl_test_error(CPL_ERROR_NONE);
+
+ xshift = -1.0;
+ yshift = -1.0;
+ cpl_test_eq(0, single_shift_test("BCS_NANS-1.0", image, xshift, yshift,
+ "BCS", NONE_NANS));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, single_shift_test("BCS_CLIPPING-1.0", image, xshift, yshift,
+ "BCS", NONE_CLIPPING));
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_image_delete(image);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+int single_rotate_test(const char *filename,
+ cpl_image *image,
+ double alpha,
+ const char *method,
+ enum extrapolationType type)
+{
+ FILE *idl = NULL;
+ cpl_imagelist *cube = NULL,
+ *cube1 = NULL,
+ *cube2 = NULL;
+ float *pixel = NULL;
+ int result = -1;
+#if KMCLIPM_GET_INSTALLED_CPL_VERSION >= 6
+ cpl_size xdim = 0,
+ ydim = 0,
+ i = 0,
+ j = 0;
+#define FT_CPLSIZE "lld"
+#else
+ int xdim = 0,
+ ydim = 0,
+ i = 0,
+ j = 0;
+#define FT_CPLSIZE "d"
+#endif
+
+ char *dataFilename = cpl_sprintf("%s/test_data/kmclipm_test_rotate_%s.dat", ".", filename);
+ char *refFilename = cpl_sprintf("%s/ref/kmclipm_test_rotate_%s.ref", getenv("srcdir"), filename);
+ idl = fopen(dataFilename, "w");
+
+ xdim = cpl_image_get_size_x(image);
+ ydim = cpl_image_get_size_y(image);
+ fprintf(idl, "%"FT_CPLSIZE" %"FT_CPLSIZE"\n", xdim, ydim);
+
+ pixel = cpl_image_get_data_float(image);
+ for (j=0; j<ydim ; j++) {
+ for (i=0; i<xdim ; i++) {
+ fprintf(idl, " %g", pixel[i + j*xdim]);
+ }
+ }
+ fprintf(idl, "\n");
+
+ cube = cpl_imagelist_new();
+ cpl_imagelist_set(cube,cpl_image_duplicate(image),0);
+ cpl_test_nonnull(cube1 = kmclipm_rotate(cube, alpha, method, type));
+ cpl_imagelist_delete(cube);
+
+ pixel = cpl_image_get_data_float(cpl_imagelist_get(cube1, 0));
+ xdim = cpl_image_get_size_x(cpl_imagelist_get(cube1, 0));
+ ydim = cpl_image_get_size_y(cpl_imagelist_get(cube1, 0));
+ fprintf(idl, "%"FT_CPLSIZE" %"FT_CPLSIZE"\n", xdim, ydim);
+ for (j=0; j<ydim ; j++) {
+ for (i=0; i<xdim ; i++) {
+ fprintf(idl, " %g", pixel[i + j*xdim]);
+ }
+ }
+ fprintf(idl, "\n");
+
+ cpl_test_nonnull(cube2 = kmclipm_rotate(cube1, -alpha, method, type));
+ cpl_imagelist_delete(cube1);
+
+ pixel = cpl_image_get_data_float(cpl_imagelist_get(cube2, 0));
+ xdim = cpl_image_get_size_x(cpl_imagelist_get(cube2, 0));
+ ydim = cpl_image_get_size_y(cpl_imagelist_get(cube2, 0));
+ fprintf(idl, "%"FT_CPLSIZE" %"FT_CPLSIZE"\n", xdim, ydim);
+ for (j=0; j<ydim ; j++) {
+ for (i=0; i<xdim ; i++) {
+ fprintf(idl, " %g", pixel[i + j*xdim]);
+ }
+ }
+ fprintf(idl, "\n");
+ cpl_imagelist_delete(cube2);
+
+ fclose(idl);
+ char* cmpCommand = cpl_sprintf("cmp %s %s", dataFilename, refFilename);
+ result = system(cmpCommand);
+ cpl_free(dataFilename); dataFilename = NULL;
+ cpl_free(refFilename); refFilename = NULL;
+ cpl_free(cmpCommand); cmpCommand = NULL;
+
+ return result;
+}
+
+void test_kmclipm_rotate() {
+ cpl_image *image;
+ const int xdim=14;
+ const int ydim=14;
+ char *testName;
+ char *errorMessage;
+ double alphas [] = {4.,40.,90.,180.,270.,356.,-1.};
+ double alpha;
+ FILE *animFile = NULL;
+ cpl_imagelist *cubein;
+ cpl_imagelist *cubeout;
+ float *pixel;
+ int rl, al;
+ char *my_path;
+
+ image = cpl_image_new(xdim, ydim, CPL_TYPE_FLOAT);
+ cpl_image_fill_gaussian(image,xdim/3.,ydim/3.,200.,xdim/8.,ydim/8.);
+
+ int idx=0;
+ while (alphas[idx] > 0.) {
+ alpha = alphas[idx] / 180.0 * CPL_MATH_PI;
+ testName = cpl_sprintf("BCS_NATURAL_%03g", alphas[idx]);
+ errorMessage = cpl_sprintf("kmclipm_rotate: BCS_NATURAL_%03.0g does "
+ "not match reference", alphas[idx]);
+ cpl_test_eq(0, single_rotate_test(testName, image, alpha, "BCS",
+ BCS_NATURAL));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_free(testName); testName = NULL;
+ cpl_free(errorMessage); errorMessage = NULL;
+
+
+ testName = cpl_sprintf("BCS_ESTIMATED_%03g", alphas[idx]);
+ errorMessage = cpl_sprintf("kmclipm_rotate: BCS_ESTIMATED_%03.0g does "
+ "not match reference", alphas[idx]);
+ cpl_test_eq(0, single_rotate_test(testName, image, alpha, "BCS",
+ BCS_ESTIMATED));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_free(testName); testName = NULL;
+ cpl_free(errorMessage); errorMessage = NULL;
+
+ testName = cpl_sprintf("BCS_NANS_%03g", alphas[idx]);
+ errorMessage = cpl_sprintf("kmclipm_rotate: BCS_NANS_%03.0g does not "
+ "match reference", alphas[idx]);
+ cpl_test_eq(0, single_rotate_test(testName, image, alpha, "BCS",
+ NONE_NANS));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_free(testName); testName = NULL;
+ cpl_free(errorMessage); errorMessage = NULL;
+
+ alpha = alphas[idx] / 180.0 * CPL_MATH_PI;
+ testName = cpl_sprintf("RESIZE_BCS_NATURAL_%03g", alphas[idx]);
+ errorMessage = cpl_sprintf("kmclipm_rotate: RESIZE_BCS_NATURAL_%03.0g "
+ "does not match reference", alphas[idx]);
+ cpl_test_eq(0, single_rotate_test(testName, image, alpha, "BCS",
+ RESIZE_BCS_NATURAL));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_free(testName); testName = NULL;
+ cpl_free(errorMessage); errorMessage = NULL;
+
+ testName = cpl_sprintf("RESIZE_BCS_ESTIMATED_%03g", alphas[idx]);
+ errorMessage = cpl_sprintf("kmclipm_rotate: RESIZE_BCS_ESTIMATED_%03.0g "
+ "does not match reference", alphas[idx]);
+ cpl_test_eq(0, single_rotate_test(testName, image, alpha, "BCS",
+ RESIZE_BCS_ESTIMATED));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_free(testName); testName = NULL;
+ cpl_free(errorMessage); errorMessage = NULL;
+
+ testName = cpl_sprintf("RESIZE_NANS_%03g", alphas[idx]);
+ errorMessage = cpl_sprintf("kmclipm_rotate: RESIZE_NANS_%03.0g does not "
+ "match reference", alphas[idx]);
+ cpl_test_eq(0, single_rotate_test(testName, image, alpha, "BCS",
+ RESIZE_NANS));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_free(testName); testName = NULL;
+ cpl_free(errorMessage); errorMessage = NULL;
+
+ testName = cpl_sprintf("NN_%03g", alphas[idx]);
+ errorMessage = cpl_sprintf("kmclipm_rotate: NN_%03.0g does not "
+ "match reference", alphas[idx]);
+ cpl_test_eq(0, single_rotate_test(testName, image, alpha, "NN",
+ NONE_NANS));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_free(testName); testName = NULL;
+ cpl_free(errorMessage); errorMessage = NULL;
+
+ testName = cpl_sprintf("NN_RESIZE_%03g", alphas[idx]);
+ errorMessage = cpl_sprintf("kmclipm_rotate: RESIZE_NN_%03.0g does not "
+ "match reference", alphas[idx]);
+ cpl_test_eq(0, single_rotate_test(testName, image, alpha, "NN",
+ RESIZE_NANS));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_free(testName); testName = NULL;
+ cpl_free(errorMessage); errorMessage = NULL;
+
+ idx++;
+ }
+
+ cubein = cpl_imagelist_new();
+ cpl_imagelist_set(cubein,cpl_image_duplicate(image),0);
+ enum extrapolationType eType = NONE_NANS;
+ const char *method;
+ for (rl=0; rl<8; rl++) {
+ switch (rl) {
+ case 0:
+ method = "BCS";
+ eType = NONE_NANS;
+ my_path = cpl_sprintf("%s/test_data/kmclipm_test_rotate_animation_NONE_NANS.dat", ".");
+ animFile = fopen(my_path, "w");
+ cpl_free(my_path);
+ break;
+ case 1:
+ method = "BCS";
+ eType = BCS_NATURAL;
+ my_path = cpl_sprintf("%s/test_data/kmclipm_test_rotate_animation_BCS_NATURAL.dat", ".");
+ animFile = fopen(my_path, "w");
+ cpl_free(my_path);
+ break;
+ case 2:
+ method = "BCS";
+ eType = BCS_ESTIMATED;
+ my_path = cpl_sprintf("%s/test_data/kmclipm_test_rotate_animation_BCS_ESTIMATED.dat", ".");
+ animFile = fopen(my_path, "w");
+ cpl_free(my_path);
+ break;
+ case 3:
+ method = "BCS";
+ eType = RESIZE_NANS;
+ my_path = cpl_sprintf("%s/test_data/kmclipm_test_rotate_animation_RESIZE_NANS.dat", ".");
+ animFile = fopen(my_path, "w");
+ cpl_free(my_path);
+ break;
+ case 4:
+ method = "BCS";
+ eType = RESIZE_BCS_NATURAL;
+ my_path = cpl_sprintf("%s/test_data/kmclipm_test_rotate_animation_RESIZE_BCS_NATURAL.dat", ".");
+ animFile = fopen(my_path, "w");
+ cpl_free(my_path);
+ break;
+ case 5:
+ method = "BCS";
+ eType = RESIZE_BCS_ESTIMATED;
+ my_path = cpl_sprintf("%s/test_data/kmclipm_test_rotate_animation_RESIZE_BCS_ESTIMATED.dat", ".");
+ animFile = fopen(my_path, "w");
+ cpl_free(my_path);
+ break;
+ case 6:
+ method = "NN";
+ eType = NONE_NANS;
+ my_path = cpl_sprintf("%s/test_data/kmclipm_test_rotate_animation_NONE_NANS_NN.dat", ".");
+ animFile = fopen(my_path, "w");
+ cpl_free(my_path);
+ break;
+ case 7:
+ method = "NN";
+ eType = RESIZE_NANS;
+ my_path = cpl_sprintf("%s/test_data/kmclipm_test_rotate_animation_RESIZE_NANS_NN.dat", ".");
+ animFile = fopen(my_path, "w");
+ cpl_free(my_path);
+ break;
+ }
+
+#if KMCLIPM_GET_INSTALLED_CPL_VERSION >= 6
+ cpl_size i = 0,
+ j = 0,
+ xc = 0,
+ yc = 0,
+ xo = 0,
+ yo = 0;
+#else
+ int i = 0,
+ j = 0,
+ xc = 0,
+ yc = 0,
+ xo = 0,
+ yo = 0;
+#endif
+ fprintf(animFile, "%d %d %d\n",100,20,20);
+ for (al=0.0; al<360.; al=al+3.6) {
+ alpha = al / 180.0 * CPL_MATH_PI;
+ cpl_test_nonnull(cubeout = kmclipm_rotate(cubein, alpha, method, eType));
+ pixel = cpl_image_get_data_float(cpl_imagelist_get(cubeout, 0));
+ xc = cpl_image_get_size_x(cpl_imagelist_get(cubeout, 0));
+ yc = cpl_image_get_size_y(cpl_imagelist_get(cubeout, 0));
+ xo = (20 - xc) / 2;
+ yo = (20 - yc) / 2;
+ for (j=0; j<20 ; j++) {
+ for (i=0; i<20 ; i++) {
+ if (i <= xo || i >= 20-xo || j <= yo || j >= 20-yo) {
+ fprintf(animFile, " %g", 0.2);
+ } else {
+ fprintf(animFile, " %g", pixel[i-xo + (j-yo)*xc]);
+ }
+ }
+ }
+ fprintf(animFile, "\n");
+ cpl_imagelist_delete(cubeout);
+ }
+ fclose(animFile);
+ }
+ cpl_imagelist_delete(cubein);
+ cpl_image_delete(image);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ * @brief test for kmclipm_reject_deviant()
+ */
+void test_kmclipm_reject_deviant()
+{
+ cpl_msg_set_level(CPL_MSG_OFF);
+ kmclipm_reject_deviant(NULL, -2, -2, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ double stddev = 0, mean = 0;
+ cpl_vector *d = cpl_vector_new(5);
+ cpl_vector_set(d, 0, 0.1);
+ cpl_vector_set(d, 1, 100);
+ cpl_vector_set(d, 2, 0.05);
+ cpl_vector_set(d, 3, 0.74);
+ cpl_vector_set(d, 4, 0.2);
+ kmclipm_vector *dd = kmclipm_vector_create(d);
+
+ kmclipm_reject_deviant(dd, -2, -2, NULL, NULL);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ kmclipm_reject_deviant(dd, 0, -2, NULL, NULL);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_msg_set_level(my_level);
+
+ kmclipm_reject_deviant(dd, 3, 3, NULL, NULL);
+ cpl_test_eq(1, cpl_vector_get(dd->mask, 0));
+ cpl_test_eq(0, cpl_vector_get(dd->mask, 1));
+ cpl_test_eq(1, cpl_vector_get(dd->mask, 2));
+ cpl_test_eq(1, cpl_vector_get(dd->mask, 3));
+ cpl_test_eq(1, cpl_vector_get(dd->mask, 4));
+ kmclipm_vector_delete(dd);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ d = cpl_vector_new(5);
+ cpl_vector_set(d, 0, 0.1);
+ cpl_vector_set(d, 1, 100);
+ cpl_vector_set(d, 2, 0.05);
+ cpl_vector_set(d, 3, 0.74);
+ cpl_vector_set(d, 4, 0.2);
+ dd = kmclipm_vector_create(d);
+ kmclipm_reject_deviant(dd, 3, 3, &stddev, NULL);
+ cpl_test_abs(0.317844, stddev, 0.01);
+ cpl_test_eq(1, cpl_vector_get(dd->mask, 0));
+ cpl_test_eq(0, cpl_vector_get(dd->mask, 1));
+ cpl_test_eq(1, cpl_vector_get(dd->mask, 2));
+ cpl_test_eq(1, cpl_vector_get(dd->mask, 3));
+ cpl_test_eq(1, cpl_vector_get(dd->mask, 4));
+ kmclipm_vector_delete(dd);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ d = cpl_vector_new(5);
+ cpl_vector_set(d, 0, 0.1);
+ cpl_vector_set(d, 1, 100);
+ cpl_vector_set(d, 2, 0.05);
+ cpl_vector_set(d, 3, 0.74);
+ cpl_vector_set(d, 4, 0.2);
+ dd = kmclipm_vector_create(d);
+ kmclipm_reject_deviant(dd, 3, 3, &stddev, &mean);
+ cpl_test_abs(0.317844, stddev, 0.01);
+ cpl_test_abs(0.2725, mean, 0.01);
+ cpl_test_eq(1, cpl_vector_get(dd->mask, 0));
+ cpl_test_eq(0, cpl_vector_get(dd->mask, 1));
+ cpl_test_eq(1, cpl_vector_get(dd->mask, 2));
+ cpl_test_eq(1, cpl_vector_get(dd->mask, 3));
+ cpl_test_eq(1, cpl_vector_get(dd->mask, 4));
+ kmclipm_vector_delete(dd);
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_make_image()
+{
+ float tol = 0.01;
+
+ cpl_imagelist *data = NULL,
+ *noise = NULL;
+
+ cpl_image *data_out = NULL,
+ *noise_out = NULL,
+ *tmp = NULL;
+
+ cpl_vector *slices = NULL;
+
+ /* --- invalid tests --- */
+ cpl_test_eq(CPL_ERROR_NULL_INPUT, kmclipm_make_image(NULL, NULL,
+ NULL, NULL,
+ NULL,
+ "gaga",
+ -1, -1,
+ -1,
+ -1, -1));
+ cpl_error_reset();
+
+ data = cpl_imagelist_new();
+
+ cpl_test_eq(CPL_ERROR_NULL_INPUT, kmclipm_make_image(data, NULL,
+ NULL, NULL,
+ NULL,
+ "gaga",
+ -1, -1,
+ -1,
+ -1, -1));
+ cpl_error_reset();
+
+ cpl_test_eq(CPL_ERROR_ILLEGAL_INPUT, kmclipm_make_image(data, NULL,
+ &data_out, NULL,
+ NULL,
+ "gaga",
+ -1, -1,
+ -1,
+ -1, -1));
+ cpl_error_reset();
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 0.0, 0.1);
+ cpl_imagelist_set(data, tmp, 0);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 1.0, 0.1);
+ cpl_imagelist_set(data, tmp, 1);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 3.0, 0.1);
+ cpl_imagelist_set(data, tmp, 2);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 1.0, 0.1);
+ cpl_imagelist_set(data, tmp, 3);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 1.0, 0.1);
+ cpl_imagelist_set(data, tmp, 4);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 1.0, 0.1);
+ cpl_imagelist_set(data, tmp, 5);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 1.0, 0.1);
+ cpl_imagelist_set(data, tmp, 6);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 1.0, 0.1);
+ cpl_imagelist_set(data, tmp, 7);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 1.0, 0.1);
+ cpl_imagelist_set(data, tmp, 8);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 199.0, 0.1);
+ cpl_imagelist_set(data, tmp, 9);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 1.0, 0.1);
+ cpl_imagelist_set(data, tmp, 10);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 1.0, 0.1);
+ cpl_imagelist_set(data, tmp, 11);
+
+ cpl_test_eq(CPL_ERROR_ILLEGAL_INPUT, kmclipm_make_image(data, NULL,
+ &data_out, NULL,
+ NULL,
+ "gaga",
+ -1, -1,
+ -1,
+ -1, -1));
+ cpl_error_reset();
+
+ cpl_test_eq(CPL_ERROR_ILLEGAL_INPUT, kmclipm_make_image(data, NULL,
+ &data_out, NULL,
+ NULL,
+ "ksigma",
+ 2, -1,
+ -1,
+ -1, -1));
+ cpl_error_reset();
+
+ cpl_test_eq(CPL_ERROR_ILLEGAL_INPUT, kmclipm_make_image(data, NULL,
+ &data_out, NULL,
+ NULL,
+ "ksigma",
+ 2, 2,
+ -1,
+ -1, -1));
+ cpl_error_reset();
+
+ cpl_test_eq(CPL_ERROR_ILLEGAL_INPUT, kmclipm_make_image(data, NULL,
+ &data_out, NULL,
+ NULL,
+ "min_max",
+ -1, -1,
+ -1,
+ -1, -1));
+ cpl_error_reset();
+
+ cpl_test_eq(CPL_ERROR_ILLEGAL_INPUT, kmclipm_make_image(data, NULL,
+ &data_out, NULL,
+ NULL,
+ "min_max",
+ -1, -1,
+ -1,
+ 1, -1));
+ cpl_error_reset();
+
+ noise = cpl_imagelist_new();
+
+ cpl_test_eq(CPL_ERROR_ILLEGAL_INPUT, kmclipm_make_image(data, noise,
+ &data_out, NULL,
+ NULL,
+ "median",
+ -1, -1,
+ -1,
+ -1, -1));
+ cpl_error_reset();
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 0.0, 0.01);
+ cpl_imagelist_set(noise, tmp, 0);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 0.1, 0.01);
+ cpl_imagelist_set(noise, tmp, 1);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 0.3, 0.01);
+ cpl_imagelist_set(noise, tmp, 2);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 0.4, 0.01);
+ cpl_imagelist_set(noise, tmp, 3);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 0.0, 0.01);
+ cpl_imagelist_set(noise, tmp, 4);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 0.1, 0.01);
+ cpl_imagelist_set(noise, tmp, 5);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 0.3, 0.01);
+ cpl_imagelist_set(noise, tmp, 6);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 0.4, 0.01);
+ cpl_imagelist_set(noise, tmp, 7);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 0.0, 0.01);
+ cpl_imagelist_set(noise, tmp, 8);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 0.1, 0.01);
+ cpl_imagelist_set(noise, tmp, 9);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 0.3, 0.01);
+ cpl_imagelist_set(noise, tmp, 10);
+
+ tmp = cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ kmclipm_test_fill_image(tmp, 0.4, 0.01);
+ cpl_imagelist_set(noise, tmp, 11);
+
+ slices = cpl_vector_new(3);
+ cpl_vector_fill(slices, 1.0);
+ cpl_test_eq(CPL_ERROR_ILLEGAL_INPUT, kmclipm_make_image(data, noise,
+ &data_out, NULL,
+ slices,
+ "median",
+ -1, -1,
+ -1,
+ -1, -1));
+ cpl_error_reset();
+ cpl_vector_delete(slices);
+
+ /* --- valid tests --- */
+
+ slices = cpl_vector_new(12);
+ cpl_vector_set(slices, 0, 1.0);
+ cpl_vector_set(slices, 1, 1.0);
+ cpl_vector_set(slices, 2, 1.0);
+ cpl_vector_set(slices, 3, 1.0);
+ cpl_vector_set(slices, 4, 1.0);
+ cpl_vector_set(slices, 5, 1.0);
+ cpl_vector_set(slices, 6, 1.0);
+ cpl_vector_set(slices, 7, 1.0);
+ cpl_vector_set(slices, 8, 1.0);
+ cpl_vector_set(slices, 9, 0.0);
+ cpl_vector_set(slices, 10, 1.0);
+ cpl_vector_set(slices, 11, 1.0);
+
+ cpl_test_eq(CPL_ERROR_NONE, kmclipm_make_image(data, NULL,
+ &data_out, NULL,
+ NULL,
+ "median",
+ -1, -1,
+ -1,
+ -1, -1));
+ cpl_test_abs(cpl_image_get_mean(data_out), 5.94998, tol);
+ cpl_image_delete(data_out);
+
+ cpl_test_eq(CPL_ERROR_NONE, kmclipm_make_image(data, noise,
+ &data_out, &noise_out,
+ NULL,
+ "median",
+ -1, -1,
+ -1,
+ -1, -1));
+ cpl_test_abs(cpl_image_get_mean(data_out), 5.94998, tol);
+ cpl_test_abs(cpl_image_get_mean(noise_out), 17.2348, tol);
+ cpl_image_delete(data_out);
+ cpl_image_delete(noise_out);
+
+ cpl_test_eq(CPL_ERROR_NONE, kmclipm_make_image(data, noise,
+ &data_out, &noise_out,
+ slices,
+ "median",
+ -1, -1,
+ -1,
+ -1, -1));
+ cpl_test_abs(cpl_image_get_mean(data_out), 5.94998, tol);
+ cpl_test_abs(cpl_image_get_mean(noise_out), 0.219059, tol);
+ cpl_image_delete(data_out);
+ cpl_image_delete(noise_out);
+
+ cpl_test_eq(CPL_ERROR_NONE, kmclipm_make_image(data, NULL,
+ &data_out, NULL,
+ NULL,
+ "ksigma",
+ 2, 2,
+ 2,
+ -1, -1));
+ cpl_test_abs(cpl_image_get_mean(data_out), 5.95, tol);
+ cpl_image_delete(data_out);
+
+ cpl_test_eq(CPL_ERROR_NONE, kmclipm_make_image(data, noise,
+ &data_out, &noise_out,
+ NULL,
+ "ksigma",
+ 2, 2,
+ 2,
+ -1, -1));
+ cpl_test_abs(cpl_image_get_mean(data_out), 5.95, tol);
+ cpl_test_abs(cpl_image_get_mean(noise_out), 0.0, tol);
+ cpl_image_delete(data_out);
+ cpl_image_delete(noise_out);
+
+ cpl_test_eq(CPL_ERROR_NONE, kmclipm_make_image(data, noise,
+ &data_out, &noise_out,
+ slices,
+ "ksigma",
+ 2, 2,
+ 2,
+ -1, -1));
+ cpl_test_abs(cpl_image_get_mean(data_out), 5.95, tol);
+ cpl_test_abs(cpl_image_get_mean(noise_out), 0.0, tol);
+ cpl_image_delete(data_out);
+ cpl_image_delete(noise_out);
+
+ cpl_test_eq(CPL_ERROR_NONE, kmclipm_make_image(data, NULL,
+ &data_out, NULL,
+ NULL,
+ "min_max",
+ -1, -1,
+ -1,
+ 1, 1));
+ cpl_test_abs(cpl_image_get_mean(data_out), 6.14999, tol);
+ cpl_image_delete(data_out);
+
+ cpl_test_eq(CPL_ERROR_NONE, kmclipm_make_image(data, noise,
+ &data_out, &noise_out,
+ NULL,
+ "min_max",
+ -1, -1,
+ -1,
+ 1, 1));
+ cpl_test_abs(cpl_image_get_mean(data_out), 6.14999, tol);
+ cpl_test_abs(cpl_image_get_mean(noise_out), 0.2, tol);
+ cpl_image_delete(data_out);
+ cpl_image_delete(noise_out);
+
+ cpl_imagelist_delete(data);
+ cpl_imagelist_delete(noise);
+ cpl_vector_delete(slices);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_combine_vector()
+{
+ float tol = 0.01;
+
+ cpl_vector *identified = NULL,
+ *data = NULL,
+ *noise = NULL,
+ *dupd = NULL,
+ *dupn = NULL,
+ *dupi = NULL;
+
+ int new_size = 0,
+ len = 10;
+
+ double stdev = 0.0,
+ stderr = 0.0;
+ kmclipm_vector *kvd = NULL,
+ *kvn = NULL;
+ enum combine_status status = combine_ok;
+
+ /* --- invalid tests --- */
+ cpl_msg_set_level(CPL_MSG_OFF);
+
+ cpl_test_eq(-1,
+ kmclipm_combine_vector(NULL, NULL, NULL,
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status));
+ cpl_test_eq(combine_ok, status);
+ cpl_error_reset();
+
+ data = cpl_vector_new(len);
+ kmclipm_test_fill_vector(data, 0.0, 0.5);
+
+ dupd = cpl_vector_duplicate(data);
+ kvd = kmclipm_vector_create(dupd);
+
+ cpl_test_eq(-1,
+ kmclipm_combine_vector(kvd, NULL, NULL,
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status));
+ cpl_test_eq(combine_ok, status);
+ cpl_error_reset();
+
+ kmclipm_vector_delete(kvd);
+
+ identified = cpl_vector_new(len);
+ cpl_vector_fill(identified, 1.0);
+ cpl_vector_set(identified, 5, 0);
+
+ dupd = cpl_vector_duplicate(data);
+ dupi = cpl_vector_duplicate(identified);
+ kvd = kmclipm_vector_create2(dupd, dupi);
+
+ cpl_test_eq(-1, kmclipm_combine_vector(kvd, NULL, NULL,
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status));
+ cpl_test_eq(combine_ok, status);
+ cpl_error_reset();
+
+ cpl_test_eq(-1, kmclipm_combine_vector(kvd, NULL, "min_max",
+ 0.0, 0.0, 0, 0, -1,
+ &new_size, &stdev, &stderr, -1.0,
+ &status));
+ cpl_test_eq(combine_ok, status);
+ cpl_error_reset();
+
+ cpl_test_eq(-1, kmclipm_combine_vector(kvd, NULL, "min_max",
+ 0.0, 0.0, 0, -1, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status));
+ cpl_test_eq(combine_ok, status);
+ cpl_error_reset();
+
+
+ cpl_test_eq(-1, kmclipm_combine_vector(kvd, NULL, "ksigma",
+ -1.0, 0.0, 0, -1, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status));
+ cpl_test_eq(combine_ok, status);
+ cpl_error_reset();
+
+ cpl_test_eq(-1, kmclipm_combine_vector(kvd, NULL, "ksigma",
+ 0.0, -1.0, 0, -1, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status));
+ cpl_test_eq(combine_ok, status);
+ cpl_error_reset();
+
+ cpl_test_eq(-1, kmclipm_combine_vector(kvd, NULL, "ksigma",
+ 0.0, 0.0, -1, -1, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status));
+ cpl_test_eq(combine_ok, status);
+ cpl_error_reset();
+
+ cpl_test_eq(0, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+
+ /* --- valid tests --- */
+ noise = cpl_vector_new(len);
+ kmclipm_test_fill_vector(noise, 0.0, 0.01);
+ cpl_vector_sort(noise, -1);
+
+ dupn = cpl_vector_duplicate(noise);
+ dupi = cpl_vector_duplicate(identified);
+ kvn = kmclipm_vector_create2(dupn, dupi);
+
+ /* new_size > 2*/
+ cpl_test_abs(2.22, kmclipm_combine_vector(kvd, NULL, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+
+ cpl_test_abs(20, kmclipm_combine_vector(kvd, NULL, "sum",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(9, new_size);
+ cpl_test_abs(1.60295, stdev, tol);
+ cpl_test_abs(0.534316, stderr, tol);
+
+ cpl_test_abs(2, kmclipm_combine_vector(kvd, NULL, "median",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(9, new_size);
+ cpl_test_abs(1.62019, stdev, tol);
+ cpl_test_abs(0.540063, stderr, tol);
+
+ cpl_test_abs(2.22, kmclipm_combine_vector(kvd, NULL, "min_max",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(9, new_size);
+ cpl_test_abs(1.60295, stdev, tol);
+ cpl_test_abs(0.534316, stderr, tol);
+
+ cpl_test_abs(2.5, kmclipm_combine_vector(kvd, NULL, "min_max",
+ 0.0, 0.0, 0, 2, 3,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(4, new_size);
+ cpl_test_abs(0.912871, stdev, tol);
+ cpl_test_abs(0.456435, stderr, tol);
+
+ /* applies average */
+ cpl_test_abs(2.22, kmclipm_combine_vector(kvd, NULL, "min_max",
+ 0.0, 0.0, 0, 4, 5,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(9, new_size);
+ cpl_test_abs(1.60295, stdev, tol);
+ cpl_test_abs(0.534316, stderr, tol);
+
+ /* applies average */
+ cpl_test_abs(2.22, kmclipm_combine_vector(kvd, NULL, "ksigma",
+ 0.0, 0.0, 3, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(9, new_size);
+ cpl_test_abs(1.60295, stdev, tol);
+ cpl_test_abs(0.534316, stderr, tol);
+ cpl_test_abs(1.875, kmclipm_combine_vector(kvd, NULL, "ksigma",
+ 1, 1, 2, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+
+ cpl_test_eq(4, new_size);
+ cpl_test_abs(0.853913, stdev, tol);
+ cpl_test_abs(0.853913/sqrt(4), stderr, tol);
+
+ /* with noise */
+ cpl_test_abs(1.875, kmclipm_combine_vector(kvd, kvn, "ksigma",
+ 1.0, 1.0, 2, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(4, new_size);
+ cpl_test_abs(0.853913, stdev, tol);
+ cpl_test_abs(0.853913/sqrt(4), stderr, tol);
+
+ /* new_size = 2 */
+ cpl_test_abs(2.2222, kmclipm_combine_vector(kvd, kvn, "ksigma",
+ 3.0, 3.0, 3, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(9, new_size);
+ cpl_test_abs(1.60295, stdev, tol/100);
+ cpl_test_abs(0.5343, stderr, tol/100);
+
+ cpl_test_abs(0.25, kmclipm_combine_vector(kvd, kvn, "min_max",
+ 0.0, 0.0, 0, 7, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.060208, stdev, tol);
+ cpl_test_abs(0.0425735, stderr, tol);
+
+ cpl_test_abs(0.25, kmclipm_combine_vector(kvd, kvn, "min_max",
+ 0.0, 0.0, 0, 7, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.060208, stdev, tol/100);
+ cpl_test_abs(0.042573, stderr, tol/100);
+
+ kmclipm_vector_delete(kvd);
+ kmclipm_vector_delete(kvn);
+
+ cpl_vector_set(identified, 2, 0);
+ cpl_vector_set(identified, 3, 0);
+ cpl_vector_set(identified, 4, 0);
+ cpl_vector_set(identified, 6, 0);
+ cpl_vector_set(identified, 7, 0);
+ cpl_vector_set(identified, 8, 0);
+ cpl_vector_set(identified, 9, 0);
+
+ dupd = cpl_vector_duplicate(data);
+ dupn = cpl_vector_duplicate(noise);
+ dupi = cpl_vector_duplicate(identified);
+ kvd = kmclipm_vector_create2(dupd, dupi);
+ dupi = cpl_vector_duplicate(identified);
+ kvn = kmclipm_vector_create2(dupn, dupi);
+
+ cpl_test_abs(0.25, kmclipm_combine_vector(kvd, NULL, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.5, stdev, tol);
+ cpl_test_abs(0.3536, stderr, tol);
+
+ cpl_test_abs(0.25, kmclipm_combine_vector(kvd, kvn, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.060208, stdev, tol/100);
+ cpl_test_abs(0.042575, stderr, tol/100);
+
+ cpl_test_abs(0.5, kmclipm_combine_vector(kvd, NULL, "sum",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.5, stdev, tol);
+ cpl_test_abs(0.3536, stderr, tol);
+
+ cpl_test_abs(0.5, kmclipm_combine_vector(kvd, kvn, "sum",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.120416, stdev, tol/10);
+ cpl_test_abs(0.0851469, stderr, tol/100);
+
+ cpl_test_abs(0.25, kmclipm_combine_vector(kvd, NULL, "median",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.5, stdev, tol);
+ cpl_test_abs(0.3536, stderr, tol);
+
+ cpl_test_abs(0.25, kmclipm_combine_vector(kvd, kvn, "median",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.060208, stdev, tol/100);
+ cpl_test_abs(0.0425734, stderr, tol/100);
+
+ /* new_size = 1 */
+ cpl_vector_fill(identified, 1.0);
+ cpl_vector_set(identified, 5, 0);
+
+ kmclipm_vector_delete(kvd);
+ kmclipm_vector_delete(kvn);
+
+ dupd = cpl_vector_duplicate(data);
+ dupn = cpl_vector_duplicate(noise);
+ dupi = cpl_vector_duplicate(identified);
+ kvd = kmclipm_vector_create2(dupd, dupi);
+ dupi = cpl_vector_duplicate(identified);
+ kvn = kmclipm_vector_create2(dupn, dupi);
+
+ cpl_test_abs(3, kmclipm_combine_vector(kvd, NULL, "ksigma",
+ 1.0, 0.5, 5, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+
+ cpl_test_abs(3, kmclipm_combine_vector(kvd, kvn, "ksigma",
+ 1.0, 0.5, 5, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(0.03, stdev, tol);
+ cpl_test_abs(0.03, stderr, tol);
+
+ cpl_test_abs(0.5, kmclipm_combine_vector(kvd, NULL, "min_max",
+ 0.0, 0.0, 0, 7, 1,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+
+ cpl_test_abs(0.5, kmclipm_combine_vector(kvd, kvn, "min_max",
+ 0.0, 0.0, 0, 7, 1,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(0.08, stdev, tol);
+ cpl_test_abs(0.08, stderr, tol);
+
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kvd);
+ kmclipm_vector_delete(kvn);
+
+ cpl_vector_set(identified, 0, 0);
+ cpl_vector_set(identified, 2, 0);
+ cpl_vector_set(identified, 3, 0);
+ cpl_vector_set(identified, 4, 0);
+ cpl_vector_set(identified, 6, 0);
+ cpl_vector_set(identified, 7, 0);
+ cpl_vector_set(identified, 8, 0);
+ cpl_vector_set(identified, 9, 0);
+
+ dupd = cpl_vector_duplicate(data);
+ dupn = cpl_vector_duplicate(noise);
+ dupi = cpl_vector_duplicate(identified);
+ kvd = kmclipm_vector_create2(dupd, dupi);
+ dupi = cpl_vector_duplicate(identified);
+ kvn = kmclipm_vector_create2(dupn, dupi);
+
+
+ cpl_test_abs(0.5, kmclipm_combine_vector(kvd, NULL, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+
+ cpl_test_abs(0.5, kmclipm_combine_vector(kvd, kvn, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(0.08, stdev, tol);
+ cpl_test_abs(0.08, stderr, tol);
+
+ cpl_test_abs(0.5, kmclipm_combine_vector(kvd, NULL, "sum",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+
+ cpl_test_abs(0.5, kmclipm_combine_vector(kvd, kvn, "sum",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(0.08, stdev, tol);
+ cpl_test_abs(0.08, stderr, tol);
+
+ cpl_test_abs(0.5, kmclipm_combine_vector(kvd, NULL, "median",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+
+ cpl_test_abs(0.5, kmclipm_combine_vector(kvd, kvn, "median",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(0.08, stdev, tol);
+ cpl_test_abs(0.08, stderr, tol);
+
+ kmclipm_vector_delete(kvd);
+ kmclipm_vector_delete(kvn);
+ cpl_vector_delete(data);
+ cpl_vector_delete(noise);
+ cpl_vector_delete(identified);
+
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /*
+ * (new) systematic tests
+ */
+
+ /* nz = 1, w/o noise, all methods */
+ data = cpl_vector_new(1);
+ cpl_vector_fill(data, 5);
+ noise = cpl_vector_new(1);
+ cpl_vector_fill(noise, 0.5);
+ identified = cpl_vector_new(1);
+ cpl_vector_fill(identified, 1);
+ dupd = cpl_vector_duplicate(data);
+ dupn = cpl_vector_duplicate(noise);
+ dupi = cpl_vector_duplicate(identified);
+ kvd = kmclipm_vector_create2(dupd, dupi);
+ dupi = cpl_vector_duplicate(identified);
+ kvn = kmclipm_vector_create2(dupn, dupi);
+
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, NULL, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, NULL, "median",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, NULL, "min_max",
+ 0.0, 0.0, 0, 2, 3,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, NULL, "sum",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, NULL, "ksigma",
+ 0.2, 0.2, 3, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+
+ /* nz = 1, with noise, all methods */
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, kvn, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(0.5, stdev, tol);
+ cpl_test_abs(0.5, stderr, tol);
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, kvn, "median",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(0.5, stdev, tol);
+ cpl_test_abs(0.5, stderr, tol);
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, kvn, "min_max",
+ 0.0, 0.0, 0, 2, 3,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(0.5, stdev, tol);
+ cpl_test_abs(0.5, stderr, tol);
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, kvn, "sum",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(0.5, stdev, tol);
+ cpl_test_abs(0.5, stderr, tol);
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, kvn, "ksigma",
+ 0.2, 0.2, 3, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(0.5, stdev, tol);
+ cpl_test_abs(0.5, stderr, tol);
+
+ kmclipm_vector_delete(kvd);
+ kmclipm_vector_delete(kvn);
+ cpl_vector_delete(data);
+ cpl_vector_delete(noise);
+ cpl_vector_delete(identified);
+
+ /* nz = 2, w/o noise, all methods */
+ data = cpl_vector_new(2);
+ cpl_vector_set(data, 0, 5);
+ cpl_vector_set(data, 1, 2);
+ noise = cpl_vector_new(2);
+ cpl_vector_set(noise, 0, 0.5);
+ cpl_vector_set(noise, 1, 0.2);
+ identified = cpl_vector_new(2);
+ cpl_vector_fill(identified, 1);
+
+ dupd = cpl_vector_duplicate(data);
+ dupn = cpl_vector_duplicate(noise);
+ dupi = cpl_vector_duplicate(identified);
+ kvd = kmclipm_vector_create2(dupd, dupi);
+ dupi = cpl_vector_duplicate(identified);
+ kvn = kmclipm_vector_create2(dupn, dupi);
+
+ cpl_test_abs(3.5, kmclipm_combine_vector(kvd, NULL, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(2), stderr, tol);
+ cpl_test_abs(3.5, kmclipm_combine_vector(kvd, NULL, "median",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(2), stderr, tol);
+ cpl_test_abs(3.5, kmclipm_combine_vector(kvd, NULL, "min_max",
+ 0.0, 0.0, 0, 2, 3,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(2), stderr, tol);
+ cpl_test_abs(7, kmclipm_combine_vector(kvd, NULL, "sum",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(2), stderr, tol);
+
+ cpl_test_abs(3.5, kmclipm_combine_vector(kvd, NULL, "ksigma",
+ 1.0, 1.0, 3, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(2), stderr, tol);
+
+ /* nz = 2, with noise, all methods */
+ cpl_test_abs(3.5, kmclipm_combine_vector(kvd, kvn, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.2693, stdev, tol);
+ cpl_test_abs(0.19042, stderr, tol);
+ cpl_test_abs(3.5, kmclipm_combine_vector(kvd, kvn, "median",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.2693, stdev, tol);
+ cpl_test_abs(0.19042, stderr, tol);
+ cpl_test_abs(3.5, kmclipm_combine_vector(kvd, kvn, "min_max",
+ 0.0, 0.0, 0, 2, 3,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.2693, stdev, tol);
+ cpl_test_abs(0.19042, stderr, tol);
+ cpl_test_abs(7, kmclipm_combine_vector(kvd, kvn, "sum",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.5385, stdev, tol);
+ cpl_test_abs(0.380777, stderr, tol);
+
+ cpl_test_abs(3.5, kmclipm_combine_vector(kvd, kvn, "ksigma",
+ 1.0, 1.0, 3, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(2, new_size);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_abs(0.26925, stdev, tol);
+ cpl_test_abs(0.190394, stderr, tol);
+
+ kmclipm_vector_delete(kvd);
+ kmclipm_vector_delete(kvn);
+ cpl_vector_delete(data);
+ cpl_vector_delete(noise);
+ cpl_vector_delete(identified);
+
+ /* nz = 3, w/o noise, all methods */
+ data = cpl_vector_new(3);
+ cpl_vector_set(data, 0, 5);
+ cpl_vector_set(data, 1, 2);
+ cpl_vector_set(data, 2, 8);
+ noise = cpl_vector_new(3);
+ cpl_vector_set(noise, 0, 0.5);
+ cpl_vector_set(noise, 1, 0.2);
+ cpl_vector_set(noise, 2, 0.1);
+ identified = cpl_vector_new(3);
+ cpl_vector_fill(identified, 1);
+
+ dupd = cpl_vector_duplicate(data);
+ dupn = cpl_vector_duplicate(noise);
+ dupi = cpl_vector_duplicate(identified);
+ kvd = kmclipm_vector_create2(dupd, dupi);
+ dupi = cpl_vector_duplicate(identified);
+ kvn = kmclipm_vector_create2(dupn, dupi);
+
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, NULL, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(3, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(3), stderr, tol);
+
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, NULL, "median",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(3, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(3), stderr, tol);
+
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, NULL, "min_max",
+ 0.0, 0.0, 0, 2, 3,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(3, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(3), stderr, tol);
+
+ cpl_test_abs(15, kmclipm_combine_vector(kvd, NULL, "sum",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(3, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(3), stderr, tol);
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, NULL, "ksigma",
+ 1.0, 1.0, 3, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(3, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(3), stderr, tol);
+
+ /* nz = 3, with noise, all methods */
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, kvn, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(3, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(3), stderr, tol);
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, kvn, "median",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(3, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(3), stderr, tol);
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, kvn, "min_max",
+ 0.0, 0.0, 0, 2, 3,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(3, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(3), stderr, tol);
+ cpl_test_abs(15, kmclipm_combine_vector(kvd, kvn, "sum",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(3, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(3), stderr, tol);
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, kvn, "ksigma",
+ 1.0, 1.0, 3, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(3, new_size);
+ cpl_test_abs(3, stdev, tol);
+ cpl_test_abs(3/sqrt(3), stderr, tol);
+
+ kmclipm_vector_delete(kvd);
+ kmclipm_vector_delete(kvn);
+ cpl_vector_delete(data);
+ cpl_vector_delete(noise);
+ cpl_vector_delete(identified);
+
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_msg_set_level(my_level);
+
+ /*
+ * test with infinites
+ */
+ data = cpl_vector_new(1);
+ cpl_vector_fill(data, 5);
+ noise = cpl_vector_new(1);
+ cpl_vector_fill(noise, 0.5);
+ identified = cpl_vector_new(1);
+ cpl_vector_fill(identified, 0);
+
+ dupd = cpl_vector_duplicate(data);
+ dupn = cpl_vector_duplicate(noise);
+ dupi = cpl_vector_duplicate(identified);
+ kvd = kmclipm_vector_create2(dupd, dupi);
+ dupi = cpl_vector_duplicate(identified);
+ kvn = kmclipm_vector_create2(dupn, dupi);
+
+ cpl_test_abs(-1, kmclipm_combine_vector(kvd, NULL, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_rejected, status);
+ cpl_test_eq(0, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+
+ cpl_vector_fill(identified, 1);
+ cpl_vector_fill(data, NAN);
+ cpl_test_abs(-1, kmclipm_combine_vector(kvd, NULL, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_rejected, status);
+ cpl_test_eq(0, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+
+ cpl_vector_fill(data, -1./0.);
+ cpl_test_abs(-1, kmclipm_combine_vector(kvd, NULL, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_rejected, status);
+ cpl_test_eq(0, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+
+ cpl_vector_fill(data, 1./0.);
+ cpl_test_abs(-1, kmclipm_combine_vector(kvd, NULL, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_rejected, status);
+ cpl_test_eq(0, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+
+ cpl_test_abs(-1, kmclipm_combine_vector(kvd, kvn, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_rejected, status);
+ cpl_test_eq(0, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+
+ kmclipm_vector_delete(kvd);
+ kmclipm_vector_delete(kvn);
+ cpl_vector_delete(data);
+ cpl_vector_delete(noise);
+ cpl_vector_delete(identified);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /*size = 2, one infinite*/
+ data = cpl_vector_new(2);
+ cpl_vector_set(data, 0, 5);
+ cpl_vector_set(data, 1, NAN);
+ identified = cpl_vector_new(2);
+ cpl_vector_fill(identified, 1);
+
+ dupd = cpl_vector_duplicate(data);
+ dupi = cpl_vector_duplicate(identified);
+ kvd = kmclipm_vector_create2(dupd, dupi);
+
+ cpl_test_abs(5, kmclipm_combine_vector(kvd, NULL, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(1, new_size);
+ cpl_test_abs(-1.0, stdev, tol);
+ cpl_test_abs(-1.0, stderr, tol);
+
+ kmclipm_vector_delete(kvd);
+ cpl_vector_delete(data);
+ cpl_vector_delete(identified);
+
+ /*size = 3, one infinite*/
+ data = cpl_vector_new(3);
+ cpl_vector_set(data, 0, 5);
+ cpl_vector_set(data, 1, NAN);
+ cpl_vector_set(data, 2, 1);
+ noise = cpl_vector_new(3);
+ cpl_vector_set(noise, 0, 0.5);
+ cpl_vector_set(noise, 1, 0.6);
+ cpl_vector_set(noise, 2, 0.7);
+ identified = cpl_vector_new(3);
+ cpl_vector_fill(identified, 1);
+
+ dupd = cpl_vector_duplicate(data);
+ dupn = cpl_vector_duplicate(noise);
+ dupi = cpl_vector_duplicate(identified);
+ kvd = kmclipm_vector_create2(dupd, dupi);
+ dupi = cpl_vector_duplicate(identified);
+ kvn = kmclipm_vector_create2(dupn, dupi);
+
+ cpl_test_abs(3, kmclipm_combine_vector(kvd, kvn, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.4301, stdev, tol);
+ cpl_test_abs(0.3041, stderr, tol);
+
+ kmclipm_vector_delete(kvd);
+ kmclipm_vector_delete(kvn);
+ cpl_vector_delete(data);
+ cpl_vector_delete(noise);
+ cpl_vector_delete(identified);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /*
+ * test for NaNs in data or /and noise
+ */
+
+ /* NaN in noise at other position than in data (rather impossible) */
+ data = cpl_vector_new(3);
+ cpl_vector_set(data, 0, 5);
+ cpl_vector_set(data, 1, NAN);
+ cpl_vector_set(data, 2, 1);
+ noise = cpl_vector_new(3);
+ cpl_vector_set(noise, 0, 0.5);
+ cpl_vector_set(noise, 1, 0.6);
+ cpl_vector_set(noise, 2, NAN);
+ identified = cpl_vector_new(3);
+ cpl_vector_fill(identified, 1);
+
+ dupd = cpl_vector_duplicate(data);
+ dupn = cpl_vector_duplicate(noise);
+ dupi = cpl_vector_duplicate(identified);
+ kvd = kmclipm_vector_create2(dupd, dupi);
+ dupi = cpl_vector_duplicate(identified);
+ kvn = kmclipm_vector_create2(dupn, dupi);
+
+ cpl_test_abs(3, kmclipm_combine_vector(kvd, kvn, "average",
+ 0.0, 0.0, 0, 0, 0,
+ &new_size, &stdev, &stderr, -1.0,
+ &status), tol);
+ cpl_test_eq(combine_ok, status);
+ cpl_test_eq(2, new_size);
+ cpl_test_abs(0.5, stdev, tol);
+ cpl_test_abs(0.5, stderr, tol);
+
+ kmclipm_vector_delete(kvd);
+ kmclipm_vector_delete(kvn);
+ cpl_vector_delete(data);
+ cpl_vector_delete(noise);
+ cpl_vector_delete(identified);
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_combine_frames()
+{
+ float tol = 0.01;
+
+ cpl_imagelist *cube1 = cpl_imagelist_new(),
+ *cube2 = cpl_imagelist_new(),
+ *cube_data_z1 = cpl_imagelist_new(),
+ *cube_data_z2 = cpl_imagelist_new(),
+ *cube_data_z4 = cpl_imagelist_new(),
+ *cube_noise_z1 = cpl_imagelist_new(),
+ *cube_noise_z2 = cpl_imagelist_new(),
+ *cube_noise_z4 = cpl_imagelist_new();
+
+ cpl_image *img1 = NULL,
+ *img2 = NULL;
+
+ cpl_vector *identified = NULL;
+
+ /* --- invalid tests --- */
+ cpl_msg_set_level(CPL_MSG_OFF);
+
+ cpl_test_eq(CPL_ERROR_NULL_INPUT,
+ kmclipm_combine_frames(NULL, NULL, NULL, NULL,
+ -1.0, -1.0, -1, -1, -1, NULL, NULL, -1.0));
+ cpl_error_reset();
+
+ kmclipm_test_alloc_cube(cube1, 5, 5, 5);
+ kmclipm_test_fill_cube(cube1, 0.0, 0.5);
+
+ kmclipm_test_alloc_cube(cube2, 5, 5, 5);
+ kmclipm_test_fill_cube(cube2, 0.0, 0.1);
+
+ kmclipm_test_alloc_cube(cube_data_z1, 3, 3, 1);
+ kmclipm_test_fill_cube(cube_data_z1, 0.0, 0.5);
+
+ kmclipm_test_alloc_cube(cube_noise_z1, 3, 3, 1);
+ kmclipm_test_fill_cube(cube_noise_z1, 0.0, 0.1);
+
+ kmclipm_test_alloc_cube(cube_data_z2, 3, 3, 2);
+ kmclipm_test_fill_cube(cube_data_z2, 0.0, 0.5);
+
+ kmclipm_test_alloc_cube(cube_noise_z2, 3, 3, 2);
+ kmclipm_test_fill_cube(cube_noise_z2, 0.0, 0.1);
+
+ kmclipm_test_alloc_cube(cube_data_z4, 3, 3, 4);
+ kmclipm_test_fill_cube(cube_data_z4, 0.0, 0.5);
+
+ kmclipm_test_alloc_cube(cube_noise_z4, 3, 3, 4);
+ kmclipm_test_fill_cube(cube_noise_z4, 0.0, 0.1);
+
+ cpl_test_eq(CPL_ERROR_NULL_INPUT,
+ kmclipm_combine_frames(cube1, NULL, NULL, NULL,
+ -1.0, -1.0, -1, -1, -1,
+ NULL, NULL, -1.0));
+ cpl_error_reset();
+
+ cpl_test_eq(CPL_ERROR_ILLEGAL_INPUT,
+ kmclipm_combine_frames(cube1, NULL, NULL, "gaga",
+ -1.0, -1.0, -1, -1, -1,
+ &img1, NULL, -1.0));
+ cpl_error_reset();
+
+ cpl_test_eq(CPL_ERROR_ILLEGAL_INPUT,
+ kmclipm_combine_frames(cube1, NULL, NULL, "ksigma",
+ 2.0, -1.0, -1, -1, -1,
+ &img1, NULL, -1.0));
+ cpl_error_reset();
+
+ cpl_test_eq(CPL_ERROR_ILLEGAL_INPUT,
+ kmclipm_combine_frames(cube1, NULL, NULL, "ksigma",
+ 2.0, 1.0, -1, -1, -1,
+ &img1, NULL, -1.0));
+ cpl_error_reset();
+
+ cpl_test_eq(CPL_ERROR_ILLEGAL_INPUT,
+ kmclipm_combine_frames(cube1, NULL, NULL, "min_max",
+ -1.0, -1.0, -1, 1, -1,
+ &img1, NULL, -1.0));
+ cpl_error_reset();
+
+ /* --- valid tests --- */
+ /* only one frame, data only*/
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z1, NULL, NULL, "sum",
+ -1, -1, -1, -1, -1,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z1, NULL, NULL, "median",
+ -1, -1, -1, -1, -1,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z1, NULL, NULL, "min_max",
+ -1, -1, -1, 0, 0,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z1, NULL, NULL, "min_max",
+ -1, -1, -1, 1, 0,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z1, NULL, NULL, "ksigma",
+ 0, 0, 0, -1, -1,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ /* only one frame, data / noise*/
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z1, cube_noise_z1, NULL,
+ "sum",-1, -1, -1, -1, -1,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z1, cube_noise_z1, NULL,
+ "sum",-1, -1, -1, -1, -1,
+ &img1, &img2, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.4, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z1, cube_noise_z1, NULL,
+ "average",-1, -1, -1, -1, -1,
+ &img1, &img2, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.4, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z1, cube_noise_z1, NULL,
+ "median", -1, -1, -1, -1, -1,
+ &img1, &img2, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.4, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z4, cube_noise_z4, NULL,
+ "min_max", -1, -1, -1, 1, 2,
+ &img1, &img2, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 3, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.6, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ /* only two frames, data only*/
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z2, NULL, NULL, "sum",
+ -1, -1, -1, -1, -1,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 4.5, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z2, NULL, NULL, "median",
+ -1, -1, -1, -1, -1,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2.25, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z2, NULL, NULL, "min_max",
+ -1, -1, -1, 0, 0,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2.25, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z2, NULL, NULL, "min_max",
+ -1, -1, -1, 1, 0,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z2, NULL, NULL, "min_max",
+ -1, -1, -1, 1, 1,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2.25, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z2, NULL, NULL, "ksigma",
+ 0, 0, 0, -1, -1,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2.25, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z2, NULL, NULL, "ksigma",
+ 1.0, 1.0, 2, -1, -1,
+ &img1, NULL, -1.0));
+
+ cpl_test_abs(cpl_image_get_mean(img1), 2.25, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ /* only two frames, data / noise*/
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z2, cube_noise_z2, NULL, "sum",
+ -1, -1, -1, -1, -1,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 4.5, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z2, cube_noise_z2, NULL, "sum",
+ -1, -1, -1, -1, -1,
+ &img1, &img2, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 4.5, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.455269, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z2, cube_noise_z2, NULL,
+ "average", -1, -1, -1, -1, -1,
+ &img1, &img2, -1.0));
+
+ cpl_test_abs(cpl_image_get_mean(img1), 2.25, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.227635, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z2, cube_noise_z2, NULL,
+ "median", -1, -1, -1, -1, -1,
+ &img1, &img2, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2.25, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.227635, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z4, cube_noise_z4, NULL,
+ "min_max", -1, -1, -1, 1, 1,
+ &img1, &img2, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2.75, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.276557, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube_data_z4, cube_noise_z4, NULL,
+ "ksigma", 1, 1, 1, -1, -1,
+ &img1, &img2, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 2.75, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.276557, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ /* data only */
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube1, NULL, NULL, "ksigma",
+ 2.0, 1.0, 1, -1, -1,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 7.25, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube1, NULL, NULL, "median",
+ -1.0, -1.0, -1, -1, -1,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 7.0, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube1, NULL, NULL, "min_max",
+ -1.0, -1.0, -1, 1, 1,
+ &img1, NULL, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 7.0, tol);
+ cpl_image_delete(img1); img1 = NULL;
+
+ /* data and noise */
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube1, cube2, NULL, "ksigma",
+ 2.0, 1.0, 1, -1, -1,
+ &img1, &img2, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 7.25, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.322749, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube1, cube2, NULL, "median",
+ -1.0, -1.0, -1, -1, -1,
+ &img1, &img2, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 7.0, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.353553, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube1, cube2, NULL, "min_max",
+ -1.0, -1.0, -1, 1, 1,
+ &img1, &img2, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 7.0, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.288675, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ /* data and noise & identified slices */
+ identified = cpl_vector_new(5);
+ cpl_vector_set(identified, 0, 1.0);
+ cpl_vector_set(identified, 1, 1.0);
+ cpl_vector_set(identified, 2, 1.0);
+ cpl_vector_set(identified, 3, 1.0);
+ cpl_vector_set(identified, 4, 0.0);
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube1, cube2, identified, "ksigma",
+ 2.0, 1.0, 1, -1, -1,
+ &img1, &img2, -1.0));
+
+ cpl_test_abs(cpl_image_get_mean(img1), 7, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.288675, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube1, cube2, identified, "median",
+ -1.0, -1.0, -1, -1, -1,
+ &img1, &img2, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 6.75, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.322749, tol);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_combine_frames(cube1, cube2, identified, "min_max",
+ -1.0, -1.0, -1, 1, 1,
+ &img1, &img2, -1.0));
+ cpl_test_abs(cpl_image_get_mean(img1), 6.75, tol);
+ cpl_test_abs(cpl_image_get_mean(img2), 0.675799 , tol);
+
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_imagelist_delete(cube1); cube1 = NULL;
+ cpl_imagelist_delete(cube2); cube2 = NULL;
+ cpl_imagelist_delete(cube_data_z1); cube_data_z1 = NULL;
+ cpl_imagelist_delete(cube_data_z2); cube_data_z2 = NULL;
+ cpl_imagelist_delete(cube_data_z4); cube_data_z4 = NULL;
+ cpl_imagelist_delete(cube_noise_z1); cube_noise_z1 = NULL;
+ cpl_imagelist_delete(cube_noise_z2); cube_noise_z2 = NULL;
+ cpl_imagelist_delete(cube_noise_z4); cube_noise_z4 = NULL;
+ cpl_vector_delete(identified); identified = NULL;
+
+ /*
+ * (new) systematic tests
+ */
+
+ /* nz = 1, w/o noise, all methods */
+ cube1 = cpl_imagelist_new();
+ cube2 = cpl_imagelist_new();
+ kmclipm_test_alloc_cube(cube1, 2, 2, 1);
+ kmclipm_test_fill_cube(cube1, 1.0, 1.0);
+ kmclipm_test_alloc_cube(cube2, 2, 2, 1);
+ kmclipm_test_fill_cube(cube2, 0.1, 1.0);
+ identified = cpl_vector_new(1);
+ cpl_vector_fill(identified, 1);
+
+ kmclipm_combine_frames(cube1, NULL, identified, "average",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.29099, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, NULL, identified, "median",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.29099, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, NULL, identified, "min_max",
+ 0.0, 0.0, 0, 2, 3, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.29099, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, NULL, identified, "sum",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.29099, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, NULL, identified, "ksigma",
+ 1.0, 1.0, 3, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.29099, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ /* nz = 1, with noise, all methods */
+ kmclipm_combine_frames(cube1, cube2, identified, "average",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.6, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, cube2, identified, "median",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.6, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, cube2, identified, "min_max",
+ 0.0, 0.0, 0, 2, 3, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.6, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, cube2, identified, "sum",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.6, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, cube2, identified, "ksigma",
+ 1.0, 1.0, 3, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.6, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_imagelist_delete(cube1); cube1 = NULL;
+ cpl_imagelist_delete(cube2); cube2 = NULL;
+ cpl_vector_delete(identified); identified = NULL;
+
+ /* nz = 2, w/o noise, all methods */
+ cube1 = cpl_imagelist_new();
+ cube2 = cpl_imagelist_new();
+ kmclipm_test_alloc_cube(cube1, 2, 2, 2);
+ kmclipm_test_fill_cube(cube1, 1.0, 1.0);
+ kmclipm_test_alloc_cube(cube2, 2, 2, 2);
+ kmclipm_test_fill_cube(cube2, 0.1, 1.0);
+ identified = cpl_vector_new(2);
+ cpl_vector_fill(identified, 1);
+
+ kmclipm_combine_frames(cube1, NULL, identified, "average",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(2), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, NULL, identified, "median",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(2), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, NULL, identified, "min_max",
+ 0.0, 0.0, 0, 2, 3, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(2), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, NULL, identified, "sum",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(6, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(2), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, NULL, identified, "ksigma",
+ 1.0, 1.0, 3, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(2), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* nz = 2, with noise, all methods */
+ kmclipm_combine_frames(cube1, cube2, identified, "average",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_test_abs(3, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.09244, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, cube2, identified, "median",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.09244, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, cube2, identified, "min_max",
+ 0.0, 0.0, 0, 2, 3, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.09244, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, cube2, identified, "sum",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(6, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(2*1.09244, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, cube2, identified, "ksigma",
+ 1.0, 1.0, 3, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.09244, cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_imagelist_delete(cube1); cube1 = NULL;
+ cpl_imagelist_delete(cube2); cube2 = NULL;
+ cpl_vector_delete(identified); identified = NULL;
+
+ /* nz = 3, w/o noise, all methods */
+ cube1 = cpl_imagelist_new();
+ cube2 = cpl_imagelist_new();
+ kmclipm_test_alloc_cube(cube1, 2, 2, 3);
+ kmclipm_test_fill_cube(cube1, 1.0, 1.0);
+ kmclipm_test_alloc_cube(cube2, 2, 2, 3);
+ kmclipm_test_fill_cube(cube2, 0.1, 1.0);
+ identified = cpl_vector_new(3);
+ cpl_vector_fill(identified, 1);
+
+ kmclipm_combine_frames(cube1, NULL, identified, "average",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(3), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, NULL, identified, "median",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(3), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, NULL, identified, "min_max",
+ 0.0, 0.0, 0, 2, 3, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(3), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, NULL, identified, "sum",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(10.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(3), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, NULL, identified, "ksigma",
+ 1.0, 1.0, 3, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(3), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ /* nz = 3, with noise, all methods */
+ kmclipm_combine_frames(cube1, cube2, identified, "average",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(3), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, cube2, identified, "median",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(3), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, cube2, identified, "min_max",
+ 0.0, 0.0, 0, 2, 3, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(3), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, cube2, identified, "sum",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(10.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(3), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ kmclipm_combine_frames(cube1, cube2, identified, "ksigma",
+ 1.0, 1.0, 3, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3.5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1/sqrt(3), cpl_image_get_mean(img2), 0.01);
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_imagelist_delete(cube1); cube1 = NULL;
+ cpl_imagelist_delete(cube2); cube2 = NULL;
+ cpl_vector_delete(identified); identified = NULL;
+
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_msg_set_level(my_level);
+
+ /*
+ * test with infinites
+ */
+ cube1 = cpl_imagelist_new();
+ cpl_image *aa = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
+ cpl_image_set(aa, 1, 1, 1);
+ cpl_image_set(aa, 2, 1, NAN);
+ cpl_image_reject(aa, 2, 1);
+ cpl_image_set(aa, 1, 2, 3);
+ cpl_image_set(aa, 2, 2, 4);
+ cpl_imagelist_set(cube1, aa, 0);
+ identified = cpl_vector_new(1);
+ cpl_vector_fill(identified, 1);
+
+ kmclipm_combine_frames(cube1, NULL, identified, "average",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, 0.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.666666, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.52753, cpl_image_get_mean(img2), 0.01);
+ cpl_test_eq(1, cpl_image_count_rejected(img1));
+ cpl_test_eq(1, cpl_image_count_rejected(img2));
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_image_set(aa, 2, 1, 1./0.);
+ kmclipm_combine_frames(cube1, NULL, identified, "average",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, 0.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.666666, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.52753, cpl_image_get_mean(img2), 0.01);
+ cpl_test_eq(1, cpl_image_count_rejected(img1));
+ cpl_test_eq(1, cpl_image_count_rejected(img2));
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_image_set(aa, 2, 1, -1./0.);
+ kmclipm_combine_frames(cube1, NULL, identified, "average",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, 0.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.666666, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(1.52753, cpl_image_get_mean(img2), 0.01);
+ cpl_test_eq(1, cpl_image_count_rejected(img1));
+ cpl_test_eq(1, cpl_image_count_rejected(img2));
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cube2 = cpl_imagelist_new();
+ aa = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
+ cpl_image_set(aa, 1, 1, .1);
+ cpl_image_set(aa, 2, 1, .2);
+ cpl_image_set(aa, 1, 2, .3);
+ cpl_image_set(aa, 2, 2, .4);
+ cpl_imagelist_set(cube2, aa, 0);
+ kmclipm_combine_frames(cube1, cube2, identified, "average",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, 0.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(2.666666, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(0.2666, cpl_image_get_mean(img2), 0.01);
+ cpl_test_eq(1, cpl_image_count_rejected(img1));
+ cpl_test_eq(1, cpl_image_count_rejected(img2));
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_imagelist_delete(cube1); cube1 = NULL;
+ cpl_imagelist_delete(cube2); cube2 = NULL;
+ cpl_vector_delete(identified); identified = NULL;
+
+ /*size = 2, one infinite*/
+ cube1 = cpl_imagelist_new();
+ aa = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
+ cpl_image_set(aa, 1, 1, 1);
+ cpl_image_set(aa, 2, 1, NAN);
+ cpl_image_set(aa, 1, 2, 3);
+ cpl_image_set(aa, 2, 2, 4);
+ cpl_imagelist_set(cube1, aa, 0);
+ aa = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
+ cpl_image_set(aa, 1, 1, 5);
+ cpl_image_set(aa, 2, 1, 6);
+ cpl_image_set(aa, 1, 2, 7);
+ cpl_image_set(aa, 2, 2, 8);
+ cpl_imagelist_set(cube1, aa, 1);
+ identified = cpl_vector_new(2);
+ cpl_vector_fill(identified, 1);
+
+ kmclipm_combine_frames(cube1, NULL, identified, "average",
+ 0.0, 0.0, 0, 0, 0, &img1, &img2, -1.0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(5, cpl_image_get_mean(img1), 0.01);
+ cpl_test_abs(4/sqrt(2), cpl_image_get_mean(img2), 0.01);
+ cpl_test_eq(0, cpl_image_count_rejected(img1));
+ cpl_test_eq(1, cpl_image_count_rejected(img2));
+ cpl_image_delete(img1); img1 = NULL;
+ cpl_image_delete(img2); img2 = NULL;
+
+ cpl_imagelist_delete(cube1); cube1 = NULL;
+ cpl_vector_delete(identified); identified = NULL;
+}
+
+void test_kmclipm_setup_grid()
+{
+ double tol = 0.01;
+ gridDefinition gd;
+
+ /* invalid tests */
+ kmclipm_setup_grid(NULL, "NN", 1.9, KMOS_PIX_RESOLUTION, 0.);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ kmclipm_setup_grid(&gd, "gaga", 1.9, KMOS_PIX_RESOLUTION, 0.);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ kmclipm_setup_grid(&gd, "NN", -9.9, KMOS_PIX_RESOLUTION, 0.);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ /* valid tests */
+ cpl_test_error(kmclipm_setup_grid(&gd, "NN", 1.9, KMOS_PIX_RESOLUTION, 0.));
+ cpl_test_eq(gd.method, NEAREST_NEIGHBOR);
+
+ cpl_test_error(kmclipm_setup_grid(&gd, "lwNN", 1.9, KMOS_PIX_RESOLUTION, 0.));
+ cpl_test_eq(gd.method, LINEAR_WEIGHTED_NEAREST_NEIGHBOR);
+
+ cpl_test_error(kmclipm_setup_grid(&gd, "swNN", 1.9, KMOS_PIX_RESOLUTION, 0.));
+ cpl_test_eq(gd.method, SQUARE_WEIGHTED_NEAREST_NEIGHBOR);
+
+ cpl_test_error(kmclipm_setup_grid(&gd, "NN", 1.9, KMOS_PIX_RESOLUTION, 0.));
+ cpl_test_eq(gd.method, NEAREST_NEIGHBOR);
+ cpl_test_abs(gd.neighborHood.distance, 1.9, tol);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+/*
+void test_kmclipm_setup_grid_band_auto()
+{
+ double tol = 0.01;
+ gridDefinition gd;
+ cpl_propertylist *pl = NULL;
+ cpl_table *tbl = NULL;
+
+*/ /* invalid tests */
+/* kmclipm_setup_grid_band_auto(NULL, NULL, 0, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ kmclipm_setup_grid_band_auto(&gd, NULL, 0, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ pl = cpl_propertylist_new();
+ kmclipm_setup_grid_band_auto(&gd, pl, 0, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ tbl = cpl_table_new(2);
+ cpl_table_new_column(tbl, "K", CPL_TYPE_FLOAT);
+ cpl_table_set_float(tbl, "K", 0, 1.956);
+ cpl_table_set_float(tbl, "K", 1, 2.511);
+ kmclipm_setup_grid_band_auto(&gd, pl, 0, tbl);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ kmclipm_setup_grid_band_auto(&gd, pl, 1, tbl);
+ cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
+
+*/ /* valid tests */
+/* cpl_propertylist_update_string(pl, "ESO INS FILT1 ID", "K");
+ gd.l.dim = 1000;
+ kmclipm_setup_grid_band_auto(&gd, pl, 1, tbl);
+ cpl_test_abs(gd.l.start, 1.956, tol);
+ cpl_test_abs(gd.l.delta, 0.000270996, tol/10000);
+
+ cpl_propertylist_delete(pl);
+ cpl_table_delete(tbl);
+ cpl_test_error(CPL_ERROR_NONE);
+}
+*/
+void test_kmclipm_setup_grid_band()
+{
+ double tol = 0.01;
+ gridDefinition gd;
+ cpl_table *tbl = NULL;
+
+ /* invalid tests */
+ kmclipm_setup_grid_band(NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ kmclipm_setup_grid_band(&gd, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ tbl = cpl_table_new(2);
+ kmclipm_setup_grid_band(&gd, NULL, tbl);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* valid tests */
+ cpl_table_new_column(tbl, "K", CPL_TYPE_FLOAT);
+ cpl_table_set_float(tbl, "K", 0, 1.956);
+ cpl_table_set_float(tbl, "K", 1, 2.511);
+ gd.l.dim = 1000;
+ kmclipm_setup_grid_band(&gd, "K", tbl);
+ cpl_test_abs(gd.l.start, 1.956, tol);
+ cpl_test_abs(gd.l.delta, 0.000270996, tol/10000);
+
+ cpl_table_delete(tbl);
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_update_property_int()
+{
+ cpl_propertylist *pl = NULL;
+
+ /* --- invalid tests --- */
+ cpl_test_eq(CPL_ERROR_NULL_INPUT,
+ kmclipm_update_property_int(NULL, NULL, 0, NULL));
+ cpl_error_reset();
+
+ pl = cpl_propertylist_new();
+
+ cpl_test_eq(CPL_ERROR_NULL_INPUT,
+ kmclipm_update_property_int(pl, NULL, 0, NULL));
+ cpl_error_reset();
+
+ /* --- valid tests --- */
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_update_property_int(pl, "name", 2, NULL));
+ cpl_test_eq(cpl_propertylist_get_int(pl, "name"), 2);
+ cpl_test_eq(cpl_propertylist_get_comment(pl, "name") == NULL, 1);
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_update_property_int(pl, "name", 8, "gaga"));
+ cpl_test_eq(cpl_propertylist_get_int(pl, "name"), 8);
+ cpl_test_eq(cpl_propertylist_get_comment(pl, "name") == NULL, 0);
+ cpl_test_eq(strcmp(cpl_propertylist_get_comment(pl, "name"), "gaga"), 0);
+
+ cpl_propertylist_delete(pl);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_update_property_double()
+{
+ cpl_propertylist *pl = NULL;
+
+ /* --- invalid tests --- */
+ cpl_test_eq(CPL_ERROR_NULL_INPUT,
+ kmclipm_update_property_double(NULL, NULL, 0, NULL));
+ cpl_error_reset();
+
+ pl = cpl_propertylist_new();
+
+ cpl_test_eq(CPL_ERROR_NULL_INPUT,
+ kmclipm_update_property_double(pl, NULL, 0, NULL));
+ cpl_error_reset();
+
+ /* --- valid tests --- */
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_update_property_double(pl, "name", 1.1, NULL));
+ cpl_test_abs(cpl_propertylist_get_double(pl, "name"), 1.1, DBL_EPSILON);
+ cpl_test_eq(cpl_propertylist_get_comment(pl, "name") == NULL, 1);
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_update_property_double(pl, "name", 2.2, "gaga"));
+ cpl_test_abs(cpl_propertylist_get_double(pl, "name"), 2.2, DBL_EPSILON);
+ cpl_test_eq(cpl_propertylist_get_comment(pl, "name") == NULL, 0);
+ cpl_test_eq(strcmp(cpl_propertylist_get_comment(pl, "name"), "gaga"), 0);
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_update_property_double(pl, "name", NAN, "gaga"));
+ cpl_test_abs(cpl_propertylist_get_double(pl, "name"), 0.0, DBL_EPSILON);
+ cpl_test_eq(cpl_propertylist_get_comment(pl, "name") == NULL, 0);
+ cpl_test_eq(strcmp(cpl_propertylist_get_comment(pl, "name"),
+ "INVALID VALUE: was NaN"), 0);
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_update_property_double(pl, "name", 1.0/0.0, "gaga"));
+ cpl_test_abs(cpl_propertylist_get_double(pl, "name"), 0.0, DBL_EPSILON);
+ cpl_test_eq(cpl_propertylist_get_comment(pl, "name") == NULL, 0);
+ cpl_test_eq(strcmp(cpl_propertylist_get_comment(pl, "name"),
+ "INVALID VALUE: was +Inf"), 0);
+
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_update_property_double(pl, "name", -1.0/0.0, "gaga"));
+ cpl_test_abs(cpl_propertylist_get_double(pl, "name"), 0.0, DBL_EPSILON);
+ cpl_test_eq(cpl_propertylist_get_comment(pl, "name") == NULL, 0);
+ cpl_test_eq(strcmp(cpl_propertylist_get_comment(pl, "name"),
+ "INVALID VALUE: was -Inf"), 0);
+
+ cpl_propertylist_delete(pl);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_update_property_string()
+{
+ cpl_propertylist *pl = NULL,
+ *mainh = NULL;
+ char *keyword = NULL;
+ const char *tmp_str = NULL;
+
+ /* --- invalid tests --- */
+ kmclipm_update_property_string(NULL, NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ pl = cpl_propertylist_new();
+
+ kmclipm_update_property_string(pl, NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ kmclipm_update_property_string(pl, "name", NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* --- valid tests --- */
+ kmclipm_update_property_string(pl, "name", "aga", NULL);
+ cpl_test_eq(strcmp(cpl_propertylist_get_string(pl, "name"), "aga"), 0);
+ cpl_test_eq(cpl_propertylist_get_comment(pl, "name") == NULL, 1);
+
+ kmclipm_update_property_string(pl, "name", "bgb", "gaga");
+ cpl_test_eq(strcmp(cpl_propertylist_get_string(pl, "name"), "bgb"), 0);
+ cpl_test_eq(cpl_propertylist_get_comment(pl, "name") == NULL, 0);
+ cpl_test_eq(strcmp(cpl_propertylist_get_comment(pl, "name"), "gaga"), 0);
+
+ keyword = cpl_sprintf("%s%d%s",IFU_FILTID_PREFIX, 1, IFU_FILTID_POSTFIX);
+ mainh = cpl_propertylist_new();
+ tmp_str = cpl_propertylist_get_string(mainh, keyword);
+ if (tmp_str != NULL) {
+ kmclipm_update_property_string(pl,
+ keyword,
+ tmp_str,
+ cpl_propertylist_get_comment(mainh,
+ keyword));
+ cpl_test_error(CPL_ERROR_NONE);
+ } else {
+ cpl_error_reset();
+ }
+
+ kmclipm_update_property_string(mainh, keyword, "F", "gagacomment");
+ tmp_str = cpl_propertylist_get_string(mainh, keyword);
+ if (tmp_str != NULL) {
+ kmclipm_update_property_string(pl,
+ keyword,
+ tmp_str,
+ cpl_propertylist_get_comment(mainh,
+ keyword));
+ cpl_test_error(CPL_ERROR_NONE);
+ } else {
+ cpl_error_reset();
+ }
+ cpl_test_eq(strcmp(cpl_propertylist_get_string(pl, keyword), "F"), 0);
+ cpl_test_eq(cpl_propertylist_get_comment(pl, keyword) == NULL, 0);
+ cpl_test_eq(strcmp(cpl_propertylist_get_comment(pl, keyword), "gagacomment"), 0);
+ cpl_free(keyword); keyword = NULL;
+
+
+ cpl_propertylist_delete(pl);
+ cpl_propertylist_delete(mainh);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_strip_angle()
+{
+ double a = 0.0, tol = 0.01;
+
+ /* --- invalid tests --- */
+ kmclipm_strip_angle(NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* --- valid tests --- */
+ a = 20;
+ kmclipm_strip_angle(&a);
+ cpl_test_abs(a, 20, tol);
+
+ a = 190.1;
+ kmclipm_strip_angle(&a);
+ cpl_test_abs(a, 190.1, tol);
+
+ a = 360;
+ kmclipm_strip_angle(&a);
+ cpl_test_abs(a, 0, tol);
+
+ a = 400;
+ kmclipm_strip_angle(&a);
+ cpl_test_abs(a, 40, tol);
+
+ a = -360;
+ kmclipm_strip_angle(&a);
+ cpl_test_abs(a, 0, tol);
+
+ a = -400;
+ kmclipm_strip_angle(&a);
+ cpl_test_abs(a, 320, tol);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_reconstruct_nnlut_get_timestamp()
+{
+/*erwtest*/
+ /* --- invalid tests --- */
+ /* --- valid tests --- */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_compare_timestamps()
+{
+/*erwtest*/
+ /* --- invalid tests --- */
+ kmclipm_compare_timestamps(NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* --- valid tests --- */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_extract_bounds()
+{
+ cpl_propertylist *pl = NULL;
+ int *ret = NULL,
+ i = 0;
+
+ /* --- invalid tests --- */
+ kmclipm_extract_bounds(NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+
+ /* --- valid tests --- */
+ pl = cpl_propertylist_new();
+ cpl_test_nonnull(ret = kmclipm_extract_bounds(pl));
+ for (i = 0; i < 2 * KMOS_NR_IFUS; i++) cpl_test_eq(-1, ret[0]);
+ cpl_free(ret); ret = NULL;
+
+ cpl_propertylist_update_int(pl, "ESO PRO BOUND IFU24_L", 100);
+ cpl_propertylist_update_int(pl, "ESO PRO BOUND IFU24_R", 200);
+ cpl_test_nonnull(ret = kmclipm_extract_bounds(pl));
+ for (i = 0; i < 2 * (KMOS_NR_IFUS-1); i++) cpl_test_eq(-1, ret[0]);
+ cpl_test_eq(100, ret[2*KMOS_NR_IFUS-2]);
+ cpl_test_eq(200, ret[2*KMOS_NR_IFUS-1]);
+ cpl_free(ret); ret = NULL;
+
+ cpl_propertylist_delete(pl); pl = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_propertylist_load() {
+ /* --- invalid tests --- */
+ cpl_msg_set_level(CPL_MSG_OFF);
+ cpl_test_null(kmclipm_propertylist_load(NULL, -1));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_propertylist *pl=cpl_propertylist_new();
+ char *my_path = cpl_sprintf("%s/test_data/ttt.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_propertylist_delete(pl); pl = NULL;
+
+ cpl_test_null(kmclipm_propertylist_load(my_path, -1));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_msg_set_level(my_level);
+
+ /* --- valid tests --- */
+ cpl_test_nonnull(pl = kmclipm_propertylist_load(my_path, 0));
+
+ cpl_free(my_path);
+ cpl_propertylist_delete(pl); pl = NULL;
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_image_load() {
+ /* --- invalid tests --- */
+ cpl_msg_set_level(CPL_MSG_OFF);
+ cpl_test_null(kmclipm_image_load(NULL, CPL_TYPE_FLOAT, 0, -1));
+ if (((cpl_version_get_major() == 5) && (cpl_version_get_minor() >= 3)) ||
+ (cpl_version_get_major() > 5))
+ {
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ } else {
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ }
+
+ cpl_image *img=cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ char *my_path = cpl_sprintf("%s/test_data/ttt.fits", ".");
+ cpl_image_save(img, my_path, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+ cpl_image_delete(img); img = NULL;
+
+ cpl_test_null(kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, -1));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_msg_set_level(my_level);
+
+ /* --- valid tests --- */
+ cpl_test_nonnull(img = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0));
+
+ cpl_free(my_path);
+ cpl_image_delete(img); img = NULL;
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_image_load_window() {
+ /* --- invalid tests --- */
+ cpl_msg_set_level(CPL_MSG_OFF);
+ cpl_test_null(kmclipm_image_load_window(NULL, CPL_TYPE_FLOAT, 0, -1, -1, -1, -1, -1));
+ if (((cpl_version_get_major() == 5) && (cpl_version_get_minor() >= 3)) ||
+ (cpl_version_get_major() > 5))
+ {
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ } else {
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ }
+
+ cpl_image *img=cpl_image_new(10, 10, CPL_TYPE_FLOAT);
+ cpl_test_error(CPL_ERROR_NONE);
+ char *my_path = cpl_sprintf("%s/test_data/ttt.fits", ".");
+ cpl_image_save(img, my_path, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_image_delete(img); img = NULL;
+
+ cpl_test_null(kmclipm_image_load_window(my_path, CPL_TYPE_FLOAT, 0, -1, -1, -1, -1, -1));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_msg_set_level(my_level);
+
+ /* --- valid tests --- */
+ cpl_test_nonnull(img = kmclipm_image_load_window(my_path, CPL_TYPE_FLOAT, 0, 0, 1, 1, 5, 5));
+
+ cpl_free(my_path);
+ cpl_image_delete(img); img = NULL;
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_imagelist_load() {
+ /* --- invalid tests --- */
+ cpl_msg_set_level(CPL_MSG_OFF);
+ cpl_test_null(kmclipm_imagelist_load(NULL, CPL_TYPE_FLOAT, -1));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_imagelist *cube=cpl_imagelist_new();
+ char *my_path = cpl_sprintf("%s/test_data/ttt.fits", ".");
+ cpl_imagelist_save(cube, my_path, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+ cpl_imagelist_delete(cube); cube = NULL;
+
+ cpl_test_null(kmclipm_imagelist_load(my_path, CPL_TYPE_FLOAT, -1));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_msg_set_level(my_level);
+
+ /* --- valid tests --- */
+ cpl_test_nonnull(cube = kmclipm_imagelist_load(my_path, CPL_TYPE_FLOAT, 0));
+
+ cpl_free(my_path);
+ cpl_imagelist_delete(cube); cube = NULL;
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_table_load() {
+ /* --- invalid tests --- */
+ cpl_msg_set_level(CPL_MSG_OFF);
+ cpl_test_null(kmclipm_table_load(NULL, -1, 0));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_table *tbl=cpl_table_new(5);
+ cpl_table_new_column(tbl, "aaa", CPL_TYPE_FLOAT);
+ cpl_propertylist *pl=cpl_propertylist_new();
+ char *my_path = cpl_sprintf("%s/test_data/ttt.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_propertylist *plsub=cpl_propertylist_new();
+ cpl_table_save(tbl, NULL, plsub, my_path, CPL_IO_EXTEND);
+ cpl_table_delete(tbl); tbl = NULL;
+ cpl_propertylist_delete(pl); pl = NULL;
+ cpl_propertylist_delete(plsub); plsub = NULL;
+
+ cpl_test_null(kmclipm_table_load(my_path, -1, 0));
+ cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE);
+
+ cpl_msg_set_level(my_level);
+
+ /* --- valid tests --- */
+ cpl_test_nonnull(tbl = kmclipm_table_load(my_path, 1, 1));
+
+ cpl_free(my_path);
+ cpl_table_delete(tbl); tbl = NULL;
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_image_save()
+{
+ /* --- invalid tests --- */
+ cpl_msg_set_level(CPL_MSG_OFF);
+ kmclipm_image_save(NULL, "img.fits", CPL_BPP_IEEE_FLOAT, NULL,
+ CPL_IO_CREATE, NAN);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ cpl_msg_set_level(my_level);
+
+ /* --- valid tests --- */
+ cpl_image *img = cpl_image_new(10,10,CPL_TYPE_FLOAT);
+ char *my_path = cpl_sprintf("%s/test_data/imgttt.fits", ".");
+ kmclipm_image_save(img, my_path, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE, NAN);
+
+ cpl_image_delete(img);
+ cpl_free(my_path);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_imagelist_save()
+{
+ /* --- invalid tests --- */
+ cpl_msg_set_level(CPL_MSG_OFF);
+ kmclipm_imagelist_save(NULL, "img.fits", CPL_BPP_IEEE_FLOAT, NULL,
+ CPL_IO_CREATE, NAN);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_imagelist *ccc = cpl_imagelist_new();
+ char *my_path = cpl_sprintf("%s/test_data/imgttt.fits", ".");
+ kmclipm_imagelist_save(ccc, my_path, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE, NAN);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_msg_set_level(my_level);
+
+ /* --- valid tests --- */
+ cpl_image *img = cpl_image_new(10,10,CPL_TYPE_FLOAT);
+ cpl_imagelist_set(ccc, img, 0);
+ kmclipm_imagelist_save(ccc, my_path, CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE, NAN);
+
+ cpl_free(my_path);
+ cpl_imagelist_delete(ccc);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_set_cal_path()
+{
+ /* --- invalid tests --- */
+ cpl_msg_set_level(CPL_MSG_OFF);
+ kmclipm_set_cal_path(NULL, 2);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ kmclipm_set_cal_path("aaa", 2);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_msg_set_level(my_level);
+
+ /* --- valid tests --- */
+ kmclipm_set_cal_path("aaa", TRUE);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_set_cal_path("aaa", FALSE);
+ cpl_test_error(CPL_ERROR_NONE);
+
+}
+
+/**
+ @brief Executes the unit tests for all functions in the module @ref kmclipm_functions
+
+ @return Error code, 0 for NONE.
+ */
+int main()
+{
+ /* For DEVELOPERS:
+ * to omit all CPL_MSG_INFO output, apply following statement in the shell
+ * before executing "make check":
+ * setenv CPL_MSG_LEVEL warning
+ * (or export CPL_MSG_LEVEL=warning)
+ */
+
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", my_level);
+
+ char *my_path = cpl_sprintf("%s/test_data", ".");
+ mkdir(my_path, 0777);
+
+ cpl_free(my_path);
+
+ cpl_msg_set_level_from_env();
+ my_level = cpl_msg_get_level();
+
+ test_kmclipm_load_image_with_extensions();
+ test_kmclipm_gaussfit_2d();
+ test_kmclipm_reconstruct();
+ test_kmclipm_shift();
+ test_kmclipm_rotate();
+ test_kmclipm_reject_deviant();
+ test_kmclipm_make_image();
+ test_kmclipm_combine_vector();
+ test_kmclipm_combine_frames();
+ test_kmclipm_setup_grid();
+/* test_kmclipm_setup_grid_band_auto();*/
+ test_kmclipm_setup_grid_band();
+ test_kmclipm_update_property_int();
+ test_kmclipm_update_property_double();
+ test_kmclipm_update_property_string();
+ test_kmclipm_strip_angle();
+ test_kmclipm_reconstruct_nnlut_get_timestamp();
+ test_kmclipm_compare_timestamps();
+ test_kmclipm_extract_bounds();
+ test_kmclipm_propertylist_load();
+ test_kmclipm_image_load();
+ test_kmclipm_image_load_window();
+ test_kmclipm_imagelist_load();
+ test_kmclipm_table_load();
+ test_kmclipm_image_save();
+ test_kmclipm_imagelist_save();
+ test_kmclipm_set_cal_path();
+
+ cpl_msg_info("","All tests done.");
+ cpl_msg_set_level(CPL_MSG_WARNING);
+ return cpl_test_end(0);
+}
+
+/** @} */
diff --git a/kmclipm/test/kmclipm_test_math.c b/kmclipm/test/kmclipm_test_math.c
new file mode 100644
index 0000000..2a7bbb6
--- /dev/null
+++ b/kmclipm/test/kmclipm_test_math.c
@@ -0,0 +1,220 @@
+
+/*********************************************************************
+ * E.S.O. - VLT project
+ *
+ * "@(#) $Id: kmclipm_test_math.c,v 1.9 2013-10-08 11:12:02 aagudo Exp $"
+ *
+ * Tests for functions in src/kmclipm_priv_functions.c/.h
+ *
+ * who when what
+ * -------- ---------- ----------------------------------------------
+ * aagudo 2008-06-12 created
+ */
+
+/**
+ @defgroup kmclipm_test_math Unit tests for the math functions in kmclipm_math
+
+ Unit test for the functions in the module @ref kmclipm_math
+
+ @{
+*/
+
+/*------------------------------------------------------------------------------
+ * Includes
+ *----------------------------------------------------------------------------*/
+#include <float.h>
+#include <math.h>
+#include <sys/stat.h>
+
+#include "kmclipm_math.h"
+#include "kmclipm_priv_error.h"
+#include "kmclipm_constants.h"
+#include "kmclipm_priv_constants.h"
+
+cpl_msg_severity my_level= CPL_MSG_INFO;
+
+/*------------------------------------------------------------------------------
+ * Implementation
+ *----------------------------------------------------------------------------*/
+
+void test_kmclipm_median_min()
+{
+ cpl_image *img = NULL;
+ double ret_val = 0.0,
+ *dbl = NULL,
+ tol = 0.01;
+ float *img_data = NULL;
+ int i = 0;
+
+ /* ----- test with correct values ----- */
+ /* empty 3x3 image */
+ img = cpl_image_new(MEDIAN_WINDOW_SIZE, MEDIAN_WINDOW_SIZE,
+ CPL_TYPE_FLOAT);
+ img_data = cpl_image_get_data_float(img);
+ for (i = 0; i < MEDIAN_WINDOW_SIZE * MEDIAN_WINDOW_SIZE; i++) {
+ /* initialise to zero */
+ img_data[i] = 0.0;
+ }
+ cpl_test_abs(0.0, kmclipm_median_min(img, NULL, NULL), tol);
+
+ /* non-empty 3x3 image */
+ for (i = 0; i < MEDIAN_WINDOW_SIZE * MEDIAN_WINDOW_SIZE; i++) {
+ /* initialise to some value */
+ img_data[i] = i * 0.1;
+ }
+ cpl_test_abs(0.4, kmclipm_median_min(img, NULL, NULL), 1e-6);
+ cpl_image_delete(img);
+
+ /* non-empty 14x14 image */
+ img = cpl_image_new(KMOS_SLITLET_X, KMOS_SLITLET_Y,
+ CPL_TYPE_FLOAT);
+ img_data = cpl_image_get_data_float(img);
+ for (i = 0; i < KMOS_SLITLET_X * KMOS_SLITLET_Y; i++) {
+ /* initialise to zero */
+ img_data[i] = i * 123.98348;
+ }
+ cpl_test_abs(1859.75, kmclipm_median_min(img, NULL, NULL), tol);
+
+ cpl_image_delete(img);
+
+ /* ----- test with wrong values ----- */
+ /* NULL pointer */
+ ret_val = kmclipm_median_min(NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* casted pointer to 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);
+
+ /* empty 1x1 image */
+ img = cpl_image_new(1, 1, CPL_TYPE_FLOAT);
+ cpl_image_set(img, 1, 1, 0.0);
+
+ ret_val = kmclipm_median_min(img, NULL, NULL);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_image_delete(img);
+
+ cpl_test_error(CPL_ERROR_NONE);
+
+ tol = ret_val; /* against warnings [-Wunused-but-set-variable] */
+}
+
+
+void test_kmclipm_median_max()
+{
+ cpl_image *img = NULL;
+ double ret_val = 0.0,
+ *dbl = NULL,
+ tol = 0.01;
+ float *img_data = NULL;
+ int i = 0;
+
+ /* ----- test with correct values ----- */
+ /* empty 3x3 image */
+ img = cpl_image_new(MEDIAN_WINDOW_SIZE, MEDIAN_WINDOW_SIZE, CPL_TYPE_FLOAT);
+ img_data = cpl_image_get_data_float(img);
+ for (i = 0; i < MEDIAN_WINDOW_SIZE * MEDIAN_WINDOW_SIZE; i++) {
+ /* initialise to zero */
+ img_data[i] = 0.0;
+ }
+ cpl_test_abs(0.0, kmclipm_median_max(img, NULL, NULL), tol);
+
+ /* non-empty 3x3 image */
+ for (i = 0; i < MEDIAN_WINDOW_SIZE * MEDIAN_WINDOW_SIZE; i++) {
+ /* initialise to some value */
+ img_data[i] = i * 0.1;
+ }
+ cpl_test_abs(0.4, kmclipm_median_max(img, NULL, NULL), 1e-6);
+ cpl_image_delete(img);
+
+ /* non-empty 14x14 image */
+ img = cpl_image_new(KMOS_SLITLET_X, KMOS_SLITLET_Y, CPL_TYPE_FLOAT);
+ img_data = cpl_image_get_data_float(img);
+ for (i = 0; i < KMOS_SLITLET_X * KMOS_SLITLET_Y; i++) {
+ /* initialise to zero */
+ img_data[i] = i * 123.98348;
+ }
+ cpl_test_abs(22317, kmclipm_median_max(img, NULL, NULL), tol*3);
+ cpl_image_delete(img);
+
+ /* ----- test with wrong values ----- */
+ /* NULL pointer */
+ ret_val = kmclipm_median_max(NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* casted pointer to 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);
+
+ /* empty 1x1 image */
+ img = cpl_image_new(1, 1, CPL_TYPE_FLOAT);
+ cpl_image_set(img, 1, 1, 0.0);
+ ret_val = kmclipm_median_max(img, NULL, NULL);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_image_delete(img);
+
+ cpl_test_error(CPL_ERROR_NONE);
+
+ tol = ret_val; /* against warnings [-Wunused-but-set-variable] */
+}
+
+void test_kmclipm_is_nan_or_inf()
+{
+ cpl_test_eq(FALSE, kmclipm_is_nan_or_inf(5.0));
+ cpl_test_eq(TRUE, kmclipm_is_nan_or_inf(0.0/0.0));
+ cpl_test_eq(TRUE, kmclipm_is_nan_or_inf(1.0/0.0));
+ cpl_test_eq(TRUE, kmclipm_is_nan_or_inf(-1.0/0.0));
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_is_inf()
+{
+ cpl_test_eq(0, kmclipm_is_inf(5.0));
+ cpl_test_eq(0, kmclipm_is_inf(0.0/0.0));
+ cpl_test_eq(1, kmclipm_is_inf(1.0/0.0));
+ cpl_test_eq(-1, kmclipm_is_inf(-1.0/0.0));
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Executes the unit tests for all functions in the module @ref kmclipm_math
+
+ @return Error code, 0 for NONE.
+ */
+int main()
+{
+ /* For DEVELOPERS:
+ * to omit all CPL_MSG_INFO output, apply following statement in the shell
+ * before executing "make check":
+ * setenv CPL_MSG_LEVEL warning
+ * (or export CPL_MSG_LEVEL=warning)
+ */
+
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", my_level);
+
+ char *my_path = cpl_sprintf("%s/test_data", ".");
+ mkdir(my_path, 0777);
+ cpl_free(my_path);
+
+ cpl_msg_set_level_from_env();
+ my_level = cpl_msg_get_level();
+
+ test_kmclipm_median_min();
+ test_kmclipm_median_max();
+ test_kmclipm_is_nan_or_inf();
+ test_kmclipm_is_inf();
+
+ cpl_msg_info("","All tests done.");
+ cpl_msg_set_level(CPL_MSG_WARNING);
+ return cpl_test_end(0);
+}
+
+/** @} */
diff --git a/kmclipm/test/kmclipm_test_priv_constants.c b/kmclipm/test/kmclipm_test_priv_constants.c
new file mode 100644
index 0000000..0e3763e
--- /dev/null
+++ b/kmclipm/test/kmclipm_test_priv_constants.c
@@ -0,0 +1,191 @@
+
+/*********************************************************************
+ * E.S.O. - VLT project
+ *
+ * "@(#) $Id: kmclipm_test_priv_constants.c,v 1.8 2013-10-08 11:12:02 aagudo Exp $"
+ *
+ * Tests for functions in src/kmclipm_priv_constants.c/.h
+ *
+ * who when what
+ * -------- ---------- ----------------------------------------------
+ * aagudo 2007-10-19 created
+ * aagudo 2008-06-24 added tests for kmclipm_priv_get_rtd_width() and
+ * kmclipm_priv_get_rtd_height()
+ */
+
+/**
+ @defgroup kmclipm_test_priv_constants Unit tests for the private functions in kmclipm_priv_constants
+
+ Unit test for the functions in the module @ref kmclipm_priv_constants
+
+ @{
+*/
+
+
+/*------------------------------------------------------------------------------
+ * Includes
+ *----------------------------------------------------------------------------*/
+#include <sys/stat.h>
+
+#include "kmclipm_constants.h"
+#include "kmclipm_priv_constants.h"
+#include "kmclipm_priv_error.h"
+
+cpl_msg_severity my_level= CPL_MSG_INFO;
+
+/*------------------------------------------------------------------------------
+ * Implementation
+ *----------------------------------------------------------------------------*/
+
+void test_kmclipm_priv_ifu_pos_x()
+{
+ /* invalid tests */
+ cpl_test_eq(kmclipm_priv_ifu_pos_x(-5), -1);
+ cpl_test_eq(kmclipm_priv_ifu_pos_x(KMOS_NR_IFUS), -1);
+
+ /* valid tests */
+ cpl_test_eq(kmclipm_priv_ifu_pos_x(0), RTD_IFU_POS_1);
+ cpl_test_eq(kmclipm_priv_ifu_pos_x(6), RTD_IFU_POS_2);
+ cpl_test_eq(kmclipm_priv_ifu_pos_x(12), RTD_IFU_POS_3);
+ cpl_test_eq(kmclipm_priv_ifu_pos_x(18), RTD_IFU_POS_4);
+ cpl_test_eq(kmclipm_priv_ifu_pos_x(KMOS_NR_IFUS - 1), RTD_IFU_POS_4);
+}
+
+void test_kmclipm_priv_ifu_pos_y()
+{
+ /* invalid tests */
+ cpl_test_eq(kmclipm_priv_ifu_pos_y(-99), -1);
+ cpl_test_eq(kmclipm_priv_ifu_pos_y(KMOS_NR_IFUS + 15), -1);
+
+ /* valid tests */
+ cpl_test_eq(kmclipm_priv_ifu_pos_y(0), RTD_IFU_POS_5);
+ cpl_test_eq(kmclipm_priv_ifu_pos_y(6), RTD_IFU_POS_4);
+ cpl_test_eq(kmclipm_priv_ifu_pos_y(12), RTD_IFU_POS_3);
+ cpl_test_eq(kmclipm_priv_ifu_pos_y(18), RTD_IFU_POS_2);
+ cpl_test_eq(kmclipm_priv_ifu_pos_y(KMOS_NR_IFUS - 1), RTD_IFU_POS_1);
+}
+
+void test_kmclipm_priv_get_rtd_width()
+{
+ cpl_test_eq(kmclipm_priv_get_rtd_width(), 5 * KMOS_SLITLET_X + 6 * RTD_GAP);
+}
+
+void test_kmclipm_priv_get_rtd_height()
+{
+ cpl_test_eq(kmclipm_priv_get_rtd_height(), 5 * KMOS_SLITLET_Y + 6 * RTD_GAP);
+}
+
+void test_kmclipm_priv_get_output_path()
+{
+/* cpl_test_eq(strcmp(kmclipm_priv_get_output_path(),""), 0);*/
+}
+
+void test_kmclipm_priv_set_output_path()
+{
+ char test_string[20] = "ansdd7390m&%G";
+ kmclipm_priv_set_output_path(test_string);
+ cpl_test_eq_string(kmclipm_priv_get_output_path(), test_string);
+}
+
+void test_kmclipm_priv_get_output_cubes()
+{
+ cpl_test_eq(kmclipm_priv_get_output_cubes(), FALSE);
+}
+
+void test_kmclipm_priv_set_output_cubes()
+{
+ kmclipm_priv_set_output_cubes(TRUE);
+ cpl_test_eq(kmclipm_priv_get_output_cubes(), TRUE);
+}
+
+void test_kmclipm_priv_get_output_extracted_images()
+{
+ cpl_test_eq(kmclipm_priv_get_output_extracted_images(), FALSE);
+}
+
+void test_kmclipm_priv_set_output_extracted_images()
+{
+ kmclipm_priv_set_output_extracted_images(TRUE);
+ cpl_test_eq(kmclipm_priv_get_output_extracted_images(), TRUE);
+}
+
+void test_kmclipm_priv_get_output_images()
+{
+ cpl_test_eq(kmclipm_priv_get_output_images(), FALSE);
+}
+
+void test_kmclipm_priv_set_output_images()
+{
+ kmclipm_priv_set_output_images(TRUE);
+ cpl_test_eq(kmclipm_priv_get_output_images(), TRUE);
+}
+
+void test_kmclipm_priv_get_output_patrol()
+{
+ cpl_test_eq(kmclipm_priv_get_output_patrol(), TRUE);
+}
+
+void test_kmclipm_priv_set_output_patrol()
+{
+ kmclipm_priv_set_output_patrol(FALSE);
+ cpl_test_eq(kmclipm_priv_get_output_patrol(), FALSE);
+}
+
+void test_kmclipm_priv_get_output_rtd()
+{
+ cpl_test_eq(kmclipm_priv_get_output_rtd(), TRUE);
+}
+
+void test_kmclipm_priv_set_output_rtd()
+{
+ kmclipm_priv_set_output_rtd(FALSE);
+ cpl_test_eq(kmclipm_priv_get_output_rtd(), FALSE);
+}
+
+
+/**
+ @brief Executes the unit tests for all functions in the module @ref kmclipm_priv_constants
+
+ @return Error code, 0 for NONE.
+*/
+int main()
+{
+ /* For DEVELOPERS:
+ * to omit all CPL_MSG_INFO output, apply following statement in the shell
+ * before executing "make check":
+ * setenv CPL_MSG_LEVEL warning
+ * (or export CPL_MSG_LEVEL=warning)
+ */
+
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", my_level);
+
+ char *my_path = cpl_sprintf("%s/test_data", ".");
+ mkdir(my_path, 0777);
+ cpl_free(my_path);
+
+ cpl_msg_set_level_from_env();
+ my_level = cpl_msg_get_level();
+
+ test_kmclipm_priv_ifu_pos_x();
+ test_kmclipm_priv_ifu_pos_y();
+ test_kmclipm_priv_get_rtd_width();
+ test_kmclipm_priv_get_rtd_height();
+ test_kmclipm_priv_get_output_path();
+ test_kmclipm_priv_set_output_path();
+ test_kmclipm_priv_get_output_cubes();
+ test_kmclipm_priv_set_output_cubes();
+ test_kmclipm_priv_get_output_extracted_images();
+ test_kmclipm_priv_set_output_extracted_images();
+ test_kmclipm_priv_get_output_patrol();
+ test_kmclipm_priv_set_output_patrol();
+ test_kmclipm_priv_get_output_rtd();
+ test_kmclipm_priv_set_output_rtd();
+ test_kmclipm_priv_get_output_images();
+ test_kmclipm_priv_set_output_images();
+
+ cpl_msg_info("","All tests done.");
+ cpl_msg_set_level(CPL_MSG_WARNING);
+ return cpl_test_end(0);
+}
+
+/** @} */
diff --git a/kmclipm/test/kmclipm_test_priv_functions.c b/kmclipm/test/kmclipm_test_priv_functions.c
new file mode 100644
index 0000000..fab801d
--- /dev/null
+++ b/kmclipm/test/kmclipm_test_priv_functions.c
@@ -0,0 +1,1114 @@
+
+/*********************************************************************
+ * E.S.O. - VLT project
+ *
+ * "@(#) $Id: kmclipm_test_priv_functions.c,v 1.9 2013-10-08 11:12:02 aagudo Exp $"
+ *
+ * Tests for functions in src/kmclipm_priv_functions.c/.h
+ *
+ * who when what
+ * -------- ---------- ----------------------------------------------
+ * aagudo 2007-10-19 created
+ * aagudo 2007-12-14 added test for new function:
+ * kmclipm_test_priv_paint_ifu_rectangle()
+ * (Makes boundary around IFU-images in patrol-view)
+ * aagudo 2007-12-17 fixed memory leak in
+ kmclipm_test_priv_create_patrol_view()
+ * aagudo 2008-06-06 updated calls to test functions because of new testlib
+ * aagudo 2008-06-24 added test for kmclipm_priv_paint_ifu_rectangle_rtd()
+ */
+
+/**
+ @defgroup kmclipm_test_priv_functions Unit tests for the private functions in kmclipm_priv_functions
+
+ Unit test for the functions in the module @ref kmclipm_priv_functions
+
+ @{
+*/
+
+/*------------------------------------------------------------------------------
+ * Includes
+ *----------------------------------------------------------------------------*/
+
+#include <float.h>
+#include <math.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+
+#include "kmclipm_constants.h"
+#include "kmclipm_priv_constants.h"
+#include "kmclipm_priv_reconstruct.h"
+#include "kmclipm_priv_functions.h"
+#include "kmclipm_priv_error.h"
+
+cpl_msg_severity my_level= CPL_MSG_INFO;
+
+/*------------------------------------------------------------------------------
+ * Implementation
+ *----------------------------------------------------------------------------*/
+
+/**
+ @brief Routine to test kmclipm_priv_paste_ifu_images()
+ */
+void test_kmclipm_priv_paste_ifu_images()
+{
+ double ret_val = 0.0;
+ cpl_image *img = NULL,
+ *img2 = NULL,
+ *img3 = NULL;
+
+ /* ----- test with wrong values ----- */
+ /* 2 NULL pointers & 2 negative values*/
+ img = NULL;
+
+ ret_val = kmclipm_priv_paste_ifu_images(NULL, &img, -1, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* 1 NULL pointers & 2 negative values*/
+ img2 = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
+ cpl_image_set(img2, 1, 1, 9.9);
+ cpl_image_set(img2, 1, 2, 9.9);
+ cpl_image_set(img2, 2, 1, 9.9);
+ cpl_image_set(img2, 2, 2, 9.9);
+
+ ret_val = kmclipm_priv_paste_ifu_images(img2, &img, -1, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ ret_val += ret_val; /* against warnings [-Wunused-but-set-variable] */
+
+ /* ----- test with correct values ----- */
+
+ /* 2 negative values*/
+ img = cpl_image_new(4, 4, CPL_TYPE_FLOAT);
+
+ cpl_test_abs(kmclipm_priv_paste_ifu_images(img2, &img, -1, -1), 9.9, 1e-6);
+
+ /* 1 negative value*/
+ cpl_test_abs(kmclipm_priv_paste_ifu_images(img2, &img, -3, -1), 9.9, 1e-6);
+
+ /* to big value*/
+ cpl_test_abs(kmclipm_priv_paste_ifu_images(img2, &img, 4, -1), 9.9, 1e-6);
+
+ /* to big value*/
+ cpl_test_abs(kmclipm_priv_paste_ifu_images(img2, &img, 3, 4), 9.9, 1e-6);
+
+ /* ok value */
+ cpl_test_abs(kmclipm_priv_paste_ifu_images(img2, &img, 3, 3), 9.9, 1e-6);
+
+ /* --- check result (subtract generated image from img3) */
+ img3 = cpl_image_new(4, 4, CPL_TYPE_FLOAT);
+ cpl_image_set(img3, 3, 3, 9.9);
+ cpl_image_set(img3, 3, 4, 9.9);
+ cpl_image_set(img3, 4, 3, 9.9);
+ cpl_image_set(img3, 4, 4, 9.9);
+
+ /* Assert that images are equal */
+ cpl_image_subtract(img, img3);
+ cpl_test_abs(cpl_image_get_max(img), 0.0, 0.001);
+
+ cpl_image_delete(img);
+ cpl_image_delete(img2);
+ cpl_image_delete(img3);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Routine to test kmclipm_priv_create_patrol_view()
+ */
+void test_kmclipm_priv_create_patrol_view()
+{
+ float *img_data = NULL;
+
+ cpl_image *img = NULL,
+ *img2 = NULL,
+ *ret_ptr = NULL;
+
+ cpl_imagelist *img_list = NULL;
+
+ int i = 0,
+ j = 0;
+
+ const int ifu_id_zero[] = {-1,
+ 0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0},
+ ifu_id_mixed[] = {-1,
+ 1,0,1,0,1,0,1,0,1,0,1,1,
+ 0,1,0,0,0,0,0,0,0,0,0,0};
+
+ const double nominal_pos[] = {-1.0, -1.0,
+ -111.66474, 31.4259, /* IFU_1_x, IFU_1_y */
+ -71.01666, 46.6983, /* IFU_2*/
+ -28.72386, 13.56894, /* IFU_3 */
+ -15.33114, 0.64614, /* IFU_4 */
+ 111.54726, 16.85838, /* IFU_5 */
+ 34.83282, 93.1029, /* IFU_6 */
+ -10.39698, -113.42694, /* IFU_7 */
+ 50.10522, -112.25214, /* IFU_8 */
+ -50, -30, /* IFU_9 */
+ -10, -80, /* IFU_10 */
+ -50, 15, /* IFU_11 */
+ 10, -100, /* IFU_12 */
+ 15, 15, /* IFU_13 */
+ 126, 0, /* IFU_14 */
+ -10, -10, /* IFU_15 */
+ 89.716577, 89.716577, /* IFU_16 */
+ 50, -40, /* IFU_17 */
+ 40, -20, /* IFU_18 */
+ 70, -10, /* IFU_19 */
+ -10, 50, /* IFU_20 */
+ -40, 80, /* IFU_21 */
+ -70, 0, /* IFU_22 */
+ 60, 10, /* IFU_23 */
+ 70, 50 }; /* IFU_24 */
+
+ /* ----- test with wrong values ----- */
+ /* 3 NULL pointers */
+ ret_ptr = kmclipm_priv_create_patrol_view(NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* empty image list and 2 NULL pointers */
+ img_list = cpl_imagelist_new();
+ ret_ptr = kmclipm_priv_create_patrol_view(img_list, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* empty image list, nominal_pos and 1 NULL pointer */
+ ret_ptr = kmclipm_priv_create_patrol_view(img_list, nominal_pos, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* too large img_list ( greater than KMOS_NR_IFUS) */
+ for (j = 0; j <= KMOS_NR_IFUS; j++) {
+ img2 = cpl_image_new(KMOS_SLITLET_X, KMOS_SLITLET_Y, CPL_TYPE_FLOAT);
+ cpl_imagelist_set(img_list, img2, j);
+ }
+ ret_ptr = kmclipm_priv_create_patrol_view(img_list, nominal_pos,
+ ifu_id_zero);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_imagelist_delete(img_list);
+
+ /* empty image list, nominal_pos is ok and ifu_id is mixed*/
+ img_list = cpl_imagelist_new();
+
+ ret_ptr = kmclipm_priv_create_patrol_view(img_list, nominal_pos,
+ ifu_id_mixed);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_imagelist_delete(img_list);
+
+ /* empty image list, nominal_pos and ifu_id is zero */
+ img_list = cpl_imagelist_new();
+ ret_ptr = kmclipm_priv_create_patrol_view(img_list, nominal_pos,
+ ifu_id_zero);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ /* ----- test with correct values ----- */
+
+ /* non-empty image list, nominal_pos is ok and ifu_id is zero*/
+
+ for (j = 0; j < KMOS_NR_DETECTORS * KMOS_IFUS_PER_DETECTOR; j++) {
+ img = cpl_image_new(KMOS_SLITLET_X, KMOS_SLITLET_Y, CPL_TYPE_FLOAT);
+ img_data = cpl_image_get_data_float(img);
+ for (i = 0; i < KMOS_SLITLET_X * KMOS_SLITLET_Y; i++) {
+ img_data[i] = 66.0;
+ }
+ cpl_imagelist_set(img_list, img, j);
+ }
+
+ ret_ptr = kmclipm_priv_create_patrol_view(img_list, nominal_pos,
+ ifu_id_zero);
+ cpl_test_nonnull(ret_ptr);
+
+ cpl_image_delete(ret_ptr); ret_ptr = NULL;
+ cpl_imagelist_delete(img_list); img_list = NULL;
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Routine to test kmclipm_priv_paint_ifu_rectangle_patrol()
+ */
+void test_kmclipm_priv_paint_ifu_rectangle_patrol()
+{
+ cpl_image *img = NULL;
+
+ /* ----- test with wrong values ----- */
+ /* NULL pointers & 2 negative values*/
+ kmclipm_priv_paint_ifu_rectangle_patrol(&img, -1, -1, 99.0);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* ----- test with correct values ----- */
+ img = cpl_image_new(PATROL_FIELD_SIZE, PATROL_FIELD_SIZE, CPL_TYPE_FLOAT);
+ kmclipm_priv_paint_ifu_rectangle_patrol(&img, -1, -1, 99.0);
+ kmclipm_priv_paint_ifu_rectangle_patrol(&img, 2, -1, 99.0);
+ kmclipm_priv_paint_ifu_rectangle_patrol(&img, 2, 10, 99.0);
+ kmclipm_priv_paint_ifu_rectangle_patrol(&img, 10, 2, 99.0);
+
+ cpl_image_delete(img);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Routine to test kmclipm_priv_paint_ifu_rectangle_rtd()
+ */
+void test_kmclipm_priv_paint_ifu_rectangle_rtd()
+{
+ cpl_image *img = NULL;
+
+ int ids[] = { -1,
+ 1, 1, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 1, 1, 1, 1, 1, 1};
+
+ /* ----- test with wrong values ----- */
+ /* 2 NULL pointers */
+ kmclipm_priv_paint_ifu_rectangle_rtd(&img, NULL, 99.0);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* 1 NULL pointers */
+ img = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
+ kmclipm_priv_paint_ifu_rectangle_rtd(&img, NULL, 99.0);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* to small image*/
+ kmclipm_priv_paint_ifu_rectangle_rtd(&img, ids, 99.0);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_image_delete(img);
+
+ /* ----- test with correct values ----- */
+ img = cpl_image_new(kmclipm_priv_get_rtd_width(),
+ kmclipm_priv_get_rtd_height(),
+ CPL_TYPE_FLOAT);
+ kmclipm_priv_paint_ifu_rectangle_rtd(&img, ids, 99.0);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_image_delete(img);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Routine to test kmclipm_priv_gauss2d_fnc()
+ */
+void test_kmclipm_priv_gauss2d_fnc()
+{
+ double x[] = {100, 130},
+ a[] = {1, 100, 130, 5, 0};
+
+ double result = 0.0,
+ tol = 0.001;
+
+ int r = 0;
+
+ /* ----- invalid test ----- */
+
+ /* ----- valid test ----- */
+ r = kmclipm_priv_gauss2d_fnc(x, a, &result);
+ cpl_test_eq(r, 0);
+ cpl_test_abs(result, 1.0, tol);
+
+ x[0] = 98, x[1] = 128;
+ r = kmclipm_priv_gauss2d_fnc(x, a, &result);
+ cpl_test_eq(r, 0);
+ cpl_test_abs(result, 0.411796, tol);
+
+ x[0] = 100, x[1] = 130;
+ a[0] = 3; a[4] = 2;
+ r = kmclipm_priv_gauss2d_fnc(x, a, &result);
+ cpl_test_eq(r, 0);
+ cpl_test_abs(result, 5.0, tol);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Routine to test kmclipm_priv_gauss2d_fncd()
+ */
+void test_kmclipm_priv_gauss2d_fncd()
+{
+ double x[] = {100, 130},
+ a[] = {1, 100, 130, 5},
+ res[] = {0, 0, 0, 0, 0};
+
+ double tol = 0.001;
+
+ int r = 0;
+
+ /* ----- invalid test ----- */
+
+ /* ----- valid test ----- */
+ r = kmclipm_priv_gauss2d_fncd(x, a, res);
+ cpl_test_eq(r, 0);
+ cpl_test_abs(res[0], 1.0, tol);
+ cpl_test_abs(res[1], 0.0, tol);
+ cpl_test_abs(res[2], 0.0, tol);
+ cpl_test_abs(res[3], 0.0, tol);
+ cpl_test_abs(res[4], 1.0, tol);
+
+ x[0] = 98, x[1] = 128;
+ r = kmclipm_priv_gauss2d_fncd(x, a, res);
+ cpl_test_eq(r, 0);
+ cpl_test_abs(res[0], 0.411796, tol);
+ cpl_test_abs(res[1], -0.182678, tol);
+ cpl_test_abs(res[2], -0.182678, tol);
+ cpl_test_abs(res[3], 0.146143, tol);
+ cpl_test_abs(res[4], 1.0, tol);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Routine to test kmclipm_priv_debug_vector()
+ */
+void test_kmclipm_priv_debug_vector()
+{
+ cpl_vector *x = NULL;
+
+ /* ----- invalid test ----- */
+ kmclipm_priv_debug_vector(x);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* ----- valid test ----- */
+ x = cpl_vector_new(3);
+ cpl_vector_set(x, 0, 5.5);
+ cpl_vector_set(x, 1, 6.6);
+ cpl_vector_set(x, 2, 7.7);
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_priv_debug_vector(x));
+ cpl_vector_delete(x);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Routine to test kmclipm_priv_debug_image()
+ */
+void test_kmclipm_priv_debug_image()
+{
+ cpl_image *x = NULL;
+
+ /* ----- invalid test ----- */
+ kmclipm_priv_debug_image(x);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* ----- valid test ----- */
+ x = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
+ cpl_image_set(x, 1, 1, 1);
+ cpl_image_set(x, 1, 2, 2);
+ cpl_image_set(x, 2, 1, 3);
+ cpl_image_set(x, 2, 2, 4);
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_priv_debug_image(x));
+ cpl_image_delete(x);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Routine to test kmclipm_priv_debug_cube()
+ */
+void test_kmclipm_priv_debug_cube()
+{
+ cpl_imagelist *x = NULL;
+ cpl_image *img = NULL;
+
+ /* ----- invalid test ----- */
+ kmclipm_priv_debug_cube(x);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* ----- valid test ----- */
+ x = cpl_imagelist_new();
+ img = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
+ cpl_image_set(img, 1, 1, 1);
+ cpl_image_set(img, 1, 2, 2);
+ cpl_image_set(img, 2, 1, 3);
+ cpl_image_set(img, 2, 2, 4);
+ cpl_imagelist_set(x, img, 0);
+ img = cpl_image_new(2, 2, CPL_TYPE_FLOAT);
+ cpl_image_set(img, 1, 1, 5);
+ cpl_image_set(img, 1, 2, 6);
+ cpl_image_set(img, 2, 1, 7);
+ cpl_image_set(img, 2, 2, 8);
+ cpl_imagelist_set(x, img, 1);
+ cpl_test_eq(CPL_ERROR_NONE,
+ kmclipm_priv_debug_cube(x));
+ cpl_imagelist_delete(x);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_priv_find_angle()
+{
+ char *filt = NULL,
+ *grat = NULL,
+ *fn_xcal = NULL,
+ *fn_ycal = NULL,
+ *fn_lcal = NULL,
+ *fn_lut = NULL,
+ *my_path = NULL;
+
+ cpl_propertylist *pl = cpl_propertylist_new();
+ filt = cpl_sprintf("%s", "K");
+ grat = cpl_sprintf("%s", "K");
+
+ /* --- invalid tests --- */
+ cpl_msg_set_level(CPL_MSG_OFF);
+ kmclipm_priv_find_angle(0, NULL, NULL, NULL, NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ kmclipm_priv_find_angle(0, &filt, NULL, NULL, NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ kmclipm_priv_find_angle(0, &filt, &grat, NULL, NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ kmclipm_priv_find_angle(0, &filt, &grat, &fn_xcal, NULL, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ kmclipm_priv_find_angle(0, &filt, &grat, &fn_xcal, &fn_ycal, NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ kmclipm_priv_find_angle(0, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ kmclipm_priv_find_angle(0, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ cpl_test_error(CPL_ERROR_FILE_IO);
+
+ my_path = cpl_sprintf("%s/test_data/bbb/", ".");
+ kmclipm_set_cal_path(my_path, FALSE);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("mkdir -p %s/test_data/bbb/", ".");
+ system(my_path);
+ cpl_free(my_path);
+ kmclipm_priv_find_angle(0, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ cpl_free(fn_xcal);
+ cpl_free(fn_ycal);
+ cpl_free(fn_lcal);
+ cpl_free(fn_lut);
+ cpl_test_error(CPL_ERROR_ILLEGAL_OUTPUT);
+
+ cpl_propertylist_update_double(pl, ROTANGLE, 0);
+ cpl_propertylist_update_string(pl, "ESO INS FILT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT3 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT3 ID", "K");
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "XCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK0.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ kmclipm_priv_find_angle(0, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ cpl_free(fn_xcal);
+ cpl_free(fn_ycal);
+ cpl_free(fn_lcal);
+ cpl_free(fn_lut);
+ cpl_test_error(CPL_ERROR_ILLEGAL_OUTPUT);
+
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "YCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK0.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ kmclipm_priv_find_angle(0, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ cpl_free(fn_xcal);
+ cpl_free(fn_ycal);
+ cpl_free(fn_lcal);
+ cpl_free(fn_lut);
+ cpl_test_error(CPL_ERROR_ILLEGAL_OUTPUT);
+
+ cpl_msg_set_level(my_level);
+
+ /* --- valid tests --- */
+
+ /* create cal0 */
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "LCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK0.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ kmclipm_priv_find_angle(0, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK0.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK0.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK0.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_0", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* create cal60 */
+ cpl_propertylist_update_double(pl, ROTANGLE, 60);
+ cpl_propertylist_update_string(pl, "ESO INS FILT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT3 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT3 ID", "K");
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "XCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK60.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "YCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK60.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "LCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK60.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ kmclipm_priv_find_angle(0, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK0.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK0.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK0.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_0", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(60, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK60.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK60.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK60.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_60", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(45, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK60.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK60.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK60.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_60", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(-1, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK0.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK0.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK0.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_0", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(29.9, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK0.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK0.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK0.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_0", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(30, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK0.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK0.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK0.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_0", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(30.1, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK60.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK60.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK60.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_60", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* create cal120 */
+ cpl_propertylist_update_double(pl, ROTANGLE, 120);
+ cpl_propertylist_update_string(pl, "ESO INS FILT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT3 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT3 ID", "K");
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "XCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK120.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "YCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK120.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "LCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK120.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+
+ /* create cal180 */
+ cpl_propertylist_update_double(pl, ROTANGLE, 180);
+ cpl_propertylist_update_string(pl, "ESO INS FILT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT3 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT3 ID", "K");
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "XCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK180.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "YCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK180.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "LCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK180.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+
+ /* create cal240 */
+ cpl_propertylist_update_double(pl, ROTANGLE, 240);
+ cpl_propertylist_update_string(pl, "ESO INS FILT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT3 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT3 ID", "K");
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "XCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK240.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "YCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK240.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "LCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK240.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+
+ /* create cal300 */
+ cpl_propertylist_update_double(pl, ROTANGLE, 300);
+ cpl_propertylist_update_string(pl, "ESO INS FILT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT3 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT3 ID", "K");
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "XCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK300.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "YCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK300.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "LCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK300.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+
+ kmclipm_priv_find_angle(-1, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK0.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK0.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK0.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_0", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(299.9, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK300.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK300.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK300.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_300", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(330.1, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK0.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK0.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK0.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_0", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(330, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK300.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK300.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK300.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_300", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(329.9, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK300.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK300.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK300.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_300", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(-29.9, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK0.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK0.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK0.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_0", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(-30, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK300.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK300.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK300.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_300", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(-30.1, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK300.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK300.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK300.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_300", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_priv_find_angle(-362, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK0.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK0.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK0.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_0", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* create cal0 H-band */
+ cpl_propertylist_update_double(pl, ROTANGLE, 0);
+ cpl_propertylist_update_string(pl, "ESO INS FILT1 ID", "H");
+ cpl_propertylist_update_string(pl, "ESO INS FILT2 ID", "H");
+ cpl_propertylist_update_string(pl, "ESO INS FILT3 ID", "H");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT1 ID", "H");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT2 ID", "H");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT3 ID", "H");
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "XCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalH0.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "YCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalH0.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "LCAL");
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalH0.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ kmclipm_priv_find_angle(0, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalK0.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalK0.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalK0.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_KKK_0", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_free(filt); filt = cpl_sprintf("H");
+ cpl_free(grat); grat = cpl_sprintf("H");
+ kmclipm_priv_find_angle(2, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/bbb/xcalH0.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/ycalH0.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lcalH0.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/bbb/lut_HHH_0", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* create cal-test */
+ my_path = cpl_sprintf("%s/test_data/ccc/", ".");
+ kmclipm_set_cal_path(my_path, FALSE);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("mkdir -p %s/test_data/ccc/", ".");
+ system(my_path);
+ cpl_free(my_path);
+
+ cpl_propertylist_update_double(pl, ROTANGLE, 0);
+ cpl_propertylist_update_string(pl, "ESO INS FILT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS FILT3 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT1 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT2 ID", "K");
+ cpl_propertylist_update_string(pl, "ESO INS GRAT3 ID", "K");
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "XCAL");
+ my_path = cpl_sprintf("%s/test_data/ccc/xcal_test.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "YCAL");
+ my_path = cpl_sprintf("%s/test_data/ccc/ycal_test.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_propertylist_update_string(pl, CPL_DFS_PRO_CATG, "LCAL");
+ my_path = cpl_sprintf("%s/test_data/ccc/lcal_test.fits", ".");
+ cpl_propertylist_save(pl, my_path, CPL_IO_CREATE);
+ cpl_free(my_path);
+ cpl_free(filt); filt = cpl_sprintf("K");
+ cpl_free(grat); grat = cpl_sprintf("K");
+ kmclipm_priv_find_angle(0, &filt, &grat, &fn_xcal, &fn_ycal, &fn_lcal, &fn_lut);
+ my_path = cpl_sprintf("%s/test_data/ccc/xcal_test.fits", ".");
+ cpl_test_eq_string(fn_xcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/ccc/ycal_test.fits", ".");
+ cpl_test_eq_string(fn_ycal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/ccc/lcal_test.fits", ".");
+ cpl_test_eq_string(fn_lcal, my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/test_data/ccc/lut_KKK_0", ".");
+ cpl_test_eq_string(fn_lut, my_path);
+ cpl_free(my_path);
+ cpl_free(fn_xcal); fn_xcal = NULL;
+ cpl_free(fn_ycal); fn_ycal = NULL;
+ cpl_free(fn_lcal); fn_lcal = NULL;
+ cpl_free(fn_lut); fn_lut = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* test additionally if filt & grat have been changed from H to K */
+ cpl_test_eq_string(filt, "K");
+ cpl_test_eq_string(grat, "K");
+
+ cpl_free(filt); filt = NULL;
+ cpl_free(grat); grat = NULL;
+ cpl_propertylist_delete(pl); pl = NULL;
+
+ my_path = cpl_sprintf("rm -rf %s/test_data/bbb", ".");
+ system(my_path);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("rm -rf %s/test_data/ccc", ".");
+ system(my_path);
+ cpl_free(my_path);
+}
+
+/**
+ @brief Executes the unit tests for all functions in the module
+ @ref kmclipm_priv_functions
+ @param argc ...
+ @param argv ...
+ @return Error code, 0 for NONE.
+ */
+int main()
+{
+ /* For DEVELOPERS:
+ * to omit all CPL_MSG_INFO output, apply following statement in the shell
+ * before executing "make check":
+ * setenv CPL_MSG_LEVEL warning
+ * (or export CPL_MSG_LEVEL=warning)
+ */
+
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", my_level);
+
+ char *my_path = cpl_sprintf("%s/test_data", ".");
+ mkdir(my_path, 0777);
+ cpl_free(my_path);
+
+ cpl_msg_set_level_from_env();
+ my_level = cpl_msg_get_level();
+
+ test_kmclipm_priv_paste_ifu_images();
+ test_kmclipm_priv_create_patrol_view();
+ test_kmclipm_priv_paint_ifu_rectangle_patrol();
+ test_kmclipm_priv_paint_ifu_rectangle_rtd();
+ test_kmclipm_priv_gauss2d_fnc();
+ test_kmclipm_priv_gauss2d_fncd();
+ test_kmclipm_priv_debug_vector();
+ test_kmclipm_priv_debug_image();
+ test_kmclipm_priv_debug_cube();
+ test_kmclipm_priv_find_angle();
+
+ cpl_msg_info("","All tests done.");
+ cpl_msg_set_level(CPL_MSG_WARNING);
+ return cpl_test_end(0);
+}
+
+/** @} */
diff --git a/kmclipm/test/kmclipm_test_priv_reconstruct.c b/kmclipm/test/kmclipm_test_priv_reconstruct.c
new file mode 100644
index 0000000..f8d14ce
--- /dev/null
+++ b/kmclipm/test/kmclipm_test_priv_reconstruct.c
@@ -0,0 +1,553 @@
+
+/*********************************************************************
+ * E.S.O. - VLT project
+ *
+ * "@(#) $Id: kmclipm_test_priv_reconstruct.c,v 1.7 2013-10-08 11:12:02 aagudo Exp $"
+ *
+ * Tests for functions in src/kmclipm_priv_constants.c/.h
+ *
+ * who when what
+ * -------- ---------- ----------------------------------------------
+ * aagudo 2011-09-06 created
+ */
+
+/**
+ @defgroup kmclipm_test_priv_reconstruct Unit tests for the private functions in kmclipm_priv_reconstruct
+
+ Unit test for the functions in the module @ref kmclipm_priv_reconstruct
+
+ @{
+*/
+
+
+/*------------------------------------------------------------------------------
+ * Includes
+ *----------------------------------------------------------------------------*/
+#include <math.h>
+#include <sys/stat.h>
+
+#include "kmclipm_constants.h"
+#include "kmclipm_priv_reconstruct.h"
+#include "kmclipm_priv_error.h"
+
+cpl_msg_severity my_level= CPL_MSG_INFO;
+
+/*------------------------------------------------------------------------------
+ * Implementation
+ *----------------------------------------------------------------------------*/
+int compareAndSaveNeighborGrid (const char* testName, const char * info,
+ const gridDefinition gd, neighbors ***nb, const samples *sampleList)
+{
+ int retVal = 1;
+ FILE *data;
+ char *dataFilename;
+ char *refFilename;
+ char *idlFilename;
+ char *cmpCommand;
+ int p, il, iy, ix, n;
+
+ dataFilename = cpl_sprintf( "%s/test_data/kmclipm_test_priv_find_neighbors_%s.dat", ".", testName);
+ idlFilename = cpl_sprintf( "%s/test_data/kmclipm_test_priv_find_neighbors_%s.idl", ".", testName);
+ refFilename = cpl_sprintf("%s/ref/kmclipm_test_priv_find_neighbors_%s.ref", getenv("srcdir"), testName);
+ int totalNeighborCount = 0;
+
+ data = fopen(dataFilename, "w");
+ fprintf(data, "Test: %s\n", info);
+ fprintf(data, "Samples:\n");
+ for (p=0; p<sampleList->no_samples; p++) {
+ fprintf(data, " %2d -> %+.2f / %+.2f / %+.2f : %+.2f\n",
+ p, sampleList->x[p],sampleList->y[p],
+ sampleList->l[p],sampleList->value[p]);
+ }
+ fprintf(data, "Grid definition:\n");
+ fprintf(data, "x: dim %2d %+.3f...%+.3f delta %.3f\n",
+ gd.x.dim, gd.x.start, gd.x.start+(gd.x.dim-1)*gd.x.delta, gd.x.delta);
+ fprintf(data, "y: dim %2d %+.3f...%+.3f delta %.3f\n",
+ gd.y.dim, gd.y.start, gd.y.start+(gd.y.dim-1)*gd.y.delta, gd.y.delta);
+ fprintf(data, "l: dim %2d %+.3f...%+.3f delta %.3f\n",
+ gd.l.dim, gd.l.start, gd.l.start+(gd.l.dim-1)*gd.l.delta, gd.l.delta);
+ fprintf(data, "Grid pixel neighbors:\n");
+ for (il=0; il<gd.l.dim; il++) {
+ for (iy=0; iy<gd.y.dim; iy++) {
+ for (ix=0; ix<gd.x.dim; ix++) {
+ totalNeighborCount += nb[ix][iy][il].no_neighbors;
+ fprintf(data, "%d / %d / %d (%+.2f / %+.2f / %+.2f) : %d \n",
+ ix, iy, il,
+ gd.x.start + ix * gd.x.delta, gd.y.start + iy * gd.y.delta,
+ gd.l.start + il * gd.l.delta, nb[ix][iy][il].no_neighbors);
+ for (n=0; n<nb[ix][iy][il].no_neighbors; n++) {
+ int k = nb[ix][iy][il].idx[n];
+ fprintf(data, "\t (%+.2f / %+.2f / %+.2f) %.3f -> %d \n",
+ sampleList->x[k],sampleList->y[k],sampleList->l[k],
+ nb[ix][iy][il].distance[n], k);
+ }
+ }
+ }
+ }
+ fprintf(data, "Sample readout neighbors:\n");
+ for (p=0; p<sampleList->no_samples; p++) {
+ fprintf(data, " %2d -> %+.2f / %+.2f / %+.2f\n",
+ p, sampleList->x[p],sampleList->y[p],sampleList->l[p]);
+ for (il=0; il<gd.l.dim; il++) {
+ for (iy=0; iy<gd.y.dim; iy++) {
+ for (ix=0; ix<gd.x.dim; ix++) {
+ for (n=0; n<nb[ix][iy][il].no_neighbors; n++) {
+ int k = nb[ix][iy][il].idx[n];
+ if (k == p) {
+ fprintf(data, "\t(%+.2f / %+.2f / %+.2f) %.3f\n",
+ gd.x.start + ix * gd.x.delta, gd.y.start + iy * gd.y.delta,
+ gd.l.start + il * gd.l.delta, nb[ix][iy][il].distance[n]);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ fclose(data);
+
+ data = fopen(idlFilename, "w");
+ fprintf(data, "%d\n", sampleList->no_samples);
+ for (p=0; p<sampleList->no_samples; p++) {
+ fprintf(data, "%f %f %f %f\n", sampleList->x[p],sampleList->y[p],
+ sampleList->l[p],sampleList->value[p]);
+ }
+ fprintf(data, "%d\n", gd.x.dim * gd.y.dim * gd.l.dim);
+ for (il=0; il<gd.l.dim; il++) {
+ for (iy=0; iy<gd.y.dim; iy++) {
+ for (ix=0; ix<gd.x.dim; ix++) {
+ fprintf(data, "%f %f %f\n", gd.x.start + ix * gd.x.delta,
+ gd.y.start + iy * gd.y.delta, gd.l.start + il * gd.l.delta);
+ }
+ }
+ }
+ fprintf(data, "%d\n", totalNeighborCount);
+ for (il=0; il<gd.l.dim; il++) {
+ for (iy=0; iy<gd.y.dim; iy++) {
+ for (ix=0; ix<gd.x.dim; ix++) {
+ for (n=0; n<nb[ix][iy][il].no_neighbors; n++) {
+ int k = nb[ix][iy][il].idx[n];
+ fprintf(data, "%f %f %f %f %f %f\n",
+ gd.x.start + ix * gd.x.delta, gd.y.start + iy * gd.y.delta,
+ gd.l.start + il * gd.l.delta,
+ sampleList->x[k],sampleList->y[k],sampleList->l[k]);
+ }
+ }
+ }
+ }
+ fclose(data);
+
+ cmpCommand = cpl_sprintf("cmp %s %s", refFilename, dataFilename);
+ int test = system(cmpCommand);
+ retVal = WEXITSTATUS(test); /* WEXITSTATUS is defined in <sys/wait.h> */
+
+ if (retVal) {
+ for (il=0; il<gd.l.dim; il++) {
+ for (iy=0; iy<gd.y.dim; iy++) {
+ for (ix=0; ix<gd.x.dim; ix++) {
+ printf("%d (", nb[ix][iy][il].no_neighbors);
+ for (n=0; n<nb[ix][iy][il].no_neighbors; n++) {
+ int k = nb[ix][iy][il].idx[n];
+ printf("%.1f/%.1f/%.1f->%.3f ", sampleList->x[k],sampleList->x[k],
+ sampleList->l[k],nb[ix][iy][il].distance[n]);
+ }
+ printf(")\t");
+ }
+ printf("\n");
+ }
+ printf("\n");
+ }
+ }
+
+ cpl_free(cmpCommand);
+ cpl_free(idlFilename);
+ cpl_free(dataFilename);
+ cpl_free(refFilename);
+
+ return retVal;
+}
+
+void test_kmclipm_priv_reconstruct_nnlut_get_timestamp()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_priv_reconstruct_nnlut_read()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_priv_reconstruct_nnlut_write()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_priv_reconstruct_nearestneighbor()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_priv_reconstruct_cubicspline()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_priv_setup_grid()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_priv_find_neighbors()
+{
+ int il, ix, iy;
+
+ samples sampleList;
+ sampleList.no_samples = 0;
+ gridDefinition gd;
+ neighbors ***nb = NULL;
+
+ gd.lamdaDistanceScale = 1.0;
+ gd.x.start = -3;
+ gd.x.delta = 2;
+ gd.x.dim = (3 - gd.x.start) / gd.x.delta + 1;
+ gd.y.start = -4;
+ gd.y.delta = 2;
+ gd.y.dim = (4 - gd.y.start) / gd.y.delta + 1;
+ gd.l.start = 0;
+ gd.l.delta = 1;
+ gd.l.dim = (2 - gd.l.start) / gd.l.delta + 1;
+ gd.neighborHood.distance = 0.5;
+ gd.neighborHood.scale = PIXEL;
+ gd.neighborHood.type = N_CUBE;
+ /*
+ float distance = 0.5;
+ enum neighborhoodType nbhType = N_CUBE;
+ enum scaleType distType = PIXEL;
+ */
+ sampleList.no_samples = gd.x.dim * gd.y.dim * gd.l.dim;
+ sampleList.x = (float *) cpl_calloc(sampleList.no_samples, sizeof(float));
+ sampleList.y = (float *) cpl_calloc(sampleList.no_samples, sizeof(float));
+ sampleList.l = (float *) cpl_calloc(sampleList.no_samples, sizeof(float));
+ sampleList.value = (float *) cpl_calloc(sampleList.no_samples, sizeof(float));
+
+ /*
+ * test for illegal inputs
+ */
+ /* missing sample list */
+ cpl_test_null(nb = (neighbors ***) kmclipm_priv_find_neighbors (gd, NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+ cpl_free(nb); nb = NULL;
+
+ /* grid dimensions not greater than 0 */
+ gridDefinition gde = gd;
+ gde.x.dim = 0;
+ cpl_test_null(nb = (neighbors ***) kmclipm_priv_find_neighbors (gde, &sampleList));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_free(nb); nb = NULL;
+ gde.x.dim = gd.x.dim;
+
+ /* reverse grid axis */
+ gde.y.delta = -1.0;
+ cpl_test_null(nb = (neighbors ***) kmclipm_priv_find_neighbors (gde, &sampleList));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_error_reset();
+ cpl_free(nb); nb = NULL;
+
+ /* negative distance for valid neighbors */
+ gd.neighborHood.distance = -1.;
+ cpl_test_null(nb = (neighbors ***) kmclipm_priv_find_neighbors (gd, &sampleList));
+ gd.neighborHood.distance = 0.5;
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_error_reset();
+ cpl_free(nb); nb = NULL;
+
+ /* invalid neighborhood type */
+ gd.neighborHood.type = -1;
+ cpl_test_null(nb = (neighbors ***) kmclipm_priv_find_neighbors (gd, &sampleList));
+ gd.neighborHood.type = N_CUBE;
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_error_reset();
+ cpl_free(nb); nb = NULL;
+
+ /* invalid scaling type */
+ gd.neighborHood.scale = -1;
+ cpl_test_null(nb = (neighbors ***) kmclipm_priv_find_neighbors (gd, &sampleList));
+ gd.neighborHood.scale = PIXEL;
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_error_reset();
+ cpl_free(nb); nb = NULL;
+
+ const char *info;
+ info = "one to one map";
+ cpl_msg_info("kmclipm_test_priv_find_neighbors","%s", info);
+ for (ix=0; ix<gd.x.dim; ix++) {
+ for (iy=0; iy<gd.y.dim; iy++) {
+ for (il=0; il<gd.l.dim; il++) {
+ int p = ix + iy * gd.x.dim + il * gd.x.dim * gd.y.dim;
+ sampleList.x[p] = gd.x.start + ix * gd.x.delta;
+ sampleList.y[p] = gd.y.start + iy * gd.y.delta;
+ sampleList.l[p] = gd.l.start + il * gd.l.delta;
+ sampleList.value[p] = sqrt(sampleList.x[p]*sampleList.x[p] +
+ sampleList.y[p]*sampleList.y[p] +
+ sampleList.l[p]*sampleList.l[p]);
+ }
+ }
+ }
+ gd.neighborHood.distance = 0.5;
+ gd.neighborHood.scale = PIXEL;
+ gd.neighborHood.type = N_CUBE;
+
+ /*Alex: added because valgind threw conditional jump warnings*/
+ gd.method = LINEAR_WEIGHTED_NEAREST_NEIGHBOR;
+
+ cpl_test_nonnull(nb = (neighbors ***) kmclipm_priv_find_neighbors (gd, &sampleList));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, compareAndSaveNeighborGrid("one", info, gd, nb,&sampleList));
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_priv_cleanup_neighborlist(nb, gd);
+
+ info = "second layer shifted in l-direction by 0.6, "
+ "distance=0.5 nbhType=N_CUBE distType=PIXEL";
+ cpl_msg_info("kmclipm_test_priv_find_neighbors", "%s", info);
+ for (ix=0; ix<gd.x.dim; ix++) {
+ for (iy=0; iy<gd.y.dim; iy++) {
+ for (il=0; il<gd.l.dim; il++) {
+ float ill;
+ if (il ==1) {
+ ill = 1.6;
+ } else {
+ ill = il;
+ }
+ int p = ix + iy * gd.x.dim + il * gd.x.dim * gd.y.dim;
+ sampleList.x[p] = gd.x.start + ix * gd.x.delta;
+ sampleList.y[p] = gd.y.start + iy * gd.y.delta;
+ sampleList.l[p] = gd.l.start + ill * gd.l.delta;
+ sampleList.value[p] = sqrt(sampleList.x[p]*sampleList.x[p] +
+ sampleList.y[p]*sampleList.y[p] +
+ sampleList.l[p]*sampleList.l[p]);
+ }
+ }
+ }
+ gd.neighborHood.distance = 0.5;
+ gd.neighborHood.type = N_CUBE;
+ gd.neighborHood.scale = PIXEL;
+ cpl_test_nonnull(nb = (neighbors ***) kmclipm_priv_find_neighbors (gd, &sampleList));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, compareAndSaveNeighborGrid ("two", info, gd, nb, &sampleList));
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_priv_cleanup_neighborlist(nb, gd);
+
+ info = "second layer shifted by 0.6 in l-direction and by 0.4 in "
+ "y-direction, distance=0.5 nbhType=N_CUBE distType=PIXEL";
+ cpl_msg_info("kmclipm_test_priv_find_neighbors", "%s", info);
+ for (ix=0; ix<gd.x.dim; ix++) {
+ for (iy=0; iy<gd.y.dim; iy++) {
+ for (il=0; il<gd.l.dim; il++) {
+ float ill, iyy;
+ if (il ==1) {
+ ill = 1.6;
+ iyy = iy+0.4;
+ } else {
+ ill = il;
+ iyy = iy;
+ }
+ int p = ix + iy * gd.x.dim + il * gd.x.dim * gd.y.dim;
+ sampleList.x[p] = gd.x.start + ix * gd.x.delta;
+ sampleList.y[p] = gd.y.start + iyy * gd.y.delta;
+ sampleList.l[p] = gd.l.start + ill * gd.l.delta;
+ sampleList.value[p] = sqrt(sampleList.x[p]*sampleList.x[p] +
+ sampleList.y[p]*sampleList.y[p] +
+ sampleList.l[p]*sampleList.l[p]);
+ }
+ }
+ }
+ gd.neighborHood.distance = 0.5;
+ gd.neighborHood.type = N_CUBE;
+ gd.neighborHood.scale = PIXEL;
+ cpl_test_nonnull(nb = (neighbors ***) kmclipm_priv_find_neighbors (gd, &sampleList));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, compareAndSaveNeighborGrid ("three", info, gd, nb, &sampleList));
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_priv_cleanup_neighborlist(nb, gd);
+
+ info = "second layer shifted by 0.6 in l-direction and by 0.4 in "
+ "y-direction, distance=0.5 nbhType=N_SPERE distType=PIXEL";
+ cpl_msg_info("kmclipm_test_priv_find_neighbors", "%s", info);
+ for (ix=0; ix<gd.x.dim; ix++) {
+ for (iy=0; iy<gd.y.dim; iy++) {
+ for (il=0; il<gd.l.dim; il++) {
+ float ill, iyy;
+ if (il ==1) {
+ ill = 1.6;
+ iyy = iy+0.4;
+ } else {
+ ill = il;
+ iyy = iy;
+ }
+ int p = ix + iy * gd.x.dim + il * gd.x.dim * gd.y.dim;
+ sampleList.x[p] = gd.x.start + ix * gd.x.delta;
+ sampleList.y[p] = gd.y.start + iyy * gd.y.delta;
+ sampleList.l[p] = gd.l.start + ill * gd.l.delta;
+ sampleList.value[p] = sqrt(sampleList.x[p]*sampleList.x[p] +
+ sampleList.y[p]*sampleList.y[p] +
+ sampleList.l[p]*sampleList.l[p]);
+ }
+ }
+ }
+ gd.neighborHood.distance = 0.5;
+ gd.neighborHood.type = N_SPHERE;
+ gd.neighborHood.scale = PIXEL;
+ cpl_test_nonnull(nb = (neighbors ***) kmclipm_priv_find_neighbors (gd, &sampleList));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, compareAndSaveNeighborGrid ("four", info, gd, nb, &sampleList));
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_priv_cleanup_neighborlist(nb, gd);
+
+ info = "second layer shifted by 0.6 in l-direction and by 0.4 in "
+ "y-direction, distance=0.9 nbhType=N_SPHERE distType=UNIT";
+ cpl_msg_info("kmclipm_test_priv_find_neighbors", "%s", info);
+ for (ix=0; ix<gd.x.dim; ix++) {
+ for (iy=0; iy<gd.y.dim; iy++) {
+ for (il=0; il<gd.l.dim; il++) {
+ float ill, iyy;
+ if (il ==1) {
+ ill = 1.6;
+ iyy = iy+0.4;
+ } else {
+ ill = il;
+ iyy = iy;
+ }
+ int p = ix + iy * gd.x.dim + il * gd.x.dim * gd.y.dim;
+ sampleList.x[p] = gd.x.start + ix * gd.x.delta;
+ sampleList.y[p] = gd.y.start + iyy * gd.y.delta;
+ sampleList.l[p] = gd.l.start + ill * gd.l.delta;
+ sampleList.value[p] = sqrt(sampleList.x[p]*sampleList.x[p] +
+ sampleList.y[p]*sampleList.y[p] +
+ sampleList.l[p]*sampleList.l[p]);
+ }
+ }
+ }
+ gd.neighborHood.distance = 0.9;
+ gd.neighborHood.type = N_SPHERE;
+ gd.neighborHood.scale = UNIT;
+ cpl_test_nonnull(nb = (neighbors ***) kmclipm_priv_find_neighbors (gd, &sampleList));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, compareAndSaveNeighborGrid ("five", info, gd, nb, &sampleList));
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_priv_cleanup_neighborlist(nb, gd);
+
+ info = "x-direction tiled by one pixel, "
+ "distance=0.5 nbhType=N_CUBE distType=PIXEL";
+ cpl_msg_info("kmclipm_test_priv_find_neighbors", "%s", info);
+ for (ix=0; ix<gd.x.dim; ix++) {
+ for (iy=0; iy<gd.y.dim; iy++) {
+ for (il=0; il<gd.l.dim; il++) {
+ int p = ix + iy * gd.x.dim + il * gd.x.dim * gd.y.dim;
+ sampleList.x[p] = gd.x.start + ix * gd.x.delta + (float) (iy) /
+ (float) (gd.y.dim) * gd.x.delta;
+ sampleList.y[p] = gd.y.start + iy * gd.y.delta;
+ sampleList.l[p] = gd.l.start + il * gd.l.delta;
+ sampleList.value[p] = sqrt(sampleList.x[p]*sampleList.x[p] +
+ sampleList.y[p]*sampleList.y[p] +
+ sampleList.l[p]*sampleList.l[p]);
+ }
+ }
+ }
+ gd.neighborHood.distance = 0.5;
+ gd.neighborHood.type = N_CUBE;
+ gd.neighborHood.scale = PIXEL;
+ cpl_test_nonnull(nb = (neighbors ***) kmclipm_priv_find_neighbors (gd, &sampleList));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(0, compareAndSaveNeighborGrid ("six", info, gd, nb, &sampleList));
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_priv_cleanup_neighborlist(nb, gd);
+
+ cpl_free(sampleList.x);
+ cpl_free(sampleList.y);
+ cpl_free(sampleList.l);
+ cpl_free(sampleList.value);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_priv_cleanup_neighborlist()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_priv_delete_alien_ifu_cal_data()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Executes the unit tests for all functions in the module @ref kmclipm_priv_reconstruct
+
+ @return Error code, 0 for NONE.
+*/
+int main()
+{
+ /* For DEVELOPERS:
+ * to omit all CPL_MSG_INFO output, apply following statement in the shell
+ * before executing "make check":
+ * setenv CPL_MSG_LEVEL warning
+ * (or export CPL_MSG_LEVEL=warning)
+ */
+
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", my_level);
+
+ char *my_path = cpl_sprintf("%s/test_data", ".");
+ mkdir(my_path, 0777);
+ cpl_free(my_path);
+
+ cpl_msg_set_level_from_env();
+ my_level = cpl_msg_get_level();
+
+ test_kmclipm_priv_reconstruct_nnlut_get_timestamp();
+ test_kmclipm_priv_reconstruct_nnlut_read();
+ test_kmclipm_priv_reconstruct_nnlut_write();
+ test_kmclipm_priv_reconstruct_nearestneighbor();
+ test_kmclipm_priv_reconstruct_cubicspline();
+ test_kmclipm_priv_setup_grid();
+ test_kmclipm_priv_find_neighbors();
+ test_kmclipm_priv_cleanup_neighborlist();
+ test_kmclipm_priv_delete_alien_ifu_cal_data();
+
+ cpl_msg_info("","All tests done.");
+ cpl_msg_set_level(CPL_MSG_WARNING);
+ return cpl_test_end(0);
+}
+
+/** @} */
diff --git a/kmclipm/test/kmclipm_test_priv_splines.c b/kmclipm/test/kmclipm_test_priv_splines.c
new file mode 100644
index 0000000..7088b06
--- /dev/null
+++ b/kmclipm/test/kmclipm_test_priv_splines.c
@@ -0,0 +1,266 @@
+
+/*********************************************************************
+ * E.S.O. - VLT project
+ *
+ * "@(#) $Id: kmclipm_test_priv_splines.c,v 1.7 2013-10-08 11:12:02 aagudo Exp $"
+ *
+ * Tests for functions in src/kmclipm_priv_constants.c/.h
+ *
+ * who when what
+ * -------- ---------- ----------------------------------------------
+ * aagudo 2011-09-06 created
+ */
+
+/**
+ @defgroup kmclipm_test_priv_splines Unit tests for the private functions in kmclipm_priv_splines
+
+ Unit test for the functions in the module @ref kmclipm_priv_splines
+
+ @{
+*/
+
+/*------------------------------------------------------------------------------
+ * Includes
+ *----------------------------------------------------------------------------*/
+#include <sys/stat.h>
+
+#include "kmclipm_constants.h"
+#include "kmclipm_priv_splines.h"
+#include "kmclipm_priv_error.h"
+
+cpl_msg_severity my_level= CPL_MSG_INFO;
+
+/*------------------------------------------------------------------------------
+ * Implementation
+ *----------------------------------------------------------------------------*/
+
+void test_bicubicspline_reg_reg()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_bicubicspline_reg_irreg()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_bicubicspline_reg_set()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_bicubicspline_irreg_reg()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_bicubicspline_irreg_irreg()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_bicubicspline_irreg_set()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_cubicspline_reg_reg()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_cubicspline_irreg_reg()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_cubicspline_reg_irreg()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_cubicspline_irreg_irreg()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_spline_reg_init()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_spline_irreg_init()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_spline_reg_interpolate()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_spline_irreg_interpolate()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_polynomial_irreg_reg()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_vector()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_blank_matrix()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_matrix()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_free_vector()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_free_matrix()
+{
+/*erwtest*/
+ /* invalid tests */
+
+ /* valid tests */
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Executes the unit tests for all functions in the module @ref kmclipm_priv_splines
+
+ @return Error code, 0 for NONE.
+*/
+int main()
+{
+ /* For DEVELOPERS:
+ * to omit all CPL_MSG_INFO output, apply following statement in the shell
+ * before executing "make check":
+ * setenv CPL_MSG_LEVEL warning
+ * (or export CPL_MSG_LEVEL=warning)
+ */
+
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", my_level);
+
+ char *my_path = cpl_sprintf("%s/test_data", ".");
+ mkdir(my_path, 0777);
+ cpl_free(my_path);
+
+ cpl_msg_set_level_from_env();
+ my_level = cpl_msg_get_level();
+
+ test_bicubicspline_reg_reg();
+ test_bicubicspline_reg_irreg();
+ test_bicubicspline_reg_set();
+ test_bicubicspline_irreg_reg();
+ test_bicubicspline_irreg_irreg();
+ test_bicubicspline_irreg_set();
+ test_cubicspline_reg_reg();
+ test_cubicspline_irreg_reg();
+ test_cubicspline_reg_irreg();
+ test_cubicspline_irreg_irreg();
+ test_spline_reg_init();
+ test_spline_irreg_init();
+ test_spline_reg_interpolate();
+ test_spline_irreg_interpolate();
+ test_polynomial_irreg_reg();
+ test_vector();
+ test_blank_matrix();
+ test_matrix();
+ test_free_vector();
+ test_free_matrix();
+
+ cpl_msg_info("","All tests done.");
+ cpl_msg_set_level(CPL_MSG_WARNING);
+ return cpl_test_end(0);
+}
+
+/** @} */
diff --git a/kmclipm/test/kmclipm_test_rtd.c b/kmclipm/test/kmclipm_test_rtd.c
new file mode 100644
index 0000000..483f75c
--- /dev/null
+++ b/kmclipm/test/kmclipm_test_rtd.c
@@ -0,0 +1,2660 @@
+
+/*********************************************************************
+ * E.S.O. - VLT project
+ *
+ * "@(#) $Id: kmclipm_test_rtd.c,v 1.34 2013-10-08 11:12:02 aagudo Exp $"
+ *
+ * Tests for functions in src/kmclipm_rtd_image.c/.h
+ *
+ * who when what
+ * -------- ---------- ----------------------------------------------
+ * aagudo 2007-10-19 created
+ * aagudo 2007-12-07 in generate_test_data(): the rtd_image created
+ * now uses RTD_GAP defined in
+ * kmclipm_priv_constants.h
+ * aagudo 2007-12-07 added test for kmclipm_rtd_image_from_memory()
+ * aagudo 2007-12-14 Removed a empty message-string in cpl_msg_info()-call
+ * aagudo 2007-12-17 fixed memory leak in main()
+ * aagudo 2008-01-09 fixed bugs in:
+ * kmclipm_compare(): removed KMCLIPM_xxx-Macros
+ * and used rather KMCLIPM_TRY_TESTLIB_xxx-Macros (
+ * (even when a error was produced in a function
+ * tests passed successfully)
+ * kmclipm_save_output(): same as above
+ * test_kmclipm_rtd_image(),
+ * test_kmclipm_rtd_image_from_files()
+ * test_kmclipm_rtd_image_from_memory(): same as above.
+ * additionally some tests have been added to check
+ * behavior when no sky is supplied
+ */
+
+/**
+ @defgroup kmclipm_test_rtd Tests for the RTD image functions
+
+ bla bla
+
+ @{
+*/
+
+/*------------------------------------------------------------------------------
+ * Includes
+ *----------------------------------------------------------------------------*/
+/* added this because gcc -std=C99 doesn't know M_PI **/
+/* commented out again since using CPL_MATH_PI */
+/*#define _GNU_SOURCE */
+
+#define _ISOC99_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <time.h>
+#include <math.h>
+#define __USE_XOPEN
+#include <sys/stat.h>
+#undef __USE_XOPEN
+
+#include <cpl.h>
+
+#include "kmclipm_constants.h"
+#include "kmclipm_functions.h"
+#include "kmclipm_priv_constants.h"
+#include "kmclipm_priv_functions.h"
+#include "kmclipm_priv_reconstruct.h"
+#include "kmclipm_rtd_image.h"
+#include "kmclipm_priv_error.h"
+#include "kmclipm_math.h"
+
+cpl_msg_severity my_level= CPL_MSG_INFO;
+
+/*------------------------------------------------------------------------------
+ * Prototypes
+ *----------------------------------------------------------------------------*/
+#include <stdbool.h>
+int kmclipm_testlib_parser_readline(FILE *f, char *str, int maxlength);
+void kmclipm_testlib_parser_store_parameter( cpl_parameterlist *parlist,
+ const char *name,
+ const char *description,
+ const char *context,
+ const char *value);
+cpl_propertylist *kmclipm_testlib_parser_extract_line_tokens( const char *line,
+ const char *operators,
+ const char *separators,
+ const char commentchar);
+cpl_parameterlist *kmclipm_testlib_parser_import_configfile(
+ const char *filename,
+ cpl_parameterlist *append_list);
+/*------------------------------------------------------------------------------
+ * Typedefs
+ *----------------------------------------------------------------------------*/
+
+typedef struct {
+ cpl_image *actual_img;
+ char actual_img_path[256];
+ char actual_img_type[256];
+ cpl_image *additional_img;
+ char additional_img_path[256];
+ char additional_img_type[256];
+ int *ifu_id;
+ double *nominal_pos;
+ int do_compare;
+} test_parameters_struct;
+
+test_parameters_struct test_pars;
+
+double kmclipm_dummy_main_header_alpha[] = {
+235949.663,
+ 10.677,
+ 118.650,
+ 32.047,
+ 149.485,
+ 24.458,
+ 220.278,
+ 46.486,
+ 224.378,
+ 42.524,
+ 108.768,
+ 12.372,
+235947.347,
+ 10.409,
+235926.671,
+235945.066,
+235828.354,
+235922.570,
+235724.482,
+235837.166,
+235732.130,
+ 0.304,
+235824.083,
+235926.594
+};
+
+double kmclipm_dummy_main_header_delta[] = {
+-845648.643,
+-845906.234,
+-845803.444,
+-845847.857,
+-845758.709,
+-845904.853,
+-850001.737,
+-845934.311,
+-850011.816,
+-850029.098,
+-850209.139,
+-850018.706,
+-850259.832,
+-850059.271,
+-850208.302,
+-850050.872,
+-850039.122,
+-850026.384,
+-845947.845,
+-845936.460,
+-845849.366,
+-845943.954,
+-845709.717,
+-845807.650
+};
+
+const char* kmclipm_dummy_main_header_name[] = {
+"FDF_050",
+"FDF_070",
+"FDF_051",
+"FDF_081",
+"SKY",
+"FDF_079",
+"SKY",
+"SKY",
+"FDF_080",
+"SKY",
+"SKY",
+"SKY",
+"FDF_086",
+"FDF_066",
+"FDF_069",
+"SKY",
+"SKY",
+"SKY",
+"SKY",
+"SKY",
+"SKY",
+"FDF_067",
+"SKY",
+"SKY"
+};
+
+/*------------------------------------------------------------------------------
+ * Implementation
+ *----------------------------------------------------------------------------*/
+const char *patrol_path = "patrol.fits";
+const char *patrol_path_from_files = "patrol_from_files.fits";
+const char *patrol_path_from_memory = "patrol_from_memory.fits";
+
+/* object declarations */
+int xpos[] = { 5, 11, 6, 6, 9, 4, 10, 12,
+ 9, 11, 1, 14, 14, 1, 6, 6,
+ 0, 7, 7, 7, 7, 7, 7, 7};
+int ypos[] = { 7, 10, 12, 5, 9, 6, 6, 6,
+ 3, 8, 1, 1, 14, 14, 4, 12,
+ 0, 7, 7, 7, 7, 7, 7, 7};
+int ifu_id[] = { -1,
+ 1, 1, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 1, 1, 1, 1, 1, 1};
+double fwhm[] = { 1.5, 3.0, 2.1, 1.7, 4.5, 3.1, 3.8, 2.7,
+ 4.2, 3.3, 4.0, 4.0, 4.0, 4.0, 2.2, 1.9,
+ 0.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
+double intensity[] = { 3.2, 5.1, 2.1, 3.8, 4.0, 3.3, 4.8, 5.5,
+ 9.5, 6.7, 6.0, 6.0, 6.0, 6.0, 3.9, 2.6,
+ 0.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
+
+int xpos_only[] = { 5, 11, 6, 6, 9, 4, 10, 12,
+ 9, 11, 1, 14, 14, 1, 6, 6,
+ 4, 7, 7, 7, 7, 7, 7, 7};
+int ypos_only[] = { 7, 10, 12, 5, 9, 6, 6, 6,
+ 3, 8, 1, 1, 14, 14, 4, 12,
+ 6, 7, 7, 7, 7, 7, 7, 7};
+double fwhm_only[] = { 1.5, 3.0, 2.1, 1.7, 4.5, 3.1, 3.8, 2.7,
+ 4.2, 3.3, 4.0, 4.0, 4.0, 4.0, 2.2, 1.9,
+ 3.3, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
+double intensity_only[] = { 3.2, 5.1, 2.1, 3.8, 4.0, 3.3, 4.8, 5.5,
+ 9.5, 6.7, 6.0, 6.0, 6.0, 6.0, 3.9, 2.6,
+ 10.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
+
+double intens_ref[] = { 0.0122754, 0.0193456, 0.00801426, 0.0145585, 0.0152263, 0.0125688, 0.0182948, 0.0209837,
+ 0.0360134, 0.0256257, 0.0228489, 0.0229544, 0.0227857, 0.0229012, 0.0149248, 0.00990087,
+ -1.0, 0.00763412, 0.0115145, 0.0152128, 0.0190575, 0.0229563, 0.0267898, 0.0311127};
+double fwhm_ref[] = { 3.52855, 7.06723, 4.9216, 3.99265, 10.5663, 7.33791, 8.94785, 6.35848,
+ 9.89771, 7.78545, 9.4583, 9.48691, 9.40454, 9.38746, 5.18129, 4.48112,
+ -1.0, 4.70195, 7.075, 9.3954, 11.8012, 14.1568, 16.5716, 18};
+/* test
+int xpos[] = { 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3};
+
+int ypos[] = { 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14};
+
+int ifu_id[] = { -1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1};
+
+double fwhm[] = { 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0,
+ 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0,
+ 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0};
+
+double intensity[] = { 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,
+ 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,
+ 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0};
+*/
+
+/**
+ @brief Flips or rotates images in a way as IFUs appear on detectors.
+
+ @param img The image to turn or rotate.
+ @param ifu The IFU number.
+*/
+void flip_rotate_image_forth(cpl_image *img, int ifu)
+{
+ if ((ifu+1 >= 1) && (ifu+1 <= 4)) {
+ /* 1,2,3,4 */
+ cpl_image_turn(img, -1);
+ } else if ((ifu+1 >= 5) && (ifu+1 <= 8)) {
+ /* 5,6,7,8, */
+ cpl_image_turn(img, 1);
+ } else if ((ifu+1 >= 9) && (ifu+1 <= 12)) {
+ /* 9,10,11,12 */
+ cpl_image_turn(img, 1);
+ } else if ((ifu+1 >= 13) && (ifu+1 <= 16)) {
+ /* 13,14,15,16 */
+ cpl_image_turn(img, -1);
+ } else if ((ifu+1 >= 17) && (ifu+1 <= 20)) {
+ /* 17,18,19,20 */
+ /* flip horizontal */
+ } else if ((ifu+1 >= 21) && (ifu+1 <= 24)) {
+ /* 21,22,23,24 */
+ /* flip horizontal */
+ cpl_image_flip(img, 1);
+ cpl_image_flip(img, 3);
+ }
+}
+
+/**
+ @brief Flips or rotates images back in a way as IFUs appear on detectors.
+
+ @param img The image to turn or rotate.
+ @param ifu The IFU number.
+*/
+void flip_rotate_image_back(cpl_image *img, int ifu)
+{
+ if ((ifu+1 >= 1) && (ifu+1 <= 4)) {
+ /* 1,2,3,4 */
+ cpl_image_turn(img, 1);
+ } else if ((ifu+1 >= 5) && (ifu+1 <= 8)) {
+ /* 5,6,7,8, */
+ cpl_image_turn(img, -1);
+ } else if ((ifu+1 >= 9) && (ifu+1 <= 12)) {
+ /* 9,10,11,12 */
+ cpl_image_turn(img, -1);
+ } else if ((ifu+1 >= 13) && (ifu+1 <= 16)) {
+ /* 13,14,15,16 */
+ cpl_image_turn(img, 1);
+ } else if ((ifu+1 >= 17) && (ifu+1 <= 20)) {
+ /* 17,18,19,20 */
+ /* flip horizontal */
+ } else if ((ifu+1 >= 21) && (ifu+1 <= 24)) {
+ /* 21,22,23,24 */
+ /* flip horizontal */
+ cpl_image_flip(img, 3);
+ cpl_image_flip(img, 1);
+ }
+}
+
+/**
+ @brief Generates test data.
+ @param save_cubes bla.
+ @param save_image_cubes bla.
+ @return CPL_ERROR_NONE or the relevant _cpl_error_code_ on error.
+
+ bla.
+*/
+cpl_error_code generate_test_data(int save_cubes, int save_image_cubes)
+{
+ char *raw_obj_path = cpl_sprintf("%s/test_data/raw_image_obj.fits", ".");
+ char *raw_sky_path = cpl_sprintf("%s/test_data/raw_image_sky.fits", ".");
+ char *raw_obj_only_path = cpl_sprintf("%s/test_data/raw_image_obj_only.fits", ".");
+ char *raw_sky_only_path = cpl_sprintf("%s/test_data/raw_image_sky_only.fits", ".");
+ char *lcal_path = cpl_sprintf("%s/test_data/lcal_KKK.fits", ".");
+ char *xcal_path = cpl_sprintf("%s/test_data/xcal_KKK.fits", ".");
+ char *ycal_path = cpl_sprintf("%s/test_data/ycal_KKK.fits", ".");
+ char *wave_path = cpl_sprintf("%s/test_data/kmos_wave_band.fits", ".");
+ char *badpix_path = cpl_sprintf("%s/test_data/badpix.fits", ".");
+
+ char *raw_obj_pathH = cpl_sprintf("%s/test_data/raw_image_objH.fits", ".");
+ char *raw_sky_pathH = cpl_sprintf("%s/test_data/raw_image_skyH.fits", ".");
+ char *lcal_pathH = cpl_sprintf("%s/test_data/lcal_HHH.fits", ".");
+ char *xcal_pathH = cpl_sprintf("%s/test_data/xcal_HHH.fits", ".");
+ char *ycal_pathH = cpl_sprintf("%s/test_data/ycal_HHH.fits", ".");
+
+ char *lcal_pathTest = cpl_sprintf("%s/test_data/test/lcal_test.fits", ".");
+ char *xcal_pathTest = cpl_sprintf("%s/test_data/test/xcal_test.fits", ".");
+ char *ycal_pathTest = cpl_sprintf("%s/test_data/test/ycal_test.fits", ".");
+ char *wave_pathTest = cpl_sprintf("%s/test_data/test/kmos_wave_band.fits", ".");
+
+/*----------------- Declarations ----------------------------*/
+ const char *suffix = ".fits";
+
+ char *tmp_name = NULL,
+ *tmp_comment = NULL;
+
+ int ifu = 0,
+ d = 0,
+ x = 0,
+ y = 0,
+ x_only = 0,
+ y_only = 0,
+ i = 0,
+ j = 0,
+ start = 0,
+ offset = 0,
+ readnoise = 5,
+ i_raw = 0,
+ i_img = 0,
+ start_offset = 2,
+ inter_slitlet_offset = 4;
+
+ double scaling_factor = 14.0 / 5500.0,
+ median = 0.;
+
+ float *praw_image_obj = NULL,
+ *praw_image_obj_only = NULL,
+ *pimage_obj = NULL,
+ *pimage_obj_only = NULL,
+ *praw_image_sky = NULL,
+ *praw_image_sky_only = NULL,
+ *pimage_sky = NULL,
+ *pimage_sky_only = NULL,
+ *plcal_img = NULL,
+ *plcal_imgH = NULL,
+ *pxcal_img = NULL,
+ *pycal_img = NULL,
+ *pbadpix_img = NULL,
+ val_ref_rtd = 0.0,
+ val_ref_rtd_target = 0.0,
+ val_ref_rtd_sky = 0.0,
+ out_val_ref_rtd = 0.0,
+ out_val_ref_rtd_target = 0.0,
+ out_val_ref_rtd_sky = 0.0,
+ lcal_start = 1.927,
+ lcal_end = 2.47,
+ lcal_offset = 0.0,
+ lcal_val = 0.0,
+ lcal_startH = 1.43,
+ lcal_endH = 1.89,
+ lcal_offsetH = 0.0,
+ lcal_valH = 0.0,
+ cal_tmp = 0.0;
+
+ cpl_image *gauss_image = NULL,
+ *image_obj = NULL,
+ *image_obj_only = NULL,
+ *rtd_image_obj = NULL,
+ *raw_image_obj = NULL,
+ *raw_image_obj_only = NULL,
+ *lcal_img = NULL,
+ *lcal_imgH = NULL,
+ *xcal_img = NULL,
+ *ycal_img = NULL,
+ *badpix_img = NULL,
+ **image_cube_vector_obj = NULL,
+ **image_cube_vector_obj_only = NULL,
+ *image_sky = NULL,
+ *image_sky_only = NULL,
+ *rtd_image = NULL,
+ *rtd_image_sky = NULL,
+ *raw_image_sky = NULL,
+ *raw_image_sky_only = NULL,
+ **image_cube_vector_sky = NULL,
+ **image_cube_vector_sky_only = NULL,
+ *nan_image = NULL,
+ *tmp_img = NULL;
+
+ cpl_imagelist **cube_vector_obj = NULL,
+ **cube_vector_sky = NULL,
+ **cube_vector_obj_only = NULL,
+ **cube_vector_sky_only = NULL;
+
+ cpl_propertylist *main_header = NULL,
+ *main_headerH = NULL,
+ *main_header_only = NULL,
+ *sub_header = NULL;
+ cpl_table *tbl = NULL;
+
+ cpl_test_nonnull(gauss_image = cpl_image_new(KMOS_SLITLET_X,
+ KMOS_SLITLET_Y,
+ CPL_TYPE_FLOAT));
+
+
+ char *my_path = cpl_sprintf("mkdir -p %s/test_data/test/", ".");
+ system(my_path);
+ cpl_free(my_path);
+
+ /* generate image with nan all over */
+ cpl_test_nonnull(nan_image = cpl_image_new(KMOS_SLITLET_X,
+ KMOS_SLITLET_Y,
+ CPL_TYPE_FLOAT));
+
+ cpl_image_fill_gaussian(nan_image, 0.0, 0.0, 0.0, 0.0, 0.0);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_msg_info("RTD generate", "Test data is being generated.\n");
+
+/* ****************************************************************************
+ * Generate targets & sky
+ * ************************************************************************** */
+ /*----------------- generate cubes ----------------------------*/
+ cpl_test_nonnull(cube_vector_obj =
+ cpl_malloc(KMOS_NR_IFUS * sizeof(cpl_imagelist *)));
+ cpl_test_nonnull(cube_vector_sky =
+ cpl_malloc(KMOS_NR_IFUS * sizeof(cpl_imagelist *)));
+ cpl_test_nonnull(cube_vector_obj_only =
+ cpl_malloc(KMOS_NR_IFUS * sizeof(cpl_imagelist *)));
+ cpl_test_nonnull(cube_vector_sky_only =
+ cpl_malloc(KMOS_NR_IFUS * sizeof(cpl_imagelist *)));
+
+ for (ifu = 0; ifu < KMOS_NR_IFUS; ifu++) {
+ cpl_test_nonnull(cube_vector_obj[ifu] = cpl_imagelist_new());
+ cpl_test_nonnull(cube_vector_sky[ifu] = cpl_imagelist_new());
+ cpl_test_nonnull(cube_vector_obj_only[ifu] = cpl_imagelist_new());
+ cpl_test_nonnull(cube_vector_sky_only[ifu] = cpl_imagelist_new());
+
+ x = xpos[ifu];
+ y = ypos[ifu];
+ x_only = xpos_only[ifu];
+ y_only = ypos_only[ifu];
+
+ /* change coordinates, since all IFUs are orientated differently */
+ for (d = 0; d < KMOS_DETECTOR_SIZE; d++) {
+ if (ifu_id[ifu + 1] == 0) {
+ cpl_test_nonnull(image_obj = cpl_image_duplicate(nan_image));
+ cpl_test_nonnull(image_sky = cpl_image_duplicate(nan_image));
+ } else {
+ cpl_test_nonnull(image_obj = cpl_image_new(KMOS_SLITLET_X,
+ KMOS_SLITLET_Y,
+ CPL_TYPE_FLOAT));
+ cpl_test_nonnull(image_sky = cpl_image_new(KMOS_SLITLET_X,
+ KMOS_SLITLET_Y,
+ CPL_TYPE_FLOAT));
+ /* add in background */
+ cpl_image_fill_noise_uniform(image_obj, 0, readnoise);
+ cpl_image_fill_noise_uniform(image_sky, 0, readnoise);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* generate gauss for targets*/
+ cpl_image_fill_gaussian(gauss_image, x, y,
+ 2*CPL_MATH_PI*fwhm[ifu]*fwhm[ifu],
+ fwhm[ifu], fwhm[ifu]);
+
+ cpl_image_multiply_scalar(gauss_image,
+ (1 + (((double)rand())/RAND_MAX))
+ * intensity[ifu]);
+ cpl_image_add(image_obj, gauss_image);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* scale to Intensities as in Ric's IDL-code
+ * (a factor of about 14/5500) */
+ cpl_image_multiply_scalar(image_obj, scaling_factor);
+ cpl_image_multiply_scalar(image_sky, scaling_factor);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* switch target and sky if demanded */
+ if (ifu_id[ifu + 1] == 2) {
+ tmp_img = image_obj;
+ image_obj = image_sky;
+ image_sky = tmp_img;
+ }
+ }
+
+ cpl_imagelist_set(cube_vector_obj[ifu], image_obj, d);
+ cpl_imagelist_set(cube_vector_sky[ifu], image_sky, d);
+
+ /*
+ * the same as above for raw_image_obj_only and raw_image_sky_only
+ *
+ */
+ cpl_test_nonnull(image_obj_only = cpl_image_new(KMOS_SLITLET_X,
+ KMOS_SLITLET_Y,
+ CPL_TYPE_FLOAT));
+ cpl_test_nonnull(image_sky_only = cpl_image_new(KMOS_SLITLET_X,
+ KMOS_SLITLET_Y,
+ CPL_TYPE_FLOAT));
+ cpl_image_fill_noise_uniform(image_obj_only, 0, readnoise);
+ cpl_image_fill_noise_uniform(image_sky_only, 0, readnoise);
+ cpl_image_fill_gaussian(gauss_image, x_only, y_only,
+ 2*CPL_MATH_PI*fwhm_only[ifu]*fwhm_only[ifu],
+ fwhm_only[ifu], fwhm_only[ifu]);
+
+ cpl_image_multiply_scalar(gauss_image,
+ (1 + (((double)rand())/RAND_MAX))
+ * intensity_only[ifu]);
+ cpl_image_add(image_obj_only, gauss_image);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_image_multiply_scalar(image_obj_only, scaling_factor);
+ cpl_image_multiply_scalar(image_sky_only, scaling_factor);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_imagelist_set(cube_vector_obj_only[ifu], image_obj_only, d);
+ cpl_imagelist_set(cube_vector_sky_only[ifu], image_sky_only, d);
+ }
+
+ /* optional: save intermediate cubes to disk */
+ if (save_cubes) {
+ if (ifu == 0) {
+ cpl_msg_info("RTD generate",
+ "Saving the cubes takes a while... Go get a coffee.\n");
+ }
+
+ tmp_name = cpl_sprintf("%s%s%d%s",
+ kmclipm_priv_get_output_path(),
+ "ref_cube_obj", ifu + 1, suffix);
+ cpl_msg_info("RTD generate", "Saving %s\n", tmp_name);
+ cpl_imagelist_save(cube_vector_obj[ifu], tmp_name,
+ CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ tmp_name = cpl_sprintf("%s%s%d%s",
+ kmclipm_priv_get_output_path(),
+ "ref_cube_sky", ifu + 1, suffix);
+ cpl_msg_info("RTD generate", "Saving %s\n", tmp_name);
+ cpl_imagelist_save(cube_vector_sky[ifu], tmp_name,
+ CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+ }
+ }
+
+ cpl_image_delete(nan_image); nan_image = NULL;
+
+ /*----------------- generate images of cubes -------------------------*/
+ cpl_test_nonnull(image_cube_vector_obj =
+ cpl_malloc(KMOS_NR_IFUS * sizeof(cpl_image *)));
+ cpl_test_nonnull(image_cube_vector_sky =
+ cpl_malloc(KMOS_NR_IFUS * sizeof(cpl_image *)));
+ cpl_test_nonnull(image_cube_vector_obj_only =
+ cpl_malloc(KMOS_NR_IFUS * sizeof(cpl_image *)));
+ cpl_test_nonnull(image_cube_vector_sky_only =
+ cpl_malloc(KMOS_NR_IFUS * sizeof(cpl_image *)));
+
+ for (ifu = 0; ifu < KMOS_NR_IFUS; ifu++) {
+ kmclipm_make_image(cube_vector_obj[ifu], NULL,
+ &image_cube_vector_obj[ifu], NULL,
+ NULL, "average", -1, -1, -1, -1, -1);
+
+ kmclipm_make_image(cube_vector_sky[ifu], NULL,
+ &image_cube_vector_sky[ifu], NULL,
+ NULL, "average",
+ -1, -1, -1, -1, -1);
+ kmclipm_make_image(cube_vector_obj_only[ifu], NULL,
+ &image_cube_vector_obj_only[ifu], NULL,
+ NULL, "average", -1, -1, -1, -1, -1);
+
+ kmclipm_make_image(cube_vector_sky_only[ifu], NULL,
+ &image_cube_vector_sky_only[ifu], NULL,
+ NULL, "average",
+ -1, -1, -1, -1, -1);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* optional: save images of intermediate cubes to disk */
+ if (save_image_cubes) {
+ tmp_name = cpl_sprintf("%s%s%d%s",
+ kmclipm_priv_get_output_path(),
+ "ref_image_cube_obj", ifu + 1, suffix);
+ cpl_msg_info("RTD generate", "Saving %s\n", tmp_name);
+ cpl_image_save(image_cube_vector_obj[ifu], tmp_name,
+ CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ tmp_name = cpl_sprintf("%s%s%d%s",
+ kmclipm_priv_get_output_path(),
+ "ref_image_cube_sky", ifu + 1, suffix);
+ cpl_msg_info("RTD generate", "Saving %s\n", tmp_name);
+ cpl_image_save(image_cube_vector_sky[ifu], tmp_name,
+ CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+ }
+ }
+
+ /*----------------- generate raw image ----------------------------*/
+ tbl = cpl_table_new(2);
+ cpl_table_new_column(tbl, "H", CPL_TYPE_FLOAT);
+ cpl_table_set_float(tbl, "H", 0, 1.431);
+ cpl_table_set_float(tbl, "H", 1, 1.856);
+ cpl_table_new_column(tbl, "HK", CPL_TYPE_FLOAT);
+ cpl_table_set_float(tbl, "HK", 0, 1.454);
+ cpl_table_set_float(tbl, "HK", 1, 2.455);
+ cpl_table_new_column(tbl, "IZ", CPL_TYPE_FLOAT);
+ cpl_table_set_float(tbl, "IZ", 0, 0.76);
+ cpl_table_set_float(tbl, "IZ", 1, 1.12);
+ cpl_table_new_column(tbl, "K", CPL_TYPE_FLOAT);
+ cpl_table_set_float(tbl, "K", 0, 1.956);
+ cpl_table_set_float(tbl, "K", 1, 2.511);
+ cpl_table_new_column(tbl, "YJ", CPL_TYPE_FLOAT);
+ cpl_table_set_float(tbl, "YJ", 0, 1.000);
+ cpl_table_set_float(tbl, "YJ", 1, 1.356);
+ cpl_propertylist *mpl = cpl_propertylist_new();
+ kmclipm_update_property_string(mpl, "ESO PRO CATG", "WAVE_BAND",
+ "Category of pipeline product frame");
+ cpl_propertylist *subpl = cpl_propertylist_new();
+ kmclipm_update_property_string(subpl, "EXTNAME", "LIST", "");
+ cpl_table_save(tbl, mpl, subpl, wave_path, CPL_IO_CREATE);
+ cpl_table_save(tbl, mpl, subpl, wave_pathTest, CPL_IO_CREATE);
+ cpl_propertylist_delete(mpl); mpl = NULL;
+ cpl_propertylist_delete(subpl); subpl = NULL;
+ cpl_table_delete(tbl); tbl = NULL;
+
+ cpl_test_nonnull(raw_image_obj =
+ cpl_image_new(KMOS_DETECTOR_SIZE, KMOS_DETECTOR_SIZE,
+ CPL_TYPE_FLOAT));
+ cpl_test_nonnull(raw_image_sky =
+ cpl_image_new(KMOS_DETECTOR_SIZE, KMOS_DETECTOR_SIZE,
+ CPL_TYPE_FLOAT));
+ cpl_test_nonnull(raw_image_obj_only =
+ cpl_image_new(KMOS_DETECTOR_SIZE, KMOS_DETECTOR_SIZE,
+ CPL_TYPE_FLOAT));
+ cpl_test_nonnull(raw_image_sky_only =
+ cpl_image_new(KMOS_DETECTOR_SIZE, KMOS_DETECTOR_SIZE,
+ CPL_TYPE_FLOAT));
+ cpl_test_nonnull(lcal_img =
+ cpl_image_new(KMOS_DETECTOR_SIZE, KMOS_DETECTOR_SIZE,
+ CPL_TYPE_FLOAT));
+ cpl_test_nonnull(lcal_imgH =
+ cpl_image_new(KMOS_DETECTOR_SIZE, KMOS_DETECTOR_SIZE,
+ CPL_TYPE_FLOAT));
+ cpl_test_nonnull(xcal_img =
+ cpl_image_new(KMOS_DETECTOR_SIZE, KMOS_DETECTOR_SIZE,
+ CPL_TYPE_FLOAT));
+ cpl_test_nonnull(ycal_img =
+ cpl_image_new(KMOS_DETECTOR_SIZE, KMOS_DETECTOR_SIZE,
+ CPL_TYPE_FLOAT));
+ cpl_test_nonnull(badpix_img =
+ cpl_image_new(KMOS_DETECTOR_SIZE, KMOS_DETECTOR_SIZE,
+ CPL_TYPE_FLOAT));
+
+ cpl_test_nonnull(praw_image_obj = cpl_image_get_data_float(raw_image_obj));
+ cpl_test_nonnull(praw_image_sky = cpl_image_get_data_float(raw_image_sky));
+ cpl_test_nonnull(praw_image_obj_only = cpl_image_get_data_float(raw_image_obj_only));
+ cpl_test_nonnull(praw_image_sky_only = cpl_image_get_data_float(raw_image_sky_only));
+ cpl_test_nonnull(plcal_img = cpl_image_get_data_float(lcal_img));
+ cpl_test_nonnull(plcal_imgH = cpl_image_get_data_float(lcal_imgH));
+ cpl_test_nonnull(pxcal_img = cpl_image_get_data_float(xcal_img));
+ cpl_test_nonnull(pycal_img = cpl_image_get_data_float(ycal_img));
+ cpl_test_nonnull(pbadpix_img = cpl_image_get_data_float(badpix_img));
+
+ cpl_image_fill_noise_uniform(raw_image_obj, -0.000001, 0.000001);
+ cpl_image_fill_noise_uniform(raw_image_sky, -0.000001, 0.000001);
+ cpl_image_fill_noise_uniform(raw_image_obj_only, -0.000001, 0.000001);
+ cpl_image_fill_noise_uniform(raw_image_sky_only, -0.000001, 0.000001);
+
+ /* fill calibration-images by default with NaN's */
+ float nan_val = NAN;
+ for (i = 0; i < cpl_image_get_size_x(xcal_img)*cpl_image_get_size_y(xcal_img); i++) {
+ pxcal_img[i] = nan_val;
+ pycal_img[i] = nan_val;
+ plcal_img[i] = nan_val;
+ plcal_imgH[i] = nan_val;
+ }
+
+ /* saving main header and no data */
+ cpl_msg_info("RTD generate", "Saving raw object & sky files and "
+ "calibration frames (badpix, xcal, ycal & lcal).\n");
+
+ cpl_test_nonnull(main_header = cpl_propertylist_new());
+
+ /* add general keywords */
+ kmclipm_update_property_string(main_header, "ESO INS FILT1 ID",
+ "K", "Filter unique id.");
+ kmclipm_update_property_string(main_header, "ESO INS FILT2 ID",
+ "K", "Filter unique id.");
+ kmclipm_update_property_string(main_header, "ESO INS FILT3 ID",
+ "K", "Filter unique id.");
+ kmclipm_update_property_string(main_header, "ESO INS GRAT1 ID",
+ "K", "Grating unique id.");
+ kmclipm_update_property_string(main_header, "ESO INS GRAT2 ID",
+ "K", "Grating unique id.");
+ kmclipm_update_property_string(main_header, "ESO INS GRAT3 ID",
+ "K", "Grating unique id.");
+ kmclipm_update_property_double(main_header,"ESO OCS ROT NAANGLE",
+ 0., "");
+ kmclipm_update_property_int(main_header, OBS_ID, -1,
+ "Observation block ID");
+ kmclipm_update_property_string(main_header, READMODE, "Nondest",
+ "Used readout mode name");
+ kmclipm_update_property_int(main_header, NDSAMPLES, 3,
+ "nr. samples");
+ cpl_test_error(CPL_ERROR_NONE);
+
+ for (i = 1; i <= KMOS_NR_IFUS; i++) {
+ if (ifu_id[i] == 0) {
+ /* if IFU is inactive mark is as such */
+ tmp_name = cpl_sprintf("%s%d%s", IFU_VALID_PREFIX, i, IFU_VALID_POSTFIX);
+ kmclipm_update_property_string(main_header, tmp_name,
+ "kmclipm_test_rtd disabled this IFU", "");
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+ } else {
+ /* if IFU is active, add alpha & delta*/
+ tmp_name = cpl_sprintf("%s%d%s", IFU_ALPHA_PREFIX, i, IFU_ALPHA_POSTFIX);
+ tmp_comment = cpl_sprintf("%s", "DUMMY: alpha hosted by arm i [HHMMSS.SSS]");
+ kmclipm_update_property_double(main_header, tmp_name,
+ kmclipm_dummy_main_header_alpha[i-1],
+ tmp_comment);
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_free(tmp_comment); tmp_comment = NULL;
+
+ tmp_name = cpl_sprintf("%s%d%s", IFU_DELTA_PREFIX, i, IFU_DELTA_POSTFIX);
+ tmp_comment = cpl_sprintf("%s", "DUMMY: delta hosted by arm i [DDMMSS.SSS]");
+ kmclipm_update_property_double(main_header, tmp_name,
+ kmclipm_dummy_main_header_delta[i-1],
+ tmp_comment);
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_free(tmp_comment); tmp_comment = NULL;
+
+ tmp_name = cpl_sprintf("%s%d%s", IFU_NAME_PREFIX, i, IFU_NAME_POSTFIX);
+ tmp_comment = cpl_sprintf("%s", "DUMMY: name hosted by arm i");
+ kmclipm_update_property_string(main_header, tmp_name,
+ kmclipm_dummy_main_header_name[i-1],
+ tmp_comment);
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_free(tmp_comment); tmp_comment = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+ }
+ }
+
+ cpl_test_nonnull(main_header_only = cpl_propertylist_duplicate(main_header));
+ for (i = 1; i <= KMOS_NR_IFUS; i++) {
+ /* if IFU is active, add alpha & delta*/
+ tmp_name = cpl_sprintf("%s%d%s", IFU_ALPHA_PREFIX, i, IFU_ALPHA_POSTFIX);
+ tmp_comment = cpl_sprintf("%s", "DUMMY: alpha hosted by arm i [HHMMSS.SSS]");
+ kmclipm_update_property_double(main_header_only, tmp_name,
+ kmclipm_dummy_main_header_alpha[i-1],
+ tmp_comment);
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_free(tmp_comment); tmp_comment = NULL;
+
+ tmp_name = cpl_sprintf("%s%d%s", IFU_DELTA_PREFIX, i, IFU_DELTA_POSTFIX);
+ tmp_comment = cpl_sprintf("%s", "DUMMY: delta hosted by arm i [DDMMSS.SSS]");
+ kmclipm_update_property_double(main_header_only, tmp_name,
+ kmclipm_dummy_main_header_delta[i-1],
+ tmp_comment);
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_free(tmp_comment); tmp_comment = NULL;
+
+ tmp_name = cpl_sprintf("%s%d%s", IFU_NAME_PREFIX, i, IFU_NAME_POSTFIX);
+ tmp_comment = cpl_sprintf("%s", "DUMMY: name hosted by arm i");
+ kmclipm_update_property_string(main_header_only, tmp_name,
+ kmclipm_dummy_main_header_name[i-1],
+ tmp_comment);
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_free(tmp_comment); tmp_comment = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+ }
+
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_propertylist_save(main_header, raw_obj_path, CPL_IO_CREATE);
+ cpl_propertylist_save(main_header_only, raw_obj_only_path, CPL_IO_CREATE);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_propertylist_save(main_header, raw_sky_path, CPL_IO_CREATE);
+ cpl_propertylist_save(main_header_only, raw_sky_only_path, CPL_IO_CREATE);
+ cpl_propertylist_delete(main_header_only); main_header_only = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_propertylist_update_string(main_header, CPL_DFS_PRO_CATG, "LCAL");
+ cpl_propertylist_save(main_header, lcal_path, CPL_IO_CREATE);
+ cpl_propertylist_save(main_header, lcal_pathTest, CPL_IO_CREATE);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_propertylist_update_string(main_header, CPL_DFS_PRO_CATG, "YCAL");
+ cpl_propertylist_save(main_header, ycal_path, CPL_IO_CREATE);
+ cpl_propertylist_save(main_header, ycal_pathTest, CPL_IO_CREATE);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_propertylist_update_string(main_header, CPL_DFS_PRO_CATG, "BADPIXEL");
+
+ cpl_propertylist_save(main_header, badpix_path, CPL_IO_CREATE);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_test_error(CPL_ERROR_NONE);
+ main_headerH = cpl_propertylist_duplicate(main_header);
+ kmclipm_update_property_string(main_headerH, "ESO INS FILT1 ID",
+ "H", "Filter unique id.");
+ kmclipm_update_property_string(main_headerH, "ESO INS FILT2 ID",
+ "H", "Filter unique id.");
+ kmclipm_update_property_string(main_headerH, "ESO INS FILT3 ID",
+ "H", "Filter unique id.");
+ kmclipm_update_property_string(main_headerH, "ESO INS GRAT1 ID",
+ "H", "Grating unique id.");
+ kmclipm_update_property_string(main_headerH, "ESO INS GRAT2 ID",
+ "H", "Grating unique id.");
+ kmclipm_update_property_string(main_headerH, "ESO INS GRAT3 ID",
+ "H", "Grating unique id.");
+ kmclipm_update_property_double(main_headerH,"ESO OCS ROT NAANGLE",
+ 60., "");
+ cpl_propertylist_save(main_headerH, raw_obj_pathH, CPL_IO_CREATE);
+ cpl_propertylist_save(main_headerH, raw_sky_pathH, CPL_IO_CREATE);
+ cpl_propertylist_update_string(main_headerH, CPL_DFS_PRO_CATG, "LCAL");
+ cpl_propertylist_save(main_headerH, lcal_pathH, CPL_IO_CREATE);
+ cpl_propertylist_update_string(main_headerH, CPL_DFS_PRO_CATG, "YCAL");
+ cpl_propertylist_save(main_headerH, ycal_pathH, CPL_IO_CREATE);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_update_property_int(main_header, "ESO PRO BOUND IFU1_L", 1, "");
+ kmclipm_update_property_int(main_header, "ESO PRO BOUND IFU1_R", 252, "");
+ kmclipm_update_property_int(main_header, "ESO PRO BOUND IFU2_L", 253, "");
+ kmclipm_update_property_int(main_header, "ESO PRO BOUND IFU2_R", 504, "");
+ kmclipm_update_property_int(main_header, "ESO PRO BOUND IFU3_L", 505, "");
+ kmclipm_update_property_int(main_header, "ESO PRO BOUND IFU3_R", 756, "");
+ kmclipm_update_property_int(main_header, "ESO PRO BOUND IFU4_L", 757, "");
+ kmclipm_update_property_int(main_header, "ESO PRO BOUND IFU4_R", 1008, "");
+ kmclipm_update_property_int(main_header, "ESO PRO BOUND IFU5_L", 1009, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU5_R", 1260, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU6_L", 1261, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU6_R", 1512, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU7_L", 1513, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU7_R", 1764, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU8_L", 1765, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU8_R", 2016, "");
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU9_L", 1, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU9_R", 252, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU10_L", 253, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU10_R", 504, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU11_L", 505, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU11_R", 756, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU12_L", 757, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU12_R", 1008, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU13_L", 1009, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU13_R", 1260, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU14_L", 1261, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU14_R", 1512, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU15_L", 1513, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU15_R", 1764, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU16_L", 1765, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU16_R", 2016, "");
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU17_L", 1, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU17_R", 252, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU18_L", 253, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU18_R", 504, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU19_L", 505, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU19_R", 756, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU20_L", 757, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU20_R", 1008, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU21_L", 1009, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU21_R", 1260, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU22_L", 1261, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU22_R", 1512, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU23_L", 1513, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU23_R", 1764, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU24_L", 1765, "");
+ kmclipm_update_property_int(main_header,"ESO PRO BOUND IFU24_R", 2016, "");
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_propertylist_update_string(main_header, CPL_DFS_PRO_CATG, "XCAL");
+ cpl_propertylist_save(main_header, xcal_path, CPL_IO_CREATE);
+ cpl_propertylist_save(main_header, xcal_pathTest, CPL_IO_CREATE);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_propertylist_delete(main_headerH); main_headerH = NULL;
+ main_headerH = cpl_propertylist_duplicate(main_header);
+ kmclipm_update_property_string(main_headerH, "ESO INS FILT1 ID",
+ "H", "Filter unique id.");
+ kmclipm_update_property_string(main_headerH, "ESO INS FILT2 ID",
+ "H", "Filter unique id.");
+ kmclipm_update_property_string(main_headerH, "ESO INS FILT3 ID",
+ "H", "Filter unique id.");
+ kmclipm_update_property_string(main_headerH, "ESO INS GRAT1 ID",
+ "H", "Grating unique id.");
+ kmclipm_update_property_string(main_headerH, "ESO INS GRAT2 ID",
+ "H", "Grating unique id.");
+ kmclipm_update_property_string(main_headerH, "ESO INS GRAT3 ID",
+ "H", "Grating unique id.");
+ kmclipm_update_property_double(main_headerH,"ESO OCS ROT NAANGLE",
+ 60., "");
+ cpl_propertylist_update_string(main_headerH, CPL_DFS_PRO_CATG, "XCAL");
+ cpl_propertylist_save(main_headerH, xcal_pathH, CPL_IO_CREATE);
+ cpl_propertylist_delete(main_headerH); main_headerH = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_propertylist_delete(main_header); main_header = NULL;
+
+ lcal_offset = (lcal_end - lcal_start) / KMOS_DETECTOR_SIZE;
+ lcal_offsetH = (lcal_endH - lcal_startH) / KMOS_DETECTOR_SIZE;
+
+ /* loop detectors */
+ ifu = 0;
+ for (d = 0; d < KMOS_NR_DETECTORS; d++) {
+ start = start_offset;
+
+ cpl_test_nonnull(sub_header = cpl_propertylist_new());
+
+ /* loop IFUs */
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ lcal_val = lcal_end;
+ lcal_valH = lcal_endH;
+
+ /* loop in z */
+ for(j = 0; j < KMOS_DETECTOR_SIZE; j++) {
+ cpl_test_nonnull(image_obj = cpl_imagelist_get(cube_vector_obj[ifu], j));
+ cpl_test_nonnull(image_sky = cpl_imagelist_get(cube_vector_sky[ifu], j));
+ cpl_test_nonnull(image_obj_only = cpl_imagelist_get(cube_vector_obj_only[ifu], j));
+ cpl_test_nonnull(image_sky_only = cpl_imagelist_get(cube_vector_sky_only[ifu], j));
+
+ /* when generating raw images correct IFUs for weird orientation */
+ flip_rotate_image_forth(image_obj, ifu);
+ flip_rotate_image_forth(image_sky, ifu);
+ flip_rotate_image_forth(image_obj_only, ifu);
+ flip_rotate_image_forth(image_sky_only, ifu);
+
+ cpl_test_nonnull(pimage_obj = cpl_image_get_data_float(image_obj));
+ cpl_test_nonnull(pimage_sky = cpl_image_get_data_float(image_sky));
+ cpl_test_nonnull(pimage_obj_only = cpl_image_get_data_float(image_obj_only));
+ cpl_test_nonnull(pimage_sky_only = cpl_image_get_data_float(image_sky_only));
+
+ offset = start;
+
+ /* loop in x and y */
+ for (y = 1; y <= KMOS_SLITLET_Y; y++) {
+ for(x = 1; x <= KMOS_SLITLET_X; x++) {
+ i_raw = (offset + x - 1) + j * KMOS_DETECTOR_SIZE;
+ i_img = (x - 1) + (y - 1) * KMOS_SLITLET_Y;
+
+ /*-------- create raw_obj frame --------*/
+ praw_image_obj[i_raw] = pimage_obj[i_img];
+ praw_image_obj_only[i_raw] = pimage_obj_only[i_img];
+
+ /*-------- create raw_sky frame --------*/
+ praw_image_sky[i_raw] = pimage_sky[i_img];
+ praw_image_sky_only[i_raw] = pimage_sky_only[i_img];
+
+ /*-------- create lcal frame --------*/
+ plcal_img[i_raw] = lcal_val;
+ plcal_imgH[i_raw] = lcal_valH;
+
+ /*-------- create xcal frame --------*/
+ if (d == 0) {
+ if (i < 4) {
+ cal_tmp = -1300 + (y-1)*200;
+ } else {
+ cal_tmp = 1300 - (y-1)*200;
+ }
+ } else if (d == 1) {
+ if (i < 4) {
+ cal_tmp = 1300 - (y-1)*200;
+ } else {
+ cal_tmp = -1300 + (y-1)*200;
+ }
+ } else if (d == 2) {
+ if (i < 4) {
+ cal_tmp = -1300 + (x-1)*200;
+ } else {
+ cal_tmp = 1300 - (x-1)*200;
+ }
+ }
+
+ /* add in IFU number as decimal */
+ if (cal_tmp < 0) {
+ cal_tmp -= (float)(i+1)/10;
+ } else {
+ cal_tmp += (float)(i+1)/10;
+ }
+
+ pxcal_img[i_raw] = cal_tmp;
+
+ /*-------- create ycal frame --------*/
+ if (d == 0) {
+ if (i < 4) {
+ cal_tmp = 1300 - (x-1)*200;
+ } else {
+ cal_tmp = -1300 + (x-1)*200;
+ }
+ } else if (d == 1) {
+ if (i < 4) {
+ cal_tmp = -1300 + (x-1)*200;
+ } else {
+ cal_tmp = 1300 - (x-1)*200;
+ }
+ } else if (d == 2) {
+ if (i < 4) {
+ cal_tmp = -1300 + (y-1)*200;
+ } else {
+ cal_tmp = 1300 - (y-1)*200;
+ }
+ }
+
+ /* add in IFU number as decimal */
+ if (cal_tmp < 0) {
+ cal_tmp -= (float)(i+1)/10;
+ } else {
+ cal_tmp += (float)(i+1)/10;
+ }
+
+ pycal_img[i_raw] = cal_tmp;
+
+ /*-------- create badpix frame --------*/
+ pbadpix_img[i_raw] = 1.0;
+
+ } /* for x */
+ offset += inter_slitlet_offset + KMOS_SLITLET_X;
+ } /* for y */
+
+ /* increment */
+ offset = start;
+ lcal_val -= lcal_offset;
+ lcal_valH -= lcal_offsetH;
+
+ /* when generating raw images correct IFUs for weird
+ orientation again back*/
+ flip_rotate_image_back(image_obj, ifu);
+ flip_rotate_image_back(image_sky, ifu);
+
+ } /* for j (z-axis) */
+ start += KMOS_SLITLET_X * KMOS_SLITLET_Y
+ + KMOS_SLITLET_X * inter_slitlet_offset;
+ ifu++;
+ } /* for i = IFUs per detector */
+
+ /* put in saturated pixels in first det of raw_image_obj */
+ if (d == 0) {
+ praw_image_obj[279+1719*KMOS_DETECTOR_SIZE] = 0.;
+
+ praw_image_obj[278+1719*KMOS_DETECTOR_SIZE] = 0.;
+ praw_image_obj[280+1719*KMOS_DETECTOR_SIZE] = 0.;
+ praw_image_obj[279+1718*KMOS_DETECTOR_SIZE] = 0.;
+ praw_image_obj[279+1720*KMOS_DETECTOR_SIZE] = 0.;
+
+ praw_image_obj[280+1720*KMOS_DETECTOR_SIZE] = 0.;
+ praw_image_obj[278+1718*KMOS_DETECTOR_SIZE] = 0.;
+ praw_image_obj[278+1720*KMOS_DETECTOR_SIZE] = 0.;
+ praw_image_obj[280+1718*KMOS_DETECTOR_SIZE] = 0.;
+
+ praw_image_obj_only[279+1719*KMOS_DETECTOR_SIZE] = 0.;
+
+ praw_image_obj_only[278+1719*KMOS_DETECTOR_SIZE] = 0.;
+ praw_image_obj_only[280+1719*KMOS_DETECTOR_SIZE] = 0.;
+ praw_image_obj_only[279+1718*KMOS_DETECTOR_SIZE] = 0.;
+ praw_image_obj_only[279+1720*KMOS_DETECTOR_SIZE] = 0.;
+
+ praw_image_obj_only[280+1720*KMOS_DETECTOR_SIZE] = 0.;
+ praw_image_obj_only[278+1718*KMOS_DETECTOR_SIZE] = 0.;
+ praw_image_obj_only[278+1720*KMOS_DETECTOR_SIZE] = 0.;
+ praw_image_obj_only[280+1718*KMOS_DETECTOR_SIZE] = 0.;
+ }
+
+ /* saving extension */
+ kmclipm_update_property_double(sub_header, GAIN, 1.0,
+ "Gain in e-/ADU");
+ kmclipm_update_property_double(sub_header, RON, 0.0,
+ "Read-out noise in e-");
+ tmp_name = cpl_sprintf("%s%d%s", "CHIP", d+1, ".INT1");
+ kmclipm_update_property_string(sub_header, EXTNAME, tmp_name,
+ "FITS extension name");
+ cpl_free(tmp_name); tmp_name = NULL;
+ kmclipm_update_property_int(sub_header, CHIPINDEX, d+1,
+ "Chip index");
+ cpl_image_save(raw_image_obj, raw_obj_path, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_image_save(raw_image_sky, raw_sky_path, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_image_save(raw_image_obj_only, raw_obj_only_path, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_image_save(raw_image_sky_only, raw_sky_only_path, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_image_save(raw_image_obj, raw_obj_pathH, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_image_save(raw_image_sky, raw_sky_pathH, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_propertylist_erase(sub_header, GAIN);
+ cpl_propertylist_erase(sub_header, RON);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ tmp_name = cpl_sprintf("%s%d%s", "DET.", d+1, ".DATA");
+ kmclipm_update_property_string(sub_header, EXTNAME, tmp_name,
+ "FITS extension name");
+ kmclipm_update_property_double(sub_header, CAL_ROTANGLE,
+ 0, "[deg] Rotator relative to nasmyth");
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_image_save(lcal_img, lcal_path, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_image_save(xcal_img, xcal_path, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_image_save(ycal_img, ycal_path, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ kmclipm_update_property_double(sub_header, CAL_ROTANGLE,
+ 60, "[deg] Rotator relative to nasmyth");
+ cpl_image_save(lcal_imgH, lcal_pathH, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_image_save(xcal_img, xcal_pathH, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_image_save(ycal_img, ycal_pathH, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ kmclipm_update_property_double(sub_header, CAL_ROTANGLE,
+ 0, "[deg] Rotator relative to nasmyth");
+ cpl_image_save(lcal_img, lcal_pathTest, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_image_save(xcal_img, xcal_pathTest, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_image_save(ycal_img, ycal_pathTest, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ tmp_name = cpl_sprintf("%s%d%s", "DET.", d+1, ".BADPIX");
+ kmclipm_update_property_string(sub_header, EXTNAME,
+ tmp_name, "FITS extension name");
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_image_save(badpix_img, badpix_path, CPL_BPP_IEEE_FLOAT,
+ sub_header, CPL_IO_EXTEND);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_propertylist_delete(sub_header); sub_header = NULL;
+ } /* for d = detectors */
+
+ /*----------------- generate RTD image ----------------------------*/
+ cpl_test_nonnull(rtd_image = cpl_image_new(5 * KMOS_SLITLET_X + 6 * RTD_GAP,
+ 5 * KMOS_SLITLET_Y + 6 * RTD_GAP,
+ CPL_TYPE_FLOAT));
+
+ cpl_test_nonnull(rtd_image_obj = cpl_image_new(5 * KMOS_SLITLET_X + 6 * RTD_GAP,
+ 5 * KMOS_SLITLET_Y + 6 * RTD_GAP,
+ CPL_TYPE_FLOAT));
+ cpl_test_nonnull(rtd_image_sky = cpl_image_new(5 * KMOS_SLITLET_X + 6 * RTD_GAP,
+ 5 * KMOS_SLITLET_Y + 6 * RTD_GAP,
+ CPL_TYPE_FLOAT));
+
+ for (ifu = 0; ifu < KMOS_NR_IFUS; ifu++) {
+ if (ifu_id[ifu + 1] > 0) {
+ /* paste targets into ref_rtd_target.fits */
+ median = kmclipm_median_min(image_cube_vector_obj[ifu], NULL, NULL);
+ cpl_image_subtract_scalar(image_cube_vector_obj[ifu], median*3/4);
+ out_val_ref_rtd_target = kmclipm_priv_paste_ifu_images(
+ image_cube_vector_obj[ifu],
+ &rtd_image_obj,
+ kmclipm_priv_ifu_pos_x(ifu),
+ kmclipm_priv_ifu_pos_y(ifu));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_nonnull(rtd_image_obj);
+
+ /* paste skies into ref_rtd_sky.fits */
+ median = kmclipm_median_min(image_cube_vector_sky[ifu], NULL, NULL);
+ cpl_image_subtract_scalar(image_cube_vector_sky[ifu], median/2);
+ out_val_ref_rtd_sky = kmclipm_priv_paste_ifu_images(
+ image_cube_vector_sky[ifu],
+ &rtd_image_sky,
+ kmclipm_priv_ifu_pos_x(ifu),
+ kmclipm_priv_ifu_pos_y(ifu));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_nonnull(rtd_image_sky);
+
+ /* paste subtracted targets & skies into ref_rtd.fits
+ (this one is actually used to be compared to test-output) */
+ if (ifu_id[ifu + 1] == 1) {
+ cpl_imagelist_subtract(cube_vector_obj[ifu],
+ cube_vector_sky[ifu]);
+ kmclipm_make_image(cube_vector_obj[ifu], NULL,&tmp_img, NULL,
+ NULL, "average", -1, -1, -1, -1, -1);
+ cpl_test_error(CPL_ERROR_NONE);
+ } else {
+ cpl_imagelist_subtract(cube_vector_sky[ifu],
+ cube_vector_obj[ifu]);
+ kmclipm_make_image(cube_vector_sky[ifu], NULL, &tmp_img, NULL,
+ NULL, "average", -1, -1, -1, -1, -1);
+ cpl_test_error(CPL_ERROR_NONE);
+ }
+
+ median = kmclipm_median_min(tmp_img, NULL, NULL);
+ cpl_image_subtract_scalar(tmp_img, median);
+
+ out_val_ref_rtd = kmclipm_priv_paste_ifu_images(tmp_img,
+ &rtd_image,
+ kmclipm_priv_ifu_pos_x(ifu),
+ kmclipm_priv_ifu_pos_y(ifu));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_nonnull(rtd_image);
+
+ cpl_image_delete(tmp_img); tmp_img = NULL;
+
+ if (out_val_ref_rtd > val_ref_rtd) {
+ val_ref_rtd = out_val_ref_rtd;
+ }
+
+ if (out_val_ref_rtd_target > val_ref_rtd_target) {
+ val_ref_rtd_target = out_val_ref_rtd_target;
+ }
+
+ if (out_val_ref_rtd_sky > val_ref_rtd_sky) {
+ val_ref_rtd_sky = out_val_ref_rtd_sky;
+ }
+ }
+ }
+
+ /* save ref_rtd_target.fits to disk */
+ if (val_ref_rtd_target == 0.0) {
+ val_ref_rtd_target = 100.0;
+ }
+
+ kmclipm_priv_paint_ifu_rectangle_rtd(&rtd_image_obj,
+ ifu_id,
+ val_ref_rtd_target);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ tmp_name = cpl_sprintf("%s%s%s", kmclipm_priv_get_output_path(),
+ "ref_rtd_target", suffix);
+ cpl_msg_info("RTD generate", "Saving %s\n", tmp_name);
+ cpl_image_save(rtd_image_obj, tmp_name, CPL_BPP_IEEE_FLOAT,
+ NULL, CPL_IO_CREATE);
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* save ref_rtd_sky.fits to disk */
+ if (val_ref_rtd_sky == 0.0) {
+ val_ref_rtd_sky = 100.0;
+ }
+
+ kmclipm_priv_paint_ifu_rectangle_rtd(&rtd_image_sky,
+ ifu_id,
+ val_ref_rtd_sky);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ tmp_name = cpl_sprintf("%s%s%s", kmclipm_priv_get_output_path(),
+ "ref_rtd_sky", suffix);
+ cpl_msg_info("RTD generate", "Saving %s\n", tmp_name);
+ cpl_image_save(rtd_image_sky, tmp_name, CPL_BPP_IEEE_FLOAT,
+ NULL, CPL_IO_CREATE);
+ cpl_free(tmp_name); tmp_name = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* save ref_rtd.fits to disk */
+ if (val_ref_rtd == 0.0)
+ val_ref_rtd = 100.0;
+
+ kmclipm_priv_paint_ifu_rectangle_rtd(&rtd_image,
+ ifu_id,
+ val_ref_rtd);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ tmp_name = cpl_sprintf("%s%s%s", kmclipm_priv_get_output_path(),
+ "ref_rtd", suffix);
+ cpl_msg_info("RTD generate", "Saving %s\n", tmp_name);
+ cpl_image_save(rtd_image, tmp_name, CPL_BPP_IEEE_FLOAT,
+ NULL, CPL_IO_CREATE);
+ cpl_free(tmp_name); tmp_name = NULL;
+
+ /*----------------- Free memory ----------------------------*/
+ cpl_image_delete(gauss_image); gauss_image = NULL;
+ cpl_image_delete(rtd_image_obj); rtd_image_obj = NULL;
+ cpl_image_delete(rtd_image_sky); rtd_image_sky = NULL;
+ cpl_image_delete(rtd_image); rtd_image = NULL;
+ cpl_image_delete(raw_image_obj); raw_image_obj = NULL;
+ cpl_image_delete(raw_image_sky); raw_image_sky = NULL;
+ cpl_image_delete(raw_image_obj_only); raw_image_obj_only = NULL;
+ cpl_image_delete(raw_image_sky_only); raw_image_sky_only = NULL;
+ cpl_image_delete(lcal_img); lcal_img = NULL;
+ cpl_image_delete(lcal_imgH); lcal_imgH = NULL;
+ cpl_image_delete(xcal_img); xcal_img = NULL;
+ cpl_image_delete(ycal_img); ycal_img = NULL;
+ cpl_image_delete(badpix_img); badpix_img = NULL;
+
+ for (ifu = 0; ifu < KMOS_NR_IFUS; ifu++) {
+ cpl_imagelist_delete(cube_vector_obj[ifu]); cube_vector_obj[ifu] = NULL;
+ cpl_imagelist_delete(cube_vector_sky[ifu]); cube_vector_sky[ifu] = NULL;
+ cpl_imagelist_delete(cube_vector_obj_only[ifu]); cube_vector_obj_only[ifu] = NULL;
+ cpl_imagelist_delete(cube_vector_sky_only[ifu]); cube_vector_sky_only[ifu] = NULL;
+ }
+ cpl_free(cube_vector_obj); cube_vector_obj = NULL;
+ cpl_free(cube_vector_sky); cube_vector_sky = NULL;
+ cpl_free(cube_vector_obj_only); cube_vector_obj_only = NULL;
+ cpl_free(cube_vector_sky_only); cube_vector_sky_only = NULL;
+
+ for (ifu = 0; ifu < KMOS_NR_IFUS; ifu++) {
+ cpl_image_delete(image_cube_vector_obj[ifu]); image_cube_vector_obj[ifu] = NULL;
+ cpl_image_delete(image_cube_vector_sky[ifu]); image_cube_vector_sky[ifu] = NULL;
+ cpl_image_delete(image_cube_vector_obj_only[ifu]); image_cube_vector_obj_only[ifu] = NULL;
+ cpl_image_delete(image_cube_vector_sky_only[ifu]); image_cube_vector_sky_only[ifu] = NULL;
+ }
+ cpl_free(image_cube_vector_obj); image_cube_vector_obj = NULL;
+ cpl_free(image_cube_vector_sky); image_cube_vector_sky = NULL;
+ cpl_free(image_cube_vector_obj_only); image_cube_vector_obj_only = NULL;
+ cpl_free(image_cube_vector_sky_only); image_cube_vector_sky_only = NULL;
+
+ cpl_msg_info("RTD generate", "Test data generated successfully.\n");
+
+ cpl_free(raw_obj_path);
+ cpl_free(raw_sky_path);
+ cpl_free(raw_obj_only_path);
+ cpl_free(raw_sky_only_path);
+ cpl_free(lcal_path);
+ cpl_free(xcal_path);
+ cpl_free(ycal_path);
+ cpl_free(wave_path);
+ cpl_free(badpix_path);
+ cpl_free(raw_obj_pathH);
+ cpl_free(raw_sky_pathH);
+ cpl_free(lcal_pathH);
+ cpl_free(xcal_pathH);
+ cpl_free(ycal_pathH);
+ cpl_free(lcal_pathTest);
+ cpl_free(xcal_pathTest);
+ cpl_free(ycal_pathTest);
+ cpl_free(wave_pathTest);
+
+ return cpl_error_get_code();
+}
+
+/**
+ @brief Helper function to check returned RTD-image
+ @param rtd_img Calculated RTD-image.
+ @param target_only Flag if only a target and no sky was provided.
+
+ The passed image is compared to a reference RTD-image.
+*/
+void kmclipm_compare(cpl_image *rtd_img, int target_only) {
+
+ cpl_image *rtd_ref = NULL;
+
+ double max = 0.0, min = 0.0;
+
+ if (target_only == 0) {
+ char *my_path = cpl_sprintf("%s/test_data/ref_rtd.fits", ".");
+ rtd_ref = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0,0);
+ cpl_free(my_path);
+ } else if (target_only == 1) {
+ char *my_path = cpl_sprintf("%s/test_data/ref_rtd_target.fits", ".");
+ rtd_ref = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0,0);
+ cpl_free(my_path);
+ } else if (target_only == 2) {
+ char *my_path = cpl_sprintf("%s/test_data/ref_rtd_sky.fits", ".");
+ rtd_ref = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0,0);
+ cpl_free(my_path);
+ }
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_image_subtract(rtd_img, rtd_ref);
+ max = cpl_image_get_max(rtd_img);
+ min = cpl_image_get_min(rtd_img);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_test_eq(1, (max <= 0.007) && (min >= -0.007));
+
+ cpl_image_delete(rtd_ref); rtd_ref = NULL;
+}
+
+/**
+ @brief Helper function to check returned center positions and errors
+ @param center_pos Array with the calculated center positions.
+ @param errors Array with the calculated errors.
+ @param intens Array with the calculated intensity.
+ @param ifu_id Array with the ifu ids.
+ @param target target mode.
+
+ The passed center positions and errors are checked if they lie between
+ a certain interval (allow some errros).
+*/
+void kmclipm_compare_values(kmclipm_fitpar *fitpar,
+ int *ifu_id,
+ int target)
+{
+ double err = 0.05,
+ tol = 0.01;
+
+ int i = 0;
+
+ cpl_test_abs(fitpar->xpos[0], -1.0, tol);
+ cpl_test_abs(fitpar->xpos_error[0], -1.0, tol);
+ cpl_test_abs(fitpar->ypos[0], -1.0, tol);
+ cpl_test_abs(fitpar->ypos_error[0], -1.0, tol);
+ cpl_test_abs(fitpar->intensity[0], -1.0, tol);
+ cpl_test_abs(fitpar->intensity_error[0], -1.0, tol);
+ cpl_test_abs(fitpar->fwhm[0], -1.0, tol);
+ cpl_test_abs(fitpar->fwhm_error[0], -1.0, tol);
+ cpl_test_abs(fitpar->background[0], -1.0, tol);
+ cpl_test_abs(fitpar->background_error[0], -1.0, tol);
+
+ for (i = 0; i < KMOS_NR_IFUS; i++) {
+ if (((ifu_id[i + 1] > 0) && (target == 0)) ||
+ ((ifu_id[i + 1] == 1) && (target == 1)) ||
+ ((ifu_id[i + 1] == 2) && (target == 2)))
+ {
+ cpl_test_abs(fitpar->xpos[i+1], xpos[i], err);
+ cpl_test_abs(fitpar->ypos[i+1], ypos[i], err);
+ cpl_test_abs(fitpar->intensity[i+1], intens_ref[i], err);
+ cpl_test_abs(abs(fitpar->fwhm[i+1]), fwhm_ref[i], err*20);
+ cpl_test_abs(fitpar->background[i+1], 0., err);
+
+ cpl_test_eq(1, fitpar->xpos_error[i+1] <= err);
+ cpl_test_eq(1, fitpar->ypos_error[i+1] <= err);
+ cpl_test_eq(1, fitpar->intensity_error[i+1] <= err);
+
+ if (i == 20)
+ cpl_test_eq(1, fitpar->fwhm_error[i+1] <= err*2);
+ else if (i == 21)
+ cpl_test_eq(1, fitpar->fwhm_error[i+1] <= err*3);
+ else if (i == 22)
+ cpl_test_eq(1, fitpar->fwhm_error[i+1] <= err*4);
+ else if (i == 23)
+ cpl_test_eq(1, fitpar->fwhm_error[i+1] <= err*6);
+ else
+ cpl_test_eq(1, fitpar->fwhm_error[i+1] <= err);
+
+ cpl_test_eq(1, fitpar->background_error[i+1] <= err);
+ } else {
+ cpl_test_eq(1, fitpar->xpos[i+1] == -1.0);
+ cpl_test_eq(1, fitpar->ypos[i+1] == -1.0);
+ cpl_test_eq(1, fitpar->xpos_error[i+1] == -1.0);
+ cpl_test_eq(1, fitpar->ypos_error[i+1] == -1.0);
+ cpl_test_eq(1, fitpar->intensity[i+1] == -1.0);
+ cpl_test_eq(1, fitpar->intensity_error[i+1] == -1.0);
+ cpl_test_eq(1, fitpar->fwhm[i+1] == -1.0);
+ cpl_test_eq(1, fitpar->fwhm_error[i+1] == -1.0);
+ cpl_test_eq(1, fitpar->background[i+1] == -1.0);
+ cpl_test_eq(1, fitpar->background_error[i+1] == -1.0);
+ }
+ }
+}
+
+/**
+ @brief Save Image to predefined output path
+ @param img Image to save.
+ @param path Path of file to save.
+
+*/
+void kmclipm_save_output(cpl_image * img, const char *filename)
+{
+ char *temp_path = NULL;
+
+ /* save patrol image if option is set */
+
+ if (kmclipm_priv_get_output_patrol() == TRUE) {
+ temp_path = cpl_sprintf("%s%s", kmclipm_priv_get_output_path(), filename);
+
+ cpl_image_save(img, temp_path,
+ CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_CREATE);
+ cpl_test_error(CPL_ERROR_NONE);
+ }
+
+ cpl_free(temp_path); temp_path = NULL;
+}
+
+/**
+ @brief Routine for testing kmclipm_rtd_image() with target and sky.
+*/
+void test_kmclipm_rtd_image()
+{
+ cpl_image *patrol_img = NULL,
+ *rtd_img = NULL;
+ int target_only = 0;
+ kmclipm_fitpar fitpar;
+
+ /*-------------- Calculate RTD-image & patrol-view -------------------*/
+ kmclipm_rtd_image(test_pars.actual_img,
+ test_pars.actual_img_type,
+ test_pars.additional_img_path,
+ test_pars.additional_img_type,
+ test_pars.ifu_id,
+ test_pars.nominal_pos,
+ "K", "K", 0.0,
+ &fitpar,
+ &rtd_img, &patrol_img);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /*---------- Save output images if options are set correspondingly ---*/
+ if (kmclipm_priv_get_output_patrol() == TRUE) {
+ kmclipm_save_output(patrol_img, patrol_path);
+ }
+
+ if (kmclipm_priv_get_output_rtd() == TRUE) {
+ kmclipm_save_output(rtd_img, "rtd.fits");
+ }
+
+ /*-------------- Compare rtd-image with ref_rtd.fits ---*/
+ if (test_pars.do_compare) {
+ if ((strcmp(test_pars.additional_img_path, "NOT_AVAILABLE") == 0) ||
+ (strcmp(test_pars.additional_img_type, "NOT_AVAILABLE") == 0))
+ {
+ target_only = 1;
+ }
+
+ kmclipm_compare(rtd_img, target_only);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_compare_values(&fitpar, ifu_id, target_only);
+ cpl_test_error(CPL_ERROR_NONE);
+ }
+
+ cpl_image_delete(patrol_img); patrol_img = NULL;
+ cpl_image_delete(rtd_img); rtd_img = NULL;
+ kmclipm_free_fitpar(&fitpar);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Routine for testing kmclipm_rtd_image() with sky only.
+*/
+void test_kmclipm_rtd_image_sky()
+{
+
+ cpl_image *patrol_img = NULL,
+ *rtd_img = NULL,
+ *actual_img = NULL;
+
+ int target_only = 0;
+ kmclipm_fitpar fitpar;
+
+ cpl_test_nonnull(test_pars.additional_img_path);
+
+ cpl_test_nonnull(actual_img =
+ kmclipm_load_image_with_extensions(
+ test_pars.additional_img_path));
+
+ /*-------------- Calculate RTD-image & patrol-view -------------------*/
+ kmclipm_rtd_image(actual_img, "SKY",
+ "NOT_AVAILABLE", "NOT_AVAILABLE",
+ test_pars.ifu_id, test_pars.nominal_pos,
+ "K", "K", 0.0,
+ &fitpar,
+ &rtd_img, &patrol_img);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /*---------- Save output images if options are set correspondingly ---*/
+ if (kmclipm_priv_get_output_patrol() == TRUE) {
+ kmclipm_save_output(patrol_img, patrol_path);
+ }
+
+ if (kmclipm_priv_get_output_rtd() == TRUE) {
+ kmclipm_save_output(rtd_img, "rtd.fits");
+ }
+ /*-------------- Compare rtd-image with ref_rtd.fits ---*/
+ if (test_pars.do_compare) {
+ target_only = 2;
+
+ kmclipm_compare(rtd_img, target_only);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_compare_values(&fitpar, ifu_id, target_only);
+ cpl_test_error(CPL_ERROR_NONE);
+ }
+
+ cpl_image_delete(actual_img); actual_img = NULL;
+ cpl_image_delete(patrol_img); patrol_img = NULL;
+ cpl_image_delete(rtd_img); rtd_img = NULL;
+ kmclipm_free_fitpar(&fitpar);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Routine for testing kmclipm_rtd_image() with wrong inputs.
+*/
+void test_kmclipm_rtd_image_error()
+{
+ cpl_image *patrol_img = NULL,
+ *rtd_img = NULL;
+ kmclipm_fitpar fitpar;
+
+ cpl_msg_severity level = cpl_msg_get_level();
+
+ cpl_msg_set_level(CPL_MSG_OFF);
+
+ /* Wrong input: actual_img == NULL */
+ kmclipm_rtd_image(NULL, "TARG",
+ test_pars.additional_img_path, "SKY",
+ test_pars.ifu_id, test_pars.nominal_pos,
+ "K", "K", 0.0,
+ &fitpar,
+ &rtd_img, &patrol_img);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* Wrong input: additional_img == NULL */
+ kmclipm_rtd_image(test_pars.actual_img, "TARG",
+ NULL, "SKY",
+ test_pars.ifu_id, test_pars.nominal_pos,
+ "K", "K", 0.0,
+ &fitpar,
+ &rtd_img, &patrol_img);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* Wrong input: ifu_id == NULL */
+ kmclipm_rtd_image(test_pars.actual_img, "TARG",
+ test_pars.additional_img_path, "SKY",
+ NULL, test_pars.nominal_pos,
+ "K", "K", 0.0,
+ &fitpar,
+ &rtd_img, &patrol_img);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* Wrong input: nominal_pos == NULL */
+ kmclipm_rtd_image(test_pars.actual_img, "TARG",
+ test_pars.additional_img_path, "SKY",
+ test_pars.ifu_id, NULL,
+ "K", "K", 0.0,
+ &fitpar,
+ &rtd_img, &patrol_img);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* Wrong input: grating == NULL */
+ kmclipm_rtd_image(test_pars.actual_img, "TARG",
+ test_pars.additional_img_path, "SKY",
+ test_pars.ifu_id, test_pars.nominal_pos,
+ NULL, "K", 0.0,
+ &fitpar,
+ &rtd_img, &patrol_img);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* Wrong input: filter == NULL */
+ kmclipm_rtd_image(test_pars.actual_img, "TARG",
+ test_pars.additional_img_path, "SKY",
+ test_pars.ifu_id, test_pars.nominal_pos,
+ "K", NULL, 0.0,
+ &fitpar,
+ &rtd_img, &patrol_img);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* Wrong input: actual_img_type == additional_img_type */
+ kmclipm_rtd_image(test_pars.actual_img, "TARG",
+ test_pars.additional_img_path, "TARG",
+ test_pars.ifu_id, test_pars.nominal_pos,
+ "K", "K", 0.0,
+ &fitpar,
+ &rtd_img, &patrol_img);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_image_delete(patrol_img); patrol_img = NULL;
+ cpl_image_delete(rtd_img); rtd_img = NULL;
+ kmclipm_free_fitpar(&fitpar);
+
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_msg_set_level(level);
+}
+
+/**
+ @brief Routine for testing kmclipm_rtd_image_from_files().
+*/
+void test_kmclipm_rtd_image_from_files()
+{
+ cpl_image *patrol_img = NULL,
+ *rtd_img = NULL;
+ kmclipm_fitpar fitpar;
+
+ /*----------------- Calculate RTD-image & patrol-view ----------------*/
+ kmclipm_rtd_image_from_files(
+ test_pars.actual_img_path, test_pars.actual_img_type,
+ test_pars.additional_img_path, test_pars.additional_img_type,
+ test_pars.ifu_id, test_pars.nominal_pos,
+ &fitpar,
+ &rtd_img, &patrol_img);
+ cpl_test_error(CPL_ERROR_NONE);
+/* don't do any additional tests here since reconstructing a K-band image marked
+ as H-band produces wrong values
+ It is just to show that the right calibration-file are picked automatically
+ and the LUTs work when switching bands*/
+ /*---------- Save output images if options are set correspondingly ---*/
+/* if (kmclipm_priv_get_output_patrol() == TRUE) {
+ kmclipm_save_output(patrol_img, patrol_path_from_files);
+ }
+
+ if (kmclipm_priv_get_output_rtd() == TRUE) {
+ kmclipm_save_output(rtd_img, "rtd_from_files.fits");
+ }*/
+ /*-------------- Compare rtd-image with ref_rtd.fits ---*/
+/* if (test_pars.do_compare) {
+ if ((strcmp(test_pars.additional_img_path, "NOT_AVAILABLE") == 0) ||
+ (strcmp(test_pars.additional_img_type, "NOT_AVAILABLE") == 0))
+ {
+ target_only = 1;
+ }
+ kmclipm_compare(rtd_img, target_only);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_compare_values(&fitpar, ifu_id, target_only);
+ cpl_test_error(CPL_ERROR_NONE);
+ }
+*/
+ cpl_image_delete(patrol_img); patrol_img = NULL;
+ cpl_image_delete(rtd_img); rtd_img = NULL;
+ kmclipm_free_fitpar(&fitpar);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Routine for testing kmclipm_rtd_image_from_memory().
+*/
+void test_kmclipm_rtd_image_from_memory()
+{
+ cpl_image *patrol_img = NULL,
+ *rtd_img = NULL;
+ int target_only = 0;
+ kmclipm_fitpar fitpar;
+
+ /*--------------- Calculate RTD-image & patrol-view ------------------*/
+ kmclipm_rtd_image_from_memory(
+ test_pars.actual_img, test_pars.actual_img_type,
+ test_pars.additional_img, test_pars.additional_img_type,
+ test_pars.ifu_id, test_pars.nominal_pos,
+ "K", "K", 0.0,
+ &fitpar,
+ &rtd_img, &patrol_img);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /*---------- Save output images if options are set correspondingly ---*/
+ if (kmclipm_priv_get_output_patrol() == TRUE) {
+ kmclipm_save_output(patrol_img, patrol_path_from_memory);
+ }
+
+ if (kmclipm_priv_get_output_rtd() == TRUE) {
+ kmclipm_save_output(rtd_img, "rtd_from_memory.fits");
+ }
+
+ /*-------------- Compare rtd-image with ref_rtd.fits ---*/
+ if (test_pars.do_compare) {
+ if ((test_pars.additional_img == NULL) ||
+ (strcmp(test_pars.additional_img_type, "NOT_AVAILABLE") == 0))
+ {
+ target_only = 1;
+ }
+ kmclipm_compare(rtd_img, target_only);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_compare_values(&fitpar, ifu_id, target_only);
+ cpl_test_error(CPL_ERROR_NONE);
+ }
+
+ cpl_image_delete(patrol_img); patrol_img = NULL;
+ cpl_image_delete(rtd_img); rtd_img = NULL;
+ kmclipm_free_fitpar(&fitpar);
+
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+/**
+ @brief Starts the unit test.
+
+ @param argc ...
+ @param argv ...
+
+ Usage: @code kmclipm_test_rtd [[options], [arguments]] @endcode
+ <br>
+ - without any options or arguments:
+ <code> kmclipm_test_rtd </code>
+ This is the standard unit test. Test data will be generated, data will be
+ processed where the actual image is ./data/raw_imageObj.fits (TARG) and the
+ additional image is ./data/raw_imageSky.fits (SKY)
+ - Options:
+ <code> kmclipm_test_rtd --help </code> Prints this help
+ <code> kmclipm_test_rtd --no-gen [args] </code> Runs the program without generating test data
+ Additional arguments:
+ Supply one image (TARGET or SKY):
+ <code> kmclipm_test_rtd --no-gen [path actual image] [\"TARG\", \"SKY\"] </code>
+ Supply two images:
+ <code> kmclipm_test_rtd --no-gen [path actual image] [\"TARG\", \"SKY\"]
+ [path additional image] [\"SKY\", \"TARG\"] </code>
+ <code> kmclipm_test_rtd --generate [options]</code> Generates test data for the unit test
+ - Additional options:
+ <code> cubes-out </code> Saves the cubes of each IFU to disk
+ <code> image-cubes-out </code> Saves the collapsed images of cubes to disk
+
+ @return Error code, 0 for NONE.
+ */
+int main(int argc, char *argv[])
+{
+ cpl_parameterlist *par_list = NULL;
+
+ cpl_parameter *temp_par = NULL;
+
+ int save_cubes = FALSE,
+ save_image_cubes = FALSE,
+ i = 0,
+ do_compare = 0,
+ data_is_dir = FALSE;
+
+ cpl_image *actual_img = NULL,
+ *additional_img = NULL;
+
+ struct stat s;
+
+ if (stat("../data", &s) == 0) {
+ if (s.st_mode & S_IFDIR) {
+ data_is_dir = TRUE;
+ }
+ }
+
+/*----------------- Test-specific Initialisation ----------------------------*/
+
+ /* For DEVELOPERS:
+ * to omit all CPL_MSG_INFO output, apply following statement in the shell
+ * before executing "make check":
+ * setenv CPL_MSG_LEVEL warning
+ * (or export CPL_MSG_LEVEL=warning)
+ */
+
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", my_level);
+
+ char *raw_obj_path = cpl_sprintf("%s/test_data/raw_image_obj.fits", ".");
+ char *raw_sky_path = cpl_sprintf("%s/test_data/raw_image_sky.fits", ".");
+ char *raw_obj_pathH = cpl_sprintf("%s/test_data/raw_image_objH.fits", ".");
+ char *raw_sky_pathH = cpl_sprintf("%s/test_data/raw_image_skyH.fits", ".");
+
+ char *my_path = cpl_sprintf("%s/test_data", ".");
+ mkdir(my_path, 0777);
+ cpl_free(my_path);
+
+ cpl_msg_set_level_from_env();
+ my_level = cpl_msg_get_level();
+
+ /* specify the nominal positions of the IFUs in the patrol image */
+ const double nominal_pos[] = {-1.0, -1.0,
+ -111.66474, 31.4259, /* IFU_1_x, IFU_1_y */
+ -71.01666, 46.6983, /* IFU_2*/
+ -28.72386, 13.56894, /* IFU_3 */
+ -15.33114, 0.64614, /* IFU_4 */
+ 111.54726, 16.85838, /* IFU_5 */
+ 34.83282, 93.1029, /* IFU_6 */
+ -10.39698, -113.42694, /* IFU_7 */
+ 50.10522, -112.25214, /* IFU_8 */
+ -50, -30, /* IFU_9 */
+ -10, -80, /* IFU_10 */
+ -50, 15, /* IFU_11 */
+ 10, -100, /* IFU_12 */
+ 15, 15, /* IFU_13 */
+ 126, 0, /* IFU_14 */
+ -10, -10, /* IFU_15 */
+ 89.716577, 89.716577, /* IFU_16 */
+ 50, -40, /* IFU_17 */
+ 40, -20, /* IFU_18 */
+ 70, -10, /* IFU_19 */
+ -10, 50, /* IFU_20 */
+ -40, 80, /* IFU_21 */
+ -70, 0, /* IFU_22 */
+ 60, 10, /* IFU_23 */
+ -128.46638, -128.46638 }; /* IFU_24 */
+
+ char actual_img_type[256],
+ additional_img_path[256],
+ additional_img_type[256];
+
+ sprintf(additional_img_path, "NOT_AVAILABLE");
+ sprintf(additional_img_type, "NOT_AVAILABLE");
+
+ /* set data output path */
+ my_path = cpl_sprintf("%s/test_data/", ".");
+ kmclipm_priv_set_output_path(my_path);
+ cpl_free(my_path);
+
+ kmclipm_set_cal_path(kmclipm_priv_get_output_path(), FALSE);
+ /*setenv("KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE", "BOTH", 1);*/ /* faster */
+ /*setenv("KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE", "FILE", 1);*/ /* faster */
+ setenv("KMCLIPM_PRIV_RECONSTRUCT_LUT_MODE", "NONE", 1); /* slower, but
+ valgrind works */
+
+ /*----------------- Argument-handling --------------------------------*/
+ if (argc == 1) {
+ /* no argument provided, first test data is generated then
+ * rtd_image is executed using standard values (unit test when
+ * executing make check)
+ */
+
+ generate_test_data(save_cubes, save_image_cubes);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* provide object and sky frame */
+ cpl_test_nonnull(actual_img =
+ kmclipm_load_image_with_extensions(raw_obj_path));
+
+ sprintf(actual_img_type, "TARG");
+ sprintf(additional_img_path, raw_sky_path);
+ sprintf(additional_img_type, "SKY");
+ }
+ else if ((argc > 1) && (strcmp(argv[1], "--help") == 0)) {
+ /* print help */
+ printf("-------------------------------------------------------\n");
+ printf("--- kmclipm_test_rtd ---\n");
+ printf("-------------------------------------------------------\n");
+ printf("Usage: kmclipm_test_rtd [[options], [arguments]]\n");
+ printf("-------------------------------------------------------\n");
+ printf("without any options or arguments:\n");
+ printf(" $ kmclipm_test_rtd\n");
+ printf(" This is the standard unit test. Test data will be generated,\n");
+ printf(" data will be processed where the actual image is \n");
+ printf(" ./data/raw_imageObj.fits (TARG) and the additional image is \n");
+ printf(" ./data/raw_imageSky.fits (SKY)\n\n");
+ printf("-------------------------------------------------------\n");
+ printf("Options:\n");
+ printf(" --help Prints this help\n\n");
+ printf(" --no-gen Runs the program without generating test data\n\n");
+ printf(" Additional arguments:\n");
+ printf(" Supply one image (TARGET or SKY):\n");
+ printf(" $ kmclipm_test_rtd --no-gen [path actual image] [\"TARG\", \"SKY\"]\n\n");
+ printf(" Supply two images:\n");
+ printf(" $ kmclipm_test_rtd --no-gen [path actual image] [\"TARG\", \"SKY\"]\n");
+ printf(" [path additional image] [\"SKY\", \"TARG\"]\n\n");
+ printf(" --generate Generates test data for the unit test\n\n");
+ printf(" Additional options:\n");
+ printf(" --cubes-out Saves the cubes of each IFU to disk\n");
+ printf(" --image-cubes-out Saves the collapsed images of cubes to disk\n");
+ printf("-------------------------------------------------------\n");
+
+ return cpl_test_end(0);
+ }
+ else if ((argc > 1) && (strcmp(argv[1], "--generate") == 0)) {
+ /* only test data is generated */
+ if (argc > 2) {
+ for (i = 2; i < argc; i++) {
+ if (!strcmp(argv[i], "--cubes-out")) {
+ save_cubes = TRUE;
+ }
+ if (!strcmp(argv[i], "--image-cubes-out")) {
+ save_image_cubes = TRUE;
+ }
+ }
+ }
+
+ if (save_cubes) {
+ cpl_msg_info("RTD test", "Cubes will be saved to disk.\n");
+ }
+ if (save_image_cubes) {
+ cpl_msg_info("RTD test",
+ "Images of cubes will be saved to disk.\n");
+ }
+
+ generate_test_data(save_cubes, save_image_cubes);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ return cpl_test_end(0);
+ }
+ else if ((argc > 1) && (strcmp(argv[1], "--no-gen") == 0)) {
+ if (argc == 2) {
+ /* default */
+ cpl_msg_info("RTD test", "Loading data for actual image.");
+ cpl_test_nonnull(actual_img =
+ kmclipm_load_image_with_extensions(raw_obj_path));
+ sprintf(actual_img_type, "TARG");
+ sprintf(additional_img_path, raw_sky_path);
+ sprintf(additional_img_type, "SKY");
+ } else if (argc == 4) {
+ /* only actual image is supplied */
+ cpl_msg_info("RTD test", "Loading data for actual image.");
+ cpl_test_nonnull(actual_img =
+ kmclipm_load_image_with_extensions(argv[2]));
+ if (cpl_error_get_code() != CPL_ERROR_NONE) {
+ cpl_msg_error("RTD test", "Couldn't load image: %s",
+ argv[2]);
+ cpl_test_error(CPL_ERROR_FILE_IO);
+ return cpl_test_end(0);
+ }
+ sprintf(actual_img_type, argv[3]);
+ } else if (argc == 6) {
+ /* actual and additional image are supplied */
+ cpl_msg_info("RTD test", "Loading data for actual image.");
+ cpl_test_nonnull(actual_img =
+ kmclipm_load_image_with_extensions(argv[2]));
+ if (cpl_error_get_code() != CPL_ERROR_NONE) {
+ cpl_msg_error("RTD test", "Couldn't load image: %s",
+ argv[2]);
+ cpl_test_error(CPL_ERROR_FILE_IO);
+ return cpl_test_end(0);
+ }
+ sprintf(actual_img_type, argv[3]);
+ sprintf(additional_img_path, argv[4]);
+ sprintf(additional_img_type, argv[5]);
+ } else {
+ cpl_msg_error("RTD test", "Wrong number of arguments!");
+ return cpl_test_end(0);
+ }
+ }
+ else {
+ cpl_msg_error("RTD test", "Wrong number of arguments!");
+ return cpl_test_end(0);
+ }
+
+/*----------------- Configuration parameters -----------------------------*/
+
+ /* load configuration parameters, generate cpl_parameterlist and
+ * initialise kmclipm_rtd_image()
+ */
+
+ my_path = cpl_sprintf("%s/ref/parameter_config.txt", getenv("srcdir"));
+ cpl_test_nonnull(par_list = kmclipm_testlib_parser_import_configfile( my_path, NULL));
+ cpl_free(my_path);
+
+ cpl_test_nonnull(temp_par =
+ cpl_parameterlist_find(par_list, "cubes-out"));
+ kmclipm_priv_set_output_cubes(
+ !strcmp(cpl_parameter_get_string(temp_par), "TRUE"));
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_test_nonnull(temp_par =
+ cpl_parameterlist_find(par_list, "extracted-images-out"));
+ kmclipm_priv_set_output_extracted_images(
+ !strcmp(cpl_parameter_get_string(temp_par), "TRUE"));
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_test_nonnull(temp_par = cpl_parameterlist_find(par_list, "patrol"));
+ kmclipm_priv_set_output_patrol(
+ !strcmp(cpl_parameter_get_string(temp_par), "TRUE"));
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_test_nonnull(temp_par = cpl_parameterlist_find(par_list, "rtd"));
+ kmclipm_priv_set_output_rtd(
+ !strcmp(cpl_parameter_get_string(temp_par), "TRUE"));
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_test_nonnull(temp_par = cpl_parameterlist_find(par_list, "images-out"));
+ kmclipm_priv_set_output_images(
+ !strcmp(cpl_parameter_get_string(temp_par), "TRUE"));
+ cpl_test_error(CPL_ERROR_NONE);
+
+ if ((argc == 1)
+ || (((argc > 1)
+ && ((argc > 1) && (strcmp(argv[1], "--no-gen") == 0)))
+ && (argc == 2)))
+ {
+ do_compare = 1;
+ }
+ if ((argc == 1) ||
+ (((argc > 1) &&
+ ((argc > 1) && (strcmp(argv[1], "--no-gen") == 0))) &&
+ (argc == 2)))
+ {
+ do_compare = 1;
+ }
+
+ cpl_msg_info("RTD test", "Finished initialisation.");
+ cpl_msg_info("RTD test", "-------------------------------"
+ "-------------------------------");
+ cpl_msg_info("RTD test", " ");
+
+ /* ----- test kmclipm_rtd_image() (K-band) -------------------------------*/
+ test_pars.actual_img = actual_img;
+ test_pars.additional_img = additional_img;
+ test_pars.ifu_id = (int*)ifu_id;
+ test_pars.nominal_pos = (double*)nominal_pos;
+ test_pars.do_compare = do_compare;
+
+ sprintf(test_pars.actual_img_type, actual_img_type);
+ sprintf(test_pars.additional_img_path, additional_img_path);
+ sprintf(test_pars.additional_img_type, additional_img_type);
+
+ test_kmclipm_rtd_image();
+ sprintf(test_pars.additional_img_path, "NOT_AVAILABLE");
+ sprintf(test_pars.additional_img_type, "NOT_AVAILABLE");
+
+ test_kmclipm_rtd_image();
+
+ /* ----- test kmclipm_rtd_image() (sky only) -------------------------*/
+ sprintf(test_pars.additional_img_path, additional_img_path);
+ sprintf(test_pars.additional_img_type, "SKY");
+
+ test_kmclipm_rtd_image_sky();
+
+ /* ----- test kmclipm_rtd_image_from_files() (H-band) --------------------*/
+ sprintf(test_pars.actual_img_path, raw_obj_pathH);
+ sprintf(test_pars.additional_img_path, raw_sky_pathH);
+
+ test_kmclipm_rtd_image_from_files();
+
+ /* ----- test kmclipm_rtd_image_from_memory() (K-band) -------------------*/
+ sprintf(test_pars.actual_img_path, raw_obj_path);
+ sprintf(test_pars.additional_img_path, raw_sky_path);
+ cpl_test_nonnull(additional_img =
+ kmclipm_load_image_with_extensions(additional_img_path));
+ cpl_test_error(CPL_ERROR_NONE);
+
+ test_pars.actual_img = actual_img;
+ test_pars.additional_img = additional_img;
+ sprintf(test_pars.actual_img_type, actual_img_type);
+ sprintf(test_pars.additional_img_type, additional_img_type);
+
+ test_kmclipm_rtd_image_from_memory();
+
+
+ cpl_image_delete(additional_img); additional_img = NULL;
+ additional_img = NULL;
+ test_pars.additional_img = additional_img;
+ sprintf(test_pars.additional_img_type, "NOT_AVAILABLE");
+
+ test_kmclipm_rtd_image_from_memory();
+
+ /* ----- test kmclipm_rtd_img() with wrong values --------------------*/
+
+ test_kmclipm_rtd_image_error();
+
+/*----------------- Free memory & return ----------------------------*/
+ cpl_image_delete(actual_img); actual_img = NULL;
+ cpl_parameterlist_delete(par_list); par_list = NULL;
+ kmclipm_priv_reconstruct_nnlut_reset_tables();
+
+ cpl_msg_info("","All tests done.");
+ cpl_msg_set_level(CPL_MSG_WARNING);
+
+/*----------------- Copy cal-files to ../data --------------------------------*/
+/* Needed for packaging build on IWS */
+/* 1) rename cal-file in order to sed it
+ 2) replace the complete line containing the DATE keyword
+ (can't override this in CPL)
+ 3) copy it to kmclipm/data
+ 4) gzip it, ready to use for IWS */
+
+ if (data_is_dir) {
+ char *srcdir = ".";
+ char *cmd;
+ cmd = cpl_sprintf("cd %s/test_data;"
+ "mv raw_image_obj.fits fff;"
+ "sed \"s/DATE = '.\\{69\\}/DATE = '1111-11-11T11:11:11' \\/ file creation date (YYYY-MM-DDThh:mm:ss UT) /\" fff > raw_image_obj.fits;"
+ "cp raw_image_obj.fits ../../data;"
+ "gzip -fn ../../data/raw_image_obj.fits", srcdir);
+ system(cmd);
+ cpl_free(cmd);
+ cmd = cpl_sprintf("cd %s/test_data;"
+ "mv raw_image_sky.fits fff;"
+ "sed \"s/DATE = '.\\{69\\}/DATE = '1111-11-11T11:11:11' \\/ file creation date (YYYY-MM-DDThh:mm:ss UT) /\" fff > raw_image_sky.fits;"
+ "cp raw_image_sky.fits ../../data;"
+ "gzip -fn ../../data/raw_image_sky.fits", srcdir);
+ system(cmd);
+ cpl_free(cmd);
+ cmd = cpl_sprintf("cd %s/test_data;"
+ "mv raw_image_obj_only.fits fff;"
+ "sed \"s/DATE = '.\\{69\\}/DATE = '1111-11-11T11:11:11' \\/ file creation date (YYYY-MM-DDThh:mm:ss UT) /\" fff > raw_image_obj_only.fits;"
+ "cp raw_image_obj_only.fits ../../data;"
+ "gzip -fn ../../data/raw_image_obj_only.fits", srcdir);
+ system(cmd);
+ cpl_free(cmd);
+ cmd = cpl_sprintf("cd %s/test_data;"
+ "mv raw_image_sky_only.fits fff;"
+ "sed \"s/DATE = '.\\{69\\}/DATE = '1111-11-11T11:11:11' \\/ file creation date (YYYY-MM-DDThh:mm:ss UT) /\" fff > raw_image_sky_only.fits;"
+ "cp raw_image_sky_only.fits ../../data;"
+ "gzip -fn ../../data/raw_image_sky_only.fits", srcdir);
+ system(cmd);
+ cpl_free(cmd);
+ cmd = cpl_sprintf("cd %s/test_data/test;"
+ "mv kmos_wave_band.fits fff;"
+ "sed \"s/DATE = '.\\{69\\}/DATE = '1111-11-11T11:11:11' \\/ file creation date (YYYY-MM-DDThh:mm:ss UT) /\" fff > kmos_wave_band.fits;"
+ "cp kmos_wave_band.fits ../../../data;"
+ "gzip -fn ../../../data/kmos_wave_band.fits", srcdir);
+ system(cmd);
+ cpl_free(cmd);
+ cmd = cpl_sprintf("cd %s/test_data/test;"
+ "mv xcal_test.fits fff;"
+ "sed \"s/DATE = '.\\{69\\}/DATE = '1111-11-11T11:11:11' \\/ file creation date (YYYY-MM-DDThh:mm:ss UT) /\" fff > xcal_test.fits;"
+ "cp xcal_test.fits ../../../data;"
+ "gzip -fn ../../../data/xcal_test.fits", srcdir);
+ system(cmd);
+ cpl_free(cmd);
+ cmd = cpl_sprintf("cd %s/test_data/test;"
+ "mv ycal_test.fits fff;"
+ "sed \"s/DATE = '.\\{69\\}/DATE = '1111-11-11T11:11:11' \\/ file creation date (YYYY-MM-DDThh:mm:ss UT) /\" fff > ycal_test.fits;"
+ "cp ycal_test.fits ../../../data;"
+ "gzip -fn ../../../data/ycal_test.fits", srcdir);
+ system(cmd);
+ cpl_free(cmd);
+ cmd = cpl_sprintf("cd %s/test_data/test;"
+ "mv lcal_test.fits fff;"
+ "sed \"s/DATE = '.\\{69\\}/DATE = '1111-11-11T11:11:11' \\/ file creation date (YYYY-MM-DDThh:mm:ss UT) /\" fff > lcal_test.fits;"
+ "cp lcal_test.fits ../../../data;"
+ "gzip -fn ../../../data/lcal_test.fits", srcdir);
+ system(cmd);
+ cpl_free(cmd);
+ }
+
+ cpl_free(raw_obj_path);
+ cpl_free(raw_sky_path);
+ cpl_free(raw_obj_pathH);
+ cpl_free(raw_sky_pathH);
+
+ return cpl_test_end(0);
+}
+
+/*-----------------------------------------------------------------------------
+ Implementation kmclipm_testlib_parser
+ -----------------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAXLINELENGTH 2048
+const char ESCAPECHAR = '\\';
+const char ESCAPES[2][5] = {
+ "0nrt",
+ "\0\n\r\t"
+};
+
+/*
+ * check whether a character is a space character
+ */
+bool kmclipm_testlib_parser_is_space_char(char c) {
+ return c <= ' ';
+}
+
+/*
+ * check whether a character is introducing an escape code
+ */
+bool kmclipm_testlib_parser_is_escape_char(char c) {
+ return (c == ESCAPECHAR);
+}
+
+/*
+ * to an escape code, return the corresponding escape char
+ */
+char kmclipm_testlib_parser_escape(char c) {
+ int n = 0;
+ for (; ESCAPES[0][n] != '\0'; n++) {
+ if (ESCAPES[0][n] == c)
+ return ESCAPES[1][n];
+ }
+ return c;
+}
+
+/*
+ * check whether a character is present in a string
+ */
+bool kmclipm_testlib_parser_is_char_in_str(char c, const char *str) {
+ int n = 0;
+ while (str[n] != '\0') {
+ if (c == str[n])
+ return true;
+ n++;
+ }
+ return false;
+}
+
+/*
+ * check whether a character is NOT an end of line
+ */
+bool kmclipm_testlib_parser_neol(FILE *f, char c){
+ return (!feof(f) && c != '\n');
+}
+
+/*
+ * compare two strings while ignoring cases
+ */
+int kmclipm_testlib_parser_strcasecmp(const char *s1, const char *s2) {
+ while ((*s1 != '\0' && *s2 != '\0')
+ && (tolower(*(unsigned char *) s1) ==
+ tolower(*(unsigned char *) s2))) {
+ s1++;
+ s2++;
+ }
+ return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2);
+}
+
+/*----------------------------------------------------------------------------*/
+/*
+ * read a line from a stream
+ *
+ * It reads up to the next newline character, and omits return characters.
+ *
+ * The character array must be at least one char bigger than the specified
+ * maximum length, to allow the terminating 0 to be written.
+ *
+ * Returns:
+ * Length of line if successful,
+ * NEGATIVE length of line if maximal length was overflown
+ */
+/*----------------------------------------------------------------------------*/
+int kmclipm_testlib_parser_readline(FILE *f, char *str, int maxlength) {
+ int length = 0;
+ char c = 0;
+ int success = 1;
+
+ if (kmclipm_testlib_parser_neol(f, c))
+ c = fgetc(f);
+ while (kmclipm_testlib_parser_neol(f, c)) {
+ if (c != '\r') {
+ if (length < maxlength)
+ str[length++] = c;
+ else
+ success = -1;
+ }
+ c = fgetc(f);
+ }
+ str[length] = '\0';
+
+ return success * length;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+ @brief This is an internal function of kmclipm/test, which is only mentioned
+ for documentation. It extracts string tokens from a line string.
+ @param line Line string.
+ @param operators A string containing characters that will be interpreted
+ as non-text and will thus create new tokens. Contiguous
+ characters are stored as one operator token.
+ @param separators A string containing characters that will also be
+ interpreted as non-text and will thus create new tokens.
+ Every separator character is stored in a single token.
+ @param commentchar Character indicating that the rest of the line is a
+ comment, which will not be parsed.
+ @param use_comment Future-planned flag indicating whether a comment shall
+ be used for the recorded parameter
+ @param grouping Future-planned string containing character pairs which
+ indicate the starts and ends of a character group
+ @return A list of properties containing the string tokens. Each property will
+ contain the token as its value. The name of each property will be
+ either "TXT" indicating text, "OPR" indicating an operator, or "SEP"
+ indicating that it contains a separator
+
+ This function parses a line string for space-separated sub-strings, called
+ tokens. Additional operator and separator characters can be specified, which
+ will be stored in own tokens. There are three types of tokens, text, operator
+ and separator tokens, indicated by their respective property names.
+
+ Double-quoted parts in the input line string are regarded as text as-is.
+
+ Escape sequences are recognized and after substitution regarded as text. The
+ following special escape sequences are known so far:\n
+ - \\n newline character
+ - \\r return character
+ - \\t tabulator
+
+ All other characters can be escaped as-well, forcing them to be interpreted
+ as text.\n
+ Operators, separators, comment characters, quotes and the escape character
+ should all be different! If not, the priority of interpretation is:
+ -# Escape character
+ -# Quotes
+ -# Comment character
+ -# Separators
+ -# Operators
+
+ An example of usage is given below:
+ @code
+ const char *operators = "=";
+ const char *separators = ";";
+ linetokens = kmclipm_testlib_parser_extract_line_tokens(line, operators, separators, '#');
+ @endcode
+*/
+/*----------------------------------------------------------------------------*/
+cpl_propertylist *kmclipm_testlib_parser_extract_line_tokens( const char *line,
+ const char *operators,
+ const char *separators,
+ const char commentchar) {
+ char *temp, c;
+ int pos, t = 0, length;
+ bool quotes = false,
+ was_escaped = false,
+ last_was_textchar = false,
+ last_was_operator = false,
+ last_was_separator = false,
+ is_text_char,
+ is_operator,
+ is_separator,
+ force_text,
+ stop = false;
+ cpl_propertylist *tokens = cpl_propertylist_new();
+
+ #define ADD_TOKEN(string, name) { \
+ temp[t] = '\0'; \
+ cpl_propertylist_append_string(tokens, name, string); \
+ t = 0; \
+ }
+ #define ADD_TOKEN_SEP(string) ADD_TOKEN(string, "SEP");
+ #define ADD_TOKEN_OPR(string) ADD_TOKEN(string, "OPR");
+ #define ADD_TOKEN_TXT(string) ADD_TOKEN(string, "TXT");
+
+ /* get length of line and allocate a temp char buffer of same length (+1) */
+ for (length=0; line[length] != '\0'; length++) ;
+ temp = (char*)malloc((length+1) * sizeof(char));
+
+ pos=0;
+ while (pos < length && kmclipm_testlib_parser_is_space_char(line[pos]))
+ pos++;
+
+ while (!stop) {
+ c = line[pos++];
+ if (c == '\"') { /* toggle quotes, the nearly uppest level operator */
+ quotes = !quotes;
+ /* treat quote content always as text (also empty quotes) */
+ if (quotes) {
+ /* if not already, then begin a text string here */
+ last_was_textchar = true;
+
+ /* terminate all strings that are not text strings */
+ if (last_was_operator) {
+ ADD_TOKEN_OPR(temp);
+ last_was_operator = false;
+ }
+ if (last_was_separator) {
+ ADD_TOKEN_SEP(temp);
+ last_was_separator = false;
+ }
+ }
+ }
+ else {
+ was_escaped = false;
+ if (kmclipm_testlib_parser_is_escape_char(c)) {
+ c = line[pos++];
+ if (c != '\0') { /* avoid line end problems after a '\' */
+ was_escaped = true;
+ }
+ c = kmclipm_testlib_parser_escape(c);
+ }
+ force_text = quotes ||
+ was_escaped;
+ stop = ( (c == '\0' && !was_escaped) ||
+ (c == commentchar && !force_text));
+ is_separator = !stop &&
+ kmclipm_testlib_parser_is_char_in_str(c, separators) &&
+ !force_text;
+ is_operator = !stop &&
+ !is_separator &&
+ kmclipm_testlib_parser_is_char_in_str(c, operators) &&
+ !force_text;
+ is_text_char = !stop &&
+ !is_separator &&
+ !is_operator &&
+ ( !kmclipm_testlib_parser_is_space_char(c) ||
+ force_text);
+ /* if last was a (single) separator character */
+ if (last_was_separator) /**/
+ ADD_TOKEN_SEP(temp);
+ /* if end of text/operator/etc. string is reached */
+ if (!is_operator && last_was_operator)
+ ADD_TOKEN_OPR(temp);
+ if (!is_text_char && last_was_textchar)
+ ADD_TOKEN_TXT(temp);
+
+ if (is_separator || is_text_char || is_operator)
+ temp[t++] = c; /* copy text into temp string */
+
+ last_was_operator = is_operator;
+ last_was_separator = is_separator;
+ last_was_textchar = is_text_char;
+ }
+ }
+
+ free(temp);
+ return tokens;
+}
+
+/*
+ * The following function is still not error safe
+ *
+ * */
+
+void kmclipm_testlib_parser_store_parameter( cpl_parameterlist *parlist,
+ const char *name,
+ const char *description,
+ const char *context,
+ const char *value) {
+ cpl_parameter *par;
+ cpl_type T;
+
+ if ((par = cpl_parameterlist_find(parlist, name)) == 0) {
+ par = cpl_parameter_new_value(
+ name,
+ CPL_TYPE_STRING,
+ description,
+ context,
+ value);
+ cpl_parameterlist_append(parlist, par);
+ cpl_msg_debug(context, "string %s = %s", name, value);
+ }
+ else {
+ if ((T = cpl_parameter_get_type(par)) == CPL_TYPE_BOOL) {
+ cpl_parameter_set_bool(par,
+ (atoi(value) > 0) ||
+ (kmclipm_testlib_parser_strcasecmp(value, "yes") == 0) ||
+ (kmclipm_testlib_parser_strcasecmp(value, "true") == 0)
+ );
+ cpl_msg_debug(context, "bool %s = %d", name, cpl_parameter_get_bool(par));
+ }
+ else if (T == CPL_TYPE_INT) {
+ cpl_parameter_set_int(par, atoi(value));
+ cpl_msg_debug(context, "int %s = %d", name, cpl_parameter_get_int(par));
+ }
+ else if (T == CPL_TYPE_DOUBLE) {
+ cpl_parameter_set_double(par, atof(value));
+ cpl_msg_debug(context, "double %s = %g", name, cpl_parameter_get_double(par));
+ }
+ else if (T == CPL_TYPE_STRING) {
+ cpl_parameter_set_string(par, value);
+ cpl_msg_debug(context, "string %s = %s", name, value);
+ }
+ }
+
+ /* mark the parameter as present */
+ cpl_parameter_set_default_flag(par, 1);
+
+}
+
+/*----------------------------------------------------------------------------*/
+/*
+ * Parse a configuration file line by line. Syntax:
+ * variablename = value
+ * Bad syntax errors are not caught so far, like non-text characters in
+ * variable names.
+ *
+ *
+ * TO DO:
+ * - implement escape characters: done
+ * - built-in commands, like "include" to include other files
+ * - expand variables
+ * - switch to allow escaped/quoted variable names
+ */
+/*----------------------------------------------------------------------------*/
+cpl_parameterlist *kmclipm_testlib_parser_import_configfile( const char *filename,
+ cpl_parameterlist *append_list) {
+ FILE *configfile;
+ cpl_parameterlist *pars = 0;
+ cpl_propertylist *linetokens;
+ cpl_property *token;
+ char line[MAXLINELENGTH+1];
+ char par_name[MAXLINELENGTH+1];
+ char par_value[MAXLINELENGTH+1];
+ int t, nrtokens;
+ const char *component = filename;
+ const char *operators = "=";
+ const char *separators = ";";
+ bool is_value, append;
+
+ if ((configfile = fopen(filename, "rb")) == 0) {
+ cpl_msg_error(component, "Could not open file for reading.\n");
+ cpl_error_set(component, CPL_ERROR_FILE_NOT_FOUND);
+ return 0;
+ }
+
+ append = (append_list != 0);
+ if (!append)
+ pars = cpl_parameterlist_new();
+ else
+ pars = append_list;
+
+ while (!feof(configfile) && cpl_error_get_code() == CPL_ERROR_NONE) {
+ if (kmclipm_testlib_parser_readline(configfile, line, MAXLINELENGTH) < 0) {
+ cpl_msg_error(component, "Maximum line length (%d) exceeded.\n", MAXLINELENGTH);
+ cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT);
+ break;
+ };
+
+ linetokens = kmclipm_testlib_parser_extract_line_tokens(line, operators, separators, '#');
+
+ par_name[0] = '\0';
+ par_value[0] = '\0';
+ is_value = false;
+ nrtokens = cpl_propertylist_get_size(linetokens);
+ for (t = 0; t < nrtokens; t++) {
+ token = cpl_propertylist_get(linetokens, t);
+ if (strcmp(cpl_property_get_name(token), "SEP") == 0){
+ if (strcmp(cpl_property_get_string(token), ";") == 0) {
+ if (is_value)
+ kmclipm_testlib_parser_store_parameter(pars, par_name, "", filename, par_value);
+
+ /* reset interpreting (terminate strings) */
+ par_name[0] = '\0';
+ par_value[0] = '\0';
+ is_value = false;
+ }
+ }
+ else {
+ if (is_value) {
+ if (strcmp(cpl_property_get_name(token), "TXT") == 0) {
+ if (par_value[0] == '\0')
+ strcpy(par_value, cpl_property_get_string(token));
+ else {
+ strcat(par_value, " ");
+ strcat(par_value, cpl_property_get_string(token));
+ }
+ }
+ }
+ else {
+ if (strcmp(cpl_property_get_name(token), "OPR") == 0) {
+ if (strcmp(cpl_property_get_string(token), "=") == 0) {
+ is_value = true;
+ } else {
+ cpl_msg_error(component, "Unknown operator in configuration-file: \"%s\"\n", cpl_property_get_string(token));
+ cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT);
+ break;
+ }
+ } else if (par_name[0] == '\0') {
+ strcpy(par_name, cpl_property_get_string(token));
+ } else {
+ if (strcmp(par_name, "include") == 0) {
+ kmclipm_testlib_parser_import_configfile(cpl_property_get_string(token), pars);
+ }
+ else {
+ cpl_msg_error(component, "Unknown command in configuration-file: \"%s\"\n", par_name);
+ cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT);
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (is_value && cpl_error_get_code() == CPL_ERROR_NONE)
+ kmclipm_testlib_parser_store_parameter(pars, par_name, "", filename, par_value);
+ cpl_propertylist_delete(linetokens);
+ }
+
+ if (cpl_error_get_code() != CPL_ERROR_NONE) {
+ if (!append) {
+ cpl_parameterlist_delete(pars);
+ pars = 0;
+ }
+ cpl_msg_error(cpl_error_get_file(), "%s", cpl_error_get_message());
+ }
+
+ fclose(configfile);
+
+ return pars;
+}
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+/** @} */
diff --git a/kmclipm/test/kmclipm_test_vector.c b/kmclipm/test/kmclipm_test_vector.c
new file mode 100644
index 0000000..2b739a6
--- /dev/null
+++ b/kmclipm/test/kmclipm_test_vector.c
@@ -0,0 +1,1738 @@
+/*********************************************************************
+ * E.S.O. - VLT project
+ *
+ * "@(#) $Id: kmclipm_test_vector.c,v 1.12 2013-10-08 11:12:02 aagudo Exp $"
+ *
+ * Tests for functions in src/kmclipm_functions.c/.h
+ *
+ * who when what
+ * -------- ---------- ----------------------------------------------
+ * aagudo 2008-06-16 created
+ */
+
+/**
+ @defgroup kmclipm_test_functions Unit tests for the functions in kmclipm_vector
+
+ Unit test for the functions in the module @ref kmclipm_vector
+
+ @{
+*/
+
+/*------------------------------------------------------------------------------
+ * Includes
+ *----------------------------------------------------------------------------*/
+#define _ISOC99_SOURCE
+
+#include <math.h>
+#include <sys/stat.h>
+
+#include "kmclipm_vector.h"
+#include "kmclipm_math.h"
+
+cpl_msg_severity my_level= CPL_MSG_INFO;
+
+/*------------------------------------------------------------------------------
+ * Implementation
+ *----------------------------------------------------------------------------*/
+
+void test_kmclipm_vector_new()
+{
+ cpl_test_null(kmclipm_vector_new(0));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_new(5));
+ cpl_test_eq(5, cpl_vector_get_size(kv->data));
+ cpl_test_eq(5, cpl_vector_get_size(kv->mask));
+ cpl_test_eq(0, cpl_vector_get_mean(kv->data));
+ cpl_test_eq(1, cpl_vector_get_mean(kv->mask));
+
+ kmclipm_vector_delete(kv);
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_create()
+{
+ cpl_test_null(kmclipm_vector_create(NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_fill(v, 2);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ cpl_test_eq(5, cpl_vector_get_size(kv->data));
+ cpl_test_eq(5, cpl_vector_get_size(kv->mask));
+ cpl_test_eq(2, cpl_vector_get_mean(kv->data));
+ cpl_test_eq(1, cpl_vector_get_mean(kv->mask));
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ cpl_test_eq(5, cpl_vector_get_size(kv->data));
+ cpl_test_eq(5, cpl_vector_get_size(kv->mask));
+ cpl_test_eq(1, isnan(cpl_vector_get_mean(kv->data)));
+ cpl_test_abs(4./5., cpl_vector_get_mean(kv->mask), 0.01);
+ kmclipm_vector_delete(kv);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ cpl_test_eq(5, cpl_vector_get_size(kv->data));
+ cpl_test_eq(5, cpl_vector_get_size(kv->mask));
+ cpl_test_eq(1, isnan(cpl_vector_get_mean(kv->data)));
+ cpl_test_abs(0., cpl_vector_get_mean(kv->mask), 0.01);
+ kmclipm_vector_delete(kv);
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_create2()
+{
+ cpl_test_null(kmclipm_vector_create2(NULL, NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *d = cpl_vector_new(5);
+ cpl_vector_set(d, 0, 1);
+ cpl_vector_set(d, 1, 2);
+ cpl_vector_set(d, 2, 3);
+ cpl_vector_set(d, 3, 4);
+ cpl_vector_set(d, 4, 5);
+ cpl_test_null(kmclipm_vector_create2(d, NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *m = cpl_vector_new(2);
+ cpl_test_null(kmclipm_vector_create2(d, m));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_vector_delete(m);
+
+ m = cpl_vector_new(5);
+ cpl_vector_set(m, 0, 0);
+ cpl_vector_set(m, 1, 1);
+ cpl_vector_set(m, 2, 5);
+ cpl_vector_set(m, 3, -7);
+ cpl_vector_set(m, 4, 1);
+
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create2(d, m));
+ cpl_test_eq(5, cpl_vector_get_size(kv->data));
+ cpl_test_eq(5, cpl_vector_get_size(kv->mask));
+ cpl_test_abs(3.333, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_abs(3./5., cpl_vector_get_mean(kv->mask), 0.01);
+
+ kmclipm_vector_delete(kv);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ d = cpl_vector_new(5);
+ cpl_vector_set(d, 0, 1);
+ cpl_vector_set(d, 1, NAN);
+ cpl_vector_set(d, 2, 3);
+ cpl_vector_set(d, 3, 4);
+ cpl_vector_set(d, 4, 5);
+ m = cpl_vector_new(5);
+ cpl_vector_set(m, 0, 0);
+ cpl_vector_set(m, 1, 1);
+ cpl_vector_set(m, 2, NAN);
+ cpl_vector_set(m, 3, -7);
+ cpl_vector_set(m, 4, 1);
+
+ cpl_test_nonnull(kv = kmclipm_vector_create2(d, m));
+ cpl_test_eq(5, cpl_vector_get_size(kv->data));
+ cpl_test_eq(5, cpl_vector_get_size(kv->mask));
+ cpl_test_eq(5, kmclipm_vector_get_mean(kv));
+ cpl_test_abs(1./5., cpl_vector_get_mean(kv->mask), 0.01);
+ cpl_test_abs(3, cpl_vector_get(kv->data,2), 0.01);
+ cpl_test_eq(0, cpl_vector_get(kv->mask,2));
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv);
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_delete()
+{
+ kmclipm_vector_delete(NULL);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector *kv = kmclipm_vector_new(5);
+ kmclipm_vector_delete(kv);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ kmclipm_vector_delete(kv);
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_duplicate()
+{
+ cpl_test_null(kmclipm_vector_duplicate(NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL, *kv2 = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_nonnull(kv2 = kmclipm_vector_duplicate(kv));
+ cpl_test_abs(3, kmclipm_vector_get_mean(kv2), 0.01);
+ cpl_test_abs(4./5., cpl_vector_get_mean(kv2->mask), 0.01);
+ kmclipm_vector_delete(kv); kv = NULL;
+ kmclipm_vector_delete(kv2); kv2 = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_nonnull(kv2 = kmclipm_vector_duplicate(kv));
+ cpl_test_abs(0, kmclipm_vector_get_mean(kv2), 0.01);
+ cpl_test_abs(0., cpl_vector_get_mean(kv2->mask), 0.01);
+ kmclipm_vector_delete(kv); kv = NULL;
+ kmclipm_vector_delete(kv2); kv2 = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_set()
+{
+ kmclipm_vector_set(NULL, -1, 0);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ kmclipm_vector_set(kv, -1, 0);
+ cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE);
+
+ kmclipm_vector_set(kv, 0, 0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(11./4., kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_abs(4./5., cpl_vector_get_mean(kv->mask), 0.01);
+
+ kmclipm_vector_set(kv, 0, 1./0.);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(11./3., kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_abs(3./5., cpl_vector_get_mean(kv->mask), 0.01);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ kmclipm_vector_set(kv, 0, 1);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(1., kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_abs(1./5., cpl_vector_get_mean(kv->mask), 0.01);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_get()
+{
+ cpl_test_abs(0, kmclipm_vector_get(NULL, -1, NULL), 0.01);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(0, kmclipm_vector_get(kv, -1, NULL), 0.01);
+ cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE);
+
+ cpl_test_abs(1, kmclipm_vector_get(kv, 0, NULL), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ int rej = 0;
+ cpl_test_abs(2, kmclipm_vector_get(kv, 1, &rej), 0.01);
+ cpl_test_eq(0, rej);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(1, isnan(kmclipm_vector_get(kv, 2, &rej)));
+ cpl_test_eq(1, rej);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_eq(1, isnan(kmclipm_vector_get(kv, 0, NULL)));
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_get_mask()
+{
+ cpl_test_null(kmclipm_vector_get_mask(NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_vector *mask = NULL;
+ cpl_test_nonnull(mask = kmclipm_vector_get_mask(kv));
+ cpl_test_abs(4./5., cpl_vector_get_mean(mask), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_vector_delete(mask); mask = NULL;
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_nonnull(mask = kmclipm_vector_get_mask(kv));
+ cpl_test_abs(0., cpl_vector_get_mean(mask), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_vector_delete(mask); mask = NULL;
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_get_bpm()
+{
+ cpl_test_null(kmclipm_vector_get_bpm(NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_vector *mask = NULL;
+ cpl_test_nonnull(mask = kmclipm_vector_get_bpm(kv));
+ cpl_test_abs(4./5., cpl_vector_get_mean(mask), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_nonnull(mask = kmclipm_vector_get_bpm(kv));
+ cpl_test_abs(0., cpl_vector_get_mean(mask), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_reject_from_mask() {
+ kmclipm_vector_reject_from_mask(NULL, NULL, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ kmclipm_vector_reject_from_mask(kv, NULL, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *mask = cpl_vector_new(4);
+ kmclipm_vector_reject_from_mask(kv, mask, -1);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_vector_delete(mask); mask = NULL;
+
+ mask = cpl_vector_new(5);
+ cpl_vector_set(mask, 0, 1);
+ cpl_vector_set(mask, 1, 0);
+ cpl_vector_set(mask, 2, 1);
+ cpl_vector_set(mask, 3, 1);
+ cpl_vector_set(mask, 4, 1);
+
+ kmclipm_vector_reject_from_mask(kv, mask, -1);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ kmclipm_vector_reject_from_mask(kv, mask, TRUE);
+ cpl_test_abs(10./3., kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_vector_set(mask, 0, 1);
+ cpl_vector_set(mask, 1, 1);
+ cpl_vector_set(mask, 2, 0);
+ cpl_vector_set(mask, 3, 0);
+ cpl_vector_set(mask, 4, 1);
+
+ kmclipm_vector_reject_from_mask(kv, mask, FALSE);
+ cpl_test_abs(8./3., kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_vector_delete(mask); mask = NULL;
+ kmclipm_vector_delete(kv); kv = NULL;
+}
+
+void test_kmclipm_vector_count_rejected()
+{
+ cpl_test_eq(-1, kmclipm_vector_count_rejected(NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ cpl_test_eq(1, kmclipm_vector_count_rejected(kv));
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ cpl_test_eq(5, kmclipm_vector_count_rejected(kv));
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_count_non_rejected()
+{
+ cpl_test_eq(-1, kmclipm_vector_count_non_rejected(NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ cpl_test_eq(4, kmclipm_vector_count_non_rejected(kv));
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ cpl_test_eq(0, kmclipm_vector_count_non_rejected(kv));
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_adapt_rejected()
+{
+ kmclipm_vector_adapt_rejected(NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv1 = NULL, *kv2 = NULL;
+ cpl_test_nonnull(kv1 = kmclipm_vector_create(v));
+
+ kmclipm_vector_adapt_rejected(kv1, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v2 = cpl_vector_new(1);
+ cpl_vector_set(v2, 0, 1);
+ cpl_test_nonnull(kv2 = kmclipm_vector_create(v2));
+
+ kmclipm_vector_adapt_rejected(kv1, kv2);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ kmclipm_vector_delete(kv2); kv2 = NULL;
+
+ v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, NAN);
+ cpl_vector_set(v, 2, 3);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ cpl_test_nonnull(kv2 = kmclipm_vector_create(v));
+
+ cpl_test_abs(12, kmclipm_vector_get_sum(kv1), 0.01);
+ cpl_test_abs(13, kmclipm_vector_get_sum(kv2), 0.01);
+ kmclipm_vector_adapt_rejected(kv1, kv2);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(10, kmclipm_vector_get_sum(kv1), 0.01);
+ cpl_test_abs(10, kmclipm_vector_get_sum(kv2), 0.01);
+
+ kmclipm_vector_delete(kv1); kv1 = NULL;
+ kmclipm_vector_delete(kv2); kv2 = NULL;
+}
+
+void test_kmclipm_vector_is_rejected()
+{
+ cpl_test_eq(-1, kmclipm_vector_is_rejected(NULL, -1));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_eq(-1, kmclipm_vector_is_rejected(kv, -1));
+ cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE);
+ cpl_test_eq(-1, kmclipm_vector_is_rejected(kv, 5));
+ cpl_test_error(CPL_ERROR_ACCESS_OUT_OF_RANGE);
+
+ cpl_test_eq(0, kmclipm_vector_is_rejected(kv, 1));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(1, kmclipm_vector_is_rejected(kv, 2));
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ cpl_test_eq(1, kmclipm_vector_is_rejected(kv, 1));
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_reject()
+{
+ kmclipm_vector_reject(NULL, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ kmclipm_vector_reject(kv, -1);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ kmclipm_vector_reject(kv, 5);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_test_eq(2, cpl_vector_get(kv->data, 1));
+ cpl_test_eq(1, cpl_vector_get(kv->mask, 1));
+ kmclipm_vector_reject(kv, 1);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(2, cpl_vector_get(kv->data, 1));
+ cpl_test_eq(0, cpl_vector_get(kv->mask, 1));
+
+ cpl_test_eq(5, cpl_vector_get_size(kv->data));
+ cpl_test_eq(5, cpl_vector_get_size(kv->mask));
+ cpl_test_eq(3, kmclipm_vector_get_mean(kv));
+ cpl_test_abs(3./5., cpl_vector_get_mean(kv->mask), 0.01);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ kmclipm_vector_reject(kv, 1);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_extract()
+{
+ kmclipm_vector *kv_out = NULL;
+ cpl_test_null(kmclipm_vector_extract(NULL, 5, -1));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_null(kmclipm_vector_extract(kv, 5, -1));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_test_nonnull(kv_out = kmclipm_vector_extract(kv, 1, 3));
+ cpl_test_eq(3, kmclipm_vector_get_mean(kv_out));
+ cpl_test_eq(3, kmclipm_vector_get_size(kv_out));
+ kmclipm_vector_delete(kv); kv = NULL;
+ kmclipm_vector_delete(kv_out); kv_out = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_nonnull(kv_out = kmclipm_vector_extract(kv, 1, 3));
+ cpl_test_eq(0, kmclipm_vector_get_mean(kv_out));
+ cpl_test_eq(3, kmclipm_vector_get_size(kv_out));
+ kmclipm_vector_delete(kv); kv = NULL;
+ kmclipm_vector_delete(kv_out); kv_out = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_create_non_rejected()
+{
+ cpl_test_null(kmclipm_vector_create_non_rejected(NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_vector *out = NULL;
+ cpl_test_nonnull(out = kmclipm_vector_create_non_rejected(kv));
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_eq(4, cpl_vector_get_size(out));
+ cpl_test_abs(3, cpl_vector_get_mean(out), 0.01);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_vector_delete(out);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ cpl_test_null(out = kmclipm_vector_create_non_rejected(kv));
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_add()
+{
+ kmclipm_vector_add(NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv1 = NULL, *kv2 = NULL;
+ cpl_test_nonnull(kv1 = kmclipm_vector_create(v));
+
+ kmclipm_vector_add(kv1, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v2 = cpl_vector_new(1);
+ cpl_vector_set(v2, 0, 1);
+ cpl_test_nonnull(kv2 = kmclipm_vector_create(v2));
+
+ kmclipm_vector_add(kv1, kv2);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ kmclipm_vector_delete(kv2); kv2 = NULL;
+
+ v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, NAN);
+ cpl_vector_set(v, 2, 3);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ cpl_test_nonnull(kv2 = kmclipm_vector_create(v));
+
+ cpl_test_abs(12, kmclipm_vector_get_sum(kv1), 0.01);
+ cpl_test_abs(13, kmclipm_vector_get_sum(kv2), 0.01);
+ kmclipm_vector_add(kv1, kv2);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(20, kmclipm_vector_get_sum(kv1), 0.01);
+ cpl_test_abs(13, kmclipm_vector_get_sum(kv2), 0.01);
+
+ kmclipm_vector_delete(kv1); kv1 = NULL;
+ kmclipm_vector_delete(kv2); kv2 = NULL;
+}
+
+void test_kmclipm_vector_subtract()
+{
+ kmclipm_vector_subtract(NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv1 = NULL, *kv2 = NULL;
+ cpl_test_nonnull(kv1 = kmclipm_vector_create(v));
+
+ kmclipm_vector_subtract(kv1, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v2 = cpl_vector_new(1);
+ cpl_vector_set(v2, 0, 1);
+ cpl_test_nonnull(kv2 = kmclipm_vector_create(v2));
+
+ kmclipm_vector_subtract(kv1, kv2);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ kmclipm_vector_delete(kv2); kv2 = NULL;
+
+ v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, NAN);
+ cpl_vector_set(v, 2, 3);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ cpl_test_nonnull(kv2 = kmclipm_vector_create(v));
+
+ cpl_test_abs(12, kmclipm_vector_get_sum(kv1), 0.01);
+ cpl_test_abs(13, kmclipm_vector_get_sum(kv2), 0.01);
+ kmclipm_vector_subtract(kv1, kv2);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(0, kmclipm_vector_get_sum(kv1), 0.01);
+ cpl_test_abs(13, kmclipm_vector_get_sum(kv2), 0.01);
+
+ kmclipm_vector_delete(kv1); kv1 = NULL;
+ kmclipm_vector_delete(kv2); kv2 = NULL;
+}
+
+void test_kmclipm_vector_multiply()
+{
+ kmclipm_vector_multiply(NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv1 = NULL, *kv2 = NULL;
+ cpl_test_nonnull(kv1 = kmclipm_vector_create(v));
+
+ kmclipm_vector_multiply(kv1, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v2 = cpl_vector_new(1);
+ cpl_vector_set(v2, 0, 1);
+ cpl_test_nonnull(kv2 = kmclipm_vector_create(v2));
+
+ kmclipm_vector_multiply(kv1, kv2);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ kmclipm_vector_delete(kv2); kv2 = NULL;
+
+ v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, NAN);
+ cpl_vector_set(v, 2, 3);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ cpl_test_nonnull(kv2 = kmclipm_vector_create(v));
+
+ cpl_test_abs(12, kmclipm_vector_get_sum(kv1), 0.01);
+ cpl_test_abs(13, kmclipm_vector_get_sum(kv2), 0.01);
+ kmclipm_vector_multiply(kv1, kv2);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(42, kmclipm_vector_get_sum(kv1), 0.01);
+ cpl_test_abs(13, kmclipm_vector_get_sum(kv2), 0.01);
+
+ kmclipm_vector_delete(kv1); kv1 = NULL;
+ kmclipm_vector_delete(kv2); kv2 = NULL;
+}
+
+void test_kmclipm_vector_divide()
+{
+ kmclipm_vector_divide(NULL, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv1 = NULL, *kv2 = NULL;
+ cpl_test_nonnull(kv1 = kmclipm_vector_create(v));
+
+ kmclipm_vector_divide(kv1, NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v2 = cpl_vector_new(1);
+ cpl_vector_set(v2, 0, 1);
+ cpl_test_nonnull(kv2 = kmclipm_vector_create(v2));
+
+ kmclipm_vector_divide(kv1, kv2);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ kmclipm_vector_delete(kv2); kv2 = NULL;
+
+ v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, NAN);
+ cpl_vector_set(v, 2, 3);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ cpl_test_nonnull(kv2 = kmclipm_vector_create(v));
+
+ cpl_test_abs(12, kmclipm_vector_get_sum(kv1), 0.01);
+ cpl_test_abs(13, kmclipm_vector_get_sum(kv2), 0.01);
+ kmclipm_vector_divide(kv1, kv2);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(3, kmclipm_vector_get_sum(kv1), 0.01);
+ cpl_test_abs(13, kmclipm_vector_get_sum(kv2), 0.01);
+
+ kmclipm_vector_delete(kv1); kv1 = NULL;
+ kmclipm_vector_delete(kv2); kv2 = NULL;
+}
+
+void test_kmclipm_vector_add_scalar()
+{
+ kmclipm_vector_add_scalar(NULL, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(3, kmclipm_vector_get_mean(kv), 0.01);
+ kmclipm_vector_add_scalar(kv, -1);
+ cpl_test_abs(2, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_add_scalar(kv, 2);
+ cpl_test_abs(4, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_add_scalar(kv, NAN);
+ cpl_test_abs(0, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ kmclipm_vector_add_scalar(kv, 2);
+ cpl_test_abs(0, kmclipm_vector_get_mean(kv), 0.01);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_subtract_scalar()
+{
+ kmclipm_vector_subtract_scalar(NULL, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(3, kmclipm_vector_get_mean(kv), 0.01);
+ kmclipm_vector_subtract_scalar(kv, -1);
+ cpl_test_abs(4, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_subtract_scalar(kv, 2);
+ cpl_test_abs(2, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_subtract_scalar(kv, NAN);
+ cpl_test_abs(0, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ kmclipm_vector_subtract_scalar(kv, 2);
+ cpl_test_abs(0, kmclipm_vector_get_mean(kv), 0.01);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_multiply_scalar()
+{
+ kmclipm_vector_multiply_scalar(NULL, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(3, kmclipm_vector_get_mean(kv), 0.01);
+ kmclipm_vector_multiply_scalar(kv, -1);
+ cpl_test_abs(-3, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_multiply_scalar(kv, 2);
+ cpl_test_abs(-6, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_multiply_scalar(kv, NAN);
+ cpl_test_abs(0, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ kmclipm_vector_multiply_scalar(kv, 2);
+ cpl_test_abs(0, kmclipm_vector_get_mean(kv), 0.01);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_divide_scalar()
+{
+ kmclipm_vector_divide_scalar(NULL, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(3, kmclipm_vector_get_mean(kv), 0.01);
+ kmclipm_vector_divide_scalar(kv, -1);
+ cpl_test_abs(-3, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_divide_scalar(kv, 2);
+ cpl_test_abs(-1.5, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_divide_scalar(kv, NAN);
+ cpl_test_abs(0, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ kmclipm_vector_divide_scalar(kv, 2);
+ cpl_test_abs(0, kmclipm_vector_get_mean(kv), 0.01);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_abs()
+{
+ kmclipm_vector_abs(NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, -1);
+ cpl_vector_set(v, 1, -2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, -4);
+ cpl_vector_set(v, 4, -5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(-3, kmclipm_vector_get_mean(kv), 0.01);
+ kmclipm_vector_abs(kv);
+ cpl_test_abs(3, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ kmclipm_vector_abs(kv);
+ cpl_test_abs(0, kmclipm_vector_get_mean(kv), 0.01);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_get_size()
+{
+ cpl_test_eq(-1, kmclipm_vector_get_size(NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_eq(5, kmclipm_vector_get_size(kv));
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_eq(5, kmclipm_vector_get_size(kv));
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+}
+
+void test_kmclipm_vector_get_mean()
+{
+ cpl_test_abs(0., kmclipm_vector_get_mean(NULL), 0.01);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(3., kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(0., kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+}
+
+void test_kmclipm_vector_get_median()
+{
+ cpl_test_abs(0., kmclipm_vector_get_median(NULL, KMCLIPM_ARITHMETIC), 0.01);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ /* even size */
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 5);
+ cpl_vector_set(v, 1, 4);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 2);
+ cpl_vector_set(v, 4, 1);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(3., kmclipm_vector_get_median(kv, KMCLIPM_ARITHMETIC), 0.01);
+ cpl_test_abs(2., kmclipm_vector_get_median(kv, KMCLIPM_STATISTICAL), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ /* uneven size */
+ v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 5);
+ cpl_vector_set(v, 1, 4);
+ cpl_vector_set(v, 2, 3);
+ cpl_vector_set(v, 3, 2);
+ cpl_vector_set(v, 4, 1);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(3., kmclipm_vector_get_median(kv, KMCLIPM_ARITHMETIC), 0.01);
+ cpl_test_abs(3., kmclipm_vector_get_median(kv, KMCLIPM_STATISTICAL), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(0., kmclipm_vector_get_median(kv, KMCLIPM_ARITHMETIC), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_cut_percentian()
+{
+ cpl_test_null(kmclipm_vector_cut_percentian(NULL, -1.));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(10);
+ cpl_vector_set(v, 0, 10);
+ cpl_vector_set(v, 1, 8);
+ cpl_vector_set(v, 2, 7);
+ cpl_vector_set(v, 3, 6);
+ cpl_vector_set(v, 4, 5);
+ cpl_vector_set(v, 5, 4);
+ cpl_vector_set(v, 6, 3);
+ cpl_vector_set(v, 7, 2);
+ cpl_vector_set(v, 8, 1);
+ cpl_vector_set(v, 9, 9);
+ kmclipm_vector *kv = NULL,
+ *kvout = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_null(kmclipm_vector_cut_percentian(kv, -1.0));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_test_null(kmclipm_vector_cut_percentian(kv, 1.0));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_test_nonnull(kvout = kmclipm_vector_cut_percentian(kv, 0.0));
+ cpl_test_eq(10, kmclipm_vector_get_size(kvout));
+ cpl_test_abs(5.5, kmclipm_vector_get_mean(kvout), 0.01);
+ kmclipm_vector_delete(kvout); kvout = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_test_nonnull(kvout = kmclipm_vector_cut_percentian(kv, 0.1));
+ cpl_test_eq(9, kmclipm_vector_get_size(kvout));
+ cpl_test_abs(5.0, kmclipm_vector_get_mean(kvout), 0.01);
+ kmclipm_vector_delete(kvout); kvout = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_test_nonnull(kvout = kmclipm_vector_cut_percentian(kv, 0.25));
+ cpl_test_eq(7, kmclipm_vector_get_size(kvout));
+ cpl_test_abs(4, kmclipm_vector_get_mean(kvout), 0.01);
+ kmclipm_vector_delete(kvout); kvout = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_test_nonnull(kvout = kmclipm_vector_cut_percentian(kv, 0.5));
+ cpl_test_eq(5, kmclipm_vector_get_size(kvout));
+ cpl_test_abs(3.0, kmclipm_vector_get_mean(kvout), 0.01);
+ kmclipm_vector_delete(kvout); kvout = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_test_nonnull(kvout = kmclipm_vector_cut_percentian(kv, 0.7));
+ cpl_test_eq(3, kmclipm_vector_get_size(kvout));
+ cpl_test_abs(2.0, kmclipm_vector_get_mean(kvout), 0.01);
+ kmclipm_vector_delete(kvout); kvout = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_get_sum()
+{
+ cpl_test_eq(0, kmclipm_vector_get_sum(NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_eq(12, kmclipm_vector_get_sum(kv));
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_delete(kv); kv = NULL;
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_eq(0, kmclipm_vector_get_sum(kv));
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_get_stdev()
+{
+ cpl_test_abs(-1, kmclipm_vector_get_stdev(NULL), 0.01);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(1.82574, kmclipm_vector_get_stdev(kv), 0.01);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ cpl_test_abs(0, kmclipm_vector_get_stdev(kv), 0.01);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_get_stdev_median()
+{
+ cpl_test_eq(-1, kmclipm_vector_get_stdev_median(NULL));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(1.82574, kmclipm_vector_get_stdev_median(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+ kmclipm_vector_delete(kv); kv = NULL;
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_eq(-1, kmclipm_vector_get_stdev_median(kv));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_get_max()
+{
+ cpl_test_abs(0, kmclipm_vector_get_max(NULL, NULL), 0.01);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(5, kmclipm_vector_get_max(kv, NULL), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ int pos;
+ cpl_test_abs(5, kmclipm_vector_get_max(kv, &pos), 0.01);
+ cpl_test_eq(4, pos);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 6);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 0.5);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(6, kmclipm_vector_get_max(kv, &pos), 0.01);
+ cpl_test_eq(0, pos);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ cpl_test_abs(0, kmclipm_vector_get_max(kv, &pos), 0.01);
+ cpl_test_eq(-1, pos);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_get_min()
+{
+ cpl_test_abs(0, kmclipm_vector_get_min(NULL, NULL), 0.01);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(1, kmclipm_vector_get_min(kv, NULL), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ int pos;
+ cpl_test_abs(1, kmclipm_vector_get_min(kv, &pos), 0.01);
+ cpl_test_eq(0, pos);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 0.5);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(0.5, kmclipm_vector_get_min(kv, &pos), 0.01);
+ cpl_test_eq(4, pos);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ cpl_test_abs(0, kmclipm_vector_get_min(kv, &pos), 0.01);
+ cpl_test_eq(-1, pos);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_power()
+{
+ kmclipm_vector_power(NULL, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(3., kmclipm_vector_get_mean(kv), 0.01);
+ kmclipm_vector_power(kv, -1);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(0.4875, kmclipm_vector_get_mean(kv), 0.01);
+
+ kmclipm_vector_power(kv, 2);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(0.338125, kmclipm_vector_get_mean(kv), 0.01);
+
+ kmclipm_vector_power(kv, 0);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(1, kmclipm_vector_get_mean(kv), 0.01);
+
+ kmclipm_vector_power(kv, NAN);
+ cpl_test_error(CPL_ERROR_NONE);
+ cpl_test_abs(1, kmclipm_vector_get_mean(kv), 0.01);
+
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ kmclipm_vector_power(kv, 2);
+ cpl_test_abs(0., kmclipm_vector_get_mean(kv), 0.01);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, 0.);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ kmclipm_vector_power(kv, 2);
+ cpl_test_abs(0., kmclipm_vector_get_mean(kv), 0.01);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_fill()
+{
+ kmclipm_vector_fill(NULL, -1);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_abs(3., kmclipm_vector_get_mean(kv), 0.01);
+ kmclipm_vector_fill(kv, -1);
+ cpl_test_abs(-1, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_fill(kv, NAN);
+ cpl_test_abs(0, kmclipm_vector_get_mean(kv), 0.01);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_flip()
+{
+ kmclipm_vector_flip(NULL);
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ kmclipm_vector_flip(kv);
+ cpl_test_abs(cpl_vector_get(kv->data, 0), 5, 0.01);
+ cpl_test_abs(cpl_vector_get(kv->data, 1), 4, 0.01);
+ cpl_test_abs(cpl_vector_get(kv->mask, 2), 0, 0.01);
+ cpl_test_abs(cpl_vector_get(kv->mask, 1), 1, 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv);
+}
+
+void test_kmclipm_vector_histogram()
+{
+ kmclipm_vector *out = NULL;
+
+ cpl_test_null(out = kmclipm_vector_histogram(NULL, -1.0));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_null(out = kmclipm_vector_histogram(kv, -1.0));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+
+ cpl_test_nonnull(out = kmclipm_vector_histogram(kv, 4));
+ cpl_test_eq(4, cpl_vector_get_size(out->data));
+ cpl_test_eq(2, cpl_vector_get(out->data, 0));
+ cpl_test_eq(0, cpl_vector_get(out->data, 1));
+ cpl_test_eq(1, cpl_vector_get(out->data, 2));
+ cpl_test_eq(1, cpl_vector_get(out->data, 3));
+ cpl_test_eq(1, cpl_vector_get_mean(out->mask));
+ kmclipm_vector_delete(out); out = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_test_nonnull(out = kmclipm_vector_histogram(kv, 2));
+ cpl_test_eq(2, cpl_vector_get_size(out->data));
+ cpl_test_eq(3, cpl_vector_get(out->data, 0));
+ cpl_test_eq(1, cpl_vector_get(out->data, 1));
+ cpl_test_eq(1, cpl_vector_get_mean(out->mask));
+ kmclipm_vector_delete(out); out = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv);
+
+ v = cpl_vector_new(8);
+ cpl_vector_set(v, 0, 1.5);
+ cpl_vector_set(v, 1, 0.5);
+ cpl_vector_set(v, 2, 0.0);
+ cpl_vector_set(v, 3, 1.0);
+ cpl_vector_set(v, 4, 2.0);
+ cpl_vector_set(v, 5, -1.0);
+ cpl_vector_set(v, 6, 3.0);
+ cpl_vector_set(v, 7, -2.1);
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ cpl_test_nonnull(out = kmclipm_vector_histogram(kv, 4));
+ cpl_test_eq(4, cpl_vector_get_size(out->data));
+ cpl_test_eq(2, cpl_vector_get(out->data, 0));
+ cpl_test_eq(3, cpl_vector_get(out->data, 1));
+ cpl_test_eq(2, cpl_vector_get(out->data, 2));
+ cpl_test_eq(1, cpl_vector_get(out->data, 3));
+ kmclipm_vector_delete(out); out = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_delete(kv);
+}
+
+void test_kmclipm_vector_load()
+{
+ char *my_path;
+
+ cpl_msg_set_level(CPL_MSG_OFF);
+ cpl_test_null(kmclipm_vector_load(NULL, -1));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ cpl_vector *v = cpl_vector_new(5);
+ cpl_vector_set(v, 0, 1);
+ cpl_vector_set(v, 1, 2);
+ cpl_vector_set(v, 2, NAN);
+ cpl_vector_set(v, 3, 4);
+ cpl_vector_set(v, 4, 5);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ my_path = cpl_sprintf("%s/test_data/ttt.fits", ".");
+ kmclipm_vector_save(kv, my_path, CPL_BPP_IEEE_DOUBLE, NULL, CPL_IO_CREATE, NAN);
+ cpl_free(my_path);
+ kmclipm_vector_delete(kv); kv = NULL;
+
+ v = cpl_vector_new(5);
+ cpl_vector_fill(v, NAN);
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+ my_path = cpl_sprintf("%s/test_data/ttt2.fits", ".");
+ kmclipm_vector_save(kv, my_path, CPL_BPP_IEEE_DOUBLE, NULL, CPL_IO_CREATE, NAN);
+ cpl_free(my_path);
+ kmclipm_vector_delete(kv); kv = NULL;
+
+ my_path = cpl_sprintf("%s/test_data/ttt.fits", ".");
+ cpl_test_null(kmclipm_vector_load(my_path, -1));
+ cpl_free(my_path);
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_msg_set_level(my_level);
+
+ /* --- valid tests --- */
+ my_path = cpl_sprintf("%s/test_data/ttt.fits", ".");
+ cpl_test_nonnull(kv = kmclipm_vector_load(my_path, 0));
+ cpl_free(my_path);
+ cpl_test_eq(5, cpl_vector_get_size(kv->data));
+ cpl_test_eq(5, cpl_vector_get_size(kv->mask));
+ cpl_test_abs(3, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_abs(4./5., cpl_vector_get_mean(kv->mask), 0.01);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ my_path = cpl_sprintf("%s/test_data/ttt2.fits", ".");
+ cpl_test_nonnull(kv = kmclipm_vector_load(my_path, 0));
+ cpl_free(my_path);
+ cpl_test_eq(5, cpl_vector_get_size(kv->data));
+ cpl_test_eq(5, cpl_vector_get_size(kv->mask));
+ cpl_test_abs(0, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_abs(0, cpl_vector_get_mean(kv->mask), 0.01);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_save()
+{
+ char *my_path;
+
+ cpl_msg_set_level(CPL_MSG_OFF);
+ cpl_test_null(kmclipm_vector_load(NULL, -1));
+ cpl_test_error(CPL_ERROR_NULL_INPUT);
+
+ my_path = cpl_sprintf("%s/test_data/ttt.fits", ".");
+ cpl_test_null(kmclipm_vector_load(my_path, -1));
+ cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
+ cpl_msg_set_level(my_level);
+
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_load(my_path, 0));
+
+ kmclipm_vector_save(kv, my_path, CPL_BPP_IEEE_DOUBLE, NULL, CPL_IO_CREATE, NAN);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_load(my_path, 0));
+ cpl_test_eq(5, cpl_vector_get_size(kv->data));
+ cpl_test_eq(5, cpl_vector_get_size(kv->mask));
+ cpl_test_abs(3, kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_abs(4./5., cpl_vector_get_mean(kv->mask), 0.01);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ kmclipm_vector_save(kv, my_path, CPL_BPP_IEEE_DOUBLE, NULL, CPL_IO_CREATE, 0.);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_load(my_path, 0));
+ cpl_test_eq(5, cpl_vector_get_size(kv->data));
+ cpl_test_eq(5, cpl_vector_get_size(kv->mask));
+ cpl_test_abs(12./5., kmclipm_vector_get_mean(kv), 0.01);
+ cpl_test_abs(1, cpl_vector_get_mean(kv->mask), 0.01);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_free(my_path);
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+void test_kmclipm_vector_dump()
+{
+ kmclipm_vector_dump(NULL);
+ cpl_test_error(CPL_ERROR_NONE);
+
+ cpl_vector *v = cpl_vector_new(1);
+ cpl_vector_set(v, 0, 1);
+ kmclipm_vector *kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ kmclipm_vector_dump(kv);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+
+ v = cpl_vector_new(1);
+ cpl_vector_fill(v, NAN);
+ kv = NULL;
+ cpl_test_nonnull(kv = kmclipm_vector_create(v));
+
+ kmclipm_vector_dump(kv);
+ kmclipm_vector_delete(kv); kv = NULL;
+ cpl_test_error(CPL_ERROR_NONE);
+}
+
+int main()
+{
+ /* For DEVELOPERS:
+ * to omit all CPL_MSG_INFO output, apply following statement in the shell
+ * before executing "make check":
+ * setenv CPL_MSG_LEVEL warning
+ * (or export CPL_MSG_LEVEL=warning)
+ */
+
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", my_level);
+
+ char *my_path = cpl_sprintf("%s/test_data", ".");
+ mkdir(my_path, 0777);
+ cpl_free(my_path);
+
+ cpl_msg_set_level_from_env();
+ my_level = cpl_msg_get_level();
+
+ test_kmclipm_vector_new();
+ test_kmclipm_vector_create();
+ test_kmclipm_vector_create2();
+ test_kmclipm_vector_delete();
+ test_kmclipm_vector_duplicate();
+ test_kmclipm_vector_set();
+ test_kmclipm_vector_get();
+ test_kmclipm_vector_get_mask();
+ test_kmclipm_vector_get_bpm();
+ test_kmclipm_vector_reject_from_mask();
+
+ test_kmclipm_vector_count_rejected();
+ test_kmclipm_vector_count_non_rejected();
+ test_kmclipm_vector_is_rejected();
+ test_kmclipm_vector_reject();
+ test_kmclipm_vector_extract();
+ test_kmclipm_vector_create_non_rejected();
+ test_kmclipm_vector_adapt_rejected();
+
+ test_kmclipm_vector_add();
+ test_kmclipm_vector_subtract();
+ test_kmclipm_vector_multiply();
+ test_kmclipm_vector_divide();
+ test_kmclipm_vector_add_scalar();
+ test_kmclipm_vector_subtract_scalar();
+ test_kmclipm_vector_multiply_scalar();
+ test_kmclipm_vector_divide_scalar();
+ test_kmclipm_vector_abs();
+
+ test_kmclipm_vector_get_size();
+ test_kmclipm_vector_get_mean();
+ test_kmclipm_vector_get_median();
+ test_kmclipm_vector_cut_percentian();
+ test_kmclipm_vector_get_sum();
+ test_kmclipm_vector_get_stdev();
+ test_kmclipm_vector_get_stdev_median();
+ test_kmclipm_vector_get_max();
+ test_kmclipm_vector_get_min();
+ test_kmclipm_vector_power();
+ test_kmclipm_vector_fill();
+ test_kmclipm_vector_flip();
+ test_kmclipm_vector_histogram();
+
+ test_kmclipm_vector_load();
+ test_kmclipm_vector_save();
+ test_kmclipm_vector_dump();
+
+ cpl_msg_info("","All tests done.");
+ cpl_msg_set_level(CPL_MSG_WARNING);
+ return cpl_test_end(0);
+}
+
+/** @} */
diff --git a/kmclipm/test/ref/kmclipm_test_functions.ref b/kmclipm/test/ref/kmclipm_test_functions.ref
new file mode 100644
index 0000000..babfbff
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_functions.ref
@@ -0,0 +1,2 @@
+1 - [ INFO ] cpl_init() set errno=25: Inappropriate ioctl for device
+1 - [ INFO ] All tests done.
diff --git a/kmclipm/test/ref/kmclipm_test_math.ref b/kmclipm/test/ref/kmclipm_test_math.ref
new file mode 100644
index 0000000..babfbff
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_math.ref
@@ -0,0 +1,2 @@
+1 - [ INFO ] cpl_init() set errno=25: Inappropriate ioctl for device
+1 - [ INFO ] All tests done.
diff --git a/kmclipm/test/ref/kmclipm_test_priv_constants.ref b/kmclipm/test/ref/kmclipm_test_priv_constants.ref
new file mode 100644
index 0000000..babfbff
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_priv_constants.ref
@@ -0,0 +1,2 @@
+1 - [ INFO ] cpl_init() set errno=25: Inappropriate ioctl for device
+1 - [ INFO ] All tests done.
diff --git a/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_five.ref b/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_five.ref
new file mode 100644
index 0000000..06f88df
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_five.ref
@@ -0,0 +1,308 @@
+Test: second layer shifted by 0.6 in l-direction and by 0.4 in y-direction, distance=0.9 nbhType=N_SPHERE distType=UNIT
+Samples:
+ 0 -> -3.00 / -4.00 / +0.00 : +5.00
+ 1 -> -1.00 / -4.00 / +0.00 : +4.12
+ 2 -> +1.00 / -4.00 / +0.00 : +4.12
+ 3 -> +3.00 / -4.00 / +0.00 : +5.00
+ 4 -> -3.00 / -2.00 / +0.00 : +3.61
+ 5 -> -1.00 / -2.00 / +0.00 : +2.24
+ 6 -> +1.00 / -2.00 / +0.00 : +2.24
+ 7 -> +3.00 / -2.00 / +0.00 : +3.61
+ 8 -> -3.00 / +0.00 / +0.00 : +3.00
+ 9 -> -1.00 / +0.00 / +0.00 : +1.00
+ 10 -> +1.00 / +0.00 / +0.00 : +1.00
+ 11 -> +3.00 / +0.00 / +0.00 : +3.00
+ 12 -> -3.00 / +2.00 / +0.00 : +3.61
+ 13 -> -1.00 / +2.00 / +0.00 : +2.24
+ 14 -> +1.00 / +2.00 / +0.00 : +2.24
+ 15 -> +3.00 / +2.00 / +0.00 : +3.61
+ 16 -> -3.00 / +4.00 / +0.00 : +5.00
+ 17 -> -1.00 / +4.00 / +0.00 : +4.12
+ 18 -> +1.00 / +4.00 / +0.00 : +4.12
+ 19 -> +3.00 / +4.00 / +0.00 : +5.00
+ 20 -> -3.00 / -3.20 / +1.60 : +4.67
+ 21 -> -1.00 / -3.20 / +1.60 : +3.71
+ 22 -> +1.00 / -3.20 / +1.60 : +3.71
+ 23 -> +3.00 / -3.20 / +1.60 : +4.67
+ 24 -> -3.00 / -1.20 / +1.60 : +3.61
+ 25 -> -1.00 / -1.20 / +1.60 : +2.24
+ 26 -> +1.00 / -1.20 / +1.60 : +2.24
+ 27 -> +3.00 / -1.20 / +1.60 : +3.61
+ 28 -> -3.00 / +0.80 / +1.60 : +3.49
+ 29 -> -1.00 / +0.80 / +1.60 : +2.05
+ 30 -> +1.00 / +0.80 / +1.60 : +2.05
+ 31 -> +3.00 / +0.80 / +1.60 : +3.49
+ 32 -> -3.00 / +2.80 / +1.60 : +4.40
+ 33 -> -1.00 / +2.80 / +1.60 : +3.38
+ 34 -> +1.00 / +2.80 / +1.60 : +3.38
+ 35 -> +3.00 / +2.80 / +1.60 : +4.40
+ 36 -> -3.00 / +4.80 / +1.60 : +5.88
+ 37 -> -1.00 / +4.80 / +1.60 : +5.16
+ 38 -> +1.00 / +4.80 / +1.60 : +5.16
+ 39 -> +3.00 / +4.80 / +1.60 : +5.88
+ 40 -> -3.00 / -4.00 / +2.00 : +5.39
+ 41 -> -1.00 / -4.00 / +2.00 : +4.58
+ 42 -> +1.00 / -4.00 / +2.00 : +4.58
+ 43 -> +3.00 / -4.00 / +2.00 : +5.39
+ 44 -> -3.00 / -2.00 / +2.00 : +4.12
+ 45 -> -1.00 / -2.00 / +2.00 : +3.00
+ 46 -> +1.00 / -2.00 / +2.00 : +3.00
+ 47 -> +3.00 / -2.00 / +2.00 : +4.12
+ 48 -> -3.00 / +0.00 / +2.00 : +3.61
+ 49 -> -1.00 / +0.00 / +2.00 : +2.24
+ 50 -> +1.00 / +0.00 / +2.00 : +2.24
+ 51 -> +3.00 / +0.00 / +2.00 : +3.61
+ 52 -> -3.00 / +2.00 / +2.00 : +4.12
+ 53 -> -1.00 / +2.00 / +2.00 : +3.00
+ 54 -> +1.00 / +2.00 / +2.00 : +3.00
+ 55 -> +3.00 / +2.00 / +2.00 : +4.12
+ 56 -> -3.00 / +4.00 / +2.00 : +5.39
+ 57 -> -1.00 / +4.00 / +2.00 : +4.58
+ 58 -> +1.00 / +4.00 / +2.00 : +4.58
+ 59 -> +3.00 / +4.00 / +2.00 : +5.39
+Grid definition:
+x: dim 4 -3.000...+3.000 delta 2.000
+y: dim 5 -4.000...+4.000 delta 2.000
+l: dim 3 +0.000...+2.000 delta 1.000
+Grid pixel neighbors:
+0 / 0 / 0 (-3.00 / -4.00 / +0.00) : 1
+ (-3.00 / -4.00 / +0.00) 0.000 -> 0
+1 / 0 / 0 (-1.00 / -4.00 / +0.00) : 1
+ (-1.00 / -4.00 / +0.00) 0.000 -> 1
+2 / 0 / 0 (+1.00 / -4.00 / +0.00) : 1
+ (+1.00 / -4.00 / +0.00) 0.000 -> 2
+3 / 0 / 0 (+3.00 / -4.00 / +0.00) : 1
+ (+3.00 / -4.00 / +0.00) 0.000 -> 3
+0 / 1 / 0 (-3.00 / -2.00 / +0.00) : 1
+ (-3.00 / -2.00 / +0.00) 0.000 -> 4
+1 / 1 / 0 (-1.00 / -2.00 / +0.00) : 1
+ (-1.00 / -2.00 / +0.00) 0.000 -> 5
+2 / 1 / 0 (+1.00 / -2.00 / +0.00) : 1
+ (+1.00 / -2.00 / +0.00) 0.000 -> 6
+3 / 1 / 0 (+3.00 / -2.00 / +0.00) : 1
+ (+3.00 / -2.00 / +0.00) 0.000 -> 7
+0 / 2 / 0 (-3.00 / +0.00 / +0.00) : 1
+ (-3.00 / +0.00 / +0.00) 0.000 -> 8
+1 / 2 / 0 (-1.00 / +0.00 / +0.00) : 1
+ (-1.00 / +0.00 / +0.00) 0.000 -> 9
+2 / 2 / 0 (+1.00 / +0.00 / +0.00) : 1
+ (+1.00 / +0.00 / +0.00) 0.000 -> 10
+3 / 2 / 0 (+3.00 / +0.00 / +0.00) : 1
+ (+3.00 / +0.00 / +0.00) 0.000 -> 11
+0 / 3 / 0 (-3.00 / +2.00 / +0.00) : 1
+ (-3.00 / +2.00 / +0.00) 0.000 -> 12
+1 / 3 / 0 (-1.00 / +2.00 / +0.00) : 1
+ (-1.00 / +2.00 / +0.00) 0.000 -> 13
+2 / 3 / 0 (+1.00 / +2.00 / +0.00) : 1
+ (+1.00 / +2.00 / +0.00) 0.000 -> 14
+3 / 3 / 0 (+3.00 / +2.00 / +0.00) : 1
+ (+3.00 / +2.00 / +0.00) 0.000 -> 15
+0 / 4 / 0 (-3.00 / +4.00 / +0.00) : 1
+ (-3.00 / +4.00 / +0.00) 0.000 -> 16
+1 / 4 / 0 (-1.00 / +4.00 / +0.00) : 1
+ (-1.00 / +4.00 / +0.00) 0.000 -> 17
+2 / 4 / 0 (+1.00 / +4.00 / +0.00) : 1
+ (+1.00 / +4.00 / +0.00) 0.000 -> 18
+3 / 4 / 0 (+3.00 / +4.00 / +0.00) : 1
+ (+3.00 / +4.00 / +0.00) 0.000 -> 19
+0 / 0 / 1 (-3.00 / -4.00 / +1.00) : 0
+1 / 0 / 1 (-1.00 / -4.00 / +1.00) : 0
+2 / 0 / 1 (+1.00 / -4.00 / +1.00) : 0
+3 / 0 / 1 (+3.00 / -4.00 / +1.00) : 0
+0 / 1 / 1 (-3.00 / -2.00 / +1.00) : 0
+1 / 1 / 1 (-1.00 / -2.00 / +1.00) : 0
+2 / 1 / 1 (+1.00 / -2.00 / +1.00) : 0
+3 / 1 / 1 (+3.00 / -2.00 / +1.00) : 0
+0 / 2 / 1 (-3.00 / +0.00 / +1.00) : 0
+1 / 2 / 1 (-1.00 / +0.00 / +1.00) : 0
+2 / 2 / 1 (+1.00 / +0.00 / +1.00) : 0
+3 / 2 / 1 (+3.00 / +0.00 / +1.00) : 0
+0 / 3 / 1 (-3.00 / +2.00 / +1.00) : 0
+1 / 3 / 1 (-1.00 / +2.00 / +1.00) : 0
+2 / 3 / 1 (+1.00 / +2.00 / +1.00) : 0
+3 / 3 / 1 (+3.00 / +2.00 / +1.00) : 0
+0 / 4 / 1 (-3.00 / +4.00 / +1.00) : 0
+1 / 4 / 1 (-1.00 / +4.00 / +1.00) : 0
+2 / 4 / 1 (+1.00 / +4.00 / +1.00) : 0
+3 / 4 / 1 (+3.00 / +4.00 / +1.00) : 0
+0 / 0 / 2 (-3.00 / -4.00 / +2.00) : 2
+ (-3.00 / -4.00 / +2.00) 0.000 -> 40
+ (-3.00 / -3.20 / +1.60) 0.894 -> 20
+1 / 0 / 2 (-1.00 / -4.00 / +2.00) : 2
+ (-1.00 / -4.00 / +2.00) 0.000 -> 41
+ (-1.00 / -3.20 / +1.60) 0.894 -> 21
+2 / 0 / 2 (+1.00 / -4.00 / +2.00) : 2
+ (+1.00 / -4.00 / +2.00) 0.000 -> 42
+ (+1.00 / -3.20 / +1.60) 0.894 -> 22
+3 / 0 / 2 (+3.00 / -4.00 / +2.00) : 2
+ (+3.00 / -4.00 / +2.00) 0.000 -> 43
+ (+3.00 / -3.20 / +1.60) 0.894 -> 23
+0 / 1 / 2 (-3.00 / -2.00 / +2.00) : 2
+ (-3.00 / -2.00 / +2.00) 0.000 -> 44
+ (-3.00 / -1.20 / +1.60) 0.894 -> 24
+1 / 1 / 2 (-1.00 / -2.00 / +2.00) : 2
+ (-1.00 / -2.00 / +2.00) 0.000 -> 45
+ (-1.00 / -1.20 / +1.60) 0.894 -> 25
+2 / 1 / 2 (+1.00 / -2.00 / +2.00) : 2
+ (+1.00 / -2.00 / +2.00) 0.000 -> 46
+ (+1.00 / -1.20 / +1.60) 0.894 -> 26
+3 / 1 / 2 (+3.00 / -2.00 / +2.00) : 2
+ (+3.00 / -2.00 / +2.00) 0.000 -> 47
+ (+3.00 / -1.20 / +1.60) 0.894 -> 27
+0 / 2 / 2 (-3.00 / +0.00 / +2.00) : 2
+ (-3.00 / +0.00 / +2.00) 0.000 -> 48
+ (-3.00 / +0.80 / +1.60) 0.894 -> 28
+1 / 2 / 2 (-1.00 / +0.00 / +2.00) : 2
+ (-1.00 / +0.00 / +2.00) 0.000 -> 49
+ (-1.00 / +0.80 / +1.60) 0.894 -> 29
+2 / 2 / 2 (+1.00 / +0.00 / +2.00) : 2
+ (+1.00 / +0.00 / +2.00) 0.000 -> 50
+ (+1.00 / +0.80 / +1.60) 0.894 -> 30
+3 / 2 / 2 (+3.00 / +0.00 / +2.00) : 2
+ (+3.00 / +0.00 / +2.00) 0.000 -> 51
+ (+3.00 / +0.80 / +1.60) 0.894 -> 31
+0 / 3 / 2 (-3.00 / +2.00 / +2.00) : 2
+ (-3.00 / +2.00 / +2.00) 0.000 -> 52
+ (-3.00 / +2.80 / +1.60) 0.894 -> 32
+1 / 3 / 2 (-1.00 / +2.00 / +2.00) : 2
+ (-1.00 / +2.00 / +2.00) 0.000 -> 53
+ (-1.00 / +2.80 / +1.60) 0.894 -> 33
+2 / 3 / 2 (+1.00 / +2.00 / +2.00) : 2
+ (+1.00 / +2.00 / +2.00) 0.000 -> 54
+ (+1.00 / +2.80 / +1.60) 0.894 -> 34
+3 / 3 / 2 (+3.00 / +2.00 / +2.00) : 2
+ (+3.00 / +2.00 / +2.00) 0.000 -> 55
+ (+3.00 / +2.80 / +1.60) 0.894 -> 35
+0 / 4 / 2 (-3.00 / +4.00 / +2.00) : 2
+ (-3.00 / +4.00 / +2.00) 0.000 -> 56
+ (-3.00 / +4.80 / +1.60) 0.894 -> 36
+1 / 4 / 2 (-1.00 / +4.00 / +2.00) : 2
+ (-1.00 / +4.00 / +2.00) 0.000 -> 57
+ (-1.00 / +4.80 / +1.60) 0.894 -> 37
+2 / 4 / 2 (+1.00 / +4.00 / +2.00) : 2
+ (+1.00 / +4.00 / +2.00) 0.000 -> 58
+ (+1.00 / +4.80 / +1.60) 0.894 -> 38
+3 / 4 / 2 (+3.00 / +4.00 / +2.00) : 2
+ (+3.00 / +4.00 / +2.00) 0.000 -> 59
+ (+3.00 / +4.80 / +1.60) 0.894 -> 39
+Sample readout neighbors:
+ 0 -> -3.00 / -4.00 / +0.00
+ (-3.00 / -4.00 / +0.00) 0.000
+ 1 -> -1.00 / -4.00 / +0.00
+ (-1.00 / -4.00 / +0.00) 0.000
+ 2 -> +1.00 / -4.00 / +0.00
+ (+1.00 / -4.00 / +0.00) 0.000
+ 3 -> +3.00 / -4.00 / +0.00
+ (+3.00 / -4.00 / +0.00) 0.000
+ 4 -> -3.00 / -2.00 / +0.00
+ (-3.00 / -2.00 / +0.00) 0.000
+ 5 -> -1.00 / -2.00 / +0.00
+ (-1.00 / -2.00 / +0.00) 0.000
+ 6 -> +1.00 / -2.00 / +0.00
+ (+1.00 / -2.00 / +0.00) 0.000
+ 7 -> +3.00 / -2.00 / +0.00
+ (+3.00 / -2.00 / +0.00) 0.000
+ 8 -> -3.00 / +0.00 / +0.00
+ (-3.00 / +0.00 / +0.00) 0.000
+ 9 -> -1.00 / +0.00 / +0.00
+ (-1.00 / +0.00 / +0.00) 0.000
+ 10 -> +1.00 / +0.00 / +0.00
+ (+1.00 / +0.00 / +0.00) 0.000
+ 11 -> +3.00 / +0.00 / +0.00
+ (+3.00 / +0.00 / +0.00) 0.000
+ 12 -> -3.00 / +2.00 / +0.00
+ (-3.00 / +2.00 / +0.00) 0.000
+ 13 -> -1.00 / +2.00 / +0.00
+ (-1.00 / +2.00 / +0.00) 0.000
+ 14 -> +1.00 / +2.00 / +0.00
+ (+1.00 / +2.00 / +0.00) 0.000
+ 15 -> +3.00 / +2.00 / +0.00
+ (+3.00 / +2.00 / +0.00) 0.000
+ 16 -> -3.00 / +4.00 / +0.00
+ (-3.00 / +4.00 / +0.00) 0.000
+ 17 -> -1.00 / +4.00 / +0.00
+ (-1.00 / +4.00 / +0.00) 0.000
+ 18 -> +1.00 / +4.00 / +0.00
+ (+1.00 / +4.00 / +0.00) 0.000
+ 19 -> +3.00 / +4.00 / +0.00
+ (+3.00 / +4.00 / +0.00) 0.000
+ 20 -> -3.00 / -3.20 / +1.60
+ (-3.00 / -4.00 / +2.00) 0.894
+ 21 -> -1.00 / -3.20 / +1.60
+ (-1.00 / -4.00 / +2.00) 0.894
+ 22 -> +1.00 / -3.20 / +1.60
+ (+1.00 / -4.00 / +2.00) 0.894
+ 23 -> +3.00 / -3.20 / +1.60
+ (+3.00 / -4.00 / +2.00) 0.894
+ 24 -> -3.00 / -1.20 / +1.60
+ (-3.00 / -2.00 / +2.00) 0.894
+ 25 -> -1.00 / -1.20 / +1.60
+ (-1.00 / -2.00 / +2.00) 0.894
+ 26 -> +1.00 / -1.20 / +1.60
+ (+1.00 / -2.00 / +2.00) 0.894
+ 27 -> +3.00 / -1.20 / +1.60
+ (+3.00 / -2.00 / +2.00) 0.894
+ 28 -> -3.00 / +0.80 / +1.60
+ (-3.00 / +0.00 / +2.00) 0.894
+ 29 -> -1.00 / +0.80 / +1.60
+ (-1.00 / +0.00 / +2.00) 0.894
+ 30 -> +1.00 / +0.80 / +1.60
+ (+1.00 / +0.00 / +2.00) 0.894
+ 31 -> +3.00 / +0.80 / +1.60
+ (+3.00 / +0.00 / +2.00) 0.894
+ 32 -> -3.00 / +2.80 / +1.60
+ (-3.00 / +2.00 / +2.00) 0.894
+ 33 -> -1.00 / +2.80 / +1.60
+ (-1.00 / +2.00 / +2.00) 0.894
+ 34 -> +1.00 / +2.80 / +1.60
+ (+1.00 / +2.00 / +2.00) 0.894
+ 35 -> +3.00 / +2.80 / +1.60
+ (+3.00 / +2.00 / +2.00) 0.894
+ 36 -> -3.00 / +4.80 / +1.60
+ (-3.00 / +4.00 / +2.00) 0.894
+ 37 -> -1.00 / +4.80 / +1.60
+ (-1.00 / +4.00 / +2.00) 0.894
+ 38 -> +1.00 / +4.80 / +1.60
+ (+1.00 / +4.00 / +2.00) 0.894
+ 39 -> +3.00 / +4.80 / +1.60
+ (+3.00 / +4.00 / +2.00) 0.894
+ 40 -> -3.00 / -4.00 / +2.00
+ (-3.00 / -4.00 / +2.00) 0.000
+ 41 -> -1.00 / -4.00 / +2.00
+ (-1.00 / -4.00 / +2.00) 0.000
+ 42 -> +1.00 / -4.00 / +2.00
+ (+1.00 / -4.00 / +2.00) 0.000
+ 43 -> +3.00 / -4.00 / +2.00
+ (+3.00 / -4.00 / +2.00) 0.000
+ 44 -> -3.00 / -2.00 / +2.00
+ (-3.00 / -2.00 / +2.00) 0.000
+ 45 -> -1.00 / -2.00 / +2.00
+ (-1.00 / -2.00 / +2.00) 0.000
+ 46 -> +1.00 / -2.00 / +2.00
+ (+1.00 / -2.00 / +2.00) 0.000
+ 47 -> +3.00 / -2.00 / +2.00
+ (+3.00 / -2.00 / +2.00) 0.000
+ 48 -> -3.00 / +0.00 / +2.00
+ (-3.00 / +0.00 / +2.00) 0.000
+ 49 -> -1.00 / +0.00 / +2.00
+ (-1.00 / +0.00 / +2.00) 0.000
+ 50 -> +1.00 / +0.00 / +2.00
+ (+1.00 / +0.00 / +2.00) 0.000
+ 51 -> +3.00 / +0.00 / +2.00
+ (+3.00 / +0.00 / +2.00) 0.000
+ 52 -> -3.00 / +2.00 / +2.00
+ (-3.00 / +2.00 / +2.00) 0.000
+ 53 -> -1.00 / +2.00 / +2.00
+ (-1.00 / +2.00 / +2.00) 0.000
+ 54 -> +1.00 / +2.00 / +2.00
+ (+1.00 / +2.00 / +2.00) 0.000
+ 55 -> +3.00 / +2.00 / +2.00
+ (+3.00 / +2.00 / +2.00) 0.000
+ 56 -> -3.00 / +4.00 / +2.00
+ (-3.00 / +4.00 / +2.00) 0.000
+ 57 -> -1.00 / +4.00 / +2.00
+ (-1.00 / +4.00 / +2.00) 0.000
+ 58 -> +1.00 / +4.00 / +2.00
+ (+1.00 / +4.00 / +2.00) 0.000
+ 59 -> +3.00 / +4.00 / +2.00
+ (+3.00 / +4.00 / +2.00) 0.000
diff --git a/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_four.ref b/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_four.ref
new file mode 100644
index 0000000..f45112c
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_four.ref
@@ -0,0 +1,268 @@
+Test: second layer shifted by 0.6 in l-direction and by 0.4 in y-direction, distance=0.5 nbhType=N_SPERE distType=PIXEL
+Samples:
+ 0 -> -3.00 / -4.00 / +0.00 : +5.00
+ 1 -> -1.00 / -4.00 / +0.00 : +4.12
+ 2 -> +1.00 / -4.00 / +0.00 : +4.12
+ 3 -> +3.00 / -4.00 / +0.00 : +5.00
+ 4 -> -3.00 / -2.00 / +0.00 : +3.61
+ 5 -> -1.00 / -2.00 / +0.00 : +2.24
+ 6 -> +1.00 / -2.00 / +0.00 : +2.24
+ 7 -> +3.00 / -2.00 / +0.00 : +3.61
+ 8 -> -3.00 / +0.00 / +0.00 : +3.00
+ 9 -> -1.00 / +0.00 / +0.00 : +1.00
+ 10 -> +1.00 / +0.00 / +0.00 : +1.00
+ 11 -> +3.00 / +0.00 / +0.00 : +3.00
+ 12 -> -3.00 / +2.00 / +0.00 : +3.61
+ 13 -> -1.00 / +2.00 / +0.00 : +2.24
+ 14 -> +1.00 / +2.00 / +0.00 : +2.24
+ 15 -> +3.00 / +2.00 / +0.00 : +3.61
+ 16 -> -3.00 / +4.00 / +0.00 : +5.00
+ 17 -> -1.00 / +4.00 / +0.00 : +4.12
+ 18 -> +1.00 / +4.00 / +0.00 : +4.12
+ 19 -> +3.00 / +4.00 / +0.00 : +5.00
+ 20 -> -3.00 / -3.20 / +1.60 : +4.67
+ 21 -> -1.00 / -3.20 / +1.60 : +3.71
+ 22 -> +1.00 / -3.20 / +1.60 : +3.71
+ 23 -> +3.00 / -3.20 / +1.60 : +4.67
+ 24 -> -3.00 / -1.20 / +1.60 : +3.61
+ 25 -> -1.00 / -1.20 / +1.60 : +2.24
+ 26 -> +1.00 / -1.20 / +1.60 : +2.24
+ 27 -> +3.00 / -1.20 / +1.60 : +3.61
+ 28 -> -3.00 / +0.80 / +1.60 : +3.49
+ 29 -> -1.00 / +0.80 / +1.60 : +2.05
+ 30 -> +1.00 / +0.80 / +1.60 : +2.05
+ 31 -> +3.00 / +0.80 / +1.60 : +3.49
+ 32 -> -3.00 / +2.80 / +1.60 : +4.40
+ 33 -> -1.00 / +2.80 / +1.60 : +3.38
+ 34 -> +1.00 / +2.80 / +1.60 : +3.38
+ 35 -> +3.00 / +2.80 / +1.60 : +4.40
+ 36 -> -3.00 / +4.80 / +1.60 : +5.88
+ 37 -> -1.00 / +4.80 / +1.60 : +5.16
+ 38 -> +1.00 / +4.80 / +1.60 : +5.16
+ 39 -> +3.00 / +4.80 / +1.60 : +5.88
+ 40 -> -3.00 / -4.00 / +2.00 : +5.39
+ 41 -> -1.00 / -4.00 / +2.00 : +4.58
+ 42 -> +1.00 / -4.00 / +2.00 : +4.58
+ 43 -> +3.00 / -4.00 / +2.00 : +5.39
+ 44 -> -3.00 / -2.00 / +2.00 : +4.12
+ 45 -> -1.00 / -2.00 / +2.00 : +3.00
+ 46 -> +1.00 / -2.00 / +2.00 : +3.00
+ 47 -> +3.00 / -2.00 / +2.00 : +4.12
+ 48 -> -3.00 / +0.00 / +2.00 : +3.61
+ 49 -> -1.00 / +0.00 / +2.00 : +2.24
+ 50 -> +1.00 / +0.00 / +2.00 : +2.24
+ 51 -> +3.00 / +0.00 / +2.00 : +3.61
+ 52 -> -3.00 / +2.00 / +2.00 : +4.12
+ 53 -> -1.00 / +2.00 / +2.00 : +3.00
+ 54 -> +1.00 / +2.00 / +2.00 : +3.00
+ 55 -> +3.00 / +2.00 / +2.00 : +4.12
+ 56 -> -3.00 / +4.00 / +2.00 : +5.39
+ 57 -> -1.00 / +4.00 / +2.00 : +4.58
+ 58 -> +1.00 / +4.00 / +2.00 : +4.58
+ 59 -> +3.00 / +4.00 / +2.00 : +5.39
+Grid definition:
+x: dim 4 -3.000...+3.000 delta 2.000
+y: dim 5 -4.000...+4.000 delta 2.000
+l: dim 3 +0.000...+2.000 delta 1.000
+Grid pixel neighbors:
+0 / 0 / 0 (-3.00 / -4.00 / +0.00) : 1
+ (-3.00 / -4.00 / +0.00) 0.000 -> 0
+1 / 0 / 0 (-1.00 / -4.00 / +0.00) : 1
+ (-1.00 / -4.00 / +0.00) 0.000 -> 1
+2 / 0 / 0 (+1.00 / -4.00 / +0.00) : 1
+ (+1.00 / -4.00 / +0.00) 0.000 -> 2
+3 / 0 / 0 (+3.00 / -4.00 / +0.00) : 1
+ (+3.00 / -4.00 / +0.00) 0.000 -> 3
+0 / 1 / 0 (-3.00 / -2.00 / +0.00) : 1
+ (-3.00 / -2.00 / +0.00) 0.000 -> 4
+1 / 1 / 0 (-1.00 / -2.00 / +0.00) : 1
+ (-1.00 / -2.00 / +0.00) 0.000 -> 5
+2 / 1 / 0 (+1.00 / -2.00 / +0.00) : 1
+ (+1.00 / -2.00 / +0.00) 0.000 -> 6
+3 / 1 / 0 (+3.00 / -2.00 / +0.00) : 1
+ (+3.00 / -2.00 / +0.00) 0.000 -> 7
+0 / 2 / 0 (-3.00 / +0.00 / +0.00) : 1
+ (-3.00 / +0.00 / +0.00) 0.000 -> 8
+1 / 2 / 0 (-1.00 / +0.00 / +0.00) : 1
+ (-1.00 / +0.00 / +0.00) 0.000 -> 9
+2 / 2 / 0 (+1.00 / +0.00 / +0.00) : 1
+ (+1.00 / +0.00 / +0.00) 0.000 -> 10
+3 / 2 / 0 (+3.00 / +0.00 / +0.00) : 1
+ (+3.00 / +0.00 / +0.00) 0.000 -> 11
+0 / 3 / 0 (-3.00 / +2.00 / +0.00) : 1
+ (-3.00 / +2.00 / +0.00) 0.000 -> 12
+1 / 3 / 0 (-1.00 / +2.00 / +0.00) : 1
+ (-1.00 / +2.00 / +0.00) 0.000 -> 13
+2 / 3 / 0 (+1.00 / +2.00 / +0.00) : 1
+ (+1.00 / +2.00 / +0.00) 0.000 -> 14
+3 / 3 / 0 (+3.00 / +2.00 / +0.00) : 1
+ (+3.00 / +2.00 / +0.00) 0.000 -> 15
+0 / 4 / 0 (-3.00 / +4.00 / +0.00) : 1
+ (-3.00 / +4.00 / +0.00) 0.000 -> 16
+1 / 4 / 0 (-1.00 / +4.00 / +0.00) : 1
+ (-1.00 / +4.00 / +0.00) 0.000 -> 17
+2 / 4 / 0 (+1.00 / +4.00 / +0.00) : 1
+ (+1.00 / +4.00 / +0.00) 0.000 -> 18
+3 / 4 / 0 (+3.00 / +4.00 / +0.00) : 1
+ (+3.00 / +4.00 / +0.00) 0.000 -> 19
+0 / 0 / 1 (-3.00 / -4.00 / +1.00) : 0
+1 / 0 / 1 (-1.00 / -4.00 / +1.00) : 0
+2 / 0 / 1 (+1.00 / -4.00 / +1.00) : 0
+3 / 0 / 1 (+3.00 / -4.00 / +1.00) : 0
+0 / 1 / 1 (-3.00 / -2.00 / +1.00) : 0
+1 / 1 / 1 (-1.00 / -2.00 / +1.00) : 0
+2 / 1 / 1 (+1.00 / -2.00 / +1.00) : 0
+3 / 1 / 1 (+3.00 / -2.00 / +1.00) : 0
+0 / 2 / 1 (-3.00 / +0.00 / +1.00) : 0
+1 / 2 / 1 (-1.00 / +0.00 / +1.00) : 0
+2 / 2 / 1 (+1.00 / +0.00 / +1.00) : 0
+3 / 2 / 1 (+3.00 / +0.00 / +1.00) : 0
+0 / 3 / 1 (-3.00 / +2.00 / +1.00) : 0
+1 / 3 / 1 (-1.00 / +2.00 / +1.00) : 0
+2 / 3 / 1 (+1.00 / +2.00 / +1.00) : 0
+3 / 3 / 1 (+3.00 / +2.00 / +1.00) : 0
+0 / 4 / 1 (-3.00 / +4.00 / +1.00) : 0
+1 / 4 / 1 (-1.00 / +4.00 / +1.00) : 0
+2 / 4 / 1 (+1.00 / +4.00 / +1.00) : 0
+3 / 4 / 1 (+3.00 / +4.00 / +1.00) : 0
+0 / 0 / 2 (-3.00 / -4.00 / +2.00) : 1
+ (-3.00 / -4.00 / +2.00) 0.000 -> 40
+1 / 0 / 2 (-1.00 / -4.00 / +2.00) : 1
+ (-1.00 / -4.00 / +2.00) 0.000 -> 41
+2 / 0 / 2 (+1.00 / -4.00 / +2.00) : 1
+ (+1.00 / -4.00 / +2.00) 0.000 -> 42
+3 / 0 / 2 (+3.00 / -4.00 / +2.00) : 1
+ (+3.00 / -4.00 / +2.00) 0.000 -> 43
+0 / 1 / 2 (-3.00 / -2.00 / +2.00) : 1
+ (-3.00 / -2.00 / +2.00) 0.000 -> 44
+1 / 1 / 2 (-1.00 / -2.00 / +2.00) : 1
+ (-1.00 / -2.00 / +2.00) 0.000 -> 45
+2 / 1 / 2 (+1.00 / -2.00 / +2.00) : 1
+ (+1.00 / -2.00 / +2.00) 0.000 -> 46
+3 / 1 / 2 (+3.00 / -2.00 / +2.00) : 1
+ (+3.00 / -2.00 / +2.00) 0.000 -> 47
+0 / 2 / 2 (-3.00 / +0.00 / +2.00) : 1
+ (-3.00 / +0.00 / +2.00) 0.000 -> 48
+1 / 2 / 2 (-1.00 / +0.00 / +2.00) : 1
+ (-1.00 / +0.00 / +2.00) 0.000 -> 49
+2 / 2 / 2 (+1.00 / +0.00 / +2.00) : 1
+ (+1.00 / +0.00 / +2.00) 0.000 -> 50
+3 / 2 / 2 (+3.00 / +0.00 / +2.00) : 1
+ (+3.00 / +0.00 / +2.00) 0.000 -> 51
+0 / 3 / 2 (-3.00 / +2.00 / +2.00) : 1
+ (-3.00 / +2.00 / +2.00) 0.000 -> 52
+1 / 3 / 2 (-1.00 / +2.00 / +2.00) : 1
+ (-1.00 / +2.00 / +2.00) 0.000 -> 53
+2 / 3 / 2 (+1.00 / +2.00 / +2.00) : 1
+ (+1.00 / +2.00 / +2.00) 0.000 -> 54
+3 / 3 / 2 (+3.00 / +2.00 / +2.00) : 1
+ (+3.00 / +2.00 / +2.00) 0.000 -> 55
+0 / 4 / 2 (-3.00 / +4.00 / +2.00) : 1
+ (-3.00 / +4.00 / +2.00) 0.000 -> 56
+1 / 4 / 2 (-1.00 / +4.00 / +2.00) : 1
+ (-1.00 / +4.00 / +2.00) 0.000 -> 57
+2 / 4 / 2 (+1.00 / +4.00 / +2.00) : 1
+ (+1.00 / +4.00 / +2.00) 0.000 -> 58
+3 / 4 / 2 (+3.00 / +4.00 / +2.00) : 1
+ (+3.00 / +4.00 / +2.00) 0.000 -> 59
+Sample readout neighbors:
+ 0 -> -3.00 / -4.00 / +0.00
+ (-3.00 / -4.00 / +0.00) 0.000
+ 1 -> -1.00 / -4.00 / +0.00
+ (-1.00 / -4.00 / +0.00) 0.000
+ 2 -> +1.00 / -4.00 / +0.00
+ (+1.00 / -4.00 / +0.00) 0.000
+ 3 -> +3.00 / -4.00 / +0.00
+ (+3.00 / -4.00 / +0.00) 0.000
+ 4 -> -3.00 / -2.00 / +0.00
+ (-3.00 / -2.00 / +0.00) 0.000
+ 5 -> -1.00 / -2.00 / +0.00
+ (-1.00 / -2.00 / +0.00) 0.000
+ 6 -> +1.00 / -2.00 / +0.00
+ (+1.00 / -2.00 / +0.00) 0.000
+ 7 -> +3.00 / -2.00 / +0.00
+ (+3.00 / -2.00 / +0.00) 0.000
+ 8 -> -3.00 / +0.00 / +0.00
+ (-3.00 / +0.00 / +0.00) 0.000
+ 9 -> -1.00 / +0.00 / +0.00
+ (-1.00 / +0.00 / +0.00) 0.000
+ 10 -> +1.00 / +0.00 / +0.00
+ (+1.00 / +0.00 / +0.00) 0.000
+ 11 -> +3.00 / +0.00 / +0.00
+ (+3.00 / +0.00 / +0.00) 0.000
+ 12 -> -3.00 / +2.00 / +0.00
+ (-3.00 / +2.00 / +0.00) 0.000
+ 13 -> -1.00 / +2.00 / +0.00
+ (-1.00 / +2.00 / +0.00) 0.000
+ 14 -> +1.00 / +2.00 / +0.00
+ (+1.00 / +2.00 / +0.00) 0.000
+ 15 -> +3.00 / +2.00 / +0.00
+ (+3.00 / +2.00 / +0.00) 0.000
+ 16 -> -3.00 / +4.00 / +0.00
+ (-3.00 / +4.00 / +0.00) 0.000
+ 17 -> -1.00 / +4.00 / +0.00
+ (-1.00 / +4.00 / +0.00) 0.000
+ 18 -> +1.00 / +4.00 / +0.00
+ (+1.00 / +4.00 / +0.00) 0.000
+ 19 -> +3.00 / +4.00 / +0.00
+ (+3.00 / +4.00 / +0.00) 0.000
+ 20 -> -3.00 / -3.20 / +1.60
+ 21 -> -1.00 / -3.20 / +1.60
+ 22 -> +1.00 / -3.20 / +1.60
+ 23 -> +3.00 / -3.20 / +1.60
+ 24 -> -3.00 / -1.20 / +1.60
+ 25 -> -1.00 / -1.20 / +1.60
+ 26 -> +1.00 / -1.20 / +1.60
+ 27 -> +3.00 / -1.20 / +1.60
+ 28 -> -3.00 / +0.80 / +1.60
+ 29 -> -1.00 / +0.80 / +1.60
+ 30 -> +1.00 / +0.80 / +1.60
+ 31 -> +3.00 / +0.80 / +1.60
+ 32 -> -3.00 / +2.80 / +1.60
+ 33 -> -1.00 / +2.80 / +1.60
+ 34 -> +1.00 / +2.80 / +1.60
+ 35 -> +3.00 / +2.80 / +1.60
+ 36 -> -3.00 / +4.80 / +1.60
+ 37 -> -1.00 / +4.80 / +1.60
+ 38 -> +1.00 / +4.80 / +1.60
+ 39 -> +3.00 / +4.80 / +1.60
+ 40 -> -3.00 / -4.00 / +2.00
+ (-3.00 / -4.00 / +2.00) 0.000
+ 41 -> -1.00 / -4.00 / +2.00
+ (-1.00 / -4.00 / +2.00) 0.000
+ 42 -> +1.00 / -4.00 / +2.00
+ (+1.00 / -4.00 / +2.00) 0.000
+ 43 -> +3.00 / -4.00 / +2.00
+ (+3.00 / -4.00 / +2.00) 0.000
+ 44 -> -3.00 / -2.00 / +2.00
+ (-3.00 / -2.00 / +2.00) 0.000
+ 45 -> -1.00 / -2.00 / +2.00
+ (-1.00 / -2.00 / +2.00) 0.000
+ 46 -> +1.00 / -2.00 / +2.00
+ (+1.00 / -2.00 / +2.00) 0.000
+ 47 -> +3.00 / -2.00 / +2.00
+ (+3.00 / -2.00 / +2.00) 0.000
+ 48 -> -3.00 / +0.00 / +2.00
+ (-3.00 / +0.00 / +2.00) 0.000
+ 49 -> -1.00 / +0.00 / +2.00
+ (-1.00 / +0.00 / +2.00) 0.000
+ 50 -> +1.00 / +0.00 / +2.00
+ (+1.00 / +0.00 / +2.00) 0.000
+ 51 -> +3.00 / +0.00 / +2.00
+ (+3.00 / +0.00 / +2.00) 0.000
+ 52 -> -3.00 / +2.00 / +2.00
+ (-3.00 / +2.00 / +2.00) 0.000
+ 53 -> -1.00 / +2.00 / +2.00
+ (-1.00 / +2.00 / +2.00) 0.000
+ 54 -> +1.00 / +2.00 / +2.00
+ (+1.00 / +2.00 / +2.00) 0.000
+ 55 -> +3.00 / +2.00 / +2.00
+ (+3.00 / +2.00 / +2.00) 0.000
+ 56 -> -3.00 / +4.00 / +2.00
+ (-3.00 / +4.00 / +2.00) 0.000
+ 57 -> -1.00 / +4.00 / +2.00
+ (-1.00 / +4.00 / +2.00) 0.000
+ 58 -> +1.00 / +4.00 / +2.00
+ (+1.00 / +4.00 / +2.00) 0.000
+ 59 -> +3.00 / +4.00 / +2.00
+ (+3.00 / +4.00 / +2.00) 0.000
diff --git a/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_one.ref b/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_one.ref
new file mode 100644
index 0000000..9d72257
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_one.ref
@@ -0,0 +1,308 @@
+Test: one to one map
+Samples:
+ 0 -> -3.00 / -4.00 / +0.00 : +5.00
+ 1 -> -1.00 / -4.00 / +0.00 : +4.12
+ 2 -> +1.00 / -4.00 / +0.00 : +4.12
+ 3 -> +3.00 / -4.00 / +0.00 : +5.00
+ 4 -> -3.00 / -2.00 / +0.00 : +3.61
+ 5 -> -1.00 / -2.00 / +0.00 : +2.24
+ 6 -> +1.00 / -2.00 / +0.00 : +2.24
+ 7 -> +3.00 / -2.00 / +0.00 : +3.61
+ 8 -> -3.00 / +0.00 / +0.00 : +3.00
+ 9 -> -1.00 / +0.00 / +0.00 : +1.00
+ 10 -> +1.00 / +0.00 / +0.00 : +1.00
+ 11 -> +3.00 / +0.00 / +0.00 : +3.00
+ 12 -> -3.00 / +2.00 / +0.00 : +3.61
+ 13 -> -1.00 / +2.00 / +0.00 : +2.24
+ 14 -> +1.00 / +2.00 / +0.00 : +2.24
+ 15 -> +3.00 / +2.00 / +0.00 : +3.61
+ 16 -> -3.00 / +4.00 / +0.00 : +5.00
+ 17 -> -1.00 / +4.00 / +0.00 : +4.12
+ 18 -> +1.00 / +4.00 / +0.00 : +4.12
+ 19 -> +3.00 / +4.00 / +0.00 : +5.00
+ 20 -> -3.00 / -4.00 / +1.00 : +5.10
+ 21 -> -1.00 / -4.00 / +1.00 : +4.24
+ 22 -> +1.00 / -4.00 / +1.00 : +4.24
+ 23 -> +3.00 / -4.00 / +1.00 : +5.10
+ 24 -> -3.00 / -2.00 / +1.00 : +3.74
+ 25 -> -1.00 / -2.00 / +1.00 : +2.45
+ 26 -> +1.00 / -2.00 / +1.00 : +2.45
+ 27 -> +3.00 / -2.00 / +1.00 : +3.74
+ 28 -> -3.00 / +0.00 / +1.00 : +3.16
+ 29 -> -1.00 / +0.00 / +1.00 : +1.41
+ 30 -> +1.00 / +0.00 / +1.00 : +1.41
+ 31 -> +3.00 / +0.00 / +1.00 : +3.16
+ 32 -> -3.00 / +2.00 / +1.00 : +3.74
+ 33 -> -1.00 / +2.00 / +1.00 : +2.45
+ 34 -> +1.00 / +2.00 / +1.00 : +2.45
+ 35 -> +3.00 / +2.00 / +1.00 : +3.74
+ 36 -> -3.00 / +4.00 / +1.00 : +5.10
+ 37 -> -1.00 / +4.00 / +1.00 : +4.24
+ 38 -> +1.00 / +4.00 / +1.00 : +4.24
+ 39 -> +3.00 / +4.00 / +1.00 : +5.10
+ 40 -> -3.00 / -4.00 / +2.00 : +5.39
+ 41 -> -1.00 / -4.00 / +2.00 : +4.58
+ 42 -> +1.00 / -4.00 / +2.00 : +4.58
+ 43 -> +3.00 / -4.00 / +2.00 : +5.39
+ 44 -> -3.00 / -2.00 / +2.00 : +4.12
+ 45 -> -1.00 / -2.00 / +2.00 : +3.00
+ 46 -> +1.00 / -2.00 / +2.00 : +3.00
+ 47 -> +3.00 / -2.00 / +2.00 : +4.12
+ 48 -> -3.00 / +0.00 / +2.00 : +3.61
+ 49 -> -1.00 / +0.00 / +2.00 : +2.24
+ 50 -> +1.00 / +0.00 / +2.00 : +2.24
+ 51 -> +3.00 / +0.00 / +2.00 : +3.61
+ 52 -> -3.00 / +2.00 / +2.00 : +4.12
+ 53 -> -1.00 / +2.00 / +2.00 : +3.00
+ 54 -> +1.00 / +2.00 / +2.00 : +3.00
+ 55 -> +3.00 / +2.00 / +2.00 : +4.12
+ 56 -> -3.00 / +4.00 / +2.00 : +5.39
+ 57 -> -1.00 / +4.00 / +2.00 : +4.58
+ 58 -> +1.00 / +4.00 / +2.00 : +4.58
+ 59 -> +3.00 / +4.00 / +2.00 : +5.39
+Grid definition:
+x: dim 4 -3.000...+3.000 delta 2.000
+y: dim 5 -4.000...+4.000 delta 2.000
+l: dim 3 +0.000...+2.000 delta 1.000
+Grid pixel neighbors:
+0 / 0 / 0 (-3.00 / -4.00 / +0.00) : 1
+ (-3.00 / -4.00 / +0.00) 0.000 -> 0
+1 / 0 / 0 (-1.00 / -4.00 / +0.00) : 1
+ (-1.00 / -4.00 / +0.00) 0.000 -> 1
+2 / 0 / 0 (+1.00 / -4.00 / +0.00) : 1
+ (+1.00 / -4.00 / +0.00) 0.000 -> 2
+3 / 0 / 0 (+3.00 / -4.00 / +0.00) : 1
+ (+3.00 / -4.00 / +0.00) 0.000 -> 3
+0 / 1 / 0 (-3.00 / -2.00 / +0.00) : 1
+ (-3.00 / -2.00 / +0.00) 0.000 -> 4
+1 / 1 / 0 (-1.00 / -2.00 / +0.00) : 1
+ (-1.00 / -2.00 / +0.00) 0.000 -> 5
+2 / 1 / 0 (+1.00 / -2.00 / +0.00) : 1
+ (+1.00 / -2.00 / +0.00) 0.000 -> 6
+3 / 1 / 0 (+3.00 / -2.00 / +0.00) : 1
+ (+3.00 / -2.00 / +0.00) 0.000 -> 7
+0 / 2 / 0 (-3.00 / +0.00 / +0.00) : 1
+ (-3.00 / +0.00 / +0.00) 0.000 -> 8
+1 / 2 / 0 (-1.00 / +0.00 / +0.00) : 1
+ (-1.00 / +0.00 / +0.00) 0.000 -> 9
+2 / 2 / 0 (+1.00 / +0.00 / +0.00) : 1
+ (+1.00 / +0.00 / +0.00) 0.000 -> 10
+3 / 2 / 0 (+3.00 / +0.00 / +0.00) : 1
+ (+3.00 / +0.00 / +0.00) 0.000 -> 11
+0 / 3 / 0 (-3.00 / +2.00 / +0.00) : 1
+ (-3.00 / +2.00 / +0.00) 0.000 -> 12
+1 / 3 / 0 (-1.00 / +2.00 / +0.00) : 1
+ (-1.00 / +2.00 / +0.00) 0.000 -> 13
+2 / 3 / 0 (+1.00 / +2.00 / +0.00) : 1
+ (+1.00 / +2.00 / +0.00) 0.000 -> 14
+3 / 3 / 0 (+3.00 / +2.00 / +0.00) : 1
+ (+3.00 / +2.00 / +0.00) 0.000 -> 15
+0 / 4 / 0 (-3.00 / +4.00 / +0.00) : 1
+ (-3.00 / +4.00 / +0.00) 0.000 -> 16
+1 / 4 / 0 (-1.00 / +4.00 / +0.00) : 1
+ (-1.00 / +4.00 / +0.00) 0.000 -> 17
+2 / 4 / 0 (+1.00 / +4.00 / +0.00) : 1
+ (+1.00 / +4.00 / +0.00) 0.000 -> 18
+3 / 4 / 0 (+3.00 / +4.00 / +0.00) : 1
+ (+3.00 / +4.00 / +0.00) 0.000 -> 19
+0 / 0 / 1 (-3.00 / -4.00 / +1.00) : 1
+ (-3.00 / -4.00 / +1.00) 0.000 -> 20
+1 / 0 / 1 (-1.00 / -4.00 / +1.00) : 1
+ (-1.00 / -4.00 / +1.00) 0.000 -> 21
+2 / 0 / 1 (+1.00 / -4.00 / +1.00) : 1
+ (+1.00 / -4.00 / +1.00) 0.000 -> 22
+3 / 0 / 1 (+3.00 / -4.00 / +1.00) : 1
+ (+3.00 / -4.00 / +1.00) 0.000 -> 23
+0 / 1 / 1 (-3.00 / -2.00 / +1.00) : 1
+ (-3.00 / -2.00 / +1.00) 0.000 -> 24
+1 / 1 / 1 (-1.00 / -2.00 / +1.00) : 1
+ (-1.00 / -2.00 / +1.00) 0.000 -> 25
+2 / 1 / 1 (+1.00 / -2.00 / +1.00) : 1
+ (+1.00 / -2.00 / +1.00) 0.000 -> 26
+3 / 1 / 1 (+3.00 / -2.00 / +1.00) : 1
+ (+3.00 / -2.00 / +1.00) 0.000 -> 27
+0 / 2 / 1 (-3.00 / +0.00 / +1.00) : 1
+ (-3.00 / +0.00 / +1.00) 0.000 -> 28
+1 / 2 / 1 (-1.00 / +0.00 / +1.00) : 1
+ (-1.00 / +0.00 / +1.00) 0.000 -> 29
+2 / 2 / 1 (+1.00 / +0.00 / +1.00) : 1
+ (+1.00 / +0.00 / +1.00) 0.000 -> 30
+3 / 2 / 1 (+3.00 / +0.00 / +1.00) : 1
+ (+3.00 / +0.00 / +1.00) 0.000 -> 31
+0 / 3 / 1 (-3.00 / +2.00 / +1.00) : 1
+ (-3.00 / +2.00 / +1.00) 0.000 -> 32
+1 / 3 / 1 (-1.00 / +2.00 / +1.00) : 1
+ (-1.00 / +2.00 / +1.00) 0.000 -> 33
+2 / 3 / 1 (+1.00 / +2.00 / +1.00) : 1
+ (+1.00 / +2.00 / +1.00) 0.000 -> 34
+3 / 3 / 1 (+3.00 / +2.00 / +1.00) : 1
+ (+3.00 / +2.00 / +1.00) 0.000 -> 35
+0 / 4 / 1 (-3.00 / +4.00 / +1.00) : 1
+ (-3.00 / +4.00 / +1.00) 0.000 -> 36
+1 / 4 / 1 (-1.00 / +4.00 / +1.00) : 1
+ (-1.00 / +4.00 / +1.00) 0.000 -> 37
+2 / 4 / 1 (+1.00 / +4.00 / +1.00) : 1
+ (+1.00 / +4.00 / +1.00) 0.000 -> 38
+3 / 4 / 1 (+3.00 / +4.00 / +1.00) : 1
+ (+3.00 / +4.00 / +1.00) 0.000 -> 39
+0 / 0 / 2 (-3.00 / -4.00 / +2.00) : 1
+ (-3.00 / -4.00 / +2.00) 0.000 -> 40
+1 / 0 / 2 (-1.00 / -4.00 / +2.00) : 1
+ (-1.00 / -4.00 / +2.00) 0.000 -> 41
+2 / 0 / 2 (+1.00 / -4.00 / +2.00) : 1
+ (+1.00 / -4.00 / +2.00) 0.000 -> 42
+3 / 0 / 2 (+3.00 / -4.00 / +2.00) : 1
+ (+3.00 / -4.00 / +2.00) 0.000 -> 43
+0 / 1 / 2 (-3.00 / -2.00 / +2.00) : 1
+ (-3.00 / -2.00 / +2.00) 0.000 -> 44
+1 / 1 / 2 (-1.00 / -2.00 / +2.00) : 1
+ (-1.00 / -2.00 / +2.00) 0.000 -> 45
+2 / 1 / 2 (+1.00 / -2.00 / +2.00) : 1
+ (+1.00 / -2.00 / +2.00) 0.000 -> 46
+3 / 1 / 2 (+3.00 / -2.00 / +2.00) : 1
+ (+3.00 / -2.00 / +2.00) 0.000 -> 47
+0 / 2 / 2 (-3.00 / +0.00 / +2.00) : 1
+ (-3.00 / +0.00 / +2.00) 0.000 -> 48
+1 / 2 / 2 (-1.00 / +0.00 / +2.00) : 1
+ (-1.00 / +0.00 / +2.00) 0.000 -> 49
+2 / 2 / 2 (+1.00 / +0.00 / +2.00) : 1
+ (+1.00 / +0.00 / +2.00) 0.000 -> 50
+3 / 2 / 2 (+3.00 / +0.00 / +2.00) : 1
+ (+3.00 / +0.00 / +2.00) 0.000 -> 51
+0 / 3 / 2 (-3.00 / +2.00 / +2.00) : 1
+ (-3.00 / +2.00 / +2.00) 0.000 -> 52
+1 / 3 / 2 (-1.00 / +2.00 / +2.00) : 1
+ (-1.00 / +2.00 / +2.00) 0.000 -> 53
+2 / 3 / 2 (+1.00 / +2.00 / +2.00) : 1
+ (+1.00 / +2.00 / +2.00) 0.000 -> 54
+3 / 3 / 2 (+3.00 / +2.00 / +2.00) : 1
+ (+3.00 / +2.00 / +2.00) 0.000 -> 55
+0 / 4 / 2 (-3.00 / +4.00 / +2.00) : 1
+ (-3.00 / +4.00 / +2.00) 0.000 -> 56
+1 / 4 / 2 (-1.00 / +4.00 / +2.00) : 1
+ (-1.00 / +4.00 / +2.00) 0.000 -> 57
+2 / 4 / 2 (+1.00 / +4.00 / +2.00) : 1
+ (+1.00 / +4.00 / +2.00) 0.000 -> 58
+3 / 4 / 2 (+3.00 / +4.00 / +2.00) : 1
+ (+3.00 / +4.00 / +2.00) 0.000 -> 59
+Sample readout neighbors:
+ 0 -> -3.00 / -4.00 / +0.00
+ (-3.00 / -4.00 / +0.00) 0.000
+ 1 -> -1.00 / -4.00 / +0.00
+ (-1.00 / -4.00 / +0.00) 0.000
+ 2 -> +1.00 / -4.00 / +0.00
+ (+1.00 / -4.00 / +0.00) 0.000
+ 3 -> +3.00 / -4.00 / +0.00
+ (+3.00 / -4.00 / +0.00) 0.000
+ 4 -> -3.00 / -2.00 / +0.00
+ (-3.00 / -2.00 / +0.00) 0.000
+ 5 -> -1.00 / -2.00 / +0.00
+ (-1.00 / -2.00 / +0.00) 0.000
+ 6 -> +1.00 / -2.00 / +0.00
+ (+1.00 / -2.00 / +0.00) 0.000
+ 7 -> +3.00 / -2.00 / +0.00
+ (+3.00 / -2.00 / +0.00) 0.000
+ 8 -> -3.00 / +0.00 / +0.00
+ (-3.00 / +0.00 / +0.00) 0.000
+ 9 -> -1.00 / +0.00 / +0.00
+ (-1.00 / +0.00 / +0.00) 0.000
+ 10 -> +1.00 / +0.00 / +0.00
+ (+1.00 / +0.00 / +0.00) 0.000
+ 11 -> +3.00 / +0.00 / +0.00
+ (+3.00 / +0.00 / +0.00) 0.000
+ 12 -> -3.00 / +2.00 / +0.00
+ (-3.00 / +2.00 / +0.00) 0.000
+ 13 -> -1.00 / +2.00 / +0.00
+ (-1.00 / +2.00 / +0.00) 0.000
+ 14 -> +1.00 / +2.00 / +0.00
+ (+1.00 / +2.00 / +0.00) 0.000
+ 15 -> +3.00 / +2.00 / +0.00
+ (+3.00 / +2.00 / +0.00) 0.000
+ 16 -> -3.00 / +4.00 / +0.00
+ (-3.00 / +4.00 / +0.00) 0.000
+ 17 -> -1.00 / +4.00 / +0.00
+ (-1.00 / +4.00 / +0.00) 0.000
+ 18 -> +1.00 / +4.00 / +0.00
+ (+1.00 / +4.00 / +0.00) 0.000
+ 19 -> +3.00 / +4.00 / +0.00
+ (+3.00 / +4.00 / +0.00) 0.000
+ 20 -> -3.00 / -4.00 / +1.00
+ (-3.00 / -4.00 / +1.00) 0.000
+ 21 -> -1.00 / -4.00 / +1.00
+ (-1.00 / -4.00 / +1.00) 0.000
+ 22 -> +1.00 / -4.00 / +1.00
+ (+1.00 / -4.00 / +1.00) 0.000
+ 23 -> +3.00 / -4.00 / +1.00
+ (+3.00 / -4.00 / +1.00) 0.000
+ 24 -> -3.00 / -2.00 / +1.00
+ (-3.00 / -2.00 / +1.00) 0.000
+ 25 -> -1.00 / -2.00 / +1.00
+ (-1.00 / -2.00 / +1.00) 0.000
+ 26 -> +1.00 / -2.00 / +1.00
+ (+1.00 / -2.00 / +1.00) 0.000
+ 27 -> +3.00 / -2.00 / +1.00
+ (+3.00 / -2.00 / +1.00) 0.000
+ 28 -> -3.00 / +0.00 / +1.00
+ (-3.00 / +0.00 / +1.00) 0.000
+ 29 -> -1.00 / +0.00 / +1.00
+ (-1.00 / +0.00 / +1.00) 0.000
+ 30 -> +1.00 / +0.00 / +1.00
+ (+1.00 / +0.00 / +1.00) 0.000
+ 31 -> +3.00 / +0.00 / +1.00
+ (+3.00 / +0.00 / +1.00) 0.000
+ 32 -> -3.00 / +2.00 / +1.00
+ (-3.00 / +2.00 / +1.00) 0.000
+ 33 -> -1.00 / +2.00 / +1.00
+ (-1.00 / +2.00 / +1.00) 0.000
+ 34 -> +1.00 / +2.00 / +1.00
+ (+1.00 / +2.00 / +1.00) 0.000
+ 35 -> +3.00 / +2.00 / +1.00
+ (+3.00 / +2.00 / +1.00) 0.000
+ 36 -> -3.00 / +4.00 / +1.00
+ (-3.00 / +4.00 / +1.00) 0.000
+ 37 -> -1.00 / +4.00 / +1.00
+ (-1.00 / +4.00 / +1.00) 0.000
+ 38 -> +1.00 / +4.00 / +1.00
+ (+1.00 / +4.00 / +1.00) 0.000
+ 39 -> +3.00 / +4.00 / +1.00
+ (+3.00 / +4.00 / +1.00) 0.000
+ 40 -> -3.00 / -4.00 / +2.00
+ (-3.00 / -4.00 / +2.00) 0.000
+ 41 -> -1.00 / -4.00 / +2.00
+ (-1.00 / -4.00 / +2.00) 0.000
+ 42 -> +1.00 / -4.00 / +2.00
+ (+1.00 / -4.00 / +2.00) 0.000
+ 43 -> +3.00 / -4.00 / +2.00
+ (+3.00 / -4.00 / +2.00) 0.000
+ 44 -> -3.00 / -2.00 / +2.00
+ (-3.00 / -2.00 / +2.00) 0.000
+ 45 -> -1.00 / -2.00 / +2.00
+ (-1.00 / -2.00 / +2.00) 0.000
+ 46 -> +1.00 / -2.00 / +2.00
+ (+1.00 / -2.00 / +2.00) 0.000
+ 47 -> +3.00 / -2.00 / +2.00
+ (+3.00 / -2.00 / +2.00) 0.000
+ 48 -> -3.00 / +0.00 / +2.00
+ (-3.00 / +0.00 / +2.00) 0.000
+ 49 -> -1.00 / +0.00 / +2.00
+ (-1.00 / +0.00 / +2.00) 0.000
+ 50 -> +1.00 / +0.00 / +2.00
+ (+1.00 / +0.00 / +2.00) 0.000
+ 51 -> +3.00 / +0.00 / +2.00
+ (+3.00 / +0.00 / +2.00) 0.000
+ 52 -> -3.00 / +2.00 / +2.00
+ (-3.00 / +2.00 / +2.00) 0.000
+ 53 -> -1.00 / +2.00 / +2.00
+ (-1.00 / +2.00 / +2.00) 0.000
+ 54 -> +1.00 / +2.00 / +2.00
+ (+1.00 / +2.00 / +2.00) 0.000
+ 55 -> +3.00 / +2.00 / +2.00
+ (+3.00 / +2.00 / +2.00) 0.000
+ 56 -> -3.00 / +4.00 / +2.00
+ (-3.00 / +4.00 / +2.00) 0.000
+ 57 -> -1.00 / +4.00 / +2.00
+ (-1.00 / +4.00 / +2.00) 0.000
+ 58 -> +1.00 / +4.00 / +2.00
+ (+1.00 / +4.00 / +2.00) 0.000
+ 59 -> +3.00 / +4.00 / +2.00
+ (+3.00 / +4.00 / +2.00) 0.000
diff --git a/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_six.ref b/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_six.ref
new file mode 100644
index 0000000..7751851
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_six.ref
@@ -0,0 +1,296 @@
+Test: x-direction tiled by one pixel, distance=0.5 nbhType=N_CUBE distType=PIXEL
+Samples:
+ 0 -> -3.00 / -4.00 / +0.00 : +5.00
+ 1 -> -1.00 / -4.00 / +0.00 : +4.12
+ 2 -> +1.00 / -4.00 / +0.00 : +4.12
+ 3 -> +3.00 / -4.00 / +0.00 : +5.00
+ 4 -> -2.60 / -2.00 / +0.00 : +3.28
+ 5 -> -0.60 / -2.00 / +0.00 : +2.09
+ 6 -> +1.40 / -2.00 / +0.00 : +2.44
+ 7 -> +3.40 / -2.00 / +0.00 : +3.94
+ 8 -> -2.20 / +0.00 / +0.00 : +2.20
+ 9 -> -0.20 / +0.00 / +0.00 : +0.20
+ 10 -> +1.80 / +0.00 / +0.00 : +1.80
+ 11 -> +3.80 / +0.00 / +0.00 : +3.80
+ 12 -> -1.80 / +2.00 / +0.00 : +2.69
+ 13 -> +0.20 / +2.00 / +0.00 : +2.01
+ 14 -> +2.20 / +2.00 / +0.00 : +2.97
+ 15 -> +4.20 / +2.00 / +0.00 : +4.65
+ 16 -> -1.40 / +4.00 / +0.00 : +4.24
+ 17 -> +0.60 / +4.00 / +0.00 : +4.04
+ 18 -> +2.60 / +4.00 / +0.00 : +4.77
+ 19 -> +4.60 / +4.00 / +0.00 : +6.10
+ 20 -> -3.00 / -4.00 / +1.00 : +5.10
+ 21 -> -1.00 / -4.00 / +1.00 : +4.24
+ 22 -> +1.00 / -4.00 / +1.00 : +4.24
+ 23 -> +3.00 / -4.00 / +1.00 : +5.10
+ 24 -> -2.60 / -2.00 / +1.00 : +3.43
+ 25 -> -0.60 / -2.00 / +1.00 : +2.32
+ 26 -> +1.40 / -2.00 / +1.00 : +2.64
+ 27 -> +3.40 / -2.00 / +1.00 : +4.07
+ 28 -> -2.20 / +0.00 / +1.00 : +2.42
+ 29 -> -0.20 / +0.00 / +1.00 : +1.02
+ 30 -> +1.80 / +0.00 / +1.00 : +2.06
+ 31 -> +3.80 / +0.00 / +1.00 : +3.93
+ 32 -> -1.80 / +2.00 / +1.00 : +2.87
+ 33 -> +0.20 / +2.00 / +1.00 : +2.24
+ 34 -> +2.20 / +2.00 / +1.00 : +3.14
+ 35 -> +4.20 / +2.00 / +1.00 : +4.76
+ 36 -> -1.40 / +4.00 / +1.00 : +4.35
+ 37 -> +0.60 / +4.00 / +1.00 : +4.17
+ 38 -> +2.60 / +4.00 / +1.00 : +4.87
+ 39 -> +4.60 / +4.00 / +1.00 : +6.18
+ 40 -> -3.00 / -4.00 / +2.00 : +5.39
+ 41 -> -1.00 / -4.00 / +2.00 : +4.58
+ 42 -> +1.00 / -4.00 / +2.00 : +4.58
+ 43 -> +3.00 / -4.00 / +2.00 : +5.39
+ 44 -> -2.60 / -2.00 / +2.00 : +3.84
+ 45 -> -0.60 / -2.00 / +2.00 : +2.89
+ 46 -> +1.40 / -2.00 / +2.00 : +3.16
+ 47 -> +3.40 / -2.00 / +2.00 : +4.42
+ 48 -> -2.20 / +0.00 / +2.00 : +2.97
+ 49 -> -0.20 / +0.00 / +2.00 : +2.01
+ 50 -> +1.80 / +0.00 / +2.00 : +2.69
+ 51 -> +3.80 / +0.00 / +2.00 : +4.29
+ 52 -> -1.80 / +2.00 / +2.00 : +3.35
+ 53 -> +0.20 / +2.00 / +2.00 : +2.84
+ 54 -> +2.20 / +2.00 / +2.00 : +3.58
+ 55 -> +4.20 / +2.00 / +2.00 : +5.06
+ 56 -> -1.40 / +4.00 / +2.00 : +4.69
+ 57 -> +0.60 / +4.00 / +2.00 : +4.51
+ 58 -> +2.60 / +4.00 / +2.00 : +5.17
+ 59 -> +4.60 / +4.00 / +2.00 : +6.42
+Grid definition:
+x: dim 4 -3.000...+3.000 delta 2.000
+y: dim 5 -4.000...+4.000 delta 2.000
+l: dim 3 +0.000...+2.000 delta 1.000
+Grid pixel neighbors:
+0 / 0 / 0 (-3.00 / -4.00 / +0.00) : 1
+ (-3.00 / -4.00 / +0.00) 0.000 -> 0
+1 / 0 / 0 (-1.00 / -4.00 / +0.00) : 1
+ (-1.00 / -4.00 / +0.00) 0.000 -> 1
+2 / 0 / 0 (+1.00 / -4.00 / +0.00) : 1
+ (+1.00 / -4.00 / +0.00) 0.000 -> 2
+3 / 0 / 0 (+3.00 / -4.00 / +0.00) : 1
+ (+3.00 / -4.00 / +0.00) 0.000 -> 3
+0 / 1 / 0 (-3.00 / -2.00 / +0.00) : 1
+ (-2.60 / -2.00 / +0.00) 0.200 -> 4
+1 / 1 / 0 (-1.00 / -2.00 / +0.00) : 1
+ (-0.60 / -2.00 / +0.00) 0.200 -> 5
+2 / 1 / 0 (+1.00 / -2.00 / +0.00) : 1
+ (+1.40 / -2.00 / +0.00) 0.200 -> 6
+3 / 1 / 0 (+3.00 / -2.00 / +0.00) : 1
+ (+3.40 / -2.00 / +0.00) 0.200 -> 7
+0 / 2 / 0 (-3.00 / +0.00 / +0.00) : 1
+ (-2.20 / +0.00 / +0.00) 0.400 -> 8
+1 / 2 / 0 (-1.00 / +0.00 / +0.00) : 1
+ (-0.20 / +0.00 / +0.00) 0.400 -> 9
+2 / 2 / 0 (+1.00 / +0.00 / +0.00) : 1
+ (+1.80 / +0.00 / +0.00) 0.400 -> 10
+3 / 2 / 0 (+3.00 / +0.00 / +0.00) : 1
+ (+3.80 / +0.00 / +0.00) 0.400 -> 11
+0 / 3 / 0 (-3.00 / +2.00 / +0.00) : 0
+1 / 3 / 0 (-1.00 / +2.00 / +0.00) : 1
+ (-1.80 / +2.00 / +0.00) 0.400 -> 12
+2 / 3 / 0 (+1.00 / +2.00 / +0.00) : 1
+ (+0.20 / +2.00 / +0.00) 0.400 -> 13
+3 / 3 / 0 (+3.00 / +2.00 / +0.00) : 1
+ (+2.20 / +2.00 / +0.00) 0.400 -> 14
+0 / 4 / 0 (-3.00 / +4.00 / +0.00) : 0
+1 / 4 / 0 (-1.00 / +4.00 / +0.00) : 1
+ (-1.40 / +4.00 / +0.00) 0.200 -> 16
+2 / 4 / 0 (+1.00 / +4.00 / +0.00) : 1
+ (+0.60 / +4.00 / +0.00) 0.200 -> 17
+3 / 4 / 0 (+3.00 / +4.00 / +0.00) : 1
+ (+2.60 / +4.00 / +0.00) 0.200 -> 18
+0 / 0 / 1 (-3.00 / -4.00 / +1.00) : 1
+ (-3.00 / -4.00 / +1.00) 0.000 -> 20
+1 / 0 / 1 (-1.00 / -4.00 / +1.00) : 1
+ (-1.00 / -4.00 / +1.00) 0.000 -> 21
+2 / 0 / 1 (+1.00 / -4.00 / +1.00) : 1
+ (+1.00 / -4.00 / +1.00) 0.000 -> 22
+3 / 0 / 1 (+3.00 / -4.00 / +1.00) : 1
+ (+3.00 / -4.00 / +1.00) 0.000 -> 23
+0 / 1 / 1 (-3.00 / -2.00 / +1.00) : 1
+ (-2.60 / -2.00 / +1.00) 0.200 -> 24
+1 / 1 / 1 (-1.00 / -2.00 / +1.00) : 1
+ (-0.60 / -2.00 / +1.00) 0.200 -> 25
+2 / 1 / 1 (+1.00 / -2.00 / +1.00) : 1
+ (+1.40 / -2.00 / +1.00) 0.200 -> 26
+3 / 1 / 1 (+3.00 / -2.00 / +1.00) : 1
+ (+3.40 / -2.00 / +1.00) 0.200 -> 27
+0 / 2 / 1 (-3.00 / +0.00 / +1.00) : 1
+ (-2.20 / +0.00 / +1.00) 0.400 -> 28
+1 / 2 / 1 (-1.00 / +0.00 / +1.00) : 1
+ (-0.20 / +0.00 / +1.00) 0.400 -> 29
+2 / 2 / 1 (+1.00 / +0.00 / +1.00) : 1
+ (+1.80 / +0.00 / +1.00) 0.400 -> 30
+3 / 2 / 1 (+3.00 / +0.00 / +1.00) : 1
+ (+3.80 / +0.00 / +1.00) 0.400 -> 31
+0 / 3 / 1 (-3.00 / +2.00 / +1.00) : 0
+1 / 3 / 1 (-1.00 / +2.00 / +1.00) : 1
+ (-1.80 / +2.00 / +1.00) 0.400 -> 32
+2 / 3 / 1 (+1.00 / +2.00 / +1.00) : 1
+ (+0.20 / +2.00 / +1.00) 0.400 -> 33
+3 / 3 / 1 (+3.00 / +2.00 / +1.00) : 1
+ (+2.20 / +2.00 / +1.00) 0.400 -> 34
+0 / 4 / 1 (-3.00 / +4.00 / +1.00) : 0
+1 / 4 / 1 (-1.00 / +4.00 / +1.00) : 1
+ (-1.40 / +4.00 / +1.00) 0.200 -> 36
+2 / 4 / 1 (+1.00 / +4.00 / +1.00) : 1
+ (+0.60 / +4.00 / +1.00) 0.200 -> 37
+3 / 4 / 1 (+3.00 / +4.00 / +1.00) : 1
+ (+2.60 / +4.00 / +1.00) 0.200 -> 38
+0 / 0 / 2 (-3.00 / -4.00 / +2.00) : 1
+ (-3.00 / -4.00 / +2.00) 0.000 -> 40
+1 / 0 / 2 (-1.00 / -4.00 / +2.00) : 1
+ (-1.00 / -4.00 / +2.00) 0.000 -> 41
+2 / 0 / 2 (+1.00 / -4.00 / +2.00) : 1
+ (+1.00 / -4.00 / +2.00) 0.000 -> 42
+3 / 0 / 2 (+3.00 / -4.00 / +2.00) : 1
+ (+3.00 / -4.00 / +2.00) 0.000 -> 43
+0 / 1 / 2 (-3.00 / -2.00 / +2.00) : 1
+ (-2.60 / -2.00 / +2.00) 0.200 -> 44
+1 / 1 / 2 (-1.00 / -2.00 / +2.00) : 1
+ (-0.60 / -2.00 / +2.00) 0.200 -> 45
+2 / 1 / 2 (+1.00 / -2.00 / +2.00) : 1
+ (+1.40 / -2.00 / +2.00) 0.200 -> 46
+3 / 1 / 2 (+3.00 / -2.00 / +2.00) : 1
+ (+3.40 / -2.00 / +2.00) 0.200 -> 47
+0 / 2 / 2 (-3.00 / +0.00 / +2.00) : 1
+ (-2.20 / +0.00 / +2.00) 0.400 -> 48
+1 / 2 / 2 (-1.00 / +0.00 / +2.00) : 1
+ (-0.20 / +0.00 / +2.00) 0.400 -> 49
+2 / 2 / 2 (+1.00 / +0.00 / +2.00) : 1
+ (+1.80 / +0.00 / +2.00) 0.400 -> 50
+3 / 2 / 2 (+3.00 / +0.00 / +2.00) : 1
+ (+3.80 / +0.00 / +2.00) 0.400 -> 51
+0 / 3 / 2 (-3.00 / +2.00 / +2.00) : 0
+1 / 3 / 2 (-1.00 / +2.00 / +2.00) : 1
+ (-1.80 / +2.00 / +2.00) 0.400 -> 52
+2 / 3 / 2 (+1.00 / +2.00 / +2.00) : 1
+ (+0.20 / +2.00 / +2.00) 0.400 -> 53
+3 / 3 / 2 (+3.00 / +2.00 / +2.00) : 1
+ (+2.20 / +2.00 / +2.00) 0.400 -> 54
+0 / 4 / 2 (-3.00 / +4.00 / +2.00) : 0
+1 / 4 / 2 (-1.00 / +4.00 / +2.00) : 1
+ (-1.40 / +4.00 / +2.00) 0.200 -> 56
+2 / 4 / 2 (+1.00 / +4.00 / +2.00) : 1
+ (+0.60 / +4.00 / +2.00) 0.200 -> 57
+3 / 4 / 2 (+3.00 / +4.00 / +2.00) : 1
+ (+2.60 / +4.00 / +2.00) 0.200 -> 58
+Sample readout neighbors:
+ 0 -> -3.00 / -4.00 / +0.00
+ (-3.00 / -4.00 / +0.00) 0.000
+ 1 -> -1.00 / -4.00 / +0.00
+ (-1.00 / -4.00 / +0.00) 0.000
+ 2 -> +1.00 / -4.00 / +0.00
+ (+1.00 / -4.00 / +0.00) 0.000
+ 3 -> +3.00 / -4.00 / +0.00
+ (+3.00 / -4.00 / +0.00) 0.000
+ 4 -> -2.60 / -2.00 / +0.00
+ (-3.00 / -2.00 / +0.00) 0.200
+ 5 -> -0.60 / -2.00 / +0.00
+ (-1.00 / -2.00 / +0.00) 0.200
+ 6 -> +1.40 / -2.00 / +0.00
+ (+1.00 / -2.00 / +0.00) 0.200
+ 7 -> +3.40 / -2.00 / +0.00
+ (+3.00 / -2.00 / +0.00) 0.200
+ 8 -> -2.20 / +0.00 / +0.00
+ (-3.00 / +0.00 / +0.00) 0.400
+ 9 -> -0.20 / +0.00 / +0.00
+ (-1.00 / +0.00 / +0.00) 0.400
+ 10 -> +1.80 / +0.00 / +0.00
+ (+1.00 / +0.00 / +0.00) 0.400
+ 11 -> +3.80 / +0.00 / +0.00
+ (+3.00 / +0.00 / +0.00) 0.400
+ 12 -> -1.80 / +2.00 / +0.00
+ (-1.00 / +2.00 / +0.00) 0.400
+ 13 -> +0.20 / +2.00 / +0.00
+ (+1.00 / +2.00 / +0.00) 0.400
+ 14 -> +2.20 / +2.00 / +0.00
+ (+3.00 / +2.00 / +0.00) 0.400
+ 15 -> +4.20 / +2.00 / +0.00
+ 16 -> -1.40 / +4.00 / +0.00
+ (-1.00 / +4.00 / +0.00) 0.200
+ 17 -> +0.60 / +4.00 / +0.00
+ (+1.00 / +4.00 / +0.00) 0.200
+ 18 -> +2.60 / +4.00 / +0.00
+ (+3.00 / +4.00 / +0.00) 0.200
+ 19 -> +4.60 / +4.00 / +0.00
+ 20 -> -3.00 / -4.00 / +1.00
+ (-3.00 / -4.00 / +1.00) 0.000
+ 21 -> -1.00 / -4.00 / +1.00
+ (-1.00 / -4.00 / +1.00) 0.000
+ 22 -> +1.00 / -4.00 / +1.00
+ (+1.00 / -4.00 / +1.00) 0.000
+ 23 -> +3.00 / -4.00 / +1.00
+ (+3.00 / -4.00 / +1.00) 0.000
+ 24 -> -2.60 / -2.00 / +1.00
+ (-3.00 / -2.00 / +1.00) 0.200
+ 25 -> -0.60 / -2.00 / +1.00
+ (-1.00 / -2.00 / +1.00) 0.200
+ 26 -> +1.40 / -2.00 / +1.00
+ (+1.00 / -2.00 / +1.00) 0.200
+ 27 -> +3.40 / -2.00 / +1.00
+ (+3.00 / -2.00 / +1.00) 0.200
+ 28 -> -2.20 / +0.00 / +1.00
+ (-3.00 / +0.00 / +1.00) 0.400
+ 29 -> -0.20 / +0.00 / +1.00
+ (-1.00 / +0.00 / +1.00) 0.400
+ 30 -> +1.80 / +0.00 / +1.00
+ (+1.00 / +0.00 / +1.00) 0.400
+ 31 -> +3.80 / +0.00 / +1.00
+ (+3.00 / +0.00 / +1.00) 0.400
+ 32 -> -1.80 / +2.00 / +1.00
+ (-1.00 / +2.00 / +1.00) 0.400
+ 33 -> +0.20 / +2.00 / +1.00
+ (+1.00 / +2.00 / +1.00) 0.400
+ 34 -> +2.20 / +2.00 / +1.00
+ (+3.00 / +2.00 / +1.00) 0.400
+ 35 -> +4.20 / +2.00 / +1.00
+ 36 -> -1.40 / +4.00 / +1.00
+ (-1.00 / +4.00 / +1.00) 0.200
+ 37 -> +0.60 / +4.00 / +1.00
+ (+1.00 / +4.00 / +1.00) 0.200
+ 38 -> +2.60 / +4.00 / +1.00
+ (+3.00 / +4.00 / +1.00) 0.200
+ 39 -> +4.60 / +4.00 / +1.00
+ 40 -> -3.00 / -4.00 / +2.00
+ (-3.00 / -4.00 / +2.00) 0.000
+ 41 -> -1.00 / -4.00 / +2.00
+ (-1.00 / -4.00 / +2.00) 0.000
+ 42 -> +1.00 / -4.00 / +2.00
+ (+1.00 / -4.00 / +2.00) 0.000
+ 43 -> +3.00 / -4.00 / +2.00
+ (+3.00 / -4.00 / +2.00) 0.000
+ 44 -> -2.60 / -2.00 / +2.00
+ (-3.00 / -2.00 / +2.00) 0.200
+ 45 -> -0.60 / -2.00 / +2.00
+ (-1.00 / -2.00 / +2.00) 0.200
+ 46 -> +1.40 / -2.00 / +2.00
+ (+1.00 / -2.00 / +2.00) 0.200
+ 47 -> +3.40 / -2.00 / +2.00
+ (+3.00 / -2.00 / +2.00) 0.200
+ 48 -> -2.20 / +0.00 / +2.00
+ (-3.00 / +0.00 / +2.00) 0.400
+ 49 -> -0.20 / +0.00 / +2.00
+ (-1.00 / +0.00 / +2.00) 0.400
+ 50 -> +1.80 / +0.00 / +2.00
+ (+1.00 / +0.00 / +2.00) 0.400
+ 51 -> +3.80 / +0.00 / +2.00
+ (+3.00 / +0.00 / +2.00) 0.400
+ 52 -> -1.80 / +2.00 / +2.00
+ (-1.00 / +2.00 / +2.00) 0.400
+ 53 -> +0.20 / +2.00 / +2.00
+ (+1.00 / +2.00 / +2.00) 0.400
+ 54 -> +2.20 / +2.00 / +2.00
+ (+3.00 / +2.00 / +2.00) 0.400
+ 55 -> +4.20 / +2.00 / +2.00
+ 56 -> -1.40 / +4.00 / +2.00
+ (-1.00 / +4.00 / +2.00) 0.200
+ 57 -> +0.60 / +4.00 / +2.00
+ (+1.00 / +4.00 / +2.00) 0.200
+ 58 -> +2.60 / +4.00 / +2.00
+ (+3.00 / +4.00 / +2.00) 0.200
+ 59 -> +4.60 / +4.00 / +2.00
diff --git a/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_three.ref b/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_three.ref
new file mode 100644
index 0000000..b1d131d
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_three.ref
@@ -0,0 +1,308 @@
+Test: second layer shifted by 0.6 in l-direction and by 0.4 in y-direction, distance=0.5 nbhType=N_CUBE distType=PIXEL
+Samples:
+ 0 -> -3.00 / -4.00 / +0.00 : +5.00
+ 1 -> -1.00 / -4.00 / +0.00 : +4.12
+ 2 -> +1.00 / -4.00 / +0.00 : +4.12
+ 3 -> +3.00 / -4.00 / +0.00 : +5.00
+ 4 -> -3.00 / -2.00 / +0.00 : +3.61
+ 5 -> -1.00 / -2.00 / +0.00 : +2.24
+ 6 -> +1.00 / -2.00 / +0.00 : +2.24
+ 7 -> +3.00 / -2.00 / +0.00 : +3.61
+ 8 -> -3.00 / +0.00 / +0.00 : +3.00
+ 9 -> -1.00 / +0.00 / +0.00 : +1.00
+ 10 -> +1.00 / +0.00 / +0.00 : +1.00
+ 11 -> +3.00 / +0.00 / +0.00 : +3.00
+ 12 -> -3.00 / +2.00 / +0.00 : +3.61
+ 13 -> -1.00 / +2.00 / +0.00 : +2.24
+ 14 -> +1.00 / +2.00 / +0.00 : +2.24
+ 15 -> +3.00 / +2.00 / +0.00 : +3.61
+ 16 -> -3.00 / +4.00 / +0.00 : +5.00
+ 17 -> -1.00 / +4.00 / +0.00 : +4.12
+ 18 -> +1.00 / +4.00 / +0.00 : +4.12
+ 19 -> +3.00 / +4.00 / +0.00 : +5.00
+ 20 -> -3.00 / -3.20 / +1.60 : +4.67
+ 21 -> -1.00 / -3.20 / +1.60 : +3.71
+ 22 -> +1.00 / -3.20 / +1.60 : +3.71
+ 23 -> +3.00 / -3.20 / +1.60 : +4.67
+ 24 -> -3.00 / -1.20 / +1.60 : +3.61
+ 25 -> -1.00 / -1.20 / +1.60 : +2.24
+ 26 -> +1.00 / -1.20 / +1.60 : +2.24
+ 27 -> +3.00 / -1.20 / +1.60 : +3.61
+ 28 -> -3.00 / +0.80 / +1.60 : +3.49
+ 29 -> -1.00 / +0.80 / +1.60 : +2.05
+ 30 -> +1.00 / +0.80 / +1.60 : +2.05
+ 31 -> +3.00 / +0.80 / +1.60 : +3.49
+ 32 -> -3.00 / +2.80 / +1.60 : +4.40
+ 33 -> -1.00 / +2.80 / +1.60 : +3.38
+ 34 -> +1.00 / +2.80 / +1.60 : +3.38
+ 35 -> +3.00 / +2.80 / +1.60 : +4.40
+ 36 -> -3.00 / +4.80 / +1.60 : +5.88
+ 37 -> -1.00 / +4.80 / +1.60 : +5.16
+ 38 -> +1.00 / +4.80 / +1.60 : +5.16
+ 39 -> +3.00 / +4.80 / +1.60 : +5.88
+ 40 -> -3.00 / -4.00 / +2.00 : +5.39
+ 41 -> -1.00 / -4.00 / +2.00 : +4.58
+ 42 -> +1.00 / -4.00 / +2.00 : +4.58
+ 43 -> +3.00 / -4.00 / +2.00 : +5.39
+ 44 -> -3.00 / -2.00 / +2.00 : +4.12
+ 45 -> -1.00 / -2.00 / +2.00 : +3.00
+ 46 -> +1.00 / -2.00 / +2.00 : +3.00
+ 47 -> +3.00 / -2.00 / +2.00 : +4.12
+ 48 -> -3.00 / +0.00 / +2.00 : +3.61
+ 49 -> -1.00 / +0.00 / +2.00 : +2.24
+ 50 -> +1.00 / +0.00 / +2.00 : +2.24
+ 51 -> +3.00 / +0.00 / +2.00 : +3.61
+ 52 -> -3.00 / +2.00 / +2.00 : +4.12
+ 53 -> -1.00 / +2.00 / +2.00 : +3.00
+ 54 -> +1.00 / +2.00 / +2.00 : +3.00
+ 55 -> +3.00 / +2.00 / +2.00 : +4.12
+ 56 -> -3.00 / +4.00 / +2.00 : +5.39
+ 57 -> -1.00 / +4.00 / +2.00 : +4.58
+ 58 -> +1.00 / +4.00 / +2.00 : +4.58
+ 59 -> +3.00 / +4.00 / +2.00 : +5.39
+Grid definition:
+x: dim 4 -3.000...+3.000 delta 2.000
+y: dim 5 -4.000...+4.000 delta 2.000
+l: dim 3 +0.000...+2.000 delta 1.000
+Grid pixel neighbors:
+0 / 0 / 0 (-3.00 / -4.00 / +0.00) : 1
+ (-3.00 / -4.00 / +0.00) 0.000 -> 0
+1 / 0 / 0 (-1.00 / -4.00 / +0.00) : 1
+ (-1.00 / -4.00 / +0.00) 0.000 -> 1
+2 / 0 / 0 (+1.00 / -4.00 / +0.00) : 1
+ (+1.00 / -4.00 / +0.00) 0.000 -> 2
+3 / 0 / 0 (+3.00 / -4.00 / +0.00) : 1
+ (+3.00 / -4.00 / +0.00) 0.000 -> 3
+0 / 1 / 0 (-3.00 / -2.00 / +0.00) : 1
+ (-3.00 / -2.00 / +0.00) 0.000 -> 4
+1 / 1 / 0 (-1.00 / -2.00 / +0.00) : 1
+ (-1.00 / -2.00 / +0.00) 0.000 -> 5
+2 / 1 / 0 (+1.00 / -2.00 / +0.00) : 1
+ (+1.00 / -2.00 / +0.00) 0.000 -> 6
+3 / 1 / 0 (+3.00 / -2.00 / +0.00) : 1
+ (+3.00 / -2.00 / +0.00) 0.000 -> 7
+0 / 2 / 0 (-3.00 / +0.00 / +0.00) : 1
+ (-3.00 / +0.00 / +0.00) 0.000 -> 8
+1 / 2 / 0 (-1.00 / +0.00 / +0.00) : 1
+ (-1.00 / +0.00 / +0.00) 0.000 -> 9
+2 / 2 / 0 (+1.00 / +0.00 / +0.00) : 1
+ (+1.00 / +0.00 / +0.00) 0.000 -> 10
+3 / 2 / 0 (+3.00 / +0.00 / +0.00) : 1
+ (+3.00 / +0.00 / +0.00) 0.000 -> 11
+0 / 3 / 0 (-3.00 / +2.00 / +0.00) : 1
+ (-3.00 / +2.00 / +0.00) 0.000 -> 12
+1 / 3 / 0 (-1.00 / +2.00 / +0.00) : 1
+ (-1.00 / +2.00 / +0.00) 0.000 -> 13
+2 / 3 / 0 (+1.00 / +2.00 / +0.00) : 1
+ (+1.00 / +2.00 / +0.00) 0.000 -> 14
+3 / 3 / 0 (+3.00 / +2.00 / +0.00) : 1
+ (+3.00 / +2.00 / +0.00) 0.000 -> 15
+0 / 4 / 0 (-3.00 / +4.00 / +0.00) : 1
+ (-3.00 / +4.00 / +0.00) 0.000 -> 16
+1 / 4 / 0 (-1.00 / +4.00 / +0.00) : 1
+ (-1.00 / +4.00 / +0.00) 0.000 -> 17
+2 / 4 / 0 (+1.00 / +4.00 / +0.00) : 1
+ (+1.00 / +4.00 / +0.00) 0.000 -> 18
+3 / 4 / 0 (+3.00 / +4.00 / +0.00) : 1
+ (+3.00 / +4.00 / +0.00) 0.000 -> 19
+0 / 0 / 1 (-3.00 / -4.00 / +1.00) : 0
+1 / 0 / 1 (-1.00 / -4.00 / +1.00) : 0
+2 / 0 / 1 (+1.00 / -4.00 / +1.00) : 0
+3 / 0 / 1 (+3.00 / -4.00 / +1.00) : 0
+0 / 1 / 1 (-3.00 / -2.00 / +1.00) : 0
+1 / 1 / 1 (-1.00 / -2.00 / +1.00) : 0
+2 / 1 / 1 (+1.00 / -2.00 / +1.00) : 0
+3 / 1 / 1 (+3.00 / -2.00 / +1.00) : 0
+0 / 2 / 1 (-3.00 / +0.00 / +1.00) : 0
+1 / 2 / 1 (-1.00 / +0.00 / +1.00) : 0
+2 / 2 / 1 (+1.00 / +0.00 / +1.00) : 0
+3 / 2 / 1 (+3.00 / +0.00 / +1.00) : 0
+0 / 3 / 1 (-3.00 / +2.00 / +1.00) : 0
+1 / 3 / 1 (-1.00 / +2.00 / +1.00) : 0
+2 / 3 / 1 (+1.00 / +2.00 / +1.00) : 0
+3 / 3 / 1 (+3.00 / +2.00 / +1.00) : 0
+0 / 4 / 1 (-3.00 / +4.00 / +1.00) : 0
+1 / 4 / 1 (-1.00 / +4.00 / +1.00) : 0
+2 / 4 / 1 (+1.00 / +4.00 / +1.00) : 0
+3 / 4 / 1 (+3.00 / +4.00 / +1.00) : 0
+0 / 0 / 2 (-3.00 / -4.00 / +2.00) : 2
+ (-3.00 / -4.00 / +2.00) 0.000 -> 40
+ (-3.00 / -3.20 / +1.60) 0.566 -> 20
+1 / 0 / 2 (-1.00 / -4.00 / +2.00) : 2
+ (-1.00 / -4.00 / +2.00) 0.000 -> 41
+ (-1.00 / -3.20 / +1.60) 0.566 -> 21
+2 / 0 / 2 (+1.00 / -4.00 / +2.00) : 2
+ (+1.00 / -4.00 / +2.00) 0.000 -> 42
+ (+1.00 / -3.20 / +1.60) 0.566 -> 22
+3 / 0 / 2 (+3.00 / -4.00 / +2.00) : 2
+ (+3.00 / -4.00 / +2.00) 0.000 -> 43
+ (+3.00 / -3.20 / +1.60) 0.566 -> 23
+0 / 1 / 2 (-3.00 / -2.00 / +2.00) : 2
+ (-3.00 / -2.00 / +2.00) 0.000 -> 44
+ (-3.00 / -1.20 / +1.60) 0.566 -> 24
+1 / 1 / 2 (-1.00 / -2.00 / +2.00) : 2
+ (-1.00 / -2.00 / +2.00) 0.000 -> 45
+ (-1.00 / -1.20 / +1.60) 0.566 -> 25
+2 / 1 / 2 (+1.00 / -2.00 / +2.00) : 2
+ (+1.00 / -2.00 / +2.00) 0.000 -> 46
+ (+1.00 / -1.20 / +1.60) 0.566 -> 26
+3 / 1 / 2 (+3.00 / -2.00 / +2.00) : 2
+ (+3.00 / -2.00 / +2.00) 0.000 -> 47
+ (+3.00 / -1.20 / +1.60) 0.566 -> 27
+0 / 2 / 2 (-3.00 / +0.00 / +2.00) : 2
+ (-3.00 / +0.00 / +2.00) 0.000 -> 48
+ (-3.00 / +0.80 / +1.60) 0.566 -> 28
+1 / 2 / 2 (-1.00 / +0.00 / +2.00) : 2
+ (-1.00 / +0.00 / +2.00) 0.000 -> 49
+ (-1.00 / +0.80 / +1.60) 0.566 -> 29
+2 / 2 / 2 (+1.00 / +0.00 / +2.00) : 2
+ (+1.00 / +0.00 / +2.00) 0.000 -> 50
+ (+1.00 / +0.80 / +1.60) 0.566 -> 30
+3 / 2 / 2 (+3.00 / +0.00 / +2.00) : 2
+ (+3.00 / +0.00 / +2.00) 0.000 -> 51
+ (+3.00 / +0.80 / +1.60) 0.566 -> 31
+0 / 3 / 2 (-3.00 / +2.00 / +2.00) : 2
+ (-3.00 / +2.00 / +2.00) 0.000 -> 52
+ (-3.00 / +2.80 / +1.60) 0.566 -> 32
+1 / 3 / 2 (-1.00 / +2.00 / +2.00) : 2
+ (-1.00 / +2.00 / +2.00) 0.000 -> 53
+ (-1.00 / +2.80 / +1.60) 0.566 -> 33
+2 / 3 / 2 (+1.00 / +2.00 / +2.00) : 2
+ (+1.00 / +2.00 / +2.00) 0.000 -> 54
+ (+1.00 / +2.80 / +1.60) 0.566 -> 34
+3 / 3 / 2 (+3.00 / +2.00 / +2.00) : 2
+ (+3.00 / +2.00 / +2.00) 0.000 -> 55
+ (+3.00 / +2.80 / +1.60) 0.566 -> 35
+0 / 4 / 2 (-3.00 / +4.00 / +2.00) : 2
+ (-3.00 / +4.00 / +2.00) 0.000 -> 56
+ (-3.00 / +4.80 / +1.60) 0.566 -> 36
+1 / 4 / 2 (-1.00 / +4.00 / +2.00) : 2
+ (-1.00 / +4.00 / +2.00) 0.000 -> 57
+ (-1.00 / +4.80 / +1.60) 0.566 -> 37
+2 / 4 / 2 (+1.00 / +4.00 / +2.00) : 2
+ (+1.00 / +4.00 / +2.00) 0.000 -> 58
+ (+1.00 / +4.80 / +1.60) 0.566 -> 38
+3 / 4 / 2 (+3.00 / +4.00 / +2.00) : 2
+ (+3.00 / +4.00 / +2.00) 0.000 -> 59
+ (+3.00 / +4.80 / +1.60) 0.566 -> 39
+Sample readout neighbors:
+ 0 -> -3.00 / -4.00 / +0.00
+ (-3.00 / -4.00 / +0.00) 0.000
+ 1 -> -1.00 / -4.00 / +0.00
+ (-1.00 / -4.00 / +0.00) 0.000
+ 2 -> +1.00 / -4.00 / +0.00
+ (+1.00 / -4.00 / +0.00) 0.000
+ 3 -> +3.00 / -4.00 / +0.00
+ (+3.00 / -4.00 / +0.00) 0.000
+ 4 -> -3.00 / -2.00 / +0.00
+ (-3.00 / -2.00 / +0.00) 0.000
+ 5 -> -1.00 / -2.00 / +0.00
+ (-1.00 / -2.00 / +0.00) 0.000
+ 6 -> +1.00 / -2.00 / +0.00
+ (+1.00 / -2.00 / +0.00) 0.000
+ 7 -> +3.00 / -2.00 / +0.00
+ (+3.00 / -2.00 / +0.00) 0.000
+ 8 -> -3.00 / +0.00 / +0.00
+ (-3.00 / +0.00 / +0.00) 0.000
+ 9 -> -1.00 / +0.00 / +0.00
+ (-1.00 / +0.00 / +0.00) 0.000
+ 10 -> +1.00 / +0.00 / +0.00
+ (+1.00 / +0.00 / +0.00) 0.000
+ 11 -> +3.00 / +0.00 / +0.00
+ (+3.00 / +0.00 / +0.00) 0.000
+ 12 -> -3.00 / +2.00 / +0.00
+ (-3.00 / +2.00 / +0.00) 0.000
+ 13 -> -1.00 / +2.00 / +0.00
+ (-1.00 / +2.00 / +0.00) 0.000
+ 14 -> +1.00 / +2.00 / +0.00
+ (+1.00 / +2.00 / +0.00) 0.000
+ 15 -> +3.00 / +2.00 / +0.00
+ (+3.00 / +2.00 / +0.00) 0.000
+ 16 -> -3.00 / +4.00 / +0.00
+ (-3.00 / +4.00 / +0.00) 0.000
+ 17 -> -1.00 / +4.00 / +0.00
+ (-1.00 / +4.00 / +0.00) 0.000
+ 18 -> +1.00 / +4.00 / +0.00
+ (+1.00 / +4.00 / +0.00) 0.000
+ 19 -> +3.00 / +4.00 / +0.00
+ (+3.00 / +4.00 / +0.00) 0.000
+ 20 -> -3.00 / -3.20 / +1.60
+ (-3.00 / -4.00 / +2.00) 0.566
+ 21 -> -1.00 / -3.20 / +1.60
+ (-1.00 / -4.00 / +2.00) 0.566
+ 22 -> +1.00 / -3.20 / +1.60
+ (+1.00 / -4.00 / +2.00) 0.566
+ 23 -> +3.00 / -3.20 / +1.60
+ (+3.00 / -4.00 / +2.00) 0.566
+ 24 -> -3.00 / -1.20 / +1.60
+ (-3.00 / -2.00 / +2.00) 0.566
+ 25 -> -1.00 / -1.20 / +1.60
+ (-1.00 / -2.00 / +2.00) 0.566
+ 26 -> +1.00 / -1.20 / +1.60
+ (+1.00 / -2.00 / +2.00) 0.566
+ 27 -> +3.00 / -1.20 / +1.60
+ (+3.00 / -2.00 / +2.00) 0.566
+ 28 -> -3.00 / +0.80 / +1.60
+ (-3.00 / +0.00 / +2.00) 0.566
+ 29 -> -1.00 / +0.80 / +1.60
+ (-1.00 / +0.00 / +2.00) 0.566
+ 30 -> +1.00 / +0.80 / +1.60
+ (+1.00 / +0.00 / +2.00) 0.566
+ 31 -> +3.00 / +0.80 / +1.60
+ (+3.00 / +0.00 / +2.00) 0.566
+ 32 -> -3.00 / +2.80 / +1.60
+ (-3.00 / +2.00 / +2.00) 0.566
+ 33 -> -1.00 / +2.80 / +1.60
+ (-1.00 / +2.00 / +2.00) 0.566
+ 34 -> +1.00 / +2.80 / +1.60
+ (+1.00 / +2.00 / +2.00) 0.566
+ 35 -> +3.00 / +2.80 / +1.60
+ (+3.00 / +2.00 / +2.00) 0.566
+ 36 -> -3.00 / +4.80 / +1.60
+ (-3.00 / +4.00 / +2.00) 0.566
+ 37 -> -1.00 / +4.80 / +1.60
+ (-1.00 / +4.00 / +2.00) 0.566
+ 38 -> +1.00 / +4.80 / +1.60
+ (+1.00 / +4.00 / +2.00) 0.566
+ 39 -> +3.00 / +4.80 / +1.60
+ (+3.00 / +4.00 / +2.00) 0.566
+ 40 -> -3.00 / -4.00 / +2.00
+ (-3.00 / -4.00 / +2.00) 0.000
+ 41 -> -1.00 / -4.00 / +2.00
+ (-1.00 / -4.00 / +2.00) 0.000
+ 42 -> +1.00 / -4.00 / +2.00
+ (+1.00 / -4.00 / +2.00) 0.000
+ 43 -> +3.00 / -4.00 / +2.00
+ (+3.00 / -4.00 / +2.00) 0.000
+ 44 -> -3.00 / -2.00 / +2.00
+ (-3.00 / -2.00 / +2.00) 0.000
+ 45 -> -1.00 / -2.00 / +2.00
+ (-1.00 / -2.00 / +2.00) 0.000
+ 46 -> +1.00 / -2.00 / +2.00
+ (+1.00 / -2.00 / +2.00) 0.000
+ 47 -> +3.00 / -2.00 / +2.00
+ (+3.00 / -2.00 / +2.00) 0.000
+ 48 -> -3.00 / +0.00 / +2.00
+ (-3.00 / +0.00 / +2.00) 0.000
+ 49 -> -1.00 / +0.00 / +2.00
+ (-1.00 / +0.00 / +2.00) 0.000
+ 50 -> +1.00 / +0.00 / +2.00
+ (+1.00 / +0.00 / +2.00) 0.000
+ 51 -> +3.00 / +0.00 / +2.00
+ (+3.00 / +0.00 / +2.00) 0.000
+ 52 -> -3.00 / +2.00 / +2.00
+ (-3.00 / +2.00 / +2.00) 0.000
+ 53 -> -1.00 / +2.00 / +2.00
+ (-1.00 / +2.00 / +2.00) 0.000
+ 54 -> +1.00 / +2.00 / +2.00
+ (+1.00 / +2.00 / +2.00) 0.000
+ 55 -> +3.00 / +2.00 / +2.00
+ (+3.00 / +2.00 / +2.00) 0.000
+ 56 -> -3.00 / +4.00 / +2.00
+ (-3.00 / +4.00 / +2.00) 0.000
+ 57 -> -1.00 / +4.00 / +2.00
+ (-1.00 / +4.00 / +2.00) 0.000
+ 58 -> +1.00 / +4.00 / +2.00
+ (+1.00 / +4.00 / +2.00) 0.000
+ 59 -> +3.00 / +4.00 / +2.00
+ (+3.00 / +4.00 / +2.00) 0.000
diff --git a/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_two.ref b/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_two.ref
new file mode 100644
index 0000000..87ee0da
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_priv_find_neighbors_two.ref
@@ -0,0 +1,308 @@
+Test: second layer shifted in l-direction by 0.6, distance=0.5 nbhType=N_CUBE distType=PIXEL
+Samples:
+ 0 -> -3.00 / -4.00 / +0.00 : +5.00
+ 1 -> -1.00 / -4.00 / +0.00 : +4.12
+ 2 -> +1.00 / -4.00 / +0.00 : +4.12
+ 3 -> +3.00 / -4.00 / +0.00 : +5.00
+ 4 -> -3.00 / -2.00 / +0.00 : +3.61
+ 5 -> -1.00 / -2.00 / +0.00 : +2.24
+ 6 -> +1.00 / -2.00 / +0.00 : +2.24
+ 7 -> +3.00 / -2.00 / +0.00 : +3.61
+ 8 -> -3.00 / +0.00 / +0.00 : +3.00
+ 9 -> -1.00 / +0.00 / +0.00 : +1.00
+ 10 -> +1.00 / +0.00 / +0.00 : +1.00
+ 11 -> +3.00 / +0.00 / +0.00 : +3.00
+ 12 -> -3.00 / +2.00 / +0.00 : +3.61
+ 13 -> -1.00 / +2.00 / +0.00 : +2.24
+ 14 -> +1.00 / +2.00 / +0.00 : +2.24
+ 15 -> +3.00 / +2.00 / +0.00 : +3.61
+ 16 -> -3.00 / +4.00 / +0.00 : +5.00
+ 17 -> -1.00 / +4.00 / +0.00 : +4.12
+ 18 -> +1.00 / +4.00 / +0.00 : +4.12
+ 19 -> +3.00 / +4.00 / +0.00 : +5.00
+ 20 -> -3.00 / -4.00 / +1.60 : +5.25
+ 21 -> -1.00 / -4.00 / +1.60 : +4.42
+ 22 -> +1.00 / -4.00 / +1.60 : +4.42
+ 23 -> +3.00 / -4.00 / +1.60 : +5.25
+ 24 -> -3.00 / -2.00 / +1.60 : +3.94
+ 25 -> -1.00 / -2.00 / +1.60 : +2.75
+ 26 -> +1.00 / -2.00 / +1.60 : +2.75
+ 27 -> +3.00 / -2.00 / +1.60 : +3.94
+ 28 -> -3.00 / +0.00 / +1.60 : +3.40
+ 29 -> -1.00 / +0.00 / +1.60 : +1.89
+ 30 -> +1.00 / +0.00 / +1.60 : +1.89
+ 31 -> +3.00 / +0.00 / +1.60 : +3.40
+ 32 -> -3.00 / +2.00 / +1.60 : +3.94
+ 33 -> -1.00 / +2.00 / +1.60 : +2.75
+ 34 -> +1.00 / +2.00 / +1.60 : +2.75
+ 35 -> +3.00 / +2.00 / +1.60 : +3.94
+ 36 -> -3.00 / +4.00 / +1.60 : +5.25
+ 37 -> -1.00 / +4.00 / +1.60 : +4.42
+ 38 -> +1.00 / +4.00 / +1.60 : +4.42
+ 39 -> +3.00 / +4.00 / +1.60 : +5.25
+ 40 -> -3.00 / -4.00 / +2.00 : +5.39
+ 41 -> -1.00 / -4.00 / +2.00 : +4.58
+ 42 -> +1.00 / -4.00 / +2.00 : +4.58
+ 43 -> +3.00 / -4.00 / +2.00 : +5.39
+ 44 -> -3.00 / -2.00 / +2.00 : +4.12
+ 45 -> -1.00 / -2.00 / +2.00 : +3.00
+ 46 -> +1.00 / -2.00 / +2.00 : +3.00
+ 47 -> +3.00 / -2.00 / +2.00 : +4.12
+ 48 -> -3.00 / +0.00 / +2.00 : +3.61
+ 49 -> -1.00 / +0.00 / +2.00 : +2.24
+ 50 -> +1.00 / +0.00 / +2.00 : +2.24
+ 51 -> +3.00 / +0.00 / +2.00 : +3.61
+ 52 -> -3.00 / +2.00 / +2.00 : +4.12
+ 53 -> -1.00 / +2.00 / +2.00 : +3.00
+ 54 -> +1.00 / +2.00 / +2.00 : +3.00
+ 55 -> +3.00 / +2.00 / +2.00 : +4.12
+ 56 -> -3.00 / +4.00 / +2.00 : +5.39
+ 57 -> -1.00 / +4.00 / +2.00 : +4.58
+ 58 -> +1.00 / +4.00 / +2.00 : +4.58
+ 59 -> +3.00 / +4.00 / +2.00 : +5.39
+Grid definition:
+x: dim 4 -3.000...+3.000 delta 2.000
+y: dim 5 -4.000...+4.000 delta 2.000
+l: dim 3 +0.000...+2.000 delta 1.000
+Grid pixel neighbors:
+0 / 0 / 0 (-3.00 / -4.00 / +0.00) : 1
+ (-3.00 / -4.00 / +0.00) 0.000 -> 0
+1 / 0 / 0 (-1.00 / -4.00 / +0.00) : 1
+ (-1.00 / -4.00 / +0.00) 0.000 -> 1
+2 / 0 / 0 (+1.00 / -4.00 / +0.00) : 1
+ (+1.00 / -4.00 / +0.00) 0.000 -> 2
+3 / 0 / 0 (+3.00 / -4.00 / +0.00) : 1
+ (+3.00 / -4.00 / +0.00) 0.000 -> 3
+0 / 1 / 0 (-3.00 / -2.00 / +0.00) : 1
+ (-3.00 / -2.00 / +0.00) 0.000 -> 4
+1 / 1 / 0 (-1.00 / -2.00 / +0.00) : 1
+ (-1.00 / -2.00 / +0.00) 0.000 -> 5
+2 / 1 / 0 (+1.00 / -2.00 / +0.00) : 1
+ (+1.00 / -2.00 / +0.00) 0.000 -> 6
+3 / 1 / 0 (+3.00 / -2.00 / +0.00) : 1
+ (+3.00 / -2.00 / +0.00) 0.000 -> 7
+0 / 2 / 0 (-3.00 / +0.00 / +0.00) : 1
+ (-3.00 / +0.00 / +0.00) 0.000 -> 8
+1 / 2 / 0 (-1.00 / +0.00 / +0.00) : 1
+ (-1.00 / +0.00 / +0.00) 0.000 -> 9
+2 / 2 / 0 (+1.00 / +0.00 / +0.00) : 1
+ (+1.00 / +0.00 / +0.00) 0.000 -> 10
+3 / 2 / 0 (+3.00 / +0.00 / +0.00) : 1
+ (+3.00 / +0.00 / +0.00) 0.000 -> 11
+0 / 3 / 0 (-3.00 / +2.00 / +0.00) : 1
+ (-3.00 / +2.00 / +0.00) 0.000 -> 12
+1 / 3 / 0 (-1.00 / +2.00 / +0.00) : 1
+ (-1.00 / +2.00 / +0.00) 0.000 -> 13
+2 / 3 / 0 (+1.00 / +2.00 / +0.00) : 1
+ (+1.00 / +2.00 / +0.00) 0.000 -> 14
+3 / 3 / 0 (+3.00 / +2.00 / +0.00) : 1
+ (+3.00 / +2.00 / +0.00) 0.000 -> 15
+0 / 4 / 0 (-3.00 / +4.00 / +0.00) : 1
+ (-3.00 / +4.00 / +0.00) 0.000 -> 16
+1 / 4 / 0 (-1.00 / +4.00 / +0.00) : 1
+ (-1.00 / +4.00 / +0.00) 0.000 -> 17
+2 / 4 / 0 (+1.00 / +4.00 / +0.00) : 1
+ (+1.00 / +4.00 / +0.00) 0.000 -> 18
+3 / 4 / 0 (+3.00 / +4.00 / +0.00) : 1
+ (+3.00 / +4.00 / +0.00) 0.000 -> 19
+0 / 0 / 1 (-3.00 / -4.00 / +1.00) : 0
+1 / 0 / 1 (-1.00 / -4.00 / +1.00) : 0
+2 / 0 / 1 (+1.00 / -4.00 / +1.00) : 0
+3 / 0 / 1 (+3.00 / -4.00 / +1.00) : 0
+0 / 1 / 1 (-3.00 / -2.00 / +1.00) : 0
+1 / 1 / 1 (-1.00 / -2.00 / +1.00) : 0
+2 / 1 / 1 (+1.00 / -2.00 / +1.00) : 0
+3 / 1 / 1 (+3.00 / -2.00 / +1.00) : 0
+0 / 2 / 1 (-3.00 / +0.00 / +1.00) : 0
+1 / 2 / 1 (-1.00 / +0.00 / +1.00) : 0
+2 / 2 / 1 (+1.00 / +0.00 / +1.00) : 0
+3 / 2 / 1 (+3.00 / +0.00 / +1.00) : 0
+0 / 3 / 1 (-3.00 / +2.00 / +1.00) : 0
+1 / 3 / 1 (-1.00 / +2.00 / +1.00) : 0
+2 / 3 / 1 (+1.00 / +2.00 / +1.00) : 0
+3 / 3 / 1 (+3.00 / +2.00 / +1.00) : 0
+0 / 4 / 1 (-3.00 / +4.00 / +1.00) : 0
+1 / 4 / 1 (-1.00 / +4.00 / +1.00) : 0
+2 / 4 / 1 (+1.00 / +4.00 / +1.00) : 0
+3 / 4 / 1 (+3.00 / +4.00 / +1.00) : 0
+0 / 0 / 2 (-3.00 / -4.00 / +2.00) : 2
+ (-3.00 / -4.00 / +2.00) 0.000 -> 40
+ (-3.00 / -4.00 / +1.60) 0.400 -> 20
+1 / 0 / 2 (-1.00 / -4.00 / +2.00) : 2
+ (-1.00 / -4.00 / +2.00) 0.000 -> 41
+ (-1.00 / -4.00 / +1.60) 0.400 -> 21
+2 / 0 / 2 (+1.00 / -4.00 / +2.00) : 2
+ (+1.00 / -4.00 / +2.00) 0.000 -> 42
+ (+1.00 / -4.00 / +1.60) 0.400 -> 22
+3 / 0 / 2 (+3.00 / -4.00 / +2.00) : 2
+ (+3.00 / -4.00 / +2.00) 0.000 -> 43
+ (+3.00 / -4.00 / +1.60) 0.400 -> 23
+0 / 1 / 2 (-3.00 / -2.00 / +2.00) : 2
+ (-3.00 / -2.00 / +2.00) 0.000 -> 44
+ (-3.00 / -2.00 / +1.60) 0.400 -> 24
+1 / 1 / 2 (-1.00 / -2.00 / +2.00) : 2
+ (-1.00 / -2.00 / +2.00) 0.000 -> 45
+ (-1.00 / -2.00 / +1.60) 0.400 -> 25
+2 / 1 / 2 (+1.00 / -2.00 / +2.00) : 2
+ (+1.00 / -2.00 / +2.00) 0.000 -> 46
+ (+1.00 / -2.00 / +1.60) 0.400 -> 26
+3 / 1 / 2 (+3.00 / -2.00 / +2.00) : 2
+ (+3.00 / -2.00 / +2.00) 0.000 -> 47
+ (+3.00 / -2.00 / +1.60) 0.400 -> 27
+0 / 2 / 2 (-3.00 / +0.00 / +2.00) : 2
+ (-3.00 / +0.00 / +2.00) 0.000 -> 48
+ (-3.00 / +0.00 / +1.60) 0.400 -> 28
+1 / 2 / 2 (-1.00 / +0.00 / +2.00) : 2
+ (-1.00 / +0.00 / +2.00) 0.000 -> 49
+ (-1.00 / +0.00 / +1.60) 0.400 -> 29
+2 / 2 / 2 (+1.00 / +0.00 / +2.00) : 2
+ (+1.00 / +0.00 / +2.00) 0.000 -> 50
+ (+1.00 / +0.00 / +1.60) 0.400 -> 30
+3 / 2 / 2 (+3.00 / +0.00 / +2.00) : 2
+ (+3.00 / +0.00 / +2.00) 0.000 -> 51
+ (+3.00 / +0.00 / +1.60) 0.400 -> 31
+0 / 3 / 2 (-3.00 / +2.00 / +2.00) : 2
+ (-3.00 / +2.00 / +2.00) 0.000 -> 52
+ (-3.00 / +2.00 / +1.60) 0.400 -> 32
+1 / 3 / 2 (-1.00 / +2.00 / +2.00) : 2
+ (-1.00 / +2.00 / +2.00) 0.000 -> 53
+ (-1.00 / +2.00 / +1.60) 0.400 -> 33
+2 / 3 / 2 (+1.00 / +2.00 / +2.00) : 2
+ (+1.00 / +2.00 / +2.00) 0.000 -> 54
+ (+1.00 / +2.00 / +1.60) 0.400 -> 34
+3 / 3 / 2 (+3.00 / +2.00 / +2.00) : 2
+ (+3.00 / +2.00 / +2.00) 0.000 -> 55
+ (+3.00 / +2.00 / +1.60) 0.400 -> 35
+0 / 4 / 2 (-3.00 / +4.00 / +2.00) : 2
+ (-3.00 / +4.00 / +2.00) 0.000 -> 56
+ (-3.00 / +4.00 / +1.60) 0.400 -> 36
+1 / 4 / 2 (-1.00 / +4.00 / +2.00) : 2
+ (-1.00 / +4.00 / +2.00) 0.000 -> 57
+ (-1.00 / +4.00 / +1.60) 0.400 -> 37
+2 / 4 / 2 (+1.00 / +4.00 / +2.00) : 2
+ (+1.00 / +4.00 / +2.00) 0.000 -> 58
+ (+1.00 / +4.00 / +1.60) 0.400 -> 38
+3 / 4 / 2 (+3.00 / +4.00 / +2.00) : 2
+ (+3.00 / +4.00 / +2.00) 0.000 -> 59
+ (+3.00 / +4.00 / +1.60) 0.400 -> 39
+Sample readout neighbors:
+ 0 -> -3.00 / -4.00 / +0.00
+ (-3.00 / -4.00 / +0.00) 0.000
+ 1 -> -1.00 / -4.00 / +0.00
+ (-1.00 / -4.00 / +0.00) 0.000
+ 2 -> +1.00 / -4.00 / +0.00
+ (+1.00 / -4.00 / +0.00) 0.000
+ 3 -> +3.00 / -4.00 / +0.00
+ (+3.00 / -4.00 / +0.00) 0.000
+ 4 -> -3.00 / -2.00 / +0.00
+ (-3.00 / -2.00 / +0.00) 0.000
+ 5 -> -1.00 / -2.00 / +0.00
+ (-1.00 / -2.00 / +0.00) 0.000
+ 6 -> +1.00 / -2.00 / +0.00
+ (+1.00 / -2.00 / +0.00) 0.000
+ 7 -> +3.00 / -2.00 / +0.00
+ (+3.00 / -2.00 / +0.00) 0.000
+ 8 -> -3.00 / +0.00 / +0.00
+ (-3.00 / +0.00 / +0.00) 0.000
+ 9 -> -1.00 / +0.00 / +0.00
+ (-1.00 / +0.00 / +0.00) 0.000
+ 10 -> +1.00 / +0.00 / +0.00
+ (+1.00 / +0.00 / +0.00) 0.000
+ 11 -> +3.00 / +0.00 / +0.00
+ (+3.00 / +0.00 / +0.00) 0.000
+ 12 -> -3.00 / +2.00 / +0.00
+ (-3.00 / +2.00 / +0.00) 0.000
+ 13 -> -1.00 / +2.00 / +0.00
+ (-1.00 / +2.00 / +0.00) 0.000
+ 14 -> +1.00 / +2.00 / +0.00
+ (+1.00 / +2.00 / +0.00) 0.000
+ 15 -> +3.00 / +2.00 / +0.00
+ (+3.00 / +2.00 / +0.00) 0.000
+ 16 -> -3.00 / +4.00 / +0.00
+ (-3.00 / +4.00 / +0.00) 0.000
+ 17 -> -1.00 / +4.00 / +0.00
+ (-1.00 / +4.00 / +0.00) 0.000
+ 18 -> +1.00 / +4.00 / +0.00
+ (+1.00 / +4.00 / +0.00) 0.000
+ 19 -> +3.00 / +4.00 / +0.00
+ (+3.00 / +4.00 / +0.00) 0.000
+ 20 -> -3.00 / -4.00 / +1.60
+ (-3.00 / -4.00 / +2.00) 0.400
+ 21 -> -1.00 / -4.00 / +1.60
+ (-1.00 / -4.00 / +2.00) 0.400
+ 22 -> +1.00 / -4.00 / +1.60
+ (+1.00 / -4.00 / +2.00) 0.400
+ 23 -> +3.00 / -4.00 / +1.60
+ (+3.00 / -4.00 / +2.00) 0.400
+ 24 -> -3.00 / -2.00 / +1.60
+ (-3.00 / -2.00 / +2.00) 0.400
+ 25 -> -1.00 / -2.00 / +1.60
+ (-1.00 / -2.00 / +2.00) 0.400
+ 26 -> +1.00 / -2.00 / +1.60
+ (+1.00 / -2.00 / +2.00) 0.400
+ 27 -> +3.00 / -2.00 / +1.60
+ (+3.00 / -2.00 / +2.00) 0.400
+ 28 -> -3.00 / +0.00 / +1.60
+ (-3.00 / +0.00 / +2.00) 0.400
+ 29 -> -1.00 / +0.00 / +1.60
+ (-1.00 / +0.00 / +2.00) 0.400
+ 30 -> +1.00 / +0.00 / +1.60
+ (+1.00 / +0.00 / +2.00) 0.400
+ 31 -> +3.00 / +0.00 / +1.60
+ (+3.00 / +0.00 / +2.00) 0.400
+ 32 -> -3.00 / +2.00 / +1.60
+ (-3.00 / +2.00 / +2.00) 0.400
+ 33 -> -1.00 / +2.00 / +1.60
+ (-1.00 / +2.00 / +2.00) 0.400
+ 34 -> +1.00 / +2.00 / +1.60
+ (+1.00 / +2.00 / +2.00) 0.400
+ 35 -> +3.00 / +2.00 / +1.60
+ (+3.00 / +2.00 / +2.00) 0.400
+ 36 -> -3.00 / +4.00 / +1.60
+ (-3.00 / +4.00 / +2.00) 0.400
+ 37 -> -1.00 / +4.00 / +1.60
+ (-1.00 / +4.00 / +2.00) 0.400
+ 38 -> +1.00 / +4.00 / +1.60
+ (+1.00 / +4.00 / +2.00) 0.400
+ 39 -> +3.00 / +4.00 / +1.60
+ (+3.00 / +4.00 / +2.00) 0.400
+ 40 -> -3.00 / -4.00 / +2.00
+ (-3.00 / -4.00 / +2.00) 0.000
+ 41 -> -1.00 / -4.00 / +2.00
+ (-1.00 / -4.00 / +2.00) 0.000
+ 42 -> +1.00 / -4.00 / +2.00
+ (+1.00 / -4.00 / +2.00) 0.000
+ 43 -> +3.00 / -4.00 / +2.00
+ (+3.00 / -4.00 / +2.00) 0.000
+ 44 -> -3.00 / -2.00 / +2.00
+ (-3.00 / -2.00 / +2.00) 0.000
+ 45 -> -1.00 / -2.00 / +2.00
+ (-1.00 / -2.00 / +2.00) 0.000
+ 46 -> +1.00 / -2.00 / +2.00
+ (+1.00 / -2.00 / +2.00) 0.000
+ 47 -> +3.00 / -2.00 / +2.00
+ (+3.00 / -2.00 / +2.00) 0.000
+ 48 -> -3.00 / +0.00 / +2.00
+ (-3.00 / +0.00 / +2.00) 0.000
+ 49 -> -1.00 / +0.00 / +2.00
+ (-1.00 / +0.00 / +2.00) 0.000
+ 50 -> +1.00 / +0.00 / +2.00
+ (+1.00 / +0.00 / +2.00) 0.000
+ 51 -> +3.00 / +0.00 / +2.00
+ (+3.00 / +0.00 / +2.00) 0.000
+ 52 -> -3.00 / +2.00 / +2.00
+ (-3.00 / +2.00 / +2.00) 0.000
+ 53 -> -1.00 / +2.00 / +2.00
+ (-1.00 / +2.00 / +2.00) 0.000
+ 54 -> +1.00 / +2.00 / +2.00
+ (+1.00 / +2.00 / +2.00) 0.000
+ 55 -> +3.00 / +2.00 / +2.00
+ (+3.00 / +2.00 / +2.00) 0.000
+ 56 -> -3.00 / +4.00 / +2.00
+ (-3.00 / +4.00 / +2.00) 0.000
+ 57 -> -1.00 / +4.00 / +2.00
+ (-1.00 / +4.00 / +2.00) 0.000
+ 58 -> +1.00 / +4.00 / +2.00
+ (+1.00 / +4.00 / +2.00) 0.000
+ 59 -> +3.00 / +4.00 / +2.00
+ (+3.00 / +4.00 / +2.00) 0.000
diff --git a/kmclipm/test/ref/kmclipm_test_priv_functions.ref b/kmclipm/test/ref/kmclipm_test_priv_functions.ref
new file mode 100644
index 0000000..babfbff
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_priv_functions.ref
@@ -0,0 +1,2 @@
+1 - [ INFO ] cpl_init() set errno=25: Inappropriate ioctl for device
+1 - [ INFO ] All tests done.
diff --git a/kmclipm/test/ref/kmclipm_test_priv_reconstruct.ref b/kmclipm/test/ref/kmclipm_test_priv_reconstruct.ref
new file mode 100644
index 0000000..2a01fe5
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_priv_reconstruct.ref
@@ -0,0 +1,8 @@
+1 - [ INFO ] cpl_init() set errno=25: Inappropriate ioctl for device
+1 - [ INFO ] one to one map
+1 - [ INFO ] second layer shifted in l-direction by 0.6, distance=0.5 nbhType=N_CUBE distType=PIXEL
+1 - [ INFO ] second layer shifted by 0.6 in l-direction and by 0.4 in y-direction, distance=0.5 nbhType=N_CUBE distType=PIXEL
+1 - [ INFO ] second layer shifted by 0.6 in l-direction and by 0.4 in y-direction, distance=0.5 nbhType=N_SPERE distType=PIXEL
+1 - [ INFO ] second layer shifted by 0.6 in l-direction and by 0.4 in y-direction, distance=0.9 nbhType=N_SPHERE distType=UNIT
+1 - [ INFO ] x-direction tiled by one pixel, distance=0.5 nbhType=N_CUBE distType=PIXEL
+1 - [ INFO ] All tests done.
diff --git a/kmclipm/test/ref/kmclipm_test_priv_splines.ref b/kmclipm/test/ref/kmclipm_test_priv_splines.ref
new file mode 100644
index 0000000..babfbff
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_priv_splines.ref
@@ -0,0 +1,2 @@
+1 - [ INFO ] cpl_init() set errno=25: Inappropriate ioctl for device
+1 - [ INFO ] All tests done.
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_004.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_004.ref
new file mode 100644
index 0000000..8990798
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_004.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 0.115152 0.310034 0.60259 0.840888 0.845062 0.611479 0.318134 0.118814 0.031851 0.00614512 0.00085642 9.06996e-05 -8.43573e-06 9.05633e-05 0.382306 1.0006 1.9032 2.61117 2.58968 1.85481 0.957723 0.355945 0.0952269 0.0183863 0.00257111 0.00027027 -1.19121e-05 0.000167437 0.824895 2.16035 4.11479 5.65269 5.61129 4.02072 2.07642 0.771997 0.206763 0.0400034 0.00561001 0.000585313 -2.90641e-06 0.000216463 1.28941 3.37699 6.43461 8.84334 8.77978 6.29012 3.24791 1.20788 0.323828 0.0627501 0.00 [...]
+14 14
+ 0.109136 0.362084 0.724714 1.0601 1.12024 0.858276 0.475424 0.189582 0.0541856 0.0111025 0.0016399 0.000179812 7.78268e-06 1.09058e-05 0.329602 1.03815 2.08109 3.03825 3.20025 2.43967 1.34295 0.531944 0.151066 0.0307535 0.00450712 0.000489807 1.70828e-05 3.83949e-05 0.689972 2.08739 4.19971 6.13937 6.47666 4.94187 2.72184 1.07886 0.306819 0.0626059 0.00919866 0.000996116 4.33554e-05 6.38972e-05 1.03487 3.04082 6.13601 8.97645 9.47667 7.2308 3.98117 1.57807 0.449294 0.0918834 0.013532 0. [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_040.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_040.ref
new file mode 100644
index 0000000..0dd845b
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_040.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ -0.441569 -0.130338 -0.0152681 0.0153035 0.0148122 0.00775949 0.00294275 0.00081002 0.000165187 -7.22662e-05 0.000355442 0.00220627 0.00512984 0.00770658 -0.293041 -0.022665 0.108865 0.131619 0.0953325 0.0494916 0.0183159 0.00499838 0.00101732 0.000145185 -6.90286e-05 0.000381479 0.00138859 0.00225212 0.0271245 0.384997 0.602891 0.602253 0.434165 0.225746 0.0852754 0.0227434 0.00441191 0.000660411 5.84916e-05 -2.4988e-05 0.000198404 0.000449466 0.690501 1.4303 1.97316 1.97782 1.43083 0. [...]
+14 14
+ -13.1366 -5.43829 -0.846049 0.922321 1.16156 0.860743 0.476955 0.19162 0.0395587 0.0179855 0.0763338 0.115611 0.100942 0.0659309 -7.45943 -2.15039 1.50243 3.112 3.19376 2.44025 1.33922 0.531392 0.154438 0.0262071 0.00381688 0.0133526 0.0160054 0.010059 -2.41609 1.16557 4.28698 6.15301 6.47697 4.94157 2.72492 1.07693 0.307608 0.0642297 0.00835554 0.00056768 0.00109562 0.000665075 0.375989 3.05222 6.18023 8.9467 9.47305 7.2298 3.97576 1.58078 0.450243 0.0925568 0.013614 0.00148129 3.95556 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_045.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_045.ref
new file mode 100644
index 0000000..8341b9d
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_045.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ -0.241053 -0.0582712 -0.00348963 0.0084929 0.00724455 0.0037755 0.00135919 0.000392709 4.9632e-05 -5.14446e-05 0.000666265 0.00223536 0.0037377 0.00420921 -0.215881 -0.0179286 0.0607693 0.0719271 0.051103 0.0265236 0.0100166 0.00260327 0.000542661 4.94945e-05 -3.70752e-05 0.000346312 0.000838885 0.00100889 -0.0477737 0.225136 0.369538 0.365657 0.263338 0.135578 0.050801 0.0138413 0.00259605 0.000391086 2.57263e-05 -1.39135e-05 9.34777e-05 0.000163281 0.433135 0.984701 1.35467 1.35294 0. [...]
+14 14
+ -14.1697 -6.84123 -1.70238 0.692247 1.15277 0.870604 0.472851 0.191032 0.0504555 0.00441061 0.056003 0.135083 0.163974 0.131439 -6.84123 -2.37111 1.27891 3.08632 3.22127 2.43637 1.33937 0.530972 0.153173 0.0285955 0.00186966 0.0164239 0.02823 0.026743 -1.70238 1.27891 4.27342 6.17995 6.45772 4.94941 2.72022 1.07627 0.307324 0.0631988 0.00886158 0.000359252 0.00279644 0.00329114 0.692247 3.08632 6.17995 8.94261 9.48287 7.23099 3.98019 1.58173 0.450792 0.0921548 0.0140725 0.00129184 4.194 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_090.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_090.ref
new file mode 100644
index 0000000..1731a6c
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_090.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 2.16734e-06 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 8.24456e-11 4.60796e-12 1.37886e-05 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0.000177978 0.000500534 0.00101552 0.0014864 0.00156953 0.00119563 0.000657066 0.000260503 7.45086e-05 1.53741e-05 2.28856e-06 2.45767e-07 1.90404e-08 1.06418 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_180.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_180.ref
new file mode 100644
index 0000000..71be066
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_180.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 4.60796e-12 8.24456e-11 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 2.16734e-06 7.70655e-07 8.24456e-11 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 1.37886e-05 1.06418e-09 1.90404e-08 2.45767e-07 2.28856e-06 1.53741e-05 7.45086e-05 0.000260503 0.000657066 0.00119563 0.00156953 0.0014864 0.00101552 0.000500534 0.00017 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_270.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_270.ref
new file mode 100644
index 0000000..923fe80
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_270.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 1.37886e-05 0.000177978 0.00165732 0.0111335 0.0539573 0.18865 0.475831 0.865843 1.13662 1.07641 0.735417 0.362475 0.128888 2.16734e-06 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 0.362475 4.39726e-06 7.86758e-05 0.00101552 0.00945644 0.0635266 0.307874 1.07641 2.71504 4.94039 6.4854 6.14188 4.1962 2.06824 0.735417 6.43618e-06 0.000115156 0.0014864 0.0138412 0.0929824 0.450628 1.57552 3.97394 7.23114 9.49254 8.9 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_356.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_356.ref
new file mode 100644
index 0000000..0c5a4e9
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_ESTIMATED_356.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 0.115152 0.382306 0.824895 1.28941 1.45236 1.18115 0.692941 0.292592 0.0886635 0.0192484 0.00299645 0.000335088 2.88401e-05 -3.92922e-06 0.310034 1.0006 2.16035 3.37699 3.80655 3.1007 1.82469 0.774436 0.23644 0.0518293 0.0081618 0.000924452 8.19988e-05 -1.59285e-05 0.60259 1.9032 4.11479 6.43461 7.25583 5.91084 3.47814 1.47609 0.450611 0.098726 0.0155199 0.00175032 0.000156322 -3.85736e-05 0.840888 2.61117 5.65269 8.84334 9.97638 8.12783 4.7822 2.02951 0.619776 0.135874 0.0213649 0.0024 [...]
+14 14
+ 0.109136 0.329602 0.689972 1.03487 1.11229 0.859718 0.477047 0.189459 0.0537271 0.010907 0.00159508 0.000178767 -1.49147e-05 0.000147221 0.362084 1.03815 2.08739 3.04082 3.20151 2.44027 1.34291 0.531588 0.150866 0.0307239 0.00451023 0.000499717 -1.66334e-05 0.000235639 0.724714 2.08109 4.19971 6.13601 6.47556 4.94273 2.72233 1.07849 0.306491 0.0625253 0.00919028 0.00100501 6.69636e-06 0.000255405 1.0601 3.03825 6.13937 8.97645 9.47701 7.23176 3.98161 1.57787 0.449157 0.0918826 0.0135414 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_004.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_004.ref
new file mode 100644
index 0000000..eacfe27
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_004.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ nan nan nan nan nan nan nan 0.120174 0.0325496 0.00631519 0.000883172 8.95246e-05 6.88107e-06 -2.43138e-06 0.401121 1.01398 1.92809 2.63422 2.60432 1.86001 0.958273 0.355564 0.0950221 0.0183338 0.00256515 0.000261247 1.99822e-05 -3.41355e-06 0.847617 2.1492 4.11043 5.64587 5.6074 4.01918 2.07626 0.772099 0.206824 0.040018 0.00561579 0.000573401 4.35039e-05 -2.80659e-06 1.32871 3.36745 6.43915 8.84424 8.78111 6.29049 3.24798 1.20784 0.323811 0.0627441 0.0088167 0.000900547 6.77391e-05 -3 [...]
+14 14
+ nan 0.280766 0.489194 0.608298 0.504326 0.267352 0.0524259 nan nan nan nan nan nan nan nan 1.07083 2.12039 3.10144 3.2566 2.47184 1.35169 0.531102 0.152443 0.0303929 0.00478604 0.000403561 6.97335e-05 -1.2887e-05 nan 2.09495 4.17811 6.12205 6.45893 4.93328 2.71955 1.07908 0.306475 0.0626684 0.00914209 0.000995831 7.12483e-05 4.55067e-06 nan 3.0568 6.13477 8.98493 9.48079 7.2335 3.98164 1.57806 0.449368 0.0918757 0.0135511 0.00144098 0.000113958 3.70108e-06 nan 3.20574 6.47093 9.47645 10 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_040.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_040.ref
new file mode 100644
index 0000000..896e02f
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_040.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ nan nan nan nan nan 0.00791934 0.00293585 0.000807812 0.000149555 2.28862e-05 -6.98238e-06 nan nan nan nan nan nan 0.132764 0.0966384 0.0493327 0.0183123 0.00500506 0.00100792 0.000138078 1.47207e-05 -1.12035e-05 nan nan nan nan 0.618396 0.606637 0.432894 0.225801 0.0852942 0.0227394 0.00441885 0.000646298 6.68623e-05 4.98791e-06 -7.33439e-06 nan nan 1.47366 1.97747 1.97327 1.43144 0.746107 0.279056 0.0762487 0.0148108 0.00204249 0.00021335 1.65879e-05 8.60738e-07 -2.23123e-06 1.81276 3 [...]
+14 14
+ nan nan nan nan 0.863629 0.700791 0.453876 0.166818 0.0637897 nan nan nan nan nan nan nan nan 3.13606 3.20631 2.46947 1.35483 0.519708 0.151116 0.0308454 0.00581946 nan nan nan nan nan 4.25009 6.1484 6.47356 4.93846 2.72786 1.07736 0.30932 0.062878 0.00891354 0.00113849 nan nan nan 3.13645 6.15876 8.95958 9.47005 7.23017 3.97608 1.57986 0.45039 0.0928442 0.0134139 0.00155448 8.71891e-05 nan nan 3.20962 6.45404 9.4809 10.0125 7.62131 4.20722 1.66466 0.475883 0.0978255 0.0143242 0.0015721 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_045.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_045.ref
new file mode 100644
index 0000000..854a428
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_045.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ nan nan nan nan 0.00741513 0.00379618 0.00135909 0.000375996 7.71515e-05 1.08303e-05 -2.3284e-05 nan nan nan nan nan nan 0.0736227 0.0513817 0.0264589 0.0100214 0.00260943 0.0005193 7.6938e-05 7.8057e-06 -1.21022e-05 nan nan nan nan 0.378252 0.367647 0.262703 0.135641 0.0508006 0.0138409 0.0026022 0.000374272 3.99896e-05 2.92934e-06 -3.26668e-06 nan nan 1.00791 1.36204 1.34969 0.970539 0.504385 0.187337 0.0506601 0.00997545 0.00135253 0.000140458 1.07942e-05 5.70166e-07 -4.56544e-07 1.3 [...]
+14 14
+ nan nan nan nan 1.03879 0.842691 0.397547 0.185986 0.053424 0.011121 nan nan nan nan nan nan nan 3.06382 3.21651 2.46578 1.33491 0.534104 0.149718 0.0289389 0.00496094 nan nan nan nan nan 4.24023 6.1643 6.463 4.9463 2.71921 1.07679 0.309698 0.0620244 0.00984097 0.00104696 nan nan nan 3.06382 6.1643 8.95717 9.48023 7.23099 3.98107 1.58092 0.450817 0.0921251 0.01383 0.00144465 0.00012663 nan 1.03879 3.21651 6.463 9.48023 9.99327 7.62649 4.20069 1.66557 0.476213 0.0968151 0.0145922 0.00147 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_090.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_090.ref
new file mode 100644
index 0000000..1731a6c
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_090.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 2.16734e-06 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 8.24456e-11 4.60796e-12 1.37886e-05 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0.000177978 0.000500534 0.00101552 0.0014864 0.00156953 0.00119563 0.000657066 0.000260503 7.45086e-05 1.53741e-05 2.28856e-06 2.45767e-07 1.90404e-08 1.06418 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_180.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_180.ref
new file mode 100644
index 0000000..71be066
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_180.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 4.60796e-12 8.24456e-11 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 2.16734e-06 7.70655e-07 8.24456e-11 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 1.37886e-05 1.06418e-09 1.90404e-08 2.45767e-07 2.28856e-06 1.53741e-05 7.45086e-05 0.000260503 0.000657066 0.00119563 0.00156953 0.0014864 0.00101552 0.000500534 0.00017 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_270.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_270.ref
new file mode 100644
index 0000000..923fe80
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_270.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 1.37886e-05 0.000177978 0.00165732 0.0111335 0.0539573 0.18865 0.475831 0.865843 1.13662 1.07641 0.735417 0.362475 0.128888 2.16734e-06 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 0.362475 4.39726e-06 7.86758e-05 0.00101552 0.00945644 0.0635266 0.307874 1.07641 2.71504 4.94039 6.4854 6.14188 4.1962 2.06824 0.735417 6.43618e-06 0.000115156 0.0014864 0.0138412 0.0929824 0.450628 1.57552 3.97394 7.23114 9.49254 8.9 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_356.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_356.ref
new file mode 100644
index 0000000..78fc61f
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NANS_356.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ nan 0.401121 0.847617 1.32871 1.4925 1.20708 0.700868 nan nan nan nan nan nan nan nan 1.01398 2.1492 3.36745 3.79555 3.09408 1.82273 0.774881 0.237105 0.0521214 0.00823409 0.00093786 7.72724e-05 4.99226e-06 nan 1.92809 4.11043 6.43915 7.25825 5.91268 3.47859 1.47597 0.450442 0.0986558 0.0155014 0.00175142 0.000142622 9.22325e-06 nan 2.63422 5.64587 8.84424 9.97517 8.12751 4.78205 2.02955 0.619816 0.135892 0.0213673 0.0024123 0.000195702 1.27225e-05 nan 2.60432 5.6074 8.78111 9.90582 8.0 [...]
+14 14
+ nan nan nan nan nan nan nan -0.033162 0.0293871 0.00121226 0.00166422 -8.36943e-05 6.40997e-05 -4.56378e-05 0.280766 1.07083 2.09495 3.0568 3.20574 2.44264 1.34141 0.537181 0.15265 0.0317003 0.00454491 0.000521568 3.1577e-05 9.99264e-07 0.489194 2.12039 4.17811 6.13477 6.47093 4.9422 2.72249 1.07703 0.305901 0.0622292 0.00917866 0.000970195 7.93494e-05 -4.74885e-06 0.608298 3.10144 6.12205 8.98493 9.47645 7.23272 3.98139 1.57832 0.44933 0.0919734 0.0135555 0.0014493 0.000112766 1.81595e [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_004.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_004.ref
new file mode 100644
index 0000000..3e0c822
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_004.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 0.0687709 0.221023 0.48938 0.741892 0.78874 0.59286 0.316447 0.120174 0.0325496 0.00631519 0.000883172 8.95246e-05 6.88107e-06 -2.43138e-06 0.401121 1.01398 1.92809 2.63422 2.60432 1.86001 0.958273 0.355564 0.0950221 0.0183338 0.00256515 0.000261247 1.99822e-05 -3.41355e-06 0.847617 2.1492 4.11043 5.64587 5.6074 4.01918 2.07626 0.772099 0.206824 0.040018 0.00561579 0.000573401 4.35039e-05 -2.80659e-06 1.32871 3.36745 6.43915 8.84424 8.78111 6.29049 3.24798 1.20784 0.323811 0.0627441 0.0 [...]
+14 14
+ 0.0812454 0.353639 0.702638 1.0436 1.11373 0.859883 0.477216 0.189075 0.0530075 0.0104535 0.00144622 0.000139796 9.53799e-06 -3.29378e-07 0.300528 1.0587 2.09083 3.05375 3.20757 2.44167 1.34275 0.532105 0.151404 0.0309341 0.00455967 0.000488889 3.89213e-05 7.2567e-07 0.653675 2.09854 4.18642 6.13511 6.47197 4.94105 2.72173 1.07885 0.306708 0.0625514 0.00918887 0.00097915 7.69004e-05 2.15494e-06 1.01606 3.0555 6.13249 8.98136 9.47733 7.2315 3.98111 1.57811 0.449318 0.0919004 0.0135412 0. [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_040.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_040.ref
new file mode 100644
index 0000000..f3a1064
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_040.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ -4.88968 -1.40819 -0.264797 -0.0122763 0.0143776 0.00791934 0.00293585 0.000807812 0.000149555 2.28862e-05 -6.98238e-06 -0.000138284 -0.000475553 -0.000892116 -3.19271 -0.789856 0.00243894 0.132764 0.0966384 0.0493327 0.0183123 0.00500506 0.00100792 0.000138078 1.47207e-05 -1.12035e-05 -9.44962e-05 -0.000218087 -1.18573 0.181866 0.618396 0.606637 0.432894 0.225801 0.0852942 0.0227394 0.00441885 0.000646298 6.68623e-05 4.98791e-06 -7.33439e-06 -3.2905e-05 0.503002 1.47366 1.97747 1.97327 [...]
+14 14
+ -4.71751 -2.23244 0.0161754 1.04638 1.11572 0.872289 0.477754 0.181785 0.0599884 0.00902371 -0.0155603 -0.0355292 -0.0391855 -0.0233931 -3.00085 -0.564083 1.73715 3.09041 3.19665 2.44943 1.33921 0.532283 0.150427 0.0316998 0.00491745 -0.00207808 -0.00432195 -0.00344289 -0.799332 1.55472 4.24964 6.14601 6.47877 4.93812 2.72423 1.07756 0.307666 0.063067 0.00914626 0.00111231 -0.000183541 -0.00031666 0.797563 3.05017 6.16291 8.9596 9.47087 7.23036 3.97624 1.58055 0.45034 0.0926828 0.013399 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_045.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_045.ref
new file mode 100644
index 0000000..a9bb9d7
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_045.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ -2.67258 -0.630204 -0.0938087 0.00149883 0.00741513 0.00379618 0.00135909 0.000375996 7.71515e-05 1.08303e-05 -2.3284e-05 -0.000154933 -0.000358324 -0.000491126 -2.33475 -0.481962 0.0107245 0.0736227 0.0513817 0.0264589 0.0100214 0.00260943 0.0005193 7.6938e-05 7.8057e-06 -1.21022e-05 -5.81439e-05 -9.67201e-05 -1.28426 0.0397316 0.378252 0.367647 0.262703 0.135641 0.0508006 0.0138409 0.0026022 0.000374272 3.99896e-05 2.92934e-06 -3.26668e-06 -1.13171e-05 0.0764415 1.00791 1.36204 1.3496 [...]
+14 14
+ -4.872 -2.66773 -0.41266 0.962508 1.12002 0.851446 0.495228 0.180236 0.0546443 0.014126 -0.00766889 -0.0319023 -0.0512634 -0.0543198 -2.66773 -0.631028 1.63473 3.06763 3.21771 2.45319 1.33527 0.53235 0.151726 0.0302331 0.0051003 -0.00232748 -0.00730641 -0.00818477 -0.41266 1.63473 4.23594 6.16416 6.4624 4.94475 2.71944 1.07671 0.307533 0.0621191 0.00970047 0.000966272 -0.000273521 -0.000742923 0.962508 3.06763 6.16416 8.95784 9.48042 7.231 3.98135 1.58121 0.450813 0.0923601 0.0137754 0. [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_090.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_090.ref
new file mode 100644
index 0000000..1731a6c
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_090.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 2.16734e-06 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 8.24456e-11 4.60796e-12 1.37886e-05 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0.000177978 0.000500534 0.00101552 0.0014864 0.00156953 0.00119563 0.000657066 0.000260503 7.45086e-05 1.53741e-05 2.28856e-06 2.45767e-07 1.90404e-08 1.06418 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_180.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_180.ref
new file mode 100644
index 0000000..71be066
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_180.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 4.60796e-12 8.24456e-11 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 2.16734e-06 7.70655e-07 8.24456e-11 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 1.37886e-05 1.06418e-09 1.90404e-08 2.45767e-07 2.28856e-06 1.53741e-05 7.45086e-05 0.000260503 0.000657066 0.00119563 0.00156953 0.0014864 0.00101552 0.000500534 0.00017 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_270.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_270.ref
new file mode 100644
index 0000000..923fe80
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_270.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 1.37886e-05 0.000177978 0.00165732 0.0111335 0.0539573 0.18865 0.475831 0.865843 1.13662 1.07641 0.735417 0.362475 0.128888 2.16734e-06 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 0.362475 4.39726e-06 7.86758e-05 0.00101552 0.00945644 0.0635266 0.307874 1.07641 2.71504 4.94039 6.4854 6.14188 4.1962 2.06824 0.735417 6.43618e-06 0.000115156 0.0014864 0.0138412 0.0929824 0.450628 1.57552 3.97394 7.23114 9.49254 8.9 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_356.ref b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_356.ref
new file mode 100644
index 0000000..4383e79
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_BCS_NATURAL_356.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 0.0687709 0.401121 0.847617 1.32871 1.4925 1.20708 0.700868 0.291041 0.0859644 0.0179652 0.00264377 0.000272435 1.94033e-05 9.83151e-07 0.221023 1.01398 2.1492 3.36745 3.79555 3.09408 1.82273 0.774881 0.237105 0.0521214 0.00823409 0.00093786 7.72724e-05 4.99226e-06 0.48938 1.92809 4.11043 6.43915 7.25825 5.91268 3.47859 1.47597 0.450442 0.0986558 0.0155014 0.00175142 0.000142622 9.22325e-06 0.741892 2.63422 5.64587 8.84424 9.97517 8.12751 4.78205 2.02955 0.619816 0.135892 0.0213673 0.00 [...]
+14 14
+ 0.0812454 0.300528 0.653675 1.01606 1.10957 0.863048 0.477835 0.18831 0.0527756 0.0105682 0.00152554 0.000160615 1.2929e-05 -4.28428e-06 0.353639 1.0587 2.09854 3.0555 3.20675 2.44118 1.34269 0.531962 0.15123 0.0308733 0.00454899 0.000487541 3.92909e-05 -5.59172e-06 0.702638 2.09083 4.18642 6.13249 6.47144 4.94233 2.72225 1.07842 0.30635 0.0624664 0.00918256 0.000979418 7.74799e-05 -3.25338e-06 1.0436 3.05375 6.13511 8.98136 9.47746 7.23239 3.98152 1.57792 0.449195 0.0919042 0.0135532 0 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_004.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_004.ref
new file mode 100644
index 0000000..3248448
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_004.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ nan nan nan nan nan nan nan 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.0014864 0.000115156 6.43618e-06 1.13 [...]
+14 14
+ nan 0 0 0 0 0 0 nan nan nan nan nan nan nan nan 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 nan 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 nan 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.0014864 0.000115156 6.43618e-06 nan 3.19654 6.4854 9.49254 10.0235 7.63558 4.1962 1.66364 0.475831 0.0981829 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_040.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_040.ref
new file mode 100644
index 0000000..6c5fdbc
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_040.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ nan nan nan nan nan 0.00466092 0.00466092 0.00101552 7.86758e-05 6.43618e-06 6.79615e-06 nan nan nan nan nan nan 0.18865 0.151746 0.0313112 0.00945644 0.0138412 0.0014864 0.000121597 5.17711e-06 5.17711e-06 nan nan nan nan 0.475831 0.530546 0.530546 0.307874 0.0929824 0.0138412 0.00156953 0.00119563 9.26289e-05 2.84513e-06 1.12799e-06 nan nan 0.865843 2.43504 2.71504 1.07641 0.450628 0.450628 0.0981829 0.0111335 0.00119563 0.000657066 2.0182e-05 1.12799e-06 3.22626e-07 1.07641 3.19654 4 [...]
+14 14
+ nan nan nan nan 0 0 0.475831 0.18865 0.18865 nan nan nan nan nan nan nan nan 2.06824 3.19654 2.43504 2.71504 0.530546 0.151746 0.0313112 0.00466092 nan nan nan nan nan 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.00945644 0.00945644 0.00101552 nan nan nan 3.02723 6.14188 8.98974 6.4854 7.23114 3.97394 0.450628 0.450628 0.0929824 0.0138412 0.0014864 7.86758e-05 nan nan 3.19654 6.14188 9.49254 10.0235 5.81657 4.1962 1.66364 0.475831 0.0981829 0.00156953 0.00156953 0.000121597 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_045.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_045.ref
new file mode 100644
index 0000000..f60b8ef
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_045.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ nan nan nan nan 0.0111335 0.00466092 0.00101552 0.00101552 0.000115156 6.79615e-06 6.79615e-06 nan nan nan nan nan nan 0.0539573 0.0313112 0.0635266 0.00945644 0.0014864 0.00156953 0.000121597 5.17711e-06 2.84513e-06 nan nan nan nan 0.18865 0.530546 0.307874 0.0635266 0.0929824 0.0146153 0.00156953 0.00119563 5.0905e-05 1.12799e-06 1.12799e-06 nan nan 0.865843 1.3382 1.07641 1.07641 0.450628 0.0981829 0.0981829 0.0111335 0.000657066 0.000260503 2.0182e-05 3.22626e-07 6.65705e-08 1.13662 [...]
+14 14
+ nan nan nan nan 1.13662 0.865843 0.18865 0.18865 0.0539573 0.0111335 nan nan nan nan nan nan nan 3.02723 3.19654 4.94039 1.3382 0.530546 0.307874 0.0313112 0.00466092 nan nan nan nan nan 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 nan nan nan 3.02723 6.14188 9.49254 9.49254 7.23114 1.57552 1.57552 0.450628 0.0929824 0.0146153 0.0014864 0.000115156 nan 1.13662 3.19654 6.4854 9.49254 10.0235 7.63558 4.1962 1.66364 0.475831 0.0981829 0.0146153 0.0 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_090.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_090.ref
new file mode 100644
index 0000000..1731a6c
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_090.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 2.16734e-06 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 8.24456e-11 4.60796e-12 1.37886e-05 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0.000177978 0.000500534 0.00101552 0.0014864 0.00156953 0.00119563 0.000657066 0.000260503 7.45086e-05 1.53741e-05 2.28856e-06 2.45767e-07 1.90404e-08 1.06418 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_180.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_180.ref
new file mode 100644
index 0000000..71be066
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_180.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 4.60796e-12 8.24456e-11 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 2.16734e-06 7.70655e-07 8.24456e-11 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 1.37886e-05 1.06418e-09 1.90404e-08 2.45767e-07 2.28856e-06 1.53741e-05 7.45086e-05 0.000260503 0.000657066 0.00119563 0.00156953 0.0014864 0.00101552 0.000500534 0.00017 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_270.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_270.ref
new file mode 100644
index 0000000..923fe80
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_270.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 1.37886e-05 0.000177978 0.00165732 0.0111335 0.0539573 0.18865 0.475831 0.865843 1.13662 1.07641 0.735417 0.362475 0.128888 2.16734e-06 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 0.362475 4.39726e-06 7.86758e-05 0.00101552 0.00945644 0.0635266 0.307874 1.07641 2.71504 4.94039 6.4854 6.14188 4.1962 2.06824 0.735417 6.43618e-06 0.000115156 0.0014864 0.0138412 0.0929824 0.450628 1.57552 3.97394 7.23114 9.49254 8.9 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_356.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_356.ref
new file mode 100644
index 0000000..9b26601
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_356.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ nan 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 nan nan nan nan nan nan nan nan 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 nan 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 nan 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.0014864 0.000115156 6.43618e-06 nan 3.19654 6.4854 9.49254 10.0235 7. [...]
+14 14
+ nan nan nan nan nan nan nan 0 0 0 0 0 0 0 0 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 0 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.0014864 0.000115156 6.43618e-06 0 3.19654 6.4854 9.49254 10.0235 7.63558 4.1962 1.66364 0.475831 0.0981829 0.0146153 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_004.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_004.ref
new file mode 100644
index 0000000..3248448
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_004.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ nan nan nan nan nan nan nan 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.0014864 0.000115156 6.43618e-06 1.13 [...]
+14 14
+ nan 0 0 0 0 0 0 nan nan nan nan nan nan nan nan 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 nan 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 nan 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.0014864 0.000115156 6.43618e-06 nan 3.19654 6.4854 9.49254 10.0235 7.63558 4.1962 1.66364 0.475831 0.0981829 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_040.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_040.ref
new file mode 100644
index 0000000..54a9350
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_040.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+20 20
+ nan nan nan nan nan nan nan nan nan nan nan 7.70655e-07 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 1.37886e-05 2.16734e-06 4.39726e-06 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.000177978 3.8778e-05 7.86758e-05 4.39726e-06 6.43618e-06 nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.00466092 0.00466092 0.00101552 7.86758e-05 6.43618e-06 6.79615e-06 nan nan nan nan nan nan nan nan nan nan nan nan 0.18865 0.151746 0.0313112 0.00 [...]
+28 28
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0 0 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0 0 0 0 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0 0 0 0 0 0 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0 0 0 0 0 0 0 nan nan nan n [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_045.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_045.ref
new file mode 100644
index 0000000..cd82904
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_045.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+20 20
+ nan nan nan nan nan nan nan nan nan nan 7.70655e-07 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 1.37886e-05 2.16734e-06 4.39726e-06 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.000177978 0.000500534 7.86758e-05 4.39726e-06 6.43618e-06 nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.0111335 0.00466092 0.00101552 0.00101552 0.000115156 6.79615e-06 6.79615e-06 nan nan nan nan nan nan nan nan nan nan nan nan 0.0539573 0.0313112 0.06 [...]
+28 28
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0 0 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0 0 0 0 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0 0 0 0 0 0 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0 0 0 0 0 0 0 0 nan nan nan [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_090.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_090.ref
new file mode 100644
index 0000000..1731a6c
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_090.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 2.16734e-06 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 8.24456e-11 4.60796e-12 1.37886e-05 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0.000177978 0.000500534 0.00101552 0.0014864 0.00156953 0.00119563 0.000657066 0.000260503 7.45086e-05 1.53741e-05 2.28856e-06 2.45767e-07 1.90404e-08 1.06418 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_180.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_180.ref
new file mode 100644
index 0000000..71be066
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_180.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 4.60796e-12 8.24456e-11 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 2.16734e-06 7.70655e-07 8.24456e-11 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 1.37886e-05 1.06418e-09 1.90404e-08 2.45767e-07 2.28856e-06 1.53741e-05 7.45086e-05 0.000260503 0.000657066 0.00119563 0.00156953 0.0014864 0.00101552 0.000500534 0.00017 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_270.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_270.ref
new file mode 100644
index 0000000..923fe80
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_270.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 1.37886e-05 0.000177978 0.00165732 0.0111335 0.0539573 0.18865 0.475831 0.865843 1.13662 1.07641 0.735417 0.362475 0.128888 2.16734e-06 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 0.362475 4.39726e-06 7.86758e-05 0.00101552 0.00945644 0.0635266 0.307874 1.07641 2.71504 4.94039 6.4854 6.14188 4.1962 2.06824 0.735417 6.43618e-06 0.000115156 0.0014864 0.0138412 0.0929824 0.450628 1.57552 3.97394 7.23114 9.49254 8.9 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_356.ref b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_356.ref
new file mode 100644
index 0000000..9b26601
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_NN_RESIZE_356.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ nan 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 nan nan nan nan nan nan nan nan 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 nan 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 nan 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.0014864 0.000115156 6.43618e-06 nan 3.19654 6.4854 9.49254 10.0235 7. [...]
+14 14
+ nan nan nan nan nan nan nan 0 0 0 0 0 0 0 0 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 0 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.0014864 0.000115156 6.43618e-06 0 3.19654 6.4854 9.49254 10.0235 7.63558 4.1962 1.66364 0.475831 0.0981829 0.0146153 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_004.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_004.ref
new file mode 100644
index 0000000..8990798
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_004.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 0.115152 0.310034 0.60259 0.840888 0.845062 0.611479 0.318134 0.118814 0.031851 0.00614512 0.00085642 9.06996e-05 -8.43573e-06 9.05633e-05 0.382306 1.0006 1.9032 2.61117 2.58968 1.85481 0.957723 0.355945 0.0952269 0.0183863 0.00257111 0.00027027 -1.19121e-05 0.000167437 0.824895 2.16035 4.11479 5.65269 5.61129 4.02072 2.07642 0.771997 0.206763 0.0400034 0.00561001 0.000585313 -2.90641e-06 0.000216463 1.28941 3.37699 6.43461 8.84334 8.77978 6.29012 3.24791 1.20788 0.323828 0.0627501 0.00 [...]
+14 14
+ 0.109136 0.362084 0.724714 1.0601 1.12024 0.858276 0.475424 0.189582 0.0541856 0.0111025 0.0016399 0.000179812 7.78268e-06 1.09058e-05 0.329602 1.03815 2.08109 3.03825 3.20025 2.43967 1.34295 0.531944 0.151066 0.0307535 0.00450712 0.000489807 1.70828e-05 3.83949e-05 0.689972 2.08739 4.19971 6.13937 6.47666 4.94187 2.72184 1.07886 0.306819 0.0626059 0.00919866 0.000996116 4.33554e-05 6.38972e-05 1.03487 3.04082 6.13601 8.97645 9.47667 7.2308 3.98117 1.57807 0.449294 0.0918834 0.013532 0. [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_040.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_040.ref
new file mode 100644
index 0000000..8e6bc63
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_040.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+20 20
+ -10.1532 -4.31132 -1.46302 -0.393905 -0.0838202 -0.0143566 -0.00195814 -0.000207614 -1.65496e-05 1.17861e-07 6.40878e-08 0.00016213 0.00119145 0.00488816 0.0141452 0.0315228 0.0562417 0.082634 0.101041 0.10429 -8.87996 -4.25996 -1.62008 -0.489202 -0.117995 -0.0227503 -0.00349585 -0.000334565 3.06407e-05 2.70457e-05 -3.19769e-06 2.51667e-05 0.000755457 0.00373414 0.0109204 0.0229316 0.0374504 0.0492035 0.053358 0.0482111 -6.47097 -3.47413 -1.48486 -0.506704 -0.139042 -0.0297361 -0.003344 [...]
+28 28
+ 61.1008 34.5039 17.9869 8.2182 1.82732 -2.96957 -7.4036 -11.8599 -15.9313 -18.817 -19.4496 -17.128 -12.5353 -7.16093 -2.70064 -0.500347 0.201306 0.253123 0.147513 0.118833 0.129051 0.142313 0.125439 0.0746007 0.0602372 0.0310324 0.00560048 0.0222674 67.9571 43.2774 24.1909 12.2989 5.52824 1.33944 -1.70031 -4.4345 -7.09631 -9.34818 -10.5099 -9.86152 -7.34504 -4.03878 -1.58711 -0.40183 -0.00474074 0.0497265 0.0487386 0.0584803 0.071315 0.0715268 0.0469699 0.0368156 0.0234204 0.00446161 0. [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_045.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_045.ref
new file mode 100644
index 0000000..18261d2
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_045.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+20 20
+ -4.41677 -1.4468 -0.387576 -0.0834913 -0.0146852 -0.00212817 -0.000242167 -2.35886e-05 -3.43397e-07 -2.3321e-06 9.52778e-05 0.000846061 0.00376486 0.0112628 0.0250243 0.0431218 0.0592898 0.0659898 0.0600489 0.0450807 -5.36004 -1.99123 -0.597405 -0.145801 -0.0288057 -0.0047257 -0.000601664 -1.80112e-05 2.46e-05 7.07785e-06 -1.40326e-05 0.000348829 0.00224464 0.00721088 0.0155633 0.0249549 0.0310772 0.0308178 0.0247646 0.0162086 -5.30605 -2.21325 -0.749075 -0.206113 -0.0469188 -0.00814378 [...]
+28 28
+ 89.4173 65.2725 37.8019 19.9678 8.92479 1.30238 -4.35173 -9.30876 -13.6128 -16.5447 -17.188 -15.1734 -11.1715 -6.60684 -2.75666 -0.420239 0.31261 0.298049 0.161158 0.05438 0.0338997 0.0499836 0.066873 0.0961935 0.0981556 0.0543579 0.0260017 0.0145715 65.2725 59.5602 42.2457 23.7843 12.0757 4.97971 0.186505 -3.40071 -6.50178 -8.96082 -10.1624 -9.54302 -7.19762 -4.11435 -1.61739 -0.40934 -0.0375624 0.0415027 0.0212843 0.0119371 0.0227905 0.0338068 0.0516999 0.0558455 0.0327463 0.0164705 0 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_090.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_090.ref
new file mode 100644
index 0000000..1731a6c
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_090.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 2.16734e-06 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 8.24456e-11 4.60796e-12 1.37886e-05 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0.000177978 0.000500534 0.00101552 0.0014864 0.00156953 0.00119563 0.000657066 0.000260503 7.45086e-05 1.53741e-05 2.28856e-06 2.45767e-07 1.90404e-08 1.06418 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_180.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_180.ref
new file mode 100644
index 0000000..71be066
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_180.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 4.60796e-12 8.24456e-11 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 2.16734e-06 7.70655e-07 8.24456e-11 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 1.37886e-05 1.06418e-09 1.90404e-08 2.45767e-07 2.28856e-06 1.53741e-05 7.45086e-05 0.000260503 0.000657066 0.00119563 0.00156953 0.0014864 0.00101552 0.000500534 0.00017 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_270.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_270.ref
new file mode 100644
index 0000000..923fe80
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_270.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 1.37886e-05 0.000177978 0.00165732 0.0111335 0.0539573 0.18865 0.475831 0.865843 1.13662 1.07641 0.735417 0.362475 0.128888 2.16734e-06 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 0.362475 4.39726e-06 7.86758e-05 0.00101552 0.00945644 0.0635266 0.307874 1.07641 2.71504 4.94039 6.4854 6.14188 4.1962 2.06824 0.735417 6.43618e-06 0.000115156 0.0014864 0.0138412 0.0929824 0.450628 1.57552 3.97394 7.23114 9.49254 8.9 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_356.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_356.ref
new file mode 100644
index 0000000..0c5a4e9
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_ESTIMATED_356.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 0.115152 0.382306 0.824895 1.28941 1.45236 1.18115 0.692941 0.292592 0.0886635 0.0192484 0.00299645 0.000335088 2.88401e-05 -3.92922e-06 0.310034 1.0006 2.16035 3.37699 3.80655 3.1007 1.82469 0.774436 0.23644 0.0518293 0.0081618 0.000924452 8.19988e-05 -1.59285e-05 0.60259 1.9032 4.11479 6.43461 7.25583 5.91084 3.47814 1.47609 0.450611 0.098726 0.0155199 0.00175032 0.000156322 -3.85736e-05 0.840888 2.61117 5.65269 8.84334 9.97638 8.12783 4.7822 2.02951 0.619776 0.135874 0.0213649 0.0024 [...]
+14 14
+ 0.109136 0.329602 0.689972 1.03487 1.11229 0.859718 0.477047 0.189459 0.0537271 0.010907 0.00159508 0.000178767 -1.49147e-05 0.000147221 0.362084 1.03815 2.08739 3.04082 3.20151 2.44027 1.34291 0.531588 0.150866 0.0307239 0.00451023 0.000499717 -1.66334e-05 0.000235639 0.724714 2.08109 4.19971 6.13601 6.47556 4.94273 2.72233 1.07849 0.306491 0.0625253 0.00919028 0.00100501 6.69636e-06 0.000255405 1.0601 3.03825 6.13937 8.97645 9.47701 7.23176 3.98161 1.57787 0.449157 0.0918826 0.0135414 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_004.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_004.ref
new file mode 100644
index 0000000..3e0c822
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_004.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 0.0687709 0.221023 0.48938 0.741892 0.78874 0.59286 0.316447 0.120174 0.0325496 0.00631519 0.000883172 8.95246e-05 6.88107e-06 -2.43138e-06 0.401121 1.01398 1.92809 2.63422 2.60432 1.86001 0.958273 0.355564 0.0950221 0.0183338 0.00256515 0.000261247 1.99822e-05 -3.41355e-06 0.847617 2.1492 4.11043 5.64587 5.6074 4.01918 2.07626 0.772099 0.206824 0.040018 0.00561579 0.000573401 4.35039e-05 -2.80659e-06 1.32871 3.36745 6.43915 8.84424 8.78111 6.29049 3.24798 1.20784 0.323811 0.0627441 0.0 [...]
+14 14
+ 0.0812454 0.353639 0.702638 1.0436 1.11373 0.859883 0.477216 0.189075 0.0530075 0.0104535 0.00144622 0.000139796 9.53799e-06 -3.29378e-07 0.300528 1.0587 2.09083 3.05375 3.20757 2.44167 1.34275 0.532105 0.151404 0.0309341 0.00455967 0.000488889 3.89213e-05 7.2567e-07 0.653675 2.09854 4.18642 6.13511 6.47197 4.94105 2.72173 1.07885 0.306708 0.0625514 0.00918887 0.00097915 7.69004e-05 2.15494e-06 1.01606 3.0555 6.13249 8.98136 9.47733 7.2315 3.98111 1.57811 0.449318 0.0919004 0.0135412 0. [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_040.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_040.ref
new file mode 100644
index 0000000..c08beb4
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_040.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+20 20
+ -73.8165 -33.5934 -12.319 -3.60815 -0.836074 -0.153991 -0.0217794 -0.00227375 -0.000177916 -8.22492e-06 2.19625e-07 -7.50511e-06 -9.49236e-05 -0.000513687 -0.00177655 -0.00445686 -0.00865999 -0.0135766 -0.0174647 -0.0187766 -70.1855 -36.4382 -15.0875 -4.9558 -1.27918 -0.253225 -0.0379532 -0.00399608 -0.000202128 1.93327e-05 8.2114e-06 1.12222e-06 -3.86045e-05 -0.000313392 -0.0011903 -0.00294319 -0.00537717 -0.0076655 -0.00884545 -0.00839288 -56.2422 -32.8934 -15.2683 -5.54348 -1.54524 - [...]
+28 28
+ -80.6982 -65.4844 -64.5828 -74.0643 -84.5931 -87.4628 -85.6483 -84.8678 -88.1096 -99.7581 -112.219 -110.044 -87.7723 -53.9878 -24.2591 -9.7958 -3.36297 -0.844582 -0.151265 0.104501 -0.000316513 -0.0965293 -0.0363032 -0.0356046 -0.0104414 0.00106889 -0.00427763 -0.000118251 -67.5498 -50.7399 -38.6814 -35.1349 -38.0414 -42.9934 -46.4048 -50.5307 -58.3471 -69.1462 -78.6353 -77.4039 -59.2844 -32.1373 -13.0754 -4.10174 -0.758614 -0.0254434 0.0906643 0.0389838 -0.0368999 -0.0190171 -0.0187589 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_045.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_045.ref
new file mode 100644
index 0000000..1fcb635
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_045.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+20 20
+ -31.9469 -11.2903 -3.29584 -0.779483 -0.150274 -0.02332 -0.00269119 -0.000244147 -1.43491e-05 8.6653e-08 -3.40808e-06 -5.89603e-05 -0.000360061 -0.00131471 -0.00333203 -0.00631301 -0.00932488 -0.0109751 -0.0104457 -0.00813645 -41.8276 -16.933 -5.57737 -1.49203 -0.315638 -0.0523924 -0.00650724 -0.000485317 4.15475e-06 1.12614e-05 2.97046e-06 -1.21608e-05 -0.000155647 -0.000691312 -0.00181579 -0.0033228 -0.00454992 -0.00484673 -0.00411879 -0.00281954 -45.1208 -20.6628 -7.66561 -2.25846 -0 [...]
+28 28
+ -87.6859 -68.5134 -51.9826 -41.881 -38.9226 -37.7727 -35.0771 -34.1994 -40.3039 -54.9818 -71.761 -78.9327 -68.737 -45.2599 -21.0275 -4.96933 0.904228 2.14224 2.10018 1.5474 0.897674 0.269674 0.0538263 0.0103088 -0.0110207 -0.0154217 -0.0115396 -0.00429561 -68.5134 -54.8959 -41.3889 -30.4813 -24.4018 -23.6967 -26.1997 -31.3282 -40.6871 -53.8888 -65.9775 -68.3941 -56.052 -33.3886 -12.8751 -3.33268 -0.326799 0.575538 0.56152 0.355686 0.130588 0.0303475 0.00583735 -0.00566476 -0.00871948 -0 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_090.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_090.ref
new file mode 100644
index 0000000..1731a6c
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_090.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 2.16734e-06 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 8.24456e-11 4.60796e-12 1.37886e-05 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0.000177978 0.000500534 0.00101552 0.0014864 0.00156953 0.00119563 0.000657066 0.000260503 7.45086e-05 1.53741e-05 2.28856e-06 2.45767e-07 1.90404e-08 1.06418 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_180.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_180.ref
new file mode 100644
index 0000000..71be066
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_180.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 4.60796e-12 8.24456e-11 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 2.16734e-06 7.70655e-07 8.24456e-11 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 1.37886e-05 1.06418e-09 1.90404e-08 2.45767e-07 2.28856e-06 1.53741e-05 7.45086e-05 0.000260503 0.000657066 0.00119563 0.00156953 0.0014864 0.00101552 0.000500534 0.00017 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_270.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_270.ref
new file mode 100644
index 0000000..923fe80
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_270.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 1.37886e-05 0.000177978 0.00165732 0.0111335 0.0539573 0.18865 0.475831 0.865843 1.13662 1.07641 0.735417 0.362475 0.128888 2.16734e-06 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 0.362475 4.39726e-06 7.86758e-05 0.00101552 0.00945644 0.0635266 0.307874 1.07641 2.71504 4.94039 6.4854 6.14188 4.1962 2.06824 0.735417 6.43618e-06 0.000115156 0.0014864 0.0138412 0.0929824 0.450628 1.57552 3.97394 7.23114 9.49254 8.9 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_356.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_356.ref
new file mode 100644
index 0000000..4383e79
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_BCS_NATURAL_356.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 0.0687709 0.401121 0.847617 1.32871 1.4925 1.20708 0.700868 0.291041 0.0859644 0.0179652 0.00264377 0.000272435 1.94033e-05 9.83151e-07 0.221023 1.01398 2.1492 3.36745 3.79555 3.09408 1.82273 0.774881 0.237105 0.0521214 0.00823409 0.00093786 7.72724e-05 4.99226e-06 0.48938 1.92809 4.11043 6.43915 7.25825 5.91268 3.47859 1.47597 0.450442 0.0986558 0.0155014 0.00175142 0.000142622 9.22325e-06 0.741892 2.63422 5.64587 8.84424 9.97517 8.12751 4.78205 2.02955 0.619816 0.135892 0.0213673 0.00 [...]
+14 14
+ 0.0812454 0.300528 0.653675 1.01606 1.10957 0.863048 0.477835 0.18831 0.0527756 0.0105682 0.00152554 0.000160615 1.2929e-05 -4.28428e-06 0.353639 1.0587 2.09854 3.0555 3.20675 2.44118 1.34269 0.531962 0.15123 0.0308733 0.00454899 0.000487541 3.92909e-05 -5.59172e-06 0.702638 2.09083 4.18642 6.13249 6.47144 4.94233 2.72225 1.07842 0.30635 0.0624664 0.00918256 0.000979418 7.74799e-05 -3.25338e-06 1.0436 3.05375 6.13511 8.98136 9.47746 7.23239 3.98152 1.57792 0.449195 0.0919042 0.0135532 0 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_004.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_004.ref
new file mode 100644
index 0000000..eacfe27
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_004.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ nan nan nan nan nan nan nan 0.120174 0.0325496 0.00631519 0.000883172 8.95246e-05 6.88107e-06 -2.43138e-06 0.401121 1.01398 1.92809 2.63422 2.60432 1.86001 0.958273 0.355564 0.0950221 0.0183338 0.00256515 0.000261247 1.99822e-05 -3.41355e-06 0.847617 2.1492 4.11043 5.64587 5.6074 4.01918 2.07626 0.772099 0.206824 0.040018 0.00561579 0.000573401 4.35039e-05 -2.80659e-06 1.32871 3.36745 6.43915 8.84424 8.78111 6.29049 3.24798 1.20784 0.323811 0.0627441 0.0088167 0.000900547 6.77391e-05 -3 [...]
+14 14
+ nan 0.280766 0.489194 0.608298 0.504326 0.267352 0.0524259 nan nan nan nan nan nan nan nan 1.07083 2.12039 3.10144 3.2566 2.47184 1.35169 0.531102 0.152443 0.0303929 0.00478604 0.000403561 6.97335e-05 -1.2887e-05 nan 2.09495 4.17811 6.12205 6.45893 4.93328 2.71955 1.07908 0.306475 0.0626684 0.00914209 0.000995831 7.12483e-05 4.55067e-06 nan 3.0568 6.13477 8.98493 9.48079 7.2335 3.98164 1.57806 0.449368 0.0918757 0.0135511 0.00144098 0.000113958 3.70108e-06 nan 3.20574 6.47093 9.47645 10 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_040.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_040.ref
new file mode 100644
index 0000000..e5bbb4d
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_040.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+20 20
+ nan nan nan nan nan nan nan nan nan nan nan -7.50511e-06 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 8.2114e-06 1.12222e-06 -3.86045e-05 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.000344408 8.63592e-05 1.86537e-05 -5.07509e-07 -0.000102951 nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.00791934 0.00293585 0.000807812 0.000149555 2.28862e-05 -6.98238e-06 nan nan nan nan nan nan nan nan nan nan nan nan 0.132764 0.0966384 0.0493 [...]
+28 28
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 1.37133e-05 -5.80538e-06 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.000125976 -4.14387e-05 7.37311e-06 0.000218848 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan -0.000286197 -0.000135464 -0.00108695 -0.000483963 -0.000113505 - [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_045.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_045.ref
new file mode 100644
index 0000000..af9be4d
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_045.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+20 20
+ nan nan nan nan nan nan nan nan nan nan -3.40808e-06 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 1.12614e-05 2.97046e-06 -1.21608e-05 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.000380885 0.00014243 4.01835e-05 7.84163e-06 -2.33485e-05 nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.00741513 0.00379618 0.00135909 0.000375996 7.71515e-05 1.08303e-05 -2.3284e-05 nan nan nan nan nan nan nan nan nan nan nan nan 0.0736227 0.0513817 [...]
+28 28
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan -1.54554e-06 1.95501e-06 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.00019079 -7.9055e-06 6.75828e-06 0.000107251 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan -0.000604844 -2.95806e-05 -0.000834258 -0.000433796 -8.9885e-06 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_090.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_090.ref
new file mode 100644
index 0000000..1731a6c
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_090.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 2.16734e-06 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 8.24456e-11 4.60796e-12 1.37886e-05 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0.000177978 0.000500534 0.00101552 0.0014864 0.00156953 0.00119563 0.000657066 0.000260503 7.45086e-05 1.53741e-05 2.28856e-06 2.45767e-07 1.90404e-08 1.06418 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_180.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_180.ref
new file mode 100644
index 0000000..71be066
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_180.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 4.60796e-12 8.24456e-11 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 2.16734e-06 7.70655e-07 8.24456e-11 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 1.37886e-05 1.06418e-09 1.90404e-08 2.45767e-07 2.28856e-06 1.53741e-05 7.45086e-05 0.000260503 0.000657066 0.00119563 0.00156953 0.0014864 0.00101552 0.000500534 0.00017 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_270.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_270.ref
new file mode 100644
index 0000000..923fe80
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_270.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ 7.70655e-07 1.37886e-05 0.000177978 0.00165732 0.0111335 0.0539573 0.18865 0.475831 0.865843 1.13662 1.07641 0.735417 0.362475 0.128888 2.16734e-06 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 0.362475 4.39726e-06 7.86758e-05 0.00101552 0.00945644 0.0635266 0.307874 1.07641 2.71504 4.94039 6.4854 6.14188 4.1962 2.06824 0.735417 6.43618e-06 0.000115156 0.0014864 0.0138412 0.0929824 0.450628 1.57552 3.97394 7.23114 9.49254 8.9 [...]
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_356.ref b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_356.ref
new file mode 100644
index 0000000..78fc61f
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_RESIZE_NANS_356.ref
@@ -0,0 +1,6 @@
+14 14
+ 0.128888 0.362475 0.735417 1.07641 1.13662 0.865843 0.475831 0.18865 0.0539573 0.0111335 0.00165732 0.000177978 1.37886e-05 7.70655e-07 0.362475 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.735417 2.06824 4.1962 6.14188 6.4854 4.94039 2.71504 1.07641 0.307874 0.0635266 0.00945644 0.00101552 7.86758e-05 4.39726e-06 1.07641 3.02723 6.14188 8.98974 9.49254 7.23114 3.97394 1.57552 0.450628 0.0929824 0.0138412 0.001 [...]
+14 14
+ nan 0.401121 0.847617 1.32871 1.4925 1.20708 0.700868 nan nan nan nan nan nan nan nan 1.01398 2.1492 3.36745 3.79555 3.09408 1.82273 0.774881 0.237105 0.0521214 0.00823409 0.00093786 7.72724e-05 4.99226e-06 nan 1.92809 4.11043 6.43915 7.25825 5.91268 3.47859 1.47597 0.450442 0.0986558 0.0155014 0.00175142 0.000142622 9.22325e-06 nan 2.63422 5.64587 8.84424 9.97517 8.12751 4.78205 2.02955 0.619816 0.135892 0.0213673 0.0024123 0.000195702 1.27225e-05 nan 2.60432 5.6074 8.78111 9.90582 8.0 [...]
+14 14
+ nan nan nan nan nan nan nan -0.033162 0.0293871 0.00121226 0.00166422 -8.36943e-05 6.40997e-05 -4.56378e-05 0.280766 1.07083 2.09495 3.0568 3.20574 2.44264 1.34141 0.537181 0.15265 0.0317003 0.00454491 0.000521568 3.1577e-05 9.99264e-07 0.489194 2.12039 4.17811 6.13477 6.47093 4.9422 2.72249 1.07703 0.305901 0.0622292 0.00917866 0.000970195 7.93494e-05 -4.74885e-06 0.608298 3.10144 6.12205 8.98493 9.47645 7.23272 3.98139 1.57832 0.44933 0.0919734 0.0135555 0.0014493 0.000112766 1.81595e [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_animation_NONE_NANS_NN.ref b/kmclipm/test/ref/kmclipm_test_rotate_animation_NONE_NANS_NN.ref
new file mode 100644
index 0000000..1ed0a50
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_animation_NONE_NANS_NN.ref
@@ -0,0 +1,121 @@
+100 20 20
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.06824 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.06824 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.735417 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 7.86758e-05 4.39726e-06 4.39726e-06 0.2 0.2 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.735417 1.07641 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.00101552 7.86758e-05 4.39726e-06 4.39726e-06 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.07641 1.13662 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00945644 0.00101552 7.86758e-05 4.39726e-06 4.39726e-06 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.0682 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.13662 0.865843 1.3382 1.3382 0.530546 0.151746 0.0635266 0.00945644 0.00101552 7.86758e-05 6.43618e-06 nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.06824 3.0272 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.865843 0.475831 0.530546 0.151746 0.0313112 0.00945644 0.00101552 7.86758e-05 0.000115156 6.43618e-06 nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.02723 3.1 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.865843 0.475831 0.530546 0.151746 0.0635266 0.00945644 0.00101552 0.000115156 6.43618e-06 6.43618e-06 nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.07641 3.1 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.475831 0.475831 0.530546 0.151746 0.0635266 0.00945644 0.00101552 0.000115156 6.43618e-06 6.79615e-06 nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.07641 3.1 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.475831 0.18865 0.151746 0.0313112 0.0635266 0.00945644 0.0014864 0.000115156 6.79615e-06 6.79615e-06 nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.13662 0.86 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan 0.18865 0.151746 0.0313112 0.00945644 0.00101552 0.0014864 0.000115156 6.79615e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.865843 1.3382 0.53 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan 0.530546 0.151746 0.0635266 0.00945644 0.0014864 0.000115156 0.000121597 6.79615e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.865843 1.3382 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.18865 0.151746 0.0313112 0.0635266 0.00945644 0.0014864 0.000121597 6.79615e-06 5.17711e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.475831 1.33 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.18865 0.151746 0.0313112 0.00945644 0.0138412 0.0014864 0.000121597 6.79615e-06 5.17711e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.475831 0.53 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.0539573 0.151746 0.0313112 0.00945644 0.0014864 0.0014864 0.000121597 5.17711e-06 5.17711e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.475831 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.0539573 0.0313112 0.0635266 0.00945644 0.0014864 0.00156953 0.000121597 5.17711e-06 2.84513e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.18865 0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.0539573 0.0313112 0.00945644 0.00945644 0.0014864 0.000121597 9.26289e-05 5.17711e-06 2.84513e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.18865 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.0111335 0.0313112 0.00945644 0.0138412 0.0014864 0.000121597 9.26289e-05 2.84513e-06 1.12799e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.18865 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.0111335 0.0313112 0.00945644 0.0014864 0.00156953 0.000121597 9.26289e-05 2.84513e-06 1.12799e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.18865 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.0313112 0.00466092 0.00945644 0.0014864 0.00156953 9.26289e-05 5.0905e-05 2.84513e-06 1.12799e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.05395 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.00466092 0.00945644 0.00101552 0.0014864 0.000121597 9.26289e-05 2.84513e-06 1.12799e-06 3.22626e-07 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.05 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.0111335 0.00466092 0.00945644 0.0014864 0.00156953 0.000121597 9.26289e-05 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 nan 0.2 0.2 0.2 0.2 0.2 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.00165732 0.00466092 0.00101552 0.0014864 0.00156953 9.26289e-05 5.0905e-05 1.12799e-06 1.12799e-06 3.22626e-07 6.65705e-08 nan 0.2 0.2 0.2 0.2 0.2 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.00165732 0.00466092 0.00101552 0.0014864 0.00156953 9.26289e-05 5.0905e-05 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 0.2 0.2 0.2 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.00466092 0.000500534 0.00101552 0.0014864 0.000121597 9.26289e-05 5.0905e-05 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.000500534 0.00101552 0.0014864 0.00156953 9.26289e-05 5.0905e-05 2.0182e-05 2.0182e-05 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 0.2 0.2 0.2 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.000500534 0.00101552 0.0014864 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 6.65705e-08 9.90956e-09 1.06418e-09 8.24456e-11 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.000177978 0.000500534 0.00101552 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 9.90956e-09 1.06418e-09 8.24456e-11 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.000177978 0.000500534 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.06418e-09 8.24456e-11 0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 4.39726e-06 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.90404e-08 1.06418e-09 1.06418e-09 0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 4.39726e-06 6.43618e-06 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 2.45767e-07 1.90404e-08 1.06418e-09 1.06418e-09 0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 4.39726e-06 6.43618e-06 6.79615e-06 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 2.28856e-06 2.45767e-07 1.90404e-08 1.06418e-09 1.06418e-09 0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.43618e-06 6.79615e-06 5.17711e-06 5.0905e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.53741e-05 2.28856e-06 2.45767e-07 1.90404e-08 9.90956e-09 nan 0.2 0.2 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 2.0182e-05 5.77242e-06 1.19108e-06 2.28856e-06 2.45767e-07 1.90404e-08 1.77302e-07 9.90956e-09 nan 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 2.0182e-05 5.77242e-06 1.53741e-05 2.28856e-06 2.45767e-07 1.77302e-07 9.90956e-09 9.90956e-09 nan 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.79615e-06 5.17711e-06 2.84513e-06 2.84513e-06 2.0182e-05 5.77242e-06 1.53741e-05 2.28856e-06 2.45767e-07 1.77302e-07 9.90956e-09 6.65705e-08 nan 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 5.77242e-06 1.19108e-06 1.53741e-05 2.28856e-06 2.28856e-06 1.77302e-07 6.65705e-08 6.65705e-08 nan 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 5.17711e-06 2.84513e-06 1.12799e-06 5.77242e-06 1.19108e-06 2.28856e-06 2.45767e-07 2.28856e-06 1.77302e-07 6.65705e-08 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 2.84513e-06 1.12799e-06 2.0182e-05 5.77242e-06 1.53741e-05 2.28856e-06 2.28856e-06 1.77302e-07 1.19108e-06 6.65705e-08 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 2.84513e-06 1.12799e-06 5.77242e-06 1.19108e-06 1.53741e-05 2.28856e-06 2.28856e-06 1.19108e-06 6.65705e-08 3.22626e-07 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 2.84513e-06 1.12799e-06 5.77242e-06 1.19108e-06 2.28856e-06 2.13108e-05 2.28856e-06 1.19108e-06 6.65705e-08 3.22626e-07 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.12799e-06 3.22626e-07 5.77242e-06 1.19108e-06 2.28856e-06 2.28856e-06 2.28856e-06 1.19108e-06 3.22626e-07 3.22626e-07 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.12799e-06 3.22626e-07 1.19108e-06 1.53741e-05 2.28856e-06 2.28856e-06 1.53741e-05 1.19108e-06 3.22626e-07 1.12799e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 3.22626e-07 3.22626e-07 1.19108e-06 2.28856e-06 2.28856e-06 2.28856e-06 1.19108e-06 5.77242e-06 3.22626e-07 1.12799e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 3.22626e-07 6.65705e-08 1.19108e-06 2.28856e-06 2.13108e-05 2.28856e-06 1.19108e-06 5.77242e-06 1.12799e-06 2.84513e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 3.22626e-07 6.65705e-08 1.19108e-06 2.28856e-06 2.28856e-06 1.53741e-05 1.19108e-06 5.77242e-06 1.12799e-06 2.84513e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 6.65705e-08 1.19108e-06 1.77302e-07 2.28856e-06 2.28856e-06 1.53741e-05 5.77242e-06 2.0182e-05 1.12799e-06 2.84513e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 6.65705e-08 1.77302e-07 2.28856e-06 2.45767e-07 2.28856e-06 1.19108e-06 5.77242e-06 1.12799e-06 2.84513e-06 5.17711e-06 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.65705e-08 6.65705e-08 1.77302e-07 2.28856e-06 2.28856e-06 1.53741e-05 1.19108e-06 5.77242e-06 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 nan 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.65705e-08 9.90956e-09 1.77302e-07 2.45767e-07 2.28856e-06 1.53741e-05 5.77242e-06 2.0182e-05 2.84513e-06 2.84513e-06 5.17711e-06 6.79615e-06 nan 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 9.90956e-09 9.90956e-09 1.77302e-07 2.45767e-07 2.28856e-06 1.53741e-05 5.77242e-06 2.0182e-05 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 9.90956e-09 1.77302e-07 1.90404e-08 2.45767e-07 2.28856e-06 1.19108e-06 5.77242e-06 2.0182e-05 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 9.90956e-09 1.90404e-08 2.45767e-07 2.28856e-06 1.53741e-05 5.77242e-06 2.0182e-05 5.0905e-05 5.0905e-05 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.06418e-09 1.90404e-08 2.45767e-07 2.28856e-06 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 6.79615e-06 6.43618e-06 4.39726e-06 2.16734e-06 0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.06418e-09 1.90404e-08 2.45767e-07 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 6.43618e-06 4.39726e-06 2.16734e-06 0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.06418e-09 1.90404e-08 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 4.39726e-06 2.16734e-06 0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 1.37886e-05 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 1.37886e-05 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 nan 0.2 0.2 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.06418e-09 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 0.000500534 0.000177978 nan 0.2 0.2 0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.06418e-09 9.90956e-09 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 0.00101552 0.000500534 0.000177978 nan 0.2 0.2 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.06418e-09 9.90956e-09 6.65705e-08 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.0014864 0.00101552 0.000500534 nan nan 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 9.90956e-09 6.65705e-08 3.22626e-07 2.0182e-05 2.0182e-05 5.0905e-05 9.26289e-05 0.00156953 0.0014864 0.00101552 0.000500534 nan nan 0.2 0.2 0.2 0.2 0.2 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 5.0905e-05 9.26289e-05 0.000121597 0.0014864 0.00101552 0.000500534 0.00466092 nan nan 0.2 0.2 0.2 0.2 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 5.0905e-05 9.26289e-05 0.00156953 0.0014864 0.00101552 0.00466092 0.00165732 nan nan 0.2 0.2 0.2 0.2 0.2 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.65705e-08 3.22626e-07 1.12799e-06 1.12799e-06 5.0905e-05 9.26289e-05 0.00156953 0.0014864 0.00101552 0.00466092 0.00165732 nan nan 0.2 0.2 0.2 0.2 0.2 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 9.26289e-05 0.000121597 0.00156953 0.0014864 0.00945644 0.00466092 0.0111335 nan nan 0.2 0.2 0.2 0.2 0.2 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 3.22626e-07 1.12799e-06 2.84513e-06 9.26289e-05 0.000121597 0.0014864 0.00101552 0.00945644 0.00466092 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.65705e [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.12799e-06 2.84513e-06 5.0905e-05 9.26289e-05 0.00156953 0.0014864 0.00945644 0.00466092 0.0313112 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.65705e-08 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.12799e-06 2.84513e-06 9.26289e-05 0.000121597 0.00156953 0.0014864 0.00945644 0.0313112 0.0111335 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.22626e-07 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.12799e-06 2.84513e-06 9.26289e-05 0.000121597 0.0014864 0.0138412 0.00945644 0.0313112 0.0111335 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.22626e-07 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 2.84513e-06 5.17711e-06 9.26289e-05 0.000121597 0.0014864 0.00945644 0.00945644 0.0313112 0.0539573 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.22626e-07 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 2.84513e-06 5.17711e-06 0.000121597 0.00156953 0.0014864 0.00945644 0.0635266 0.0313112 0.0539573 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.12799e-06 1 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 5.17711e-06 5.17711e-06 0.000121597 0.0014864 0.0014864 0.00945644 0.0313112 0.151746 0.0539573 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.12799e-06 2.8 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 5.17711e-06 6.79615e-06 0.000121597 0.0014864 0.0138412 0.00945644 0.0313112 0.151746 0.18865 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.84513e-06 2.845 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 5.17711e-06 6.79615e-06 0.000121597 0.0014864 0.00945644 0.0635266 0.0313112 0.151746 0.18865 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.84513e-06 2.845 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 6.79615e-06 0.000121597 0.000115156 0.0014864 0.00945644 0.0635266 0.151746 0.530546 nan nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.84513e-06 5.17711e-0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 6.79615e-06 0.000115156 0.0014864 0.00101552 0.00945644 0.0313112 0.151746 0.18865 nan nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 5.17711e-06 5.17711e-06 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.79615e-06 6.79615e-06 0.000115156 0.0014864 0.00945644 0.0635266 0.0313112 0.151746 0.18865 0.475831 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 5.17711e-06 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.79615e-06 6.43618e-06 0.000115156 0.00101552 0.00945644 0.0635266 0.151746 0.530546 0.475831 0.475831 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 5.17711e-06 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.43618e-06 6.43618e-06 0.000115156 0.00101552 0.00945644 0.0635266 0.151746 0.530546 0.475831 0.865843 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.79615e-06 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.43618e-06 0.000115156 7.86758e-05 0.00101552 0.00945644 0.0313112 0.151746 0.530546 0.475831 0.865843 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.79615e-06 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.43618e-06 7.86758e-05 0.00101552 0.00945644 0.0635266 0.151746 0.530546 1.3382 1.3382 0.865843 1.13662 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.79615e-06 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 4.39726e-06 7.86758e-05 0.00101552 0.00945644 0.0313112 0.151746 0.530546 1.3382 2.43504 1.13662 1.07641 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.43618e-06 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 4.39726e-06 7.86758e-05 0.00101552 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 1.07641 0.735417 0.362475 0.2 0.2 0.2 0.2 0.2 0.2 0.2 6.43 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 4.39726e-06 7.86758e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 0.735417 0.362475 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 0.362475 0.2 0.2 0.2 0.2 0.2 0.2 0.2 7.86758e-0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 0.362475 0.2 0.2 0.2 0.2 0.2 0.2 0.2 7.86758e-0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 7.86758e-05 0.0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.000177978 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 2.06824 0.735417 nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.000500534 0.00 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.000177978 0.00165732 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 4.1962 2.06824 0.735417 nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.000500534 0.004 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.00165732 0.0111335 0.151746 0.530546 1.3382 2.43504 3.19654 6.14188 4.1962 2.06824 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.000500534 0.00466092 0.03131 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.0111335 0.0539573 0.530546 0.530546 1.3382 2.43504 6.4854 6.14188 4.1962 2.06824 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.000500534 0.00466092 0.0313112 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.0539573 0.18865 1.3382 2.43504 3.19654 6.14188 4.1962 2.06824 3.02723 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.00466092 0.0313112 0.151746 0.530546 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.0539573 0.18865 1.3382 2.43504 6.4854 6.14188 4.1962 3.02723 1.07641 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.00165732 0.0313112 0.151746 0.530546 2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.18865 0.18865 1.3382 2.43504 6.4854 6.14188 4.1962 3.02723 1.07641 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.00165732 0.0313112 0.151746 0.530546 2.7 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.18865 0.475831 2.43504 3.19654 6.4854 6.14188 6.14188 3.02723 1.13662 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.0111335 0.0539573 0.151746 0.530546 2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan 0.475831 2.43504 3.19654 6.14188 4.1962 6.14188 3.02723 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.0539573 0.530546 1.3382 2.71504 4.94039 9 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan 1.3382 2.43504 6.4854 6.14188 6.14188 3.02723 3.19654 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.0539573 0.530546 1.3382 4.94039 6.4854 9.49 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.475831 2.43504 3.19654 6.4854 6.14188 6.14188 3.19654 1.13662 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.18865 0.530546 1.3382 4.94039 9.49254 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.475831 2.43504 3.19654 6.14188 8.98974 6.14188 3.19654 1.13662 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.18865 1.3382 1.3382 4.94039 9.49254 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.865843 2.43504 3.19654 6.14188 6.14188 6.14188 3.19654 0.865843 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.18865 1.3382 2.43504 4.94039 9.4925 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.865843 3.19654 6.4854 6.14188 6.14188 6.4854 3.19654 0.865843 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.18865 1.3382 4.94039 6.4854 9.49254 9 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.865843 3.19654 6.14188 6.14188 6.14188 3.19654 2.43504 0.865843 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.475831 2.43504 4.94039 6.4854 8.989 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 1.13662 3.19654 6.14188 8.98974 6.14188 3.19654 2.43504 0.475831 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.475831 2.43504 4.94039 9.49254 8.989 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 1.13662 3.19654 6.14188 6.14188 6.4854 3.19654 2.43504 0.475831 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.475831 2.43504 6.4854 9.49254 8.98974 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 3.19654 3.02723 6.14188 6.14188 6.4854 2.43504 1.3382 nan nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.865843 2.43504 6.4854 9.49254 9.49254 6.485 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 3.02723 6.14188 4.1962 6.14188 3.19654 2.43504 0.475831 nan nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.865843 3.19654 6.4854 8.98974 9.49254 4.9 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.13662 3.02723 6.14188 6.14188 6.4854 3.19654 2.43504 0.475831 0.18865 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.865843 3.19654 6.4854 8.98974 9.4 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.07641 3.02723 4.1962 6.14188 6.4854 2.43504 1.3382 0.18865 0.18865 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 3.19654 3.19654 6.14188 8.98974 9.4925 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.07641 3.02723 4.1962 6.14188 6.4854 2.43504 1.3382 0.18865 0.0539573 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 3.19654 6.4854 8.98974 8.98974 6.485 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 3.02723 2.06824 4.1962 6.14188 3.19654 2.43504 1.3382 0.18865 0.0539573 nan nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 3.19654 6.14188 8.98974 9.49254 4.9 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 2.06824 4.1962 6.14188 6.4854 2.43504 1.3382 0.530546 0.530546 0.0539573 0.0111335 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.13662 3.02723 6.14188 8.98974 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 2.06824 4.1962 6.14188 3.19654 2.43504 1.3382 0.530546 0.151746 0.0111335 0.00165732 nan nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.07641 3.02723 6.14188 8.9897 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.735417 2.06824 4.1962 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00165732 0.000177978 1.37886e-05 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.07641 3 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.735417 2.06824 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000177978 1.37886e-05 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.02723 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.06824 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rotate_animation_RESIZE_NANS_NN.ref b/kmclipm/test/ref/kmclipm_test_rotate_animation_RESIZE_NANS_NN.ref
new file mode 100644
index 0000000..940cfa4
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rotate_animation_RESIZE_NANS_NN.ref
@@ -0,0 +1,121 @@
+100 20 20
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.06824 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.06824 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 0.0539573 0.0111335 0.00165732 0.000177978 3.8778e-05 2.16734e-06 2.16734e-06 nan 0.2 0.2 0.2 0.2 0.2 0.362475 0.735417 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 7.86758e- [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 0.18865 0.0539573 0.0111335 0.00165732 0.000500534 3.8778e-05 2.16734e-06 2.16734e-06 nan 0.2 0.2 0.2 0.2 0.2 0.362475 0.735417 1.07641 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.00101552 7.8675 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 0.18865 0.0539573 0.0111335 0.00466092 0.000500534 3.8778e-05 2.16734e-06 nan nan 0.2 0.2 0.2 0.2 0.2 nan nan 1.07641 1.13662 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00945644 0.00101552 7.86758e-05 4.39726e-06 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 0.0539573 0.0111335 0.00466092 0.000500534 3.8778e-05 2.16734e-06 4.39726e-06 nan nan 0.2 0.2 0.2 0.2 0.2 nan nan 1.13662 0.865843 1.3382 1.3382 0.530546 0.151746 0.0635266 0.00945644 0.00101552 7.86758e-05 6.43618e [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan nan nan 0.000177978 1.37886e-05 2.16734e-06 nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan nan nan 0.0539573 0.0111335 0.00466092 0.000500534 3.8778e-05 4.39726e-06 4.39726e-06 nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.865843 0.475831 0.530546 0.151746 0.0313112 0.00945644 0.00101552 7.867 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan nan 0.000177978 1.37886e-05 3.8778e-05 2.16734e-06 nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan nan nan 0.0539573 0.0313112 0.00466092 0.000500534 7.86758e-05 4.39726e-06 4.39726e-06 nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.865843 0.475831 0.530546 0.151746 0.0635266 0.00945644 0.001015 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan nan 0.000177978 3.8778e-05 2.16734e-06 2.16734e-06 nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan nan nan 0.0111335 0.00466092 0.000500534 0.00101552 7.86758e-05 4.39726e-06 nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.475831 0.475831 0.530546 0.151746 0.0635266 0.00945644 0.00101552 0.00 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 0.00165732 0.000177978 3.8778e-05 2.16734e-06 4.39726e-06 nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan nan 0.0539573 0.0111335 0.00466092 0.000500534 7.86758e-05 4.39726e-06 6.43618e-06 nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.475831 0.18865 0.151746 0.0313112 0.0635266 0.00945644 0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 0.000177978 3.8778e-05 3.8778e-05 4.39726e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan nan 0.0539573 0.0313112 0.00466092 0.00101552 7.86758e-05 6.43618e-06 6.43618e-06 nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan 0.18865 0.151746 0.0313112 0.00945644 0.00101552 0.0014864 0.00 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 0.000177978 3.8778e-05 4.39726e-06 4.39726e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan nan 0.0111335 0.00466092 0.00466092 0.00101552 7.86758e-05 6.43618e-06 6.43618e-06 nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan 0.530546 0.151746 0.0635266 0.00945644 0.0014864 0.000115156 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan nan nan 2.16734e-06 2.16734e-06 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan nan 0.000177978 0.000500534 3.8778e-05 4.39726e-06 4.39726e-06 nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan 0.0111335 0.00466092 0.00101552 7.86758e-05 0.000115156 6.43618e-06 6.79615e-06 nan nan nan nan nan 0.2 nan nan nan nan nan 0.18865 0.151746 0.0313112 0.0635266 0.0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan nan 1.37886e-05 2.16734e-06 2.16734e-06 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan nan 0.000177978 3.8778e-05 7.86758e-05 4.39726e-06 6.43618e-06 nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan 0.0313112 0.00466092 0.00101552 7.86758e-05 6.43618e-06 6.79615e-06 nan nan nan nan nan nan 0.2 nan nan nan nan nan 0.18865 0.151746 0.0313112 0.00945644 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan nan 2.16734e-06 2.16734e-06 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan nan 0.000500534 3.8778e-05 4.39726e-06 6.43618e-06 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 0.0111335 0.00466092 0.00466092 0.00101552 0.000115156 6.43618e-06 6.79615e-06 nan nan nan nan nan nan 0.2 nan nan nan nan nan 0.0539573 0.151746 0.0313112 0.00945644 0.0014864 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 1.37886e-05 2.16734e-06 4.39726e-06 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan 0.000177978 0.000500534 7.86758e-05 4.39726e-06 6.43618e-06 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 0.0111335 0.00466092 0.00101552 0.00101552 0.000115156 6.79615e-06 6.79615e-06 nan nan nan nan nan nan 0.2 nan nan nan nan nan 0.0539573 0.0313112 0.0635266 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 1.37886e-05 2.16734e-06 4.39726e-06 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan 0.000177978 3.8778e-05 7.86758e-05 6.43618e-06 6.43618e-06 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 0.00165732 0.00466092 0.00101552 0.000115156 0.000115156 6.79615e-06 5.17711e-06 nan nan nan nan nan nan 0.2 nan nan nan nan nan 0.0539573 0.0313112 0.00945644 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 2.16734e-06 4.39726e-06 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan 0.000500534 3.8778e-05 4.39726e-06 6.43618e-06 6.79615e-06 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 0.00165732 0.000500534 0.00101552 0.000115156 0.000121597 6.79615e-06 5.17711e-06 nan nan nan nan nan nan 0.2 nan nan nan nan nan 0.0111335 0.0313112 0.00945644 0.01384 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 1.37886e-05 2.16734e-06 4.39726e-06 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 0.000177978 3.8778e-05 7.86758e-05 4.39726e-06 6.43618e-06 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 0.00466092 0.000500534 0.00101552 0.000115156 6.79615e-06 5.17711e-06 2.84513e-06 nan nan nan nan nan nan 0.2 nan nan nan nan nan 0.0111335 0.0313112 0.00945644 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan 0.000177978 3.8778e-05 4.39726e-06 6.43618e-06 6.79615e-06 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.00165732 0.000500534 0.00101552 0.000115156 0.000115156 6.79615e-06 5.17711e-06 2.84513e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.0313112 0.00466092 0.00945644 0.0014864 0.00 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan 3.8778e-05 3.8778e-05 4.39726e-06 6.43618e-06 6.79615e-06 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.00165732 0.000500534 0.00101552 0.000115156 0.000121597 5.17711e-06 5.17711e-06 2.84513e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.00466092 0.00945644 0.00101552 0.0014864 0.00 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan 3.8778e-05 4.39726e-06 6.43618e-06 6.79615e-06 6.79615e-06 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.000177978 0.000500534 7.86758e-05 0.000115156 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 0.0111335 0.00466092 0.00945644 0.0014864 0.0015 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan 1.37886e-05 3.8778e-05 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.000500534 0.00101552 7.86758e-05 0.000115156 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 0.00165732 0.00466092 0.00101552 0.001486 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan 3.8778e-05 2.16734e-06 4.39726e-06 6.43618e-06 6.79615e-06 nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.000500534 7.86758e-05 0.000115156 0.000121597 5.17711e-06 2.84513e-06 1.12799e-06 1.12799e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 0.00165732 0.00466092 0.00101552 0.0014864 0.001 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan 2.16734e-06 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 0.000177978 3.8778e-05 7.86758e-05 0.000115156 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 0.00466092 0.000500534 0.00101552 0.0014 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 1.37886e-05 3.8778e-05 7.86758e-05 0.000115156 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 nan nan nan 0.2 0.2 0.2 0.2 0.2 nan nan 0.000500534 0.00101552 0.0014864 0.00156953 9.26289e-05 5.0905e-05 2.018 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 3.8778e-05 7.86758e-05 0.000115156 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 nan nan 0.2 0.2 0.2 0.2 0.2 nan nan 0.000500534 0.00101552 0.0014864 0.000121597 9.26289e-05 5.0905e [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.37886e-05 3.8778e-05 7.86758e-05 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 8.24456e-11 nan 0.2 0.2 0.2 0.2 0.2 nan 0.000177978 0.000500534 0.00101552 0.000115156 0.000 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.37886e-05 3.8778e-05 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 8.24456e-11 4.60796e-12 0.2 0.2 0.2 0.2 0.2 nan 0.000177978 0.000500534 7.86758e-05 0.000115 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.8778e-05 7.86758e-05 0.000115156 0.000121597 9.26289e-05 5.0905e-05 2.0182e-05 5.77242e-06 1.19108e-06 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.16734e-06 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 1.47512e-09 8.24456e-11 8.24456e-11 nan 0.2 0.2 0.2 0.2 0.2 2.16734e-06 4.39726e-06 0.000115156 0.000121597 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.16734e-06 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 9.90956e-09 1.90404e-08 1.47512e-09 8.24456e-11 8.24456e-11 nan 0.2 0.2 0.2 0.2 0.2 2.16734e-06 4.39726e-06 6.43618e-06 0.000121597 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 nan nan 0.2 0.2 0.2 0.2 0.2 2.16734e-06 4.39726e-06 6.43618e-06 6.79615e-06 9.26289e-05 5.0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 6.79615e-06 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 1.77302e-07 1.90404e-08 1.47512e-09 8.24456e-11 1.06418e-09 nan nan 0.2 0.2 0.2 0.2 0.2 4.39726e-06 6.43618e-06 6.79615e-06 5.17711e-06 5.0905e-05 5.0905e-05 2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 8.24456e-11 8.24456e-11 nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 5.17711e-06 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 1.77302e-07 1.90404e-08 1.47512e-09 1.06418e-09 1.06418e-09 nan nan nan 0.2 0.2 0.2 nan 4.39726e-06 6.43618e-06 6.79615 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 6.65705e-08 9.90956e-09 1.06418e-09 8.24456e-11 1.47512e-09 8.24456e-11 nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 2.84513e-06 2.84513e-06 1.12799e-06 3.22626e-07 1.19108e-06 1.77302e-07 1.90404e-08 1.90404e-08 1.06418e-09 1.06418e-09 nan nan nan 0.2 0.2 0.2 nan 4.39726e-06 6.43618e-06 6.79615 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 3.22626e-07 6.65705e-08 9.90956e-09 1.06418e-09 1.47512e-09 8.24456e-11 8.24456e-11 nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 1.77302e-07 1.90404e-08 2.45767e-07 1.90404e-08 1.06418e-09 nan nan nan nan 0.2 0.2 0.2 nan nan 6.79615e-06 5.17711e-06 2.8 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 6.65705e-08 6.65705e-08 9.90956e-09 1.06418e-09 1.47512e-09 8.24456e-11 1.06418e-09 nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 2.84513e-06 1.12799e-06 3.22626e-07 6.65705e-08 1.77302e-07 1.90404e-08 1.90404e-08 1.06418e-09 9.90956e-09 nan nan nan nan 0.2 0.2 0.2 nan nan 6.79615e-06 5.17711e-06 2.8 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 6.65705e-08 9.90956e-09 1.06418e-09 1.47512e-09 1.47512e-09 1.06418e-09 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 1.12799e-06 3.22626e-07 3.22626e-07 1.19108e-06 1.77302e-07 2.45767e-07 1.90404e-08 9.90956e-09 9.90956e-09 nan nan nan nan 0.2 0.2 0.2 nan nan nan 5.17711e-06 2.84513e-06 1.12799 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 6.65705e-08 9.90956e-09 1.06418e-09 1.47512e-09 1.06418e-09 1.06418e-09 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 1.12799e-06 3.22626e-07 6.65705e-08 1.77302e-07 1.77302e-07 2.45767e-07 1.90404e-08 9.90956e-09 9.90956e-09 nan nan nan nan 0.2 0.2 0.2 nan nan nan 2.84513e-06 1.12799e-06 2.0182e [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 1.06418e-09 8.24456e-11 8.24456e-11 8.24456e-11 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan 9.90956e-09 1.06418e-09 1.90404e-08 1.47512e-09 1.06418e-09 1.06418e-09 nan nan nan nan nan nan 0.2 nan nan nan nan nan 1.12799e-06 3.22626e-07 6.65705e-08 1.77302e-07 2.45767e-07 1.90404e-08 1.77302e-07 9.90956e-09 6.65705e-08 nan nan nan nan nan 0.2 nan nan nan nan [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 1.06418e-09 8.24456e-11 8.24456e-11 8.24456e-11 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 6.65705e-08 9.90956e-09 1.06418e-09 1.47512e-09 1.90404e-08 1.06418e-09 9.90956e-09 nan nan nan nan nan nan 0.2 nan nan nan nan nan 3.22626e-07 6.65705e-08 1.19108e-06 1.77302e-07 2.45767e-07 1.90404e-08 9.90956e-09 6.65705e-08 nan nan nan nan nan nan 0.2 nan nan nan nan [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 1.06418e-09 8.24456e-11 8.24456e-11 8.24456e-11 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 9.90956e-09 9.90956e-09 1.90404e-08 1.47512e-09 1.06418e-09 9.90956e-09 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 3.22626e-07 6.65705e-08 1.77302e-07 1.77302e-07 2.45767e-07 1.77302e-07 9.90956e-09 6.65705e-08 nan nan nan nan nan nan 0.2 nan nan nan nan 1.12799 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 1.06418e-09 8.24456e-11 8.24456e-11 1.06418e-09 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 9.90956e-09 1.06418e-09 1.90404e-08 1.90404e-08 1.06418e-09 9.90956e-09 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 6.65705e-08 6.65705e-08 1.77302e-07 2.45767e-07 2.45767e-07 1.77302e-07 6.65705e-08 6.65705e-08 nan nan nan nan nan nan 0.2 nan nan nan nan 1.12799 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 8.24456e-11 8.24456e-11 8.24456e-11 1.06418e-09 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 9.90956e-09 1.06418e-09 1.47512e-09 1.90404e-08 9.90956e-09 9.90956e-09 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 6.65705e-08 9.90956e-09 1.77302e-07 2.45767e-07 1.77302e-07 1.77302e-07 6.65705e-08 3.22626e-07 nan nan nan nan nan nan 0.2 nan nan nan nan 3.22626 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 8.24456e-11 8.24456e-11 8.24456e-11 1.06418e-09 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 9.90956e-09 1.06418e-09 1.90404e-08 1.47512e-09 1.06418e-09 9.90956e-09 6.65705e-08 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 6.65705e-08 9.90956e-09 1.90404e-08 2.45767e-07 1.77302e-07 1.19108e-06 6.65705e-08 3.22626e-07 nan nan nan nan nan nan 0.2 nan nan nan nan [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 8.24456e-11 8.24456e-11 8.24456e-11 1.06418e-09 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 1.06418e-09 1.06418e-09 1.47512e-09 1.90404e-08 1.06418e-09 9.90956e-09 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan 6.65705e-08 9.90956e-09 1.77302e-07 1.90404e-08 2.45767e-07 1.77302e-07 6.65705e-08 3.22626e-07 1.12799e-06 nan nan nan nan nan nan 0.2 nan nan nan nan [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan 1.06418e-09 1.06418e-09 1.47512e-09 1.06418e-09 9.90956e-09 6.65705e-08 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 9.90956e-09 9.90956e-09 1.90404e-08 2.45767e-07 1.77302e-07 1.77302e-07 6.65705e-08 3.22626e-07 1.12799e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 6.65705e-08 1.19108e-06 1.77302 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan 1.06418e-09 1.47512e-09 1.47512e-09 1.06418e-09 9.90956e-09 6.65705e-08 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 9.90956e-09 9.90956e-09 1.90404e-08 2.45767e-07 1.77302e-07 1.19108e-06 3.22626e-07 3.22626e-07 1.12799e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 6.65705e-08 1.77302e-07 2.28856 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan 1.06418e-09 8.24456e-11 1.47512e-09 1.06418e-09 9.90956e-09 6.65705e-08 6.65705e-08 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 9.90956e-09 1.06418e-09 1.90404e-08 1.90404e-08 1.77302e-07 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan 6.65705e-08 6.65705e-08 1.7 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan 8.24456e-11 8.24456e-11 1.47512e-09 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 1.06418e-09 1.90404e-08 2.45767e-07 1.90404e-08 1.77302e-07 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan 6.65705e-08 9.90956e-09 1.7 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan 8.24456e-11 1.47512e-09 8.24456e-11 1.06418e-09 9.90956e-09 6.65705e-08 nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan 1.06418e-09 1.06418e-09 1.90404e-08 1.90404e-08 1.77302e-07 1.19108e-06 3.22626e-07 1.12799e-06 2.84513e-06 2.84513e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan 9.90956e-09 9.90956e-09 1.7 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan 8.24456e-11 8.24456e-11 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan 1.06418e-09 1.06418e-09 1.47512e-09 1.90404e-08 1.77302e-07 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan 9.90956e-09 1.77302e-07 1.9 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.06418e-09 8.24456e-11 1.47512e-09 1.90404e-08 1.77302e-07 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 nan nan nan 0.2 0.2 0.2 0.2 0.2 nan 9.90956e-09 1.90404e-08 2.45767e-07 2.28856e-06 1.53741e-05 5.77242 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 8.24456e-11 1.47512e-09 1.90404e-08 1.77302e-07 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 nan nan 0.2 0.2 0.2 0.2 0.2 1.06418e-09 1.06418e-09 1.90404e-08 2.45767e-07 2.28856e-06 1.1 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 8.24456e-11 8.24456e-11 1.47512e-09 1.90404e-08 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 2.16734e-06 nan 0.2 0.2 0.2 0.2 0.2 1.06418e-09 1.06418e-09 1.90404e-08 2.45767e-07 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 8.24456e-11 8.24456e-11 1.47512e-09 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 2.16734e-06 nan 0.2 0.2 0.2 0.2 0.2 1.06418e-09 1.06418e-09 1.90404e-08 1.90404e-08 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 1.37886e-05 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 1.37886e-05 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.47512e-09 1.90404e-08 1.77302e-07 1.19108e-06 5.77242e-06 2.0182e-05 5.0905e-05 9.26289e-05 0.000121597 0.000115156 7.86758e-05 3.8778e-05 nan 0.2 0.2 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 8.24456e-11 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 3.8778e-05 1.37886e-05 nan nan 0.2 0.2 0.2 0.2 0.2 8.24456e-11 1.06418e-09 1.77302e-07 1.19108e-06 5.77242e [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 8.24456e-11 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 6.43618e-06 7.86758e-05 3.8778e-05 1.37886e-05 nan nan 0.2 0.2 0.2 0.2 0.2 8.24456e-11 1.06418e-09 9.90956e-09 1.19108e-06 5.77242e [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 0.000115156 7.86758e-05 3.8778e-05 nan nan nan 0.2 0.2 0.2 0.2 0.2 8.24456e-11 1.06418e-09 9.90956e-09 6.65705e-08 5.77242e-06 2.0182e-05 5 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 0.000115156 7.86758e-05 3.8778e-05 1.37886e-05 nan nan nan 0.2 0.2 0.2 0.2 0.2 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 2.0182e-05 2.0182e-05 5.0905e-05 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 2.16734e-06 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 3.22626e-07 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 0.000115156 7.86758e-05 3.8778e-05 0.000177978 nan nan nan nan 0.2 0.2 0.2 nan 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 6.79615e-06 6.43618e-06 4.39726e-06 2.16734e-06 3.8778e-05 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 1.12799e-06 1.12799e-06 2.84513e-06 5.17711e-06 0.000121597 0.000115156 7.86758e-05 0.000500534 nan nan nan nan nan 0.2 0.2 0.2 nan 1.06418e-09 9.90956e-09 6.65705e-08 3.22626e-07 1.12799e [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 5.17711e-06 6.79615e-06 6.43618e-06 4.39726e-06 3.8778e-05 1.37886e-05 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 0.000115156 7.86758e-05 0.00101552 0.000500534 nan nan nan nan nan 0.2 0.2 0.2 nan nan 6.65705e-08 3.22626e-07 1.12799e-06 1.12799e- [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 6.79615e-06 6.79615e-06 6.43618e-06 4.39726e-06 3.8778e-05 nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 1.12799e-06 2.84513e-06 5.17711e-06 6.79615e-06 0.000115156 7.86758e-05 0.000500534 0.000177978 nan nan nan nan nan 0.2 0.2 0.2 nan nan 6.65705e-08 3.22626e-07 1.12799e-06 2.84513e-06 9.26 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 6.79615e-06 6.43618e-06 4.39726e-06 3.8778e-05 3.8778e-05 nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 2.84513e-06 5.17711e-06 5.17711e-06 0.000121597 0.000115156 0.00101552 0.000500534 0.00165732 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 3.22626e-07 1.12799e-06 2.84513e-06 9.26289e-05 0.0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 6.79615e-06 6.43618e-06 4.39726e-06 3.8778e-05 0.000177978 nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 2.84513e-06 5.17711e-06 6.79615e-06 0.000115156 0.000115156 0.00101552 0.000500534 0.00165732 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 1.12799e-06 2.84513e-06 5.0905e-05 9.26289e-05 0.0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 4.39726e-06 2.16734e-06 1.37886e-05 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan 6.43618e-06 4.39726e-06 7.86758e-05 3.8778e-05 0.000177978 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 2.84513e-06 5.17711e-06 6.79615e-06 0.000115156 0.00101552 0.000500534 0.00466092 nan nan nan nan nan nan nan 0.2 nan nan nan nan 1.12799e-06 2.84513e-06 9.26289e-0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 4.39726e-06 2.16734e-06 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 6.79615e-06 6.43618e-06 4.39726e-06 3.8778e-05 0.000500534 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 5.17711e-06 6.79615e-06 0.000121597 0.000115156 0.00101552 0.000500534 0.00165732 nan nan nan nan nan nan nan 0.2 nan nan nan nan 1.12799e-06 2.84513e-06 9.26289e-05 0.0001 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 4.39726e-06 2.16734e-06 1.37886e-05 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 6.43618e-06 6.43618e-06 7.86758e-05 3.8778e-05 0.000177978 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 5.17711e-06 6.79615e-06 0.000115156 0.000115156 0.00101552 0.00466092 0.00165732 nan nan nan nan nan nan nan 0.2 nan nan nan nan 2.84513e-06 5.17711e-06 9.26289e-05 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 4.39726e-06 2.16734e-06 1.37886e-05 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 6.43618e-06 4.39726e-06 7.86758e-05 0.000500534 0.000177978 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 6.79615e-06 6.79615e-06 0.000115156 0.00101552 0.00101552 0.00466092 0.0111335 nan nan nan nan nan nan nan 0.2 nan nan nan nan 2.84513e-06 5.17711e-06 0.000121597 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 2.16734e-06 2.16734e-06 nan nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 6.43618e-06 4.39726e-06 3.8778e-05 0.000500534 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 6.79615e-06 6.43618e-06 0.000115156 0.00101552 0.00466092 0.00466092 0.0111335 nan nan nan nan nan nan nan 0.2 nan nan nan nan 5.17711e-06 5.17711e-06 0.000121597 0.0014864 0.00148 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 2.16734e-06 2.16734e-06 1.37886e-05 nan nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 6.43618e-06 4.39726e-06 7.86758e-05 3.8778e-05 0.000177978 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 6.79615e-06 6.43618e-06 7.86758e-05 0.00101552 0.00466092 0.0313112 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan 5.17711e-06 6.79615e-06 0.000121597 0.001486 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 2.16734e-06 2.16734e-06 nan nan nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 4.39726e-06 4.39726e-06 3.8778e-05 0.000500534 0.000177978 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan 6.79615e-06 6.43618e-06 0.000115156 7.86758e-05 0.00101552 0.00466092 0.0111335 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan 5.17711e-06 6.79615e-06 0.000121597 0.001486 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan 4.39726e-06 4.39726e-06 3.8778e-05 0.000177978 nan nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 6.43618e-06 6.43618e-06 7.86758e-05 0.00101552 0.00466092 0.00466092 0.0111335 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 6.79615e-06 0.000121597 0.000115156 0.0014864 0.00945644 0.0635266 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan 4.39726e-06 3.8778e-05 3.8778e-05 0.000177978 nan nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 6.43618e-06 6.43618e-06 7.86758e-05 0.00101552 0.00466092 0.0313112 0.0539573 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 6.79615e-06 0.000115156 0.0014864 0.00101552 0.00945644 0.0313112 0.151 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan 4.39726e-06 2.16734e-06 3.8778e-05 0.000177978 0.00165732 nan nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 6.43618e-06 4.39726e-06 7.86758e-05 0.000500534 0.00466092 0.0111335 0.0539573 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan 6.79615e-06 6.79615e-06 0.000115156 0.0014864 0.00945644 0.0635266 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan 2.16734e-06 2.16734e-06 3.8778e-05 0.000177978 nan nan nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 4.39726e-06 7.86758e-05 0.00101552 0.000500534 0.00466092 0.0111335 nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan 6.79615e-06 6.43618e-06 0.000115156 0.00101552 0.00945644 0.0635266 0.151746 0.5 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan 2.16734e-06 3.8778e-05 1.37886e-05 0.000177978 nan nan nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan 4.39726e-06 4.39726e-06 7.86758e-05 0.000500534 0.00466092 0.0313112 0.0539573 nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan 6.43618e-06 6.43618e-06 0.000115156 0.00101552 0.00945644 0.0635266 0.151 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan 2.16734e-06 1.37886e-05 0.000177978 nan nan nan nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan 4.39726e-06 4.39726e-06 3.8778e-05 0.000500534 0.00466092 0.0111335 0.0539573 nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan 6.43618e-06 0.000115156 7.86758e-05 0.00101552 0.00945644 0.0313112 0.151746 0.53 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 4.39726e-06 2.16734e-06 3.8778e-05 0.000500534 0.00466092 0.0111335 0.0539573 nan nan nan nan nan nan nan 0.2 0.2 0.2 0.2 0.2 nan 6.43618e-06 7.86758e-05 0.00101552 0.00945644 0.0635266 0.151746 0.530546 1.3382 1.3382 0.865843 1.13662 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 2.16734e-06 3.8778e-05 0.000500534 0.00466092 0.0111335 0.0539573 0.18865 nan nan nan nan nan nan nan 0.2 0.2 0.2 0.2 0.2 4.39726e-06 4.39726e-06 7.86758e-05 0.00101552 0.00945644 0.0313112 0.151746 0.530546 1.3382 2.43504 1.13662 1.07 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.16734e-06 2.16734e-06 3.8778e-05 0.000500534 0.00165732 0.0111335 0.0539573 0.18865 nan nan nan nan nan nan nan 0.2 0.2 0.2 0.2 0.2 4.39726e-06 4.39726e-06 7.86758e-05 0.00101552 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.16734e-06 2.16734e-06 3.8778e-05 0.000177978 0.00165732 0.0111335 0.0539573 nan nan nan nan nan nan nan nan 0.2 0.2 0.2 0.2 0.2 4.39726e-06 4.39726e-06 7.86758e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 0.362475 0.2 0.2 0.2 0.2 0.2 0.2 0.2 7.86758e-0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 0.362475 0.2 0.2 0.2 0.2 0.2 0.2 0.2 7.86758e-0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 3.8778e-05 0.000500534 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 1.0194 nan 0.2 0.2 0.2 0.2 0.2 0.2 0.2 7.86758e-05 0.0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 0.865843 1.13662 1.07641 0.735417 1.0194 0.362475 nan nan 0.2 0.2 0.2 0.2 0.2 1.37886e-05 0.000177978 0.00466092 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 2.06824 2.06824 0.735417 nan nan 0.2 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 0.475831 0.865843 1.13662 1.07641 2.06824 1.0194 0.362475 nan nan 0.2 0.2 0.2 0.2 0.2 1.37886e-05 0.000177978 0.00165732 0.0313112 0.151746 0.530546 1.3382 2.43504 3.19654 3.02723 4.1962 2.06824 0.735417 nan nan 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 0.475831 0.865843 1.13662 3.02723 2.06824 1.0194 nan nan nan 0.2 0.2 0.2 0.2 0.2 nan nan 0.00165732 0.0111335 0.151746 0.530546 1.3382 2.43504 3.19654 6.14188 4.1962 2.06824 nan nan nan 0.2 0.2 0.2 0.2 0.2 3.8778e-0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan 0.865843 1.13662 3.02723 2.06824 1.0194 0.362475 nan nan nan 0.2 0.2 0.2 0.2 0.2 nan nan 0.0111335 0.0539573 0.530546 0.530546 1.3382 2.43504 6.4854 6.14188 4.1962 2.06824 nan nan nan 0.2 0.2 0.2 0.2 0.2 1.37886e-05 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan nan nan 0.735417 0.362475 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan nan nan 0.865843 1.13662 3.02723 2.06824 1.0194 0.735417 nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.0539573 0.18865 1.3382 2.43504 3.19654 6.14188 4.1962 2.06824 3.02723 nan nan nan nan 0.2 0.2 0.2 nan 0.000177 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan nan 0.735417 0.362475 1.0194 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan nan nan 0.865843 3.19654 3.02723 2.06824 2.06824 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.0539573 0.18865 1.3382 2.43504 6.4854 6.14188 4.1962 3.02723 1.07641 nan nan nan nan 0.2 0.2 0.2 nan nan 0.0016 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan nan 0.735417 1.0194 0.362475 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan nan nan 1.13662 3.02723 2.06824 4.1962 2.06824 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.18865 0.18865 1.3382 2.43504 6.4854 6.14188 4.1962 3.02723 1.07641 nan nan nan nan 0.2 0.2 0.2 nan nan 0.00165732 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 1.07641 0.735417 1.0194 nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan nan 0.865843 1.13662 3.02723 2.06824 2.06824 0.735417 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.18865 0.475831 2.43504 3.19654 6.4854 6.14188 6.14188 3.02723 1.13662 nan nan nan nan 0.2 0.2 0.2 nan nan 0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 0.735417 1.0194 1.0194 nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan nan 0.865843 3.19654 3.02723 4.1962 2.06824 1.07641 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan 0.475831 2.43504 3.19654 6.14188 4.1962 6.14188 3.02723 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 0.053957 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 0.735417 1.0194 0.735417 nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan nan 1.13662 3.02723 3.02723 4.1962 2.06824 1.07641 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan nan 1.3382 2.43504 6.4854 6.14188 6.14188 3.02723 3.19654 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 0.0539573 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan nan nan 0.362475 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan nan 0.735417 2.06824 1.0194 0.735417 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan 1.13662 3.02723 4.1962 2.06824 3.02723 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 0.475831 2.43504 3.19654 6.4854 6.14188 6.14188 3.19654 1.13662 nan nan nan nan nan nan 0.2 nan nan nan na [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan nan 0.362475 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan nan 0.735417 1.0194 2.06824 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan 3.19654 3.02723 4.1962 2.06824 1.07641 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 0.475831 2.43504 3.19654 6.14188 8.98974 6.14188 3.19654 1.13662 nan nan nan nan nan nan 0.2 nan nan nan nan 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan nan 0.362475 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan nan 2.06824 1.0194 0.735417 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 1.13662 3.02723 3.02723 4.1962 3.02723 1.07641 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 0.865843 2.43504 3.19654 6.14188 6.14188 6.14188 3.19654 0.865843 nan nan nan nan nan nan 0.2 nan nan nan n [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 0.362475 0.362475 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan 0.735417 2.06824 2.06824 0.735417 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 1.13662 3.02723 4.1962 4.1962 3.02723 1.13662 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 0.865843 3.19654 6.4854 6.14188 6.14188 6.4854 3.19654 0.865843 nan nan nan nan nan nan 0.2 nan n [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 0.362475 nan nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan 0.735417 1.0194 2.06824 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 1.07641 3.02723 4.1962 3.02723 3.02723 1.13662 nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 0.865843 3.19654 6.14188 6.14188 6.14188 3.19654 2.43504 0.865843 nan nan nan nan nan nan 0.2 nan nan nan n [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan nan 0.362475 nan nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan nan 2.06824 1.0194 0.735417 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 1.07641 2.06824 4.1962 3.02723 3.19654 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 1.13662 3.19654 6.14188 8.98974 6.14188 3.19654 2.43504 0.475831 nan nan nan nan nan nan 0.2 nan nan nan nan 0. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan nan nan 0.362475 nan nan nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 0.735417 1.0194 2.06824 0.735417 nan nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan nan 3.02723 2.06824 4.1962 3.02723 1.13662 nan nan nan nan nan nan nan nan 0.2 nan nan nan nan nan 1.13662 3.19654 6.14188 6.14188 6.4854 3.19654 2.43504 0.475831 nan nan nan nan nan nan 0.2 nan nan nan na [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan 0.735417 1.0194 0.735417 nan nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 1.07641 2.06824 4.1962 3.02723 3.02723 1.13662 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 3.19654 3.02723 6.14188 6.14188 6.4854 2.43504 1.3382 nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 0.865843 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan 1.0194 1.0194 0.735417 nan nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 1.07641 2.06824 4.1962 3.02723 3.19654 0.865843 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 3.02723 6.14188 4.1962 6.14188 3.19654 2.43504 0.475831 nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 0.865843 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan nan 1.0194 0.735417 1.07641 nan nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 0.735417 2.06824 2.06824 3.02723 1.13662 0.865843 nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 1.13662 3.02723 6.14188 6.14188 6.4854 3.19654 2.43504 0.475831 0.18865 nan nan nan nan nan 0.2 0.2 0.2 nan nan n [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan 0.362475 1.0194 0.735417 nan nan nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 2.06824 4.1962 2.06824 3.02723 1.13662 nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 1.07641 3.02723 4.1962 6.14188 6.4854 2.43504 1.3382 0.18865 0.18865 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 3.1965 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan 1.0194 0.362475 0.735417 nan nan nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan nan 2.06824 2.06824 3.02723 3.19654 0.865843 nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 1.07641 3.02723 4.1962 6.14188 6.4854 2.43504 1.3382 0.18865 0.0539573 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 3. [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan nan nan 0.362475 0.735417 nan nan nan nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 0.735417 1.0194 2.06824 3.02723 1.13662 0.865843 nan nan nan nan nan nan nan nan 0.2 0.2 0.2 nan nan nan 3.02723 2.06824 4.1962 6.14188 3.19654 2.43504 1.3382 0.18865 0.0539573 nan nan nan nan nan 0.2 0.2 0.2 nan nan nan [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 0.362475 1.0194 2.06824 3.02723 1.13662 0.865843 nan nan nan nan nan nan nan 0.2 0.2 0.2 0.2 0.2 nan nan 2.06824 4.1962 6.14188 6.4854 2.43504 1.3382 0.530546 0.530546 0.0539573 0.0111335 nan nan nan 0.2 0.2 0.2 0.2 0.2 nan 1.13662 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan nan 1.0194 2.06824 3.02723 1.13662 0.865843 0.475831 nan nan nan nan nan nan nan 0.2 0.2 0.2 0.2 0.2 nan nan 2.06824 4.1962 6.14188 3.19654 2.43504 1.3382 0.530546 0.151746 0.0111335 0.00165732 nan nan nan 0.2 0.2 0.2 0.2 0.2 nan 1.076 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.362475 1.0194 2.06824 1.07641 1.13662 0.865843 0.475831 nan nan nan nan nan nan nan 0.2 0.2 0.2 0.2 0.2 nan 0.735417 2.06824 4.1962 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00165732 0.000177978 1.37886e-05 nan 0.2 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 nan 0.362475 1.0194 0.735417 1.07641 1.13662 0.865843 nan nan nan nan nan nan nan nan 0.2 0.2 0.2 0.2 0.2 nan 0.735417 2.06824 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000177978 1.37886e-05 7.70655e-0 [...]
+ 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 1.0194 2.06824 3.02723 3.19654 2.43504 1.3382 0.530546 0.151746 0.0313112 0.00466092 0.000500534 3.8778e-05 2.16734e-06 0.2 0.2 0.2 0.2 0.2 0.2 0.2 2.06824 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_rtd.ref b/kmclipm/test/ref/kmclipm_test_rtd.ref
new file mode 100644
index 0000000..e056c97
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_rtd.ref
@@ -0,0 +1,17 @@
+1 - [ INFO ] cpl_init() set errno=25: Inappropriate ioctl for device
+1 - [ INFO ] Test data is being generated.
+1 -
+1 - [ INFO ] Saving raw object & sky files and calibration frames (badpix, xcal, ycal & lcal).
+1 -
+1 - [ INFO ] Saving ./data/output/ref_rtd_target.fits
+1 -
+1 - [ INFO ] Saving ./data/output/ref_rtd_sky.fits
+1 -
+1 - [ INFO ] Saving ./data/output/ref_rtd.fits
+1 -
+1 - [ INFO ] Test data generated successfully.
+1 -
+1 - [ INFO ] Finished initialisation.
+1 - [ INFO ] --------------------------------------------------------------
+1 - [ INFO ]
+1 - [ INFO ] All tests done.
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING+0.8.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING+0.8.ref
new file mode 100644
index 0000000..eed5660
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING+0.8.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+13 13
+ 0.00155307 0.00711388 0.0238712 0.0576921 0.100477 0.126179 0.114375 0.0748685 0.0353708 0.0120396 0.00294644 0.000515755 7.11557e-05 0.00711388 0.0325853 0.109343 0.26426 0.460236 0.577968 0.523895 0.342937 0.162017 0.0551476 0.0134963 0.00236243 0.000325931 0.0238712 0.109343 0.366907 0.886745 1.54436 1.93942 1.75797 1.15075 0.54366 0.185052 0.0452878 0.00792731 0.00109368 0.0576921 0.26426 0.886745 2.14309 3.73241 4.6872 4.24868 2.78115 1.31392 0.447236 0.109452 0.0191588 0.00264323 [...]
+12 12
+ 0.00335442 0.0136274 0.0430438 0.0972814 0.158551 0.186542 0.158549 0.0972863 0.043026 0.0136908 0.0031299 0.000520873 0.0136274 0.0553612 0.174866 0.395206 0.644112 0.757828 0.644107 0.395226 0.174793 0.055619 0.0127152 0.00211605 0.0430438 0.174866 0.552338 1.24831 2.03452 2.3937 2.0345 1.24838 0.552108 0.17568 0.0401628 0.00668383 0.0972814 0.395206 1.24831 2.82125 4.59811 5.4099 4.59808 2.82139 1.24779 0.397046 0.09077 0.0151058 0.158551 0.644112 2.03452 4.59811 7.49407 8.81713 7.49 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING+08.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING+08.ref
new file mode 100644
index 0000000..eed5660
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING+08.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+13 13
+ 0.00155307 0.00711388 0.0238712 0.0576921 0.100477 0.126179 0.114375 0.0748685 0.0353708 0.0120396 0.00294644 0.000515755 7.11557e-05 0.00711388 0.0325853 0.109343 0.26426 0.460236 0.577968 0.523895 0.342937 0.162017 0.0551476 0.0134963 0.00236243 0.000325931 0.0238712 0.109343 0.366907 0.886745 1.54436 1.93942 1.75797 1.15075 0.54366 0.185052 0.0452878 0.00792731 0.00109368 0.0576921 0.26426 0.886745 2.14309 3.73241 4.6872 4.24868 2.78115 1.31392 0.447236 0.109452 0.0191588 0.00264323 [...]
+12 12
+ 0.00335442 0.0136274 0.0430438 0.0972814 0.158551 0.186542 0.158549 0.0972863 0.043026 0.0136908 0.0031299 0.000520873 0.0136274 0.0553612 0.174866 0.395206 0.644112 0.757828 0.644107 0.395226 0.174793 0.055619 0.0127152 0.00211605 0.0430438 0.174866 0.552338 1.24831 2.03452 2.3937 2.0345 1.24838 0.552108 0.17568 0.0401628 0.00668383 0.0972814 0.395206 1.24831 2.82125 4.59811 5.4099 4.59808 2.82139 1.24779 0.397046 0.09077 0.0151058 0.158551 0.644112 2.03452 4.59811 7.49407 8.81713 7.49 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING+1.0.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING+1.0.ref
new file mode 100644
index 0000000..a1c5010
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING+1.0.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+13 13
+ 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.000802179 0.0913109 0.396889 1.24453 2.81535 4.5946 5.40945 4.5946 2.81535 1.24453 0.396889 0.0913109 0.0151553 0.00181467 0. [...]
+12 12
+ 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.0913109 0.396889 1.24453 2.81535 4.5946 5.40945 4.5946 2.81535 1.24453 0.396889 0.0913109 0.0151553 0.149018 0.647717 2.03106 4.5946 7.49831 8.82813 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING-0.8.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING-0.8.ref
new file mode 100644
index 0000000..75f6de9
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING-0.8.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+13 13
+ 0.000200344 0.00105421 0.00432527 0.0127036 0.0268901 0.0410792 0.0453192 0.0360876 0.0207211 0.00857314 0.00255702 0.000550475 8.69499e-05 0.00105421 0.00554724 0.0227595 0.0668463 0.141496 0.216158 0.238469 0.189892 0.109034 0.0451118 0.013455 0.0028966 0.00045753 0.00432527 0.0227595 0.093379 0.274261 0.580536 0.886866 0.978403 0.7791 0.447351 0.185087 0.0552039 0.0118843 0.00187718 0.0127036 0.0668463 0.274261 0.805523 1.70507 2.60479 2.87364 2.28827 1.3139 0.543614 0.162138 0.03490 [...]
+12 12
+ 0.00298285 0.0128988 0.0405769 0.0917387 0.149511 0.175907 0.14951 0.0917402 0.0405723 0.012913 0.0029415 0.000528371 0.0128988 0.0557783 0.175467 0.396707 0.64653 0.760679 0.646529 0.396713 0.175447 0.0558396 0.0127199 0.00228484 0.0405769 0.175467 0.551985 1.24796 2.03386 2.39294 2.03385 1.24798 0.551922 0.17566 0.0400144 0.00718765 0.0917387 0.396707 1.24796 2.82146 4.59826 5.41011 4.59825 2.82151 1.24782 0.397143 0.0904669 0.0162503 0.149511 0.64653 2.03386 4.59826 7.49398 8.81708 7 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING-08.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING-08.ref
new file mode 100644
index 0000000..75f6de9
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING-08.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+13 13
+ 0.000200344 0.00105421 0.00432527 0.0127036 0.0268901 0.0410792 0.0453192 0.0360876 0.0207211 0.00857314 0.00255702 0.000550475 8.69499e-05 0.00105421 0.00554724 0.0227595 0.0668463 0.141496 0.216158 0.238469 0.189892 0.109034 0.0451118 0.013455 0.0028966 0.00045753 0.00432527 0.0227595 0.093379 0.274261 0.580536 0.886866 0.978403 0.7791 0.447351 0.185087 0.0552039 0.0118843 0.00187718 0.0127036 0.0668463 0.274261 0.805523 1.70507 2.60479 2.87364 2.28827 1.3139 0.543614 0.162138 0.03490 [...]
+12 12
+ 0.00298285 0.0128988 0.0405769 0.0917387 0.149511 0.175907 0.14951 0.0917402 0.0405723 0.012913 0.0029415 0.000528371 0.0128988 0.0557783 0.175467 0.396707 0.64653 0.760679 0.646529 0.396713 0.175447 0.0558396 0.0127199 0.00228484 0.0405769 0.175467 0.551985 1.24796 2.03386 2.39294 2.03385 1.24798 0.551922 0.17566 0.0400144 0.00718765 0.0917387 0.396707 1.24796 2.82146 4.59826 5.41011 4.59825 2.82151 1.24782 0.397143 0.0904669 0.0162503 0.149511 0.64653 2.03386 4.59826 7.49398 8.81708 7 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING-1.0.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING-1.0.ref
new file mode 100644
index 0000000..f473d0e
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_CLIPPING-1.0.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+13 13
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.17544 [...]
+12 12
+ 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.0913109 0.396889 1.24453 2.81535 4.5946 5.40945 4.5946 2.81535 1.24453 0.396889 0.0913109 0.0151553 0.149018 0.647717 2.03106 4.5946 7.49831 8.82813 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_ESTIMATED+0.8.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_ESTIMATED+0.8.ref
new file mode 100644
index 0000000..85a67ef
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_ESTIMATED+0.8.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ 0.00131351 0.006573 0.0219448 0.0530585 0.0924023 0.116041 0.105184 0.0688526 0.0325282 0.0110735 0.00270464 0.000493155 -4.88517e-06 0.00103146 0.006573 0.0328924 0.109815 0.265513 0.462396 0.580686 0.526358 0.344549 0.162776 0.0554136 0.0135344 0.00246783 -2.44463e-05 0.00516158 0.0219448 0.109815 0.366632 0.886449 1.54377 1.93869 1.75731 1.15032 0.543449 0.185005 0.0451864 0.00823914 -8.1617e-05 0.0172326 0.0530585 0.265513 0.886449 2.14327 3.73255 4.6874 4.24886 2.78127 1.31396 0.44 [...]
+14 14
+ 0.0197927 0.00611854 0.0336948 0.104385 0.236355 0.385119 0.453132 0.38513 0.236316 0.104519 0.0332419 0.00764171 0.00117433 0.000280144 0.00611854 0.00189144 0.0104161 0.0322688 0.0730647 0.119053 0.140077 0.119056 0.0730528 0.0323101 0.0102761 0.00236229 0.000363024 8.66014e-05 0.0336948 0.0104161 0.0573616 0.177704 0.402367 0.655622 0.771405 0.65564 0.402301 0.177931 0.0565906 0.0130091 0.00199917 0.000476913 0.104385 0.0322688 0.177704 0.550523 1.24652 2.0311 2.38979 2.03115 1.24632 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_ESTIMATED+08.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_ESTIMATED+08.ref
new file mode 100644
index 0000000..85a67ef
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_ESTIMATED+08.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ 0.00131351 0.006573 0.0219448 0.0530585 0.0924023 0.116041 0.105184 0.0688526 0.0325282 0.0110735 0.00270464 0.000493155 -4.88517e-06 0.00103146 0.006573 0.0328924 0.109815 0.265513 0.462396 0.580686 0.526358 0.344549 0.162776 0.0554136 0.0135344 0.00246783 -2.44463e-05 0.00516158 0.0219448 0.109815 0.366632 0.886449 1.54377 1.93869 1.75731 1.15032 0.543449 0.185005 0.0451864 0.00823914 -8.1617e-05 0.0172326 0.0530585 0.265513 0.886449 2.14327 3.73255 4.6874 4.24886 2.78127 1.31396 0.44 [...]
+14 14
+ 0.0197927 0.00611854 0.0336948 0.104385 0.236355 0.385119 0.453132 0.38513 0.236316 0.104519 0.0332419 0.00764171 0.00117433 0.000280144 0.00611854 0.00189144 0.0104161 0.0322688 0.0730647 0.119053 0.140077 0.119056 0.0730528 0.0323101 0.0102761 0.00236229 0.000363024 8.66014e-05 0.0336948 0.0104161 0.0573616 0.177704 0.402367 0.655622 0.771405 0.65564 0.402301 0.177931 0.0565906 0.0130091 0.00199917 0.000476913 0.104385 0.0322688 0.177704 0.550523 1.24652 2.0311 2.38979 2.03115 1.24632 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_ESTIMATED-0.8.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_ESTIMATED-0.8.ref
new file mode 100644
index 0000000..fe0a08d
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_ESTIMATED-0.8.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ 0.00769437 0.000669363 0.00668651 0.0267636 0.0787383 0.166642 0.254578 0.280853 0.223643 0.128413 0.0531314 0.0158405 0.00343357 0.000456226 0.000669363 5.82305e-05 0.000581686 0.00232827 0.00684975 0.0144968 0.0221467 0.0244325 0.0194556 0.0111711 0.0046221 0.00137803 0.000298699 3.96889e-05 0.00668651 0.000581686 0.00581067 0.023258 0.0684247 0.144814 0.221232 0.244065 0.194349 0.111593 0.0461719 0.0137656 0.00298381 0.000396467 0.0267636 0.00232827 0.023258 0.093093 0.273879 0.57963 [...]
+14 14
+ 0.000128049 0.000593787 0.00268295 0.00840337 0.0190088 0.030977 0.0364467 0.0309774 0.0190074 0.00840779 0.00267006 0.000628431 4.30192e-05 0.000795295 0.000593787 0.00275349 0.0124413 0.0389679 0.0881473 0.143646 0.16901 0.143648 0.0881407 0.0389884 0.0123815 0.00291414 0.000199487 0.00368792 0.00268295 0.0124413 0.0562144 0.176071 0.398282 0.649044 0.763649 0.649053 0.398252 0.176164 0.0559444 0.0131672 0.000901358 0.0166634 0.00840337 0.0389679 0.176071 0.55148 1.24748 2.0329 2.3918 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_ESTIMATED-08.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_ESTIMATED-08.ref
new file mode 100644
index 0000000..fe0a08d
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_ESTIMATED-08.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ 0.00769437 0.000669363 0.00668651 0.0267636 0.0787383 0.166642 0.254578 0.280853 0.223643 0.128413 0.0531314 0.0158405 0.00343357 0.000456226 0.000669363 5.82305e-05 0.000581686 0.00232827 0.00684975 0.0144968 0.0221467 0.0244325 0.0194556 0.0111711 0.0046221 0.00137803 0.000298699 3.96889e-05 0.00668651 0.000581686 0.00581067 0.023258 0.0684247 0.144814 0.221232 0.244065 0.194349 0.111593 0.0461719 0.0137656 0.00298381 0.000396467 0.0267636 0.00232827 0.023258 0.093093 0.273879 0.57963 [...]
+14 14
+ 0.000128049 0.000593787 0.00268295 0.00840337 0.0190088 0.030977 0.0364467 0.0309774 0.0190074 0.00840779 0.00267006 0.000628431 4.30192e-05 0.000795295 0.000593787 0.00275349 0.0124413 0.0389679 0.0881473 0.143646 0.16901 0.143648 0.0881407 0.0389884 0.0123815 0.00291414 0.000199487 0.00368792 0.00268295 0.0124413 0.0562144 0.176071 0.398282 0.649044 0.763649 0.649053 0.398252 0.176164 0.0559444 0.0131672 0.000901358 0.0166634 0.00840337 0.0389679 0.176071 0.55148 1.24748 2.0329 2.3918 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS+0.8.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS+0.8.ref
new file mode 100644
index 0000000..a78289c
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS+0.8.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ 0.00155307 0.00711388 0.0238712 0.0576921 0.100477 0.126179 0.114375 0.0748685 0.0353708 0.0120396 0.00294644 0.000515755 7.11557e-05 nan 0.00711388 0.0325853 0.109343 0.26426 0.460236 0.577968 0.523895 0.342937 0.162017 0.0551476 0.0134963 0.00236243 0.000325931 nan 0.0238712 0.109343 0.366907 0.886745 1.54436 1.93942 1.75797 1.15075 0.54366 0.185052 0.0452878 0.00792731 0.00109368 nan 0.0576921 0.26426 0.886745 2.14309 3.73241 4.6872 4.24868 2.78115 1.31392 0.447236 0.109452 0.0191588 [...]
+14 14
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.00335442 0.0136274 0.0430438 0.0972814 0.158551 0.186542 0.158549 0.0972863 0.0430261 0.0136904 0.00313138 0.000515356 6.98224e-05 nan 0.0136274 0.0553612 0.174866 0.395206 0.644112 0.757828 0.644107 0.395226 0.174794 0.0556173 0.0127212 0.00209364 0.000283653 nan 0.0430438 0.174866 0.552338 1.24831 2.03452 2.3937 2.0345 1.24838 0.55211 0.175675 0.0401818 0.00661304 0.000895958 nan 0.0972814 0.395206 1.24831 2.82125 4.59811 5 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS+08.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS+08.ref
new file mode 100644
index 0000000..f8f272b
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS+08.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ 0.00155307 0.00711388 0.0238712 0.0576921 0.100477 0.126179 0.114375 0.0748685 0.0353708 0.0120396 0.00294644 0.000515755 7.11557e-05 nan 0.00711388 0.0325853 0.109343 0.26426 0.460236 0.577968 0.523895 0.342937 0.162017 0.0551476 0.0134963 0.00236243 0.000325931 nan 0.0238712 0.109343 0.366907 0.886745 1.54436 1.93942 1.75797 1.15075 0.54366 0.185052 0.0452878 0.00792731 0.00109368 nan 0.0576921 0.26426 0.886745 2.14309 3.73241 4.6872 4.24868 2.78115 1.31392 0.447236 0.109452 0.0191588 [...]
+14 14
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS+1.0.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS+1.0.ref
new file mode 100644
index 0000000..3bd48d4
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS+1.0.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 nan 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 nan 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.000802179 nan 0.0913109 0.396889 1.24453 2.81535 4.5946 5.40945 4.5946 2.81535 1.24453 0.396889 0.0913109 0.0151553 0 [...]
+14 14
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 nan 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 nan 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.000802179 nan 0.0913109 0.396889 1.24453 2.81535 4.5946 5 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS-0.8.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS-0.8.ref
new file mode 100644
index 0000000..de6d76d
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS-0.8.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.000200344 0.00105421 0.00432527 0.0127036 0.0268901 0.0410792 0.0453192 0.0360876 0.0207211 0.00857314 0.00255702 0.000550475 8.69499e-05 nan 0.00105421 0.00554724 0.0227595 0.0668463 0.141496 0.216158 0.238469 0.189892 0.109034 0.0451118 0.013455 0.0028966 0.00045753 nan 0.00432527 0.0227595 0.093379 0.274261 0.580536 0.886866 0.978403 0.7791 0.447351 0.185087 0.0552039 0.0118843 0.00187718 nan 0.0127036 0.0668463 0.274261 0 [...]
+14 14
+ 9.70274e-05 0.00053219 0.00232793 0.0073179 0.0165458 0.0269652 0.0317261 0.0269651 0.0165459 0.00731748 0.00232893 0.000530517 9.52951e-05 nan 0.00053219 0.00291903 0.0127685 0.0401383 0.0907527 0.147902 0.174016 0.147902 0.0907535 0.040136 0.0127741 0.00290986 0.000522688 nan 0.00232793 0.0127685 0.0558527 0.175574 0.396974 0.64696 0.761186 0.646959 0.396978 0.175564 0.0558769 0.0127284 0.00228636 nan 0.0073179 0.0401383 0.175574 0.551923 1.2479 2.03374 2.39281 2.03373 1.24791 0.55189 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS-08.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS-08.ref
new file mode 100644
index 0000000..26e961c
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS-08.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.000200344 0.00105421 0.00432527 0.0127036 0.0268901 0.0410792 0.0453192 0.0360876 0.0207211 0.00857314 0.00255702 0.000550475 8.69499e-05 nan 0.00105421 0.00554724 0.0227595 0.0668463 0.141496 0.216158 0.238469 0.189892 0.109034 0.0451118 0.013455 0.0028966 0.00045753 nan 0.00432527 0.0227595 0.093379 0.274261 0.580536 0.886866 0.978403 0.7791 0.447351 0.185087 0.0552039 0.0118843 0.00187718 nan 0.0127036 0.0668463 0.274261 0 [...]
+14 14
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS-1.0.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS-1.0.ref
new file mode 100644
index 0000000..f2743dc
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_NANS-1.0.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 nan 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 nan 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 nan 0.00669945 0.0403642 0. [...]
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 nan 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 nan 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 nan 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.55 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_NATURAL+0.8.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_NATURAL+0.8.ref
new file mode 100644
index 0000000..0e2409d
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_NATURAL+0.8.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ 0.00155307 0.00711388 0.0238712 0.0576921 0.100477 0.126179 0.114375 0.0748685 0.0353708 0.0120396 0.00294644 0.000515755 7.11557e-05 -0.000156847 0.00711388 0.0325853 0.109343 0.26426 0.460236 0.577968 0.523895 0.342937 0.162017 0.0551476 0.0134963 0.00236243 0.000325931 -0.000718442 0.0238712 0.109343 0.366907 0.886745 1.54436 1.93942 1.75797 1.15075 0.54366 0.185052 0.0452878 0.00792731 0.00109368 -0.00241079 0.0576921 0.26426 0.886745 2.14309 3.73241 4.6872 4.24868 2.78115 1.31392 0 [...]
+14 14
+ 0.00346993 -0.00341168 -0.01386 -0.0437786 -0.0989419 -0.161257 -0.189726 -0.161256 -0.098947 -0.0437604 -0.0139246 -0.0031829 -0.000531367 -4.22173e-05 -0.00341168 0.00335442 0.0136274 0.0430438 0.0972814 0.158551 0.186542 0.158549 0.0972864 0.0430259 0.0136909 0.00312948 0.000522449 4.15087e-05 -0.01386 0.0136274 0.0553612 0.174866 0.395206 0.644112 0.757828 0.644107 0.395226 0.174793 0.0556194 0.0127135 0.00212245 0.000168629 -0.0437786 0.0430438 0.174866 0.552338 1.24831 2.03452 2.3 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_NATURAL+08.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_NATURAL+08.ref
new file mode 100644
index 0000000..0e2409d
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_NATURAL+08.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ 0.00155307 0.00711388 0.0238712 0.0576921 0.100477 0.126179 0.114375 0.0748685 0.0353708 0.0120396 0.00294644 0.000515755 7.11557e-05 -0.000156847 0.00711388 0.0325853 0.109343 0.26426 0.460236 0.577968 0.523895 0.342937 0.162017 0.0551476 0.0134963 0.00236243 0.000325931 -0.000718442 0.0238712 0.109343 0.366907 0.886745 1.54436 1.93942 1.75797 1.15075 0.54366 0.185052 0.0452878 0.00792731 0.00109368 -0.00241079 0.0576921 0.26426 0.886745 2.14309 3.73241 4.6872 4.24868 2.78115 1.31392 0 [...]
+14 14
+ 0.00346993 -0.00341168 -0.01386 -0.0437786 -0.0989419 -0.161257 -0.189726 -0.161256 -0.098947 -0.0437604 -0.0139246 -0.0031829 -0.000531367 -4.22173e-05 -0.00341168 0.00335442 0.0136274 0.0430438 0.0972814 0.158551 0.186542 0.158549 0.0972864 0.0430259 0.0136909 0.00312948 0.000522449 4.15087e-05 -0.01386 0.0136274 0.0553612 0.174866 0.395206 0.644112 0.757828 0.644107 0.395226 0.174793 0.0556194 0.0127135 0.00212245 0.000168629 -0.0437786 0.0430438 0.174866 0.552338 1.24831 2.03452 2.3 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_NATURAL-0.8.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_NATURAL-0.8.ref
new file mode 100644
index 0000000..4a8d823
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_NATURAL-0.8.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ 0.000455583 -0.000302115 -0.00158973 -0.00652242 -0.0191568 -0.0405498 -0.0619466 -0.0683403 -0.0544192 -0.0312469 -0.0129281 -0.00385592 -0.000830105 -0.000131119 -0.000302115 0.000200344 0.00105421 0.00432527 0.0127036 0.0268901 0.0410792 0.0453192 0.0360876 0.0207211 0.00857314 0.00255702 0.000550475 8.69499e-05 -0.00158973 0.00105421 0.00554724 0.0227595 0.0668463 0.141496 0.216158 0.238469 0.189892 0.109034 0.0451118 0.013455 0.0028966 0.00045753 -0.00652242 0.00432527 0.0227595 0. [...]
+14 14
+ 5.22513e-05 0.000395289 0.00170705 0.0053705 0.0121419 0.0197881 0.0232818 0.0197881 0.0121421 0.00536986 0.00170906 0.000389315 6.99314e-05 -0.000112245 0.000395289 0.00299043 0.0129141 0.0406287 0.0918552 0.1497 0.176131 0.1497 0.0918567 0.0406238 0.0129293 0.00294523 0.000529042 -0.00084915 0.00170705 0.0129141 0.0557695 0.175455 0.396675 0.64648 0.760619 0.646478 0.396682 0.175434 0.0558353 0.0127189 0.00228466 -0.00366705 0.0053705 0.0406287 0.175455 0.551993 1.24797 2.03387 2.3929 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_BCS_NATURAL-08.ref b/kmclipm/test/ref/kmclipm_test_shift_BCS_NATURAL-08.ref
new file mode 100644
index 0000000..4a8d823
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_BCS_NATURAL-08.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ 0.000455583 -0.000302115 -0.00158973 -0.00652242 -0.0191568 -0.0405498 -0.0619466 -0.0683403 -0.0544192 -0.0312469 -0.0129281 -0.00385592 -0.000830105 -0.000131119 -0.000302115 0.000200344 0.00105421 0.00432527 0.0127036 0.0268901 0.0410792 0.0453192 0.0360876 0.0207211 0.00857314 0.00255702 0.000550475 8.69499e-05 -0.00158973 0.00105421 0.00554724 0.0227595 0.0668463 0.141496 0.216158 0.238469 0.189892 0.109034 0.0451118 0.013455 0.0028966 0.00045753 -0.00652242 0.00432527 0.0227595 0. [...]
+14 14
+ 5.22513e-05 0.000395289 0.00170705 0.0053705 0.0121419 0.0197881 0.0232818 0.0197881 0.0121421 0.00536986 0.00170906 0.000389315 6.99314e-05 -0.000112245 0.000395289 0.00299043 0.0129141 0.0406287 0.0918552 0.1497 0.176131 0.1497 0.0918567 0.0406238 0.0129293 0.00294523 0.000529042 -0.00084915 0.00170705 0.0129141 0.0557695 0.175455 0.396675 0.64648 0.760619 0.646478 0.396682 0.175434 0.0558353 0.0127189 0.00228466 -0.00366705 0.0053705 0.0406287 0.175455 0.551993 1.24797 2.03387 2.3929 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_NN_CLIPPING+0.8.ref b/kmclipm/test/ref/kmclipm_test_shift_NN_CLIPPING+0.8.ref
new file mode 100644
index 0000000..a1c5010
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_NN_CLIPPING+0.8.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+13 13
+ 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.000802179 0.0913109 0.396889 1.24453 2.81535 4.5946 5.40945 4.5946 2.81535 1.24453 0.396889 0.0913109 0.0151553 0.00181467 0. [...]
+12 12
+ 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.0913109 0.396889 1.24453 2.81535 4.5946 5.40945 4.5946 2.81535 1.24453 0.396889 0.0913109 0.0151553 0.149018 0.647717 2.03106 4.5946 7.49831 8.82813 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_NN_CLIPPING+08.ref b/kmclipm/test/ref/kmclipm_test_shift_NN_CLIPPING+08.ref
new file mode 100644
index 0000000..a1c5010
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_NN_CLIPPING+08.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+13 13
+ 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.000802179 0.0913109 0.396889 1.24453 2.81535 4.5946 5.40945 4.5946 2.81535 1.24453 0.396889 0.0913109 0.0151553 0.00181467 0. [...]
+12 12
+ 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.0913109 0.396889 1.24453 2.81535 4.5946 5.40945 4.5946 2.81535 1.24453 0.396889 0.0913109 0.0151553 0.149018 0.647717 2.03106 4.5946 7.49831 8.82813 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_NN_CLIPPING-0.8.ref b/kmclipm/test/ref/kmclipm_test_shift_NN_CLIPPING-0.8.ref
new file mode 100644
index 0000000..f473d0e
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_NN_CLIPPING-0.8.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+13 13
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.17544 [...]
+12 12
+ 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.0913109 0.396889 1.24453 2.81535 4.5946 5.40945 4.5946 2.81535 1.24453 0.396889 0.0913109 0.0151553 0.149018 0.647717 2.03106 4.5946 7.49831 8.82813 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_NN_CLIPPING-08.ref b/kmclipm/test/ref/kmclipm_test_shift_NN_CLIPPING-08.ref
new file mode 100644
index 0000000..f473d0e
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_NN_CLIPPING-08.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+13 13
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.17544 [...]
+12 12
+ 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.0913109 0.396889 1.24453 2.81535 4.5946 5.40945 4.5946 2.81535 1.24453 0.396889 0.0913109 0.0151553 0.149018 0.647717 2.03106 4.5946 7.49831 8.82813 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_NN_NANS+0.8.ref b/kmclipm/test/ref/kmclipm_test_shift_NN_NANS+0.8.ref
new file mode 100644
index 0000000..3bd48d4
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_NN_NANS+0.8.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 nan 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 nan 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.000802179 nan 0.0913109 0.396889 1.24453 2.81535 4.5946 5.40945 4.5946 2.81535 1.24453 0.396889 0.0913109 0.0151553 0 [...]
+14 14
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 nan 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 nan 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.000802179 nan 0.0913109 0.396889 1.24453 2.81535 4.5946 5 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_NN_NANS+08.ref b/kmclipm/test/ref/kmclipm_test_shift_NN_NANS+08.ref
new file mode 100644
index 0000000..3bd48d4
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_NN_NANS+08.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 nan 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 nan 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.000802179 nan 0.0913109 0.396889 1.24453 2.81535 4.5946 5.40945 4.5946 2.81535 1.24453 0.396889 0.0913109 0.0151553 0 [...]
+14 14
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 nan 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 nan 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.550149 0.175446 0.0403642 0.00669945 0.000802179 nan 0.0913109 0.396889 1.24453 2.81535 4.5946 5 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_NN_NANS-0.8.ref b/kmclipm/test/ref/kmclipm_test_shift_NN_NANS-0.8.ref
new file mode 100644
index 0000000..f2743dc
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_NN_NANS-0.8.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 nan 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 nan 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 nan 0.00669945 0.0403642 0. [...]
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 nan 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 nan 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 nan 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.55 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_shift_NN_NANS-08.ref b/kmclipm/test/ref/kmclipm_test_shift_NN_NANS-08.ref
new file mode 100644
index 0000000..f2743dc
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_shift_NN_NANS-08.ref
@@ -0,0 +1,6 @@
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 9.76855e-06 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 5.88556e-05 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 0.00025582 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.391 [...]
+14 14
+ nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 nan 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 nan 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 nan 0.00669945 0.0403642 0. [...]
+14 14
+ 8.15827e-05 0.000491536 0.0021365 0.00669945 0.0151553 0.0247332 0.0291196 0.0247332 0.0151553 0.00669945 0.0021365 0.000491536 8.15827e-05 nan 0.000491536 0.00296151 0.0128724 0.0403642 0.0913109 0.149018 0.175446 0.149018 0.0913109 0.0403642 0.0128724 0.00296151 0.000491536 nan 0.0021365 0.0128724 0.0559509 0.175446 0.396889 0.647717 0.762589 0.647717 0.396889 0.175446 0.0559509 0.0128724 0.0021365 nan 0.00669945 0.0403642 0.175446 0.550149 1.24453 2.03106 2.39126 2.03106 1.24453 0.55 [...]
diff --git a/kmclipm/test/ref/kmclipm_test_vector.ref b/kmclipm/test/ref/kmclipm_test_vector.ref
new file mode 100644
index 0000000..babfbff
--- /dev/null
+++ b/kmclipm/test/ref/kmclipm_test_vector.ref
@@ -0,0 +1,2 @@
+1 - [ INFO ] cpl_init() set errno=25: Inappropriate ioctl for device
+1 - [ INFO ] All tests done.
diff --git a/kmclipm/test/ref/parameter_config.txt b/kmclipm/test/ref/parameter_config.txt
new file mode 100644
index 0000000..cd547bf
--- /dev/null
+++ b/kmclipm/test/ref/parameter_config.txt
@@ -0,0 +1,5 @@
+rtd = TRUE
+patrol = TRUE
+cubes-out = FALSE
+images-out = FALSE
+extracted-images-out = FALSE
diff --git a/kmos/Makefile.am b/kmos/Makefile.am
index 81c9c87..30c9e8d 100644
--- a/kmos/Makefile.am
+++ b/kmos/Makefile.am
@@ -23,98 +23,93 @@ DISTCLEANFILES = *~
SUBDIRS = tests
-
if MAINTAINER_MODE
MAINTAINERCLEANFILES = Makefile.in
endif
-
INCLUDES = $(all_includes) -I../kmclipm/include/
-noinst_HEADERS = kmo_constants.h \
- kmo_cpl_extensions.h \
- kmo_debug.h \
- kmo_dfs.h \
- kmo_error.h \
- kmo_functions.h \
- kmo_utils.h \
- kmo_priv_arithmetic.h \
- kmo_priv_combine.h \
- kmo_priv_multi_reconstruct.h \
- kmo_priv_copy.h \
- kmo_priv_dark.h \
- kmo_priv_extract_spec.h \
- kmo_priv_fit_profile.h \
- kmo_priv_fits_check.h \
- kmo_priv_fits_stack.h \
- kmo_priv_flat.h \
- kmo_priv_functions.h \
- kmo_priv_make_image.h \
- kmo_priv_noise_map.h \
- kmo_priv_reconstruct.h \
- kmo_priv_rotate.h \
- kmo_priv_shift.h \
- kmo_priv_sky_mask.h \
- kmo_priv_stats.h \
- kmo_priv_wave_cal.h \
- kmo_priv_std_star.h \
- kmo_priv_lcorr.h \
- kmo_priv_sky_tweak.h \
- kmo_test_create_data.h \
- ../kmclipm/include/kmclipm_compatibility_cpl.h \
- ../kmclipm/include/kmclipm_constants.h \
- ../kmclipm/include/kmclipm_functions.h \
- ../kmclipm/include/kmclipm_math.h \
- ../kmclipm/include/kmclipm_priv_constants.h \
- ../kmclipm/include/kmclipm_priv_error.h \
- ../kmclipm/include/kmclipm_priv_functions.h \
- ../kmclipm/include/kmclipm_priv_reconstruct.h \
- ../kmclipm/include/kmclipm_priv_splines.h \
- ../kmclipm/include/kmclipm_vector.h
+noinst_HEADERS = kmo_constants.h \
+ kmo_cpl_extensions.h \
+ kmo_debug.h \
+ kmo_dfs.h \
+ kmo_error.h \
+ kmo_functions.h \
+ kmo_utils.h \
+ kmo_priv_arithmetic.h \
+ kmo_priv_combine.h \
+ kmo_priv_multi_reconstruct.h \
+ kmo_priv_copy.h \
+ kmo_priv_dark.h \
+ kmo_priv_extract_spec.h \
+ kmo_priv_fit_profile.h \
+ kmo_priv_fits_check.h \
+ kmo_priv_fits_stack.h \
+ kmo_priv_flat.h \
+ kmo_priv_functions.h \
+ kmo_priv_make_image.h \
+ kmo_priv_noise_map.h \
+ kmo_priv_reconstruct.h \
+ kmo_priv_rotate.h \
+ kmo_priv_shift.h \
+ kmo_priv_sky_mask.h \
+ kmo_priv_stats.h \
+ kmo_priv_wave_cal.h \
+ kmo_priv_std_star.h \
+ kmo_priv_lcorr.h \
+ kmo_priv_sky_tweak.h \
+ ../kmclipm/include/kmclipm_compatibility_cpl.h \
+ ../kmclipm/include/kmclipm_constants.h \
+ ../kmclipm/include/kmclipm_functions.h \
+ ../kmclipm/include/kmclipm_math.h \
+ ../kmclipm/include/kmclipm_priv_constants.h \
+ ../kmclipm/include/kmclipm_priv_error.h \
+ ../kmclipm/include/kmclipm_priv_functions.h \
+ ../kmclipm/include/kmclipm_priv_reconstruct.h \
+ ../kmclipm/include/kmclipm_priv_splines.h \
+ ../kmclipm/include/kmclipm_vector.h
-
pkginclude_HEADERS =
-privatelib_LTLIBRARIES = libkmos.la
-
-libkmos_la_SOURCES = kmo_cpl_extensions.c \
- kmo_debug.c \
- kmo_dfs.c \
- kmo_functions.c \
- kmo_utils.c \
- kmo_priv_arithmetic.c \
- kmo_priv_copy.c \
- kmo_priv_combine.c \
- kmo_priv_multi_reconstruct.c \
- kmo_priv_dark.c \
- kmo_priv_extract_spec.c \
- kmo_priv_fit_profile.c \
- kmo_priv_fits_check.c \
- kmo_priv_fits_stack.c \
- kmo_priv_flat.c \
- kmo_priv_functions.c \
- kmo_priv_make_image.c \
- kmo_priv_noise_map.c \
- kmo_priv_reconstruct.c \
- kmo_priv_rotate.c \
- kmo_priv_shift.c \
- kmo_priv_sky_mask.c \
- kmo_priv_stats.c \
- kmo_priv_wave_cal.c \
- kmo_priv_std_star.c \
- kmo_priv_lcorr.c \
- kmo_priv_sky_tweak.c \
- kmo_test_create_data.c \
- ../kmclipm/src/kmclipm_functions.c \
- ../kmclipm/src/kmclipm_math.c \
- ../kmclipm/src/kmclipm_priv_constants.c \
- ../kmclipm/src/kmclipm_priv_error.c \
- ../kmclipm/src/kmclipm_priv_functions.c \
- ../kmclipm/src/kmclipm_priv_reconstruct.c \
- ../kmclipm/src/kmclipm_priv_splines.c \
- ../kmclipm/src/kmclipm_vector.c
+privatelib_LTLIBRARIES = libkmos.la
+
+libkmos_la_SOURCES = kmo_cpl_extensions.c \
+ kmo_debug.c \
+ kmo_dfs.c \
+ kmo_functions.c \
+ kmo_utils.c \
+ kmo_priv_arithmetic.c \
+ kmo_priv_copy.c \
+ kmo_priv_combine.c \
+ kmo_priv_multi_reconstruct.c \
+ kmo_priv_dark.c \
+ kmo_priv_extract_spec.c \
+ kmo_priv_fit_profile.c \
+ kmo_priv_fits_check.c \
+ kmo_priv_fits_stack.c \
+ kmo_priv_flat.c \
+ kmo_priv_functions.c \
+ kmo_priv_make_image.c \
+ kmo_priv_noise_map.c \
+ kmo_priv_reconstruct.c \
+ kmo_priv_rotate.c \
+ kmo_priv_shift.c \
+ kmo_priv_sky_mask.c \
+ kmo_priv_stats.c \
+ kmo_priv_wave_cal.c \
+ kmo_priv_std_star.c \
+ kmo_priv_lcorr.c \
+ kmo_priv_sky_tweak.c \
+ ../kmclipm/src/kmclipm_functions.c \
+ ../kmclipm/src/kmclipm_math.c \
+ ../kmclipm/src/kmclipm_priv_constants.c \
+ ../kmclipm/src/kmclipm_priv_error.c \
+ ../kmclipm/src/kmclipm_priv_functions.c \
+ ../kmclipm/src/kmclipm_priv_reconstruct.c \
+ ../kmclipm/src/kmclipm_priv_splines.c \
+ ../kmclipm/src/kmclipm_vector.c
libkmos_la_LDFLAGS = $(EXTRA_LDFLAGS) $(CPL_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
diff --git a/kmos/Makefile.in b/kmos/Makefile.in
index b72ff37..bc713cd 100644
--- a/kmos/Makefile.in
+++ b/kmos/Makefile.in
@@ -96,11 +96,11 @@ am_libkmos_la_OBJECTS = kmo_cpl_extensions.lo kmo_debug.lo kmo_dfs.lo \
kmo_priv_noise_map.lo kmo_priv_reconstruct.lo \
kmo_priv_rotate.lo kmo_priv_shift.lo kmo_priv_sky_mask.lo \
kmo_priv_stats.lo kmo_priv_wave_cal.lo kmo_priv_std_star.lo \
- kmo_priv_lcorr.lo kmo_priv_sky_tweak.lo \
- kmo_test_create_data.lo 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
+ kmo_priv_lcorr.lo kmo_priv_sky_tweak.lo 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
libkmos_la_OBJECTS = $(am_libkmos_la_OBJECTS)
libkmos_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -216,6 +216,7 @@ LIBCPLDFS = @LIBCPLDFS@
LIBCPLDRS = @LIBCPLDRS@
LIBCPLUI = @LIBCPLUI@
LIBIRPLIB = @LIBIRPLIB@
+LIBKMCLIPMLIB = @LIBKMCLIPMLIB@
LIBKMOS = @LIBKMOS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@@ -323,84 +324,82 @@ SUBDIRS = tests
@MAINTAINER_MODE_TRUE at MAINTAINERCLEANFILES = Makefile.in
INCLUDES = $(all_includes) -I../kmclipm/include/
noinst_HEADERS = kmo_constants.h \
- kmo_cpl_extensions.h \
- kmo_debug.h \
- kmo_dfs.h \
- kmo_error.h \
- kmo_functions.h \
- kmo_utils.h \
- kmo_priv_arithmetic.h \
- kmo_priv_combine.h \
- kmo_priv_multi_reconstruct.h \
- kmo_priv_copy.h \
- kmo_priv_dark.h \
- kmo_priv_extract_spec.h \
- kmo_priv_fit_profile.h \
- kmo_priv_fits_check.h \
- kmo_priv_fits_stack.h \
- kmo_priv_flat.h \
- kmo_priv_functions.h \
- kmo_priv_make_image.h \
- kmo_priv_noise_map.h \
- kmo_priv_reconstruct.h \
- kmo_priv_rotate.h \
- kmo_priv_shift.h \
- kmo_priv_sky_mask.h \
- kmo_priv_stats.h \
- kmo_priv_wave_cal.h \
- kmo_priv_std_star.h \
- kmo_priv_lcorr.h \
- kmo_priv_sky_tweak.h \
- kmo_test_create_data.h \
- ../kmclipm/include/kmclipm_compatibility_cpl.h \
- ../kmclipm/include/kmclipm_constants.h \
- ../kmclipm/include/kmclipm_functions.h \
- ../kmclipm/include/kmclipm_math.h \
- ../kmclipm/include/kmclipm_priv_constants.h \
- ../kmclipm/include/kmclipm_priv_error.h \
- ../kmclipm/include/kmclipm_priv_functions.h \
- ../kmclipm/include/kmclipm_priv_reconstruct.h \
- ../kmclipm/include/kmclipm_priv_splines.h \
- ../kmclipm/include/kmclipm_vector.h
+ kmo_cpl_extensions.h \
+ kmo_debug.h \
+ kmo_dfs.h \
+ kmo_error.h \
+ kmo_functions.h \
+ kmo_utils.h \
+ kmo_priv_arithmetic.h \
+ kmo_priv_combine.h \
+ kmo_priv_multi_reconstruct.h \
+ kmo_priv_copy.h \
+ kmo_priv_dark.h \
+ kmo_priv_extract_spec.h \
+ kmo_priv_fit_profile.h \
+ kmo_priv_fits_check.h \
+ kmo_priv_fits_stack.h \
+ kmo_priv_flat.h \
+ kmo_priv_functions.h \
+ kmo_priv_make_image.h \
+ kmo_priv_noise_map.h \
+ kmo_priv_reconstruct.h \
+ kmo_priv_rotate.h \
+ kmo_priv_shift.h \
+ kmo_priv_sky_mask.h \
+ kmo_priv_stats.h \
+ kmo_priv_wave_cal.h \
+ kmo_priv_std_star.h \
+ kmo_priv_lcorr.h \
+ kmo_priv_sky_tweak.h \
+ ../kmclipm/include/kmclipm_compatibility_cpl.h \
+ ../kmclipm/include/kmclipm_constants.h \
+ ../kmclipm/include/kmclipm_functions.h \
+ ../kmclipm/include/kmclipm_math.h \
+ ../kmclipm/include/kmclipm_priv_constants.h \
+ ../kmclipm/include/kmclipm_priv_error.h \
+ ../kmclipm/include/kmclipm_priv_functions.h \
+ ../kmclipm/include/kmclipm_priv_reconstruct.h \
+ ../kmclipm/include/kmclipm_priv_splines.h \
+ ../kmclipm/include/kmclipm_vector.h
pkginclude_HEADERS =
privatelib_LTLIBRARIES = libkmos.la
libkmos_la_SOURCES = kmo_cpl_extensions.c \
- kmo_debug.c \
- kmo_dfs.c \
- kmo_functions.c \
- kmo_utils.c \
- kmo_priv_arithmetic.c \
- kmo_priv_copy.c \
- kmo_priv_combine.c \
- kmo_priv_multi_reconstruct.c \
- kmo_priv_dark.c \
- kmo_priv_extract_spec.c \
- kmo_priv_fit_profile.c \
- kmo_priv_fits_check.c \
- kmo_priv_fits_stack.c \
- kmo_priv_flat.c \
- kmo_priv_functions.c \
- kmo_priv_make_image.c \
- kmo_priv_noise_map.c \
- kmo_priv_reconstruct.c \
- kmo_priv_rotate.c \
- kmo_priv_shift.c \
- kmo_priv_sky_mask.c \
- kmo_priv_stats.c \
- kmo_priv_wave_cal.c \
- kmo_priv_std_star.c \
- kmo_priv_lcorr.c \
- kmo_priv_sky_tweak.c \
- kmo_test_create_data.c \
- ../kmclipm/src/kmclipm_functions.c \
- ../kmclipm/src/kmclipm_math.c \
- ../kmclipm/src/kmclipm_priv_constants.c \
- ../kmclipm/src/kmclipm_priv_error.c \
- ../kmclipm/src/kmclipm_priv_functions.c \
- ../kmclipm/src/kmclipm_priv_reconstruct.c \
- ../kmclipm/src/kmclipm_priv_splines.c \
- ../kmclipm/src/kmclipm_vector.c
+ kmo_debug.c \
+ kmo_dfs.c \
+ kmo_functions.c \
+ kmo_utils.c \
+ kmo_priv_arithmetic.c \
+ kmo_priv_copy.c \
+ kmo_priv_combine.c \
+ kmo_priv_multi_reconstruct.c \
+ kmo_priv_dark.c \
+ kmo_priv_extract_spec.c \
+ kmo_priv_fit_profile.c \
+ kmo_priv_fits_check.c \
+ kmo_priv_fits_stack.c \
+ kmo_priv_flat.c \
+ kmo_priv_functions.c \
+ kmo_priv_make_image.c \
+ kmo_priv_noise_map.c \
+ kmo_priv_reconstruct.c \
+ kmo_priv_rotate.c \
+ kmo_priv_shift.c \
+ kmo_priv_sky_mask.c \
+ kmo_priv_stats.c \
+ kmo_priv_wave_cal.c \
+ kmo_priv_std_star.c \
+ kmo_priv_lcorr.c \
+ kmo_priv_sky_tweak.c \
+ ../kmclipm/src/kmclipm_functions.c \
+ ../kmclipm/src/kmclipm_math.c \
+ ../kmclipm/src/kmclipm_priv_constants.c \
+ ../kmclipm/src/kmclipm_priv_error.c \
+ ../kmclipm/src/kmclipm_priv_functions.c \
+ ../kmclipm/src/kmclipm_priv_reconstruct.c \
+ ../kmclipm/src/kmclipm_priv_splines.c \
+ ../kmclipm/src/kmclipm_vector.c
libkmos_la_LDFLAGS = $(EXTRA_LDFLAGS) $(CPL_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
libkmos_la_LIBADD = $(LIBIRPLIB) $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE)
@@ -513,7 +512,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_stats.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_std_star.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_priv_wave_cal.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_test_create_data.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_utils.Plo at am__quote@
.c.o:
diff --git a/kmos/kmo_debug.h b/kmos/kmo_debug.h
index de09d50..5fb9223 100644
--- a/kmos/kmo_debug.h
+++ b/kmos/kmo_debug.h
@@ -33,6 +33,7 @@
*----------------------------------------------------------------------------*/
#include <cpl.h>
+
#include "kmo_utils.h"
//cpl_msg_set_level(CPL_MSG_DEBUG);kmo_debug_();cpl_msg_set_level(CPL_MSG_INFO);
diff --git a/kmos/kmo_dfs.c b/kmos/kmo_dfs.c
index 9fce773..60c1daa 100644
--- a/kmos/kmo_dfs.c
+++ b/kmos/kmo_dfs.c
@@ -35,12 +35,13 @@
#include <cpl.h>
+#include "kmclipm_math.h"
+
#include "kmo_dfs.h"
#include "kmo_utils.h"
#include "kmo_error.h"
#include "kmo_constants.h"
#include "kmo_debug.h"
-#include "kmclipm_math.h"
/*----------------------------------------------------------------------------*/
/**
@@ -2417,7 +2418,7 @@ cpl_error_code kmo_extname_extractor(const char *extname,
KMO_TRY_ASSURE(strcmp(content, EXT_LIST) == 0,
CPL_ERROR_ILLEGAL_INPUT,
- "extname has bad content: %s (must be LIST!)",
+ "EXTNAME has bad content: %s (must be LIST!)",
content);
break;
case 2:
@@ -2428,7 +2429,7 @@ cpl_error_code kmo_extname_extractor(const char *extname,
KMO_TRY_ASSURE((strcmp(content, EXT_DATA) == 0) ||
(strcmp(content, EXT_NOISE) == 0),
CPL_ERROR_ILLEGAL_INPUT,
- "extname has bad content: %s (either DATA or NOISE!",
+ "EXTNAME has bad content: %s (either DATA or NOISE!",
content);
break;
case 3:
@@ -2440,7 +2441,7 @@ cpl_error_code kmo_extname_extractor(const char *extname,
(strcmp(content, EXT_NOISE) == 0) ||
(strcmp(content, EXT_BADPIX) == 0),
CPL_ERROR_ILLEGAL_INPUT,
- "extname has bad content: %s (either DATA, NOISE or "
+ "EXTNAME has bad content: %s (either DATA, NOISE or "
"BADPIX)!", content);
break;
default:
diff --git a/kmos/kmo_dfs.h b/kmos/kmo_dfs.h
index 4745efd..08da64d 100644
--- a/kmos/kmo_dfs.h
+++ b/kmos/kmo_dfs.h
@@ -33,9 +33,8 @@
*--------------------------------------------------------------------------*/
#include <cpl.h>
-#include <cpl.h>
-#include "kmclipm_vector.h"
+#include "kmclipm_vector.h"
#include "kmo_utils.h"
@@ -98,10 +97,13 @@
#define STD_MASK "STD_MASK"
#define STD_CUBE "STD_CUBE"
#define STAR_SPEC "STAR_SPEC"
+#define NOISE_SPEC "NOISE_SPEC"
// kmo_sci_red
#define SCIENCE "SCIENCE" // RAW
#define COMBINED_CUBE "SCI_COMBINED"
#define RECONSTRUCTED_CUBE "SCI_RECONSTRUCTED"
+#define INTERIM_OBJECT_CUBE "SCI_INTERIM_OBJECT"
+#define INTERIM_OBJECT_SKY "SCI_INTERIM_SKY"
// kmo_multi_reconstruct
#define CUBE_MULTI "CUBE_MULTI"
@@ -114,6 +116,7 @@
#define ARITHMETIC "ARITHMETIC"
// kmo_combine
#define COMBINE "COMBINE"
+#define EXP_MASK "EXP_MASK"
// kmo_copy
#define COPY "COPY"
// kmo_reconstruct
@@ -248,6 +251,7 @@
#define QC_THROUGHPUT_SDV "ESO QC THRUPUT SDV"
#define QC_STD_TRACE "ESO QC STD TRACE"
#define QC_NR_STD_STARS "ESO QC NR STD STARS"
+#define QC_SNR "ESO QC SNR"
/*------------------------------------------------------------------------------
Functions prototypes
diff --git a/kmos/kmo_functions.c b/kmos/kmo_functions.c
index 0cf953e..9f209c4 100644
--- a/kmos/kmo_functions.c
+++ b/kmos/kmo_functions.c
@@ -40,6 +40,7 @@
#include <string.h>
#include <stdlib.h>
#include <math.h>
+#include <unistd.h>
#ifdef __USE_XOPEN
#include <time.h>
@@ -50,6 +51,7 @@
#endif
#include <cpl.h>
+
#include "kmclipm_constants.h"
#include "kmclipm_vector.h"
#include "kmclipm_priv_reconstruct.h"
@@ -126,6 +128,9 @@ int getIndexObjSkyStruct(const objSkyStruct *obj_sky_struct, const char *strToFi
@brief
Print an objSkyStruct
+ If this function is modified, please apply same change as well to
+ kmo_save_objSkyStruct() and kmo_read_objSkyStruct() !!!
+
@param frameset The frameset
@param objSkyStruct The objSkyStruct to print
@@ -133,7 +138,8 @@ int getIndexObjSkyStruct(const objSkyStruct *obj_sky_struct, const char *strToFi
void kmo_print_objSkyStruct(const objSkyStruct *obj_sky_struct)
{
int i = 0,
- s = 0;
+ s = 0,
+ foundIfu = FALSE;
const char *objFilename = NULL,
*skyFilename = NULL,
*tag = NULL,
@@ -141,7 +147,9 @@ void kmo_print_objSkyStruct(const objSkyStruct *obj_sky_struct)
char *keyword = NULL,
outStrType[1024],
outStrFileId[1024],
- tmpStr[5];
+ outStrIfuId[1024],
+ tmpStr[5],
+ tmpStrIfu[5];
objSkyIndexStruct *indexStruct = NULL;
cpl_propertylist *pl = NULL;
objSkyTable *obj_sky_table = NULL;
@@ -172,10 +180,11 @@ void kmo_print_objSkyStruct(const objSkyStruct *obj_sky_struct)
cpl_msg_info("", "IFU 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24");
cpl_msg_info("", " ----------------------------------------------------------------------");
for (i = 0; i < obj_sky_struct->size; i++) {
-// sprintf(outStrType, " type: ");
sprintf(outStrType, " type:");
sprintf(outStrFileId, " sky in #:");
+ sprintf(outStrIfuId, " #ifu:");
if (obj_sky_table[i].objFrame != NULL) {
+ foundIfu = FALSE;
KMO_TRY_EXIT_IF_NULL(
objFilename = cpl_frame_get_filename(obj_sky_table[i].objFrame));
KMO_TRY_EXIT_IF_NULL(
@@ -186,12 +195,22 @@ void kmo_print_objSkyStruct(const objSkyStruct *obj_sky_struct)
// get associated File ID
if ((obj_sky_table[i].skyFrames[s] == NULL) || (obj_sky_table[i].skyFrames[s] == NO_CORRESPONDING_SKYFRAME)) {
sprintf(tmpStr, " .");
+ sprintf(tmpStrIfu, " .");
} else {
KMO_TRY_EXIT_IF_NULL(
skyFilename = cpl_frame_get_filename(obj_sky_table[i].skyFrames[s]));
sprintf(tmpStr, "%3d", getIndexObjSkyStruct(obj_sky_struct, skyFilename));
+ if (obj_sky_table[i].skyIfus[s] != -1) {
+ sprintf(tmpStrIfu, "%3d", obj_sky_table[i].skyIfus[s]);
+ if (obj_sky_table[i].skyIfus[s] != s+1) {
+ foundIfu = TRUE;
+ }
+ } else {
+ sprintf(tmpStrIfu, " .");
+ }
}
strcat(outStrFileId, tmpStr);
+ strcat(outStrIfuId, tmpStrIfu);
// get type
KMO_TRY_EXIT_IF_NULL(
@@ -209,15 +228,451 @@ void kmo_print_objSkyStruct(const objSkyStruct *obj_sky_struct)
}
cpl_msg_info("", "%s", outStrType);
cpl_msg_info("", "%s", outStrFileId);
+ if (foundIfu) {
+ cpl_msg_info("", "%s", outStrIfuId);
+ }
+ cpl_propertylist_delete(pl); pl = NULL;
+ } // end if (obj_sky_table[i].objFrame != NULL)
+ } // end for (i < obj_sky_struct->size)
+ cpl_msg_info("", "-----------------------------------------------------------------------------------");
+ }
+ KMO_CATCH
+ {
+ KMO_CATCH_MSG();
+ }
+}
+
+/**
+ @brief
+ Save an objSkyStruct to disk.
+
+ If this function is modified, please apply same change as well to
+ kmo_print_objSkyStruct() and kmo_read_objSkyStruct() !!!
+
+ @param objSkyStruct The objSkyStruct to print
+ @param filename The filename to save to
+
+*/
+cpl_error_code kmo_save_objSkyStruct(const objSkyStruct *obj_sky_struct)
+{
+ int i = 0,
+ s = 0,
+ fn_cnt = 1;
+ const char *objFilename = NULL,
+ *skyFilename = NULL,
+ *tag = NULL,
+ *type = NULL;
+ char *keyword = NULL,
+ *filename = NULL,
+ outStrType[1024],
+ outStrFileId[1024],
+ tmpStr[5];
+ objSkyIndexStruct *indexStruct = NULL;
+ cpl_propertylist *pl = NULL;
+ objSkyTable *obj_sky_table = NULL;
+ FILE *fh = NULL;
+ cpl_error_code ret_err = CPL_ERROR_NONE;
+
+ KMO_TRY {
+ KMO_TRY_ASSURE(obj_sky_struct != NULL,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Not all inputs provided!");
+
+ // create unique filename
+ KMO_TRY_EXIT_IF_NULL(
+ filename = cpl_sprintf("obj_sky_table.txt"));
+ while (access(filename, F_OK) == 0) {
+ cpl_free(filename); filename = NULL;
+ KMO_TRY_EXIT_IF_NULL(
+ filename = cpl_sprintf("obj_sky_table_%d.txt", fn_cnt++));
+ }
+
+ fh = fopen(filename, "w");
+ if (fh == NULL) {
+ KMO_TRY_ASSURE(1==0,
+ CPL_ERROR_FILE_IO,
+ "Couldn't' open file handler for saving obj/sky-struct!");
+ }
+
+ KMO_TRY_EXIT_IF_NULL(
+ obj_sky_table = obj_sky_struct->table);
+ KMO_TRY_EXIT_IF_NULL(
+ indexStruct = obj_sky_struct->indexStruct);
+
+ KMO_TRY_EXIT_IF_NULL(
+ tag = cpl_frame_get_tag(obj_sky_struct->table[0].objFrame));
+
+ fprintf(fh, "-----------------------------------------------------------------------------------\n");
+ fprintf(fh, "*** When editing this table for reading it in later again, ***\n");
+ fprintf(fh, "*** please follow these rules: ***\n");
+ fprintf(fh, "*** 1) This table is intended to change object-sky associations, so only ***\n");
+ fprintf(fh, "*** change the lower part of the table . ***\n");
+ fprintf(fh, "*** 2) valid values for the type are: 'O', 'S' and 'R' ***\n");
+ fprintf(fh, "*** - types can be reassigned freely ***\n");
+ fprintf(fh, "*** (where 'R' is handled like'O', so in fact there is no need to insert ***\n");
+ fprintf(fh, "*** any 'R') ***\n");
+ fprintf(fh, "*** 3) valid values for the skies are: space separated integers ***\n");
+ fprintf(fh, "*** - the number of spaces doesn't matter ***\n");
+ fprintf(fh, "*** - the number of sky indices must always be 24! ***\n");
+ fprintf(fh, "*** - for type 'S' put in a '.' (in fact everything except an integer) ***\n");
+ fprintf(fh, "*** - every object ('O' or 'R') must have a index assigned! ***\n");
+ fprintf(fh, "*** - the index must exist in the upper table ***\n");
+ fprintf(fh, "*** - the index could point to an IFU containing an object (this would ***\n");
+ fprintf(fh, "*** result in subtracting an object from an object) ***\n");
+ fprintf(fh, "*** ***\n");
+ fprintf(fh, "*** No checks at all on validity of any of the input data is performed. ***\n");
+ fprintf(fh, "*** ***\n");
+ fprintf(fh, "*** These comments are ignored when reading in this table. ***\n");
+ fprintf(fh, "-----------------------------------------------------------------------------------\n");
+ fprintf(fh, "Object/sky associations of frames tagged as: %s\n", tag);
+ fprintf(fh, " \n");
+ fprintf(fh, "index: filename:\n");
+
+ for (i = 0; i < obj_sky_struct->sizeIndexStruct; i++) {
+ fprintf(fh, "#%3d: %s\n", indexStruct[i].index, indexStruct[i].filename);
+ }
+
+ fprintf(fh, "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n");
+ fprintf(fh, "IFU 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24\n");
+ fprintf(fh, " ----------------------------------------------------------------------\n");
+ for (i = 0; i < obj_sky_struct->size; i++) {
+ sprintf(outStrType, " type:");
+ sprintf(outStrFileId, " sky in #:");
+ if (obj_sky_table[i].objFrame != NULL) {
+ KMO_TRY_EXIT_IF_NULL(
+ objFilename = cpl_frame_get_filename(obj_sky_table[i].objFrame));
+ KMO_TRY_EXIT_IF_NULL(
+ pl = kmclipm_propertylist_load(objFilename, 0));
+ fprintf(fh, "frame #%3d: %s\n", getIndexObjSkyStruct(obj_sky_struct, objFilename), objFilename);
+
+ for (s = 0; s < KMOS_NR_IFUS; s++) {
+ // get associated File ID
+ if ((obj_sky_table[i].skyFrames[s] == NULL) || (obj_sky_table[i].skyFrames[s] == NO_CORRESPONDING_SKYFRAME)) {
+ sprintf(tmpStr, " .");
+ } else {
+ KMO_TRY_EXIT_IF_NULL(
+ skyFilename = cpl_frame_get_filename(obj_sky_table[i].skyFrames[s]));
+ sprintf(tmpStr, "%3d", getIndexObjSkyStruct(obj_sky_struct, skyFilename));
+ }
+ strcat(outStrFileId, tmpStr);
+
+ // get type
+ KMO_TRY_EXIT_IF_NULL(
+ keyword = cpl_sprintf("%s%d%s", IFU_TYPE_PREFIX, s+1, IFU_TYPE_POSTFIX));
+ if (cpl_propertylist_has(pl, keyword)) {
+ KMO_TRY_EXIT_IF_NULL(
+ type = cpl_propertylist_get_string(pl, keyword));
+ sprintf(tmpStr, " %s", type);
+ } else {
+ sprintf(tmpStr, " .");
+ }
+ cpl_free(keyword); keyword = NULL;
+
+ strcat(outStrType, tmpStr);
+ }
+ fprintf(fh, "%s\n", outStrType);
+ fprintf(fh, "%s\n", outStrFileId);
cpl_propertylist_delete(pl); pl = NULL;
}
}
- cpl_msg_info("", "-----------------------------------------------------------------------------------");
+ fprintf(fh, "-----------------------------------------------------------------------------------\n");
+
+ fclose(fh);
}
KMO_CATCH
{
KMO_CATCH_MSG();
+ ret_err = cpl_error_get_code();
}
+
+ cpl_free(filename); filename = NULL;
+
+ return ret_err;
+}
+
+/**
+ @brief
+ Reads an obj/sky-struct from disk
+
+ @param filename The file to read in
+ @param frameset The frameset
+ @param frameType The frame type to process
+
+ @return A pointer to an objSkyStruct
+
+ The returned objSkyStruct must be freed with kmo_delete_objSkyStruct()
+*/
+objSkyStruct* kmo_read_objSkyStruct(const char *filename,
+ cpl_frameset *frameset,
+ const char *frameType)
+{
+ objSkyStruct *obj_sky_struct = NULL;
+ FILE *fh = NULL;
+ int maxchar = 2048,
+ maxframes = 2048,
+ i = 0,
+ j = 0,
+ ok = 0,
+ allFrameCnt = 0,
+ nrFrames = 0,
+ validFrameCnt = 0,
+ *allFrameIndices = NULL,
+ *validFrameIndices = NULL,
+ **indexFrame = NULL,
+ **indexIfu = NULL;
+ char tmpstr[maxchar],
+ **allFrameFilenames = NULL,
+ ***type = NULL,
+ *tmpstr2 = NULL;
+ cpl_frame *tmp_frame = NULL;
+
+ KMO_TRY
+ {
+ KMO_TRY_ASSURE((filename != NULL) &&
+ (frameset != NULL) &&
+ (frameType != NULL),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Not all inputs are provided!");
+
+ //
+ // allocate temporary memory
+ //
+ KMO_TRY_EXIT_IF_NULL(
+ validFrameIndices = cpl_calloc(maxframes, sizeof(int)));
+ KMO_TRY_EXIT_IF_NULL(
+ allFrameIndices = cpl_calloc(maxframes, sizeof(int)));
+ KMO_TRY_EXIT_IF_NULL(
+ allFrameFilenames = cpl_calloc(maxframes, sizeof(char*)));
+ KMO_TRY_EXIT_IF_NULL(
+ type = cpl_calloc(maxframes, sizeof(char*)));
+ KMO_TRY_EXIT_IF_NULL(
+ indexFrame = cpl_calloc(maxframes, sizeof(int*)));
+ KMO_TRY_EXIT_IF_NULL(
+ indexIfu = cpl_calloc(maxframes, sizeof(int*)));
+ for (i = 0; i < maxframes; i++) {
+ KMO_TRY_EXIT_IF_NULL(
+ allFrameFilenames[i] = cpl_calloc(maxchar, sizeof(char)));
+ KMO_TRY_EXIT_IF_NULL(
+ type[i] = cpl_calloc(KMOS_NR_IFUS, sizeof(char*)));
+ KMO_TRY_EXIT_IF_NULL(
+ indexFrame[i] = cpl_calloc(KMOS_NR_IFUS, sizeof(int)));
+ KMO_TRY_EXIT_IF_NULL(
+ indexIfu[i] = cpl_calloc(KMOS_NR_IFUS, sizeof(int)));
+ for (j = 0; j < KMOS_NR_IFUS; j++) {
+ KMO_TRY_EXIT_IF_NULL(
+ type[i][j] = cpl_calloc(1, sizeof(char)));
+ strcpy(type[i][j], "x");
+ indexFrame[i][j] = -1;
+ indexIfu[i][j] = -1;
+ }
+ }
+
+ //
+ // open file handler
+ //
+ fh = fopen(filename, "r");
+ if (fh == NULL) {
+ KMO_TRY_ASSURE(1==0,
+ CPL_ERROR_FILE_IO,
+ "Couldn't' open file handler for reading obj/sky-struct!");
+ }
+
+ //
+ // skip header
+ //
+ fgets(tmpstr, 2, fh); // read first charachter and check if it is a '#'
+ while (strcmp(tmpstr, "#") != 0) {
+ fgets(tmpstr, maxchar, fh); // skip rest of line
+ fgets(tmpstr, 2, fh); // read first charachter again
+ }
+
+ //
+ // read in filenames and their indices
+ //
+ while (strcmp(tmpstr, "#") == 0) {
+ fscanf(fh, "%d", &(allFrameIndices[allFrameCnt])); // read index
+ fscanf(fh, "%s", tmpstr); // skip ':'
+ fscanf(fh, "%s", allFrameFilenames[allFrameCnt]); // read filename
+ fgets(tmpstr, maxchar, fh); // skip rest of line
+ fgets(tmpstr, 2, fh); // read first charachter again
+
+ allFrameCnt++;
+ }
+
+ //
+ // skip intermediate header (IFU 1 2 3 4....)
+ //
+ fgets(tmpstr, 2, fh); // read first character and check if it is a 'f'
+ while (strcmp(tmpstr, "f") != 0) {
+ fgets(tmpstr, maxchar, fh); // skip rest of line
+ fgets(tmpstr, 2, fh); // read first charachter again
+ }
+
+ //
+ // read in indices and associations
+ //
+ while (strcmp(tmpstr, "f") == 0) {
+ // 1st line
+ fscanf(fh, "%s", tmpstr); // skip 'frame'
+ fscanf(fh, "%s", tmpstr); // skip '#'
+ fscanf(fh, "%d", &(validFrameIndices[validFrameCnt])); // read index
+ fgets(tmpstr, maxchar, fh); // skip rest of line
+
+ // 2nd line
+ fscanf(fh, "%s", tmpstr); // skip 'type:'
+ for (i = 0; i < KMOS_NR_IFUS; i++) {
+ fscanf(fh, "%s", type[validFrameCnt][i]); // read type-code
+ }
+ fgets(tmpstr, maxchar, fh); // skip rest of line
+
+ // 3rd line
+ fscanf(fh, "%s", tmpstr); // skip 'sky'
+ fscanf(fh, "%s", tmpstr); // skip 'in'
+ fscanf(fh, "%s", tmpstr); // skip '#:'
+ for (i = 0; i < KMOS_NR_IFUS; i++) {
+ fscanf(fh, "%s", tmpstr); // read sky-index
+ if (strcmp(tmpstr, ".") != 0) {
+ // valid index to sky frame (any optional /x IFU identifier is ignored by atoi())
+ indexFrame[validFrameCnt][i] = atoi(tmpstr);
+
+ tmpstr2 = cpl_sprintf("%d", atoi(tmpstr));
+ if (strlen(tmpstr2) != strlen(tmpstr)) {
+ // valid index to sky IFU
+ indexIfu[validFrameCnt][i] = atoi(strchr(tmpstr,'/')+1);
+ }
+ cpl_free(tmpstr2); tmpstr2 = NULL;
+ } else {
+ // this is a sky IFU
+ }
+ }
+ fgets(tmpstr, maxchar, fh); // skip rest of line
+ fgets(tmpstr, 2, fh); // read first charachter again
+
+ validFrameCnt++;
+ }
+ fclose(fh);
+
+// debug
+//for (i = 0; i < allFrameCnt; i++) {
+// printf("%d: %s\n", allFrameIndices[i], allFrameFilenames[i]);
+//} printf("\n");fflush(stdout);
+//for (i = 0; i < validFrameCnt; i++) {
+// printf("index: %d\n", validFrameIndices[i]);
+// printf("type-code: ");
+// for (j = 0; j < KMOS_NR_IFUS; j++) {
+// printf("%s ", type[i][j]);
+// } printf("\n");
+// printf("sky-assoc.: ");
+// for (j = 0; j < KMOS_NR_IFUS; j++) {
+// printf("%d ", indexFrame[i][j]);
+// } printf("\n");
+// for (j = 0; j < KMOS_NR_IFUS; j++) {
+// printf("%d ", indexIfu[i][j]);
+// } printf("\n");
+//} printf("\n");fflush(stdout);
+
+ //
+ // populate obj_sky_struct
+ //
+ nrFrames = cpl_frameset_count_tags(frameset, frameType);
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ KMO_TRY_ASSURE(nrFrames == allFrameCnt,
+ CPL_ERROR_ILLEGAL_INPUT,
+ "The number of %s frames and the number of frames in %s isn't equal (%d and %d)!",
+ frameType, filename, nrFrames, allFrameCnt);
+
+ KMO_TRY_EXIT_IF_NULL(
+ obj_sky_struct = cpl_calloc(1, sizeof(objSkyStruct)));
+
+ obj_sky_struct->size = validFrameCnt;
+ KMO_TRY_EXIT_IF_NULL(
+ obj_sky_struct->table = cpl_calloc(validFrameCnt, sizeof(objSkyTable)));
+
+ for (i = 0; i < validFrameCnt; i++) {
+ ok = FALSE;
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_frame = kmo_dfs_get_frame(frameset, frameType));
+ while (!ok && (tmp_frame != NULL)) {
+ if (strcmp(allFrameFilenames[validFrameIndices[i]], cpl_frame_get_filename(tmp_frame)) == 0) {
+ // found frame
+ obj_sky_struct->table[i].objFrame = tmp_frame;
+ ok = TRUE;
+ }
+ tmp_frame = kmo_dfs_get_frame(frameset, NULL);
+ KMO_TRY_CHECK_ERROR_STATE();
+ }
+
+ for (j = 0; j < KMOS_NR_IFUS; j++) {
+ if ((indexFrame[i][j] >= 0) &&
+ ((strcmp(type[i][j], "O") == 0) || (strcmp(type[i][j], "R") == 0)))
+ {
+ ok = FALSE;
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_frame = kmo_dfs_get_frame(frameset, frameType));
+ while (!ok && (tmp_frame != NULL)) {
+ if (strcmp(allFrameFilenames[indexFrame[i][j]], cpl_frame_get_filename(tmp_frame)) == 0) {
+ // found frame
+ obj_sky_struct->table[i].skyFrames[j] = tmp_frame;
+ obj_sky_struct->table[i].skyIfus[j] = indexIfu[i][j];
+ ok = TRUE;
+ }
+ tmp_frame = kmo_dfs_get_frame(frameset, NULL);
+ KMO_TRY_CHECK_ERROR_STATE();
+ }
+ } else {
+ obj_sky_struct->table[i].skyFrames[j] = NO_CORRESPONDING_SKYFRAME;
+ obj_sky_struct->table[i].skyIfus[j] = -1;
+ }
+ } // end for (j = KMOS_NR_IFUS)
+ } // end for (i = validFrameCnt)
+
+ // create objSkyIndexStruct
+ KMO_TRY_EXIT_IF_NULL(
+ obj_sky_struct->indexStruct = kmo_create_objSkyIndexStruct(frameset,
+ obj_sky_struct));
+
+ //
+ // print info on which frames have only sky in it
+ //
+ for (i = 0; i < allFrameCnt; i++) {
+ ok = FALSE;
+ for (j = 0; j < validFrameCnt; j++) {
+ if (validFrameIndices[j] == i) {
+ ok = TRUE;
+ break;
+ }
+ }
+ if (!ok) {
+ cpl_msg_info("",
+ "Frame '%s' does not contain objects, no output will be produced for it",
+ allFrameFilenames[i]);
+ }
+ }
+ }
+ KMO_CATCH
+ {
+ KMO_CATCH_MSG();
+ kmo_delete_objSkyStruct(obj_sky_struct);
+ }
+
+ cpl_free(validFrameIndices); validFrameIndices = NULL;
+ cpl_free(allFrameIndices); allFrameIndices = NULL;
+ for (i = 0; i < maxframes; i++) {
+ cpl_free(allFrameFilenames[i]); allFrameFilenames[i] = NULL;
+ for (j = 0; j < KMOS_NR_IFUS; j++) {
+ cpl_free(type[i][j]); type[i][j] = NULL;
+ }
+ cpl_free(type[i]); type[i] = NULL;
+ cpl_free(indexFrame[i]); indexFrame[i] = NULL;
+ cpl_free(indexIfu[i]); indexIfu[i] = NULL;
+ }
+ cpl_free(allFrameFilenames); allFrameFilenames = NULL;
+ cpl_free(type); type = NULL;
+ cpl_free(indexFrame); indexFrame = NULL;
+ cpl_free(indexIfu); indexIfu = NULL;
+
+ return obj_sky_struct;
}
/**
@@ -244,14 +699,11 @@ objSkyStruct* kmo_create_objSkyStruct(cpl_frameset *frameset,
kx = 0,
sx = 0,
atLeastOneObjectFound = 0,
- nr_tags = 0,
- i = 0,
ifu_nr = 0;
char *subseconds = NULL,
*keywordType = NULL;
const char *timestamp = NULL,
- *type = NULL,
- *tag = NULL;
+ *type = NULL;
tmpFrameTableStruct *tmpFrameTable = NULL;
objSkyStruct *obj_sky_struct = NULL;
cpl_frame *frame = NULL;
@@ -389,6 +841,7 @@ objSkyStruct* kmo_create_objSkyStruct(cpl_frameset *frameset,
atLeastOneObjectFound = 0;
for (kx = 0; kx < KMOS_NR_IFUS; kx++) {
+ obj_sky_struct->table[cnt].skyIfus[kx] = -1;
if (tmpFrameTable[ix].type[kx] == 'S') {
// sky position not an object
obj_sky_struct->table[cnt].skyFrames[kx] = NULL;
@@ -402,6 +855,7 @@ objSkyStruct* kmo_create_objSkyStruct(cpl_frameset *frameset,
if (min > delta_ts) {
min = delta_ts;
obj_sky_struct->table[cnt].skyFrames[kx] = tmpFrameTable[sx].frame;
+ obj_sky_struct->table[cnt].skyIfus[kx] = kx+1;
}
}
}
@@ -429,35 +883,76 @@ objSkyStruct* kmo_create_objSkyStruct(cpl_frameset *frameset,
// create objSkyIndexStruct
KMO_TRY_EXIT_IF_NULL(
+ obj_sky_struct->indexStruct = kmo_create_objSkyIndexStruct(frameset,
+ obj_sky_struct));
+ }
+ KMO_CATCH
+ {
+ cpl_msg_info(cpl_func, "Encountered error: %s in %s",
+ cpl_error_get_message(), cpl_error_get_where());
+ kmo_delete_objSkyStruct(obj_sky_struct);
+ }
+
+ if (tmpFrameTable != NULL) {
+ cpl_free(tmpFrameTable); tmpFrameTable = NULL;
+ }
+
+ return obj_sky_struct;
+}
+
+/**
+ @brief
+ creates the obj-sky-index-struct
+
+ @param frameset The frameset
+ @param obj_sky_struct The obj-sky-structure
+
+ @return A pointer to an objSkyIndexStruct
+
+ The returned objSkyIndexStruct must be freed
+*/
+objSkyIndexStruct* kmo_create_objSkyIndexStruct(cpl_frameset *frameset,
+ objSkyStruct *obj_sky_struct)
+{
+ int i = 0,
+ nr_tags = 0;
+ const char *tag = NULL;
+ cpl_frame *frame = NULL;
+ objSkyIndexStruct *indexStruct = NULL;
+
+ KMO_TRY
+ {
+ KMO_TRY_ASSURE((frameset != NULL) &&
+ (obj_sky_struct != NULL),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Not all inputs provided!");
+
+ // create objSkyIndexStruct
+ KMO_TRY_EXIT_IF_NULL(
tag = cpl_frame_get_tag(obj_sky_struct->table[0].objFrame));
nr_tags = cpl_frameset_count_tags(frameset, tag);
KMO_TRY_EXIT_IF_NULL(
- obj_sky_struct->indexStruct = (objSkyIndexStruct*)cpl_calloc(nr_tags, sizeof(objSkyIndexStruct)));
+ indexStruct = (objSkyIndexStruct*)cpl_calloc(nr_tags, sizeof(objSkyIndexStruct)));
obj_sky_struct->sizeIndexStruct = nr_tags;
KMO_TRY_EXIT_IF_NULL(
frame = cpl_frameset_find(frameset, tag));
while (frame != NULL) {
- obj_sky_struct->indexStruct[i].filename = cpl_frame_get_filename(frame);
- obj_sky_struct->indexStruct[i].index = i;
+ indexStruct[i].filename = cpl_frame_get_filename(frame);
+ indexStruct[i].index = i;
i++;
frame = cpl_frameset_find(frameset, NULL);
}
}
KMO_CATCH
{
- cpl_msg_info(cpl_func, "Encountered error: %s in %s",
- cpl_error_get_message(), cpl_error_get_where());
- kmo_delete_objSkyStruct(obj_sky_struct);
- }
-
- if (tmpFrameTable != NULL) {
- cpl_free(tmpFrameTable); tmpFrameTable = NULL;
+ KMO_CATCH_MSG();
+ cpl_free(indexStruct); indexStruct = NULL;
}
- return obj_sky_struct;
+ return indexStruct;
}
/**
@@ -539,6 +1034,7 @@ void kmo_delete_objSkyStruct(objSkyStruct *obj_sky_struct)
@brief
Print an armNameStruct
+ @param frameset The frameset
@param armNameStruct The armNameStruct to print
*/
@@ -555,7 +1051,7 @@ void kmo_print_armNameStruct(cpl_frameset *frameset, armNameStruct *arm_name_str
KMO_TRY_ASSURE((arm_name_struct != NULL) &&
(frameset != NULL),
CPL_ERROR_ILLEGAL_INPUT,
- "objNameStruct is NULL!");
+ "Not all inputs provided!");
has_telluric = cpl_frameset_count_tags(frameset, TELLURIC);
@@ -612,9 +1108,7 @@ void kmo_print_armNameStruct(cpl_frameset *frameset, armNameStruct *arm_name_str
/**
@brief
- Reads a objSkyStruct and return an array with the names of the IFUs to reconstruct
-
- @param obj_sky_struct Input objSkyStruct
+ Creates an armNameStruct out of the frameset
@return A pointer to an armNameStruct
@@ -629,6 +1123,116 @@ armNameStruct* kmo_create_armNameStruct(cpl_frameset *frameset,
const char *mapping_mode,
int acceptAllSky)
{
+ armNameStruct *arm_name_struct = NULL;
+
+ KMO_TRY
+ {
+ KMO_TRY_ASSURE((unused_ifus != NULL) &&
+ (bounds != NULL),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Not all inputs are provided!");
+
+ KMO_TRY_EXIT_IF_NULL(
+ arm_name_struct = cpl_calloc(1, sizeof(armNameStruct)));
+
+ KMO_TRY_EXIT_IF_NULL(
+ arm_name_struct->obj_sky_struct = kmo_create_objSkyStruct(frameset,
+ frameType,
+ acceptAllSky));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_priv_create_armNameStruct(arm_name_struct,
+ frameset,
+ frameType,
+ ifus,
+ name,
+ unused_ifus,
+ bounds,
+ mapping_mode,
+ acceptAllSky));
+ }
+ KMO_CATCH
+ {
+ KMO_CATCH_MSG();
+ kmo_delete_armNameStruct(arm_name_struct);
+ }
+
+ return arm_name_struct;
+}
+
+/**
+ @brief
+ Creates an armNameStruct out of an existing objSkyStruct (reading in from file)
+
+ @return A pointer to an armNameStruct
+
+ The returned armNameStruct must be freed with kmo_delete_armNameStruct()
+*/
+armNameStruct* kmo_create_armNameStruct2(objSkyStruct *obj_sky_struct,
+ cpl_frameset *frameset,
+ const char *frameType,
+ const cpl_vector *ifus,
+ const char *name,
+ cpl_array **unused_ifus,
+ const int *bounds,
+ const char *mapping_mode,
+ int acceptAllSky)
+{
+ armNameStruct *arm_name_struct = NULL;
+
+ KMO_TRY
+ {
+ KMO_TRY_ASSURE((obj_sky_struct != NULL) &&
+ (frameset != NULL) &&
+ (unused_ifus != NULL) &&
+ (bounds != NULL),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Not all inputs are provided!");
+
+ KMO_TRY_EXIT_IF_NULL(
+ arm_name_struct = cpl_calloc(1, sizeof(armNameStruct)));
+
+ KMO_TRY_EXIT_IF_NULL(
+ arm_name_struct->obj_sky_struct = obj_sky_struct);
+
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_priv_create_armNameStruct(arm_name_struct,
+ frameset,
+ frameType,
+ ifus,
+ name,
+ unused_ifus,
+ bounds,
+ mapping_mode,
+ acceptAllSky));
+ }
+ KMO_CATCH
+ {
+ KMO_CATCH_MSG();
+ kmo_delete_armNameStruct(arm_name_struct);
+ }
+
+ return arm_name_struct;
+}
+
+/**
+ @brief
+ Creates an armNameStruct after the obj_sky_struct has been created
+
+
+ @return A pointer to an armNameStruct
+
+ The returned armNameStruct must be freed with kmo_delete_armNameStruct()
+*/
+cpl_error_code kmo_priv_create_armNameStruct(armNameStruct *arm_name_struct,
+ cpl_frameset *frameset,
+ const char *frameType,
+ const cpl_vector *ifus,
+ const char *name,
+ cpl_array **unused_ifus,
+ const int *bounds,
+ const char *mapping_mode,
+ int acceptAllSky)
+{
int ix = 0,
iy = 0,
i = 0,
@@ -642,7 +1246,6 @@ armNameStruct* kmo_create_armNameStruct(cpl_frameset *frameset,
has_telluric = 0,
ifu_nr_telluric = 0;
int *punused_ifus = NULL;
- armNameStruct *arm_name_struct = NULL;
const char *fn_obj = NULL,
*tmpName = NULL,
*targetType = NULL;
@@ -652,20 +1255,18 @@ armNameStruct* kmo_create_armNameStruct(cpl_frameset *frameset,
targetTypeChar;
cpl_propertylist *main_header = NULL;
cpl_frame *frame = NULL;
+ cpl_error_code ret_err = CPL_ERROR_NONE;
KMO_TRY {
- KMO_TRY_ASSURE((unused_ifus != NULL) &&
+ KMO_TRY_ASSURE((arm_name_struct != NULL) &&
+ (arm_name_struct->obj_sky_struct != NULL) &&
+ (frameset != NULL) &&
+ (frameType != NULL) &&
+ (unused_ifus != NULL) &&
(bounds != NULL),
CPL_ERROR_ILLEGAL_INPUT,
- "obj_sky_struct mustn't be NULL");
+ "Not all inputs provided!");
- KMO_TRY_EXIT_IF_NULL(
- arm_name_struct = cpl_calloc(1, sizeof(armNameStruct)));
-
- KMO_TRY_EXIT_IF_NULL(
- arm_name_struct->obj_sky_struct = kmo_create_objSkyStruct(frameset,
- frameType,
- acceptAllSky));
arm_name_struct->size = arm_name_struct->obj_sky_struct->size;
if (ifus != NULL) {
@@ -920,9 +1521,10 @@ armNameStruct* kmo_create_armNameStruct(cpl_frameset *frameset,
{
KMO_CATCH_MSG();
kmo_delete_armNameStruct(arm_name_struct);
+ ret_err = cpl_error_get_code();
}
- return arm_name_struct;
+ return ret_err;
}
/**
@@ -947,6 +1549,7 @@ void kmo_delete_armNameStruct(armNameStruct *arm_name_struct)
cpl_free(arm_name_struct->name_ids); arm_name_struct->name_ids = NULL;
}
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;
}
@@ -1023,7 +1626,7 @@ cpl_array* kmo_get_timestamps(cpl_frame* xcalFrame,
return calTimestamp;
}
-cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
+cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
int lowBound,
int highBound,
cpl_image *objDetImage_data,
@@ -1487,24 +2090,25 @@ cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
Nan/Inf values are now rejected already here.
*/
-cpl_error_code kmo_reconstruct_sci(int ifu_nr,
- int lowBound,
- int highBound,
- cpl_frame *objectFrame,
- const char *obj_tag,
- cpl_frame *skyFrame,
- const char *sky_tag,
- cpl_frame *flatFrame,
- cpl_frame *xcalFrame,
- cpl_frame *ycalFrame,
- cpl_frame *lcalFrame,
- cpl_polynomial *lcorrection,
- const gridDefinition *gd,
- cpl_imagelist **dataCubePtr,
- cpl_imagelist **noiseCubePtr,
- int flux,
- int background,
- int xcal_interpolation)
+cpl_error_code kmo_reconstruct_sci(int ifu_nr,
+ int lowBound,
+ int highBound,
+ cpl_frame *objectFrame,
+ const char *obj_tag,
+ cpl_frame *skyFrame,
+ const char *sky_tag,
+ cpl_frame *flatFrame,
+ cpl_frame *xcalFrame,
+ cpl_frame *ycalFrame,
+ cpl_frame *lcalFrame,
+ cpl_polynomial *lcorrection,
+ double *velocity_correction,
+ const gridDefinition *gd,
+ cpl_imagelist **dataCubePtr,
+ cpl_imagelist **noiseCubePtr,
+ int flux,
+ int background,
+ int xcal_interpolation)
{
cpl_error_code retVal = CPL_ERROR_NONE;
@@ -1820,12 +2424,18 @@ cpl_error_code kmo_reconstruct_sci(int ifu_nr,
cpl_vector_set(calAngles, 2, rotangle_found_l));
//
- // apply the lambda correction polynomial if supplied as argument
+ // get pointer to LCAL data in case any correction has to be applied
//
- if (lcorrection != NULL) {
+ if ((lcorrection != NULL) || (velocity_correction != NULL)){
KMO_TRY_EXIT_IF_NULL(
plcalDetImage = cpl_image_get_data_float(lcalDetImage));
lsize = cpl_image_get_size_x(lcalDetImage) * cpl_image_get_size_y(lcalDetImage);
+ }
+
+ //
+ // apply the lambda correction polynomial if supplied as argument
+ //
+ if (lcorrection != NULL) {
for (i = 0; i < lsize; i++) {
if (plcalDetImage[i] != 0.0) {
plcalDetImage[i] -= (float) cpl_polynomial_eval_1d(lcorrection, plcalDetImage[i], NULL);
@@ -1834,6 +2444,16 @@ cpl_error_code kmo_reconstruct_sci(int ifu_nr,
}
//
+ // apply velocity correction if supplied as argument
+ //
+ if (velocity_correction != NULL) {
+ double lcorr = *velocity_correction;
+ for (i = 0; i < lsize; i++) {
+ plcalDetImage[i] *= lcorr;
+ }
+ }
+
+ //
// finally call reconstruct function
//
KMO_TRY_EXIT_IF_ERROR(
diff --git a/kmos/kmo_functions.h b/kmos/kmo_functions.h
index b2473ad..54defdc 100644
--- a/kmos/kmo_functions.h
+++ b/kmos/kmo_functions.h
@@ -33,6 +33,7 @@
*----------------------------------------------------------------------------*/
#include <cpl.h>
+
#include "kmclipm_functions.h"
#include "kmclipm_constants.h"
@@ -41,31 +42,30 @@
typedef struct {
cpl_frame *objFrame; // pointer to frame containing objects
cpl_frame *skyFrames[KMOS_NR_IFUS]; // array of pointers to according sky frames
+ int skyIfus[KMOS_NR_IFUS]; // array of integers to according IFUs in sky frames
} objSkyTable;
typedef struct { // just for connecting frame filenames to entries in objSkyStruct
- const char *filename;
- int index;
+ const char *filename;
+ int index;
} objSkyIndexStruct;
typedef struct {
- int size; // number of frames with objects in it
- objSkyTable *table; // array of objSkyTables size: size
- int sizeIndexStruct;
+ int size; // number of frames with objects in it
+ objSkyTable *table; // array of objSkyTables size: size
+ int sizeIndexStruct;
objSkyIndexStruct *indexStruct; // size: sizeIndexStruct
} objSkyStruct;
typedef struct {
- int size; // number of frames with objects in it (same as objSkyStruct->size)
- int nrNames; // number of object names
-
+ int size; // number of frames with objects in it (same as objSkyStruct->size)
+ int nrNames; // number of object names
objSkyStruct *obj_sky_struct; // pointer to structure with obj/sky-associations, size: [1]
-
- char **names; // array of object names size: [nrNames]
- int *namesCnt; // array with number of object name occurences size: [nrNames]
- int *telluricCnt; // array with number of telluric occurences size: [nrNames]
- int *sameTelluric; // array with boolean if same telluric for all IFUs size: [nrNames]
- int *name_ids; // array with IDs of object names size: [size*KMOS_NR_IFUS]
+ char **names; // array of object names size: [nrNames]
+ int *namesCnt; // array with number of object name occurences size: [nrNames]
+ int *telluricCnt; // array with number of telluric occurences size: [nrNames]
+ int *sameTelluric; // array with boolean if same telluric for all IFUs size: [nrNames]
+ int *name_ids; // array with IDs of object names size: [size*KMOS_NR_IFUS]
// 0: no object available, 1: 1st object ID etc.
} armNameStruct;
@@ -78,11 +78,22 @@ extern int print_warning_once;
void kmo_print_objSkyStruct(const objSkyStruct *obj_sky_struct);
+cpl_error_code kmo_save_objSkyStruct(const objSkyStruct *obj_sky_struct);
+
+objSkyStruct* kmo_read_objSkyStruct(
+ const char *filename,
+ cpl_frameset *frameset,
+ const char *frameType);
+
objSkyStruct* kmo_create_objSkyStruct(
cpl_frameset *frameset,
const char *frameType,
int acceptAllSky);
+objSkyIndexStruct* kmo_create_objSkyIndexStruct(
+ cpl_frameset *frameset,
+ objSkyStruct *obj_sky_struct);
+
void kmo_collapse_objSkyStruct(
objSkyStruct* obj_sky_struct,
int ifu_nr,
@@ -105,6 +116,28 @@ armNameStruct* kmo_create_armNameStruct(cpl_frameset *frameset,
const char *mapping_mode,
int acceptAllSky);
+armNameStruct* kmo_create_armNameStruct2(
+ objSkyStruct *obj_sky_struct,
+ cpl_frameset *frameset,
+ const char *frameType,
+ const cpl_vector *ifus,
+ const char *name,
+ cpl_array **unused_ifus,
+ const int *bounds,
+ const char *mapping_mode,
+ int acceptAllSky);
+
+cpl_error_code kmo_priv_create_armNameStruct(
+ armNameStruct *arm_name_struct,
+ cpl_frameset *frameset,
+ const char *frameType,
+ const cpl_vector *ifus,
+ const char *name,
+ cpl_array **unused_ifus,
+ const int *bounds,
+ const char *mapping_mode,
+ int acceptAllSky);
+
void kmo_delete_armNameStruct(
armNameStruct *arm_name_struct);
@@ -114,7 +147,8 @@ cpl_array* kmo_get_timestamps(
cpl_frame* ycalFrame,
cpl_frame* lcalFrame);
-cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
+cpl_error_code kmo_reconstruct_sci_image(
+ int ifu_nr,
int lowBound,
int highBound,
cpl_image *objectDataDetImage,
@@ -138,7 +172,8 @@ cpl_error_code kmo_reconstruct_sci_image(int ifu_nr,
double *ret_flux_out,
double *ret_background);
-cpl_error_code kmo_reconstruct_sci(int ifu_nr,
+cpl_error_code kmo_reconstruct_sci(
+ int ifu_nr,
int lowBound,
int highBound,
cpl_frame *objectFrame,
@@ -150,6 +185,7 @@ cpl_error_code kmo_reconstruct_sci(int ifu_nr,
cpl_frame *ycalFrame,
cpl_frame *lcalFrame,
cpl_polynomial *lcorrection,
+ double *velocity_correction,
const gridDefinition *gd,
cpl_imagelist **dataCubePtr,
cpl_imagelist **noiseCubePtr,
diff --git a/kmos/kmo_priv_combine.c b/kmos/kmo_priv_combine.c
index e2dbeb2..49fe2a6 100644
--- a/kmos/kmo_priv_combine.c
+++ b/kmos/kmo_priv_combine.c
@@ -36,11 +36,13 @@
#include <string.h>
#include <cpl.h>
+
#include "kmclipm_constants.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"
@@ -53,6 +55,88 @@
*/
/*----------------------------------------------------------------------------*/
+// check if there is a short repeating pattern, if yes return this,
+// otherwise truncate
+char* kmo_shorten_ifu_string(const char* in)
+{
+ char *retstr = NULL,
+ *substr = NULL,
+ *found = NULL;
+ int lensubstr = 1,
+ pos = 0;
+
+ KMO_TRY
+ {
+
+ // create first substring of length one
+ KMO_TRY_EXIT_IF_NULL(
+ substr = calloc(strlen(in), sizeof(char)));
+ strncpy(substr, in, lensubstr);
+
+ // expand substring as much as possible
+ found = strstr(in+1, substr);
+ while ((found != NULL) && (strlen(substr)+strlen(found) != strlen(in))) {
+ lensubstr++;
+ strncpy(substr, in, lensubstr);
+ found = strstr(in+1, substr);
+ }
+
+ if (found != NULL) {
+ // check if substring applies to whole input string
+ pos = lensubstr;
+ found = strstr(in+pos, substr);
+ while ((found != NULL) && (pos + strlen(found) == strlen(in))) {
+ pos += lensubstr;
+ found = strstr(in+pos, substr);
+ }
+
+ if ((found == NULL) && (pos-1+lensubstr == (int)strlen(in))) {
+ // pattern repeating until the end, ok! Just assign anything to found
+ found = substr;
+ } else {
+ // pattern not completely repeatable
+ found = NULL;
+ }
+ }
+
+ if (found == NULL) {
+ // didn't find any pattern, just truncate it to length of 10
+ lensubstr = 10;
+ if ((int)strlen(in) < lensubstr) {
+ lensubstr = strlen(in);
+ }
+ strncpy(substr, in, lensubstr);
+
+ // replace all ; with _
+ found = strstr(substr, ";");
+ while (found != NULL) {
+ strncpy(found, "_", 1);
+ found = strstr(substr, ";");
+ }
+
+ KMO_TRY_EXIT_IF_NULL(
+ retstr = cpl_sprintf("_%s_etc", substr));
+ } else {
+ // replace all ; with _
+ found = strstr(substr, ";");
+ while (found != NULL) {
+ strncpy(found, "_", 1);
+ found = strstr(substr, ";");
+ }
+
+ KMO_TRY_EXIT_IF_NULL(
+ retstr = cpl_sprintf("_%s", substr));
+ }
+ }
+ KMO_CATCH
+ {
+ KMO_CATCH_MSG();
+ cpl_free(retstr); retstr = NULL;
+ }
+
+ return retstr;
+}
+
/**
@brief Apply the subpixelshift here using kmo_priv_shift()
@@ -253,6 +337,7 @@ cpl_error_code kmo_align_subpix(double *x, double *y,
@param flux If flux conservation should be applied
@param cube_combined_data (Output) The combined data cube
@param cube_combined_noise (Output) The combined noise cube
+ @param exp_mask (Output) The exposure time mask
@return xxx,
ang1 = 0.0,
@@ -280,7 +365,8 @@ cpl_error_code kmo_priv_combine(cpl_imagelist **cube_data,
const enum extrapolationType extrapolate,
int flux,
cpl_imagelist **cube_combined_data,
- cpl_imagelist **cube_combined_noise)
+ cpl_imagelist **cube_combined_noise,
+ cpl_image **exp_mask)
{
cpl_error_code err = CPL_ERROR_NONE;
int nz = 0,
@@ -318,7 +404,8 @@ cpl_error_code kmo_priv_combine(cpl_imagelist **cube_data,
yref = 0.0,
stderr = 0.0;
char *ext_name = NULL,
- *fn_shifts = NULL;
+ *fn_shifts = NULL,
+ *tmp_str = NULL;
const char *frname = NULL;
cpl_image *img_data_tmp = NULL,
*img_noise_tmp = NULL,
@@ -340,6 +427,7 @@ cpl_error_code kmo_priv_combine(cpl_imagelist **cube_data,
cpl_array *status = NULL;
float *pimg_data_tmp = NULL,
*pimg_noise_tmp = NULL,
+ *pexp_mask = NULL,
*p = NULL;
FILE *fid = NULL;
enum combine_status combStatus = combine_ok;
@@ -518,8 +606,7 @@ cpl_error_code kmo_priv_combine(cpl_imagelist **cube_data,
cpl_matrix_set(phys_ref, 0, 2, 1);
KMO_TRY_EXIT_IF_NULL(
- wcs_ref =
- cpl_wcs_new_from_propertylist(header_data[0]));
+ wcs_ref = cpl_wcs_new_from_propertylist(header_data[0]));
KMO_TRY_EXIT_IF_ERROR(
cpl_wcs_convert(wcs_ref, phys_ref, &world, &status,
@@ -861,32 +948,38 @@ cpl_error_code kmo_priv_combine(cpl_imagelist **cube_data,
*cube_combined_noise = cpl_imagelist_new());
}
+ if (exp_mask != NULL) {
+ KMO_TRY_EXIT_IF_NULL(
+ *exp_mask = cpl_image_new(nx_new, ny_new, CPL_TYPE_FLOAT));
+ KMO_TRY_EXIT_IF_NULL(
+ pexp_mask = cpl_image_get_data_float(*exp_mask));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_image_fill(*exp_mask,0.));
+ }
+
// loop through all slices
for (iz = 0; iz< nz; iz++) {
printf("\rCombining frames: %3d%% done", (int)(100*iz/nz));
+
// get all img-pointers to images of slice iz
for (i = 0; i < data_counter; i++) {
KMO_TRY_EXIT_IF_NULL(
- data_cur_img_list[i] =
- cpl_imagelist_get(cube_data[i], iz));
+ data_cur_img_list[i] = cpl_imagelist_get(cube_data[i], iz));
KMO_TRY_CHECK_ERROR_STATE();
+
if (noise_counter > 0) {
KMO_TRY_EXIT_IF_NULL(
- noise_cur_img_list[i] =
- cpl_imagelist_get(cube_noise[i], iz));
+ noise_cur_img_list[i] = cpl_imagelist_get(cube_noise[i], iz));
KMO_TRY_CHECK_ERROR_STATE();
}
}
KMO_TRY_EXIT_IF_NULL(
- img_data_tmp = cpl_image_new(nx_new, ny_new,
- CPL_TYPE_FLOAT));
+ img_data_tmp = cpl_image_new(nx_new, ny_new, CPL_TYPE_FLOAT));
KMO_TRY_EXIT_IF_NULL(
- pimg_data_tmp = cpl_image_get_data_float(img_data_tmp));
-
+ img_noise_tmp = cpl_image_new(nx_new, ny_new, CPL_TYPE_FLOAT));
KMO_TRY_EXIT_IF_NULL(
- img_noise_tmp = cpl_image_new(nx_new, ny_new,
- CPL_TYPE_FLOAT));
+ pimg_data_tmp = cpl_image_get_data_float(img_data_tmp));
KMO_TRY_EXIT_IF_NULL(
pimg_noise_tmp = cpl_image_get_data_float(img_noise_tmp));
@@ -973,6 +1066,9 @@ KMO_TRY_CHECK_ERROR_STATE();
&stderr,
0.,
&combStatus);
+ if (exp_mask != NULL) {
+ pexp_mask[ix+iy*nx_new] = nr_identified;
+ }
KMO_TRY_CHECK_ERROR_STATE();
} else {
// no data value here, reject pixel
@@ -1021,57 +1117,48 @@ kmclipm_vector_delete(kvn); kvn = NULL;
if (header_noise != NULL) {
ext_name = cpl_sprintf("IFU.[%s].NOISE", ifus_txt);
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_string(header_noise[0],
- EXTNAME, ext_name,
+ kmclipm_update_property_string(header_noise[0], EXTNAME, ext_name,
"FITS extension name"));
cpl_free(ext_name); ext_name = NULL;
}
+ cpl_free(tmp_str); tmp_str = NULL;
}
if (strcmp(name, "") != 0) {
ext_name = cpl_sprintf("%s.DATA", name);
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_string(header_data[0],
- EXTNAME, ext_name,
+ kmclipm_update_property_string(header_data[0], EXTNAME, ext_name,
"FITS extension name"));
cpl_free(ext_name); ext_name = NULL;
if (header_noise != NULL) {
ext_name = cpl_sprintf("%s.NOISE", name);
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_string(header_noise[0],
- EXTNAME, ext_name,
+ kmclipm_update_property_string(header_noise[0], EXTNAME, ext_name,
"FITS extension name"));
cpl_free(ext_name); ext_name = NULL;
}
+ cpl_free(tmp_str); tmp_str = NULL;
}
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_double(header_data[0],
- CRPIX1,
- cpl_propertylist_get_double(header_data[0], CRPIX1)
- + pxshifts[0],
+ kmclipm_update_property_double(header_data[0], CRPIX1,
+ cpl_propertylist_get_double(header_data[0], CRPIX1) + pxshifts[0],
"[pix] Reference pixel in x"));
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_double(header_data[0],
- CRPIX2,
- cpl_propertylist_get_double(header_data[0], CRPIX2)
- + pyshifts[0],
+ kmclipm_update_property_double(header_data[0], CRPIX2,
+ cpl_propertylist_get_double(header_data[0], CRPIX2) + pyshifts[0],
"[pix] Reference pixel in y"));
if (header_noise != NULL) {
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_double(header_noise[0],
- CRPIX1,
- cpl_propertylist_get_double(header_noise[0], CRPIX1)
- + pxshifts[0],
+ kmclipm_update_property_double(header_noise[0], CRPIX1,
+ cpl_propertylist_get_double(header_noise[0], CRPIX1) + pxshifts[0],
"[pix] Reference pixel in x"));
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_double(header_noise[0],
- CRPIX2,
- cpl_propertylist_get_double(header_noise[0], CRPIX2)
- + pyshifts[0],
+ kmclipm_update_property_double(header_noise[0], CRPIX2,
+ cpl_propertylist_get_double(header_noise[0], CRPIX2) + pyshifts[0],
"[pix] Reference pixel in y"));
}
} else {
diff --git a/kmos/kmo_priv_combine.h b/kmos/kmo_priv_combine.h
index 36629a4..399f991 100644
--- a/kmos/kmo_priv_combine.h
+++ b/kmos/kmo_priv_combine.h
@@ -38,6 +38,8 @@
* Prototypes
*----------------------------------------------------------------------------*/
+char* kmo_shorten_ifu_string(const char *in);
+
cpl_error_code kmo_align_subpix(double *x, double *y,
cpl_imagelist **data,
cpl_imagelist **noise,
@@ -75,7 +77,8 @@ cpl_error_code kmo_priv_combine(cpl_imagelist **cube_data,
const enum extrapolationType extrapolate,
int flux,
cpl_imagelist **cube_combined_data,
- cpl_imagelist **cube_combined_noise);
+ cpl_imagelist **cube_combined_noise,
+ cpl_image **exp_mask);
cpl_error_code kmo_edge_nan(cpl_imagelist *data,
int ifu_nr);
diff --git a/kmos/kmo_priv_dark.c b/kmos/kmo_priv_dark.c
index 8caf805..f382922 100644
--- a/kmos/kmo_priv_dark.c
+++ b/kmos/kmo_priv_dark.c
@@ -37,6 +37,7 @@
#include <math.h>
#include <cpl.h>
+
#include "kmclipm_math.h"
#include "kmo_utils.h"
diff --git a/kmos/kmo_priv_extract_spec.c b/kmos/kmo_priv_extract_spec.c
index 15434d7..8e3136c 100644
--- a/kmos/kmo_priv_extract_spec.c
+++ b/kmos/kmo_priv_extract_spec.c
@@ -36,6 +36,7 @@
#include <math.h>
#include <cpl.h>
+
#include "kmclipm_constants.h"
#include "kmclipm_functions.h"
diff --git a/kmos/kmo_priv_fit_profile.c b/kmos/kmo_priv_fit_profile.c
index 48d9943..f02b77e 100644
--- a/kmos/kmo_priv_fit_profile.c
+++ b/kmos/kmo_priv_fit_profile.c
@@ -28,6 +28,7 @@
#include <math.h>
#include <cpl.h>
+
#include "kmclipm_math.h"
#include "kmclipm_functions.h"
@@ -1282,11 +1283,11 @@ cpl_vector* kmo_image_fit_gauss(const cpl_image *img,
"[adu] intensity of the function"));
KMO_TRY_EXIT_IF_ERROR(
kmclipm_update_property_double(*pl, FIT_RADIUS_X,
- pfit_par[4],
+ fabs(pfit_par[4]),
"[pix] half axis length in x"));
KMO_TRY_EXIT_IF_ERROR(
kmclipm_update_property_double(*pl, FIT_RADIUS_Y,
- pfit_par[5],
+ fabs(pfit_par[5]),
"[pix] half axis length in y"));
KMO_TRY_EXIT_IF_ERROR(
kmclipm_update_property_double(*pl, FIT_ROTATION,
diff --git a/kmos/kmo_priv_fit_profile.h b/kmos/kmo_priv_fit_profile.h
index 81fad59..d761b85 100644
--- a/kmos/kmo_priv_fit_profile.h
+++ b/kmos/kmo_priv_fit_profile.h
@@ -34,6 +34,7 @@
#include <stdio.h>
#include <string.h>
+
#include <cpl.h>
/*------------------------------------------------------------------------------
diff --git a/kmos/kmo_priv_fits_check.c b/kmos/kmo_priv_fits_check.c
index 643671b..645acf6 100644
--- a/kmos/kmo_priv_fits_check.c
+++ b/kmos/kmo_priv_fits_check.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <cpl.h>
+
#include "kmclipm_constants.h"
#include "kmclipm_functions.h"
diff --git a/kmos/kmo_priv_fits_stack.c b/kmos/kmo_priv_fits_stack.c
index 1230110..00ed780 100644
--- a/kmos/kmo_priv_fits_stack.c
+++ b/kmos/kmo_priv_fits_stack.c
@@ -27,7 +27,9 @@
#include <math.h>
#include <string.h>
+
#include <cpl.h>
+
#include "kmclipm_constants.h"
#include "kmclipm_functions.h"
diff --git a/kmos/kmo_priv_flat.c b/kmos/kmo_priv_flat.c
index 8c27f9b..a08506d 100644
--- a/kmos/kmo_priv_flat.c
+++ b/kmos/kmo_priv_flat.c
@@ -38,6 +38,7 @@
#include <string.h>
#include <cpl.h>
+
#include "kmclipm_math.h"
#include "kmo_utils.h"
@@ -1051,6 +1052,68 @@ cpl_array** kmo_analize_ifu_edges(kmclipm_vector *pos,
return array;
}
+
+cpl_array** kmo_accept_all_ifu_edges(kmclipm_vector *pos,
+ cpl_array *ifu_inactive)
+{
+ int i = 0,
+ j = 0,
+ size = 0,
+ nr_ifu = 0;
+ double *ppos_valid = NULL;
+ cpl_vector *pos_valid = NULL;
+ cpl_array **array = NULL;
+
+ KMO_TRY
+ {
+ // allocate array of cpl_arrays to return and initialize to zero
+ KMO_TRY_EXIT_IF_NULL(
+ array = (cpl_array**)cpl_malloc(KMOS_IFUS_PER_DETECTOR * sizeof(cpl_array*)));
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ array[i] = NULL;
+ }
+
+ KMO_TRY_EXIT_IF_NULL(
+ pos_valid = kmclipm_vector_create_non_rejected(pos));
+ size = cpl_vector_get_size(pos_valid);
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ //
+ // check if we have all 224 edges, then just fill them into the array
+ //
+ if (size == 224) {
+ KMO_TRY_EXIT_IF_NULL(
+ ppos_valid = cpl_vector_get_data(pos_valid));
+ j = 0;
+ for (nr_ifu = 1; nr_ifu <= KMOS_IFUS_PER_DETECTOR; nr_ifu++) {
+ if (cpl_array_get_int(ifu_inactive, nr_ifu-1, NULL) == 1) {
+ // IFU has been set inactive. dismiss found edges and continue
+ } else {
+ // fill array
+ KMO_TRY_EXIT_IF_NULL(
+ array[nr_ifu-1] = cpl_array_new(2*KMOS_SLITLET_Y, CPL_TYPE_INT));
+ for (i = 0; i < 2*KMOS_SLITLET_Y; i++) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_array_set_int(array[nr_ifu-1], i, ppos_valid[j++]));
+ }
+ }
+ }
+ }
+ }
+ KMO_CATCH
+ {
+ KMO_CATCH_MSG();
+ for (i = 0; i < KMOS_IFUS_PER_DETECTOR; i++) {
+ cpl_array_delete(array[i]); array[i] = NULL;
+ }
+ cpl_free(array); array = NULL;
+ }
+
+ cpl_vector_delete(pos_valid); pos_valid = NULL;
+
+ return array;
+}
+
/**
@brief
Checks if gaps are uniform (starting from left).
@@ -1242,7 +1305,9 @@ cpl_array** kmo_analyze_flat(const cpl_image* data,
tmp_stddev = 0.0,
tmp_stderr = 0.0;
kmclipm_vector *midline = NULL,
- *pos = NULL,
+ *pos1 = NULL,
+ *pos2 = NULL,
+ *pos3 = NULL,
*dbg_level = NULL,
*dbg_value = NULL;
cpl_image *tmp_data = NULL;
@@ -1303,47 +1368,92 @@ cpl_array** kmo_analyze_flat(const cpl_image* data,
//
// get slitlet edges the standard way, assuming all slitlets are well shaped
//
- pos = kmo_analize_slitedges(midline, thresh,
- &dbg_value, &dbg_level, &dbg_pos);
- KMO_TRY_CHECK_ERROR_STATE();
+ ok = TRUE;
+ pos1 = kmo_analize_slitedges(midline, thresh, &dbg_value, &dbg_level, &dbg_pos);
+ cpl_error_reset();
- if (pos != NULL) {
+ if (pos1 != NULL) {
cpl_msg_severity msg_level = cpl_msg_get_level();
cpl_msg_set_level(CPL_MSG_OFF);
- array = kmo_analize_ifu_edges(pos, ifu_inactive, FALSE, FALSE, nx);
+ array = kmo_analize_ifu_edges(pos1, ifu_inactive, FALSE, FALSE, nx);
cpl_msg_set_level(msg_level);
if (array == NULL) {
- kmclipm_vector_delete(pos); pos = NULL;
+ ok = FALSE;
cpl_error_reset();
}
+ } else {
+ ok = FALSE;
}
- if (pos == NULL) {
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ if (!ok) {
// slitlets malformed, check for slit/gap-width etc, reject these edges
// threshold is halved
- pos = kmo_analize_slitedges_advanced(midline, thresh/2, &cut_first, &cut_last);
- KMO_TRY_CHECK_ERROR_STATE();
+ ok = TRUE;
+ pos2 = kmo_analize_slitedges_advanced(midline, thresh/2, &cut_first, &cut_last);
+ cpl_error_reset();
- if (pos != NULL) {
+ if (pos2 != NULL) {
cpl_msg_severity msg_level = cpl_msg_get_level();
cpl_msg_set_level(CPL_MSG_OFF);
- array = kmo_analize_ifu_edges(pos, ifu_inactive, cut_first, cut_last, nx);
+ array = kmo_analize_ifu_edges(pos2, ifu_inactive, cut_first, cut_last, nx);
cpl_msg_set_level(msg_level);
if (array == NULL) {
- kmclipm_vector_delete(pos); pos = NULL;
+ ok = FALSE;
cpl_error_reset();
}
+ } else {
+ ok = FALSE;
}
+ KMO_TRY_CHECK_ERROR_STATE();
- if (pos == NULL) {
- // try again with threshold of 3/4
- pos = kmo_analize_slitedges_advanced(midline, thresh*3./4., &cut_first, &cut_last);
- KMO_TRY_CHECK_ERROR_STATE();
+ if (!ok) {
+ // try again with threshold of 3/4
+ ok =TRUE;
+ pos3 = kmo_analize_slitedges_advanced(midline, thresh*3./4., &cut_first, &cut_last);
+ cpl_error_reset();
+
+ if (pos3 != NULL) {
+ cpl_msg_severity msg_level = cpl_msg_get_level();
+ cpl_msg_set_level(CPL_MSG_OFF);
+ array = kmo_analize_ifu_edges(pos3, ifu_inactive, cut_first, cut_last, nx);
+ cpl_msg_set_level(msg_level);
+ if (array == NULL) {
+ ok = FALSE;
+ cpl_error_reset();
+ }
+ } else {
+ ok = FALSE;
+ }
+ KMO_TRY_CHECK_ERROR_STATE();
- if (pos != NULL) {
- array = kmo_analize_ifu_edges(pos, ifu_inactive, cut_first, cut_last, nx);
- }
+ if (!ok) {
+ // slitlets definitely malformed
+ // If pos has size 224, at least all edges have been detected,
+ // but the gap-size/slitlet-size are malformed
+ // Last Chance: Accept slitlets anyway, emit warning about vignetting
+ cpl_msg_warning("","**************************************************************");
+ cpl_msg_warning("","* Detected all edges of all IFUs, but they seem strongly *");
+ cpl_msg_warning("","* vignetted! Please check the raw input frame! *");
+ cpl_msg_warning("","* It is strongly recommended using other flat exposures! *");
+ cpl_msg_warning("","**************************************************************");
+ kmclipm_vector *ggg = NULL;
+ if ((pos1 != NULL) && (kmclipm_vector_count_non_rejected(pos1) == 224)) {
+ ggg = pos1;
+ } else if ((pos2 != NULL) && (kmclipm_vector_count_non_rejected(pos2) == 224)) {
+ ggg = pos2;
+ } else if ((pos3 != NULL) && (kmclipm_vector_count_non_rejected(pos3) == 224)) {
+ ggg = pos3;
+ } else {
+ // Do nothing everything failed....
+ }
+ if (ggg != NULL) {
+ array = kmo_accept_all_ifu_edges(ggg, ifu_inactive);
+ }
+ }
}
}
+ KMO_TRY_CHECK_ERROR_STATE();
if (array != NULL) {
// snyc array and ifu_inactive
@@ -1377,13 +1487,14 @@ cpl_array** kmo_analyze_flat(const cpl_image* data,
KMO_CATCH
{
KMO_CATCH_MSG();
- kmclipm_vector_delete(pos); pos = NULL;
}
kmclipm_vector_delete(midline); midline = NULL;
kmclipm_vector_delete(dbg_level); dbg_level = NULL;
kmclipm_vector_delete(dbg_value); dbg_value = NULL;
- kmclipm_vector_delete(pos); pos = NULL;
+ kmclipm_vector_delete(pos1); pos1 = NULL;
+ kmclipm_vector_delete(pos2); pos2 = NULL;
+ kmclipm_vector_delete(pos3); pos3 = NULL;
return array;
}
diff --git a/kmos/kmo_priv_flat.h b/kmos/kmo_priv_flat.h
index 5f9a4ed..17af4b9 100644
--- a/kmos/kmo_priv_flat.h
+++ b/kmos/kmo_priv_flat.h
@@ -33,6 +33,7 @@
*----------------------------------------------------------------------------*/
#include <cpl.h>
+
#include "kmclipm_vector.h"
extern double slit_tol;
@@ -68,12 +69,17 @@ kmclipm_vector* kmo_analize_slitedges_advanced(
int *cut_first,
int *cut_last);
-cpl_array** kmo_analize_ifu_edges(kmclipm_vector *pos,
+cpl_array** kmo_analize_ifu_edges(
+ kmclipm_vector *pos,
cpl_array *ifu_inactive,
int cut_first,
int cut_last,
int nx);
+cpl_array** kmo_accept_all_ifu_edges(
+ kmclipm_vector *pos,
+ cpl_array *ifu_inactive);
+
cpl_error_code kmo_get_slit_gap(const cpl_vector *pos,
cpl_vector **slits,
cpl_vector **gaps);
diff --git a/kmos/kmo_priv_functions.h b/kmos/kmo_priv_functions.h
index cad2281..842439d 100644
--- a/kmos/kmo_priv_functions.h
+++ b/kmos/kmo_priv_functions.h
@@ -33,6 +33,7 @@
*----------------------------------------------------------------------------*/
#include <cpl.h>
+
#include <kmclipm_vector.h>
/*------------------------------------------------------------------------------
diff --git a/kmos/kmo_priv_lcorr.c b/kmos/kmo_priv_lcorr.c
index 70cefb3..00949dd 100644
--- a/kmos/kmo_priv_lcorr.c
+++ b/kmos/kmo_priv_lcorr.c
@@ -46,12 +46,15 @@
#include <math.h>
#include <stdio.h>
+
#include <cpl.h>
-#include "kmo_error.h"
+
#include "kmclipm_constants.h"
+#include "kmclipm_priv_splines.h"
+
+#include "kmo_error.h"
#include "kmo_priv_extract_spec.h"
#include "kmo_priv_lcorr.h"
-#include "kmclipm_priv_splines.h"
#include "kmo_priv_fit_profile.h"
FILE *IDL = NULL;
diff --git a/kmos/kmo_priv_lcorr.h b/kmos/kmo_priv_lcorr.h
index 5696472..906d43f 100644
--- a/kmos/kmo_priv_lcorr.h
+++ b/kmos/kmo_priv_lcorr.h
@@ -34,7 +34,7 @@
#include <cpl.h>
-#include <kmclipm_functions.h>
+#include "kmclipm_functions.h"
/*-----------------------------------------------------------------------------
* Types
diff --git a/kmos/kmo_priv_multi_reconstruct.c b/kmos/kmo_priv_multi_reconstruct.c
index 9c74988..f0a4eb3 100644
--- a/kmos/kmo_priv_multi_reconstruct.c
+++ b/kmos/kmo_priv_multi_reconstruct.c
@@ -49,15 +49,14 @@
#include "kmclipm_constants.h"
#include "kmclipm_math.h"
#include "kmclipm_functions.h"
-
#include "kmclipm_priv_reconstruct.h"
+
#include "kmo_priv_reconstruct.h"
#include "kmo_priv_multi_reconstruct.h"
#include "kmo_functions.h"
#include "kmo_priv_functions.h"
#include "kmo_dfs.h"
#include "kmo_error.h"
-
#include "kmo_priv_fit_profile.h"
#include "kmo_priv_shift.h"
#include "kmo_priv_noise_map.h"
@@ -164,6 +163,7 @@ cpl_imagelist** kmo_mr_create_datacubes(armNameStruct *arm_name_struct,
ycal_frame,
lcal_frame,
NULL,
+ NULL,
&gd,
&cube_data,
&cube_noise,
diff --git a/kmos/kmo_priv_reconstruct.c b/kmos/kmo_priv_reconstruct.c
index a8a33ab..215376c 100644
--- a/kmos/kmo_priv_reconstruct.c
+++ b/kmos/kmo_priv_reconstruct.c
@@ -36,6 +36,7 @@
#include <string.h>
#include <cpl.h>
+
#include "kmclipm_constants.h"
#include "kmclipm_math.h"
diff --git a/kmos/kmo_priv_reconstruct.h b/kmos/kmo_priv_reconstruct.h
index 804b719..b35960b 100644
--- a/kmos/kmo_priv_reconstruct.h
+++ b/kmos/kmo_priv_reconstruct.h
@@ -33,6 +33,7 @@
*----------------------------------------------------------------------------*/
#include <cpl.h>
+
#include "kmclipm_functions.h"
/*------------------------------------------------------------------------------
diff --git a/kmos/kmo_priv_rotate.h b/kmos/kmo_priv_rotate.h
index d0bb338..c1d8148 100644
--- a/kmos/kmo_priv_rotate.h
+++ b/kmos/kmo_priv_rotate.h
@@ -33,6 +33,7 @@
*----------------------------------------------------------------------------*/
#include <cpl.h>
+
#include "kmclipm_constants.h"
#include "kmclipm_functions.h"
diff --git a/kmos/kmo_priv_shift.c b/kmos/kmo_priv_shift.c
index 7ddab9f..2ba4a3e 100644
--- a/kmos/kmo_priv_shift.c
+++ b/kmos/kmo_priv_shift.c
@@ -36,6 +36,7 @@
#include <math.h>
#include <cpl.h>
+
#include "kmclipm_constants.h"
#include "kmo_debug.h"
@@ -78,6 +79,7 @@
NONE_NANS, RESIZE_BCS_NATURAL, RESIZE_BCS_ESTIMATED,
RESIZE_NANS)
+
@return
The function returns CPL_ERROR_NONE on success or a CPL error code
otherwise.
diff --git a/kmos/kmo_priv_sky_tweak.c b/kmos/kmo_priv_sky_tweak.c
index 3b0ccf3..a7c6762 100644
--- a/kmos/kmo_priv_sky_tweak.c
+++ b/kmos/kmo_priv_sky_tweak.c
@@ -36,12 +36,15 @@
#include <math.h>
#include <string.h>
#include <stdio.h>
+
#include <cpl.h>
-#include "kmo_error.h"
+
#include "kmclipm_constants.h"
+#include "kmclipm_priv_splines.h"
#include "kmclipm_math.h"
+
+#include "kmo_error.h"
#include "kmo_priv_sky_tweak.h"
-#include "kmclipm_priv_splines.h"
#include "kmo_priv_lcorr.h"
#include "kmo_utils.h"
@@ -60,7 +63,7 @@ void amoeba(double **p, double y[], int ndim, double ftol,
double amotry(double **p, double y[], double psum[], int ndim,
double (*funk)(double []), int ihi, double fac);
int i,ihi,ilo,inhi,j,mpts=ndim+1;
- double rtol,sum,swap,ysave,ytry,*psum;
+ double rtol, sum, swap, ysave, ytry, *psum = NULL;
psum=vector(ndim+1);
*nfunk=0;
@@ -109,7 +112,7 @@ double amotry(double **p, double y[], double psum[], int ndim,
double (*funk)(double []), int ihi, double fac)
{
int j;
- double fac1,fac2,ytry,*ptry;
+ double fac1,fac2,ytry,*ptry=NULL;
ptry=vector(ndim+1);
fac1=(1.0-fac)/ndim;
@@ -133,12 +136,12 @@ double amotry(double **p, double y[], double psum[], int ndim,
int cont_region_size,
line_region_size;
-double *cont_sky_intensities,
- *line_sky_intensities,
- *cont_object_intensities,
- *line_object_intensities,
- *cont_lambda,
- *line_lambda;
+double *cont_sky_intensities=NULL,
+ *line_sky_intensities=NULL,
+ *cont_object_intensities=NULL,
+ *line_object_intensities=NULL,
+ *cont_lambda=NULL,
+ *line_lambda=NULL;
double fitsky(double *p) {
double result = 0.;
@@ -168,9 +171,9 @@ double fitsky(double *p) {
}
int spectrum_size;
-double *spectrum_lambda;
-double *spectrum_value;
-double *thermal_background;
+double *spectrum_lambda=NULL;
+double *spectrum_value=NULL;
+double *thermal_background=NULL;
#define HC_K 14387.7512979 // h*c/k in [micrometer*K]
#define PLANCK(lambda,t) (pow((lambda),-5.0) / (exp(HC_K/((lambda) * fabs(t))) - 1.))
@@ -395,8 +398,8 @@ double get_average_disregarding_outliers (const cpl_vector *vdata) {
*tmpv2 = NULL,
*tmpv3 = NULL,
*tmpv4 = NULL;
- const double *data;
- double *tmpv1_data;
+ const double *data=NULL;
+ double *tmpv1_data=NULL;
KMO_TRY {
@@ -458,8 +461,8 @@ cpl_error_code kmo_priv_sky_tweak_get_spectra(const cpl_imagelist *object,
*intsky = NULL;
const cpl_image *oimg = NULL,
*simg = NULL;
- double *intobj_data,
- *intsky_data;
+ double *intobj_data=NULL,
+ *intsky_data=NULL;
int nx = 0,
ny = 0,
nz = 0;
@@ -470,8 +473,8 @@ cpl_error_code kmo_priv_sky_tweak_get_spectra(const cpl_imagelist *object,
nr_valid_int = 0;
int m_is_rejected, o_is_rejected, s_is_rejected;
double mpix, opix, spix;
- cpl_vector *ovec,
- *svec;
+ cpl_vector *ovec=NULL,
+ *svec=NULL;
KMO_TRY {
@@ -563,13 +566,13 @@ cpl_error_code kmo_priv_sky_tweak_get_spectra(const cpl_imagelist *object,
}
if (no_nans) {
- cpl_vector *new_lambda,
- *new_intobj,
- *new_intsky;
- double *new_lambda_d,
- *new_intobj_d,
- *new_intsky_d;
- const double *lambda_d;
+ cpl_vector *new_lambda=NULL,
+ *new_intobj=NULL,
+ *new_intsky=NULL;
+ double *new_lambda_d=NULL,
+ *new_intobj_d=NULL,
+ *new_intsky_d=NULL;
+ const double *lambda_d=NULL;
KMO_TRY_EXIT_IF_NULL(
new_lambda = cpl_vector_new(nr_valid_int));
@@ -660,16 +663,17 @@ cpl_bivector* kmo_priv_sky_tweak_correct_vibrational_trans(
*tmp1_s = NULL,
*tmp3_s = NULL,
*tmp4_d = NULL,
- *line_interpolate_object,
- *line_interpolate_sky,
- *flineres;
+ *line_interpolate_object=NULL,
+ *line_interpolate_sky=NULL,
+ *flineres=NULL;
cpl_vector *tmp1_l_v = NULL,
*tmp1_o_v = NULL,
*tmp1_s_v = NULL,
// *tmp2_l_v = NULL,
// *tmp2_o_v = NULL,
*tmp2_s_v = NULL,
- *tmp3_s_v = NULL/*,
+ *tmp3_s_v = NULL,
+ *tmp4_v = NULL;/*,
*tmp_i_v = NULL*/;
KMO_TRY {
@@ -765,7 +769,6 @@ cpl_bivector* kmo_priv_sky_tweak_correct_vibrational_trans(
}
// cpl_vector *tmp3_v;
- cpl_vector *tmp4_v;
// KMO_TRY_EXIT_IF_NULL(
// tmp4_v = cpl_vector_filter_median_create(tmp3_s_v,line_full_width/2));
KMO_TRY_EXIT_IF_NULL(
@@ -970,10 +973,10 @@ cpl_bivector* kmo_priv_sky_tweak_correct_vibrational_trans(
cpl_free(line_interpolate_sky); line_interpolate_sky = NULL; }
nr_transitions++;
- }
+ } // if (nr_samples != 0)
cpl_msg_debug(__func__, "%s", dbg_message);
dbg_message[0] = '\0';
- }
+ } // end for (ix = 0; ix<nr_boundaries-1; ix++)
// check for outliers in the scaling factors
int nr_valid = 0,
@@ -1048,6 +1051,7 @@ cpl_bivector* kmo_priv_sky_tweak_correct_vibrational_trans(
if (tmp1_l_v != NULL) { cpl_vector_delete(tmp1_l_v); }
if (tmp1_o_v != NULL) { cpl_vector_delete(tmp1_o_v); }
if (tmp1_s_v != NULL) { cpl_vector_delete(tmp1_s_v); }
+ if (tmp4_v != NULL) { cpl_vector_delete(tmp4_v); tmp4_v = NULL; }
return result;
}
diff --git a/kmos/kmo_priv_stats.c b/kmos/kmo_priv_stats.c
index c11ae75..e164ab1 100644
--- a/kmos/kmo_priv_stats.c
+++ b/kmos/kmo_priv_stats.c
@@ -36,6 +36,7 @@
#include <string.h>
#include <cpl.h>
+
#include "kmclipm_math.h"
#include "kmclipm_functions.h"
#include "kmclipm_vector.h"
diff --git a/kmos/kmo_priv_stats.h b/kmos/kmo_priv_stats.h
index 1164e43..c5874ba 100644
--- a/kmos/kmo_priv_stats.h
+++ b/kmos/kmo_priv_stats.h
@@ -33,6 +33,7 @@
*----------------------------------------------------------------------------*/
#include <cpl.h>
+
#include "kmclipm_vector.h"
/*------------------------------------------------------------------------------
diff --git a/kmos/kmo_priv_std_star.c b/kmos/kmo_priv_std_star.c
index 6600304..0bd840b 100644
--- a/kmos/kmo_priv_std_star.c
+++ b/kmos/kmo_priv_std_star.c
@@ -38,10 +38,12 @@
#include <math.h>
#include <cpl.h>
+
#include "kmclipm_math.h"
#include "kmo_priv_std_star.h"
#include "kmo_priv_functions.h"
+#include "kmo_functions.h"
#include "kmo_cpl_extensions.h"
#include "kmo_priv_fit_profile.h"
#include "kmo_dfs.h"
@@ -500,7 +502,7 @@ cpl_vector* kmo_interpolate_vector_wcs(const cpl_frame *frame,
data_in = data_in_new;
}
- cpl_msg_warning("", "The desired wavelength range (%g-%g) is "
+ cpl_msg_warning("", " The desired wavelength range (%g-%g) is "
"larger than the one from frame %s (%g-%g)! The "
"values outside the range (%g-%g) are set to zero!",
lambda_min_out, lambda_max_out,
@@ -783,7 +785,7 @@ cpl_error_code kmo_remove_line(cpl_vector *spectrum,
line_center, min, &pl, 1);
if (fit_par == NULL) {
- cpl_msg_warning("","Couldn't identify the line at %g [um]!", line_center);
+ cpl_msg_warning(""," Couldn't identify the line at %g [um]!", line_center);
cpl_error_reset();
if (plot_it) {
@@ -821,7 +823,7 @@ cpl_error_code kmo_remove_line(cpl_vector *spectrum,
KMO_TRY_EXIT_IF_ERROR(
cpl_vector_multiply(spectrum_range, atmos_range));
- cpl_msg_info("", "Removed line at %g [um]", line_center);
+ cpl_msg_info("", " Removed line at %g [um]", line_center);
if (plot_it) {
char *ssstr = cpl_sprintf("lambda%d.fits", cnter);
@@ -1030,14 +1032,14 @@ double kmo_calc_zeropoint(double magnitude1,
if (strcmp(filter_id, "HK") == 0) {
bandwidth = LAMBDA_MAX_K - LAMBDA_MIN_K;
zp2 = magnitude2 + 2.5*log10(counts_band2 * cdelt / bandwidth);
- cpl_msg_info("", "Zeropoint in H: %g", zp1);
- cpl_msg_info("", "Zeropoint in K: %g", zp2);
+ cpl_msg_info("", " Zeropoint in H: %g", zp1);
+ cpl_msg_info("", " Zeropoint in K: %g", zp2);
// take average of zeropoints for QC keyword
zp1 = (zp1 + zp2) / 2;
- cpl_msg_info("", "Avg. zeropoint: %g (to be stored as QC parameter)", zp1);
+ cpl_msg_info("", " Avg. zeropoint: %g (to be stored as QC parameter)", zp1);
} else {
- cpl_msg_info("", "Zeropoint: %g", zp1);
+ cpl_msg_info("", " Zeropoint: %g", zp1);
}
}
KMO_CATCH
@@ -1471,11 +1473,7 @@ cpl_error_code kmo_calc_band_mean(const cpl_propertylist *pl,
//
// calculate mean noise
//
- if (noise != NULL) {
- KMO_TRY_ASSURE(mean_noise != 0,
- CPL_ERROR_NULL_INPUT,
- "Not all input data is provided!");
-
+ if ((noise != NULL) && (mean_noise != NULL)) {
size = cpl_vector_get_size(noise);
KMO_TRY_EXIT_IF_NULL(
ptmp_spec_noise = cpl_vector_get_data_const(noise));
@@ -1516,7 +1514,7 @@ cpl_error_code kmo_calc_band_mean(const cpl_propertylist *pl,
KMO_CATCH_MSG();
ret_err = cpl_error_get_code();
*mean_data = 0.;
- if (noise != NULL) {
+ if ((noise != NULL) && (mean_noise != NULL)) {
*mean_noise = 0.;
}
}
@@ -1524,4 +1522,125 @@ cpl_error_code kmo_calc_band_mean(const cpl_propertylist *pl,
return ret_err;
}
+/**
+ @brief
+ Creates a skySkyStruct containing pairs of sky frames
+
+ @param frameset The frameset only containing STD frames
+
+ @return The skySkyStruct
+
+*/
+skySkyStruct* kmo_create_skySkyStruct(cpl_frameset *frameset)
+{
+ int nrIfu = 0,
+ nrFrame = 0;
+ char *tmp_str = NULL;
+ const char *filename1 = NULL,
+ *filename2 = NULL,
+ *type1 = NULL,
+ *type2 = NULL;
+ cpl_frame *frame1 = NULL,
+ *frame2 = NULL;
+ cpl_propertylist *header1 = NULL,
+ *header2 = NULL;
+ skySkyStruct *sky_sky_struct = NULL;
+ objSkyStruct *tmp_obj_sky_struct = NULL;
+
+ KMO_TRY
+ {
+ KMO_TRY_ASSURE((frameset != NULL),
+ CPL_ERROR_NULL_INPUT,
+ "Not all input data is provided!");
+
+ KMO_TRY_EXIT_IF_NULL(
+ sky_sky_struct = (skySkyStruct*)cpl_calloc(KMOS_NR_IFUS, sizeof(skySkyStruct)));
+ for (nrIfu = 0; nrIfu < KMOS_NR_IFUS; nrIfu++) {
+ sky_sky_struct[nrIfu].nrSkyPairs = 0;
+ sky_sky_struct[nrIfu].skyPairs = NULL;
+ }
+
+ // creating a temporary objSkyStruct which holds all STD frames
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_obj_sky_struct = kmo_create_objSkyStruct(frameset, STD, TRUE));
+
+ // loop first all IFUs
+ for (nrIfu = 0; nrIfu < KMOS_NR_IFUS; nrIfu++) {
+ // loop all frames
+ for (nrFrame = 0; nrFrame < tmp_obj_sky_struct->size; nrFrame++) {
+ frame1 = tmp_obj_sky_struct->table[nrFrame].objFrame;
+ KMO_TRY_EXIT_IF_NULL(
+ filename1 = cpl_frame_get_filename(frame1));
+ if (nrFrame+1 < tmp_obj_sky_struct->size) {
+ // got 2 subsequent frames
+ frame2 = tmp_obj_sky_struct->table[nrFrame+1].objFrame;
+ KMO_TRY_EXIT_IF_NULL(
+ filename2 = cpl_frame_get_filename(frame2));
+
+ // load headers and check if 2 skies present in their IFU
+ KMO_TRY_EXIT_IF_NULL(
+ header1 = kmclipm_propertylist_load(filename1, 0));
+ KMO_TRY_EXIT_IF_NULL(
+ header2 = kmclipm_propertylist_load(filename2, 0));
+
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_str = cpl_sprintf("%s%d%s", IFU_TYPE_PREFIX, nrIfu+1, IFU_TYPE_POSTFIX));
+
+ if (cpl_propertylist_has(header1, tmp_str) && cpl_propertylist_has(header2, tmp_str)) {
+ KMO_TRY_EXIT_IF_NULL(
+ type1 = cpl_propertylist_get_string(header1, tmp_str));
+ KMO_TRY_EXIT_IF_NULL(
+ type2 = cpl_propertylist_get_string(header2, tmp_str));
+
+ if ((strcmp(type1, "S") == 0) && (strcmp(type1, type2) == 0)) {
+ // both contain skies, store them in new skyPair
+ int my_size = sky_sky_struct[nrIfu].nrSkyPairs;
+ KMO_TRY_EXIT_IF_NULL(
+ sky_sky_struct[nrIfu].skyPairs = cpl_realloc(sky_sky_struct[nrIfu].skyPairs, (my_size+1) * sizeof(skySkyPair)));
+
+ sky_sky_struct[nrIfu].skyPairs[my_size].skyFrame1 = frame1;
+ sky_sky_struct[nrIfu].skyPairs[my_size].skyFrame2 = frame2;
+
+ sky_sky_struct[nrIfu].nrSkyPairs++;
+
+ // successfully found a 2nd sky, increment nrFrame twice!
+ nrFrame++;
+ }
+ }
+ cpl_propertylist_delete(header1); header1 = NULL;
+ cpl_propertylist_delete(header2); header2 = NULL;
+ cpl_free(tmp_str); tmp_str = NULL;
+ } else {
+ // only one frame left, ignore it
+ }
+ } // end for (nrFrame)
+ } // end for (nrIfu)
+ } KMO_CATCH {
+ KMO_CATCH_MSG();
+ sky_sky_struct = NULL;
+ }
+
+ kmo_delete_objSkyStruct(tmp_obj_sky_struct);
+
+ return sky_sky_struct;
+}
+
+/**
+ @brief
+ Delete an skySkyStruct properly
+
+ @param skySkyStruct The structure to delete
+*/
+void kmo_delete_skySkyStruct(skySkyStruct *sky_sky_struct)
+{
+ int i = 0;
+
+ if (sky_sky_struct != NULL) {
+ 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;
+ }
+}
+
/** @{ */
diff --git a/kmos/kmo_priv_std_star.h b/kmos/kmo_priv_std_star.h
index 47e9e45..53733cb 100644
--- a/kmos/kmo_priv_std_star.h
+++ b/kmos/kmo_priv_std_star.h
@@ -33,6 +33,7 @@
*----------------------------------------------------------------------------*/
#include <cpl.h>
+
#include "kmclipm_constants.h"
/*-----------------------------------------------------------------------------
@@ -46,6 +47,16 @@ typedef struct {
cpl_frame *skyframes[KMOS_NR_IFUS];
} objSkyFrameTableStruct;
+typedef struct {
+ cpl_frame *skyFrame1;
+ cpl_frame *skyFrame2;
+} skySkyPair;
+
+typedef struct {
+ int nrSkyPairs;
+ skySkyPair *skyPairs;
+} skySkyStruct;
+
#define NO_CORRESPONDING_SKYFRAME ((cpl_frame* ) -1)
/*------------------------------------------------------------------------------
@@ -120,4 +131,10 @@ cpl_error_code kmo_calc_band_mean(
const cpl_vector *noise,
double *mean_data,
double *mean_noise);
+
+skySkyStruct* kmo_create_skySkyStruct(
+ cpl_frameset *frameset);
+
+void kmo_delete_skySkyStruct(
+ skySkyStruct *sky_sky_struct);
#endif
diff --git a/kmos/kmo_priv_wave_cal.c b/kmos/kmo_priv_wave_cal.c
index 464f531..19ec268 100644
--- a/kmos/kmo_priv_wave_cal.c
+++ b/kmos/kmo_priv_wave_cal.c
@@ -49,6 +49,8 @@
#include <cpl.h>
+#include "irplib_wlxcorr.h"
+
#include "kmo_utils.h"
#include "kmo_error.h"
#include "kmo_dfs.h"
@@ -60,7 +62,6 @@
#include "kmo_cpl_extensions.h"
#include "kmo_priv_functions.h"
#include "kmo_debug.h"
-#include "../irplib/irplib_wlxcorr.h"
/*----------------------------------------------------------------------------*/
/**
@@ -5589,9 +5590,9 @@ cpl_error_code kmo_calc_qc_wave_cal(const cpl_imagelist *cube,
kmclipm_vector_reject(gpos, ix+iy*nx);
kmclipm_vector_reject(gfwhm, ix+iy*nx);
kmclipm_vector_reject(gpeak, ix+iy*nx);
- cpl_error_reset();
err = CPL_ERROR_NONE;
}
+ cpl_error_reset();// error status must be reset anyway also if err==CPL_ERROR_NONE
}
}
cpl_vector_delete(y); y = NULL;
diff --git a/kmos/kmo_test_create_data.h b/kmos/kmo_test_create_data.h
deleted file mode 100644
index e867a28..0000000
--- a/kmos/kmo_test_create_data.h
+++ /dev/null
@@ -1,288 +0,0 @@
-/* $Id: kmo_test_create_data.h,v 1.4 2012-11-09 12:58:37 aagudo Exp $
- *
- * This file is part of the KMOS Pipeline
- * Copyright (C) 2002,2003 European Southern Observatory
- *
- * 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
- *
- * Automatic data generation functions
- *
- * who when what
- * -------- ---------- ----------------------------------------------
- * aagudo 2008-02-06 created
- *
- * The functions in this file are only used in functions generating test data
- * in kmos/tests and recipes/tests, therefore no test functions are provided
- * for the functions present here. (This file has to be loccated here since it
- * is referred to from kmos/tests and recipes/tests)
- *
- */
-
-/*
- * $Author: aagudo $
- * $Date: 2012-11-09 12:58:37 $
- * $Revision: 1.4 $
- * $Name: not supported by cvs2svn $
- */
-
-#ifndef KMOS_TEST_CREATE_DATA_H
-#define KMOS_TEST_CREATE_DATA_H
-
-#include <sys/stat.h>
-
-#include <cpl.h>
-
-extern float test_global_seed_data;
-extern float test_global_seed_noise;
-
-extern int test_global_size_x;
-extern int test_global_size_y;
-extern int test_global_size_z;
-extern int test_global_nr_frames;
-extern int test_global_valid[];
-
-extern const char *test_global_path_test_data;
-extern const char *test_global_path_ref_data;
-extern const char *test_global_raw_path;
-
-/* ---------------------- test-functions ------------------------------------ */
-int kmo_test_file_exists(const char *name);
-
-const char* kmo_test_cat_strings(char *newstr,
- const char *string1,
- const char *string2);
-
-void kmo_test_verbose_off();
-
-void kmo_test_verbose_on();
-
-const char* kmo_test_esorex_verbose();
-
-void kmo_get_pipe_command(char *cmd,
- const char *filename,
- const char *sof,
- int extend);
-
-double kmo_test_esorex_data(const char* filename, int dont_lower);
-
-void kmo_test_create_pipeline_data();
-void kmo_test_create_pipeline_data_core(const char * subpath, const char *log_path);
-
-cpl_frame* kmo_test_frame_new(const char *filename,
- const char *tag,
- cpl_frame_group group);
-
-cpl_error_code kmo_test_update_keywords(cpl_propertylist *pl,
- char *keys[],
- char *vals[],
- int types[],
- int nr_keys);
-
-void kmo_test_fill_vector(cpl_vector *vec,
- float seed,
- float offset);
-
-void kmo_test_fill_image(cpl_image *img,
- float seed,
- float offset);
-
-void kmo_test_fill_cube(cpl_imagelist *cube,
- float seed,
- float offset);
-
-void kmo_test_fill_mask(cpl_image *img);
-
-void kmo_test_alloc_cube(cpl_imagelist *cube,
- int x,
- int y,
- int z);
-
-void kmo_test_init_vec(cpl_vector *vec);
-
-cpl_imagelist* kmo_test_create_cube(int x, int y, int z, int gauss, int *offset);
-
-void kmo_test_create_primary_extension(const char *filename,
- char *primary_keys[],
- char *primary_vals[],
- int primary_types[],
- int nr_primary_keys);
-
-int kmo_test_create_RAW_data(int x,
- int y,
- const char *filename,
- char *primary_keys[],
- char *primary_vals[],
- int primary_types[],
- int nr_primary_keys,
- char *sub_keys[],
- char *sub_vals[],
- int sub_types[],
- int nr_sub_keys,
- float seed,
- float offset);
-
-int kmo_test_create_RAW_data_zero(int x,
- int y,
- const char *filename);
-
-int kmo_test_create_F2D_data(int x,
- int y,
- int mask,
- const char *filename,
- char *primary_keys[],
- char *primary_vals[],
- int primary_types[],
- int nr_primary_keys,
- char *sub_keys[],
- char *sub_vals[],
- int sub_types[],
- int nr_sub_keys);
-
-int kmo_test_create_F2D_data_noise(int x,
- int y,
- const char *filename,
- char *primary_keys[],
- char *primary_vals[],
- int primary_types[],
- int nr_primary_keys,
- char *sub_keys[],
- char *sub_vals[],
- int sub_types[],
- int nr_sub_keys);
-
-int kmo_test_create_F2I_data(int x,
- int y,
- int mask,
- int nr_images,
- const char *filename,
- char *primary_keys[],
- char *primary_vals[],
- int primary_types[],
- int nr_primary_keys,
- char *sub_keys[],
- char *sub_vals[],
- int sub_types[],
- int nr_sub_keys);
-
-int kmo_test_create_F2I_data_noise(int x,
- int y,
- int nr_images,
- const char *filename,
- char *primary_keys[],
- char *primary_vals[],
- int primary_types[],
- int nr_primary_keys,
- char *sub_keys[],
- char *sub_vals[],
- int sub_types[],
- int nr_sub_keys);
-
-int kmo_test_create_F3I_data(int x,
- int y,
- int z,
- int gauss,
- int nr_cubes,
- const char *filename,
- char *primary_keys[],
- char *primary_vals[],
- int primary_types[],
- int nr_primary_keys,
- char *sub_keys[],
- char *sub_vals[],
- int sub_types[],
- int nr_sub_keys);
-
-int kmo_test_create_F3I_data_infinite(int x,
- int y,
- int z,
- int nr_cubes,
- const char *filename,
- char *primary_keys[],
- char *primary_vals[],
- int primary_types[],
- int nr_primary_keys,
- char *sub_keys[],
- char *sub_vals[],
- int sub_types[],
- int nr_sub_keys);
-
-int kmo_test_create_F3I_data2(int x,
- int y,
- int z,
- int nr_cubes,
- int val[],
- const char *filename,
- char *primary_keys[],
- char *primary_vals[],
- int primary_types[],
- int nr_primary_keys,
- char *sub_keys[],
- char *sub_vals[],
- int sub_types[],
- int nr_sub_keys);
-
-int kmo_test_create_F3I_data_noise(int x,
- int y,
- int z,
- int gauss,
- int nr_cubes,
- const char *filename,
- char *primary_keys[],
- char *primary_vals[],
- int primary_types[],
- int nr_primary_keys,
- char *sub_keys[],
- char *sub_vals[],
- int sub_types[],
- int nr_sub_keys);
-
-int kmo_test_create_F1I_data(int x,
- int nr_vectors,
- const char *filename,
- char *primary_keys[],
- char *primary_vals[],
- int primary_types[],
- int nr_primary_keys,
- char *sub_keys[],
- char *sub_vals[],
- int sub_types[],
- int nr_sub_keys);
-
-int kmo_test_create_F1I_data_noise(int x,
- int nr_vectors,
- const char *filename,
- char *primary_keys[],
- char *primary_vals[],
- int primary_types[],
- int nr_primary_keys,
- char *sub_keys[],
- char *sub_vals[],
- int sub_types[],
- int nr_sub_keys);
-
-int kmo_test_create_B2D_data(int x,
- int y,
- int mask,
- const char *filename,
- char *primary_keys[],
- char *primary_vals[],
- int primary_types[],
- int nr_primary_keys,
- char *sub_keys[],
- char *sub_vals[],
- int sub_types[],
- int nr_sub_keys);
-
-#endif
diff --git a/kmos/kmo_utils.c b/kmos/kmo_utils.c
index 9e37144..dec46c3 100644
--- a/kmos/kmo_utils.c
+++ b/kmos/kmo_utils.c
@@ -34,6 +34,7 @@
*----------------------------------------------------------------------------*/
#include <string.h>
#include <ctype.h>
+#include <math.h>
#include <cpl.h>
@@ -44,8 +45,6 @@
#include <kmo_constants.h>
#include <kmo_cpl_extensions.h>
-#include <math.h>
-
/*----------------------------------------------------------------------------*/
/**
@defgroup kmos_utils Miscellaneous Utilities
@@ -1743,7 +1742,8 @@ cpl_array** kmo_get_unused_ifus(const cpl_frameset *frameset,
TELLURIC,
/*STD_IMAGE,
STD_MASK,
- STAR_SPEC,*/
+ STAR_SPEC,
+ SNR_SPEC,*/
OBJECT,
ARITHMETIC,
COMBINE,
diff --git a/kmos/tests/Makefile.am b/kmos/tests/Makefile.am
index ca82bb3..1b827a2 100644
--- a/kmos/tests/Makefile.am
+++ b/kmos/tests/Makefile.am
@@ -21,7 +21,7 @@ AUTOMAKE_OPTIONS = 1.8 foreign
DISTCLEANFILES = *~
-SUBDIRS = ref_data
+EXTRA_DIST = ref_data
if MAINTAINER_MODE
@@ -49,28 +49,28 @@ check_PROGRAMS = \
kmo_priv_fits_stack-test \
kmo_priv_flat-test \
kmo_priv_functions-test \
+ kmo_priv_lcorr-test \
kmo_priv_make_image-test \
kmo_priv_noise_map-test \
kmo_priv_reconstruct-test \
kmo_priv_rotate-test \
kmo_priv_shift-test \
kmo_priv_sky_mask-test \
+ kmo_priv_sky_tweak-test \
kmo_priv_stats-test \
kmo_priv_std_star-test \
kmo_priv_wave_cal-test \
- kmo_utils-test \
- kmo_priv_lcorr-test \
- kmo_priv_sky_tweak-test
+ kmo_utils-test
-kmo_cpl_extensions_test_SOURCES = kmo_cpl_extensions-test.c
+kmo_cpl_extensions_test_SOURCES = create_data_kmos.c kmo_cpl_extensions-test.c
kmo_cpl_extensions_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_cpl_extensions_test_LDADD = $(LDADD)
-kmo_debug_test_SOURCES = kmo_debug-test.c
+kmo_debug_test_SOURCES = create_data_kmos.c kmo_debug-test.c
kmo_debug_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_debug_test_LDADD = $(LDADD)
-kmo_dfs_test_SOURCES = kmo_dfs-test.c
+kmo_dfs_test_SOURCES = create_data_kmos.c kmo_dfs-test.c
kmo_dfs_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_dfs_test_LDADD = $(LDADD)
@@ -78,23 +78,23 @@ kmo_functions_test_SOURCES = kmo_functions-test.c
kmo_functions_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_functions_test_LDADD = $(LDADD)
-kmo_priv_arithmetic_test_SOURCES = kmo_priv_arithmetic-test.c
+kmo_priv_arithmetic_test_SOURCES = create_data_kmos.c kmo_priv_arithmetic-test.c
kmo_priv_arithmetic_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_arithmetic_test_LDADD = $(LDADD)
-kmo_priv_combine_test_SOURCES = kmo_priv_combine-test.c
+kmo_priv_combine_test_SOURCES = create_data_kmos.c kmo_priv_combine-test.c
kmo_priv_combine_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_combine_test_LDADD = $(LDADD)
-kmo_priv_copy_test_SOURCES = kmo_priv_copy-test.c
+kmo_priv_copy_test_SOURCES = create_data_kmos.c kmo_priv_copy-test.c
kmo_priv_copy_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_copy_test_LDADD = $(LDADD)
-kmo_priv_dark_test_SOURCES = kmo_priv_dark-test.c
+kmo_priv_dark_test_SOURCES = create_data_kmos.c kmo_priv_dark-test.c
kmo_priv_dark_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_dark_test_LDADD = $(LDADD)
-kmo_priv_extract_spec_test_SOURCES = kmo_priv_extract_spec-test.c
+kmo_priv_extract_spec_test_SOURCES = create_data_kmos.c kmo_priv_extract_spec-test.c
kmo_priv_extract_spec_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_extract_spec_test_LDADD = $(LDADD)
@@ -102,70 +102,70 @@ kmo_priv_fit_profile_test_SOURCES = kmo_priv_fit_profile-test.c
kmo_priv_fit_profile_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_fit_profile_test_LDADD = $(LDADD)
-kmo_priv_fits_check_test_SOURCES = kmo_priv_fits_check-test.c
+kmo_priv_fits_check_test_SOURCES = create_data_kmos.c kmo_priv_fits_check-test.c
kmo_priv_fits_check_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_fits_check_test_LDADD = $(LDADD)
-kmo_priv_fits_stack_test_SOURCES = kmo_priv_fits_stack-test.c
+kmo_priv_fits_stack_test_SOURCES = create_data_kmos.c kmo_priv_fits_stack-test.c
kmo_priv_fits_stack_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_fits_stack_test_LDADD = $(LDADD)
-kmo_priv_flat_test_SOURCES = kmo_priv_flat-test.c
+kmo_priv_flat_test_SOURCES = create_data_kmos.c kmo_priv_flat-test.c
kmo_priv_flat_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_flat_test_LDADD = $(LDADD)
-kmo_priv_functions_test_SOURCES = kmo_priv_functions-test.c
+kmo_priv_functions_test_SOURCES = create_data_kmos.c kmo_priv_functions-test.c
kmo_priv_functions_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_functions_test_LDADD = $(LDADD)
-kmo_priv_make_image_test_SOURCES = kmo_priv_make_image-test.c
+kmo_priv_lcorr_test_SOURCES = create_data_kmos.c kmo_priv_lcorr-test.c
+kmo_priv_lcorr_test_LDFLAGS = $(CPL_LDFLAGS)
+kmo_priv_lcorr_test_LDADD = $(LDADD)
+
+kmo_priv_make_image_test_SOURCES = create_data_kmos.c kmo_priv_make_image-test.c
kmo_priv_make_image_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_make_image_test_LDADD = $(LDADD)
-kmo_priv_noise_map_test_SOURCES = kmo_priv_noise_map-test.c
+kmo_priv_noise_map_test_SOURCES = create_data_kmos.c kmo_priv_noise_map-test.c
kmo_priv_noise_map_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_noise_map_test_LDADD = $(LDADD)
-kmo_priv_reconstruct_test_SOURCES = kmo_priv_reconstruct-test.c
+kmo_priv_reconstruct_test_SOURCES = create_data_kmos.c kmo_priv_reconstruct-test.c
kmo_priv_reconstruct_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_reconstruct_test_LDADD = $(LDADD)
-kmo_priv_rotate_test_SOURCES = kmo_priv_rotate-test.c
+kmo_priv_rotate_test_SOURCES = create_data_kmos.c kmo_priv_rotate-test.c
kmo_priv_rotate_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_rotate_test_LDADD = $(LDADD)
-kmo_priv_shift_test_SOURCES = kmo_priv_shift-test.c
+kmo_priv_shift_test_SOURCES = create_data_kmos.c kmo_priv_shift-test.c
kmo_priv_shift_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_shift_test_LDADD = $(LDADD)
-kmo_priv_sky_mask_test_SOURCES = kmo_priv_sky_mask-test.c
+kmo_priv_sky_mask_test_SOURCES = create_data_kmos.c kmo_priv_sky_mask-test.c
kmo_priv_sky_mask_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_sky_mask_test_LDADD = $(LDADD)
-kmo_priv_std_star_test_SOURCES = kmo_priv_std_star-test.c
-kmo_priv_std_star_test_LDFLAGS = $(CPL_LDFLAGS)
-kmo_priv_std_star_test_LDADD = $(LDADD)
+kmo_priv_sky_tweak_test_SOURCES = create_data_kmos.c kmo_priv_sky_tweak-test.c
+kmo_priv_sky_tweak_test_LDFLAGS = $(CPL_LDFLAGS)
+kmo_priv_sky_tweak_test_LDADD = $(LDADD)
-kmo_priv_stats_test_SOURCES = kmo_priv_stats-test.c
+kmo_priv_stats_test_SOURCES = create_data_kmos.c kmo_priv_stats-test.c
kmo_priv_stats_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_stats_test_LDADD = $(LDADD)
+kmo_priv_std_star_test_SOURCES = create_data_kmos.c kmo_priv_std_star-test.c
+kmo_priv_std_star_test_LDFLAGS = $(CPL_LDFLAGS)
+kmo_priv_std_star_test_LDADD = $(LDADD)
+
kmo_priv_wave_cal_test_SOURCES = kmo_priv_wave_cal-test.c
kmo_priv_wave_cal_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_wave_cal_test_LDADD = $(LDADD)
-kmo_utils_test_SOURCES = kmo_utils-test.c
+kmo_utils_test_SOURCES = create_data_kmos.c kmo_utils-test.c
kmo_utils_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_utils_test_LDADD = $(LDADD)
-kmo_priv_lcorr_test_SOURCES = kmo_priv_lcorr-test.c
-kmo_priv_lcorr_test_LDFLAGS = $(CPL_LDFLAGS)
-kmo_priv_lcorr_test_LDADD = $(LDADD)
-
-kmo_priv_sky_tweak_test_SOURCES = kmo_priv_sky_tweak-test.c
-kmo_priv_sky_tweak_test_LDFLAGS = $(CPL_LDFLAGS)
-kmo_priv_sky_tweak_test_LDADD = $(LDADD)
-
TESTS = $(check_PROGRAMS)
# Expected failures
@@ -179,4 +179,4 @@ TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
# We need to remove any files that the above tests created.
clean-local:
- $(RM) *.fits *.paf *.log *.txt
+ $(RM) *.fits *.paf *.log *.txt $(top_srcdir)/kmos/tests/test_data
diff --git a/kmos/tests/Makefile.in b/kmos/tests/Makefile.in
index 9ae535d..bc1aa9d 100644
--- a/kmos/tests/Makefile.in
+++ b/kmos/tests/Makefile.in
@@ -43,15 +43,15 @@ check_PROGRAMS = kmo_cpl_extensions-test$(EXEEXT) \
kmo_priv_fit_profile-test$(EXEEXT) \
kmo_priv_fits_check-test$(EXEEXT) \
kmo_priv_fits_stack-test$(EXEEXT) kmo_priv_flat-test$(EXEEXT) \
- kmo_priv_functions-test$(EXEEXT) \
+ kmo_priv_functions-test$(EXEEXT) kmo_priv_lcorr-test$(EXEEXT) \
kmo_priv_make_image-test$(EXEEXT) \
kmo_priv_noise_map-test$(EXEEXT) \
kmo_priv_reconstruct-test$(EXEEXT) \
kmo_priv_rotate-test$(EXEEXT) kmo_priv_shift-test$(EXEEXT) \
- kmo_priv_sky_mask-test$(EXEEXT) kmo_priv_stats-test$(EXEEXT) \
+ kmo_priv_sky_mask-test$(EXEEXT) \
+ kmo_priv_sky_tweak-test$(EXEEXT) kmo_priv_stats-test$(EXEEXT) \
kmo_priv_std_star-test$(EXEEXT) \
- kmo_priv_wave_cal-test$(EXEEXT) kmo_utils-test$(EXEEXT) \
- kmo_priv_lcorr-test$(EXEEXT) kmo_priv_sky_tweak-test$(EXEEXT)
+ kmo_priv_wave_cal-test$(EXEEXT) kmo_utils-test$(EXEEXT)
XFAIL_TESTS =
subdir = kmos/tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
@@ -71,7 +71,7 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-am_kmo_cpl_extensions_test_OBJECTS = \
+am_kmo_cpl_extensions_test_OBJECTS = create_data_kmos.$(OBJEXT) \
kmo_cpl_extensions-test.$(OBJEXT)
kmo_cpl_extensions_test_OBJECTS = \
$(am_kmo_cpl_extensions_test_OBJECTS)
@@ -83,13 +83,15 @@ kmo_cpl_extensions_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_cpl_extensions_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_cpl_extensions_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_debug_test_OBJECTS = kmo_debug-test.$(OBJEXT)
+am_kmo_debug_test_OBJECTS = create_data_kmos.$(OBJEXT) \
+ kmo_debug-test.$(OBJEXT)
kmo_debug_test_OBJECTS = $(am_kmo_debug_test_OBJECTS)
kmo_debug_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_debug_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_debug_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_dfs_test_OBJECTS = kmo_dfs-test.$(OBJEXT)
+am_kmo_dfs_test_OBJECTS = create_data_kmos.$(OBJEXT) \
+ kmo_dfs-test.$(OBJEXT)
kmo_dfs_test_OBJECTS = $(am_kmo_dfs_test_OBJECTS)
kmo_dfs_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_dfs_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -101,7 +103,7 @@ kmo_functions_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_functions_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_functions_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_arithmetic_test_OBJECTS = \
+am_kmo_priv_arithmetic_test_OBJECTS = create_data_kmos.$(OBJEXT) \
kmo_priv_arithmetic-test.$(OBJEXT)
kmo_priv_arithmetic_test_OBJECTS = \
$(am_kmo_priv_arithmetic_test_OBJECTS)
@@ -109,25 +111,28 @@ kmo_priv_arithmetic_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_arithmetic_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_arithmetic_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_combine_test_OBJECTS = kmo_priv_combine-test.$(OBJEXT)
+am_kmo_priv_combine_test_OBJECTS = create_data_kmos.$(OBJEXT) \
+ kmo_priv_combine-test.$(OBJEXT)
kmo_priv_combine_test_OBJECTS = $(am_kmo_priv_combine_test_OBJECTS)
kmo_priv_combine_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_combine_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_combine_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_copy_test_OBJECTS = kmo_priv_copy-test.$(OBJEXT)
+am_kmo_priv_copy_test_OBJECTS = create_data_kmos.$(OBJEXT) \
+ kmo_priv_copy-test.$(OBJEXT)
kmo_priv_copy_test_OBJECTS = $(am_kmo_priv_copy_test_OBJECTS)
kmo_priv_copy_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_copy_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_copy_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_dark_test_OBJECTS = kmo_priv_dark-test.$(OBJEXT)
+am_kmo_priv_dark_test_OBJECTS = create_data_kmos.$(OBJEXT) \
+ kmo_priv_dark-test.$(OBJEXT)
kmo_priv_dark_test_OBJECTS = $(am_kmo_priv_dark_test_OBJECTS)
kmo_priv_dark_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_dark_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_dark_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_extract_spec_test_OBJECTS = \
+am_kmo_priv_extract_spec_test_OBJECTS = create_data_kmos.$(OBJEXT) \
kmo_priv_extract_spec-test.$(OBJEXT)
kmo_priv_extract_spec_test_OBJECTS = \
$(am_kmo_priv_extract_spec_test_OBJECTS)
@@ -145,7 +150,7 @@ kmo_priv_fit_profile_test_LINK = $(LIBTOOL) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(kmo_priv_fit_profile_test_LDFLAGS) \
$(LDFLAGS) -o $@
-am_kmo_priv_fits_check_test_OBJECTS = \
+am_kmo_priv_fits_check_test_OBJECTS = create_data_kmos.$(OBJEXT) \
kmo_priv_fits_check-test.$(OBJEXT)
kmo_priv_fits_check_test_OBJECTS = \
$(am_kmo_priv_fits_check_test_OBJECTS)
@@ -153,7 +158,7 @@ kmo_priv_fits_check_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_fits_check_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_fits_check_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_fits_stack_test_OBJECTS = \
+am_kmo_priv_fits_stack_test_OBJECTS = create_data_kmos.$(OBJEXT) \
kmo_priv_fits_stack-test.$(OBJEXT)
kmo_priv_fits_stack_test_OBJECTS = \
$(am_kmo_priv_fits_stack_test_OBJECTS)
@@ -161,13 +166,14 @@ kmo_priv_fits_stack_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_fits_stack_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_fits_stack_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_flat_test_OBJECTS = kmo_priv_flat-test.$(OBJEXT)
+am_kmo_priv_flat_test_OBJECTS = create_data_kmos.$(OBJEXT) \
+ kmo_priv_flat-test.$(OBJEXT)
kmo_priv_flat_test_OBJECTS = $(am_kmo_priv_flat_test_OBJECTS)
kmo_priv_flat_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_flat_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_flat_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_functions_test_OBJECTS = \
+am_kmo_priv_functions_test_OBJECTS = create_data_kmos.$(OBJEXT) \
kmo_priv_functions-test.$(OBJEXT)
kmo_priv_functions_test_OBJECTS = \
$(am_kmo_priv_functions_test_OBJECTS)
@@ -175,13 +181,14 @@ kmo_priv_functions_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_functions_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_functions_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_lcorr_test_OBJECTS = kmo_priv_lcorr-test.$(OBJEXT)
+am_kmo_priv_lcorr_test_OBJECTS = create_data_kmos.$(OBJEXT) \
+ kmo_priv_lcorr-test.$(OBJEXT)
kmo_priv_lcorr_test_OBJECTS = $(am_kmo_priv_lcorr_test_OBJECTS)
kmo_priv_lcorr_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_lcorr_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_lcorr_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_make_image_test_OBJECTS = \
+am_kmo_priv_make_image_test_OBJECTS = create_data_kmos.$(OBJEXT) \
kmo_priv_make_image-test.$(OBJEXT)
kmo_priv_make_image_test_OBJECTS = \
$(am_kmo_priv_make_image_test_OBJECTS)
@@ -189,7 +196,7 @@ kmo_priv_make_image_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_make_image_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_make_image_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_noise_map_test_OBJECTS = \
+am_kmo_priv_noise_map_test_OBJECTS = create_data_kmos.$(OBJEXT) \
kmo_priv_noise_map-test.$(OBJEXT)
kmo_priv_noise_map_test_OBJECTS = \
$(am_kmo_priv_noise_map_test_OBJECTS)
@@ -197,7 +204,7 @@ kmo_priv_noise_map_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_noise_map_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_noise_map_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_reconstruct_test_OBJECTS = \
+am_kmo_priv_reconstruct_test_OBJECTS = create_data_kmos.$(OBJEXT) \
kmo_priv_reconstruct-test.$(OBJEXT)
kmo_priv_reconstruct_test_OBJECTS = \
$(am_kmo_priv_reconstruct_test_OBJECTS)
@@ -206,25 +213,28 @@ kmo_priv_reconstruct_test_LINK = $(LIBTOOL) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(kmo_priv_reconstruct_test_LDFLAGS) \
$(LDFLAGS) -o $@
-am_kmo_priv_rotate_test_OBJECTS = kmo_priv_rotate-test.$(OBJEXT)
+am_kmo_priv_rotate_test_OBJECTS = create_data_kmos.$(OBJEXT) \
+ kmo_priv_rotate-test.$(OBJEXT)
kmo_priv_rotate_test_OBJECTS = $(am_kmo_priv_rotate_test_OBJECTS)
kmo_priv_rotate_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_rotate_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_rotate_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_shift_test_OBJECTS = kmo_priv_shift-test.$(OBJEXT)
+am_kmo_priv_shift_test_OBJECTS = create_data_kmos.$(OBJEXT) \
+ kmo_priv_shift-test.$(OBJEXT)
kmo_priv_shift_test_OBJECTS = $(am_kmo_priv_shift_test_OBJECTS)
kmo_priv_shift_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_shift_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_shift_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_sky_mask_test_OBJECTS = kmo_priv_sky_mask-test.$(OBJEXT)
+am_kmo_priv_sky_mask_test_OBJECTS = create_data_kmos.$(OBJEXT) \
+ kmo_priv_sky_mask-test.$(OBJEXT)
kmo_priv_sky_mask_test_OBJECTS = $(am_kmo_priv_sky_mask_test_OBJECTS)
kmo_priv_sky_mask_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_sky_mask_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_sky_mask_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_sky_tweak_test_OBJECTS = \
+am_kmo_priv_sky_tweak_test_OBJECTS = create_data_kmos.$(OBJEXT) \
kmo_priv_sky_tweak-test.$(OBJEXT)
kmo_priv_sky_tweak_test_OBJECTS = \
$(am_kmo_priv_sky_tweak_test_OBJECTS)
@@ -232,13 +242,15 @@ kmo_priv_sky_tweak_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_sky_tweak_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_sky_tweak_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_stats_test_OBJECTS = kmo_priv_stats-test.$(OBJEXT)
+am_kmo_priv_stats_test_OBJECTS = create_data_kmos.$(OBJEXT) \
+ kmo_priv_stats-test.$(OBJEXT)
kmo_priv_stats_test_OBJECTS = $(am_kmo_priv_stats_test_OBJECTS)
kmo_priv_stats_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_stats_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_stats_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_priv_std_star_test_OBJECTS = kmo_priv_std_star-test.$(OBJEXT)
+am_kmo_priv_std_star_test_OBJECTS = create_data_kmos.$(OBJEXT) \
+ kmo_priv_std_star-test.$(OBJEXT)
kmo_priv_std_star_test_OBJECTS = $(am_kmo_priv_std_star_test_OBJECTS)
kmo_priv_std_star_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_std_star_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -250,7 +262,8 @@ kmo_priv_wave_cal_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_priv_wave_cal_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_priv_wave_cal_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_utils_test_OBJECTS = kmo_utils-test.$(OBJEXT)
+am_kmo_utils_test_OBJECTS = create_data_kmos.$(OBJEXT) \
+ kmo_utils-test.$(OBJEXT)
kmo_utils_test_OBJECTS = $(am_kmo_utils_test_OBJECTS)
kmo_utils_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_utils_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -312,49 +325,11 @@ DIST_SOURCES = $(kmo_cpl_extensions_test_SOURCES) \
$(kmo_priv_stats_test_SOURCES) \
$(kmo_priv_std_star_test_SOURCES) \
$(kmo_priv_wave_cal_test_SOURCES) $(kmo_utils_test_SOURCES)
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
- distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
- distdir
ETAGS = etags
CTAGS = ctags
am__tty_colors = \
red=; grn=; lgn=; blu=; std=
-DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-am__relativize = \
- dir0=`pwd`; \
- sed_first='s,^\([^/]*\)/.*$$,\1,'; \
- sed_rest='s,^[^/]*/*,,'; \
- sed_last='s,^.*/\([^/]*\)$$,\1,'; \
- sed_butlast='s,/*[^/]*$$,,'; \
- while test -n "$$dir1"; do \
- first=`echo "$$dir1" | sed -e "$$sed_first"`; \
- if test "$$first" != "."; then \
- if test "$$first" = ".."; then \
- dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
- dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
- else \
- first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
- if test "$$first2" = "$$first"; then \
- dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
- else \
- dir2="../$$dir2"; \
- fi; \
- dir0="$$dir0"/"$$first"; \
- fi; \
- fi; \
- dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
- done; \
- reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
@@ -409,6 +384,7 @@ LIBCPLDFS = @LIBCPLDFS@
LIBCPLDRS = @LIBCPLDRS@
LIBCPLUI = @LIBCPLUI@
LIBIRPLIB = @LIBIRPLIB@
+LIBKMCLIPMLIB = @LIBKMCLIPMLIB@
LIBKMOS = @LIBKMOS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@@ -512,88 +488,88 @@ wkfcopydir = @wkfcopydir@
wkfextradir = @wkfextradir@
AUTOMAKE_OPTIONS = 1.8 foreign
DISTCLEANFILES = *~
-SUBDIRS = ref_data
+EXTRA_DIST = ref_data
@MAINTAINER_MODE_TRUE at MAINTAINERCLEANFILES = Makefile.in
INCLUDES = $(all_includes) -I../../kmclipm/include/
LDADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE) $(LIBKMOS)
-kmo_cpl_extensions_test_SOURCES = kmo_cpl_extensions-test.c
+kmo_cpl_extensions_test_SOURCES = create_data_kmos.c kmo_cpl_extensions-test.c
kmo_cpl_extensions_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_cpl_extensions_test_LDADD = $(LDADD)
-kmo_debug_test_SOURCES = kmo_debug-test.c
+kmo_debug_test_SOURCES = create_data_kmos.c kmo_debug-test.c
kmo_debug_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_debug_test_LDADD = $(LDADD)
-kmo_dfs_test_SOURCES = kmo_dfs-test.c
+kmo_dfs_test_SOURCES = create_data_kmos.c kmo_dfs-test.c
kmo_dfs_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_dfs_test_LDADD = $(LDADD)
kmo_functions_test_SOURCES = kmo_functions-test.c
kmo_functions_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_functions_test_LDADD = $(LDADD)
-kmo_priv_arithmetic_test_SOURCES = kmo_priv_arithmetic-test.c
+kmo_priv_arithmetic_test_SOURCES = create_data_kmos.c kmo_priv_arithmetic-test.c
kmo_priv_arithmetic_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_arithmetic_test_LDADD = $(LDADD)
-kmo_priv_combine_test_SOURCES = kmo_priv_combine-test.c
+kmo_priv_combine_test_SOURCES = create_data_kmos.c kmo_priv_combine-test.c
kmo_priv_combine_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_combine_test_LDADD = $(LDADD)
-kmo_priv_copy_test_SOURCES = kmo_priv_copy-test.c
+kmo_priv_copy_test_SOURCES = create_data_kmos.c kmo_priv_copy-test.c
kmo_priv_copy_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_copy_test_LDADD = $(LDADD)
-kmo_priv_dark_test_SOURCES = kmo_priv_dark-test.c
+kmo_priv_dark_test_SOURCES = create_data_kmos.c kmo_priv_dark-test.c
kmo_priv_dark_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_dark_test_LDADD = $(LDADD)
-kmo_priv_extract_spec_test_SOURCES = kmo_priv_extract_spec-test.c
+kmo_priv_extract_spec_test_SOURCES = create_data_kmos.c kmo_priv_extract_spec-test.c
kmo_priv_extract_spec_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_extract_spec_test_LDADD = $(LDADD)
kmo_priv_fit_profile_test_SOURCES = kmo_priv_fit_profile-test.c
kmo_priv_fit_profile_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_fit_profile_test_LDADD = $(LDADD)
-kmo_priv_fits_check_test_SOURCES = kmo_priv_fits_check-test.c
+kmo_priv_fits_check_test_SOURCES = create_data_kmos.c kmo_priv_fits_check-test.c
kmo_priv_fits_check_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_fits_check_test_LDADD = $(LDADD)
-kmo_priv_fits_stack_test_SOURCES = kmo_priv_fits_stack-test.c
+kmo_priv_fits_stack_test_SOURCES = create_data_kmos.c kmo_priv_fits_stack-test.c
kmo_priv_fits_stack_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_fits_stack_test_LDADD = $(LDADD)
-kmo_priv_flat_test_SOURCES = kmo_priv_flat-test.c
+kmo_priv_flat_test_SOURCES = create_data_kmos.c kmo_priv_flat-test.c
kmo_priv_flat_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_flat_test_LDADD = $(LDADD)
-kmo_priv_functions_test_SOURCES = kmo_priv_functions-test.c
+kmo_priv_functions_test_SOURCES = create_data_kmos.c kmo_priv_functions-test.c
kmo_priv_functions_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_functions_test_LDADD = $(LDADD)
-kmo_priv_make_image_test_SOURCES = kmo_priv_make_image-test.c
+kmo_priv_lcorr_test_SOURCES = create_data_kmos.c kmo_priv_lcorr-test.c
+kmo_priv_lcorr_test_LDFLAGS = $(CPL_LDFLAGS)
+kmo_priv_lcorr_test_LDADD = $(LDADD)
+kmo_priv_make_image_test_SOURCES = create_data_kmos.c kmo_priv_make_image-test.c
kmo_priv_make_image_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_make_image_test_LDADD = $(LDADD)
-kmo_priv_noise_map_test_SOURCES = kmo_priv_noise_map-test.c
+kmo_priv_noise_map_test_SOURCES = create_data_kmos.c kmo_priv_noise_map-test.c
kmo_priv_noise_map_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_noise_map_test_LDADD = $(LDADD)
-kmo_priv_reconstruct_test_SOURCES = kmo_priv_reconstruct-test.c
+kmo_priv_reconstruct_test_SOURCES = create_data_kmos.c kmo_priv_reconstruct-test.c
kmo_priv_reconstruct_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_reconstruct_test_LDADD = $(LDADD)
-kmo_priv_rotate_test_SOURCES = kmo_priv_rotate-test.c
+kmo_priv_rotate_test_SOURCES = create_data_kmos.c kmo_priv_rotate-test.c
kmo_priv_rotate_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_rotate_test_LDADD = $(LDADD)
-kmo_priv_shift_test_SOURCES = kmo_priv_shift-test.c
+kmo_priv_shift_test_SOURCES = create_data_kmos.c kmo_priv_shift-test.c
kmo_priv_shift_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_shift_test_LDADD = $(LDADD)
-kmo_priv_sky_mask_test_SOURCES = kmo_priv_sky_mask-test.c
+kmo_priv_sky_mask_test_SOURCES = create_data_kmos.c kmo_priv_sky_mask-test.c
kmo_priv_sky_mask_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_sky_mask_test_LDADD = $(LDADD)
-kmo_priv_std_star_test_SOURCES = kmo_priv_std_star-test.c
-kmo_priv_std_star_test_LDFLAGS = $(CPL_LDFLAGS)
-kmo_priv_std_star_test_LDADD = $(LDADD)
-kmo_priv_stats_test_SOURCES = kmo_priv_stats-test.c
+kmo_priv_sky_tweak_test_SOURCES = create_data_kmos.c kmo_priv_sky_tweak-test.c
+kmo_priv_sky_tweak_test_LDFLAGS = $(CPL_LDFLAGS)
+kmo_priv_sky_tweak_test_LDADD = $(LDADD)
+kmo_priv_stats_test_SOURCES = create_data_kmos.c kmo_priv_stats-test.c
kmo_priv_stats_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_stats_test_LDADD = $(LDADD)
+kmo_priv_std_star_test_SOURCES = create_data_kmos.c kmo_priv_std_star-test.c
+kmo_priv_std_star_test_LDFLAGS = $(CPL_LDFLAGS)
+kmo_priv_std_star_test_LDADD = $(LDADD)
kmo_priv_wave_cal_test_SOURCES = kmo_priv_wave_cal-test.c
kmo_priv_wave_cal_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_priv_wave_cal_test_LDADD = $(LDADD)
-kmo_utils_test_SOURCES = kmo_utils-test.c
+kmo_utils_test_SOURCES = create_data_kmos.c kmo_utils-test.c
kmo_utils_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_utils_test_LDADD = $(LDADD)
-kmo_priv_lcorr_test_SOURCES = kmo_priv_lcorr-test.c
-kmo_priv_lcorr_test_LDFLAGS = $(CPL_LDFLAGS)
-kmo_priv_lcorr_test_LDADD = $(LDADD)
-kmo_priv_sky_tweak_test_SOURCES = kmo_priv_sky_tweak-test.c
-kmo_priv_sky_tweak_test_LDFLAGS = $(CPL_LDFLAGS)
-kmo_priv_sky_tweak_test_LDADD = $(LDADD)
TESTS = $(check_PROGRAMS)
# Be sure to reexport important environment variables.
@@ -602,7 +578,7 @@ TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)"
-all: all-recursive
+all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
@@ -730,6 +706,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/create_data_kmos.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_cpl_extensions-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_debug-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_dfs-test.Po at am__quote@
@@ -784,76 +761,6 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
- fi; test -z "$$fail"
-
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
-
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -864,23 +771,10 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
mkid -fID $$unique
tags: TAGS
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
- if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
- include_option=--etags-include; \
- empty_fix=.; \
- else \
- include_option=--include; \
- empty_fix=; \
- fi; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test ! -f $$subdir/TAGS || \
- set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
- fi; \
- done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
@@ -899,7 +793,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
fi; \
fi
ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -1042,50 +936,21 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- fi; \
- done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
- $(am__relativize); \
- new_distdir=$$reldir; \
- dir1=$$subdir; dir2="$(top_distdir)"; \
- $(am__relativize); \
- new_top_distdir=$$reldir; \
- echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
- echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
- ($(am__cd) $$subdir && \
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$new_top_distdir" \
- distdir="$$new_distdir" \
- am__remove_distdir=: \
- am__skip_length_check=: \
- am__skip_mode_fix=: \
- distdir) \
- || exit 1; \
- fi; \
- done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
-check: check-recursive
+check: check-am
all-am: Makefile
-installdirs: installdirs-recursive
-installdirs-am:
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-installcheck: installcheck-recursive
+installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
@@ -1109,99 +974,97 @@ maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-clean: clean-recursive
+clean: clean-am
clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \
mostlyclean-am
-distclean: distclean-recursive
+distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
-dvi: dvi-recursive
+dvi: dvi-am
dvi-am:
-html: html-recursive
+html: html-am
html-am:
-info: info-recursive
+info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-recursive
+install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
-install-html: install-html-recursive
+install-html: install-html-am
install-html-am:
-install-info: install-info-recursive
+install-info: install-info-am
install-info-am:
install-man:
-install-pdf: install-pdf-recursive
+install-pdf: install-pdf-am
install-pdf-am:
-install-ps: install-ps-recursive
+install-ps: install-ps-am
install-ps-am:
installcheck-am:
-maintainer-clean: maintainer-clean-recursive
+maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
-mostlyclean: mostlyclean-recursive
+mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
-pdf: pdf-recursive
+pdf: pdf-am
pdf-am:
-ps: ps-recursive
+ps: ps-am
ps-am:
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \
- ctags-recursive install-am install-strip tags-recursive
+.MAKE: check-am install-am install-strip
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-TESTS check-am clean \
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool clean-local \
- ctags ctags-recursive distclean distclean-compile \
- distclean-generic distclean-libtool distclean-tags distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs installdirs-am \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
+ ctags distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am
# We need to remove any files that the above tests created.
clean-local:
- $(RM) *.fits *.paf *.log *.txt
+ $(RM) *.fits *.paf *.log *.txt $(top_srcdir)/kmos/tests/test_data
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/kmos/tests/create_data_kmos.c b/kmos/tests/create_data_kmos.c
new file mode 100644
index 0000000..3d5a136
--- /dev/null
+++ b/kmos/tests/create_data_kmos.c
@@ -0,0 +1,247 @@
+
+#include <stdlib.h>
+#include <cpl.h>
+#include "kmo_error.h"
+
+float test_global_seed_data = 1.1;
+
+/**
+ @brief Switches off error-messages.
+*/
+void kmo_test_verbose_off()
+{
+ if (getenv("KMO_TEST_VERBOSE") == NULL) {
+ cpl_msg_set_level(CPL_MSG_OFF);
+ }
+}
+
+/**
+ @brief Switches on error-messages.
+*/
+void kmo_test_verbose_on()
+{
+ if (getenv("KMO_TEST_VERBOSE") == NULL) {
+ cpl_msg_set_level(CPL_MSG_WARNING);
+ }
+}
+
+/**
+ @brief
+ Frame constructor
+
+ @param filename frame filename
+ @param tag frame tag
+ @param group frame group
+
+ @return Newly allocated frame with the given contents.
+ */
+cpl_frame* kmo_test_frame_new(const char *filename,
+ const char *tag,
+ cpl_frame_group group)
+{
+ cpl_frame *f = NULL;
+
+ KMO_TRY
+ {
+ f = cpl_frame_new();
+ KMO_TRY_EXIT_IF_NOT(f != NULL);
+
+ cpl_frame_set_filename(f, filename);
+
+ cpl_frame_set_tag(f, tag);
+
+ cpl_frame_set_group(f, group);
+ }
+ KMO_CATCH
+ {
+ f = NULL;
+ }
+
+ return f;
+}
+
+/**
+ @brief Fills a vector with increasing values.
+
+ @param vec The vector to fill with values.
+ @param seed The starting value.
+ @param offset The offset for the values.
+
+ */
+void kmo_test_fill_vector(cpl_vector *vec,
+ float seed,
+ float offset)
+{
+ int i = 0,
+ size = 0;
+ double *data = NULL;
+
+ KMO_TRY
+ {
+ size = cpl_vector_get_size(vec);
+ KMO_TRY_EXIT_IF_NOT(size > 0);
+
+ data = cpl_vector_get_data(vec);
+ KMO_TRY_EXIT_IF_NOT(data != NULL);
+
+ // horizontal stripes: bottom = 0, top = seed * (y-1)
+ for (i = 0; i < size; i++) {
+ data[i] = seed + i * offset;
+ }
+ }
+ KMO_CATCH
+ {
+ }
+}
+
+/**
+ @brief Fills an image with increasing values.
+
+ @param img The image to fill with values.
+ @param seed The starting value.
+ @param offset The offset for the values.
+
+ */
+void kmo_test_fill_image(cpl_image *img,
+ float seed,
+ float offset)
+{
+ int i = 0,
+ j = 0;
+ cpl_size d = 0,
+ x = 0,
+ y = 0;
+ float *data = NULL,
+ f = 0.0;
+
+ KMO_TRY
+ {
+ x = cpl_image_get_size_x(img);
+ y = cpl_image_get_size_y(img);
+
+
+ data = cpl_image_get_data_float(img);
+ KMO_TRY_EXIT_IF_NOT(data != NULL);
+
+ // horizontal stripes: bottom = 0, top = seed * (y-1)
+ for (i = 0; i < y; i++) {
+ for (j = 0; j < x; j++) {
+ data[d] = seed + f;
+ d++;
+ f += offset;
+ }
+ }
+ }
+ KMO_CATCH
+ {
+ }
+}
+
+/**
+ @brief Fills a cube with increasing values.
+
+ @param cube The cube to fill with values.
+ @param seed The starting value.
+ @param offset The offset for the values.
+
+ */
+void kmo_test_fill_cube(cpl_imagelist *cube,
+ float seed,
+ float offset)
+{
+ int i = 0,
+ size = 0;
+
+ KMO_TRY
+ {
+ size = cpl_imagelist_get_size(cube);
+ KMO_TRY_EXIT_IF_NOT(size > 0);
+
+ for (i = 0; i < size; i++) {
+ kmo_test_fill_image(cpl_imagelist_get(cube, i),
+ seed, offset);
+ seed += offset;
+ }
+ }
+ KMO_CATCH
+ {
+ }
+}
+
+/**
+ @brief Allocates images in an empty imagelist.
+
+ @param cube The cube to allocate.
+ @param x Size in x-dimension.
+ @param y Size in y-dimension.
+ @param z Size in z-dimension.
+
+ */
+void kmo_test_alloc_cube(cpl_imagelist *cube,
+ int x,
+ int y,
+ int z)
+{
+ int i = 0;
+ cpl_image *img = NULL;
+
+ KMO_TRY
+ {
+ KMO_TRY_EXIT_IF_NOT(cpl_imagelist_get_size(cube) == 0);
+
+ for (i = 0; i < z; i++) {
+ KMO_TRY_EXIT_IF_NULL(
+ img = cpl_image_new(x, y, CPL_TYPE_FLOAT));
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_imagelist_set(cube, img, i));
+ }
+ }
+ KMO_CATCH
+ {
+ }
+}
+
+/**
+ @brief Fills a cube with data either serial or gaussian data.
+
+ @param x The 1st dimension.
+ @param y The 2nd dimension.
+ @param z The 3rd dimension.
+ @param gauss TRUE if images should contain a gauss, FALSE otherwise.
+
+ @return The generated imagelist.
+ */
+cpl_imagelist* kmo_test_create_cube(int x, int y, int z, int gauss, int *offset)
+{
+ cpl_imagelist *imglist = NULL;
+ cpl_image *img = NULL;
+
+ int i = 0;
+
+ KMO_TRY
+ {
+ imglist = cpl_imagelist_new();
+ KMO_TRY_EXIT_IF_NOT(imglist != NULL);
+
+ for (i = 0; i < z; i++) {
+ img = cpl_image_new(x, y, CPL_TYPE_FLOAT);
+ KMO_TRY_EXIT_IF_NOT(img != NULL);
+
+ if (gauss == FALSE) {
+ kmo_test_fill_image(img, (*offset)++, test_global_seed_data);
+ } else {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_image_fill_gaussian(img, x/2, y/2,
+ *offset + test_global_seed_data,
+ x/4, y/4));
+ }
+
+ cpl_imagelist_set(imglist, img, i);
+ }
+ }
+ KMO_CATCH
+ {
+ }
+
+ return imglist;
+}
diff --git a/kmos/tests/kmo_cpl_extensions-test.c b/kmos/tests/kmo_cpl_extensions-test.c
index c483e04..8536a92 100644
--- a/kmos/tests/kmo_cpl_extensions-test.c
+++ b/kmos/tests/kmo_cpl_extensions-test.c
@@ -32,9 +32,9 @@
#include <math.h>
#include <cpl_plot.h>
+
#include "kmclipm_math.h"
-#include "kmo_test_create_data.h"
#include "kmo_utils.h"
#include "kmo_cpl_extensions.h"
#include "kmo_debug.h"
@@ -45,6 +45,12 @@
@{
*/
+void kmo_test_fill_image(cpl_image *img, float seed, float offset);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+void kmo_test_alloc_cube(cpl_imagelist *cube, int x, int y, int z);
+void kmo_test_fill_cube(cpl_imagelist *cube, float seed, float offset);
+
/**
@brief tests kmo_image_histogram()
*/
diff --git a/kmos/tests/kmo_debug-test.c b/kmos/tests/kmo_debug-test.c
index b963a97..f2e69db 100644
--- a/kmos/tests/kmo_debug-test.c
+++ b/kmos/tests/kmo_debug-test.c
@@ -31,7 +31,6 @@
#include "kmo_debug.h"
#include "kmo_utils.h"
-#include "kmo_test_create_data.h"
#include "kmo_cpl_extensions.h"
/**
@@ -40,6 +39,9 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+
/**
@brief test kmo_debug_header()
*/
@@ -139,11 +141,12 @@ void test_kmo_debug_array()
void test_kmo_debug_desc()
{
kmo_test_verbose_off();
- main_fits_desc desc = kmo_identify_fits_header(
- "../../recipes/tests/ref_data/KMOS_dummy.fits");
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+ main_fits_desc desc = kmo_identify_fits_header(my_path);
cpl_test_eq(CPL_ERROR_NONE, kmo_debug_desc(desc));
kmo_test_verbose_on();
kmo_free_fits_desc(&desc);
+ cpl_free(my_path);
}
/**
diff --git a/kmos/tests/kmo_dfs-test.c b/kmos/tests/kmo_dfs-test.c
index 965bca7..d3539ac 100644
--- a/kmos/tests/kmo_dfs-test.c
+++ b/kmos/tests/kmo_dfs-test.c
@@ -35,7 +35,6 @@
#include "kmclipm_vector.h"
#include "kmclipm_constants.h"
-#include "kmo_test_create_data.h"
#include "kmo_dfs.h"
#include "kmo_utils.h"
#include "kmo_debug.h"
@@ -46,6 +45,14 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+cpl_frame* kmo_test_frame_new(const char *filename, const char *tag, cpl_frame_group group);
+void kmo_test_fill_vector(cpl_vector *vec, float seed, float offset);
+void kmo_test_fill_image(cpl_image *img, float seed, float offset);
+void kmo_test_fill_cube(cpl_imagelist *cube, float seed, float offset);
+void kmo_test_alloc_cube(cpl_imagelist *cube, int x, int y, int z);
+
/**
* @brief test strlower
*/
@@ -183,8 +190,8 @@ void test_kmo_dfs_load_primary_header()
cpl_propertylist *pl = NULL;
cpl_frameset *fs = cpl_frameset_new();
cpl_frame *fr = NULL;
- fr = kmo_test_frame_new("../../recipes/tests/ref_data/KMOS_dummy.fits",
- "", CPL_FRAME_GROUP_RAW);
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+ fr = kmo_test_frame_new(my_path, "", CPL_FRAME_GROUP_RAW);
cpl_frameset_insert(fs, fr);
kmo_test_verbose_off();
@@ -202,6 +209,7 @@ void test_kmo_dfs_load_primary_header()
cpl_propertylist_delete(pl);
cpl_frameset_delete(fs);
+ cpl_free(my_path);
}
/**
@@ -212,8 +220,8 @@ void test_kmo_dfs_load_sub_header()
cpl_propertylist *pl = NULL;
cpl_frameset *fs = cpl_frameset_new();
cpl_frame *fr = NULL;
- fr = kmo_test_frame_new("../../recipes/tests/ref_data/KMOS_dummy.fits",
- "", CPL_FRAME_GROUP_RAW);
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+ fr = kmo_test_frame_new(my_path, "", CPL_FRAME_GROUP_RAW);
cpl_frameset_insert(fs, fr);
kmo_test_verbose_off();
@@ -235,6 +243,7 @@ void test_kmo_dfs_load_sub_header()
cpl_propertylist_delete(pl);
cpl_frameset_delete(fs);
+ cpl_free(my_path);
}
/**
@@ -626,8 +635,8 @@ void test_kmo_dfs_save_main_header()
kmo_dfs_save_main_header(fs, "aga", NULL, NULL, NULL, NULL, ""));
cpl_test_error(CPL_ERROR_NULL_INPUT);
- fr = kmo_test_frame_new("../../recipes/tests/ref_data/KMOS_dummy.fits",
- "", CPL_FRAME_GROUP_RAW);
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+ fr = kmo_test_frame_new(my_path, "", CPL_FRAME_GROUP_RAW);
cpl_frameset_insert(fs, fr);
cpl_test_eq(CPL_ERROR_NULL_INPUT,
@@ -645,6 +654,7 @@ void test_kmo_dfs_save_main_header()
cpl_propertylist_delete(pl);
cpl_parameterlist_delete(parl);
cpl_frameset_delete(fs);
+ cpl_free(my_path);
}
/**
@@ -666,11 +676,13 @@ void test_kmo_dfs_save_sub_header()
cpl_test_error(CPL_ERROR_NULL_INPUT);
kmo_test_verbose_on();
- pl = cpl_propertylist_load("../../recipes/tests/ref_data/KMOS_dummy.fits", 1);
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+ pl = cpl_propertylist_load(my_path, 1);
cpl_test_eq(CPL_ERROR_NONE,
kmo_dfs_save_sub_header("agaa", "", pl));
cpl_propertylist_delete(pl);
+ cpl_free(my_path);
}
/**
@@ -702,9 +714,8 @@ void test_kmo_dfs_save_vector()
/* save real vector here (first save main header)*/
cpl_parameterlist *parl = cpl_parameterlist_new();
cpl_frameset *fs = cpl_frameset_new();
- cpl_frame *fr = kmo_test_frame_new(
- "../../recipes/tests/ref_data/KMOS_dummy.fits",
- "", CPL_FRAME_GROUP_RAW);
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+ cpl_frame *fr = kmo_test_frame_new( my_path, "", CPL_FRAME_GROUP_RAW);
cpl_frameset_insert(fs, fr);
cpl_test_eq(CPL_ERROR_NONE,
kmo_dfs_save_main_header(fs, "aga_vec", "", NULL, NULL, parl, ""));
@@ -730,6 +741,7 @@ void test_kmo_dfs_save_vector()
kmclipm_vector_delete(vec);
cpl_frameset_delete(fs);
cpl_parameterlist_delete(parl);
+ cpl_free(my_path);
}
/**
@@ -759,9 +771,8 @@ void test_kmo_dfs_save_image()
/* save real image here (first save main header) */
cpl_parameterlist *parl = cpl_parameterlist_new();
cpl_frameset *fs = cpl_frameset_new();
- cpl_frame *fr = kmo_test_frame_new(
- "../../recipes/tests/ref_data/KMOS_dummy.fits",
- "", CPL_FRAME_GROUP_RAW);
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+ cpl_frame *fr = kmo_test_frame_new(my_path, "", CPL_FRAME_GROUP_RAW);
cpl_frameset_insert(fs, fr);
cpl_test_eq(CPL_ERROR_NONE,
kmo_dfs_save_main_header(fs, "aga_img", "", NULL, NULL, parl, ""));
@@ -792,6 +803,7 @@ void test_kmo_dfs_save_image()
cpl_image_delete(img);
cpl_frameset_delete(fs);
cpl_parameterlist_delete(parl);
+ cpl_free(my_path);
}
/**
@@ -822,9 +834,8 @@ void test_kmo_dfs_save_cube()
/* save real cube here */
cpl_parameterlist *parl = cpl_parameterlist_new();
cpl_frameset *fs = cpl_frameset_new();
- cpl_frame *fr = kmo_test_frame_new(
- "../../recipes/tests/ref_data/KMOS_dummy.fits",
- "", CPL_FRAME_GROUP_RAW);
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+ cpl_frame *fr = kmo_test_frame_new( my_path, "", CPL_FRAME_GROUP_RAW);
cpl_frameset_insert(fs, fr);
cpl_test_eq(CPL_ERROR_NONE,
kmo_dfs_save_main_header(fs, "aga_cube", "", NULL, NULL, parl, ""));
@@ -849,6 +860,7 @@ void test_kmo_dfs_save_cube()
cpl_imagelist_delete(cube);
cpl_frameset_delete(fs);
cpl_parameterlist_delete(parl);
+ cpl_free(my_path);
}
/**
@@ -891,8 +903,8 @@ void test_kmo_dfs_get_frame()
cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
kmo_test_verbose_on();
- fr = kmo_test_frame_new("../../recipes/tests/ref_data/KMOS_dummy.fits",
- "", CPL_FRAME_GROUP_RAW);
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+ fr = kmo_test_frame_new(my_path, "", CPL_FRAME_GROUP_RAW);
cpl_frameset_insert(fs, fr);
cpl_frame *ff;
cpl_test_nonnull(ff = kmo_dfs_get_frame(fs, ""));
@@ -905,6 +917,7 @@ void test_kmo_dfs_get_frame()
cpl_test_eq(TRUE, flag);
cpl_frameset_delete(fs);
+ cpl_free(my_path);
}
/**
@@ -1141,22 +1154,17 @@ void test_kmo_identify_index()
{
cpl_frameset *fs = cpl_frameset_new();
cpl_frame *fr = NULL;
- fr = kmo_test_frame_new("../../recipes/tests/ref_data/KMOS_dummy.fits",
- "", CPL_FRAME_GROUP_RAW);
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+ fr = kmo_test_frame_new(my_path, "", CPL_FRAME_GROUP_RAW);
cpl_frameset_insert(fs, fr);
kmo_test_verbose_off();
- cpl_test_eq(1, kmo_identify_index(
- "../../recipes/tests/ref_data/KMOS_dummy.fits", 1, 0));
- cpl_test_eq(2, kmo_identify_index(
- "../../recipes/tests/ref_data/KMOS_dummy.fits", 2, 0));
- cpl_test_eq(3, kmo_identify_index(
- "../../recipes/tests/ref_data/KMOS_dummy.fits", 3, 0));
- cpl_test_eq(-1, kmo_identify_index(
- "../../recipes/tests/ref_data/KMOS_dummy.fits", 4, 0));
+ cpl_test_eq(1, kmo_identify_index(my_path, 1, 0));
+ cpl_test_eq(2, kmo_identify_index(my_path, 2, 0));
+ cpl_test_eq(3, kmo_identify_index(my_path, 3, 0));
+ cpl_test_eq(-1, kmo_identify_index(my_path, 4, 0));
cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
- cpl_test_eq(-1, kmo_identify_index(
- "../../recipes/tests/ref_data/KMOS_dummy.fits", 1, 1));
+ cpl_test_eq(-1, kmo_identify_index(my_path, 1, 1));
cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
cpl_test_eq(-1, kmo_identify_index(NULL, 1, 0));
cpl_test_error(CPL_ERROR_NULL_INPUT);
@@ -1165,6 +1173,7 @@ void test_kmo_identify_index()
kmo_test_verbose_on();
cpl_frameset_delete(fs);
+ cpl_free(my_path);
}
/**
diff --git a/kmos/tests/kmo_functions-test.c b/kmos/tests/kmo_functions-test.c
index 5b3fa03..b2fef37 100644
--- a/kmos/tests/kmo_functions-test.c
+++ b/kmos/tests/kmo_functions-test.c
@@ -29,9 +29,8 @@
#include <config.h>
#endif
-#include <kmo_test_create_data.h>
-#include <kmo_functions.h>
-#include <kmo_debug.h>
+#include "kmo_functions.h"
+#include "kmo_debug.h"
/**
@defgroup kmo_functions_test kmo_functions unit tests
diff --git a/kmos/tests/kmo_priv_arithmetic-test.c b/kmos/tests/kmo_priv_arithmetic-test.c
index 35c2475..7fe7722 100644
--- a/kmos/tests/kmo_priv_arithmetic-test.c
+++ b/kmos/tests/kmo_priv_arithmetic-test.c
@@ -33,7 +33,6 @@
#include "kmo_priv_arithmetic.h"
#include "kmo_priv_copy.h"
-#include "kmo_test_create_data.h"
#include "kmo_utils.h"
/**
@@ -41,6 +40,14 @@
@{
*/
+
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+void kmo_test_fill_vector(cpl_vector *vec, float seed, float offset);
+void kmo_test_fill_image(cpl_image *img, float seed, float offset);
+void kmo_test_fill_cube(cpl_imagelist *cube, float seed, float offset);
+void kmo_test_alloc_cube(cpl_imagelist *cube, int x, int y, int z);
+
/**
@brief test for kmo_arithmetic_1D_1D()
*/
diff --git a/kmos/tests/kmo_priv_combine-test.c b/kmos/tests/kmo_priv_combine-test.c
index 35d21ed..6d9c71f 100644
--- a/kmos/tests/kmo_priv_combine-test.c
+++ b/kmos/tests/kmo_priv_combine-test.c
@@ -29,12 +29,11 @@
#include <config.h>
#endif
-//#include "kmclipm_vector.h"
#include "kmclipm_constants.h"
+
#include "kmo_functions.h"
#include "kmo_cpl_extensions.h"
#include "kmo_priv_combine.h"
-#include "kmo_test_create_data.h"
#include "kmo_utils.h"
/**
@@ -43,6 +42,11 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+void kmo_test_fill_cube(cpl_imagelist *cube, float seed, float offset);
+void kmo_test_alloc_cube(cpl_imagelist *cube, int x, int y, int z);
+
/**
* @brief Test for kmo_align_subpix()
*/
@@ -192,7 +196,7 @@ void test_kmo_priv_combine()
"header", "BCS", "gauss", "shifts2.txt",
"ksigma",
3.0, 3.0, 3, 5, 5, BCS_NATURAL, TRUE,
- &data_out,&noise_out);
+ &data_out, &noise_out, NULL);
cpl_test_error(CPL_ERROR_DATA_NOT_FOUND);
// add CD-matrix to header_data
@@ -216,7 +220,7 @@ void test_kmo_priv_combine()
"header", "BCS", "gauss", "shifts2.txt",
"ksigma",
3.0, 3.0, 3, 5, 5, BCS_NATURAL, TRUE,
- &data_out,&noise_out);
+ &data_out,&noise_out, NULL);
cpl_test_error(CPL_ERROR_UNSPECIFIED);
// kmo_test_verbose_on();
@@ -258,7 +262,7 @@ void test_kmo_priv_combine()
"header", "BCS", "gauss", "shifts2.txt",
"ksigma",
3.0, 3.0, 3, 5, 5, BCS_NATURAL, TRUE,
- &data_out,&noise_out);
+ &data_out,&noise_out, NULL);
cpl_test_error(CPL_ERROR_NONE);
cpl_test_abs(kmo_imagelist_get_mean(data_out), 11.3376, 0.01);
cpl_test_abs(kmo_imagelist_get_mean(noise_out), 0, 0.01);
@@ -323,7 +327,7 @@ void test_kmo_priv_combine()
"header", "BCS", "gauss", "shifts2.txt",
"ksigma",
3.0, 3.0, 3, 5, 5, BCS_NATURAL, TRUE,
- &data_out,&noise_out);
+ &data_out,&noise_out, NULL);
cpl_test_error(CPL_ERROR_NONE);
cpl_test_abs(kmo_imagelist_get_mean(data_out), 11.3376, 0.01);
cpl_test_abs(kmo_imagelist_get_mean(noise_out), 0, 0.01);
@@ -392,7 +396,7 @@ void test_kmo_priv_combine()
"header", "BCS", "gauss", "shifts2.txt",
"ksigma",
3.0, 3.0, 3, 5, 5, BCS_NATURAL, TRUE,
- &data_out,&noise_out);
+ &data_out,&noise_out, NULL);
cpl_test_error(CPL_ERROR_NONE);
cpl_test_abs(kmo_imagelist_get_mean(data_out), 11.3376, 0.01);
cpl_test_abs(kmo_imagelist_get_mean(noise_out), 0, 0.01);
diff --git a/kmos/tests/kmo_priv_copy-test.c b/kmos/tests/kmo_priv_copy-test.c
index ac50fc9..67389a8 100644
--- a/kmos/tests/kmo_priv_copy-test.c
+++ b/kmos/tests/kmo_priv_copy-test.c
@@ -32,7 +32,6 @@
#include "kmclipm_vector.h"
#include "kmo_priv_copy.h"
-#include "kmo_test_create_data.h"
#include "kmo_utils.h"
/**
@@ -41,6 +40,13 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+void kmo_test_fill_vector(cpl_vector *vec, float seed, float offset);
+void kmo_test_fill_image(cpl_image *img, float seed, float offset);
+void kmo_test_fill_cube(cpl_imagelist *cube, float seed, float offset);
+void kmo_test_alloc_cube(cpl_imagelist *cube, int x, int y, int z);
+
/**
* @brief Test for kmo_copy_scalar_F1I()
*/
diff --git a/kmos/tests/kmo_priv_dark-test.c b/kmos/tests/kmo_priv_dark-test.c
index d2bdbcf..37b504b 100644
--- a/kmos/tests/kmo_priv_dark-test.c
+++ b/kmos/tests/kmo_priv_dark-test.c
@@ -33,7 +33,6 @@
#include <cpl_plot.h>
-#include "kmo_test_create_data.h"
#include "kmo_priv_dark.h"
#include "kmo_cpl_extensions.h"
#include "kmo_debug.h"
@@ -44,6 +43,9 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+
/**
@brief test for kmo_create_bad_pix_dark()
*/
diff --git a/kmos/tests/kmo_priv_extract_spec-test.c b/kmos/tests/kmo_priv_extract_spec-test.c
index 169d8fb..35bc0cc 100644
--- a/kmos/tests/kmo_priv_extract_spec-test.c
+++ b/kmos/tests/kmo_priv_extract_spec-test.c
@@ -31,7 +31,6 @@
#include "kmclipm_constants.h"
-#include "kmo_test_create_data.h"
#include "kmo_priv_extract_spec.h"
#include "kmo_cpl_extensions.h"
@@ -41,6 +40,10 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+cpl_imagelist* kmo_test_create_cube(int x, int y, int z, int gauss, int *offset);
+
/**
@brief test for kmo_priv_extract_spec()
*/
diff --git a/kmos/tests/kmo_priv_fit_profile-test.c b/kmos/tests/kmo_priv_fit_profile-test.c
index 766f204..2a649ae 100644
--- a/kmos/tests/kmo_priv_fit_profile-test.c
+++ b/kmos/tests/kmo_priv_fit_profile-test.c
@@ -33,7 +33,6 @@
#include <cpl_plot.h>
-#include "kmo_test_create_data.h"
#include "kmo_priv_fit_profile.h"
#include "kmo_cpl_extensions.h"
#include "kmo_debug.h"
diff --git a/kmos/tests/kmo_priv_fits_check-test.c b/kmos/tests/kmo_priv_fits_check-test.c
index e67eddc..1f63411 100644
--- a/kmos/tests/kmo_priv_fits_check-test.c
+++ b/kmos/tests/kmo_priv_fits_check-test.c
@@ -31,10 +31,9 @@
#include "kmclipm_vector.h"
-#include <kmo_test_create_data.h>
-#include <kmo_priv_fits_check.h>
-#include <kmo_cpl_extensions.h>
-#include <kmo_debug.h>
+#include "kmo_priv_fits_check.h"
+#include "kmo_cpl_extensions.h"
+#include "kmo_debug.h"
/**
@defgroup kmo_priv_fits_check_test kmo_priv_fits_check unit tests
@@ -42,6 +41,9 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+
/**
@brief test for kmo_fits_check_print_header()
*/
diff --git a/kmos/tests/kmo_priv_fits_stack-test.c b/kmos/tests/kmo_priv_fits_stack-test.c
index bc1f7cd..aee7078 100644
--- a/kmos/tests/kmo_priv_fits_stack-test.c
+++ b/kmos/tests/kmo_priv_fits_stack-test.c
@@ -29,13 +29,13 @@
#include <config.h>
#endif
-#include <kmo_test_create_data.h>
-#include <kmo_priv_fits_stack.h>
-#include <kmo_cpl_extensions.h>
-#include <kmo_debug.h>
-#include <kmo_dfs.h>
-#include <kmclipm_constants.h>
-#include <kmclipm_functions.h>
+#include "kmclipm_constants.h"
+#include "kmclipm_functions.h"
+
+#include "kmo_priv_fits_stack.h"
+#include "kmo_cpl_extensions.h"
+#include "kmo_debug.h"
+#include "kmo_dfs.h"
/**
@defgroup kmo_priv_fits_stack_test kmo_priv_fits_stack unit tests
@@ -43,6 +43,9 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+
/**
@brief test for kmo_priv_fits_stack()
*/
diff --git a/kmos/tests/kmo_priv_flat-test.c b/kmos/tests/kmo_priv_flat-test.c
index 107845e..c8e2a0f 100644
--- a/kmos/tests/kmo_priv_flat-test.c
+++ b/kmos/tests/kmo_priv_flat-test.c
@@ -32,10 +32,10 @@
#include <math.h>
#include <cpl_plot.h>
+
#include "kmclipm_functions.h"
#include "kmclipm_constants.h"
-#include "kmo_test_create_data.h"
#include "kmo_priv_flat.h"
#include "kmo_cpl_extensions.h"
#include "kmo_debug.h"
@@ -47,6 +47,9 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+
/**
@brief test for kmo_create_bad_pix_flat_thresh()
*/
@@ -108,11 +111,15 @@ void test_kmo_polyfit_edge()
cpl_test_null(kmo_polyfit_edge(NULL, NULL, 3));
cpl_test_error(CPL_ERROR_NULL_INPUT);
- kmclipm_vector *x = kmclipm_vector_load("ref_data/cut_yrow.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/cut_yrow.fits", getenv("srcdir"));
+ kmclipm_vector *x = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
cpl_test_null(kmo_polyfit_edge(x, NULL, 3));
cpl_test_error(CPL_ERROR_NULL_INPUT);
- kmclipm_vector *y = kmclipm_vector_load("ref_data/cut_edge.fits", 0);
+ my_path = cpl_sprintf("%s/ref_data/cut_edge.fits", getenv("srcdir"));
+ kmclipm_vector *y = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
cpl_vector *f = NULL;
cpl_test_nonnull(f = kmo_polyfit_edge(x, y, 3));
@@ -133,12 +140,15 @@ void test_kmo_edge_trace()
kmo_edge_trace(NULL, NULL, NULL, -1, -1);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- cpl_image *data = kmclipm_image_load("ref_data/well_formed_ifus.fits",
- CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/well_formed_ifus.fits", getenv("srcdir"));
+ cpl_image *data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
kmo_edge_trace(data, NULL, NULL, -1, -1);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- kmclipm_vector *ddd = kmclipm_vector_load("ref_data/yrow.fits", 0);
+ my_path = cpl_sprintf("%s/ref_data/yrow.fits", getenv("srcdir"));
+ kmclipm_vector *ddd = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
cpl_vector *yrow = kmclipm_vector_create_non_rejected(ddd);
kmclipm_vector_delete(ddd);
kmo_edge_trace(data, yrow, NULL, -1, -1);
@@ -187,7 +197,9 @@ void test_kmo_calc_calib_frames()
kmo_calc_calib_frames(slit_ids, NULL, 0, NULL, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- FILE *fp = fopen("ref_data/edgepars_matrix.bin","rb");
+ char *my_path = cpl_sprintf("%s/ref_data/edgepars_matrix.bin", getenv("srcdir"));
+ FILE *fp = fopen(my_path,"rb");
+ cpl_free(my_path);
cpl_matrix **edgepars = (cpl_matrix**)cpl_malloc(n*sizeof(cpl_matrix*));
for (i = 0; i < n; i++) {
edgepars[i] = cpl_matrix_new(2*m, 4);
@@ -198,8 +210,9 @@ void test_kmo_calc_calib_frames()
kmo_calc_calib_frames(slit_ids, edgepars, 0, NULL, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- cpl_image *data = kmclipm_image_load("ref_data/well_formed_ifus.fits",
- CPL_TYPE_FLOAT, 0, 0);
+ my_path = cpl_sprintf("%s/ref_data/well_formed_ifus.fits", getenv("srcdir"));
+ cpl_image *data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
kmo_calc_calib_frames(slit_ids, edgepars, 0, data, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
@@ -255,7 +268,9 @@ void test_kmo_curvature_qc()
cpl_test_error(CPL_ERROR_NULL_INPUT);
int n = 8, m = 14;
- FILE *fp = fopen("ref_data/edgepars_matrix.bin","rb");
+ char *my_path = cpl_sprintf("%s/ref_data/edgepars_matrix.bin", getenv("srcdir"));
+ FILE *fp = fopen(my_path,"rb");
+ cpl_free(my_path);
cpl_matrix **edgepars = (cpl_matrix**)cpl_malloc(n*sizeof(cpl_matrix*));
int i = 0;
for (i = 0; i < n; i++) {
@@ -317,7 +332,9 @@ void test_kmo_edgepars_to_table()
cpl_test_error(CPL_ERROR_NULL_INPUT);
kmo_test_verbose_on();
- FILE *fp = fopen("ref_data/edgepars_matrix.bin","rb");
+ char *my_path = cpl_sprintf("%s/ref_data/edgepars_matrix.bin", getenv("srcdir"));
+ FILE *fp = fopen(my_path,"rb");
+ cpl_free(my_path);
cpl_matrix **edgepars = (cpl_matrix**)cpl_malloc(n*sizeof(cpl_matrix*));
for (i = 0; i < n; i++) {
edgepars[i] = cpl_matrix_new(2*m, 4);
@@ -390,7 +407,9 @@ void test_kmo_flat_interpolate_edge_parameters()
{
double checksum = 0;
int n = 8, m = 14;
- FILE *fp = fopen("ref_data/edgepars_matrix.bin","rb");
+ char *my_path = cpl_sprintf("%s/ref_data/edgepars_matrix.bin", getenv("srcdir"));
+ FILE *fp = fopen(my_path,"rb");
+ cpl_free(my_path);
cpl_matrix **edgepars = (cpl_matrix**)cpl_malloc(n*sizeof(cpl_matrix*));
int i = 0;
for (i = 0; i < n; i++) {
@@ -554,7 +573,9 @@ void test_kmo_create_line_profile()
cpl_test_null(kmo_create_line_profile(NULL, -1, -1));
cpl_test_error(CPL_ERROR_NULL_INPUT);
- cpl_image *profile = kmclipm_image_load ("ref_data/line_prof.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/line_prof.fits", getenv("srcdir"));
+ cpl_image *profile = kmclipm_image_load (my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
cpl_test_null(kmo_create_line_profile(profile, 10, 5));
cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
kmo_test_verbose_on();
@@ -590,21 +611,27 @@ void test_kmo_get_slitedges()
cpl_test_error(CPL_ERROR_NULL_INPUT);
kmo_test_verbose_on();
- midline = kmclipm_vector_load("ref_data/midline.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/midline.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
cpl_test_nonnull(pos = kmo_get_slitedges(midline, 1106.87));
cpl_test_error(CPL_ERROR_NONE);
cpl_test_abs(881.8, kmclipm_vector_get_mean(pos), 0.1);
kmclipm_vector_delete(midline);
kmclipm_vector_delete(pos);
- midline = kmclipm_vector_load("ref_data/midline_sv1_blank.fits", 0);
+ my_path = cpl_sprintf("%s/ref_data/midline_sv1_blank.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
cpl_test_nonnull(pos = kmo_get_slitedges(midline, 200));
cpl_test_error(CPL_ERROR_NONE);
cpl_test_abs(696.5, kmclipm_vector_get_mean(pos), 0.1);
kmclipm_vector_delete(midline);
kmclipm_vector_delete(pos);
- midline = kmclipm_vector_load("ref_data/midline_sv2.fits", 0);
+ my_path = cpl_sprintf("%s/ref_data/midline_sv2.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
kmclipm_vector_reject(midline, 0);
kmclipm_vector_reject(midline, 1);
kmclipm_vector_reject(midline, 2);
@@ -620,7 +647,9 @@ void test_kmo_get_slitedges()
kmclipm_vector_delete(midline);
kmclipm_vector_delete(pos);
- midline = kmclipm_vector_load("ref_data/midline_sv2.fits", 0);
+ my_path = cpl_sprintf("%s/ref_data/midline_sv2.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
kmclipm_vector_reject(midline, 0);
kmclipm_vector_reject(midline, 1);
kmclipm_vector_reject(midline, 2);
@@ -636,7 +665,9 @@ void test_kmo_get_slitedges()
kmclipm_vector_delete(midline);
kmclipm_vector_delete(pos);
- midline = kmclipm_vector_load("ref_data/midline_sv2_gap_first.fits", 0);
+ my_path = cpl_sprintf("%s/ref_data/midline_sv2_gap_first.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
kmclipm_vector_reject(midline, 0);
kmclipm_vector_reject(midline, 1);
kmclipm_vector_reject(midline, 2);
@@ -652,7 +683,9 @@ void test_kmo_get_slitedges()
kmclipm_vector_delete(midline);
kmclipm_vector_delete(pos);
- midline = kmclipm_vector_load("ref_data/midline_sv2_gap_last.fits", 0);
+ my_path = cpl_sprintf("%s/ref_data/midline_sv2_gap_last.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
kmclipm_vector_reject(midline, 0);
kmclipm_vector_reject(midline, 1);
kmclipm_vector_reject(midline, 2);
@@ -668,7 +701,9 @@ void test_kmo_get_slitedges()
kmclipm_vector_delete(midline);
kmclipm_vector_delete(pos);
- midline = kmclipm_vector_load("ref_data/midline_sv2_gap_first_last.fits", 0);
+ my_path = cpl_sprintf("%s/ref_data/midline_sv2_gap_first_last.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
kmclipm_vector_reject(midline, 0);
kmclipm_vector_reject(midline, 1);
kmclipm_vector_reject(midline, 2);
@@ -698,7 +733,9 @@ void test_kmo_analize_slitedges()
{
// blank, noisy, no slitlets
- midline = kmclipm_vector_load("ref_data/midline_sv1_blank.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/midline_sv1_blank.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
// estimated threshold, arbitrary edges due to noise
cpl_test_null(pos = kmo_analize_slitedges(midline, 173,
&t_value, &t_level, &t_pos));
@@ -711,28 +748,36 @@ void test_kmo_analize_slitedges()
}
{
// first: gap, last: slit
- midline = kmclipm_vector_load("ref_data/midline_sv2_gap_first.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/midline_sv2_gap_first.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
cpl_test_null(pos = kmo_analize_slitedges(midline, 173,
&t_value, &t_level, &t_pos));
kmclipm_vector_delete(midline);
}
{
// first: slit, last: gap
- midline = kmclipm_vector_load("ref_data/midline_sv2_gap_last.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/midline_sv2_gap_last.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
cpl_test_null(pos = kmo_analize_slitedges(midline, 173,
&t_value, &t_level, &t_pos));
kmclipm_vector_delete(midline);
}
{
// first: gap, last: gap
- midline = kmclipm_vector_load("ref_data/midline_sv2_gap_first_last.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/midline_sv2_gap_first_last.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
cpl_test_null(pos = kmo_analize_slitedges(midline, 173,
&t_value, &t_level, &t_pos));
kmclipm_vector_delete(midline);
}
{
// first: slit, last: slit (normal case)
- midline = kmclipm_vector_load("ref_data/midline_sv2.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/midline_sv2.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
cpl_test_nonnull(pos = kmo_analize_slitedges(midline, 5500,
&t_value, &t_level, &t_pos));
cpl_test_abs(1015.0, kmclipm_vector_get_mean(pos), 0.1);
@@ -759,7 +804,9 @@ void test_kmo_analize_slitedges_advanced()
{
// blank, noisy, no slitlets
- midline = kmclipm_vector_load("ref_data/midline_sv1_blank.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/midline_sv1_blank.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
// estimated threshold, arbitrary edges due to noise
cpl_test_null(pos = kmo_analize_slitedges_advanced(midline, 173, &cut_first, &cut_last));
// too low & too high threshold, no edges
@@ -769,7 +816,9 @@ void test_kmo_analize_slitedges_advanced()
}
{
// first: slit, last: slit (normal case)
- midline = kmclipm_vector_load("ref_data/midline_sv2.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/midline_sv2.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
cpl_test_nonnull(pos = kmo_analize_slitedges_advanced(midline, 5500, &cut_first, &cut_last));
cpl_test_abs(1014.8, kmclipm_vector_get_mean(pos), 0.1);
cpl_test_eq(220, kmclipm_vector_count_non_rejected(pos));
@@ -781,7 +830,9 @@ void test_kmo_analize_slitedges_advanced()
}
{
// first: gap, last: slit
- midline = kmclipm_vector_load("ref_data/midline_sv2_gap_first.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/midline_sv2_gap_first.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
cpl_test_nonnull(pos = kmo_analize_slitedges_advanced(midline, 5500, &cut_first, &cut_last));
cpl_test_abs(1023.9, kmclipm_vector_get_mean(pos), 0.1);
cpl_test_eq(218, kmclipm_vector_count_non_rejected(pos));
@@ -793,7 +844,9 @@ void test_kmo_analize_slitedges_advanced()
}
{
// first: slit, last: gap
- midline = kmclipm_vector_load("ref_data/midline_sv2_gap_last.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/midline_sv2_gap_last.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
cpl_test_nonnull(pos = kmo_analize_slitedges_advanced(midline, 5500, &cut_first, &cut_last));
cpl_test_abs(1005.6, kmclipm_vector_get_mean(pos), 0.1);
cpl_test_eq(218, kmclipm_vector_count_non_rejected(pos));
@@ -805,7 +858,9 @@ void test_kmo_analize_slitedges_advanced()
}
{
// first: gap, last: gap
- midline = kmclipm_vector_load("ref_data/midline_sv2_gap_first_last.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/midline_sv2_gap_first_last.fits", getenv("srcdir"));
+ midline = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
cpl_test_nonnull(pos = kmo_analize_slitedges_advanced(midline, 5500, &cut_first, &cut_last));
cpl_test_abs(1014.75, kmclipm_vector_get_mean(pos), 0.1);
cpl_test_eq(216, kmclipm_vector_count_non_rejected(pos));
@@ -838,7 +893,9 @@ void test_kmo_analyze_flat()
//
// all_blank.fits
//
- data = kmclipm_image_load("ref_data/all_blank.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/all_blank.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -870,7 +927,9 @@ void test_kmo_analyze_flat()
//
// noise_img.fits
//
- data = kmclipm_image_load("ref_data/noise_img.fits", CPL_TYPE_FLOAT, 0, 0);
+ my_path = cpl_sprintf("%s/ref_data/noise_img.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -902,7 +961,9 @@ void test_kmo_analyze_flat()
//
// flat_det_sv1_blank.fits
//
- data = kmclipm_image_load("ref_data/flat_det_sv1_blank.fits", CPL_TYPE_FLOAT, 0, 0);
+ my_path = cpl_sprintf("%s/ref_data/flat_det_sv1_blank.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 1 0 0 0 0 0 0
@@ -937,7 +998,9 @@ void test_kmo_analyze_flat()
//
// test with IFU7 vignetted, IFU8 blank
//
- data = kmclipm_image_load("ref_data/flat_det_sv1.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/flat_det_sv1.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -972,7 +1035,9 @@ void test_kmo_analyze_flat()
//
// test with IFU5 vignetted
//
- data = kmclipm_image_load("ref_data/flat_det_sv2.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/flat_det_sv2.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1032,7 +1097,9 @@ void test_kmo_analyze_flat()
//
// test with IFU5 vignetted, IFU 2 blackened out
//
- data = kmclipm_image_load("ref_data/flat_det_sv2_ifu2_black.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/flat_det_sv2_ifu2_black.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 1 0 0 0 0 0
@@ -1067,7 +1134,9 @@ void test_kmo_analyze_flat()
//
// test with IFU5 vignetted, IFU 1 blackened out
//
- data = kmclipm_image_load("ref_data/flat_det_sv2_ifu1_black.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/flat_det_sv2_ifu1_black.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 1 0 0 0 0 0
@@ -1102,7 +1171,9 @@ void test_kmo_analyze_flat()
//
// test with IFU5 vignetted, IFU 8 blackened out
//
- data = kmclipm_image_load("ref_data/flat_det_sv2_ifu8_black.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/flat_det_sv2_ifu8_black.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 1 0 0 0 0 0
@@ -1137,7 +1208,9 @@ void test_kmo_analyze_flat()
//
// test with IFU5 vignetted, IFU 2,3 blackened out
//
- data = kmclipm_image_load("ref_data/flat_det_sv2_ifu2_3_black.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/flat_det_sv2_ifu2_3_black.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 1 0 0 0 0
@@ -1172,7 +1245,9 @@ void test_kmo_analyze_flat()
//
// test with IFU5 vignetted, IFU 1,8 blackened out
//
- data = kmclipm_image_load("ref_data/flat_det_sv2_ifu1_8_black.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/flat_det_sv2_ifu1_8_black.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 1 0 0 0 0
@@ -1207,7 +1282,9 @@ void test_kmo_analyze_flat()
//
// test with IFU5 vignetted, IFU 1,2,3,4,6,7,8 blackened out
//
- data = kmclipm_image_load("ref_data/flat_det_sv2_ifu1_2_3_4_6_7_8_black.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/flat_det_sv2_ifu1_2_3_4_6_7_8_black.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 1 0 0 0 0
@@ -1242,7 +1319,9 @@ void test_kmo_analyze_flat()
//
// test with IFU3 vignetted
//
- data = kmclipm_image_load("ref_data/flat_det_sv2_2.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/flat_det_sv2_2.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1276,7 +1355,9 @@ void test_kmo_analyze_flat()
//
// test with cut_left_right
//
- data = kmclipm_image_load("ref_data/cut_left_right_222edges.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/cut_left_right_222edges.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1310,7 +1391,9 @@ void test_kmo_analyze_flat()
//
// test with cut_left_right, 166 slitlets --> all deactivated
//
- data = kmclipm_image_load("ref_data/cut_left_right_220edges.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/cut_left_right_220edges.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1345,7 +1428,9 @@ void test_kmo_analyze_flat()
//
// test with cut_left_right, 214 slitlets --> all deactivated
//
- data = kmclipm_image_load("ref_data/out_of_zoom.fits", CPL_TYPE_FLOAT, 0, 0);
+ my_path = cpl_sprintf("%s/ref_data/out_of_zoom.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1381,7 +1466,9 @@ void test_kmo_analyze_flat()
//
// test with shift left one slitlet cut, 196 slitlets
//
- data = kmclipm_image_load("ref_data/shift_left_one_slitlet_cut.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/shift_left_one_slitlet_cut.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1413,7 +1500,9 @@ void test_kmo_analyze_flat()
for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
cpl_free(array);
- data = kmclipm_image_load("ref_data/shift_left_one_slitlet_cut_IFU1_8_missing.fits", CPL_TYPE_FLOAT, 0, 0);
+ my_path = cpl_sprintf("%s/ref_data/shift_left_one_slitlet_cut_IFU1_8_missing.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 1 0
@@ -1444,7 +1533,9 @@ void test_kmo_analyze_flat()
for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
cpl_free(array);
- data = kmclipm_image_load("ref_data/shift_left_one_slitlet_cut_IFU3_present.fits", CPL_TYPE_FLOAT, 0, 0);
+ my_path = cpl_sprintf("%s/ref_data/shift_left_one_slitlet_cut_IFU3_present.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1474,7 +1565,9 @@ void test_kmo_analyze_flat()
for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
cpl_free(array);
- data = kmclipm_image_load("ref_data/shift_left_one_slitlet_cut_IFU6_7_missing.fits", CPL_TYPE_FLOAT, 0, 0);
+ my_path = cpl_sprintf("%s/ref_data/shift_left_one_slitlet_cut_IFU6_7_missing.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1508,7 +1601,9 @@ void test_kmo_analyze_flat()
//
// test with shift right one slitlet cut, 196 slitlets
//
- data = kmclipm_image_load("ref_data/shift_right_one_slitlet_cut.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/shift_right_one_slitlet_cut.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
@@ -1539,7 +1634,9 @@ void test_kmo_analyze_flat()
for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
cpl_free(array);
- data = kmclipm_image_load("ref_data/shift_right_one_slitlet_cut_IFU1_missing.fits", CPL_TYPE_FLOAT, 0, 0);
+ my_path = cpl_sprintf("%s/ref_data/shift_right_one_slitlet_cut_IFU1_missing.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1571,7 +1668,9 @@ void test_kmo_analyze_flat()
for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
cpl_free(array);
- data = kmclipm_image_load("ref_data/shift_right_one_slitlet_cut_IFU2_missing.fits", CPL_TYPE_FLOAT, 0, 0);
+ my_path = cpl_sprintf("%s/ref_data/shift_right_one_slitlet_cut_IFU2_missing.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1605,7 +1704,9 @@ void test_kmo_analyze_flat()
//
// test with large shifts, slitlets cut on one side
//
- data = kmclipm_image_load("ref_data/shift_right_slitlets_cut.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/shift_right_slitlets_cut.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1635,7 +1736,9 @@ void test_kmo_analyze_flat()
for (i = 0; i < 8; i++) cpl_array_delete(array[i]);
cpl_free(array);
- data = kmclipm_image_load("ref_data/shift_left_slitlets_cut.fits", CPL_TYPE_FLOAT, 0, 0);
+ my_path = cpl_sprintf("%s/ref_data/shift_left_slitlets_cut.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1667,7 +1770,9 @@ void test_kmo_analyze_flat()
}
{
// valid test (strong rotation, midline of 100)
- data = kmclipm_image_load("ref_data/strong_rotation_100high.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/strong_rotation_100high.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1698,7 +1803,9 @@ void test_kmo_analyze_flat()
cpl_free(array);
// valid test (strong rotation, midline of size 2)
- data = kmclipm_image_load("ref_data/strong_rotation_2high.fits", CPL_TYPE_FLOAT, 0, 0);
+ my_path = cpl_sprintf("%s/ref_data/strong_rotation_2high.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1729,7 +1836,9 @@ void test_kmo_analyze_flat()
cpl_free(array);
// valid test (strong rotation, midline of 40)
- data = kmclipm_image_load("ref_data/strong_rotation_40high.fits", CPL_TYPE_FLOAT, 0, 0);
+ my_path = cpl_sprintf("%s/ref_data/strong_rotation_40high.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1761,7 +1870,9 @@ void test_kmo_analyze_flat()
}
{
// valid test with 224 slitlet edges
- data = kmclipm_image_load("ref_data/well_formed_ifus.fits", CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/well_formed_ifus.fits", getenv("srcdir"));
+ data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
badpix = cpl_image_duplicate(data);
kmo_image_fill(badpix, 1);
// ifu_inactive in : 0 0 0 0 0 0 0 0
@@ -1803,8 +1914,9 @@ void test_kmo_calc_curvature()
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- cpl_image *data = kmclipm_image_load("ref_data/well_formed_ifus.fits",
- CPL_TYPE_FLOAT, 0, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/well_formed_ifus.fits", getenv("srcdir"));
+ cpl_image *data = kmclipm_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
kmo_calc_curvature(data, NULL, NULL, NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
diff --git a/kmos/tests/kmo_priv_functions-test.c b/kmos/tests/kmo_priv_functions-test.c
index 2868e92..6df92f4 100644
--- a/kmos/tests/kmo_priv_functions-test.c
+++ b/kmos/tests/kmo_priv_functions-test.c
@@ -32,7 +32,6 @@
#include <string.h>
#include "kmo_priv_functions.h"
-#include "kmo_test_create_data.h"
#include "kmo_utils.h"
#include "kmo_dfs.h"
#include "kmo_cpl_extensions.h"
@@ -44,6 +43,10 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+void kmo_test_fill_vector(cpl_vector *vec, float seed, float offset);
+
/**
@brief test for kmo_create_lambda_vec
*/
@@ -106,7 +109,6 @@ void test_kmo_is_in_range()
cpl_vector_set(ranges, 2, 1.1);
cpl_vector_set(ranges, 3, 1.6);
kmo_test_fill_vector(lambda, 0.8, 0.01);
-
cpl_test_eq(0, kmo_is_in_range(ranges, lambda, 1));
cpl_test_eq(1, kmo_is_in_range(ranges, lambda, 12));
cpl_test_eq(0, kmo_is_in_range(ranges, lambda, 28));
@@ -464,8 +466,10 @@ void test_kmo_check_frameset_setup()
cpl_frame *fr = cpl_frame_new();
cpl_frame_set_tag(fr, FLAT_ON);
- cpl_frame_set_filename(fr, "ref_data/flat_on1.fits");
+ char *my_path = cpl_sprintf("%s/ref_data/flat_on1.fits", getenv("srcdir"));
+ cpl_frame_set_filename(fr, my_path);
cpl_frameset_insert(fs, fr);
+ cpl_free(my_path);
kmo_check_frameset_setup(fs, FLAT_ON, 0, 0, 0);
cpl_test_error(CPL_ERROR_NONE);
@@ -483,14 +487,18 @@ void test_kmo_check_frameset_setup()
fr = cpl_frame_new();
cpl_frame_set_tag(fr, FLAT_ON);
- cpl_frame_set_filename(fr, "ref_data/flat_on2.fits");
+ my_path = cpl_sprintf("%s/ref_data/flat_on2.fits", getenv("srcdir"));
+ cpl_frame_set_filename(fr, my_path);
cpl_frameset_insert(fs, fr);
+ cpl_free(my_path);
kmo_check_frameset_setup(fs, FLAT_ON, 1, 1, 1);
cpl_test_error(CPL_ERROR_NONE);
fr = cpl_frame_new();
cpl_frame_set_tag(fr, DARK);
- cpl_frame_set_filename(fr, "ref_data/dark1.fits");
+ my_path = cpl_sprintf("%s/ref_data/dark1.fits", getenv("srcdir"));
+ cpl_frame_set_filename(fr, my_path);
+ cpl_free(my_path);
cpl_frameset_insert(fs, fr);
kmo_check_frameset_setup(fs, FLAT_ON, 1, 1, 1);
cpl_test_error(CPL_ERROR_NONE);
@@ -498,7 +506,9 @@ void test_kmo_check_frameset_setup()
kmo_test_verbose_off();
fr = cpl_frame_new();
cpl_frame_set_tag(fr, FLAT_ON);
- cpl_frame_set_filename(fr, "ref_data/flat_on3.fits");
+ my_path = cpl_sprintf("%s/ref_data/flat_on3.fits", getenv("srcdir"));
+ cpl_frame_set_filename(fr, my_path);
+ cpl_free(my_path);
cpl_frameset_insert(fs, fr);
kmo_check_frameset_setup(fs, FLAT_ON, 1, 1, 1);
cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
@@ -530,11 +540,15 @@ void test_kmo_check_frame_setup()
cpl_frame *fr = cpl_frame_new();
cpl_frame_set_tag(fr, FLAT_ON);
- cpl_frame_set_filename(fr, "ref_data/flat_on1.fits");
+ char *my_path = cpl_sprintf("%s/ref_data/flat_on1.fits", getenv("srcdir"));
+ cpl_frame_set_filename(fr, my_path);
+ cpl_free(my_path);
cpl_frameset_insert(fs, fr);
fr = cpl_frame_new();
cpl_frame_set_tag(fr, XCAL);
- cpl_frame_set_filename(fr, "ref_data/flat_on2.fits");
+ my_path = cpl_sprintf("%s/ref_data/flat_on2.fits", getenv("srcdir"));
+ cpl_frame_set_filename(fr, my_path);
+ cpl_free(my_path);
cpl_frameset_insert(fs, fr);
kmo_check_frame_setup(fs, FLAT_ON, XCAL, 0, 0, 0);
cpl_test_error(CPL_ERROR_NONE);
@@ -554,14 +568,18 @@ void test_kmo_check_frame_setup()
kmo_test_verbose_off();
fr = cpl_frame_new();
cpl_frame_set_tag(fr, FLAT_OFF);
- cpl_frame_set_filename(fr, "ref_data/dark1.fits");
+ my_path = cpl_sprintf("%s/ref_data/dark1.fits", getenv("srcdir"));
+ cpl_frame_set_filename(fr, my_path);
+ cpl_free(my_path);
cpl_frameset_insert(fs, fr);
kmo_check_frame_setup(fs, FLAT_ON, FLAT_OFF, 1, 1, 1);
cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
fr = cpl_frame_new();
cpl_frame_set_tag(fr, YCAL);
- cpl_frame_set_filename(fr, "ref_data/flat_on3.fits");
+ my_path = cpl_sprintf("%s/ref_data/flat_on3.fits", getenv("srcdir"));
+ cpl_frame_set_filename(fr, my_path);
+ cpl_free(my_path);
cpl_frameset_insert(fs, fr);
kmo_check_frame_setup(fs, FLAT_ON, YCAL, 1, 1, 1);
cpl_test_error(CPL_ERROR_ILLEGAL_INPUT);
@@ -578,16 +596,24 @@ void test_kmo_priv_compare_frameset_setup()
{
cpl_frame *fr1 = cpl_frame_new();
cpl_frame_set_tag(fr1, FLAT_ON);
- cpl_frame_set_filename(fr1, "ref_data/flat_on1.fits");
+ char *my_path = cpl_sprintf("%s/ref_data/flat_on1.fits", getenv("srcdir"));
+ cpl_frame_set_filename(fr1, my_path);
+ cpl_free(my_path);
cpl_frame *fr2 = cpl_frame_new();
cpl_frame_set_tag(fr2, XCAL);
- cpl_frame_set_filename(fr2, "ref_data/flat_on2.fits");
+ my_path = cpl_sprintf("%s/ref_data/flat_on2.fits", getenv("srcdir"));
+ cpl_frame_set_filename(fr2, my_path);
+ cpl_free(my_path);
cpl_frame *fr3 = cpl_frame_new();
cpl_frame_set_tag(fr3, FLAT_ON);
- cpl_frame_set_filename(fr3, "ref_data/flat_on3.fits");
+ my_path = cpl_sprintf("%s/ref_data/flat_on3.fits", getenv("srcdir"));
+ cpl_frame_set_filename(fr3, my_path);
+ cpl_free(my_path);
cpl_frame *fr4 = cpl_frame_new();
cpl_frame_set_tag(fr4, FLAT_OFF);
- cpl_frame_set_filename(fr4, "ref_data/dark1.fits");
+ my_path = cpl_sprintf("%s/ref_data/dark1.fits", getenv("srcdir"));
+ cpl_frame_set_filename(fr4, my_path);
+ cpl_free(my_path);
kmo_test_verbose_off();
kmo_priv_compare_frame_setup(NULL, NULL, NULL, NULL, 0, 0, 0);
diff --git a/kmos/tests/kmo_priv_lcorr-test.c b/kmos/tests/kmo_priv_lcorr-test.c
index 0e1f932..d818c46 100644
--- a/kmos/tests/kmo_priv_lcorr-test.c
+++ b/kmos/tests/kmo_priv_lcorr-test.c
@@ -30,15 +30,8 @@
#endif
#include <cpl.h>
-#include "kmo_priv_lcorr.h"
-#include "kmo_test_create_data.h"
-//#include "kmclipm_constants.h"
-//
-//#include "kmo_priv_reconstruct.h"
-//#include "kmo_test_create_data.h"
-//#include "kmo_utils.h"
-//#include "kmo_debug.h"
+#include "kmo_priv_lcorr.h"
/**
@defgroup kmo_priv_lcorr_test kmo_priv_lcorr unit tests
@@ -46,6 +39,8 @@
@{
*/
+void kmo_test_verbose_off();
+
/**
@brief test for kmo_lcorr_create_lambda_vector()
*/
@@ -327,17 +322,25 @@ int main()
cpl_vector_set(range,1,1.7);
cpl_vector_set(range,2,2.0);
cpl_vector_set(range,3,2.3);
- obj_cube = cpl_imagelist_load("ref_data/lcorr_obj_cube.fits", CPL_TYPE_FLOAT, 0);
- obj_header = cpl_propertylist_load("ref_data/lcorr_obj_cube.fits",0);
- obj_mask = cpl_image_load("ref_data/lcorr_obj_mask.fits", CPL_TYPE_FLOAT, 0, 0);
- obj_spectrum_file = cpl_vector_load("ref_data/lcorr_obj_spectrum.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/lcorr_obj_cube.fits", getenv("srcdir"));
+ obj_cube = cpl_imagelist_load(my_path, CPL_TYPE_FLOAT, 0);
+ obj_header = cpl_propertylist_load(my_path,0);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/ref_data/lcorr_obj_mask.fits", getenv("srcdir"));
+ obj_mask = cpl_image_load(my_path, CPL_TYPE_FLOAT, 0, 0);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/ref_data/lcorr_obj_spectrum.fits", getenv("srcdir"));
+ obj_spectrum_file = cpl_vector_load(my_path, 0);
+ cpl_free(my_path);
test_kmo_lcorr_create_lambda_vector(obj_header);
lambda = kmo_lcorr_create_lambda_vector(obj_header);
test_kmo_lcorr_extract_spectrum(obj_cube, obj_header, obj_spectrum_file);
test_kmo_lcorr_create_object_mask(obj_cube, lambda, obj_mask);
- test_kmo_lcorr_read_reference_spectrum("ref_data/lcorr_ohspecHK.fits", lambda);
- ref_spectrum = kmo_lcorr_read_reference_spectrum("ref_data/lcorr_ohspecHK.fits", NULL);
+ my_path = cpl_sprintf("%s/ref_data/lcorr_ohspecHK.fits", getenv("srcdir"));
+ test_kmo_lcorr_read_reference_spectrum(my_path, lambda);
+ ref_spectrum = kmo_lcorr_read_reference_spectrum(my_path, NULL);
+ cpl_free(my_path);
test_kmo_lcorr_get_peak_positions(ref_spectrum);
test_kmo_lcorr_get_peak_lambdas(ref_spectrum);
obj_spectrum = kmo_lcorr_extract_spectrum(obj_cube, obj_header, 0.8, NULL);
@@ -353,6 +356,7 @@ int main()
cpl_vector_delete(lambda);
cpl_vector_delete(range);
cpl_vector_delete(peaks);
+
return cpl_test_end(0);
}
diff --git a/kmos/tests/kmo_priv_make_image-test.c b/kmos/tests/kmo_priv_make_image-test.c
index afad3a2..0979571 100644
--- a/kmos/tests/kmo_priv_make_image-test.c
+++ b/kmos/tests/kmo_priv_make_image-test.c
@@ -29,10 +29,9 @@
#include <config.h>
#endif
-#include <kmo_priv_make_image.h>
-#include <kmo_test_create_data.h>
-#include <kmo_utils.h>
-#include <kmo_debug.h>
+#include "kmo_priv_make_image.h"
+#include "kmo_utils.h"
+#include "kmo_debug.h"
/**
@defgroup kmo_priv_make_image_test kmo_priv_make_image unit tests
@@ -40,6 +39,10 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+void kmo_test_fill_vector(cpl_vector *vec, float seed, float offset);
+
/**
@brief test for kmo_identify_slices_with_oh()
*/
diff --git a/kmos/tests/kmo_priv_noise_map-test.c b/kmos/tests/kmo_priv_noise_map-test.c
index ccfd429..02fcd15 100644
--- a/kmos/tests/kmo_priv_noise_map-test.c
+++ b/kmos/tests/kmo_priv_noise_map-test.c
@@ -29,9 +29,8 @@
#include <config.h>
#endif
-#include <kmo_priv_noise_map.h>
-#include <kmo_test_create_data.h>
-#include <kmo_utils.h>
+#include "kmo_priv_noise_map.h"
+#include "kmo_utils.h"
/**
@defgroup kmo_priv_noise_map_test kmo_priv_noise_map unit tests
@@ -39,6 +38,10 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+void kmo_test_fill_image(cpl_image *img, float seed, float offset);
+
/**
@brief test for kmo_calc_noise_map
*/
diff --git a/kmos/tests/kmo_priv_reconstruct-test.c b/kmos/tests/kmo_priv_reconstruct-test.c
index 448bb50..8a4f349 100644
--- a/kmos/tests/kmo_priv_reconstruct-test.c
+++ b/kmos/tests/kmo_priv_reconstruct-test.c
@@ -32,7 +32,6 @@
#include "kmclipm_constants.h"
#include "kmo_priv_reconstruct.h"
-#include "kmo_test_create_data.h"
#include "kmo_utils.h"
#include "kmo_debug.h"
@@ -42,6 +41,9 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+
/**
@brief test for kmo_calc_flux_in()
*/
@@ -103,13 +105,15 @@ void test_kmo_calc_wcs_gd()
kmo_calc_wcs_gd(NULL, NULL, -1, gd);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- cpl_propertylist *pl1 = kmclipm_propertylist_load("ref_data/head.fits", 0);
+ 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("ref_data/head.fits", 1);
+ 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();
diff --git a/kmos/tests/kmo_priv_rotate-test.c b/kmos/tests/kmo_priv_rotate-test.c
index bd78df8..115ca59 100644
--- a/kmos/tests/kmo_priv_rotate-test.c
+++ b/kmos/tests/kmo_priv_rotate-test.c
@@ -30,7 +30,6 @@
#endif
#include "kmo_priv_rotate.h"
-#include "kmo_test_create_data.h"
#include "kmo_cpl_extensions.h"
/**
@@ -39,6 +38,9 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+
/**
@brief test for kmo_priv_rotate()
*/
diff --git a/kmos/tests/kmo_priv_shift-test.c b/kmos/tests/kmo_priv_shift-test.c
index cdcd993..ce628f9 100644
--- a/kmos/tests/kmo_priv_shift-test.c
+++ b/kmos/tests/kmo_priv_shift-test.c
@@ -32,7 +32,6 @@
#include "kmclipm_constants.h"
#include "kmo_priv_shift.h"
-#include "kmo_test_create_data.h"
#include "kmo_cpl_extensions.h"
/**
@@ -41,6 +40,9 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+
/**
@brief test for kmo_priv_shift()
*/
diff --git a/kmos/tests/kmo_priv_sky_mask-test.c b/kmos/tests/kmo_priv_sky_mask-test.c
index 2f09381..7334706 100644
--- a/kmos/tests/kmo_priv_sky_mask-test.c
+++ b/kmos/tests/kmo_priv_sky_mask-test.c
@@ -29,7 +29,6 @@
#include <config.h>
#endif
-#include "kmo_test_create_data.h"
#include "kmo_priv_sky_mask.h"
#include "kmo_debug.h"
@@ -39,6 +38,10 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+cpl_imagelist* kmo_test_create_cube(int x, int y, int z, int gauss, int *offset);
+
/**
@brief test for kmo_calc_sky_mask()
*/
diff --git a/kmos/tests/kmo_priv_sky_tweak-test.c b/kmos/tests/kmo_priv_sky_tweak-test.c
index a098f48..1f7fc89 100644
--- a/kmos/tests/kmo_priv_sky_tweak-test.c
+++ b/kmos/tests/kmo_priv_sky_tweak-test.c
@@ -11,15 +11,19 @@
#include <config.h>
#endif
-#include <cpl.h>
#include <stdio.h>
#include <math.h>
-#include "kmo_priv_sky_tweak.h"
-#include "kmo_priv_lcorr.h"
-#include "kmo_test_create_data.h"
+
+#include <cpl.h>
+
#include "kmclipm_priv_splines.h"
#include "kmclipm_functions.h"
+#include "kmo_priv_sky_tweak.h"
+#include "kmo_priv_lcorr.h"
+
+void kmo_test_verbose_off();
+
double bessj0(double x)
{
double ax,z;
@@ -112,7 +116,7 @@ void test_kmo_get_thermal_background(cpl_bivector *spectrum) {
*x_result,
*y_result;
float ftol = 1e-3;
- char *ref_filename = "ref_data/sky_tweak_bgd_subtr_ref.fits";
+ char *ref_filename = cpl_sprintf("%s/ref_data/sky_tweak_bgd_subtr_ref.fits", getenv("srcdir"));
int remove_it;
x_spectrum = cpl_bivector_get_x_const(spectrum);
@@ -135,6 +139,7 @@ void test_kmo_get_thermal_background(cpl_bivector *spectrum) {
if (ref != NULL) { cpl_vector_delete(ref); }
if (th_bkg != NULL) { cpl_vector_delete(th_bkg); }
if (result != NULL) { cpl_bivector_delete(result); }
+ cpl_free(ref_filename);
}
void test_kmo_priv_sky_tweak_get_spectra (cpl_imagelist *obj, cpl_imagelist *sky,
@@ -210,8 +215,10 @@ int main(){
cpl_test_init("kmos-spark at mpe.mpg.de", CPL_MSG_WARNING);
kmo_test_verbose_off();
- obj_header = cpl_propertylist_load("ref_data/lcorr_obj_cube.fits",0);
- obj_cube = cpl_imagelist_load("ref_data/lcorr_obj_cube.fits", CPL_TYPE_FLOAT, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/lcorr_obj_cube.fits", getenv("srcdir"));
+ obj_header = cpl_propertylist_load(my_path,0);
+ obj_cube = cpl_imagelist_load(my_path, CPL_TYPE_FLOAT, 0);
+ cpl_free(my_path);
obj_spectrum = kmo_lcorr_extract_spectrum(obj_cube, obj_header, 0.8, NULL);
cpl_imagelist_delete(obj_cube);
cpl_propertylist_delete(obj_header);
@@ -219,9 +226,13 @@ int main(){
test_amoeba();
test_kmo_get_thermal_background(obj_spectrum);
- obj_cube = cpl_imagelist_load("ref_data/sky_tweak_obj_cube.fits", CPL_TYPE_FLOAT, 0);
- sky_cube = cpl_imagelist_load("ref_data/sky_tweak_sky_cube.fits", CPL_TYPE_FLOAT, 0);
- obj_header = cpl_propertylist_load("ref_data/sky_tweak_obj_cube.fits",0);
+ my_path = cpl_sprintf("%s/ref_data/sky_tweak_obj_cube.fits", getenv("srcdir"));
+ obj_cube = cpl_imagelist_load(my_path, CPL_TYPE_FLOAT, 0);
+ obj_header = cpl_propertylist_load(my_path,0);
+ cpl_free(my_path);
+ my_path = cpl_sprintf("%s/ref_data/sky_tweak_sky_cube.fits", getenv("srcdir"));
+ sky_cube = cpl_imagelist_load(my_path, CPL_TYPE_FLOAT, 0);
+ cpl_free(my_path);
for (ix=0; ix<cpl_imagelist_get_size(obj_cube); ix++) {
kmclipm_reject_nan(cpl_imagelist_get(obj_cube, ix));
diff --git a/kmos/tests/kmo_priv_stats-test.c b/kmos/tests/kmo_priv_stats-test.c
index 33abfa3..5b0d964 100644
--- a/kmos/tests/kmo_priv_stats-test.c
+++ b/kmos/tests/kmo_priv_stats-test.c
@@ -30,7 +30,6 @@
#endif
#include "kmo_priv_stats.h"
-#include "kmo_test_create_data.h"
#include "kmo_utils.h"
#include "kmo_debug.h"
@@ -40,6 +39,9 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+
/**
@brief Test for kmo_calc_stats_cube()
*/
diff --git a/kmos/tests/kmo_priv_std_star-test.c b/kmos/tests/kmo_priv_std_star-test.c
index eed56b4..9f10d16 100644
--- a/kmos/tests/kmo_priv_std_star-test.c
+++ b/kmos/tests/kmo_priv_std_star-test.c
@@ -35,7 +35,6 @@
#include "kmclipm_math.h"
#include "kmo_priv_std_star.h"
-#include "kmo_test_create_data.h"
#include "kmo_cpl_extensions.h"
#include "kmo_priv_functions.h"
#include "kmo_utils.h"
@@ -47,6 +46,9 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+
/**
@brief Test for kmo_get_spec_type()
*/
@@ -85,7 +87,9 @@ void test_kmo_get_temperature()
cpl_test_abs(0, kmo_get_temperature(NULL, NULL, NULL), 0.01);
cpl_test_error(CPL_ERROR_NULL_INPUT);
- cpl_table *lut = kmclipm_table_load("ref_data/kmos_spec_type.fits", 1, 0);
+ char *my_path = cpl_sprintf("%s/ref_data/kmos_spec_type.fits", getenv("srcdir"));
+ cpl_table *lut = kmclipm_table_load(my_path, 1, 0);
+ cpl_free(my_path);
cpl_test_abs(0, kmo_get_temperature(lut, NULL, NULL), 0.01);
cpl_test_error(CPL_ERROR_NULL_INPUT);
@@ -151,7 +155,9 @@ void test_kmo_interpolate_vector_wcs()
cpl_test_error(CPL_ERROR_NULL_INPUT);
// not overlapping
- cpl_frame_set_filename(fr, "ref_data/kmos_atmos_k.fits");
+ char *my_path = cpl_sprintf("%s/ref_data/kmos_atmos_k.fits", getenv("srcdir"));
+ cpl_frame_set_filename(fr, my_path);
+ cpl_free(my_path);
cpl_frame_set_tag(fr, "gaga_tag");
cpl_vector_fill(x_out, 0);
cpl_test_null(kmo_interpolate_vector_wcs(fr, x_out));
@@ -183,7 +189,9 @@ void test_kmo_divide_blackbody()
kmo_divide_blackbody(NULL, NULL, -1);
cpl_test_error(CPL_ERROR_NULL_INPUT);
-kmclipm_vector *ddd = kmclipm_vector_load("ref_data/kmos_atmos_k.fits", 1);
+ char *my_path = cpl_sprintf("%s/ref_data/kmos_atmos_k.fits", getenv("srcdir"));
+kmclipm_vector *ddd = kmclipm_vector_load(my_path, 1);
+cpl_free(my_path);
cpl_vector *solar_y = kmclipm_vector_create_non_rejected(ddd);
kmclipm_vector_delete(ddd);
kmo_divide_blackbody(solar_y, NULL, -1);
@@ -226,7 +234,9 @@ void test_kmo_remove_line()
kmo_remove_line(NULL, NULL, NULL, 2.1663, 0.015);
cpl_test_error(CPL_ERROR_NULL_INPUT);
-kmclipm_vector *ddd = kmclipm_vector_load("ref_data/test_br_gamma.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/test_br_gamma.fits", getenv("srcdir"));
+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);
cpl_vector_fill(data, 1);
@@ -238,7 +248,9 @@ kmclipm_vector_delete(ddd);
kmo_remove_line(data, lambda, NULL, 2.1663, 0.015);
cpl_test_error(CPL_ERROR_NULL_INPUT);
-kmclipm_vector *aaa = kmclipm_vector_load("ref_data/kmos_atmos_k.fits", 1);
+ my_path = cpl_sprintf("%s/ref_data/test_br_gamma.fits", getenv("srcdir"));
+kmclipm_vector *aaa = kmclipm_vector_load(my_path, 1);
+ cpl_free(my_path);
cpl_vector *atmos = kmclipm_vector_create_non_rejected(aaa);
kmclipm_vector_delete(aaa);
kmo_remove_line(data, lambda, atmos, 2.1663, 0.015);
@@ -247,7 +259,9 @@ kmclipm_vector_delete(aaa);
kmo_test_verbose_on();
cpl_vector_delete(data);
-kmclipm_vector *iii = kmclipm_vector_load("ref_data/test_br_gamma.fits", 0);
+ my_path = cpl_sprintf("%s/ref_data/test_br_gamma.fits", getenv("srcdir"));
+kmclipm_vector *iii = kmclipm_vector_load(my_path, 0);
+ cpl_free(my_path);
data = cpl_vector_duplicate(iii->data);
kmclipm_vector_delete(iii);
ddd = kmclipm_vector_create(cpl_vector_duplicate(data));
@@ -273,7 +287,9 @@ void test_kmo_calc_counts()
kmo_calc_counts(NULL, NULL, -1, -1, -1, NULL, NULL);
cpl_test_error(CPL_ERROR_NULL_INPUT);
-kmclipm_vector *ddd = kmclipm_vector_load("ref_data/test_br_gamma.fits", 0);
+ char *my_path = cpl_sprintf("%s/ref_data/test_br_gamma.fits", getenv("srcdir"));
+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;
diff --git a/kmos/tests/kmo_priv_wave_cal-test.c b/kmos/tests/kmo_priv_wave_cal-test.c
index 78c6cd6..de1df25 100644
--- a/kmos/tests/kmo_priv_wave_cal-test.c
+++ b/kmos/tests/kmo_priv_wave_cal-test.c
@@ -29,9 +29,8 @@
#include <config.h>
#endif
-#include <kmo_test_create_data.h>
-#include <kmo_priv_wave_cal.h>
-#include <kmo_debug.h>
+#include "kmo_priv_wave_cal.h"
+#include "kmo_debug.h"
/**
@defgroup kmo_priv_wave_cal_test kmo_priv_wave_cal unit tests
diff --git a/kmos/tests/kmo_utils-test.c b/kmos/tests/kmo_utils-test.c
index 4eabec1..14d02f4 100644
--- a/kmos/tests/kmo_utils-test.c
+++ b/kmos/tests/kmo_utils-test.c
@@ -34,7 +34,6 @@
#include <cpl_plot.h>
-#include "kmo_test_create_data.h"
#include "kmo_dfs.h"
#include "kmo_utils.h"
#include "kmo_cpl_extensions.h"
@@ -47,6 +46,10 @@
@{
*/
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+void kmo_test_fill_vector(cpl_vector *vec, float seed, float offset);
+
/**
@brief test for kmos_get_license()
*/
@@ -221,8 +224,9 @@ void test_kmo_identify_fits_header()
{
main_fits_desc main_desc;
- main_desc = kmo_identify_fits_header(
- "../../recipes/tests/ref_data/KMOS_dummy.fits");
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+ main_desc = kmo_identify_fits_header(my_path);
+ cpl_free(my_path);
cpl_test_eq(3, main_desc.nr_ext);
cpl_test_eq(raw_fits, main_desc.fits_type);
cpl_test_eq(detector_frame, main_desc.frame_type);
@@ -303,8 +307,9 @@ void test_kmo_free_fits_desc()
{
main_fits_desc main_desc;
- main_desc = kmo_identify_fits_header(
- "../../recipes/tests/ref_data/KMOS_dummy.fits");
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+ main_desc = kmo_identify_fits_header(my_path);
+ cpl_free(my_path);
kmo_free_fits_desc(&main_desc);
diff --git a/recipes/Makefile.am b/recipes/Makefile.am
index b4f9de5..912f409 100644
--- a/recipes/Makefile.am
+++ b/recipes/Makefile.am
@@ -31,7 +31,8 @@ MAINTAINERCLEANFILES = Makefile.in
endif
-INCLUDES = $(all_includes) -I../kmclipm/include/
+INCLUDES = $(all_includes)
+#INCLUDES = $(all_includes) -I../kmclipm/include/
noinst_HEADERS =
diff --git a/recipes/Makefile.in b/recipes/Makefile.in
index d257708..03e7c51 100644
--- a/recipes/Makefile.in
+++ b/recipes/Makefile.in
@@ -349,6 +349,7 @@ LIBCPLDFS = @LIBCPLDFS@
LIBCPLDRS = @LIBCPLDRS@
LIBCPLUI = @LIBCPLUI@
LIBIRPLIB = @LIBIRPLIB@
+LIBKMCLIPMLIB = @LIBKMCLIPMLIB@
LIBKMOS = @LIBKMOS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@@ -454,7 +455,8 @@ AUTOMAKE_OPTIONS = 1.8 foreign
DISTCLEANFILES = *~
SUBDIRS = tests
@MAINTAINER_MODE_TRUE at MAINTAINERCLEANFILES = Makefile.in
-INCLUDES = $(all_includes) -I../kmclipm/include/
+INCLUDES = $(all_includes)
+#INCLUDES = $(all_includes) -I../kmclipm/include/
noinst_HEADERS =
#-----------------------------------------------------------------
diff --git a/recipes/kmo_combine.c b/recipes/kmo_combine.c
index 835acef..36d5f70 100644
--- a/recipes/kmo_combine.c
+++ b/recipes/kmo_combine.c
@@ -199,6 +199,7 @@ static char kmo_combine_description[] =
" category Type Explanation\n"
" -------- ----- -----------\n"
" COMBINE_<ESO PRO CATG> F3I Combined data cube\n"
+" EXP_MASK_<ESO PRO CATG> F3I Exposure time mask\n"
"-------------------------------------------------------------------------------\n"
"\n";
@@ -418,26 +419,6 @@ static int kmo_combine_destroy(cpl_plugin *plugin)
*/
static int kmo_combine(cpl_parameterlist *parlist, cpl_frameset *frameset)
{
- const char *method = NULL,
- *cmethod = NULL,
- *fmethod = NULL,
- *filename = NULL,
- *frame_filename = NULL,
- *ifus_txt = NULL,
- *tmp_strc = NULL;
-
- char *tmp_str = NULL,
- *mapping_mode = NULL,
- *name = NULL,
- **name_vec = NULL;
-
- cpl_imagelist **data_cube_list = NULL,
- **noise_cube_list = NULL,
- *cube_combined_data = NULL,
- *cube_combined_noise= NULL;
-
- cpl_vector *ifus = NULL;
-
int ret_val = 0,
nr_frames = 0,
index = 0,
@@ -456,19 +437,34 @@ static int kmo_combine(cpl_parameterlist *parlist, cpl_frameset *frameset)
j = 0,
ifu_nr = 0,
nv = 0;
-
double cpos_rej = 0.0,
cneg_rej = 0.0;
-
+ char *tmp_str = NULL,
+ *fn_combine = NULL,
+ *fn_mask = NULL,
+ *mapping_mode = NULL,
+ *name = NULL,
+ **name_vec = NULL;
+ const char *method = NULL,
+ *cmethod = NULL,
+ *fmethod = NULL,
+ *filename = NULL,
+ *frame_filename = NULL,
+ *ifus_txt = NULL,
+ *tmp_strc = NULL;
+ cpl_vector *ifus = NULL;
+ cpl_image *exp_mask = NULL;
+ cpl_imagelist **data_cube_list = NULL,
+ **noise_cube_list = NULL,
+ *cube_combined_data = NULL,
+ *cube_combined_noise= NULL;
cpl_propertylist *main_header = NULL,
**data_header_list = NULL,
**noise_header_list = NULL,
*tmp_header = NULL;
-
cpl_frame *frame = NULL;
cpl_size ci = 0;
main_fits_desc desc;
-
enum extrapolationType extrapol_enum = NONE_CLIPPING;
KMO_TRY
@@ -690,19 +686,22 @@ static int kmo_combine(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_free(tmp_str); tmp_str = NULL;
for (ifu_nr = 1; ifu_nr <= KMOS_NR_IFUS; ifu_nr++) {
+ found = 0;
tmp_str = kmo_get_name_from_ocs_ifu(frame, ifu_nr);
KMO_TRY_CHECK_ERROR_STATE();
- found = 0;
- for (j = 0; j < name_vec_size; j++) {
- if (strcmp(name_vec[j], tmp_str) == 0) {
- found = TRUE;
- break;
+
+ if (tmp_str != NULL) {
+ for (j = 0; j < name_vec_size; j++) {
+ if (strcmp(name_vec[j], tmp_str) == 0) {
+ found = TRUE;
+ break;
+ }
+ }
+ if (!found) {
+ name_vec[name_vec_size++] = tmp_str;
+ } else {
+ cpl_free(tmp_str); tmp_str = NULL;
}
- }
- if (!found) {
- name_vec[name_vec_size++] = tmp_str;
- } else {
- cpl_free(tmp_str); tmp_str = NULL;
}
}
}
@@ -714,8 +713,19 @@ static int kmo_combine(cpl_parameterlist *parlist, cpl_frameset *frameset)
name_vec[0] = cpl_sprintf("mapping"));
} else {
if (ifus != NULL) {
+ char *tmptmp = NULL;
+ if (strlen(ifus_txt) > 10) {
+ KMO_TRY_EXIT_IF_NULL(
+ tmptmp = kmo_shorten_ifu_string(ifus_txt));
+ cpl_msg_info("", "Because of lengthy ifus-parameter, filenames of products and their EXTNAME keywords will be truncated to ...ifu%s...", tmptmp);
+ } else {
+ KMO_TRY_EXIT_IF_NULL(
+ tmptmp = cpl_sprintf("%s", ifus_txt));
+ }
KMO_TRY_EXIT_IF_NULL(
- name_vec[0] = cpl_sprintf("IFU%s", ifus_txt));
+ name_vec[0] = cpl_sprintf("IFU%s", tmptmp));
+ ifus_txt = "";
+ cpl_free(tmptmp); tmptmp = NULL;
} else {
KMO_TRY_EXIT_IF_NULL(
name_vec[0] = cpl_sprintf("%s", name));
@@ -929,7 +939,8 @@ static int kmo_combine(cpl_parameterlist *parlist, cpl_frameset *frameset)
extrapol_enum,
flux,
&cube_combined_data,
- &cube_combined_noise));
+ &cube_combined_noise,
+ &exp_mask));
//
// save data
@@ -943,20 +954,28 @@ static int kmo_combine(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_EXIT_IF_NULL(
main_header = kmo_dfs_load_primary_header(frameset, "0"));
KMO_TRY_EXIT_IF_NULL(
- tmp_str = cpl_sprintf("%s_%s_%s",
- COMBINE,
+ fn_combine = cpl_sprintf("%s_%s_%s",
+ COMBINE,
+ cpl_propertylist_get_string(main_header, CPL_DFS_PRO_CATG),
+ name_vec[nv]));
+ KMO_TRY_EXIT_IF_NULL(
+ fn_mask = cpl_sprintf("%s_%s_%s",
+ EXP_MASK,
cpl_propertylist_get_string(main_header, CPL_DFS_PRO_CATG),
name_vec[nv]));
cpl_propertylist_delete(main_header); main_header = NULL;
} else {
KMO_TRY_EXIT_IF_NULL(
- tmp_str = cpl_sprintf("%s_%d", COMBINE, suppress_index++));
+ fn_combine = cpl_sprintf("%s_%d", COMBINE, suppress_index));
+ KMO_TRY_EXIT_IF_NULL(
+ fn_mask = cpl_sprintf("%s_%d", EXP_MASK, suppress_index++));
}
frame = cpl_frameset_get_first(frameset);
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_main_header(frameset, tmp_str, "", frame, NULL,
- parlist, cpl_func));
+ kmo_dfs_save_main_header(frameset, fn_combine, "", frame, NULL, parlist, cpl_func));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_main_header(frameset, fn_mask, "", frame, NULL, parlist, cpl_func));
if (data_header_list[0] != NULL) {
if (cpl_propertylist_has(data_header_list[0], "ESO PRO FRNAME")) {
@@ -969,15 +988,16 @@ static int kmo_combine(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_cube(cube_combined_data, tmp_str, "",
- data_header_list[0], 0./0.));
-
+ kmo_dfs_save_cube(cube_combined_data, fn_combine, "", data_header_list[0], 0./0.));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_cube(cube_combined_noise, fn_combine, "", noise_header_list[0], 0./0.));
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_cube(cube_combined_noise, tmp_str, "",
- noise_header_list[0], 0./0.));
+ kmo_dfs_save_image(exp_mask, fn_mask, "", data_header_list[0], 0./0.));
cpl_imagelist_delete(cube_combined_data); cube_combined_data = NULL;
cpl_imagelist_delete(cube_combined_noise); cube_combined_noise = NULL;
+ cpl_image_delete(exp_mask); exp_mask = NULL;
+
if (data_cube_list != NULL) {
for (i = 0; i < nr_frames*KMOS_NR_IFUS; i++) {
cpl_imagelist_delete(data_cube_list[i]); data_cube_list[i] = NULL;
@@ -1000,7 +1020,8 @@ static int kmo_combine(cpl_parameterlist *parlist, cpl_frameset *frameset)
noise_header_list[i] = NULL;
}
}
- cpl_free(tmp_str); tmp_str = NULL;
+ cpl_free(fn_combine); fn_combine = NULL;
+ cpl_free(fn_mask); fn_mask = NULL;
}
}
KMO_CATCH
@@ -1013,6 +1034,7 @@ static int kmo_combine(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_vector_delete(ifus); ifus = NULL;
cpl_imagelist_delete(cube_combined_data); cube_combined_data = NULL;
cpl_imagelist_delete(cube_combined_noise); cube_combined_noise = NULL;
+ cpl_image_delete(exp_mask); exp_mask = NULL;
if (data_cube_list != NULL) {
for (i = 0; i < nr_frames*KMOS_NR_IFUS; i++) {
diff --git a/recipes/kmo_copy.c b/recipes/kmo_copy.c
index ddf950c..8d42ee2 100644
--- a/recipes/kmo_copy.c
+++ b/recipes/kmo_copy.c
@@ -34,6 +34,7 @@
#include <string.h>
#include <cpl.h>
+
#include "kmclipm_constants.h"
#include "kmclipm_functions.h"
diff --git a/recipes/kmo_dev_setup.c b/recipes/kmo_dev_setup.c
index 9021c52..3f1d256 100644
--- a/recipes/kmo_dev_setup.c
+++ b/recipes/kmo_dev_setup.c
@@ -38,6 +38,7 @@
#include <string.h>
#include <cpl.h>
+
#include "kmclipm_math.h"
#include "kmo_priv_reconstruct.h"
diff --git a/recipes/kmo_flat.c b/recipes/kmo_flat.c
index 16b413e..0b8276f 100644
--- a/recipes/kmo_flat.c
+++ b/recipes/kmo_flat.c
@@ -1343,6 +1343,7 @@ static int kmo_flat(cpl_parameterlist *parlist, cpl_frameset *frameset)
}
}
} // for (nr_devices)
+ KMO_TRY_CHECK_ERROR_STATE();
//
// ------------ saving headers ------------
diff --git a/recipes/kmo_illumination.c b/recipes/kmo_illumination.c
index a0cbce8..bb6a783 100644
--- a/recipes/kmo_illumination.c
+++ b/recipes/kmo_illumination.c
@@ -38,11 +38,12 @@
#include <cpl.h>
+#include "kmclipm_priv_splines.h"
+
#include "kmo_priv_reconstruct.h"
#include "kmo_priv_functions.h"
#include "kmo_priv_flat.h"
#include "kmo_priv_wave_cal.h"
-#include "kmclipm_priv_splines.h"
#include "kmo_functions.h"
#include "kmo_cpl_extensions.h"
#include "kmo_dfs.h"
diff --git a/recipes/kmo_illumination_flat.c b/recipes/kmo_illumination_flat.c
index 4c80244..908990c 100644
--- a/recipes/kmo_illumination_flat.c
+++ b/recipes/kmo_illumination_flat.c
@@ -38,11 +38,12 @@
#include <cpl.h>
+#include "kmclipm_priv_splines.h"
+
#include "kmo_priv_reconstruct.h"
#include "kmo_priv_functions.h"
#include "kmo_priv_flat.h"
#include "kmo_priv_wave_cal.h"
-#include "kmclipm_priv_splines.h"
#include "kmo_functions.h"
#include "kmo_cpl_extensions.h"
#include "kmo_dfs.h"
diff --git a/recipes/kmo_multi_reconstruct.c b/recipes/kmo_multi_reconstruct.c
index c3b1a46..b4b89dc 100644
--- a/recipes/kmo_multi_reconstruct.c
+++ b/recipes/kmo_multi_reconstruct.c
@@ -36,6 +36,7 @@
#include <math.h>
#include <cpl.h>
+
#include "kmclipm_constants.h"
#include "kmclipm_functions.h"
@@ -121,6 +122,13 @@ static char kmo_multi_reconstruct_description[] =
"products with the same category are produced, they will be numered consecutively\n"
"starting from 0.\n"
"\n"
+"--obj_sky_table\n"
+"The automatic obj-sky-associations can be modified by indicating a file with\n"
+"the desired associations. Therefore the file written to disk by default\n"
+"(without setting this option) can be edited manually. The formatting must\n"
+"absolutely be retained, just the type codes ('O' and'S') and the associated\n"
+"frame indices should be altered\n"
+"\n"
" Advanced reconstruction parameters\n"
" ----------------------------------\n"
"--neighborhoodRange\n"
@@ -142,7 +150,6 @@ static char kmo_multi_reconstruct_description[] =
"--no_subtract\n"
"If set to TRUE, the found objects and references won't be sky subtracted. \n"
"Additionally all IFUs will be reconstructed, even the ones containing skies. \n"
-"This option sets the parameter no_combine to TRUE automatically.\n"
"\n"
"--xcal_interpolation\n"
"If true interpolate the pixel position in the slitlet (xcal) using the two\n"
@@ -480,6 +487,17 @@ static int kmo_multi_reconstruct_create(cpl_plugin *plugin)
cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
cpl_parameterlist_append(recipe->parameters, p);
+ /* --obj_sky_table */
+ p = cpl_parameter_new_value("kmos.kmo_multi_reconstruct.obj_sky_table",
+ CPL_TYPE_STRING,
+ "The path to the file with the modified obj/sky associations.",
+ "kmos.kmo_multi_reconstruct",
+ "");
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "obj_sky_table");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
+
// add parameters for band-definition
kmo_band_pars_create(recipe->parameters,
"kmos.kmo_multi_reconstruct");
@@ -590,6 +608,7 @@ static int kmo_multi_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frame
*name = NULL,
*tmp_str = NULL,
*filename = NULL,
+ *fn_obj_sky_table = NULL,
*comb_method = NULL,
*cmethod = NULL,
*fmethod = NULL,
@@ -834,6 +853,15 @@ static int kmo_multi_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frame
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_print_parameter_help(parlist, "kmos.kmo_multi_reconstruct.dev_cal"));
+ fn_obj_sky_table = kmo_dfs_get_parameter_string(parlist,
+ "kmos.kmo_multi_reconstruct.obj_sky_table");
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_print_parameter_help(parlist,
+ "kmos.kmo_multi_reconstruct.obj_sky_table"));
+
+
KMO_TRY_EXIT_IF_ERROR(
kmo_combine_pars_load(parlist,
"kmos.kmo_multi_reconstruct",
@@ -1129,18 +1157,41 @@ static int kmo_multi_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frame
// get valid object names to process, either one object name across
// several SCIENCE frames, or all object names
//
- KMO_TRY_EXIT_IF_NULL(
- arm_name_struct = kmo_create_armNameStruct(frameset,
- SCIENCE,
- ifus,
- name,
- unused_ifus_after,
- bounds,
- mapping_mode,
- no_subtract));
- cpl_free(bounds); bounds = NULL;
+ if (strcmp(fn_obj_sky_table, "") == 0) {
+ KMO_TRY_EXIT_IF_NULL(
+ arm_name_struct = kmo_create_armNameStruct(frameset,
+ SCIENCE,
+ ifus,
+ name,
+ unused_ifus_after,
+ bounds,
+ mapping_mode,
+ no_subtract));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_save_objSkyStruct(arm_name_struct->obj_sky_struct));
+ } else {
+ // read in obj/sky-table
+ objSkyStruct *obj_sky_struct = NULL;
+ KMO_TRY_EXIT_IF_NULL(
+ obj_sky_struct = kmo_read_objSkyStruct(fn_obj_sky_table,
+ frameset,
+ SCIENCE));
+
+ KMO_TRY_EXIT_IF_NULL(
+ arm_name_struct = kmo_create_armNameStruct2(obj_sky_struct,
+ frameset,
+ SCIENCE,
+ ifus,
+ name,
+ unused_ifus_after,
+ bounds,
+ mapping_mode,
+ no_subtract));
+
+ }
kmo_print_armNameStruct(frameset, arm_name_struct);
+ cpl_free(bounds); bounds = NULL;
//
// check availability of tellurics for the different IFUs used
diff --git a/recipes/kmo_reconstruct.c b/recipes/kmo_reconstruct.c
index 5ed50ef..d9ed916 100644
--- a/recipes/kmo_reconstruct.c
+++ b/recipes/kmo_reconstruct.c
@@ -987,6 +987,7 @@ static int kmo_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frameset)
ycal_frame,
lcal_frame,
NULL,
+ NULL,
&gd,
&cube_data,
&cube_noise,
@@ -1020,6 +1021,7 @@ static int kmo_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frameset)
ycal_frame,
lcal_frame,
lcorr_coeffs,
+ NULL,
&gd,
&cube_data,
&cube_noise,
diff --git a/recipes/kmo_sci_red.c b/recipes/kmo_sci_red.c
index 8082af8..e04ed99 100644
--- a/recipes/kmo_sci_red.c
+++ b/recipes/kmo_sci_red.c
@@ -36,11 +36,13 @@
#include <math.h>
#include <cpl.h>
+
#include "kmclipm_constants.h"
#include "kmclipm_functions.h"
#include "kmo_debug.h"
#include "kmo_constants.h"
+#include "kmo_cpl_extensions.h"
#include "kmo_priv_lcorr.h"
#include "kmo_utils.h"
#include "kmo_error.h"
@@ -133,6 +135,13 @@ static char kmo_sci_red_description[] =
"If set to TRUE subtract the thermal background from the cube resulting from sky tweaking.\n"
"Default value is TRUE.\n"
"\n"
+"--obj_sky_table\n"
+"The automatic obj-sky-associations can be modified by indicating a file with\n"
+"the desired associations. Therefore the file written to disk by default\n"
+"(without setting this option) can be edited manually. The formatting must\n"
+"absolutely be retained, just the type codes ('O' and'S') and the associated\n"
+"frame indices should be altered\n"
+"\n"
" Advanced reconstruction parameters\n"
" ----------------------------------\n"
"--neighborhoodRange\n"
@@ -174,6 +183,15 @@ static char kmo_sci_red_description[] =
"original size. For frames taken with mapping templates, extrapolation is\n"
"switched on automatically.\n"
"\n"
+"--velocity_offset\n"
+"Specifies the velocity offset correction in km/s for lambda scale.\n"
+"Default is 0.0 km/s, i.e. no velocity correction.\n"
+"\n"
+"--save_interims\n"
+"If set to TRUE the interim object and sky cubes used for sky tweaking are saved\n"
+"to FITS file in the same format as SCI_RECONSTRUCTED\n"
+ "Default is FALSE.\n"
+ "\n"
" Advanced combining parameters\n"
" ----------------------------------\n"
"--edge_nan\n"
@@ -280,6 +298,13 @@ static char kmo_sci_red_description[] =
" -------- ----- -----------\n"
" SCI_COMBINED F3I Combined cubes with noise\n"
" SCI_RECONSTRUCTED F3I Reconstructed cube with noise\n"
+" EXP_MASK F3I Exposure time mask (not for mapping-templates!)\n"
+" SCI_INTERIM_OBJECT F3I (optional) Intermediate reconstructed object \n"
+" cubes used for sky tweaking, no noise \n"
+" (set --sky_tweak and --save_interims)\n"
+" SCI_INTERIM_SKY F3I (optional) Intermediate reconstructed sky \n"
+" cubes used for sky tweaking, no noise\n"
+" (set --sky_tweak and --save_interims)\n"
"------------------------------------------------------------------------------\n"
"\n";
@@ -592,6 +617,37 @@ static int kmo_sci_red_create(cpl_plugin *plugin)
kmo_band_pars_create(recipe->parameters,
"kmos.kmo_sci_red");
+ /* --obj_sky_table */
+ p = cpl_parameter_new_value("kmos.kmo_sci_red.obj_sky_table",
+ CPL_TYPE_STRING,
+ "The path to the file with the modified obj/sky associations.",
+ "kmos.kmo_sci_red",
+ "");
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "obj_sky_table");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
+ /* --velocity_offset */
+ p = cpl_parameter_new_value("kmos.kmo_sci_red.velocity_offset",
+ CPL_TYPE_DOUBLE,
+ "Specify velocity offset correction in km/s for lambda scale",
+ "kmos.kmo_sci_red",
+ 0.0);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "velocity_offset");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
+ /* --save_interims */
+ p = cpl_parameter_new_value("kmos.kmo_sci_red.save_interims",
+ CPL_TYPE_BOOL,
+ "Save interim object and sky cubes. "
+ "Can only be used together with --sky_tweak",
+ "kmos.kmo_sci_red",
+ FALSE);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "save_interims");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
return kmo_combine_pars_create(recipe->parameters,
"kmos.kmo_sci_red",
DEF_REJ_METHOD,
@@ -678,17 +734,22 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
do_sky_subtraction = FALSE,
sky_tweak = FALSE,
tbsub = TRUE,
+ save_interims = FALSE,
xcal_interpolation = FALSE,
suppress_extension = FALSE,
suppress_index = 0,
i = 0,
sf = 0,
jj = 0,
- ifu_nr = 0;
+ ifu_nr = 0,
+ sky_ifu_nr = 0;
double neighborhoodRange = 1.001,
cpos_rej = 0.0,
cneg_rej = 0.0,
- pix_scale = 0.0;
+ pix_scale = 0.0,
+ velo_offset = 0.0,
+ velo_corr = 0.0;
+ double *velo_corr_ptr = NULL;
char *suffix = NULL,
*keyword = NULL,
*extname = NULL,
@@ -703,10 +764,14 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
*filter_id = NULL,
*tmp_str = NULL,
*filename = NULL,
+ *fn_obj_sky_table = NULL,
*fn_out = NULL,
+ *fn_out_mask = NULL,
*fn_obj = NULL,
*fn_sky = NULL,
*fn_reconstr = NULL,
+ *fn_interim_object = NULL,
+ *fn_interim_sky = NULL,
*comb_method = NULL,
*cmethod = NULL,
*fmethod = NULL;
@@ -721,17 +786,22 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
*tmp_frame = NULL;
cpl_propertylist *tmp_header = NULL,
*main_header = NULL,
+ *main_sky_header = NULL,
**header_data = NULL,
- **header_noise = NULL;
+ **header_noise = NULL,
+ **header_sky = NULL;
cpl_vector *ifus = NULL;
kmclipm_vector *telluric_data = NULL,
*telluric_noise = NULL;
cpl_image **lcal = NULL,
*illum_data = NULL,
*illum_noise = NULL,
- *tmpImg = NULL;
+ *tmpImg = NULL,
+ *exp_mask = NULL;
cpl_imagelist **cube_data = NULL,
**cube_noise = NULL,
+ **cube_interim_object = NULL,
+ **cube_interim_sky = NULL,
*sky_data = NULL,
*sky_noise = NULL,
*combined_data = NULL,
@@ -741,7 +811,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_frame *sky_frame = NULL,
*sky_as_object_frame = NULL,
*ref_spectrum_frame = NULL;
- cpl_polynomial *lcorr_coeffs = NULL;
+ cpl_polynomial *oh_lcorr_coeffs = NULL;
main_fits_desc desc1,
desc2,
desc_telluric;
@@ -819,8 +889,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
//
cpl_msg_info("", "--- Parameter setup for kmo_sci_red ------");
- flux = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_sci_red.flux");
+ flux = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_sci_red.flux");
KMO_TRY_ASSURE((flux == 0) ||
(flux == 1),
@@ -830,8 +899,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.flux"));
- background = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_sci_red.background");
+ background = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_sci_red.background");
KMO_TRY_ASSURE((background == 0) ||
(background == 1),
@@ -842,8 +910,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.background"));
KMO_TRY_EXIT_IF_NULL(
- imethod = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_sci_red.imethod"));
+ imethod = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_sci_red.imethod"));
KMO_TRY_ASSURE((strcmp(imethod, "NN") == 0) ||
(strcmp(imethod, "lwNN") == 0) ||
@@ -858,8 +925,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.imethod"));
KMO_TRY_EXIT_IF_NULL(
- smethod = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_sci_red.smethod"));
+ smethod = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_sci_red.smethod"));
KMO_TRY_ASSURE((strcmp(smethod, "NN") == 0) ||
(strcmp(smethod, "CS") == 0),
@@ -867,11 +933,9 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
"smethod must be either \"NN\" or \"CS\"!");
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_sci_red.smethod"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.smethod"));
- neighborhoodRange = kmo_dfs_get_parameter_double(parlist,
- "kmos.kmo_sci_red.neighborhoodRange");
+ neighborhoodRange = kmo_dfs_get_parameter_double(parlist, "kmos.kmo_sci_red.neighborhoodRange");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_ASSURE(neighborhoodRange > 0.0,
@@ -879,16 +943,13 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
"neighborhoodRange must be greater than 0.0");
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_sci_red.neighborhoodRange"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.neighborhoodRange"));
KMO_TRY_EXIT_IF_NULL(
- comb_method = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_sci_red.method"));
+ comb_method = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_sci_red.method"));
KMO_TRY_EXIT_IF_NULL(
- fmethod = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_sci_red.fmethod"));
+ fmethod = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_sci_red.fmethod"));
KMO_TRY_ASSURE((strcmp(comb_method, "none") == 0) ||
(strcmp(comb_method, "header") == 0) ||
@@ -899,8 +960,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
"'header', 'center' or 'user'");
if (strcmp(comb_method, "user") == 0) {
- filename = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_sci_red.filename");
+ filename = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_sci_red.filename");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_ASSURE(strcmp(filename, "") != 0,
@@ -909,15 +969,13 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
"provided!");
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_sci_red.filename"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.filename"));
}
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.method"));
- ifus_txt = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_sci_red.ifus");
+ ifus_txt = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_sci_red.ifus");
KMO_TRY_CHECK_ERROR_STATE();
name = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_sci_red.name");
@@ -954,8 +1012,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
kmo_band_pars_load(parlist, "kmos.kmo_sci_red");
- extrapolate = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_sci_red.extrapolate");
+ extrapolate = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_sci_red.extrapolate");
KMO_TRY_CHECK_ERROR_STATE();
if (strcmp(smethod, "NN") == 0) {
@@ -984,8 +1041,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.extrapolate"));
- fast_mode = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_sci_red.fast_mode");
+ fast_mode = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_sci_red.fast_mode");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_ASSURE((fast_mode == TRUE) ||
(fast_mode == FALSE),
@@ -994,8 +1050,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.fast_mode"));
- edge_nan = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_sci_red.edge_nan");
+ edge_nan = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_sci_red.edge_nan");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.edge_nan"));
@@ -1004,8 +1059,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
CPL_ERROR_ILLEGAL_INPUT,
"edge_nan must be TRUE or FALSE!");
- no_combine = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_sci_red.no_combine");
+ no_combine = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_sci_red.no_combine");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_EXIT_IF_ERROR(
@@ -1015,8 +1069,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
CPL_ERROR_ILLEGAL_INPUT,
"no_combine must be TRUE or FALSE!");
- no_subtract = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_sci_red.no_subtract");
+ no_subtract = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_sci_red.no_subtract");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_EXIT_IF_ERROR(
@@ -1026,8 +1079,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
CPL_ERROR_ILLEGAL_INPUT,
"no_subtract must be TRUE or FALSE!");
- sky_tweak = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_sci_red.sky_tweak");
+ sky_tweak = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_sci_red.sky_tweak");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_EXIT_IF_ERROR(
@@ -1039,25 +1091,22 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_ASSURE(!((no_subtract == TRUE) && (sky_tweak == TRUE)),
CPL_ERROR_ILLEGAL_INPUT,
- "Either no_subtract or sky_tweak or both must be FALSE");
+ "Either no_subtract or sky_tweak or both must be FALSE (try instead sky_tweak and save_interims)!");
tbsub = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_sci_red.tbsub");
KMO_TRY_CHECK_ERROR_STATE();
- pix_scale = kmo_dfs_get_parameter_double(parlist,
- "kmos.kmo_sci_red.pix_scale");
+ pix_scale = kmo_dfs_get_parameter_double(parlist, "kmos.kmo_sci_red.pix_scale");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_sci_red.pix_scale"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.pix_scale"));
KMO_TRY_ASSURE((pix_scale >= 0.01) &&
(pix_scale <= 0.4),
CPL_ERROR_ILLEGAL_INPUT,
"pix_scale must be between 0.01 and 0.4 (results in cubes "
"with 7x7 to 280x280 pixels)!");
- xcal_interpolation = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_sci_red.xcal_interpolation");
+ xcal_interpolation = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_sci_red.xcal_interpolation");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.xcal_interpolation"));
@@ -1076,6 +1125,12 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
CPL_ERROR_ILLEGAL_INPUT,
"suppress_extension must be TRUE or FALSE!");
+ fn_obj_sky_table = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_sci_red.obj_sky_table");
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.obj_sky_table"));
+
KMO_TRY_EXIT_IF_ERROR(
kmo_combine_pars_load(parlist,
"kmos.kmo_sci_red",
@@ -1087,6 +1142,26 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
&cmax,
FALSE));
+ velo_offset = kmo_dfs_get_parameter_double(parlist, "kmos.kmo_sci_red.velocity_offset");
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ velo_corr = 1. + velo_offset * 1000. / CPL_PHYS_C;
+ velo_corr_ptr = &velo_corr;
+
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.velocity_offset"));
+
+ save_interims = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_sci_red.save_interims");
+ KMO_TRY_CHECK_ERROR_STATE();
+ KMO_TRY_ASSURE((save_interims == TRUE) || (save_interims == FALSE),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "save_interims must be TRUE or FALSE!");
+ KMO_TRY_ASSURE(!((save_interims == TRUE) && (sky_tweak == FALSE)),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "Save_interims saves sky_tweak objects so sky_tweak must be enabled too!");
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_sci_red.save_interims"));
+
cpl_msg_info("", "-------------------------------------------");
//
@@ -1310,16 +1385,63 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
// get valid STD frames with objects in it and associated sky exposures and
// get valid object names to process, either one object name across
// several SCIENCE frames, or all object names
- KMO_TRY_EXIT_IF_NULL(
- arm_name_struct = kmo_create_armNameStruct(frameset,
- SCIENCE,
- ifus,
- name,
- unused_ifus_after,
- bounds,
- mapping_mode,
- no_subtract));
+ if (strcmp(fn_obj_sky_table, "") == 0) {
+ KMO_TRY_EXIT_IF_NULL(
+ arm_name_struct = kmo_create_armNameStruct(frameset,
+ SCIENCE,
+ ifus,
+ name,
+ unused_ifus_after,
+ bounds,
+ mapping_mode,
+ no_subtract));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_save_objSkyStruct(arm_name_struct->obj_sky_struct));
+ } else {
+ // read in obj/sky-table
+ objSkyStruct *obj_sky_struct = NULL;
+
+ KMO_TRY_EXIT_IF_NULL(
+ obj_sky_struct = kmo_read_objSkyStruct(fn_obj_sky_table,
+ frameset,
+ SCIENCE));
+
+ // check if any sky-IFUs have been specified not beeing the same IFU# for objects.
+ // In this case sky_tweak must be activated
+ for (i = 0; i < obj_sky_struct->size; i++) {
+ if (obj_sky_struct->table[i].objFrame != NULL) {
+ for (jj = 0; jj < KMOS_NR_IFUS; jj++) {
+ if ((obj_sky_struct->table[i].skyIfus[jj] > 0) && (sky_tweak == FALSE)) {
+ kmo_print_objSkyStruct(obj_sky_struct);
+
+ cpl_msg_error("","*************************************************************************");
+ cpl_msg_error("","* The provided obj/sky-association-table (parameter --obj_sky_table) *");
+ cpl_msg_error("","* contains skies assigned to objects originating from different IFUs! *");
+ cpl_msg_error("","* In this case the parameter --sky_tweak has to be set by the user! *");
+ cpl_msg_error("","*************************************************************************");
+
+ kmo_delete_objSkyStruct(obj_sky_struct);
+ KMO_TRY_ASSURE(1 == 0,
+ CPL_ERROR_ILLEGAL_INPUT,
+ " ");
+ }
+ }
+ }
+ }
+
+ KMO_TRY_EXIT_IF_NULL(
+ arm_name_struct = kmo_create_armNameStruct2(obj_sky_struct,
+ frameset,
+ SCIENCE,
+ ifus,
+ name,
+ unused_ifus_after,
+ bounds,
+ mapping_mode,
+ no_subtract));
+
+ }
kmo_print_armNameStruct(frameset, arm_name_struct);
// in mapping-mode check if for all IFUs there is either no telluric at all
@@ -1366,6 +1488,18 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
header_noise = (cpl_propertylist**)cpl_calloc(nr_data_alloc,
sizeof(cpl_propertylist*)));
+ if (save_interims) {
+ KMO_TRY_EXIT_IF_NULL(
+ cube_interim_object = (cpl_imagelist**)cpl_calloc(nr_data_alloc,
+ sizeof(cpl_imagelist*)));
+ KMO_TRY_EXIT_IF_NULL(
+ cube_interim_sky = (cpl_imagelist**)cpl_calloc(nr_data_alloc,
+ sizeof(cpl_imagelist*)));
+ KMO_TRY_EXIT_IF_NULL(
+ header_sky = (cpl_propertylist**)cpl_calloc(nr_data_alloc,
+ sizeof(cpl_propertylist*)));
+ }
+
if (cpl_frameset_count_tags(frameset, SCIENCE) == 1) {
no_combine = TRUE;
cpl_msg_info("", "--no_combine has been set to TRUE since there is only one SCIENCE frame!");
@@ -1444,6 +1578,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_msg_info("", " > processing frame: %s", fn_obj);
for (ifu_nr = 1; ifu_nr <= KMOS_NR_IFUS; ifu_nr++)
{
+ sky_ifu_nr = ifu_nr;
det_nr = (ifu_nr - 1)/KMOS_IFUS_PER_DETECTOR + 1;
KMO_TRY_ASSURE((det_nr >= 1) &&
@@ -1475,16 +1610,26 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
do_sky_subtraction = TRUE;
if (no_subtract) {
sky_frame = NULL;
- cpl_msg_warning("", " > Omit sky subtraction on IFU %d", ifu_nr);
} else {
sky_frame = arm_name_struct->obj_sky_struct->table[sf].skyFrames[ifu_nr-1];
KMO_TRY_EXIT_IF_NULL(
fn_sky = cpl_frame_get_filename(sky_frame));
- cpl_msg_info("", " > IFU %d (with sky in frame: %s)", ifu_nr, fn_sky);
}
+
if (sky_tweak){
sky_as_object_frame = sky_frame;
sky_frame = NULL;
+ sky_ifu_nr = arm_name_struct->obj_sky_struct->table[sf].skyIfus[ifu_nr-1];
+ }
+
+ if (no_subtract) {
+ cpl_msg_warning("", " > Omit sky subtraction on IFU %d", ifu_nr);
+ } else {
+ if (sky_ifu_nr == ifu_nr) {
+ cpl_msg_info("", " > IFU %d (with sky in frame: %s)", ifu_nr, fn_sky);
+ } else {
+ cpl_msg_info("", " > IFU %d (with sky in IFU %d of frame: %s)", ifu_nr, sky_ifu_nr, fn_sky);
+ }
}
} else {
do_sky_subtraction = FALSE;
@@ -1551,6 +1696,50 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
NAXIS3, gd.l.dim,
"length of data axis 3"));
+ if (save_interims && (sky_as_object_frame != NULL)) {
+ KMO_TRY_EXIT_IF_NULL(
+ main_sky_header = kmclipm_propertylist_load(
+ cpl_frame_get_filename(sky_as_object_frame), 0));
+
+ KMO_TRY_EXIT_IF_NULL(
+ header_sky[ifu_nr-1] = kmclipm_propertylist_load(
+ cpl_frame_get_filename(sky_as_object_frame),
+ det_nr));
+
+ KMO_TRY_EXIT_IF_NULL(
+ extname = kmo_extname_creator(ifu_frame, ifu_nr,
+ EXT_DATA));
+
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_update_property_string(header_sky[ifu_nr-1],
+ EXTNAME, extname,
+ "FITS extension name"));
+
+ cpl_free(extname); extname = NULL;
+
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_calc_wcs_gd(main_sky_header, header_sky[ifu_nr-1], ifu_nr, gd));
+
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_update_property_int(header_sky[ifu_nr-1],
+ NAXIS, 3,
+ "number of data axes"));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_update_property_int(header_sky[ifu_nr-1],
+ NAXIS1, gd.x.dim,
+ "length of data axis 1"));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_update_property_int(header_sky[ifu_nr-1],
+ NAXIS2, gd.y.dim,
+ "length of data axis 2"));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_update_property_int(header_sky[ifu_nr-1],
+ NAXIS3, gd.l.dim,
+ "length of data axis 3"));
+
+ cpl_propertylist_delete(main_sky_header); main_sky_header = NULL;
+ }
+
//
// reconstruct object
//
@@ -1569,6 +1758,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
ycal_frame,
lcal_frame,
NULL,
+ velo_corr_ptr,
&gd,
&cube_data[ifu_nr-1],
&cube_noise[ifu_nr-1],
@@ -1590,6 +1780,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
ycal_frame,
lcal_frame,
NULL,
+ NULL,
&gd,
&cube_data[ifu_nr-1],
&cube_noise[ifu_nr-1],
@@ -1600,7 +1791,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
if (cube_data[ifu_nr-1] != NULL) {
KMO_TRY_EXIT_IF_NULL(
- lcorr_coeffs = kmo_lcorr_get(cube_data[ifu_nr-1],
+ oh_lcorr_coeffs = kmo_lcorr_get(cube_data[ifu_nr-1],
header_data[ifu_nr-1],
ref_spectrum_frame,
gd,
@@ -1624,7 +1815,8 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
xcal_frame,
ycal_frame,
lcal_frame,
- lcorr_coeffs,
+ oh_lcorr_coeffs,
+ velo_corr_ptr,
&gd,
&cube_data[ifu_nr-1],
&cube_noise[ifu_nr-1],
@@ -1632,7 +1824,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
background,
xcal_interpolation));
- cpl_polynomial_delete(lcorr_coeffs); lcorr_coeffs = NULL;
+ cpl_polynomial_delete(oh_lcorr_coeffs); oh_lcorr_coeffs = NULL;
}
}
@@ -1641,9 +1833,9 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
if (do_sky_subtraction && sky_tweak) {
if (ref_spectrum_frame == NULL) { // no lambda correction using OH lines
KMO_TRY_EXIT_IF_ERROR(
- kmo_reconstruct_sci(ifu_nr,
- bounds[2*(ifu_nr-1)],
- bounds[2*(ifu_nr-1)+1],
+ kmo_reconstruct_sci(sky_ifu_nr,
+ bounds[2*(sky_ifu_nr-1)],
+ bounds[2*(sky_ifu_nr-1)+1],
sky_as_object_frame,
SCIENCE,
sky_frame,
@@ -1653,6 +1845,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
ycal_frame,
lcal_frame,
NULL,
+ velo_corr_ptr,
&gd,
&sky_data,
&sky_noise,
@@ -1662,9 +1855,9 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
} else { // lambda correction using OH lines
KMO_TRY_EXIT_IF_ERROR(
- kmo_reconstruct_sci(ifu_nr,
- bounds[2*(ifu_nr-1)],
- bounds[2*(ifu_nr-1)+1],
+ kmo_reconstruct_sci(sky_ifu_nr,
+ bounds[2*(sky_ifu_nr-1)],
+ bounds[2*(sky_ifu_nr-1)+1],
sky_as_object_frame,
SCIENCE,
NULL,
@@ -1674,6 +1867,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
ycal_frame,
lcal_frame,
NULL,
+ NULL,
&gd,
&sky_data,
&sky_noise,
@@ -1684,12 +1878,12 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
if (sky_data != NULL) {
KMO_TRY_EXIT_IF_NULL(
- lcorr_coeffs = kmo_lcorr_get(sky_data,
- header_data[ifu_nr-1],
- ref_spectrum_frame,
- gd,
- filter_id,
- ifu_nr));
+ oh_lcorr_coeffs = kmo_lcorr_get(sky_data,
+ header_data[ifu_nr-1],
+ ref_spectrum_frame,
+ gd,
+ filter_id,
+ ifu_nr));
cpl_imagelist_delete(sky_data); sky_data = NULL;
if (sky_noise != NULL) {
@@ -1697,9 +1891,9 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
}
KMO_TRY_EXIT_IF_ERROR(
- kmo_reconstruct_sci(ifu_nr,
- bounds[2*(ifu_nr-1)],
- bounds[2*(ifu_nr-1)+1],
+ kmo_reconstruct_sci(sky_ifu_nr,
+ bounds[2*(sky_ifu_nr-1)],
+ bounds[2*(sky_ifu_nr-1)+1],
sky_as_object_frame,
SCIENCE,
sky_frame,
@@ -1708,7 +1902,8 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
xcal_frame,
ycal_frame,
lcal_frame,
- lcorr_coeffs,
+ oh_lcorr_coeffs,
+ velo_corr_ptr,
&gd,
&sky_data,
&sky_noise,
@@ -1716,8 +1911,17 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
background,
xcal_interpolation));
- cpl_polynomial_delete(lcorr_coeffs); lcorr_coeffs = NULL;
+ cpl_polynomial_delete(oh_lcorr_coeffs); oh_lcorr_coeffs = NULL;
}
+ } // end if (ref_spectrum_frame == NULL)
+
+ if (save_interims && (sky_as_object_frame != NULL)) {
+ KMO_TRY_EXIT_IF_NULL(
+ cube_interim_object[ifu_nr-1] =
+ cpl_imagelist_duplicate(cube_data[ifu_nr-1]));
+ KMO_TRY_EXIT_IF_NULL(
+ cube_interim_sky[ifu_nr-1] =
+ cpl_imagelist_duplicate(sky_data));
}
cpl_imagelist *tmp_object_cube = cube_data[ifu_nr-1];
@@ -1735,7 +1939,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
if (sky_noise != NULL) {
cpl_imagelist_delete(sky_noise); sky_noise = NULL;
}
- }
+ } // end if (do_sky_subtraction && sky_tweak)
// scale flux according to pixel_scale
KMO_TRY_EXIT_IF_NULL(
@@ -1909,11 +2113,23 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
}
fn_out = RECONSTRUCTED_CUBE;
+ fn_interim_object = INTERIM_OBJECT_CUBE;
+ fn_interim_sky = INTERIM_OBJECT_SKY;
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_save_main_header(frameset, fn_out, fn_suffix,
arm_name_struct->obj_sky_struct->table[sf].objFrame,
NULL, parlist, cpl_func));
+ if (save_interims && (sky_as_object_frame != NULL)) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_main_header(frameset, fn_interim_object, fn_suffix,
+ arm_name_struct->obj_sky_struct->table[sf].objFrame,
+ NULL, parlist, cpl_func));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_main_header(frameset, fn_interim_sky, fn_suffix,
+ arm_name_struct->obj_sky_struct->table[sf].objFrame,
+ NULL, parlist, cpl_func));
+ }
for (ifu_nr = 1; ifu_nr <= KMOS_NR_IFUS; ifu_nr++) {
KMO_TRY_EXIT_IF_ERROR(
@@ -1927,14 +2143,35 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
0./0.));
}
+ if (save_interims && (sky_as_object_frame != NULL)) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_cube(cube_interim_object[ifu_nr-1], fn_interim_object,
+ fn_suffix, header_data[ifu_nr-1], 0./0.));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_cube(cube_interim_sky[ifu_nr-1], fn_interim_sky,
+ fn_suffix, header_sky[ifu_nr-1], 0./0.));
+ }
+
cpl_imagelist_delete(cube_data[ifu_nr-1]); cube_data[ifu_nr-1] = NULL;
cpl_imagelist_delete(cube_noise[ifu_nr-1]); cube_noise[ifu_nr-1] = NULL;
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;
+ 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;
+ }
} // end for ifu_nr
cpl_free(fn_suffix); fn_suffix = NULL;
} else {
cpl_msg_info("", " > 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;
+ }
} // if (cube_counter_data > 0) {
cpl_propertylist_delete(main_header); main_header = NULL;
@@ -1943,6 +2180,11 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_free(cube_noise); cube_noise = NULL;
cpl_free(header_data); header_data = NULL;
cpl_free(header_noise); header_noise = NULL;
+ if (save_interims) {
+ cpl_free(cube_interim_object); cube_interim_object = NULL;
+ cpl_free(cube_interim_sky); cube_interim_sky = NULL;
+ cpl_free(header_sky); header_sky = NULL;
+ }
kmo_print_unused_ifus(unused_ifus_after, TRUE);
@@ -2099,7 +2341,8 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
extrapol_enum,
flux,
&combined_data,
- &combined_noise));
+ &combined_noise,
+ &exp_mask));
} else if (cube_counter_noise == 0) {
// if imethod == "CS"
KMO_TRY_EXIT_IF_ERROR(
@@ -2124,7 +2367,8 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
extrapol_enum,
flux,
&combined_data,
- &combined_noise));
+ &combined_noise,
+ &exp_mask));
} else {
KMO_TRY_ASSURE(1 == 0,
CPL_ERROR_ILLEGAL_INPUT,
@@ -2137,6 +2381,14 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
"this object! Saving it as it is.");
KMO_TRY_EXIT_IF_NULL(
combined_data = cpl_imagelist_duplicate(cube_data[0]));
+ KMO_TRY_EXIT_IF_NULL(
+ tmpImg = cpl_imagelist_get(combined_data, 0));
+ KMO_TRY_EXIT_IF_NULL(
+ exp_mask = cpl_image_new(cpl_image_get_size_x(tmpImg),
+ cpl_image_get_size_y(tmpImg),
+ CPL_TYPE_FLOAT));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_image_fill(exp_mask, 1.));
if (cube_noise[0] != NULL) {
KMO_TRY_EXIT_IF_NULL(
@@ -2149,6 +2401,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
} // end if (cube_counter_data > 1)
fn_out = COMBINED_CUBE;
+ fn_out_mask = EXP_MASK;
if (!suppress_extension) {
char tmp_suffix[1024];
tmp_suffix[0] = '\0';
@@ -2179,36 +2432,33 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_EXIT_IF_NULL(
tmp_frame = kmo_dfs_get_frame(frameset, RECONSTRUCTED_CUBE));
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_main_header(frameset, fn_out, fn_suffix,
- tmp_frame, NULL, parlist, cpl_func));
+ kmo_dfs_save_main_header(frameset, fn_out, fn_suffix, tmp_frame, NULL, parlist, cpl_func));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_main_header(frameset, fn_out_mask, fn_suffix, tmp_frame, NULL, parlist, cpl_func));
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_cube(combined_data, fn_out, fn_suffix,
- header_data[0], 0./0.));
+ kmo_dfs_save_cube(combined_data, fn_out, fn_suffix, header_data[0], 0./0.));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_image(exp_mask, fn_out_mask, fn_suffix, header_data[0], 0./0.));
// if (combined_noise != NULL) {
if (header_noise[0] == NULL) {
KMO_TRY_EXIT_IF_NULL(
- header_noise[0] =
- cpl_propertylist_duplicate(header_data[0]));
+ header_noise[0] = cpl_propertylist_duplicate(header_data[0]));
KMO_TRY_EXIT_IF_NULL(
- tmp_str = cpl_propertylist_get_string(header_data[0],
- EXTNAME));
+ tmp_str = cpl_propertylist_get_string(header_data[0], EXTNAME));
KMO_TRY_EXIT_IF_ERROR(
kmo_extname_extractor(tmp_str, &ft, &tmp_int, content));
KMO_TRY_EXIT_IF_NULL(
- extname = kmo_extname_creator(ifu_frame, tmp_int,
- EXT_NOISE));
+ extname = kmo_extname_creator(ifu_frame, tmp_int, EXT_NOISE));
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_string(header_noise[0],
- EXTNAME, extname,
+ kmclipm_update_property_string(header_noise[0], EXTNAME, extname,
"FITS extension name"));
cpl_free(extname); extname = NULL;
}
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_cube(combined_noise, fn_out, fn_suffix,
- header_noise[0], 0./0.));
+ kmo_dfs_save_cube(combined_noise, fn_out, fn_suffix, header_noise[0], 0./0.));
// }
for (jj = 0; jj < nr_data_alloc; jj++) {
@@ -2224,22 +2474,19 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_free(fn_suffix); fn_suffix = NULL;
cpl_imagelist_delete(combined_data); combined_data = NULL;
cpl_imagelist_delete(combined_noise); combined_noise = NULL;
+ cpl_image_delete(exp_mask); exp_mask = NULL;
} // for i = nr_avail_obj_names
} else {
// we are in mapping_mode
nr_data_alloc = nr_reconstructed_frames*KMOS_NR_IFUS;
KMO_TRY_EXIT_IF_NULL(
- cube_data = (cpl_imagelist**)cpl_calloc(nr_data_alloc,
- sizeof(cpl_imagelist*)));
+ cube_data = (cpl_imagelist**)cpl_calloc(nr_data_alloc, sizeof(cpl_imagelist*)));
KMO_TRY_EXIT_IF_NULL(
- cube_noise = (cpl_imagelist**)cpl_calloc(nr_data_alloc,
- sizeof(cpl_imagelist*)));
+ cube_noise = (cpl_imagelist**)cpl_calloc(nr_data_alloc, sizeof(cpl_imagelist*)));
KMO_TRY_EXIT_IF_NULL(
- header_data = (cpl_propertylist**)cpl_calloc( nr_data_alloc,
- sizeof(cpl_propertylist*)));
+ header_data = (cpl_propertylist**)cpl_calloc(nr_data_alloc, sizeof(cpl_propertylist*)));
KMO_TRY_EXIT_IF_NULL(
- header_noise = (cpl_propertylist**)cpl_calloc(nr_data_alloc,
- sizeof(cpl_propertylist*)));
+ header_noise = (cpl_propertylist**)cpl_calloc(nr_data_alloc, sizeof(cpl_propertylist*)));
cube_counter_data = 0;
cube_counter_noise = 0;
@@ -2262,8 +2509,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
if (desc1.sub_desc[index-1].valid_data) {
KMO_TRY_EXIT_IF_NULL(
cube_data[cube_counter_data] =
- kmclipm_imagelist_load(fn_reconstr, CPL_TYPE_FLOAT,
- index));
+ kmclipm_imagelist_load(fn_reconstr, CPL_TYPE_FLOAT, index));
if (edge_nan) {
KMO_TRY_EXIT_IF_ERROR(
kmo_edge_nan(cube_data[cube_counter_data], ifu_nr));
@@ -2283,12 +2529,8 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
KMO_TRY_EXIT_IF_NULL(
header_data[cube_counter_data] =
kmclipm_propertylist_load(fn_reconstr, index));
- cpl_propertylist_update_string(header_data[cube_counter_data],
- "ESO PRO FRNAME",
- fn_reconstr);
- cpl_propertylist_update_int(header_data[cube_counter_data],
- "ESO PRO IFUNR",
- index);
+ cpl_propertylist_update_string(header_data[cube_counter_data], "ESO PRO FRNAME", fn_reconstr);
+ cpl_propertylist_update_int(header_data[cube_counter_data], "ESO PRO IFUNR", index);
cube_counter_data++;
}
@@ -2299,8 +2541,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
if (desc1.sub_desc[index-1].valid_data) {
KMO_TRY_EXIT_IF_NULL(
cube_noise[cube_counter_noise] =
- kmclipm_imagelist_load(fn_reconstr, CPL_TYPE_FLOAT,
- index));
+ kmclipm_imagelist_load(fn_reconstr, CPL_TYPE_FLOAT, index));
if (edge_nan) {
KMO_TRY_EXIT_IF_ERROR(
@@ -2318,8 +2559,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
cube_noise[cube_counter_noise] = tmpCube;
}
KMO_TRY_EXIT_IF_NULL(
- header_noise[cube_counter_noise] =
- kmclipm_propertylist_load(fn_reconstr, index));
+ header_noise[cube_counter_noise] = kmclipm_propertylist_load(fn_reconstr, index));
cube_counter_noise++;
}
}
@@ -2355,7 +2595,8 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
extrapol_enum,
flux,
&combined_data,
- &combined_noise));
+ &combined_noise,
+ NULL));
} else if (cube_counter_noise == 0) {
// if imethod == "CS"
KMO_TRY_EXIT_IF_ERROR(
@@ -2380,7 +2621,8 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
extrapol_enum,
flux,
&combined_data,
- &combined_noise));
+ &combined_noise,
+ NULL));
} else {
KMO_TRY_ASSURE(1 == 0,
CPL_ERROR_ILLEGAL_INPUT,
@@ -2412,8 +2654,7 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
NULL, parlist, cpl_func));
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_cube(combined_data, fn_out, fn_suffix,
- header_data[0], 0./0.));
+ kmo_dfs_save_cube(combined_data, fn_out, fn_suffix, header_data[0], 0./0.));
// if (combined_noise != NULL) {
if (header_noise[0] == NULL) {
@@ -2422,22 +2663,18 @@ static int kmo_sci_red(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_propertylist_duplicate(header_data[0]));
KMO_TRY_EXIT_IF_NULL(
- tmp_str = cpl_propertylist_get_string(header_data[0],
- EXTNAME));
+ tmp_str = cpl_propertylist_get_string(header_data[0], EXTNAME));
KMO_TRY_EXIT_IF_ERROR(
kmo_extname_extractor(tmp_str, &ft, &tmp_int, content));
KMO_TRY_EXIT_IF_NULL(
- extname = kmo_extname_creator(ifu_frame, tmp_int,
- EXT_NOISE));
+ extname = kmo_extname_creator(ifu_frame, tmp_int, EXT_NOISE));
KMO_TRY_EXIT_IF_ERROR(
- kmclipm_update_property_string(header_noise[0],
- EXTNAME, extname,
+ kmclipm_update_property_string(header_noise[0], EXTNAME, extname,
"FITS extension name"));
cpl_free(extname); extname = NULL;
}
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_save_cube(combined_noise, fn_out, fn_suffix,
- header_noise[0], 0./0.));
+ kmo_dfs_save_cube(combined_noise, fn_out, fn_suffix, header_noise[0], 0./0.));
// }
for (i = 0; i < nr_data_alloc; i++) {
diff --git a/recipes/kmo_sky_tweak.c b/recipes/kmo_sky_tweak.c
index 5a406e7..bc0a03b 100644
--- a/recipes/kmo_sky_tweak.c
+++ b/recipes/kmo_sky_tweak.c
@@ -29,14 +29,9 @@
#include <config.h>
#endif
-//#include <string.h>
-//#include <math.h>
-
#include <cpl.h>
#include <cpl_wcs.h>
-//#include "kmo_debug.h"
-//#include "kmo_utils.h"
#include "kmo_dfs.h"
#include "kmo_error.h"
#include "kmo_constants.h"
diff --git a/recipes/kmo_std_star.c b/recipes/kmo_std_star.c
index a050506..14ab3ef 100644
--- a/recipes/kmo_std_star.c
+++ b/recipes/kmo_std_star.c
@@ -37,6 +37,7 @@
#include <string.h>
#include <cpl.h>
+
#include "kmclipm_math.h"
#include "kmo_constants.h"
@@ -289,6 +290,11 @@ static char kmo_std_star_description[] =
"3. For any IFUs not containing a standard star and a sky exposure an empty\n"
" frame will be returned.\n"
"\n"
+"NOISE_SPEC contains in any case the shot noise [sqrt(counts*gain)/gain]. If the\n"
+"exposures have been taken with template KMOS_spec_cal_stdstarscipatt, then an\n"
+"additional noise component is added in: All existing sky exposures for an IFU\n"
+"are subtracted pairwise, spectra are extracted and the std deviation is calculated.\n"
+"\n"
"BASIC PARAMETERS:\n"
"-----------------\n"
"--startype\n"
@@ -321,6 +327,11 @@ static char kmo_std_star_description[] =
"Set to TRUE if the intermediate reconstructed cubes (eventually divided by "
"illumination correction) should be saved as well. Default is FALSE.\n"
"\n"
+"--no_noise\n"
+"Applies only for data taken with template KMOS_spec_cal_stdstarscipatt:\n"
+"Skip lengthy calculation of noise-spectra on all sky exposures (no NOISE_SPEC\n"
+"will be produced).\n"
+"\n"
"ADVANCED PARAMETERS\n"
"-------------------\n"
"--flux\n"
@@ -383,8 +394,8 @@ static char kmo_std_star_description[] =
"starting from 0.\n"
"\n"
"-------------------------------------------------------------------------------\n"
-" Input files:\n"
-"\n"
+" Input files: \n"
+" \n"
" DO KMOS \n"
" category Type Explanation Required #Frames\n"
" -------- ----- ----------- -------- -------\n"
@@ -400,19 +411,20 @@ static char kmo_std_star_description[] =
" ATMOS_MODEL F1S Model atmospheric transmisson N 0,1 \n"
" (only for OBAF stars in K band) \n"
" SPEC_TYPE_LOOKUP F2L LUT eff. stellar temperature N 0,1 \n"
-"\n"
-" Output files:\n"
-"\n"
-" DO KMOS\n"
-" category Type Explanation\n"
-" -------- ----- -----------\n"
-" TELLURIC F1I The normalised telluric spectrum \n"
-" (including errors) \n"
-" STAR_SPEC F1I The extracted star spectrum \n"
-" (including errors) \n"
-" STD_IMAGE F2I The standard star PSF images \n"
-" STD_MASK F2I The generated mask used to extract the star \n"
-" spectrum \n"
+" \n"
+" Output files: \n"
+" \n"
+" DO KMOS \n"
+" category Type Explanation \n"
+" -------- ----- ----------- \n"
+" TELLURIC F1I The normalised telluric spectrum \n"
+" (including errors) \n"
+" STAR_SPEC F1I The extracted star spectrum \n"
+" (including errors) \n"
+" STD_IMAGE F2I The standard star PSF images \n"
+" STD_MASK F2I The generated mask used to extract the star \n"
+" spectrum \n"
+" NOISE_SPEC F1I The extracted noise spectrum \n"
"-------------------------------------------------------------------------------\n"
"\n";
@@ -559,6 +571,18 @@ static int kmo_std_star_create(cpl_plugin *plugin)
cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
cpl_parameterlist_append(recipe->parameters, p);
+ /* --no_noise */
+ p = cpl_parameter_new_value("kmos.kmo_std_star.no_noise",
+ CPL_TYPE_BOOL,
+ "Applies only for data taken with template KMOS_spec_cal_stdstarscipatt: "
+ "FALSE: Calculate noise-spectra on all sky exposures. "
+ "TRUE: skip this step",
+ "kmos.kmo_std_star",
+ FALSE);
+ cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "no_noise");
+ cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+ cpl_parameterlist_append(recipe->parameters, p);
+
/* --xcal_interpolation */
p = cpl_parameter_new_value("kmos.kmo_std_star.xcal_interpolation",
CPL_TYPE_BOOL,
@@ -642,81 +666,93 @@ static int kmo_std_star_destroy(cpl_plugin *plugin)
*/
static int kmo_std_star(cpl_parameterlist *parlist, cpl_frameset *frameset)
{
- cpl_imagelist **stored_data_cube = NULL,
- **stored_noise_cube = NULL;
- cpl_image **stored_psf_data = NULL,
- *illum_corr = NULL,
- **stored_mask = NULL,
- *lcal = NULL;
- cpl_frame *xcal_frame = NULL,
- *ycal_frame = NULL,
- *lcal_frame = NULL,
- *flat_frame = NULL,
- *illum_frame = NULL,
- *obj_frame = NULL,
- *sky_frame = NULL,
- *tmp_frame = NULL;
+ cpl_imagelist **stored_data_cube = NULL,
+ **stored_noise_cube = NULL;
+ cpl_image **stored_psf_data = NULL,
+ *illum_corr = NULL,
+ **stored_mask = NULL,
+ *lcal = NULL;
+ const cpl_image *tmp_img = NULL;
+ cpl_frame *xcal_frame = NULL,
+ *ycal_frame = NULL,
+ *lcal_frame = NULL,
+ *flat_frame = NULL,
+ *illum_frame = NULL,
+ *obj_frame = NULL,
+ *sky_frame = NULL,
+ *tmp_frame = NULL;
cpl_vector *solar_spec = NULL,
*atmos_model = NULL,
**stored_telluric_data = NULL,
**stored_telluric_noise = NULL,
**stored_starspec_data = NULL,
**stored_starspec_noise = NULL,
+ *shot_noise = NULL,
+ **stored_noisespec = NULL,
*tmp_spec_data = NULL,
- *spec_qc = NULL,
+ *spec_qc = NULL,
*tmp_spec_noise = NULL,
*identified_slices = NULL,
*tmp_vec = NULL,
*lambda_x = NULL;
- int ret_val = 0,
- nr_devices = 0,
- nr_exp = 0,
- j = 0,
- *bounds = NULL,
- ifu_nr = 0,
- citer = 0,
- cmax = 0,
- cmin = 0,
- line_warning = FALSE,
- nr_std_stars = 0,
- print_warning_once = TRUE,
- flux = FALSE,
- background = FALSE,
- band_method = 0,
- save_cubes = FALSE,
- has_magnitude = TRUE,
- xcal_interpolation = FALSE,
- suppress_extension = FALSE,
- nr_split_mag = 0,
- i = 0,
- l = 0,
- gx = 0,
- gy = 0,
- k = 0;
- const int *punused_ifus = NULL;
- objSkyStruct *obj_sky_struct = NULL;
- double *stored_qc_throughput = NULL,
- star_temperature = 0.0,
- neighborhoodRange = 1.001,
- cpos_rej = 0.0,
- cneg_rej = 0.0,
- zeropoint = -1.0,
- throughput_mean = -1.0,
- throughput_sdv = -1.0,
- std_trace = -1.0,
- counts1 = 0.0,
- counts2 = 0.0,
- magnitude1 = 0.0,
- magnitude2 = 0.0,
- exptime = 0.,
- cdelt3 = 0.,
- mean_data = 0.,
- mean_noise = 0.,
- *ptmp_spec_noise = NULL,
- crpix1 = 0.,
- crval1 = 0.,
- cdelt1 = 0.;
- const double *ptmp_spec_data = NULL;
+ int ret_val = 0,
+ nr_devices = 0,
+ nr_exp = 0,
+ j = 0,
+ *bounds = NULL,
+ ifu_nr = 0,
+ citer = 0,
+ cmax = 0,
+ cmin = 0,
+ line_warning = FALSE,
+ nr_std_stars = 0,
+ print_warning_once = TRUE,
+ flux = FALSE,
+ background = FALSE,
+ band_method = 0,
+ save_cubes = FALSE,
+ no_noise = FALSE,
+ has_magnitude = TRUE,
+ xcal_interpolation = FALSE,
+ suppress_extension = FALSE,
+ nr_split_mag = 0,
+ nr_sky_pairs = 0,
+ i = 0,
+ ii = 0,
+ l = 0,
+ gx = 0,
+ gy = 0,
+ k = 0;
+ const int *punused_ifus = NULL;
+ objSkyStruct *obj_sky_struct = NULL;
+ skySkyStruct *sky_sky_struct = NULL;
+ double *stored_qc_throughput = NULL,
+ star_temperature = 0.0,
+ neighborhoodRange = 1.001,
+ cpos_rej = 0.0,
+ cneg_rej = 0.0,
+ zeropoint = -1.0,
+ throughput_mean = -1.0,
+ throughput_sdv = -1.0,
+ std_trace = -1.0,
+ counts1 = 0.0,
+ counts2 = 0.0,
+ magnitude1 = 0.0,
+ magnitude2 = 0.0,
+ gain = 0.0,
+ flux_scale_factor = 0.0,
+ exptime = 0.,
+ cdelt3 = 0.,
+ mean_data = 0.,
+ mean_data2 = 0.,
+ *ptmp_spec_noise = NULL,
+ *ppp = NULL,
+ crpix1 = 0.,
+ crval1 = 0.,
+ cdelt1 = 0.,
+ tmp_data = 0.,
+ tmp_noise = 0.;
+ const double *ptmp_spec_data = NULL;
cpl_propertylist *main_header_tel = NULL,
*main_header_psf = NULL,
*sub_header_orig = NULL,
@@ -728,36 +764,38 @@ static int kmo_std_star(cpl_parameterlist *parlist, cpl_frameset *frameset)
**stored_sub_cube_noise_headers = NULL,
**stored_sub_psf_headers = NULL,
*pl_psf = NULL;
- cpl_table *spec_type_LUT = NULL,
- *band_table = NULL;;
+ cpl_table *spec_type_LUT = NULL,
+ *band_table = NULL;;
main_fits_desc desc1,
desc2;
- char *extname = NULL,
- *keyword = NULL,
+ char *extname = NULL,
+ *keyword = NULL,
filename_telluric[256],
filename_starspec[256],
filename_psf[256],
filename_mask[256],
filename_cubes[256],
- *suffix = NULL,
- *fn_suffix = NULL,
+ filename_noise[256],
+ *suffix = NULL,
+ *fn_suffix = NULL,
spec_class[256],
lum_class[256],
star_type[2],
- *tmp_band_method = getenv("KMO_BAND_METHOD"),
- **split_mag = NULL,
- *grat_id = NULL;
- const char *filter_id = NULL,
- *spec_type = NULL,
- *magnitude_txt = NULL,
- *imethod = NULL,
- *cmethod = NULL,
- *fmethod = NULL,
- *tmp_str = NULL;
+ *tmp_band_method = getenv("KMO_BAND_METHOD"),
+ **split_mag = NULL,
+ *grat_id = NULL,
+ *tplid = NULL;
+ const char *filter_id = NULL,
+ *spec_type = NULL,
+ *magnitude_txt = NULL,
+ *imethod = NULL,
+ *cmethod = NULL,
+ *fmethod = NULL,
+ *tmp_str = NULL;
gridDefinition gd;
- cpl_array **unused_ifus_before = NULL,
- **unused_ifus_after = NULL;
- cpl_frameset *frameset_std = NULL;
+ cpl_array **unused_ifus_before = NULL,
+ **unused_ifus_after = NULL;
+ cpl_frameset *frameset_std = NULL;
KMO_TRY
{
@@ -805,15 +843,12 @@ static int kmo_std_star(cpl_parameterlist *parlist, cpl_frameset *frameset)
cpl_msg_info("", "--- Parameter setup for kmo_std_star ------");
KMO_TRY_EXIT_IF_NULL(
- spec_type = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_std_star.startype"));
+ spec_type = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_std_star.startype"));
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_std_star.startype"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_std_star.startype"));
KMO_TRY_EXIT_IF_NULL(
- imethod = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_std_star.imethod"));
+ imethod = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_std_star.imethod"));
KMO_TRY_ASSURE((strcmp(imethod, "NN") == 0) ||
(strcmp(imethod, "lwNN") == 0) ||
(strcmp(imethod, "swNN") == 0) ||
@@ -823,56 +858,53 @@ static int kmo_std_star(cpl_parameterlist *parlist, cpl_frameset *frameset)
"method must be either \"NN\", \"lwNN\", "
"\"swNN\", \"MS\" or \"CS\"!");
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_std_star.imethod"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_std_star.imethod"));
KMO_TRY_EXIT_IF_NULL(
- fmethod = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_std_star.fmethod"));
+ fmethod = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_std_star.fmethod"));
KMO_TRY_ASSURE((strcmp(fmethod, "gauss") == 0) ||
(strcmp(fmethod, "moffat") == 0),
CPL_ERROR_ILLEGAL_INPUT,
"fmethod must be either 'gauss' or "
"'moffat' !");
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_std_star.method"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_std_star.method"));
- neighborhoodRange = kmo_dfs_get_parameter_double(parlist,
- "kmos.kmo_std_star.neighborhoodRange");
+ neighborhoodRange = kmo_dfs_get_parameter_double(parlist, "kmos.kmo_std_star.neighborhoodRange");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_ASSURE(neighborhoodRange > 0.0,
CPL_ERROR_ILLEGAL_INPUT,
"neighborhoodRange must be greater than 0.0");
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_std_star.neighborhoodRange"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_std_star.neighborhoodRange"));
- magnitude_txt = kmo_dfs_get_parameter_string(parlist,
- "kmos.kmo_std_star.magnitude");
+ magnitude_txt = kmo_dfs_get_parameter_string(parlist, "kmos.kmo_std_star.magnitude");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_EXIT_IF_ERROR(
- kmo_dfs_print_parameter_help(parlist,
- "kmos.kmo_std_star.magnitude"));
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_std_star.magnitude"));
- flux = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_std_star.flux");
+ flux = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_std_star.flux");
KMO_TRY_ASSURE((flux == FALSE) || (flux == TRUE),
CPL_ERROR_ILLEGAL_INPUT,
"flux must be either FALSE or TRUE!");
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_print_parameter_help(parlist, "kmos.kmo_std_star.flux"));
- save_cubes = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_std_star.save_cubes");
+ save_cubes = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_std_star.save_cubes");
KMO_TRY_ASSURE((save_cubes == FALSE) || (save_cubes == TRUE),
CPL_ERROR_ILLEGAL_INPUT,
"save_cubes must be either FALSE or TRUE!");
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_print_parameter_help(parlist, "kmos.kmo_std_star.save_cubes"));
- xcal_interpolation = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_std_star.xcal_interpolation");
+ no_noise = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_std_star.no_noise");
+ KMO_TRY_ASSURE((no_noise == FALSE) || (no_noise == TRUE),
+ CPL_ERROR_ILLEGAL_INPUT,
+ "no_noise must be either FALSE or TRUE!");
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_print_parameter_help(parlist, "kmos.kmo_std_star.no_noise"));
+
+ xcal_interpolation = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_std_star.xcal_interpolation");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_print_parameter_help(parlist, "kmos.kmo_std_star.xcal_interpolation"));
@@ -881,8 +913,7 @@ static int kmo_std_star(cpl_parameterlist *parlist, cpl_frameset *frameset)
CPL_ERROR_ILLEGAL_INPUT,
"xcal_interpolation must be TRUE or FALSE!");
- suppress_extension = kmo_dfs_get_parameter_bool(parlist,
- "kmos.kmo_std_star.suppress_extension");
+ suppress_extension = kmo_dfs_get_parameter_bool(parlist, "kmos.kmo_std_star.suppress_extension");
KMO_TRY_CHECK_ERROR_STATE();
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_print_parameter_help(parlist, "kmos.kmo_std_star.suppress_extension"));
@@ -920,10 +951,13 @@ static int kmo_std_star(cpl_parameterlist *parlist, cpl_frameset *frameset)
tmp_header = kmclipm_propertylist_load(cpl_frame_get_filename(tmp_frame), 0));
KMO_TRY_EXIT_IF_NULL(
grat_id = cpl_sprintf("%s", cpl_propertylist_get_string(tmp_header, "ESO INS GRAT1 ID")));
+ KMO_TRY_EXIT_IF_NULL(
+ tplid = cpl_sprintf("%s", cpl_propertylist_get_string(tmp_header, TPL_ID)));
KMO_TRY_EXIT_IF_ERROR(
cpl_frameset_insert(frameset_std, cpl_frame_duplicate(tmp_frame)));
cpl_propertylist_delete(tmp_header); tmp_header = NULL;
-KMO_TRY_CHECK_ERROR_STATE();
+ KMO_TRY_CHECK_ERROR_STATE();
+
KMO_TRY_EXIT_IF_NULL(
tmp_frame = kmo_dfs_get_frame(frameset, NULL));
while (tmp_frame != NULL ) {
@@ -1333,12 +1367,11 @@ KMO_TRY_CHECK_ERROR_STATE();
stored_sub_psf_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
sizeof(cpl_propertylist*)));
KMO_TRY_EXIT_IF_NULL(
- stored_sub_tel_data_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
- sizeof(cpl_propertylist*)));
+ stored_sub_tel_data_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+ sizeof(cpl_propertylist*)));
KMO_TRY_EXIT_IF_NULL(
stored_sub_tel_noise_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
- sizeof(cpl_propertylist*)));
-
+ sizeof(cpl_propertylist*)));
if (save_cubes) {
KMO_TRY_EXIT_IF_NULL(
stored_sub_cube_data_headers = (cpl_propertylist**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
@@ -1365,6 +1398,14 @@ KMO_TRY_CHECK_ERROR_STATE();
obj_sky_struct = kmo_create_objSkyStruct(frameset_std, STD, FALSE));
kmo_print_objSkyStruct(obj_sky_struct);
+ KMO_TRY_EXIT_IF_NULL(
+ stored_noisespec = (cpl_vector**)cpl_calloc(nr_devices*KMOS_IFUS_PER_DETECTOR,
+ sizeof(cpl_vector*)));
+
+ // identify sky-sky-pairs for NOISE_SPEC calculation
+ KMO_TRY_EXIT_IF_NULL(
+ sky_sky_struct = kmo_create_skySkyStruct(frameset_std));
+
// loop the object-sky pairs
if (obj_sky_struct->size == 0) {
cpl_msg_warning(cpl_func,"Not a single frame contains an object");
@@ -1374,6 +1415,7 @@ KMO_TRY_CHECK_ERROR_STATE();
strcpy(filename_psf, STD_IMAGE);
strcpy(filename_mask, STD_MASK);
strcpy(filename_cubes, STD_CUBE);
+ strcpy(filename_noise, NOISE_SPEC);
obj_frame = obj_sky_struct->table[nr_exp].objFrame;
KMO_TRY_EXIT_IF_NULL(
@@ -1449,15 +1491,14 @@ KMO_TRY_CHECK_ERROR_STATE();
// IFU is valid
if (sky_frame != NO_CORRESPONDING_SKYFRAME) {
- cpl_msg_info("","Processing standard star in IFU %d "
- "(obj: %s, sky: %s)", ifu_nr,
- cpl_frame_get_filename(obj_frame),
- cpl_frame_get_filename(sky_frame));
+ cpl_msg_info("", "Processing standard star in IFU %d", ifu_nr);
+ cpl_msg_info("", " (obj: %s, sky: %s)",
+ cpl_frame_get_filename(obj_frame), cpl_frame_get_filename(sky_frame));
} else {
sky_frame = NULL;
- cpl_msg_warning("","Processing standard star in IFU %d "
- "(obj: %s, no corresponding sky frame",
- ifu_nr, cpl_frame_get_filename(obj_frame));
+ cpl_msg_warning("", "Processing standard star in IFU %d", ifu_nr);
+ cpl_msg_warning("", " (obj: %s, no corresponding sky frame)",
+ cpl_frame_get_filename(obj_frame));
}
nr_std_stars++;
@@ -1519,7 +1560,7 @@ KMO_TRY_CHECK_ERROR_STATE();
// CUNIT
cpl_propertylist_update_string(stored_sub_tel_data_headers[ifu_nr-1], CUNIT1,
- cpl_propertylist_get_string(stored_sub_tel_data_headers[ifu_nr-1], CUNIT3));
+ cpl_propertylist_get_string(stored_sub_tel_data_headers[ifu_nr-1], CUNIT3));
cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CUNIT2);
cpl_propertylist_erase(stored_sub_tel_data_headers[ifu_nr-1], CUNIT3);
@@ -1564,6 +1605,7 @@ KMO_TRY_CHECK_ERROR_STATE();
ycal_frame,
lcal_frame,
NULL,
+ NULL,
&gd,
&stored_data_cube[ifu_nr-1],
&stored_noise_cube[ifu_nr-1],
@@ -1649,14 +1691,99 @@ KMO_TRY_CHECK_ERROR_STATE();
sqrt(spat_res)*KMOS_PIX_RESOLUTION,
"[arcsec] mean fwhm resolution of PSF"));
cpl_vector_delete(tmp_vec); tmp_vec = NULL;
-
- // extract spectrum in masked area
+
+ // extract spectrum in masked area and convert returned mean to sum
+ // (times mask aperture)
KMO_TRY_EXIT_IF_ERROR(
kmo_priv_extract_spec(stored_data_cube[ifu_nr-1],
stored_noise_cube[ifu_nr-1],
stored_mask[ifu_nr-1],
&tmp_spec_data,
&tmp_spec_noise));
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_multiply_scalar(tmp_spec_data, cpl_image_get_flux(stored_mask[ifu_nr-1])));
+ if (tmp_spec_noise != NULL) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_multiply_scalar(tmp_spec_noise, cpl_image_get_flux(stored_mask[ifu_nr-1])));
+ }
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ // extract spectrum of whole area for QC THRUHPUT and QC ZEROPOINT and
+ // convert returned mean to sum (times 196, IFU area)
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_priv_extract_spec(stored_data_cube[ifu_nr-1],
+ stored_noise_cube[ifu_nr-1],
+ NULL,
+ &spec_qc,
+ &tmp_vec));
+
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_img = cpl_imagelist_get(stored_data_cube[ifu_nr-1], 0));
+ int tmpx = cpl_image_get_size_x(tmp_img),
+ tmpy = cpl_image_get_size_x(tmp_img);
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_multiply_scalar(spec_qc, tmpx*tmpy));
+ if (tmp_vec != NULL) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_multiply_scalar(tmp_vec, tmpx*tmpy));
+ }
+
+ // calculate shot noise
+ crpix1 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CRPIX1);
+ crval1 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CRVAL1);
+ cdelt1 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CDELT1);
+ gain = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], GAIN);
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ // shot_noise = sqrt(tmp_spec_data*gain)/gain
+ // (set negative values and NaN's to zero before sqrt)
+ KMO_TRY_EXIT_IF_NULL(
+ shot_noise = cpl_vector_duplicate(tmp_spec_data));
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_multiply_scalar(shot_noise, gain));
+
+ ppp = cpl_vector_get_data(shot_noise);
+ for (ii = 0; ii < cpl_vector_get_size(shot_noise); ii++) {
+ if ((ppp[ii] < 0.0) || kmclipm_is_nan_or_inf(ppp[ii])) {
+ ppp[ii] = 0.0;
+ }
+ }
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_sqrt(shot_noise));
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_divide_scalar(shot_noise, gain));
+
+ // scale extracted spectrum to match the one calculated over the whole area
+ // (this is done in a band-specific range!)
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_calc_band_mean(stored_sub_tel_data_headers[ifu_nr-1],
+ filter_id,
+ tmp_spec_data,
+ tmp_spec_noise,
+ &mean_data,
+ NULL));
+
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_calc_band_mean(stored_sub_tel_data_headers[ifu_nr-1],
+ filter_id,
+ spec_qc,
+ tmp_vec,
+ &mean_data2,
+ NULL));
+
+ cpl_vector_delete(tmp_vec); tmp_vec = NULL;
+
+ flux_scale_factor = mean_data2/mean_data;
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_multiply_scalar(shot_noise, flux_scale_factor));
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_multiply_scalar(tmp_spec_data, flux_scale_factor));
+ if ((tmp_spec_noise != NULL) && (fabs(mean_data) > 1e-8)) {
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_multiply_scalar(tmp_spec_noise, flux_scale_factor));
+ }
// store to save to disk later on
stored_starspec_data[ifu_nr-1] = cpl_vector_duplicate(tmp_spec_data);
@@ -1665,32 +1792,136 @@ KMO_TRY_CHECK_ERROR_STATE();
}
KMO_TRY_CHECK_ERROR_STATE();
- // if magnitude is provided
- // calculate zeropoint and throughput
- if (has_magnitude) {
- // extract spectrum of whole are for QC THRUHput and ZEROPOINT
- KMO_TRY_EXIT_IF_ERROR(
- kmo_priv_extract_spec(stored_data_cube[ifu_nr-1],
- NULL,
- NULL,
- &spec_qc,
- NULL));
-
- // multiply spectrum with area of IFU (196) to get the sum
- const cpl_image *tmp_img = cpl_imagelist_get(stored_data_cube[ifu_nr-1], 0);
- int tmpx = cpl_image_get_size_x(tmp_img),
- tmpy = cpl_image_get_size_x(tmp_img);
- cpl_vector_multiply_scalar(spec_qc, tmpx*tmpy);
- }
+ //
+ // calculate noise spectra
+ //
+ if (!no_noise && (strcmp(tplid, "KMOS_spec_cal_stdstarscipatt") == 0)) {
+ nr_sky_pairs = sky_sky_struct[ifu_nr-1].nrSkyPairs;
+ if (nr_sky_pairs > 2) {
+ cpl_msg_info("", " Calculating noise-spectra on sky exposures for IFU %d", ifu_nr);
+ int ll = 0;
+ double **pvec_array = NULL,
+ *ptmp_vec = NULL,
+ *pstored_noisespec = NULL;
+ cpl_vector **vec_array = NULL;
+ cpl_imagelist *tmp_cube = NULL;
+
+ KMO_TRY_EXIT_IF_NULL(
+ vec_array = cpl_calloc(nr_sky_pairs, sizeof(cpl_vector*)));
+ KMO_TRY_EXIT_IF_NULL(
+ pvec_array = cpl_calloc(nr_sky_pairs, sizeof(double*)));
+ // reconstruct all sky-Pairs, extract spectra using a mask and store temporarily
+ for (ii = 0; ii < nr_sky_pairs; ii++) {
+ // reconstruct (sky1-sky2)/flatfield
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_reconstruct_sci(ifu_nr,
+ bounds[2*(ifu_nr-1)],
+ bounds[2*(ifu_nr-1)+1],
+ sky_sky_struct[ifu_nr-1].skyPairs[ii].skyFrame1,
+ STD,
+ sky_sky_struct[ifu_nr-1].skyPairs[ii].skyFrame2,
+ STD,
+ flat_frame,
+ xcal_frame,
+ ycal_frame,
+ lcal_frame,
+ NULL,
+ NULL,
+ &gd,
+ &tmp_cube,
+ NULL,
+ FALSE,
+ FALSE,
+ xcal_interpolation));
+
+ // extract spectrum in masked area and convert mean to sum
+ // (times mask aperture)
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_priv_extract_spec(tmp_cube,
+ NULL,
+ stored_mask[ifu_nr-1],
+ &(vec_array[ii]),
+ NULL));
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_multiply_scalar(vec_array[ii], cpl_image_get_flux(stored_mask[ifu_nr-1])));
+
+ // again: scale calculated noise spectrum to match the one calculated over the whole area
+ // (this is done in a band-specific range!)
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_multiply_scalar(vec_array[ii], flux_scale_factor));
+
+ KMO_TRY_EXIT_IF_NULL(
+ pvec_array[ii] = cpl_vector_get_data(vec_array[ii]));
+
+ cpl_imagelist_delete(tmp_cube); tmp_cube = NULL;
+ }
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ // now calculate stddev on every wavelength of all temporary
+ // extracted spectra
+ KMO_TRY_EXIT_IF_NULL(
+ stored_noisespec[ifu_nr-1] = cpl_vector_new(gd.l.dim));
+ KMO_TRY_EXIT_IF_NULL(
+ pstored_noisespec = cpl_vector_get_data(stored_noisespec[ifu_nr-1]));
+ KMO_TRY_EXIT_IF_NULL(
+ tmp_vec = cpl_vector_new(nr_sky_pairs));
+ KMO_TRY_EXIT_IF_NULL(
+ ptmp_vec = cpl_vector_get_data(tmp_vec));
+ for (ll = 0; ll < gd.l.dim; ll++) {
+ for (ii = 0; ii < nr_sky_pairs; ii++) {
+ ptmp_vec[ii] = pvec_array[ii][ll];
+ }
+
+ pstored_noisespec[ll] = cpl_vector_get_stdev(tmp_vec);
+ }
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ // free temporary data
+ for (ii = 0; ii < nr_sky_pairs; ii++) {
+ cpl_vector_delete(vec_array[ii]); vec_array[ii] = NULL;
+ }
+ cpl_free(vec_array); vec_array = NULL;
+ cpl_free(pvec_array); pvec_array = NULL;
+ cpl_vector_delete(tmp_vec); tmp_vec = NULL;
+
+ // apply shot_noise (total noise = sqrt (shot_noise^2 + sky_noise^2) )
+ // and set negative values and NaN's to zero
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_power(stored_noisespec[ifu_nr-1], 2.));
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_power(shot_noise, 2.));
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_add(stored_noisespec[ifu_nr-1], shot_noise));
+ ppp = cpl_vector_get_data(stored_noisespec[ifu_nr-1]);
+ for (ii = 0; ii < cpl_vector_get_size(stored_noisespec[ifu_nr-1]); ii++) {
+ if ((ppp[ii] < 0.0) || kmclipm_is_nan_or_inf(ppp[ii])) {
+ ppp[ii] = 0.0;
+ }
+ }
+ KMO_TRY_EXIT_IF_ERROR(
+ cpl_vector_sqrt(stored_noisespec[ifu_nr-1]));
+ cpl_vector_delete(shot_noise); shot_noise = NULL;
+ } else {
+ cpl_msg_warning("", " Not calculating noise-spectra because there are less than "
+ "2 sky-sky pairs present (skies must be subsequent in time)!"
+ " Just storing shot-noise.");
+ stored_noisespec[ifu_nr-1] = shot_noise;
+ } // end if (nr_sky_pairs > 0)
+ } else {
+ stored_noisespec[ifu_nr-1] = shot_noise;
+ } // end if (!no_noise & ...)
+ KMO_TRY_CHECK_ERROR_STATE();
+
+ //
+ // spectrum correction
+ //
// calculate abscissa of output spectrum
KMO_TRY_EXIT_IF_NULL(
lambda_x = kmo_create_lambda_vec(gd.l.dim, 1,
gd.l.start,
gd.l.delta));
- //
- // spectrum correction
- //
+
if ((strcmp(star_type, "O") == 0) ||
(strcmp(star_type, "B") == 0) ||
(strcmp(star_type, "A") == 0) ||
@@ -1872,14 +2103,15 @@ if (plot_it) {
tmp_spec_data,
tmp_spec_noise,
&mean_data,
- &mean_noise));
+ NULL));
KMO_TRY_EXIT_IF_ERROR(
cpl_vector_divide_scalar(tmp_spec_data, mean_data));
if (tmp_spec_noise != NULL) {
+ // scale noise with the same factor as data
KMO_TRY_EXIT_IF_ERROR(
- cpl_vector_divide_scalar(tmp_spec_noise, mean_noise));
+ cpl_vector_divide_scalar(tmp_spec_noise, mean_data));
// set noise spectrum also to zero when solar_spec is too short
KMO_TRY_EXIT_IF_NULL(
@@ -1902,11 +2134,6 @@ if (plot_it) {
// calculate zeropoint and throughput
if (has_magnitude) {
// calculate QC THROUGHPUT
- crpix1 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CRPIX1);
- crval1 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CRVAL1);
- cdelt1 = cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], CDELT1);
- KMO_TRY_CHECK_ERROR_STATE();
-
KMO_TRY_EXIT_IF_ERROR(
kmo_calc_counts(spec_qc, filter_id,
crpix1, crval1, cdelt1,
@@ -1916,10 +2143,8 @@ if (plot_it) {
counts1 /= exptime;
counts2 /= exptime;
- stored_qc_throughput[ifu_nr-1] =
- kmo_calc_throughput(magnitude1, magnitude2, counts1, counts2,
- cpl_propertylist_get_double(stored_sub_tel_data_headers[ifu_nr-1], GAIN),
- filter_id);
+ stored_qc_throughput[ifu_nr-1] = kmo_calc_throughput(magnitude1, magnitude2,
+ counts1, counts2, gain, filter_id);
KMO_TRY_CHECK_ERROR_STATE();
if (kmclipm_is_nan_or_inf(stored_qc_throughput[ifu_nr-1])) {
@@ -1944,7 +2169,7 @@ if (plot_it) {
zeropoint,
"[mag] IFU zeropoint"));
}
- cpl_vector_delete(spec_qc);spec_qc = NULL;
+ cpl_vector_delete(spec_qc); spec_qc = NULL;
} else {
cpl_error_reset();
// IFU is invalid
@@ -1996,10 +2221,13 @@ if (plot_it) {
kmclipm_update_property_string(stored_sub_tel_noise_headers[ifu_nr-1],
EXTNAME, extname, "FITS extension name"));
if (save_cubes) {
- KMO_TRY_EXIT_IF_NULL(
- stored_sub_cube_noise_headers[ifu_nr-1] =
- cpl_propertylist_duplicate(
- stored_sub_cube_data_headers[ifu_nr-1]));
+ if (stored_sub_cube_noise_headers[ifu_nr-1] == NULL) {
+ KMO_TRY_EXIT_IF_NULL(
+ stored_sub_cube_noise_headers[ifu_nr-1] =
+ cpl_propertylist_duplicate(
+ stored_sub_cube_data_headers[ifu_nr-1]));
+ }
+
KMO_TRY_EXIT_IF_ERROR(
kmclipm_update_property_string(stored_sub_cube_noise_headers[ifu_nr-1],
EXTNAME, extname, "FITS extension name"));
@@ -2053,7 +2281,6 @@ if (plot_it) {
}
// save primary extension
- cpl_msg_info("","Saving STD exposure No. %d", nr_exp+1);
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_save_main_header(frameset, filename_telluric, fn_suffix,
obj_frame, main_header_tel, parlist,
@@ -2070,6 +2297,12 @@ if (plot_it) {
kmo_dfs_save_main_header(frameset, filename_psf, fn_suffix,
obj_frame, main_header_psf, parlist,
cpl_func));
+ if (!no_noise && (strcmp(tplid, "KMOS_spec_cal_stdstarscipatt") == 0)) {
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_main_header(frameset, filename_noise, fn_suffix,
+ obj_frame, main_header_tel, parlist,
+ cpl_func));
+ }
if (save_cubes) {
KMO_TRY_EXIT_IF_ERROR(
kmo_dfs_save_main_header(frameset, filename_cubes, fn_suffix,
@@ -2090,7 +2323,7 @@ ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_telluric_data[ifu_nr-1])
kmo_dfs_save_vector(ddd, filename_telluric, fn_suffix,
stored_sub_tel_data_headers[ifu_nr-1],
0./0.));
-kmclipm_vector_delete(ddd); ddd =NULL;
+kmclipm_vector_delete(ddd); ddd = NULL;
if (stored_telluric_noise[ifu_nr-1] != NULL)
ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_telluric_noise[ifu_nr-1]));
@@ -2098,7 +2331,7 @@ ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_telluric_noise[ifu_nr-1]
kmo_dfs_save_vector(ddd, filename_telluric, fn_suffix,
stored_sub_tel_noise_headers[ifu_nr-1],
0./0.));
-kmclipm_vector_delete(ddd); ddd =NULL;
+kmclipm_vector_delete(ddd); ddd = NULL;
// save star_spec-vector
if (stored_starspec_data[ifu_nr-1] != NULL)
@@ -2107,7 +2340,7 @@ ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_starspec_data[ifu_nr-1])
kmo_dfs_save_vector(ddd, filename_starspec, fn_suffix,
stored_sub_tel_data_headers[ifu_nr-1],
0./0.));
-kmclipm_vector_delete(ddd); ddd =NULL;
+kmclipm_vector_delete(ddd); ddd = NULL;
if (stored_starspec_noise[ifu_nr-1] != NULL)
ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_starspec_noise[ifu_nr-1]));
@@ -2115,7 +2348,7 @@ ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_starspec_noise[ifu_nr-1]
kmo_dfs_save_vector(ddd, filename_starspec, fn_suffix,
stored_sub_tel_noise_headers[ifu_nr-1],
0./0.));
-kmclipm_vector_delete(ddd); ddd =NULL;
+kmclipm_vector_delete(ddd); ddd = NULL;
// save psf-image
KMO_TRY_EXIT_IF_ERROR(
@@ -2130,6 +2363,40 @@ kmclipm_vector_delete(ddd); ddd =NULL;
filename_mask, fn_suffix,
stored_sub_psf_headers[ifu_nr-1],
0./0.));
+
+ // save noise_spec-vector
+ if (!no_noise &&
+ (strcmp(tplid, "KMOS_spec_cal_stdstarscipatt") == 0) &&
+ (stored_noisespec != NULL) &&
+ (stored_noisespec[ifu_nr-1] != NULL) &&
+ (stored_starspec_data[ifu_nr-1] != NULL))
+ {
+ // calculate QC SNR
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_calc_band_mean(stored_sub_tel_data_headers[ifu_nr-1],
+ filter_id,
+ stored_starspec_data[ifu_nr-1], NULL,
+ &tmp_data, NULL));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_calc_band_mean(stored_sub_tel_data_headers[ifu_nr-1],
+ filter_id,
+ stored_noisespec[ifu_nr-1], NULL,
+ &tmp_noise, NULL));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmclipm_update_property_double(stored_sub_tel_data_headers[ifu_nr-1], QC_SNR,
+ tmp_data/tmp_noise, "[] SNR"));
+ }
+
+ if (!no_noise && (strcmp(tplid, "KMOS_spec_cal_stdstarscipatt") == 0)) {
+if ((stored_noisespec != NULL) && (stored_noisespec[ifu_nr-1] != NULL))
+ddd = kmclipm_vector_create(cpl_vector_duplicate(stored_noisespec[ifu_nr-1]));
+ KMO_TRY_EXIT_IF_ERROR(
+ kmo_dfs_save_vector(ddd, filename_noise, fn_suffix,
+ stored_sub_tel_data_headers[ifu_nr-1],
+ 0./0.));
+kmclipm_vector_delete(ddd); ddd = NULL;
+ }
+
// save reonstructed cubes
if (save_cubes) {
KMO_TRY_EXIT_IF_ERROR(
@@ -2173,6 +2440,9 @@ kmclipm_vector_delete(ddd); ddd =NULL;
cpl_vector_delete(stored_starspec_data[i]); stored_starspec_data[i] = NULL;
cpl_vector_delete(stored_starspec_noise[i]); stored_starspec_noise[i] = NULL;
cpl_image_delete(stored_psf_data[i]); stored_psf_data[i] = NULL;
+ if ((stored_noisespec != NULL) && (stored_noisespec[i] != NULL)) {
+ cpl_vector_delete(stored_noisespec[i]); stored_noisespec[i] = NULL;
+ }
cpl_propertylist_delete(stored_sub_tel_data_headers[i]); stored_sub_tel_data_headers[i] = NULL;
cpl_propertylist_delete(stored_sub_tel_noise_headers[i]); stored_sub_tel_noise_headers[i] = NULL;
if (save_cubes) {
@@ -2187,6 +2457,10 @@ kmclipm_vector_delete(ddd); ddd =NULL;
cpl_free(stored_telluric_data); stored_telluric_data = NULL;
cpl_free(stored_telluric_noise); stored_telluric_noise = NULL;
cpl_free(stored_starspec_data); stored_starspec_data = NULL;
+ if (stored_noisespec != NULL) {
+ cpl_free(stored_noisespec); stored_noisespec = NULL;
+ }
+ kmo_delete_skySkyStruct(sky_sky_struct); sky_sky_struct = NULL;
cpl_free(stored_starspec_noise); stored_starspec_noise = NULL;
cpl_free(stored_psf_data); stored_psf_data = NULL;
cpl_free(stored_sub_tel_data_headers); stored_sub_tel_data_headers = NULL;
@@ -2204,6 +2478,8 @@ kmclipm_vector_delete(ddd); ddd =NULL;
cpl_free(stored_noise_cube); stored_noise_cube = NULL;
cpl_free(grat_id); grat_id = NULL;
cpl_frameset_delete(frameset_std); frameset_std = NULL;
+ cpl_free(extname); extname = NULL;
+ cpl_free(tplid); tplid = NULL;
return ret_val;
}
diff --git a/recipes/tests/Makefile.am b/recipes/tests/Makefile.am
index 2d8a858..13a39f0 100644
--- a/recipes/tests/Makefile.am
+++ b/recipes/tests/Makefile.am
@@ -21,7 +21,7 @@ AUTOMAKE_OPTIONS = 1.8 foreign
DISTCLEANFILES = *~
-SUBDIRS = ref_data
+EXTRA_DIST = ref_data
if MAINTAINER_MODE
@@ -29,14 +29,14 @@ MAINTAINERCLEANFILES = Makefile.in
endif
-INCLUDES = $(all_includes) -I../../kmclipm/include/
+INCLUDES = $(all_includes)
+#INCLUDES = $(all_includes) -I../../kmclipm/include/
LDADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE) $(LIBKMOS)
-#check_PROGRAMS = kmo_fits_strip-test
-
# Test programs
-check_PROGRAMS = kmo_arithmetic-test \
+check_PROGRAMS = kmo_init-test \
+ kmo_arithmetic-test \
kmo_combine-test \
kmo_copy-test \
kmo_dev_setup-test \
@@ -60,108 +60,111 @@ check_PROGRAMS = kmo_arithmetic-test \
kmo_sci_red-test \
kmo_multi_reconstruct-test \
kmo_fits_strip-test \
- leak_check-test
+ kmo_final-test
+kmo_init_test_SOURCES = create_data_recipes.c kmo_init-test.c
+kmo_init_test_LDFLAGS = $(CPL_LDFLAGS)
+kmo_init_test_LDADD = $(LDADD)
-kmo_arithmetic_test_SOURCES = kmo_arithmetic-test.c
+kmo_arithmetic_test_SOURCES = create_data_recipes.c kmo_arithmetic-test.c
kmo_arithmetic_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_arithmetic_test_LDADD = $(LDADD)
-
-kmo_combine_test_SOURCES = kmo_combine-test.c
+
+kmo_combine_test_SOURCES = create_data_recipes.c kmo_combine-test.c
kmo_combine_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_combine_test_LDADD = $(LDADD)
-kmo_copy_test_SOURCES = kmo_copy-test.c
+kmo_copy_test_SOURCES = create_data_recipes.c kmo_copy-test.c
kmo_copy_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_copy_test_LDADD = $(LDADD)
-kmo_dev_setup_test_SOURCES = kmo_dev_setup-test.c
+kmo_dev_setup_test_SOURCES = create_data_recipes.c kmo_dev_setup-test.c
kmo_dev_setup_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_dev_setup_test_LDADD = $(LDADD)
-kmo_extract_spec_test_SOURCES = kmo_extract_spec-test.c
+kmo_extract_spec_test_SOURCES = create_data_recipes.c kmo_extract_spec-test.c
kmo_extract_spec_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_extract_spec_test_LDADD = $(LDADD)
-kmo_fit_profile_test_SOURCES = kmo_fit_profile-test.c
+kmo_fit_profile_test_SOURCES = create_data_recipes.c kmo_fit_profile-test.c
kmo_fit_profile_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_fit_profile_test_LDADD = $(LDADD)
-kmo_fits_check_test_SOURCES = kmo_fits_check-test.c
+kmo_fits_check_test_SOURCES = create_data_recipes.c kmo_fits_check-test.c
kmo_fits_check_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_fits_check_test_LDADD = $(LDADD)
-kmo_fits_stack_test_SOURCES = kmo_fits_stack-test.c
+kmo_fits_stack_test_SOURCES = create_data_recipes.c kmo_fits_stack-test.c
kmo_fits_stack_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_fits_stack_test_LDADD = $(LDADD)
-kmo_make_image_test_SOURCES = kmo_make_image-test.c
+kmo_make_image_test_SOURCES = create_data_recipes.c kmo_make_image-test.c
kmo_make_image_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_make_image_test_LDADD = $(LDADD)
-kmo_noise_map_test_SOURCES = kmo_noise_map-test.c
+kmo_noise_map_test_SOURCES = create_data_recipes.c kmo_noise_map-test.c
kmo_noise_map_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_noise_map_test_LDADD = $(LDADD)
-kmo_rotate_test_SOURCES = kmo_rotate-test.c
+kmo_rotate_test_SOURCES = create_data_recipes.c kmo_rotate-test.c
kmo_rotate_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_rotate_test_LDADD = $(LDADD)
-kmo_shift_test_SOURCES = kmo_shift-test.c
+kmo_shift_test_SOURCES = create_data_recipes.c kmo_shift-test.c
kmo_shift_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_shift_test_LDADD = $(LDADD)
-kmo_sky_mask_test_SOURCES = kmo_sky_mask-test.c
+kmo_sky_mask_test_SOURCES = create_data_recipes.c kmo_sky_mask-test.c
kmo_sky_mask_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_sky_mask_test_LDADD = $(LDADD)
-kmo_stats_test_SOURCES = kmo_stats-test.c
+kmo_stats_test_SOURCES = create_data_recipes.c kmo_stats-test.c
kmo_stats_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_stats_test_LDADD = $(LDADD)
-kmo_dark_test_SOURCES = kmo_dark-test.c
+kmo_dark_test_SOURCES = create_data_recipes.c kmo_dark-test.c
kmo_dark_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_dark_test_LDADD = $(LDADD)
-kmo_flat_test_SOURCES = kmo_flat-test.c
+kmo_flat_test_SOURCES = create_data_recipes.c kmo_flat-test.c
kmo_flat_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_flat_test_LDADD = $(LDADD)
-kmo_wave_cal_test_SOURCES = kmo_wave_cal-test.c
+kmo_wave_cal_test_SOURCES = create_data_recipes.c kmo_wave_cal-test.c
kmo_wave_cal_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_wave_cal_test_LDADD = $(LDADD)
-kmo_reconstruct_test_SOURCES = kmo_reconstruct-test.c
+kmo_reconstruct_test_SOURCES = create_data_recipes.c kmo_reconstruct-test.c
kmo_reconstruct_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_reconstruct_test_LDADD = $(LDADD)
-kmo_illumination_test_SOURCES = kmo_illumination-test.c
+kmo_illumination_test_SOURCES = create_data_recipes.c kmo_illumination-test.c
kmo_illumination_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_illumination_test_LDADD = $(LDADD)
-kmo_illumination_flat_test_SOURCES = kmo_illumination_flat-test.c
+kmo_illumination_flat_test_SOURCES = create_data_recipes.c kmo_illumination_flat-test.c
kmo_illumination_flat_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_illumination_flat_test_LDADD = $(LDADD)
-kmo_std_star_test_SOURCES = kmo_std_star-test.c
+kmo_std_star_test_SOURCES = create_data_recipes.c kmo_std_star-test.c
kmo_std_star_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_std_star_test_LDADD = $(LDADD)
-kmo_sci_red_test_SOURCES = kmo_sci_red-test.c
+kmo_sci_red_test_SOURCES = create_data_recipes.c kmo_sci_red-test.c
kmo_sci_red_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_sci_red_test_LDADD = $(LDADD)
-kmo_multi_reconstruct_test_SOURCES = kmo_multi_reconstruct-test.c
+kmo_multi_reconstruct_test_SOURCES = create_data_recipes.c kmo_multi_reconstruct-test.c
kmo_multi_reconstruct_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_multi_reconstruct_test_LDADD = $(LDADD)
-kmo_fits_strip_test_SOURCES = kmo_fits_strip-test.c
+kmo_fits_strip_test_SOURCES = create_data_recipes.c kmo_fits_strip-test.c
kmo_fits_strip_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_fits_strip_test_LDADD = $(LDADD)
-leak_check_test_SOURCES = leak_check-test.c
-leak_check_test_LDFLAGS = $(CPL_LDFLAGS)
-leak_check_test_LDADD = $(LDADD)
+kmo_final_test_SOURCES = kmo_final-test.c
+kmo_final_test_LDFLAGS = $(CPL_LDFLAGS)
+kmo_final_test_LDADD = $(LDADD)
TESTS = $(check_PROGRAMS)
diff --git a/recipes/tests/Makefile.in b/recipes/tests/Makefile.in
index 1d98774..718872b 100644
--- a/recipes/tests/Makefile.in
+++ b/recipes/tests/Makefile.in
@@ -34,7 +34,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-check_PROGRAMS = kmo_arithmetic-test$(EXEEXT) \
+check_PROGRAMS = kmo_init-test$(EXEEXT) kmo_arithmetic-test$(EXEEXT) \
kmo_combine-test$(EXEEXT) kmo_copy-test$(EXEEXT) \
kmo_dev_setup-test$(EXEEXT) kmo_extract_spec-test$(EXEEXT) \
kmo_fit_profile-test$(EXEEXT) kmo_fits_check-test$(EXEEXT) \
@@ -46,7 +46,7 @@ check_PROGRAMS = kmo_arithmetic-test$(EXEEXT) \
kmo_reconstruct-test$(EXEEXT) kmo_illumination-test$(EXEEXT) \
kmo_illumination_flat-test$(EXEEXT) kmo_std_star-test$(EXEEXT) \
kmo_sci_red-test$(EXEEXT) kmo_multi_reconstruct-test$(EXEEXT) \
- kmo_fits_strip-test$(EXEEXT) leak_check-test$(EXEEXT)
+ kmo_fits_strip-test$(EXEEXT) kmo_final-test$(EXEEXT)
subdir = recipes/tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -65,7 +65,8 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-am_kmo_arithmetic_test_OBJECTS = kmo_arithmetic-test.$(OBJEXT)
+am_kmo_arithmetic_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_arithmetic-test.$(OBJEXT)
kmo_arithmetic_test_OBJECTS = $(am_kmo_arithmetic_test_OBJECTS)
am__DEPENDENCIES_1 =
am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
@@ -75,73 +76,90 @@ kmo_arithmetic_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_arithmetic_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_arithmetic_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_combine_test_OBJECTS = kmo_combine-test.$(OBJEXT)
+am_kmo_combine_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_combine-test.$(OBJEXT)
kmo_combine_test_OBJECTS = $(am_kmo_combine_test_OBJECTS)
kmo_combine_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_combine_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_combine_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_copy_test_OBJECTS = kmo_copy-test.$(OBJEXT)
+am_kmo_copy_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_copy-test.$(OBJEXT)
kmo_copy_test_OBJECTS = $(am_kmo_copy_test_OBJECTS)
kmo_copy_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_copy_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_copy_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_dark_test_OBJECTS = kmo_dark-test.$(OBJEXT)
+am_kmo_dark_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_dark-test.$(OBJEXT)
kmo_dark_test_OBJECTS = $(am_kmo_dark_test_OBJECTS)
kmo_dark_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_dark_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_dark_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_dev_setup_test_OBJECTS = kmo_dev_setup-test.$(OBJEXT)
+am_kmo_dev_setup_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_dev_setup-test.$(OBJEXT)
kmo_dev_setup_test_OBJECTS = $(am_kmo_dev_setup_test_OBJECTS)
kmo_dev_setup_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_dev_setup_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_dev_setup_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_extract_spec_test_OBJECTS = kmo_extract_spec-test.$(OBJEXT)
+am_kmo_extract_spec_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_extract_spec-test.$(OBJEXT)
kmo_extract_spec_test_OBJECTS = $(am_kmo_extract_spec_test_OBJECTS)
kmo_extract_spec_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_extract_spec_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_extract_spec_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_fit_profile_test_OBJECTS = kmo_fit_profile-test.$(OBJEXT)
+am_kmo_final_test_OBJECTS = kmo_final-test.$(OBJEXT)
+kmo_final_test_OBJECTS = $(am_kmo_final_test_OBJECTS)
+kmo_final_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
+kmo_final_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(kmo_final_test_LDFLAGS) $(LDFLAGS) -o $@
+am_kmo_fit_profile_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_fit_profile-test.$(OBJEXT)
kmo_fit_profile_test_OBJECTS = $(am_kmo_fit_profile_test_OBJECTS)
kmo_fit_profile_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_fit_profile_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_fit_profile_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_fits_check_test_OBJECTS = kmo_fits_check-test.$(OBJEXT)
+am_kmo_fits_check_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_fits_check-test.$(OBJEXT)
kmo_fits_check_test_OBJECTS = $(am_kmo_fits_check_test_OBJECTS)
kmo_fits_check_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_fits_check_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_fits_check_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_fits_stack_test_OBJECTS = kmo_fits_stack-test.$(OBJEXT)
+am_kmo_fits_stack_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_fits_stack-test.$(OBJEXT)
kmo_fits_stack_test_OBJECTS = $(am_kmo_fits_stack_test_OBJECTS)
kmo_fits_stack_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_fits_stack_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_fits_stack_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_fits_strip_test_OBJECTS = kmo_fits_strip-test.$(OBJEXT)
+am_kmo_fits_strip_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_fits_strip-test.$(OBJEXT)
kmo_fits_strip_test_OBJECTS = $(am_kmo_fits_strip_test_OBJECTS)
kmo_fits_strip_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_fits_strip_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_fits_strip_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_flat_test_OBJECTS = kmo_flat-test.$(OBJEXT)
+am_kmo_flat_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_flat-test.$(OBJEXT)
kmo_flat_test_OBJECTS = $(am_kmo_flat_test_OBJECTS)
kmo_flat_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_flat_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_flat_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_illumination_test_OBJECTS = kmo_illumination-test.$(OBJEXT)
+am_kmo_illumination_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_illumination-test.$(OBJEXT)
kmo_illumination_test_OBJECTS = $(am_kmo_illumination_test_OBJECTS)
kmo_illumination_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_illumination_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_illumination_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_illumination_flat_test_OBJECTS = \
+am_kmo_illumination_flat_test_OBJECTS = create_data_recipes.$(OBJEXT) \
kmo_illumination_flat-test.$(OBJEXT)
kmo_illumination_flat_test_OBJECTS = \
$(am_kmo_illumination_flat_test_OBJECTS)
@@ -150,13 +168,21 @@ kmo_illumination_flat_test_LINK = $(LIBTOOL) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(kmo_illumination_flat_test_LDFLAGS) \
$(LDFLAGS) -o $@
-am_kmo_make_image_test_OBJECTS = kmo_make_image-test.$(OBJEXT)
+am_kmo_init_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_init-test.$(OBJEXT)
+kmo_init_test_OBJECTS = $(am_kmo_init_test_OBJECTS)
+kmo_init_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
+kmo_init_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(kmo_init_test_LDFLAGS) $(LDFLAGS) -o $@
+am_kmo_make_image_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_make_image-test.$(OBJEXT)
kmo_make_image_test_OBJECTS = $(am_kmo_make_image_test_OBJECTS)
kmo_make_image_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_make_image_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_make_image_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_multi_reconstruct_test_OBJECTS = \
+am_kmo_multi_reconstruct_test_OBJECTS = create_data_recipes.$(OBJEXT) \
kmo_multi_reconstruct-test.$(OBJEXT)
kmo_multi_reconstruct_test_OBJECTS = \
$(am_kmo_multi_reconstruct_test_OBJECTS)
@@ -165,66 +191,69 @@ kmo_multi_reconstruct_test_LINK = $(LIBTOOL) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(kmo_multi_reconstruct_test_LDFLAGS) \
$(LDFLAGS) -o $@
-am_kmo_noise_map_test_OBJECTS = kmo_noise_map-test.$(OBJEXT)
+am_kmo_noise_map_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_noise_map-test.$(OBJEXT)
kmo_noise_map_test_OBJECTS = $(am_kmo_noise_map_test_OBJECTS)
kmo_noise_map_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_noise_map_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_noise_map_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_reconstruct_test_OBJECTS = kmo_reconstruct-test.$(OBJEXT)
+am_kmo_reconstruct_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_reconstruct-test.$(OBJEXT)
kmo_reconstruct_test_OBJECTS = $(am_kmo_reconstruct_test_OBJECTS)
kmo_reconstruct_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_reconstruct_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_reconstruct_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_rotate_test_OBJECTS = kmo_rotate-test.$(OBJEXT)
+am_kmo_rotate_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_rotate-test.$(OBJEXT)
kmo_rotate_test_OBJECTS = $(am_kmo_rotate_test_OBJECTS)
kmo_rotate_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_rotate_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_rotate_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_sci_red_test_OBJECTS = kmo_sci_red-test.$(OBJEXT)
+am_kmo_sci_red_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_sci_red-test.$(OBJEXT)
kmo_sci_red_test_OBJECTS = $(am_kmo_sci_red_test_OBJECTS)
kmo_sci_red_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_sci_red_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_sci_red_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_shift_test_OBJECTS = kmo_shift-test.$(OBJEXT)
+am_kmo_shift_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_shift-test.$(OBJEXT)
kmo_shift_test_OBJECTS = $(am_kmo_shift_test_OBJECTS)
kmo_shift_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_shift_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_shift_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_sky_mask_test_OBJECTS = kmo_sky_mask-test.$(OBJEXT)
+am_kmo_sky_mask_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_sky_mask-test.$(OBJEXT)
kmo_sky_mask_test_OBJECTS = $(am_kmo_sky_mask_test_OBJECTS)
kmo_sky_mask_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_sky_mask_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_sky_mask_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_stats_test_OBJECTS = kmo_stats-test.$(OBJEXT)
+am_kmo_stats_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_stats-test.$(OBJEXT)
kmo_stats_test_OBJECTS = $(am_kmo_stats_test_OBJECTS)
kmo_stats_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_stats_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_stats_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_std_star_test_OBJECTS = kmo_std_star-test.$(OBJEXT)
+am_kmo_std_star_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_std_star-test.$(OBJEXT)
kmo_std_star_test_OBJECTS = $(am_kmo_std_star_test_OBJECTS)
kmo_std_star_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_std_star_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_std_star_test_LDFLAGS) $(LDFLAGS) -o $@
-am_kmo_wave_cal_test_OBJECTS = kmo_wave_cal-test.$(OBJEXT)
+am_kmo_wave_cal_test_OBJECTS = create_data_recipes.$(OBJEXT) \
+ kmo_wave_cal-test.$(OBJEXT)
kmo_wave_cal_test_OBJECTS = $(am_kmo_wave_cal_test_OBJECTS)
kmo_wave_cal_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
kmo_wave_cal_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(kmo_wave_cal_test_LDFLAGS) $(LDFLAGS) -o $@
-am_leak_check_test_OBJECTS = leak_check-test.$(OBJEXT)
-leak_check_test_OBJECTS = $(am_leak_check_test_OBJECTS)
-leak_check_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
-leak_check_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(leak_check_test_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/admin/depcomp
am__depfiles_maybe = depfiles
@@ -241,75 +270,38 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
SOURCES = $(kmo_arithmetic_test_SOURCES) $(kmo_combine_test_SOURCES) \
$(kmo_copy_test_SOURCES) $(kmo_dark_test_SOURCES) \
$(kmo_dev_setup_test_SOURCES) $(kmo_extract_spec_test_SOURCES) \
- $(kmo_fit_profile_test_SOURCES) $(kmo_fits_check_test_SOURCES) \
- $(kmo_fits_stack_test_SOURCES) $(kmo_fits_strip_test_SOURCES) \
- $(kmo_flat_test_SOURCES) $(kmo_illumination_test_SOURCES) \
- $(kmo_illumination_flat_test_SOURCES) \
+ $(kmo_final_test_SOURCES) $(kmo_fit_profile_test_SOURCES) \
+ $(kmo_fits_check_test_SOURCES) $(kmo_fits_stack_test_SOURCES) \
+ $(kmo_fits_strip_test_SOURCES) $(kmo_flat_test_SOURCES) \
+ $(kmo_illumination_test_SOURCES) \
+ $(kmo_illumination_flat_test_SOURCES) $(kmo_init_test_SOURCES) \
$(kmo_make_image_test_SOURCES) \
$(kmo_multi_reconstruct_test_SOURCES) \
$(kmo_noise_map_test_SOURCES) $(kmo_reconstruct_test_SOURCES) \
$(kmo_rotate_test_SOURCES) $(kmo_sci_red_test_SOURCES) \
$(kmo_shift_test_SOURCES) $(kmo_sky_mask_test_SOURCES) \
$(kmo_stats_test_SOURCES) $(kmo_std_star_test_SOURCES) \
- $(kmo_wave_cal_test_SOURCES) $(leak_check_test_SOURCES)
+ $(kmo_wave_cal_test_SOURCES)
DIST_SOURCES = $(kmo_arithmetic_test_SOURCES) \
$(kmo_combine_test_SOURCES) $(kmo_copy_test_SOURCES) \
$(kmo_dark_test_SOURCES) $(kmo_dev_setup_test_SOURCES) \
- $(kmo_extract_spec_test_SOURCES) \
+ $(kmo_extract_spec_test_SOURCES) $(kmo_final_test_SOURCES) \
$(kmo_fit_profile_test_SOURCES) $(kmo_fits_check_test_SOURCES) \
$(kmo_fits_stack_test_SOURCES) $(kmo_fits_strip_test_SOURCES) \
$(kmo_flat_test_SOURCES) $(kmo_illumination_test_SOURCES) \
- $(kmo_illumination_flat_test_SOURCES) \
+ $(kmo_illumination_flat_test_SOURCES) $(kmo_init_test_SOURCES) \
$(kmo_make_image_test_SOURCES) \
$(kmo_multi_reconstruct_test_SOURCES) \
$(kmo_noise_map_test_SOURCES) $(kmo_reconstruct_test_SOURCES) \
$(kmo_rotate_test_SOURCES) $(kmo_sci_red_test_SOURCES) \
$(kmo_shift_test_SOURCES) $(kmo_sky_mask_test_SOURCES) \
$(kmo_stats_test_SOURCES) $(kmo_std_star_test_SOURCES) \
- $(kmo_wave_cal_test_SOURCES) $(leak_check_test_SOURCES)
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
- distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
- distdir
+ $(kmo_wave_cal_test_SOURCES)
ETAGS = etags
CTAGS = ctags
am__tty_colors = \
red=; grn=; lgn=; blu=; std=
-DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-am__relativize = \
- dir0=`pwd`; \
- sed_first='s,^\([^/]*\)/.*$$,\1,'; \
- sed_rest='s,^[^/]*/*,,'; \
- sed_last='s,^.*/\([^/]*\)$$,\1,'; \
- sed_butlast='s,/*[^/]*$$,,'; \
- while test -n "$$dir1"; do \
- first=`echo "$$dir1" | sed -e "$$sed_first"`; \
- if test "$$first" != "."; then \
- if test "$$first" = ".."; then \
- dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
- dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
- else \
- first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
- if test "$$first2" = "$$first"; then \
- dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
- else \
- dir2="../$$dir2"; \
- fi; \
- dir0="$$dir0"/"$$first"; \
- fi; \
- fi; \
- dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
- done; \
- reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
@@ -364,6 +356,7 @@ LIBCPLDFS = @LIBCPLDFS@
LIBCPLDRS = @LIBCPLDRS@
LIBCPLUI = @LIBCPLUI@
LIBIRPLIB = @LIBIRPLIB@
+LIBKMCLIPMLIB = @LIBKMCLIPMLIB@
LIBKMOS = @LIBKMOS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@@ -467,85 +460,89 @@ wkfcopydir = @wkfcopydir@
wkfextradir = @wkfextradir@
AUTOMAKE_OPTIONS = 1.8 foreign
DISTCLEANFILES = *~
-SUBDIRS = ref_data
+EXTRA_DIST = ref_data
@MAINTAINER_MODE_TRUE at MAINTAINERCLEANFILES = Makefile.in
-INCLUDES = $(all_includes) -I../../kmclipm/include/
+INCLUDES = $(all_includes)
+#INCLUDES = $(all_includes) -I../../kmclipm/include/
LDADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE) $(LIBKMOS)
-kmo_arithmetic_test_SOURCES = kmo_arithmetic-test.c
+kmo_init_test_SOURCES = create_data_recipes.c kmo_init-test.c
+kmo_init_test_LDFLAGS = $(CPL_LDFLAGS)
+kmo_init_test_LDADD = $(LDADD)
+kmo_arithmetic_test_SOURCES = create_data_recipes.c kmo_arithmetic-test.c
kmo_arithmetic_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_arithmetic_test_LDADD = $(LDADD)
-kmo_combine_test_SOURCES = kmo_combine-test.c
+kmo_combine_test_SOURCES = create_data_recipes.c kmo_combine-test.c
kmo_combine_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_combine_test_LDADD = $(LDADD)
-kmo_copy_test_SOURCES = kmo_copy-test.c
+kmo_copy_test_SOURCES = create_data_recipes.c kmo_copy-test.c
kmo_copy_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_copy_test_LDADD = $(LDADD)
-kmo_dev_setup_test_SOURCES = kmo_dev_setup-test.c
+kmo_dev_setup_test_SOURCES = create_data_recipes.c kmo_dev_setup-test.c
kmo_dev_setup_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_dev_setup_test_LDADD = $(LDADD)
-kmo_extract_spec_test_SOURCES = kmo_extract_spec-test.c
+kmo_extract_spec_test_SOURCES = create_data_recipes.c kmo_extract_spec-test.c
kmo_extract_spec_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_extract_spec_test_LDADD = $(LDADD)
-kmo_fit_profile_test_SOURCES = kmo_fit_profile-test.c
+kmo_fit_profile_test_SOURCES = create_data_recipes.c kmo_fit_profile-test.c
kmo_fit_profile_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_fit_profile_test_LDADD = $(LDADD)
-kmo_fits_check_test_SOURCES = kmo_fits_check-test.c
+kmo_fits_check_test_SOURCES = create_data_recipes.c kmo_fits_check-test.c
kmo_fits_check_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_fits_check_test_LDADD = $(LDADD)
-kmo_fits_stack_test_SOURCES = kmo_fits_stack-test.c
+kmo_fits_stack_test_SOURCES = create_data_recipes.c kmo_fits_stack-test.c
kmo_fits_stack_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_fits_stack_test_LDADD = $(LDADD)
-kmo_make_image_test_SOURCES = kmo_make_image-test.c
+kmo_make_image_test_SOURCES = create_data_recipes.c kmo_make_image-test.c
kmo_make_image_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_make_image_test_LDADD = $(LDADD)
-kmo_noise_map_test_SOURCES = kmo_noise_map-test.c
+kmo_noise_map_test_SOURCES = create_data_recipes.c kmo_noise_map-test.c
kmo_noise_map_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_noise_map_test_LDADD = $(LDADD)
-kmo_rotate_test_SOURCES = kmo_rotate-test.c
+kmo_rotate_test_SOURCES = create_data_recipes.c kmo_rotate-test.c
kmo_rotate_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_rotate_test_LDADD = $(LDADD)
-kmo_shift_test_SOURCES = kmo_shift-test.c
+kmo_shift_test_SOURCES = create_data_recipes.c kmo_shift-test.c
kmo_shift_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_shift_test_LDADD = $(LDADD)
-kmo_sky_mask_test_SOURCES = kmo_sky_mask-test.c
+kmo_sky_mask_test_SOURCES = create_data_recipes.c kmo_sky_mask-test.c
kmo_sky_mask_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_sky_mask_test_LDADD = $(LDADD)
-kmo_stats_test_SOURCES = kmo_stats-test.c
+kmo_stats_test_SOURCES = create_data_recipes.c kmo_stats-test.c
kmo_stats_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_stats_test_LDADD = $(LDADD)
-kmo_dark_test_SOURCES = kmo_dark-test.c
+kmo_dark_test_SOURCES = create_data_recipes.c kmo_dark-test.c
kmo_dark_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_dark_test_LDADD = $(LDADD)
-kmo_flat_test_SOURCES = kmo_flat-test.c
+kmo_flat_test_SOURCES = create_data_recipes.c kmo_flat-test.c
kmo_flat_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_flat_test_LDADD = $(LDADD)
-kmo_wave_cal_test_SOURCES = kmo_wave_cal-test.c
+kmo_wave_cal_test_SOURCES = create_data_recipes.c kmo_wave_cal-test.c
kmo_wave_cal_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_wave_cal_test_LDADD = $(LDADD)
-kmo_reconstruct_test_SOURCES = kmo_reconstruct-test.c
+kmo_reconstruct_test_SOURCES = create_data_recipes.c kmo_reconstruct-test.c
kmo_reconstruct_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_reconstruct_test_LDADD = $(LDADD)
-kmo_illumination_test_SOURCES = kmo_illumination-test.c
+kmo_illumination_test_SOURCES = create_data_recipes.c kmo_illumination-test.c
kmo_illumination_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_illumination_test_LDADD = $(LDADD)
-kmo_illumination_flat_test_SOURCES = kmo_illumination_flat-test.c
+kmo_illumination_flat_test_SOURCES = create_data_recipes.c kmo_illumination_flat-test.c
kmo_illumination_flat_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_illumination_flat_test_LDADD = $(LDADD)
-kmo_std_star_test_SOURCES = kmo_std_star-test.c
+kmo_std_star_test_SOURCES = create_data_recipes.c kmo_std_star-test.c
kmo_std_star_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_std_star_test_LDADD = $(LDADD)
-kmo_sci_red_test_SOURCES = kmo_sci_red-test.c
+kmo_sci_red_test_SOURCES = create_data_recipes.c kmo_sci_red-test.c
kmo_sci_red_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_sci_red_test_LDADD = $(LDADD)
-kmo_multi_reconstruct_test_SOURCES = kmo_multi_reconstruct-test.c
+kmo_multi_reconstruct_test_SOURCES = create_data_recipes.c kmo_multi_reconstruct-test.c
kmo_multi_reconstruct_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_multi_reconstruct_test_LDADD = $(LDADD)
-kmo_fits_strip_test_SOURCES = kmo_fits_strip-test.c
+kmo_fits_strip_test_SOURCES = create_data_recipes.c kmo_fits_strip-test.c
kmo_fits_strip_test_LDFLAGS = $(CPL_LDFLAGS)
kmo_fits_strip_test_LDADD = $(LDADD)
-leak_check_test_SOURCES = leak_check-test.c
-leak_check_test_LDFLAGS = $(CPL_LDFLAGS)
-leak_check_test_LDADD = $(LDADD)
+kmo_final_test_SOURCES = kmo_final-test.c
+kmo_final_test_LDFLAGS = $(CPL_LDFLAGS)
+kmo_final_test_LDADD = $(LDADD)
TESTS = $(check_PROGRAMS)
# Be sure to reexport important environment variables.
@@ -554,7 +551,7 @@ TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)"
-all: all-recursive
+all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
@@ -615,6 +612,9 @@ kmo_dev_setup-test$(EXEEXT): $(kmo_dev_setup_test_OBJECTS) $(kmo_dev_setup_test_
kmo_extract_spec-test$(EXEEXT): $(kmo_extract_spec_test_OBJECTS) $(kmo_extract_spec_test_DEPENDENCIES) $(EXTRA_kmo_extract_spec_test_DEPENDENCIES)
@rm -f kmo_extract_spec-test$(EXEEXT)
$(kmo_extract_spec_test_LINK) $(kmo_extract_spec_test_OBJECTS) $(kmo_extract_spec_test_LDADD) $(LIBS)
+kmo_final-test$(EXEEXT): $(kmo_final_test_OBJECTS) $(kmo_final_test_DEPENDENCIES) $(EXTRA_kmo_final_test_DEPENDENCIES)
+ @rm -f kmo_final-test$(EXEEXT)
+ $(kmo_final_test_LINK) $(kmo_final_test_OBJECTS) $(kmo_final_test_LDADD) $(LIBS)
kmo_fit_profile-test$(EXEEXT): $(kmo_fit_profile_test_OBJECTS) $(kmo_fit_profile_test_DEPENDENCIES) $(EXTRA_kmo_fit_profile_test_DEPENDENCIES)
@rm -f kmo_fit_profile-test$(EXEEXT)
$(kmo_fit_profile_test_LINK) $(kmo_fit_profile_test_OBJECTS) $(kmo_fit_profile_test_LDADD) $(LIBS)
@@ -636,6 +636,9 @@ kmo_illumination-test$(EXEEXT): $(kmo_illumination_test_OBJECTS) $(kmo_illuminat
kmo_illumination_flat-test$(EXEEXT): $(kmo_illumination_flat_test_OBJECTS) $(kmo_illumination_flat_test_DEPENDENCIES) $(EXTRA_kmo_illumination_flat_test_DEPENDENCIES)
@rm -f kmo_illumination_flat-test$(EXEEXT)
$(kmo_illumination_flat_test_LINK) $(kmo_illumination_flat_test_OBJECTS) $(kmo_illumination_flat_test_LDADD) $(LIBS)
+kmo_init-test$(EXEEXT): $(kmo_init_test_OBJECTS) $(kmo_init_test_DEPENDENCIES) $(EXTRA_kmo_init_test_DEPENDENCIES)
+ @rm -f kmo_init-test$(EXEEXT)
+ $(kmo_init_test_LINK) $(kmo_init_test_OBJECTS) $(kmo_init_test_LDADD) $(LIBS)
kmo_make_image-test$(EXEEXT): $(kmo_make_image_test_OBJECTS) $(kmo_make_image_test_DEPENDENCIES) $(EXTRA_kmo_make_image_test_DEPENDENCIES)
@rm -f kmo_make_image-test$(EXEEXT)
$(kmo_make_image_test_LINK) $(kmo_make_image_test_OBJECTS) $(kmo_make_image_test_LDADD) $(LIBS)
@@ -669,9 +672,6 @@ kmo_std_star-test$(EXEEXT): $(kmo_std_star_test_OBJECTS) $(kmo_std_star_test_DEP
kmo_wave_cal-test$(EXEEXT): $(kmo_wave_cal_test_OBJECTS) $(kmo_wave_cal_test_DEPENDENCIES) $(EXTRA_kmo_wave_cal_test_DEPENDENCIES)
@rm -f kmo_wave_cal-test$(EXEEXT)
$(kmo_wave_cal_test_LINK) $(kmo_wave_cal_test_OBJECTS) $(kmo_wave_cal_test_LDADD) $(LIBS)
-leak_check-test$(EXEEXT): $(leak_check_test_OBJECTS) $(leak_check_test_DEPENDENCIES) $(EXTRA_leak_check_test_DEPENDENCIES)
- @rm -f leak_check-test$(EXEEXT)
- $(leak_check_test_LINK) $(leak_check_test_OBJECTS) $(leak_check_test_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -679,12 +679,14 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/create_data_recipes.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_arithmetic-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_combine-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_copy-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_dark-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_dev_setup-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_extract_spec-test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_final-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_fit_profile-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_fits_check-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_fits_stack-test.Po at am__quote@
@@ -692,6 +694,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_flat-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_illumination-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_illumination_flat-test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_init-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_make_image-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_multi_reconstruct-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_noise_map-test.Po at am__quote@
@@ -703,7 +706,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_stats-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_std_star-test.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmo_wave_cal-test.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/leak_check-test.Po at am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -732,76 +734,6 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
- fi; test -z "$$fail"
-
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
-
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -812,23 +744,10 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
mkid -fID $$unique
tags: TAGS
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
- if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
- include_option=--etags-include; \
- empty_fix=.; \
- else \
- include_option=--include; \
- empty_fix=; \
- fi; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test ! -f $$subdir/TAGS || \
- set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
- fi; \
- done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
@@ -847,7 +766,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
fi; \
fi
ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -990,50 +909,21 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- fi; \
- done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
- $(am__relativize); \
- new_distdir=$$reldir; \
- dir1=$$subdir; dir2="$(top_distdir)"; \
- $(am__relativize); \
- new_top_distdir=$$reldir; \
- echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
- echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
- ($(am__cd) $$subdir && \
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$new_top_distdir" \
- distdir="$$new_distdir" \
- am__remove_distdir=: \
- am__skip_length_check=: \
- am__skip_mode_fix=: \
- distdir) \
- || exit 1; \
- fi; \
- done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
-check: check-recursive
+check: check-am
all-am: Makefile
-installdirs: installdirs-recursive
-installdirs-am:
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-installcheck: installcheck-recursive
+installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
@@ -1057,94 +947,92 @@ maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-clean: clean-recursive
+clean: clean-am
clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \
mostlyclean-am
-distclean: distclean-recursive
+distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
-dvi: dvi-recursive
+dvi: dvi-am
dvi-am:
-html: html-recursive
+html: html-am
html-am:
-info: info-recursive
+info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-recursive
+install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
-install-html: install-html-recursive
+install-html: install-html-am
install-html-am:
-install-info: install-info-recursive
+install-info: install-info-am
install-info-am:
install-man:
-install-pdf: install-pdf-recursive
+install-pdf: install-pdf-am
install-pdf-am:
-install-ps: install-ps-recursive
+install-ps: install-ps-am
install-ps-am:
installcheck-am:
-maintainer-clean: maintainer-clean-recursive
+maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
-mostlyclean: mostlyclean-recursive
+mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
-pdf: pdf-recursive
+pdf: pdf-am
pdf-am:
-ps: ps-recursive
+ps: ps-am
ps-am:
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \
- ctags-recursive install-am install-strip tags-recursive
+.MAKE: check-am install-am install-strip
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-TESTS check-am clean \
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool clean-local \
- ctags ctags-recursive distclean distclean-compile \
- distclean-generic distclean-libtool distclean-tags distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs installdirs-am \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
+ ctags distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am
# We need to remove any files that the above tests created.
diff --git a/kmos/kmo_test_create_data.c b/recipes/tests/create_data_recipes.c
similarity index 98%
rename from kmos/kmo_test_create_data.c
rename to recipes/tests/create_data_recipes.c
index ce6e35e..2b1ebb4 100644
--- a/kmos/kmo_test_create_data.c
+++ b/recipes/tests/create_data_recipes.c
@@ -42,7 +42,6 @@
#include <string.h>
#include <sys/stat.h>
-#include "kmo_test_create_data.h"
#include "kmo_dfs.h"
#include "kmo_constants.h"
#include "kmo_debug.h"
@@ -68,10 +67,7 @@ int test_global_size_x = 5,
test_global_size_z = 7,
test_global_nr_frames = 5;
-const char *test_global_raw_path = "ref_data/KMOS_dummy.fits";
-
const char *test_global_path_test_data = "test_data/";
-const char *test_global_path_ref_data = "ref_data/";
// !!! global_valid MUST have size of nr_ifus !!!
int test_global_valid[] = {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, \
@@ -79,12 +75,6 @@ int test_global_valid[] = {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, \
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE};
/**
- @defgroup kmo_create_data Functions to create test data
-
- @{
- */
-
-/**
@brief Checks if a file or folder of a given name exists.
@param name The name of the file or folder to check.
@@ -452,167 +442,6 @@ double kmo_test_esorex_data(const char* filename, int dont_lower)
}
/**
- @brief Creates 2048x2048pixel data to test the pipeline
- */
-void kmo_test_create_pipeline_data()
-{
- printf("------------------------------\n");
- printf(" > Creating pipeline test data\n");
- kmo_test_create_pipeline_data_core("pipeline/",
- "log_generate_pipeline_data.txt");
- printf("------------------------------\n");
-}
-
-/**
- @brief Creates 2048x2048pixel data to test the pipeline
- */
-void kmo_test_create_pipeline_data_core(const char * subpath, const char* log_path)
-{
- const char *darkpath = "ref_data/K_only_sky_dark.fits",
- *flatpath = "ref_data/K_only_sky_flat.fits",
- *arcpath = "ref_data/K_only_sky_arc.fits",
- *skypath = "ref_data/K_only_sky.fits",
- *stdpath = "ref_data/K_stars+obj_rot0.25.fits",
- *valid = "\"1;1;1;1;1;1;1;1\"",
- *filter = "\"K\"",
- *grating = "\"K\"",
- *sub_key = "\"ESO DET CHIP GAIN;double;1.1;ESO DET CHIP RON;double;0.1\"";
-
- char cmd[2048],
- path[1024];
-
- double rotangle = 0.0;
-
-// cpl_msg_info("", " > Creating pipeline test data...");
-
- // setup directories
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
- }
-
- strcpy(path, test_global_path_test_data);
- strcat(path, subpath);
-
- if (kmo_test_file_exists(path) == FALSE) {
- mkdir(path, 0777);
- }
-
- // DARK
- sprintf(cmd, "esorex kmo_dev_setup --type=DARK --rotangle=%f --valid=%s"
- " --subkey=%s %s",
- rotangle, valid, sub_key, darkpath);
- kmo_get_pipe_command(cmd, log_path, NULL, FALSE);
- system(cmd);
- sprintf(cmd, "mv dark_123.fits %s", path); system(cmd);
- sprintf(cmd, "mv dark_231.fits %s", path); system(cmd);
- sprintf(cmd, "mv dark_312.fits %s", path); system(cmd);
-
- // FLAT_ON
- sprintf(cmd, "esorex kmo_dev_setup --type=FLAT_ON --rotangle=%f --valid=%s"
- " --filt=%s --grat=%s --subkey=%s %s",
- rotangle, valid, filter, grating,
- sub_key, flatpath);
- kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
- system(cmd);
- sprintf(cmd, "mv flat_on_123.fits %s", path); system(cmd);
- sprintf(cmd, "mv flat_on_231.fits %s", path); system(cmd);
- sprintf(cmd, "mv flat_on_312.fits %s", path); system(cmd);
-
- // FLAT_OFF
- sprintf(cmd, "esorex kmo_dev_setup --type=FLAT_OFF --rotangle=%f "
- "--valid=%s --filt=%s --grat=%s %s",
- rotangle, valid, filter, grating,
- darkpath);
- kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
- system(cmd);
- sprintf(cmd, "mv flat_off_123.fits %s", path); system(cmd);
- sprintf(cmd, "mv flat_off_231.fits %s", path); system(cmd);
- sprintf(cmd, "mv flat_off_312.fits %s", path); system(cmd);
-
- // ARC_ON
- sprintf(cmd, "esorex kmo_dev_setup --type=ARC_ON --rotangle=%f "
- "--valid=%s --filt=%s --grat=%s --subkey=%s %s",
- rotangle, valid, filter, grating,
- sub_key, arcpath);
- kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
- system(cmd);
- sprintf(cmd, "mv arc_on_123.fits %s", path); system(cmd);
-
- // ARC_OFF
- sprintf(cmd, "esorex kmo_dev_setup --type=ARC_OFF --rotangle=%f "
- "--valid=%s --filt=%s --grat=%s --subkey=%s %s",
- rotangle, valid, filter, grating,
- sub_key, darkpath);
- kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
- system(cmd);
- sprintf(cmd, "mv arc_off_123.fits %s", path); system(cmd);
-
- // SKY
- sprintf(cmd, "esorex kmo_dev_setup --type=SKY --rotangle=%f --valid=%s"
- " --filt=%s --grat=%s %s",
- rotangle, valid, filter, grating,
- skypath);
- kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
- system(cmd);
- sprintf(cmd, "mv sky_123.fits %s", path); system(cmd);
- sprintf(cmd, "mv sky_231.fits %s", path); system(cmd);
- sprintf(cmd, "mv sky_312.fits %s", path); system(cmd);
-
- // STD OBJ
- sprintf(cmd, "esorex kmo_dev_setup --type=STD --rotangle=%f --valid=%s"
- " --filt=%s --grat=%s --subkey=%s "
- " --mainkey=\"ESO TPL ID;string;KMOS_spec_cal_stdstarscipatt\" "
- " --date=\"2011-01-12T11:10:00.0000\" "
- " --objects=\"0;1;0;0;1;0;0;0\" %s ",
- rotangle, valid, filter, grating,
- sub_key, stdpath);
- kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
- system(cmd);
- sprintf(cmd, "mv std_123.fits %s/std_obj_123.fits", path); system(cmd);
-
- // STD SKY
- sprintf(cmd, "esorex kmo_dev_setup --type=STD --rotangle=%f --valid=%s"
- " --filt=%s --grat=%s --subkey=%s "
- " --mainkey=\"ESO TPL ID;string;KMOS_spec_cal_stdstarscipatt\" "
- " --date=\"2011-01-12T11:12:00.0000\" "
- " --objects=\"0;0;0;0;0;0;0;0\" %s ",
- rotangle, valid, filter, grating,
- sub_key, skypath);
- kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
- system(cmd);
- sprintf(cmd, "mv std_123.fits %s/std_sky_123.fits", path); system(cmd);
-
- // SCIENCE OBJ
- sprintf(cmd, "esorex kmo_dev_setup --type=STD --rotangle=%f --valid=%s"
- " --filt=%s --grat=%s --subkey=%s "
- "--date=\"2011-01-12T12:12:00.0000\" "
- "--mainkey=\"ESO OCS ARM5 NAME;string;AAA;"
- "ESO OCS ARM10 NAME;string;BBB;"
- "ESO OCS ARM18 NAME;string;CCC;ESO OCS ARM21 NAME;string;DDD\""
- " --objects=\"0;1;0;0;1;0;0;0\" %s",
- rotangle, valid, filter, grating,
- sub_key, stdpath);
- kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
- system(cmd);
- sprintf(cmd, "mv std_123.fits %s/science_obj_123.fits", path); system(cmd);
-
- // SCIENCE SKY
- sprintf(cmd, "esorex kmo_dev_setup --type=STD --rotangle=%f --valid=%s"
- " --filt=%s --grat=%s --subkey=%s "
- "--date=\"2011-01-12T12:13:00.0000\""
- " --objects=\"0;0;0;0;0;0;0;0\" %s",
- rotangle, valid, filter, grating,
- sub_key, skypath);
- kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
- system(cmd);
- sprintf(cmd, "mv std_123.fits %s/science_sky_123.fits", path); system(cmd);
-
- system("rm tmp_delete1.fits tmp_delete2.fits tmp_delete3.fits");
-
- cpl_msg_info("", "Finished creating pipeline test data...");
-}
-
-/**
@brief
Frame constructor
@@ -993,6 +822,8 @@ void kmo_test_create_primary_extension(const char *filename,
KMO_TRY
{
+ char *test_global_raw_path = cpl_sprintf("%s/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+
header = kmclipm_propertylist_load(test_global_raw_path, 0);
KMO_TRY_EXIT_IF_NOT(header != NULL);
@@ -1003,6 +834,7 @@ void kmo_test_create_primary_extension(const char *filename,
KMO_TRY_EXIT_IF_ERROR(
cpl_propertylist_save(header, filename, CPL_IO_CREATE));
+ cpl_free(test_global_raw_path); test_global_raw_path = NULL;
}
KMO_CATCH
{
@@ -1055,6 +887,8 @@ int kmo_test_create_RAW_data(int x,
KMO_TRY
{
+ char *test_global_raw_path = cpl_sprintf("%s/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+
// load header from dummy
KMO_TRY_EXIT_IF_NULL(
header = kmclipm_propertylist_load(test_global_raw_path, 0));
@@ -1097,6 +931,7 @@ int kmo_test_create_RAW_data(int x,
cpl_propertylist_delete(header); header = NULL;
}
KMO_TRY_CHECK_ERROR_STATE();
+ cpl_free(test_global_raw_path); test_global_raw_path = NULL;
}
KMO_CATCH
{
@@ -1127,6 +962,8 @@ int kmo_test_create_RAW_data_zero(int x,
KMO_TRY
{
+ char *test_global_raw_path = cpl_sprintf("%s/ref_data/KMOS_dummy.fits", getenv("srcdir"));
+
// load header from dummy
KMO_TRY_EXIT_IF_NULL(
header = kmclipm_propertylist_load(test_global_raw_path, 0));
@@ -1159,6 +996,8 @@ int kmo_test_create_RAW_data_zero(int x,
cpl_propertylist_delete(header); header = NULL;
}
KMO_TRY_CHECK_ERROR_STATE();
+
+ cpl_free(test_global_raw_path); test_global_raw_path = NULL;
}
KMO_CATCH
{
@@ -2354,5 +2193,157 @@ int kmo_test_create_B2D_data(int x,
return ret;
}
+/**
+ @brief Creates 2048x2048pixel data to test the pipeline
+ */
+void kmo_test_create_pipeline_data_core(const char * subpath, const char* log_path)
+{
+ char darkpath[1024],
+ flatpath[1024],
+ arcpath[1024],
+ skypath[1024],
+ stdpath[1024];
+ strcpy(darkpath, getenv("srcdir"));
+ strcat(darkpath, "/ref_data/K_only_sky_dark.fits");
+ strcpy(flatpath, getenv("srcdir"));
+ strcat(flatpath, "/ref_data/K_only_sky_flat.fits");
+ strcpy(arcpath, getenv("srcdir"));
+ strcat(arcpath, "/ref_data/K_only_sky_arc.fits");
+ strcpy(skypath, getenv("srcdir"));
+ strcat(skypath, "/ref_data/K_only_sky.fits");
+ strcpy(stdpath, getenv("srcdir"));
+ strcat(stdpath, "/ref_data/K_stars+obj_rot0.25.fits");
+
+ const char *valid = "\"1;1;1;1;1;1;1;1\"",
+ *filter = "\"K\"",
+ *grating = "\"K\"",
+ *sub_key = "\"ESO DET CHIP GAIN;double;1.1;ESO DET CHIP RON;double;0.1\"";
+
+ char cmd[2048],
+ path[1024];
+ double rotangle = 0.0;
+
+ // setup directories
+ if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
+ mkdir(test_global_path_test_data, 0777);
+ }
+
+ strcpy(path, test_global_path_test_data);
+ strcat(path, subpath);
+
+ if (kmo_test_file_exists(path) == FALSE) {
+ mkdir(path, 0777);
+ }
+
+ // DARK
+ sprintf(cmd, "esorex kmo_dev_setup --type=DARK --rotangle=%f --valid=%s"
+ " --subkey=%s %s",
+ rotangle, valid, sub_key, darkpath);
+ kmo_get_pipe_command(cmd, log_path, NULL, FALSE);
+ system(cmd);
+ sprintf(cmd, "mv dark_123.fits %s", path); system(cmd);
+ sprintf(cmd, "mv dark_231.fits %s", path); system(cmd);
+ sprintf(cmd, "mv dark_312.fits %s", path); system(cmd);
+
+ // FLAT_ON
+ sprintf(cmd, "esorex kmo_dev_setup --type=FLAT_ON --rotangle=%f --valid=%s"
+ " --filt=%s --grat=%s --subkey=%s %s",
+ rotangle, valid, filter, grating,
+ sub_key, flatpath);
+ kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
+ system(cmd);
+ sprintf(cmd, "mv flat_on_123.fits %s", path); system(cmd);
+ sprintf(cmd, "mv flat_on_231.fits %s", path); system(cmd);
+ sprintf(cmd, "mv flat_on_312.fits %s", path); system(cmd);
+
+ // FLAT_OFF
+ sprintf(cmd, "esorex kmo_dev_setup --type=FLAT_OFF --rotangle=%f "
+ "--valid=%s --filt=%s --grat=%s %s",
+ rotangle, valid, filter, grating,
+ darkpath);
+ kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
+ system(cmd);
+ sprintf(cmd, "mv flat_off_123.fits %s", path); system(cmd);
+ sprintf(cmd, "mv flat_off_231.fits %s", path); system(cmd);
+ sprintf(cmd, "mv flat_off_312.fits %s", path); system(cmd);
+
+ // ARC_ON
+ sprintf(cmd, "esorex kmo_dev_setup --type=ARC_ON --rotangle=%f "
+ "--valid=%s --filt=%s --grat=%s --subkey=%s %s",
+ rotangle, valid, filter, grating,
+ sub_key, arcpath);
+ kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
+ system(cmd);
+ sprintf(cmd, "mv arc_on_123.fits %s", path); system(cmd);
+
+ // ARC_OFF
+ sprintf(cmd, "esorex kmo_dev_setup --type=ARC_OFF --rotangle=%f "
+ "--valid=%s --filt=%s --grat=%s --subkey=%s %s",
+ rotangle, valid, filter, grating,
+ sub_key, darkpath);
+ kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
+ system(cmd);
+ sprintf(cmd, "mv arc_off_123.fits %s", path); system(cmd);
-/** @} */
+ // SKY
+ sprintf(cmd, "esorex kmo_dev_setup --type=SKY --rotangle=%f --valid=%s"
+ " --filt=%s --grat=%s %s",
+ rotangle, valid, filter, grating,
+ skypath);
+ kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
+ system(cmd);
+ sprintf(cmd, "mv sky_123.fits %s", path); system(cmd);
+ sprintf(cmd, "mv sky_231.fits %s", path); system(cmd);
+ sprintf(cmd, "mv sky_312.fits %s", path); system(cmd);
+
+ // STD OBJ
+ sprintf(cmd, "esorex kmo_dev_setup --type=STD --rotangle=%f --valid=%s"
+ " --filt=%s --grat=%s --subkey=%s "
+ " --mainkey=\"ESO TPL ID;string;KMOS_spec_cal_stdstarscipatt\" "
+ " --date=\"2011-01-12T11:10:00.0000\" "
+ " --objects=\"0;1;0;0;1;0;0;0\" %s ",
+ rotangle, valid, filter, grating,
+ sub_key, stdpath);
+ kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
+ system(cmd);
+ sprintf(cmd, "mv std_123.fits %s/std_obj_123.fits", path); system(cmd);
+
+ // STD SKY
+ sprintf(cmd, "esorex kmo_dev_setup --type=STD --rotangle=%f --valid=%s"
+ " --filt=%s --grat=%s --subkey=%s "
+ " --mainkey=\"ESO TPL ID;string;KMOS_spec_cal_stdstarscipatt\" "
+ " --date=\"2011-01-12T11:12:00.0000\" "
+ " --objects=\"0;0;0;0;0;0;0;0\" %s ",
+ rotangle, valid, filter, grating,
+ sub_key, skypath);
+ kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
+ system(cmd);
+ sprintf(cmd, "mv std_123.fits %s/std_sky_123.fits", path); system(cmd);
+
+ // SCIENCE OBJ
+ sprintf(cmd, "esorex kmo_dev_setup --type=STD --rotangle=%f --valid=%s"
+ " --filt=%s --grat=%s --subkey=%s "
+ "--date=\"2011-01-12T12:12:00.0000\" "
+ "--mainkey=\"ESO OCS ARM5 NAME;string;AAA;"
+ "ESO OCS ARM10 NAME;string;BBB;"
+ "ESO OCS ARM18 NAME;string;CCC;ESO OCS ARM21 NAME;string;DDD\""
+ " --objects=\"0;1;0;0;1;0;0;0\" %s",
+ rotangle, valid, filter, grating,
+ sub_key, stdpath);
+ kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
+ system(cmd);
+ sprintf(cmd, "mv std_123.fits %s/science_obj_123.fits", path); system(cmd);
+
+ // SCIENCE SKY
+ sprintf(cmd, "esorex kmo_dev_setup --type=STD --rotangle=%f --valid=%s"
+ " --filt=%s --grat=%s --subkey=%s "
+ "--date=\"2011-01-12T12:13:00.0000\""
+ " --objects=\"0;0;0;0;0;0;0;0\" %s",
+ rotangle, valid, filter, grating,
+ sub_key, skypath);
+ kmo_get_pipe_command(cmd, log_path, NULL, TRUE);
+ system(cmd);
+ sprintf(cmd, "mv std_123.fits %s/science_sky_123.fits", path); system(cmd);
+
+ system("rm tmp_delete1.fits tmp_delete2.fits tmp_delete3.fits");
+}
diff --git a/recipes/tests/kmo_arithmetic-test.c b/recipes/tests/kmo_arithmetic-test.c
index 8b26fd1..1acdbac 100644
--- a/recipes/tests/kmo_arithmetic-test.c
+++ b/recipes/tests/kmo_arithmetic-test.c
@@ -30,12 +30,36 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
+
#include "kmclipm_math.h"
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
double scalar = 6.7;
int ifu_nr = 4;
@@ -265,12 +289,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_combine-test.c b/recipes/tests/kmo_combine-test.c
index c02f869..31693b8 100644
--- a/recipes/tests/kmo_combine-test.c
+++ b/recipes/tests/kmo_combine-test.c
@@ -30,15 +30,38 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
+
#include "kmclipm_constants.h"
#include "kmclipm_math.h"
#include "kmclipm_functions.h"
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_combine/";
@@ -104,6 +127,8 @@ static int kmo_generate_test_data_combine(const char *path)
name2[256],
cmd[256];
+ char *test_global_path_ref_data = cpl_sprintf("%s/ref_data/", getenv("srcdir"));
+
kmo_test_cat_strings(file_ref, test_global_path_ref_data, "ref_cube_arc.fits");
cpl_imagelist *cube_in = kmclipm_imagelist_load(file_ref,
@@ -603,6 +628,8 @@ static int kmo_generate_test_data_combine(const char *path)
cpl_imagelist_delete(cube_in); cube_in = NULL;
+ cpl_free(test_global_path_ref_data);
+
return 0;
}
@@ -636,12 +663,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
/* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_copy-test.c b/recipes/tests/kmo_copy-test.c
index 604c0c1..b78a71b 100644
--- a/recipes/tests/kmo_copy-test.c
+++ b/recipes/tests/kmo_copy-test.c
@@ -30,11 +30,34 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_copy/";
@@ -233,13 +256,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_dark-test.c b/recipes/tests/kmo_dark-test.c
index 36f81c0..d314256 100644
--- a/recipes/tests/kmo_dark-test.c
+++ b/recipes/tests/kmo_dark-test.c
@@ -30,14 +30,38 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <math.h>
#include <cpl.h>
+
#include "kmclipm_functions.h"
#include "kmclipm_constants.h"
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_dark/";
@@ -298,12 +322,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_dev_setup-test.c b/recipes/tests/kmo_dev_setup-test.c
index 544e34b..09eea55 100644
--- a/recipes/tests/kmo_dev_setup-test.c
+++ b/recipes/tests/kmo_dev_setup-test.c
@@ -30,14 +30,39 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
+
#include "kmclipm_functions.h"
#include "kmclipm_constants.h"
-#include "kmo_test_create_data.h"
#include "kmo_dfs.h"
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+void kmo_test_create_pipeline_data_core(const char*, const char*);
+
const char *path_recipe = "kmo_dev_setup/";
/**
@@ -68,11 +93,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_extract_spec-test.c b/recipes/tests/kmo_extract_spec-test.c
index 1576943..1eae6a9 100644
--- a/recipes/tests/kmo_extract_spec-test.c
+++ b/recipes/tests/kmo_extract_spec-test.c
@@ -31,15 +31,38 @@
#include <math.h>
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
+
#include "kmclipm_constants.h"
#include "kmclipm_functions.h"
#include "kmclipm_math.h"
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_extract_spec/";
@@ -339,13 +362,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/leak_check-test.c b/recipes/tests/kmo_final-test.c
similarity index 89%
rename from recipes/tests/leak_check-test.c
rename to recipes/tests/kmo_final-test.c
index ff153fb..655b1a0 100644
--- a/recipes/tests/leak_check-test.c
+++ b/recipes/tests/kmo_final-test.c
@@ -30,7 +30,6 @@
#endif
#include <string.h>
-//#include <math.h>
#include <cpl.h>
@@ -53,10 +52,12 @@ int main()
// run bash-script to examine all generated log_*.txt files in
// kmosp/recipes/tests
- ret = system("./leak_check.sh");
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/kmo_final_test.sh", getenv("srcdir"));
+ ret = system(my_path);
+ cpl_free(my_path);
// have to shift by 8 (divide by 256) to get back
- //correct exit status from leak_check.sh
+ //correct exit status from kmo_final_test.sh
ret = ret >> 8;
// test if zero active pointers
diff --git a/recipes/tests/leak_check.sh b/recipes/tests/kmo_final_test.sh
similarity index 100%
rename from recipes/tests/leak_check.sh
rename to recipes/tests/kmo_final_test.sh
diff --git a/recipes/tests/kmo_fit_profile-test.c b/recipes/tests/kmo_fit_profile-test.c
index f6f8247..097c513 100644
--- a/recipes/tests/kmo_fit_profile-test.c
+++ b/recipes/tests/kmo_fit_profile-test.c
@@ -30,13 +30,37 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
+
#include "kmclipm_functions.h"
#include "kmo_priv_fit_profile.h"
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_fit_profile/";
@@ -268,7 +292,8 @@ static int kmo_generate_test_data_fit_profile(const char *path)
sprintf(out_path, "%s%s", path, "stack.sof");
fh = fopen(out_path, "w");
fprintf (fh, "test_data/kmo_fit_profile/moffat1d.fits STACK_DATA\n");
- fprintf (fh, "ref_data/noise1d.fits STACK_NOISE\n");
+ char *my_path = cpl_sprintf("%s/ref_data/noise1d.fits", getenv("srcdir"));
+ fprintf (fh, "%s STACK_NOISE\n", my_path);
fclose(fh);
//
@@ -293,10 +318,11 @@ static int kmo_generate_test_data_fit_profile(const char *path)
sprintf(out_path, "%s%s", path, "stack.sof");
fh = fopen(out_path, "w");
fprintf (fh, "test_data/kmo_fit_profile/moffat1d.fits STACK_DATA\n");
- fprintf (fh, "ref_data/noise1d.fits STACK_NOISE\n");
+ fprintf (fh, "%s STACK_NOISE\n", my_path);
fprintf (fh, "test_data/kmo_fit_profile/moffat1d.fits STACK_DATA\n");
- fprintf (fh, "ref_data/noise1d.fits STACK_NOISE\n");
+ fprintf (fh, "%s STACK_NOISE\n", my_path);
fclose(fh);
+ cpl_free(my_path);
//
// create 1d moffat curve without WCS and with noise
@@ -420,7 +446,9 @@ static int kmo_generate_test_data_fit_profile(const char *path)
sprintf(out_path, "%s%s", path, "stack.sof");
fh = fopen(out_path, "w");
fprintf (fh, "test_data/kmo_fit_profile/gauss2d.fits STACK_DATA\n");
- fprintf (fh, "ref_data/noise2d.fits STACK_NOISE\n");
+ my_path = cpl_sprintf("%s/ref_data/noise2d.fits", getenv("srcdir"));
+ fprintf (fh, "%s STACK_NOISE\n", my_path);
+ cpl_free(my_path);
fclose(fh);
tmpstr = cpl_sprintf("%s", valid_files[7]);
@@ -523,13 +551,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_fits_check-test.c b/recipes/tests/kmo_fits_check-test.c
index 6678dd0..d0275fe 100644
--- a/recipes/tests/kmo_fits_check-test.c
+++ b/recipes/tests/kmo_fits_check-test.c
@@ -30,10 +30,32 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
-#include "kmo_test_create_data.h"
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
/**
@defgroup kmo_fits_check_test kmo_fits_check unit tests
@@ -48,9 +70,10 @@ static void test_fits_check(const char *option, int ret_val)
{
// create esorex-command
char esorex_command[256];
+ char *my_path = cpl_sprintf("%s/../../recipes/tests/ref_data/KMOS_dummy.fits", getenv("srcdir"));
sprintf(esorex_command,
- "esorex --suppress-prefix=TRUE kmo_fits_check %s %s", option,
- " ../../recipes/tests/ref_data/KMOS_dummy.fits");
+ "esorex --suppress-prefix=TRUE kmo_fits_check %s %s", option, my_path);
+ cpl_free(my_path);
kmo_get_pipe_command(esorex_command,
"log_kmo_fits_check.txt", NULL, TRUE);
diff --git a/recipes/tests/kmo_fits_stack-test.c b/recipes/tests/kmo_fits_stack-test.c
index 9783614..3859fd4 100644
--- a/recipes/tests/kmo_fits_stack-test.c
+++ b/recipes/tests/kmo_fits_stack-test.c
@@ -30,13 +30,38 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
+
#include "kmclipm_functions.h"
#include "kmclipm_constants.h"
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+const char* kmo_test_esorex_verbose();
const char *path_recipe = "kmo_fits_stack/";
@@ -189,13 +214,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
@@ -237,6 +255,7 @@ int main(int argc, char *argv[])
cpl_propertylist_delete(prl);
// stack F1S
+ char *test_global_path_ref_data = cpl_sprintf("%s/ref_data/", getenv("srcdir"));
kmo_test_cat_strings(file1, test_global_path_ref_data, valid_files[3]);
test_fits_stack2(file1, F1S, "", "", 0);
@@ -320,6 +339,8 @@ int main(int argc, char *argv[])
test_fits_stack2(file1, F1L, "\"%f;%f\"", "\"A;B\"", 1);
+ cpl_free(test_global_path_ref_data);
+
return cpl_test_end(0);
}
diff --git a/recipes/tests/kmo_fits_strip-test.c b/recipes/tests/kmo_fits_strip-test.c
index 589a279..0f95d78 100644
--- a/recipes/tests/kmo_fits_strip-test.c
+++ b/recipes/tests/kmo_fits_strip-test.c
@@ -30,10 +30,32 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
-#include "kmo_test_create_data.h"
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
/**
@defgroup kmo_fits_strip_test kmo_fits_strip unit tests
@@ -81,7 +103,7 @@ int main()
cpl_test_abs(kmo_test_esorex_data("strip", 1), 26.9946, tol);
test_fits_strip("--empty", "telluric_KKK.fits", 0);
- cpl_test_abs(kmo_test_esorex_data("strip", 1), 11.6164, tol);
+ cpl_test_abs(kmo_test_esorex_data("strip", 1), 5.61881, 0.3);
test_fits_strip("--angle=0", "master_flat_KKK.fits", 0);
cpl_test_abs(kmo_test_esorex_data("strip", 1), 3.00054, tol);
diff --git a/recipes/tests/kmo_flat-test.c b/recipes/tests/kmo_flat-test.c
index f42a759..cfb00e3 100644
--- a/recipes/tests/kmo_flat-test.c
+++ b/recipes/tests/kmo_flat-test.c
@@ -30,14 +30,38 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <math.h>
#include <cpl.h>
+
#include "kmclipm_functions.h"
#include "kmclipm_constants.h"
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_flat/";
@@ -477,13 +501,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_illumination-test.c b/recipes/tests/kmo_illumination-test.c
index 0e107ba..036a545 100644
--- a/recipes/tests/kmo_illumination-test.c
+++ b/recipes/tests/kmo_illumination-test.c
@@ -30,12 +30,36 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
+
#include "kmclipm_functions.h"
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_illumination/";
@@ -74,12 +98,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
- kmo_test_create_pipeline_data();
- }
-
cpl_msg_info(cpl_func, "Testing kmo_illumination with real "
"pipeline data.");
sprintf(test_path, "%s%s", test_global_path_test_data, "pipeline/");
@@ -106,6 +124,7 @@ int main(int argc, char *argv[])
// create sof-file
FILE *fh = fopen(sof_path, "w");
+ char *my_path = cpl_sprintf("%s/ref_data/kmos_wave_band.fits", getenv("srcdir"));
fprintf (fh,
"%s FLAT_SKY\n"
"%s FLAT_SKY\n"
@@ -115,9 +134,10 @@ int main(int argc, char *argv[])
"xcal_KKK.fits XCAL\n"
"ycal_KKK.fits YCAL\n"
"lcal_KKK.fits LCAL\n"
- "ref_data/kmos_wave_band.fits WAVE_BAND\n",
- op1_file, op2_file, op3_file);
+ "%s WAVE_BAND\n",
+ op1_file, op2_file, op3_file, my_path);
fclose(fh);
+ cpl_free(my_path);
// create esorex-command
sprintf(esorex_command,
diff --git a/recipes/tests/kmo_illumination_flat-test.c b/recipes/tests/kmo_illumination_flat-test.c
index 1c9fd03..74a22a1 100644
--- a/recipes/tests/kmo_illumination_flat-test.c
+++ b/recipes/tests/kmo_illumination_flat-test.c
@@ -30,12 +30,36 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
+
#include "kmclipm_functions.h"
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_illumination_flat/";
@@ -74,12 +98,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
- kmo_test_create_pipeline_data();
- }
-
cpl_msg_info(cpl_func, "Testing kmo_illumination_flat with real "
"pipeline data.");
sprintf(test_path, "%s%s", test_global_path_test_data, "pipeline/");
@@ -106,6 +124,7 @@ int main(int argc, char *argv[])
// create sof-file
FILE *fh = fopen(sof_path, "w");
+ char *my_path = cpl_sprintf("%s/ref_data/kmos_wave_band.fits", getenv("srcdir"));
fprintf (fh,
"%s FLAT_SKY_FLAT\n"
"%s FLAT_SKY_FLAT\n"
@@ -113,9 +132,10 @@ int main(int argc, char *argv[])
"xcal_KKK.fits XCAL\n"
"ycal_KKK.fits YCAL\n"
"lcal_KKK.fits LCAL\n"
- "ref_data/kmos_wave_band.fits WAVE_BAND\n",
- op1_file, op2_file, op3_file);
+ "%s WAVE_BAND\n",
+ op1_file, op2_file, op3_file, my_path);
fclose(fh);
+ cpl_free(my_path);
// create esorex-command
sprintf(esorex_command,
@@ -130,7 +150,7 @@ int main(int argc, char *argv[])
// checking output
strcpy(file_path, "illum_corr_KKK");
- cpl_test_abs(kmo_test_esorex_data(file_path, 1), 87.0973, tol);
+ cpl_test_abs(kmo_test_esorex_data(file_path, 1), 24.0035, tol);
strcat(file_path, ".fits");
h = kmclipm_propertylist_load(file_path, 0);
diff --git a/recipes/tests/kmo_init-test.c b/recipes/tests/kmo_init-test.c
new file mode 100644
index 0000000..0099925
--- /dev/null
+++ b/recipes/tests/kmo_init-test.c
@@ -0,0 +1,39 @@
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <cpl.h>
+
+const char *test_global_path_test_data;
+int kmo_test_file_exists(const char*);
+void kmo_test_create_pipeline_data_core(const char*, const char*);
+
+char *pipeline_test_path = "pipeline/";
+
+/**
+ @brief Do init for recipe-tests
+ @param argc the number of parameters
+ @param argv the parameter list
+ */
+int main(int argc, char *argv[])
+{
+ char path[1024];
+ if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
+ mkdir(test_global_path_test_data, 0777);
+ }
+
+ strcpy(path, test_global_path_test_data);
+ strcat(path, pipeline_test_path);
+
+ if (kmo_test_file_exists(path) == FALSE) {
+ mkdir(path, 0777);
+ kmo_test_create_pipeline_data_core(pipeline_test_path,
+ "log_generate_pipeline_data.txt");
+ }
+
+ cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
+
+ if ((argc == 5) && (strcmp(argv[1], "xxx") != 0)) { }
+
+ return cpl_test_end(0);
+}
diff --git a/recipes/tests/kmo_make_image-test.c b/recipes/tests/kmo_make_image-test.c
index 979fc14..f79037f 100644
--- a/recipes/tests/kmo_make_image-test.c
+++ b/recipes/tests/kmo_make_image-test.c
@@ -30,11 +30,34 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_make_image/";
@@ -248,13 +271,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
@@ -279,8 +295,10 @@ int main(int argc, char *argv[])
fclose(fd);
FILE *fh = fopen(sof_path, "w");
+ char *test_global_path_ref_data = cpl_sprintf("%s/ref_data/", getenv("srcdir"));
fprintf (fh, "%s%s STACK_DATA\n", test_global_path_ref_data, valid_files[5]);
fclose(fh);
+ cpl_free(test_global_path_ref_data);
sprintf(esorex_command,
"esorex --suppress-prefix=TRUE kmo_fits_stack -type=F1S "
diff --git a/recipes/tests/kmo_multi_reconstruct-test.c b/recipes/tests/kmo_multi_reconstruct-test.c
index 99cf021..7ab9e8f 100644
--- a/recipes/tests/kmo_multi_reconstruct-test.c
+++ b/recipes/tests/kmo_multi_reconstruct-test.c
@@ -30,14 +30,38 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <math.h>
#include <cpl.h>
+
#include "kmclipm_functions.h"
-#include "kmo_test_create_data.h"
#include "kmo_dfs.h"
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+
const char *path_recipe = "kmo_multi_reconstruct/";
const char *valid_files[] = {"science_obj_123.fits",
@@ -58,6 +82,7 @@ static void test_multi_reconstruct(const char *path1, const char *path2, int ret
// create sof-file
const char *sof_path = "test_multi_reconstruct.sof";
FILE *fh = fopen(sof_path, "w");
+ char *my_path = cpl_sprintf("%s/ref_data/%s", getenv("srcdir"), valid_files[2]);
fprintf (fh,
"%s SCIENCE\n"
"%s SCIENCE\n"
@@ -65,9 +90,10 @@ static void test_multi_reconstruct(const char *path1, const char *path2, int ret
"xcal_KKK.fits XCAL\n"
"ycal_KKK.fits YCAL\n"
"lcal_KKK.fits LCAL\n"
- "ref_data/%s WAVE_BAND\n",
- path1, path2, valid_files[2]);
+ "%s WAVE_BAND\n",
+ path1, path2, my_path);
fclose(fh);
+ cpl_free(my_path);
// create esorex-command
char esorex_command[256];
@@ -108,13 +134,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_noise_map-test.c b/recipes/tests/kmo_noise_map-test.c
index 1122ffa..6ca5efc 100644
--- a/recipes/tests/kmo_noise_map-test.c
+++ b/recipes/tests/kmo_noise_map-test.c
@@ -30,13 +30,36 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
+
#include "kmclipm_constants.h"
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_noise_map/";
@@ -148,13 +171,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_reconstruct-test.c b/recipes/tests/kmo_reconstruct-test.c
index c12cf5a..9c4bb78 100644
--- a/recipes/tests/kmo_reconstruct-test.c
+++ b/recipes/tests/kmo_reconstruct-test.c
@@ -30,11 +30,33 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <math.h>
#include <cpl.h>
-#include "kmo_test_create_data.h"
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_reconstruct/";
@@ -57,14 +79,16 @@ test_reconstruct(const char *file_path,
// create sof-file
const char *sof_path = "test_reconstruct.sof";
FILE *fh = fopen(sof_path, "w");
+ char *my_path = cpl_sprintf("%s/ref_data/%s", getenv("srcdir"), valid_files[1]);
fprintf (fh,
"%s ARC_ON\n"
"xcal_KKK.fits XCAL\n"
"ycal_KKK.fits YCAL\n"
"lcal_KKK.fits LCAL\n"
- "ref_data/%s WAVE_BAND\n",
- file_path, valid_files[1]);
+ "%s WAVE_BAND\n",
+ file_path, my_path);
fclose(fh);
+ cpl_free(my_path);
// create esorex-command
char esorex_command[256];
@@ -104,13 +128,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_rotate-test.c b/recipes/tests/kmo_rotate-test.c
index 78b9716..d380300 100644
--- a/recipes/tests/kmo_rotate-test.c
+++ b/recipes/tests/kmo_rotate-test.c
@@ -30,13 +30,37 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
+
#include "kmclipm_functions.h"
#include "kmclipm_constants.h"
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_rotate/";
@@ -90,6 +114,7 @@ static int kmo_generate_test_data_rotate(const char *path)
name2[256],
cmd[256];
+ char *test_global_path_ref_data = cpl_sprintf("%s/ref_data/", getenv("srcdir"));
kmo_test_cat_strings(file_ref, test_global_path_ref_data, "ref_cube_arc.fits");
cpl_imagelist *cube_in = kmclipm_imagelist_load(file_ref,
@@ -213,6 +238,8 @@ static int kmo_generate_test_data_rotate(const char *path)
cpl_propertylist_delete(pl); pl = NULL;
+ cpl_free(test_global_path_ref_data);
+
return 0;
}
@@ -290,13 +317,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_sci_red-test.c b/recipes/tests/kmo_sci_red-test.c
index cc87e0b..3a8fd0e 100644
--- a/recipes/tests/kmo_sci_red-test.c
+++ b/recipes/tests/kmo_sci_red-test.c
@@ -30,14 +30,38 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <math.h>
#include <cpl.h>
+
#include "kmclipm_functions.h"
-#include "kmo_test_create_data.h"
#include "kmo_dfs.h"
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+
const char *path_recipe = "kmo_sci_red/";
const char *valid_files[] = {"science_obj_123.fits",
@@ -58,6 +82,7 @@ static void test_sci_red(const char *path1, const char *path2, int ret_val)
// create sof-file
const char *sof_path = "test_sci_red.sof";
FILE *fh = fopen(sof_path, "w");
+ char *my_path = cpl_sprintf("%s/ref_data/%s", getenv("srcdir"), valid_files[2]);
fprintf (fh,
"%s SCIENCE\n"
"%s SCIENCE\n"
@@ -67,9 +92,10 @@ static void test_sci_red(const char *path1, const char *path2, int ret_val)
"master_flat_KKK.fits MASTER_FLAT\n"
"illum_corr_KKK.fits ILLUM_CORR\n"
"telluric_KKK.fits TELLURIC\n"
- "ref_data/%s WAVE_BAND\n",
- path1, path2, valid_files[2]);
+ "%s WAVE_BAND\n",
+ path1, path2, my_path);
fclose(fh);
+ cpl_free(my_path);
// create esorex-command
char esorex_command[256];
@@ -110,13 +136,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_shift-test.c b/recipes/tests/kmo_shift-test.c
index 8b04e48..c14b421 100644
--- a/recipes/tests/kmo_shift-test.c
+++ b/recipes/tests/kmo_shift-test.c
@@ -30,13 +30,37 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
+
#include "kmclipm_functions.h"
#include "kmclipm_constants.h"
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_shift/";
@@ -91,6 +115,7 @@ static int kmo_generate_test_data_shift(const char *path)
name2[256],
cmd[256];
+ char *test_global_path_ref_data = cpl_sprintf("%s/ref_data/", getenv("srcdir"));
kmo_test_cat_strings(file_ref, test_global_path_ref_data, "ref_cube_arc.fits");
cpl_imagelist *cube_in = kmclipm_imagelist_load(file_ref,
@@ -214,6 +239,8 @@ static int kmo_generate_test_data_shift(const char *path)
cpl_propertylist_delete(pl); pl = NULL;
+ cpl_free(test_global_path_ref_data);
+
return 0;
}
@@ -291,13 +318,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_sky_mask-test.c b/recipes/tests/kmo_sky_mask-test.c
index 6d92201..8521392 100644
--- a/recipes/tests/kmo_sky_mask-test.c
+++ b/recipes/tests/kmo_sky_mask-test.c
@@ -30,11 +30,34 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
double scalar = 6.7;
int ifu_nr = 4;
@@ -171,13 +194,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_stats-test.c b/recipes/tests/kmo_stats-test.c
index f07178e..9a73336 100644
--- a/recipes/tests/kmo_stats-test.c
+++ b/recipes/tests/kmo_stats-test.c
@@ -30,11 +30,34 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <cpl.h>
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
double scalar = 6.7;
int ifu_nr = 4;
@@ -288,13 +311,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/recipes/tests/kmo_std_star-test.c b/recipes/tests/kmo_std_star-test.c
index ea35f93..b403fe3 100644
--- a/recipes/tests/kmo_std_star-test.c
+++ b/recipes/tests/kmo_std_star-test.c
@@ -30,14 +30,38 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <math.h>
#include <cpl.h>
+
#include "kmclipm_functions.h"
-#include "kmo_test_create_data.h"
#include "kmo_dfs.h"
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+
const char *path_recipe = "kmo_std_star/";
const char *valid_files[] = {"std_obj_123.fits",
@@ -63,6 +87,7 @@ static void test_std_star(const char *star_path, const char *sky_path,
// create sof-file
const char *sof_path = "test_std_star.sof";
FILE *fh = fopen(sof_path, "w");
+ char *my_path = cpl_sprintf("%s/ref_data", getenv("srcdir"));
fprintf (fh,
"%s STD\n"
"%s STD\n"
@@ -71,21 +96,22 @@ static void test_std_star(const char *star_path, const char *sky_path,
"lcal_KKK.fits LCAL\n"
"master_flat_KKK.fits MASTER_FLAT\n"
"illum_corr_KKK.fits ILLUM_CORR\n"
- "ref_data/%s WAVE_BAND\n",
- star_path, sky_path, valid_files[5]);
+ "%s/%s WAVE_BAND\n",
+ star_path, sky_path, my_path, valid_files[5]);
if (solar_path != NULL) {
fprintf(fh,
- "ref_data/%s SOLAR_SPEC\n", solar_path);
+ "%s/%s SOLAR_SPEC\n", my_path, solar_path);
}
if (atmos_path != NULL) {
fprintf(fh,
- "ref_data/%s ATMOS_MODEL\n", atmos_path);
+ "%s/%s ATMOS_MODEL\n", my_path, atmos_path);
}
if (spec_path != NULL) {
fprintf(fh,
- "ref_data/%s SPEC_TYPE_LOOKUP\n", spec_path);
+ "%s/%s SPEC_TYPE_LOOKUP\n", my_path, spec_path);
}
fclose(fh);
+ cpl_free(my_path);
// create esorex-command
char esorex_command[256];
@@ -131,13 +157,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
@@ -196,7 +215,7 @@ int main(int argc, char *argv[])
// check telluric_KKK.fits
strcpy(file_path, "telluric_KKK");
- cpl_test_abs(kmo_test_esorex_data(file_path, 1), 11.6164, .3);
+ cpl_test_abs(kmo_test_esorex_data(file_path, 1), 5.61881, .3);
strcat(file_path, ".fits");
h = kmclipm_propertylist_load(file_path, 0);
@@ -221,7 +240,7 @@ int main(int argc, char *argv[])
// check star_spec_KKK.fits
strcpy(file_path, "star_spec_KKK");
- cpl_test_abs(kmo_test_esorex_data(file_path, 1), 247348, tol*4e6);
+ cpl_test_abs(kmo_test_esorex_data(file_path, 1), 2.10111e6, tol*4e6);
strcat(file_path, ".fits");
h = kmclipm_propertylist_load(file_path, 0);
diff --git a/recipes/tests/kmo_wave_cal-test.c b/recipes/tests/kmo_wave_cal-test.c
index cf090bf..d16e8c8 100644
--- a/recipes/tests/kmo_wave_cal-test.c
+++ b/recipes/tests/kmo_wave_cal-test.c
@@ -30,13 +30,37 @@
#endif
#include <string.h>
+#include <sys/stat.h>
#include <math.h>
#include <cpl.h>
+
#include "kmclipm_functions.h"
#include "kmo_dfs.h"
-#include "kmo_test_create_data.h"
+
+const char *test_global_path_test_data;
+float test_global_seed_data, test_global_seed_noise;
+int test_global_size_x, test_global_size_y, test_global_size_z, test_global_nr_frames;
+void kmo_get_pipe_command(char*, const char*, const char*, int);
+int kmo_test_file_exists(const char*);
+void kmo_test_verbose_off();
+void kmo_test_verbose_on();
+double kmo_test_esorex_data(const char*, int);
+const char* kmo_test_cat_strings(char*, const char*, const char*);
+int kmo_test_create_RAW_data(int, int, const char*, char**, char**, int*, int, char**, char**, int*, int, float, float);
+int kmo_test_create_RAW_data_zero(int, int, const char*);
+int kmo_test_create_F2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2D_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F2I_data_noise(int, int, int, const char*, char *, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_infinite(int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data2(int, int, int, int, int*, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F3I_data_noise(int, int, int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_F1I_data_noise(int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
+int kmo_test_create_B2D_data(int, int, int, const char*, char*, char*, int*, int, char**, char**, int*, int);
const char *path_recipe = "kmo_wave_cal/";
@@ -63,6 +87,7 @@ static void test_wave_cal(const char *path_op_on1,
// create sof-file
const char *sof_path = "test_wave_cal.sof";
FILE *fh = fopen(sof_path, "w");
+ char *my_path = cpl_sprintf("%s/ref_data", getenv("srcdir"));
fprintf (fh,
"%s ARC_ON\n"
"%s ARC_OFF\n"
@@ -71,12 +96,13 @@ static void test_wave_cal(const char *path_op_on1,
"ycal_KKK.fits YCAL\n"
"flat_edge_KKK.fits FLAT_EDGE\n"
"master_flat_KKK.fits MASTER_FLAT\n"
- "ref_data/%s ARC_LIST\n"
- "ref_data/%s REF_LINES\n"
- "ref_data/%s WAVE_BAND\n",
+ "%s/%s ARC_LIST\n"
+ "%s/%s REF_LINES\n"
+ "%s/%s WAVE_BAND\n",
path_op_on1, path_op_off1,
- valid_files[3], valid_files[4], valid_files[5]);
+ my_path, valid_files[3], my_path, valid_files[4], my_path, valid_files[5]);
fclose(fh);
+ cpl_free(my_path);
// create esorex-command
char esorex_command[256];
@@ -121,13 +147,6 @@ int main(int argc, char *argv[])
cpl_test_init("<kmos-spark at mpe.mpg.de>", CPL_MSG_WARNING);
- /* ----- check if test data exists ----- */
- if (kmo_test_file_exists(test_global_path_test_data) == FALSE) {
- mkdir(test_global_path_test_data, 0777);
-
- kmo_test_create_pipeline_data();
- }
-
strcpy(test_path, test_global_path_test_data);
strcat(test_path, path_recipe);
diff --git a/reflex/Makefile.in b/reflex/Makefile.in
index d29fb04..78f855e 100644
--- a/reflex/Makefile.in
+++ b/reflex/Makefile.in
@@ -140,6 +140,7 @@ LIBCPLDFS = @LIBCPLDFS@
LIBCPLDRS = @LIBCPLDRS@
LIBCPLUI = @LIBCPLUI@
LIBIRPLIB = @LIBIRPLIB@
+LIBKMCLIPMLIB = @LIBKMCLIPMLIB@
LIBKMOS = @LIBKMOS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
diff --git a/reflex/kmos.xml.in b/reflex/kmos.xml.in
index 4359765..8417d1c 100644
--- a/reflex/kmos.xml.in
+++ b/reflex/kmos.xml.in
@@ -2,7 +2,7 @@
<!DOCTYPE entity PUBLIC "-//UC Berkeley//DTD MoML 1//EN"
"http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd">
<entity name="kmos" class="org.kepler.moml.CompositeClassEntity">
- <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:46342:8:182">
+ <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:46842:4:12">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="org.kepler.moml.CompositeClassEntity">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="null">
@@ -1548,7 +1548,7 @@
<property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:436:1:urn:lsid:kepler-project.org/ns/:21155:114:1">
</property>
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:436:1:urn:lsid:kepler-project.org/ns/:12776:4:415:urn:lsid:kepler-project.org/ns/:12776:55:75:urn:lsid:kepler-project.org/ns/:12776:59:142:urn:lsid:kepler-project.org/ns/:12776:68:228:urn:lsid:kepler-project.org/ns/:12776:84:51:urn:lsid:kepler-project.org/ns/:2745:31:9:urn:lsid:kepler-project.org/ns/:2745:32:214:urn:lsid:kepler-project.org/ns/:2745:45:122:urn:lsid:kepl [...]
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:436:1:urn:lsid:kepler-project.org/ns/:12776:4:415:urn:lsid:kepler-project.org/ns/:12776:55:75:urn:lsid:kepler-project.org/ns/:12776:59:142:urn:lsid:kepler-project.org/ns/:12776:68:228:urn:lsid:kepler-project.org/ns/:12776:84:51:urn:lsid:kepler-project.org/ns/:2745:31:9:urn:lsid:kepler-project.org/ns/:2745:32:214:urn:lsid:kepler-project.org/ns/:2745:45:122:urn:lsid:kepl [...]
</property>
<property name="CALIB_DATA_DIR" class="ptolemy.data.expr.FileParameter" value="CALIB_DATA_PATH_TO_REPLACE/kmos- at VERSION@/">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
@@ -2292,6 +2292,91 @@
<property name="_renderFirst" class="ptolemy.kernel.util.SingletonAttribute">
</property>
</property>
+ <property name="Annotation8" class="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="_hideName" class="ptolemy.data.expr.SingletonParameter" value="true">
+ </property>
+ <property name="_hideAllParameters" class="ptolemy.data.expr.Parameter" value="true">
+ </property>
+ <property name="textSize" class="ptolemy.data.expr.Parameter" value="14">
+ </property>
+ <property name="textColor" class="ptolemy.actor.gui.ColorAttribute" value="{0.4,0.4,0.0,1.0}">
+ </property>
+ <property name="fontFamily" class="ptolemy.data.expr.StringParameter" value="SansSerif">
+ </property>
+ <property name="bold" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="italic" class="ptolemy.data.expr.Parameter" value="false">
+ </property>
+ <property name="text" class="ptolemy.kernel.util.StringAttribute" value="Global Interactivity control Point">
+ <property name="_style" class="ptolemy.actor.gui.style.TextStyle">
+ <property name="height" class="ptolemy.data.expr.Parameter" value="20">
+ </property>
+ <property name="width" class="ptolemy.data.expr.Parameter" value="80">
+ </property>
+ </property>
+ </property>
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Use the Annotation attribute to annotate a workflow. Double-click the attribute to customize the content, font size, color, and basic formatting (bold and italics).</configure></property>
+<property name="prop:fontFamily" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font face. Select a font from the drop-down menu. The default is "SansSerif".</configure></property>
+<property name="prop:italic" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be italics. By default, type will not be italicized.</configure></property>
+<property name="prop:bold" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Select to indicate that the type should be bold. By default, type will not be bold.</configure></property>
+<property name="prop:textColor" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font color. Specify a string representing an array of four elements: red, green, blue, and alpha, where alpha is transparency. The default is an opaque black, {0.0, 0.0, 0.0, 1.0}</configure></property>
+<property name="prop:textSize" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The font size. Select an integer from the drop-down menu or specify a new size by typing it directly into the value field. The default is 14.</configure></property>
+<property name="prop:text" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>The text of the annotation.</configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:46842:6:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.vergil.kernel.attributes.TextAttribute">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1199:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#DocumentationActor">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#WorkflowDocumentation">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[785.0, 410.0]">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:436:1:urn:lsid:kepler-project.org/ns/:43289:29:1">
+ </property>
+ </property>
+ <property name="GlobalPlotInteractivity" class="ptolemy.data.expr.StringParameter" value="True">
+<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
+<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
+<property name="version" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
+<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>StringParameter specifies a persistent string. </p>
<p>Change the name of the StringParameter to better identify the specified value (right-click the parameter and select "Customize Name" from the menu). Other actors may refer to the StringParameter using the $NAME syntax (e.g. $Parameter).
</p></configure></property>
+</property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:46842:5:1">
+ </property>
+ <property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.data.expr.StringParameter">
+ <property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:1185:1">
+ </property>
+ </property>
+ <property name="semanticType00" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:1:1#Parameter">
+ </property>
+ <property name="semanticType11" class="org.kepler.sms.SemanticType" value="urn:lsid:localhost:onto:2:1#Parameter">
+ </property>
+ <property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute">
+ </property>
+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{1.0, 0.0, 0.0, 1.0}">
+ </property>
+ </property>
+ <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
+ <configure>
+ <svg>
+ <text x="20" style="font-size:14; font-family:SansSerif; fill:red" y="20">-S-</text>
+ </svg>
+ </configure>
+ </property>
+ <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
+ </property>
+ <property name="_location" class="ptolemy.kernel.util.Location" value="[745.0, 400.0]">
+ </property>
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:421:1">
+ </property>
+ </property>
<entity name="FitsRouter" class="org.eso.FitsRouter">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
@@ -3102,7 +3187,7 @@
<entity name="WAVE_CAL" class="ptolemy.actor.TypedCompositeActor">
<property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="8.1.devel">
</property>
- <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:46309:10:2">
+ <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:kepler-project.org/ns/:46842:7:1">
</property>
<property name="class" class="ptolemy.kernel.util.StringAttribute" value="ptolemy.actor.TypedCompositeActor">
<property name="id" class="ptolemy.kernel.util.StringAttribute" value="urn:lsid:kepler-project.org:class:449:1">
@@ -3121,9 +3206,9 @@
<property name="userLevelDocumentation" class="ptolemy.kernel.util.ConfigurableAttribute"><configure><p>A Composite actor is an aggregation of actors. It may have a local director that is responsible for executing the contained actors. A Composite actor with a local director is called an opaque actor. Composite actors do not require a local director. Composite actors with no local director "inherit" the director from the containing workflow and are called non-opaque.</ [...]
</property> <property name="_location" class="ptolemy.kernel.util.Location" value="[215.0, 850.0]">
</property>
- <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:15314:197:41:urn:lsid:kepler-project.org/ns/:21155:64:67:urn:lsid:kepler-project.org/ns/:29452:30:11:urn:lsid:kepler-project.org/ns/:21155:427:153:urn:lsid:kepler-project.org/ns/:43289:40:241">
+ <property name="derivedFrom" class="org.kepler.moml.NamedObjIdReferralList" value="urn:lsid:kepler-project.org:actor:449:1:urn:lsid:kepler-project.org/ns/:15314:197:41:urn:lsid:kepler-project.org/ns/:21155:64:67:urn:lsid:kepler-project.org/ns/:29452:30:11:urn:lsid:kepler-project.org/ns/:21155:427:153:urn:lsid:kepler-project.org/ns/:43289:40:241:urn:lsid:kepler-project.org/ns/:46309:10:2">
</property>
- <property name="EnableInteractivity" class="ptolemy.data.expr.StringParameter" value="true">
+ <property name="EnableInteractivity" class="ptolemy.data.expr.StringParameter" value="$GlobalPlotInteractivity">
<property name="KeplerDocumentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute">
<property name="description" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>null</configure></property>
<property name="author" class="ptolemy.kernel.util.ConfigurableAttribute"><configure>Edward A. Lee</configure></property>
@@ -4788,6 +4873,8 @@
</property>
</relation>
<relation name="relation7" class="ptolemy.actor.TypedIORelation">
+ <property name="width" class="ptolemy.data.expr.Parameter" value="1">
+ </property>
</relation>
<link port="raw_data_dir" relation="relation7"/>
<link port="Variable Setter.input" relation="relation3"/>
diff --git a/regtests/Makefile.in b/regtests/Makefile.in
index 3b423b6..1262b30 100644
--- a/regtests/Makefile.in
+++ b/regtests/Makefile.in
@@ -149,6 +149,7 @@ LIBCPLDFS = @LIBCPLDFS@
LIBCPLDRS = @LIBCPLDRS@
LIBCPLUI = @LIBCPLUI@
LIBIRPLIB = @LIBIRPLIB@
+LIBKMCLIPMLIB = @LIBKMCLIPMLIB@
LIBKMOS = @LIBKMOS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
diff --git a/regtests/tests/Makefile.in b/regtests/tests/Makefile.in
index 01965a3..25c30f3 100644
--- a/regtests/tests/Makefile.in
+++ b/regtests/tests/Makefile.in
@@ -109,6 +109,7 @@ LIBCPLDFS = @LIBCPLDFS@
LIBCPLDRS = @LIBCPLDRS@
LIBCPLUI = @LIBCPLUI@
LIBIRPLIB = @LIBIRPLIB@
+LIBKMCLIPMLIB = @LIBKMCLIPMLIB@
LIBKMOS = @LIBKMOS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
diff --git a/tools/easySPARK/Makefile b/tools/easySPARK/Makefile
index 0b9aede..2563aa0 100644
--- a/tools/easySPARK/Makefile
+++ b/tools/easySPARK/Makefile
@@ -86,16 +86,16 @@ SCRIPTS = $(dist_bin_SCRIPTS)
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = ${SHELL} /home/yjung/tmp/kmos-1_2_6/kmosp/admin/missing --run aclocal-1.11
+ACLOCAL = ${SHELL} /home/yjung/tmp/kmos-1_2_8/kmosp/admin/missing --run aclocal-1.11
AMTAR = $${TAR-tar}
AR = ar
-AUTOCONF = ${SHELL} /home/yjung/tmp/kmos-1_2_6/kmosp/admin/missing --run autoconf
-AUTOHEADER = ${SHELL} /home/yjung/tmp/kmos-1_2_6/kmosp/admin/missing --run autoheader
-AUTOMAKE = ${SHELL} /home/yjung/tmp/kmos-1_2_6/kmosp/admin/missing --run automake-1.11
+AUTOCONF = ${SHELL} /home/yjung/tmp/kmos-1_2_8/kmosp/admin/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/yjung/tmp/kmos-1_2_8/kmosp/admin/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/yjung/tmp/kmos-1_2_8/kmosp/admin/missing --run automake-1.11
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
-CFLAGS = -g3 -ggdb -O0 -rdynamic -Wall -W -fno-builtin
+CFLAGS = -g -O2 -fno-builtin
CPL_INCLUDES = -I/home_eso/yjung/install/dfs_ga016532/include -I/home_eso/yjung/install/dfs_ga016532/include
CPL_LDFLAGS = -L/home_eso/yjung/install/dfs_ga016532/lib -L/home_eso/yjung/install/dfs_ga016532/lib
CPP = gcc -E
@@ -113,7 +113,7 @@ ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /bin/grep -E
-ESO_DEBUG_FLAGS = -DESO_ENABLE_DEBUG
+ESO_DEBUG_FLAGS = -DNDEBUG
EXEEXT =
FGREP = /bin/grep -F
GREP = /bin/grep
@@ -122,15 +122,15 @@ INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
-KMOS_BINARY_AGE = 206
-KMOS_BINARY_VERSION = 10206
-KMOS_INCLUDES = -I$(top_srcdir)/kmos -I$(top_srcdir)/irplib -I$(top_srcdir)/kmclipm
+KMOS_BINARY_AGE = 208
+KMOS_BINARY_VERSION = 10208
+KMOS_INCLUDES = -I$(top_srcdir)/kmos -I$(top_srcdir)/irplib -I$(top_srcdir)/kmclipm/include
KMOS_INTERFACE_AGE = 0
-KMOS_LDFLAGS = -L$(top_builddir)/kmos
+KMOS_LDFLAGS = -L$(top_srcdir)/kmos
KMOS_MAJOR_VERSION = 1
-KMOS_MICRO_VERSION = 6
+KMOS_MICRO_VERSION = 8
KMOS_MINOR_VERSION = 2
-KMOS_VERSION = 1.2.6
+KMOS_VERSION = 1.2.8
LATEX = /usr/bin/latex
LD = /usr/bin/ld -m elf_x86_64
LDFLAGS =
@@ -140,7 +140,8 @@ LIBCPLDFS = -lcpldfs
LIBCPLDRS = -lcpldrs
LIBCPLUI = -lcplui
LIBIRPLIB = $(top_builddir)/irplib/libirplib.la
-LIBKMOS = $(top_srcdir)/kmos/libkmos.la
+LIBKMCLIPMLIB = $(top_builddir)/kmclipm/libkmclipmlib.la
+LIBKMOS = $(top_builddir)/kmos/libkmos.la
LIBOBJS =
LIBS = -lm -lnsl
LIBTOOL = $(SHELL) $(top_builddir)/libtool
@@ -152,7 +153,7 @@ LT_AGE = 0
LT_CURRENT = 0
LT_REVISION = 0
MAINT =
-MAKEINFO = ${SHELL} /home/yjung/tmp/kmos-1_2_6/kmosp/admin/missing --run makeinfo
+MAKEINFO = ${SHELL} /home/yjung/tmp/kmos-1_2_8/kmosp/admin/missing --run makeinfo
MANIFEST_TOOL = :
MKDIR_P = /bin/mkdir -p
NM = /usr/bin/nm -B
@@ -164,10 +165,10 @@ OTOOL64 =
PACKAGE = kmos
PACKAGE_BUGREPORT = kmos-spark at mpe.mpg.de
PACKAGE_NAME = KMOS Instrument Pipeline
-PACKAGE_STRING = KMOS Instrument Pipeline 1.2.6
+PACKAGE_STRING = KMOS Instrument Pipeline 1.2.8
PACKAGE_TARNAME = kmos
PACKAGE_URL =
-PACKAGE_VERSION = 1.2.6
+PACKAGE_VERSION = 1.2.8
PATH_SEPARATOR = :
PURIFY_CMD = NONE
RANLIB = ranlib
@@ -175,16 +176,16 @@ SED = /bin/sed
SET_MAKE =
SHELL = /bin/bash
STRIP = strip
-VERSION = 1.2.6
-abs_builddir = /home/yjung/tmp/kmos-1_2_6/kmosp/tools/easySPARK
-abs_srcdir = /home/yjung/tmp/kmos-1_2_6/kmosp/tools/easySPARK
-abs_top_builddir = /home/yjung/tmp/kmos-1_2_6/kmosp
-abs_top_srcdir = /home/yjung/tmp/kmos-1_2_6/kmosp
+VERSION = 1.2.8
+abs_builddir = /home/yjung/tmp/kmos-1_2_8/kmosp/tools/easySPARK
+abs_srcdir = /home/yjung/tmp/kmos-1_2_8/kmosp/tools/easySPARK
+abs_top_builddir = /home/yjung/tmp/kmos-1_2_8/kmosp
+abs_top_srcdir = /home/yjung/tmp/kmos-1_2_8/kmosp
ac_ct_AR = ar
ac_ct_CC = gcc
ac_ct_DUMPBIN =
-all_includes = $(KMOS_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES) $(XXCLIPM_INCLUDES)
-all_ldflags = $(KMOS_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS) $(XXCLIPM_LDFLAGS)
+all_includes = $(KMOS_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES)
+all_ldflags = $(KMOS_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS)
am__include = include
am__leading_dot = .
am__quote =
@@ -212,7 +213,7 @@ host_vendor = unknown
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
-install_sh = ${SHELL} /home/yjung/tmp/kmos-1_2_6/kmosp/admin/install-sh
+install_sh = ${SHELL} /home/yjung/tmp/kmos-1_2_8/kmosp/admin/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
@@ -248,6 +249,7 @@ dist_bin_SCRIPTS = easySPARK_calibration.sh \
easySPARK_dark.sh \
easySPARK_flat.sh \
easySPARK_illumination.sh \
+ easySPARK_illumination_flat.sh \
easySPARK_reconstruct.sh \
easySPARK_multi_reconstruct.sh \
easySPARK_sci_red.sh \
diff --git a/tools/easySPARK/Makefile.am b/tools/easySPARK/Makefile.am
index 90a9b54..622c237 100644
--- a/tools/easySPARK/Makefile.am
+++ b/tools/easySPARK/Makefile.am
@@ -31,6 +31,7 @@ dist_bin_SCRIPTS = easySPARK_calibration.sh \
easySPARK_dark.sh \
easySPARK_flat.sh \
easySPARK_illumination.sh \
+ easySPARK_illumination_flat.sh \
easySPARK_reconstruct.sh \
easySPARK_multi_reconstruct.sh \
easySPARK_sci_red.sh \
diff --git a/tools/easySPARK/Makefile.in b/tools/easySPARK/Makefile.in
index 20ca740..cf2aac9 100644
--- a/tools/easySPARK/Makefile.in
+++ b/tools/easySPARK/Makefile.in
@@ -140,6 +140,7 @@ LIBCPLDFS = @LIBCPLDFS@
LIBCPLDRS = @LIBCPLDRS@
LIBCPLUI = @LIBCPLUI@
LIBIRPLIB = @LIBIRPLIB@
+LIBKMCLIPMLIB = @LIBKMCLIPMLIB@
LIBKMOS = @LIBKMOS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@@ -248,6 +249,7 @@ dist_bin_SCRIPTS = easySPARK_calibration.sh \
easySPARK_dark.sh \
easySPARK_flat.sh \
easySPARK_illumination.sh \
+ easySPARK_illumination_flat.sh \
easySPARK_reconstruct.sh \
easySPARK_multi_reconstruct.sh \
easySPARK_sci_red.sh \
diff --git a/tools/easySPARK/easySPARK_calibration.sh b/tools/easySPARK/easySPARK_calibration.sh
index fdd6d30..7534f26 100755
--- a/tools/easySPARK/easySPARK_calibration.sh
+++ b/tools/easySPARK/easySPARK_calibration.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-EASY_VERSION="1.0"
+EASY_VERSION="1.1"
bb=`tput bold`
nn=`tput sgr0`
diff --git a/tools/easySPARK/easySPARK_dark.sh b/tools/easySPARK/easySPARK_dark.sh
index 491ef4e..e5e32f1 100755
--- a/tools/easySPARK/easySPARK_dark.sh
+++ b/tools/easySPARK/easySPARK_dark.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-EASY_VERSION="1.0"
+EASY_VERSION="1.1"
bb=`tput bold`
nn=`tput sgr0`
diff --git a/tools/easySPARK/easySPARK_flat.sh b/tools/easySPARK/easySPARK_flat.sh
index 2b265c0..03fed1e 100755
--- a/tools/easySPARK/easySPARK_flat.sh
+++ b/tools/easySPARK/easySPARK_flat.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-EASY_VERSION="1.0"
+EASY_VERSION="1.1"
bb=`tput bold`
nn=`tput sgr0`
diff --git a/tools/easySPARK/easySPARK_illumination.sh b/tools/easySPARK/easySPARK_illumination.sh
index 3ae3051..3c224b1 100755
--- a/tools/easySPARK/easySPARK_illumination.sh
+++ b/tools/easySPARK/easySPARK_illumination.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-EASY_VERSION="1.0"
+EASY_VERSION="1.1"
bb=`tput bold`
nn=`tput sgr0`
diff --git a/tools/easySPARK/easySPARK_illumination.sh b/tools/easySPARK/easySPARK_illumination_flat.sh
similarity index 64%
copy from tools/easySPARK/easySPARK_illumination.sh
copy to tools/easySPARK/easySPARK_illumination_flat.sh
index 3ae3051..d584550 100755
--- a/tools/easySPARK/easySPARK_illumination.sh
+++ b/tools/easySPARK/easySPARK_illumination_flat.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-EASY_VERSION="1.0"
+EASY_VERSION="1.1"
bb=`tput bold`
nn=`tput sgr0`
@@ -8,27 +8,24 @@ nn=`tput sgr0`
# help
if [ $# -eq 0 ]; then
echo "${bb}-------------------------------------------------------------------${nn}"
- echo "${bb}Creates sof-file for kmo_illumination-recipe and executes it.${nn}"
+ echo "${bb}Creates sof-file for kmo_illumination_flat-recipe and executes it.${nn}"
echo " "
echo "- The environment variable ${bb}KMOS_CALIB${nn} pointing to a path has to be"
echo " set in order to find the needed static calibration frame WAVE_BAND."
echo " Otherwise the execution of this script will fail!"
- echo "- If XCAL, YCAL, LCAL, MASTER_DARK and MASTER_FLAT frames aren't existing"
- echo " in the working directory the script is searching as well KMOS_CALIB in"
- echo " order to find them."
+ echo "- If XCAL, YCAL and LCAL frames aren't existing in the working directory"
+ echo " the script is searching as well KMOS_CALIB in order to find them."
echo "- As argument an arbitrary exposure of an executed "
- echo " ${bb}KMOS_spec_cal_skyflat${nn} template must be provided."
- echo " All matching exposures are collected automatically."
- echo "- The first exposure will be ignored when its EXPTIME differs from the"
- echo " other frames. In this case it is an aquisition frame taken to estimate "
- echo " the needed EXPTIME."
+ echo " ${bb}KMOS_spec_cal_calunitflat${nn} template must be provided."
+ echo " All matching exposures are collected automatically (Only FLAT,LAMP at an"
+ echo " angle of 0deg)."
echo "- (Optional) If as 2nd argument ${bb}sof${nn} is provided, then only"
echo " the sof-file is generated but not executed."
echo " "
echo "${bb}Usage:${nn}"
- echo " easySPARK_illumination.sh <filename with full path>"
+ echo " easySPARK_illumination_flat.sh <filename with full path>"
echo " or"
- echo " easySPARK_illumination.sh <filename with full path> sof"
+ echo " easySPARK_illumination_flat.sh <filename with full path> sof"
echo " "
echo "Version: "$EASY_VERSION
echo "${bb}-------------------------------------------------------------------${nn}"
@@ -85,8 +82,8 @@ fi
tplId=$(dfits $fileName |\
fitsort -d tpl.id |\
gawk '{print $2}')
-if [ $tplId != KMOS_spec_cal_skyflat ]; then
- echo "${bb}ERROR${nn}: File is of wrong template: $tplId instead of KMOS_spec_cal_skyflat !"
+if [ $tplId != KMOS_spec_cal_calunitflat ]; then
+ echo "${bb}ERROR${nn}: File is of wrong template: $tplId instead of KMOS_spec_cal_calunitflat !"
exit
fi
@@ -95,23 +92,24 @@ tplStartTime=$(dfits $fileName |\
fitsort -d tpl.start |\
gawk '{print $2}')
-# get files with matching tplStartTime and FLAT_SKY
+# get files with matching tplStartTime and FLAT_LAMP
dataDir=$(dirname "$fileName")
matchingFiles=$(dfits $dataDir/KMOS*.fits | \
- fitsort -d tpl.start dpr.type |\
+ fitsort -d tpl.start dpr.type ocs.rot.naangle |\
grep $tplStartTime |\
- grep FLAT,SKY |\
+ grep FLAT,LAMP |\
+ grep -P "\s+0.0" | \
gawk '{print $1}' |\
tr "\n" " ")
-# populate sof-file with FLAT_SKY frames
-sofFile="illumination_$tplStartTime.sof"
+# populate sof-file with FLAT_SKY_FLAT frames
+sofFile="illumination_flat_$tplStartTime.sof"
cat > $sofFile </dev/null
for file in $matchingFiles; do
- echo "$file FLAT_SKY" >> $sofFile
+ echo "$file FLAT_SKY_FLAT" >> $sofFile
done
-# get grating id of first FLAT_SKY frame
+# get grating id of first FLAT_SKY_FLAT frame
gratingUpper=$(dfits $matchingFiles |\
fitsort -d ins.grat1.id |\
head -n1 |\
@@ -121,19 +119,10 @@ gratingUpper=$(dfits $matchingFiles |\
echo "$KMOS_CALIB/kmos_wave_band.fits WAVE_BAND" >> $sofFile
# add band-specific calibration frames
-fnMasterDark=master_dark.fits
-fnMasterFlat=master_flat_$gratingUpper$gratingUpper$gratingUpper.fits
fnXcal=xcal_$gratingUpper$gratingUpper$gratingUpper.fits
fnYcal=ycal_$gratingUpper$gratingUpper$gratingUpper.fits
fnLcal=lcal_$gratingUpper$gratingUpper$gratingUpper.fits
-fnFlatEdge=flat_edge_$gratingUpper$gratingUpper$gratingUpper.fits
-if [ ! -e $fnMasterDark ]; then
- fnMasterDark=$KMOS_CALIB"/"$fnMasterDark
-fi
-if [ ! -e $fnMasterFlat ]; then
- fnMasterFlat=$KMOS_CALIB"/"$fnMasterFlat
-fi
if [ ! -e $fnXcal ]; then
fnXcal=$KMOS_CALIB"/"$fnXcal
fi
@@ -143,19 +132,13 @@ fi
if [ ! -e $fnLcal ]; then
fnLcal=$KMOS_CALIB"/"$fnLcal
fi
-if [ ! -e $fnFlatEdge ]; then
- fnFlatEdge=$KMOS_CALIB"/"$fnFlatEdge
-fi
-echo "$fnMasterDark MASTER_DARK" >> $sofFile
-echo "$fnMasterFlat MASTER_FLAT" >> $sofFile
echo "$fnXcal XCAL" >> $sofFile
echo "$fnYcal YCAL" >> $sofFile
echo "$fnLcal LCAL" >> $sofFile
-echo "$fnFlatEdge FLAT_EDGE" >> $sofFile
echo ""
-echo "${bb}------------------ easySPARK_illumination ---------------------${nn}"
+echo "${bb}------------------ easySPARK_illumination_flat ---------------------${nn}"
echo "${bb}INPUT${nn}"
echo "filename: "$fileName
echo "with "
@@ -168,11 +151,11 @@ echo $sofFile" with:"
cat $sofFile
echo ""
-# execute kmo_illumination
+# execute kmo_illumination_flat
if [ $sofOnly = 0 ]; then
- echo "${bb}NOW CALCULATING ILLUMINATION CORRECTION:${nn}"
- echo "esorex kmo_illumination "$sofFile
+ echo "${bb}NOW CALCULATING ILLUMINATION_FLAT CORRECTION:${nn}"
+ echo "esorex kmo_illumination_flat "$sofFile
- esorex kmo_illumination $sofFile
+ esorex kmo_illumination_flat $sofFile
fi
echo "${bb}----------------------------------------------------------${nn}"
diff --git a/tools/easySPARK/easySPARK_multi_reconstruct.sh b/tools/easySPARK/easySPARK_multi_reconstruct.sh
index 277322a..6b32b86 100755
--- a/tools/easySPARK/easySPARK_multi_reconstruct.sh
+++ b/tools/easySPARK/easySPARK_multi_reconstruct.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-EASY_VERSION="1.0"
+EASY_VERSION="1.1"
bb=`tput bold`
nn=`tput sgr0`
diff --git a/tools/easySPARK/easySPARK_reconstruct.sh b/tools/easySPARK/easySPARK_reconstruct.sh
index acbf72c..7bb0365 100755
--- a/tools/easySPARK/easySPARK_reconstruct.sh
+++ b/tools/easySPARK/easySPARK_reconstruct.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-EASY_VERSION="1.0"
+EASY_VERSION="1.1"
bb=`tput bold`
nn=`tput sgr0`
diff --git a/tools/easySPARK/easySPARK_sci_red.sh b/tools/easySPARK/easySPARK_sci_red.sh
index 6c52f4e..4429d51 100755
--- a/tools/easySPARK/easySPARK_sci_red.sh
+++ b/tools/easySPARK/easySPARK_sci_red.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-EASY_VERSION="1.0"
+EASY_VERSION="1.1"
bb=`tput bold`
nn=`tput sgr0`
diff --git a/tools/easySPARK/easySPARK_std_star.sh b/tools/easySPARK/easySPARK_std_star.sh
index a5c6359..eab2ac5 100755
--- a/tools/easySPARK/easySPARK_std_star.sh
+++ b/tools/easySPARK/easySPARK_std_star.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-EASY_VERSION="1.0"
+EASY_VERSION="1.1"
bb=`tput bold`
nn=`tput sgr0`
diff --git a/tools/easySPARK/easySPARK_test.sh b/tools/easySPARK/easySPARK_test.sh
index 1afcd7a..022f5ba 100755
--- a/tools/easySPARK/easySPARK_test.sh
+++ b/tools/easySPARK/easySPARK_test.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-EASY_VERSION="1.0"
+EASY_VERSION="1.1"
bb=`tput bold`
nn=`tput sgr0`
diff --git a/tools/easySPARK/easySPARK_wave_cal.sh b/tools/easySPARK/easySPARK_wave_cal.sh
index 0521730..45e7a56 100755
--- a/tools/easySPARK/easySPARK_wave_cal.sh
+++ b/tools/easySPARK/easySPARK_wave_cal.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-EASY_VERSION="1.0"
+EASY_VERSION="1.1"
bb=`tput bold`
nn=`tput sgr0`
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cpl-plugin-kmos.git
More information about the debian-science-commits
mailing list