IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34378


Ignore:
Timestamp:
Sep 2, 2012, 1:10:10 PM (14 years ago)
Author:
eugene
Message:

add satstar profile operations (add & sub profile and/or noise at appropriate locations; skip stars with profiles for some analysis steps, etc; some mods to visualization for testing

Location:
branches/eam_branches/ipp-20120805/psphot/src
Files:
17 edited

Legend:

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

    r34368 r34378  
    513513    );
    514514
     515bool psphotSatstarProfileModel (pmSource *source, psImageMaskType maskVal);
     516bool psphotSatstarProfileCreate (pmSource *source, psVector **logRmodelOut, psVector **logFmodelOut, psVector *logR, psVector *flux, float Rmax);
     517bool psphotSatstarProfileOp (pmSource *source, psImageMaskType maskVal, float FACTOR, pmModelOpMode mode, bool add);
     518bool psphotVisualRadialProfileSatstar (pmSource *source, psImageMaskType maskVal);
     519bool psphotAddOrSubSatstarsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int fileIndex, psMetadata *recipe, bool add);
     520bool psphotSatstarPhotometry (pmSource *source);
     521
    515522#endif
  • branches/eam_branches/ipp-20120805/psphot/src/psphotAddNoise.c

    r33980 r34378  
    7676    }
    7777
     78    psphotVisualShowImage (readout);
     79
    7880    // loop over all source
    7981    for (int i = 0; i < sources->n; i++) {
    8082        pmSource *source = sources->data[i];
     83
     84        // add or subtract noise for a saturated star.  satstars modeled as a radial profile
     85        // need special handling
     86        if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) {
     87            psphotSatstarProfileOp (source, maskVal, FACTOR, PM_MODEL_OP_NOISE, add);
     88            continue;
     89        }
    8190
    8291        // skip sources which were not subtracted
     
    92101    }
    93102
     103    psphotVisualShowImage (readout);
     104
    94105    return true;
    95106}
  • branches/eam_branches/ipp-20120805/psphot/src/psphotApResid.c

    r33089 r34378  
    200200        if (source->mode &  PM_SOURCE_MODE_FAIL) SKIPSTAR ("FAIL STAR");
    201201        if (source->mode &  PM_SOURCE_MODE_POOR) SKIPSTAR ("POOR STAR");
     202
     203        // skip saturated stars modeled with a radial profile
     204        if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) SKIPSTAR ("SATSTAR");
    202205
    203206        if (source->mode &  PM_SOURCE_MODE_EXT_LIMIT) SKIPSTAR ("EXTENDED");
  • branches/eam_branches/ipp-20120805/psphot/src/psphotBlendFit.c

    r34258 r34378  
    241241        pmSource *source = sources->data[i];
    242242
    243 # if (0)
    244 # define TEST_X 34
    245 # define TEST_Y 28
    246    
     243        int TEST_ON = false;
     244# if (1)
     245# define TEST_X 653
     246# define TEST_Y 466
    247247        if ((fabs(source->peak->xf - TEST_X) < 5) && (fabs(source->peak->yf - TEST_Y) < 5)) {
    248248            fprintf (stderr, "test object\n");
    249         }
    250 
     249            //  psTraceSetLevel("psLib.math.psMinimizeLMChi2", 5);
     250            TEST_ON = true;
     251        }
    251252# undef TEST_X
    252253# undef TEST_Y
     
    258259        if (source->type == PM_SOURCE_TYPE_DEFECT) continue;
    259260        if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
     261
     262        // skip saturated stars modeled with a radial profile
     263        if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue;
    260264
    261265        // skip DBL second sources (ie, added by psphotFitBlob
     
    306310        if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) {
    307311            if (psphotFitBlob (readout, source, newSources, psf, fitOptions, maskVal, markVal)) {
     312                if (TEST_ON) {
     313                    psTraceSetLevel("psLib.math.psMinimizeLMChi2", 0);
     314                }
    308315                psTrace ("psphot", 5, "source at %7.1f, %7.1f is ext", source->peak->xf, source->peak->yf);
    309316                Next ++;
     
    312319        } else {
    313320            if (psphotFitBlend (readout, source, psf, fitOptions, maskVal, markVal)) {
     321                if (TEST_ON) {
     322                    psTraceSetLevel("psLib.math.psMinimizeLMChi2", 0);
     323                }
    314324                source->type = PM_SOURCE_TYPE_STAR;
    315325                psTrace ("psphot", 5, "source at %7.1f, %7.1f is psf", source->peak->xf, source->peak->yf);
  • branches/eam_branches/ipp-20120805/psphot/src/psphotExtendedSourceAnalysis.c

    r33089 r34378  
    218218        if (source->mode & PM_SOURCE_MODE_SATSTAR) continue;
    219219
     220        // skip saturated stars modeled with a radial profile
     221        if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue;
     222
    220223        // optionally allow non-extended objects to get petrosians as well
    221224        if (!doPetroStars) {
  • branches/eam_branches/ipp-20120805/psphot/src/psphotExtendedSourceFits.c

    r34258 r34378  
    317317        if (source->type == PM_SOURCE_TYPE_DEFECT) continue;
    318318        if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
     319
     320        // skip saturated stars modeled with a radial profile
     321        if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue;
    319322
    320323        // XXX this should use peak?
  • branches/eam_branches/ipp-20120805/psphot/src/psphotFindDetections.c

    r33914 r34378  
    120120    if (useFootprints) {
    121121        if (replaceSourcesForFootprints) {
     122            // subtract the noise for all sources including satstars
    122123            psphotAddOrSubNoiseReadout(config, view, filerule, index, recipe, false);
    123124            psphotReplaceAllSourcesReadout (config, view, filerule, index, recipe, false);
     125
     126            // add in the satstars
     127            psphotAddOrSubSatstarsReadout (config, view, filerule, index, recipe, true);
     128
    124129            psFree (significance);
    125130            significance = psphotSignificanceImage (readout, recipe, maskVal);
     131
     132            // display the significance image
     133            psphotVisualShowSignificance (significance->variance, 0.98*threshold, 1.02*threshold);
    126134        }
    127135
     
    130138        if (replaceSourcesForFootprints) {
    131139            psphotRemoveAllSourcesReadout (config, view, filerule, index, recipe, false);
     140
     141            // subtract the satstars
     142            psphotAddOrSubSatstarsReadout (config, view, filerule, index, recipe, false);
    132143        }
    133144    }
  • branches/eam_branches/ipp-20120805/psphot/src/psphotFitSourcesLinear.c

    r34274 r34378  
    222222        if (source->type == PM_SOURCE_TYPE_DEFECT) continue;
    223223        if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
     224
     225        // skip saturated stars modeled with a radial profile
     226        if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue;
    224227
    225228        // do not include CRs in the full ensemble fit
  • branches/eam_branches/ipp-20120805/psphot/src/psphotGuessModels.c

    r33089 r34378  
    169169        source->tmpFlags |= PM_SOURCE_TMPF_MODEL_GUESS;
    170170
    171         // skip non-astronomical objects (very likely defects)
    172         if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) continue;
     171        // skip non-astronomical objects (very likely defects) and satstars with profiles subtracted
     172        if (source->mode  & PM_SOURCE_MODE_MOMENTS_FAILURE) continue;
     173        if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue;
    173174        if (source->type == PM_SOURCE_TYPE_DEFECT) continue;
    174175        if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
  • branches/eam_branches/ipp-20120805/psphot/src/psphotKronIterate.c

    r33964 r34378  
    309309            if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) continue;
    310310
     311            // skip saturated stars modeled with a radial profile
     312            if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue;
     313
    311314            // replace object in image
    312315            bool reSubtract = false;
  • branches/eam_branches/ipp-20120805/psphot/src/psphotMagnitudes.c

    r33089 r34378  
    182182        if (saveTest) {
    183183            psphotSaveImage(NULL, testImage, "test.image.1.fits");
     184        }
     185
     186        // satstars modeled as a radial profile need special handling
     187        if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) {
     188            psphotSatstarPhotometry (source);
     189            continue;
    184190        }
    185191
  • branches/eam_branches/ipp-20120805/psphot/src/psphotRadialApertures.c

    r34136 r34378  
    240240        if (source->mode & PM_SOURCE_MODE_DEFECT) continue;
    241241
     242        // skip saturated stars modeled with a radial profile
     243        if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue;
     244
    242245        // XXX measure radial apertures even for saturated stars
    243246        // if (source->mode & PM_SOURCE_MODE_SATSTAR) continue;
  • branches/eam_branches/ipp-20120805/psphot/src/psphotRadialProfileWings.c

    r33839 r34378  
    190190        if (!source->moments) continue;
    191191
     192        // skip saturated stars modeled with a radial profile
     193        if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue;
     194
     195        // skip non-detected sources matched from other images
     196        if (source->mode2 & PM_SOURCE_MODE2_MATCHED) return true; // skip matched sources (no signal)
     197
     198        // XXX unclear if I should run this analysis on both 1st and 2nd pass for 1st pass objects,
     199        // or just use the 1st pass value.  I think I should just use the 1st pass value, so skip
     200        // any that have already been assigned
     201        if (isfinite(source->skyRadius)) return true;
     202
    192203        // replace object in image
    193204        bool reSubtract = false;
     
    226237
    227238    // psImageMaskType **vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA;
    228 
    229     // XXX unclear if I should run this analysis on both 1st and 2nd pass for 1st pass objects,
    230     // or just use the 1st pass value.  I think I should just use the 1st pass value, so skip
    231     // any that have already been assigned
    232     if (isfinite(source->skyRadius)) return true;
    233 
    234     if (source->mode2 & PM_SOURCE_MODE2_MATCHED) return true; // skip matched sources (no signal)
    235239
    236240    // radii will be MIN_RADIUS to MAX_RADIUS in NN log steps:
  • branches/eam_branches/ipp-20120805/psphot/src/psphotReadout.c

    r34368 r34378  
    143143    }
    144144
    145     // find blended neighbors of very saturated stars (detections->newSources)
     145    // find and subtract radial profile models for saturated stars (XXX change name eventually)
    146146    if (!psphotDeblendSatstars (config, view, filerule)) {
    147147        psError (PSPHOT_ERR_UNKNOWN, false, "failed on satstar deblend analysis");
     
    221221    // NOTE: this block performs the 2nd pass low-significance PSF detection stage
    222222    {
    223         // add noise for subtracted objects
     223        // add noise for subtracted objects & subtracted saturated stars
    224224        psphotAddNoise (config, view, filerule); // pass 1 (detections->allSources)
    225225
     
    253253        // merge the newly selected sources into the existing list
    254254        // NOTE: merge OLD and NEW
    255         // XXX check on free of sources...
    256255        psphotMergeSources (config, view, filerule); // (detections->newSources + detections->allSources -> detections->allSources)
    257256
     
    294293        // merge the newly selected sources into the existing list
    295294        // NOTE: merge OLD and NEW
    296         // XXX check on free of sources...
    297295        psphotMergeSources (config, view, filerule); // (detections->newSources + detections->allSources -> detections->allSources)
    298296
  • branches/eam_branches/ipp-20120805/psphot/src/psphotSourceSize.c

    r34258 r34378  
    498498            continue;
    499499        }
     500
     501        // skip saturated stars modeled with a radial profile
     502        if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue;
    500503
    501504        // we are classifying by moments and PSF_MAG - KRON_MAG
  • branches/eam_branches/ipp-20120805/psphot/src/psphotSourceStats.c

    r33840 r34378  
    447447        }
    448448
     449        // skip saturated stars modeled with a radial profile (this probably never happens, since it is set after)
     450        if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue;
     451
    449452        if (!(source->peak->type == PM_PEAK_SUSPECT_SATURATION)) {
    450453            // measure basic source moments (no S/N clipping on input pixels)
  • branches/eam_branches/ipp-20120805/psphot/src/psphotVisual.c

    r34368 r34378  
    262262}
    263263
     264static psImage *posImage = NULL;
     265static psImage *delImage = NULL;
     266
    264267bool psphotVisualShowImage (pmReadout *readout) {
    265268
     
    277280    psphotVisualScaleImage (kapa, readout->variance, readout->mask, "variance", 1.0, 1);
    278281    psphotVisualScaleImage (kapa, readout->image, readout->mask, "image", sqrt(factor), 0);
     282
     283    if (posImage == NULL) {
     284        posImage = psImageCopy (NULL, readout->image, PS_TYPE_F32);
     285    }
    279286
    280287    pmVisualAskUser(NULL);
     
    25802587    }
    25812588
    2582     if (reshow) {
     2589    if (false && reshow) {
    25832590        psphotVisualShowMask (myKapa, readout->mask, "mask", 2);
    25842591        psphotVisualScaleImage (myKapa, readout->variance, readout->mask, "variance", 1.0, 1);
    25852592    }
    2586     psphotVisualScaleImage (myKapa, readout->image, readout->mask, "resid", sqrt(factor), 0);
     2593
     2594    if (posImage) {
     2595        delImage = (psImage *) psBinaryOp(delImage, posImage, "-", readout->image);
     2596        psphotVisualScaleImage (myKapa, posImage, readout->mask, "posimage", sqrt(factor), 0);
     2597        psphotVisualScaleImage (myKapa, delImage, readout->mask, "delimage", sqrt(factor), 2);
     2598    }
     2599
     2600    psphotVisualScaleImage (myKapa, readout->image, readout->mask, "resid", sqrt(factor), 1);
    25872601
    25882602    pmVisualAskUser(NULL);
Note: See TracChangeset for help on using the changeset viewer.