IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 15, 2015, 10:13:54 AM (11 years ago)
Author:
eugene
Message:

add galphot to the merge options

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c

    r39139 r39142  
    1414  double *X1, *Y1, *X2, *Y2;
    1515  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;
    1818  int NsecfiltIn;
    1919  int NsecfiltOut;
     
    199199      NGALP = Ngalp + input[0].average[N].Ngalphot + 1000;
    200200      REALLOCATE (next_galp, off_t, NGALP);
    201       REALLOCATE (output[0].galphot, Galphot, NGALP);
     201      REALLOCATE (output[0].galphot, GalPhot, NGALP);
    202202    }
    203203
     
    222222      if (REPLACE_BY_PHOTCODE) {
    223223        // index to first measure for this object
    224         // XXX this does not support lensing measurements
     224        // XXX this does not support lensing, starpar, or galphot measurements
    225225        if (replace_match (&output[0].average[n], output[0].measure, next_meas, &input[0].average[N], &input[0].measure[offset])) {
    226226          input[0].found_t[N] = output[0].average[n].measureOffset; 
     
    315315    }
    316316
     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
    317335    // update the average properties to reflect the incoming entries:
    318336    // if the original value is NAN but the input value is not, accept the input:
     
    365383      REALLOCATE (output[0].starpar, StarPar, NSTAR);
    366384    }
     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    }
    367390    if (Nave >= NAVE) {
    368391      NAVE = Nave + 1000;
     
    488511    }
    489512
     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
    490539    Nave ++;
    491540  }
     
    497546  REALLOCATE (output[0].lensing, Lensing, Nlens);
    498547  REALLOCATE (output[0].starpar, StarPar, Nstar);
     548  REALLOCATE (output[0].galphot, GalPhot, Ngalp);
    499549 
    500550# define NOSORT 0
     
    506556    output[0].lensing = sort_lensing (output[0].average, Nave, output[0].lensing, Nlens, next_lens);
    507557    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);
    508559  }
    509560
     
    523574  output[0].Nlensing = Nlens;
    524575  output[0].Nstarpar = Nstar;
     576  output[0].Ngalphot = Ngalp;
    525577  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);
    527579
    528580  free (next_meas);
    529581  free (next_lens);
    530582  free (next_star);
     583  free (next_galp);
    531584
    532585  free (X2);
Note: See TracChangeset for help on using the changeset viewer.