IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 20, 2010, 12:59:49 PM (17 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/psphotChoosePSF.c

    r26262 r26643  
    22
    33// try PSF models and select best option
    4 pmPSF *psphotChoosePSF (pmReadout *readout, psArray *sources, psMetadata *recipe) {
     4bool psphotChoosePSFReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index) {
    55
    66    bool status;
    77
    88    psTimerStart ("psphot.choose.psf");
     9
     10    // find the currently selected readout
     11    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     12    psAssert (readout, "missing file?");
     13
     14    pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
     15    psAssert (readout, "missing readout?");
     16
     17    psArray *sources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
     18    psAssert (sources, "missing sources?");
     19
     20    // select the appropriate recipe information
     21    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     22    psAssert (recipe, "missing recipe?");
    923
    1024    // bit-masks to test for good/bad pixels
    1125    psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT");
    12     assert (maskVal);
     26    psAssert (maskVal, "missing mask value?");
    1327
    1428    // bit-mask to mark pixels not used in analysis
    1529    psImageMaskType markVal = psMetadataLookupImageMask(&status, recipe, "MARK.PSPHOT");
    16     assert (markVal);
     30    psAssert (markVal, "missing mark value?");
    1731
    1832    // maskVal is used to test for rejected pixels, and must include markVal
     
    302316
    303317    psFree (options);
    304     return (psf);
     318
     319    // save PSF on readout->analysis
     320    if (!psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_PTR, "psphot psf model", psf)) {
     321        psError (PSPHOT_ERR_UNKNOWN, false, "problem saving sources on readout");
     322        return false;
     323    }
     324
     325    return true;
    305326}
    306327
     
    445466    return true;
    446467}
     468
     469// for now, let's store the detections on the readout->analysis for each readout
     470bool psphotChoosePSF (pmConfig *config, const pmFPAview *view)
     471{
     472    bool status = true;
     473
     474    int num = psMetadataAddS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
     475    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
     476
     477    // loop over the available readouts
     478    for (int i = 0; i < num; i++) {
     479        if (!psphotChoosePSFReadout (config, view, "PSPHOT.INPUT", i, havePSF)) {
     480            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
     481            return false;
     482        }
     483    }
     484    return true;
     485}
Note: See TracChangeset for help on using the changeset viewer.