Changeset 41808 for branches/eam_branches/ipp-dev-20210817/psModules
- Timestamp:
- Sep 13, 2021, 6:44:06 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-dev-20210817/psModules/src/detrend/pmPattern.c
r41806 r41808 139 139 // Measurement and application 140 140 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 141 142 // USE_BACKGROUND_STDEV: if true, the analysis will use the measured robust stdev to clip the out-of-range pixles 143 // if false, the stdev will be estimated based on the Poisson statistics of the median (sky level). 144 # define USE_BACKGROUND_STDEV 0 141 145 142 146 bool pmPatternRow(pmReadout *ro, int order, int iter, float rej, float thresh, … … 172 176 } 173 177 174 # if ( 0)178 # if (USE_BACKGROUND_STDEV) 175 179 float lower = stats->robustMedian - thresh * stats->robustStdev; // Lower bound for data 176 180 float upper = stats->robustMedian + thresh * stats->robustStdev; // Upper bound for data 177 181 float background = stats->robustMedian; 178 182 # else 179 180 183 // the signal we are looking for is a small variation on top of the background. if 181 184 // the background is uniform with only read noise + sky noise, then the pixel-to-pixel … … 201 204 # endif 202 205 203 // the expected amplitude of the 2nd order term is 204 // if the predicted sky poisson signal is larger than 205 206 // I want to add a constraint to the fit so the amplitude or coeffs are |value| < x 206 pmCell *cell = ro->parent; 207 const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of cell 208 fprintf (stderr, "pattern row background %s: %f - %f - %f\n", cellName,lower, background, upper); 209 210 211 // XXX add code to skip fit if background stdev is large compared to expected signal 212 // XXX add a constraint to the fit so the |amplitude| < x (x ~ 20 - 25) 207 213 208 214 psFree(stats); … … 217 223 218 224 psStats *clip = psStatsAlloc(clipMean | clipStdev); // Clipping statistics 219 clip->clipIter = iter; 225 // XXX clip->clipIter = iter; 226 clip->clipIter = 1; // XXX skip iteration for a test 220 227 clip->clipSigma = rej; 221 228 psVector *clipMask = psVectorAlloc(numCols, PS_TYPE_VECTOR_MASK); // Mask for clipping … … 259 266 float validXmax = -1; 260 267 268 // XXX can we do just as well fitting 1/3 of the pixels? (NOT REALLY) 269 // (x % 3) || 261 270 for (int x = 0; x < numCols; x++) { 262 if ((mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal) ||263 data->data.F32[x] < lower || data->data.F32[x] > upper) {264 clipMask->data.PS_TYPE_VECTOR_MASK_DATA[x] = 0xFF;271 if ((mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal) || 272 data->data.F32[x] < lower || data->data.F32[x] > upper) { 273 clipMask->data.PS_TYPE_VECTOR_MASK_DATA[x] = 0xFF; 265 274 } else { 266 275 clipMask->data.PS_TYPE_VECTOR_MASK_DATA[x] = 0; … … 271 280 } 272 281 282 // XXX how much time is spent in the fitting 273 283 if (num < validNmin) { 274 284 // Not enough points to fit
Note:
See TracChangeset
for help on using the changeset viewer.
