IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26612


Ignore:
Timestamp:
Jan 14, 2010, 4:49:42 PM (16 years ago)
Author:
eugene
Message:

limit the number of sources used for the PSF model measurement

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/ppSub/src/ppSubMakePSF.c

    r26432 r26612  
    2121
    2222#include "ppSub.h"
     23
     24psArray *ppSubSelectPSFSources(psArray *sources);
    2325
    2426bool ppSubMakePSF(ppSubData *data)
     
    7981    // Here, we assume the image is background-subtracted
    8082    psArray *sources = psMetadataLookupPtr(&mdok, minuend->analysis, "PSPHOT.SOURCES");
    81     if (!psphotReadoutFindPSF(config, view, sources)) {
     83   
     84    // XXX filter sources?  limit the total number and return only brighter objects?
     85    // use flags to toss totally bogus entries?
     86    psArray *goodSources = ppSubSelectPSFSources (sources);
     87    if (!psphotReadoutFindPSF(config, view, goodSources)) {
    8288        // This is likely a data quality issue
    8389        // XXX Split into multiple cases using error codes?
     
    8692        ppSubDataQuality(data, PSPHOT_ERR_PSF, PPSUB_FILES_PHOT_SUB | PPSUB_FILES_PHOT_INV);
    8793        psFree(view);
     94        psFree(goodSources);
    8895        return true;
    8996    }
     
    100107    psMetadataRemoveKey(photRO->analysis, "PSPHOT.HEADER");
    101108
     109    psFree(goodSources);
    102110    psFree(view);
    103111
     
    156164    return true;
    157165}
     166
     167
     168// XXX hardwired MAX for now
     169# define MAX_NPSF 500
     170
     171psArray *ppSubSelectPSFSources(psArray *sources){
     172
     173    sources = psArraySort (sources, pmSourceSortBySN);
     174
     175    psArray *subset = psArrayAllocEmpty(MAX_NPSF);
     176
     177    int nPSF = 0;
     178    for (int i = 0; (nPSF < MAX_NPSF) && (i < sources->n); i++) {
     179
     180        pmSource *source = sources->data[i];
     181        if (!source) continue;
     182
     183        // skip non-astronomical objects (very likely defects)
     184        if (source->type == PM_SOURCE_TYPE_DEFECT) continue;
     185        if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
     186        if (source->mode & PM_SOURCE_MODE_SATSTAR) continue;
     187       
     188        psArrayAdd (subset, 100, source);
     189        nPSF++;
     190    }
     191   
     192    return subset;
     193}
Note: See TracChangeset for help on using the changeset viewer.