IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 23, 2010, 9:02:41 PM (16 years ago)
Author:
Paul Price
Message:

Something was missing from the merge (probably because I tool r27400 out), so had to get it back.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackPrepare.c

    r27402 r27427  
    126126    options->inputMask = psVectorAlloc(num, PS_TYPE_VECTOR_MASK); // Mask for inputs
    127127    psVectorInit(options->inputMask, 0);
     128    options->exposures = psVectorAlloc(options->num, PS_TYPE_F32);
     129    psVectorInit(options->exposures, NAN);
    128130
    129131    pmFPAfileActivate(config->files, false, NULL);
     
    134136    }
    135137
    136     psMetadataIterator *fileIter = psMetadataIteratorAlloc(config->files, PS_LIST_HEAD, "^PPSTACK.INPUT$");
    137     psMetadataItem *fileItem; // Item from iteration
    138138    psArray *psfs = psArrayAlloc(num); // PSFs for PSF envelope
    139139    int numCols = 0, numRows = 0;   // Size of image
    140     int index = 0;                  // Index for file
    141     while ((fileItem = psMetadataGetAndIncrement(fileIter))) {
    142         assert(fileItem->type == PS_DATA_UNKNOWN);
    143         pmFPAfile *inputFile = fileItem->data.V; // An input file
     140    options->sumExposure = 0.0;
     141    for (int i = 0; i < num; i++) {
     142        pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT", i); // File of interest
     143        pmCell *cell = pmFPAviewThisCell(view, file->fpa); // Cell of interest
     144
     145        options->exposures->data.F32[i] = psMetadataLookupF32(NULL, cell->concepts, "CELL.EXPOSURE");
     146        options->sumExposure += options->exposures->data.F32[i];
    144147
    145148        // Get list of PSFs, to determine target PSF
    146149        if (options->convolve) {
    147             pmChip *chip = pmFPAviewThisChip(view, inputFile->fpa); // The chip: holds the PSF
     150            pmChip *chip = pmFPAviewThisChip(view, file->fpa); // The chip: holds the PSF
    148151            pmPSF *psf = psMetadataLookupPtr(NULL, chip->analysis, "PSPHOT.PSF"); // PSF
    149152            if (!psf) {
    150153                psError(PPSTACK_ERR_PROG, false, "Unable to find PSF.");
    151154                psFree(view);
    152                 psFree(fileIter);
    153155                psFree(psfs);
    154156                return false;
    155157            }
    156             psfs->data[index] = psMemIncrRefCounter(psf);
     158            psfs->data[i] = psMemIncrRefCounter(psf);
    157159            psMetadataRemoveKey(chip->analysis, "PSPHOT.PSF");
    158160
    159             pmCell *cell = pmFPAviewThisCell(view, inputFile->fpa); // Cell of interest
     161            pmCell *cell = pmFPAviewThisCell(view, file->fpa); // Cell of interest
    160162            pmHDU *hdu = pmHDUFromCell(cell);
    161163            assert(hdu && hdu->header);
     
    165167                psError(PPSTACK_ERR_PROG, false, "Unable to determine size of image from PSF.");
    166168                psFree(view);
    167                 psFree(fileIter);
    168169                psFree(psfs);
    169170                return false;
     
    180181        pmDetections *detections = NULL;
    181182        if (options->convolve || options->matchZPs || options->photometry || redoPhot) {
    182             pmReadout *ro = pmFPAviewThisReadout(view, inputFile->fpa); // Readout with sources
     183            pmReadout *ro = pmFPAviewThisReadout(view, file->fpa); // Readout with sources
    183184            detections = psMetadataLookupPtr(NULL, ro->analysis, "PSPHOT.DETECTIONS"); // Sources
    184185            if (!detections) {
     
    188189            psAssert (detections->allSources, "missing sources?");
    189190
    190             options->sourceLists->data[index] = psMemIncrRefCounter(detections->allSources);
     191            options->sourceLists->data[i] = psMemIncrRefCounter(detections->allSources);
    191192        }
    192193
    193194        // Re-do photometry if we don't trust the source lists
    194195        if (redoPhot) {
    195             psTrace("ppStack", 2, "Photometering input %d of %d....\n", index, num);
     196            psTrace("ppStack", 2, "Photometering input %d of %d....\n", i, num);
    196197            pmFPAfileActivate(config->files, false, NULL);
    197             ppStackFileActivationSingle(config, PPSTACK_FILES_CONVOLVE, true, index);
     198            ppStackFileActivationSingle(config, PPSTACK_FILES_CONVOLVE, true, i);
    198199            if (options->convolve) {
    199200                pmFPAfileActivate(config->files, true, "PPSTACK.CONV.KERNEL");
    200201            }
    201             pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT", index); // File
     202            pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT", i); // File
    202203            pmFPAview *photView = ppStackFilesIterateDown(config);
    203204            if (!photView) {
     
    223224            ppStackFileActivation(config, PPSTACK_FILES_PREPARE, true);
    224225        }
    225 
    226         index++;
    227     }
    228     psFree(fileIter);
     226    }
    229227
    230228    psString log = psStringCopy("Input seeing FWHMs:\n"); // Log message
Note: See TracChangeset for help on using the changeset viewer.