Changeset 13371 for trunk/ppSub/src/ppSubReadout.c
- Timestamp:
- May 11, 2007, 5:51:36 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ppSub/src/ppSubReadout.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubReadout.c
r13363 r13371 16 16 pmReadout *inRO = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT"); // Input readout 17 17 pmReadout *refRO = pmFPAfileThisReadout(config->files, view, "PPSUB.REF"); // Reference readout 18 #if 0 18 19 pmCell *outCell = pmFPAfileThisCell(config->files, view, "PPSUB.OUTPUT"); // Output cell 19 20 pmReadout *outRO = pmReadoutAlloc(outCell); // Output readout 21 #endif 20 22 21 23 psImage *input = inRO->image; // Input image … … 87 89 psVector *solution = NULL; // Solution to match PSF 88 90 89 for (int i = 0, numRejected = 0; i < iter && numRejected != 0; i++) { 91 int numRejected = -1; // Number of rejected stamps in each iteration 92 for (int i = 0; i < iter && numRejected != 0; i++) { 90 93 stamps = pmSubtractionFindStamps(stamps, refRO->image, stampMask, MASK_BAD, MASK_STAMP, 91 threshold, spacing, footprint);94 threshold, spacing, size + footprint); 92 95 if (!stamps) { 93 96 psError(PS_ERR_UNKNOWN, false, "Unable to find stamps on reference image."); … … 116 119 } 117 120 118 if (!pmSubtractionConvolve(&outRO->image, &outRO->weight, &outRO->mask, 121 psImage *convImage = NULL, *convWeight = NULL, *convMask = NULL; // Convolved images 122 if (!pmSubtractionConvolve(&convImage, &convWeight, &convMask, 119 123 refRO->image, refRO->weight, refRO->mask, 120 124 MASK_BAD, maskBlank, solution, kernels)) { … … 125 129 // Do the subtraction 126 130 if (reverse) { 127 (void)psBinaryOp( outRO->image, outRO->image, "-", inRO->image);131 (void)psBinaryOp(inRO->image, convImage, "-", inRO->image); 128 132 } else { 129 (void)psBinaryOp( outRO->image, inRO->image, "-", outRO->image);133 (void)psBinaryOp(inRO->image, inRO->image, "-", convImage); 130 134 } 131 (void)psBinaryOp(outRO->mask, outRO->mask, "|", inRO->mask); 132 (void)psBinaryOp(outRO->weight, outRO->weight, "+", inRO->weight); 135 (void)psBinaryOp(inRO->mask, convMask, "|", inRO->mask); 136 (void)psBinaryOp(inRO->weight, convWeight, "+", inRO->weight); 137 138 psFree(convImage); 139 psFree(convMask); 140 psFree(convWeight); 133 141 134 142 #if 0 135 143 // Generate image with convolution kernels 136 int fullSize = 2 * size + 1 ;// Full size of kernel144 int fullSize = 2 * size + 1 + 1; // Full size of kernel 137 145 psImage *convKernels = psImageAlloc(5 * fullSize, 5 * fullSize, PS_TYPE_F32); 146 psImageInit(fullSize, NAN); 138 147 for (int j = -2; j <= 2; j++) { 139 148 for (int i = -2; i <= 2; i++) { … … 156 165 157 166 // XXX What do we do with this image? 167 168 psFits *kernelFile = psFitsOpen("kernel.fits", "w"); 169 (void)psFitsWriteImage(kernelFile, NULL, convKernels, 0, NULL); 170 psFitsClose(kernelFile); 171 158 172 psFree(convKernels); 159 173 #endif … … 163 177 psFree(stamps); 164 178 psFree(solution); 165 psFree(outRO);166 179 return true; 167 180 … … 170 183 psFree(stamps); 171 184 psFree(solution); 172 psFree(outRO);173 185 return false; 174 186 }
Note:
See TracChangeset
for help on using the changeset viewer.
