IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 20, 2010, 12:59:49 PM (16 years ago)
Author:
eugene
Message:

updating code so more functions can handle the multi-input concept

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/psphot.stack.20100120/src/psphotFindDetections.c

    r26634 r26643  
    22
    33// smooth the image, search for peaks, optionally define footprints based on the peaks
    4 pmDetections *psphotFindDetections (pmDetections *detections, pmReadout *readout, psMetadata *recipe) {
     4bool psphotFindDetections (pmConfig *config, const pmFPAview *view, const char *filename, int index) {
    55
    66    bool status;
     
    99    int NMAX = 0;
    1010
     11    // find the currently selected readout
     12    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     13    psAssert (readout, "missing file?");
     14
     15    pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
     16    psAssert (readout, "missing readout?");
     17
     18    // select the appropriate recipe information
     19    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     20    psAssert (recipe, "missing recipe?");
     21
    1122    // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
    1223    psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels
    13     assert (maskVal);
     24    psAssert (maskVal, "missing mask value?");
    1425
    1526    // Use the new pmFootprints approach?
     
    7182    psphotVisualShowFootprints (detections);
    7283
    73     return detections;
     84    // save detections on the readout->analysis
     85    if (!psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_PTR, "psphot detectinos", detections)) {
     86        psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout");
     87        return NULL;
     88    }
     89
     90    return true;
    7491}
    7592
     
    7794// otherwise it only contains the new peaks.
    7895
    79 # if 0
    80 // XXX where do we place the N sets of detections?
     96// for now, let's store the detections on the readout->analysis for each readout
    8197bool psphotFindDetections (pmConfig *config, const pmFPAview *view)
    8298{
     
    84100
    85101    int num = psMetadataAddS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
    86     psAbort (!status, "programming error: must define PSPHOT.INPUT.NUM");
     102    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
    87103
    88104    // loop over the available readouts
    89105    for (int i = 0; i < num; i++) {
    90106        if (!psphotFindDetectionsReadout (config, view, "PSPHOT.INPUT", i)) {
    91             psError (PSPHOT_ERR_CONFIG, false, "failed to subtract background for PSPHOT.INPUT entry %d", i);
     107            psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for PSPHOT.INPUT entry %d", i);
    92108            return false;
    93109        }
     
    95111    return true;
    96112}
    97 # endif
Note: See TracChangeset for help on using the changeset viewer.