IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36311


Ignore:
Timestamp:
Nov 25, 2013, 11:51:42 AM (13 years ago)
Author:
eugene
Message:

new fitting tests

Location:
branches/eam_branches/ipp-20130904
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130904/psModules/src/objects/pmPCM_MinimizeChisq.c

    r36309 r36311  
    135135        }
    136136
    137         if (0) {
    138             fprintf (stderr, "%d : \n", min->iter);
     137        if (1) {
     138            fprintf (stderr, "%d : ", min->iter);
    139139            for (int ti = 0; ti < params->n; ti++) {
    140140                fprintf (stderr, "%f  ", params->data.F32[ti]);
    141141            }
    142             fprintf (stderr, "\n");
     142            fprintf (stderr, " : %f\n", min->value);
    143143        }
    144144
  • branches/eam_branches/ipp-20130904/psphot/src/psphotExtendedSourceFits.c

    r36310 r36311  
    315315
    316316// XXX TEST
    317             if (!isInteractive) {
     317            if (false && !isInteractive) {
    318318                if (!psThreadJobAddPending(job)) {
    319319                    psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
  • branches/eam_branches/ipp-20130904/psphot/src/psphotSourceFits.c

    r36310 r36311  
    2121
    2222bool psphotPCMfitCheckSize (pmPCMdata *pcm, pmSource *source, psImageMaskType maskVal, float psfSize);
     23bool psphotPCMfitRetry (pmPCMdata *pcm, pmSource *source, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal, float psfSize);
    2324
    2425bool psphotFitInit (int nThreads) {
     
    652653    if (TIMING) { t4 = psTimerMark ("psphotFitPCM"); }
    653654
    654     psphotPCMfitCheckSize (pcm, source, maskVal, psfSize);
     655    if (pcm->modelConv->nIter == fitOptions->nIter) {
     656        psphotPCMfitRetry (pcm, source, &options, maskVal, markVal, psfSize);
     657    }
     658    // psphotPCMfitCheckSize (pcm, source, maskVal, psfSize);
    655659    if (TIMING) { t5 = psTimerMark ("psphotFitPCM"); }
    656660
     
    13251329            rMin = dref;
    13261330        }
    1327         // fprintf (stderr, "%d | %f %f %f | %f %f %f\n", j, dref, Io, Chisq, rMin, iMin, xMin);
     1331        fprintf (stderr, "%d | %f %f %f | %f %f %f\n", j, dref, Io, Chisq, rMin, iMin, xMin);
    13281332    }
    13291333
     
    13441348}
    13451349
     1350// we have an initial fit, check to see if the current size is besst
     1351bool psphotPCMfitRetry (pmPCMdata *pcm, pmSource *source, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal, float psfSize) {
     1352
     1353    // PAR is already at my current best guess
     1354    psF32 *PAR = pcm->modelConv->params->data.F32;
     1355
     1356    // store best guess as a shape
     1357    psEllipseAxes centerAxes;
     1358    pmModelParamsToAxes (&centerAxes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true);
     1359
     1360    // retry with axes smaller by 1 pixel
     1361    psEllipseAxes guessAxes;
     1362    guessAxes.major = centerAxes.major - 0.08;
     1363    guessAxes.minor = guessAxes.major * centerAxes.minor / centerAxes.major;
     1364    guessAxes.theta = centerAxes.theta;
     1365
     1366    if (!isfinite(guessAxes.major)) return false;
     1367    if (!isfinite(guessAxes.minor)) return false;
     1368    if (!isfinite(guessAxes.theta)) return false;
     1369
     1370    // convert the major,minor,theta to shape parameters for an Reff-like model
     1371    pmModelAxesToParams (&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], guessAxes, true);
     1372
     1373    // generated the modelFlux
     1374    pmPCMMakeModel (source, pcm->modelConv, maskVal, psfSize);
     1375       
     1376    float YY = 0.0;
     1377    float YM = 0.0;
     1378    float MM = 0.0;
     1379    bool usePoisson = false;
     1380
     1381    for (int iy = 0; iy < source->pixels->numRows; iy++) {
     1382        for (int ix = 0; ix < source->pixels->numCols; ix++) {
     1383            // skip masked points
     1384            if (source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix]) {
     1385                continue;
     1386            }
     1387            // skip zero-variance points
     1388            if (source->variance->data.F32[iy][ix] == 0) {
     1389                continue;
     1390            }
     1391            // skip nan value points
     1392            if (!isfinite(source->pixels->data.F32[iy][ix])) {
     1393                continue;
     1394            }
     1395
     1396            float fy = source->pixels->data.F32[iy][ix];
     1397            float fm = source->modelFlux->data.F32[iy][ix];
     1398            float wt = (usePoisson) ? 1.0 / source->variance->data.F32[iy][ix] : 1.0;
     1399
     1400            YY += PS_SQR(fy) * wt;
     1401            YM += fm * fy * wt;
     1402            MM += PS_SQR(fm) * wt;
     1403        }
     1404    }
     1405
     1406    float Io = YM / MM;
     1407    PAR[PM_PAR_I0] = Io;
     1408
     1409    pmSourceFitPCM (pcm, source, fitOptions, maskVal, markVal, psfSize);  // NOTE : 1687 allocs in here
     1410
     1411    return true;
     1412}
     1413
     1414
  • branches/eam_branches/ipp-20130904/psphot/test/tap_psphot_galaxygrid.pro

    r36310 r36311  
    12781278    foreach radius 1.0 1.5 2.0 2.5 3.0 4.0 6.0 8.0
    12791279      # mkexp.devexp.single tests.20131120/testrad.ps1v1.exp.$Nrun EXP $radius 1.0
    1280       fitexp tests.20131120/testrad.ps1v1.exp.$Nrun tests.20131120/testrad.ps1v1.exp.$Nrun.t4s EXP_CONV
     1280      fitexp tests.20131120/testrad.ps1v1.exp.$Nrun tests.20131120/testrad.ps1v1.exp.$Nrun.t4p EXP_CONV
    12811281      $Nrun ++
    12821282    end
     
    12851285  $Nrun = 0
    12861286  foreach radius 1.0 1.5 2.0 2.5 3.0 4.0 6.0 8.0
    1287     cmf.load.concat tests.20131120/testrad.ps1v1.exp.$Nrun.dat tests.20131120/testrad.ps1v1.exp.$Nrun.t4s.cmf EXP
     1287    cmf.load.concat tests.20131120/testrad.ps1v1.exp.$Nrun.dat tests.20131120/testrad.ps1v1.exp.$Nrun.t4p.cmf EXP
    12881288    set dM_m = Mot_m - Min_m
    12891289    vstat -q dM_m
Note: See TracChangeset for help on using the changeset viewer.