IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38742


Ignore:
Timestamp:
Sep 16, 2015, 7:46:34 AM (11 years ago)
Author:
eugene
Message:

check galphot and starpar to average links; fix endpoint error in Nvalue test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150625/Ohana/src/dvomerge/src/dvoverify_utils.c

    r38733 r38742  
    235235        fprintf (stderr, "%sOffset >= catalog.N%s: %d : %d >= %d\n", #NAME, #NAME, i, catalog.average[i].NAME##Offset, (int) catalog.N##NAME); \
    236236      }                                                                 \
    237       isOK = (catalog.average[i].N##NAME == 0) || (catalog.average[i].NAME##Offset + catalog.average[i].N##NAME < catalog.N##NAME); \
     237      isOK = (catalog.average[i].N##NAME == 0) || (catalog.average[i].NAME##Offset + catalog.average[i].N##NAME <= catalog.N##NAME); \
    238238      offsetOK &= isOK;                                                 \
    239239      if (VERBOSE && !isOK) {                                           \
    240         fprintf (stderr, "%sOffset + N%s > catalog.N%s : %d : %d + %d >= %d\n", #NAME, #NAME, #NAME, i, catalog.average[i].N##NAME, catalog.average[i].NAME##Offset, (int) catalog.N##NAME); \
     240        fprintf (stderr, "%sOffset + N%s > catalog.N%s : %d : %d + %d > %d\n", #NAME, #NAME, #NAME, i, catalog.average[i].N##NAME, catalog.average[i].NAME##Offset, (int) catalog.N##NAME); \
    241241      } }                                                               \
    242242    if (!offsetOK) {                                                    \
     
    365365  }
    366366
     367  // check starpar <-> average links
     368  {
     369    int objIDsOK = TRUE;
     370    int catIDsOK = TRUE;
     371    int averefOK = TRUE;
     372
     373    for (i = 0; i < catalog.Naverage; i++) {
     374      m = catalog.average[i].starparOffset;
     375      for (j = 0; j < catalog.average[i].Nstarpar; j++) {
     376        objIDsOK &= (catalog.average[i].objID == catalog.starpar[m+j].objID);
     377        catIDsOK &= (catalog.average[i].catID == catalog.starpar[m+j].catID);
     378        averefOK &= (catalog.starpar[m+j].averef == i);
     379      }
     380    }
     381   
     382    if (!objIDsOK) {
     383      fprintf (stderr, "ERROR: catalog %s has invalid starpar obj IDs\n", catalog.filename);
     384      status = FALSE;
     385    }
     386    if (!catIDsOK) {
     387      fprintf (stderr, "ERROR: catalog %s has invalid starpar cat IDs\n", catalog.filename);
     388      status = FALSE;
     389    }
     390    if (!averefOK) {
     391      fprintf (stderr, "ERROR: catalog %s has invalid starpar averef values\n", catalog.filename);
     392      status = FALSE;
     393    }
     394  }
     395
     396  // check galphot <-> average links
     397  {
     398    int objIDsOK = TRUE;
     399    int catIDsOK = TRUE;
     400    int averefOK = TRUE;
     401
     402    for (i = 0; i < catalog.Naverage; i++) {
     403      m = catalog.average[i].galphotOffset;
     404      for (j = 0; j < catalog.average[i].Ngalphot; j++) {
     405        objIDsOK &= (catalog.average[i].objID == catalog.galphot[m+j].objID);
     406        catIDsOK &= (catalog.average[i].catID == catalog.galphot[m+j].catID);
     407        averefOK &= (catalog.galphot[m+j].averef == i);
     408      }
     409    }
     410   
     411    if (!objIDsOK) {
     412      fprintf (stderr, "ERROR: catalog %s has invalid galphot obj IDs\n", catalog.filename);
     413      status = FALSE;
     414    }
     415    if (!catIDsOK) {
     416      fprintf (stderr, "ERROR: catalog %s has invalid galphot cat IDs\n", catalog.filename);
     417      status = FALSE;
     418    }
     419    if (!averefOK) {
     420      fprintf (stderr, "ERROR: catalog %s has invalid galphot averef values\n", catalog.filename);
     421      status = FALSE;
     422    }
     423  }
     424
    367425  // check the image ID here?
    368426  if (CHECK_IMAGE_ID) {
Note: See TracChangeset for help on using the changeset viewer.