Commit bf36aed3 authored by Johan Richard's avatar Johan Richard
Browse files

Fixed Issue 4427 in multiple images catalog

parent c4f2a63d
......@@ -92,7 +92,7 @@ void o_prep_mult(int ntmult, struct galaxie *mult)
if ( k >= NFMAX && i < ntmult )
{
fprintf(stderr, "ERROR: too many systems in %s (maximum %d)\n",
NPRINTF(stderr, "ERROR: too many systems in %s (maximum %d)\n",
I.multfile, NFMAX);
exit(-1);
}
......@@ -114,7 +114,7 @@ void o_prep_mult(int ntmult, struct galaxie *mult)
// no single images without redshift
if ( I.mult[i] == 1 && multi[i][0].z == 0 )
{
fprintf(stderr, "ERROR: no multiple images in file %s\n",
NPRINTF(stderr, "ERROR: no multiple images in file %s\n",
I.multfile);
exit(-1);
};
......@@ -134,6 +134,57 @@ void o_prep_mult(int ntmult, struct galaxie *mult)
if ( k != 0 )
NPRINTF(stderr, "INFO: %d multiple images with unknown redshift\n", k);
// checks if two images have same IDs or same positions
for (i = 0; i < I.n_mult; i++)
{
for (j = 0; j < I.mult[i]; j++)
{
int icheck,jcheck;
//checks all the further images in same system
for(jcheck = j+1; jcheck < I.mult[i]; jcheck++)
{
//checks duplicate names
if( !strcmp(multi[i][j].n,multi[i][jcheck].n))
{
NPRINTF(stderr, "WARNING: Duplicate image %s\n",multi[i][j].n);
}
//checks duplicate positions
if(( fabs(multi[i][j].C.x-multi[i][jcheck].C.x)<0.0001) &&
( fabs(multi[i][j].C.y-multi[i][jcheck].C.y)<0.0001))
{
NPRINTF(stderr, "WARNING: image %s has same coordinates as image %s\n",multi[i][j].n,multi[i][jcheck].n);
}
//checks differences in redshifts in a same system
if(multi[i][j].z!=multi[i][jcheck].z)
{
NPRINTF(stderr, "ERROR: image %s has a different redshift than image %s\n",multi[i][j].n,multi[i][jcheck].n);
exit(-1);
}
}
//checks all the further systems (avoid checking twice)
for (icheck = i+1 ; icheck < I.n_mult; icheck++)
{
for(jcheck = 0; jcheck < I.mult[icheck]; jcheck++)
{
//checks duplicate names
if( !strcmp(multi[i][j].n,multi[icheck][jcheck].n))
{
NPRINTF(stderr, "WARNING: Duplicate image %s\n",multi[i][j].n);
}
//checks duplicate positions
if(( fabs(multi[i][j].C.x-multi[icheck][jcheck].C.x)<0.0001) &&
( fabs(multi[i][j].C.y-multi[icheck][jcheck].C.y)<0.0001))
{
NPRINTF(stderr, "WARNING: image %s has same coordinates as image %s\n",multi[i][j].n,multi[icheck][jcheck].n);
}
}
}
}
};
// Check if there are some critical line redshift optimization
int ncrit = 0;
for ( i = 0; i < I.nzlim; i++ )
......@@ -186,7 +237,7 @@ void o_prep_mult(int ntmult, struct galaxie *mult)
if ( !matched && l == I.nzlim )
{
fprintf(stderr, "ERROR: Image name %s not found in the z_m_limit list\n",
NPRINTF(stderr, "ERROR: Image name %s not found in the z_m_limit list\n",
multi[i][0].n);
exit(-1);
}
......
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