Changeset 39142 for trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c
- Timestamp:
- Nov 15, 2015, 10:13:54 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c
r39139 r39142 14 14 double *X1, *Y1, *X2, *Y2; 15 15 double dX, dY, dR; 16 off_t *N1, *N2, *next_meas, *next_lens, *next_star ;17 off_t Nave, NAVE, Nmeas, NMEAS, Nmatch, Nlens, NLENS, Nstar, NSTAR ;16 off_t *N1, *N2, *next_meas, *next_lens, *next_star, *next_galp; 17 off_t Nave, NAVE, Nmeas, NMEAS, Nmatch, Nlens, NLENS, Nstar, NSTAR, Ngalp, NGALP; 18 18 int NsecfiltIn; 19 19 int NsecfiltOut; … … 199 199 NGALP = Ngalp + input[0].average[N].Ngalphot + 1000; 200 200 REALLOCATE (next_galp, off_t, NGALP); 201 REALLOCATE (output[0].galphot, Gal phot, NGALP);201 REALLOCATE (output[0].galphot, GalPhot, NGALP); 202 202 } 203 203 … … 222 222 if (REPLACE_BY_PHOTCODE) { 223 223 // index to first measure for this object 224 // XXX this does not support lensing measurements224 // XXX this does not support lensing, starpar, or galphot measurements 225 225 if (replace_match (&output[0].average[n], output[0].measure, next_meas, &input[0].average[N], &input[0].measure[offset])) { 226 226 input[0].found_t[N] = output[0].average[n].measureOffset; … … 315 315 } 316 316 317 // if galphot measurements exist, add them too 318 if (output[0].galphot) { 319 for (Nin = 0; Nin < input[0].average[N].Ngalphot; Nin++) { 320 /* add to end of galphot list */ 321 add_galp_link (&output[0].average[n], next_galp, Ngalp, NGALP); 322 323 // set the new galphot 324 off_t galpoff = input[0].average[N].galphotOffset + Nin; 325 output[0].galphot[Ngalp] = input[0].galphot[galpoff]; 326 327 output[0].galphot[Ngalp].averef = n; 328 output[0].galphot[Ngalp].objID = output[0].average[n].objID; 329 output[0].galphot[Ngalp].catID = output[0].catID; 330 output[0].average[n].Ngalphot ++; 331 Ngalp ++; 332 } 333 } 334 317 335 // update the average properties to reflect the incoming entries: 318 336 // if the original value is NAN but the input value is not, accept the input: … … 365 383 REALLOCATE (output[0].starpar, StarPar, NSTAR); 366 384 } 385 if (Ngalp + input[0].average[N].Ngalphot >= NGALP) { 386 NGALP = Ngalp + input[0].average[N].Ngalphot + 1000; 387 REALLOCATE (next_galp, off_t, NGALP); 388 REALLOCATE (output[0].galphot, GalPhot, NGALP); 389 } 367 390 if (Nave >= NAVE) { 368 391 NAVE = Nave + 1000; … … 488 511 } 489 512 513 /** add galphot for this input average object **/ 514 if (output[0].galphot) { 515 output[0].average[Nave].galphotOffset = Ngalp; 516 for (Nin = 0; Nin < input[0].average[N].Ngalphot; Nin ++) { 517 // supply the galphot values from this detection 518 off_t galpoff = input[0].average[N].galphotOffset + Nin; 519 output[0].galphot[Ngalp] = input[0].galphot[galpoff]; 520 521 // the following galphot elements cannot be set until here: 522 output[0].galphot[Ngalp].averef = Nave; 523 output[0].galphot[Ngalp].objID = output[0].average[Nave].objID; 524 output[0].galphot[Ngalp].catID = output[0].catID; 525 526 // as we add galphot, update Ngalphot to match 527 output[0].average[Nave].Ngalphot ++; 528 529 /* we set next[Ngalp] to -1 here, and update correctly below */ 530 next_galp[Ngalp] = -1; 531 Ngalp ++; 532 } 533 int Ngroup = input[0].average[N].Ngalphot; 534 for (j = 0; j < Ngroup - 1; j++) { 535 next_galp[Ngalp - Ngroup + j] = Ngalp - Ngroup + j + 1; 536 } 537 } 538 490 539 Nave ++; 491 540 } … … 497 546 REALLOCATE (output[0].lensing, Lensing, Nlens); 498 547 REALLOCATE (output[0].starpar, StarPar, Nstar); 548 REALLOCATE (output[0].galphot, GalPhot, Ngalp); 499 549 500 550 # define NOSORT 0 … … 506 556 output[0].lensing = sort_lensing (output[0].average, Nave, output[0].lensing, Nlens, next_lens); 507 557 output[0].starpar = sort_starpar (output[0].average, Nave, output[0].starpar, Nstar, next_star); 558 output[0].galphot = sort_galphot (output[0].average, Nave, output[0].galphot, Ngalp, next_galp); 508 559 } 509 560 … … 523 574 output[0].Nlensing = Nlens; 524 575 output[0].Nstarpar = Nstar; 576 output[0].Ngalphot = Ngalp; 525 577 output[0].Nsecfilt_mem = Nave*NsecfiltOut; 526 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas, Nlens : "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n", Nstars, Nave, Nmeas, Nlens, Nmatch);578 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas, Nlens, Ngalp: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n", Nstars, Nave, Nmeas, Nlens, Ngalp, Nmatch); 527 579 528 580 free (next_meas); 529 581 free (next_lens); 530 582 free (next_star); 583 free (next_galp); 531 584 532 585 free (X2);
Note:
See TracChangeset
for help on using the changeset viewer.
