- Timestamp:
- Mar 29, 2010, 3:55:49 PM (16 years ago)
- Location:
- branches/eam_branches/20100225
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ppStack/src/ppStackPrepare.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20100225
- Property svn:mergeinfo changed
-
branches/eam_branches/20100225/ppStack/src/ppStackPrepare.c
r27075 r27517 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); 128 130 129 131 pmFPAfileActivate(config->files, false, NULL); … … 134 136 } 135 137 136 psMetadataIterator *fileIter = psMetadataIteratorAlloc(config->files, PS_LIST_HEAD, "^PPSTACK.INPUT$");137 psMetadataItem *fileItem; // Item from iteration138 138 psArray *psfs = psArrayAlloc(num); // PSFs for PSF envelope 139 139 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]; 144 147 145 148 // Get list of PSFs, to determine target PSF 146 149 if (options->convolve) { 147 pmChip *chip = pmFPAviewThisChip(view, inputFile->fpa); // The chip: holds the PSF150 pmChip *chip = pmFPAviewThisChip(view, file->fpa); // The chip: holds the PSF 148 151 pmPSF *psf = psMetadataLookupPtr(NULL, chip->analysis, "PSPHOT.PSF"); // PSF 149 152 if (!psf) { 150 153 psError(PPSTACK_ERR_PROG, false, "Unable to find PSF."); 151 154 psFree(view); 152 psFree(fileIter);153 155 psFree(psfs); 154 156 return false; 155 157 } 156 psfs->data[i ndex] = psMemIncrRefCounter(psf);158 psfs->data[i] = psMemIncrRefCounter(psf); 157 159 psMetadataRemoveKey(chip->analysis, "PSPHOT.PSF"); 158 160 159 pmCell *cell = pmFPAviewThisCell(view, inputFile->fpa); // Cell of interest161 pmCell *cell = pmFPAviewThisCell(view, file->fpa); // Cell of interest 160 162 pmHDU *hdu = pmHDUFromCell(cell); 161 163 assert(hdu && hdu->header); … … 165 167 psError(PPSTACK_ERR_PROG, false, "Unable to determine size of image from PSF."); 166 168 psFree(view); 167 psFree(fileIter);168 169 psFree(psfs); 169 170 return false; … … 180 181 pmDetections *detections = NULL; 181 182 if (options->convolve || options->matchZPs || options->photometry || redoPhot) { 182 pmReadout *ro = pmFPAviewThisReadout(view, inputFile->fpa); // Readout with sources183 pmReadout *ro = pmFPAviewThisReadout(view, file->fpa); // Readout with sources 183 184 detections = psMetadataLookupPtr(NULL, ro->analysis, "PSPHOT.DETECTIONS"); // Sources 184 if (!detections) { 185 psError(PPSTACK_ERR_PROG, false, "Unable to find source detections in readout."); 186 return NULL; 185 if (!detections || !detections->allSources) { 186 psWarning("No detections found for image %d --- rejecting.", i); 187 options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PPSTACK_MASK_CAL; 188 continue; 187 189 } 188 190 psAssert (detections->allSources, "missing sources?"); 189 191 190 options->sourceLists->data[i ndex] = psMemIncrRefCounter(detections->allSources);192 options->sourceLists->data[i] = psMemIncrRefCounter(detections->allSources); 191 193 } 192 194 193 195 // Re-do photometry if we don't trust the source lists 194 196 if (redoPhot) { 195 psTrace("ppStack", 2, "Photometering input %d of %d....\n", i ndex, num);197 psTrace("ppStack", 2, "Photometering input %d of %d....\n", i, num); 196 198 pmFPAfileActivate(config->files, false, NULL); 197 ppStackFileActivationSingle(config, PPSTACK_FILES_CONVOLVE, true, i ndex);199 ppStackFileActivationSingle(config, PPSTACK_FILES_CONVOLVE, true, i); 198 200 if (options->convolve) { 199 201 pmFPAfileActivate(config->files, true, "PPSTACK.CONV.KERNEL"); 200 202 } 201 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT", i ndex); // File203 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT", i); // File 202 204 pmFPAview *photView = ppStackFilesIterateDown(config); 203 205 if (!photView) { … … 223 225 ppStackFileActivation(config, PPSTACK_FILES_PREPARE, true); 224 226 } 225 226 index++; 227 } 228 psFree(fileIter); 227 } 229 228 230 229 psString log = psStringCopy("Input seeing FWHMs:\n"); // Log message
Note:
See TracChangeset
for help on using the changeset viewer.
