IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 9, 2010, 10:56:32 AM (16 years ago)
Author:
eugene
Message:

changed pmSourceFitModel and related APIs to pass a structure of fit options; this lets us change the options between soruces within the multithreaded context; also re-organized the include orders to avoid conflicts

Location:
branches/eam_branches/ipp-20100621/psphot/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/psphot/src/psphot.h

    r28013 r28643  
    211211bool            psphotInitLimitsPSF (psMetadata *recipe, pmReadout *readout);
    212212bool            psphotInitLimitsEXT (psMetadata *recipe);
    213 bool            psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, psImageMaskType maskVal, psImageMaskType markVal);
    214 bool            psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf, psImageMaskType maskVal, psImageMaskType markVal);
    215 bool            psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, psImageMaskType maskVal, psImageMaskType markVal);
    216 pmModel        *psphotFitEXT (pmReadout *readout, pmSource *source, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal);
    217 psArray        *psphotFitDBL (pmReadout *readout, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
     213bool            psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal);
     214bool            psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal);
     215bool            psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal);
     216pmModel        *psphotFitEXT (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal);
     217psArray        *psphotFitDBL (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal);
    218218
    219219// functions to support simultaneous multi-source fitting
     
    252252bool            psphotVisualShowBackground (pmConfig *config, const pmFPAview *view, pmReadout *readout);
    253253bool            psphotVisualShowSignificance (psImage *image, float min, float max);
     254bool            psphotVisualShowLogSignificance (psImage *image, float min, float max);
    254255bool            psphotVisualShowPeaks (pmDetections *detections);
    255256bool            psphotVisualShowFootprints (pmDetections *detections);
  • branches/eam_branches/ipp-20100621/psphot/src/psphotBlendFit.c

    r28405 r28643  
    7575
    7676    // Define source fitting parameters for extended source fits
    77     pmSourceFitModelInit(fitIter, fitTol, PS_SQR(skySig), poisson);
     77    pmSourceFitOptions *fitOptions = pmSourceFitOptionsAlloc();
     78    fitOptions->nIter         = fitIter;
     79    fitOptions->tol           = fitTol;
     80    fitOptions->poissonErrors = poisson;
     81    fitOptions->weight        = PS_SQR(skySig);
     82    fitOptions->mode          = PM_SOURCE_FIT_PSF;
    7883
    7984    psphotInitLimitsPSF (recipe, readout);
     
    8893    if (!sources->n) {
    8994        psLogMsg ("psphot", PS_LOG_INFO, "no sources, skipping blend");
     95        psFree (fitOptions);
    9096        return true;
    9197    }
     
    112118            psArrayAdd(job->args, 1, psf);
    113119            psArrayAdd(job->args, 1, newSources); // return for new sources
     120            psArrayAdd(job->args, 1, fitOptions); // default fit options
    114121            psFree (newSources);
    115122
     
    121128            if (!psThreadJobAddPending(job)) {
    122129                psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
     130                psFree (fitOptions);
    123131                return NULL;
    124132            }
    125 
    126 # if (0)
    127             {
    128                 int nfit = 0;
    129                 int npsf = 0;
    130                 int next = 0;
    131                 int nfail = 0;
    132                 psArray *newSources = psArrayAllocEmpty(16);
    133 
    134                 if (!psphotBlendFit_Unthreaded (&nfit, &npsf, &next, &nfail, readout, recipe, cells->data[j], psf, newSources)) {
    135                     psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
    136                     return NULL;
    137                 }
    138                 Nfit += nfit;
    139                 Npsf += npsf;
    140                 Next += next;
    141                 Nfail += nfail;
    142 
    143                 // add these back onto sources
    144                 for (int k = 0; k < newSources->n; k++) {
    145                     psArrayAdd (sources, 16, newSources->data[k]);
    146                 }
    147                 psFree (newSources);
    148             }
    149 # endif
    150133        }
    151134
     
    153136        if (!psThreadPoolWait (false)) {
    154137            psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
     138            psFree (fitOptions);
    155139            return NULL;
    156140        }
     
    163147            } else {
    164148                psScalar *scalar = NULL;
    165                 scalar = job->args->data[5];
     149                scalar = job->args->data[6];
    166150                Nfit += scalar->data.S32;
    167                 scalar = job->args->data[6];
     151                scalar = job->args->data[7];
    168152                Npsf += scalar->data.S32;
    169                 scalar = job->args->data[7];
     153                scalar = job->args->data[8];
    170154                Next += scalar->data.S32;
    171                 scalar = job->args->data[8];
     155                scalar = job->args->data[9];
    172156                Nfail += scalar->data.S32;
    173157
     
    186170      psphotSaveImage (NULL, readout->image,  "image.v2.fits");
    187171    }
     172    psFree (fitOptions);
    188173
    189174    psLogMsg ("psphot.psphotBlendFit", PS_LOG_INFO, "fit models: %f sec for %d objects (%d psf, %d ext, %d failed, %ld skipped)\n", psTimerMark ("psphot.fit.nonlinear"), Nfit, Npsf, Next, Nfail, sources->n - Nfit);
     
    204189    psScalar *scalar = NULL;
    205190
    206     pmReadout *readout  = job->args->data[0];
    207     psMetadata *recipe  = job->args->data[1];
    208     psArray *sources    = job->args->data[2];
    209     pmPSF *psf          = job->args->data[3];
    210     psArray *newSources = job->args->data[4];
     191    pmReadout *readout             = job->args->data[0];
     192    psMetadata *recipe             = job->args->data[1];
     193    psArray *sources               = job->args->data[2];
     194    pmPSF *psf                     = job->args->data[3];
     195    psArray *newSources            = job->args->data[4];
     196    pmSourceFitOptions *fitOptions = job->args->data[5];
    211197
    212198    // bit-masks to test for good/bad pixels
     
    269255        Nfit ++;
    270256
     257        if (0) {
     258            psF32 Mxx = source->moments->Mxx;
     259            psF32 Myy = source->moments->Myy;
     260            fprintf (stderr, "1: Mxx: %f, Myy: %f\n", Mxx, Myy);
     261        }
     262
    271263        // try fitting PSFs or extended sources depending on source->mode
    272264        // these functions subtract the resulting fitted source
    273265        if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) {
    274             if (psphotFitBlob (readout, source, newSources, psf, maskVal, markVal)) {
     266            if (psphotFitBlob (readout, source, newSources, psf, fitOptions, maskVal, markVal)) {
    275267                source->type = PM_SOURCE_TYPE_EXTENDED;
    276268                psTrace ("psphot", 5, "source at %7.1f, %7.1f is ext", source->peak->xf, source->peak->yf);
     
    280272            }
    281273        } else {
    282             if (psphotFitBlend (readout, source, psf, maskVal, markVal)) {
     274            if (psphotFitBlend (readout, source, psf, fitOptions, maskVal, markVal)) {
    283275                source->type = PM_SOURCE_TYPE_STAR;
    284276                psTrace ("psphot", 5, "source at %7.1f, %7.1f is psf", source->peak->xf, source->peak->yf);
     
    289281        }
    290282
     283        if (0) {
     284            psF32 Mxx = source->moments->Mxx;
     285            psF32 Myy = source->moments->Myy;
     286            fprintf (stderr, "2: Mxx: %f, Myy: %f\n", Mxx, Myy);
     287        }
     288
    291289        psTrace ("psphot", 5, "source at %7.1f, %7.1f failed", source->peak->xf, source->peak->yf);
    292290        Nfail ++;
     
    298296
    299297    // change the value of a scalar on the array (wrap this and put it in psArray.h)
    300     scalar = job->args->data[5];
     298    scalar = job->args->data[6];
    301299    scalar->data.S32 = Nfit;
    302300
    303     scalar = job->args->data[6];
     301    scalar = job->args->data[7];
    304302    scalar->data.S32 = Npsf;
    305303
    306     scalar = job->args->data[7];
     304    scalar = job->args->data[8];
    307305    scalar->data.S32 = Next;
    308306
    309     scalar = job->args->data[8];
     307    scalar = job->args->data[9];
    310308    scalar->data.S32 = Nfail;
    311309
  • branches/eam_branches/ipp-20100621/psphot/src/psphotChoosePSF.c

    r28013 r28643  
    7474
    7575    // structure to store user options defining the psf
    76     pmPSFOptions *options = pmPSFOptionsAlloc ();
     76    pmPSFOptions *options = pmPSFOptionsAlloc();
    7777
    7878    // load user options from the recipe. no need to check existence -- they are
     
    143143        return false;
    144144    }
    145     pmSourceFitModelInit(fitIter, fitTol, PS_SQR(SKY_SIG), options->poissonErrorsPhotLMM);
    146 
     145
     146    // options which modify the behavior of the model fitting
     147    options->fitOptions                = pmSourceFitOptionsAlloc();
     148    options->fitOptions->nIter         = fitIter;
     149    options->fitOptions->tol           = fitTol;
     150    options->fitOptions->poissonErrors = options->poissonErrorsPhotLMM;
     151    options->fitOptions->weight        = PS_SQR(SKY_SIG);
     152    options->fitOptions->mode          = PM_SOURCE_FIT_PSF;
     153   
    147154    psArray *stars = psArrayAllocEmpty (sources->n);
    148155
  • branches/eam_branches/ipp-20100621/psphot/src/psphotExtendedSourceFits.c

    r28013 r28643  
    129129    sources = psArraySort (sources, pmSourceSortBySN);
    130130
     131    // Define source fitting parameters for extended source fits
     132    pmSourceFitOptions *fitOptions = pmSourceFitOptionsAlloc();
     133    fitOptions->mode          = PM_SOURCE_FIT_EXT;
     134    // XXX for now, use the defaults for the rest:
     135    // fitOptions->nIter         = fitIter;
     136    // fitOptions->tol           = fitTol;
     137    // fitOptions->poissonErrors = poisson;
     138    // fitOptions->weight        = PS_SQR(skySig);
     139
    131140    // choose the sources of interest
    132141    for (int i = 0; i < sources->n; i++) {
     
    215224              psFree (source->modelFlux);
    216225              source->modelFlux = NULL;
    217               modelFit = psphotFitEXT (readout, source, modelType, maskVal, markVal);
     226              modelFit = psphotFitEXT (readout, source, fitOptions, modelType, maskVal, markVal);
    218227              if (!modelFit) {
    219228                  psTrace ("psphot", 5, "failed to fit plain model for object at %f, %f", source->moments->Mx, source->moments->My);
     
    311320        }
    312321    }
     322    psFree (fitOptions);
    313323
    314324    psLogMsg ("psphot", PS_LOG_INFO, "extended source analysis: %f sec for %d objects\n", psTimerMark ("psphot"), Next);
  • branches/eam_branches/ipp-20100621/psphot/src/psphotFindDetections.c

    r28013 r28643  
    9090    psphotVisualShowSignificance (significance, -1.0, PS_SQR(3.0*NSIGMA_PEAK));
    9191
    92     // XXX getting some strange results from significance image
    93     if (0) {
    94         psImage *lsig = (psImage *) psUnaryOp (NULL, significance, "log");
    95         psphotVisualShowSignificance (lsig, 0.0, 4.0);
    96         psFree (lsig);
    97     }   
     92    // display the log significance image
     93    psphotVisualShowLogSignificance (significance, 0.0, 4.5);
    9894
    9995    // detect the peaks in the significance image
  • branches/eam_branches/ipp-20100621/psphot/src/psphotFitSet.c

    r21183 r28643  
    2424    }
    2525
     26    // Define source fitting parameters for extended source fits
     27    pmSourceFitOptions *fitOptions = pmSourceFitOptionsAlloc();
     28    fitOptions->mode          = PM_SOURCE_FIT_EXT;
     29    // XXX for now, use the defaults for the rest:
     30    // fitOptions->nIter         = fitIter;
     31    // fitOptions->tol           = fitTol;
     32    // fitOptions->poissonErrors = poisson;
     33    // fitOptions->weight        = PS_SQR(skySig);
     34
    2635    // XXX pmSourceFitSet must cache the modelFlux?
    27     pmSourceFitSet (source, modelSet, mode, maskVal);
     36    pmSourceFitSet (source, modelSet, fitOptions, maskVal);
    2837
    2938    // write out positive object
  • branches/eam_branches/ipp-20100621/psphot/src/psphotReadout.c

    r28398 r28643  
    5353    }
    5454
    55     // load the psf model, if suppled.  FWHM_X,FWHM_Y,etc are determined and saved on
    56     // readout->analysis XXX this function currently only works with a single PSPHOT.INPUT
     55    // load the psf model, if suppled.  FWHM_MAJ,FWHM_MIN,etc are determined and saved on
     56    // readout->analysis. XXX Note: this function currently only works with a single
     57    // PSPHOT.INPUT
    5758    if (!psphotLoadPSF (config, view)) { // ??? need to supply 2 ?
    5859        psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model");
  • branches/eam_branches/ipp-20100621/psphot/src/psphotSetThreads.c

    r26894 r28643  
    3030    psFree(task);
    3131
    32     task = psThreadTaskAlloc("PSPHOT_BLEND_FIT", 9);
     32    task = psThreadTaskAlloc("PSPHOT_BLEND_FIT", 10);
    3333    task->function = &psphotBlendFit_Threaded;
    3434    psThreadTaskAdd(task);
  • branches/eam_branches/ipp-20100621/psphot/src/psphotSourceFits.c

    r26894 r28643  
    22
    33// given a source with an existing modelPSF, attempt a full PSF fit, subtract if successful
    4 // XXX this function does not call pmSourceFitModelInit : fix this?
    54
    65static int NfitPSF = 0;
     
    2221}
    2322
    24 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, psImageMaskType maskVal, psImageMaskType markVal) {
     23bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal) {
    2524
    2625    float x, y, dR;
     26
     27    pmSourceFitOptions options = *fitOptions;
    2728
    2829    // maskVal is used to test for rejected pixels, and must include markVal
     
    3132    // if this source is not a possible blend, just fit as PSF
    3233    if ((source->blends == NULL) || (source->mode & PM_SOURCE_MODE_SATSTAR)) {
    33         bool status = psphotFitPSF (readout, source, psf, maskVal, markVal);
     34        bool status = psphotFitPSF (readout, source, psf, fitOptions, maskVal, markVal);
    3435        return status;
    3536    }
     
    9192
    9293    // fit PSF model
    93     pmSourceFitSet (source, modelSet, PM_SOURCE_FIT_PSF, maskVal);
     94    options.mode = PM_SOURCE_FIT_PSF;
     95    pmSourceFitSet (source, modelSet, &options, maskVal);
    9496
    9597    // clear the circular mask
     
    154156}
    155157
    156 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, psImageMaskType maskVal, psImageMaskType markVal) {
     158bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal) {
    157159
    158160    double chiTrend;
     161    pmSourceFitOptions options = *fitOptions;
    159162
    160163    // maskVal is used to test for rejected pixels, and must include markVal
     
    171174
    172175    // fit PSF model (set/unset the pixel mask)
    173     pmSourceFitModel (source, PSF, PM_SOURCE_FIT_PSF, maskVal);
     176    options.mode = PM_SOURCE_FIT_PSF;
     177    pmSourceFitModel (source, PSF, &options, maskVal);
    174178
    175179    if (!isfinite(PSF->params->data.F32[PM_PAR_I0])) psAbort("nan in fit");
     
    213217}
    214218
    215 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *newSources, pmPSF *psf, psImageMaskType maskVal, psImageMaskType markVal) {
     219bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *newSources, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal) {
    216220
    217221    bool okEXT, okDBL;
     
    246250
    247251    // XXX need to handle failures better here
    248     EXT = psphotFitEXT (readout, source, modelTypeEXT, maskVal, markVal);
     252    EXT = psphotFitEXT (readout, source, fitOptions, modelTypeEXT, maskVal, markVal);
    249253    if (!EXT) goto escape;
    250254    if (!isfinite(EXT->params->data.F32[PM_PAR_I0])) goto escape;
     
    254258
    255259    // DBL will always be defined, but DBL->data[n] might not
    256     DBL = psphotFitDBL (readout, source, maskVal, markVal);
     260    DBL = psphotFitDBL (readout, source, fitOptions, maskVal, markVal);
    257261    if (!DBL) goto escape;
    258262    if (!DBL->n) goto escape;
     
    379383
    380384// fit a double PSF source to an extended blob
    381 psArray *psphotFitDBL (pmReadout *readout, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) {
     385psArray *psphotFitDBL (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal) {
    382386
    383387    float dx, dy;
     
    387391    psEllipseMoments moments;
    388392    psArray *modelSet;
     393
     394    pmSourceFitOptions options = *fitOptions;
    389395
    390396    NfitDBL ++;
     
    426432
    427433    // fit PSF model (set/unset the pixel mask)
    428     pmSourceFitSet (source, modelSet, PM_SOURCE_FIT_PSF, maskVal);
     434    options.mode = PM_SOURCE_FIT_PSF;
     435    pmSourceFitSet (source, modelSet, &options, maskVal);
    429436    return (modelSet);
    430437}
    431438
    432 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal) {
     439pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal) {
     440
     441    pmSourceFitOptions options = *fitOptions;
    433442
    434443    NfitEXT ++;
     
    436445    // maskVal is used to test for rejected pixels, and must include markVal
    437446    maskVal |= markVal;
     447
     448    psTraceSetLevel("psLib.math.psMinimizeLMChi2", 5);
    438449
    439450    // use the source moments, etc to guess basic model parameters
     
    448459    }
    449460
     461    // for sersic models, get the initial guess more carefully
     462    // if (modelType == pmModelClassGetType("PS_MODEL_SERSIC")) {
     463    //  psphotGuessSersic ();
     464    //  // test and return NULL on failure?
     465    // }
     466
    450467    // fit EXT (not PSF) model (set/unset the pixel mask)
    451     pmSourceFitModel (source, EXT, PM_SOURCE_FIT_EXT, maskVal);
     468    options.mode = PM_SOURCE_FIT_EXT;
     469    pmSourceFitModel (source, EXT, &options, maskVal);
     470
     471    psTraceSetLevel("psLib.math.psMinimizeLMChi2", 0);
    452472    return (EXT);
    453473}
     474
     475// A sersic model is very sensitive to the index.  attempt to find the index first by grid search in just the index
     476// bool psphotFitSersic (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal) {
     477//
     478//     assert (model->type == pmModelClassGetType("PS_MODEL_SERSIC"));
     479//
     480//
     481//     
     482//     if (!model->modelGuess(model, source)) {
     483//     }
     484//     
     485//
     486// }
  • branches/eam_branches/ipp-20100621/psphot/src/psphotSourceSize.c

    r28013 r28643  
    11# include "psphotInternal.h"
    22# include <gsl/gsl_sf_gamma.h>
     3
     4# define KRON 1
    35
    46typedef struct {
     
    197199        pmSourceSub (source, PM_MODEL_OP_FULL, options->maskVal);
    198200
     201        // XXX test: switch to kron flux
     202# if (KRON)
     203        float apMag = -2.5*log10(source->moments->KronFlux);
     204# else
    199205        float apMag = -2.5*log10(source->moments->Sum);
     206# endif
    200207        float dMag = source->psfMag - apMag;
    201208
     
    343350        pmSourceSub (source, PM_MODEL_OP_FULL, options->maskVal);
    344351
     352# if (KRON)
     353        float apMag = -2.5*log10(source->moments->KronFlux);
     354# else
    345355        float apMag = -2.5*log10(source->moments->Sum);
     356# endif
    346357        float dMag = source->psfMag - apMag;
    347358
    348359        // set nSigma to include both systematic and poisson error terms
    349360        // XXX the 'poisson error' contribution for size is probably wrong...
    350         float nSigmaMAG = (dMag - options->ApResid) / hypot(source->errMag, options->ApSysErr);
     361        // XXX add in a hard floor on the Ap Sys Err (to be a bit generous)
     362        float nSigmaMAG = (dMag - options->ApResid) / hypot(source->errMag, hypot(options->ApSysErr, 0.025));
    351363        float nSigmaMXX = (Mxx - psfClump->X) / hypot(psfClump->dX, psfClump->X*psfClump->X*source->errMag);
    352364        float nSigmaMYY = (Myy - psfClump->Y) / hypot(psfClump->dY, psfClump->Y*psfClump->Y*source->errMag);
     365
     366        fprintf (stderr, "Mxx: %f, Myy: %f, dx: %f, dy: %f, psfMag: %f, apMag: %f, dMag: %f, errMag: %f, nSigmaMag: %f\n",
     367                 Mxx, Myy, source->peak->xf - source->moments->Mx, source->peak->yf - source->moments->My,
     368                 source->psfMag, apMag, dMag, source->errMag, nSigmaMAG);
    353369
    354370        // partially-masked sources are more likely to be mis-measured PSFs
  • branches/eam_branches/ipp-20100621/psphot/src/psphotSourceStats.c

    r28440 r28643  
    11# include "psphotInternal.h"
     2void pmSourceMomentsSetVerbose(bool state);
    23
    34// convert detections to sources and measure their basic properties (moments, local sky, sky
     
    369370    maskVal |= markVal;
    370371
     372    // XXX test : pmSourceMomentsSetVerbose(true);
     373
    371374    // threaded measurement of the sources moments
    372375    int Nfail = 0;
     
    408411        // measure basic source moments (no S/N clipping on input pixels)
    409412        status = pmSourceMoments (source, RADIUS, SIGMA, 0.0, maskVal);
     413        // XXX moments / aperture test:
     414        if (0) {
     415            // clear the mask bit and set the circular mask pixels
     416            psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal));
     417            psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, 4.0*source->moments->Mrf, "OR", markVal);
     418           
     419            float apMag = NAN;
     420            pmSourcePhotometryAper (&apMag, NULL, source->pixels, source->maskObj, maskVal);
     421            fprintf (stderr, "apMag: %f, kronMag: %f\n", apMag, -2.5*log10(source->moments->KronFlux));
     422
     423            // clear the mask bit
     424            psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal));
     425        }           
    410426        if (status) {
    411427            Nmoments ++;
  • branches/eam_branches/ipp-20100621/psphot/src/psphotVisual.c

    r28435 r28643  
    228228
    229229    psphotVisualRangeImage (kapa, image, "signif", 2, min, max);
     230
     231    pmVisualAskUser(NULL);
     232    return true;
     233}
     234
     235bool psphotVisualShowLogSignificance (psImage *image, float min, float max) {
     236
     237    if (!pmVisualTestLevel("psphot.image.logsignif", 3)) return true;
     238
     239    int kapa = psphotKapaChannel (1);
     240    if (kapa == -1) return false;
     241
     242    psImage *lsig = (psImage *) psUnaryOp (NULL, image, "log");
     243    psphotVisualRangeImage (kapa, lsig, "log-signif", 2, min, max);
     244    psFree (lsig);
    230245
    231246    pmVisualAskUser(NULL);
Note: See TracChangeset for help on using the changeset viewer.