Commit 962e6faa authored by Johan Richard's avatar Johan Richard
Browse files

Corrected bug in image comparison / sorting

parent 62ea163d
......@@ -17,16 +17,14 @@
// BCLEMENT : chi2 proximity bug fix
/* qsort struct comparision function (x field) */
static int struct_cmp_by_x(const void *a, const void *b)
{
static int struct_cmp_by_x(const void *a, const void *b)
{
struct point *da = (struct point *)a;
struct point *db = (struct point *)b;
return (int)(da->x - db->x);
/* float comparison: returns negative if b > a
and positive if a > b. We multiplied result by 100.0
to preserve decimal fraction */
}
if (da->x < db->x) return -1;
if (da->x > db->x) return 1;
return 0;
}
static double chi2SglImage( struct galaxie *pima, struct point *ps );
static int chi2_img( double *chi2, double *lh0 );
......@@ -180,7 +178,7 @@ int o_chi_lhood0(double *chi_ext, double *lhood0_ext, double *np_b0)
M.verbose = 0;
//2Eric: You assume that imFrame.pixelx == imFrame.pixely ?
if (fabs(( imFrame.pixelx - imFrame.pixely)/imFrame.pixelx) > 1e-4)
if (fabs(( imFrame.pixelx - imFrame.pixely)/imFrame.pixelx) > 1e-3)
{
fprintf(stderr, "Error | imFrame.pixelx(%f) != imFrame.pixely(%f) but we assume that they are equal\n", imFrame.pixelx, imFrame.pixely);
exit(EXIT_FAILURE);
......
......@@ -17,16 +17,15 @@
// BCLEMENT : chi2 proximity bug fix
/* qsort struct comparision function (x field) */
static int struct_cmp_by_x(const void *a, const void *b)
{
static int struct_cmp_by_x(const void *a, const void *b)
{
struct point *da = (struct point *)a;
struct point *db = (struct point *)b;
return (int)(da->x - db->x);
/* float comparison: returns negative if b > a
and positive if a > b. We multiplied result by 100.0
to preserve decimal fraction */
}
if (da->x < db->x) return -1;
if (da->x > db->x) return 1;
return 0;
}
static double chi2SglImage( struct galaxie *pima, struct point *ps );
static int chi2_img( double *chi2, double *lh0 );
......@@ -180,7 +179,7 @@ int o_chi_lhood0(double *chi_ext, double *lhood0_ext, double *np_b0)
M.verbose = 0;
//2Eric: You assume that imFrame.pixelx == imFrame.pixely ?
if (fabs(( imFrame.pixelx - imFrame.pixely)/imFrame.pixelx) > 1e-4)
if (fabs(( imFrame.pixelx - imFrame.pixely)/imFrame.pixelx) > 1e-3)
{
fprintf(stderr, "Error | imFrame.pixelx(%f) != imFrame.pixely(%f) but we assume that they are equal\n", imFrame.pixelx, imFrame.pixely);
exit(EXIT_FAILURE);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment