IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 6, 2010, 1:36:51 PM (16 years ago)
Author:
eugene
Message:

working on stackphot

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/stackphot.20100406/psphot/src/psphotStackChisqImage.c

    r27547 r27625  
    1212    psTimerStart ("psphot.chisq.image");
    1313
     14    pmFPAfile *chisqFile = pmFPAfileSelectSingle(config->files, "PSPHOT.CHISQ.OUTPUT", 0);
     15    psAssert (chisqFile, "missing chisq image FPA?");
     16
     17    pmCell *chisqCell = pmFPAviewThisCell(view, chisqFile->fpa);
     18
    1419    // create a holder for the image
    15     pmReadout *chiImage = pmReadoutAlloc();
     20    pmReadout *chiReadout = pmFPAviewThisReadout(view, chisqFile->fpa);
     21    if (!chiReadout) {
     22      chiReadout = pmReadoutAlloc(chisqCell);
     23    } else {
     24      psMemIncrRefCounter(chiReadout);
     25    }
    1626
    1727    int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
     
    2030    // loop over the available readouts
    2131    for (int i = 0; i < num; i++) {
    22         if (!psphotStackChisqImageAddReadout(config, view, chiImage, "PSPHOT.INPUT", i)) {
     32        if (!psphotStackChisqImageAddReadout(config, view, chiReadout, "PSPHOT.INPUT", i)) {
    2333            psError (PSPHOT_ERR_CONFIG, false, "failed to model background for PSPHOT.INPUT entry %d", i);
    2434            return false;
     
    2636    }
    2737
     38    num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
     39    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
     40
     41    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "PSPHOT.CHISQ.NUM", PS_META_REPLACE, "", num);
     42    num++;
     43    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "", num);
     44
    2845    // need to save the resulting image somewhere (PSPHOT.INPUT?)
     46    if (!psMetadataAddPtr(config->files, PS_LIST_TAIL, "PSPHOT.INPUT", PS_DATA_UNKNOWN | PS_META_DUPLICATE_OK, "", chisqFile)) {
     47        psError(PM_ERR_CONFIG, false, "could not add chisqFPA to config files");
     48        return false;
     49    }
    2950
    3051    psLogMsg ("psphot", PS_LOG_INFO, "built chisq image: %f sec\n", psTimerMark ("psphot.chisq.image"));
    3152
     53    psFree (chiReadout);
    3254    return true;
    3355}
    3456
    3557bool psphotStackChisqImageAddReadout(const pmConfig *config, // Configuration
    36                                      pmFPAview *view,
     58                                     const pmFPAview *view,
    3759                                     pmReadout *chiReadout,
    3860                                     char *filename,
Note: See TracChangeset for help on using the changeset viewer.