IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33372


Ignore:
Timestamp:
Feb 25, 2012, 8:50:53 PM (14 years ago)
Author:
eugene
Message:

fix weighting scheme for different photcodes; fix reset & ubercal collisions

Location:
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/StarOps.c

    r33364 r33372  
    7676        N = 0;
    7777        for (k = 0; k < catalog[i].averageT[j].Nmeasure; k++, m++) {
     78
    7879          // skip measurements that do not match the current photcode
    79           int ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[m].photcode);
    80           if (ecode != thisCode) { continue; }
     80          PhotCode *code = GetPhotcodebyCode (catalog[i].measureT[m].photcode);
     81          if (!code) continue;
     82          if (code->equiv != thisCode) { continue; }
     83
     84          // int ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[m].photcode);
     85          // if (ecode != thisCode) { continue; }
    8186
    8287          if (catalog[i].measureT[m].dbFlags & MEAS_BAD) {
     
    114119          }
    115120          list[N] = Msys - Mcal - Mmos - Mgrid;
    116           dlist[N] = MAX (catalog[i].measureT[m].dM, MIN_ERROR);
     121
     122          // dlist gives the error, which is used as the weight in WT_MEAN.
     123          // we can modify the resulting weight in a few ways:
     124          // 1) MIN_ERROR guarantees a floor
     125          // 2) photomErrSys is added in quadrature as a sytematic error, set per photcode
     126          // 3) UBERCAL measurements can have their weight increased by a big factor to help tie down the averages
     127          // 4) some reference photcode of some kind can be specified as fixed and have a high weight
     128          dlist[N] = MAX (hypot(catalog[i].measureT[m].dM, code->photomErrSys), MIN_ERROR);
    117129
    118130          // up-weight the ubercal values (or convergence can take a long time...)
     
    122134
    123135          // tie down reference photometry if the -refcode (code) option is selected
    124           // XXX re-think this...
     136          // eg, -refcode g_SDSS
     137          // this probably makes no sense in the context of multifilter analysis
    125138          if (refPhotcode) {
    126             if (GetPhotcodeEquivCodebyCode(catalog[i].measureT[m].photcode) == refPhotcode[0].equiv) {
    127               // increase the weight by a factor of 100:
    128               dlist[N] = 0.01*catalog[i].measureT[m].dM;
     139            if (code->code == refPhotcode->code) {
     140              // tiny error -> large weight
     141              // dlist[N] = MAX (0.01*catalog[i].measureT[m].dM, MIN_ERROR);
     142              dlist[N] = 0.0001;
    129143            }
    130144          }
     
    157171// * setMrelOutput skips stars for which there are too few good measurements
    158172// * setMrelOutput is meant to be called repeatedly, relaxing the criteria for 'good' on each pass
     173
     174// setMave is also similar to the above.  but:
     175// * setMave is called by relphot -update-objects
     176// * setMave includes PSF_QF tests
     177// * setMave updates 2MASS average flags
     178// * setMave updates average EXT flags (PS1 and 2MASS)
    159179int setMrelOutput (Catalog *catalog, int Ncatalog, int mark, FlatCorrectionTable *flatcorr) {
    160180
     
    164184  double *list, *dlist;
    165185  StatType stats;
    166   int Nsec, Nsecfilt, ecode;
    167 
    168   Nsecfilt = GetPhotcodeNsecfilt ();
     186  int Nsec, ecode;
     187
     188  int Nsecfilt = GetPhotcodeNsecfilt ();
    169189
    170190  /* Nmeasure is now different, need to reallocate */
     
    193213        m = catalog[i].averageT[j].measureOffset;
    194214        for (k = 0; k < catalog[i].averageT[j].Nmeasure; k++, m++) {
     215
    195216          // skip measurements that do not match the current photcode
    196           ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[m].photcode);
    197           if (ecode != thisCode) { continue; }
     217          PhotCode *code = GetPhotcodebyCode (catalog[i].measureT[m].photcode);
     218          if (!code) continue;
     219          if (code->equiv != thisCode) { continue; }
     220
     221          // ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[m].photcode);
     222          // if (ecode != thisCode) { continue; }
    198223
    199224          if (catalog[i].measureT[m].dbFlags & MEAS_BAD) continue;
     
    215240          Msys = PhotSysTiny (&catalog[i].measureT[m], &catalog[i].averageT[j], &catalog[i].secfilt[j*Nsecfilt]);
    216241          list[N] = Msys - Mcal - Mmos - Mgrid;
    217           dlist[N] = MAX (catalog[i].measureT[m].dM, MIN_ERROR);
     242
     243          // dlist gives the error, which is used as the weight in WT_MEAN.
     244          // we can modify the resulting weight in a few ways:
     245          // 1) MIN_ERROR guarantees a floor
     246          // 2) photomErrSys is added in quadrature as a sytematic error, set per photcode
     247          // 3) UBERCAL measurements can have their weight increased by a big factor to help tie down the averages
     248          // 4) some reference photcode of some kind can be specified as fixed and have a high weight
     249          dlist[N] = MAX (hypot(catalog[i].measureT[m].dM, code->photomErrSys), MIN_ERROR);
     250
     251          // up-weight the ubercal values (or convergence can take a long time...)
     252          if (catalog[i].measureT[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
     253            dlist[N] = MAX (0.1*catalog[i].measureT[m].dM, MIN_ERROR);
     254          }
     255
     256          // tie down reference photometry if the -refcode (code) option is selected
     257          // eg, -refcode g_SDSS
     258          // this probably makes no sense in the context of multifilter analysis
     259          if (refPhotcode) {
     260            if (code->code == refPhotcode->code) {
     261              // tiny error -> large weight
     262              // dlist[N] = MAX (0.01*catalog[i].measureT[m].dM, MIN_ERROR);
     263              dlist[N] = 0.0001;
     264            }
     265          }
    218266          N++;
    219267        }
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/bcatalog.c

    r33364 r33372  
    6262  subcatalog[0].filename = catalog[0].filename;
    6363
     64  // flags used by the photometry analysis (excluding UBERCAL)
     65  unsigned int PHOTOM_FLAGS =
     66    ID_MEAS_NOCAL |       // detection ignored for this analysis (photcode, time range)
     67    ID_MEAS_POOR_PHOTOM | // detection is photometry outlier
     68    ID_MEAS_SKIP_PHOTOM | // detection was ignored for photometry measurement
     69    ID_MEAS_AREA;         // detetion was outside acceptable area of device
     70
    6471  /* exclude stars not in range or with too few measurements */
    6572  for (i = 0; i < catalog[0].Naverage; i++) {
     
    7481    }
    7582
     83    // reset the calculated average magnitudes (does not affect ubercal-tied measurements or images)
    7684    if (RESET) {
    7785      int Ns;
     
    147155      subcatalog[0].measureT[Nmeasure].averef = Naverage;
    148156      if (RESET) {
    149         subcatalog[0].measureT[Nmeasure].Mcal = 0;
    150         subcatalog[0].measureT[Nmeasure].dbFlags &= 0xff00;
    151         subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_POOR_PHOTOM;
    152         subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_AREA;
    153         subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_NOCAL;
     157        if (!KEEP_UBERCAL) {
     158          subcatalog[0].measureT[Nmeasure].Mcal = 0;
     159          subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_PHOTOM_UBERCAL;
     160        }
     161        subcatalog[0].measureT[Nmeasure].dbFlags &= ~PHOTOM_FLAGS;
    154162      }
    155163      Nmeasure ++;
Note: See TracChangeset for help on using the changeset viewer.