IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 23, 2010, 9:12:53 AM (16 years ago)
Author:
Paul Price
Message:

Pulling r27400 out of the trunk until it can be developed further (compression, make optional). Development will continue on branches/pap_stack/

File:
1 edited

Legend:

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

    r27400 r27402  
    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);
    130128
    131129    pmFPAfileActivate(config->files, false, NULL);
     
    136134    }
    137135
     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     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];
     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
    147144
    148145        // Get list of PSFs, to determine target PSF
    149146        if (options->convolve) {
    150             pmChip *chip = pmFPAviewThisChip(view, file->fpa); // The chip: holds the PSF
     147            pmChip *chip = pmFPAviewThisChip(view, inputFile->fpa); // The chip: holds the PSF
    151148            pmPSF *psf = psMetadataLookupPtr(NULL, chip->analysis, "PSPHOT.PSF"); // PSF
    152149            if (!psf) {
    153150                psError(PPSTACK_ERR_PROG, false, "Unable to find PSF.");
    154151                psFree(view);
     152                psFree(fileIter);
    155153                psFree(psfs);
    156154                return false;
    157155            }
    158             psfs->data[i] = psMemIncrRefCounter(psf);
     156            psfs->data[index] = psMemIncrRefCounter(psf);
    159157            psMetadataRemoveKey(chip->analysis, "PSPHOT.PSF");
    160158
    161             pmCell *cell = pmFPAviewThisCell(view, file->fpa); // Cell of interest
     159            pmCell *cell = pmFPAviewThisCell(view, inputFile->fpa); // Cell of interest
    162160            pmHDU *hdu = pmHDUFromCell(cell);
    163161            assert(hdu && hdu->header);
     
    167165                psError(PPSTACK_ERR_PROG, false, "Unable to determine size of image from PSF.");
    168166                psFree(view);
     167                psFree(fileIter);
    169168                psFree(psfs);
    170169                return false;
     
    181180        pmDetections *detections = NULL;
    182181        if (options->convolve || options->matchZPs || options->photometry || redoPhot) {
    183             pmReadout *ro = pmFPAviewThisReadout(view, file->fpa); // Readout with sources
     182            pmReadout *ro = pmFPAviewThisReadout(view, inputFile->fpa); // Readout with sources
    184183            detections = psMetadataLookupPtr(NULL, ro->analysis, "PSPHOT.DETECTIONS"); // Sources
    185184            if (!detections) {
     
    189188            psAssert (detections->allSources, "missing sources?");
    190189
    191             options->sourceLists->data[i] = psMemIncrRefCounter(detections->allSources);
     190            options->sourceLists->data[index] = psMemIncrRefCounter(detections->allSources);
    192191        }
    193192
    194193        // Re-do photometry if we don't trust the source lists
    195194        if (redoPhot) {
    196             psTrace("ppStack", 2, "Photometering input %d of %d....\n", i, num);
     195            psTrace("ppStack", 2, "Photometering input %d of %d....\n", index, num);
    197196            pmFPAfileActivate(config->files, false, NULL);
    198             ppStackFileActivationSingle(config, PPSTACK_FILES_CONVOLVE, true, i);
     197            ppStackFileActivationSingle(config, PPSTACK_FILES_CONVOLVE, true, index);
    199198            if (options->convolve) {
    200199                pmFPAfileActivate(config->files, true, "PPSTACK.CONV.KERNEL");
    201200            }
    202             pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT", i); // File
     201            pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT", index); // File
    203202            pmFPAview *photView = ppStackFilesIterateDown(config);
    204203            if (!photView) {
     
    224223            ppStackFileActivation(config, PPSTACK_FILES_PREPARE, true);
    225224        }
    226     }
     225
     226        index++;
     227    }
     228    psFree(fileIter);
    227229
    228230    psString log = psStringCopy("Input seeing FWHMs:\n"); // Log message
Note: See TracChangeset for help on using the changeset viewer.