IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20339


Ignore:
Timestamp:
Oct 22, 2008, 5:52:22 PM (18 years ago)
Author:
Paul Price
Message:

Ensure sources are over the S/N limit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotMergeSources.c

    r20329 r20339  
    7171    detections->peaks = psArrayAllocEmpty(100);
    7272
     73    psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
     74    if (!recipe) {
     75        psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSPHOT_RECIPE);
     76        return false;
     77    }
     78    float snMin = psMetadataLookupF32(NULL, recipe, "MOMENTS_SN_MIN");
     79    if (!isfinite(snMin)) {
     80        return NULL;
     81    }
     82
    7383    for (int i = 0; i < sources->n; i++) {
    7484        pmSource *source = sources->data[i];
    7585        pmModel *model = source->modelPSF;
    7686
     87        if (!isfinite(source->psfMag)) {
     88            continue;
     89        }
     90
     91        float flux = powf(10.0, -0.4 * source->psfMag);
    7792        float xpos = model->params->data.F32[PM_PAR_XPOS];
    7893        float ypos = model->params->data.F32[PM_PAR_YPOS];
     
    8196        peak->xf = xpos;
    8297        peak->yf = ypos;
    83         peak->flux = 1.0;
    84         peak->SN = INFINITY;
     98        peak->flux = flux;
     99        peak->SN = snMin + flux;
    85100
    86101        psArrayAdd (detections->peaks, 100, peak);
Note: See TracChangeset for help on using the changeset viewer.