Changeset 27402 for trunk/ppStack/src/ppStackPrepare.c
- Timestamp:
- Mar 23, 2010, 9:12:53 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/ppStack/src/ppStackPrepare.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStackPrepare.c
r27400 r27402 126 126 options->inputMask = psVectorAlloc(num, PS_TYPE_VECTOR_MASK); // Mask for inputs 127 127 psVectorInit(options->inputMask, 0); 128 options->exposures = psVectorAlloc(options->num, PS_TYPE_F32);129 psVectorInit(options->exposures, NAN);130 128 131 129 pmFPAfileActivate(config->files, false, NULL); … … 136 134 } 137 135 136 psMetadataIterator *fileIter = psMetadataIteratorAlloc(config->files, PS_LIST_HEAD, "^PPSTACK.INPUT$"); 137 psMetadataItem *fileItem; // Item from iteration 138 138 psArray *psfs = psArrayAlloc(num); // PSFs for PSF envelope 139 139 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 147 144 148 145 // Get list of PSFs, to determine target PSF 149 146 if (options->convolve) { 150 pmChip *chip = pmFPAviewThisChip(view, file->fpa); // The chip: holds the PSF147 pmChip *chip = pmFPAviewThisChip(view, inputFile->fpa); // The chip: holds the PSF 151 148 pmPSF *psf = psMetadataLookupPtr(NULL, chip->analysis, "PSPHOT.PSF"); // PSF 152 149 if (!psf) { 153 150 psError(PPSTACK_ERR_PROG, false, "Unable to find PSF."); 154 151 psFree(view); 152 psFree(fileIter); 155 153 psFree(psfs); 156 154 return false; 157 155 } 158 psfs->data[i ] = psMemIncrRefCounter(psf);156 psfs->data[index] = psMemIncrRefCounter(psf); 159 157 psMetadataRemoveKey(chip->analysis, "PSPHOT.PSF"); 160 158 161 pmCell *cell = pmFPAviewThisCell(view, file->fpa); // Cell of interest159 pmCell *cell = pmFPAviewThisCell(view, inputFile->fpa); // Cell of interest 162 160 pmHDU *hdu = pmHDUFromCell(cell); 163 161 assert(hdu && hdu->header); … … 167 165 psError(PPSTACK_ERR_PROG, false, "Unable to determine size of image from PSF."); 168 166 psFree(view); 167 psFree(fileIter); 169 168 psFree(psfs); 170 169 return false; … … 181 180 pmDetections *detections = NULL; 182 181 if (options->convolve || options->matchZPs || options->photometry || redoPhot) { 183 pmReadout *ro = pmFPAviewThisReadout(view, file->fpa); // Readout with sources182 pmReadout *ro = pmFPAviewThisReadout(view, inputFile->fpa); // Readout with sources 184 183 detections = psMetadataLookupPtr(NULL, ro->analysis, "PSPHOT.DETECTIONS"); // Sources 185 184 if (!detections) { … … 189 188 psAssert (detections->allSources, "missing sources?"); 190 189 191 options->sourceLists->data[i ] = psMemIncrRefCounter(detections->allSources);190 options->sourceLists->data[index] = psMemIncrRefCounter(detections->allSources); 192 191 } 193 192 194 193 // Re-do photometry if we don't trust the source lists 195 194 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); 197 196 pmFPAfileActivate(config->files, false, NULL); 198 ppStackFileActivationSingle(config, PPSTACK_FILES_CONVOLVE, true, i );197 ppStackFileActivationSingle(config, PPSTACK_FILES_CONVOLVE, true, index); 199 198 if (options->convolve) { 200 199 pmFPAfileActivate(config->files, true, "PPSTACK.CONV.KERNEL"); 201 200 } 202 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT", i ); // File201 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT", index); // File 203 202 pmFPAview *photView = ppStackFilesIterateDown(config); 204 203 if (!photView) { … … 224 223 ppStackFileActivation(config, PPSTACK_FILES_PREPARE, true); 225 224 } 226 } 225 226 index++; 227 } 228 psFree(fileIter); 227 229 228 230 psString log = psStringCopy("Input seeing FWHMs:\n"); // Log message
Note:
See TracChangeset
for help on using the changeset viewer.
