IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 13, 2014, 2:40:41 PM (12 years ago)
Author:
bills
Message:

change psphotFullForce galaxy shapes analysis to use different radius
trial values based on the signal to nosie of the source as measured
by psphotStack

File:
1 edited

Legend:

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

    r36718 r36747  
    8080    assert (markVal);
    8181
    82     // maskVal is used to test for rejected pixels, and must include markVal
    8382    maskVal |= markVal;
    8483
    85     // bit-mask to mark pixels not used in analysis
    8684    psphotGalaxyShapeOptions *opt = psphotGalaxyShapeOptionsAlloc();
     85    opt->Q = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_Q");
     86    psAssert (status, "missing GALAXY_SHAPES_Q");
     87    opt->NSigma = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_NSIGMA");
     88    psAssert (status, "missing GALAXY_SHAPES_NSIGMA");
     89    opt->clampSN = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_CLAMP_SN");
     90    psAssert (status, "missing GALAXY_SHAPES_NSIGMA");
     91
     92#ifdef notdef
    8793    opt->fRmajorMin = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_FR_MAJOR_MIN"); if (!status) opt->fRmajorMin = 0.5;
    8894    opt->fRmajorMax = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_FR_MAJOR_MAX"); if (!status) opt->fRmajorMax = 2.0;
     
    9197    opt->fRminorMax = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_FR_MINOR_MAX"); if (!status) opt->fRminorMax = 2.0;
    9298    opt->fRminorDel = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_FR_MINOR_DEL"); if (!status) opt->fRminorDel = 0.1;
     99#endif
    93100
    94101    // what fraction of the PSF is used? (radius in pixels : 2 -> 5x5 box)
     
    238245bool psphotGalaxyShapeGrid (pmSource *source, pmSourceFitOptions *fitOptions, psphotGalaxyShapeOptions *opt, psImageMaskType maskVal, int psfSize) {
    239246
     247
    240248    for (int iModel = 0 ; iModel < source->modelFits->n; iModel++) {
    241249        pmModel *model = source->modelFits->data[iModel];
     
    252260
    253261        // double check that the guess is carried along...
    254 
    255         // I have some source guess (e0, e1, e2)
    256         psEllipseAxes guessAxes = pmPSF_ModelToAxes (PAR, modelType);
    257 
    258262        if (!source->galaxyFits) {
    259263            source->galaxyFits = psArrayAllocEmpty(1);
    260             // source->galaxyFits = pmSourceGalaxyFitsAlloc();
    261264        }
    262265        pmSourceGalaxyFits *galaxyFits = pmSourceGalaxyFitsAlloc();
     
    264267        psFree(galaxyFits);
    265268
     269        // set the options for this source
     270        psphotGalaxyShapeOptionsSet(source, galaxyFits, opt);
     271
     272        // I have some source guess (e0, e1, e2)
     273        psEllipseAxes guessAxes = pmPSF_ModelToAxes (PAR, modelType);
     274
    266275        float fRmajorBest = NAN;
    267276        float fRminorBest = NAN;
    268277        float chisqBest = NAN;
    269         for (float fRmajor = opt->fRmajorMin; fRmajor < opt->fRmajorMax + 0.5*opt->fRmajorDel; fRmajor += opt->fRmajorDel) {
    270             for (float fRminor = opt->fRminorMin; fRminor < opt->fRminorMax + 0.5*opt->fRminorDel; fRminor += opt->fRminorDel) {
     278        for (float fRmajor = galaxyFits->fRmajorMin; fRmajor < galaxyFits->fRmajorMax + 0.5*galaxyFits->fRmajorDel; fRmajor += galaxyFits->fRmajorDel) {
     279            for (float fRminor = galaxyFits->fRminorMin; fRminor < galaxyFits->fRminorMax + 0.5*galaxyFits->fRminorDel; fRminor += galaxyFits->fRminorDel) {
    271280     
    272281                psEllipseAxes testAxes = guessAxes;
     
    405414    psMemSetDeallocator(opt, (psFreeFunc) psphotGalaxyShapeOptionsFree);
    406415   
     416#ifdef notdef
    407417    opt->fRmajorMin = 0.5;
    408418    opt->fRmajorMax = 2.0;
     
    411421    opt->fRminorMax = 2.0;
    412422    opt->fRminorDel = 0.1;
     423    opt->snMinAllTrials = 20;      // for sources with cff SN < 20 ...
     424    opt->reduceTrialsFactor = 2; // cut the number of trials in half (double the deltas)
     425#endif
    413426
    414427    return opt;
    415428}
    416429
     430void psphotGalaxyShapeOptionsSet(pmSource *source, pmSourceGalaxyFits *galaxyFits, psphotGalaxyShapeOptions *options)
     431{
     432    // XXX: put these in recipe
     433    // doesn't make sense to use too small of a spacing
     434    float clampedSN = source->extSN < options->clampSN ? source->extSN : options->clampSN;
     435
     436    float f_del = options->Q / clampedSN;
     437    float f_min = 1 - options->NSigma * f_del;
     438    float f_max = 1 + options->NSigma * f_del;
     439
     440    galaxyFits->fRmajorMin = f_min;
     441    galaxyFits->fRmajorMax = f_max;
     442    galaxyFits->fRmajorDel = f_del;
     443    galaxyFits->fRminorMin = f_min;
     444    galaxyFits->fRminorMax = f_max;
     445    galaxyFits->fRminorDel = f_del;
     446}
     447
Note: See TracChangeset for help on using the changeset viewer.