IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41485


Ignore:
Timestamp:
Feb 3, 2021, 2:48:14 PM (5 years ago)
Author:
eugene
Message:

in TGroups, skip images with photcodes not of the active set; new API to wrap the test for photcodes in the active list

Location:
trunk/Ohana/src/relphot
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relphot/include/relphot.h

    r41473 r41485  
    841841void SetZeroPointModes (void);
    842842int UseStandardOLS (ZptFitModeType mode);
     843int GetActivePhotcodeIndex (int photcode);
  • trunk/Ohana/src/relphot/src/ImageOps.c

    r41473 r41485  
    290290void findImages (Catalog *catalog, int Ncatalog, int doImageList) {
    291291
    292   off_t j;
    293   int i, ecode, Ns, found;
    294  
    295292  int Nmatch = 0;
    296   for (i = 0; i < Ncatalog; i++) {
    297     for (j = 0; j < catalog[i].Nmeasure; j++) {
     293  for (int i = 0; i < Ncatalog; i++) {
     294    for (off_t j = 0; j < catalog[i].Nmeasure; j++) {
    298295      catalog[i].measureT[j].myDet = FALSE; // a detetion is not mine until proven otherwise
    299       ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[j].photcode);
    300296
    301297      // skip measurements which do not match one of the requested photcodes (
    302298      // (do we not already exclude in bcatalog -- maybe needed for reload_objects?
    303       found = FALSE;
    304       for (Ns = 0; !found && (Ns < Nphotcodes); Ns++) {
    305         if (ecode == photcodes[Ns][0].code) found = TRUE;
    306       }
    307       if (!found) continue;
     299      int Ns = GetActivePhotcodeIndex (catalog[i].measureT[j].photcode);
     300      if (Ns < 0) continue;
    308301
    309302      // if we match one of our images, myDet gets set to TRUE
     
    317310int findCCD (off_t idx, off_t meas, int cat, MeasureTiny *measure) {
    318311
    319   int ccdnum, found, Ns, ecode;
     312  int ccdnum;
    320313  double X, Y;
    321314  char *pname, *filter, *p, base[256];
     
    324317  pname = GetPhotcodeNamebyCode (image[idx].photcode);
    325318
    326   // XXX this seems quite terrible...
    327   ecode = GetPhotcodeEquivCodebyCode (measure[0].photcode);
    328   found = FALSE;
    329   for (Ns = 0; !found && (Ns < Nphotcodes); Ns++) {
    330     if (ecode == photcodes[Ns][0].code) found = TRUE;
    331   }
    332   if (!found) return (FALSE);
     319  // skip measurements which do not match one of the requested photcodes (
     320  // (do we not already exclude in bcatalog -- maybe needed for reload_objects?
     321  int Ns = GetActivePhotcodeIndex (measure[0].photcode);
     322  if (Ns < 0) return FALSE;
    333323
    334324  filter = photcodes[Ns][0].name;
  • trunk/Ohana/src/relphot/src/MosaicOps.c

    r41473 r41485  
    856856
    857857int findMosaics (Catalog *catalog, int Ncatalog, int doMosaicList) {
    858  
    859   int i, ecode, found, Ns;
    860   off_t j;
    861858
    862859  if (!MOSAIC_ZEROPT) return (FALSE);
     
    864861
    865862  int Nmatch = 0;
    866   for (i = 0; i < Ncatalog; i++) {
    867     for (j = 0; j < catalog[i].Nmeasure; j++) {
     863  for (int i = 0; i < Ncatalog; i++) {
     864    for (off_t j = 0; j < catalog[i].Nmeasure; j++) {
    868865      catalog[i].measureT[j].myDet = FALSE; // a detetion is not mine until proven otherwise
    869866
     
    872869        if (catalog[i].measureT[j].t > TSTOP) continue;
    873870      }
    874       ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[j].photcode);
    875       found = FALSE;
    876       for (Ns = 0; !found && (Ns < Nphotcodes); Ns++) {
    877         if (ecode == photcodes[Ns][0].code) found = TRUE;
    878       }
    879       if (!found) continue;
     871
     872      int Ns = GetActivePhotcodeIndex (catalog[i].measureT[j].photcode);
     873      if (Ns < 0) continue;
    880874      matchMosaics (catalog, j, i, doMosaicList);
    881875      Nmatch ++;
     
    15981592
    15991593        // skip unused measurements
     1594
     1595        // XXX replace with:
     1596        // Ns = GetActivePhotcodeIndex (photcode);
     1597        // if (Ns < 0) continue;
     1598
    16001599        int Nsec;
    16011600        int ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[m].photcode);
     
    16201619        if (nMos == -1) continue;
    16211620
     1621        // XXX how can this not be true? 
    16221622        if (mosaic[nMos].photcode != ecode) {
    16231623          fprintf (stderr, "*");
  • trunk/Ohana/src/relphot/src/TGroupOps.c

    r41473 r41485  
    6767    tgroupTimes[i][0].start = tgroupTimesRaw[i];
    6868    tgroupTimes[i][0].stop  = tgroupTimesRaw[i] + 86399;
     69
     70    // One TGroup per *active* photcode.  Check if photcode is active with:
     71    // GetActivePhotcodeIndex (photcode) (returns -1 if not active)
    6972
    7073    ALLOCATE (tgroupTimes[i][0].byCode, TGroup, Nphotcodes);
     
    198201    }
    199202
     203    // skip inactive photcodes (do not assign to a TGroup)
     204    if (GetActivePhotcodeIndex (subset[i].photcode) < 0) continue;
     205   
    200206    TGroup *myGroup = findTGroup(subset[i].tzero, subset[i].photcode);
    201207    if (!myGroup) {
     
    358364TGroup *findTGroup (unsigned int start, int photcode) {
    359365
    360   // first find the matching photcode (our list of active secondary photcodes
    361   // does not necessarily match the list of all secondary photcodes)
    362   int Ns = -1;
    363   int ecode = GetPhotcodeEquivCodebyCode (photcode);
    364   for (int i = 0; (Ns < 0) && (i < Nphotcodes); i++) {
    365     if (photcodes[i][0].code != ecode) continue;
    366     Ns = i;
    367   }
     366  // find index of matching photcode from our list of active secondary photcodes
     367  int Ns = GetActivePhotcodeIndex (photcode);
    368368  if (Ns < 0) return NULL;
    369369
     
    519519int findTGroups (Catalog *catalog, int Ncatalog) {
    520520 
    521   int i, ecode, found, Ns;
    522   off_t j;
    523 
    524521  if (!TGROUP_ZEROPT) return (FALSE);
    525522  // if we are calibrating by tgroup, redefine myDet == on one of my tgroups
    526523
    527524  int Nmatch = 0;
    528   for (i = 0; i < Ncatalog; i++) {
    529     for (j = 0; j < catalog[i].Nmeasure; j++) {
     525  for (int i = 0; i < Ncatalog; i++) {
     526    for (off_t j = 0; j < catalog[i].Nmeasure; j++) {
    530527      catalog[i].measureT[j].myDet = FALSE; // a detetion is not mine until proven otherwise
    531528
     
    535532      }
    536533
    537       ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[j].photcode);
    538       found = FALSE;
    539       for (Ns = 0; !found && (Ns < Nphotcodes); Ns++) {
    540         if (ecode == photcodes[Ns][0].code) found = TRUE;
    541       }
    542       if (!found) continue;
     534      // check if this measure has a relevant photcode
     535      int Ns = GetActivePhotcodeIndex (catalog[i].measureT[j].photcode);
     536      if (Ns < 0) continue;
    543537
    544538      matchTGroups (catalog, j, i);
     
    549543
    550544  // XXX print results for testing
    551   for (i = 0; FALSE && (i < NtgroupTimes); i++) {
     545  for (int i = 0; FALSE && (i < NtgroupTimes); i++) {
    552546    TGroup *tgroup = tgroupTimes[i][0].byCode;
    553547    for (off_t j = 0; j < tgroupTimes[i][0].nCode; j++) {
     
    909903    float MsysKron = PhotSysTiny (&catalog[c].measureT[m], &catalog[c].averageT[n], &catalog[c].secfilt[n*Nsecfilt], MAG_CLASS_KRON);
    910904
     905    // XXX byCode : here we are only checking for equiv photcodes (not active photcodes)
    911906    PhotCode *code = GetPhotcodebyCode (catalog[c].measureT[m].photcode);
    912907    if (!code) goto skip;
  • trunk/Ohana/src/relphot/src/args.c

    r41473 r41485  
    537537  }
    538538
     539  // (photcodes, Nphotcodes) is the list of active average photcodes
    539540  PhotcodeList = NULL;
    540541  photcodes = NULL;
     
    569570}
    570571
     572// for the given measurement photcode, find the sequence number of
     573// the equivalent active photcode (-1 if none match)
     574// XXX this could be optimized by making a lookup table of active equiv codes
     575int GetActivePhotcodeIndex (int photcode) {
     576
     577  // first find the matching photcode (our list of active secondary photcodes
     578  // does not necessarily match the list of all secondary photcodes)
     579  int Ns = -1;
     580  int ecode = GetPhotcodeEquivCodebyCode (photcode);
     581  for (int i = 0; (Ns < 0) && (i < Nphotcodes); i++) {
     582    if (photcodes[i][0].code != ecode) continue;
     583    Ns = i;
     584  }
     585  return Ns;
     586}
     587
    571588// XXX need to free sky
    572589void relphot_free (SkyTable *sky, SkyList *skylist) {
  • trunk/Ohana/src/relphot/src/assign_images.c

    r39481 r41485  
    5959int select_images_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage) {
    6060
    61   int ecode, found;
    6261  off_t i, j;
    6362
     
    7372   
    7473    /* exclude images by photcode */
    75     ecode = GetPhotcodeEquivCodebyCode (image[j].photcode);
    76     found = FALSE;
    77     int Ns;
    78     for (Ns = 0; !found && (Ns < Nphotcodes); Ns++) {
    79       if (ecode == photcodes[Ns][0].code) found = TRUE;
    80     }
    81     if (!found) continue;
     74    int Ns = GetActivePhotcodeIndex (image[j].photcode);
     75    if (Ns < 0) continue;
    8276
    8377    /* exclude images by time */
  • trunk/Ohana/src/relphot/src/select_images.c

    r40291 r41485  
    2222  off_t i, j, k, m, nStart, iSky, nimage, NIMAGE, D_NIMAGE;
    2323  off_t *line_number;
    24   int InRange, ecode, found;
     24  int InRange, found;
    2525  double Ri[5], Di[5], Xi[5], Yi[5];
    2626  Coords tcoords;
     
    106106    // goto found_it;
    107107
    108     /* exclude images by photcode */
     108    /* exclude images by photcode (we are not doing this, but I'm not sure why) */
    109109    if (FALSE) {
    110       ecode = GetPhotcodeEquivCodebyCode (timage[i].photcode);
    111       found = FALSE;
    112       int Ns;
    113       for (Ns = 0; !found && (Ns < Nphotcodes); Ns++) {
    114         if (ecode == photcodes[Ns][0].code) found = TRUE;
    115       }
    116       if (!found) continue;
     110      int Ns = GetActivePhotcodeIndex (timage[i].photcode);
     111      if (Ns < 0) continue;
    117112    }
    118113
  • trunk/Ohana/src/relphot/src/setExclusions.c

    r37037 r41485  
    99
    1010  off_t i, j, k, m, Narea, Nnocal, Ngood;
    11   int ecode, found, Ns;
    1211  Coords *coords;
    1312  double r, d, x, y;
     
    2019
    2120        /* select measurements by photcode */
    22         ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[m].photcode);
    23         found = FALSE;
    24         for (Ns = 0; !found && (Ns < Nphotcodes); Ns++) {
    25             if (ecode == photcodes[Ns][0].code) found = TRUE;
    26         }
    27         if (!found) goto mark_nocal;
     21        int Ns = GetActivePhotcodeIndex (catalog[i].measureT[m].photcode);
     22        if (Ns < 0) goto mark_nocal;
    2823       
    2924        /* select measurements by time */
Note: See TracChangeset for help on using the changeset viewer.