IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 15, 2010, 6:31:24 AM (16 years ago)
Author:
eugene
Message:

correctly unmark unused PSF candidates using source id; grid search for sersic terms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/psphot/src/psphotChoosePSF.c

    r28657 r28677  
    244244
    245245    // try each model option listed in config
     246    // pmPSFtryModel makes a local copy of the sources -- those points are not the same as those for 'sources'
    246247    for (int i = 0; i < modelNames->n; i++) {
    247248        char *modelName = modelNames->data[i];
     
    321322
    322323    // unset the PSFSTAR flag for stars not used for PSF model
     324    // XXX a more efficient way of achieving this would be to record a pair of arrays
     325    // of the source index and the source id for the psf stars.  but that would require we do
     326    // not re-sort the source list in the meanwhile
     327    int nDrop = 0;
    323328    for (int i = 0; i < try->sources->n; i++) {
    324329        pmSource *source = try->sources->data[i];
    325330        if (try->mask->data.PS_TYPE_VECTOR_MASK_DATA[i]) {
    326             source->mode &= ~PM_SOURCE_MODE_PSFSTAR;
    327         }
    328     }
     331            // need to find this source in the original list (these are copies, not pointers)
     332            for (int j = 0; j < sources->n; j++) {
     333                pmSource *realSource = sources->data[j];
     334                if (realSource->id != source->id) continue;
     335                realSource->mode &= ~PM_SOURCE_MODE_PSFSTAR;
     336                source->mode &= ~PM_SOURCE_MODE_PSFSTAR;
     337                nDrop ++;
     338                break;
     339            }
     340        }
     341    }
     342    // fprintf (stderr, "drop %d stars as PSF stars\n", nDrop);
     343
     344    // XXX is this working?
     345    // int N1 = 0;
     346    // for (int i = 0; i < try->sources->n; i++) {
     347    //     pmSource *source = try->sources->data[i];
     348    //  fprintf (stderr, "%llx : %d\n", (long long int) source, (source->mode & PM_SOURCE_MODE_PSFSTAR));
     349    //  if (source->mode & PM_SOURCE_MODE_PSFSTAR) {
     350    //      N1 ++;
     351    //     }
     352    // }
     353    // int N2 = 0;
     354    // for (int i = 0; i < sources->n; i++) {
     355    //     pmSource *source = sources->data[i];
     356    //  fprintf (stderr, "%llx : %d\n", (long long int) source, (source->mode & PM_SOURCE_MODE_PSFSTAR));
     357    //  if (source->mode & PM_SOURCE_MODE_PSFSTAR) {
     358    //      N2 ++;
     359    //     }
     360    // }
     361    // fprintf (stderr, "N1: %d, N2: %d\n", N1, N2);
    329362
    330363    // build a PSF residual image
Note: See TracChangeset for help on using the changeset viewer.