Changeset 16408
- Timestamp:
- Feb 11, 2008, 7:09:46 PM (18 years ago)
- Location:
- branches/pap_branch_080207/ppStack/src
- Files:
-
- 3 edited
-
ppStack.h (modified) (1 diff)
-
ppStackLoop.c (modified) (4 diffs)
-
ppStackMatch.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_branch_080207/ppStack/src/ppStack.h
r16407 r16408 51 51 /// Convolve image to match specified seeing 52 52 bool ppStackMatch(pmReadout *readout, ///< Readout to be convolved; replaced with output 53 psArray **regions, // Array of regions used in each PSF matching, returned 54 psArray **kernels, // Array of kernels used in each PSF matching, returned 53 55 const pmReadout *sourcesRO, ///< Readout with sources 54 56 const pmPSF *psf, ///< Target PSF -
branches/pap_branch_080207/ppStack/src/ppStackLoop.c
r16407 r16408 10 10 11 11 #include "ppStack.h" 12 13 #define ARRAY_BUFFER 16 // Number to add to array at a time14 12 15 13 // Here follows lists of files for activation/deactivation at various stages. Each must be NULL-terminated. … … 327 325 #ifndef CONVOLVED_ALREADY 328 326 // Background subtraction, scaling and normalisation is performed automatically by the image matching 329 if (!ppStackMatch(readout, sources, targetPSF, config)) { 327 psArray *regions = NULL, *kernels = NULL; // Regions and kernels used in subtraction 328 if (!ppStackMatch(readout, ®ions, &kernels, sources, targetPSF, config)) { 330 329 psError(PS_ERR_UNKNOWN, false, "Unable to match image %d --- ignoring.", i); 331 330 psFree(sources); … … 333 332 return false; 334 333 } 334 335 subRegions->data[i] = regions; 336 subKernels->data[i] = kernels; 335 337 336 338 // Write the temporary convolved files … … 342 344 #endif 343 345 344 // Extract the regions and solutions used in the image matching345 // This stops them from being freed when we iterate back up the FPA346 psArray *regions = psArrayAllocEmpty(ARRAY_BUFFER); // Array of regions347 {348 psMetadataIterator *iter = psMetadataIteratorAlloc(readout->analysis, PS_LIST_HEAD,349 PM_SUBTRACTION_ANALYSIS_REGION); // Iterator350 psMetadataItem *item = NULL;// Item from iteration351 while ((item = psMetadataGetAndIncrement(iter))) {352 assert(item->type == PS_DATA_REGION);353 regions = psArrayAdd(regions, ARRAY_BUFFER, item->data.V);354 }355 psFree(iter);356 }357 psArray *kernels = psArrayAllocEmpty(ARRAY_BUFFER); // Array of kernels358 {359 psMetadataIterator *iter = psMetadataIteratorAlloc(readout->analysis, PS_LIST_HEAD,360 PM_SUBTRACTION_ANALYSIS_KERNEL); // Iterator361 psMetadataItem *item = NULL;// Item from iteration362 while ((item = psMetadataGetAndIncrement(iter))) {363 assert(item->type == PS_DATA_VECTOR);364 kernels = psArrayAdd(kernels, ARRAY_BUFFER, item->data.V);365 }366 psFree(iter);367 }368 assert(regions->n == kernels->n);369 370 subRegions->data[i] = regions;371 subKernels->data[i] = kernels;372 346 cells->data[i] = psMemIncrRefCounter(readout->parent); 373 374 347 filesIterateUp(config); 375 348 } -
branches/pap_branch_080207/ppStack/src/ppStackMatch.c
r16373 r16408 9 9 #include "ppStack.h" 10 10 11 #define ARRAY_BUFFER 16 // Number to add to array at a time 12 13 11 14 //#define TESTING 12 15 13 bool ppStackMatch(pmReadout *readout, const pmReadout *sourcesRO, const pmPSF *psf, const pmConfig *config) 16 bool ppStackMatch(pmReadout *readout, psArray **regions, psArray **kernels, 17 const pmReadout *sourcesRO, const pmPSF *psf, const pmConfig *config) 14 18 { 19 assert(readout); 20 assert(regions && !*regions); 21 assert(kernels && !*kernels); 22 assert(sourcesRO); 23 assert(psf); 24 assert(config); 25 15 26 // Look up appropriate values from the ppSub recipe 16 27 bool mdok; // Status of MD lookup … … 105 116 readout->mask = psMemIncrRefCounter(output->mask); 106 117 readout->weight = psMemIncrRefCounter(output->weight); 118 119 // Extract the regions and solutions used in the image matching 120 // This stops them from being freed when we iterate back up the FPA 121 *regions = psArrayAllocEmpty(ARRAY_BUFFER); // Array of regions 122 { 123 psMetadataIterator *iter = psMetadataIteratorAlloc(readout->analysis, PS_LIST_HEAD, 124 PM_SUBTRACTION_ANALYSIS_REGION); // Iterator 125 psMetadataItem *item = NULL;// Item from iteration 126 while ((item = psMetadataGetAndIncrement(iter))) { 127 assert(item->type == PS_DATA_REGION); 128 *regions = psArrayAdd(*regions, ARRAY_BUFFER, item->data.V); 129 } 130 psFree(iter); 131 } 132 *kernels = psArrayAllocEmpty(ARRAY_BUFFER); // Array of kernels 133 { 134 psMetadataIterator *iter = psMetadataIteratorAlloc(readout->analysis, PS_LIST_HEAD, 135 PM_SUBTRACTION_ANALYSIS_KERNEL); // Iterator 136 psMetadataItem *item = NULL;// Item from iteration 137 while ((item = psMetadataGetAndIncrement(iter))) { 138 assert(item->type == PS_DATA_VECTOR); 139 *kernels = psArrayAdd(*kernels, ARRAY_BUFFER, item->data.V); 140 } 141 psFree(iter); 142 } 143 assert((*regions)->n == (*kernels)->n); 144 145 107 146 psFree(output); 108 147
Note:
See TracChangeset
for help on using the changeset viewer.
