/home/amodigli/releases/xsh/1.2.10/pso/xsh.26608/xshp/xsh/tests/test-xsh_fit.c File Reference

#include <xsh_fit.h>
#include <tests.h>
#include <cpl_test.h>
#include <math.h>
#include <float.h>

Go to the source code of this file.

Defines

#define MODULE_ID   "XSH_FIT"
#define XSH_TEST_MARGIN   2.0
#define xsh_test(expr)
#define xsh_test_tol(first, second, tolerance)
#define IMAGESZ   10
#define NFRAMES   10
#define IMAGESZFIT   256
#define xsh_fit_imagelist_is_zero(A, B)   xsh_fit_imagelist_is_zero_macro(A, B)
#define xsh_fit_image_is_zero(A, B)   xsh_fit_image_is_zero_macro(A, B)

Functions

static void xsh_fit_imagelist_polynomial_tests (void)
static void xsh_fit_imagelist_is_zero_macro (const cpl_imagelist *self, double tol)
 Verify that all elements in an imagelist are zero (within a tolerance).
static void xsh_fit_image_is_zero_macro (const cpl_image *self, double tol)
 Verify that all elements in an image are zero (within a tolerance).
static cpl_error_code xsh_image_fill_noise_uniform (cpl_image *self, double min_pix, double max_pix)
 Fill an image with uniform random noise distribution.
int main (void)
 Unit tests of fit module.

Define Documentation

#define IMAGESZ   10

Definition at line 63 of file test-xsh_fit.c.

Referenced by xsh_fit_imagelist_polynomial_tests().

#define IMAGESZFIT   256

Definition at line 65 of file test-xsh_fit.c.

Referenced by xsh_fit_imagelist_polynomial_tests().

#define MODULE_ID   "XSH_FIT"

Definition at line 38 of file test-xsh_fit.c.

#define NFRAMES   10

Definition at line 64 of file test-xsh_fit.c.

#define xsh_fit_image_is_zero ( A,
 )     xsh_fit_image_is_zero_macro(A, B)

Definition at line 69 of file test-xsh_fit.c.

Referenced by xsh_fit_imagelist_polynomial_tests().

#define xsh_fit_imagelist_is_zero ( A,
 )     xsh_fit_imagelist_is_zero_macro(A, B)

Definition at line 67 of file test-xsh_fit.c.

Referenced by xsh_fit_imagelist_polynomial_tests().

#define xsh_test ( expr   ) 
Value:
do { \
    if (!(expr)) assure(0, CPL_ERROR_ILLEGAL_OUTPUT, "Test failed"); \
 } while(0) \

Definition at line 43 of file test-xsh_fit.c.

Referenced by xsh_fit_imagelist_polynomial_tests().

#define XSH_TEST_MARGIN   2.0

Definition at line 41 of file test-xsh_fit.c.

#define xsh_test_tol ( first,
second,
tolerance   ) 
Value:
do {                                                                       \
        const double xsh_test_first = (double)(first);                      \
        const double xsh_test_second = (double)(second);                    \
        const double xsh_test_tolerance = (double)(tolerance);              \
       /* The error margin on the tolerance */                                 \
        const double xsh_test_margin = (double)(XSH_TEST_MARGIN);        \
                                                                               \
        if (!(fabs(xsh_test_first - xsh_test_second) <=                  \
            xsh_test_tolerance * xsh_test_margin))                       \
        {                                                                      \
            xsh_test(0);                                                    \
        }                                                                      \
    } while (0)

Definition at line 48 of file test-xsh_fit.c.

Referenced by xsh_fit_image_is_zero_macro().


Function Documentation

int main ( void   ) 

Unit tests of fit module.

Definition at line 99 of file test-xsh_fit.c.

References check, MODULE_ID, TEST_END, TESTS_INIT, xsh_error_dump, and xsh_fit_imagelist_polynomial_tests().

static void xsh_fit_image_is_zero_macro ( const cpl_image *  self,
double  tol 
) [static]

Verify that all elements in an image are zero (within a tolerance).

Parameters:
self The image to check
tol The non-negative tolerance param line The line number of the caller
Returns:
void

Definition at line 447 of file test-xsh_fit.c.

References xsh_test_tol.

Referenced by xsh_fit_imagelist_is_zero_macro().

static void xsh_fit_imagelist_is_zero_macro ( const cpl_imagelist *  self,
double  tol 
) [static]

Verify that all elements in an imagelist are zero (within a tolerance).

Parameters:
self The list of images to check
tol The non-negative tolerance
Returns:
void

Definition at line 418 of file test-xsh_fit.c.

References check, n, and xsh_fit_image_is_zero_macro().

static void xsh_fit_imagelist_polynomial_tests ( void   )  [static]
static cpl_error_code xsh_image_fill_noise_uniform ( cpl_image *  self,
double  min_pix,
double  max_pix 
) [static]

Fill an image with uniform random noise distribution.

Parameters:
self Image to fill
min_pix Minimum output pixel value.
max_pix Maximum output pixel value.
Returns:
CPL_ERROR_NONE or the relevant CPL error code on error.
See also:
cpl_image_fill_noise_uniform()
Note:
Images with pixel type int are also supported

FIXME: Add Integer support to cpl_image_fill_noise_uniform()

Definition at line 481 of file test-xsh_fit.c.

References nx, and ny.

Referenced by xsh_fit_imagelist_polynomial_tests().


Generated on 9 Mar 2011 for X-shooter Pipeline Reference Manual by  doxygen 1.6.1