Changeset 7836 for trunk/psModules/src/detrend/pmFringeStats.c
- Timestamp:
- Jul 6, 2006, 5:26:22 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/detrend/pmFringeStats.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmFringeStats.c
r7828 r7836 3 3 * @author Eugene Magnier, IfA 4 4 * 5 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-07-0 6 03:29:28$5 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-07-07 03:26:22 $ 7 7 * 8 8 * Copyright 2004 IfA … … 151 151 psStats *medianSd = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); // Median and SD 152 152 153 // Measure the sky over the image153 // Measure the sky in each smoothing box 154 154 psImage *sky = psImageAlloc(fringe->nX, fringe->nY, PS_TYPE_F32); 155 155 for (int i = 0; i < fringe->nY; i++) { 156 int y0 = (float)i * (float)image->numRows / (float)fringe->nY;157 int y1 = (float)(i + 1) * (float)image->numRows / (float)fringe->nY;156 int y0 = image->row0 + (float)i * (float)image->numRows / (float)fringe->nY; 157 int y1 = image->row0 + (float)(i + 1) * (float)image->numRows / (float)fringe->nY; 158 158 for (int j = 0; j < fringe->nX; j++) { 159 int x0 = (float)j * (float)image->numCols / (float)fringe->nX;160 int x1 = (float)(j + 1) * (float)image->numCols / (float)fringe->nX;159 int x0 = image->col0 + (float)j * (float)image->numCols / (float)fringe->nX; 160 int x1 = image->col0 + (float)(j + 1) * (float)image->numCols / (float)fringe->nX; 161 161 psRegion region = psRegionSet(x0, x1, y0, y1); 162 162 psImage *subImage = psImageSubset(image, region); // Subimage of the sky region 163 psImage *subMask = psImageSubset(mask, region); // Subimage of the sky region 163 psImage *subMask = NULL; 164 if (mask) { 165 subMask = psImageSubset(mask, region); // Subimage of the sky region 166 } 164 167 psImageStats(median, subImage, subMask, maskVal); 165 168 sky->data.F32[i][j] = median->sampleMedian; … … 168 171 169 172 for (int i = 0; i < fringe->x->n; i++) { 170 psRegion region = psRegionSet(xPt[i] - dX, xPt[i] + dX + 1, yPt[i] - dY, yPt[i] + dY + 1); 171 region = psRegionForImage(image, region); 173 psRegion region = psRegionSet(image->col0 + xPt[i] - dX, 174 image->col0 + xPt[i] + dX + 1, 175 image->row0 + yPt[i] - dY, 176 image->row0 + yPt[i] + dY + 1); 172 177 psImage *subImage = psImageSubset(image, region); 173 psImage *subMask = psImageSubset(mask, region); 178 psImage *subMask = NULL; 179 if (mask) { 180 subMask = psImageSubset(mask, region); 181 } 174 182 psImageStats(medianSd, subImage, subMask, maskVal); 175 183 psFree(subImage); … … 220 228 PS_ASSERT_VECTOR_SIZE(df, numRows, false); 221 229 222 if (extname && strlen(extname) > 0) {223 if (!psFitsMoveExtName(fits, extname)) {224 psError(PS_ERR_IO, false, "Unable to move to extension %s\n", extname);225 return false;226 }227 } else if (!psFitsMoveExtNum(fits, 0, false)) {228 psError(PS_ERR_IO, false, "Unable to move to PHU\n");229 return false;230 }231 232 230 // We need to write: 233 231 // Scalars: dX, dY, nX, nY
Note:
See TracChangeset
for help on using the changeset viewer.
