Changeset 16991
- Timestamp:
- Mar 13, 2008, 5:25:47 PM (18 years ago)
- Location:
- trunk/ppStack/src
- Files:
-
- 3 edited
-
ppStack.h (modified) (1 diff)
-
ppStackLoop.c (modified) (11 diffs)
-
ppStackPSF.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStack.h
r16986 r16991 23 23 pmPSF *ppStackPSF(const pmConfig *config, // Configuration 24 24 int numCols, int numRows, // Size of image 25 const ps List *list// List of input PSFs25 const psArray *psfs // List of input PSFs 26 26 ); 27 27 -
trunk/ppStack/src/ppStackLoop.c
r16986 r16991 47 47 } 48 48 49 // Activate/deactivate a single element for a list ; return array of files50 static psArray *fileActivationSingle(pmConfig *config, // Configuration51 char **files, // Files to turn on/off52 bool state, // Activation state53 int num // Number of file in sequence54 )49 // Activate/deactivate a single element for a list 50 static void fileActivationSingle(pmConfig *config, // Configuration 51 char **files, // Files to turn on/off 52 bool state, // Activation state 53 int num // Number of file in sequence 54 ) 55 55 { 56 56 assert(config); 57 57 assert(files); 58 58 59 psList *list = psListAlloc(NULL); // List of files60 61 59 for (int i = 0; files[i] != NULL; i++) { 62 pmFPAfile *file = pmFPAfileActivateSingle(config->files, state, files[i], num); // Activated file 63 psListAdd(list, PS_LIST_TAIL, file); 64 } 65 66 psArray *array = psListToArray(list); 67 psFree(list); 68 69 return array; 60 pmFPAfileActivateSingle(config->files, state, files[i], num); // Activated file 61 } 62 return; 70 63 } 71 64 … … 241 234 "^PPSTACK.INPUT$"); // Iterator 242 235 psMetadataItem *fileItem; // Item from iteration 243 ps List *psfList = psListAlloc(NULL); // List ofPSFs for PSF envelope236 psArray *psfs = psArrayAlloc(num); // PSFs for PSF envelope 244 237 int numCols = 0, numRows = 0; // Size of image 238 int index = 0; // Index for file 245 239 while ((fileItem = psMetadataGetAndIncrement(fileIter))) { 246 240 assert(fileItem->type == PS_DATA_UNKNOWN); … … 253 247 psFree(sources); 254 248 psFree(fileIter); 255 psFree(psf List);249 psFree(psfs); 256 250 return false; 257 251 } 258 psListAdd(psfList, PS_LIST_TAIL, psf); 252 psfs->data[index++] = psMemIncrRefCounter(psf); 253 psMetadataRemoveKey(chip->analysis, "PSPHOT.PSF"); 259 254 260 255 pmCell *cell = pmFPAviewThisCell(view, inputFile->fpa); // Cell of interest … … 268 263 psFree(sources); 269 264 psFree(fileIter); 270 psFree(psf List);265 psFree(psfs); 271 266 return false; 272 267 } … … 279 274 psFree(view); 280 275 281 targetPSF = ppStackPSF(config, numCols, numRows, psf List);282 psFree(psf List);276 targetPSF = ppStackPSF(config, numCols, numRows, psfs); 277 psFree(psfs); 283 278 if (!targetPSF) { 284 279 psError(PS_ERR_UNKNOWN, false, "Unable to determine output PSF."); … … 313 308 psTrace("ppStack", 2, "Convolving input %d of %d to target PSF....\n", i, num); 314 309 pmFPAfileActivate(config->files, false, NULL); 315 psArray *files = fileActivationSingle(config, convolveFiles, true, i); 310 fileActivationSingle(config, convolveFiles, true, i); 311 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT", i); // File of interest 316 312 pmFPAview *view = filesIterateDown(config); 317 313 if (!view) { … … 321 317 } 322 318 323 pmReadout *readout = pmFPAviewThisReadout(view, ((pmFPAfile*)files->data[0])->fpa); // Input readout319 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); // Input readout 324 320 psFree(view); 325 321 … … 372 368 psArray *readouts = psArrayAlloc(num); // Readouts for convolved images 373 369 for (int i = 0; i < num; i++) { 374 readouts->data[i] = pmReadoutAlloc(cells->data[i]); // Readout into which to read 370 pmCell *cell = cells->data[i]; // Cell of interest 371 pmReadout *ro = cell->readouts->data[0]; // Readout of interest 372 if (!ro) { 373 ro = pmReadoutAlloc(cell); 374 } 375 readouts->data[i] = ro; // Readout into which to read 375 376 } 376 377 psFree(cells); … … 394 395 psError(PS_ERR_UNKNOWN, false, "Unable to open convolved files %s, %s, %s", 395 396 (char*)imageNames->data[i], (char*)maskNames->data[i], (char*)weightNames->data[i]); 396 psFree(cells);397 397 psFree(subKernels); 398 398 psFree(subRegions); … … 471 471 psPixels *reject = pmStackReject(inspect, NULL, threshold, subRegions->data[i], 472 472 subKernels->data[i]); // Pixels to reject 473 psFree(inspect); 473 474 psTrace("ppStack", 5, "%ld pixels rejected from image %d", reject->n, i); 474 475 rejected->data[i] = reject; … … 525 526 526 527 psFree(rejected); 528 for (int i = 0; i < readouts->n; i++) { 529 pmReadout *ro = readouts->data[i]; // Readout of interest 530 pmReadoutFreeData(ro); 531 } 527 532 psFree(readouts); 528 533 -
trunk/ppStack/src/ppStackPSF.c
r16605 r16991 9 9 #include "ppStack.h" 10 10 11 pmPSF *ppStackPSF(const pmConfig *config, int numCols, int numRows, const ps List *list)11 pmPSF *ppStackPSF(const pmConfig *config, int numCols, int numRows, const psArray *psfs) 12 12 { 13 13 // Get the recipe values … … 18 18 19 19 // Solve for the target PSF 20 psArray *array = psListToArray(list); // Array of PSFs 21 pmPSF *psf = pmPSFEnvelope(numCols, numRows, array, psfInstances, psfRadius, psfModel, 20 pmPSF *psf = pmPSFEnvelope(numCols, numRows, psfs, psfInstances, psfRadius, psfModel, 22 21 psfOrder, psfOrder); 23 psFree(array);24 22 if (!psf) { 25 23 psError(PS_ERR_UNKNOWN, false, "Unable to determine output PSF.");
Note:
See TracChangeset
for help on using the changeset viewer.
