IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30764


Ignore:
Timestamp:
Feb 28, 2011, 2:46:40 PM (15 years ago)
Author:
eugene
Message:

updated API for pmSourceChisq (requires covarFactor); visualization fixes

Location:
branches/eam_branches/ipp-20110213/psphot/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/psphot/src/psphotApResid.c

    r30624 r30764  
    11# include "psphotInternal.h"
     2// # define DEBUG
    23
    34# define SKIPSTAR(MSG) { psTrace ("psphot", 3, "invalid : %s", MSG); continue; }
     
    481482        if (!isfinite(source->apMag) || !isfinite(source->psfMag)) {
    482483            Nfail ++;
    483             psTrace ("psphot", 3, "fail : nan mags : %f %f", source->apMag, source->psfMag);
     484            psTrace ("psphot", 3, "fail : %f, %f : nan mags : %f %f", source->peak->xf, source->peak->yf, source->apMag, source->psfMag);
    484485            continue;
    485486        }
  • branches/eam_branches/ipp-20110213/psphot/src/psphotBlendFit.c

    r30707 r30764  
    9494    fitOptions->weight        = PS_SQR(skySig);
    9595    fitOptions->mode          = PM_SOURCE_FIT_PSF;
     96    fitOptions->covarFactor   = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix
    9697
    9798    psphotInitLimitsPSF (recipe, readout);
  • branches/eam_branches/ipp-20110213/psphot/src/psphotChoosePSF.c

    r30753 r30764  
    160160    options->fitOptions->weight        = PS_SQR(SKY_SIG);
    161161    options->fitOptions->mode          = PM_SOURCE_FIT_PSF;
     162    options->fitOptions->covarFactor   = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix
     163
    162164   
    163165    psArray *stars = psArrayAllocEmpty (sources->n);
     
    178180    psphotCheckStarDistribution (stars, sources, options);
    179181
    180     psLogMsg ("psphot.pspsf", PS_LOG_DETAIL, "selected candidate %ld PSF objects\n", stars->n);
     182    psLogMsg ("psphot.pspsf", PS_LOG_DETAIL, "selected %ld candidate PSF objects\n", stars->n);
    181183
    182184    if (stars->n < 50) {
  • branches/eam_branches/ipp-20110213/psphot/src/psphotExtendedSourceFits.c

    r30707 r30764  
    275275    // Define source fitting parameters for extended source fits
    276276    pmSourceFitOptions *fitOptions = pmSourceFitOptionsAlloc();
    277     fitOptions->mode          = PM_SOURCE_FIT_EXT;
     277    fitOptions->mode           = PM_SOURCE_FIT_EXT;
    278278    fitOptions->saveCovariance = true;  // XXX make this a user option?
     279    fitOptions->covarFactor    = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix
    279280
    280281    // XXX for now, use the defaults for the rest:
  • branches/eam_branches/ipp-20110213/psphot/src/psphotFitSet.c

    r29004 r30764  
    2727    pmSourceFitOptions *fitOptions = pmSourceFitOptionsAlloc();
    2828    fitOptions->mode          = PM_SOURCE_FIT_EXT;
     29    fitOptions->covarFactor   = 1.0;
    2930    // XXX for now, use the defaults for the rest:
    3031    // fitOptions->nIter         = fitIter;
  • branches/eam_branches/ipp-20110213/psphot/src/psphotFitSourcesLinear.c

    r30624 r30764  
    121121    // covarFactor = 1.0;
    122122
     123    int Nsat = 0;
     124
    123125    // select the sources which will be used for the fitting analysis
    124126    for (int i = 0; i < sources->n; i++) {
     
    134136        // do not include CRs in the full ensemble fit
    135137        if (source->mode & PM_SOURCE_MODE_CR_LIMIT) continue;
     138
     139        // XXX count saturated stars
     140        if (source->mode & PM_SOURCE_MODE_SATSTAR) {
     141            Nsat ++;
     142        }
    136143
    137144        if (final) {
     
    180187    psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "built fitSources: %f sec (%ld objects)\n", psTimerMark ("psphot.linear"), sources->n);
    181188
     189    fprintf (stderr, "****** Nsat : %d ********\n", Nsat);
     190
    182191    if (fitSources->n == 0) {
    183192        psFree(fitSources);
     
    305314        if (source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) continue;
    306315        pmModel *model = pmSourceGetModel (NULL, source);
    307         pmSourceChisq (model, source->pixels, source->maskObj, source->variance, maskVal, covarFactor);
     316        pmSourceChisq (model, source->pixels, source->maskObj, source->variance, maskVal, covarFactor, 1);
    308317    }
    309318    psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "get chisqs: %f sec (%d elements)\n", psTimerMark ("psphot.linear"), sparse->Nelem);
     
    324333    // We have to place this visualization here because the models are not realized until
    325334    // psphotGuessModels or fitted until psphotFitSourcesLinear.
    326     psphotVisualShowPSFStars (recipe, psf, sources);
     335    // psphotVisualShowPSFStars (recipe, psf, sources);
    327336
    328337    return true;
  • branches/eam_branches/ipp-20110213/psphot/src/psphotFitSourcesLinearStack.c

    r30624 r30764  
    165165        if (source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) continue;
    166166        pmModel *model = pmSourceGetModel (NULL, source);
    167         pmSourceChisq (model, source->pixels, source->maskObj, source->variance, maskVal, COVAR_FACTOR);
     167        pmSourceChisq (model, source->pixels, source->maskObj, source->variance, maskVal, COVAR_FACTOR, 1);
    168168    }
    169169    psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "get chisqs: %f sec (%d elements)\n", psTimerMark ("psphot.linear"), sparse->Nelem);
  • branches/eam_branches/ipp-20110213/psphot/src/psphotVisual.c

    r30753 r30764  
    845845
    846846        if (source->type != type) continue;
    847         if (mode && !(source->mode & mode)) continue;
     847
     848        if (mode == PM_SOURCE_MODE_PSFSTAR) {
     849            bool keep = false;
     850            keep |= (source->tmpFlags & PM_SOURCE_TMPF_CANDIDATE_PSFSTAR);
     851            keep |= (source->mode & PM_SOURCE_MODE_PSFSTAR);
     852            if (!keep) continue;
     853        } else {
     854            if (mode && !(source->mode & mode)) continue;
     855        }
    848856
    849857        pmMoments *moments = source->moments;
     
    13611369    graphdata.xmax = +30.05;
    13621370    graphdata.ymin = -0.05;
    1363     graphdata.ymax = +5.05;
     1371    graphdata.ymax = +8.05;
    13641372    KapaSetLimits (myKapa, &graphdata);
    13651373
     
    14211429    graphdata.xmax = +1.51;
    14221430    graphdata.ymin = -0.05;
    1423     graphdata.ymax = +5.05;
     1431    graphdata.ymax = +8.05;
    14241432    graphdata.color = KapaColorByName ("black");
    14251433    KapaSetLimits (myKapa, &graphdata);
     
    26642672    graphdata.ymax = -32.0;
    26652673
    2666     FILE *f = fopen ("chisq.dat", "w");
    2667 
    26682674    // construct the plot vectors
    26692675    int n = 0;
     
    26832689        graphdata.ymin = PS_MIN(graphdata.ymin, y->data.F32[n]);
    26842690        graphdata.ymax = PS_MAX(graphdata.ymax, y->data.F32[n]);
    2685 
    2686         fprintf (f, "%d %d %f %f\n", i, n, x->data.F32[n], y->data.F32[n]);
    2687 
    26882691        n++;
    26892692    }
    26902693    x->n = y->n = n;
    2691     fclose (f);
    26922694
    26932695    float range;
Note: See TracChangeset for help on using the changeset viewer.