IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30106


Ignore:
Timestamp:
Dec 17, 2010, 10:07:26 AM (15 years ago)
Author:
eugene
Message:

merge changes from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101205/ppSub/src/ppSubLoop.c

    r29937 r30106  
    3636    psAssert(config, "Require configuration.");
    3737
     38    bool success = true;
     39
    3840    pmConfigCamerasCull(config, NULL);
    3941    pmConfigRecipesCull(config, "PPSUB,PPSTATS,PSPHOT,PSASTRO,MASKS,JPEG");
     
    6163        if (!ppSubInputDetections(&foundDetections, "PPSUB.POS1.SOURCES", "PPSUB.INPUT", data)) {
    6264            psError(psErrorCodeLast(), false, "Unable to measure positive detections (1)");
    63             return false;
     65            success = false;
     66            goto ESCAPE;
    6467        }
    6568        // if nothing was found, don't bother doing the forced photometry below
     
    7073    }
    7174    if (data->forcedPhot2) {
     75        // Change the recipe to use a higher nsigma limit and quit after pass1
     76        psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
     77
     78        psF32 nsigma_peak_save = psMetadataLookupF32 (NULL, recipe, "PEAKS_NSIGMA_LIMIT");
     79        char *breakPt_save =  psMetadataLookupStr (NULL, recipe, "BREAK_POINT");
     80
     81        bool mdok;
     82        psF32 pos2_nsigma_peak = psMetadataLookupF32 (&mdok, recipe, "PEAKS_POS2_NSIGMA_LIMIT");
     83        if (!mdok) {
     84            psWarning("PEAKS_POS2_NSIGMA_LIMIT not found in recipe. Will use 25.\n");
     85            pos2_nsigma_peak = 25.;
     86        }
     87        psMetadataAddF32(recipe, PS_LIST_TAIL, "PEAKS_NSIGMA_LIMIT", PS_META_REPLACE, "", pos2_nsigma_peak);
     88        psMetadataAddStr(recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE, "", "PASS1");
     89
    7290        bool foundDetections = false;
    7391        if (!ppSubInputDetections(&foundDetections, "PPSUB.POS2.SOURCES", "PPSUB.REF", data)) {
    7492            psError(psErrorCodeLast(), false, "Unable to measure positive detections (2)");
    75             return false;
    76         }
     93            psMetadataAddF32(recipe, PS_LIST_TAIL, "PEAKS_NSIGMA_LIMIT", PS_META_REPLACE, "", nsigma_peak_save);
     94            psMetadataAddStr(recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE, "", breakPt_save);
     95            success = false;
     96            goto ESCAPE;
     97        }
     98        psMetadataAddF32(recipe, PS_LIST_TAIL, "PEAKS_NSIGMA_LIMIT", PS_META_REPLACE, "", nsigma_peak_save);
     99        psMetadataAddStr(recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE, "", breakPt_save);
    77100        // if nothing was found, don't bother doing the forced photometry below
    78101        if (!foundDetections) {
    79             psWarning ("no sources found in positive image 1, skipping forced photometry");
    80             data->forcedPhot1 = false;
    81         }
    82     }
    83 
    84     // XXX if it exists, use the POS1, POS2 results for the FWHMs
     102            psWarning ("no sources found in positive image 2, skipping forced photometry");
     103            data->forcedPhot2 = false;
     104        }
     105    }
     106
     107    // XXX if it exists, use the POS1, POS2 successs for the FWHMs
    85108    if (!ppSubMatchPSFs(data)) {
    86109        psError(psErrorCodeLast(), false, "Unable to match PSFs.");
    87         return false;
     110        success = false;
     111        goto ESCAPE;
    88112    }
    89113    if (data->quality) {
    90114        // Can't do anything at all
    91         return true;
     115        success = false;
     116        goto ESCAPE;
    92117    }
    93118    // generate the residual stamp grid for visualization
    94119    if (!ppSubResidualSampleJpeg(config)) {
    95120        psError(psErrorCodeLast(), false, "Unable to update.");
    96         return false;
     121        success = false;
     122        goto ESCAPE;
    97123    }
    98124
     
    106132    if (!ppSubFilesIterateUp(config, PPSUB_FILES_INPUT)) {
    107133        psError(PPSUB_ERR_IO, false, "Unable to close input files.");
    108         return false;
     134        success = false;
     135        goto ESCAPE;
    109136    }
    110137
    111138    if (!ppSubLowThreshold(data)) {
    112139        psError(psErrorCodeLast(), false, "Unable to threshold images.");
    113         return false;
     140        success = false;
     141        goto ESCAPE;
    114142    }
    115143
     
    117145    if (!ppSubFilesIterateDown(config, PPSUB_FILES_SUB)) {
    118146        psError(PPSUB_ERR_IO, false, "Unable to set up subtraction files.");
    119         return false;
     147        success = false;
     148        goto ESCAPE;
    120149    }
    121150
    122151    if (!ppSubDefineOutput("PPSUB.OUTPUT", config)) {
    123152        psError(psErrorCodeLast(), false, "Unable to define output.");
    124         return false;
     153        success = false;
     154        goto ESCAPE;
    125155    }
    126156
    127157    if (!data->quality && !ppSubMakePSF(data)) {
    128158        psError(psErrorCodeLast(), false, "Unable to generate PSF.");
    129         return false;
     159        success = false;
     160        goto ESCAPE;
    130161    }
    131162
     
    142173    if (!ppSubReadoutSubtract(config)) {
    143174        psError(psErrorCodeLast(), false, "Unable to subtract images.");
    144         return false;
     175        success = false;
     176        goto ESCAPE;
    145177    }
    146178    // dumpout(config, "diff.1.fits");
     
    149181    if (!ppSubFilesIterateUp(config, PPSUB_FILES_PSF | PPSUB_FILES_CONV)) {
    150182        psError(PPSUB_ERR_IO, false, "Unable to close input files.");
    151         return false;
     183        success = false;
     184        goto ESCAPE;
    152185    }
    153186    // dumpout(config, "diff.2a.fits");
     
    156189    if (!ppSubBackground(config)) {
    157190        psError(psErrorCodeLast(), false, "Unable to subtract background.");
    158         return false;
     191        success = false;
     192        goto ESCAPE;
    159193    }
    160194    // dumpout(config, "diff.2b.fits");
     
    163197    if (!ppSubVarianceRescale(config, data)) {
    164198        psError(psErrorCodeLast(), false, "Unable to rescale variance.");
    165         return false;
     199        success = false;
     200        goto ESCAPE;
    166201    }
    167202    // dumpout(config, "diff.2c.fits");
     
    169204    if (data->quality) {
    170205        // Done all we can do up to this point
    171         return true;
     206        success = false;
     207        goto ESCAPE;
    172208    }
    173209
    174210    if (!ppSubFilesIterateDown(config, PPSUB_FILES_PHOT_SUB)) {
    175211        psError(PPSUB_ERR_IO, false, "Unable to set up photometry files.");
    176         return false;
     212        success = false;
     213        goto ESCAPE;
    177214    }
    178215
    179216    if (!data->quality && !ppSubReadoutPhotometry("PPSUB.OUTPUT", data)) {
    180217        psError(psErrorCodeLast(), false, "Unable to perform photometry.");
    181         return false;
     218        success = false;
     219        goto ESCAPE;
    182220    }
    183221    // dumpout(config, "diff.3.fits");
     
    187225        if (!ppSubReadoutForcedPhot("PPSUB.FORCED1.SOURCES", "PPSUB.OUTPUT", "PPSUB.POS1.SOURCES", data)) {
    188226            psError(psErrorCodeLast(), false, "Unable to perform photometry.");
    189             return false;
     227            success = false;
     228            goto ESCAPE;
    190229        }
    191230    }
     
    195234        if (!ppSubReadoutForcedPhot("PPSUB.FORCED2.SOURCES", "PPSUB.OUTPUT", "PPSUB.POS2.SOURCES", data)) {
    196235            psError(psErrorCodeLast(), false, "Unable to perform photometry.");
    197             return false;
     236            success = false;
     237            goto ESCAPE;
    198238        }
    199239    }
     
    201241    if (!ppSubFilesIterateUp(config, PPSUB_FILES_PHOT_SUB)) {
    202242        psError(PPSUB_ERR_IO, false, "Unable to set up photometry files.");
    203         return false;
     243        success = false;
     244        goto ESCAPE;
    204245    }
    205246
     
    207248    if (!ppSubReadoutStats(data)) {
    208249        psError(psErrorCodeLast(), false, "Unable to collect statistics");
    209         return false;
     250        success = false;
     251        goto ESCAPE;
    210252    }
    211253    // Do Mask Stats
     
    214256      if (!ppSubMaskStats(config, view,data->stats)) {
    215257        psError(psErrorCodeLast(), false, "Unable to generate mask statistics");
    216         return(false);
     258        success = false;
     259        goto ESCAPE;
    217260      }
    218261    }
     
    222265    if (!ppSubReadoutJpeg(config)) {
    223266        psError(psErrorCodeLast(), false, "Unable to update.");
    224         return false;
     267        success = false;
     268        goto ESCAPE;
    225269    }
    226270
     
    229273        if (!ppSubFilesIterateDown(config, PPSUB_FILES_INV)) {
    230274            psError(PPSUB_ERR_IO, false, "Unable to set up inverse files.");
    231             return false;
     275            success = false;
     276            goto ESCAPE;
    232277        }
    233278
    234279        if (data->inverse && !ppSubDefineOutput("PPSUB.INVERSE", config)) {
    235280            psError(psErrorCodeLast(), false, "Unable to define inverse.");
    236             return false;
     281            success = false;
     282            goto ESCAPE;
    237283        }
    238284
    239285        if (!ppSubReadoutInverse(config)) {
    240286            psError(psErrorCodeLast(), false, "Unable to invert images.");
    241             return false;
     287            success = false;
     288            goto ESCAPE;
    242289        }
    243290
     
    245292        if (!ppSubFilesIterateUp(config, PPSUB_FILES_SUB)) {
    246293            psError(PPSUB_ERR_IO, false, "Unable to close subtraction files.");
    247             return false;
     294            success = false;
     295            goto ESCAPE;
    248296        }
    249297
    250298        if (!ppSubFilesIterateDown(config, PPSUB_FILES_PHOT_INV)) {
    251299            psError(PPSUB_ERR_IO, false, "Unable to set up inverse files.");
    252             return false;
     300            success = false;
     301            goto ESCAPE;
    253302        }
    254303
    255304        if (!data->quality && !ppSubReadoutPhotometry("PPSUB.INVERSE", data)) {
    256305            psError(psErrorCodeLast(), false, "Unable to perform photometry.");
    257             return false;
     306            success = false;
     307            goto ESCAPE;
    258308        }
    259309
     
    261311        if (!ppSubFilesIterateUp(config, PPSUB_FILES_INV | PPSUB_FILES_PHOT_INV)) {
    262312            psError(PPSUB_ERR_IO, false, "Unable to close subtraction files.");
    263             return false;
     313            success = false;
     314            goto ESCAPE;
    264315        }
    265316    } else {
     
    268319        if (!ppSubFilesIterateUp(config, PPSUB_FILES_SUB)) {
    269320            psError(PPSUB_ERR_IO, false, "Unable to close subtraction files.");
    270             return false;
    271         }
    272     }
    273 
     321            success = false;
     322            goto ESCAPE;
     323        }
     324    }
     325
     326ESCAPE:
    274327    pmFPAfileDropInternal(config->files, "PSPHOT.BACKGND");
    275328    pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL");
    276329    pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL.STDEV");
    277330
    278     return true;
     331    return success;
    279332}
Note: See TracChangeset for help on using the changeset viewer.