IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 28, 2013, 1:25:15 PM (13 years ago)
Author:
eugene
Message:

fix up grid search for sersic index

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130904/psphot/src/psphotSourceFits.c

    r36318 r36325  
    653653    if (TIMING) { t4 = psTimerMark ("psphotFitPCM"); }
    654654
    655     // psphotPCMfitCheckSize (pcm, source, maskVal, psfSize);
     655    if (options.isInteractive) psphotPCMfitCheckSize (pcm, source, maskVal, psfSize);
    656656    // if (pcm->modelConv->nIter == fitOptions->nIter) {
    657657    //  psphotPCMfitRetry (pcm, source, &options, maskVal, markVal, psfSize);
     
    791791
    792792// 0.5 / n for (0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 6.0)
    793 float indexGuessInv[] = {1.00, 0.50, 0.333, 0.25, 1.666, 0.125, 0.10, 0.0833};
     793float indexGuessInv[] = {1.00, 0.50, 0.333, 0.25, 0.166, 0.125, 0.10, 0.0833};
    794794float indexGuessR1q[] = {1.06, 1.19, 1.335, 1.48, 1.840, 2.290, 2.84, 3.5300};
    795795# define N_INDEX_GUESS_INV 8
     
    902902                rMin = reffGuess[j] / indexGuessR1q[i];
    903903            }
    904             // fprintf (stderr, "%d | %f %f %f %f | %f %f %f %f", i, indexGuessInv[i], reffGuess[j], Io, Chisq, sMin, rMin, iMin, xMin);
    905             // fprintf (stderr, "\n");
     904            fprintf (stderr, "%d | %f %f %f %f | %f %f %f %f", i, indexGuessInv[i], reffGuess[j], Io, Chisq, sMin, rMin, iMin, xMin);
     905            fprintf (stderr, "\n");
    906906        }
    907907    }
     
    10061006    psVector *Sidx = psVectorAllocEmpty (16, PS_TYPE_F32);
    10071007
    1008     PAR[PM_PAR_7] = indexGuessInv[nStart];
     1008    float Sm = NAN, Sp = NAN, So = NAN;
     1009    if (nStart == 0) {
     1010        Sm = indexGuessInv[nStart];
     1011        So = 0.5*(indexGuessInv[nStart + 1] + indexGuessInv[nStart]);
     1012        Sp = indexGuessInv[nStart + 1];
     1013    } else if (nStart == N_INDEX_GUESS_INV - 1) {
     1014        Sp = indexGuessInv[nStart];
     1015        So = 0.5*(indexGuessInv[nStart - 1] + indexGuessInv[nStart]);
     1016        Sm = indexGuessInv[nStart - 1];
     1017    } else {
     1018        Sm = 0.5*(indexGuessInv[nStart - 1] + indexGuessInv[nStart]);
     1019        So = indexGuessInv[nStart];
     1020        Sp = 0.5*(indexGuessInv[nStart + 1] + indexGuessInv[nStart]);
     1021    }
     1022   
     1023    PAR[PM_PAR_7] = Sm;
    10091024    pmSourceFitPCM (pcm, source, &options, maskVal, markVal, psfSize);
    10101025    if (EXTRA_VERBOSE) fprintf (stderr, "%d >>> %d %f : %f - %f %f - %f %f %f - %f\n", source->id, model->nIter, model->chisqNorm, PAR[7], PAR[2], PAR[3], PAR[4], PAR[5], PAR[6], PAR[1]);
     
    10121027    psVectorAppend (chi2, model->chisqNorm);
    10131028
    1014     PAR[PM_PAR_7] = (nStart < N_INDEX_GUESS_INV - 1) ? 0.5*(indexGuessInv[nStart + 1] + indexGuessInv[nStart]) : indexGuessInv[nStart - 1];
     1029    PAR[PM_PAR_7] = So;
    10151030    pmSourceFitPCM (pcm, source, &options, maskVal, markVal, psfSize);
    10161031    if (EXTRA_VERBOSE) fprintf (stderr, "%d >>> %d %f : %f - %f %f - %f %f %f - %f\n", source->id, model->nIter, model->chisqNorm, PAR[7], PAR[2], PAR[3], PAR[4], PAR[5], PAR[6], PAR[1]);
     
    10181033    psVectorAppend (chi2, model->chisqNorm);
    10191034
    1020     PAR[PM_PAR_7] = (nStart > 0) ? 0.5*(indexGuessInv[nStart - 1] + indexGuessInv[nStart]) : indexGuessInv[nStart + 1];
     1035    PAR[PM_PAR_7] = Sp;
    10211036    pmSourceFitPCM (pcm, source, &options, maskVal, markVal, psfSize);
    10221037    if (EXTRA_VERBOSE) fprintf (stderr, "%d >>> %d %f : %f - %f %f - %f %f %f - %f\n", source->id, model->nIter, model->chisqNorm, PAR[7], PAR[2], PAR[3], PAR[4], PAR[5], PAR[6], PAR[1]);
     
    10361051    float Smin = -0.5 * poly->coeff[1] / poly->coeff[2] / 100.0;
    10371052
    1038     // constrain Smin to be in a valid range (1.0 - 0.1, corresponding to 0.5 (Gauss) to 5.0 (slightly peakier than Dev)
    1039     Smin = PS_MAX(PS_MIN(Smin, 1.0), 0.1);
     1053    // constrain Smin to be in a valid range: allow the fitted range to go a bit beyond the 3 trial points, but no further
     1054    float Smx = Sm - 0.25*(So - Sm);
     1055    float Spx = Sp + 0.25*(Sp - So);
     1056    Smin = PS_MAX(PS_MIN(Smin, Smx), Spx);
    10401057    PAR[PM_PAR_7] = Smin;
    10411058
     
    12491266
    12501267    // loop over Reff, keeping the ARatio and Theta constant
    1251     for (int j = -20; j < 21; j++) {
    1252 
    1253         float dref = j * 0.02;
     1268    for (int j = -4; j <= 4; j++) {
     1269
     1270        float dref = j * 0.01;
    12541271
    12551272        psEllipseAxes guessAxes;
     
    13061323            rMin = dref;
    13071324        }
    1308         fprintf (stderr, "%d | %f %f %f | %f %f %f\n", j, dref, Io, Chisq, rMin, iMin, xMin);
     1325        // fprintf (stderr, "%d | %f %f %f | %f %f %f\n", j, dref, Io, Chisq, rMin, iMin, xMin);
    13091326    }
    13101327
Note: See TracChangeset for help on using the changeset viewer.