IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 15, 2008, 10:25:00 AM (18 years ago)
Author:
eugene
Message:

re-organization of the named mask bit handling: pmConfigMaskSetBits now assigns the bits to names and make the recipe consistent

Location:
trunk/psModules/src/objects
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmPSF.c

    r15983 r18554  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2008-01-02 20:41:55 $
     8 *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2008-07-15 20:25:00 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    404404
    405405// we generate the growth curve for the center of the image with the specified psf model
    406 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psMaskType maskVal, psMaskType mark)
     406bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psMaskType maskVal, psMaskType markVal)
    407407{
    408408    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    416416    // create template model
    417417    pmModel *modelRef = pmModelAlloc(psf->type);
     418
     419    // maskVal is used to test for rejected pixels, and must include markVal
     420    maskVal |= markVal;
    418421
    419422    // use the center of the center pixel of the image
     
    465468
    466469        // mask the given aperture and measure the apMag
    467         psImageKeepCircle (mask, xc, yc, radius, "OR", mark);
     470        psImageKeepCircle (mask, xc, yc, radius, "OR", markVal);
    468471        if (!pmSourcePhotometryAper (&apMag, model, image, mask, maskVal)) {
    469472            psError(PM_ERR_PHOTOM, false, "Measuring apMag for radius == %g", radius);
     
    473476            break;
    474477        }
    475 
    476         // XXX since we re-mask on each pass, this could be dropped.
    477         psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8(mark));
     478        psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8(markVal));
    478479
    479480        // the 'ignore' mode is for testing
  • trunk/psModules/src/objects/pmPSFtry.c

    r18040 r18554  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2008-06-10 01:32:15 $
     7 *  @version $Revision: 1.57 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2008-07-15 20:25:00 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9898
    9999// generate a pmPSFtry with a copy of the test PSF sources
    100 pmPSFtry *pmPSFtryModel (const psArray *sources, const char *modelName, pmPSFOptions *options, psMaskType maskVal, psMaskType mark)
     100pmPSFtry *pmPSFtryModel (const psArray *sources, const char *modelName, pmPSFOptions *options, psMaskType maskVal, psMaskType markVal)
    101101{
    102102    bool status;
     
    116116        return NULL;
    117117    }
     118
     119    // maskVal is used to test for rejected pixels, and must include markVal
     120    maskVal |= markVal;
    118121
    119122    // stage 1:  fit an EXT model to all candidates PSF sources
     
    129132        }
    130133
    131         // set object mask to define valid pixels -- XXX not unset?
    132         psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", mark);
     134        // set object mask to define valid pixels
     135        psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", markVal);
    133136
    134137        // fit model as EXT, not PSF
    135138        status = pmSourceFitModel (source, source->modelEXT, PM_SOURCE_FIT_EXT, maskVal);
     139
     140        // clear object mask to define valid pixels
     141        psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_U8(markVal));
    136142
    137143        // exclude the poor fits
     
    170176        source->modelPSF->radiusFit = options->radius;
    171177
    172         // set object mask to define valid pixels -- XXX not unset?
    173         psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", mark);
     178        // set object mask to define valid pixels
     179        psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", markVal);
    174180
    175181        // fit the PSF model to the source
     
    178184        // skip poor fits
    179185        if (!status) {
     186            psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_U8(markVal));
    180187            psfTry->mask->data.U8[i] = PSFTRY_MASK_PSF_FAIL;
    181188            psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : failed PSF fit\n", i, source->peak->x, source->peak->y);
     
    183190        }
    184191
    185         // XXX : use a different aperture radius from the fit radius?
    186         status = pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP, maskVal, mark);
     192        status = pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP, maskVal);
    187193        if (!status || isnan(source->apMag)) {
     194            psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_U8(markVal));
    188195            psfTry->mask->data.U8[i] = PSFTRY_MASK_BAD_PHOT;
    189196            psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : poor photometry\n", i, source->peak->x, source->peak->y);
    190197            continue;
    191198        }
     199
     200        // clear object mask to define valid pixels
     201        psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_U8(markVal));
    192202
    193203        psfTry->fitMag->data.F32[i] = source->psfMag;
  • trunk/psModules/src/objects/pmSource.c

    r18042 r18554  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2008-06-10 02:26:17 $
     8 *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2008-07-15 20:25:00 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    838838
    839839// should we call pmSourceCacheModel if it does not exist?
    840 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add,
    841                  psMaskType maskVal, int dx, int dy)
     840bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, psMaskType maskVal, int dx, int dy)
    842841{
    843842    PS_ASSERT_PTR_NON_NULL(source, false);
  • trunk/psModules/src/objects/pmSourcePhotometry.c

    r17998 r18554  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2008-06-09 00:43:46 $
     5 *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2008-07-15 20:25:00 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6464
    6565// XXX masked region should be (optionally) elliptical
    66 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode,
    67                          psMaskType maskVal, psMaskType mark)
     66bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psMaskType maskVal)
    6867{
    6968    PS_ASSERT_PTR_NON_NULL(source, false);
     
    230229        mask = source->maskObj;
    231230    }
    232     // set aperture mask circle to model radius
    233     // XXX use a different radius for apertures and fits...
    234     // XXX can I remove this?  the source should have the mask defined when it is constructed or
    235     // when the fit / aperture radius is changed...
    236     psImageKeepCircle (source->maskObj, x, y, model->radiusFit, "OR", mark);
    237231
    238232    // measure the weight of included pixels
    239233    // XXX is this supposed to use the weight or the flux?
    240234    if (mode & PM_SOURCE_PHOT_WEIGHT) {
    241         pmSourcePixelWeight (&source->pixWeight, model, source->pixels, source->maskObj, maskVal | mark);
     235        pmSourcePixelWeight (&source->pixWeight, model, source->pixels, source->maskObj, maskVal);
    242236    }
    243237
    244238    // measure object aperture photometry
    245     status = pmSourcePhotometryAper  (&source->apMag, model, flux, mask, maskVal | mark);
     239    status = pmSourcePhotometryAper  (&source->apMag, model, flux, mask, maskVal);
    246240    if (!status) {
    247241        psTrace ("psModules.objects", 3, "fail mag : bad Ap Mag");
     
    264258        psFree(mask);
    265259    }
    266 
    267     // unmask aperture
    268     // XXX can I remove this?  this will probably break things downstream...
    269     psImageKeepCircle (source->maskObj, x, y, model->radiusFit, "AND", PS_NOT_U8(mark));
    270260
    271261    // if source was originally subtracted, re-subtract object, leave local sky
     
    308298
    309299// return source aperture magnitude
    310 bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask,
    311                              psMaskType maskVal)
     300bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal)
    312301{
    313302    PS_ASSERT_PTR_NON_NULL(apMag, false);
     
    347336
    348337// return source aperture magnitude
    349 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask,
    350                           psMaskType maskVal)
     338bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal)
    351339{
    352340    PS_ASSERT_PTR_NON_NULL(pixWeight, false);
  • trunk/psModules/src/objects/pmSourcePhotometry.h

    r13898 r18554  
    44 * @author EAM, IfA; GLG, MHPCC
    55 *
    6  * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-06-20 02:22:26 $
     6 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2008-07-15 20:25:00 $
    88 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    99 */
     
    5050
    5151bool pmSourceMagnitudesInit (psMetadata *config);
    52 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psMaskType maskVal, psMaskType mark);
     52bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psMaskType maskVal);
    5353bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal);
    5454bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, psMaskType maskVal);
  • trunk/psModules/src/objects/pmSourcePlotMoments.c

    r15562 r18554  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-11-10 01:09:20 $
     7 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2008-07-15 20:25:00 $
    99 *
    1010 *  Copyright 2006 IfA, University of Hawaii
     
    9595    graphdata.xmin = -0.05;
    9696    graphdata.ymin = -0.05;
    97     graphdata.xmax = +2.05;
    98     graphdata.ymax = +2.05;
     97    graphdata.xmax = +4.05;
     98    graphdata.ymax = +4.05;
    9999    KapaSetLimits (kapa, &graphdata);
    100100
  • trunk/psModules/src/objects/pmSourceSky.c

    r15980 r18554  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2008-01-02 20:39:04 $
     8 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2008-07-15 20:25:00 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242
    4343The source.pixels and source.mask must already exist
     44
     45This function modifies the source mask; it should only be called before the object aperture is defined
    4446*****************************************************************************/
    4547
     
    4951    psF32 Radius,
    5052    psMaskType maskVal,
    51     psMaskType mark)
     53    psMaskType markVal)
    5254{
    5355    psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     
    6971    psRegion srcRegion;
    7072
     73    // maskVal is used to test for rejected pixels, and must include markVal
     74    maskVal |= markVal;
     75
    7176    srcRegion = psRegionForSquare(peak->x, peak->y, Radius);
    7277    srcRegion = psRegionForImage(mask, srcRegion);
    7378
    74     psImageMaskRegion(mask, srcRegion, "OR", mark);
     79    psImageMaskRegion(mask, srcRegion, "OR", markVal);
    7580    psStats *myStats = psStatsAlloc(statsOptions);
    76     if (!psImageStats(myStats, image, mask, maskVal | mark)) {
     81    if (!psImageStats(myStats, image, mask, maskVal)) {
    7782        psError(PS_ERR_UNKNOWN, false, "Unable to get image statistics.\n");
    7883        psFree(myStats);
    7984        return false;
    8085    }
    81     psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_U8(mark));
     86    psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_U8(markVal));
    8287    double value = psStatsGetValue(myStats, statistic);
    8388    psFree(myStats);
     
    101106    psF32 Radius,
    102107    psMaskType maskVal,
    103     psMaskType mark
     108    psMaskType markVal
    104109)
    105110{
     
    110115    PS_ASSERT_PTR_NON_NULL(source->peak, false);
    111116    PS_ASSERT_INT_POSITIVE(Radius, false);
     117
     118    // maskVal is used to test for rejected pixels, and must include markVal
     119    maskVal |= markVal;
    112120
    113121    psStatsOptions statistic = psStatsSingleOption(statsOptions);
     
    125133    srcRegion = psRegionForImage(mask, srcRegion);
    126134
    127     psImageMaskRegion(mask, srcRegion, "OR", mark);
     135    psImageMaskRegion(mask, srcRegion, "OR", markVal);
    128136    psStats *myStats = psStatsAlloc(statsOptions);
    129     if (!psImageStats(myStats, image, mask, maskVal | mark)) {
     137    if (!psImageStats(myStats, image, mask, maskVal)) {
    130138        psError(PS_ERR_UNKNOWN, false, "Unable to get image statistics.\n");
    131139        psFree(myStats);
    132140        return false;
    133141    }
    134     psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_U8(mark));
     142    psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_U8(markVal));
    135143    double value = psStatsGetValue(myStats, statistic);
    136144    psFree(myStats);
Note: See TracChangeset for help on using the changeset viewer.