commit a43f4cc031a0b1d613dfa2e0584e57aa5e7134fd
parent 3d12ccef73a214ba3e99086e063ce3d7822c6cee
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 24 Mar 2016 10:44:59 +0100
Enable tests for the [cumulative] phase functions
Diffstat:
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/test_sschiff_estimator_rhodo.c b/src/test_sschiff_estimator_rhodo.c
@@ -2597,7 +2597,7 @@ main(int argc, char** argv)
const double wavelength = 0.5; /* In micron */
const size_t nscatt_angles = 1000;
const size_t ngeoms = 1000;
- const size_t ndirs = 100;
+ const size_t ndirs = 1000;
size_t count;
size_t ilimit_angle;
size_t i;
@@ -2717,6 +2717,7 @@ main(int argc, char** argv)
compute_estimation_intersection(interval, 4, &result2, &result);
printf(" Ws = %9.3g +/- %9.3g ~ %9.3g +/- %9.3g (%9.3g)\n",
result2.E, result2.SE, result.E, result.SE, interval[1] - interval[0]);
+ CHECK(interval[0] <= interval[1], 1);
#define DIFF_XSECTION_CUMUL \
sschiff_estimator_get_differential_cross_section_cumulative
@@ -2743,6 +2744,7 @@ main(int argc, char** argv)
compute_estimation_intersection(interval, 4, &result2, &result);
printf(" Wc = %9.3g +/- %9.3g ~ %9.3g +/- %9.3g (%9.3g)\n",
result2.E, result2.SE, result.E, result.SE, interval[1] - interval[0]);
+ CHECK(interval[0] <= interval[1], 1);
#define PHASE_FUNCTION sschiff_estimator_get_phase_function
CHECK(PHASE_FUNCTION(NULL, 1, NULL), RES_BAD_ARG);
@@ -2763,6 +2765,13 @@ main(int argc, char** argv)
printf("PF(%9.3g) = %9.3g +/- %9.3g ~ %9.3g +/- %9.3g (%9.3g)\n",
(double)i*(PI/999.0), result.E, result.SE, func[i].E, func[i].SE,
interval[1] - interval[0]);
+ /* Check up to the limit angle only. Wide angles are analytically computed
+ * and thus are widely affected by the estimation of the `n' parameter that
+ * is not sufficiently well estimated due to a limited number of
+ * realisations. */
+ if(i <= ilimit_angle) {
+ CHECK(interval[0] <= interval[1], 1);
+ }
}
#define CUMULATIVE sschiff_estimator_get_phase_function_cumulative
@@ -2784,6 +2793,13 @@ main(int argc, char** argv)
printf("CDF(%9.3g) = %9.3g +/- %9.3g ~ %9.3g +/- %9.3g (%9.3g)\n",
(double)i*(PI/999.0), result.E, result.SE, cumul[i].E, cumul[i].SE,
interval[1] - interval[0]);
+ /* Check up to the limit angle only. Wide angles are analytically computed
+ * and thus are widely affected by the estimation of the `n' parameter that
+ * is not sufficiently well estimated due to a limited number of
+ * realisations. */
+ if(i <= ilimit_angle) {
+ CHECK(interval[0] <= interval[1], 1);
+ }
}
NCHECK(sa_add(thetas, 2000), NULL);
@@ -2815,6 +2831,7 @@ main(int argc, char** argv)
error = fabs(thetas[i] - inverse_cumulative[i]) / inverse_cumulative[i];
printf("CDF^-1(%9.3g) = %9.3g ~ %9.3g; err = %.3f%%\n",
(double)i*(1.0/1999.0), thetas[i], inverse_cumulative[i], error*100);
+ CHECK(interval[0] <= interval[1], 1);
}
sa_release(thetas);