IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 14, 2006, 11:58:44 AM (20 years ago)
Author:
eugene
Message:

renamed config to recipe in lower-level functions, added pixel weights to pmSource, other cleanups

File:
1 edited

Legend:

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

    r6851 r6862  
    3333
    3434    // scaling factor
    35     int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND_XBIN");
    36     if (!status) {DX = 64;}
    37     int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND_YBIN");
    38     if (!status) {DY = 64;}
     35    int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN");
     36    int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN");
    3937
    4038    // overhang : we will balance this evenly
     
    6967
    7068            // XXX the value of the upper and lower cuts probably should be studied...
    71             modelData[iy][ix] = psImageClippedStats (subset, submask, 0xff, 0.25, 0.75) + SKY_BIAS;
     69            psStats *stats = psImageClippedStats (subset, submask, 0xff, 0.25, 0.75);
     70            modelData[iy][ix] = stats->robustMedian + SKY_BIAS;
    7271
     72            psFree (stats);
    7373            psFree (subset);
    7474            psFree (submask);
     
    8282    psLogMsg ("psphot", 3, "build median image: %f sec\n", psTimerMark ("psphot"));
    8383
    84     // XXX temporarily until we get the pmFPAfile output finished
    85     psphotSaveImage (NULL, model->image, "model.fits");
     84    // measure background stats and save for later output
     85    psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV | PS_STAT_MIN | PS_STAT_MAX);
     86    stats = psImageStats (stats, model->image, NULL, 0);
     87    psMetadataAdd (recipe, PS_LIST_TAIL, "SKY_MEAN", PS_DATA_F32 | PS_META_REPLACE, "sky model mean",          stats->sampleMean);
     88    psMetadataAdd (recipe, PS_LIST_TAIL, "SKY_STDV", PS_DATA_F32 | PS_META_REPLACE, "sky model stdev",         stats->sampleStdev);
     89    psMetadataAdd (recipe, PS_LIST_TAIL, "SKY_MAX",  PS_DATA_F32 | PS_META_REPLACE, "sky model maximum value", stats->max);
     90    psMetadataAdd (recipe, PS_LIST_TAIL, "SKY_MIN",  PS_DATA_F32 | PS_META_REPLACE, "sky model minimum value", stats->min);
     91    psMetadataAdd (recipe, PS_LIST_TAIL, "SKY_NX",   PS_DATA_S32 | PS_META_REPLACE, "sky model size (x)",      nx);
     92    psMetadataAdd (recipe, PS_LIST_TAIL, "SKY_NY",   PS_DATA_S32 | PS_META_REPLACE, "sky model size (y)",      ny);
     93    psFree (stats);
    8694
    8795    // select background pixels, from output background file, or create
     
    8997    if (background == NULL) {
    9098        background = pmFPAfileCreateInternal (config->files, "PSPHOT.BACKGND", Nx, Ny, PS_TYPE_F32);
    91     } else {
    92         // replace the supplied image data with an image of the desired size
    93         // XXX should not have to do this: it should be allocated correctly
    94         // psImageRecycle (background->image, Nx, Ny, PS_TYPE_F32);
    95     }
    96 
     99    }
    97100    psF32 **backData = background->image->data.F32;
    98101
     
    100103    psImageUnbin (background->image, model->image, DX, DY, dx, dy);
    101104    psLogMsg ("psphot", 3, "build resampled image: %f sec\n", psTimerMark ("psphot"));
    102 
    103     // XXX temporarily until we get the pmFPAfile output finished...
    104     psphotSaveImage (NULL, background->image, "back.fits");
    105105
    106106    // back-sub image pixels, from output background file (don't create if not requested)
Note: See TracChangeset for help on using the changeset viewer.