IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13864


Ignore:
Timestamp:
Jun 18, 2007, 12:32:49 PM (19 years ago)
Author:
eugene
Message:

adding trace dump output; skip sources with apResid not finite

File:
1 edited

Legend:

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

    r13428 r13864  
    6262    Npsf = 0;
    6363
     64    FILE *dumpFile = NULL;
     65    if (psTraceGetLevel("psphot") >= 5) {
     66        dumpFile = fopen ("apresid.dat", "w");
     67    }
     68
    6469    // select all good PM_SOURCE_TYPE_STAR entries
    6570    for (int i = 0; i < sources->n; i++) {
     
    8085        }
    8186
     87        if (!isfinite(source->apMag) || !isfinite(source->apMag)) {
     88            Nfail ++;
     89            continue;
     90        }
     91
     92        // sanity clipping : if the model is so discrepant, but your expectation in the recipe
    8293        apResid->data.F64[Npsf] = source->apMag - source->psfMag;
    8394
    84         xPos->data.F64[Npsf]    = model->params->data.F32[PM_PAR_XPOS];
    85         yPos->data.F64[Npsf]    = model->params->data.F32[PM_PAR_YPOS];
    86 
    87         flux->data.F64[Npsf]    = pow(10.0, -0.4*source->psfMag);
    88         r2rflux->data.F64[Npsf] = PS_SQR(model->radiusFit) / flux->data.F64[Npsf];
    89 
    90         mask->data.U8[Npsf] = 0;
    91 
    92         // XXX sanity clip?
    93         // XXX need to see if all data were tossed?
    94         // XXX need to subtract median?
    95         // XXX need to put this in the config data...
    96         // if (fabs(apResid->data.F64[Npsf]) > 0.2) continue;
    9795        if ((MAX_AP_OFFSET > 0) && (fabs(apResid->data.F64[Npsf]) > MAX_AP_OFFSET)) {
    9896            Nfail ++;
     
    10098        }
    10199
     100        xPos->data.F64[Npsf]    = model->params->data.F32[PM_PAR_XPOS];
     101        yPos->data.F64[Npsf]    = model->params->data.F32[PM_PAR_YPOS];
     102
     103        flux->data.F64[Npsf]    = pow(10.0, -0.4*source->psfMag);
     104        r2rflux->data.F64[Npsf] = PS_SQR(model->radiusFit) / flux->data.F64[Npsf];
     105
     106        mask->data.U8[Npsf] = 0;
     107
    102108        dMag->data.F64[Npsf] = model->dparams->data.F32[PM_PAR_I0] / model->params->data.F32[PM_PAR_I0];
     109
     110        if (psTraceGetLevel("psphot") >= 5) {
     111            fprintf (dumpFile, "%f %f  %f %f %f  %x\n",
     112                     xPos->data.F64[Npsf], yPos->data.F64[Npsf],
     113                     source->psfMag, dMag->data.F64[Npsf], apResid->data.F64[Npsf],
     114                     mask->data.U8[Npsf]);
     115        }
    103116
    104117        psVectorExtend (mask,    100, 1);
     
    111124        Npsf ++;
    112125    }
     126
     127    if (psTraceGetLevel("psphot") >= 5) {
     128        fclose (dumpFile);
     129    }
     130   
    113131    psLogMsg ("psphot.apresid", PS_LOG_DETAIL, "measure aperture residuals for %d objects (%d skipped, %d failed, %ld invalid)\n",
    114132              Npsf, Nskip, Nfail, sources->n - Npsf - Nskip - Nfail);
Note: See TracChangeset for help on using the changeset viewer.