IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 27, 2013, 3:47:04 PM (13 years ago)
Author:
eugene
Message:

updates for psphotFullForce I/O

Location:
branches/eam_branches/ipp-20130904/psphot/src
Files:
3 edited

Legend:

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

    r36148 r36154  
    210210        if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) continue;
    211211
    212         // XXX where are we storing the supplied kron radius?
     212        // psphotSetRadiusMomentsExact sets the radius based on Mrf
    213213        if (!isfinite(source->moments->Mrf)) continue;
    214214
     215        // modelFits is allocated if a galaxy fit is requested
     216        if (!source->modelFits) continue;
     217
     218        psphotSetRadiusMomentsExact(&fitRadius, &windowRadius, readout, source, markVal); // NOTE : 6 allocs
     219
    215220        // skip saturated stars modeled with a radial profile
     221        // XXX worry about this at some point..
    216222        if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue;
    217223
     
    221227        }
    222228
    223         // XXX this is not right (use same concept as general source fit)
    224         float windowRadius = 6.0*source->moments->Mrf ;
    225 
    226         // re-allocate image, weight, mask arrays for each peak with box big enough to fit BIG_RADIUS
    227         pmSourceRedefinePixels (source, readout, source->peak->x, source->peak->y, windowRadius + 2);
    228         psAssert (source->pixels, "WTF?");
    229 
    230229        // this function populates moments->Mrf,GalaxyShape,GalaxyShapeErr
    231230        // do the following for a set of shapes (Ex,Ey)
     
    245244    pmModelType modelType = pmModelClassGetType ("PS_MODEL_EXP");
    246245
    247     pmModel *model = pmModelAlloc(modelType);
    248     if (!model) {
    249         return NULL;
    250     }
    251 
     246    pmModel *model = source->modelFits->data[0];
     247    if (!model) return false;
     248
     249    // we are using fitOptions->mode : be sure this makes sense
    252250    pmPCMdata *pcm = pmPCMinit (source, fitOptions, model, maskVal, psfSize);
    253251
     252    // we are fitting only PM_PAR_I0; the shape elements are generated from a grid
    254253    psF32 *PAR = pcm->modelConv->params->data.F32;
    255254
     255    // double check that the guess is carried along...
     256
    256257    // I have some source guess (e0, e1, e2)
    257     psEllipsePol guessPol;
     258    psEllipseAxes guessAxes = pmPSF_ModelToAxes (PAR, modelType);
     259    psEllipsePol guessPol = psEllipseAxesToPol (guessAxes);
    258260
    259261    // I am going to retain the value of e0, and grid search around e1,e2
  • branches/eam_branches/ipp-20130904/psphot/src/psphotMergeSources.c

    r36146 r36154  
    105105    {
    106106        pmReadout *readoutCMF = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT.CMF");
    107         if (!readoutCMF) goto loadTXT;
     107        if (!readoutCMF) goto loadCFF;
    108108
    109109        extCMF = psMetadataLookupPtr (NULL, readoutCMF->analysis, "PSPHOT.DETECTIONS");
     
    111111            for (int i = 0; i < extCMF->allSources->n; i++) {
    112112                pmSource *source = extCMF->allSources->data[i];
     113                source->mode |= PM_SOURCE_MODE_EXTERNAL;
     114
     115                // the supplied peak flux needs to be re-normalized
     116                source->peak->rawFlux = 1.0;
     117                source->peak->smoothFlux = 1.0;
     118                source->peak->detValue = 1.0;
     119
     120                // drop the loaded source modelPSF
     121                psFree (source->modelPSF);
     122                source->modelPSF = NULL;
     123                source->imageID = index;
     124
     125                psArrayAdd (detections->newSources, 100, source);
     126            }
     127        }
     128    }
     129
     130loadCFF:
     131    // load data from input CFF file:
     132    {
     133        pmReadout *readoutCFF = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT.CFF");
     134        if (!readoutCFF) goto loadTXT;
     135
     136        extCFF = psMetadataLookupPtr (NULL, readoutCFF->analysis, "PSPHOT.DETECTIONS");
     137        if (extCFF) {
     138            for (int i = 0; i < extCFF->allSources->n; i++) {
     139                pmSource *source = extCFF->allSources->data[i];
    113140                source->mode |= PM_SOURCE_MODE_EXTERNAL;
    114141
  • branches/eam_branches/ipp-20130904/psphot/src/psphotPetroFlux.c

    r36148 r36154  
    187187    PS_ASSERT_PTR_NON_NULL(source->peak, false);
    188188    PS_ASSERT_PTR_NON_NULL(source->pixels, false);
     189    PS_ASSERT_PTR_NON_NULL(source->variance, false);
     190    PS_ASSERT_PTR_NON_NULL(source->moments, false);
     191    PS_ASSERT_PTR_NON_NULL(source->extpars, false);
    189192
    190193    // the peak position is less accurate but less subject to extreme deviations
     
    202205    // Calculate the Petro magnitude (make this block optional?)
    203206    // XXX set the aperture here
    204     float radPetro  = 2.0*source->moments->Mrf;
     207    float radPetro  = PETROSIAN_RADII*source->extpars->petrosianRadius;
    205208    float radPetro2 = radPetro*radPetro;
    206209
     
    242245
    243246    // return the flux and error to parameters?
    244     // source->moments->PetroFlux    = Sum;
    245     // source->moments->PetroFluxErr = sqrt(Var);
     247    source->extpars->petrosianFlux    = Sum;
     248    source->extpars->petrosianFluxErr = sqrt(Var);
     249    source->extpars->petrosianFill = nPetroPix / (M_PI * radPetro2);
    246250
    247251    fprintf (stderr, "petro flux: %f +/- %f\n", Sum, sqrt(Var));
Note: See TracChangeset for help on using the changeset viewer.