Changeset 41485
- Timestamp:
- Feb 3, 2021, 2:48:14 PM (5 years ago)
- Location:
- trunk/Ohana/src/relphot
- Files:
-
- 8 edited
-
include/relphot.h (modified) (1 diff)
-
src/ImageOps.c (modified) (3 diffs)
-
src/MosaicOps.c (modified) (5 diffs)
-
src/TGroupOps.c (modified) (7 diffs)
-
src/args.c (modified) (2 diffs)
-
src/assign_images.c (modified) (2 diffs)
-
src/select_images.c (modified) (2 diffs)
-
src/setExclusions.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relphot/include/relphot.h
r41473 r41485 841 841 void SetZeroPointModes (void); 842 842 int UseStandardOLS (ZptFitModeType mode); 843 int GetActivePhotcodeIndex (int photcode); -
trunk/Ohana/src/relphot/src/ImageOps.c
r41473 r41485 290 290 void findImages (Catalog *catalog, int Ncatalog, int doImageList) { 291 291 292 off_t j;293 int i, ecode, Ns, found;294 295 292 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++) { 298 295 catalog[i].measureT[j].myDet = FALSE; // a detetion is not mine until proven otherwise 299 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[j].photcode);300 296 301 297 // skip measurements which do not match one of the requested photcodes ( 302 298 // (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; 308 301 309 302 // if we match one of our images, myDet gets set to TRUE … … 317 310 int findCCD (off_t idx, off_t meas, int cat, MeasureTiny *measure) { 318 311 319 int ccdnum , found, Ns, ecode;312 int ccdnum; 320 313 double X, Y; 321 314 char *pname, *filter, *p, base[256]; … … 324 317 pname = GetPhotcodeNamebyCode (image[idx].photcode); 325 318 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; 333 323 334 324 filter = photcodes[Ns][0].name; -
trunk/Ohana/src/relphot/src/MosaicOps.c
r41473 r41485 856 856 857 857 int findMosaics (Catalog *catalog, int Ncatalog, int doMosaicList) { 858 859 int i, ecode, found, Ns;860 off_t j;861 858 862 859 if (!MOSAIC_ZEROPT) return (FALSE); … … 864 861 865 862 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++) { 868 865 catalog[i].measureT[j].myDet = FALSE; // a detetion is not mine until proven otherwise 869 866 … … 872 869 if (catalog[i].measureT[j].t > TSTOP) continue; 873 870 } 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; 880 874 matchMosaics (catalog, j, i, doMosaicList); 881 875 Nmatch ++; … … 1598 1592 1599 1593 // skip unused measurements 1594 1595 // XXX replace with: 1596 // Ns = GetActivePhotcodeIndex (photcode); 1597 // if (Ns < 0) continue; 1598 1600 1599 int Nsec; 1601 1600 int ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[m].photcode); … … 1620 1619 if (nMos == -1) continue; 1621 1620 1621 // XXX how can this not be true? 1622 1622 if (mosaic[nMos].photcode != ecode) { 1623 1623 fprintf (stderr, "*"); -
trunk/Ohana/src/relphot/src/TGroupOps.c
r41473 r41485 67 67 tgroupTimes[i][0].start = tgroupTimesRaw[i]; 68 68 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) 69 72 70 73 ALLOCATE (tgroupTimes[i][0].byCode, TGroup, Nphotcodes); … … 198 201 } 199 202 203 // skip inactive photcodes (do not assign to a TGroup) 204 if (GetActivePhotcodeIndex (subset[i].photcode) < 0) continue; 205 200 206 TGroup *myGroup = findTGroup(subset[i].tzero, subset[i].photcode); 201 207 if (!myGroup) { … … 358 364 TGroup *findTGroup (unsigned int start, int photcode) { 359 365 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); 368 368 if (Ns < 0) return NULL; 369 369 … … 519 519 int findTGroups (Catalog *catalog, int Ncatalog) { 520 520 521 int i, ecode, found, Ns;522 off_t j;523 524 521 if (!TGROUP_ZEROPT) return (FALSE); 525 522 // if we are calibrating by tgroup, redefine myDet == on one of my tgroups 526 523 527 524 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++) { 530 527 catalog[i].measureT[j].myDet = FALSE; // a detetion is not mine until proven otherwise 531 528 … … 535 532 } 536 533 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; 543 537 544 538 matchTGroups (catalog, j, i); … … 549 543 550 544 // XXX print results for testing 551 for (i = 0; FALSE && (i < NtgroupTimes); i++) {545 for (int i = 0; FALSE && (i < NtgroupTimes); i++) { 552 546 TGroup *tgroup = tgroupTimes[i][0].byCode; 553 547 for (off_t j = 0; j < tgroupTimes[i][0].nCode; j++) { … … 909 903 float MsysKron = PhotSysTiny (&catalog[c].measureT[m], &catalog[c].averageT[n], &catalog[c].secfilt[n*Nsecfilt], MAG_CLASS_KRON); 910 904 905 // XXX byCode : here we are only checking for equiv photcodes (not active photcodes) 911 906 PhotCode *code = GetPhotcodebyCode (catalog[c].measureT[m].photcode); 912 907 if (!code) goto skip; -
trunk/Ohana/src/relphot/src/args.c
r41473 r41485 537 537 } 538 538 539 // (photcodes, Nphotcodes) is the list of active average photcodes 539 540 PhotcodeList = NULL; 540 541 photcodes = NULL; … … 569 570 } 570 571 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 575 int 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 571 588 // XXX need to free sky 572 589 void relphot_free (SkyTable *sky, SkyList *skylist) { -
trunk/Ohana/src/relphot/src/assign_images.c
r39481 r41485 59 59 int select_images_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage) { 60 60 61 int ecode, found;62 61 off_t i, j; 63 62 … … 73 72 74 73 /* 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; 82 76 83 77 /* exclude images by time */ -
trunk/Ohana/src/relphot/src/select_images.c
r40291 r41485 22 22 off_t i, j, k, m, nStart, iSky, nimage, NIMAGE, D_NIMAGE; 23 23 off_t *line_number; 24 int InRange, ecode,found;24 int InRange, found; 25 25 double Ri[5], Di[5], Xi[5], Yi[5]; 26 26 Coords tcoords; … … 106 106 // goto found_it; 107 107 108 /* exclude images by photcode */108 /* exclude images by photcode (we are not doing this, but I'm not sure why) */ 109 109 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; 117 112 } 118 113 -
trunk/Ohana/src/relphot/src/setExclusions.c
r37037 r41485 9 9 10 10 off_t i, j, k, m, Narea, Nnocal, Ngood; 11 int ecode, found, Ns;12 11 Coords *coords; 13 12 double r, d, x, y; … … 20 19 21 20 /* 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; 28 23 29 24 /* select measurements by time */
Note:
See TracChangeset
for help on using the changeset viewer.
