IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17336


Ignore:
Timestamp:
Apr 6, 2008, 10:12:23 AM (18 years ago)
Author:
eugene
Message:

failure on a single source should not halt processing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080324/psphot/src/psphotExtendedSourceAnalysis.c

    r17276 r17336  
    1 # include "psphot.h"
     1# include "psphotInternal.h"
    22
    33// aperture-like measurements for extended sources
     
    66    bool status;
    77    int Next = 0;
    8     int Nconvolve = 0;
    98    int Npetro = 0;
    109    int Nisophot = 0;
     
    4443    for (int i = 0; i < sources->n; i++) {
    4544
    46         pmSource *source = sources->data[i];
     45        pmSource *source = sources->data[i];
    4746
    48         // skip PSF-like and non-astronomical objects
    49         if (source->type == PM_SOURCE_TYPE_STAR) continue;
    50         if (source->type == PM_SOURCE_TYPE_DEFECT) continue;
    51         if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
     47        // skip PSF-like and non-astronomical objects
     48        if (source->type == PM_SOURCE_TYPE_STAR) continue;
     49        if (source->type == PM_SOURCE_TYPE_DEFECT) continue;
     50        if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
    5251
    53         // limit selection to some SN limit
    54         assert (source->peak); // how can a source not have a peak?
    55         if (source->peak->SN < SN_LIM) continue;
     52        // limit selection to some SN limit
     53        assert (source->peak); // how can a source not have a peak?
     54        if (source->peak->SN < SN_LIM) continue;
    5655
    57         // limit selection by analysis region
    58         if (source->peak->x < AnalysisRegion.x0) continue;
    59         if (source->peak->y < AnalysisRegion.y0) continue;
    60         if (source->peak->x > AnalysisRegion.x1) continue;
    61         if (source->peak->y > AnalysisRegion.y1) continue;
     56        // limit selection by analysis region
     57        if (source->peak->x < AnalysisRegion.x0) continue;
     58        if (source->peak->y < AnalysisRegion.y0) continue;
     59        if (source->peak->x > AnalysisRegion.x1) continue;
     60        if (source->peak->y > AnalysisRegion.y1) continue;
    6261
    63         // replace object in image
    64         if (source->mode & PM_SOURCE_MODE_SUBTRACTED) {
    65             pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal);
    66         }
    67         Next ++;
     62        // replace object in image
     63        if (source->mode & PM_SOURCE_MODE_SUBTRACTED) {
     64            pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal);
     65        }
     66        Next ++;
    6867
    6968        // if we request any of these measurements, we require the radial profile
    7069        if (doPetrosian || doIsophotal || doAnnuli || doKron) {
    71           if (!psphotRadialProfile (source, recipe, maskVal)) {
    72             psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate radial profile");
    73             return false;
    74           }
     70            if (!psphotRadialProfile (source, recipe, maskVal)) {
     71                // all measurements below require the radial profile; skip them all
     72                // re-subtract the object, leave local sky
     73                psTrace ("psphot", 5, "failed to extract radial profile for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     74                pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
     75                source->mode |= PM_SOURCE_MODE_SUBTRACTED;
     76                continue;
     77            }
    7578        }
    76 
    77         // XXX probably should not give up if we fail on any of the measurements unless it is due to
    78         // a programming error.
    7979
    8080        // Isophotal Mags
    8181        if (doIsophotal) {
    82           if (!psphotIsophotal (source, recipe, maskVal)) {
    83             psError(PSPHOT_ERR_UNKNOWN, false, "failure in Isophotal analysis");
    84             return false;
    85           }
    86           psTrace ("psphot", 5, "measure isophotal mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
    87           Nisophot ++;
     82            if (!psphotIsophotal (source, recipe, maskVal)) {
     83                psTrace ("psphot", 5, "failed to measure isophotal mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     84            } else {
     85                psTrace ("psphot", 5, "measured isophotal mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     86                Nisophot ++;
     87            }
    8888        }
    8989
    9090        // Petrosian Mags
    9191        if (doPetrosian) {
    92           if (!psphotPetrosian (source, recipe, maskVal)) {
    93             psError(PSPHOT_ERR_UNKNOWN, false, "failure in Petrosian analysis");
    94             return false;
    95           }
    96           psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
    97           Npetro ++;
     92            if (!psphotPetrosian (source, recipe, maskVal)) {
     93                psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     94            } else {
     95                psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     96                Npetro ++;
     97            }
    9898        }
    9999
    100100        // Kron Mags
    101101        if (doKron) {
    102           if (!psphotKron (source, recipe, maskVal)) {
    103             psError(PSPHOT_ERR_UNKNOWN, false, "failure in Kron analysis");
    104             return false;
    105           }
    106           psTrace ("psphot", 5, "measure kron mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
    107           Nkron ++;
     102            if (!psphotKron (source, recipe, maskVal)) {
     103                psTrace ("psphot", 5, "failed to measure kron mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     104            } else {
     105                psTrace ("psphot", 5, "measure kron mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     106                Nkron ++;
     107            }
    108108        }
    109109
    110110        // Radial Annuli
    111111        if (doAnnuli) {
    112           if (!psphotAnnuli (source, recipe, maskVal)) {
    113             psError(PSPHOT_ERR_UNKNOWN, false, "failure in Annuli analysis");
    114             return false;
    115           }
    116           psTrace ("psphot", 5, "measured annuli for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
    117           Nannuli ++;
     112            if (!psphotAnnuli (source, recipe, maskVal)) {
     113                psError(PSPHOT_ERR_UNKNOWN, false, "failure in Annuli analysis");
     114                return false;
     115            }
     116            psTrace ("psphot", 5, "measured annuli for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     117            Nannuli ++;
    118118        }
    119119
    120         // re-subtract the object, leave local sky
    121         pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
    122         source->mode |= PM_SOURCE_MODE_SUBTRACTED;
     120        // re-subtract the object, leave local sky
     121        pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
     122        source->mode |= PM_SOURCE_MODE_SUBTRACTED;
    123123    }
    124124
Note: See TracChangeset for help on using the changeset viewer.