Changeset 5564 for trunk/archive/scripts/src/phase2/papPhase2.c
- Timestamp:
- Nov 21, 2005, 5:00:14 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/archive/scripts/src/phase2/papPhase2.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/scripts/src/phase2/papPhase2.c
r5467 r5564 29 29 // * Write calibrated image 30 30 // * Write source catalogue, astrometry, etc. 31 31 32 32 // Currently neglecting different input types (F32, S32, U16, etc) 33 33 … … 302 302 #else 303 303 psFree(inputFile); 304 #endif 305 306 307 #if 1 308 { 309 // Generate mask and weight frame 310 p_pmHDU *hdu = NULL; 311 if (input->hdu) { 312 hdu = input->hdu; 313 } 314 psArray *chips = input->chips; 315 for (int chipNum = 0; chipNum < chips->n; chipNum++) { 316 pmChip *chip = chips->data[chipNum]; 317 if (chip->valid) { 318 if (chip->hdu) { 319 hdu = chip->hdu; 320 } 321 psArray *cells = chip->cells; 322 for (int cellNum = 0; cellNum < cells->n; cellNum++) { 323 pmCell *cell = cells->data[cellNum]; 324 if (cell->valid) { 325 if (cell->hdu) { 326 hdu = cell->hdu; 327 } 328 329 hdu->masks = psArrayAlloc(hdu->images->n); 330 hdu->weights = psArrayAlloc(hdu->images->n); 331 psArray *readouts = cell->readouts; 332 for (int readNum = 0; readNum < hdu->images->n; readNum++) { 333 psImage *image = hdu->images->data[readNum]; 334 psImage *mask = psImageAlloc(image->numCols, image->numRows, PS_TYPE_U8); 335 psImage *weight = psImageAlloc(image->numCols, image->numRows, PS_TYPE_F32); 336 pmReadout *readout = readouts->data[readNum]; 337 for (int j = 0; j < image->numRows; j++) { 338 for (int i = 0; i < image->numCols; i++) { 339 mask->data.U8[j][i] = j + i; 340 weight->data.F32[j][i] = sqrtf(image->data.F32[j][i]); 341 } 342 } 343 hdu->masks->data[readNum] = mask; 344 hdu->weights->data[readNum] = weight; 345 readout->mask = psMemIncrRefCounter(mask); 346 readout->weight = psMemIncrRefCounter(weight); 347 } 348 } 349 } 350 } 351 } 352 } 304 353 #endif 305 354 … … 741 790 inputReadout->image->numRows, 742 791 PS_TYPE_U8); 743 pmReadout *dummyMask = pmReadoutAlloc(NULL, dummyImage, NULL, 0, 0, 1, 1 , 1, 1);792 pmReadout *dummyMask = pmReadoutAlloc(NULL, dummyImage, NULL, 0, 0, 1, 1); 744 793 (void)pmFlatField(inputReadout, dummyMask, flatReadout); 745 794 psFree(dummyMask); … … 771 820 // Write the output 772 821 pmFPAWrite(outputFile, input, database); 773 // pmFPAWriteMask(outputMaskFile, input); 822 pmFPAWriteMask(input, outputFile); 823 pmFPAWriteWeight(input, outputFile); 824 774 825 #ifdef PRODUCTION 775 826 psFitsClose(outputFile);
Note:
See TracChangeset
for help on using the changeset viewer.
