IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 16, 2009, 12:34:24 PM (17 years ago)
Author:
eugene
Message:

added additional flag values, threaded functions always use the threaded version

File:
1 edited

Legend:

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

    r21366 r21519  
    6363        pmSource *source = sources->data[i];
    6464
     65        // turn this bit off and turn it on again if we pass this test
     66        source->mode &= ~PM_SOURCE_MODE_LINEAR_FIT;
     67
    6568        // skip non-astronomical objects (very likely defects)
    6669        if (source->type == PM_SOURCE_TYPE_DEFECT) continue;
    6770        if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
    6871
    69         // if (source->type == PM_SOURCE_TYPE_STAR &&
     72        // do not include CRs in the full ensemble fit
    7073        if (source->mode & PM_SOURCE_MODE_CR_LIMIT) continue;
    7174
    7275        if (final) {
    73             if (source->mode &  PM_SOURCE_MODE_SUBTRACTED) continue;
     76            if (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED) continue;
    7477        } else {
    75             if (source->mode &  PM_SOURCE_MODE_BLEND) continue;
     78            if (source->mode & PM_SOURCE_MODE_BLEND) continue;
    7679        }
    7780
     
    9194        if (y > AnalysisRegion.y1) continue;
    9295
     96        source->mode |= PM_SOURCE_MODE_LINEAR_FIT;
    9397        psArrayAdd (fitSources, 100, source);
    9498    }
     
    185189    psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "solve matrix: %f sec (%d elements)\n", psTimerMark ("psphot.linear"), sparse->Nelem);
    186190
     191    // XXXX **** philosophical question:
     192    // we measure bright objects in three passes: 1) linear fit; 2) non-linear fit; 3) linear fit:
     193    // should retain the chisq and errors from the intermediate non-linear fit?
     194    // the non-linear fit provides better values for the position errors, and for
     195    // extended sources, the shape errors
     196
    187197    // adjust I0 for fitSources and subtract
    188198    for (int i = 0; i < fitSources->n; i++) {
     
    194204            psAbort("linear fitted source is nan");
    195205        }
     206
    196207        model->params->data.F32[PM_PAR_I0] = norm->data.F32[i];
    197208        model->dparams->data.F32[PM_PAR_I0] = errors->data.F32[i];
     
    200211        // subtract object
    201212        pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
    202         source->mode |= PM_SOURCE_MODE_SUBTRACTED;
     213        source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
    203214    }
    204215    psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "sub models: %f sec (%d elements)\n", psTimerMark ("psphot.linear"), sparse->Nelem);
     
    207218    for (int i = 0; final && (i < fitSources->n); i++) {
    208219        pmSource *source = fitSources->data[i];
     220        if (source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) continue;
    209221        pmModel *model = pmSourceGetModel (NULL, source);
    210222        pmSourceChisq (model, source->pixels, source->maskObj, source->variance, maskVal);
Note: See TracChangeset for help on using the changeset viewer.